Documentation
¶
Overview ¶
Package runtime defines the coding agent runtime abstraction layer.
It declares the Runtime type (claude-code, codex) with parsing and validation helpers, and the Adapter interface that each runtime backend implements to provide a uniform API for starting, stopping, sending messages, receiving structured events, creating/resuming sessions, and health checks — enabling the daemon to resume interrupted conversations seamlessly.
Plane: shared
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatSkillInvocation ¶
FormatSkillInvocation returns the skill invocation string for the given runtime.
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.
// Returns the session ID on success.
ResumeSession(ctx context.Context, sessionID string) (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, Codex) implements this interface.
type AdapterConfig ¶
type AdapterConfig struct {
AgentName string
WorkDir string // Agent workspace directory
Model string // Model override
Env []string // Additional env vars (TTAL_AGENT_NAME, TASKRC, etc.)
}
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
// Tool fields (for EventTool).
ToolName string
}
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 EventTool EventType = "tool" // Tool invocation detected )
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, "cx" for codex.
func (Runtime) IsWorkerRuntime ¶
IsWorkerRuntime returns true if the runtime can be used for workers.