e2e

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package e2e provides shared runtime and artifact helpers for daemon-level end-to-end tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHomePaths

func NewHomePaths(t testing.TB) aghconfig.HomePaths

NewHomePaths creates an isolated AGH home layout for one test run.

func RecordsContainTextDelta

func RecordsContainTextDelta(records []SSEEvent, want string) bool

RecordsContainTextDelta reports whether one streamed SSE result contains the expected assistant text delta.

func SeedConfig

func SeedConfig(t testing.TB, homePaths aghconfig.HomePaths, opts ConfigSeedOptions) aghconfig.Config

SeedConfig writes a minimal config overlay and any requested agent definitions.

func SeedWorkspace

func SeedWorkspace(t testing.TB, opts WorkspaceSeedOptions) string

SeedWorkspace creates an isolated workspace root and any requested files.

func ValidateUDSApprovalResponse

func ValidateUDSApprovalResponse(statusCode int, body []byte) error

ValidateUDSApprovalResponse checks the UDS approval transport contract.

func ValidateWebhookRunProjection

func ValidateWebhookRunProjection(
	delivery aghcontract.WebhookDeliveryPayload,
	projections ...aghcontract.RunPayload,
) error

ValidateWebhookRunProjection confirms that transport-specific reads agree with the run returned by HTTP webhook ingress, while staying intentionally narrow about which fields define parity.

func WriteAgentDef

func WriteAgentDef(t testing.TB, homePaths aghconfig.HomePaths, seed AgentSeed)

WriteAgentDef persists one AGENT.md fixture under the supplied home.

Types

type AgentSeed

type AgentSeed struct {
	Name         string
	Provider     string
	Command      string
	Model        string
	Permissions  string
	Tools        []string
	Toolsets     []string
	DenyTools    []string
	CategoryPath []string
	MCPServers   []aghconfig.MCPServer
	Prompt       string
}

AgentSeed defines one persisted AGENT.md fixture.

type ArtifactCollector

type ArtifactCollector struct {
	// contains filtered or unexported fields
}

ArtifactCollector captures and indexes stable E2E diagnostics.

func NewArtifactCollector

func NewArtifactCollector(t testing.TB) *ArtifactCollector

NewArtifactCollector creates a per-test artifact directory. Passing tests clean it up, while failing tests keep it around for inspection.

func (*ArtifactCollector) ArtifactPath

func (c *ArtifactCollector) ArtifactPath(kind ArtifactKind) (string, bool)

ArtifactPath returns the absolute path for one captured artifact kind.

func (*ArtifactCollector) CaptureFile

func (c *ArtifactCollector) CaptureFile(kind ArtifactKind, sourcePath string, mediaType string) error

CaptureFile copies a single file into the canonical artifact location.

func (*ArtifactCollector) CaptureFiles

func (c *ArtifactCollector) CaptureFiles(kind ArtifactKind, sourcePaths []string, mediaType string) error

CaptureFiles copies one or more files into a canonical directory artifact.

func (*ArtifactCollector) CaptureJSON

func (c *ArtifactCollector) CaptureJSON(kind ArtifactKind, value any) error

CaptureJSON writes one artifact as indented JSON and updates the manifest.

func (*ArtifactCollector) CaptureNamedJSON

func (c *ArtifactCollector) CaptureNamedJSON(kind ArtifactKind, name string, value any) (string, error)

CaptureNamedJSON writes one JSON file inside a directory artifact and keeps the directory registered in the shared manifest.

func (*ArtifactCollector) CaptureNamedText

func (c *ArtifactCollector) CaptureNamedText(kind ArtifactKind, name string, text string) (string, error)

CaptureNamedText writes one text file inside a directory artifact and keeps the directory registered in the shared manifest.

func (*ArtifactCollector) CaptureText

func (c *ArtifactCollector) CaptureText(kind ArtifactKind, text string) error

CaptureText writes one text artifact and updates the manifest.

func (*ArtifactCollector) Manifest

func (c *ArtifactCollector) Manifest() ArtifactManifest

Manifest returns a stable snapshot of the captured artifacts.

func (*ArtifactCollector) ManifestPath

func (c *ArtifactCollector) ManifestPath() string

ManifestPath returns the stable manifest location.

func (*ArtifactCollector) RootDir

func (c *ArtifactCollector) RootDir() string

RootDir returns the artifact root for the run.

func (*ArtifactCollector) WriteManifest

func (c *ArtifactCollector) WriteManifest() (ArtifactManifest, error)

WriteManifest persists the current manifest snapshot and returns it.

type ArtifactEntry

type ArtifactEntry struct {
	Kind      ArtifactKind `json:"kind"`
	Path      string       `json:"path"`
	MediaType string       `json:"media_type,omitempty"`
}

ArtifactEntry records one captured diagnostic artifact.

type ArtifactKind

type ArtifactKind string

ArtifactKind identifies one stable E2E diagnostic surface.

