agent

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 34 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package agent provides a typed, policy-gated session layer above RobotGo's low-level compatibility API. It deliberately contains no protocol adapter.

Index

Constants

View Source
const (
	// VisualAnalysisBackend identifies RobotGo's deterministic in-memory
	// visual component detector for target-evidence policy allowlists.
	VisualAnalysisBackend = "robotgo-visual"
	// VisualAnalysisModel identifies the fixed visual proposal algorithm.
	VisualAnalysisModel = "contrast-components-v1"
	// OCRAnalysisBackend identifies RobotGo's optional in-memory Tesseract
	// backend for target-evidence policy allowlists.
	OCRAnalysisBackend = "tesseract-memory"
	// OCRAnalysisModel identifies the fixed OCR word-box result contract.
	OCRAnalysisModel = "tesseract-word-boxes-v1"
)
View Source
const (
	// SemanticRecorderSchemaVersion identifies the explicit bounded recorder request.
	SemanticRecorderSchemaVersion = "1"
	// RecordedFlowSchemaVersion identifies the privacy-reduced semantic event contract.
	RecordedFlowSchemaVersion = "1"
	// GeneratedFlowSchemaVersion identifies generated Go and MCP artifact metadata.
	GeneratedFlowSchemaVersion = "1"
	// MCPFlowFixtureSchemaVersion identifies the non-executing MCP request-template contract.
	MCPFlowFixtureSchemaVersion = "1"
)
View Source
const (
	UIStateEnabled   UIState = "enabled"
	UIStateDisabled  UIState = "disabled"
	UIStateChecked   UIState = "checked"
	UIStateSelected  UIState = "selected"
	UIStateExpanded  UIState = "expanded"
	UIStateCollapsed UIState = "collapsed"
	UIStateReadOnly  UIState = "read-only"
	UIStateRequired  UIState = "required"
	UIStateInvalid   UIState = "invalid"

	UIActionPress     UIAction = "press"
	UIActionFocus     UIAction = "focus"
	UIActionSetValue  UIAction = "set-value"
	UIActionToggle    UIAction = "toggle"
	UIActionExpand    UIAction = "expand"
	UIActionCollapse  UIAction = "collapse"
	UIActionIncrement UIAction = "increment"
	UIActionDecrement UIAction = "decrement"
)
View Source
const (
	// TargetSpecSchemaVersion identifies the deterministic semantic plus
	// reviewed analysis-evidence locator contract. Semantic-only v1 inputs
	// remain accepted with unchanged behavior.
	TargetSpecSchemaVersion       = "2"
	TargetSpecLegacySchemaVersion = "1"
	// TargetResolutionSchemaVersion identifies the privacy-reduced resolver
	// result contract.
	TargetResolutionSchemaVersion = "2"
)
View Source
const (
	// RobotGoTraceSchemaVersion identifies the bounded verified-transaction
	// timeline contract.
	RobotGoTraceSchemaVersion = "1"
	// TraceRequestSchemaVersion identifies an explicit per-transaction capture
	// request. A request never grants an action or changes its execution.
	TraceRequestSchemaVersion = "1"
)
View Source
const (
	ViewSchemaVersion = "1"
	ViewMIMEType      = "image/png"
)
View Source
const ActionProofSchemaVersion = "2"

ActionProofSchemaVersion identifies the privacy-reduced semantic-action proof contract. Proofs deliberately contain no request or desktop payload.

View Source
const AnalysisSchemaVersion = "2"

AnalysisSchemaVersion identifies the OCR and visual-proposal result contract.

View Source
const AuditSchemaVersion = "6"

AuditSchemaVersion identifies the payload-free audit event contract.

View Source
const CapabilityLeaseSchemaVersion = "1"

CapabilityLeaseSchemaVersion identifies the opaque single-use authority contract.

View Source
const CatalogSchemaVersion = "16"

CatalogSchemaVersion identifies the operation catalog JSON contract.

View Source
const (
	// ConditionSchemaVersion identifies the serialized visual-condition contract.
	ConditionSchemaVersion = "1"
)
View Source
const (
	// ObservationSchemaVersion identifies the serialized observation contract.
	ObservationSchemaVersion = "1"
)
View Source
const (
	// TargetEvidenceClauseSchemaVersion identifies one reviewed analysis-item
	// reference used by TargetSpec v2.
	TargetEvidenceClauseSchemaVersion = "1"
)
View Source
const (
	// TargetPatchProposalSchemaVersion identifies the non-executable review contract.
	TargetPatchProposalSchemaVersion = "1"
)
View Source
const (
	UISchemaVersion = "1"
)
View Source
const (
	// VerifiedFlowPlanSchemaVersion identifies the advisory verified-flow
	// capability-planning contract. Plans never grant execution authority.
	VerifiedFlowPlanSchemaVersion = "1"
)

Variables

View Source
var (
	ErrSessionBusy           = errors.New("another agent session is already active")
	ErrSessionClosed         = errors.New("agent session is closed")
	ErrPolicyDenied          = errors.New("agent policy denied the action")
	ErrStaleTarget           = errors.New("agent observation target is stale")
	ErrVerification          = errors.New("agent action verification failed")
	ErrAuditDelivery         = errors.New("agent audit delivery failed")
	ErrConditionNotMet       = errors.New("agent visual condition was not met")
	ErrInputCleanup          = errors.New("agent input cleanup failed")
	ErrTargetNotFound        = errors.New("agent target was not found")
	ErrAmbiguousTarget       = errors.New("agent target is ambiguous")
	ErrIncompleteObservation = errors.New("agent observation is incomplete")
	ErrLeaseRequired         = errors.New("agent capability lease is required")
	ErrLeaseInvalid          = errors.New("agent capability lease is invalid")
	ErrLeaseExpired          = errors.New("agent capability lease is expired")
	ErrLeaseConsumed         = errors.New("agent capability lease is consumed")
	ErrLeaseMismatch         = errors.New("agent capability lease binding does not match")
	ErrTraceExport           = errors.New("agent transaction trace export failed")
	ErrRecorderActive        = errors.New("agent semantic recorder is already active")
	ErrRecorderStopped       = errors.New("agent semantic recorder is stopped")
	ErrRecorderExpired       = errors.New("agent semantic recorder expired")
)
View Source
var (

	// ErrObservationClosed reports access to a zeroed observation buffer.
	ErrObservationClosed = errors.New("agent observation is closed")
)

Functions

func CapabilityLeaseActionValueDigest

func CapabilityLeaseActionValueDigest(value string) string

CapabilityLeaseActionValueDigest returns the lowercase SHA-256 binding used for a set-value lease. The raw value remains caller-owned.

func ValidatePolicy

func ValidatePolicy(policy Policy) error

ValidatePolicy verifies every immutable session-policy bound without acquiring the process-exclusive session owner or touching a desktop backend. Callers that must complete an explicit local consent step before NewSession can use it to fail closed before presenting that prompt.

Types

type ActionAuthorizationProof

type ActionAuthorizationProof struct {
	PolicyAllowed        bool `json:"policy_allowed"`
	ConfirmationRequired bool `json:"confirmation_required"`
	Confirmed            bool `json:"confirmed"`
}

ActionAuthorizationProof reports the fixed policy and confirmation decision without copying any policy target or request payload.

type ActionCleanupProof

type ActionCleanupProof struct {
	TransientResourcesReleased bool `json:"transient_resources_released"`
}

ActionCleanupProof attests only that RobotGo retained no operation-owned transient handles, references, or clearable buffers after the call. It does not claim release of the still-live source observation or caller-owned data.

type ActionError

type ActionError struct {
	Code      ErrorCode `json:"code"`
	Operation Operation `json:"operation,omitempty"`
	Message   string    `json:"message"`
	// contains filtered or unexported fields
}

ActionError is safe to serialize: Message never contains action payloads.

func (*ActionError) Error

func (e *ActionError) Error() string

func (*ActionError) Unwrap

func (e *ActionError) Unwrap() error

type ActionExecutionProof

type ActionExecutionProof struct {
	Backend  string                `json:"backend,omitempty"`
	Action   UIAction              `json:"action,omitempty"`
	Status   ActionExecutionStatus `json:"status"`
	Fallback bool                  `json:"fallback"`
}

ActionExecutionProof contains only fixed action/backend metadata.

type ActionExecutionStatus

type ActionExecutionStatus string

ActionExecutionStatus distinguishes a skipped idempotent retry from the one permitted native dispatch.

const (
	ActionExecutionNotDispatched           ActionExecutionStatus = "not-dispatched"
	ActionExecutionSkippedAlreadySatisfied ActionExecutionStatus = "skipped-already-satisfied"
	ActionExecutionDispatched              ActionExecutionStatus = "dispatched"
)

type ActionProof

type ActionProof struct {
	SchemaVersion string                    `json:"schema_version"`
	TransactionID string                    `json:"transaction_id"`
	Status        ActionProofStatus         `json:"status"`
	Resolution    *ActionResolutionProof    `json:"resolution,omitempty"`
	Authorization *ActionAuthorizationProof `json:"authorization,omitempty"`
	Lease         *CapabilityLeaseProof     `json:"lease,omitempty"`
	Execution     ActionExecutionProof      `json:"execution"`
	Verification  *ActionVerificationProof  `json:"verification,omitempty"`
	Cleanup       ActionCleanupProof        `json:"cleanup"`
	ErrorCode     ErrorCode                 `json:"error_code,omitempty"`
}

ActionProof is the versioned, privacy-reduced proof returned by semantic element actions. Nested stages may be absent when processing stopped before that stage could truthfully be evaluated.

type ActionProofStatus

type ActionProofStatus string

ActionProofStatus summarizes the semantic transaction without hiding a post-dispatch execution or cleanup failure behind later matching evidence.

const (
	ActionProofRejectedBeforeDispatch  ActionProofStatus = "rejected-before-dispatch"
	ActionProofFailedBeforeDispatch    ActionProofStatus = "failed-before-dispatch"
	ActionProofVerified                ActionProofStatus = "verified"
	ActionProofUnverifiedAfterDispatch ActionProofStatus = "unverified-after-dispatch"
	ActionProofCleanupPending          ActionProofStatus = "cleanup-pending"
)

type ActionRequest

type ActionRequest struct {
	Operation    Operation                `json:"operation"`
	Confirmed    bool                     `json:"confirmed,omitempty"`
	Move         *MoveAction              `json:"move,omitempty"`
	Click        *ClickAction             `json:"click,omitempty"`
	Scroll       *ScrollAction            `json:"scroll,omitempty"`
	Drag         *DragAction              `json:"drag,omitempty"`
	TypeText     *TypeTextAction          `json:"type_text,omitempty"`
	KeyChord     *KeyChordAction          `json:"key_chord,omitempty"`
	Activate     *ActivateWindowAction    `json:"activate,omitempty"`
	Precondition *ObservationPrecondition `json:"precondition,omitempty"`
	Verification *VerificationRequest     `json:"verification,omitempty"`
}

ActionRequest is a strict JSON-serializable action union. Exactly one action payload must be present and must match Operation.

type ActionResolutionProof

type ActionResolutionProof struct {
	Strategy       ActionResolutionStrategy `json:"strategy"`
	CandidateCount uint32                   `json:"candidate_count"`
	Exact          bool                     `json:"exact"`
	Healing        bool                     `json:"healing"`
}

ActionResolutionProof reports only structural resolution evidence.

type ActionResolutionStrategy

type ActionResolutionStrategy string

ActionResolutionStrategy is the bounded target-resolution vocabulary used by Action Proof v2. It distinguishes exact retained selection from an adaptive selection privately bound into a capability lease.

const (
	ActionResolutionRetainedReference ActionResolutionStrategy = "retained-reference"
	ActionResolutionAdaptiveLease     ActionResolutionStrategy = "adaptive-capability-lease"
)

type ActionResult

type ActionResult struct {
	ActionID                  string              `json:"action_id"`
	Operation                 Operation           `json:"operation"`
	Status                    ActionStatus        `json:"status"`
	Backend                   string              `json:"backend,omitempty"`
	DurationMillis            int64               `json:"duration_ms"`
	Error                     *ActionError        `json:"error,omitempty"`
	PreconditionObservationID string              `json:"precondition_observation_id,omitempty"`
	PostObservationID         string              `json:"post_observation_id,omitempty"`
	Verification              *VerificationResult `json:"verification,omitempty"`
	Proof                     *ActionProof        `json:"proof,omitempty"`
	Trace                     *RobotGoTrace       `json:"trace,omitempty"`
}

