Documentation
¶
Overview ¶
Package adapter defines narrow host integration contracts for MCP servers and external agent harnesses. It contains no transport implementation.
Index ¶
- type AgentHarness
- type AuthMode
- type HarnessCapabilities
- type HarnessCapabilityReporter
- type HarnessConfig
- type HarnessManifest
- type HarnessRegistry
- func (r *HarnessRegistry) Configure(ctx context.Context, name string, config HarnessConfig) error
- func (r *HarnessRegistry) Get(name string) (AgentHarness, bool)
- func (r *HarnessRegistry) List() []string
- func (r *HarnessRegistry) Manifest(ctx context.Context, name string) (HarnessManifest, error)
- func (r *HarnessRegistry) Register(harness AgentHarness) error
- func (r *HarnessRegistry) Statuses(ctx context.Context) ([]HarnessStatus, error)
- type HarnessRequest
- type HarnessResult
- type HarnessStatus
- type HarnessSupervisor
- func (s *HarnessSupervisor) Cancel(ctx context.Context, runID string) error
- func (s *HarnessSupervisor) Resume(ctx context.Context, request HarnessRequest, sink func(trajectory.Event) error) (HarnessResult, error)
- func (s *HarnessSupervisor) Run(ctx context.Context, request HarnessRequest, sink func(trajectory.Event) error) (HarnessResult, error)
- func (s *HarnessSupervisor) Status(ctx context.Context) (HarnessStatus, error)
- type Health
- type MCPCatalog
- type MCPConfig
- type MCPPromptRef
- type MCPPromptRequest
- type MCPRegistry
- func (r *MCPRegistry) Catalog(name string) (MCPCatalog, bool)
- func (r *MCPRegistry) Reconnect(ctx context.Context, name string) error
- func (r *MCPRegistry) Refresh(ctx context.Context, name string, refreshAuth bool) (MCPCatalog, error)
- func (r *MCPRegistry) Register(ctx context.Context, config MCPConfig, server MCPServer) error
- func (r *MCPRegistry) Statuses(ctx context.Context) (map[string]MCPStatus, error)
- func (r *MCPRegistry) Unregister(ctx context.Context, name string) error
- func (r *MCPRegistry) WatchCatalog(ctx context.Context, name string) error
- type MCPResourceRef
- type MCPResourceRequest
- type MCPServer
- type MCPStatus
- type MCPTool
- type MCPToolCall
- type MCPToolResult
- type ResumeMode
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentHarness ¶
type AgentHarness interface {
Name() string
Validate(HarnessConfig) error
Configure(context.Context, HarnessConfig) error
Version(context.Context) (string, error)
Run(context.Context, HarnessRequest, func(trajectory.Event) error) (HarnessResult, error)
Resume(context.Context, HarnessRequest, func(trajectory.Event) error) (HarnessResult, error)
Cancel(context.Context, string) error
Status(context.Context) (HarnessStatus, error)
Health(context.Context) (Health, error)
}
AgentHarness normalizes lifecycle, cancellation, events, and terminal outcome for one explicitly supported external agent runtime.
type HarnessCapabilities ¶
type HarnessCapabilities struct {
ResumeToken bool `json:"resume_token"`
TranscriptReplay bool `json:"transcript_replay"`
ExactCheckpoint bool `json:"exact_checkpoint"`
EventReplay bool `json:"event_replay"`
WorkspaceSnapshot bool `json:"workspace_snapshot"`
IdempotentResume bool `json:"idempotent_resume"`
}
HarnessCapabilities are host-observed properties of a configured harness. A manifest pins these values so a resumed request cannot silently negotiate weaker recovery semantics.
func (HarnessCapabilities) Supports ¶
func (c HarnessCapabilities) Supports(mode ResumeMode) bool
type HarnessCapabilityReporter ¶
type HarnessCapabilityReporter interface {
Capabilities(context.Context) (HarnessCapabilities, error)
}
HarnessCapabilityReporter lets an adapter expose configured recovery guarantees without expanding the execution interface for legacy harnesses.
type HarnessConfig ¶
type HarnessManifest ¶
type HarnessManifest struct {
Name string `json:"name"`
Version string `json:"version"`
ConfigDigest string `json:"config_digest"`
Health Health `json:"health"`
Capabilities HarnessCapabilities `json:"capabilities"`
}
type HarnessRegistry ¶
type HarnessRegistry struct {
// contains filtered or unexported fields
}
HarnessRegistry activates only explicitly named and host-allowlisted CLI adapters. Discovery never turns an arbitrary executable into authority.
func NewHarnessRegistry ¶
func NewHarnessRegistry(allowlist ...string) *HarnessRegistry
func (*HarnessRegistry) Configure ¶
func (r *HarnessRegistry) Configure(ctx context.Context, name string, config HarnessConfig) error
func (*HarnessRegistry) Get ¶
func (r *HarnessRegistry) Get(name string) (AgentHarness, bool)
func (*HarnessRegistry) List ¶
func (r *HarnessRegistry) List() []string
func (*HarnessRegistry) Manifest ¶
func (r *HarnessRegistry) Manifest(ctx context.Context, name string) (HarnessManifest, error)
func (*HarnessRegistry) Register ¶
func (r *HarnessRegistry) Register(harness AgentHarness) error
func (*HarnessRegistry) Statuses ¶
func (r *HarnessRegistry) Statuses(ctx context.Context) ([]HarnessStatus, error)
type HarnessRequest ¶
type HarnessRequest struct {
Identity execution.Identity `json:"identity"`
InputID string `json:"input_id"`
Prompt string `json:"prompt"`
Model string `json:"model"`
Environment workspace.Environment `json:"environment"`
ChildRunID string `json:"child_run_id"`
PolicyVersion string `json:"policy_version"`
CatalogVersion string `json:"catalog_version"`
ContextDigest string `json:"context_digest,omitempty"`
OutputTokenBudget int `json:"output_token_budget,omitempty"`
RequiredResume ResumeMode `json:"required_resume,omitempty"`
ContinuationID string `json:"continuation_id,omitempty"`
CheckpointHash string `json:"checkpoint_hash,omitempty"`
ResumeToken string `json:"resume_token,omitempty"`
Deadline time.Time `json:"deadline,omitempty"`
Harness HarnessManifest `json:"harness"`
}
type HarnessResult ¶
type HarnessResult struct {
Status string `json:"status"`
Final string `json:"final,omitempty"`
ArtifactRef string `json:"artifact_ref,omitempty"`
InputTokens int `json:"input_tokens,omitempty"`
OutputTokens int `json:"output_tokens,omitempty"`
ResumeMode ResumeMode `json:"resume_mode,omitempty"`
ResumeToken string `json:"resume_token,omitempty"`
ContinuationID string `json:"continuation_id,omitempty"`
CheckpointHash string `json:"checkpoint_hash,omitempty"`
ContextDigest string `json:"context_digest,omitempty"`
Metadata json.RawMessage `json:"metadata,omitempty"`
}
type HarnessStatus ¶
type HarnessSupervisor ¶
type HarnessSupervisor struct {
Harness AgentHarness
Manifest HarnessManifest
MaxActive int
// contains filtered or unexported fields
}
HarnessSupervisor enforces manifest pinning, bounded concurrency, event provenance, and run cleanup around one explicitly configured harness.
func NewHarnessSupervisor ¶
func NewHarnessSupervisor(harness AgentHarness, manifest HarnessManifest, maxActive int) (*HarnessSupervisor, error)
func (*HarnessSupervisor) Cancel ¶
func (s *HarnessSupervisor) Cancel(ctx context.Context, runID string) error
func (*HarnessSupervisor) Resume ¶
func (s *HarnessSupervisor) Resume(ctx context.Context, request HarnessRequest, sink func(trajectory.Event) error) (HarnessResult, error)
func (*HarnessSupervisor) Run ¶
func (s *HarnessSupervisor) Run(ctx context.Context, request HarnessRequest, sink func(trajectory.Event) error) (HarnessResult, error)
func (*HarnessSupervisor) Status ¶
func (s *HarnessSupervisor) Status(ctx context.Context) (HarnessStatus, error)
type MCPCatalog ¶
type MCPCatalog struct {
Version string `json:"version"`
Tools []MCPTool `json:"tools,omitempty"`
Resources []MCPResourceRef `json:"resources,omitempty"`
Prompts []MCPPromptRef `json:"prompts,omitempty"`
}
type MCPConfig ¶
type MCPConfig struct {
Name string `json:"name"`
Version string `json:"version"`
Transport Transport `json:"transport"`
Endpoint string `json:"endpoint"`
Auth AuthMode `json:"auth"`
ConnectTimeout time.Duration `json:"connect_timeout"`
CallTimeout time.Duration `json:"call_timeout"`
ReconnectBackoff time.Duration `json:"reconnect_backoff"`
}
type MCPPromptRef ¶
type MCPPromptRequest ¶
type MCPPromptRequest struct {
Identity execution.Identity `json:"identity"`
Prompt MCPPromptRef `json:"prompt"`
Arguments json.RawMessage `json:"arguments,omitempty"`
}
type MCPRegistry ¶
type MCPRegistry struct {
// contains filtered or unexported fields
}
MCPRegistry owns configuration, authentication, catalog refresh, status, and cleanup for explicitly allowlisted servers.
func NewMCPRegistry ¶
func NewMCPRegistry(allowlist ...string) *MCPRegistry
func (*MCPRegistry) Catalog ¶
func (r *MCPRegistry) Catalog(name string) (MCPCatalog, bool)
func (*MCPRegistry) Reconnect ¶
func (r *MCPRegistry) Reconnect(ctx context.Context, name string) error
func (*MCPRegistry) Refresh ¶
func (r *MCPRegistry) Refresh(ctx context.Context, name string, refreshAuth bool) (MCPCatalog, error)
func (*MCPRegistry) Unregister ¶
func (r *MCPRegistry) Unregister(ctx context.Context, name string) error
func (*MCPRegistry) WatchCatalog ¶
func (r *MCPRegistry) WatchCatalog(ctx context.Context, name string) error
WatchCatalog consumes versioned updates until ctx is cancelled. Invalid or empty versions stop the watch rather than replacing a known-good catalog.
type MCPResourceRef ¶
type MCPResourceRequest ¶
type MCPResourceRequest struct {
Identity execution.Identity `json:"identity"`
Resource MCPResourceRef `json:"resource"`
}
type MCPServer ¶
type MCPServer interface {
Validate(MCPConfig) error
Configure(context.Context, MCPConfig) error
Start(context.Context) error
Authenticate(context.Context) error
RefreshAuth(context.Context) error
Discover(context.Context) (MCPCatalog, error)
WatchCatalog(context.Context) (<-chan MCPCatalog, error)
CallTool(context.Context, MCPToolCall) (MCPToolResult, error)
ReadResource(context.Context, MCPResourceRequest) (json.RawMessage, error)
RenderPrompt(context.Context, MCPPromptRequest) (json.RawMessage, error)
Health(context.Context) (Health, error)
Status(context.Context) (MCPStatus, error)
Stop(context.Context) error
}
MCPServer is the lifecycle surface required from a local or remote MCP transport. OAuth and transport details remain implementation-specific.
type MCPToolCall ¶
type MCPToolCall struct {
Envelope execution.OperationEnvelope `json:"envelope"`
}
type MCPToolResult ¶
type MCPToolResult struct {
Content json.RawMessage `json:"content,omitempty"`
Indeterminate bool `json:"indeterminate,omitempty"`
Metadata json.RawMessage `json:"metadata,omitempty"`
ResultHash string `json:"result_hash,omitempty"`
}
type ResumeMode ¶
type ResumeMode string
ResumeMode names a concrete recovery mechanism rather than treating every harness Resume method as equivalent.
const ( ResumeNone ResumeMode = "" ResumeToken ResumeMode = "token" ResumeTranscript ResumeMode = "transcript" ResumeExactCheckpoint ResumeMode = "exact_checkpoint" )