const (
	ArtifactKindTranscript           ArtifactKind = "transcript"
	ArtifactKindEvents               ArtifactKind = "events"
	ArtifactKindTransportOutputs     ArtifactKind = "transport_outputs"
	ArtifactKindNetworkMessages      ArtifactKind = "network_messages"
	ArtifactKindNetworkThreads       ArtifactKind = "network_threads"
	ArtifactKindNetworkDirectRooms   ArtifactKind = "network_direct_rooms"
	ArtifactKindNetworkWork          ArtifactKind = "network_work"
	ArtifactKindNetworkAudit         ArtifactKind = "network_audit"
	ArtifactKindAutomationRuns       ArtifactKind = "automation_runs"
	ArtifactKindTasks                ArtifactKind = "tasks"
	ArtifactKindTaskRuns             ArtifactKind = "task_runs"
	ArtifactKindBridgeHealth         ArtifactKind = "bridge_health"
	ArtifactKindBridgeRoutes         ArtifactKind = "bridge_routes"
	ArtifactKindBridgeDeliveryState  ArtifactKind = "bridge_delivery_state"
	ArtifactKindBridgeSecretBindings ArtifactKind = "bridge_secret_bindings"
	ArtifactKindProviderCalls        ArtifactKind = "provider_calls"
	ArtifactKindToolHostDiagnostics  ArtifactKind = "tool_host_diagnostics"
	ArtifactKindCombinedFlow         ArtifactKind = "combined_flow"
	ArtifactKindSessionSandbox       ArtifactKind = "session_sandbox"
	ArtifactKindBrowserTrace         ArtifactKind = "browser_trace"
	ArtifactKindBrowserScreenshots   ArtifactKind = "browser_screenshots"
	ArtifactKindBrowserConsole       ArtifactKind = "browser_console"
	ArtifactKindBrowserNetwork       ArtifactKind = "browser_network"
)

type ArtifactManifest

type ArtifactManifest struct {
	Version   int             `json:"version"`
	Artifacts []ArtifactEntry `json:"artifacts"`
}

ArtifactManifest is the stable per-run artifact index.

type AutomationFixtureSeed

type AutomationFixtureSeed struct {
	Jobs     []aghcontract.CreateJobRequest
	Triggers []aghcontract.CreateTriggerRequest
}

AutomationFixtureSeed describes one batch of automation definitions seeded through the live daemon operator surface.

type AutomationFixtureState

type AutomationFixtureState struct {
	Jobs     []aghcontract.JobPayload
	Triggers []aghcontract.TriggerPayload
}

AutomationFixtureState reports the created automation resources for one seed batch.

type CLIClient

type CLIClient struct {
	// contains filtered or unexported fields
}

CLIClient shells out to the real `agh` binary against the isolated runtime.

func (*CLIClient) Run

func (c *CLIClient) Run(ctx context.Context, args ...string) (string, string, error)

Run executes one CLI command against the isolated daemon runtime.

func (*CLIClient) RunInDir

func (c *CLIClient) RunInDir(ctx context.Context, workdir string, args ...string) (string, string, error)

RunInDir executes one CLI command against the isolated daemon runtime using the provided working directory.

func (*CLIClient) RunJSON

func (c *CLIClient) RunJSON(ctx context.Context, dest any, args ...string) error

RunJSON executes one CLI command and decodes its JSON stdout.

func (*CLIClient) RunJSONInDir

func (c *CLIClient) RunJSONInDir(ctx context.Context, workdir string, dest any, args ...string) error

RunJSONInDir executes one CLI command in the provided working directory and decodes its JSON stdout.

type CombinedFlowArtifact

type CombinedFlowArtifact struct {
	Scenario          string   `json:"scenario"`
	SessionID         string   `json:"session_id,omitempty"`
	Channel           string   `json:"channel,omitempty"`
	AutomationRunID   string   `json:"automation_run_id,omitempty"`
	TriggerID         string   `json:"trigger_id,omitempty"`
	JobID             string   `json:"job_id,omitempty"`
	TaskID            string   `json:"task_id,omitempty"`
	TaskRunID         string   `json:"task_run_id,omitempty"`
	BridgeID          string   `json:"bridge_id,omitempty"`
	NetworkMessageIDs []string `json:"network_message_ids,omitempty"`
	SideEffectPaths   []string `json:"side_effect_paths,omitempty"`
}

CombinedFlowArtifact records the cross-domain identifiers and side effects that make a multi-domain failure diagnosable from one retained run.

type ConfigSeedOptions

type ConfigSeedOptions struct {
	Host            string
	HTTPPort        int
	SocketPath      string
	DefaultAgent    string
	DefaultProvider string
	DefaultSandbox  string
	PermissionMode  aghconfig.PermissionMode
	Providers       map[string]aghconfig.ProviderConfig
	Sandboxes       map[string]aghconfig.SandboxProfile
	AgentDefs       []AgentSeed
	Mutate          func(*aghconfig.Config)
}

ConfigSeedOptions configures the seeded daemon runtime config.

type MockAgentSpec

type MockAgentSpec struct {
	FixturePath     string
	FixtureAgent    string
	AgentName       string
	DiagnosticsPath string
}

MockAgentSpec is the narrow-waist contract for fixture-backed mock agents. Runtime and browser E2E helpers should register mock agents through this type instead of calling acpmock.Register directly.

type PermissionStreamPayload

type PermissionStreamPayload struct {
	RequestID string `json:"request_id"`
	Decision  string `json:"decision,omitempty"`
}

PermissionStreamPayload is the narrow streamed approval payload used by transport parity tests.

func PermissionPayloadFromSSE

func PermissionPayloadFromSSE(record SSEEvent) (PermissionStreamPayload, bool)

PermissionPayloadFromSSE extracts one approval payload from a streamed SSE record when present.

func PermissionPayloads

func PermissionPayloads(records []SSEEvent) []PermissionStreamPayload

PermissionPayloads collects all streamed approval payloads from one SSE run.

type RunProjectionSummary

