handlers

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentHandler

type AgentHandler struct {
	// contains filtered or unexported fields
}

AgentHandler handles agent-related requests

func NewAgentHandler

func NewAgentHandler(st store.Store, deps *agent.Dependencies) *AgentHandler

NewAgentHandler creates a new AgentHandler

func (*AgentHandler) Chat

func (h *AgentHandler) Chat(c *gin.Context)

Chat handles chat requests

func (*AgentHandler) Create

func (h *AgentHandler) Create(c *gin.Context)

Create creates a new agent

func (*AgentHandler) Delete

func (h *AgentHandler) Delete(c *gin.Context)

Delete deletes an agent

func (*AgentHandler) Get

func (h *AgentHandler) Get(c *gin.Context)

Get retrieves a single agent

func (*AgentHandler) GetStats

func (h *AgentHandler) GetStats(c *gin.Context)

GetStats retrieves agent statistics

func (*AgentHandler) GetStatus added in v0.14.0

func (h *AgentHandler) GetStatus(c *gin.Context)

GetStatus retrieves agent status

func (*AgentHandler) List

func (h *AgentHandler) List(c *gin.Context)

List lists all agents

func (*AgentHandler) Resume added in v0.14.0

func (h *AgentHandler) Resume(c *gin.Context)

Resume resumes an agent from storage

func (*AgentHandler) Run added in v0.14.0

func (h *AgentHandler) Run(c *gin.Context)

Run runs an agent with a message

func (*AgentHandler) Send added in v0.14.0

func (h *AgentHandler) Send(c *gin.Context)

Send sends a message to an agent

func (*AgentHandler) StreamChat

func (h *AgentHandler) StreamChat(c *gin.Context)

StreamChat handles streaming chat requests

func (*AgentHandler) Update

func (h *AgentHandler) Update(c *gin.Context)

Update updates an agent

type AgentRecord

type AgentRecord struct {
	ID        string             `json:"id"`
	Config    *types.AgentConfig `json:"config"`
	Status    string             `json:"status"` // active, disabled, archived
	CreatedAt time.Time          `json:"created_at"`
	UpdatedAt time.Time          `json:"updated_at"`
	Metadata  map[string]any     `json:"metadata,omitempty"`
}

AgentRecord Agent 持久化记录

type BenchmarkRecord

type BenchmarkRecord struct {
	ID        string               `json:"id"`
	Name      string               `json:"name"`
	Runs      int                  `json:"runs"`
	Results   []map[string]float64 `json:"results,omitempty"`
	Summary   map[string]any       `json:"summary,omitempty"`
	CreatedAt time.Time            `json:"created_at"`
}

BenchmarkRecord 基准测试记录

type CheckpointRecord

type CheckpointRecord struct {
	ID        string        `json:"id"`
	SessionID string        `json:"session_id"`
	Snapshot  SessionRecord `json:"snapshot"`
	CreatedAt time.Time     `json:"created_at"`
	Label     string        `json:"label,omitempty"`
}

CheckpointRecord Checkpoint 记录

type DashboardEventConnection added in v0.32.0

type DashboardEventConnection struct {
	ID   string
	Conn *websocket.Conn
	Send chan []byte
	// contains filtered or unexported fields
}

DashboardEventConnection represents a single dashboard WebSocket connection

type DashboardEventHandler added in v0.32.0

type DashboardEventHandler struct {
	// contains filtered or unexported fields
}

DashboardEventHandler handles WebSocket connections for dashboard event streaming

func NewDashboardEventHandler added in v0.32.0

func NewDashboardEventHandler(registry *RuntimeAgentRegistry) *DashboardEventHandler

NewDashboardEventHandler creates a new DashboardEventHandler

func (*DashboardEventHandler) BroadcastEvent added in v0.32.0

func (h *DashboardEventHandler) BroadcastEvent(msgType string, payload any)

BroadcastEvent broadcasts an event to all connected dashboard clients

func (*DashboardEventHandler) GetStats added in v0.32.0

func (h *DashboardEventHandler) GetStats(c *gin.Context)

GetStats returns dashboard WebSocket statistics

func (*DashboardEventHandler) HandleEventStream added in v0.32.0

func (h *DashboardEventHandler) HandleEventStream(c *gin.Context)

HandleEventStream handles WebSocket upgrade for event streaming

type DashboardHandler added in v0.32.0

type DashboardHandler struct {
	// contains filtered or unexported fields
}

DashboardHandler handles dashboard-related requests

func NewDashboardHandler added in v0.32.0

func NewDashboardHandler(st store.Store) *DashboardHandler

NewDashboardHandler creates a new DashboardHandler

func NewDashboardHandlerWithRegistry added in v0.32.0

func NewDashboardHandlerWithRegistry(registry *RuntimeAgentRegistry, st store.Store) *DashboardHandler

NewDashboardHandlerWithRegistry creates a new DashboardHandler with RuntimeAgentRegistry

func (*DashboardHandler) GetCosts added in v0.32.0

func (h *DashboardHandler) GetCosts(c *gin.Context)

GetCosts returns cost breakdown

func (*DashboardHandler) GetEventsSince added in v0.32.0

func (h *DashboardHandler) GetEventsSince(c *gin.Context)

GetEventsSince returns events since a cursor

func (*DashboardHandler) GetInsights added in v0.32.0

func (h *DashboardHandler) GetInsights(c *gin.Context)

GetInsights returns improvement insights

func (*DashboardHandler) GetOverview added in v0.32.0

func (h *DashboardHandler) GetOverview(c *gin.Context)

GetOverview returns overview statistics

func (*DashboardHandler) GetPerformance added in v0.32.0

func (h *DashboardHandler) GetPerformance(c *gin.Context)

GetPerformance returns performance statistics

func (*DashboardHandler) GetPricing added in v0.32.0

func (h *DashboardHandler) GetPricing(c *gin.Context)

GetPricing returns model pricing information

func (*DashboardHandler) GetRecentEvents added in v0.32.0

func (h *DashboardHandler) GetRecentEvents(c *gin.Context)

GetRecentEvents returns recent events from the timeline

func (*DashboardHandler) GetSession added in v0.32.0

func (h *DashboardHandler) GetSession(c *gin.Context)

GetSession returns detailed session info

func (*DashboardHandler) GetTokenUsage added in v0.32.0

func (h *DashboardHandler) GetTokenUsage(c *gin.Context)

GetTokenUsage returns token usage statistics

func (*DashboardHandler) GetTrace added in v0.32.0

func (h *DashboardHandler) GetTrace(c *gin.Context)

GetTrace returns a specific trace detail

func (*DashboardHandler) ListSessions added in v0.32.0

func (h *DashboardHandler) ListSessions(c *gin.Context)

ListSessions returns a list of sessions for the dashboard

func (*DashboardHandler) ListTraces added in v0.32.0

func (h *DashboardHandler) ListTraces(c *gin.Context)

ListTraces returns a list of traces

func (*DashboardHandler) UpdatePricing added in v0.32.0

func (h *DashboardHandler) UpdatePricing(c *gin.Context)

UpdatePricing updates model pricing (for custom pricing)

type EvalHandler

type EvalHandler struct {
	// contains filtered or unexported fields
}

EvalHandler handles evaluation-related requests

func NewEvalHandler

func NewEvalHandler(st store.Store) *EvalHandler

NewEvalHandler creates a new EvalHandler

func (*EvalHandler) CreateBenchmark

func (h *EvalHandler) CreateBenchmark(c *gin.Context)

CreateBenchmark creates a benchmark

func (*EvalHandler) DeleteBenchmark

func (h *EvalHandler) DeleteBenchmark(c *gin.Context)

DeleteBenchmark deletes a benchmark

func (*EvalHandler) DeleteEval

func (h *EvalHandler) DeleteEval(c *gin.Context)

DeleteEval deletes an evaluation

func (*EvalHandler) GetBenchmark

func (h *EvalHandler) GetBenchmark(c *gin.Context)

GetBenchmark retrieves a single benchmark

func (*EvalHandler) GetEval

func (h *EvalHandler) GetEval(c *gin.Context)

GetEval retrieves a single evaluation

func (*EvalHandler) ListBenchmarks

func (h *EvalHandler) ListBenchmarks(c *gin.Context)

ListBenchmarks lists all benchmarks

func (*EvalHandler) ListEvals

func (h *EvalHandler) ListEvals(c *gin.Context)

ListEvals lists all evaluations

func (*EvalHandler) RunBatchEval

func (h *EvalHandler) RunBatchEval(c *gin.Context)

RunBatchEval runs batch evaluation

func (*EvalHandler) RunBenchmark

func (h *EvalHandler) RunBenchmark(c *gin.Context)

RunBenchmark runs a benchmark

func (*EvalHandler) RunCustomEval

func (h *EvalHandler) RunCustomEval(c *gin.Context)

RunCustomEval runs custom evaluation

func (*EvalHandler) RunSessionEval

func (h *EvalHandler) RunSessionEval(c *gin.Context)

RunSessionEval runs session evaluation

func (*EvalHandler) RunTextEval

func (h *EvalHandler) RunTextEval(c *gin.Context)

RunTextEval runs text evaluation

type EvalRecord

type EvalRecord struct {
	ID          string             `json:"id"`
	Name        string             `json:"name"`
	Type        string             `json:"type"`   // text, session, batch, benchmark
	Status      string             `json:"status"` // pending, running, completed, failed
	Input       map[string]any     `json:"input,omitempty"`
	Output      map[string]any     `json:"output,omitempty"`
	Metrics     map[string]float64 `json:"metrics,omitempty"`
	Score       float64            `json:"score,omitempty"`
	StartedAt   time.Time          `json:"started_at"`
	CompletedAt *time.Time         `json:"completed_at,omitempty"`
	Duration    int64              `json:"duration,omitempty"` // milliseconds
	Error       string             `json:"error,omitempty"`
	Metadata    map[string]any     `json:"metadata,omitempty"`
}

EvalRecord 评估记录

type EventPayload added in v0.32.0

type EventPayload struct {
	AgentID  string                   `json:"agent_id"`
	Envelope types.AgentEventEnvelope `json:"envelope"`
}

EventPayload 事件消息的 Payload

type EventStreamFilters added in v0.32.0

type EventStreamFilters struct {
	Channels   []string `json:"channels"`    // ["progress", "control", "monitor"]
	EventTypes []string `json:"event_types"` // ["token_usage", "tool_executed", "error"]
	AgentIDs   []string `json:"agent_ids"`   // Filter by specific agent IDs
	MinLevel   string   `json:"min_level"`   // "debug", "info", "warn", "error"
}

EventStreamFilters defines filtering options for event streaming

type EventStreamMessage added in v0.32.0

type EventStreamMessage struct {
	Type    string `json:"type"`
	Payload any    `json:"payload"`
}

EventStreamMessage represents a message sent over the event stream WebSocket

type EventStreamSubscribeRequest added in v0.32.0

type EventStreamSubscribeRequest struct {
	Action  string              `json:"action"`  // "subscribe", "unsubscribe"
	Filters *EventStreamFilters `json:"filters"` // Filtering options
}

EventStreamSubscribeRequest represents a subscription request

type ExecutionLog

type ExecutionLog struct {
	Timestamp time.Time      `json:"timestamp"`
	Level     string         `json:"level"` // info, warn, error
	StepID    string         `json:"step_id,omitempty"`
	Message   string         `json:"message"`
	Data      map[string]any `json:"data,omitempty"`
}

ExecutionLog 执行日志

type HITLDecision added in v0.19.0

type HITLDecision struct {
	RequestID   string         `json:"request_id"`
	Decision    string         `json:"decision"` // approve, reject, edit
	EditedInput map[string]any `json:"edited_input,omitempty"`
	Reason      string         `json:"reason,omitempty"`
	DecidedAt   time.Time      `json:"decided_at"`
}

HITLDecision 审批决策

type HITLManager added in v0.19.0

type HITLManager struct {
	// contains filtered or unexported fields
}

HITLManager 管理 Human-in-the-Loop 审批流程

func NewHITLManager added in v0.19.0

func NewHITLManager(wsHandler *WebSocketHandler) *HITLManager

NewHITLManager 创建 HITL 管理器

func (*HITLManager) CancelPendingRequests added in v0.19.0

func (m *HITLManager) CancelPendingRequests(connID string)

CancelPendingRequests 取消指定连接的所有待审批请求

func (*HITLManager) CreateApprovalHandler added in v0.19.0

func (m *HITLManager) CreateApprovalHandler(connID string) middleware.ApprovalHandler

CreateApprovalHandler 创建用于 HITL 中间件的审批处理器

func (*HITLManager) GetPendingRequests added in v0.19.0

func (m *HITLManager) GetPendingRequests() []*HITLRequest

GetPendingRequests 获取待审批请求列表

func (*HITLManager) GetPendingRequestsForConn added in v0.19.0

func (m *HITLManager) GetPendingRequestsForConn(connID string) []*HITLRequest

GetPendingRequestsForConn 获取指定连接的待审批请求

func (*HITLManager) HandleDecision added in v0.19.0

func (m *HITLManager) HandleDecision(requestID string, decision string, editedInput map[string]any, reason string) error

HandleDecision 处理前端发来的审批决策

type HITLRequest added in v0.19.0

type HITLRequest struct {
	ID         string         `json:"id"`
	ToolCallID string         `json:"tool_call_id"`
	ToolName   string         `json:"tool_name"`
	ToolInput  map[string]any `json:"tool_input"`
	Message    string         `json:"message"`
	CreatedAt  time.Time      `json:"created_at"`
	AgentID    string         `json:"agent_id"`
	ConnID     string         `json:"conn_id"` // WebSocket 连接 ID
}

HITLRequest 审批请求

type LogRecord

type LogRecord struct {
	ID        string         `json:"id"`
	Level     string         `json:"level"` // debug, info, warn, error
	Message   string         `json:"message"`
	Source    string         `json:"source,omitempty"`
	Timestamp time.Time      `json:"timestamp"`
	Metadata  map[string]any `json:"metadata,omitempty"`
}

LogRecord 日志记录

type MCPHandler

type MCPHandler struct {
	// contains filtered or unexported fields
}

MCPHandler handles MCP-related requests

func NewMCPHandler

func NewMCPHandler(st store.Store) *MCPHandler

NewMCPHandler creates a new MCPHandler

func (*MCPHandler) Connect

func (h *MCPHandler) Connect(c *gin.Context)

Connect connects to an MCP server (start)

func (*MCPHandler) Create

func (h *MCPHandler) Create(c *gin.Context)

Create creates a new MCP server

func (*MCPHandler) Delete

func (h *MCPHandler) Delete(c *gin.Context)

Delete deletes an MCP server

func (*MCPHandler) Disconnect

func (h *MCPHandler) Disconnect(c *gin.Context)

Disconnect disconnects from an MCP server (stop)

func (*MCPHandler) Get

func (h *MCPHandler) Get(c *gin.Context)

Get retrieves a single MCP server

func (*MCPHandler) List

func (h *MCPHandler) List(c *gin.Context)

List lists all MCP servers

func (*MCPHandler) Update

func (h *MCPHandler) Update(c *gin.Context)

Update updates an MCP server

type MCPServerRecord

type MCPServerRecord struct {
	ID        string         `json:"id"`
	Name      string         `json:"name"`
	Type      string         `json:"type"` // stdio, sse, http
	Command   string         `json:"command,omitempty"`
	Args      []string       `json:"args,omitempty"`
	Config    map[string]any `json:"config,omitempty"`
	Status    string         `json:"status"` // stopped, running, error
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	Metadata  map[string]any `json:"metadata,omitempty"`
}

MCPServerRecord MCP 服务器记录

type MemoryHandler

type MemoryHandler struct {
	// contains filtered or unexported fields
}

MemoryHandler handles memory-related requests

func NewMemoryHandler

func NewMemoryHandler(st store.Store) *MemoryHandler

NewMemoryHandler creates a new MemoryHandler

func (*MemoryHandler) ClearWorkingMemory

func (h *MemoryHandler) ClearWorkingMemory(c *gin.Context)

ClearWorkingMemory clears working memory

func (*MemoryHandler) ConsolidateMemory

func (h *MemoryHandler) ConsolidateMemory(c *gin.Context)

ConsolidateMemory consolidates memory

func (*MemoryHandler) CreateSemanticMemory

func (h *MemoryHandler) CreateSemanticMemory(c *gin.Context)

CreateSemanticMemory creates semantic memory

func (*MemoryHandler) CreateWorkingMemory

func (h *MemoryHandler) CreateWorkingMemory(c *gin.Context)

CreateWorkingMemory creates working memory

func (*MemoryHandler) DeleteWorkingMemory

func (h *MemoryHandler) DeleteWorkingMemory(c *gin.Context)

DeleteWorkingMemory deletes working memory

func (*MemoryHandler) GetProvenance

func (h *MemoryHandler) GetProvenance(c *gin.Context)

GetProvenance gets memory provenance

func (*MemoryHandler) GetWorkingMemory

func (h *MemoryHandler) GetWorkingMemory(c *gin.Context)

GetWorkingMemory gets a single working memory

func (*MemoryHandler) ListWorkingMemory

func (h *MemoryHandler) ListWorkingMemory(c *gin.Context)

ListWorkingMemory lists working memory

