Documentation
¶
Index ¶
- Variables
- type ActivityTracker
- type EventSink
- type InFlightTurn
- type ListSessionsRequest
- type ListSessionsResponse
- type Manager
- func (m *Manager) Close()
- func (m *Manager) CloseScope(scope string) bool
- func (m *Manager) CloseService(serviceID string) int
- func (m *Manager) CloseThread(serviceID, threadID string) int
- func (m *Manager) ListInFlight() []InFlightTurn
- func (m *Manager) ListInstances() []PooledInstanceInfo
- func (m *Manager) ListPendingPermissions() []PendingPermissionInfo
- func (m *Manager) ListSessions(ctx context.Context, serviceID string, req ListSessionsRequest) (ListSessionsResponse, error)
- func (m *Manager) LoadTranscript(ctx context.Context, serviceID string, req TranscriptRequest) (TranscriptResponse, error)
- func (m *Manager) ResolvePermission(decision PermissionDecision) error
- func (m *Manager) ServeTurn(ctx context.Context, serviceID string, req TurnRequest, emit EventSink) error
- type PendingPermissionInfo
- type PermissionDecision
- type PooledInstanceInfo
- type SessionInfo
- type SessionMetadata
- type TranscriptMessage
- type TranscriptRequest
- type TranscriptResponse
- type TurnEvent
- type TurnRequest
Constants ¶
This section is empty.
Variables ¶
var ErrCapacityExceeded = errors.New("acp instance capacity exceeded")
var ErrInvalidRequest = errors.New("invalid acp request")
ErrInvalidRequest marks a client-correctable problem with a session or transcript request (a disabled service, a cwd outside allowed_roots, or a missing session id). Callers map it to HTTP 400; service-not-found maps to 404 and unwrapped agent/transport failures map to 502.
var ErrPermissionNotFound = fmt.Errorf("acp permission request not found")
ErrPermissionNotFound reports a decision for a permission request that is unknown, already answered, or expired (the in-agent wait timed out and failed closed).
Functions ¶
This section is empty.
Types ¶
type ActivityTracker ¶
type ActivityTracker struct {
// contains filtered or unexported fields
}
func NewActivityTracker ¶
func NewActivityTracker() *ActivityTracker
func (*ActivityTracker) Begin ¶
func (t *ActivityTracker) Begin(scope string) (func(), error)
func (*ActivityTracker) IsActive ¶
func (t *ActivityTracker) IsActive(scope string) bool
func (*ActivityTracker) List ¶
func (t *ActivityTracker) List() []InFlightTurn
type InFlightTurn ¶
type InFlightTurn struct {
Scope string `json:"scope"`
}
type ListSessionsRequest ¶
type ListSessionsResponse ¶
type ListSessionsResponse struct {
Sessions []SessionInfo `json:"sessions"`
NextCursor string `json:"next_cursor,omitempty"`
}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(services *acpservice.Manager) *Manager
func (*Manager) Close ¶
func (m *Manager) Close()
Close stops the janitor and tears down every pooled instance, killing the underlying agent subprocesses. It is safe to call more than once.
func (*Manager) CloseScope ¶
CloseScope tears down the pooled instance for an exact scope, returning whether one was closed. An in-flight turn on that scope will fail on its next request.
func (*Manager) CloseService ¶
CloseService tears down every pooled instance for a service and returns the count closed. This is used after process-affecting service config changes so the next turn starts an agent with the latest launch environment.
func (*Manager) CloseThread ¶
CloseThread tears down every pooled instance for a service+thread and returns the count closed. Intended as an operator escape hatch for a wedged thread.
func (*Manager) ListInFlight ¶
func (m *Manager) ListInFlight() []InFlightTurn
func (*Manager) ListInstances ¶
func (m *Manager) ListInstances() []PooledInstanceInfo
ListInstances returns an operator-facing snapshot of the pooled instances, including each instance's cached session metadata, sorted by scope.
func (*Manager) ListPendingPermissions ¶
func (m *Manager) ListPendingPermissions() []PendingPermissionInfo
ListPendingPermissions returns the in-flight interactive permission requests awaiting a decision.
func (*Manager) ListSessions ¶
func (m *Manager) ListSessions(ctx context.Context, serviceID string, req ListSessionsRequest) (ListSessionsResponse, error)
func (*Manager) LoadTranscript ¶
func (m *Manager) LoadTranscript(ctx context.Context, serviceID string, req TranscriptRequest) (TranscriptResponse, error)
func (*Manager) ResolvePermission ¶
func (m *Manager) ResolvePermission(decision PermissionDecision) error
ResolvePermission answers one pending interactive permission request. The outcome must be the ACP discriminator "selected" (with the chosen option id exactly as offered by the agent) or "cancelled".
type PendingPermissionInfo ¶
type PendingPermissionInfo struct {
RequestID string `json:"request_id"`
ServiceID string `json:"service_id"`
SessionID string `json:"session_id,omitempty"`
CreatedAt time.Time `json:"created_at"`
Data json.RawMessage `json:"data,omitempty"`
}
PendingPermissionInfo describes one in-flight interactive permission request. Data carries the raw ACP session/request_permission params (tool call context plus the agent's permission options and their exact ids).
type PermissionDecision ¶
type PermissionDecision struct {
RequestID string `json:"request_id"`
Outcome string `json:"outcome"`
OptionID string `json:"option_id,omitempty"`
}
PermissionDecision is the north-side answer to a pending interactive permission request. Outcome follows the ACP RequestPermissionOutcome discriminators: "selected" (with the chosen option id) or "cancelled".
type PooledInstanceInfo ¶
type PooledInstanceInfo struct {
Scope string `json:"scope"`
SessionID string `json:"session_id,omitempty"`
Alive bool `json:"alive"`
Active bool `json:"active"`
LastUsed time.Time `json:"last_used"`
IdleTTL time.Duration `json:"idle_ttl,omitempty"`
Metadata SessionMetadata `json:"metadata"`
}
PooledInstanceInfo is the operator-facing view of one pooled agent instance.
type SessionInfo ¶
type SessionMetadata ¶
type SessionMetadata struct {
ConfigOptions json.RawMessage `json:"config_options,omitempty"`
AvailableCommands json.RawMessage `json:"available_commands,omitempty"`
SessionInfo json.RawMessage `json:"session_info,omitempty"`
Mode json.RawMessage `json:"mode,omitempty"`
Usage json.RawMessage `json:"usage,omitempty"`
}
SessionMetadata is the cached structured state of one pooled session. Every field carries the raw ACP update object of its kind (config_option_update, available_commands_update, session_info_update, current_mode_update, usage_update).
type TranscriptMessage ¶
TranscriptMessage is one coalesced replayed message. Role is one of user, assistant, or reasoning.
type TranscriptRequest ¶
type TranscriptResponse ¶
type TranscriptResponse struct {
SessionID string `json:"session_id"`
Messages []TranscriptMessage `json:"messages"`
}
type TurnEvent ¶
type TurnEvent struct {
Event string `json:"-"`
SessionID string `json:"session_id,omitempty"`
RequestID string `json:"request_id,omitempty"`
Text string `json:"text,omitempty"`
StopReason string `json:"stop_reason,omitempty"`
Message string `json:"message,omitempty"`
Data json.RawMessage `json:"data,omitempty"`
}
type TurnRequest ¶
type TurnRequest struct {
ThreadID string `json:"thread_id"`
SessionID string `json:"session_id,omitempty"`
Input string `json:"input"`
CWD string `json:"cwd,omitempty"`
Model string `json:"model,omitempty"`
FreshSession bool `json:"fresh_session,omitempty"`
ConfigOverrides map[string]string `json:"config_overrides,omitempty"`
}
Directories
¶
| Path | Synopsis |
|---|---|
|
Package acpupdate parses ACP session/update notifications into a small set of neutral events the runtime driver forwards to the gateway north side.
|
Package acpupdate parses ACP session/update notifications into a small set of neutral events the runtime driver forwards to the gateway north side. |