type RunProjectionSummary struct {
	ID        string
	TriggerID string
	SessionID string
	Status    automationpkg.RunStatus
}

RunProjectionSummary keeps only the projection fields transport parity tests care about, so they do not duplicate daemon-truth assertions already covered by the composition-root runtime lane.

func SummarizeRunProjection

func SummarizeRunProjection(run aghcontract.RunPayload) RunProjectionSummary

SummarizeRunProjection extracts the narrow automation-run projection that should stay stable across HTTP, UDS, and CLI reads.

type RuntimeArtifactManifest

type RuntimeArtifactManifest struct {
	Version              int                      `json:"version"`
	WorkspaceRoot        string                   `json:"workspace_root,omitempty"`
	Home                 RuntimeHomeArtifact      `json:"home"`
	Logs                 RuntimeLogArtifact       `json:"logs"`
	Runs                 RuntimeRunArtifact       `json:"runs"`
	Transport            RuntimeTransportArtifact `json:"transport"`
	ArtifactRootDir      string                   `json:"artifact_root_dir,omitempty"`
	ArtifactManifestPath string                   `json:"artifact_manifest_path,omitempty"`
	CapturedArtifacts    ArtifactManifest         `json:"captured_artifacts"`
}

RuntimeArtifactManifest captures the stable daemon-runtime surfaces later integration suites need for debugging and parity assertions.

type RuntimeHarness

type RuntimeHarness struct {
	HomePaths     aghconfig.HomePaths
	Config        aghconfig.Config
	BinaryPath    string
	Artifacts     *ArtifactCollector
	WorkspaceRoot string
	WorkspaceID   string
	MockAgents    map[string]acpmock.Registration

	HTTPBaseURL string
	HTTPClient  *http.Client

	UDSBaseURL string
	UDSClient  *http.Client

	CLI *CLIClient
	// contains filtered or unexported fields
}

RuntimeHarness exposes the started daemon and its public product surfaces.

func StartRuntimeHarness

func StartRuntimeHarness(t testing.TB, opts RuntimeHarnessOptions) *RuntimeHarness

StartRuntimeHarness boots an isolated daemon through the real CLI startup path.

func (*RuntimeHarness) ApproveSessionPermission

func (h *RuntimeHarness) ApproveSessionPermission(
	ctx context.Context,
	sessionID string,
	request aghcontract.ApproveSessionRequest,
) error

ApproveSessionPermission resolves one live permission request through the public HTTP surface.

func (*RuntimeHarness) CaptureAutomationRuns

func (h *RuntimeHarness) CaptureAutomationRuns(ctx context.Context, query url.Values) error

CaptureAutomationRuns stores the current automation run projection.

func (*RuntimeHarness) CaptureBridgeDeliveryState

func (h *RuntimeHarness) CaptureBridgeDeliveryState(ctx context.Context, bridgeID string) error

CaptureBridgeDeliveryState stores one bridge detail snapshot with additive delivery health.

func (*RuntimeHarness) CaptureBridgeHealth

func (h *RuntimeHarness) CaptureBridgeHealth(ctx context.Context) error

CaptureBridgeHealth stores one bridge health-stream snapshot.

func (*RuntimeHarness) CaptureBridgeRoutes

func (h *RuntimeHarness) CaptureBridgeRoutes(ctx context.Context, bridgeID string) error

CaptureBridgeRoutes stores the persisted route projection for one bridge instance.

func (*RuntimeHarness) CaptureBridgeSecretBindings

func (h *RuntimeHarness) CaptureBridgeSecretBindings(ctx context.Context, bridgeID string) error

CaptureBridgeSecretBindings stores the persisted secret binding set for one bridge instance.

func (*RuntimeHarness) CaptureBrowserConsoleJSON

func (h *RuntimeHarness) CaptureBrowserConsoleJSON(value any) error

CaptureBrowserConsoleJSON stores browser console diagnostics.

func (*RuntimeHarness) CaptureBrowserNetworkJSON

func (h *RuntimeHarness) CaptureBrowserNetworkJSON(value any) error

CaptureBrowserNetworkJSON stores browser network diagnostics.

func (*RuntimeHarness) CaptureBrowserScreenshots

func (h *RuntimeHarness) CaptureBrowserScreenshots(paths []string) error

CaptureBrowserScreenshots stores one or more screenshot files.

func (*RuntimeHarness) CaptureBrowserTraceFile

func (h *RuntimeHarness) CaptureBrowserTraceFile(path string) error

CaptureBrowserTraceFile stores the Playwright trace archive for one scenario.

func (*RuntimeHarness) CaptureCLIOutput

func (h *RuntimeHarness) CaptureCLIOutput(
	name string,
	args []string,
	stdout string,
	stderr string,
	commandErr error,
) (string, error)

CaptureCLIOutput stores one CLI command result in the shared transport-output artifact directory.

func (*RuntimeHarness) CaptureCombinedFlowJSON

func (h *RuntimeHarness) CaptureCombinedFlowJSON(value CombinedFlowArtifact) error

CaptureCombinedFlowJSON stores a cross-domain scenario summary alongside the domain-specific artifacts captured by the test.

func (*RuntimeHarness) CaptureMockAgentDiagnostics

func (h *RuntimeHarness) CaptureMockAgentDiagnostics(registrations ...acpmock.Registration) error

CaptureMockAgentDiagnostics stores parsed mock-agent diagnostics into the shared artifact model.

func (*RuntimeHarness) CaptureNetworkArtifacts

func (h *RuntimeHarness) CaptureNetworkArtifacts(ctx context.Context, channel string) error

