refactor(agent): Pi 会话运行时 - 接入原生 Agent 与 Skills 工具链

This commit is contained in:
ddcat666 committed 2026-09-29 08:21:11 +08:00
1 parent f9b8c5a43e
commit 387d3562ad
69 files changed
+11460 -207

No files matched your search

@@ -0,0 +1,57 @@
package app
import (
"os"
"path/filepath"
"strings"
"testing"
)
func TestCloudAgentProductionSchedulingDoesNotCallLegacyGoLoop(t *testing.T) {
root := filepath.Join("..", "..")
files := []string{
filepath.Join(root, "internal", "app", "cloud_agent.go"),
filepath.Join(root, "internal", "app", "cloud_agent_runtime.go"),
filepath.Join(root, "internal", "app", "task_worker.go"),
}
for _, file := range files {
body, err := os.ReadFile(file)
if err != nil {
t.Fatal(err)
}
text := string(body)
for _, forbidden := range []string{
"s.advanceCloudAgentByID(",
"s.advanceCloudAgents()",
} {
if strings.Contains(text, forbidden) {
t.Fatalf("production scheduling still calls legacy Go loop: %s in %s", forbidden, file)
}
}
}
}
func TestCloudAgentPiRuntimeContractUsesGovernedStepBridge(t *testing.T) {
root := filepath.Join("..", "..")
coordinator, err := os.ReadFile(filepath.Join(root, "internal", "app", "cloud_agent_pi_coordinator.go"))
if err != nil {
t.Fatal(err)
}
text := string(coordinator)
for _, required := range []string{
"Operation: cloudAgentStepOperation",
"s.enqueueCloudAgentTask(run, &state, req, nil)",
"s.waitCloudAgentTask(ctx, taskID)",
} {
if !strings.Contains(text, required) {
t.Fatalf("Pi governed model bridge contract missing %q", required)
}
}
runtime, err := os.ReadFile(filepath.Join(root, "internal", "agent", "runtime", "runtime.go"))
if err != nil {
t.Fatal(err)
}
if !strings.Contains(string(runtime), "mux.HandleFunc(\"POST /model\"") {
t.Fatal("Pi runtime does not expose the governed /model bridge")
}
}