e2e

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCompozyBinary

func BuildCompozyBinary(t testing.TB) string

BuildCompozyBinary builds or reuses the current checkout's Compozy binary for integration fixtures.

func NewHomePaths

func NewHomePaths(t testing.TB) compozyconfig.HomePaths

NewHomePaths creates an isolated Compozy 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

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 compozycontract.WebhookDeliveryPayload,
	projections ...compozycontract.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 compozyconfig.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   []compozyconfig.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 stable directory under the test runtime's artifact owner. Retention is controlled by the standard go test -artifacts flag.

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"
	ArtifactKindAutomationRuns      ArtifactKind = "automation_runs"
	ArtifactKindTasks               ArtifactKind = "tasks"
	ArtifactKindTaskRuns            ArtifactKind = "task_runs"
	ArtifactKindProviderCalls       ArtifactKind = "provider_calls"
	ArtifactKindToolHostDiagnostics ArtifactKind = "tool_host_diagnostics"
	ArtifactKindCombinedFlow        ArtifactKind = "combined_flow"
	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     []compozycontract.CreateJobRequest
	Triggers []compozycontract.CreateTriggerRequest
}

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

type AutomationFixtureState

type AutomationFixtureState struct {
	Jobs     []compozycontract.JobPayload
	Triggers []compozycontract.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 `compozy` 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) RunInDirWithEnv

func (c *CLIClient) RunInDirWithEnv(
	ctx context.Context,
	workdir string,
	overrides map[string]string,
	args ...string,
) (string, string, error)

RunInDirWithEnv executes one CLI command with scoped environment overrides.

func (*CLIClient) RunInDirWithInput

func (c *CLIClient) RunInDirWithInput(
	ctx context.Context,
	workdir string,
	input io.Reader,
	args ...string,
) (string, string, error)

RunInDirWithInput executes one CLI command with explicit standard input.

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.

func (*CLIClient) RunUntilFirstStdoutLineAndStop

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

RunUntilFirstStdoutLineAndStop returns after one complete line and joins the stopped process.

type CombinedFlowArtifact

type CombinedFlowArtifact struct {
	Scenario  string `json:"scenario"`
	SessionID string `json:"session_id,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"`

	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

	PermissionMode compozyconfig.PermissionMode
	Providers      map[string]compozyconfig.ProviderConfig

	AgentDefs []AgentSeed
	Mutate    func(*compozyconfig.Config)
}

ConfigSeedOptions configures the seeded daemon runtime config.

type MockAgentSpec

type MockAgentSpec struct {
	FixturePath     string
	FixtureAgent    string
	AgentName       string
	ProviderName    string
	DiagnosticsPath string
	Tools           []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 compozycontract.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     compozyconfig.HomePaths
	Config        compozyconfig.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 compozycontract.ApproveSessionRequest,
) (err 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) 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) 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) 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) ClaimExactTaskRunForSession

func (h *RuntimeHarness) ClaimExactTaskRunForSession(
	ctx context.Context,
	runID string,
	session *compozycontract.SessionPayload,
) (compozycontract.TaskRunPayload, error)

ClaimExactTaskRunForSession claims one exact queued run through the canonical agent lease surface.

func (*RuntimeHarness) CompleteClaimedTaskRunForSession

CompleteClaimedTaskRunForSession completes a claimed run through the canonical agent lease surface without exposing the raw claim token to the caller.

func (*RuntimeHarness) CompleteTaskRun

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

func (*RuntimeHarness) CreateAutomationJob

CreateAutomationJob creates one automation job through the public UDS surface.

func (*RuntimeHarness) CreateAutomationTrigger

CreateAutomationTrigger creates one automation trigger through the public UDS 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,
) (compozycontract.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,
) (compozycontract.WebhookDeliveryPayload, error)

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

func (*RuntimeHarness) GetAutomationRun

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

GetAutomationRun fetches one automation run through the public UDS surface.

func (*RuntimeHarness) GetExtension

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

GetExtension fetches one installed extension snapshot.

func (*RuntimeHarness) GetSession

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

GetSession fetches one session detail through the operator surface.

func (*RuntimeHarness) GetTask

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

func (*RuntimeHarness) GetUserSession

func (h *RuntimeHarness) GetUserSession(ctx context.Context, sessionID string) (compozycontract.SessionPayload, error)

