Help us shape the future of Go! Take the 2026 Go Developer Survey

types

package
v1.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type A2AAgentConfig

type A2AAgentConfig struct {
	Name      string            `json:"name"`
	Endpoint  string            `json:"endpoint"`
	Headers   map[string]string `json:"headers"`
	RiskLevel string            `json:"risk_level"`
}

A2AAgentConfig A2A Agent 配置

type A2AResult

type A2AResult struct {
	AgentName string `json:"agent_name"`
	Status    string `json:"status"`
	Result    any    `json:"result,omitempty"`
	Error     string `json:"error,omitempty"`
}

A2AResult A2A 结果

type AgentRequest

type AgentRequest struct {
	Task    string                 `json:"task"`              // 自然语言任务描述
	Context map[string]any         `json:"context,omitempty"` // 上下文信息(user_id, session_id 等)
	Models  map[string]ModelConfig `json:"models,omitempty"`  // 模型配置(可选,使用内置默认配置)
	Stream  bool                   `json:"stream,omitempty"`  // 是否流式输出
}

AgentRequest Agent 自主执行请求(用于 runner 直接接收自然语言任务)

type AgentResponse

type AgentResponse struct {
	Content      string           `json:"content,omitempty"`
	ToolCalls    []ToolCall       `json:"tool_calls,omitempty"`
	TokensUsed   int              `json:"tokens_used,omitempty"`
	FinishReason string           `json:"finish_reason"`
	Metadata     ResponseMetadata `json:"metadata"`
	Error        string           `json:"error,omitempty"`
}

AgentResponse Agent 自主执行响应

type ApprovalInfo

type ApprovalInfo struct {
	ToolName        string `json:"tool_name"`
	ToolType        string `json:"tool_type"` // http, mcp, skill, a2a
	ArgumentsInJSON string `json:"arguments_in_json"`
	RiskLevel       string `json:"risk_level"`
	Description     string `json:"description"`
}

ApprovalInfo 审批信息,传递给前端

type ApprovalPolicy

type ApprovalPolicy struct {
	Enabled       bool     `json:"enabled"`
	RiskThreshold string   `json:"risk_threshold"` // low, medium, high
	AutoApprove   []string `json:"auto_approve"`   // 白名单,tool names
}

ApprovalPolicy 审批策略

type ApprovalResult

type ApprovalResult struct {
	Approved         bool
	DisapproveReason *string
}

ApprovalResult 审批结果

type CLIConfig

type CLIConfig struct {
	Name      string `json:"name"`       // CLI 名称,如 "lark"
	Command   string `json:"command"`    // CLI 命令,如 "lark-cli"
	ConfigDir string `json:"config_dir"` // Token 配置目录
	SkillsDir string `json:"skills_dir"` // Skills 文件目录
	RiskLevel string `json:"risk_level"` // 风险级别
	AuthType  string `json:"auth_type"`  // 授权类型:none, oauth2_device
}

CLIConfig CLI 工具配置(用于扩展第三方 CLI 如飞书 CLI)

type CapabilityConfig added in v0.1.2

type CapabilityConfig struct {
	ID     string         `json:"id"`
	Config map[string]any `json:"config,omitempty"`
}

type FileConfig

type FileConfig struct {
	Name        string `json:"name"`
	VirtualPath string `json:"virtual_path"` // 虚拟路径,如 /mnt/uploads/session_id/file.md
	Size        int64  `json:"size"`
	Type        string `json:"type"` // mime type
}

FileConfig 文件配置

type InternalAgentConfig

type InternalAgentConfig struct {
	ID     string      `json:"id"`
	Name   string      `json:"name"`
	Prompt string      `json:"prompt"`
	Model  ModelConfig `json:"model"`
}

InternalAgentConfig 内部 Agent 配置

type KnowledgeBaseConfig

type KnowledgeBaseConfig struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	RetrievalURL string `json:"retrieval_url"`
	Token        string `json:"token"`
	TopK         int    `json:"top_k"`
}

KnowledgeBaseConfig 知识库配置

type MCPConfig

