Documentation
¶
Overview ¶
Package cli provides shared CLI process infrastructure for external agent runtimes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TaskRuntimeRoot ¶ added in v0.3.7
TaskRuntimeRoot returns the task-private root shared by every CLI runtime.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver contains the shared process, provider-session, and event parsing machinery used by concrete CLI Runtime implementations.
func NewDriver ¶
func NewDriver( name string, invoker Invoker, options ...agent.RuntimeAdapterOptions, ) (*Driver, error)
NewDriver creates shared infrastructure for one concrete CLI Runtime.
func (*Driver) RunInvocation ¶
func (r *Driver) RunInvocation( ctx context.Context, request agent.ExecutionRequest, observer agent.NodeObserver, ) (agent.ExecutionResult, error)
RunInvocation executes one request for the concrete Runtime that owns this provider invocation facility.
type Invocation ¶
type Invocation struct {
Process runtimeprocess.Process
Events <-chan agent.NodeEvent
Result <-chan InvocationResult
Responder agent.ApprovalResponder
Questions agent.QuestionResponder
}
Invocation is a running provider process and its normalized activity stream.
type InvocationRequest ¶
type InvocationRequest struct {
ExecutionID string
ExecutionMode agent.ExecutionMode
SessionID string
Resume bool
WorkDir string
TaskDir string
SkillDir string
SystemPrompt string
Prompt string
Messages []agent.Message
Tools []agent.Tool
AllowedTools []string
TraceID string
SessionKey string
Model agent.ModelConfig
ExtraEnv []string
PermissionMode string
ApprovalHandler agent.InteractionHandler
MCPServers []agent.MCPServerConfig
}
InvocationRequest contains the provider-specific process input derived from one immutable agent execution request.
type InvocationResult ¶
type InvocationResult struct {
Message string
Usage *agent.Usage
ProviderSessionID string
Err error
}
InvocationResult is the terminal provider result for one CLI invocation. Process lifecycle is intentionally separate from observable NodeEvents.
func ConsumeEvents ¶
func ConsumeEvents( ctx context.Context, observer agent.NodeObserver, handle *Invocation, executionID string, traceID string, approvalHandler agent.InteractionHandler, questionHandler agent.InteractionHandler, ) (InvocationResult, error)
ConsumeEvents reads NodeEvents from the invocation, processes approvals/questions, normalizes message IDs, and forwards to the NodeObserver.
type Invoker ¶
type Invoker interface {
Prepare(ctx context.Context, workDir string) error
Invoke(ctx context.Context, request InvocationRequest) (*Invocation, error)
}
Invoker starts a single external CLI provider process.
It is deliberately narrower than agent.Runtime: it does not resolve runtime names, own provider-session persistence, or publish execution lifecycle.
type MessageIDMapper ¶
type MessageIDMapper struct {
// contains filtered or unexported fields
}
MessageIDMapper maps provider-local message IDs to stable execution-local IDs.
func NewMessageIDMapper ¶
func NewMessageIDMapper() *MessageIDMapper
NewMessageIDMapper creates an execution-local message ID mapper.
func (*MessageIDMapper) CurrentOrNew ¶
func (m *MessageIDMapper) CurrentOrNew() string
CurrentOrNew returns the current message ID or creates one.
func (*MessageIDMapper) ForProvider ¶
func (m *MessageIDMapper) ForProvider(providerID string) string
ForProvider returns the stable ID assigned to one provider message.
func (*MessageIDMapper) StartNew ¶
func (m *MessageIDMapper) StartNew() string
StartNew creates and selects a new message ID.