Add stage execution limits and result-first workflow views

This commit is contained in:
2026-10-10 03:03:46 +01:00
parent 7b10e3889e
commit a66d540125
35 changed files with 1392 additions and 93 deletions
+28
View File
@@ -0,0 +1,28 @@
package protocol
import (
"encoding/json"
"strings"
"testing"
)
func TestOutputPreviewUsesRetainedValuesWithoutAssumingSchema(t *testing.T) {
for _, test := range []struct {
output map[string]any
want string
}{
{map[string]any{"summary": "Fixed layout\nand added regression checks", "evidence": "details"}, "Fixed layout and added regression checks"},
{map[string]any{"artifacts": []string{"report.md"}}, `artifacts: ["report.md"]`},
{map[string]any{"z": true, "a": json.Number("9007199254740993")}, "a: 9007199254740993"},
{map[string]any{"input": map[string]any{"prompt": "private task"}}, ""},
{nil, ""},
} {
if got := OutputPreview(test.output); got != test.want {
t.Fatal(got, test.want)
}
}
preview := OutputPreview(map[string]any{"summary": strings.Repeat("宽", 500)})
if len([]rune(preview)) != 280 || !strings.HasSuffix(preview, "…") {
t.Fatal("preview is not bounded by characters")
}
}