type MCPConfig struct {
	Name      string            `json:"name"`
	Transport string            `json:"transport"` // "stdio" 或 "http"
	Command   string            `json:"command"`   // stdio 模式: 启动命令
	Args      []string          `json:"args"`      // stdio 模式: 命令参数
	Env       map[string]string `json:"env"`       // stdio 模式: 环境变量
	Endpoint  string            `json:"endpoint"`  // http 模式: MCP 服务地址
	Headers   map[string]string `json:"headers"`   // http 模式: 请求头
	RiskLevel string            `json:"risk_level"`
}

MCPConfig MCP 服务配置

type MemoryEntry

type MemoryEntry struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Type        string `json:"type"` // user, feedback, project, reference
	Content     string `json:"content"`
	Importance  int    `json:"importance"`
}

MemoryEntry 记忆条目(用于返回给 agent-frame 保存)

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

Message 消息

type ModelConfig

type ModelConfig struct {
	Provider    string         `json:"provider"`
	Name        string         `json:"name"`
	APIKey      string         `json:"api_key"`
	APIBase     string         `json:"api_base"`
	Temperature float64        `json:"temperature"`
	MaxTokens   int            `json:"max_tokens"`
	TopP        float64        `json:"top_p"`
	ExtraFields map[string]any `json:"extra_fields,omitempty"` // 额外参数,如 reasoning_split
}

ModelConfig 模型配置

type ModelRole

type ModelRole string

ModelRole 模型角色,用于多模型路由

const (
	ModelRoleDefault   ModelRole = "default"   // 默认模型,用于主对话
	ModelRoleIntent    ModelRole = "intent"    // 轻量语义意图分类
	ModelRoleRewrite   ModelRole = "rewrite"   // 改写模型,用于query改写
	ModelRoleSkill     ModelRole = "skill"     // 技能模型,用于skill执行
	ModelRoleSummarize ModelRole = "summarize" // 总结模型,用于内容总结
)

type PendingApproval

type PendingApproval struct {
	InterruptID   string `json:"interrupt_id"`
	ToolName      string `json:"tool_name"`
	ToolType      string `json:"tool_type"`
	ArgumentsJSON string `json:"arguments_json"`
	RiskLevel     string `json:"risk_level"`
	Description   string `json:"description"`
}

PendingApproval 待审批信息

type ResponseMetadata

type ResponseMetadata struct {
	Model            string             `json:"model"`
	LatencyMs        int64              `json:"latency_ms"`
	TokensUsed       int                `json:"tokens_used,omitempty"`
	PromptTokens     int                `json:"prompt_tokens,omitempty"`
	CompletionTokens int                `json:"completion_tokens,omitempty"`
	ToolCallsCount   int                `json:"tool_calls_count,omitempty"`
	A2ACallsCount    int                `json:"a2a_calls_count,omitempty"`
	SkillCallsCount  int                `json:"skill_calls_count,omitempty"`
	Iterations       int                `json:"iterations,omitempty"`
	ToolCallsDetail  []ToolCallMetadata `json:"tool_calls_detail,omitempty"`
	Error            string             `json:"error,omitempty"`
}

ResponseMetadata 响应元数据

type ResponseSchemaConfig

type ResponseSchemaConfig struct {
	Type     string         `json:"type"`
	Version  string         `json:"version"`
	Strict   bool           `json:"strict"`
	Schema   map[string]any `json:"schema"`
	Fallback string         `json:"fallback"`
}

ResponseSchemaConfig 响应格式配置

type ResumeApproval

type ResumeApproval struct {
	InterruptID      string  `json:"interrupt_id"`
	Approved         bool    `json:"approved"`
	DisapproveReason *string `json:"disapprove_reason,omitempty"`
}

ResumeApproval 单个审批结果

type ResumeRequest

type ResumeRequest struct {
	CheckPointID string           `json:"checkpoint_id"`
	Approvals    []ResumeApproval `json:"approvals"`
}

ResumeRequest resume 请求

type ResumeResponse

type ResumeResponse struct {
	Success      bool             `json:"success"`
	Error        string           `json:"error,omitempty"`
	FinishReason string           `json:"finish_reason"`
	Content      string           `json:"content,omitempty"`
	ToolCalls    []ToolCall       `json:"tool_calls,omitempty"`
	Metadata     ResponseMetadata `json:"metadata"`
}

