agentspi

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 4, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeEnv

func MergeEnv(overrides map[string]string) []string

MergeEnv returns the current process environment with the given overrides applied on top: keys present in overrides replace any inherited value, and new keys are appended. The result is sorted for deterministic output. An empty overrides map returns nil so the transport falls back to os.Environ() unchanged.

func Register

func Register(name string, factory Factory)

Types

type Agent

type Agent interface {
	Name() string
	Open(ctx context.Context, h transport.Handlers) (transport.Transport, error)
	InitializeParams() map[string]any
	SessionNewParams(modelID string) map[string]any
	SessionLoadParams(sessionID string) map[string]any
	PromptParams(sessionID, input, modelID string) map[string]any
	Cancel(ctx context.Context, t transport.Transport, sessionID string)
}

func New

func New(name string, req OpenRequest) (Agent, error)

type ConfigOption

type ConfigOption struct {
	ID    string `json:"id"`
	Value string `json:"value,omitempty"`
}

type Factory

type Factory func(OpenRequest) (Agent, error)

type OpenRequest

type OpenRequest struct {
	Service acpservice.ServiceConfig
	CWD     string
}

type ReasoningUpdateFilter

type ReasoningUpdateFilter interface {
	AcceptReasoningUpdate(params json.RawMessage) bool
}

type SessionLister

type SessionLister interface {
	SessionListParams(cwd, cursor string) map[string]any
}

type SessionLoadResolver

type SessionLoadResolver interface {
	ResolveLoadSessionID(ctx context.Context, t transport.Transport, cwd, requestedSessionID string) (loadSessionID, boundSessionID string, err error)
}

SessionLoadResolver maps a host-visible session id to the backend id that session/load accepts, plus the host-bound id the loaded session should be known by (empty means the requested id).

type SessionModelSelector

type SessionModelSelector interface {
	SelectSessionModel(ctx context.Context, t transport.Transport, sessionID, modelID string, opts []ConfigOption) ([]ConfigOption, error)
}

type StableSessionResolver

type StableSessionResolver interface {
	ResolveBoundSessionID(ctx context.Context, t transport.Transport, cwd, rawSessionID string) (string, error)
}

StableSessionResolver maps the raw session/new protocol id to the agent's stable, host-visible session id (e.g. a thick codex bridge resolving the persisted thread id). Returning "" without an error means the stable id is not resolvable yet (typically before the first prompt persists the session); the driver then re-resolves after each prompt and emits a late session event once the stable id settles. The raw protocol id keeps being used on the wire either way. Verified live: the thin codex-acp adapter does NOT need this — its raw session ids are already stable (listable and loadable from a fresh process after the first turn).

type TerminalUpdateDetector

type TerminalUpdateDetector interface {
	IsTerminalUpdate(params json.RawMessage) bool
}

type TranscriptEntry

type TranscriptEntry struct {
	Role string `json:"role"` // user | assistant | reasoning
	Text string `json:"text"`
}

TranscriptEntry is one coalesced transcript message returned by a TranscriptLoader.

type TranscriptLoader

type TranscriptLoader interface {
	LoadSessionTranscript(ctx context.Context, sessionID string) ([]TranscriptEntry, error)
}

TranscriptLoader replaces the runtime's generic session/load transcript replay with an agent-specific implementation (e.g. a thick codex bridge reading its own backend). Agents without it get the generic path: a transient connection that replays the session via session/load and collects the message chunks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL