package workflow import ( "encoding/json" "fmt" "net/http" "os/exec" "testing" "cyberstrike-ai/internal/agentruntime" ) func requirePiRuntime(t *testing.T) { t.Helper() if _, err := exec.LookPath("node"); err != nil { t.Skip("Node not installed") } if _, err := agentruntime.ResolveWorker(""); err != nil { t.Skip("build runtime/pi before Pi integration tests") } } func piTextReply(w http.ResponseWriter, text string) { w.Header().Set("Content-Type", "text/event-stream") for _, choice := range []map[string]any{ {"index": 0, "delta": map[string]any{"role": "assistant", "content": text}, "finish_reason": nil}, {"index": 0, "delta": map[string]any{}, "finish_reason": "stop"}, } { body, _ := json.Marshal(map[string]any{"id": "fixture", "object": "chat.completion.chunk", "model": "fixture", "choices": []any{choice}}) fmt.Fprintf(w, "data: %s\n\n", body) } fmt.Fprint(w, "data: [DONE]\n\n") }