ActionResult reports one planned or attempted action without retaining its input payload. Trace is present only for an explicit policy-approved Trace request on a semantic action.

type ActionStatus

type ActionStatus string

ActionStatus identifies the outcome of an action request.

const (
	ActionPlanned    ActionStatus = "planned"
	ActionSucceeded  ActionStatus = "succeeded"
	ActionFailed     ActionStatus = "failed"
	ActionUnverified ActionStatus = "unverified"
)

type ActionVerificationProof

type ActionVerificationProof struct {
	ConditionKind         UIElementConditionKind   `json:"condition_kind,omitempty"`
	Status                ActionVerificationStatus `json:"status"`
	PrecheckAttempts      uint32                   `json:"precheck_attempts"`
	FinalGateChecked      bool                     `json:"final_gate_checked"`
	PostconditionAttempts uint32                   `json:"postcondition_attempts"`
	AlreadySatisfied      bool                     `json:"already_satisfied"`
}

ActionVerificationProof keeps precheck, final-gate, and post-dispatch reads separate so its counts correspond exactly to quota-bearing backend probes.

type ActionVerificationStatus

type ActionVerificationStatus string

ActionVerificationStatus is the bounded semantic postcondition outcome. NotMatched requires at least one completed probe that returned false; Failed may carry zero attempts when a requested probe could not start.

const (
	ActionVerificationNotRequested ActionVerificationStatus = "not-requested"
	ActionVerificationMatched      ActionVerificationStatus = "matched"
	ActionVerificationNotMatched   ActionVerificationStatus = "not-matched"
	ActionVerificationFailed       ActionVerificationStatus = "failed"
)

type ActivateWindowAction

type ActivateWindowAction struct {
	Target int              `json:"target"`
	Kind   WindowTargetKind `json:"kind"`
}

ActivateWindowAction activates one immutable policy-approved process or native handle. The session revalidates its expected title immediately before dispatch so a stale or reused identity cannot silently target another window.

type AnalysisMetadata

type AnalysisMetadata struct {
	SchemaVersion  string        `json:"schema_version"`
	ObservationID  string        `json:"observation_id"`
	Region         CaptureRegion `json:"region"`
	Backend        string        `json:"backend"`
	Model          string        `json:"model"`
	DurationMillis int64         `json:"duration_ms"`
	Truncated      bool          `json:"truncated,omitempty"`
	Sanitized      bool          `json:"sanitized,omitempty"`
	Untrusted      bool          `json:"untrusted"`
	EvidenceID     string        `json:"evidence_id,omitempty"`
}

type AuditEvent

type AuditEvent struct {
	SchemaVersion             string                   `json:"schema_version"`
	Sequence                  uint64                   `json:"sequence"`
	Kind                      AuditKind                `json:"kind"`
	Timestamp                 time.Time                `json:"timestamp"`
	Operation                 Operation                `json:"operation,omitempty"`
	ActionID                  string                   `json:"action_id,omitempty"`
	ObservationID             string                   `json:"observation_id,omitempty"`
	PreconditionObservationID string                   `json:"precondition_observation_id,omitempty"`
	PostObservationID         string                   `json:"post_observation_id,omitempty"`
	ActionStatus              ActionStatus             `json:"action_status,omitempty"`
	VerificationStatus        VerificationStatus       `json:"verification_status,omitempty"`
	VerificationAttempts      uint32                   `json:"verification_attempts,omitempty"`
	ConditionID               string                   `json:"condition_id,omitempty"`
	ConditionStatus           ConditionStatus          `json:"condition_status,omitempty"`
	ConditionAttempts         uint32                   `json:"condition_attempts,omitempty"`
	ActionProofStatus         ActionProofStatus        `json:"action_proof_status,omitempty"`
	ActionExecutionStatus     ActionExecutionStatus    `json:"action_execution_status,omitempty"`
	UIConditionKind           UIElementConditionKind   `json:"ui_condition_kind,omitempty"`
	UIConditionPhase          UIConditionPhase         `json:"ui_condition_phase,omitempty"`
	UIPrecheckAttempts        uint32                   `json:"ui_precheck_attempts,omitempty"`
	UIFinalGateChecked        bool                     `json:"ui_final_gate_checked,omitempty"`
	UIPostconditionAttempts   uint32                   `json:"ui_postcondition_attempts,omitempty"`
	TargetResolutionStrategy  TargetResolutionStrategy `json:"target_resolution_strategy,omitempty"`
	TargetResolutionMode      TargetResolutionMode     `json:"target_resolution_mode,omitempty"`
	TargetAdaptiveScore       uint32                   `json:"target_adaptive_score,omitempty"`
	TargetAdaptiveThreshold   uint32                   `json:"target_adaptive_threshold,omitempty"`
	CapabilityLeaseIssued     bool                     `json:"capability_lease_issued,omitempty"`
	CapabilityLeasePresented  bool                     `json:"capability_lease_presented,omitempty"`
	CapabilityLeaseStatus     CapabilityLeaseStatus    `json:"capability_lease_status,omitempty"`
	TargetMatchedBy           []TargetEvidence         `json:"target_matched_by,omitempty"`
	TargetChanged             []TargetEvidence         `json:"target_changed,omitempty"`
	TargetCandidateCount      uint32                   `json:"target_candidate_count,omitempty"`
	TargetRejectedCount       uint32                   `json:"target_rejected_count,omitempty"`
	TargetAmbiguous           bool                     `json:"target_ambiguous,omitempty"`
	TargetEvidenceSources     []TargetEvidenceSource   `json:"target_evidence_sources,omitempty"`
	TargetEvidenceAgeMillis   int64                    `json:"target_evidence_age_ms,omitempty"`
	ErrorCode                 ErrorCode                `json:"error_code,omitempty"`
}

AuditEvent deliberately contains no request payload, coordinates, text, pixels, capture digest, backend error detail, or restore token.

type AuditKind

type AuditKind string

AuditKind identifies a sanitized session lifecycle event.

const (
	AuditObservationStarted   AuditKind = "observation.started"
	AuditObservationFinished  AuditKind = "observation.finished"
	AuditActionStarted        AuditKind = "action.started"
	AuditActionFinished       AuditKind = "action.finished"
	AuditVerificationFinished AuditKind = "verification.finished"
	AuditConditionStarted     AuditKind = "condition.started"
	AuditConditionFinished    AuditKind = "condition.finished"
	AuditResolutionStarted    AuditKind = "resolution.started"
	AuditResolutionFinished   AuditKind = "resolution.finished"
)

type AuditSink

type AuditSink interface {
	Record(ctx context.Context, event AuditEvent) error
}

AuditSink receives synchronous, payload-free events. Implementations should honor ctx and return promptly; an intent-event error prevents desktop I/O. A completion-event error is returned alongside the completed result so a caller never needs to guess whether a desktop mutation occurred. A sink must not call back into the Session that invoked it.

type CancellationSupport

type CancellationSupport string

CancellationSupport describes where cancellation is enforceable.

const (
	CancellationPreflightOnly CancellationSupport = "preflight-only"
	CancellationCooperative   CancellationSupport = "cooperative"
)

type CapabilityLease

type CapabilityLease struct {
	SchemaVersion string               `json:"schema_version"`
	ID            string               `json:"id"`
	Mode          TargetResolutionMode `json:"mode"`
	Action        UIAction             `json:"action"`
	Postcondition *UIElementCondition  `json:"postcondition,omitempty"`
	ExpiresAt     time.Time            `json:"expires_at"`
}

CapabilityLease is an opaque, single-session, single-use bearer authority. It contains no desktop identity, native reference, policy, or action value.

type CapabilityLeaseProof

type CapabilityLeaseProof struct {
	Required  bool                  `json:"required"`
	Presented bool                  `json:"presented"`
	Status    CapabilityLeaseStatus `json:"status"`
}

CapabilityLeaseProof reports only the lifecycle decision for a single-use lease. The opaque lease token and its binding digests are never serialized.

type CapabilityLeaseRequest

type CapabilityLeaseRequest struct {
	SchemaVersion     string              `json:"schema_version"`
	Action            UIAction            `json:"action"`
	Postcondition     *UIElementCondition `json:"postcondition,omitempty"`
	ActionValueSHA256 string              `json:"action_value_sha256,omitempty"`
	DurationMillis    int                 `json:"duration_ms"`
}

CapabilityLeaseRequest defines the exact future mutation authorized by a successful resolution. ActionValueSHA256 binds set-value without retaining or returning the value itself.

type CapabilityLeaseStatus

type CapabilityLeaseStatus string

CapabilityLeaseStatus is the payload-free lifecycle vocabulary exposed in Action Proof and audit evidence.

const (
	CapabilityLeaseNotRequired CapabilityLeaseStatus = "not-required"
	CapabilityLeaseAbsent      CapabilityLeaseStatus = "absent"
	CapabilityLeaseIssued      CapabilityLeaseStatus = "issued"
	CapabilityLeaseReserved    CapabilityLeaseStatus = "reserved"
	CapabilityLeaseConsumed    CapabilityLeaseStatus = "consumed"
	CapabilityLeaseInvalidated CapabilityLeaseStatus = "invalidated"
	CapabilityLeaseExpired     CapabilityLeaseStatus = "expired"
)

type CaptureMetadata

type CaptureMetadata struct {
	Region CaptureRegion `json:"region"`
	SHA256 string        `json:"sha256"`
	Width  int           `json:"width"`
	Height int           `json:"height"`
}

CaptureMetadata contains bounded, serializable capture lineage. Pixels are owned privately by Observation and never form part of this value.

type CaptureRegion

type CaptureRegion struct {
	X         int `json:"x"`
	Y         int `json:"y"`
	Width     int `json:"width"`
	Height    int `json:"height"`
	DisplayID int `json:"display_id"`
}

CaptureRegion identifies one global logical rectangle on an explicit display. Width and Height are positive and bounded by session policy.

type ClickAction

type ClickAction struct {
	Button MouseButton `json:"button"`
	Double bool        `json:"double,omitempty"`
}

ClickAction clicks one validated pointer button.

type ColorCondition

type ColorCondition struct {
	Red       uint8   `json:"red"`
	Green     uint8   `json:"green"`
	Blue      uint8   `json:"blue"`
	Tolerance float64 `json:"tolerance"`
}

ColorCondition describes one RGB target. Tolerance is a normalized Euclidean RGB distance in the inclusive range 0 through 1. Alpha is ignored.

type ConditionStatus

type ConditionStatus string

ConditionStatus identifies whether a visual condition matched.

const (
	ConditionMatched    ConditionStatus = "matched"
	ConditionNotMatched ConditionStatus = "not-matched"
)

type Config

type Config struct {
	Policy    Policy    `json:"policy"`
	AuditSink AuditSink `json:"-"`
	TraceSink TraceSink `json:"-"`
}

Config defines immutable session policy.

type DiagnosticFeature

type DiagnosticFeature struct {
	Name        string `json:"name"`
	Available   bool   `json:"available"`
	Fallback    bool   `json:"fallback"`
	Backend     string `json:"backend,omitempty"`
	Reason      string `json:"reason,omitempty"`
	Remediation string `json:"remediation,omitempty"`
}

DiagnosticFeature is a stable, sanitized feature snapshot.

type DragAction

type DragAction struct {
	StartX         int         `json:"start_x"`
	StartY         int         `json:"start_y"`
	EndX           int         `json:"end_x"`
	EndY           int         `json:"end_y"`
	DisplayID      int         `json:"display_id"`
	Button         MouseButton `json:"button"`
	DurationMillis int         `json:"duration_ms"`
}

DragAction moves from Start to End while holding one pointer button. Both coordinates are global and must remain on the same explicitly selected display.

type ElementActionRequest

type ElementActionRequest struct {
	ObservationID     string               `json:"observation_id,omitempty"`
	ElementID         string               `json:"element_id,omitempty"`
	CapabilityLeaseID string               `json:"capability_lease_id,omitempty"`
	Action            UIAction             `json:"action"`
	Expected          UIElementExpectation `json:"expected,omitempty"`
	Postcondition     *UIElementCondition  `json:"postcondition,omitempty"`
	Value             string               `json:"value,omitempty"`
	Confirmed         bool                 `json:"confirmed,omitempty"`
	Trace             *TraceRequest        `json:"trace,omitempty"`
	Hint              *RecorderActionHint  `json:"recorder_hint,omitempty"`
}

ElementActionRequest performs at most one native semantic action. Value is accepted only for set-value and is never retained in results, traces, or audit data. Trace requests add evidence only and grant no action authority.

type ErrorCode

type ErrorCode string

ErrorCode is a stable machine-readable action failure category.

const (
	ErrorInvalidInput          ErrorCode = "invalid-input"
	ErrorPolicyDenied          ErrorCode = "policy-denied"
	ErrorUnsupported           ErrorCode = "unsupported"
	ErrorUnavailable           ErrorCode = "unavailable"
	ErrorPermissionDenied      ErrorCode = "permission-denied"
	ErrorSessionClosed         ErrorCode = "session-closed"
	ErrorSessionBusy           ErrorCode = "session-busy"
	ErrorCanceled              ErrorCode = "canceled"
	ErrorTimedOut              ErrorCode = "timed-out"
	ErrorBackendFailure        ErrorCode = "backend-failure"
	ErrorStaleTarget           ErrorCode = "stale-target"
	ErrorVerification          ErrorCode = "verification-failed"
	ErrorAuditDelivery         ErrorCode = "audit-delivery-failed"
	ErrorConditionNotMet       ErrorCode = "condition-not-met"
	ErrorCleanupFailed         ErrorCode = "cleanup-failed"
	ErrorTargetNotFound        ErrorCode = "target-not-found"
	ErrorAmbiguousTarget       ErrorCode = "ambiguous-target"
	ErrorIncompleteObservation ErrorCode = "incomplete-observation"
	ErrorLeaseRequired         ErrorCode = "capability-lease-required"
	ErrorLeaseInvalid          ErrorCode = "capability-lease-invalid"
	ErrorLeaseExpired          ErrorCode = "capability-lease-expired"
	ErrorLeaseConsumed         ErrorCode = "capability-lease-consumed"
	ErrorLeaseMismatch         ErrorCode = "capability-lease-mismatch"
	ErrorTraceExport           ErrorCode = "trace-export-failed"
	ErrorRecorderActive        ErrorCode = "recorder-active"
	ErrorRecorderStopped       ErrorCode = "recorder-stopped"
	ErrorRecorderExpired       ErrorCode = "recorder-expired"
)

type FindColorRequest

type FindColorRequest struct {
	ObservationID string         `json:"observation_id"`
	Condition     ColorCondition `json:"condition"`
	Confirmed     bool           `json:"confirmed,omitempty"`
}

FindColorRequest searches only a previously captured, live observation. It never causes an implicit desktop capture.

type FindColorResult

type FindColorResult struct {
	SchemaVersion string          `json:"schema_version"`
	ConditionID   string          `json:"condition_id"`
	ObservationID string          `json:"observation_id"`
	Status        ConditionStatus `json:"status"`
	Match         *VisualMatch    `json:"match,omitempty"`
}

FindColorResult contains no pixels, capture digest, or target color.

type FlowBackendRequirement

type FlowBackendRequirement struct {
	Operation Operation `json:"operation"`
	Backend   string    `json:"backend"`
	Fallback  bool      `json:"fallback"`
}

FlowBackendRequirement is one catalog-pinned backend dependency.

type FlowCleanupObligation

type FlowCleanupObligation string

FlowCleanupObligation is one resource-lifecycle duty of later execution.

const (
	FlowCleanupTransientResources FlowCleanupObligation = "release-transient-resources"
	FlowCleanupCapabilityLease    FlowCleanupObligation = "invalidate-capability-lease"
	FlowCleanupObservation        FlowCleanupObligation = "release-observation"
)

type FlowFeasibilityStatus

type FlowFeasibilityStatus string

FlowFeasibilityStatus is the closed outcome vocabulary for one planned transaction or the complete flow.

const (
	FlowFeasible              FlowFeasibilityStatus = "feasible"
	FlowConditionallyFeasible FlowFeasibilityStatus = "conditionally-feasible"
	FlowUnsupported           FlowFeasibilityStatus = "unsupported"
	FlowPolicyDenied          FlowFeasibilityStatus = "policy-denied"
	FlowAmbiguous             FlowFeasibilityStatus = "ambiguous"
	FlowStale                 FlowFeasibilityStatus = "stale"
	FlowEvidenceRequired      FlowFeasibilityStatus = "evidence-required"
)

type FlowGenerationRequest

type FlowGenerationRequest struct {
	PackageName  string `json:"package_name"`
	FunctionName string `json:"function_name"`
}

FlowGenerationRequest selects stable Go identifiers. Generation never executes a mutation and never emits policy or confirmation grants.

type FlowPlanAssumption

type FlowPlanAssumption string

FlowPlanAssumption is a fixed, privacy-safe condition that execution must revalidate because planning cannot reserve time, evidence, or runtime state.

const (
	FlowAssumptionSessionRemainsOpen     FlowPlanAssumption = "session-remains-open"
	FlowAssumptionRuntimeRevalidated     FlowPlanAssumption = "runtime-state-revalidated"
	FlowAssumptionObservationRemainsLive FlowPlanAssumption = "observation-remains-live"
	FlowAssumptionEvidenceRemainsFresh   FlowPlanAssumption = "target-evidence-remains-fresh"
	FlowAssumptionRateScheduleHonored    FlowPlanAssumption = "policy-rate-schedule-honored"
)

type FlowPlanBlocker

type FlowPlanBlocker string

FlowPlanBlocker is a fixed, privacy-safe reason why a step is not presently feasible. It never contains target text, identifiers, tokens, or raw errors.

const (
	FlowBlockerOperationUnavailable    FlowPlanBlocker = "operation-unavailable"
	FlowBlockerPermissionRequired      FlowPlanBlocker = "permission-required"
	FlowBlockerOperationDenied         FlowPlanBlocker = "operation-policy-denied"
	FlowBlockerWindowDenied            FlowPlanBlocker = "window-policy-denied"
	FlowBlockerRoleDenied              FlowPlanBlocker = "role-policy-denied"
	FlowBlockerTargetBoundsDenied      FlowPlanBlocker = "target-bounds-policy-denied"
	FlowBlockerPropertyDenied          FlowPlanBlocker = "property-policy-denied"
	FlowBlockerActionDenied            FlowPlanBlocker = "action-policy-denied"
	FlowBlockerModeDenied              FlowPlanBlocker = "mode-policy-denied"
	FlowBlockerConfirmationRequired    FlowPlanBlocker = "confirmation-required"
	FlowBlockerQuotaInsufficient       FlowPlanBlocker = "quota-insufficient"
	FlowBlockerRateWaitRequired        FlowPlanBlocker = "policy-rate-wait-required"
	FlowBlockerSessionTimeInsufficient FlowPlanBlocker = "session-lifetime-insufficient"
	FlowBlockerClockSkew               FlowPlanBlocker = "policy-clock-skew"
	FlowBlockerLeaseRequired           FlowPlanBlocker = "capability-lease-required"
	FlowBlockerLeaseDurationDenied     FlowPlanBlocker = "capability-lease-duration-denied"
	FlowBlockerObservationRequired     FlowPlanBlocker = "observation-required"
	FlowBlockerObservationStale        FlowPlanBlocker = "observation-stale"
	FlowBlockerObservationIncomplete   FlowPlanBlocker = "observation-incomplete"
	FlowBlockerTargetNotFound          FlowPlanBlocker = "target-not-found"
	FlowBlockerTargetAmbiguous         FlowPlanBlocker = "target-ambiguous"
	FlowBlockerEvidenceStale           FlowPlanBlocker = "target-evidence-stale"
	FlowBlockerEvidenceIncomplete      FlowPlanBlocker = "target-evidence-incomplete"
	FlowBlockerEvidenceDenied          FlowPlanBlocker = "target-evidence-policy-denied"
	FlowBlockerTraceDenied             FlowPlanBlocker = "trace-policy-denied"
	FlowBlockerTraceExportUnavailable  FlowPlanBlocker = "trace-export-unavailable"
	FlowBlockerVerificationRequired    FlowPlanBlocker = "verification-required"
	FlowBlockerReviewRequired          FlowPlanBlocker = "operator-review-required"
)

type FlowPlanRemediation

type FlowPlanRemediation string

FlowPlanRemediation is a fixed advisory hint. Applying one never changes the immutable session policy and must happen outside the planner.

const (
	FlowRemediationEnableBackend        FlowPlanRemediation = "enable-supported-backend"
	FlowRemediationGrantPermission      FlowPlanRemediation = "grant-permission-outside-planner"
	FlowRemediationAllowOperation       FlowPlanRemediation = "allow-operation-in-policy"
	FlowRemediationAllowWindow          FlowPlanRemediation = "allow-window-in-policy"
	FlowRemediationAllowRole            FlowPlanRemediation = "allow-role-in-policy"
	FlowRemediationReduceTargetBounds   FlowPlanRemediation = "reduce-target-to-policy-bounds"
	FlowRemediationAllowProperty        FlowPlanRemediation = "allow-property-in-policy"
	FlowRemediationAllowAction          FlowPlanRemediation = "allow-action-in-policy"
	FlowRemediationAllowMode            FlowPlanRemediation = "allow-resolution-mode-in-policy"
	FlowRemediationObtainConfirmation   FlowPlanRemediation = "obtain-operator-confirmation"
	FlowRemediationIncreaseQuota        FlowPlanRemediation = "start-session-with-sufficient-quota"
	FlowRemediationWaitForRateLimit     FlowPlanRemediation = "wait-for-policy-rate-limit"
	FlowRemediationStartLongerSession   FlowPlanRemediation = "start-session-with-sufficient-lifetime"
	FlowRemediationCorrectClock         FlowPlanRemediation = "restore-monotonic-session-clock"
	FlowRemediationRequestLease         FlowPlanRemediation = "request-fresh-capability-lease"
	FlowRemediationReduceLeaseLifetime  FlowPlanRemediation = "reduce-capability-lease-lifetime"
	FlowRemediationProvideObservation   FlowPlanRemediation = "provide-live-semantic-observation"
	FlowRemediationRefreshObservation   FlowPlanRemediation = "refresh-semantic-observation"
	FlowRemediationRefineTarget         FlowPlanRemediation = "refine-target-specification"
	FlowRemediationProvideEvidence      FlowPlanRemediation = "provide-reviewed-target-evidence"
	FlowRemediationAllowEvidence        FlowPlanRemediation = "allow-target-evidence-in-policy"
	FlowRemediationAllowTrace           FlowPlanRemediation = "allow-trace-tier-in-policy"
	FlowRemediationConfigureTraceExport FlowPlanRemediation = "configure-trace-export-sink"
	FlowRemediationAddPostcondition     FlowPlanRemediation = "add-semantic-postcondition"
	FlowRemediationReviewTarget         FlowPlanRemediation = "review-target-change-before-execution"
)

type FlowPlanRequirements

type FlowPlanRequirements struct {
	Operations                    []Operation              `json:"operations"`
	UIRoles                       []UIRole                 `json:"ui_roles"`
	UIProperties                  []UIProperty             `json:"ui_properties"`
	UIActions                     []UIAction               `json:"ui_actions"`
	TargetModes                   []TargetResolutionMode   `json:"target_modes"`
	EvidenceSources               []TargetEvidenceSource   `json:"evidence_sources,omitempty"`
	TraceTiers                    []TracePrivacyTier       `json:"trace_tiers,omitempty"`
	Confirmations                 []Operation              `json:"confirmations,omitempty"`
	Backends                      []FlowBackendRequirement `json:"backends"`
	Cleanup                       []FlowCleanupObligation  `json:"cleanup"`
	PlatformLimitations           []FlowPlatformLimitation `json:"platform_limitations,omitempty"`
	Assumptions                   []FlowPlanAssumption     `json:"assumptions"`
	Quota                         FlowQuotaRequirement     `json:"quota"`
	Timing                        FlowTimingRequirement    `json:"timing"`
	CapabilityLeaseRequired       bool                     `json:"capability_lease_required"`
	CapabilityLeaseDurationMillis int                      `json:"capability_lease_duration_ms,omitempty"`
	FreshObservationRequired      bool                     `json:"fresh_observation_required"`
	RuntimeRevalidationRequired   bool                     `json:"runtime_revalidation_required"`
}

