Documentation
¶
Index ¶
- Constants
- Variables
- func OpaqueAgentID(agentID string) string
- func PlaywrightDownloadAvailable(root *config.Config) bool
- func PlaywrightHandoffAvailable(root *config.Config) bool
- type Action
- type ActionKind
- type ActionWorker
- type ApprovalBinding
- type Broker
- func (broker *Broker) CaptureScreenshot(ctx context.Context, request ScreenshotRequest) (ScreenshotCapture, error)
- func (broker *Broker) Close(ctx context.Context, owner Owner, sessionID string) (Session, error)
- func (broker *Broker) ExecuteAction(ctx context.Context, owner Owner, preparedID string, approval *ApprovalBinding) (Invocation, error)
- func (broker *Broker) ExecuteActionWithDownloadSink(ctx context.Context, owner Owner, preparedID string, approval *ApprovalBinding, ...) (Invocation, error)
- func (broker *Broker) ExecutePrepared(ctx context.Context, owner Owner, invocationID string, actionHash string, ...) (Invocation, error)
- func (broker *Broker) Handoff(ctx context.Context, owner Owner, sessionID string) (Session, error)
- func (broker *Broker) Observe(ctx context.Context, owner Owner, sessionID, tabID string) (Observation, error)
- func (broker *Broker) Open(ctx context.Context, request OpenRequest) (Session, error)
- func (broker *Broker) PassiveReadiness(ctx context.Context, targetName string, profileName string) (PassiveReadiness, error)
- func (broker *Broker) PassiveTargetDiagnostics(ctx context.Context, targetName string, profileNames []string) ([]ActionKind, map[string]PassiveReadiness, error)
- func (broker *Broker) PrepareAction(ctx context.Context, request PrepareActionRequest) (Preparation, error)
- func (broker *Broker) PreparedAction(ctx context.Context, owner Owner, id string) (PreparedAction, error)
- func (broker *Broker) ProfileAvailability(ctx context.Context, targetName string, profileName string) (ProfileAvailability, error)
- func (broker *Broker) Recover(ctx context.Context, verifiers ...DownloadRecoveryVerifier) error
- func (broker *Broker) RecoverAcceptedDownload(ctx context.Context, owner Owner, preparedID string, terminal json.RawMessage) (Invocation, error)
- func (broker *Broker) RecoverableDownloadPreparation(ctx context.Context, request PrepareActionRequest) (Preparation, bool, error)
- func (broker *Broker) ReleaseHandoff(ctx context.Context, owner Owner, sessionID string) (Session, error)
- func (broker *Broker) Resume(ctx context.Context, owner Owner, sessionID string) (Session, error)
- func (broker *Broker) Shutdown(ctx context.Context) error
- func (broker *Broker) Status(ctx context.Context, owner Owner, sessionID string) (Session, error)
- func (broker *Broker) Sweep(ctx context.Context) error
- func (broker *Broker) Touch(ctx context.Context, owner Owner, sessionID string) (Session, error)
- type ControllerState
- type DialogObservation
- type DownloadArtifact
- type DownloadDeliveryRequest
- type DownloadRecoveryVerifier
- type DownloadSink
- type DriverAction
- type DriverActionKind
- type DriverDownload
- type DriverElement
- type DriverObservation
- type DriverReadiness
- type DriverScreenshot
- type Effect
- type FileStore
- func (store *FileStore) Close()
- func (store *FileStore) CreateInvocation(_ context.Context, invocation Invocation) error
- func (store *FileStore) CreatePreparation(_ context.Context, prepared PreparedAction, invocation Invocation) error
- func (store *FileStore) CreateSession(_ context.Context, session Session) error
- func (store *FileStore) GetInvocation(_ context.Context, id string) (Invocation, error)
- func (store *FileStore) GetPreparedAction(_ context.Context, id string) (PreparedAction, error)
- func (store *FileStore) GetSession(_ context.Context, id string) (Session, error)
- func (store *FileStore) ListInvocations(_ context.Context, sessionID string) ([]Invocation, error)
- func (store *FileStore) ListSessions(_ context.Context) ([]Session, error)
- func (store *FileStore) PruneInvocations(_ context.Context, completedBefore int64) error
- func (store *FileStore) PrunePreparedActions(_ context.Context, expiredBefore int64) error
- func (store *FileStore) UpdateInvocation(_ context.Context, expected uint64, next Invocation) error
- func (store *FileStore) UpdateSession(_ context.Context, expected uint64, next Session) error
- type HumanControllerWorker
- type Invocation
- type InvocationExecutor
- type InvocationState
- type MemoryStore
- func (store *MemoryStore) CreateInvocation(_ context.Context, invocation Invocation) error
- func (store *MemoryStore) CreatePreparation(_ context.Context, prepared PreparedAction, invocation Invocation) error
- func (store *MemoryStore) CreateSession(_ context.Context, session Session) error
- func (store *MemoryStore) GetInvocation(_ context.Context, id string) (Invocation, error)
- func (store *MemoryStore) GetPreparedAction(_ context.Context, id string) (PreparedAction, error)
- func (store *MemoryStore) GetSession(_ context.Context, id string) (Session, error)
- func (store *MemoryStore) ListInvocations(_ context.Context, sessionID string) ([]Invocation, error)
- func (store *MemoryStore) ListSessions(_ context.Context) ([]Session, error)
- func (store *MemoryStore) PruneInvocations(_ context.Context, completedBefore int64) error
- func (store *MemoryStore) PrunePreparedActions(_ context.Context, expiredBefore int64) error
- func (store *MemoryStore) UpdateInvocation(_ context.Context, expected uint64, next Invocation) error
- func (store *MemoryStore) UpdateSession(_ context.Context, expected uint64, next Session) error
- type NavigationCheckedActionWorker
- type NavigationIdentityWorker
- type Observation
- type OpenRequest
- type Owner
- type PassiveReadiness
- type PlaywrightManagedHostConfig
- type PlaywrightWorkerFactory
- type Preparation
- type PrepareActionRequest
- type PreparedAction
- type PreparedActionWorker
- type ProfileAvailability
- type ScreenshotArtifact
- type ScreenshotCapture
- type ScreenshotDeliveryRequest
- type ScreenshotRecovery
- type ScreenshotRequest
- type ScreenshotWorker
- type Session
- type SessionState
- type Store
- type TargetDiagnostics
- type TransferWorker
- type UploadBinding
- type Worker
- type WorkerFactory
- type WorkerOpenRequest
- type WorkerOpenResult
- type WorkerPreparedAction
- type WorkerStatus
Constants ¶
const ( DefaultFileStoreRecords = 512 DefaultFileStoreBytes = 8 * 1024 * 1024 )
const ( ReadinessReady = "ready" ReadinessConfigured = "configured" ReadinessBusy = "busy" ReadinessDegraded = "degraded" CompatibilityUnchecked = "unchecked" CompatibilityCompatible = "compatible" CompatibilityIncompatible = "incompatible" )
const ( MaxIdentifierBytes = 128 MaxSafeFailureBytes = 256 MaxTerminalBytes = 320 * 1024 MaxURLBytes = 2048 MaxElementNameBytes = 512 MaxDialogMessageBytes = 2048 MaxScrollAmount = 5 )
const ( ScreenshotDeliveryPending = "pending" ScreenshotDeliveryAlreadyClaimed = "already_claimed" )
Variables ¶
var ( ErrStoreFull = errors.New("browser state store is full") ErrStoreOwned = errors.New("browser state store is owned by another process") ErrStoreClosed = errors.New("browser state store is closed") )
var ( ErrBusy = errors.New("browser profile is busy") ErrConflict = errors.New("browser state conflicts with durable state") ErrDenied = errors.New("browser authority denied") ErrDriverIncompatible = errors.New("browser driver is incompatible") ErrDriverRejected = errors.New("browser driver rejected the operation") ErrInvalid = errors.New("invalid browser state") ErrNotFound = errors.New("browser state not found") ErrApprovalRequired = errors.New("browser action requires approval") ErrSnapshotInvalidation = errors.New("browser snapshot invalidation failed") ErrStale = errors.New("browser state revision is stale") ErrWorkerLost = fmt.Errorf("%w: terminal worker loss", ErrWorkerUnavailable) )
Functions ¶
func OpaqueAgentID ¶
OpaqueAgentID maps a validated configuration alias onto the non-reversible identity used in broker ownership records and authorization checks.
func PlaywrightDownloadAvailable ¶
PlaywrightDownloadAvailable reports whether the configured private driver can deny native disk downloads and expose the scoped Chromium stream boundary.
func PlaywrightHandoffAvailable ¶
PlaywrightHandoffAvailable reports whether the managed driver owns a headed local browser window. Handoff does not expose a remote endpoint or admit a headless/browser-extension configuration.
Types ¶
type Action ¶
type Action struct {
Kind ActionKind `json:"kind"`
URL string `json:"url,omitempty"`
Ref string `json:"ref,omitempty"`
Target string `json:"target,omitempty"`
Value string `json:"value,omitempty"`
Key string `json:"key,omitempty"`
Direction string `json:"direction,omitempty"`
Amount int `json:"amount,omitempty"`
Decision string `json:"decision,omitempty"`
PromptProvided bool `json:"prompt_provided,omitempty"`
ArtifactRef string `json:"artifact_ref,omitempty"`
Deliver bool `json:"deliver,omitempty"`
}
type ActionKind ¶
type ActionKind string
const ( ActionClick ActionKind = "click" ActionFill ActionKind = "fill" ActionSelect ActionKind = "select" ActionPress ActionKind = "press" ActionScroll ActionKind = "scroll" ActionDialog ActionKind = "dialog" ActionUpload ActionKind = "upload" ActionDownload ActionKind = "download" )
func (ActionKind) Valid ¶
func (kind ActionKind) Valid() bool
type ActionWorker ¶
type ApprovalBinding ¶
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
func (*Broker) CaptureScreenshot ¶
func (broker *Broker) CaptureScreenshot( ctx context.Context, request ScreenshotRequest, ) (ScreenshotCapture, error)
CaptureScreenshot captures one PNG only for the exact fresh observation owned by the caller. Artifact persistence and routed delivery remain gateway responsibilities outside the broker.
func (*Broker) ExecuteAction ¶
func (broker *Broker) ExecuteAction( ctx context.Context, owner Owner, preparedID string, approval *ApprovalBinding, ) (Invocation, error)
func (*Broker) ExecuteActionWithDownloadSink ¶
func (broker *Broker) ExecuteActionWithDownloadSink( ctx context.Context, owner Owner, preparedID string, approval *ApprovalBinding, sink DownloadSink, ) (Invocation, error)
func (*Broker) ExecutePrepared ¶
func (broker *Broker) ExecutePrepared( ctx context.Context, owner Owner, invocationID string, actionHash string, execute InvocationExecutor, ) (Invocation, error)
ExecutePrepared durably accepts one prepared invocation before dispatch. Existing terminal records are returned idempotently; an existing accepted record becomes unknown and is never dispatched again.
func (*Broker) Handoff ¶
Handoff durably removes agent authority before enabling local human input. The controller lease is bounded by the prepared-action window and the session lifetime. No view credential crosses this broker boundary.
func (*Broker) PassiveReadiness ¶
func (broker *Broker) PassiveReadiness( ctx context.Context, targetName string, profileName string, ) (PassiveReadiness, error)
PassiveReadiness reports configured and last-observed driver readiness plus durable profile lease state. It does not call Worker.Status, start or close a worker, reconcile state, renew activity, or resolve an artifact reference.
func (*Broker) PassiveTargetDiagnostics ¶
func (broker *Broker) PassiveTargetDiagnostics( ctx context.Context, targetName string, profileNames []string, ) ([]ActionKind, map[string]PassiveReadiness, error)
PassiveTargetDiagnostics combines one immutable factory snapshot with the broker's durable profile lease projection.
func (*Broker) PrepareAction ¶
func (broker *Broker) PrepareAction(ctx context.Context, request PrepareActionRequest) (Preparation, error)
func (*Broker) PreparedAction ¶
func (*Broker) ProfileAvailability ¶
func (broker *Broker) ProfileAvailability( ctx context.Context, targetName string, profileName string, ) (ProfileAvailability, error)
ProfileAvailability reports whether a configured profile can accept a new session without starting a worker, reconciling state, or renewing activity.
func (*Broker) Recover ¶
func (broker *Broker) Recover(ctx context.Context, verifiers ...DownloadRecoveryVerifier) error
Recover reconciles state after a gateway restart. B1 workers are in-process, so continuity cannot be proven: live sessions become lost and accepted operations become unknown without dispatch, except typed downloads whose exact committed P2 artifact can still complete without replay.
func (*Broker) RecoverAcceptedDownload ¶
func (broker *Broker) RecoverAcceptedDownload( ctx context.Context, owner Owner, preparedID string, terminal json.RawMessage, ) (Invocation, error)
func (*Broker) RecoverableDownloadPreparation ¶
func (broker *Broker) RecoverableDownloadPreparation( ctx context.Context, request PrepareActionRequest, ) (Preparation, bool, error)
func (*Broker) ReleaseHandoff ¶
func (broker *Broker) ReleaseHandoff(ctx context.Context, owner Owner, sessionID string) (Session, error)
ReleaseHandoff records the authenticated local operator's release and ends the worker's human-control mode. Agent authority remains paused until a separate Resume call.
func (*Broker) Resume ¶
Resume restores agent authority only after routed human release has already revoked local input. It rotates controller generation and requires a fresh observation.
func (*Broker) Shutdown ¶
Shutdown closes every live browser session before the gateway releases the durable store. It is intentionally separate from Recover: a clean gateway stop proves that no worker survived, while restart recovery handles the opposite case after an unclean exit.
type ControllerState ¶
type ControllerState string
const ( ControllerAgent ControllerState = "agent" ControllerHumanPending ControllerState = "human_pending" ControllerHuman ControllerState = "human" ControllerResumePending ControllerState = "resume_pending" )
func (ControllerState) Valid ¶
func (state ControllerState) Valid() bool
type DialogObservation ¶
type DownloadArtifact ¶
type DownloadArtifact struct {
Ref string `json:"ref"`
Kind string `json:"kind"`
ContentType string `json:"content_type"`
Filename string `json:"filename"`
Size int64 `json:"size"`
SHA256 string `json:"sha256"`
ExpiresAt int64 `json:"expires_at"`
SessionID string `json:"browser_session_id"`
TabID string `json:"tab_id"`
Generation uint64 `json:"snapshot_generation"`
Truncated bool `json:"truncated"`
Deliver bool `json:"-"`
DeliveryState string `json:"-"`
MediaRef string `json:"-"`
Recovery *ScreenshotRecovery `json:"-"`
}
type DownloadDeliveryRequest ¶
type DownloadDeliveryRequest struct {
Owner Owner
RequestID, SessionID, Ref, MediaRef string
Recovery *ScreenshotRecovery
}
type DownloadRecoveryVerifier ¶
type DownloadRecoveryVerifier func(context.Context, PreparedAction) (bool, error)
DownloadRecoveryVerifier proves that the exact retained artifact for an accepted download was committed outside the browser ledger before restart.
type DownloadSink ¶
type DownloadSink func(context.Context, PreparedAction, DriverDownload) (json.RawMessage, error)
type DriverAction ¶
type DriverActionKind ¶
type DriverActionKind string
const ( DriverClick DriverActionKind = "click" DriverFill DriverActionKind = "fill" DriverSelect DriverActionKind = "select" DriverPress DriverActionKind = "press" DriverScroll DriverActionKind = "scroll" DriverDialog DriverActionKind = "dialog" DriverUpload DriverActionKind = "upload" DriverDownloadAction DriverActionKind = "download" )
type DriverDownload ¶
type DriverElement ¶
type DriverObservation ¶
type DriverObservation struct {
URL string
Origin string
Title string
Snapshot string
Elements []DriverElement
PendingDialog *DialogObservation
Truncated bool
}
type DriverReadiness ¶
type DriverReadiness struct {
Status string `json:"status"`
Driver string `json:"driver"`
Browser string `json:"browser"`
Proxy string `json:"proxy"`
Compatibility string `json:"compatibility"`
Code string `json:"code,omitempty"`
Action string `json:"action,omitempty"`
}
DriverReadiness is a bounded, path-free snapshot supplied by a worker factory. Reading it must not start a driver, probe a browser, or mutate the factory's last-observed compatibility state.
type DriverScreenshot ¶
type FileStore ¶
type FileStore struct {
// contains filtered or unexported fields
}
FileStore is the gateway's bounded durable browser state boundary. One gateway process owns the document at a time; every mutation is an atomic owner-only replacement.
func (*FileStore) CreateInvocation ¶
func (store *FileStore) CreateInvocation(_ context.Context, invocation Invocation) error
func (*FileStore) CreatePreparation ¶
func (store *FileStore) CreatePreparation( _ context.Context, prepared PreparedAction, invocation Invocation, ) error
func (*FileStore) CreateSession ¶
func (*FileStore) GetInvocation ¶
func (*FileStore) GetPreparedAction ¶
func (*FileStore) GetSession ¶
func (*FileStore) ListInvocations ¶
func (*FileStore) ListSessions ¶
func (*FileStore) PruneInvocations ¶
func (*FileStore) PrunePreparedActions ¶
func (*FileStore) UpdateInvocation ¶
type HumanControllerWorker ¶
type Invocation ¶
type Invocation struct {
ID string `json:"id"`
PreparedActionID string `json:"prepared_action_id,omitempty"`
SessionID string `json:"session_id"`
Owner Owner `json:"owner"`
ActionHash string `json:"action_hash"`
Effect Effect `json:"effect"`
State InvocationState `json:"state"`
Revision uint64 `json:"revision"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
ExpiresAt int64 `json:"expires_at"`
AcceptedAt int64 `json:"accepted_at,omitempty"`
CompletedAt int64 `json:"completed_at,omitempty"`
TerminalResult json.RawMessage `json:"terminal_result,omitempty"`
SafeFailure string `json:"safe_failure,omitempty"`
Download *DownloadArtifact `json:"-"`
}
func (Invocation) Validate ¶
func (invocation Invocation) Validate() error
type InvocationExecutor ¶
type InvocationExecutor func(context.Context) (json.RawMessage, error)
InvocationExecutor crosses the driver acceptance boundary exactly once. It must stop driver work and return when its context is done; a caller must not add retries below this callback.
type InvocationState ¶
type InvocationState string
const ( InvocationPrepared InvocationState = "prepared" InvocationAccepted InvocationState = "accepted" InvocationSucceeded InvocationState = "succeeded" InvocationFailed InvocationState = "failed" InvocationUnknown InvocationState = "unknown" InvocationCanceled InvocationState = "canceled" )
func (InvocationState) Terminal ¶
func (state InvocationState) Terminal() bool
func (InvocationState) Valid ¶
func (state InvocationState) Valid() bool
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
func (*MemoryStore) CreateInvocation ¶
func (store *MemoryStore) CreateInvocation(_ context.Context, invocation Invocation) error
func (*MemoryStore) CreatePreparation ¶
func (store *MemoryStore) CreatePreparation( _ context.Context, prepared PreparedAction, invocation Invocation, ) error
func (*MemoryStore) CreateSession ¶
func (store *MemoryStore) CreateSession(_ context.Context, session Session) error
func (*MemoryStore) GetInvocation ¶
func (store *MemoryStore) GetInvocation(_ context.Context, id string) (Invocation, error)
func (*MemoryStore) GetPreparedAction ¶
func (store *MemoryStore) GetPreparedAction(_ context.Context, id string) (PreparedAction, error)
func (*MemoryStore) GetSession ¶
func (*MemoryStore) ListInvocations ¶
func (store *MemoryStore) ListInvocations(_ context.Context, sessionID string) ([]Invocation, error)
func (*MemoryStore) ListSessions ¶
func (store *MemoryStore) ListSessions(_ context.Context) ([]Session, error)
func (*MemoryStore) PruneInvocations ¶
func (store *MemoryStore) PruneInvocations(_ context.Context, completedBefore int64) error
func (*MemoryStore) PrunePreparedActions ¶
func (store *MemoryStore) PrunePreparedActions(_ context.Context, expiredBefore int64) error
func (*MemoryStore) UpdateInvocation ¶
func (store *MemoryStore) UpdateInvocation(_ context.Context, expected uint64, next Invocation) error
func (*MemoryStore) UpdateSession ¶
type NavigationCheckedActionWorker ¶
type NavigationCheckedActionWorker interface {
NavigationIdentityWorker
}
NavigationCheckedActionWorker performs one final private navigation check immediately before issuing a fixed typed action. The check is the authority linearization point; the native input operation that follows is not atomic with it.
type NavigationIdentityWorker ¶
type NavigationIdentityWorker interface {
ActionWorker
}
NavigationIdentityWorker exposes a driver-owned, monotonic identity for the current main-frame navigation state. The identity is private runtime state: callers use it to reject document and same-document transitions that reproduce the same observable snapshot.
type Observation ¶
type Observation struct {
SessionID string `json:"browser_session_id"`
TabID string `json:"tab_id"`
SnapshotID string `json:"snapshot_id"`
SnapshotGeneration uint64 `json:"snapshot_generation"`
URL string `json:"url"`
Origin string `json:"origin"`
Title string `json:"title,omitempty"`
Snapshot string `json:"snapshot"`
PendingDialog *DialogObservation `json:"pending_dialog,omitempty"`
Truncated bool `json:"truncated"`
}
type OpenRequest ¶
type Owner ¶
type PassiveReadiness ¶
type PassiveReadiness struct {
Status string `json:"status"`
Broker string `json:"broker"`
Worker string `json:"worker"`
Driver string `json:"driver"`
Browser string `json:"browser"`
Proxy string `json:"proxy"`
Compatibility string `json:"compatibility"`
Profile ProfileAvailability `json:"profile"`
Code string `json:"code,omitempty"`
Action string `json:"action,omitempty"`
Passive bool `json:"passive"`
}
PassiveReadiness combines the factory snapshot with the broker's durable profile lease projection. It contains enums and operator guidance only.
type PlaywrightManagedHostConfig ¶
type PlaywrightManagedHostConfig struct {
Target string
Profile string
ProfileConfig config.BrowserProfileConfig
ServerConfig config.MCPServerConfig
}
PlaywrightManagedHostConfig binds the existing private Playwright adapter to an execution host. It is intentionally driver-facing rather than model-facing: callers must derive every field from trusted local policy.
type PlaywrightWorkerFactory ¶
type PlaywrightWorkerFactory struct {
// contains filtered or unexported fields
}
func NewPlaywrightManagedHostFactory ¶
func NewPlaywrightManagedHostFactory( host PlaywrightManagedHostConfig, ) (*PlaywrightWorkerFactory, error)
NewPlaywrightManagedHostFactory reuses the B1 Playwright worker on another trusted host. Its driver configuration is companion-local and must never be projected into a capability catalog or model-visible result.
func NewPlaywrightWorkerFactory ¶
func NewPlaywrightWorkerFactory(rootConfig *config.Config) (*PlaywrightWorkerFactory, error)
func (*PlaywrightWorkerFactory) Open ¶
func (factory *PlaywrightWorkerFactory) Open( ctx context.Context, request WorkerOpenRequest, ) (WorkerOpenResult, error)
func (*PlaywrightWorkerFactory) PassiveReadiness ¶
func (factory *PlaywrightWorkerFactory) PassiveReadiness() DriverReadiness
PassiveReadiness reads configuration, executable availability, and the compatibility outcome cached by prior real opens. It never starts npx or a browser and never probes an active worker.
type Preparation ¶
type Preparation struct {
Action PreparedAction
Approval ApprovalBinding
RequiresApproval bool
}
type PrepareActionRequest ¶
type PreparedAction ¶
type PreparedAction struct {
ID string `json:"id"`
RequestID string `json:"request_id"`
SessionID string `json:"session_id"`
Owner Owner `json:"owner"`
Target string `json:"target"`
Profile string `json:"profile"`
ControllerGeneration uint64 `json:"controller_generation"`
TabID string `json:"tab_id"`
SnapshotID string `json:"snapshot_id"`
SnapshotGeneration uint64 `json:"snapshot_generation"`
CurrentOrigin string `json:"current_origin"`
DestinationOrigin string `json:"destination_origin,omitempty"`
Action Action `json:"action"`
InputDigest string `json:"input_digest,omitempty"`
InputBytes int `json:"input_bytes,omitempty"`
ArtifactSHA256 string `json:"artifact_sha256,omitempty"`
ArtifactBytes int64 `json:"artifact_bytes,omitempty"`
ArtifactFilename string `json:"artifact_filename,omitempty"`
ArtifactContentType string `json:"artifact_content_type,omitempty"`
ElementRole string `json:"element_role,omitempty"`
ElementName string `json:"element_name,omitempty"`
DialogType string `json:"dialog_type,omitempty"`
DialogMessage string `json:"dialog_message,omitempty"`
Effect Effect `json:"effect"`
DryRun bool `json:"dry_run"`
PolicyRevision string `json:"policy_revision"`
CatalogRevision string `json:"catalog_revision"`
ActionHash string `json:"action_hash"`
CreatedAt int64 `json:"created_at"`
ExpiresAt int64 `json:"expires_at"`
}
PreparedAction is the immutable durable authority that approval binds. It deliberately omits the driver-local element target; that target remains in the live worker slot and is usable only while the bound snapshot is fresh.
func (PreparedAction) Validate ¶
func (prepared PreparedAction) Validate(maxTextBytes int) error
type PreparedActionWorker ¶
type PreparedActionWorker interface {
ActionWorker
SupportsPreparedAction(ActionKind) bool
ExecutePrepared(context.Context, WorkerPreparedAction) error
}
PreparedActionWorker receives the gateway-owned durable authority for one accepted action and must revalidate live driver state before dispatch. Remote workers use it to bind a typed node invocation; local driver workers continue to implement ActionWorker only.
type ProfileAvailability ¶
type ScreenshotArtifact ¶
type ScreenshotArtifact struct {
Ref string `json:"ref"`
Kind string `json:"kind"`
ContentType string `json:"content_type"`
Filename string `json:"filename"`
Size int64 `json:"size"`
SHA256 string `json:"sha256"`
ExpiresAt int64 `json:"expires_at"`
SessionID string `json:"browser_session_id"`
TabID string `json:"tab_id"`
SnapshotID string `json:"snapshot_id"`
SnapshotGeneration uint64 `json:"snapshot_generation"`
Truncated bool `json:"truncated"`
DeliveryState string `json:"-"`
MediaRef string `json:"-"`
Recovery *ScreenshotRecovery `json:"-"`
}
type ScreenshotCapture ¶
type ScreenshotRecovery ¶
type ScreenshotRequest ¶
type ScreenshotWorker ¶
type ScreenshotWorker interface {
ActionWorker
CaptureScreenshot(context.Context, int) (DriverScreenshot, error)
}
type Session ¶
type Session struct {
ID string `json:"id"`
Owner Owner `json:"owner"`
Target string `json:"target"`
Profile string `json:"profile"`
State SessionState `json:"state"`
DryRun bool `json:"dry_run"`
PolicyRevision string `json:"policy_revision"`
ControllerGeneration uint64 `json:"controller_generation"`
Controller ControllerState `json:"controller"`
ControllerExpiresAt int64 `json:"controller_expires_at,omitempty"`
TabID string `json:"tab_id"`
SnapshotID string `json:"snapshot_id,omitempty"`
SnapshotGeneration uint64 `json:"snapshot_generation"`
SnapshotOrigin string `json:"snapshot_origin,omitempty"`
Revision uint64 `json:"revision"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
LastActivityAt int64 `json:"last_activity_at"`
ExpiresAt int64 `json:"expires_at"`
SafeFailure string `json:"safe_failure,omitempty"`
}
func (Session) EffectiveController ¶
func (session Session) EffectiveController() ControllerState
type SessionState ¶
type SessionState string
const ( SessionOpening SessionState = "opening" SessionReady SessionState = "ready" SessionClosing SessionState = "closing" SessionClosed SessionState = "closed" SessionExpired SessionState = "expired" SessionLost SessionState = "lost" )
func (SessionState) Terminal ¶
func (state SessionState) Terminal() bool
func (SessionState) Valid ¶
func (state SessionState) Valid() bool
type Store ¶
type Store interface {
CreateSession(context.Context, Session) error
GetSession(context.Context, string) (Session, error)
ListSessions(context.Context) ([]Session, error)
UpdateSession(context.Context, uint64, Session) error
CreatePreparation(context.Context, PreparedAction, Invocation) error
GetPreparedAction(context.Context, string) (PreparedAction, error)
CreateInvocation(context.Context, Invocation) error
GetInvocation(context.Context, string) (Invocation, error)
ListInvocations(context.Context, string) ([]Invocation, error)
UpdateInvocation(context.Context, uint64, Invocation) error
PruneInvocations(context.Context, int64) error
PrunePreparedActions(context.Context, int64) error
}
Store is the broker's durable compare-and-swap boundary. The memory implementation supports foundation tests; a file-backed store lands with lifecycle and restart recovery.
type TargetDiagnostics ¶
type TargetDiagnostics struct {
Actions []ActionKind
Profiles map[string]DriverReadiness
}
TargetDiagnostics is one immutable worker-factory capability snapshot for a target and its configured profiles.
type TransferWorker ¶
type TransferWorker interface {
ActionWorker
Upload(context.Context, DriverAction) error
Download(context.Context, DriverAction, int64) (DriverDownload, error)
}
type UploadBinding ¶
type WorkerFactory ¶
type WorkerFactory interface {
Open(context.Context, WorkerOpenRequest) (WorkerOpenResult, error)
}
type WorkerOpenRequest ¶
type WorkerOpenResult ¶
type WorkerOpenResult struct {
Owner Worker
}
WorkerOpenResult transfers exactly one lifecycle owner to the broker. Owner is admitted as a worker only when Open succeeds; after a failed startup it is retained solely so cleanup can be retried.
type WorkerPreparedAction ¶
type WorkerPreparedAction struct {
InvocationID string
Prepared PreparedAction
DriverAction DriverAction
}
type WorkerStatus ¶
type WorkerStatus string
const ( WorkerReady WorkerStatus = "ready" WorkerLost WorkerStatus = "lost" )