Files
CyberStrikeAI/internal/agentruntime/types.go
T
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

86 lines
3.0 KiB
Go

// Package agentruntime defines the host-owned, framework-independent Agent protocol.
package agentruntime
import (
"context"
"encoding/json"
)
const ProtocolVersion = 1
type Model struct {
Provider string `json:"provider"`
API string `json:"api,omitempty"`
ID string `json:"id"`
BaseURL string `json:"baseUrl"`
APIKey string `json:"apiKey"`
Headers map[string]string `json:"headers,omitempty"`
ContextWindow int `json:"contextWindow"`
MaxTokens int `json:"maxTokens"`
Thinking string `json:"thinking,omitempty"`
ExtraFields map[string]any `json:"extraFields,omitempty"`
Compat map[string]any `json:"compat,omitempty"`
InputBudget int `json:"inputBudget,omitempty"`
}
type Tool struct {
Name string `json:"name"`
Description string `json:"description"`
Parameters map[string]any `json:"parameters"`
}
type Request struct {
GenerateOnly bool `json:"generateOnly,omitempty"`
RunID string `json:"runId"`
ConversationID string `json:"conversationId"`
WorkingDir string `json:"workingDir,omitempty"`
SystemPrompt string `json:"systemPrompt"`
Message string `json:"message"`
History json.RawMessage `json:"history,omitempty"`
Model Model `json:"model"`
FallbackModels []Model `json:"fallbackModels,omitempty"`
RetryMax int `json:"retryMax,omitempty"`
RetryMaxDelayMS int `json:"retryMaxDelayMs,omitempty"`
Tools []Tool `json:"tools"`
ToolSearch bool `json:"toolSearch"`
ToolSearchMinTools int `json:"toolSearchMinTools,omitempty"`
AlwaysVisibleTools []string `json:"alwaysVisibleTools,omitempty"`
SessionDir string `json:"sessionDir,omitempty"`
MaxTurns int `json:"maxTurns"`
}
type Event struct {
Type string `json:"type"`
Data json.RawMessage `json:"data,omitempty"`
}
type ToolCall struct {
ID string `json:"id"`
ProviderID string `json:"providerId,omitempty"`
Name string `json:"name"`
Arguments map[string]any `json:"arguments"`
}
type ToolResult struct {
Content string `json:"content"`
IsError bool `json:"isError,omitempty"`
ExecutionID string `json:"executionId,omitempty"`
Terminate bool `json:"terminate,omitempty"`
}
type Result struct {
TotalTokens int `json:"totalTokens,omitempty"`
Response string `json:"response"`
History json.RawMessage `json:"history"`
Status string `json:"status"`
SessionFile string `json:"sessionFile,omitempty"`
Error string `json:"error,omitempty"`
}
type ToolExecutor func(context.Context, ToolCall) (ToolResult, error)
type Control struct {
Steer func(string) error
Cancel func() error
}