FlowPlanRequirements is the deterministic union of authority, runtime, and cleanup prerequisites for a step or complete flow.

type FlowPlanStepReport

type FlowPlanStepReport struct {
	Sequence               uint32                `json:"sequence"`
	Status                 FlowFeasibilityStatus `json:"status"`
	CandidateCount         uint32                `json:"candidate_count"`
	RejectedCandidateCount uint32                `json:"rejected_candidate_count"`
	Requirements           FlowPlanRequirements  `json:"requirements"`
	Blockers               []FlowPlanBlocker     `json:"blockers,omitempty"`
	Remediations           []FlowPlanRemediation `json:"remediations,omitempty"`
}

FlowPlanStepReport identifies a step only by its stable one-based position. Caller-controlled target and observation identifiers are never echoed.

type FlowPlatformLimitation

type FlowPlatformLimitation string

FlowPlatformLimitation is a fixed capability limitation; catalog reason and remediation strings are deliberately never copied into planner output.

const (
	FlowPlatformSemanticInspectionUnavailable FlowPlatformLimitation = "semantic-inspection-unavailable"
	FlowPlatformSemanticActionUnavailable     FlowPlatformLimitation = "semantic-action-unavailable"
	FlowPlatformSemanticCheckUnavailable      FlowPlatformLimitation = "semantic-verification-unavailable"
	FlowPlatformTraceExportUnavailable        FlowPlatformLimitation = "trace-export-unavailable"
)

type FlowQuotaRequirement

type FlowQuotaRequirement struct {
	Actions      uint64 `json:"actions"`
	Queries      uint64 `json:"queries"`
	Observations uint64 `json:"observations"`
	Leases       uint64 `json:"leases"`
}

FlowQuotaRequirement is a conservative upper bound for one later execution. Planning never reserves or consumes any of these counters.

type FlowTimingRequirement

type FlowTimingRequirement struct {
	ActionReadyDelayMillis    int64 `json:"action_ready_delay_ms"`
	QueryReadyDelayMillis     int64 `json:"query_ready_delay_ms"`
	MinimumVerifiedFlowMillis int64 `json:"minimum_verified_flow_ms"`
	SessionRemainingMillis    int64 `json:"session_remaining_ms"`
}

FlowTimingRequirement is a lower-bound schedule derived from current rate gates and the remaining immutable session lifetime. It is advisory only.

type GeneratedFlowArtifacts

type GeneratedFlowArtifacts struct {
	SchemaVersion string `json:"schema_version"`
	GoSource      string `json:"go_source"`
	MCPFixture    string `json:"mcp_fixture"`
}

GeneratedFlowArtifacts contains deterministic formatted source and an MCP request-template fixture. Both preserve required-review markers.

type InspectUIRequest

type InspectUIRequest struct {
	Target    int              `json:"target"`
	Kind      WindowTargetKind `json:"kind"`
	Confirmed bool             `json:"confirmed,omitempty"`
}

InspectUIRequest selects exactly one immutable policy-approved window.

type KeyChordAction

type KeyChordAction struct {
	Key       string        `json:"key"`
	Modifiers []KeyModifier `json:"modifiers,omitempty"`
	TargetPID int           `json:"target_pid"`
}

KeyChordAction presses one bounded key with zero or more canonical modifiers after verifying that TargetPID is still the active, allow-listed process. It is input, not text entry.

type KeyModifier

type KeyModifier string

KeyModifier is the unambiguous, platform-neutral modifier vocabulary exposed by the agent contract. Legacy aliases such as cmd, ctrl, and right_shift are deliberately not accepted here.

const (
	KeyModifierAlt     KeyModifier = "alt"
	KeyModifierControl KeyModifier = "control"
	KeyModifierMeta    KeyModifier = "meta"
	KeyModifierShift   KeyModifier = "shift"
)

type MouseButton

type MouseButton string

MouseButton is a validated pointer button name.

const (
	MouseButtonLeft   MouseButton = "left"
	MouseButtonMiddle MouseButton = "center"
	MouseButtonRight  MouseButton = "right"
)

type MoveAction

type MoveAction struct {
	X         int `json:"x"`
	Y         int `json:"y"`
	DisplayID int `json:"display_id"`
}

MoveAction moves the pointer to global coordinates that must fall within the live bounds of the explicitly selected display.

type OCRRequest

type OCRRequest struct {
	ObservationID string        `json:"observation_id"`
	Region        CaptureRegion `json:"region"`
	Languages     []string      `json:"languages"`
	MinConfidence float64       `json:"min_confidence,omitempty"`
	Confirmed     bool          `json:"confirmed,omitempty"`
}

type OCRResult

type OCRResult struct {
	Metadata AnalysisMetadata `json:"metadata"`
	Boxes    []OCRTextBox     `json:"boxes"`
}

type OCRTextBox

type OCRTextBox struct {
	Text       string        `json:"text"`
	Bounds     CaptureRegion `json:"bounds"`
	Confidence float64       `json:"confidence"`
}

type Observation

type Observation struct {
	SchemaVersion string             `json:"schema_version"`
	ObservationID string             `json:"observation_id"`
	CreatedAt     time.Time          `json:"created_at"`
	Diagnostics   RuntimeDiagnostics `json:"diagnostics"`
	Capture       *CaptureMetadata   `json:"capture,omitempty"`
	// contains filtered or unexported fields
}

Observation owns optional sensitive pixels and sanitized diagnostics.

func (*Observation) Close

func (observation *Observation) Close() error

Close zeroes the optional capture. Sanitized metadata remains readable so audit and stale-lineage errors can still identify the closed observation.

func (*Observation) Image

func (observation *Observation) Image() (*image.RGBA, error)

Image returns a defensive copy of the optional sensitive capture.

type ObservationPrecondition

type ObservationPrecondition struct {
	ObservationID string `json:"observation_id"`
}

ObservationPrecondition requires the target capture to remain byte-identical immediately before mutation.

type ObserveRequest

type ObserveRequest struct {
	Confirmed bool           `json:"confirmed,omitempty"`
	Capture   *CaptureRegion `json:"capture,omitempty"`
}

ObserveRequest asks for sanitized diagnostics and, optionally, an in-memory capture. Capture pixels are never included in JSON.

type Operation

type Operation string

Operation identifies one strict agent operation.

const (
	OperationMove           Operation = "pointer.move"
	OperationClick          Operation = "pointer.click"
	OperationScroll         Operation = "pointer.scroll"
	OperationDrag           Operation = "pointer.drag"
	OperationTypeText       Operation = "keyboard.type-text"
	OperationKeyChord       Operation = "keyboard.chord"
	OperationActivate       Operation = "window.activate"
	OperationObserve        Operation = "desktop.observe"
	OperationView           Operation = "desktop.view"
	OperationOCR            Operation = "desktop.ocr"
	OperationDetectElements Operation = "desktop.detect-elements"
	OperationInspectUI      Operation = "desktop.inspect-ui"
	OperationResolveUI      Operation = "desktop.resolve-ui"
	OperationElementAct     Operation = "desktop.element-act"
	OperationFindColor      Operation = "desktop.find-color"
	OperationWaitColor      Operation = "desktop.wait-color"
)

type OperationCapability

type OperationCapability struct {
	Operation                    Operation                  `json:"operation"`
	Available                    bool                       `json:"available"`
	PolicyAllowed                bool                       `json:"policy_allowed"`
	Backend                      string                     `json:"backend,omitempty"`
	Fallback                     bool                       `json:"fallback"`
	Risk                         RiskClass                  `json:"risk"`
	ConfirmationRequired         bool                       `json:"confirmation_required"`
	Cancellation                 CancellationSupport        `json:"cancellation"`
	ProcessGlobalBackend         bool                       `json:"process_global_backend"`
	ExclusiveAgentSession        bool                       `json:"exclusive_agent_session"`
	Reason                       string                     `json:"reason,omitempty"`
	Remediation                  string                     `json:"remediation,omitempty"`
	UnavailableCode              ErrorCode                  `json:"unavailable_code,omitempty"`
	OptionalCapture              bool                       `json:"optional_capture,omitempty"`
	CaptureAvailable             bool                       `json:"capture_available,omitempty"`
	CapturePolicyAllowed         bool                       `json:"capture_policy_allowed,omitempty"`
	CaptureFallback              bool                       `json:"capture_fallback,omitempty"`
	CaptureBackend               string                     `json:"capture_backend,omitempty"`
	ScrollAxes                   []ScrollAxis               `json:"scroll_axes,omitempty"`
	ActionProofVersion           string                     `json:"action_proof_version,omitempty"`
	UIConditionKinds             []UIElementConditionKind   `json:"ui_condition_kinds,omitempty"`
	UIVerificationAttempts       uint32                     `json:"ui_verification_attempts,omitempty"`
	UIVerificationIntervalMillis int                        `json:"ui_verification_interval_ms,omitempty"`
	UIVerificationTimeoutMillis  int                        `json:"ui_verification_timeout_ms,omitempty"`
	TargetSpecVersion            string                     `json:"target_spec_version,omitempty"`
	TargetResolutionStrategies   []TargetResolutionStrategy `json:"target_resolution_strategies,omitempty"`
	TargetResolutionModes        []TargetResolutionMode     `json:"target_resolution_modes,omitempty"`
	CapabilityLeaseVersion       string                     `json:"capability_lease_version,omitempty"`
	CapabilityLeaseRequired      bool                       `json:"capability_lease_required,omitempty"`
	MaxCapabilityLeases          uint64                     `json:"max_capability_leases,omitempty"`
	MaxCapabilityLeaseMillis     int                        `json:"max_capability_lease_ms,omitempty"`
	AdaptiveTargetThreshold      uint32                     `json:"adaptive_target_threshold,omitempty"`
	MaxTargetAncestors           uint32                     `json:"max_target_ancestors,omitempty"`
	TargetEvidenceClauseVersion  string                     `json:"target_evidence_clause_version,omitempty"`
	TargetEvidenceSources        []TargetEvidenceSource     `json:"target_evidence_sources,omitempty"`
	TargetEvidenceProviders      []TargetEvidenceProvider   `json:"target_evidence_providers,omitempty"`
	MaxTargetEvidenceClauses     uint32                     `json:"max_target_evidence_clauses,omitempty"`
	MaxTargetEvidenceAgeMillis   int                        `json:"max_target_evidence_age_ms,omitempty"`
	MinTargetOCRConfidence       float64                    `json:"min_target_ocr_confidence,omitempty"`
	MinTargetVisualConfidence    float64                    `json:"min_target_visual_confidence,omitempty"`
	TraceSchemaVersion           string                     `json:"trace_schema_version,omitempty"`
	TracePrivacyTiers            []TracePrivacyTier         `json:"trace_privacy_tiers,omitempty"`
	MaxTraceEvents               uint32                     `json:"max_trace_events,omitempty"`
	MaxTraceBytes                uint64                     `json:"max_trace_bytes,omitempty"`
	TraceLifetimeMillis          int                        `json:"trace_lifetime_ms,omitempty"`
	TraceExportAllowed           bool                       `json:"trace_export_allowed,omitempty"`
	RecorderSchemaVersion        string                     `json:"recorder_schema_version,omitempty"`
	RecorderAllowed              bool                       `json:"recorder_allowed,omitempty"`
	MaxRecorderEvents            uint32                     `json:"max_recorder_events,omitempty"`
	MaxRecorderBytes             uint64                     `json:"max_recorder_bytes,omitempty"`
	RecorderLifetimeMillis       int                        `json:"recorder_lifetime_ms,omitempty"`
}

OperationCapability is one stable entry in an operation catalog.

type OperationCatalog

type OperationCatalog struct {
	SchemaVersion            string                `json:"schema_version"`
	FlowPlannerSchemaVersion string                `json:"flow_planner_schema_version"`
	Operations               []OperationCapability `json:"operations"`
}

OperationCatalog is an immutable snapshot of operation availability.

type Policy