CaptureNetworkArtifacts stores the stable message and audit snapshots for one scenario channel.

func (*RuntimeHarness) CaptureNetworkAudit

func (h *RuntimeHarness) CaptureNetworkAudit() error

CaptureNetworkAudit stores the raw network audit sink when present.

func (*RuntimeHarness) CaptureNetworkDirectRooms

func (h *RuntimeHarness) CaptureNetworkDirectRooms(ctx context.Context, channel string) error

CaptureNetworkDirectRooms stores direct-room summaries for one channel.

func (*RuntimeHarness) CaptureNetworkMessages

func (h *RuntimeHarness) CaptureNetworkMessages(ctx context.Context, channel string) error

CaptureNetworkMessages stores the current network message projection for one channel.

func (*RuntimeHarness) CaptureNetworkThreads

func (h *RuntimeHarness) CaptureNetworkThreads(ctx context.Context, channel string) error

CaptureNetworkThreads stores public-thread summaries for one channel.

func (*RuntimeHarness) CaptureNetworkWork

func (h *RuntimeHarness) CaptureNetworkWork(ctx context.Context, channel string) error

CaptureNetworkWork stores unique work rows referenced by the channel's thread and direct messages.

func (*RuntimeHarness) CaptureProviderCallsFile

func (h *RuntimeHarness) CaptureProviderCallsFile(path string, mediaType string) error

CaptureProviderCallsFile stores provider call markers or logs as a raw artifact.

func (*RuntimeHarness) CaptureProviderCallsJSON

func (h *RuntimeHarness) CaptureProviderCallsJSON(value any) error

CaptureProviderCallsJSON stores provider call diagnostics as JSON.

func (*RuntimeHarness) CaptureSessionEvents

func (h *RuntimeHarness) CaptureSessionEvents(ctx context.Context, sessionID string) error

CaptureSessionEvents stores the session-events artifact.

func (*RuntimeHarness) CaptureSessionSandbox

func (h *RuntimeHarness) CaptureSessionSandbox(ctx context.Context, sessionID string) error

CaptureSessionSandbox stores session sandbox metadata.

func (*RuntimeHarness) CaptureSessionTranscript

func (h *RuntimeHarness) CaptureSessionTranscript(ctx context.Context, sessionID string) error

CaptureSessionTranscript stores the session transcript artifact.

func (*RuntimeHarness) CaptureTaskRuns

func (h *RuntimeHarness) CaptureTaskRuns(
	ctx context.Context,
	taskID string,
	query url.Values,
) error

CaptureTaskRuns stores the task-run projection for one task.

func (*RuntimeHarness) CaptureTasks

func (h *RuntimeHarness) CaptureTasks(ctx context.Context, query url.Values) error

CaptureTasks stores the current task projection.

func (*RuntimeHarness) CaptureToolHostDiagnosticsJSON

func (h *RuntimeHarness) CaptureToolHostDiagnosticsJSON(value ToolHostDiagnosticsArtifact) error

CaptureToolHostDiagnosticsJSON stores tool-host diagnostics separately from provider or mock-agent artifacts so combined-flow runs can retain both.

func (*RuntimeHarness) CaptureTransportOutput

func (h *RuntimeHarness) CaptureTransportOutput(
	name string,
	artifact TransportOutputArtifact,
) (string, error)

CaptureTransportOutput stores one transport result inside the shared harness artifact root.

func (*RuntimeHarness) ClaimTaskRun

ClaimTaskRun claims one queued task run through the public UDS surface.

func (*RuntimeHarness) CompleteTaskRun

CompleteTaskRun completes one running task run through the public UDS surface.

func (*RuntimeHarness) CreateAutomationJob

func (h *RuntimeHarness) CreateAutomationJob(
	ctx context.Context,
	request aghcontract.CreateJobRequest,
) (aghcontract.JobPayload, error)

CreateAutomationJob creates one automation job through the public UDS surface.

func (*RuntimeHarness) CreateAutomationTrigger

func (h *RuntimeHarness) CreateAutomationTrigger(
	ctx context.Context,
	request aghcontract.CreateTriggerRequest,
) (aghcontract.TriggerPayload, error)

CreateAutomationTrigger creates one automation trigger through the public UDS surface.

func (*RuntimeHarness) CreateBridge

CreateBridge persists one bridge instance through the daemon operator surface.

func (*RuntimeHarness) CreateNetworkChannel

CreateNetworkChannel creates one network channel through the public operator surface.

func (*RuntimeHarness) CreateSession

CreateSession creates one session through the operator surface.

func (*RuntimeHarness) DeliverGlobalWebhook

func (h *RuntimeHarness) DeliverGlobalWebhook(
	ctx context.Context,
	endpoint string,
	secret string,
	payload []byte,
	deliveryID string,
	timestamp time.Time,
) (aghcontract.WebhookDeliveryPayload, error)

DeliverGlobalWebhook submits one signed global webhook through the public HTTP ingress.

func (*RuntimeHarness) DeliverWorkspaceWebhook

func (h *RuntimeHarness) DeliverWorkspaceWebhook(
	ctx context.Context,
	workspaceID string,
	endpoint string,
	secret string,
	payload []byte,
	deliveryID string,
	timestamp time.Time,
) (aghcontract.WebhookDeliveryPayload, error)

DeliverWorkspaceWebhook submits one signed workspace webhook through the public HTTP ingress.

func (*RuntimeHarness) DisableExtension