func (*MemoryHandler) SearchSemanticMemory

func (h *MemoryHandler) SearchSemanticMemory(c *gin.Context)

SearchSemanticMemory searches semantic memory

func (*MemoryHandler) UpdateWorkingMemory

func (h *MemoryHandler) UpdateWorkingMemory(c *gin.Context)

UpdateWorkingMemory updates working memory

type MessageSummary added in v0.32.0

type MessageSummary struct {
	ID        string         `json:"id,omitempty"`
	Role      string         `json:"role"`
	Content   string         `json:"content"`
	Timestamp time.Time      `json:"timestamp"`
	Metadata  map[string]any `json:"metadata,omitempty"`
}

MessageSummary represents a message in the session

type MetricRecord

type MetricRecord struct {
	ID        string            `json:"id"`
	Name      string            `json:"name"`
	Type      string            `json:"type"` // counter, gauge, histogram
	Value     float64           `json:"value"`
	Tags      map[string]string `json:"tags,omitempty"`
	Timestamp time.Time         `json:"timestamp"`
	Metadata  map[string]any    `json:"metadata,omitempty"`
}

MetricRecord 指标记录

type MiddlewareHandler added in v0.11.1

type MiddlewareHandler struct {
	// contains filtered or unexported fields
}

MiddlewareHandler 中间件处理器

func NewMiddlewareHandler added in v0.11.1

func NewMiddlewareHandler(st store.Store) *MiddlewareHandler

NewMiddlewareHandler 创建中间件处理器

func (*MiddlewareHandler) Create added in v0.11.1

func (h *MiddlewareHandler) Create(c *gin.Context)

Create 创建中间件

func (*MiddlewareHandler) Delete added in v0.11.1

func (h *MiddlewareHandler) Delete(c *gin.Context)

Delete 删除中间件

func (*MiddlewareHandler) Disable added in v0.11.1

func (h *MiddlewareHandler) Disable(c *gin.Context)

Disable 禁用中间件

func (*MiddlewareHandler) Enable added in v0.11.1

func (h *MiddlewareHandler) Enable(c *gin.Context)

Enable 启用中间件

func (*MiddlewareHandler) Get added in v0.11.1

func (h *MiddlewareHandler) Get(c *gin.Context)

Get 获取中间件

func (*MiddlewareHandler) GetInfo added in v0.11.1

func (h *MiddlewareHandler) GetInfo(c *gin.Context)

GetInfo 获取信息

func (*MiddlewareHandler) GetStats added in v0.11.1

func (h *MiddlewareHandler) GetStats(c *gin.Context)

GetStats 获取统计

func (*MiddlewareHandler) Install added in v0.11.1

func (h *MiddlewareHandler) Install(c *gin.Context)

Install 安装中间件

func (*MiddlewareHandler) List added in v0.11.1

func (h *MiddlewareHandler) List(c *gin.Context)

List 列出中间件

func (*MiddlewareHandler) ListRegistry added in v0.11.1

func (h *MiddlewareHandler) ListRegistry(c *gin.Context)

ListRegistry 列出注册表

func (*MiddlewareHandler) Reload added in v0.11.1

func (h *MiddlewareHandler) Reload(c *gin.Context)

Reload 重新加载中间件

func (*MiddlewareHandler) ReloadAll added in v0.11.1

func (h *MiddlewareHandler) ReloadAll(c *gin.Context)

ReloadAll 重新加载所有

func (*MiddlewareHandler) Uninstall added in v0.11.1

func (h *MiddlewareHandler) Uninstall(c *gin.Context)

Uninstall 卸载中间件

func (*MiddlewareHandler) Update added in v0.11.1

func (h *MiddlewareHandler) Update(c *gin.Context)

Update 更新中间件

type MiddlewareRecord added in v0.11.1

type MiddlewareRecord struct {
	ID          string         `json:"id"`
	Name        string         `json:"name"`
	Type        string         `json:"type"` // builtin, custom
	Description string         `json:"description,omitempty"`
	Config      map[string]any `json:"config,omitempty"`
	Enabled     bool           `json:"enabled"`
	Priority    int            `json:"priority"` // 执行顺序
	CreatedAt   time.Time      `json:"created_at"`
	UpdatedAt   time.Time      `json:"updated_at"`
	Metadata    map[string]any `json:"metadata,omitempty"`
}

MiddlewareRecord 中间件记录

type PoolHandler added in v0.15.0

type PoolHandler struct {
	// contains filtered or unexported fields
}

PoolHandler handles pool-related requests

func NewPoolHandler added in v0.15.0

func NewPoolHandler(st store.Store, deps *agent.Dependencies) *PoolHandler

NewPoolHandler creates a new PoolHandler

func (*PoolHandler) CreateAgent added in v0.15.0

func (h *PoolHandler) CreateAgent(c *gin.Context)

CreateAgent creates a new agent in the pool

func (*PoolHandler) GetAgent added in v0.15.0

func (h *PoolHandler) GetAgent(c *gin.Context)

GetAgent retrieves a single agent from the pool

func (*PoolHandler) GetStats added in v0.15.0

func (h *PoolHandler) GetStats(c *gin.Context)

GetStats retrieves pool statistics

func (*PoolHandler) ListAgents added in v0.15.0

func (h *PoolHandler) ListAgents(c *gin.Context)

ListAgents lists all agents in the pool

func (*PoolHandler) RemoveAgent added in v0.15.0

func (h *PoolHandler) RemoveAgent(c *gin.Context)

RemoveAgent removes an agent from the pool

func (*PoolHandler) ResumeAgent added in v0.15.0

func (h *PoolHandler) ResumeAgent(c *gin.Context)

ResumeAgent resumes an agent from storage

type ProvenanceRecord

type ProvenanceRecord struct {
	ID         string         `json:"id"`
	EntityType string         `json:"entity_type"`
	EntityID   string         `json:"entity_id"`
	Operation  string         `json:"operation"`
	Actor      string         `json:"actor,omitempty"`
	Timestamp  time.Time      `json:"timestamp"`
	Changes    map[string]any `json:"changes,omitempty"`
	Metadata   map[string]any `json:"metadata,omitempty"`
}

ProvenanceRecord Provenance 溯源记录

type RegisterPayload added in v0.32.0

type RegisterPayload struct {
	AgentID    string         `json:"agent_id"`
	TemplateID string         `json:"template_id"`
	Metadata   map[string]any `json:"metadata"`
}

RegisterPayload 注册消息的 Payload

type RegisterSessionPayload added in v0.32.0

type RegisterSessionPayload struct {
	SessionID    string         `json:"session_id"`
	AgentID      string         `json:"agent_id"`
	Status       string         `json:"status"`
	MessageCount int            `json:"message_count"`
	Metadata     map[string]any `json:"metadata"`
}

RegisterSessionPayload 注册 Session 消息的 Payload

type RegistryEventListener added in v0.32.0

type RegistryEventListener func(agentID string, ag *agent.Agent, registered bool)

RegistryEventListener is called when agents are registered/unregistered

type RemoteAgentEventListener added in v0.32.0

type RemoteAgentEventListener func(agentID string, ra *agent.RemoteAgent, registered bool)

RemoteAgentEventListener is called when remote agents are registered/unregistered

type RemoteAgentHandler added in v0.32.0

type RemoteAgentHandler struct {
	// contains filtered or unexported fields
}

RemoteAgentHandler 处理远程 Agent 的 WebSocket 连接

func NewRemoteAgentHandler added in v0.32.0

func NewRemoteAgentHandler(registry *RuntimeAgentRegistry, st store.Store) *RemoteAgentHandler

NewRemoteAgentHandler 创建 RemoteAgentHandler

func (*RemoteAgentHandler) GetStats added in v0.32.0

func (h *RemoteAgentHandler) GetStats(c *gin.Context)

GetStats 返回统计信息

func (*RemoteAgentHandler) HandleConnect added in v0.32.0

func (h *RemoteAgentHandler) HandleConnect(c *gin.Context)

HandleConnect 处理 WebSocket 连接

type RemoteAgentMessage added in v0.32.0

type RemoteAgentMessage struct {
	Type    string          `json:"type"`    // "register", "event", "unregister", "ping"
	Payload json.RawMessage `json:"payload"` // 根据 Type 解析不同的 Payload
}

RemoteAgentMessage 远程 Agent 消息

type RoomHandler added in v0.15.0

type RoomHandler struct {
	// contains filtered or unexported fields
}

RoomHandler handles room-related requests

func NewRoomHandler added in v0.15.0

func NewRoomHandler(st store.Store, pool *core.Pool) *RoomHandler

NewRoomHandler creates a new RoomHandler

func (*RoomHandler) Create added in v0.15.0

func (h *RoomHandler) Create(c *gin.Context)

Create creates a new room

func (*RoomHandler) Delete added in v0.15.0

func (h *RoomHandler) Delete(c *gin.Context)

Delete deletes a room

func (*RoomHandler) Get added in v0.15.0

func (h *RoomHandler) Get(c *gin.Context)

Get retrieves a single room

func (*RoomHandler) GetHistory added in v0.15.0

func (h *RoomHandler) GetHistory(c *gin.Context)

GetHistory retrieves room message history

func (*RoomHandler) GetMembers added in v0.15.0

func (h *RoomHandler) GetMembers(c *gin.Context)

GetMembers retrieves room members

func (*RoomHandler) Join added in v0.15.0

func (h *RoomHandler) Join(c *gin.Context)

Join adds a member to the room

func (*RoomHandler) Leave added in v0.15.0

func (h *RoomHandler) Leave(c *gin.Context)

Leave removes a member from the room

func (*RoomHandler) List added in v0.15.0

func (h *RoomHandler) List(c *gin.Context)

List lists all rooms

func (*RoomHandler) Say added in v0.15.0

func (h *RoomHandler) Say(c *gin.Context)

Say sends a message in the room

type RoomRecord added in v0.15.0

type RoomRecord struct {
	ID        string            `json:"id"`
	Name      string            `json:"name"`
	Members   []core.RoomMember `json:"members"`
	CreatedAt time.Time         `json:"created_at"`
	UpdatedAt time.Time         `json:"updated_at"`
	Metadata  map[string]any    `json:"metadata,omitempty"`
}

RoomRecord Room 持久化记录

type RuntimeAgentRegistry added in v0.16.0

type RuntimeAgentRegistry struct {
	// contains filtered or unexported fields
}

RuntimeAgentRegistry 简单的内存 Agent 注册表,用于查询运行态信息

func NewRuntimeAgentRegistry added in v0.16.0

func NewRuntimeAgentRegistry() *RuntimeAgentRegistry

func (*RuntimeAgentRegistry) AddListener added in v0.32.0

func (r *RuntimeAgentRegistry) AddListener(listener RegistryEventListener)

AddListener adds a listener that will be notified when agents are registered/unregistered

func (*RuntimeAgentRegistry) AddRemoteAgentListener added in v0.32.0

func (r *RuntimeAgentRegistry) AddRemoteAgentListener(listener RemoteAgentEventListener)

AddRemoteAgentListener adds a listener for remote agent registration events

func (*RuntimeAgentRegistry) Count added in v0.32.0

func (r *RuntimeAgentRegistry) Count() int

Count returns the number of registered agents

func (*RuntimeAgentRegistry) Get added in v0.16.0

func (r *RuntimeAgentRegistry) Get(agentID string) *agent.Agent

func (*RuntimeAgentRegistry) GetEventBuses added in v0.32.0

func (r *RuntimeAgentRegistry) GetEventBuses() []*events.EventBus

GetEventBuses returns all EventBuses from registered agents (including remote agents) Implements dashboard.EventBusProvider interface

func (*RuntimeAgentRegistry) GetRemoteAgent added in v0.32.0

func (r *RuntimeAgentRegistry) GetRemoteAgent(agentID string) *agent.RemoteAgent

GetRemoteAgent 获取远程 Agent

func (*RuntimeAgentRegistry) List added in v0.32.0

func (r *RuntimeAgentRegistry) List() []*agent.Agent

List returns all registered agents

func (*RuntimeAgentRegistry) ListRemoteAgents added in v0.32.0

func (r *RuntimeAgentRegistry) ListRemoteAgents() []*agent.RemoteAgent

ListRemoteAgents returns all registered remote agents

func (*RuntimeAgentRegistry) Register added in v0.16.0

func (r *RuntimeAgentRegistry) Register(ag *agent.Agent)

func (*RuntimeAgentRegistry) RegisterRemoteAgent added in v0.32.0

func (r *RuntimeAgentRegistry) RegisterRemoteAgent(ra *agent.RemoteAgent)

RegisterRemoteAgent 注册远程 Agent

func (*RuntimeAgentRegistry) Unregister added in v0.16.0

func (r *RuntimeAgentRegistry) Unregister(agentID string)

func (*RuntimeAgentRegistry) UnregisterRemoteAgent added in v0.32.0

func (r *RuntimeAgentRegistry) UnregisterRemoteAgent(agentID string)

UnregisterRemoteAgent 注销远程 Agent

type SemanticMemoryRecord

type SemanticMemoryRecord struct {
	ID        string         `json:"id"`
	Content   string         `json:"content"`
	Embedding []float64      `json:"embedding,omitempty"`
	Source    string         `json:"source,omitempty"`
	SessionID string         `json:"session_id,omitempty"`
	AgentID   string         `json:"agent_id,omitempty"`
	Tags      []string       `json:"tags,omitempty"`
	CreatedAt time.Time      `json:"created_at"`
	Metadata  map[string]any `json:"metadata,omitempty"`
}

SemanticMemoryRecord Semantic Memory 记录

type SessionDetail added in v0.32.0

type SessionDetail struct {
	SessionSummary

	Messages []MessageSummary `json:"messages"`
}

SessionDetail represents detailed session info

type SessionHandler

type SessionHandler struct {
	// contains filtered or unexported fields
}

SessionHandler handles session-related requests

func NewSessionHandler

func NewSessionHandler(st store.Store) *SessionHandler

NewSessionHandler creates a new SessionHandler

func (*SessionHandler) Create

func (h *SessionHandler) Create(c *gin.Context)

Create creates a new session

func (*SessionHandler) Delete

func (h *SessionHandler) Delete(c *gin.Context)

Delete deletes a session

func (*SessionHandler) Get

func (h *SessionHandler) Get(c *gin.Context)

Get retrieves a single session

func (*SessionHandler) GetCheckpoints

func (h *SessionHandler) GetCheckpoints(c *gin.Context)

GetCheckpoints retrieves session checkpoints

func (*SessionHandler) GetMessages

func (h *SessionHandler) GetMessages(c *gin.Context)

GetMessages retrieves session messages

func (*SessionHandler) GetStats

func (h *SessionHandler) GetStats(c *gin.Context)

GetStats retrieves session statistics

func (*SessionHandler) List

func (h *SessionHandler) List(c *gin.Context)

List lists all sessions

func (*SessionHandler) Resume

func (h *SessionHandler) Resume(c *gin.Context)

Resume resumes a session

func (*SessionHandler) Update

func (h *SessionHandler) Update(c *gin.Context)

Update updates a session

type SessionListResult added in v0.32.0

type SessionListResult struct {
	Sessions []SessionSummary `json:"sessions"`
	Total    int              `json:"total"`
	HasMore  bool             `json:"has_more"`
}

SessionListResult represents a list of sessions

type SessionRecord

type SessionRecord struct {
	ID          string          `json:"id"`
	AgentID     string          `json:"agent_id"`
	Status      string          `json:"status"` // active, completed, suspended
	Messages    []types.Message `json:"messages,omitempty"`
	Context     map[string]any  `json:"context,omitempty"`
	CreatedAt   time.Time       `json:"created_at"`
	UpdatedAt   time.Time       `json:"updated_at"`
	CompletedAt *time.Time      `json:"completed_at,omitempty"`
	Metadata    map[string]any  `json:"metadata,omitempty"`
}

SessionRecord Session 持久化记录

type SessionSummary added in v0.32.0

type SessionSummary struct {
	ID           string         `json:"id"`
	AgentID      string         `json:"agent_id,omitempty"`
	AgentName    string         `json:"agent_name,omitempty"`
	Status       string         `json:"status"`
	MessageCount int            `json:"message_count"`
	TokenUsage   TokenCount     `json:"token_usage"`
	CreatedAt    time.Time      `json:"created_at"`
	UpdatedAt    time.Time      `json:"updated_at"`
	Metadata     map[string]any `json:"metadata,omitempty"`
}

SessionSummary represents a session summary for dashboard

type SystemConfigRecord added in v0.11.1

type SystemConfigRecord struct {
	Key       string    `json:"key"`
	Value     any       `json:"value"`
	UpdatedAt time.Time `json:"updated_at"`
}

SystemConfigRecord 系统配置记录

type SystemHandler added in v0.11.1

type SystemHandler struct {
	// contains filtered or unexported fields
}

SystemHandler 系统处理器

func NewSystemHandler added in v0.11.1

func NewSystemHandler(st store.Store) *SystemHandler

NewSystemHandler 创建系统处理器

func (*SystemHandler) Backup added in v0.11.1

func (h *SystemHandler) Backup(c *gin.Context)

Backup 备份系统

func (*SystemHandler) DeleteConfig added in v0.11.1

func (h *SystemHandler) DeleteConfig(c *gin.Context)

DeleteConfig 删除配置

func (*SystemHandler) GetConfig added in v0.11.1

func (h *SystemHandler) GetConfig(c *gin.Context)

GetConfig 获取配置

func (*SystemHandler) GetHealth added in v0.11.1

func (h *SystemHandler) GetHealth(c *gin.Context)

GetHealth 健康检查

func (*SystemHandler) GetInfo added in v0.11.1

func (h *SystemHandler) GetInfo(c *gin.Context)

GetInfo 获取系统信息

func (*SystemHandler) GetStats added in v0.11.1

func (h *SystemHandler) GetStats(c *gin.Context)

GetStats 获取统计

func (*SystemHandler) ListConfig added in v0.11.1

func (h *SystemHandler) ListConfig(c *gin.Context)

ListConfig 列出配置

func (*SystemHandler) Reload added in v0.11.1

func (h *SystemHandler) Reload(c *gin.Context)

Reload 重新加载系统

func (*SystemHandler) RunGC added in v0.11.1

func (h *SystemHandler) RunGC(c *gin.Context)

RunGC 运行垃圾回收

func (*SystemHandler) UpdateConfig added in v0.11.1

func (h *SystemHandler) UpdateConfig(c *gin.Context)

UpdateConfig 更新配置

type TelemetryHandler

type TelemetryHandler struct {
	// contains filtered or unexported fields
}

TelemetryHandler handles telemetry-related requests

func NewTelemetryHandler

func NewTelemetryHandler(st store.Store) *TelemetryHandler

NewTelemetryHandler creates a new TelemetryHandler

func (*TelemetryHandler) ListMetrics

func (h *TelemetryHandler) ListMetrics(c *gin.Context)

ListMetrics lists all metrics

func (*TelemetryHandler) QueryLogs

func (h *TelemetryHandler) QueryLogs(c *gin.Context)

QueryLogs queries logs

func (*TelemetryHandler) QueryTraces

func (h *TelemetryHandler) QueryTraces(c *gin.Context)

QueryTraces queries traces

func (*TelemetryHandler) RecordLog

func (h *TelemetryHandler) RecordLog(c *gin.Context)

RecordLog records a log

func (*TelemetryHandler) RecordMetric

func (h *TelemetryHandler) RecordMetric(c *gin.Context)

RecordMetric records a metric

func (*TelemetryHandler) RecordTrace

func (h *TelemetryHandler) RecordTrace(c *gin.Context)

RecordTrace records a trace

type TokenCount added in v0.32.0

type TokenCount struct {
	Input  int64 `json:"input"`
	Output int64 `json:"output"`
	Total  int64 `json:"total"`
}

TokenCount represents token counts

type ToolExecution

type ToolExecution struct {
	ID          string         `json:"id"`
	ToolID      string         `json:"tool_id"`
	Input       map[string]any `json:"input"`
	Output      map[string]any `json:"output,omitempty"`
	Status      string         `json:"status"` // pending, running, completed, failed
	StartedAt   time.Time      `json:"started_at"`
	CompletedAt *time.Time     `json:"completed_at,omitempty"`
	Error       string         `json:"error,omitempty"`
}

ToolExecution Tool 执行记录

type ToolHandler

type ToolHandler struct {
	// contains filtered or unexported fields
}

ToolHandler handles tool-related requests

func NewToolHandler

func NewToolHandler(st store.Store) *ToolHandler

NewToolHandler creates a new ToolHandler

func (*ToolHandler) Create

func (h *ToolHandler) Create(c *gin.Context)

Create creates a new tool

func (*ToolHandler) Delete

func (h *ToolHandler) Delete(c *gin.Context)

Delete deletes a tool

func (*ToolHandler) Execute

func (h *ToolHandler) Execute(c *gin.Context)

Execute executes a tool

func (*ToolHandler) Get

func (h *ToolHandler) Get(c *gin.Context)

Get retrieves a single tool

func (*ToolHandler) List

func (h *ToolHandler) List(c *gin.Context)

List lists all tools

func (*ToolHandler) Update

func (h *ToolHandler) Update(c *gin.Context)

Update updates a tool

type ToolRecord

type ToolRecord struct {
	ID          string         `json:"id"`
	Name        string         `json:"name"`
	Description string         `json:"description,omitempty"`
	Type        string         `json:"type"` // builtin, custom, external
	Schema      map[string]any `json:"schema"`
	Config      map[string]any `json:"config,omitempty"`
	Status      string         `json:"status"` // active, inactive
	CreatedAt   time.Time      `json:"created_at"`
	UpdatedAt   time.Time      `json:"updated_at"`
	Metadata    map[string]any `json:"metadata,omitempty"`
}

ToolRecord Tool 持久化记录

type ToolRuntimeHandler added in v0.16.0

type ToolRuntimeHandler struct {
	// contains filtered or unexported fields
}

ToolRuntimeHandler 提供工具调用运行态查询

func NewToolRuntimeHandler added in v0.16.0

func NewToolRuntimeHandler(st store.Store, reg *RuntimeAgentRegistry) *ToolRuntimeHandler

NewToolRuntimeHandler 创建新的运行态处理器

func (*ToolRuntimeHandler) GetResult added in v0.16.0

func (h *ToolRuntimeHandler) GetResult(c *gin.Context)

GetResult 导出工具执行结果

func (*ToolRuntimeHandler) GetStatus added in v0.16.0

func (h *ToolRuntimeHandler) GetStatus(c *gin.Context)

GetStatus 获取指定调用的状态

func (*ToolRuntimeHandler) ListRunning added in v0.16.0

func (h *ToolRuntimeHandler) ListRunning(c *gin.Context)

ListRunning 返回运行中的工具调用

type TraceRecord