type Policy struct {
	AllowedOperations              []Operation              `json:"allowed_operations"`
	ConfirmOperations              []Operation              `json:"confirm_operations,omitempty"`
	AllowedDisplayIDs              []int                    `json:"allowed_display_ids,omitempty"`
	AllowedMouseButtons            []MouseButton            `json:"allowed_mouse_buttons,omitempty"`
	AllowedKeys                    []string                 `json:"allowed_keys,omitempty"`
	AllowedModifiers               []KeyModifier            `json:"allowed_modifiers,omitempty"`
	AllowedWindows                 []WindowTarget           `json:"allowed_windows,omitempty"`
	AllowedUIRoles                 []UIRole                 `json:"allowed_ui_roles,omitempty"`
	AllowedUIProperties            []UIProperty             `json:"allowed_ui_properties,omitempty"`
	AllowedUIActions               []UIAction               `json:"allowed_ui_actions,omitempty"`
	AllowedTargetModes             []TargetResolutionMode   `json:"allowed_target_modes,omitempty"`
	AllowedTargetEvidenceSources   []TargetEvidenceSource   `json:"allowed_target_evidence_sources,omitempty"`
	AllowedTargetEvidenceProviders []TargetEvidenceProvider `json:"allowed_target_evidence_providers,omitempty"`
	AllowedTargetEvidenceRegions   []CaptureRegion          `json:"allowed_target_evidence_regions,omitempty"`
	AllowedViewRegions             []CaptureRegion          `json:"allowed_view_regions,omitempty"`
	ViewRedactionMasks             []CaptureRegion          `json:"view_redaction_masks,omitempty"`
	MaxActions                     uint64                   `json:"max_actions"`
	MaxTextRunes                   int                      `json:"max_text_runes"`
	AllowDoubleClick               bool                     `json:"allow_double_click,omitempty"`
	MaxScrollEvents                uint32                   `json:"max_scroll_events,omitempty"`
	MaxScrollDistance              uint64                   `json:"max_scroll_distance,omitempty"`
	MaxDragDistance                uint64                   `json:"max_drag_distance,omitempty"`
	MaxDragDurationMillis          int                      `json:"max_drag_duration_ms,omitempty"`
	MaxChordKeys                   uint32                   `json:"max_chord_keys,omitempty"`
	MinActionIntervalMillis        int                      `json:"min_action_interval_ms,omitempty"`
	MinUIQueryIntervalMillis       int                      `json:"min_ui_query_interval_ms,omitempty"`
	SessionTimeoutMillis           int                      `json:"session_timeout_ms,omitempty"`
	MaxObservations                uint64                   `json:"max_observations,omitempty"`
	MaxCapturePixels               uint64                   `json:"max_capture_pixels,omitempty"`
	MaxQueries                     uint64                   `json:"max_queries,omitempty"`
	MaxUIElements                  uint32                   `json:"max_ui_elements,omitempty"`
	MaxUITreeDepth                 uint32                   `json:"max_ui_tree_depth,omitempty"`
	MaxUIStringBytes               uint32                   `json:"max_ui_string_bytes,omitempty"`
	MaxUIActionValueBytes          uint32                   `json:"max_ui_action_value_bytes,omitempty"`
	UIActionTimeoutMillis          int                      `json:"ui_action_timeout_ms,omitempty"`
	UIVerificationAttempts         uint32                   `json:"ui_verification_attempts,omitempty"`
	UIVerificationIntervalMillis   int                      `json:"ui_verification_interval_ms,omitempty"`
	UIVerificationTimeoutMillis    int                      `json:"ui_verification_timeout_ms,omitempty"`
	RequireCapabilityLease         bool                     `json:"require_capability_lease,omitempty"`
	MaxCapabilityLeases            uint64                   `json:"max_capability_leases,omitempty"`
	MaxCapabilityLeaseMillis       int                      `json:"max_capability_lease_ms,omitempty"`
	AdaptiveTargetThreshold        uint32                   `json:"adaptive_target_threshold,omitempty"`
	MaxTargetEvidenceAgeMillis     int                      `json:"max_target_evidence_age_ms,omitempty"`
	MinTargetOCRConfidence         float64                  `json:"min_target_ocr_confidence,omitempty"`
	MinTargetVisualConfidence      float64                  `json:"min_target_visual_confidence,omitempty"`
	AllowedTraceTiers              []TracePrivacyTier       `json:"allowed_trace_tiers,omitempty"`
	MaxTraceEvents                 uint32                   `json:"max_trace_events,omitempty"`
	MaxTraceBytes                  uint64                   `json:"max_trace_bytes,omitempty"`
	TraceLifetimeMillis            int                      `json:"trace_lifetime_ms,omitempty"`
	AllowTraceExport               bool                     `json:"allow_trace_export,omitempty"`
	AllowRecorder                  bool                     `json:"allow_recorder,omitempty"`
	MaxRecorderEvents              uint32                   `json:"max_recorder_events,omitempty"`
	MaxRecorderBytes               uint64                   `json:"max_recorder_bytes,omitempty"`
	RecorderLifetimeMillis         int                      `json:"recorder_lifetime_ms,omitempty"`
	AllowFullDisplayView           bool                     `json:"allow_full_display_view,omitempty"`
	AllowPortalView                bool                     `json:"allow_portal_view,omitempty"`
	MaxViewSourcePixels            uint64                   `json:"max_view_source_pixels,omitempty"`
	MaxViewEncodedBytes            uint64                   `json:"max_view_encoded_bytes,omitempty"`
	MaxViewWidth                   int                      `json:"max_view_width,omitempty"`
	MaxViewHeight                  int                      `json:"max_view_height,omitempty"`
	MaxViews                       uint64                   `json:"max_views,omitempty"`
	MaxConcurrentViews             uint32                   `json:"max_concurrent_views,omitempty"`
	MinViewIntervalMillis          int                      `json:"min_view_interval_ms,omitempty"`
	ViewTimeoutMillis              int                      `json:"view_timeout_ms,omitempty"`
	AllowedOCRLanguages            []string                 `json:"allowed_ocr_languages,omitempty"`
	AllowFullViewAnalysis          bool                     `json:"allow_full_view_analysis,omitempty"`
	MaxAnalysisPixels              uint64                   `json:"max_analysis_pixels,omitempty"`
	MaxOCRBoxes                    uint32                   `json:"max_ocr_boxes,omitempty"`
	MaxOCRTextBytes                uint32                   `json:"max_ocr_text_bytes,omitempty"`
	MaxVisualElements              uint32                   `json:"max_visual_elements,omitempty"`
	MaxAnalyses                    uint64                   `json:"max_analyses,omitempty"`
	MaxConcurrentAnalyses          uint32                   `json:"max_concurrent_analyses,omitempty"`
	MinAnalysisIntervalMillis      int                      `json:"min_analysis_interval_ms,omitempty"`
	AnalysisTimeoutMillis          int                      `json:"analysis_timeout_ms,omitempty"`
	WaitAttempts                   uint32                   `json:"wait_attempts,omitempty"`
	WaitIntervalMillis             int                      `json:"wait_interval_ms,omitempty"`
	WaitTimeoutMillis              int                      `json:"wait_timeout_ms,omitempty"`
	VerificationAttempts           uint32                   `json:"verification_attempts,omitempty"`
	VerificationIntervalMillis     int                      `json:"verification_interval_ms,omitempty"`
	VerificationTimeoutMillis      int                      `json:"verification_timeout_ms,omitempty"`
	// contains filtered or unexported fields
}

Policy constrains every observation, query, and mutation performed by a Session. Empty allow lists deny access; callers must opt in explicitly.

type RecordedFlow

type RecordedFlow struct {
	SchemaVersion      string           `json:"schema_version"`
	RecorderVersion    string           `json:"recorder_version"`
	TargetSpecVersion  string           `json:"target_spec_version"`
	ActionProofVersion string           `json:"action_proof_version"`
	TraceVersion       string           `json:"trace_version"`
	StartedAt          time.Time        `json:"started_at"`
	FinishedAt         time.Time        `json:"finished_at"`
	DurationMillis     int64            `json:"duration_ms"`
	Targets            []RecordedTarget `json:"targets"`
	Events             []RecorderEvent  `json:"events"`
	Truncated          bool             `json:"truncated"`
	CleanupComplete    bool             `json:"cleanup_complete"`
}

RecordedFlow is the terminal, detached result of an explicit Stop call. It contains no action values, coordinates, pixels, native references, capability IDs, raw backend errors, or observation element IDs.

func (RecordedFlow) Generate

Generate produces deterministic formatted Go and MCP artifacts without executing the flow or adding policy/confirmation grants.

type RecordedTarget

type RecordedTarget struct {
	ID              string           `json:"id"`
	WindowID        string           `json:"window_id"`
	SchemaVersion   string           `json:"schema_version"`
	Role            UIRole           `json:"role"`
	Name            string           `json:"name"`
	RequiredStates  []UIState        `json:"required_states,omitempty"`
	RequiredActions []UIAction       `json:"required_actions,omitempty"`
	Ancestors       []TargetAncestor `json:"ancestors,omitempty"`
}

RecordedTarget is a reusable semantic locator with its native window target deliberately omitted. Generated flows accept the operator-owned window as an explicit parameter instead of persisting a PID or native handle.

type RecorderActionHint

type RecorderActionHint struct {
	Impact RecorderActionImpact `json:"impact"`
}

RecorderActionHint carries fixed-vocabulary operator intent only. Omission is review-required while recording. It never changes authorization, confirmation, dispatch, or verification behavior.

type RecorderActionImpact

type RecorderActionImpact string

RecorderActionImpact is the operator-reviewed mutation-impact vocabulary.

const (
	RecorderActionReversible  RecorderActionImpact = "reversible"
	RecorderActionDestructive RecorderActionImpact = "destructive"
)

type RecorderActionOutcome

type RecorderActionOutcome struct {
	Status             ActionStatus             `json:"status"`
	ProofStatus        ActionProofStatus        `json:"proof_status,omitempty"`
	ExecutionStatus    ActionExecutionStatus    `json:"execution_status,omitempty"`
	VerificationStatus ActionVerificationStatus `json:"verification_status,omitempty"`
	ErrorCode          ErrorCode                `json:"error_code,omitempty"`
	CleanupComplete    bool                     `json:"cleanup_complete"`
}

RecorderActionOutcome captures terminal proof shape without backend payloads.

type RecorderEvent

type RecorderEvent struct {
	Sequence       uint32                       `json:"sequence"`
	Kind           RecorderEventKind            `json:"kind"`
	Operation      Operation                    `json:"operation"`
	ObservationKey string                       `json:"observation_key,omitempty"`
	TargetID       string                       `json:"target_id,omitempty"`
	Action         UIAction                     `json:"action,omitempty"`
	Impact         RecorderActionImpact         `json:"impact,omitempty"`
	Postcondition  *UIElementCondition          `json:"postcondition,omitempty"`
	Observation    *RecorderObservationEvidence `json:"observation,omitempty"`
	Resolution     *RecorderResolutionEvidence  `json:"resolution,omitempty"`
	Outcome        *RecorderActionOutcome       `json:"outcome,omitempty"`
	Trace          *RecorderTraceLineage        `json:"trace,omitempty"`
	ReviewRequired bool                         `json:"review_required"`
	ReviewReasons  []RecorderReviewReason       `json:"review_reasons,omitempty"`
	Executable     bool                         `json:"executable"`
}

RecorderEvent is one bounded semantic event or non-executable review item.

type RecorderEventKind

type RecorderEventKind string

RecorderEventKind is the fixed semantic recorder vocabulary.

const (
	RecorderEventObservation RecorderEventKind = "semantic-observation"
	RecorderEventResolution  RecorderEventKind = "target-resolution"
	RecorderEventAction      RecorderEventKind = "semantic-action"
	RecorderEventReview      RecorderEventKind = "review-item"
)

type RecorderObservationEvidence

type RecorderObservationEvidence struct {
	SchemaVersion string    `json:"schema_version"`
	ElementCount  uint32    `json:"element_count"`
	Truncated     bool      `json:"truncated"`
	ErrorCode     ErrorCode `json:"error_code,omitempty"`
}

RecorderObservationEvidence captures bounded semantic observation shape, never the accessibility tree, text values, native references, or pixels.

type RecorderRequest

type RecorderRequest struct {
	SchemaVersion string `json:"schema_version"`
}

RecorderRequest explicitly starts one session-scoped semantic recorder. Immutable Policy bounds its lifetime, event count, and retained bytes.

type RecorderResolutionEvidence

