feat(cli)!: add agent-first chat and session ask output modes

This commit is contained in:
coconut-yc
2026-06-21 02:41:36 +08:00
committed by lyingbug
parent 238297e2c5
commit 9437e1ac3c
18 changed files with 1317 additions and 355 deletions
@@ -13,6 +13,9 @@ func TestAgentAccumulator_FinalizesOnlyOnComplete(t *testing.T) {
{ResponseType: sdk.AgentResponseTypeThinking, Content: "think", Done: true},
{ResponseType: sdk.AgentResponseTypeToolCall, ID: "call_1", Content: "search"},
{ResponseType: sdk.AgentResponseTypeReflection, Content: "reflect", Done: true},
{ResponseType: sdk.AgentResponseTypeReferences, KnowledgeReferences: []*sdk.SearchResult{
{ID: "chunk_1", Content: "bulky passage"},
}},
{ResponseType: sdk.AgentResponseTypeAnswer, Content: "final answer", Done: true},
}
for _, event := range preTerminal {
@@ -35,6 +38,9 @@ func TestAgentAccumulator_FinalizesOnlyOnComplete(t *testing.T) {
if len(a.ToolEvents) != 1 {
t.Errorf("tool_events=%d, want 1", len(a.ToolEvents))
}
if len(a.References) != 1 || a.References[0].Content != "bulky passage" {
t.Errorf("references were not preserved: %+v", a.References)
}
a.Append(&sdk.AgentStreamResponse{ResponseType: sdk.AgentResponseTypeAnswer, Content: "late"})
if got := a.Answer(); got != "final answer" {