func (h *RuntimeHarness) DisableExtension(
	ctx context.Context,
	name string,
) (aghcontract.ExtensionPayload, error)

DisableExtension disables one installed extension.

func (*RuntimeHarness) EnableBridge

func (h *RuntimeHarness) EnableBridge(
	ctx context.Context,
	bridgeID string,
) (aghcontract.BridgeResponse, error)

EnableBridge starts one persisted bridge instance.

func (*RuntimeHarness) EnableExtension

func (h *RuntimeHarness) EnableExtension(
	ctx context.Context,
	name string,
) (aghcontract.ExtensionPayload, error)

EnableExtension enables one installed extension.

func (*RuntimeHarness) GetAutomationRun

func (h *RuntimeHarness) GetAutomationRun(
	ctx context.Context,
	runID string,
) (aghcontract.RunPayload, error)

GetAutomationRun fetches one automation run through the public UDS surface.

func (*RuntimeHarness) GetBridge

func (h *RuntimeHarness) GetBridge(
	ctx context.Context,
	bridgeID string,
) (aghcontract.BridgeResponse, error)

GetBridge fetches one bridge instance plus its health projection.

func (*RuntimeHarness) GetExtension

func (h *RuntimeHarness) GetExtension(
	ctx context.Context,
	name string,
) (aghcontract.ExtensionPayload, error)

GetExtension fetches one installed extension snapshot.

func (*RuntimeHarness) GetSession

func (h *RuntimeHarness) GetSession(
	ctx context.Context,
	sessionID string,
) (aghcontract.SessionPayload, error)

GetSession fetches one session detail through the operator surface.

func (*RuntimeHarness) GetTask

func (h *RuntimeHarness) GetTask(
	ctx context.Context,
	taskID string,
) (aghcontract.TaskDetailPayload, error)

GetTask fetches one expanded task view through the public UDS surface.

func (*RuntimeHarness) GetWorkspace

func (h *RuntimeHarness) GetWorkspace(
	ctx context.Context,
	workspaceID string,
) (aghcontract.WorkspacePayload, error)

GetWorkspace fetches one workspace through the daemon operator surface.

func (*RuntimeHarness) HTTPJSON

func (h *RuntimeHarness) HTTPJSON(
	ctx context.Context,
	method string,
	path string,
	body any,
	dest any,
) error

HTTPJSON performs a JSON request against the daemon HTTP API.

func (*RuntimeHarness) HTTPURL

func (h *RuntimeHarness) HTTPURL(path string) string

HTTPURL returns one absolute HTTP URL under the public daemon surface.

func (*RuntimeHarness) InstallExtension

InstallExtension installs one local extension bundle through the daemon operator surface.

func (*RuntimeHarness) ListAutomationRuns

func (h *RuntimeHarness) ListAutomationRuns(
	ctx context.Context,
	query url.Values,
) ([]aghcontract.RunPayload, error)

ListAutomationRuns fetches automation run history through the public UDS surface.

func (*RuntimeHarness) ListBridgeRoutes

func (h *RuntimeHarness) ListBridgeRoutes(
	ctx context.Context,
	bridgeID string,
) ([]bridgepkg.BridgeRoute, error)

ListBridgeRoutes fetches the persisted route set for one bridge instance.

func (*RuntimeHarness) ListBridgeSecretBindings

func (h *RuntimeHarness) ListBridgeSecretBindings(
	ctx context.Context,
	bridgeID string,
) ([]bridgepkg.BridgeSecretBinding, error)

ListBridgeSecretBindings fetches the persisted secret bindings for one bridge instance.

func (*RuntimeHarness) ListExtensions

func (h *RuntimeHarness) ListExtensions(ctx context.Context) ([]aghcontract.ExtensionPayload, error)

ListExtensions fetches the installed extension projection through the daemon operator surface.

func (*RuntimeHarness) ListTaskRuns

func (h *RuntimeHarness) ListTaskRuns(
	ctx context.Context,
	taskID string,
	query url.Values,
) ([]aghcontract.TaskRunPayload, error)

ListTaskRuns fetches one task's run history through the public UDS surface.

func (*RuntimeHarness) ListTasks

func (h *RuntimeHarness) ListTasks(
	ctx context.Context,
	query url.Values,
) ([]aghcontract.TaskSummaryPayload, error)

ListTasks fetches task summaries through the public UDS surface.

func (*RuntimeHarness) MockAgentRegistration

func (h *RuntimeHarness) MockAgentRegistration(agentName string) (acpmock.Registration, bool)

MockAgentRegistration returns one previously registered mock-agent definition.

func (*RuntimeHarness) NetworkAuditSnapshot

func (h *RuntimeHarness) NetworkAuditSnapshot() ([]store.NetworkAuditEntry, error)

NetworkAuditSnapshot decodes the current daemon-owned network audit file into a stable snapshot.

func (*RuntimeHarness) NetworkChannel

func (h *RuntimeHarness) NetworkChannel(
	ctx context.Context,
	channel string,
) (aghcontract.NetworkChannelDetailPayload, error)

NetworkChannel fetches one selected network channel detail payload.

func (*RuntimeHarness) NetworkChannelMessages

func (h *RuntimeHarness) NetworkChannelMessages(
	ctx context.Context,
	channel string,
) ([]aghcontract.NetworkConversationMessagePayload, error)

NetworkChannelMessages fetches public-thread messages for one channel.

func (*RuntimeHarness) NetworkChannels

