handlers

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: MIT Imports: 8 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) List

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

List lists all agents

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]interface{} `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]interface{} `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 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]interface{} `json:"input,omitempty"`
	Output      map[string]interface{} `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]interface{} `json:"metadata,omitempty"`
}

EvalRecord 评估记录

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]interface{} `json:"data,omitempty"`
}

ExecutionLog 执行日志

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]interface{} `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]interface{} `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]interface{} `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 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]interface{} `json:"metadata,omitempty"`
}

MetricRecord 指标记录

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]interface{} `json:"changes,omitempty"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
}

ProvenanceRecord Provenance 溯源记录

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]interface{} `json:"metadata,omitempty"`
}

SemanticMemoryRecord Semantic Memory 记录

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 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]interface{} `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]interface{} `json:"metadata,omitempty"`
}

SessionRecord Session 持久化记录

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 ToolExecution

type ToolExecution struct {
	ID          string                 `json:"id"`
	ToolID      string                 `json:"tool_id"`
	Input       map[string]interface{} `json:"input"`
	Output      map[string]interface{} `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]interface{} `json:"schema"`
	Config      map[string]interface{} `json:"config,omitempty"`
	Status      string                 `json:"status"` // active, inactive
	CreatedAt   time.Time              `json:"created_at"`
	UpdatedAt   time.Time              `json:"updated_at"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

ToolRecord Tool 持久化记录

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]interface{} `json:"attributes,omitempty"`
}

TraceRecord 追踪记录

type WorkflowExecution

type WorkflowExecution struct {
	ID          string                 `json:"id"`
	WorkflowID  string                 `json:"workflow_id"`
	Status      string                 `json:"status"` // pending, running, completed, failed, cancelled
	StartedAt   time.Time              `json:"started_at"`
	CompletedAt *time.Time             `json:"completed_at,omitempty"`
	Result      map[string]interface{} `json:"result,omitempty"`
	Error       string                 `json:"error,omitempty"`
	Logs        []ExecutionLog         `json:"logs,omitempty"`
	Context     map[string]interface{} `json:"context,omitempty"`
	Metadata    map[string]interface{} `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       []interface{}          `json:"steps"`
	Triggers    []interface{}          `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]interface{} `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]interface{} `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]interface{} `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     interface{}            `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]interface{} `json:"metadata,omitempty"`
}

WorkingMemoryRecord Working Memory 记录

Jump to

Keyboard shortcuts

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