GetUserSession fetches one User-scope session through its `@user` route.

func (*RuntimeHarness) GetWorkspace

func (h *RuntimeHarness) GetWorkspace(
	ctx context.Context,
	workspaceID string,
) (compozycontract.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,
) ([]compozycontract.RunPayload, error)

ListAutomationRuns fetches automation run history through the public UDS surface.

func (*RuntimeHarness) ListExtensions

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,
) ([]compozycontract.TaskRunPayload, error)

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

func (*RuntimeHarness) ListTasks

ListTasks fetches lean task catalog rows 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) 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, err 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, err 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, err 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, err error)

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

func (*RuntimeHarness) PromptSessionWithRuntime

func (h *RuntimeHarness) PromptSessionWithRuntime(
	ctx context.Context,
	sessionID string,
	message string,
	runtime *compozycontract.PromptRuntimeSelectionPayload,
) ([]SSEEvent, error)

PromptSessionWithRuntime sends one prompt with an explicit runtime selection and drains the SSE stream.

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 Compozy home.

func (*RuntimeHarness) ResolveWorkspace

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

ResolveWorkspace resolves a workspace through the real daemon API.

func (*RuntimeHarness) Restart

func (h *RuntimeHarness) Restart(t testing.TB)

Restart stops the daemon and starts it again on the same home, so restart-required settings written through the CLI take effect.

func (*RuntimeHarness) ResumeSession

func (h *RuntimeHarness) ResumeSession(
	ctx context.Context,
	sessionID string,
) (compozycontract.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,
) (compozycontract.SessionEventsResponse, error)

SessionEvents fetches persisted events for one session.

func (*RuntimeHarness) SessionTranscript

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

SessionTranscript fetches the persisted transcript for one session.

func (*RuntimeHarness) SetExtensionEnablement

func (h *RuntimeHarness) SetExtensionEnablement(
	ctx context.Context,
	name string,
	profile string,
	enabled bool,
) (compozycontract.ExtensionEnablementPayload, error)

SetExtensionEnablement changes one installed extension in a named profile.

func (*RuntimeHarness) StartClaimedTaskRunForSession

func (h *RuntimeHarness) StartClaimedTaskRunForSession(
	ctx context.Context,
	runID string,
	session *compozycontract.SessionPayload,
	request compozycontract.StartTaskRunRequest,
) (compozycontract.TaskRunPayload, error)

StartClaimedTaskRunForSession starts a claimed run through the session-bound agent surface without exposing its raw lease credential to the caller.

func (*RuntimeHarness) StartSessionCatalogHTTPStream

func (h *RuntimeHarness) StartSessionCatalogHTTPStream(
	ctx context.Context,
	predicate func(SSEEvent) bool,
) (stream <-chan SessionCatalogStreamResult, err error)

StartSessionCatalogHTTPStream subscribes before returning, then reads until predicate matches.

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) (err 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) StreamSessionRawHTTPUntil

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

StreamSessionRawHTTPUntil opens the public HTTP session event stream in raw frame mode 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,
) (compozycontract.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) UserSessionTranscript

func (h *RuntimeHarness) UserSessionTranscript(
	ctx context.Context,
	sessionID string,
) (compozycontract.SessionTranscriptResponse, error)

UserSessionTranscript fetches the transcript of one User-scope session.

func (*RuntimeHarness) WaitForSessionActive

func (h *RuntimeHarness) WaitForSessionActive(
	ctx context.Context,
	sessionID string,
) (compozycontract.SessionPayload, error)

WaitForSessionActive waits for asynchronous session startup to become prompt-ready.

func (*RuntimeHarness) WriteRuntimeManifest

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

WriteRuntimeManifest persists the current runtime-manifest snapshot.

type RuntimeHarnessOptions

type RuntimeHarnessOptions struct {
	BinaryPath string
	HomePaths  compozyconfig.HomePaths
	ConfigSeed ConfigSeedOptions
	MockAgents []MockAgentSpec
	Workspace  WorkspaceSeedOptions
	Env        map[string]string

	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"`
}

RuntimeHomeArtifact captures the isolated Compozy 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,omitzero"`
	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 SessionCatalogStreamResult

type SessionCatalogStreamResult struct {
	Records []SSEEvent
	Err     error
}

SessionCatalogStreamResult is one completed catalog-stream observation.

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,omitzero"`
}

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,omitzero"`
	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