import { WebJobProgress } from "@xenosystem/web-context-client/progress"; import { DatabaseSync } from "node:sqlite"; declare const XENO_ARTIFACT_SCHEMA_VERSION: 1; type XenoJsonPrimitive = string | number | boolean | null; type XenoJsonValue = XenoJsonPrimitive | XenoJsonObject | XenoJsonValue[]; interface XenoJsonObject { [key: string]: XenoJsonValue; } declare const XENO_BUILTIN_ARTIFACT_KINDS: readonly [ "plan", "requirements", "design", "task-graph", "patch", "diff", "file", "document", "diagram", "screenshot", "recording", "browser-snapshot", "test-report", "review-report", "security-report", "performance-report", "release-report", "sbom", "provenance", "attestation", "page" ]; type XenoArtifactKind = (typeof XENO_BUILTIN_ARTIFACT_KINDS)[number] | `custom:${string}`; declare const XENO_ARTIFACT_STATES: readonly [ "draft", "pending_review", "approved", "rejected", "superseded", "archived" ]; type XenoArtifactState = (typeof XENO_ARTIFACT_STATES)[number]; declare const XENO_ARTIFACT_SENSITIVITIES: readonly [ "public", "internal", "confidential", "restricted" ]; type XenoArtifactSensitivity = (typeof XENO_ARTIFACT_SENSITIVITIES)[number]; interface XenoContentHash { algorithm: "sha256" | `custom:${string}`; value: string; } type XenoArtifactStorageReference = { type: "inline"; text?: string; base64?: string; } | { type: "file"; path: string; } | { type: "blob"; uri: string; } | { type: "git"; commit: string; path: string; repositoryId?: string; } | { type: "url"; url: string; expiresAt?: string; } | { type: "external"; provider: string; locator: string; }; interface XenoArtifactContent { hash: XenoContentHash; sizeBytes: number; storage: XenoArtifactStorageReference; encoding?: "utf8" | "base64" | "binary" | `custom:${string}`; redactedPreview?: string; } interface XenoArtifactIdentity { runId?: string; sessionId?: string; turnId?: string; taskId?: string; agentId?: string; workspaceId?: string; repositoryId?: string; } declare const XENO_ARTIFACT_ACTOR_KINDS: readonly [ "agent", "tool", "user", "system", "integration" ]; type XenoArtifactActorKind = (typeof XENO_ARTIFACT_ACTOR_KINDS)[number]; interface XenoArtifactActor { kind: XenoArtifactActorKind; id: string; displayName?: string; profileFingerprint?: string; } interface XenoArtifactProvenance { producer: XenoArtifactActor; eventId?: string; toolCallId?: string; operationId?: string; executionContractFingerprint?: string; capabilityLeaseIds?: string[]; sourceArtifactIds?: string[]; attributes?: XenoJsonObject; } declare const XENO_EVIDENCE_NODE_TYPES: readonly [ "requirement", "design-decision", "risk", "task", "agent", "run", "tool-call", "edit", "commit", "test-case", "test-run", "finding", "approval", "artifact", "release", "claim" ]; type XenoEvidenceNodeType = (typeof XENO_EVIDENCE_NODE_TYPES)[number] | `custom:${string}`; declare const XENO_EVIDENCE_EDGE_TYPES: readonly [ "decomposes", "depends_on", "implements", "changes", "tests", "verifies", "finds", "fixes", "reviews", "approves", "rejects", "supersedes", "derived_from", "produced_by", "supports_claim", "contradicts_claim", "released_as" ]; type XenoEvidenceEdgeType = (typeof XENO_EVIDENCE_EDGE_TYPES)[number] | `custom:${string}`; interface XenoEvidenceReference { type: XenoEvidenceNodeType; id: string; revision?: number; } interface XenoArtifactRelationship { relation: XenoEvidenceEdgeType; target: XenoEvidenceReference; description?: string; attributes?: XenoJsonObject; } type XenoArtifactAnchor = { kind: "file"; path: string; repositoryId?: string; commit?: string; } | { kind: "source-line"; path: string; startLine: number; endLine?: number; repositoryId?: string; commit?: string; } | { kind: "diff-hunk"; path: string; hunkId: string; artifactId?: string; revision?: number; } | { kind: "symbol"; path: string; symbol: string; repositoryId?: string; commit?: string; } | { kind: "dom-node"; pageId: string; selector?: string; accessibilityId?: string; snapshotArtifactId?: string; } | { kind: "timeline"; startMs: number; endMs?: number; recordingArtifactId: string; } | { kind: "region"; x: number; y: number; width: number; height: number; mediaArtifactId: string; } | { kind: "artifact"; artifactId: string; revision?: number; } | { kind: `custom:${string}`; data: XenoJsonObject; }; interface XenoArtifactRetention { policyId?: string; retainUntil?: string; legalHold?: boolean; } interface XenoArtifactEnvelope { schemaVersion: typeof XENO_ARTIFACT_SCHEMA_VERSION; artifactId: string; revision: number; kind: XenoArtifactKind; title: string; description?: string; state: XenoArtifactState; createdAt: string; updatedAt?: string; mediaType: string; sensitivity: XenoArtifactSensitivity; identity?: XenoArtifactIdentity; content: XenoArtifactContent; provenance: XenoArtifactProvenance; relationships?: XenoArtifactRelationship[]; anchors?: XenoArtifactAnchor[]; predecessorRevision?: number; accessPolicyId?: string; retention?: XenoArtifactRetention; extensions?: Record; } interface XenoArtifactLifecycleEvent { schemaVersion: typeof XENO_ARTIFACT_SCHEMA_VERSION; eventId: string; artifactId: string; revision: number; sequence: number; recordedAt: string; actor: XenoArtifactActor; fromState: XenoArtifactState | null; toState: XenoArtifactState; reason?: string; reviewEventId?: string; } type XenoArtifactReviewDecision = "approved" | "rejected" | "changes_requested"; interface XenoArtifactReviewEventBase { schemaVersion: typeof XENO_ARTIFACT_SCHEMA_VERSION; eventId: string; artifactId: string; artifactRevision: number; artifactHash: XenoContentHash; sequence: number; recordedAt: string; actor: XenoArtifactActor; } type XenoArtifactReviewEvent = (XenoArtifactReviewEventBase & { type: "review-requested"; reviewerIds?: string[]; message?: string; }) | (XenoArtifactReviewEventBase & { type: "comment-added"; commentId: string; body: string; anchor?: XenoArtifactAnchor; parentCommentId?: string; }) | (XenoArtifactReviewEventBase & { type: "comment-resolved" | "comment-reopened"; commentId: string; reason?: string; }) | (XenoArtifactReviewEventBase & { type: "decision-recorded"; decision: XenoArtifactReviewDecision; rationale?: string; scope?: XenoArtifactAnchor; }) | (XenoArtifactReviewEventBase & { type: "review-withdrawn"; reason?: string; }); type XenoArtifactReviewEventInput = Omit, "schemaVersion" | "eventId" | "sequence" | "recordedAt"> | Omit, "schemaVersion" | "eventId" | "sequence" | "recordedAt"> | Omit, "schemaVersion" | "eventId" | "sequence" | "recordedAt"> | Omit, "schemaVersion" | "eventId" | "sequence" | "recordedAt"> | Omit, "schemaVersion" | "eventId" | "sequence" | "recordedAt">; interface XenoArtifactReviewSummary { status: "not_requested" | "pending" | "approved" | "rejected" | "changes_requested" | "withdrawn"; totalComments: number; unresolvedComments: number; latestDecision?: XenoArtifactReviewDecision; latestDecisionEventId?: string; scopedDecisionCount?: number; lastReviewedAt?: string; } interface XenoArtifactRecord { artifact: XenoArtifactEnvelope; recordVersion: number; etag: string; lifecycleEvents: XenoArtifactLifecycleEvent[]; reviewEvents: XenoArtifactReviewEvent[]; reviewSummary: XenoArtifactReviewSummary; } interface XenoArtifactListQuery { artifactIds?: string[]; kinds?: XenoArtifactKind[]; states?: XenoArtifactState[]; runId?: string; sessionId?: string; turnId?: string; taskId?: string; workspaceId?: string; repositoryId?: string; producerId?: string; sensitivity?: XenoArtifactSensitivity[]; includeSuperseded?: boolean; } interface PromptSectionContext { readonly systemPrompt: string; readonly taskPrompt?: string; readonly iteration: number; readonly model: string; } interface PromptSectionProvider { name: string; order?: number; provide(ctx: PromptSectionContext): string | null | undefined; } type PermissionProfileName = "default" | "read-only" | "trusted-dev"; interface AgentToolPolicy { mode?: "inherit" | "none" | "readOnly" | "default" | "fullAccess"; allow?: string[]; deny?: string[]; } type AgentDefinitionIsolation = "none" | "worktree"; declare const XENO_AGENT_PROFILE_SCHEMA_VERSION: 2; type AgentProfileKind = "primary" | "subagent" | "service"; type AgentProfileCollaborationMode = "chat" | "plan" | "execute" | "review"; type AgentProfileMemoryScope = "none" | "session" | "project" | "user"; type AgentProfileSoulMode = "disabled" | "read" | "learn"; type AgentProfileIsolation = AgentDefinitionIsolation | "container"; declare const AGENT_PROFILE_EXTERNAL_ACTIONS: readonly [ "publish", "deploy", "push", "send", "purchase", "sign", "file-legal", "change-infrastructure" ]; type AgentProfileExternalAction = (typeof AGENT_PROFILE_EXTERNAL_ACTIONS)[number]; type AgentProfileActionDecision = "allow" | "ask" | "deny"; type AgentProfileEvidenceKind = "sources" | "file-references" | "tests" | "typecheck" | "build" | "diff" | "deployment-proof" | "human-review"; interface AgentProfileSkillPolicy { preload: string[]; allow?: string[]; deny: string[]; } interface AgentProfileExternalActionPolicy { default: AgentProfileActionDecision; overrides?: Partial>; requireCurrentTurnApproval: AgentProfileExternalAction[]; } interface AgentProfileCapabilities { tools: AgentToolPolicy; skills: AgentProfileSkillPolicy; hooks: string[]; mcpServers?: string[]; delegatedAgents?: string[]; permissionProfile: PermissionProfileName; externalActions: AgentProfileExternalActionPolicy; } interface AgentProfileMemoryPolicy { scope: AgentProfileMemoryScope; role: string; soul: AgentProfileSoulMode; } interface AgentProfileExecutionPolicy { defaultMode: AgentProfileCollaborationMode; allowedModes: AgentProfileCollaborationMode[]; isolation: AgentProfileIsolation; allowBackground: boolean; planForComplexTasks: boolean; defaultDryRun: boolean; maxTurns?: number; } interface AgentProfileCompletionPolicy { evidence: AgentProfileEvidenceKind[]; requirePrimarySources: boolean; requireCurrentInformation: boolean; requireHumanReview: boolean; stopConditions: string[]; } interface AgentProfilePresentation { label: string; color: string; glyph: string; } interface AgentProfileV2 { schemaVersion: typeof XENO_AGENT_PROFILE_SCHEMA_VERSION; id: string; version: string; displayName: string; description: string; kind: AgentProfileKind; prompt: string; model?: { preferred?: string; effort?: "low" | "medium" | "high"; }; capabilities: AgentProfileCapabilities; memory: AgentProfileMemoryPolicy; execution: AgentProfileExecutionPolicy; completion: AgentProfileCompletionPolicy; presentation: AgentProfilePresentation; tags: string[]; } interface CompiledAgentProfile { schemaVersion: typeof XENO_AGENT_PROFILE_SCHEMA_VERSION; profile: AgentProfileV2; fingerprint: string; boundarySources: string[]; capabilities: AgentProfileCapabilities; memory: AgentProfileMemoryPolicy; execution: AgentProfileExecutionPolicy; completion: AgentProfileCompletionPolicy; promptSection: PromptSectionProvider; } declare const XENO_CAPABILITY_LEASE_SCHEMA_VERSION: 1; type XenoCapabilityKind = "filesystem-read" | "filesystem-write" | "process-execute" | "network-connect" | "secret-use" | "external-action" | "browser-read" | "browser-act" | "computer-observe" | "computer-act" | "tool-invoke" | `custom:${string}`; type XenoCapabilityEffect = "read" | "write" | "execute" | "external"; type XenoCapabilityLeaseState = "requested" | "active" | "denied" | "revoked" | "expired" | "exhausted"; interface XenoCapabilitySubject { runId: string; agentId: string; turnId?: string; toolName?: string; operationId?: string; } interface XenoCapabilityScope { kind: XenoCapabilityKind; effect: XenoCapabilityEffect; operations: string[]; resources?: string[]; destinations?: string[]; secretIds?: string[]; externalAction?: AgentProfileExternalAction; governingToolName?: string; } interface XenoCapabilityLeaseApprovalContext { turnId?: string; surface: "cli" | "hub" | "ide" | "api" | "hosted" | `custom:${string}`; promptHash?: string; messageId?: string; } interface XenoCapabilityLease { schemaVersion: typeof XENO_CAPABILITY_LEASE_SCHEMA_VERSION; leaseId: string; version: number; state: XenoCapabilityLeaseState; subject: XenoCapabilitySubject; scope: XenoCapabilityScope; reason: string; requestedAt: string; requestExpiresAt: string; durationMs: number; activatedAt?: string; expiresAt?: string; expiredAt?: string; deniedAt?: string; revokedAt?: string; exhaustedAt?: string; maxUses: number; useCount: number; childInheritance: "none" | "explicit"; approvalRequirement: "principal" | "current-turn"; requestedBy: XenoArtifactActor; approvedBy?: XenoArtifactActor; deniedBy?: XenoArtifactActor; revokedBy?: XenoArtifactActor; approvalContext?: XenoCapabilityLeaseApprovalContext; profileFingerprint: string; policyFingerprints: string[]; auditEventIds?: string[]; evidenceArtifactIds?: string[]; } interface XenoCapabilityUse { subject: XenoCapabilitySubject; kind: XenoCapabilityKind; operation: string; resource?: string; destination?: string; secretId?: string; externalAction?: AgentProfileExternalAction; } declare const WEB_CONTEXT_TOOL_RESULT_SCHEMA: "xeno.web-context.tool-result.v1"; interface WebContextEvidenceProjection { evidenceId: string; requestId: string; sourceUrl: string; finalUrl?: string; citations: Array<{ url: string; title?: string; artifactId?: string; }>; } interface WebContextToolResult { schemaVersion: typeof WEB_CONTEXT_TOOL_RESULT_SCHEMA; operation: "search" | "fetch"; requestId: string; evidence: WebContextEvidenceProjection; job?: { jobId: string; state: string; }; artifact?: { artifactId: string; mediaType: string; bytes: number; }; jobProgress?: WebJobProgress; } interface ToolDefinition { name: string; description: string; input_schema: { type: "object"; properties: Record; required?: string[]; additionalProperties?: boolean | Record; [keyword: string]: unknown; }; } interface ImageUrlBlock { type: "image_url"; image_url: { url: string; detail?: "auto" | "low" | "high"; }; } interface ResourceContentBlock { type: "resource"; uri?: string; mimeType?: string; text?: string; data?: string; } type ToolAssistantContentBlock = TextBlock | ImageUrlBlock | ResourceContentBlock; type ToolOperationState = "registered" | "starting" | "running_foreground" | "running_background" | "waiting_for_input" | "stalled" | "verifying" | "completed" | "failed" | "timed_out" | "cancelled" | "orphaned"; type ToolCompletionPolicy = "await" | "observe" | "detach"; interface ExpectedOutputContract { path: string; kind?: "file" | "directory"; nonEmpty?: boolean; } interface ToolEvidence { id: string; kind: "artifact" | "process" | "verification"; status: "pending" | "verified" | "failed"; path?: string; observedAt: string; operationId: string; detail?: Record; } interface ToolOperationSnapshot { schemaVersion: 1; operationId: string; turnId: string; generation: number; toolCallId: string; toolName: string; ownerSessionId?: string; state: ToolOperationState; terminal: boolean; presentation: "foreground" | "background"; completionPolicy: ToolCompletionPolicy; promotable: boolean; processId?: string; taskId?: string; displayName?: string; pid?: number; commandFingerprint?: string; outputPath?: string; startedAt: string; lastActivityAt: string; deadlineAt?: string; elapsedMs: number; idleMs: number; outputBytes: number; nextOffset: number; exitCode?: number | null; completionReason?: string; suggestedNextAction?: string; expectedOutputs?: ExpectedOutputContract[]; evidence?: ToolEvidence[]; } interface ToolProgressUpdate { activity?: "stdout" | "stderr" | "input" | "waiting_for_input" | "heartbeat" | "state"; message?: string; bytes?: number; outputBytes?: number; nextOffset?: number; webContextProgress?: WebJobProgress; } interface ToolAuthorizationReceipt { turnId: string; toolCallId: string; toolName: string; iteration: number; policy: { allowed: true; reason: string; temporaryOverride: boolean; }; permission: { allowed: true; reason: string; }; } interface ToolResult { success: boolean; output: string; error?: string; errorCode?: string; errorDetails?: Record; assistantContent?: ToolAssistantContentBlock[]; assistantOnlyContent?: ToolAssistantContentBlock[]; operation?: ToolOperationSnapshot; evidence?: ToolEvidence[]; webContext?: WebContextToolResult; retryable?: boolean; } interface ToolExecutionContext { signal?: AbortSignal; operationId?: string; reportProgress?: (event: ToolProgressUpdate) => void; authorization?: ToolAuthorizationReceipt; } type ToolExecutor = (input: Record, context?: ToolExecutionContext) => Promise; interface ToolPolicyProjection { observabilityInput: Record; permissionInput: Record; permissionPreview?: string; approvalKey?: string; riskLevel?: "low" | "medium" | "high"; } interface RegisteredTool { definition: ToolDefinition; execute: ToolExecutor; projectPolicyInput?: (input: Record) => ToolPolicyProjection | { error: ToolResult; }; } interface TextBlock { type: "text"; text: string; } interface AgentCapabilities { terminal: boolean; fileRead: boolean; fileWrite: boolean; appLaunch: boolean; } type ExecutionSecurityLevel = "policy-only" | "process-hardened" | "contained"; type ExecutionTrustMode = "trusted-workspace" | "untrusted"; interface ContainmentCertificationBinding { manifestPath: string; candidateSha256: string; expectedCertificationId?: string; trustedPublicKeys: Record; } interface PolicyEnforcerConfig { allowedDirectories: string[]; workingDirectory?: string; capabilities: AgentCapabilities; executionLevel?: ExecutionSecurityLevel; trustMode?: ExecutionTrustMode; requireOsContainment?: boolean; allowNetwork?: boolean; containmentCertification?: ContainmentCertificationBinding; deniedDirectories?: string[]; containedEnvironmentAllowlist?: string[]; temporaryDirectories?: string[]; workspace?: { id: string; name: string; }; team?: { id: string; name: string; }; } interface ExecutionSecurityCapabilities { policyEnforcement: boolean; restrictedIdentity: boolean; lowIntegrity: boolean; processTreeControl: boolean; filesystemIsolation: boolean; networkIsolation: boolean; inheritedHandleAllowlist: boolean; environmentSanitization: boolean; } interface ProcessContainmentStatus { available: boolean; requestedLevel: ExecutionSecurityLevel; effectiveLevel: ExecutionSecurityLevel | "unavailable"; adapter: "policy-enforcer" | "windows-restricted-token-job" | "linux-bubblewrap" | "microsoft-mxc" | "unavailable"; isolation: "policy-only" | "process-hardening" | "filesystem-network" | "none"; certified: boolean; capabilities: ExecutionSecurityCapabilities; limitations: string[]; reason: string; adapterVersion?: string; backend?: string; isolationTier?: string; nativeBinarySha256?: string; certificationArtifactId?: string; certificationManifestSha256?: string; needsHostPreparation?: boolean; } declare const XENO_SECURE_EXECUTION_CONTRACT_SCHEMA_VERSION: 1; type XenoExecutionEnforcement = "none" | "policy" | "os"; interface XenoExecutionIdentity { runId: string; agentId: string; sessionId?: string; turnId?: string; taskId?: string; workspaceId?: string; } interface XenoFilesystemExecutionPolicy { enforcement: XenoExecutionEnforcement; readRoots: string[]; writeRoots: string[]; executeRoots: string[]; deniedRoots: string[]; } interface XenoNetworkDestination { scheme?: "http" | "https" | "ws" | "wss" | "tcp" | `custom:${string}`; host: string; port?: number; } interface XenoNetworkExecutionPolicy { enforcement: XenoExecutionEnforcement; default: "deny" | "allow"; allowDestinations: XenoNetworkDestination[]; denyDestinations: XenoNetworkDestination[]; dns: "disabled" | "system" | "proxy-only"; proxyUrl?: string; downloads: "deny" | "prompt" | "allow"; acknowledgedUnrestricted: boolean; } interface XenoProcessExecutionPolicy { processTreeControl: boolean; cleanup: "kill-tree" | "best-effort"; inheritedHandleAllowlist: boolean; maximumProcesses?: number; maximumMemoryBytes?: number; maximumCpuTimeMs?: number; } interface XenoEnvironmentExecutionPolicy { inheritance: "none" | "allowlist"; allowedKeys: string[]; deniedKeys: string[]; } interface XenoSecretProjection { secretId: string; target: "environment" | "file" | "stdin" | "broker"; targetName?: string; } interface XenoExternalActionExecutionPolicy { default: AgentProfileActionDecision; overrides: Partial>; requireCurrentTurnApproval: AgentProfileExternalAction[]; requireCapabilityLease: true; } interface XenoBrowserExecutionPolicy { mode: "none" | "read" | "act"; profile: "ephemeral" | "isolated-persistent"; allowedDomains: string[]; readAllowedDomains: string[]; actAllowedDomains: string[]; deniedDomains: string[]; allowedSchemes: Array<"http" | "https">; allowedPorts: number[]; redirectPolicy: "deny" | "same-origin" | "policy"; allowLoopbackDevelopment: boolean; downloads: "deny" | "prompt" | "allow"; uploads: "deny" | "prompt" | "allow"; recording: "disabled" | "bounded"; } interface XenoComputerExecutionPolicy { mode: "none" | "observe" | "act"; allowedApplications: string[]; sensitiveRegionRedaction: boolean; humanStopRequired: boolean; } interface XenoExecutionAdapterIdentity { id: string; version: string; platform: NodeJS.Platform | string; architecture: string; certified: boolean; certificationArtifactId?: string; capabilities: ExecutionSecurityCapabilities; limitations: string[]; } interface XenoSecureExecutionContract { schemaVersion: typeof XENO_SECURE_EXECUTION_CONTRACT_SCHEMA_VERSION; contractId: string; fingerprint: string; createdAt: string; expiresAt?: string; identity: XenoExecutionIdentity; requestedLevel: ExecutionSecurityLevel; effectiveLevel: ExecutionSecurityLevel; trustMode: ExecutionTrustMode; profile: { id: string; version: string; fingerprint: string; permissionProfile: string; }; filesystem: XenoFilesystemExecutionPolicy; network: XenoNetworkExecutionPolicy; process: XenoProcessExecutionPolicy; environment: XenoEnvironmentExecutionPolicy; secrets: XenoSecretProjection[]; externalActions: XenoExternalActionExecutionPolicy; browser: XenoBrowserExecutionPolicy; computer: XenoComputerExecutionPolicy; capabilityLeaseIds: string[]; adapter: XenoExecutionAdapterIdentity; auditEventIds?: string[]; } declare const XENO_AUTOMATION_PROTOCOL_VERSION: 1; type XenoAutomationSurface = "browser" | "computer"; type XenoAutomationEffect = "observe" | "act"; type XenoBrowserAutomationOperation = "browser.navigate" | "browser.back" | "browser.forward" | "browser.reload" | "browser.wait" | "browser.snapshot" | "browser.screenshot" | "browser.locate" | "browser.click" | "browser.type" | "browser.key" | "browser.select" | "browser.scroll" | "browser.tabs.list" | "browser.tabs.open" | "browser.tabs.close" | "browser.console.read" | "browser.network.read" | "browser.storage.read" | "browser.page-errors.read" | "browser.upload" | "browser.download" | "browser.record.start" | "browser.record.stop"; type XenoComputerAutomationOperation = "computer.observe" | "computer.screenshot" | "computer.window-state" | "computer.point" | "computer.click" | "computer.double-click" | "computer.right-click" | "computer.drag" | "computer.type" | "computer.key" | "computer.scroll" | "computer.wait" | "computer.launch"; type XenoAutomationOperation = XenoBrowserAutomationOperation | XenoComputerAutomationOperation; interface XenoAutomationIdentity { runId: string; agentId: string; sessionId?: string; turnId?: string; taskId?: string; workspaceId?: string; } interface XenoAutomationTarget { url?: string; origin?: string; domain?: string; port?: number; tabId?: string; pageId?: string; deviceId?: string; applicationId?: string; displayId?: string; resource?: string; } interface XenoAutomationEvidencePolicy { before: "required" | "optional" | "disabled"; after: "required" | "optional" | "disabled"; recording: "required" | "optional" | "disabled"; sensitivity: XenoArtifactSensitivity; retainUntil?: string; legalHold?: boolean; } interface XenoAutomationRequest { protocolVersion: typeof XENO_AUTOMATION_PROTOCOL_VERSION; operationId: string; idempotencyKey: string; requestedAt: string; identity: XenoAutomationIdentity; governingToolName: string; operation: XenoAutomationOperation; parameters: XenoJsonObject; declaredTarget?: XenoAutomationTarget; executionContract: XenoSecureExecutionContract; capabilityLeaseId: string; expectedLeaseVersion: number; evidencePolicy?: Partial; } interface XenoAutomationAdapterManifest { protocolVersion: typeof XENO_AUTOMATION_PROTOCOL_VERSION; adapterId: string; adapterVersion: string; platform: string; architecture: string; operations: XenoAutomationOperation[]; targetBinding: "atomic-preflight"; profileIsolation: "none" | "ephemeral" | "isolated-persistent" | "both"; supports: { accessibilitySnapshots: boolean; screenshots: boolean; recordings: boolean; consoleInspection: boolean; networkInspection: boolean; storageInspection: boolean; pageErrorInspection: boolean; visibleCoControl: boolean; deterministicHandback: boolean; immediateStop: boolean; sensitiveRegionRedaction: boolean; }; policyEnforcement: { domain: boolean; scheme: boolean; port: boolean; redirect: boolean; upload: boolean; download: boolean; }; certified: boolean; certificationArtifactId?: string; limitations: string[]; } type XenoAutomationEvidencePhase = "before" | "action" | "after" | "recording" | "diagnostic"; type XenoAutomationEvidenceContent = { type: "text"; text: string; } | { type: "base64"; base64: string; } | { type: "reference"; storage: Exclude; hash: XenoArtifactContent["hash"]; sizeBytes: number; encoding?: XenoArtifactContent["encoding"]; }; interface XenoAutomationEvidenceInput { evidenceId: string; phase: XenoAutomationEvidencePhase; kind: Extract | `custom:${string}`; title: string; description?: string; mediaType: string; content: XenoAutomationEvidenceContent; sensitivity?: XenoArtifactSensitivity; redactedPreview?: string; anchors?: XenoArtifactEnvelope["anchors"]; extensions?: Record; } interface XenoAutomationPreflight { token: string; preparedAt: string; expiresAt: string; observedTarget: XenoAutomationTarget; evidence?: XenoAutomationEvidenceInput[]; adapterState?: XenoJsonObject; } interface XenoAutomationExecutionGrant { contractFingerprint: string; lease: XenoCapabilityLease; capabilityUse: XenoCapabilityUse; } interface XenoAutomationAdapterExecutionResult { operationId?: string; status: "ok" | "denied" | "cancelled" | "error"; startedAt: string; completedAt: string; observedTarget: XenoAutomationTarget; data?: XenoJsonValue; evidence?: XenoAutomationEvidenceInput[]; error?: { code: string; message: string; retryable?: boolean; }; } interface XenoAutomationAdapter { manifest(): Promise | XenoAutomationAdapterManifest; preflight(request: XenoAutomationRequest, signal: AbortSignal): Promise; execute(request: XenoAutomationRequest, preflight: XenoAutomationPreflight, grant: XenoAutomationExecutionGrant, signal: AbortSignal): Promise; stop?(operationId: string, reason: string): Promise; } interface XenoAutomationLeaseAuthority { consume(leaseId: string, expectedVersion: number, use: XenoCapabilityUse): Promise | XenoCapabilityLease; } interface XenoAutomationExecutionResult { replayed?: boolean; operationId: string; status: "ok" | "denied" | "cancelled" | "error" | "evidence-incomplete"; effect: XenoAutomationEffect; startedAt: string; completedAt: string; adapter: Pick; target: XenoAutomationTarget; data?: XenoJsonValue; artifacts: XenoArtifactEnvelope[]; lease: { leaseId: string; version: number; state: XenoCapabilityLease["state"]; useCount: number; }; error?: { code: string; message: string; retryable?: boolean; }; } interface XenoAutomationConformanceCheck { id: string; status: "pass" | "fail"; message: string; } interface XenoAutomationConformanceReport { protocolVersion: typeof XENO_AUTOMATION_PROTOCOL_VERSION; adapter: Pick; generatedAt: string; passed: boolean; checks: XenoAutomationConformanceCheck[]; } interface XenoAutomationOperationDescriptor { operation: XenoAutomationOperation; surface: XenoAutomationSurface; effect: XenoAutomationEffect; evidence: Pick; } declare const XENO_AUTOMATION_OPERATIONS: readonly XenoAutomationOperation[]; declare function describeXenoAutomationOperation(operation: XenoAutomationOperation): XenoAutomationOperationDescriptor; declare function isXenoAutomationOperation(value: string): value is XenoAutomationOperation; type XenoAutomationErrorCode = "AUTOMATION_REQUEST_INVALID" | "AUTOMATION_CONTRACT_INVALID" | "AUTOMATION_CONTRACT_EXPIRED" | "AUTOMATION_IDENTITY_MISMATCH" | "AUTOMATION_OPERATION_UNSUPPORTED" | "AUTOMATION_POLICY_DENIED" | "AUTOMATION_TARGET_CHANGED" | "AUTOMATION_PREFLIGHT_INVALID" | "AUTOMATION_EVIDENCE_REQUIRED" | "AUTOMATION_EVIDENCE_INVALID" | "AUTOMATION_EVIDENCE_PERSISTENCE_FAILED" | "AUTOMATION_CANCELLED" | "AUTOMATION_TRANSPORT_ERROR" | "AUTOMATION_RESPONSE_INVALID" | "AUTOMATION_OPERATION_CONFLICT" | "AUTOMATION_OUTCOME_PENDING"; declare class XenoAutomationError extends Error { readonly code: XenoAutomationErrorCode; readonly detail?: Record | undefined; constructor(code: XenoAutomationErrorCode, message: string, detail?: Record | undefined, options?: ErrorOptions); } declare function assertValidXenoAutomationRequest(request: XenoAutomationRequest): void; declare function assertValidXenoAutomationAdapterManifest(manifest: XenoAutomationAdapterManifest): void; declare function assertXenoAutomationAuthority(request: XenoAutomationRequest, manifest: XenoAutomationAdapterManifest, observedTarget: XenoAutomationTarget): void; declare function buildXenoAutomationCapabilityUse(request: XenoAutomationRequest, target: XenoAutomationTarget): XenoCapabilityUse; declare function resolveXenoAutomationEvidencePolicy(request: XenoAutomationRequest): XenoAutomationEvidencePolicy; interface XenoArtifactMutationOptions { expectedRecordVersion?: number; } interface XenoArtifactRevisionOptions extends XenoArtifactMutationOptions { actor?: XenoArtifactActor; reason?: string; } interface XenoArtifactTransitionRequest extends XenoArtifactMutationOptions { artifactId: string; revision?: number; toState: XenoArtifactState; actor: XenoArtifactActor; reason?: string; reviewEventId?: string; } interface XenoArtifactAppendReviewRequest extends XenoArtifactMutationOptions { event: XenoArtifactReviewEventInput; } interface XenoArtifactRepository { create(artifact: XenoArtifactEnvelope): Promise; createRevision(artifact: XenoArtifactEnvelope, options?: XenoArtifactRevisionOptions): Promise; get(artifactId: string, revision?: number): Promise; require(artifactId: string, revision?: number): Promise; list(query?: XenoArtifactListQuery): Promise; listRevisions(artifactId: string): Promise; transition(request: XenoArtifactTransitionRequest): Promise; appendReviewEvent(request: XenoArtifactAppendReviewRequest): Promise; } interface MaterializeXenoAutomationEvidenceOptions { request: XenoAutomationRequest; manifest: XenoAutomationAdapterManifest; policy: XenoAutomationEvidencePolicy; evidence: readonly XenoAutomationEvidenceInput[]; now?: () => string; } declare function materializeXenoAutomationEvidence(options: MaterializeXenoAutomationEvidenceOptions): XenoArtifactEnvelope[]; declare function persistXenoAutomationEvidence(repository: XenoArtifactRepository | undefined, artifacts: readonly XenoArtifactEnvelope[]): Promise; declare function assertRequiredXenoAutomationEvidence(evidence: readonly XenoAutomationEvidenceInput[], policy: XenoAutomationEvidencePolicy, phase: "before" | "after" | "recording"): void; interface XenoAutomationJournalIdentity { operationId: string; fingerprint: string; ownerToken: string; } interface XenoAutomationJournalRecord extends XenoAutomationJournalIdentity { schemaVersion: 1; outcome: { kind: "pending"; } | { kind: "result"; artifactId: string; sha256: string; } | { kind: "failed"; code: string; }; } interface XenoAutomationExecutionJournal { get(operationId: string): Promise; begin(identity: XenoAutomationJournalIdentity): Promise<{ claimed: boolean; record: XenoAutomationJournalRecord; }>; finish(identity: XenoAutomationJournalIdentity, outcome: Exclude): Promise; } declare function openSqliteAutomationExecutionJournal(path: string): Promise; declare class SqliteAutomationExecutionJournal implements XenoAutomationExecutionJournal { private readonly database; private closed; constructor(database: DatabaseSync); begin(identity: XenoAutomationJournalIdentity): Promise<{ claimed: boolean; record: XenoAutomationJournalRecord; }>; get(operationId: string): Promise; finish(identity: XenoAutomationJournalIdentity, outcome: Exclude): Promise; close(): void; private read; private transaction; } interface CapabilityMutationAck { lease: XenoCapabilityLease; replayed: boolean; executionDisposition: "dispatch-once" | "receipt-only"; } interface XenoDurableAutomationOptions { journal: XenoAutomationExecutionJournal; artifactRepository: XenoArtifactRepository; assertCurrent(request: Readonly): Promise; consume(commandId: string, leaseId: string, expectedVersion: number, use: XenoCapabilityUse): Promise; } declare function runDurableAutomation(options: XenoDurableAutomationOptions, request: XenoAutomationRequest, fingerprint: string, run: (consumeCommandId: string) => Promise): Promise; declare function pending(): XenoAutomationError; interface XenoGovernedAutomationExecutorOptions { adapter: XenoAutomationAdapter; leaseAuthority?: XenoAutomationLeaseAuthority; durable?: XenoDurableAutomationOptions; artifactRepository?: XenoArtifactRepository; now?: () => string; } declare class XenoGovernedAutomationExecutor { private readonly adapter; private readonly leaseAuthority; private readonly durable; private readonly artifactRepository?; private readonly now; private readonly executions; private readonly active; constructor(options: XenoGovernedAutomationExecutorOptions); execute(request: XenoAutomationRequest, signal?: AbortSignal): Promise; stop(operationId: string, reason?: string): Promise; private executeFresh; private trimIdempotencyRecords; } declare function createXenoAutomationConformanceReport(manifest: XenoAutomationAdapterManifest, now?: () => string): XenoAutomationConformanceReport; declare function assertXenoAutomationAdapterConformant(manifest: XenoAutomationAdapterManifest): void; interface XenoLoopbackAutomationAdapterOptions { baseUrl: string; token: string; timeoutMs?: number; maxResponseBytes?: number; fetch?: typeof globalThis.fetch; } declare class XenoLoopbackAutomationAdapter implements XenoAutomationAdapter { private readonly endpoint; private readonly token; private readonly timeoutMs; private readonly maxResponseBytes; private readonly fetchImpl; constructor(options: XenoLoopbackAutomationAdapterOptions); manifest(): Promise; preflight(request: XenoAutomationRequest, signal: AbortSignal): Promise; execute(request: XenoAutomationRequest, preflight: XenoAutomationPreflight, grant: XenoAutomationExecutionGrant, signal: AbortSignal): Promise; stop(operationId: string, reason: string): Promise; private request; } declare const XENO_BROWSER_CONTROL_PLANE_OPERATIONS: readonly [ "browser.navigate", "browser.back", "browser.forward", "browser.reload", "browser.wait", "browser.snapshot", "browser.screenshot", "browser.locate", "browser.tabs.list", "browser.tabs.open", "browser.console.read", "browser.network.read", "browser.storage.read", "browser.page-errors.read", "browser.click", "browser.type", "browser.key", "browser.select", "browser.scroll", "browser.tabs.close", "browser.upload", "browser.download" ]; interface XenoBrowserControlPlaneAdapterOptions { baseUrl: string; token: string; driver: "browser" | "extension"; fetch?: typeof globalThis.fetch; timeoutMs?: number; } declare class XenoBrowserControlPlaneAdapter implements XenoAutomationAdapter { private readonly options; private readonly base; private readonly fetchImpl; private readonly timeoutMs; constructor(options: XenoBrowserControlPlaneAdapterOptions); manifest(): Promise; preflight(request: XenoAutomationRequest, signal: AbortSignal): Promise; execute(request: XenoAutomationRequest, preflight: XenoAutomationPreflight, _grant: XenoAutomationExecutionGrant, signal: AbortSignal): Promise; stop(_operationId: string, _reason: string): Promise; private resultEvidence; private snapshotEvidence; private call; } interface ToolRegistryOptions { validateInputs?: boolean; toolSchemaMode?: "all" | "demand"; } declare class ToolRegistry { private tools; private compiledSchemas; private changeListeners; private aliasNames; private validateInputs; private readonly toolSchemaMode; private readonly activatedDefinitions; constructor(options?: ToolRegistryOptions); setValidateInputs(enabled: boolean): this; get inputValidationEnabled(): boolean; get schemaLoadingMode(): "all" | "demand"; register(tool: RegisteredTool): void; registerAlias(tool: RegisteredTool): void; registerAll(tools: Iterable): void; unregister(name: string): boolean; onChange(listener: () => void): () => void; private emitChange; get(name: string): RegisteredTool | undefined; getDefinitions(): ToolDefinition[]; getDefinitionsForRequest(): ToolDefinition[]; getCapabilityCatalog(): string; activateMatchingDefinitions(query: string, limit?: number): ToolDefinition[]; private static namespaceOf; getDefinitionsByNamespace(namespace: string): ToolDefinition[]; listNamespaces(): string[]; execute(name: string, input: Record, context?: ToolExecutionContext): Promise; listNames(): string[]; has(name: string): boolean; projectPolicyInput(name: string, input: Record): ToolPolicyProjection | { error: ToolResult; }; get size(): number; private compileDefinition; private assertDefinitionsExportable; } interface XenoGovernedAutomationToolExecution { operation: XenoAutomationOperation; governingToolName: string; operationId: string; idempotencyKey: string; parameters: Record; declaredTarget?: XenoAutomationTarget; authorization: ToolAuthorizationReceipt; signal?: AbortSignal; reportProgress?: ToolExecutionContext["reportProgress"]; } interface XenoGovernedAutomationToolRuntime { execute(input: XenoGovernedAutomationToolExecution): Promise; stop?(operationId: string, reason?: string): Promise | boolean; } interface CreateXenoGovernedAutomationToolsOptions { runtime: XenoGovernedAutomationToolRuntime; operations?: readonly XenoAutomationOperation[]; } declare function createXenoGovernedAutomationTools(options: CreateXenoGovernedAutomationToolsOptions): RegisteredTool[]; interface CliAutomationAuditEvent { eventType: "automation_lease_approved" | "automation_completed" | "automation_failed"; traceId: string; operation: XenoAutomationOperation; operationId: string; leaseId?: string; contractFingerprint?: string; status?: string; artifactIds?: string[]; permissionReason?: string; } interface CliAutomationAuditLoggerPort { append(event: { trace_id: string; event_type: string; actor: "system"; risk_level: "low" | "high"; decision?: "allow"; status: "ok" | "error"; reason?: string; metadata: Record; }): Promise; } interface CliAutomationEnvironment { browser?: { driver: "browser" | "extension"; baseUrl?: string; token?: string; readDomains: string[]; actDomains: string[]; deniedDomains: string[]; ports: number[]; allowLoopbackDevelopment: boolean; uploads: "deny" | "prompt" | "allow"; downloads: "deny" | "prompt" | "allow"; recording: "disabled" | "bounded"; }; computer?: { baseUrl?: string; token?: string; deviceId?: string; allowedApplications: string[]; }; } interface CliAutomationSurfaceStatus { surface: "browser" | "computer"; configured: boolean; available: boolean; certified: boolean; adapterId?: string; adapterVersion?: string; operations: string[]; limitations: string[]; error?: string; } interface CliAutomationStatusReport { schemaVersion: 1; protocolVersion: 1; enabled: boolean; surfaces: CliAutomationSurfaceStatus[]; docs: string; } interface CreateCliGovernedAutomationRuntimeOptions { cwd: () => string; profile: () => CompiledAgentProfile; runId: string; agentId?: string; sessionId?: string; workspaceId?: string; surface: "cli" | "hub" | "ide" | "api" | "hosted"; securityPolicy?: () => PolicyEnforcerConfig | undefined; securityStatus?: ProcessContainmentStatus; safeMode?: boolean; environment?: CliAutomationEnvironment; onAudit?: (event: CliAutomationAuditEvent) => Promise | void; } declare class CliGovernedAutomationRuntime implements XenoGovernedAutomationToolRuntime { private readonly options; private readonly leases; private readonly activeExecutors; private readonly environment; private browserAdapter?; private computerAdapter?; constructor(options: CreateCliGovernedAutomationRuntimeOptions); register(registry: ToolRegistry): number; execute(input: XenoGovernedAutomationToolExecution): Promise; stop(operationId: string, reason?: string): Promise; private securityPolicy; private adapterFor; private audit; } declare function createCliGovernedAutomationRuntime(options: CreateCliGovernedAutomationRuntimeOptions): CliGovernedAutomationRuntime; declare function createCliAutomationAuditSink(logger: CliAutomationAuditLoggerPort | undefined): ((event: CliAutomationAuditEvent) => Promise) | undefined; declare function inspectCliAutomationStatus(environment?: CliAutomationEnvironment): Promise; declare function readCliAutomationEnvironment(env?: NodeJS.ProcessEnv): CliAutomationEnvironment; declare function renderCliAutomationStatus(report: CliAutomationStatusReport): string; type XenoHostAutomationAuditEvent = CliAutomationAuditEvent; type XenoHostAutomationAuditLoggerPort = CliAutomationAuditLoggerPort; type XenoHostAutomationEnvironment = CliAutomationEnvironment; type XenoHostAutomationSurfaceStatus = CliAutomationSurfaceStatus; type XenoHostAutomationStatusReport = CliAutomationStatusReport; type CreateXenoHostGovernedAutomationRuntimeOptions = CreateCliGovernedAutomationRuntimeOptions; export { type CliAutomationAuditEvent, type CliAutomationAuditLoggerPort, type CliAutomationEnvironment, type CliAutomationStatusReport, type CliAutomationSurfaceStatus, CliGovernedAutomationRuntime, type CreateCliGovernedAutomationRuntimeOptions, type CreateXenoGovernedAutomationToolsOptions, type CreateXenoHostGovernedAutomationRuntimeOptions, type MaterializeXenoAutomationEvidenceOptions, SqliteAutomationExecutionJournal, XENO_AUTOMATION_OPERATIONS, XENO_AUTOMATION_PROTOCOL_VERSION, XENO_BROWSER_CONTROL_PLANE_OPERATIONS, type XenoAutomationAdapter, type XenoAutomationAdapterExecutionResult, type XenoAutomationAdapterManifest, type XenoAutomationConformanceCheck, type XenoAutomationConformanceReport, type XenoAutomationEffect, XenoAutomationError, type XenoAutomationErrorCode, type XenoAutomationEvidenceContent, type XenoAutomationEvidenceInput, type XenoAutomationEvidencePhase, type XenoAutomationEvidencePolicy, type XenoAutomationExecutionGrant, type XenoAutomationExecutionJournal, type XenoAutomationExecutionResult, type XenoAutomationIdentity, type XenoAutomationJournalIdentity, type XenoAutomationJournalRecord, type XenoAutomationLeaseAuthority, type XenoAutomationOperation, type XenoAutomationOperationDescriptor, type XenoAutomationPreflight, type XenoAutomationRequest, type XenoAutomationSurface, type XenoAutomationTarget, type XenoBrowserAutomationOperation, XenoBrowserControlPlaneAdapter, type XenoBrowserControlPlaneAdapterOptions, type XenoComputerAutomationOperation, type XenoDurableAutomationOptions, XenoGovernedAutomationExecutor, type XenoGovernedAutomationExecutorOptions, type XenoGovernedAutomationToolExecution, type XenoGovernedAutomationToolRuntime, type XenoHostAutomationAuditEvent, type XenoHostAutomationAuditLoggerPort, type XenoHostAutomationEnvironment, type XenoHostAutomationStatusReport, type XenoHostAutomationSurfaceStatus, CliGovernedAutomationRuntime as XenoHostGovernedAutomationRuntime, XenoLoopbackAutomationAdapter, type XenoLoopbackAutomationAdapterOptions, assertRequiredXenoAutomationEvidence, assertValidXenoAutomationAdapterManifest, assertValidXenoAutomationRequest, assertXenoAutomationAdapterConformant, assertXenoAutomationAuthority, buildXenoAutomationCapabilityUse, createCliAutomationAuditSink, createCliGovernedAutomationRuntime, createXenoAutomationConformanceReport, createXenoGovernedAutomationTools, createCliAutomationAuditSink as createXenoHostAutomationAuditSink, createCliGovernedAutomationRuntime as createXenoHostGovernedAutomationRuntime, describeXenoAutomationOperation, inspectCliAutomationStatus, inspectCliAutomationStatus as inspectXenoHostAutomationStatus, isXenoAutomationOperation, materializeXenoAutomationEvidence, openSqliteAutomationExecutionJournal, pending, persistXenoAutomationEvidence, readCliAutomationEnvironment, readCliAutomationEnvironment as readXenoHostAutomationEnvironment, renderCliAutomationStatus, renderCliAutomationStatus as renderXenoHostAutomationStatus, resolveXenoAutomationEvidencePolicy, runDurableAutomation };