type RecorderResolutionEvidence struct {
	SchemaVersion          string                   `json:"schema_version"`
	Strategy               TargetResolutionStrategy `json:"strategy,omitempty"`
	Mode                   TargetResolutionMode     `json:"mode"`
	MatchedBy              []TargetEvidence         `json:"matched_by,omitempty"`
	Changed                []TargetEvidence         `json:"changed,omitempty"`
	CandidateCount         uint32                   `json:"candidate_count"`
	RejectedCandidateCount uint32                   `json:"rejected_candidate_count"`
	Ambiguous              bool                     `json:"ambiguous"`
	EvidenceSources        []TargetEvidenceSource   `json:"evidence_sources,omitempty"`
	ErrorCode              ErrorCode                `json:"error_code,omitempty"`
}

RecorderResolutionEvidence retains only fixed, payload-free resolver proof.

type RecorderReviewReason

type RecorderReviewReason string

RecorderReviewReason explains why generated output must remain non-executable.

const (
	RecorderReviewCoordinateInput      RecorderReviewReason = "coordinate-input"
	RecorderReviewSecretInputOmitted   RecorderReviewReason = "secret-input-omitted"
	RecorderReviewNativeReference      RecorderReviewReason = "native-reference"
	RecorderReviewUnsupportedAction    RecorderReviewReason = "unsupported-action"
	RecorderReviewUnresolvedTarget     RecorderReviewReason = "unresolved-target"
	RecorderReviewLocatorPatch         RecorderReviewReason = "locator-patch"
	RecorderReviewVisualEvidence       RecorderReviewReason = "visual-evidence"
	RecorderReviewDestructiveAction    RecorderReviewReason = "destructive-action"
	RecorderReviewMissingPostcondition RecorderReviewReason = "missing-postcondition"
	RecorderReviewUnverifiedOutcome    RecorderReviewReason = "unverified-outcome"
	RecorderReviewMissingTrace         RecorderReviewReason = "missing-trace"
	RecorderReviewTruncatedFlow        RecorderReviewReason = "truncated-flow"
	RecorderReviewIncompleteTrace      RecorderReviewReason = "incomplete-trace"
	RecorderReviewUnknownImpact        RecorderReviewReason = "unknown-impact"
)

type RecorderTraceLineage

type RecorderTraceLineage struct {
	SchemaVersion   string           `json:"schema_version"`
	Tier            TracePrivacyTier `json:"tier"`
	TransactionID   string           `json:"transaction_id"`
	Truncated       bool             `json:"truncated"`
	Redacted        bool             `json:"redacted"`
	MissingEvidence bool             `json:"missing_evidence"`
	Expired         bool             `json:"expired"`
	CleanupComplete bool             `json:"cleanup_complete"`
}

RecorderTraceLineage is the bounded privacy-safe link to Trace v1.

type ResolveUIRequest

type ResolveUIRequest struct {
	ObservationID string                  `json:"observation_id"`
	Target        TargetSpec              `json:"target"`
	Mode          TargetResolutionMode    `json:"mode,omitempty"`
	Lease         *CapabilityLeaseRequest `json:"lease,omitempty"`
	Confirmed     bool                    `json:"confirmed,omitempty"`
}

ResolveUIRequest resolves one TargetSpec only within one live retained UI observation. Confirmed is used only when immutable policy requires it.

type RiskClass

type RiskClass string

RiskClass describes the policy impact of an operation.

const (
	RiskSensitiveRead      RiskClass = "sensitive-read"
	RiskReversibleMutation RiskClass = "reversible-mutation"
	RiskElevatedMutation   RiskClass = "elevated-mutation"
)

type RobotGoTrace

type RobotGoTrace struct {
	SchemaVersion        string            `json:"schema_version"`
	TransactionID        string            `json:"transaction_id"`
	Tier                 TracePrivacyTier  `json:"tier"`
	StartedAt            time.Time         `json:"started_at"`
	FinishedAt           time.Time         `json:"finished_at"`
	DurationMillis       int64             `json:"duration_ms"`
	Events               []TraceEvent      `json:"events"`
	Truncated            bool              `json:"truncated"`
	Redacted             bool              `json:"redacted"`
	MissingEvidence      bool              `json:"missing_evidence"`
	Expired              bool              `json:"expired"`
	CleanupComplete      bool              `json:"cleanup_complete"`
	ExportStatus         TraceExportStatus `json:"export_status"`
	TransactionErrorCode ErrorCode         `json:"transaction_error_code,omitempty"`
	ExportErrorCode      ErrorCode         `json:"export_error_code,omitempty"`
}

RobotGoTrace is one complete, bounded and replay-neutral transaction timeline. It is never accepted as action input.

type RuntimeDiagnostics

type RuntimeDiagnostics struct {
	GOOS           string              `json:"goos"`
	GOARCH         string              `json:"goarch"`
	CGOEnabled     bool                `json:"cgo_enabled"`
	Implementation string              `json:"implementation"`
	DisplayServer  string              `json:"display_server"`
	Compositor     string              `json:"compositor,omitempty"`
	Features       []DiagnosticFeature `json:"features"`
}

RuntimeDiagnostics is safe to serialize and never opens desktop consent.

type ScrollAction

type ScrollAction struct {
	TargetX   int    `json:"target_x"`
	TargetY   int    `json:"target_y"`
	DeltaX    int    `json:"delta_x"`
	DeltaY    int    `json:"delta_y"`
	Events    uint32 `json:"events"`
	DisplayID int    `json:"display_id"`
}

ScrollAction positions the pointer at one validated global coordinate and emits one bounded scroll delta repeatedly there. The explicit target keeps the operation usable on Wayland, which does not expose the live global pointer position.

type ScrollAxis

type ScrollAxis string

ScrollAxis identifies an axis accepted by a scroll backend.

const (
	ScrollAxisHorizontal ScrollAxis = "horizontal"
	ScrollAxisVertical   ScrollAxis = "vertical"
)

type SemanticRecorder

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

SemanticRecorder is one explicitly started session-owned recorder.

func (*SemanticRecorder) Close

func (r *SemanticRecorder) Close() error

Close cancels recording and clears all retained state without producing an artifact.

func (*SemanticRecorder) Stop

Stop atomically detaches the recorder, returns a defensive terminal flow, and clears all session-owned temporary recorder state.

type Session

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

Session serializes policy-gated desktop mutations. The underlying RobotGo input backends remain process-global, so only one agent Session may exist.

func NewSession

func NewSession(config Config) (*Session, error)

NewSession creates the single active agent session for this process. Runtime capability discovery is bounded and never opens a consent dialog.

func (*Session) ActUIElement

func (s *Session) ActUIElement(ctx context.Context, request ElementActionRequest) (result ActionResult, returnErr error)

ActUIElement revalidates and performs at most one observation-bound native semantic action. It never falls back to pointer, keyboard, capture, OCR, or shell behavior. Every return contains Action Proof v2.

func (*Session) Catalog

func (s *Session) Catalog() OperationCatalog

Catalog returns a defensive copy of the session's immutable catalog.

func (*Session) Close

func (s *Session) Close() error

Close prevents future actions, waits for an active mutation, and releases every session-owned pressed input before relinquishing the process-wide agent-session claim. A cleanup failure retains ownership so a later Close call can retry safely.

func (*Session) DetectVisualElements

func (s *Session) DetectVisualElements(ctx context.Context, request VisualElementsRequest) (VisualElementsResult, error)

DetectVisualElements returns bounded deterministic geometry proposals from one explicit subregion of a live desktop.view observation.

func (*Session) DryRun

func (s *Session) DryRun(ctx context.Context, request ActionRequest) (ActionResult, error)

DryRun performs the same shape, policy, quota, capability, and cancellation preflight as Execute without injecting input or consuming action quota. A supplied observation precondition is recaptured and consumes observation quota because stale-target validation is a real sensitive read.

func (*Session) Execute

func (s *Session) Execute(ctx context.Context, request ActionRequest) (ActionResult, error)

Execute validates and serially performs one typed desktop mutation.

func (*Session) FindColor

func (s *Session) FindColor(ctx context.Context, request FindColorRequest) (FindColorResult, error)

FindColor evaluates a color condition against an explicit session-owned observation without touching the desktop.

func (*Session) InspectUI

func (s *Session) InspectUI(ctx context.Context, request InspectUIRequest) (result UIObservation, returnErr error)

InspectUI returns one policy-scoped semantic tree. It never opens a desktop permission prompt and consumes both query and observation quota on attempt.

func (*Session) OCR

func (s *Session) OCR(ctx context.Context, request OCRRequest) (OCRResult, error)

OCR extracts bounded, sanitized word boxes from one explicit subregion of a live desktop.view observation.

func (*Session) Observe

func (s *Session) Observe(ctx context.Context, request ObserveRequest) (*Observation, error)

Observe returns a diagnostics snapshot and optional bounded capture. It is serialized with actions so an observation cannot race a session mutation.

func (*Session) PlanVerifiedFlow

func (s *Session) PlanVerifiedFlow(ctx context.Context, request VerifiedFlowPlanRequest) (VerifiedFlowPlanReport, error)

PlanVerifiedFlow evaluates a bounded verified-flow description against this session's immutable catalog and policy plus already-retained observations. It never calls a desktop backend, emits audit/trace/recorder events, issues a lease, reserves authority, consumes quota, or prompts for permission.

func (*Session) ReleaseObservation

func (s *Session) ReleaseObservation(id string) error

ReleaseObservation idempotently removes one valid observation from the session and zeroes its optional capture. It can release observations returned directly by Observe or referenced by wait/verification results.

func (*Session) ResolveUITarget

func (s *Session) ResolveUITarget(ctx context.Context, request ResolveUIRequest) (result TargetResolutionResult, returnErr error)

ResolveUITarget deterministically resolves one exact semantic or structural TargetSpec against a retained sanitized observation. It never calls a desktop backend and consumes no query, observation, or action quota.

func (*Session) StartRecorder

func (s *Session) StartRecorder(ctx context.Context, request RecorderRequest) (*SemanticRecorder, error)

StartRecorder starts the only active semantic recorder for this Session.

func (*Session) View

func (s *Session) View(ctx context.Context, request ViewRequest) (*View, error)

View captures and encodes one policy-approved image entirely in memory. It never opens a portal consent prompt and consumes view and observation quota on an authorized attempt.

func (*Session) WaitColor

func (s *Session) WaitColor(ctx context.Context, request WaitColorRequest) (WaitColorResult, error)

WaitColor captures and evaluates an explicit region until it matches or the bounded policy is exhausted. A successful result references the sole retained observation by ID; callers should pass it to ReleaseObservation when no longer needed. Every other temporary frame is zeroed before return.

type TargetAncestor

type TargetAncestor struct {
	Role           UIRole    `json:"role"`
	Name           string    `json:"name"`
	RequiredStates []UIState `json:"required_states,omitempty"`
}

TargetAncestor is one exact structural anchor. Ancestors are ordered from the immediate parent outward and resolution never skips hierarchy levels.

type TargetEvidence

type TargetEvidence string

TargetEvidence is a fixed, payload-free explanation token. The order in a result is stable and follows the order of these constants.

const (
	TargetEvidenceWindowIdentity     TargetEvidence = "window-identity"
	TargetEvidenceRole               TargetEvidence = "role"
	TargetEvidenceName               TargetEvidence = "name"
	TargetEvidenceStates             TargetEvidence = "required-states"
	TargetEvidenceActions            TargetEvidence = "required-actions"
	TargetEvidenceAncestors          TargetEvidence = "ancestor-chain"
	TargetEvidenceImageObservation   TargetEvidence = "image-observation"
	TargetEvidenceAnalysisProvenance TargetEvidence = "analysis-provenance"
	TargetEvidenceOCRItem            TargetEvidence = "ocr-item"
	TargetEvidenceVisualItem         TargetEvidence = "visual-item"
)

type TargetEvidenceClause

type TargetEvidenceClause struct {
	SchemaVersion string               `json:"schema_version"`
	ObservationID string               `json:"observation_id"`
	EvidenceID    string               `json:"evidence_id"`
	Source        TargetEvidenceSource `json:"source"`
	ItemIndex     uint32               `json:"item_index"`
}

TargetEvidenceClause references exactly one item from an explicit prior OCR or visual-analysis result. It contains no pixels or OCR text.

type TargetEvidenceProvider

type TargetEvidenceProvider struct {
	Source  TargetEvidenceSource `json:"source"`
	Backend string               `json:"backend"`
	Model   string               `json:"model"`
}

TargetEvidenceProvider is one exact backend/model identity explicitly trusted by immutable policy for weaker target-resolution evidence.

type TargetEvidenceSource

type TargetEvidenceSource string