func (h *RuntimeHarness) NetworkChannels(
	ctx context.Context,
) ([]aghcontract.NetworkChannelPayload, error)

NetworkChannels fetches the current network channel projection.

func (*RuntimeHarness) NetworkDirectResolve

NetworkDirectResolve resolves the deterministic direct room for a local session and peer.

func (*RuntimeHarness) NetworkDirectRoom

func (h *RuntimeHarness) NetworkDirectRoom(
	ctx context.Context,
	channel string,
	directID string,
) (aghcontract.NetworkDirectRoomPayload, error)

NetworkDirectRoom fetches one direct-room summary.

func (*RuntimeHarness) NetworkDirectRoomMessages

func (h *RuntimeHarness) NetworkDirectRoomMessages(
	ctx context.Context,
	channel string,
	directID string,
) ([]aghcontract.NetworkConversationMessagePayload, error)

NetworkDirectRoomMessages fetches messages isolated to one direct room.

func (*RuntimeHarness) NetworkDirectRooms

func (h *RuntimeHarness) NetworkDirectRooms(
	ctx context.Context,
	channel string,
) ([]aghcontract.NetworkDirectRoomPayload, error)

NetworkDirectRooms fetches direct-room summaries for one channel.

func (*RuntimeHarness) NetworkInbox

func (h *RuntimeHarness) NetworkInbox(
	ctx context.Context,
	sessionID string,
) ([]aghcontract.NetworkEnvelopePayload, error)

NetworkInbox fetches the queued inbox projection for one local session.

func (*RuntimeHarness) NetworkPeers

func (h *RuntimeHarness) NetworkPeers(
	ctx context.Context,
	channel string,
) ([]aghcontract.NetworkPeerPayload, error)

NetworkPeers fetches the current visible peers, optionally filtered by channel.

func (*RuntimeHarness) NetworkSend

NetworkSend sends one envelope through the public network operator surface.

func (*RuntimeHarness) NetworkStatus

NetworkStatus fetches the current network runtime projection.

func (*RuntimeHarness) NetworkThread

func (h *RuntimeHarness) NetworkThread(
	ctx context.Context,
	channel string,
	threadID string,
) (aghcontract.NetworkThreadSummaryPayload, error)

NetworkThread fetches one public-thread summary.

func (*RuntimeHarness) NetworkThreadMessages

func (h *RuntimeHarness) NetworkThreadMessages(
	ctx context.Context,
	channel string,
	threadID string,
) ([]aghcontract.NetworkConversationMessagePayload, error)

NetworkThreadMessages fetches messages isolated to one public thread.

func (*RuntimeHarness) NetworkThreads

func (h *RuntimeHarness) NetworkThreads(
	ctx context.Context,
	channel string,
) ([]aghcontract.NetworkThreadSummaryPayload, error)

NetworkThreads fetches public-thread summaries for one channel.

func (*RuntimeHarness) NetworkWork

func (h *RuntimeHarness) NetworkWork(
	ctx context.Context,
	workID string,
) (aghcontract.NetworkWorkPayload, error)

NetworkWork fetches one lifecycle-bearing work row.

func (*RuntimeHarness) PromptSession

func (h *RuntimeHarness) PromptSession(
	ctx context.Context,
	sessionID string,
	message string,
) ([]SSEEvent, error)

PromptSession sends one prompt through the operator surface and drains the SSE stream.

func (*RuntimeHarness) PromptSessionHTTP

func (h *RuntimeHarness) PromptSessionHTTP(
	ctx context.Context,
	sessionID string,
	message string,
) ([]SSEEvent, error)

PromptSessionHTTP sends one prompt through the public HTTP API and drains the SSE stream.

func (*RuntimeHarness) PromptSessionHTTPUntil

func (h *RuntimeHarness) PromptSessionHTTPUntil(
	ctx context.Context,
	sessionID string,
	message string,
	predicate func(SSEEvent) bool,
) ([]SSEEvent, error)

PromptSessionHTTPUntil sends one prompt through the public HTTP API and returns as soon as the streamed SSE records satisfy predicate.

func (*RuntimeHarness) PromptSessionHTTPWithEvents

func (h *RuntimeHarness) PromptSessionHTTPWithEvents(
	ctx context.Context,
	sessionID string,
	message string,
	onEvent func(SSEEvent) error,
) ([]SSEEvent, error)

PromptSessionHTTPWithEvents sends one prompt through the public HTTP API and lets callers react to streamed SSE records before the prompt completes.

func (*RuntimeHarness) PromptSessionUntil

func (h *RuntimeHarness) PromptSessionUntil(
	ctx context.Context,
	sessionID string,
	message string,
	predicate func(SSEEvent) bool,
) ([]SSEEvent, error)

PromptSessionUntil sends one prompt through the operator surface and returns as soon as the streamed SSE records satisfy predicate.

func (*RuntimeHarness) PromptSessionWithEvents

func (h *RuntimeHarness) PromptSessionWithEvents(
	ctx context.Context,
	sessionID string,
	message string,
	onEvent func(SSEEvent) error,
) ([]SSEEvent, error)

PromptSessionWithEvents sends one prompt through the operator surface and lets callers react to streamed SSE records before the prompt completes.

func (*RuntimeHarness) PutBridgeSecretBinding

func (h *RuntimeHarness) PutBridgeSecretBinding(
	ctx context.Context,
	bridgeID string,
	bindingName string,
	request aghcontract.PutBridgeSecretBindingRequest,
) (bridgepkg.BridgeSecretBinding, error)

