Documentation
¶
Index ¶
- func MessageToFrame(msg Message) (pty.Frame, error)
- func MustJSON(v any) json.RawMessage
- type AgentIdentity
- type AgentStats
- type ChatPayload
- type CommandSpec
- type DistributeConfig
- type ExecPayload
- type FileRPCPayload
- type FileUploadPayload
- type FileUploadResult
- type Message
- type PTYPayload
- type RegisterPayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustJSON ¶ added in v0.3.0
func MustJSON(v any) json.RawMessage
Types ¶
type AgentIdentity ¶
type AgentIdentity struct {
NodeID string `json:"node_id,omitempty"`
NodeName string `json:"node_name,omitempty"`
Space string `json:"space,omitempty"`
IOAURL string `json:"ioa_url,omitempty"`
Hostname string `json:"hostname,omitempty"`
Username string `json:"username,omitempty"`
WorkingDir string `json:"working_dir,omitempty"`
OS string `json:"os,omitempty"`
Arch string `json:"arch,omitempty"`
PID int `json:"pid,omitempty"`
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
Meta map[string]any `json:"meta,omitempty"`
}
type AgentStats ¶
type AgentStats struct {
Turns int `json:"turns,omitempty"`
ToolCalls int `json:"tool_calls,omitempty"`
RunningTools int `json:"running_tools,omitempty"`
PromptTokens int `json:"prompt_tokens,omitempty"`
CompletionTokens int `json:"completion_tokens,omitempty"`
TotalTokens int `json:"total_tokens,omitempty"`
CacheReadTokens int `json:"cache_read_tokens,omitempty"`
CacheWriteTokens int `json:"cache_write_tokens,omitempty"`
Assets int `json:"assets,omitempty"`
Loots int `json:"loots,omitempty"`
LastEvent string `json:"last_event,omitempty"`
}
type ChatPayload ¶ added in v0.3.0
type ChatPayload struct {
SessionID string `json:"session_id,omitempty"`
EvalCriteria string `json:"eval_criteria,omitempty"`
EvalMaxRounds int `json:"eval_max_rounds,omitempty"`
PersistMaxTurns int `json:"persist_max_turns,omitempty"`
}
ChatPayload is the WS payload for a "chat" message: it scopes the remote agent conversation to a web session and carries optional Goal-mode run controls. Empty EvalCriteria means a plain turn; a non-empty one makes the agent run the evaluator loop against the criteria for up to EvalMaxRounds.
type CommandSpec ¶ added in v0.3.0
type CommandSpec struct {
Name string `json:"name"`
Aliases []string `json:"aliases,omitempty"`
Usage string `json:"usage,omitempty"`
Description string `json:"description,omitempty"`
}
CommandSpec is the surface-neutral description of one user-facing "/verb" command.
type DistributeConfig ¶ added in v0.2.8
type DistributeConfig struct {
LLM struct {
Provider string `json:"provider" yaml:"provider"`
BaseURL string `json:"base_url" yaml:"base_url"`
APIKey string `json:"api_key,omitempty" yaml:"api_key"`
Model string `json:"model" yaml:"model"`
Proxy string `json:"proxy" yaml:"proxy"`
} `json:"llm" yaml:"llm"`
Cyberhub struct {
URL string `json:"url" yaml:"url"`
Key string `json:"key,omitempty" yaml:"key"`
Mode string `json:"mode" yaml:"mode"`
Proxy string `json:"proxy" yaml:"proxy"`
} `json:"cyberhub" yaml:"cyberhub"`
Recon struct {
FofaEmail string `json:"fofa_email" yaml:"fofa_email"`
FofaKey string `json:"fofa_key,omitempty" yaml:"fofa_key"`
HunterToken string `json:"hunter_token,omitempty" yaml:"hunter_token"`
HunterAPIKey string `json:"hunter_api_key,omitempty" yaml:"hunter_api_key"`
Proxy string `json:"proxy" yaml:"proxy"`
Limit *int `json:"limit,omitempty" yaml:"limit,omitempty"`
} `json:"recon" yaml:"recon"`
Scan struct {
Verify string `json:"verify" yaml:"verify"`
} `json:"scan" yaml:"scan"`
Search struct {
TavilyKeys string `json:"tavily_keys,omitempty" yaml:"tavily_keys"`
} `json:"search" yaml:"search"`
IOA struct {
URL string `json:"url" yaml:"url"`
Token string `json:"token,omitempty" yaml:"token"`
NodeName string `json:"node_name" yaml:"node_name"`
Space string `json:"space" yaml:"space"`
} `json:"ioa" yaml:"ioa"`
Agent struct {
Tools []string `json:"tools,omitempty" yaml:"tools,omitempty"`
Timeout int `json:"timeout" yaml:"timeout"`
SaveSession bool `json:"save_session" yaml:"save_session"`
} `json:"agent" yaml:"agent"`
}
DistributeConfig is the configuration payload sent from the web server to agents. All secret fields are included so agents can use them. Also used by the settings UI (with secrets masked at the handler level).
type ExecPayload ¶ added in v0.3.0
type ExecPayload struct {
Command string `json:"command"`
Cwd string `json:"cwd,omitempty"`
Timeout int `json:"timeout,omitempty"`
Env map[string]string `json:"env,omitempty"`
}
ExecPayload carries structured parameters for an "exec" message. When Payload is populated, Command/Cwd/Timeout/Env are used instead of the legacy Data field. If Payload is empty, Data is treated as the command.
type FileRPCPayload ¶ added in v0.3.0
FileRPCPayload carries the target path for Cairn runner file operations. The file bytes travel in Message.DataB64 so the webagent transport remains JSON-only even when the Cairn side uses binary WebSocket frames.
type FileUploadPayload ¶ added in v0.2.8
type FileUploadResult ¶ added in v0.2.8
type Message ¶
type Message struct {
Type string `json:"type"`
TaskID string `json:"task_id,omitempty"`
StreamID string `json:"stream_id,omitempty"`
Data string `json:"data,omitempty"`
DataB64 string `json:"data_b64,omitempty"`
Payload json.RawMessage `json:"payload,omitempty"`
}
func FrameToMessage ¶
type PTYPayload ¶
type PTYPayload struct {
SessionID string `json:"session_id,omitempty"`
Data string `json:"data,omitempty"`
DataB64 string `json:"data_b64,omitempty"`
Command string `json:"command,omitempty"`
Kind string `json:"kind,omitempty"`
Args []string `json:"args,omitempty"`
Name string `json:"name,omitempty"`
Rows int `json:"rows,omitempty"`
Cols int `json:"cols,omitempty"`
Bytes int `json:"bytes,omitempty"`
Singleton bool `json:"singleton,omitempty"`
State tmux.State `json:"state,omitempty"`
ExitCode int `json:"exit_code,omitempty"`
Session *tmux.Info `json:"session,omitempty"`
Sessions []tmux.Info `json:"sessions,omitempty"`
}
func DecodePTYPayload ¶
func DecodePTYPayload(raw json.RawMessage) (PTYPayload, error)
type RegisterPayload ¶
type RegisterPayload struct {
Name string `json:"name"`
// Commands is the LLM tool/pseudo-command registry (pkg/commands) the agent
// exposes to the model — distinct from CommandsMenu.
Commands []string `json:"commands,omitempty"`
// CommandsMenu is the agent's user-facing "/verb" catalog: the agent-scope,
// menu-visible commands it can run, plus one per loaded skill. The hub merges
// these with its own hub-scope commands to drive the web "/" menu and /help,
// so the surfaces never drift.
CommandsMenu []CommandSpec `json:"commands_menu,omitempty"`
Identity AgentIdentity `json:"identity,omitempty"`
Stats AgentStats `json:"stats,omitempty"`
}