Documentation
¶
Index ¶
- Constants
- func DecodePermissionMessageJSON(raw json.RawMessage) (string, error)
- func ExitCodeForStopReason(stopReason string) int
- func IsRetryableFailure(exitCode int, stopReason string) bool
- func NewStartOnlyThinkingError(backend, value string) error
- func NewUnsupportedThinkingError(backend string) error
- func NewUnsupportedThinkingValueError(backend, value string) error
- func StopReasonForExitCode(exitCode int) string
- func ValidatePermissionMessage(msg string) error
- func ValidateThinking(value string) error
- func ValidateThinkingForBackend(backend, value string) error
- func ValidateThinkingForBackendResume(backend, value string) error
- type AgentResult
- type Capabilities
- type ChildQuestionPayload
- type PermissionResponse
- type Provider
- type Session
- type StartOptions
Constants ¶
const (
EventChildQuestion = "child.question"
)
Shared runtime event names.
const MaxPermissionMessageBytes = 64 << 10 // 64 KiB
MaxPermissionMessageBytes is the maximum allowed size for a write-in permission message. Messages are validated as UTF-8 and must not exceed this bound.
const SessionIDConflictStopReason = "session_id_conflict"
Variables ¶
This section is empty.
Functions ¶
func DecodePermissionMessageJSON ¶
func DecodePermissionMessageJSON(raw json.RawMessage) (string, error)
DecodePermissionMessageJSON decodes a JSON string without accepting the replacement behavior encoding/json applies to malformed UTF-8 or unpaired UTF-16 surrogate escapes.
func ExitCodeForStopReason ¶
ExitCodeForStopReason returns Avenor's locked process exit code for a terminal ACP stop reason.
func IsRetryableFailure ¶
IsRetryableFailure reports whether a failed attempt may be retried. Session identity conflicts are fatal: retrying could resume a provisional ID or let an attempt finish without adopting the provider's authoritative session ID.
func NewStartOnlyThinkingError ¶
NewStartOnlyThinkingError reports that a backend supports the value only on a new session, not an explicit resume.
func NewUnsupportedThinkingError ¶
NewUnsupportedThinkingError returns the shared unsupported-parameter error.
func NewUnsupportedThinkingValueError ¶
NewUnsupportedThinkingValueError reports a canonical value that the backend supports in general but cannot apply natively.
func StopReasonForExitCode ¶
StopReasonForExitCode is the inverse of ExitCodeForStopReason. Returns an empty string for exit code 1 (generic failure) since there is no canonical stop reason for that case.
func ValidatePermissionMessage ¶
ValidatePermissionMessage checks that a message is valid UTF-8 and within the size bound. Returns nil for an empty message (ordinary options).
func ValidateThinking ¶
ValidateThinking accepts the canonical thinking controls and an empty value.
func ValidateThinkingForBackend ¶
ValidateThinkingForBackend applies the conservative backend policy after validating the canonical value. This is the start-session policy; explicit resume support is represented separately (see thinkingpolicy.Policies).
func ValidateThinkingForBackendResume ¶
ValidateThinkingForBackendResume applies the conservative backend policy for an explicit resume, distinguishing start-only support from capability gaps.
Types ¶
type AgentResult ¶
type AgentResult struct {
SessionID string `json:"session_id"`
StopReason string `json:"stop_reason"`
ExitCode int `json:"exit_code"`
OutputFiles []string `json:"output_files,omitempty"`
}
AgentResult holds the result of a completed agent session.
type Capabilities ¶
type Capabilities struct {
Backend string
Permissions bool
Resume bool
ExternalServerURL bool
SubprocessDiscovery bool
ModelSelection bool
}
Capabilities describes what a runtime backend supports.
type ChildQuestionPayload ¶
type ChildQuestionPayload struct {
RuntimeID string `json:"runtime_id"`
SessionID string `json:"session_id"`
ChildID string `json:"child_id"`
Message string `json:"message"`
RequestID string `json:"request_id"`
}
ChildQuestionPayload is the shared contract for child->parent clarification events emitted by the supervisor and consumed by orchestrators.
func (ChildQuestionPayload) Fields ¶
func (p ChildQuestionPayload) Fields() map[string]any
Fields returns the event field map used in events.Event.Fields.
type PermissionResponse ¶
PermissionResponse is the response to a permission request.
type Provider ¶
type Provider interface {
Start(ctx context.Context, opts StartOptions) (Session, error)
Resume(ctx context.Context, sessionID string) (Session, error)
Prompt(ctx context.Context, sessionID string, prompt string) error
Cancel(ctx context.Context, sessionID string) error
Events(ctx context.Context, sessionID string) (<-chan events.Event, error)
AnswerPermission(ctx context.Context, sessionID string, requestID string, response PermissionResponse) error
Capabilities(ctx context.Context) (Capabilities, error)
}
Provider is the interface that all ACP runtime backends must implement.
type Session ¶
type Session struct {
SessionID string
Backend string
Dir string
PID int // Consumed by longe halt (SIGTERM); set by opencode-acp backend. 0 otherwise.
}
Session represents an active ACP session.
type StartOptions ¶
type StartOptions struct {
Agent string
Label string
Dir string
ServerURL string
Model string
AgentProfile string
Thinking string
RuntimeID string // supervisor-assigned runtime ID (rt_N), for parent-child routing
Broker *broker.Broker // optional shared broker instance; backends may create their own if nil
// SkipPermissions passes --dangerously-skip-permissions to the agy CLI in
// headless (non-RPC) transport, where there is no interactive/AnswerPermission
// path available to approve a tool call. Defaults to false (agy's own
// default); callers running agy fully non-interactively must opt in.
// Only consumed by the agy backend today.
SkipPermissions bool
}
StartOptions holds options for starting a new session.
func MergeStartOptions ¶
func MergeStartOptions(base, override StartOptions) StartOptions
MergeStartOptions returns a new StartOptions with non-zero fields from override applied over base. Use this to combine provider-scoped defaults with per-start overrides.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package broker provides a harness-agnostic run broker for agent communication.
|
Package broker provides a harness-agnostic run broker for agent communication. |
|
claudecore
|
|
|
terminal
Package terminal provides an abstraction for interactive terminal sessions.
|
Package terminal provides an abstraction for interactive terminal sessions. |