Documentation
¶
Index ¶
- func FormatSkillInvocation(rt Runtime, skillName string) string
- func FormatSkillMessage(rt Runtime, skillName, message string) string
- func Validate(s string) error
- func Values() []string
- type Adapter
- type AdapterConfig
- type Event
- type EventType
- type Question
- type QuestionAnswer
- type QuestionOption
- type Runtime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatSkillInvocation ¶
FormatSkillInvocation returns the skill invocation string for the given runtime. Examples:
CC: "/triage" OC: "/triage" Codex: "$triage"
func FormatSkillMessage ¶
FormatSkillMessage prepends the runtime-appropriate skill invocation to the message.
Types ¶
type Adapter ¶
type Adapter interface {
// Start launches the runtime process and establishes connection.
Start(ctx context.Context) error
// Stop gracefully shuts down the runtime.
Stop(ctx context.Context) error
// SendMessage delivers text to the agent.
SendMessage(ctx context.Context, text string) error
// Events returns a channel that receives agent output events.
// Channel is closed when the adapter stops or the context is cancelled.
Events() <-chan Event
// CreateSession starts a new conversation. Returns session ID.
CreateSession(ctx context.Context) (string, error)
// ResumeSession resumes an existing conversation by ID.
ResumeSession(ctx context.Context, sessionID string) error
// IsHealthy returns true if the runtime is responsive.
IsHealthy(ctx context.Context) bool
// Runtime returns the runtime type.
Runtime() Runtime
}
Adapter abstracts the transport for communicating with a coding agent runtime. Each runtime (CC, OpenCode, Codex) implements this interface.
type AdapterConfig ¶
type AdapterConfig struct {
AgentName string
WorkDir string // Agent workspace directory
Port int // API server port (0 = not applicable for CC)
Model string // Model override
Yolo bool // Skip permission prompts
Env []string // Additional env vars (TTAL_AGENT_NAME, TTAL_TEAM, etc.)
GatewayURL string // OpenClaw Gateway URL (for openclaw runtime)
HooksToken string // OpenClaw hooks auth token (for openclaw runtime)
}
AdapterConfig holds common configuration for all adapters.
type Event ¶
type Event struct {
Type EventType
Agent string
Text string // assistant output text (for EventText/EventError)
// Status fields (for EventStatus).
ContextUsedPct float64
ContextRemainingPct float64
ModelID string
SessionID string
// Question fields (for EventQuestion).
CorrelationID string // tool_use_id / requestID / call_id
Questions []Question // 1-4 questions per event
}
Event represents an output event from any runtime.
type EventType ¶
type EventType string
EventType classifies runtime events.
const ( EventText EventType = "text" // Assistant text output → bridge to Telegram EventStatus EventType = "status" // Context/model status update EventError EventType = "error" // Runtime error EventIdle EventType = "idle" // Agent finished processing, waiting for input EventQuestion EventType = "question" // Agent needs human input )
type Question ¶
type Question struct {
ID string // Per-question ID (empty for CC, Codex uses for answer mapping)
Header string // Short label (e.g. "Database", "Approach")
Text string // Full question text
Options []QuestionOption // Available choices
MultiSelect bool // Allow multiple selections
AllowCustom bool // Allow free-form text input
IsSecret bool // Mask input (Codex only)
}
Question represents a single question from any runtime, normalized to a common format.
type QuestionAnswer ¶
QuestionAnswer pairs a question ID with the user's answer (used for Codex response routing).
type QuestionOption ¶
QuestionOption is one selectable choice for a Question.
type Runtime ¶
type Runtime string
Runtime identifies which coding agent backend to use.
func Parse ¶
Parse converts a string to a Runtime, defaulting to ClaudeCode. Accepts aliases: "cc" for claude-code, "oc" for opencode.
func (Runtime) IsWorkerRuntime ¶
IsWorkerRuntime returns true if the runtime can be used for workers. OpenClaw is agent-only — workers always use CC/OC/Codex.