PutBridgeSecretBinding upserts one daemon-owned bridge secret binding.

func (*RuntimeHarness) RegisterMockAgent

func (h *RuntimeHarness) RegisterMockAgent(t testing.TB, spec MockAgentSpec) acpmock.Registration

RegisterMockAgent writes one temporary fixture-backed AGENT.md into the isolated AGH home.

func (*RuntimeHarness) ResolveWorkspace

func (h *RuntimeHarness) ResolveWorkspace(
	ctx context.Context,
	root string,
) (aghcontract.WorkspacePayload, error)

ResolveWorkspace resolves a workspace through the real daemon API.

func (*RuntimeHarness) RestartBridge

func (h *RuntimeHarness) RestartBridge(
	ctx context.Context,
	bridgeID string,
) (aghcontract.BridgeResponse, error)

RestartBridge restarts one bridge instance while keeping its route ownership.

func (*RuntimeHarness) ResumeSession

func (h *RuntimeHarness) ResumeSession(
	ctx context.Context,
	sessionID string,
) (aghcontract.SessionPayload, error)

ResumeSession attaches to one resumable live session through the operator surface.

func (*RuntimeHarness) RuntimeManifest

func (h *RuntimeHarness) RuntimeManifest() (RuntimeArtifactManifest, error)

RuntimeManifest returns the current runtime-manifest snapshot without writing it.

func (*RuntimeHarness) RuntimeManifestPath

func (h *RuntimeHarness) RuntimeManifestPath() string

RuntimeManifestPath returns the stable runtime-manifest path under the harness artifact root.

func (*RuntimeHarness) SeedAutomationFixtures

func (h *RuntimeHarness) SeedAutomationFixtures(
	ctx context.Context,
	seed AutomationFixtureSeed,
) (AutomationFixtureState, error)

SeedAutomationFixtures creates the requested automation jobs and triggers through the public daemon UDS surface without mutating caller-supplied definitions.

func (*RuntimeHarness) SessionEvents

func (h *RuntimeHarness) SessionEvents(
	ctx context.Context,
	sessionID string,
) (aghcontract.SessionEventsResponse, error)

SessionEvents fetches persisted events for one session.

func (*RuntimeHarness) SessionSandboxArtifact

func (h *RuntimeHarness) SessionSandboxArtifact(
	ctx context.Context,
	sessionID string,
) (SessionSandboxArtifact, error)

SessionSandboxArtifact reads the public session payload and, when present, the persisted session metadata for one runtime session.

func (*RuntimeHarness) SessionTranscript

func (h *RuntimeHarness) SessionTranscript(
	ctx context.Context,
	sessionID string,
) (aghcontract.SessionTranscriptResponse, error)

SessionTranscript fetches the persisted transcript for one session.

func (*RuntimeHarness) StartTaskRun

StartTaskRun starts one claimed task run through the public UDS surface.

func (*RuntimeHarness) Stop

func (h *RuntimeHarness) Stop(ctx context.Context) error

Stop shuts down the started daemon and waits for process exit.

func (*RuntimeHarness) StopSession

func (h *RuntimeHarness) StopSession(ctx context.Context, sessionID string) error

StopSession stops one session through the operator surface.

func (*RuntimeHarness) StreamSessionHTTPUntil

func (h *RuntimeHarness) StreamSessionHTTPUntil(
	ctx context.Context,
	sessionID string,
	predicate func(SSEEvent) bool,
) ([]SSEEvent, error)

StreamSessionHTTPUntil opens the public HTTP session event stream and returns as soon as streamed SSE records satisfy predicate.

func (*RuntimeHarness) TransportClients

func (h *RuntimeHarness) TransportClients() (TransportClients, error)

TransportClients returns HTTP, UDS, and CLI transport clients for the current shared runtime harness.

func (*RuntimeHarness) TriggerAutomationJob

func (h *RuntimeHarness) TriggerAutomationJob(
	ctx context.Context,
	jobID string,
) (aghcontract.RunPayload, error)

TriggerAutomationJob forces one manual automation run through the public UDS surface.

func (*RuntimeHarness) UDSJSON

func (h *RuntimeHarness) UDSJSON(
	ctx context.Context,
	method string,
	path string,
	body any,
	dest any,
) error

UDSJSON performs a JSON request against the daemon UDS API.

func (*RuntimeHarness) UDSURL

func (h *RuntimeHarness) UDSURL(path string) string

UDSURL returns one absolute UDS-backed URL under the operator daemon surface.

func (*RuntimeHarness) WriteRuntimeManifest

func (h *RuntimeHarness) WriteRuntimeManifest() (RuntimeArtifactManifest, error)

WriteRuntimeManifest persists the current runtime-manifest snapshot.

type RuntimeHarnessOptions

type RuntimeHarnessOptions struct {
	BinaryPath       string
	HomePaths        aghconfig.HomePaths
	ConfigSeed       ConfigSeedOptions
	MockAgents       []MockAgentSpec
	Workspace        WorkspaceSeedOptions
	Env              map[string]string
	EnableNetwork    bool
	StartTimeout     time.Duration
	PollInterval     time.Duration
	ResolveWorkspace bool
}

RuntimeHarnessOptions configures one isolated daemon runtime.

type RuntimeHomeArtifact

type RuntimeHomeArtifact struct {
	HomeDir          string `json:"home_dir,omitempty"`
	ConfigFile       string `json:"config_file,omitempty"`
	DatabaseFile     string `json:"database_file,omitempty"`
	DaemonSocket     string `json:"daemon_socket,omitempty"`
	DaemonInfo       string `json:"daemon_info,omitempty"`
	LogsDir          string `json:"logs_dir,omitempty"`
	NetworkAuditFile string `json:"network_audit_file,omitempty"`
}

