Documentation
¶
Index ¶
- Constants
- type AgentInfo
- type AgentSpec
- type Connection
- type ContextPolicy
- type Error
- type Event
- type EventPolicy
- type InitializeResult
- type Interaction
- type InteractionPolicy
- type InteractionStatus
- type Manager
- func (m *Manager) AgentInfo(ctx context.Context) (InitializeResult, error)
- func (m *Manager) AgentName() string
- func (m *Manager) AllowedRoots() []string
- func (m *Manager) Authenticate(ctx context.Context, methodID string) error
- func (m *Manager) CancelPrompt(_ context.Context, sessionID, runID string) error
- func (m *Manager) Close() error
- func (m *Manager) CloseSession(ctx context.Context, id string) (SessionRecord, error)
- func (m *Manager) DeleteSession(ctx context.Context, id string) error
- func (m *Manager) ForkSession(ctx context.Context, id, cwd string, additionalDirectories []string) (SessionResult, error)
- func (m *Manager) InspectInteraction(id string) (Interaction, error)
- func (m *Manager) InspectSession(id string) (SessionRecord, error)
- func (m *Manager) ListInteractions(sessionID string, pendingOnly bool) []Interaction
- func (m *Manager) ListSessions() ([]SessionRecord, error)
- func (m *Manager) LoadSession(ctx context.Context, id string) (SessionResult, error)
- func (m *Manager) NewSession(ctx context.Context, cwd string, additionalDirectories []string) (SessionResult, error)
- func (m *Manager) PromptEvents(ctx context.Context, runID string, after uint64, limit int, wait time.Duration) (PromptEventsResult, error)
- func (m *Manager) RespondInteraction(id, optionID string, cancelled bool) (Interaction, error)
- func (m *Manager) ResumeSession(ctx context.Context, id string) (SessionResult, error)
- func (m *Manager) SetSessionConfigOption(ctx context.Context, id, configID string, value any) (any, error)
- func (m *Manager) SetSessionMode(ctx context.Context, id, modeID string) error
- func (m *Manager) StartPrompt(ctx context.Context, sessionID, text string) (PromptStartResult, error)
- func (m *Manager) Steer(ctx context.Context, sessionID, text string) (map[string]any, error)
- type NotificationHandler
- type Options
- type PermissionOption
- type PromptEventsResult
- type PromptStartResult
- type RequestHandler
- type Run
- type RunStatus
- type RuntimePolicies
- type SessionRecord
- type SessionResult
- type SessionStatus
- type SteeringPolicy
Constants ¶
View Source
const (
ProtocolVersion = 1
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection(reader io.ReadCloser, writer io.WriteCloser, requestHandler RequestHandler, notificationHandler NotificationHandler) *Connection
func (*Connection) Close ¶
func (c *Connection) Close() error
func (*Connection) Closed ¶
func (c *Connection) Closed() <-chan struct{}
type ContextPolicy ¶
type Event ¶
type Event struct {
Seq uint64 `json:"seq"`
Type string `json:"type"`
SessionID string `json:"session_id"`
RunID string `json:"run_id,omitempty"`
CreatedAt time.Time `json:"created_at"`
Update json.RawMessage `json:"update,omitempty"`
UpdateTruncated bool `json:"update_truncated,omitempty"`
OriginalUpdateBytes int `json:"original_update_bytes,omitempty"`
StopReason string `json:"stop_reason,omitempty"`
ErrorCode string `json:"error_code,omitempty"`
Message string `json:"message,omitempty"`
}
type EventPolicy ¶
type InitializeResult ¶
type Interaction ¶
type Interaction struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
Kind string `json:"kind"`
Status InteractionStatus `json:"status"`
ToolCall map[string]any `json:"tool_call,omitempty"`
Options []PermissionOption `json:"options,omitempty"`
CreatedAt time.Time `json:"created_at"`
ExpiresAt time.Time `json:"expires_at"`
// contains filtered or unexported fields
}
type InteractionPolicy ¶
type InteractionPolicy struct {
MemoryOnly bool `json:"memory_only"`
MaxOptions int `json:"max_options"`
MaxToolCallBytes int `json:"max_tool_call_bytes"`
MaxPendingGlobal int `json:"max_pending_global"`
MaxPendingPerSession int `json:"max_pending_per_session"`
AlwaysOptionsFiltered bool `json:"always_options_filtered"`
}
type InteractionStatus ¶
type InteractionStatus string
const ( InteractionPending InteractionStatus = "pending" InteractionResponded InteractionStatus = "responded" InteractionCancelled InteractionStatus = "cancelled" InteractionExpired InteractionStatus = "expired" )
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) AgentInfo ¶
func (m *Manager) AgentInfo(ctx context.Context) (InitializeResult, error)
func (*Manager) AllowedRoots ¶
func (*Manager) Authenticate ¶
func (*Manager) CancelPrompt ¶
func (*Manager) CloseSession ¶
func (*Manager) DeleteSession ¶
func (*Manager) ForkSession ¶
func (*Manager) InspectInteraction ¶
func (m *Manager) InspectInteraction(id string) (Interaction, error)
func (*Manager) InspectSession ¶
func (m *Manager) InspectSession(id string) (SessionRecord, error)
func (*Manager) ListInteractions ¶
func (m *Manager) ListInteractions(sessionID string, pendingOnly bool) []Interaction
func (*Manager) ListSessions ¶
func (m *Manager) ListSessions() ([]SessionRecord, error)
func (*Manager) LoadSession ¶
func (*Manager) NewSession ¶
func (*Manager) PromptEvents ¶
func (*Manager) RespondInteraction ¶
func (m *Manager) RespondInteraction(id, optionID string, cancelled bool) (Interaction, error)
func (*Manager) ResumeSession ¶
func (*Manager) SetSessionConfigOption ¶
func (*Manager) SetSessionMode ¶
func (*Manager) StartPrompt ¶
type NotificationHandler ¶
type NotificationHandler func(string, json.RawMessage)
type PermissionOption ¶
type PromptEventsResult ¶
type PromptEventsResult struct {
RunID string `json:"run_id"`
SessionID string `json:"session_id"`
Status RunStatus `json:"status"`
Events []Event `json:"events"`
NextSeq uint64 `json:"next_seq"`
FirstSeq uint64 `json:"first_seq"`
LatestSeq uint64 `json:"latest_seq"`
DroppedCount uint64 `json:"dropped_count"`
HasMore bool `json:"has_more"`
Truncated bool `json:"truncated"`
StartedAt time.Time `json:"started_at"`
EndedAt *time.Time `json:"ended_at,omitempty"`
StopReason string `json:"stop_reason,omitempty"`
ErrorCode string `json:"error_code,omitempty"`
Message string `json:"message,omitempty"`
}
type PromptStartResult ¶
type RequestHandler ¶
type RuntimePolicies ¶
type RuntimePolicies struct {
Context ContextPolicy `json:"context_policy"`
Events EventPolicy `json:"event_policy"`
Interactions InteractionPolicy `json:"interaction_policy"`
Steering SteeringPolicy `json:"steering_policy"`
}
RuntimePolicies is the machine-readable contract returned by acp_session info. Values are derived from the same constants that enforce the runtime, keeping client guidance and server behavior in one source of truth.
func CurrentPolicies ¶
func CurrentPolicies() RuntimePolicies
type SessionRecord ¶
type SessionRecord struct {
SchemaVersion int `json:"schema_version"`
ID string `json:"id"`
Agent string `json:"agent"`
RemoteSessionID string `json:"remote_session_id"`
CWD string `json:"cwd"`
AdditionalDirectories []string `json:"additional_directories,omitempty"`
Status SessionStatus `json:"status"`
LastStopReason string `json:"last_stop_reason,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ClosedAt *time.Time `json:"closed_at,omitempty"`
}
type SessionResult ¶
type SessionResult struct {
Session SessionRecord `json:"session"`
Modes any `json:"modes,omitempty"`
ConfigOptions any `json:"config_options,omitempty"`
Agent AgentInfo `json:"agent"`
}
type SessionStatus ¶
type SessionStatus string
const ( SessionReady SessionStatus = "ready" SessionRunning SessionStatus = "running" SessionInterrupted SessionStatus = "interrupted" SessionClosed SessionStatus = "closed" SessionError SessionStatus = "error" )
type SteeringPolicy ¶
Click to show internal directories.
Click to hide internal directories.