TargetEvidenceSource is one fixed, policy-gated weaker resolver source.

const (
	TargetEvidenceSourceOCR    TargetEvidenceSource = "ocr"
	TargetEvidenceSourceVisual TargetEvidenceSource = "visual"
)

type TargetPatchProposal

type TargetPatchProposal struct {
	SchemaVersion string           `json:"schema_version"`
	Changed       []TargetEvidence `json:"changed"`
	Score         uint32           `json:"score"`
	Threshold     uint32           `json:"threshold"`
	Executable    bool             `json:"executable"`
}

TargetPatchProposal is deliberately non-executable and payload-free. It identifies which locator clauses drifted without returning replacement text.

type TargetResolutionMode

type TargetResolutionMode string

TargetResolutionMode fixes whether resolution is exact, adaptively semantic, or a non-executable review proposal.

const (
	TargetResolutionModeStrict   TargetResolutionMode = "strict"
	TargetResolutionModeAdaptive TargetResolutionMode = "adaptive"
	TargetResolutionModeReview   TargetResolutionMode = "review"
)

type TargetResolutionResult

type TargetResolutionResult struct {
	SchemaVersion          string                   `json:"schema_version"`
	ObservationID          string                   `json:"observation_id,omitempty"`
	Strategy               TargetResolutionStrategy `json:"strategy,omitempty"`
	Mode                   TargetResolutionMode     `json:"mode"`
	MatchedBy              []TargetEvidence         `json:"matched_by,omitempty"`
	Changed                []TargetEvidence         `json:"changed,omitempty"`
	CandidateCount         uint32                   `json:"candidate_count"`
	RejectedCandidateCount uint32                   `json:"rejected_candidate_count"`
	Ambiguous              bool                     `json:"ambiguous"`
	AdaptiveScore          uint32                   `json:"adaptive_score,omitempty"`
	AdaptiveThreshold      uint32                   `json:"adaptive_threshold,omitempty"`
	ElementID              string                   `json:"element_id,omitempty"`
	Expected               *UIElementExpectation    `json:"expected,omitempty"`
	Lease                  *CapabilityLease         `json:"lease,omitempty"`
	Patch                  *TargetPatchProposal     `json:"patch,omitempty"`
	EvidenceSources        []TargetEvidenceSource   `json:"evidence_sources,omitempty"`
	EvidenceProviders      []TargetEvidenceProvider `json:"evidence_providers,omitempty"`
	EvidenceAgeMillis      int64                    `json:"evidence_age_ms,omitempty"`
}

TargetResolutionResult returns legacy exact selection, an opaque single-use lease, or a non-executable review proposal only when one candidate qualifies.

type TargetResolutionStrategy

type TargetResolutionStrategy string

TargetResolutionStrategy identifies the exact semantic or reviewed, policy-gated analysis-evidence resolver path.

const (
	TargetResolutionExactSemantic      TargetResolutionStrategy = "exact-semantic"
	TargetResolutionStructuralSemantic TargetResolutionStrategy = "structural-semantic"
	TargetResolutionAdaptiveSemantic   TargetResolutionStrategy = "adaptive-semantic"
	TargetResolutionOCREvidence        TargetResolutionStrategy = "ocr-evidence"
	TargetResolutionVisualEvidence     TargetResolutionStrategy = "visual-evidence"
	TargetResolutionCombinedEvidence   TargetResolutionStrategy = "combined-evidence"
)

type TargetSpec

type TargetSpec struct {
	SchemaVersion   string                 `json:"schema_version"`
	Window          TargetWindowSpec       `json:"window"`
	Role            UIRole                 `json:"role"`
	Name            string                 `json:"name"`
	RequiredStates  []UIState              `json:"required_states,omitempty"`
	RequiredActions []UIAction             `json:"required_actions,omitempty"`
	Ancestors       []TargetAncestor       `json:"ancestors,omitempty"`
	Evidence        []TargetEvidenceClause `json:"evidence,omitempty"`
}

TargetSpec describes one exact semantic target in one observation-scoped window. Required state/action clauses use set containment; all identity and ancestor fields use exact equality.

type TargetWindowSpec

type TargetWindowSpec struct {
	Target        int              `json:"target"`
	Kind          WindowTargetKind `json:"kind"`
	ExpectedTitle string           `json:"expected_title"`
}

TargetWindowSpec binds a TargetSpec to the same explicit, policy-owned window identity used by its source semantic observation. ExpectedTitle is compared privately and is never returned in resolver evidence or errors.

type TraceEvent

type TraceEvent struct {
	Sequence                 uint32                   `json:"sequence"`
	Kind                     TraceEventKind           `json:"kind"`
	Code                     TraceEventCode           `json:"code"`
	TransactionID            string                   `json:"transaction_id"`
	Operation                Operation                `json:"operation,omitempty"`
	ObservationID            string                   `json:"observation_id,omitempty"`
	EvidenceObservationID    string                   `json:"evidence_observation_id,omitempty"`
	Backend                  string                   `json:"backend,omitempty"`
	Fallback                 bool                     `json:"fallback,omitempty"`
	Action                   UIAction                 `json:"action,omitempty"`
	ActionStatus             ActionStatus             `json:"action_status,omitempty"`
	ActionProofStatus        ActionProofStatus        `json:"action_proof_status,omitempty"`
	ActionResolutionStrategy ActionResolutionStrategy `json:"action_resolution_strategy,omitempty"`
	TargetResolutionStrategy TargetResolutionStrategy `json:"target_resolution_strategy,omitempty"`
	TargetResolutionMode     TargetResolutionMode     `json:"target_resolution_mode,omitempty"`
	CandidateCount           uint32                   `json:"candidate_count,omitempty"`
	RejectedCandidateCount   uint32                   `json:"rejected_candidate_count,omitempty"`
	Ambiguous                bool                     `json:"ambiguous,omitempty"`
	AdaptiveScore            uint32                   `json:"adaptive_score,omitempty"`
	AdaptiveThreshold        uint32                   `json:"adaptive_threshold,omitempty"`
	MatchedBy                []TargetEvidence         `json:"matched_by,omitempty"`
	Changed                  []TargetEvidence         `json:"changed,omitempty"`
	EvidenceSources          []TargetEvidenceSource   `json:"evidence_sources,omitempty"`
	EvidenceProviders        []TargetEvidenceProvider `json:"evidence_providers,omitempty"`
	EvidenceAgeMillis        int64                    `json:"evidence_age_ms,omitempty"`
	PolicyAllowed            bool                     `json:"policy_allowed,omitempty"`
	ConfirmationRequired     bool                     `json:"confirmation_required,omitempty"`
	Confirmed                bool                     `json:"confirmed,omitempty"`
	CapabilityLeasePresented bool                     `json:"capability_lease_presented,omitempty"`
	CapabilityLeaseStatus    CapabilityLeaseStatus    `json:"capability_lease_status,omitempty"`
	ExecutionStatus          ActionExecutionStatus    `json:"execution_status,omitempty"`
	ConditionKind            UIElementConditionKind   `json:"condition_kind,omitempty"`
	VerificationStatus       ActionVerificationStatus `json:"verification_status,omitempty"`
	PrecheckAttempts         uint32                   `json:"precheck_attempts,omitempty"`
	FinalGateChecked         bool                     `json:"final_gate_checked,omitempty"`
	PostconditionAttempts    uint32                   `json:"postcondition_attempts,omitempty"`
	AlreadySatisfied         bool                     `json:"already_satisfied,omitempty"`
	CleanupComplete          bool                     `json:"cleanup_complete,omitempty"`
	ErrorCode                ErrorCode                `json:"error_code,omitempty"`
}

TraceEvent contains only bounded fixed-vocabulary evidence. Fields are projected by tier before publication.

type TraceEventCode

type TraceEventCode string

TraceEventCode is a stable explanation code, never a free-form log message.

const (
	TraceCodeStarted           TraceEventCode = "started"
	TraceCodeResolved          TraceEventCode = "resolved"
	TraceCodeMissingEvidence   TraceEventCode = "missing-evidence"
	TraceCodeAllowed           TraceEventCode = "allowed"
	TraceCodeDenied            TraceEventCode = "denied"
	TraceCodeSelected          TraceEventCode = "selected"
	TraceCodeDispatched        TraceEventCode = "dispatched"
	TraceCodeSkipped           TraceEventCode = "skipped"
	TraceCodeNotDispatched     TraceEventCode = "not-dispatched"
	TraceCodeMatched           TraceEventCode = "matched"
	TraceCodeNotMatched        TraceEventCode = "not-matched"
	TraceCodeNotRequested      TraceEventCode = "not-requested"
	TraceCodeFailed            TraceEventCode = "failed"
	TraceCodeCanceled          TraceEventCode = "canceled"
	TraceCodeTimedOut          TraceEventCode = "timed-out"
	TraceCodeCleanupComplete   TraceEventCode = "cleanup-complete"
	TraceCodeCleanupIncomplete TraceEventCode = "cleanup-incomplete"
	TraceCodeVerified          TraceEventCode = "verified"
	TraceCodeRejected          TraceEventCode = "rejected"
	TraceCodeUnverified        TraceEventCode = "unverified"
	TraceCodeCleanupPending    TraceEventCode = "cleanup-pending"
)

type TraceEventKind

type TraceEventKind string

TraceEventKind is the fixed, replay-neutral transaction timeline vocabulary.

const (
	TraceTransactionStarted    TraceEventKind = "transaction.started"
	TraceResolutionFinished    TraceEventKind = "resolution.finished"
	TraceAuthorizationFinished TraceEventKind = "authorization.finished"
	TraceBackendSelected       TraceEventKind = "backend.selected"
	TraceDispatchFinished      TraceEventKind = "dispatch.finished"
	TraceVerificationFinished  TraceEventKind = "verification.finished"
	TraceCancellationObserved  TraceEventKind = "cancellation.observed"
	TraceCleanupFinished       TraceEventKind = "cleanup.finished"
	TraceTransactionFinished   TraceEventKind = "transaction.finished"
)

type TraceExportStatus

type TraceExportStatus string

TraceExportStatus reports the atomic export outcome without changing the underlying desktop transaction result.

const (
	TraceExportNotRequested TraceExportStatus = "not-requested"
	TraceExportSucceeded    TraceExportStatus = "succeeded"
	TraceExportFailed       TraceExportStatus = "failed"
)

type TracePrivacyTier

type TracePrivacyTier string

TracePrivacyTier selects the fixed projection applied before a trace leaves the transaction. Trace v1 never includes pixels, text values, native handles, raw backend errors, credentials, or unrestricted UI trees.

const (
	TracePrivacyMetadataOnly     TracePrivacyTier = "metadata-only"
	TracePrivacySemanticRedacted TracePrivacyTier = "semantic-redacted"
	TracePrivacyVisualRedacted   TracePrivacyTier = "visual-redacted"
	TracePrivacyFullExplicit     TracePrivacyTier = "full-explicit"
)

type TraceRequest

type TraceRequest struct {
	SchemaVersion string           `json:"schema_version"`
	Tier          TracePrivacyTier `json:"tier"`
	Export        bool             `json:"export,omitempty"`
}

TraceRequest explicitly opts one semantic action into policy-approved trace capture. Export requests synchronous delivery to Config.TraceSink.

type TraceSink

type TraceSink interface {
	ExportTrace(ctx context.Context, trace RobotGoTrace) error
}

TraceSink atomically accepts one complete defensive trace copy. Calls may overlap after their desktop transaction gates are released; implementations must be concurrency-safe, honor ctx, and must not call back into the Session. On failure RobotGo clears its transient copy and reports ErrorTraceExport without changing the action outcome or proof.

type TypeTextAction

type TypeTextAction struct {
	Text string `json:"text"`
}

TypeTextAction types UTF-8 text. The text is never copied into results.

type UIAction

type UIAction string

type UIBounds

type UIBounds struct {
	X      int `json:"x"`
	Y      int `json:"y"`
	Width  int `json:"width"`
	Height int `json:"height"`
}

UIBounds is one bounded global logical rectangle.

type UIConditionPhase

type UIConditionPhase string

UIConditionPhase identifies which bounded semantic verification phase produced a terminal audit event.

const (
	UIConditionPhaseNotRequested UIConditionPhase = "not-requested"
	UIConditionPhasePrecheck     UIConditionPhase = "precheck"
	UIConditionPhaseFinalGate    UIConditionPhase = "final-gate"
	UIConditionPhasePostDispatch UIConditionPhase = "post-dispatch"
)