ResumeResponse resume 响应

type RetryConfig

type RetryConfig struct {
	MaxAttempts       int      `json:"max_attempts"`
	InitialDelayMs    int      `json:"initial_delay_ms"`
	MaxDelayMs        int      `json:"max_delay_ms"`
	BackoffMultiplier float64  `json:"backoff_multiplier"`
	RetryableErrors   []string `json:"retryable_errors"`
	// 熔断器配置
	CircuitBreakerThreshold  int `json:"circuit_breaker_threshold"`   // 连续失败次数阈值,达到后熔断
	CircuitBreakerDurationMs int `json:"circuit_breaker_duration_ms"` // 熔断持续时间
}

RetryConfig 重试配置

type RoutingConfig

type RoutingConfig struct {
	// DefaultModel 默认使用的模型角色
	DefaultModel ModelRole `json:"default_model"`
	// RewritePrompt 改写使用的提示词模板
	RewritePrompt string `json:"rewrite_prompt"`
	// SummarizePrompt 总结使用的提示词模板
	SummarizePrompt string `json:"summarize_prompt"`
}

RoutingConfig 多模型路由配置

type RunOptions

type RunOptions struct {
	Temperature    float64               `json:"temperature"`
	MaxTokens      int                   `json:"max_tokens"`
	Stream         bool                  `json:"stream"`
	TopP           float64               `json:"top_p"`
	Stop           []string              `json:"stop"`
	TimeoutMs      int                   `json:"timeout_ms"`
	MaxIterations  int                   `json:"max_iterations"`
	MaxToolCalls   int                   `json:"max_tool_calls"`
	MaxA2ACalls    int                   `json:"max_a2a_calls"`
	MaxTotalTokens int                   `json:"max_total_tokens"`
	Retry          *RetryConfig          `json:"retry"`
	ResponseSchema *ResponseSchemaConfig `json:"response_schema"`
	Routing        *RoutingConfig        `json:"routing"`
	ApprovalPolicy *ApprovalPolicy       `json:"approval_policy"`
	CheckPointID   string                `json:"checkpoint_id"`
}

RunOptions 运行选项

type RunRequest

type RunRequest struct {
	Prompt         string                 `json:"prompt"`
	Models         map[string]ModelConfig `json:"models"`
	Messages       []Message              `json:"messages"`
	Context        map[string]any         `json:"context"`
	KnowledgeBases []KnowledgeBaseConfig  `json:"knowledge_bases"` // 知识库配置(用于运行时检索)
	Skills         []Skill                `json:"skills"`
	MCPs           []MCPConfig            `json:"mcps"`
	CLIs           []CLIConfig            `json:"clis"` // CLI 工具配置(如飞书 CLI)
	A2A            []A2AAgentConfig       `json:"a2a"`
	Capabilities   []CapabilityConfig     `json:"capabilities,omitempty"`
	InternalAgents []InternalAgentConfig  `json:"internal_agents"`
	SubAgents      []SubAgentConfig       `json:"sub_agents"` // Sub-Agent 配置列表
	Options        *RunOptions            `json:"options"`
	Sandbox        *SandboxConfig         `json:"sandbox"`
	Files          []FileConfig           `json:"files"` // 上传的文件列表
	VisualInputs   []VisualInput          `json:"visual_inputs,omitempty"`
}

RunRequest 运行请求

type RunResponse

type RunResponse struct {
	Content          string            `json:"content,omitempty"`
	ToolCalls        []ToolCall        `json:"tool_calls,omitempty"`
	A2AResults       []A2AResult       `json:"a2a_results,omitempty"`
	TokensUsed       int               `json:"tokens_used,omitempty"`
	FinishReason     string            `json:"finish_reason"`
	Metadata         ResponseMetadata  `json:"metadata"`
	A2UIMessages     []json.RawMessage `json:"a2ui_messages,omitempty"`
	PendingApprovals []PendingApproval `json:"pending_approvals,omitempty"`
	CheckPointID     string            `json:"checkpoint_id,omitempty"`
	Memories         []MemoryEntry     `json:"memories,omitempty"` // 提取的记忆,供 agent-frame 保存
}