type TraceRecord struct {
	ID         string         `json:"id"`
	Name       string         `json:"name"`
	SpanID     string         `json:"span_id"`
	ParentID   string         `json:"parent_id,omitempty"`
	StartTime  time.Time      `json:"start_time"`
	EndTime    *time.Time     `json:"end_time,omitempty"`
	Duration   int64          `json:"duration,omitempty"` // microseconds
	Status     string         `json:"status"`             // ok, error
	Attributes map[string]any `json:"attributes,omitempty"`
}

TraceRecord 追踪记录

type WebSocketConnection added in v0.15.0

type WebSocketConnection struct {
	ID    string
	Conn  *websocket.Conn
	Send  chan []byte
	Agent *agent.Agent
	// contains filtered or unexported fields
}

WebSocketConnection represents a single WebSocket connection

type WebSocketHandler added in v0.15.0

type WebSocketHandler struct {
	// contains filtered or unexported fields
}

WebSocketHandler handles WebSocket connections

func NewWebSocketHandler added in v0.15.0

func NewWebSocketHandler(st store.Store, deps *agent.Dependencies, reg *RuntimeAgentRegistry) *WebSocketHandler

NewWebSocketHandler creates a new WebSocketHandler

func (*WebSocketHandler) GetStats added in v0.15.0

func (h *WebSocketHandler) GetStats(c *gin.Context)

GetStats returns WebSocket statistics

func (*WebSocketHandler) HandleWebSocket added in v0.15.0

func (h *WebSocketHandler) HandleWebSocket(c *gin.Context)

HandleWebSocket handles WebSocket upgrade and communication

type WebSocketMessage added in v0.15.0

type WebSocketMessage struct {
	Type    string         `json:"type"`
	Payload map[string]any `json:"payload"`
}

WebSocketMessage represents a message sent over WebSocket

type WorkflowExecution

type WorkflowExecution struct {
	ID          string         `json:"id"`
	WorkflowID  string         `json:"workflow_id"`
	Status      string         `json:"status"` // pending, running, completed, failed, canceled
	StartedAt   time.Time      `json:"started_at"`
	CompletedAt *time.Time     `json:"completed_at,omitempty"`
	Result      map[string]any `json:"result,omitempty"`
	Error       string         `json:"error,omitempty"`
	Logs        []ExecutionLog `json:"logs,omitempty"`
	Context     map[string]any `json:"context,omitempty"`
	Metadata    map[string]any `json:"metadata,omitempty"`
}

WorkflowExecution Workflow 执行记录

type WorkflowHandler

type WorkflowHandler struct {
	// contains filtered or unexported fields
}

WorkflowHandler handles workflow-related requests

func NewWorkflowHandler

func NewWorkflowHandler(st store.Store) *WorkflowHandler

NewWorkflowHandler creates a new WorkflowHandler

func (*WorkflowHandler) Create

func (h *WorkflowHandler) Create(c *gin.Context)

Create creates a new workflow

func (*WorkflowHandler) Delete

func (h *WorkflowHandler) Delete(c *gin.Context)

Delete deletes a workflow

func (*WorkflowHandler) Execute

func (h *WorkflowHandler) Execute(c *gin.Context)

Execute executes a workflow

func (*WorkflowHandler) Get

func (h *WorkflowHandler) Get(c *gin.Context)

Get retrieves a single workflow

func (*WorkflowHandler) GetExecutionDetails

func (h *WorkflowHandler) GetExecutionDetails(c *gin.Context)

GetExecutionDetails retrieves a single execution

func (*WorkflowHandler) GetExecutions

func (h *WorkflowHandler) GetExecutions(c *gin.Context)

GetExecutions retrieves workflow executions

func (*WorkflowHandler) List

func (h *WorkflowHandler) List(c *gin.Context)

List lists all workflows

func (*WorkflowHandler) Resume

func (h *WorkflowHandler) Resume(c *gin.Context)

Resume resumes a workflow

func (*WorkflowHandler) Suspend

func (h *WorkflowHandler) Suspend(c *gin.Context)

Suspend suspends a workflow

func (*WorkflowHandler) Update

func (h *WorkflowHandler) Update(c *gin.Context)

Update updates a workflow

type WorkflowRecord

type WorkflowRecord struct {
	ID          string         `json:"id"`
	Name        string         `json:"name"`
	Description string         `json:"description,omitempty"`
	Version     string         `json:"version"`
	Steps       []any          `json:"steps"`
	Triggers    []any          `json:"triggers,omitempty"`
	Status      string         `json:"status"`
	CreatedBy   string         `json:"created_by,omitempty"`
	CreatedAt   time.Time      `json:"created_at"`
	UpdatedAt   time.Time      `json:"updated_at"`
	Metadata    map[string]any `json:"metadata,omitempty"`
}

WorkflowRecord Workflow 持久化记录

type WorkflowStep

type WorkflowStep struct {
	ID        string         `json:"id"`
	Name      string         `json:"name"`
	Type      string         `json:"type"` // agent, tool, condition, loop
	Config    map[string]any `json:"config,omitempty"`
	DependsOn []string       `json:"depends_on,omitempty"`
	Timeout   int            `json:"timeout,omitempty"` // seconds
}

WorkflowStep Workflow 步骤

type WorkflowTrigger

type WorkflowTrigger struct {
	Type   string         `json:"type"` // manual, scheduled, event
	Config map[string]any `json:"config,omitempty"`
}

WorkflowTrigger Workflow 触发器

type WorkingMemoryRecord

type WorkingMemoryRecord struct {
	ID        string         `json:"id"`
	SessionID string         `json:"session_id,omitempty"`
	AgentID   string         `json:"agent_id,omitempty"`
	Key       string         `json:"key"`
	Value     any            `json:"value"`
	Type      string         `json:"type"`
	TTL       int            `json:"ttl,omitempty"`
	ExpiresAt *time.Time     `json:"expires_at,omitempty"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	Metadata  map[string]any `json:"metadata,omitempty"`
}

WorkingMemoryRecord Working Memory 记录

Jump to

Keyboard shortcuts

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