Files
Sycun cfaa95d7bd refactor(runtime): remove Eino and make Pi the sole agent engine
Delete the Eino model adapters, callbacks, middleware, orchestration,
summarization and single-agent runner together with their dependencies.
Chat, batch tasks, workflow Agent nodes and sub-agents now share the Pi
runtime, and dispatch is a single code path instead of an engine switch.

Configuration migrates eino_middleware/eino_skills to runtime/skills and
drops the retired callback settings while old files still load. Settings,
i18n and docs describe Pi only. Also carry the Pi follow-up fixes: empty
required lists are omitted from tool schemas, historical tool results stay
with their call batch, model proxies work over HTTP/1.1, single-query
retrieval skips query expansion, and finalization docs match Pi lifecycle
events.
2026-11-12 17:55:36 +08:00

56 lines
1.8 KiB
Go

package multiagent
import (
"context"
"encoding/json"
"path/filepath"
"testing"
"cyberstrike-ai/internal/agentruntime"
"cyberstrike-ai/internal/config"
"cyberstrike-ai/internal/database"
"go.uber.org/zap"
)
func TestPiPlanBoardRemainsReadableByConversationAPI(t *testing.T) {
dir := t.TempDir()
cfg := &config.Config{SkillsDir: dir}
r := &piRun{cfg: cfg, conversationID: "fixture"}
db, err := database.NewDB(filepath.Join(dir, "fixture.db"), zap.NewNop())
if err != nil {
t.Fatal(err)
}
defer db.Close()
db.SetAgentConversationDirs(filepath.Join(dir, ".pi", "plantask"), "", "", "")
created, err := r.executePiPlan(context.Background(), agentruntime.ToolCall{Name: "TaskCreate", Arguments: map[string]any{"subject": "Collect evidence"}})
if err != nil {
t.Fatal(err)
}
var task map[string]any
if err = json.Unmarshal([]byte(created.Content), &task); err != nil {
t.Fatal(err)
}
_, err = r.executePiPlan(context.Background(), agentruntime.ToolCall{Name: "TaskUpdate", Arguments: map[string]any{"taskId": task["id"], "status": "completed"}})
if err != nil {
t.Fatal(err)
}
tasks, err := db.ListConversationPlanTasks("fixture")
if err != nil {
t.Fatal(err)
}
if len(tasks) != 1 || tasks[0].Status != "completed" || tasks[0].Subject != "Collect evidence" {
t.Fatalf("API lost plan state: %+v", tasks)
}
_, err = r.executePiPlan(context.Background(), agentruntime.ToolCall{Name: "write_todos", Arguments: map[string]any{"todos": []any{map[string]any{"content": "Verify result", "status": "in_progress"}}}})
if err != nil {
t.Fatal(err)
}
tasks, err = db.ListConversationPlanTasks("fixture")
if err != nil {
t.Fatal(err)
}
if len(tasks) != 1 || tasks[0].Subject != "Verify result" || tasks[0].Status != "in_progress" {
t.Fatalf("replacement board incorrect: %+v", tasks)
}
}