Documentation
¶
Index ¶
- Constants
- func BuildCommand(driverPath string, fixturePath string, fixtureAgent string, ...) string
- func DefaultDriverPath() (string, error)
- func ProviderConfig(command ...string) compozyconfig.ProviderConfig
- func ProviderConfigForIdentity(provider string, command ...string) (compozyconfig.ProviderConfig, error)
- func RequireDriver(t testing.TB) string
- type AgentFixture
- type DiagnosticsRecord
- func DiagnosticsForCompozySession(records []DiagnosticsRecord, compozySessionID string) []DiagnosticsRecord
- func DiagnosticsForProvider(records []DiagnosticsRecord, provider string) []DiagnosticsRecord
- func PromptDiagnostics(records []DiagnosticsRecord) []DiagnosticsRecord
- func ProtocolDiagnostics(records []DiagnosticsRecord) []DiagnosticsRecord
- func ReadDiagnostics(path string) (records []DiagnosticsRecord, err error)
- type DiagnosticsStep
- type DriverControlAction
- type DriverControlStep
- type Fixture
- type RegisterOptions
- type Registration
- type SessionConfigOptionFixture
- type SessionConfigOptionValueFixture
- type Step
- type StepKind
- type TurnFixture
- type TurnMatch
- type TurnMatchGoal
- type TurnMatchJudge
- type TurnUsage
- type UsageUpdate
Constants ¶
const ( ProviderName = "acpmock" ProviderClaude = "claude" )
Provider identities supported by provider-aware fixture scenarios.
const FixtureVersion = 2
Variables ¶
This section is empty.
Functions ¶
func BuildCommand ¶
func BuildCommand( driverPath string, fixturePath string, fixtureAgent string, diagnosticsPath string, effectiveProvider ...string, ) string
BuildCommand renders the test-only ACP driver command string stored in AGENT.md.
func DefaultDriverPath ¶
DefaultDriverPath resolves or builds the test-only ACP mock driver binary.
func ProviderConfig ¶
func ProviderConfig(command ...string) compozyconfig.ProviderConfig
ProviderConfig returns the local auth-free provider config for ACP mock agents.
func ProviderConfigForIdentity ¶
func ProviderConfigForIdentity(provider string, command ...string) (compozyconfig.ProviderConfig, error)
ProviderConfigForIdentity returns an ACP mock config under one typed native provider identity.
func RequireDriver ¶
RequireDriver resolves the ACP mock driver binary or fails the current test.
Types ¶
type AgentFixture ¶
type AgentFixture struct {
// SteerOutcome advertises the steering extension and returns this scripted outcome.
SteerOutcome string `json:"steer_outcome,omitempty"`
Name string `json:"name"`
Provider string `json:"provider"`
Model string `json:"model,omitempty"`
ReasoningEffort string `json:"reasoning_effort,omitempty"`
Permissions string `json:"permissions,omitempty"`
Tools []string `json:"tools,omitempty"`
Prompt string `json:"prompt,omitempty"`
LoadSession *bool `json:"load_session,omitzero"`
// ForkSession advertises the unstable ACP session/fork capability; the driver answers
// session/fork with a clone id after sending clone-id updates first (OpenCode shape).
ForkSession bool `json:"fork_session,omitzero"`
// ForkError makes session/fork fail with this message.
ForkError string `json:"fork_error,omitempty"`
// LoadMissing makes session/load fail with ACP resource-not-found for any id.
LoadMissing bool `json:"load_missing,omitzero"`
// LoadDelayMS holds session/load open to script a provider that resumes slowly.
LoadDelayMS int `json:"load_delay_ms,omitzero"`
ConfigOptions []SessionConfigOptionFixture `json:"config_options,omitempty"`
Turns []TurnFixture `json:"turns"`
}
AgentFixture describes one named ACP mock agent inside a fixture file.
func (AgentFixture) RejectsConfigValue ¶
func (a AgentFixture) RejectsConfigValue(configID string, value string) bool
RejectsConfigValue reports whether the fixture scripts a set_config_option failure.
func (AgentFixture) SelectTurn ¶
func (a AgentFixture) SelectTurn(prompt string, meta ...acp.PromptMeta) (TurnFixture, error)
SelectTurn returns the first turn that matches stable prompt fields.
func (AgentFixture) SupportsLoadSession ¶
func (a AgentFixture) SupportsLoadSession() bool
SupportsLoadSession reports the fixture's advertised ACP session/load capability.
func (AgentFixture) Validate ¶
func (a AgentFixture) Validate(path string) error
Validate ensures the agent fixture is usable.
type DiagnosticsRecord ¶
type DiagnosticsRecord struct {
CompozySessionID string `json:"compozy_session_id,omitempty"`
AgentName string `json:"agent_name"`
Provider string `json:"provider,omitempty"`
SessionID string `json:"session_id"`
ProtocolMethod string `json:"protocol_method,omitempty"`
ConfigOptionID string `json:"config_option_id,omitempty"`
ConfigOptionValue string `json:"config_option_value,omitempty"`
LifecycleEvent string `json:"lifecycle_event,omitempty"`
MCPServers []acpsdk.McpServer `json:"mcp_servers,omitempty"`
PromptIndex int `json:"prompt_index"`
Prompt string `json:"prompt"`
PromptMeta acp.PromptMeta `json:"prompt_meta"`
TurnName string `json:"turn_name,omitempty"`
Match TurnMatch `json:"match"`
Steps []DiagnosticsStep `json:"steps"`
}
DiagnosticsRecord captures one protocol, lifecycle, or prompt event emitted by the ACP mock driver.
func DiagnosticsForCompozySession ¶
func DiagnosticsForCompozySession(records []DiagnosticsRecord, compozySessionID string) []DiagnosticsRecord
DiagnosticsForCompozySession returns records owned by one daemon session in append order.
func DiagnosticsForProvider ¶
func DiagnosticsForProvider(records []DiagnosticsRecord, provider string) []DiagnosticsRecord
DiagnosticsForProvider returns structured records for one canonical provider identity.
func PromptDiagnostics ¶
func PromptDiagnostics(records []DiagnosticsRecord) []DiagnosticsRecord
PromptDiagnostics returns diagnostics emitted for prompt execution turns only.
func ProtocolDiagnostics ¶
func ProtocolDiagnostics(records []DiagnosticsRecord) []DiagnosticsRecord
ProtocolDiagnostics returns diagnostics emitted when the driver receives ACP protocol methods.
func ReadDiagnostics ¶
func ReadDiagnostics(path string) (records []DiagnosticsRecord, err error)
ReadDiagnostics decodes newline-delimited diagnostics written by the mock driver.
type DiagnosticsStep ¶
type DiagnosticsStep struct {
Kind StepKind `json:"kind"`
Text string `json:"text,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
Decision string `json:"decision,omitempty"`
Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
ExitCode *int `json:"exit_code,omitzero"`
Output string `json:"output,omitempty"`
Error string `json:"error,omitempty"`
DriverAction DriverControlAction `json:"driver_action,omitempty"`
}
DiagnosticsStep captures one executed fixture step with any observed runtime outputs.
type DriverControlAction ¶
type DriverControlAction string
DriverControlAction identifies one supported driver fault injection action.
const ( DriverControlDisconnect DriverControlAction = "disconnect" DriverControlWriteRawJSONRPC DriverControlAction = "write_raw_jsonrpc" DriverControlBlockUntilCancel DriverControlAction = "block_until_cancel" DriverControlDelay DriverControlAction = "delay" // DriverControlHoldIgnoringCancel keeps the turn open for delay_ms while ignoring // prompt cancellation, so stop ladders must escalate past the cooperative phase. DriverControlHoldIgnoringCancel DriverControlAction = "hold_ignoring_cancel" // DriverControlFailPrompt answers the matched session/prompt with a JSON-RPC error // carrying error_message, the shape a provider rate limit or auth lapse reaches the // daemon in after the session was accepted. DriverControlFailPrompt DriverControlAction = "fail_prompt" DriverControlWaitForSteer DriverControlAction = "wait_for_steer" )
type DriverControlStep ¶
type DriverControlStep struct {
Action DriverControlAction `json:"action"`
RawJSONRPC string `json:"raw_jsonrpc,omitempty"`
Async bool `json:"async,omitzero"`
DelayMS int `json:"delay_ms,omitzero"`
// ErrorMessage is the JSON-RPC error message fail_prompt answers session/prompt with.
ErrorMessage string `json:"error_message,omitempty"`
// ErrorCode is the optional JSON-RPC error code for fail_prompt (default -32603).
ErrorCode int `json:"error_code,omitzero"`
}
DriverControlStep injects driver-level protocol or lifecycle faults.
func (DriverControlStep) Validate ¶
func (d DriverControlStep) Validate(path string) error
Validate ensures the driver-control payload is internally consistent.
type Fixture ¶
type Fixture struct {
Version int `json:"version"`
Agents []AgentFixture `json:"agents"`
}
Fixture describes one deterministic multi-agent ACP mock scenario.
func LoadFixture ¶
LoadFixture parses and validates one fixture file.
func ParseFixture ¶
ParseFixture decodes and validates fixture JSON.
type RegisterOptions ¶
type RegisterOptions struct {
FixturePath string
FixtureAgent string
AgentName string
ProviderName string
DriverPath string
DiagnosticsPath string
Tools []string
}
RegisterOptions describes one temporary fixture-backed AGENT.md registration.
type Registration ¶
type Registration struct {
AgentName string
FixtureAgent string
FixturePath string
DriverPath string
DiagnosticsPath string
AgentDefPath string
Command string
Provider string
Model string
Permissions string
}
Registration captures one temporary mock-agent definition written into Compozy home.
func Register ¶
func Register(homePaths compozyconfig.HomePaths, opts RegisterOptions) (Registration, error)
Register writes one temporary fixture-backed AGENT.md file into the supplied Compozy home.
type SessionConfigOptionFixture ¶
type SessionConfigOptionFixture struct {
ID string `json:"id"`
Name string `json:"name"`
Category string `json:"category,omitempty"`
Current string `json:"current"`
Values []SessionConfigOptionValueFixture `json:"values"`
}
SessionConfigOptionFixture describes one deterministic ACP session config select option.
func (SessionConfigOptionFixture) Validate ¶
func (o SessionConfigOptionFixture) Validate(path string) error
Validate ensures one session config option is deterministic and selectable.
type SessionConfigOptionValueFixture ¶
type SessionConfigOptionValueFixture struct {
Value string `json:"value"`
Label string `json:"label,omitempty"`
// RejectSet makes session/set_config_option to this advertised value fail, which
// scripts a start that ACP accepted (session/new returned) and then failed.
RejectSet bool `json:"reject_set,omitzero"`
}
SessionConfigOptionValueFixture describes one selectable ACP config option value.
type Step ¶
type Step struct {
OmitToolCallID bool `json:"omit_tool_call_id,omitzero"`
Kind StepKind `json:"kind"`
Text string `json:"text,omitempty"`
Chunks []string `json:"chunks,omitempty"`
// BurstCount repeats Text without delivery pacing to exercise transport pressure.
BurstCount int `json:"burst_count,omitzero"`
ToolID string `json:"tool_id,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
Title string `json:"title,omitempty"`
ToolKind string `json:"tool_kind,omitempty"`
Path string `json:"path,omitempty"`
Status string `json:"status,omitempty"`
ContentText string `json:"content_text,omitempty"`
RawInput json.RawMessage `json:"raw_input,omitempty"`
RawOutput json.RawMessage `json:"raw_output,omitempty"`
ExpectDecision string `json:"expect_decision,omitempty"`
EmitDecision bool `json:"emit_decision,omitzero"`
EmitText string `json:"emit_text,omitempty"`
Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
Cwd string `json:"cwd,omitempty"`
ExpectExitCode *int `json:"expect_exit_code,omitzero"`
ExpectOutputContains string `json:"expect_output_contains,omitempty"`
ExpectErrorContains string `json:"expect_error_contains,omitempty"`
EmitOutput bool `json:"emit_output,omitzero"`
DriverControl *DriverControlStep `json:"driver_control,omitzero"`
}
Step describes one deterministic ACP action emitted or executed by the driver.
type StepKind ¶
type StepKind string
const ( StepKindAssistant StepKind = "assistant" StepKindThought StepKind = "thought" StepKindToolCall StepKind = "tool_call" StepKindNativeToolCall StepKind = "native_tool_call" StepKindPermission StepKind = "permission" StepKindCommand StepKind = "command_exec" StepKindDriverControl StepKind = "driver_control" )
type TurnFixture ¶
type TurnFixture struct {
UsageUpdates []UsageUpdate `json:"usage_updates,omitempty"`
Name string `json:"name,omitempty"`
Match TurnMatch `json:"match"`
Steps []Step `json:"steps"`
StopReason string `json:"stop_reason,omitempty"`
Usage *TurnUsage `json:"usage,omitzero"`
}
TurnFixture describes one deterministic prompt turn for an agent.
func (TurnFixture) Validate ¶
func (t TurnFixture) Validate(path string) error
Validate ensures the turn fixture is usable.
type TurnMatch ¶
type TurnMatch struct {
CompactionNotice *bool `json:"compaction_notice,omitempty"`
SituationFull *bool `json:"situation_full,omitempty"`
TurnSource string `json:"turn_source,omitempty"`
UserText string `json:"user_text,omitempty"`
// UserTextContains matches a substring after the same canonical whitespace normalization as UserText.
UserTextContains string `json:"user_text_contains,omitempty"`
// RawUserTextContains matches a substring before prompt augmentation is stripped.
RawUserTextContains string `json:"raw_user_text_contains,omitempty"`
Goal *TurnMatchGoal `json:"goal,omitempty"`
Judge *TurnMatchJudge `json:"judge,omitempty"`
}
TurnMatch routes a prompt to a turn fixture using stable prompt fields.
type TurnMatchGoal ¶
type TurnMatchGoal struct {
Kind string `json:"kind,omitempty"`
RunID string `json:"run_id,omitempty"`
NodeID string `json:"node_id,omitempty"`
Generation int64 `json:"generation,omitzero"`
ItemIndex *int `json:"item_index,omitzero"`
Turn *int `json:"turn,omitzero"`
PromptAttempt *int `json:"prompt_attempt,omitzero"`
PromptID string `json:"prompt_id,omitempty"`
}
TurnMatchGoal captures exact Goal prompt metadata fields.
func (TurnMatchGoal) IsZero ¶
func (m TurnMatchGoal) IsZero() bool
IsZero reports whether the matcher selects no Goal fields.
func (TurnMatchGoal) Normalize ¶
func (m TurnMatchGoal) Normalize() TurnMatchGoal
Normalize returns an isolated, trimmed Goal matcher.
func (TurnMatchGoal) Validate ¶
func (m TurnMatchGoal) Validate(_ string) error
Validate ensures at least one exact Goal selector is present.
type TurnMatchJudge ¶
type TurnMatchJudge struct {
Role string `json:"role,omitempty"`
Attempt int `json:"attempt,omitzero"`
CorrelationID string `json:"correlation_id,omitempty"`
GateID string `json:"gate_id,omitempty"`
CriterionID string `json:"criterion_id,omitempty"`
}
TurnMatchJudge captures exact daemon-owned judge prompt metadata fields.
func (TurnMatchJudge) IsZero ¶
func (m TurnMatchJudge) IsZero() bool
IsZero reports whether the matcher selects no judge fields.
func (TurnMatchJudge) Normalize ¶
func (m TurnMatchJudge) Normalize() TurnMatchJudge
Normalize returns a trimmed judge matcher.
func (TurnMatchJudge) Validate ¶
func (m TurnMatchJudge) Validate(_ string) error
Validate ensures at least one exact judge selector is present.