RunResponse 运行响应

type SandboxConfig

type SandboxConfig struct {
	Enabled   bool              `json:"enabled"`
	Mode      string            `json:"mode"`
	Image     string            `json:"image"`
	Workdir   string            `json:"workdir"`
	Network   string            `json:"network"`
	TimeoutMs int               `json:"timeout_ms"`
	Env       map[string]string `json:"env"`
	Limits    *SandboxLimits    `json:"limits"`
	Volumes   []VolumeMount     `json:"volumes"` // 额外挂载的卷
}

SandboxConfig 沙箱配置

type SandboxLimits

type SandboxLimits struct {
	CPU    string `json:"cpu"`    // e.g., "0.5" (0.5 cores), "2" (2 cores)
	Memory string `json:"memory"` // e.g., "512m", "1g", "256M"
}

SandboxLimits 沙箱资源限制

type Skill

type Skill struct {
	ID string `json:"id"`
	// 以下字段由 SKILL.md 定义,runner 自动加载
	Name        string   `json:",omitempty"`
	Description string   `json:",omitempty"`
	Instruction string   `json:",omitempty"`
	Scope       string   `json:",omitempty"`
	Trigger     string   `json:",omitempty"`
	EntryScript string   `json:",omitempty"`
	FilePath    string   `json:",omitempty"`
	Inputs      []string `json:",omitempty"`
	Outputs     []string `json:",omitempty"`
	RiskLevel   string   `json:"risk_level,omitempty"`
	// OutputPatterns 指定脚本执行后要提取的文件模式(支持 glob 匹配)
	// 例如:["templates/*.html", "outputs/*.json"]
	OutputPatterns []string `json:"output_patterns,omitempty"`
}

Skill 技能配置

type SkillOutputFile

type SkillOutputFile struct {
	Name   string `json:"name"`
	Base64 string `json:"base64"`
	Mime   string `json:"mime,omitempty"`
}

SkillOutputFile Skill 输出文件(用于存储提取的文件内容)

type SubAgentConfig

type SubAgentConfig struct {
	ID            string       `json:"id"`
	Name          string       `json:"name"`
	Description   string       `json:"description"`
	Prompt        string       `json:"prompt"`
	Model         *ModelConfig `json:"model,omitempty"`
	Capabilities  []string     `json:"capabilities,omitempty"`
	Skills        []Skill      `json:"skills,omitempty"`
	MaxIterations int          `json:"max_iterations"`
	TimeoutMs     int          `json:"timeout_ms"`
}

SubAgentConfig is a minimal local stand-in for the reference runner's subagent.SubAgentConfig. It is intentionally trimmed: only the fields needed so that RunRequest remains self-contained without importing the heavy subagent package. Extend as needed when the subagent package is migrated.

type ToolCall

type ToolCall struct {
	Tool   string `json:"tool"`
	Input  any    `json:"input"`
	Output any    `json:"output"`
}

ToolCall 工具调用

type ToolCallMetadata

type ToolCallMetadata struct {
	Tool      string `json:"tool"`
	Input     any    `json:"input"`
	Output    any    `json:"output"`
	LatencyMs int64  `json:"latency_ms"`
	Success   bool   `json:"success"`
	Error     string `json:"error,omitempty"`
}

ToolCallMetadata 工具调用元数据

type VisualInput added in v0.1.4

type VisualInput struct {
	ID       string `json:"id"`
	MIMEType string `json:"mime_type"`
	Data     []byte `json:"data"`
	SHA256   string `json:"sha256"`
	Purpose  string `json:"purpose,omitempty"`
	Detail   string `json:"detail,omitempty"`
}

type VolumeMount

type VolumeMount struct {
	HostPath      string `json:"host_path"`      // 宿主机路径
	ContainerPath string `json:"container_path"` // 容器内路径
	ReadOnly      bool   `json:"read_only"`      // 是否只读
}

VolumeMount 卷挂载配置

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL