Documentation
¶
Overview ¶
Package client provides an HTTP client for the bcd daemon.
Commands use this client to communicate with the daemon instead of calling pkg/ packages directly. This enables the daemon architecture where the CLI is a thin client.
Index ¶
- Constants
- func DefaultSocketPath() string
- func IsDaemonNotRunning(err error) bool
- type AgentCostDetail
- type AgentCostSummary
- type AgentDailyCost
- type AgentHealthInfo
- type AgentInfo
- type AgentStatsRecord
- type AgentsClient
- func (a *AgentsClient) Broadcast(ctx context.Context, message string) (int, error)
- func (a *AgentsClient) Cost(ctx context.Context, name string) (*AgentCostSummary, error)
- func (a *AgentsClient) Create(ctx context.Context, req CreateAgentReq) (*AgentInfo, error)
- func (a *AgentsClient) Delete(ctx context.Context, name string, force bool) error
- func (a *AgentsClient) GenerateName(ctx context.Context) (string, error)
- func (a *AgentsClient) Get(ctx context.Context, name string) (*AgentInfo, error)
- func (a *AgentsClient) Health(ctx context.Context, timeout string, agentName string) ([]AgentHealthInfo, error)
- func (a *AgentsClient) List(ctx context.Context) ([]AgentInfo, error)
- func (a *AgentsClient) ListByRole(ctx context.Context, role string) ([]AgentInfo, error)
- func (a *AgentsClient) Peek(ctx context.Context, name string, lines int) (string, error)
- func (a *AgentsClient) Rename(ctx context.Context, oldName, newName string) error
- func (a *AgentsClient) Report(ctx context.Context, name, state, message string) error
- func (a *AgentsClient) Send(ctx context.Context, name, message string) error
- func (a *AgentsClient) SendToPattern(ctx context.Context, pattern, message string) (*SendResultInfo, error)
- func (a *AgentsClient) SendToRole(ctx context.Context, role, message string) (*SendResultInfo, error)
- func (a *AgentsClient) Sessions(ctx context.Context, name string) ([]SessionInfo, error)
- func (a *AgentsClient) Start(ctx context.Context, name, runtime, resumeID string) (*AgentInfo, error)
- func (a *AgentsClient) Stats(ctx context.Context, name string, limit int) ([]*AgentStatsRecord, error)
- func (a *AgentsClient) Stop(ctx context.Context, name string) error
- func (a *AgentsClient) StopAll(ctx context.Context) (int, error)
- type ChannelInfo
- type ChannelStatusInfo
- type ChannelsClient
- func (ch *ChannelsClient) AddMember(ctx context.Context, chanName, agentName string) error
- func (ch *ChannelsClient) Create(ctx context.Context, name, description string) (*ChannelInfo, error)
- func (ch *ChannelsClient) Delete(ctx context.Context, name string) error
- func (ch *ChannelsClient) Get(ctx context.Context, name string) (*ChannelInfo, error)
- func (ch *ChannelsClient) History(ctx context.Context, chanName string, limit, offset int, agentFilter string) ([]MessageInfo, error)
- func (ch *ChannelsClient) List(ctx context.Context) ([]ChannelInfo, error)
- func (ch *ChannelsClient) React(ctx context.Context, chanName string, msgID int, emoji, user string) (bool, error)
- func (ch *ChannelsClient) RemoveMember(ctx context.Context, chanName, agentName string) error
- func (ch *ChannelsClient) Send(ctx context.Context, chanName, sender, message string) (*MessageInfo, error)
- func (ch *ChannelsClient) Status(ctx context.Context) (*ChannelStatusInfo, error)
- func (ch *ChannelsClient) Update(ctx context.Context, name, description string) (*ChannelInfo, error)
- type Client
- type CostBudget
- type CostBudgetStatus
- type CostProjection
- type CostSummary
- type CostsClient
- func (c *CostsClient) AgentSummary(ctx context.Context, name string) (*AgentCostDetail, error)
- func (c *CostsClient) CheckBudget(ctx context.Context, scope string) (*CostBudgetStatus, error)
- func (c *CostsClient) Daily(ctx context.Context, days int) ([]*DailyCost, error)
- func (c *CostsClient) DeleteBudget(ctx context.Context, scope string) error
- func (c *CostsClient) ListBudgets(ctx context.Context) ([]*CostBudget, error)
- func (c *CostsClient) ProjectCost(ctx context.Context, lookbackDays, projectDays int) (*CostProjection, error)
- func (c *CostsClient) SetBudget(ctx context.Context, req *SetBudgetReq) (*CostBudget, error)
- func (c *CostsClient) SummaryByAgent(ctx context.Context) ([]*CostSummary, error)
- func (c *CostsClient) SummaryByModel(ctx context.Context) ([]*CostSummary, error)
- func (c *CostsClient) SummaryByTeam(ctx context.Context) ([]*CostSummary, error)
- func (c *CostsClient) Sync(ctx context.Context) (int, error)
- func (c *CostsClient) WorkspaceSummary(ctx context.Context) (*CostSummary, error)
- type CreateAgentReq
- type CronClient
- func (c *CronClient) Add(ctx context.Context, job *CronJob) (*CronJob, error)
- func (c *CronClient) Delete(ctx context.Context, name string) error
- func (c *CronClient) Disable(ctx context.Context, name string) error
- func (c *CronClient) Enable(ctx context.Context, name string) error
- func (c *CronClient) Get(ctx context.Context, name string) (*CronJob, error)
- func (c *CronClient) List(ctx context.Context) ([]CronJob, error)
- func (c *CronClient) Logs(ctx context.Context, name string, last int) ([]CronLogEntry, error)
- func (c *CronClient) Run(ctx context.Context, name string) error
- type CronJob
- type CronLogEntry
- type DailyCost
- type DeliveryEntry
- type DoctorCategory
- type DoctorClient
- type DoctorItem
- type DoctorReport
- type EventInfo
- type EventsClient
- func (e *EventsClient) Append(ctx context.Context, ev EventInfo) error
- func (e *EventsClient) List(ctx context.Context) ([]EventInfo, error)
- func (e *EventsClient) ListByAgent(ctx context.Context, agentName string) ([]EventInfo, error)
- func (e *EventsClient) Tail(ctx context.Context, n int) ([]EventInfo, error)
- type MCPClient
- func (m *MCPClient) Add(ctx context.Context, cfg *MCPServerConfig) (*MCPServerConfig, error)
- func (m *MCPClient) Disable(ctx context.Context, name string) error
- func (m *MCPClient) Enable(ctx context.Context, name string) error
- func (m *MCPClient) Get(ctx context.Context, name string) (*MCPServerConfig, error)
- func (m *MCPClient) List(ctx context.Context) ([]*MCPServerConfig, error)
- func (m *MCPClient) Remove(ctx context.Context, name string) error
- type MCPServerConfig
- type MessageInfo
- type NotifyClient
- func (n *NotifyClient) Activity(ctx context.Context, channel string, limit int) ([]DeliveryEntry, error)
- func (n *NotifyClient) ChannelSubscriptions(ctx context.Context, channel string) ([]Subscription, error)
- func (n *NotifyClient) ListSubscriptions(ctx context.Context) ([]Subscription, error)
- func (n *NotifyClient) Subscribe(ctx context.Context, channel, agent string, mentionOnly bool) error
- func (n *NotifyClient) Unsubscribe(ctx context.Context, channel, agent string) error
- type RoleInfo
- type RolesClient
- type SecretInfo
- type SecretsClient
- func (s *SecretsClient) Create(ctx context.Context, name, value, description string) (*SecretInfo, error)
- func (s *SecretsClient) Delete(ctx context.Context, name string) error
- func (s *SecretsClient) Get(ctx context.Context, name string) (*SecretInfo, error)
- func (s *SecretsClient) List(ctx context.Context) ([]SecretInfo, error)
- func (s *SecretsClient) Update(ctx context.Context, name, value string) (*SecretInfo, error)
- type SendResultInfo
- type SessionInfo
- type SetBudgetReq
- type SettingsClient
- type StatsClient
- type StuckConfig
- type StuckDetection
- type StuckReason
- type Subscription
- type SummaryStats
- type SystemStats
- type ToolInfo
- type ToolsClient
- func (t *ToolsClient) Delete(ctx context.Context, name string) error
- func (t *ToolsClient) Disable(ctx context.Context, name string) error
- func (t *ToolsClient) Enable(ctx context.Context, name string) error
- func (t *ToolsClient) Get(ctx context.Context, name string) (*ToolInfo, error)
- func (t *ToolsClient) List(ctx context.Context) ([]*ToolInfo, error)
- func (t *ToolsClient) Update(ctx context.Context, tool *ToolInfo) (*ToolInfo, error)
Constants ¶
const DefaultHTTPAddr = "http://127.0.0.1:9374"
DefaultHTTPAddr is the fallback HTTP address for bcd.
Variables ¶
This section is empty.
Functions ¶
func DefaultSocketPath ¶
func DefaultSocketPath() string
DefaultSocketPath returns the default Unix socket path for bcd.
func IsDaemonNotRunning ¶
IsDaemonNotRunning returns true if the error indicates the daemon is not running.
Types ¶
type AgentCostDetail ¶
type AgentCostDetail struct {
Summary *CostSummary `json:"summary"`
Daily []*AgentDailyCost `json:"daily"`
}
AgentCostDetail is the response from GET /api/costs/agent/{name}.
type AgentCostSummary ¶
type AgentCostSummary struct {
AgentID string `json:"agent_id"`
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
TotalTokens int64 `json:"total_tokens"`
TotalCostUSD float64 `json:"total_cost_usd"`
RequestCount int64 `json:"request_count"`
}
AgentCostSummary holds cost breakdown for an agent.
type AgentDailyCost ¶
type AgentDailyCost struct {
AgentID string `json:"agent_id"`
Date string `json:"date"`
CostUSD float64 `json:"cost_usd"`
TotalTokens int64 `json:"total_tokens"`
RecordCount int64 `json:"record_count"`
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
}
AgentDailyCost represents daily cost data for a specific agent.
type AgentHealthInfo ¶
type AgentHealthInfo struct {
Name string `json:"name"`
Role string `json:"role"`
Status string `json:"status"`
LastUpdated string `json:"last_updated"`
StaleDuration string `json:"stale_duration,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
TmuxAlive bool `json:"tmux_alive"`
StateFresh bool `json:"state_fresh"`
}
AgentHealthInfo represents health status of an agent.
type AgentInfo ¶
type AgentInfo struct {
CreatedAt time.Time `json:"created_at"`
StartedAt time.Time `json:"started_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
StoppedAt *time.Time `json:"stopped_at,omitempty"`
ID string `json:"id,omitempty"`
Name string `json:"name"`
Role string `json:"role"`
State string `json:"state"`
Task string `json:"task,omitempty"`
Team string `json:"team,omitempty"`
Tool string `json:"tool,omitempty"`
Session string `json:"session,omitempty"`
SessionID string `json:"session_id,omitempty"`
ParentID string `json:"parent_id,omitempty"`
Children []string `json:"children,omitempty"`
}
AgentInfo represents agent data returned by the daemon.
type AgentStatsRecord ¶
type AgentStatsRecord struct {
CollectedAt time.Time `json:"collected_at"`
AgentName string `json:"agent_name"`
CPUPct float64 `json:"cpu_pct"`
MemUsedMB float64 `json:"mem_used_mb"`
MemLimitMB float64 `json:"mem_limit_mb"`
NetRxMB float64 `json:"net_rx_mb"`
NetTxMB float64 `json:"net_tx_mb"`
BlockReadMB float64 `json:"block_read_mb"`
BlockWriteMB float64 `json:"block_write_mb"`
}
AgentStatsRecord holds a single Docker stats sample for an agent.
type AgentsClient ¶
type AgentsClient struct {
// contains filtered or unexported fields
}
AgentsClient provides agent operations via the daemon.
func (*AgentsClient) Cost ¶
func (a *AgentsClient) Cost(ctx context.Context, name string) (*AgentCostSummary, error)
Cost returns cost breakdown for an agent.
func (*AgentsClient) Create ¶
func (a *AgentsClient) Create(ctx context.Context, req CreateAgentReq) (*AgentInfo, error)
Create creates a new agent.
func (*AgentsClient) Delete ¶
Delete permanently removes an agent. If force is true, stops the agent first.
func (*AgentsClient) GenerateName ¶
func (a *AgentsClient) GenerateName(ctx context.Context) (string, error)
GenerateName generates a unique agent name.
func (*AgentsClient) Health ¶
func (a *AgentsClient) Health(ctx context.Context, timeout string, agentName string) ([]AgentHealthInfo, error)
Health returns health status for agents. If agentName is non-empty, filters to that agent.
func (*AgentsClient) List ¶
func (a *AgentsClient) List(ctx context.Context) ([]AgentInfo, error)
List returns all agents from the daemon.
func (*AgentsClient) ListByRole ¶
ListByRole returns agents filtered by role.
func (*AgentsClient) Rename ¶
func (a *AgentsClient) Rename(ctx context.Context, oldName, newName string) error
Rename renames an agent.
func (*AgentsClient) Report ¶
func (a *AgentsClient) Report(ctx context.Context, name, state, message string) error
Report updates an agent's state via the daemon.
func (*AgentsClient) Send ¶
func (a *AgentsClient) Send(ctx context.Context, name, message string) error
Send sends a message to a running agent.
func (*AgentsClient) SendToPattern ¶
func (a *AgentsClient) SendToPattern(ctx context.Context, pattern, message string) (*SendResultInfo, error)
SendToPattern sends a message to agents matching the given glob pattern.
func (*AgentsClient) SendToRole ¶
func (a *AgentsClient) SendToRole(ctx context.Context, role, message string) (*SendResultInfo, error)
SendToRole sends a message to all agents with the given role.
func (*AgentsClient) Sessions ¶
func (a *AgentsClient) Sessions(ctx context.Context, name string) ([]SessionInfo, error)
Sessions returns session history for an agent.
func (*AgentsClient) Start ¶
func (a *AgentsClient) Start(ctx context.Context, name, runtime, resumeID string) (*AgentInfo, error)
Start starts a stopped agent. resumeID optionally specifies a session ID to resume.
func (*AgentsClient) Stats ¶
func (a *AgentsClient) Stats(ctx context.Context, name string, limit int) ([]*AgentStatsRecord, error)
Stats returns Docker resource stats samples for an agent.
type ChannelInfo ¶
type ChannelInfo struct {
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Type string `json:"type,omitempty"`
Members []string `json:"members"`
MemberCount int `json:"member_count"`
MessageCount int `json:"message_count"`
}
ChannelInfo represents channel data returned by the daemon.
type ChannelStatusInfo ¶
type ChannelStatusInfo struct {
ChannelCount int `json:"channel_count"`
TotalMembers int `json:"total_members"`
}
ChannelStatusInfo holds channel status summary.
type ChannelsClient ¶
type ChannelsClient struct {
// contains filtered or unexported fields
}
ChannelsClient provides channel operations via the daemon.
func (*ChannelsClient) AddMember ¶
func (ch *ChannelsClient) AddMember(ctx context.Context, chanName, agentName string) error
AddMember adds an agent to a channel.
func (*ChannelsClient) Create ¶
func (ch *ChannelsClient) Create(ctx context.Context, name, description string) (*ChannelInfo, error)
Create creates a new channel.
func (*ChannelsClient) Delete ¶
func (ch *ChannelsClient) Delete(ctx context.Context, name string) error
Delete removes a channel.
func (*ChannelsClient) Get ¶
func (ch *ChannelsClient) Get(ctx context.Context, name string) (*ChannelInfo, error)
Get returns a single channel.
func (*ChannelsClient) History ¶
func (ch *ChannelsClient) History(ctx context.Context, chanName string, limit, offset int, agentFilter string) ([]MessageInfo, error)
History returns message history for a channel.
func (*ChannelsClient) List ¶
func (ch *ChannelsClient) List(ctx context.Context) ([]ChannelInfo, error)
List returns all channels from the daemon.
func (*ChannelsClient) React ¶
func (ch *ChannelsClient) React(ctx context.Context, chanName string, msgID int, emoji, user string) (bool, error)
React adds or removes a reaction to a message.
func (*ChannelsClient) RemoveMember ¶
func (ch *ChannelsClient) RemoveMember(ctx context.Context, chanName, agentName string) error
RemoveMember removes an agent from a channel.
func (*ChannelsClient) Send ¶
func (ch *ChannelsClient) Send(ctx context.Context, chanName, sender, message string) (*MessageInfo, error)
Send sends a message to a channel.
func (*ChannelsClient) Status ¶
func (ch *ChannelsClient) Status(ctx context.Context) (*ChannelStatusInfo, error)
Status returns the channel status summary.
func (*ChannelsClient) Update ¶
func (ch *ChannelsClient) Update(ctx context.Context, name, description string) (*ChannelInfo, error)
Update updates a channel's settings.
type Client ¶
type Client struct {
HTTPClient *http.Client
Agents *AgentsClient
Channels *ChannelsClient
Notify *NotifyClient
Events *EventsClient
Costs *CostsClient
Cron *CronClient
MCP *MCPClient
Tools *ToolsClient
Roles *RolesClient
Secrets *SecretsClient
Doctor *DoctorClient
Settings *SettingsClient
Stats *StatsClient
BaseURL string
}
Client is the HTTP client for the bcd daemon.
type CostBudget ¶
type CostBudget struct {
UpdatedAt time.Time `json:"updated_at"`
Period string `json:"period"`
Scope string `json:"scope"`
ID int64 `json:"id"`
LimitUSD float64 `json:"limit_usd"`
AlertAt float64 `json:"alert_at"`
HardStop bool `json:"hard_stop"`
}
CostBudget represents a cost budget configuration.
type CostBudgetStatus ¶
type CostBudgetStatus struct {
Budget *CostBudget `json:"budget"`
CurrentSpend float64 `json:"current_spend"`
Remaining float64 `json:"remaining"`
PercentUsed float64 `json:"percent_used"`
IsOverBudget bool `json:"is_over_budget"`
IsNearLimit bool `json:"is_near_limit"`
}
CostBudgetStatus represents the current status against a budget.
type CostProjection ¶
type CostProjection struct {
Duration time.Duration `json:"duration"`
DailyAvgCost float64 `json:"daily_avg_cost"`
ProjectedCost float64 `json:"projected_cost"`
DaysAnalyzed int `json:"days_analyzed"`
TotalHistorical float64 `json:"total_historical"`
}
CostProjection represents a cost projection based on historical data.
type CostSummary ¶
type CostSummary struct {
AgentID string `json:"agent_id,omitempty"`
TeamID string `json:"team_id,omitempty"`
Model string `json:"model,omitempty"`
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
TotalTokens int64 `json:"total_tokens"`
TotalCostUSD float64 `json:"total_cost_usd"`
RecordCount int64 `json:"record_count"`
}
CostSummary represents aggregated cost data.
type CostsClient ¶
type CostsClient struct {
// contains filtered or unexported fields
}
CostsClient provides cost operations via the daemon.
func (*CostsClient) AgentSummary ¶
func (c *CostsClient) AgentSummary(ctx context.Context, name string) (*AgentCostDetail, error)
AgentSummary returns the cost summary and daily breakdown for a specific agent.
func (*CostsClient) CheckBudget ¶
func (c *CostsClient) CheckBudget(ctx context.Context, scope string) (*CostBudgetStatus, error)
CheckBudget returns budget status for the given scope.
func (*CostsClient) DeleteBudget ¶
func (c *CostsClient) DeleteBudget(ctx context.Context, scope string) error
DeleteBudget removes a budget for the given scope.
func (*CostsClient) ListBudgets ¶
func (c *CostsClient) ListBudgets(ctx context.Context) ([]*CostBudget, error)
ListBudgets returns all configured budgets.
func (*CostsClient) ProjectCost ¶
func (c *CostsClient) ProjectCost(ctx context.Context, lookbackDays, projectDays int) (*CostProjection, error)
ProjectCost returns a cost projection based on historical data.
func (*CostsClient) SetBudget ¶
func (c *CostsClient) SetBudget(ctx context.Context, req *SetBudgetReq) (*CostBudget, error)
SetBudget creates or updates a budget.
func (*CostsClient) SummaryByAgent ¶
func (c *CostsClient) SummaryByAgent(ctx context.Context) ([]*CostSummary, error)
SummaryByAgent returns aggregated costs per agent.
func (*CostsClient) SummaryByModel ¶
func (c *CostsClient) SummaryByModel(ctx context.Context) ([]*CostSummary, error)
SummaryByModel returns aggregated costs per model.
func (*CostsClient) SummaryByTeam ¶
func (c *CostsClient) SummaryByTeam(ctx context.Context) ([]*CostSummary, error)
SummaryByTeam returns aggregated costs per team.
func (*CostsClient) Sync ¶
func (c *CostsClient) Sync(ctx context.Context) (int, error)
Sync triggers a fresh cost import from JSONL files.
func (*CostsClient) WorkspaceSummary ¶
func (c *CostsClient) WorkspaceSummary(ctx context.Context) (*CostSummary, error)
WorkspaceSummary returns the total cost summary for the workspace.
type CreateAgentReq ¶
type CreateAgentReq struct {
Name string `json:"name"`
Role string `json:"role"`
Tool string `json:"tool,omitempty"`
Runtime string `json:"runtime,omitempty"`
Parent string `json:"parent,omitempty"`
Team string `json:"team,omitempty"`
EnvFile string `json:"env_file,omitempty"`
}
CreateAgentReq is the request to create an agent.
type CronClient ¶
type CronClient struct {
// contains filtered or unexported fields
}
CronClient provides cron job operations via the daemon.
func (*CronClient) Delete ¶
func (c *CronClient) Delete(ctx context.Context, name string) error
Delete removes a cron job.
func (*CronClient) Disable ¶
func (c *CronClient) Disable(ctx context.Context, name string) error
Disable disables a cron job.
func (*CronClient) Enable ¶
func (c *CronClient) Enable(ctx context.Context, name string) error
Enable enables a cron job.
func (*CronClient) List ¶
func (c *CronClient) List(ctx context.Context) ([]CronJob, error)
List returns all cron jobs.
func (*CronClient) Logs ¶
func (c *CronClient) Logs(ctx context.Context, name string, last int) ([]CronLogEntry, error)
Logs returns the execution history for a cron job.
type CronJob ¶
type CronJob struct {
CreatedAt *time.Time `json:"created_at,omitempty"`
LastRun *time.Time `json:"last_run,omitempty"`
NextRun *time.Time `json:"next_run,omitempty"`
Name string `json:"name"`
Schedule string `json:"schedule"`
AgentName string `json:"agent_name,omitempty"`
Prompt string `json:"prompt,omitempty"`
Command string `json:"command,omitempty"`
RunCount int `json:"run_count"`
Enabled bool `json:"enabled"`
}
CronJob represents a cron job returned by the daemon.
type CronLogEntry ¶
type CronLogEntry struct {
RunAt time.Time `json:"run_at"`
Status string `json:"status"`
DurationMS int64 `json:"duration_ms"`
CostUSD float64 `json:"cost_usd,omitempty"`
}
CronLogEntry represents a cron job execution log entry.
type DailyCost ¶
type DailyCost struct {
Date string `json:"date"`
CostUSD float64 `json:"cost_usd"`
TotalTokens int64 `json:"total_tokens"`
RecordCount int64 `json:"record_count"`
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
}
DailyCost represents aggregated cost data for a single day.
type DeliveryEntry ¶
type DeliveryEntry struct {
LoggedAt time.Time `json:"logged_at"`
Channel string `json:"channel"`
Agent string `json:"agent"`
Status string `json:"status"`
Error string `json:"error,omitempty"`
Preview string `json:"preview,omitempty"`
ID int64 `json:"id"`
}
DeliveryEntry represents a delivery log entry.
type DoctorCategory ¶
type DoctorCategory struct {
Name string `json:"name"`
Items []DoctorItem `json:"items"`
}
DoctorCategory represents a single category within a doctor report.
type DoctorClient ¶
type DoctorClient struct {
// contains filtered or unexported fields
}
DoctorClient provides doctor/diagnostic operations via the daemon.
func (*DoctorClient) ByCategory ¶
func (d *DoctorClient) ByCategory(ctx context.Context, cat string) (*DoctorCategory, error)
ByCategory runs doctor checks for a specific category.
func (*DoctorClient) RunAll ¶
func (d *DoctorClient) RunAll(ctx context.Context) (*DoctorReport, error)
RunAll runs all doctor checks and returns the full report.
func (*DoctorClient) RunAllRaw ¶
func (d *DoctorClient) RunAllRaw(ctx context.Context) (json.RawMessage, error)
RunAllRaw runs all doctor checks and returns the raw JSON.
type DoctorItem ¶
type DoctorItem struct {
Name string `json:"name"`
Severity string `json:"severity"`
Message string `json:"message"`
Fix string `json:"fix,omitempty"`
}
DoctorItem represents a single check item within a doctor category.
type DoctorReport ¶
type DoctorReport struct {
Categories []DoctorCategory `json:"categories"`
}
DoctorReport represents the full doctor report returned by the daemon.
type EventInfo ¶
type EventInfo struct {
Data map[string]any `json:"data,omitempty"`
Timestamp time.Time `json:"ts"`
Type string `json:"type"`
Agent string `json:"agent,omitempty"`
Message string `json:"message,omitempty"`
}
EventInfo represents an event log entry returned by the daemon.
type EventsClient ¶
type EventsClient struct {
// contains filtered or unexported fields
}
EventsClient provides event log operations via the daemon.
func (*EventsClient) Append ¶
func (e *EventsClient) Append(ctx context.Context, ev EventInfo) error
Append logs a new event via the daemon.
func (*EventsClient) List ¶
func (e *EventsClient) List(ctx context.Context) ([]EventInfo, error)
List returns all events from the daemon.
func (*EventsClient) ListByAgent ¶
ListByAgent returns events for a specific agent.
type MCPClient ¶
type MCPClient struct {
// contains filtered or unexported fields
}
MCPClient provides MCP server configuration operations via the daemon.
func (*MCPClient) Add ¶
func (m *MCPClient) Add(ctx context.Context, cfg *MCPServerConfig) (*MCPServerConfig, error)
Add adds a new MCP server configuration.
type MCPServerConfig ¶
type MCPServerConfig struct {
Env map[string]string `json:"env,omitempty"`
Name string `json:"name"`
Transport string `json:"transport"`
Command string `json:"command,omitempty"`
URL string `json:"url,omitempty"`
Args []string `json:"args,omitempty"`
Enabled bool `json:"enabled"`
}
MCPServerConfig represents an MCP server configuration.
type MessageInfo ¶
type MessageInfo struct {
Reactions map[string][]string `json:"reactions,omitempty"`
CreatedAt time.Time `json:"created_at"`
Channel string `json:"channel"`
Sender string `json:"sender"`
Content string `json:"content"`
Type string `json:"type,omitempty"`
ID int64 `json:"id,omitempty"`
}
MessageInfo represents a channel message returned by the daemon.
type NotifyClient ¶
type NotifyClient struct {
// contains filtered or unexported fields
}
NotifyClient provides notification subscription operations via the daemon.
func (*NotifyClient) Activity ¶
func (n *NotifyClient) Activity(ctx context.Context, channel string, limit int) ([]DeliveryEntry, error)
Activity returns recent delivery log entries for a channel.
func (*NotifyClient) ChannelSubscriptions ¶
func (n *NotifyClient) ChannelSubscriptions(ctx context.Context, channel string) ([]Subscription, error)
ChannelSubscriptions returns subscriptions for a specific channel.
func (*NotifyClient) ListSubscriptions ¶
func (n *NotifyClient) ListSubscriptions(ctx context.Context) ([]Subscription, error)
ListSubscriptions returns all subscriptions.
func (*NotifyClient) Subscribe ¶
func (n *NotifyClient) Subscribe(ctx context.Context, channel, agent string, mentionOnly bool) error
Subscribe adds an agent to a channel.
func (*NotifyClient) Unsubscribe ¶
func (n *NotifyClient) Unsubscribe(ctx context.Context, channel, agent string) error
Unsubscribe removes an agent from a channel.
type RoleInfo ¶
type RoleInfo struct {
Commands map[string]string `json:"Commands"`
Skills map[string]string `json:"Skills"`
Agents map[string]string `json:"Agents"`
Rules map[string]string `json:"Rules"`
Settings map[string]any `json:"Settings"`
Name string `json:"Name"`
Prompt string `json:"Prompt"`
PromptCreate string `json:"PromptCreate"`
PromptStart string `json:"PromptStart"`
PromptStop string `json:"PromptStop"`
PromptDelete string `json:"PromptDelete"`
Review string `json:"Review"`
MCPServers []string `json:"MCPServers"`
Secrets []string `json:"Secrets"`
Plugins []string `json:"Plugins"`
}
RoleInfo represents a resolved role from the API.
type RolesClient ¶
type RolesClient struct {
// contains filtered or unexported fields
}
RolesClient provides role management operations.
type SecretInfo ¶
type SecretInfo struct {
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
}
SecretInfo represents secret metadata returned by the daemon. Values are never exposed — only metadata.
type SecretsClient ¶
type SecretsClient struct {
// contains filtered or unexported fields
}
SecretsClient provides secret operations via the daemon.
func (*SecretsClient) Create ¶
func (s *SecretsClient) Create(ctx context.Context, name, value, description string) (*SecretInfo, error)
Create creates or updates a secret with an optional description.
func (*SecretsClient) Delete ¶
func (s *SecretsClient) Delete(ctx context.Context, name string) error
Delete removes a secret by name.
func (*SecretsClient) Get ¶
func (s *SecretsClient) Get(ctx context.Context, name string) (*SecretInfo, error)
Get returns metadata for a single secret by name.
func (*SecretsClient) List ¶
func (s *SecretsClient) List(ctx context.Context) ([]SecretInfo, error)
List returns all secret metadata from the daemon.
func (*SecretsClient) Update ¶
func (s *SecretsClient) Update(ctx context.Context, name, value string) (*SecretInfo, error)
Update updates an existing secret's value.
type SendResultInfo ¶
type SendResultInfo struct {
Matched []string `json:"matched"`
Sent int `json:"sent"`
Skipped int `json:"skipped"`
Failed int `json:"failed"`
}
SendResultInfo holds the result of a broadcast/role/pattern send.
type SessionInfo ¶
type SessionInfo struct {
Timestamp time.Time `json:"timestamp,omitempty"`
ID string `json:"id"`
Current bool `json:"current,omitempty"`
}
SessionInfo represents a single session history entry.
type SetBudgetReq ¶
type SetBudgetReq struct {
Scope string `json:"scope"`
Period string `json:"period"`
LimitUSD float64 `json:"limit_usd"`
AlertAt float64 `json:"alert_at"`
HardStop bool `json:"hard_stop"`
}
SetBudgetReq is the request body for POST /api/costs/budgets.
type SettingsClient ¶
type SettingsClient struct {
// contains filtered or unexported fields
}
SettingsClient provides workspace settings operations via the daemon.
func (*SettingsClient) Get ¶
func (s *SettingsClient) Get(ctx context.Context) (json.RawMessage, error)
Get returns the current workspace settings.
func (*SettingsClient) Patch ¶
func (s *SettingsClient) Patch(ctx context.Context, section string, data map[string]any) (json.RawMessage, error)
Patch updates a specific section of workspace settings.
func (*SettingsClient) Update ¶
func (s *SettingsClient) Update(ctx context.Context, patch map[string]any) (json.RawMessage, error)
Update replaces workspace settings with the given patch map.
type StatsClient ¶
type StatsClient struct {
// contains filtered or unexported fields
}
StatsClient provides system and workspace stats via the daemon.
func (*StatsClient) Summary ¶
func (s *StatsClient) Summary(ctx context.Context) (*SummaryStats, error)
Summary returns workspace-level summary metrics.
func (*StatsClient) System ¶
func (s *StatsClient) System(ctx context.Context) (*SystemStats, error)
System returns system-level metrics.
type StuckConfig ¶
type StuckConfig struct {
// ActivityTimeout is how long without events before considering stuck.
ActivityTimeout time.Duration
// WorkTimeout is how long a task can run before considered stuck.
WorkTimeout time.Duration
// MaxFailures is the number of consecutive failures before considered stuck.
MaxFailures int
}
StuckConfig configures stuck detection thresholds.
type StuckDetection ¶
type StuckDetection struct {
LastEventTime time.Time `json:"last_event_time,omitempty"`
AgentName string `json:"agent_name"`
Reason StuckReason `json:"reason,omitempty"`
Details string `json:"details,omitempty"`
IdleDuration time.Duration `json:"idle_duration,omitempty"`
FailureCount int `json:"failure_count,omitempty"`
IsStuck bool `json:"is_stuck"`
}
StuckDetection contains the result of analyzing an agent for stuck conditions.
func DetectStuck ¶
func DetectStuck(events []EventInfo, config StuckConfig) StuckDetection
DetectStuck analyzes events to determine if an agent is stuck. This mirrors pkg/events.DetectStuck but operates on client EventInfo types, avoiding the need for CLI commands to import pkg/events directly.
type StuckReason ¶
type StuckReason string
StuckReason describes why an agent is considered stuck.
const ( // StuckNoActivity indicates no events in the timeout period. StuckNoActivity StuckReason = "no_activity" // StuckRepeatedFailures indicates the same task has failed multiple times. StuckRepeatedFailures StuckReason = "repeated_failures" // StuckWorkTimeout indicates work started but not completed within timeout. StuckWorkTimeout StuckReason = "work_timeout" )
type Subscription ¶
type Subscription struct {
CreatedAt time.Time `json:"created_at"`
Channel string `json:"channel"`
Agent string `json:"agent"`
ID int64 `json:"id"`
MentionOnly bool `json:"mention_only"`
}
Subscription represents an agent's subscription to a channel.
type SummaryStats ¶
type SummaryStats struct {
AgentsTotal int `json:"agents_total"`
AgentsRunning int `json:"agents_running"`
AgentsStopped int `json:"agents_stopped"`
ChannelsTotal int `json:"channels_total"`
MessagesTotal int `json:"messages_total"`
TotalCostUSD float64 `json:"total_cost_usd"`
RolesTotal int `json:"roles_total"`
ToolsTotal int `json:"tools_total"`
UptimeSeconds int64 `json:"uptime_seconds"`
}
SummaryStats represents workspace-level summary metrics.
type SystemStats ¶
type SystemStats struct {
Hostname string `json:"hostname"`
OS string `json:"os"`
Arch string `json:"arch"`
GoVersion string `json:"go_version"`
CPUUsagePercent float64 `json:"cpu_usage_percent"`
MemoryPercent float64 `json:"memory_usage_percent"`
DiskPercent float64 `json:"disk_usage_percent"`
MemoryTotalBytes uint64 `json:"memory_total_bytes"`
MemoryUsedBytes uint64 `json:"memory_used_bytes"`
DiskTotalBytes uint64 `json:"disk_total_bytes"`
DiskUsedBytes uint64 `json:"disk_used_bytes"`
UptimeSeconds int64 `json:"uptime_seconds"`
CPUs int `json:"cpus"`
Goroutines int `json:"goroutines"`
}
SystemStats represents system-level metrics returned by the daemon.
type ToolInfo ¶
type ToolInfo struct {
Name string `json:"name"`
Command string `json:"command,omitempty"`
InstallCmd string `json:"install_cmd,omitempty"`
UpgradeCmd string `json:"upgrade_cmd,omitempty"`
MCPServers []string `json:"mcp_servers,omitempty"`
SlashCmds []string `json:"slash_cmds,omitempty"`
Enabled bool `json:"enabled"`
Builtin bool `json:"builtin,omitempty"`
}
ToolInfo represents a tool configuration returned by the daemon.
type ToolsClient ¶
type ToolsClient struct {
// contains filtered or unexported fields
}
ToolsClient provides tool management operations via the daemon.
func (*ToolsClient) Delete ¶
func (t *ToolsClient) Delete(ctx context.Context, name string) error
Delete removes a tool by name.
func (*ToolsClient) Disable ¶
func (t *ToolsClient) Disable(ctx context.Context, name string) error
Disable disables a tool by name.
func (*ToolsClient) Enable ¶
func (t *ToolsClient) Enable(ctx context.Context, name string) error
Enable enables a tool by name.