type UIElement

type UIElement struct {
	ElementID     string     `json:"element_id"`
	Role          UIRole     `json:"role"`
	Name          string     `json:"name,omitempty"`
	Description   string     `json:"description,omitempty"`
	Value         string     `json:"value,omitempty"`
	ValueRedacted bool       `json:"value_redacted,omitempty"`
	Sensitive     bool       `json:"sensitive,omitempty"`
	States        []UIState  `json:"states,omitempty"`
	Bounds        *UIBounds  `json:"bounds,omitempty"`
	Focused       bool       `json:"focused,omitempty"`
	Actions       []UIAction `json:"actions,omitempty"`
	ParentID      string     `json:"parent_id,omitempty"`
	ChildIDs      []string   `json:"child_ids,omitempty"`
}

UIElement is a privacy-reduced semantic element. ElementID is opaque and is meaningful only together with ObservationID from the containing result.

type UIElementCondition

type UIElementCondition struct {
	Kind  UIElementConditionKind `json:"kind"`
	State UIState                `json:"state,omitempty"`
}

UIElementCondition is one optional desired state on the same retained observation element. Values are never accepted as condition operands; value-equals-action-value compares privately with ElementActionRequest.Value.

type UIElementConditionKind

type UIElementConditionKind string

UIElementConditionKind is the fixed target-relative semantic condition vocabulary supported by Action Proof v1.

const (
	UIElementConditionStatePresent           UIElementConditionKind = "state-present"
	UIElementConditionStateAbsent            UIElementConditionKind = "state-absent"
	UIElementConditionFocused                UIElementConditionKind = "focused"
	UIElementConditionNotFocused             UIElementConditionKind = "not-focused"
	UIElementConditionValueEqualsActionValue UIElementConditionKind = "value-equals-action-value"
)

type UIElementExpectation

type UIElementExpectation struct {
	Role      UIRole     `json:"role"`
	Name      string     `json:"name,omitempty"`
	Sensitive bool       `json:"sensitive,omitempty"`
	States    []UIState  `json:"states"`
	Bounds    *UIBounds  `json:"bounds"`
	Actions   []UIAction `json:"actions"`
}

UIElementExpectation is the caller-visible semantic identity that must still match both the retained observation and the live native element.

type UIObservation

type UIObservation struct {
	SchemaVersion string      `json:"schema_version"`
	ObservationID string      `json:"observation_id"`
	CreatedAt     time.Time   `json:"created_at"`
	Backend       string      `json:"backend"`
	Truncated     bool        `json:"truncated"`
	Elements      []UIElement `json:"elements"`
}

UIObservation is a bounded semantic snapshot. It contains no native object handles, backend object paths, hidden nodes, password values, or raw errors.

type UIProperty

type UIProperty string

UIProperty identifies one semantic field that policy permits to cross MCP.

const (
	UIPropertyRole        UIProperty = "role"
	UIPropertyName        UIProperty = "name"
	UIPropertyDescription UIProperty = "description"
	UIPropertyValue       UIProperty = "value"
	UIPropertyState       UIProperty = "state"
	UIPropertyBounds      UIProperty = "bounds"
	UIPropertyFocus       UIProperty = "focus"
	UIPropertyActions     UIProperty = "actions"
	UIPropertyHierarchy   UIProperty = "hierarchy"
)

type UIRole

type UIRole string

UIRole is the bounded, platform-neutral semantic role vocabulary exposed to agents. Backend-specific roles never cross the agent boundary.

const (
	UIRoleApplication UIRole = "application"
	UIRoleWindow      UIRole = "window"
	UIRoleDialog      UIRole = "dialog"
	UIRoleButton      UIRole = "button"
	UIRoleCheckbox    UIRole = "checkbox"
	UIRoleComboBox    UIRole = "combobox"
	UIRoleRadio       UIRole = "radio"
	UIRoleSwitch      UIRole = "switch"
	UIRoleTextBox     UIRole = "textbox"
	UIRolePassword    UIRole = "password"
	UIRoleLabel       UIRole = "label"
	UIRoleLink        UIRole = "link"
	UIRoleList        UIRole = "list"
	UIRoleListItem    UIRole = "list-item"
	UIRoleMenu        UIRole = "menu"
	UIRoleMenuItem    UIRole = "menu-item"
	UIRoleTab         UIRole = "tab"
	UIRoleTabPanel    UIRole = "tab-panel"
	UIRoleSlider      UIRole = "slider"
	UIRoleProgress    UIRole = "progress"
	UIRoleImage       UIRole = "image"
	UIRoleTable       UIRole = "table"
	UIRoleRow         UIRole = "row"
	UIRoleCell        UIRole = "cell"
	UIRoleGroup       UIRole = "group"
	UIRoleGeneric     UIRole = "generic"
)

type UIState

type UIState string

UIState and UIAction are fixed vocabularies. Native backend text can never be smuggled through these structural fields.

type VerificationCondition

type VerificationCondition string

VerificationCondition identifies a bounded post-action capture predicate.

const (
	VerificationCaptureChanged   VerificationCondition = "capture-changed"
	VerificationCaptureUnchanged VerificationCondition = "capture-unchanged"
)

type VerificationRequest

type VerificationRequest struct {
	Condition VerificationCondition `json:"condition"`
}

VerificationRequest compares post-action captures with the precondition observation. Attempt count and interval come from immutable session policy.

type VerificationResult

type VerificationResult struct {
	Status    VerificationStatus    `json:"status"`
	Condition VerificationCondition `json:"condition"`
	Attempts  uint32                `json:"attempts"`
}

VerificationResult never includes capture pixels or digests.

type VerificationStatus

type VerificationStatus string

VerificationStatus is the machine-readable post-action outcome.

const (
	VerificationPassed VerificationStatus = "passed"
	VerificationFailed VerificationStatus = "failed"
)

type VerifiedFlowPlanReport

type VerifiedFlowPlanReport struct {
	SchemaVersion  string                `json:"schema_version"`
	CatalogVersion string                `json:"catalog_version"`
	Status         FlowFeasibilityStatus `json:"status"`
	AdvisoryOnly   bool                  `json:"advisory_only"`
	Requirements   FlowPlanRequirements  `json:"requirements"`
	Steps          []FlowPlanStepReport  `json:"steps"`
}

VerifiedFlowPlanReport is deterministic for the same immutable session snapshot and clock. AdvisoryOnly is always true and the report can never be supplied as action authority.

type VerifiedFlowPlanRequest

type VerifiedFlowPlanRequest struct {
	SchemaVersion          string                 `json:"schema_version"`
	CatalogVersion         string                 `json:"catalog_version"`
	TargetSpecVersion      string                 `json:"target_spec_version"`
	CapabilityLeaseVersion string                 `json:"capability_lease_version"`
	ActionProofVersion     string                 `json:"action_proof_version"`
	TraceVersion           string                 `json:"trace_version"`
	Steps                  []VerifiedFlowPlanStep `json:"steps"`
}

VerifiedFlowPlanRequest pins every version consumed by a bounded advisory plan. Catalog drift fails before session state is inspected.

type VerifiedFlowPlanStep

type VerifiedFlowPlanStep struct {
	ObservationID                 string               `json:"observation_id,omitempty"`
	Target                        TargetSpec           `json:"target"`
	Mode                          TargetResolutionMode `json:"mode,omitempty"`
	Action                        UIAction             `json:"action"`
	ActionValueBytes              uint32               `json:"action_value_bytes,omitempty"`
	Postcondition                 *UIElementCondition  `json:"postcondition,omitempty"`
	CapabilityLeaseDurationMillis int                  `json:"capability_lease_duration_ms,omitempty"`
	Trace                         *TraceRequest        `json:"trace,omitempty"`
}

VerifiedFlowPlanStep describes one future resolve -> act -> verify transaction. It contains no element identity, native reference, action value, capability token, or confirmation grant.

type View

type View struct {
	Metadata ViewMetadata `json:"metadata"`
	// contains filtered or unexported fields
}

View owns one encoded, metadata-free image until TakePNG transfers that ownership to the caller. The retained observation capture remains separately session-owned until ReleaseObservation or Session.Close.

func NewImageView

func NewImageView(metadata ViewMetadata, encodedPNG []byte) (*View, error)

NewImageView adopts one metadata-free PNG produced by a custom Session implementation. The caller relinquishes the byte slice on success. Normal RobotGo callers should use Session.View instead.

func (*View) Close

func (view *View) Close() error

Close zeroes encoded image bytes that have not been transferred.

func (*View) TakePNG

func (view *View) TakePNG() ([]byte, error)

TakePNG transfers the encoded image to the caller exactly once. The caller must clear the returned bytes after its transport or consumer is finished.

type ViewMetadata

type ViewMetadata struct {
	SchemaVersion         string        `json:"schema_version"`
	ObservationID         string        `json:"observation_id"`
	CreatedAt             time.Time     `json:"created_at"`
	Region                CaptureRegion `json:"region"`
	Width                 int           `json:"width"`
	Height                int           `json:"height"`
	Backend               string        `json:"backend"`
	MIMEType              string        `json:"mime_type"`
	CaptureDurationMillis int64         `json:"capture_duration_ms"`
	Downscaled            bool          `json:"downscaled,omitempty"`
	Redacted              bool          `json:"redacted,omitempty"`
}

ViewMetadata is the sanitized structured portion of an image observation. It deliberately excludes pixels, encoded bytes, and the private digest.

type ViewRequest

type ViewRequest struct {
	Region        *CaptureRegion `json:"region,omitempty"`
	FullDisplayID *int           `json:"full_display_id,omitempty"`
	Confirmed     bool           `json:"confirmed,omitempty"`
}

ViewRequest selects either one explicitly allow-listed region or one whole display that has a separate full-display policy grant. Exactly one selector must be present.

type VisualElementProposal

type VisualElementProposal struct {
	Kind       string        `json:"kind"`
	Bounds     CaptureRegion `json:"bounds"`
	Confidence float64       `json:"confidence"`
}

type VisualElementsRequest

type VisualElementsRequest struct {
	ObservationID string        `json:"observation_id"`
	Region        CaptureRegion `json:"region"`
	MinConfidence float64       `json:"min_confidence,omitempty"`
	Confirmed     bool          `json:"confirmed,omitempty"`
}

type VisualElementsResult

type VisualElementsResult struct {
	Metadata AnalysisMetadata        `json:"metadata"`
	Elements []VisualElementProposal `json:"elements"`
}

type VisualMatch

type VisualMatch struct {
	X         int `json:"x"`
	Y         int `json:"y"`
	DisplayID int `json:"display_id"`
}

VisualMatch identifies the first matching global logical coordinate.

type WaitColorRequest

type WaitColorRequest struct {
	Region    CaptureRegion  `json:"region"`
	Condition ColorCondition `json:"condition"`
	Confirmed bool           `json:"confirmed,omitempty"`
}

WaitColorRequest polls one explicit capture region using the immutable attempt, interval, timeout, and quota limits in Policy.

type WaitColorResult

type WaitColorResult struct {
	SchemaVersion string          `json:"schema_version"`
	ConditionID   string          `json:"condition_id"`
	Status        ConditionStatus `json:"status"`
	Attempts      uint32          `json:"attempts"`
	ObservationID string          `json:"observation_id,omitempty"`
	Match         *VisualMatch    `json:"match,omitempty"`
}

WaitColorResult contains bounded polling evidence but no pixels, capture digest, or target color. A matched result identifies the retained observation.

type WindowTarget

type WindowTarget struct {
	Target        int              `json:"target"`
	Kind          WindowTargetKind `json:"kind"`
	ExpectedTitle string           `json:"expected_title"`
}

WindowTarget is one immutable activation allow-list entry. ExpectedTitle is compared with the live title immediately before dispatch to reject stale or reused native handles.

type WindowTargetKind

type WindowTargetKind string

WindowTargetKind identifies whether a window target is a process ID or a native platform handle.

const (
	WindowTargetProcess WindowTargetKind = "process"
	WindowTargetHandle  WindowTargetKind = "handle"
)

Directories

Path Synopsis
Package mcpserver exposes an agent Session through a small, local-only MCP tool surface.
Package mcpserver exposes an agent Session through a small, local-only MCP tool surface.

Jump to

Keyboard shortcuts

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