Documentation
¶
Overview ¶
Package api 提供 Agent Node 对本地 Client 暴露的 HTTP/SSE 端点。
职责边界:路由解析、请求/响应 JSON、错误码映射;session 队列与 turn 执行委托 session.Manager。
Index ¶
- type DreamingScheduler
- func (d *DreamingScheduler) CurrentStatus(agentID string, now time.Time) (result DreamingStatus)
- func (d *DreamingScheduler) Start(ctx context.Context)
- func (d *DreamingScheduler) Status(agentID string) DreamingStatus
- func (d *DreamingScheduler) Stop()
- func (d *DreamingScheduler) Tick(ctx context.Context) error
- type DreamingStatus
- type Option
- func WithConfigPath(path string) Option
- func WithDirectoryPicker(picker platform.DirectoryPicker) Option
- func WithLLM(client llm.Client) Option
- func WithNodeSettings(ns *store.NodeSettingsStore) Option
- func WithPolicy(engine *policy.Engine) Option
- func WithSkipStore() Option
- func WithStore(st *store.SQLiteStore) Option
- func WithTools(registry *tools.Registry) Option
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DreamingScheduler ¶
type DreamingScheduler struct {
// contains filtered or unexported fields
}
DreamingScheduler owns only the daily dreaming loop. Wake triggers and their interval do not participate in its due calculation.
func NewDreamingScheduler ¶
func (*DreamingScheduler) CurrentStatus ¶
func (d *DreamingScheduler) CurrentStatus(agentID string, now time.Time) (result DreamingStatus)
func (*DreamingScheduler) Start ¶
func (d *DreamingScheduler) Start(ctx context.Context)
func (*DreamingScheduler) Status ¶
func (d *DreamingScheduler) Status(agentID string) DreamingStatus
func (*DreamingScheduler) Stop ¶
func (d *DreamingScheduler) Stop()
type DreamingStatus ¶
type DreamingStatus struct {
State string `json:"state"`
NextAt time.Time `json:"next_at,omitempty"`
LastSuccess time.Time `json:"last_success,omitempty"`
LastError string `json:"last_error,omitempty"`
}
func (DreamingStatus) MarshalJSON ¶
func (s DreamingStatus) MarshalJSON() ([]byte, error)
type Option ¶
type Option func(*serverOptions)
Option 为 NewServer 可选配置。
func WithConfigPath ¶
WithConfigPath 记录 Node 启动时加载的 config.yaml 路径(供 Web UI 保存设置)。
func WithDirectoryPicker ¶
func WithDirectoryPicker(picker platform.DirectoryPicker) Option
WithDirectoryPicker injects the Node-native picker implementation (tests use this to avoid opening a real system dialog).
func WithNodeSettings ¶
func WithNodeSettings(ns *store.NodeSettingsStore) Option
WithNodeSettings 注入 Node 设置库(由 main BootstrapNodeSettings 打开)。
func WithStore ¶
func WithStore(st *store.SQLiteStore) Option
WithStore 注入 SQLite store(单测用);传 nil 且 WithSkipStore 时禁用持久化。
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server 承载 Agent Node HTTP 路由与运行时依赖。
func NewServer ¶
NewServer 根据已校验配置构造 HTTP 处理器树。
逻辑: 1. 装配 LLM、tools、policy、SQLite(可被 Option 覆盖); 2. 创建 SSE Hub 与 session.Manager,挂载 turn/skills/compression 选项; 3. 可选初始化 triggers store/scheduler 与 bash 后台任务回灌; 4. 注册 /health、/v1/agents、/v1/messages、/v1/streams 等路由。
关键边界:子系统初始化失败时尽量降级(tools/policy/store/triggers 打日志后继续),避免整进程无法启动。
func (*Server) Close ¶
func (s *Server) Close()
Close 释放 SQLite / 会话等资源。ListenAndServe 退出路径会调用;httptest 测试需显式 Cleanup。
Source Files
¶
- access_log.go
- agent_delete.go
- agent_handbook_api.go
- agent_policy_api.go
- agent_settings.go
- agent_templates_api.go
- agents_api.go
- auto_overview_api.go
- auto_runtime_helpers.go
- autonomy_default_trigger.go
- autonomy_trigger_rounds.go
- autonomy_v2_api.go
- child_agents_api.go
- context_preview.go
- dreaming_scheduler.go
- errors.go
- feedback_api.go
- host_info.go
- linux_channels_api.go
- linux_transfer_api.go
- llm_api.go
- manage_auto_summary.go
- manage_upload.go
- mcp_api.go
- media_api.go
- memory_service.go
- onboarding_gate.go
- platform_api.go
- runtime_events.go
- screen_api.go
- server.go
- server_agent_api.go
- server_lifecycle.go
- server_messages.go
- server_routes.go
- server_wiring.go
- setup_api.go
- terminal_api.go
- terminal_command.go
- terminal_sessions.go
- tool_call_control_api.go
- triggers_api.go
- turn_lifecycle_api.go
- ui_aggregate_api.go
- workgroup_agent_bridge.go
- workgroup_agent_llm.go
- workgroup_api.go