RuntimeHomeArtifact captures the isolated AGH home layout used by a harness.

type RuntimeLogArtifact

type RuntimeLogArtifact struct {
	DaemonLogFile  string `json:"daemon_log_file,omitempty"`
	ProcessLogFile string `json:"process_log_file,omitempty"`
}

RuntimeLogArtifact captures the daemon log surfaces retained by the harness.

type RuntimeRunArtifact

type RuntimeRunArtifact struct {
	RootDir     string   `json:"root_dir,omitempty"`
	Directories []string `json:"directories,omitempty"`
}

RuntimeRunArtifact captures the stable run-root surfaces retained by the harness.

type RuntimeTransportArtifact

type RuntimeTransportArtifact struct {
	HTTPBaseURL string `json:"http_base_url,omitempty"`
	HTTPHost    string `json:"http_host,omitempty"`
	HTTPPort    int    `json:"http_port,omitempty"`
	UDSBaseURL  string `json:"uds_base_url,omitempty"`
	SocketPath  string `json:"socket_path,omitempty"`
	CLIBinary   string `json:"cli_binary,omitempty"`
	CLIWorkdir  string `json:"cli_workdir,omitempty"`
}

RuntimeTransportArtifact captures the public transport metadata shared by the harness.

type SSEEvent

type SSEEvent struct {
	ID    string
	Event string
	Data  []byte
}

SSEEvent captures one parsed server-sent event record.

type SessionSandboxArtifact

type SessionSandboxArtifact struct {
	SessionID    string                             `json:"session_id"`
	SessionState string                             `json:"session_state,omitempty"`
	StopReason   store.StopReason                   `json:"stop_reason,omitempty"`
	StopDetail   string                             `json:"stop_detail,omitempty"`
	API          *aghcontract.SessionSandboxPayload `json:"api,omitempty"`
	Persisted    *store.SessionSandboxMeta          `json:"persisted,omitempty"`
}

SessionSandboxArtifact captures both the public session sandbox projection and the fuller persisted metadata stored on disk for one session.

type ToolHostDiagnosticsArtifact

type ToolHostDiagnosticsArtifact struct {
	SessionID  string                        `json:"session_id,omitempty"`
	Operations []ToolHostOperationDiagnostic `json:"operations,omitempty"`
}

ToolHostDiagnosticsArtifact groups tool-host observations for one session.

func (ToolHostDiagnosticsArtifact) Allowed

Allowed returns the matching allowed operation diagnostic when present.

func (ToolHostDiagnosticsArtifact) Blocked

Blocked returns the matching blocked operation diagnostic when present.

type ToolHostOperationDiagnostic

type ToolHostOperationDiagnostic struct {
	Operation        string                   `json:"operation"`
	Path             string                   `json:"path,omitempty"`
	Outcome          ToolHostOperationOutcome `json:"outcome,omitempty"`
	Error            string                   `json:"error,omitempty"`
	SideEffectPath   string                   `json:"side_effect_path,omitempty"`
	SideEffectExists bool                     `json:"side_effect_exists,omitempty"`
}

ToolHostOperationDiagnostic records one observed tool-host action.

func FindAllowedToolHostOperation

func FindAllowedToolHostOperation(
	operations []ToolHostOperationDiagnostic,
	operation string,
) (ToolHostOperationDiagnostic, bool)

FindAllowedToolHostOperation locates an allowed operation without relying on transcript text.

func FindBlockedToolHostOperation

func FindBlockedToolHostOperation(
	operations []ToolHostOperationDiagnostic,
	operation string,
) (ToolHostOperationDiagnostic, bool)

FindBlockedToolHostOperation locates a blocked operation without relying on transcript text.

type ToolHostOperationOutcome

type ToolHostOperationOutcome string

ToolHostOperationOutcome classifies one tool-host operation result.

const (
	ToolHostOutcomeAllowed ToolHostOperationOutcome = "allowed"
	ToolHostOutcomeBlocked ToolHostOperationOutcome = "blocked"
)

type TransportClients

type TransportClients struct {
	HTTPBaseURL string
	HTTPClient  *http.Client

	UDSBaseURL string
	UDSClient  *http.Client

	CLI *CLIClient
}

TransportClients exposes the public transport clients derived from one shared runtime harness. Tests use this to keep HTTP, UDS, and CLI reads pointed at the same daemon instance.

type TransportOutputArtifact

type TransportOutputArtifact struct {
	Name       string   `json:"name,omitempty"`
	Transport  string   `json:"transport,omitempty"`
	Command    []string `json:"command,omitempty"`
	URL        string   `json:"url,omitempty"`
	Method     string   `json:"method,omitempty"`
	StatusCode int      `json:"status_code,omitempty"`
	Stdout     string   `json:"stdout,omitempty"`
	Stderr     string   `json:"stderr,omitempty"`
	Error      string   `json:"error,omitempty"`
	Payload    any      `json:"payload,omitempty"`
}

TransportOutputArtifact records one CLI/HTTP/UDS result retained for later diagnostics.

type WorkspaceSeedOptions

type WorkspaceSeedOptions struct {
	Root  string
	Files map[string]string
}

WorkspaceSeedOptions configures the seeded workspace root.

Jump to

Keyboard shortcuts

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