@xenosystem/agent-sdk 0.9.10 → 0.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +15 -15
- package/README.md +511 -511
- package/dist/agents/index.cjs +9 -9
- package/dist/agents/index.d.cts +12 -2
- package/dist/agents/index.d.ts +12 -2
- package/dist/agents/index.js +9 -9
- package/dist/agents/metafile-cjs.json +1 -1
- package/dist/agents/metafile-esm.json +1 -1
- package/dist/artifacts/browser.cjs +1 -1
- package/dist/artifacts/browser.d.cts +2 -2
- package/dist/artifacts/browser.d.ts +2 -2
- package/dist/artifacts/browser.js +1 -1
- package/dist/artifacts/{diff-artifact-C2tQZWcs.d.cts → diff-artifact-CmhmeSu5.d.cts} +87 -7
- package/dist/artifacts/{diff-artifact-C2tQZWcs.d.ts → diff-artifact-CmhmeSu5.d.ts} +87 -7
- package/dist/artifacts/index.cjs +8 -8
- package/dist/artifacts/index.d.cts +22 -5
- package/dist/artifacts/index.d.ts +22 -5
- package/dist/artifacts/index.js +8 -8
- package/dist/artifacts/metafile-cjs.json +1 -1
- package/dist/artifacts/metafile-esm.json +1 -1
- package/dist/automation/index.cjs +2 -2
- package/dist/automation/index.d.cts +98 -7
- package/dist/automation/index.d.ts +98 -7
- package/dist/automation/index.js +2 -2
- package/dist/automation/metafile-cjs.json +1 -1
- package/dist/automation/metafile-esm.json +1 -1
- package/dist/control-plane/index.cjs +7 -7
- package/dist/control-plane/index.d.cts +19 -2
- package/dist/control-plane/index.d.ts +19 -2
- package/dist/control-plane/index.js +7 -7
- package/dist/control-plane/metafile-cjs.json +1 -1
- package/dist/control-plane/metafile-esm.json +1 -1
- package/dist/control-room/metafile-cjs.json +1 -1
- package/dist/control-room/metafile-esm.json +1 -1
- package/dist/electron/index.cjs +143 -143
- package/dist/electron/index.d.cts +25 -4
- package/dist/electron/index.d.ts +25 -4
- package/dist/electron/index.js +141 -141
- package/dist/electron/metafile-cjs.json +1 -1
- package/dist/electron/metafile-esm.json +1 -1
- package/dist/governance/index.cjs +18 -18
- package/dist/governance/index.d.cts +1 -0
- package/dist/governance/index.d.ts +1 -0
- package/dist/governance/index.js +18 -18
- package/dist/governance/metafile-cjs.json +1 -1
- package/dist/governance/metafile-esm.json +1 -1
- package/dist/hooks/index.d.cts +10 -1
- package/dist/hooks/index.d.ts +10 -1
- package/dist/hooks/metafile-cjs.json +1 -1
- package/dist/hooks/metafile-esm.json +1 -1
- package/dist/hosted/index.cjs +1 -1
- package/dist/hosted/index.js +1 -1
- package/dist/hosted/metafile-cjs.json +1 -1
- package/dist/hosted/metafile-esm.json +1 -1
- package/dist/index.cjs +332 -332
- package/dist/index.d.cts +200 -25
- package/dist/index.d.ts +200 -25
- package/dist/index.js +333 -333
- package/dist/intelligence/metafile-cjs.json +1 -1
- package/dist/intelligence/metafile-esm.json +1 -1
- package/dist/mcp/index.cjs +17 -17
- package/dist/mcp/index.d.cts +1 -0
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.js +17 -17
- package/dist/mcp/metafile-cjs.json +1 -1
- package/dist/mcp/metafile-esm.json +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/oracle/index.cjs +1 -1
- package/dist/oracle/index.d.cts +86 -6
- package/dist/oracle/index.d.ts +86 -6
- package/dist/oracle/index.js +1 -1
- package/dist/oracle/metafile-cjs.json +1 -1
- package/dist/oracle/metafile-esm.json +1 -1
- package/dist/providers/index.cjs +10 -10
- package/dist/providers/index.d.cts +1 -0
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.js +10 -10
- package/dist/providers/metafile-cjs.json +1 -1
- package/dist/providers/metafile-esm.json +1 -1
- package/dist/recipes/index.cjs +2 -2
- package/dist/recipes/index.d.cts +10 -1
- package/dist/recipes/index.d.ts +10 -1
- package/dist/recipes/index.js +2 -2
- package/dist/recipes/metafile-cjs.json +1 -1
- package/dist/recipes/metafile-esm.json +1 -1
- package/dist/research/index.cjs +3 -3
- package/dist/research/index.d.cts +86 -6
- package/dist/research/index.d.ts +86 -6
- package/dist/research/index.js +3 -3
- package/dist/research/metafile-cjs.json +1 -1
- package/dist/research/metafile-esm.json +1 -1
- package/dist/session/index.cjs +20 -20
- package/dist/session/index.d.cts +1 -0
- package/dist/session/index.d.ts +1 -0
- package/dist/session/index.js +21 -21
- package/dist/session/metafile-cjs.json +1 -1
- package/dist/session/metafile-esm.json +1 -1
- package/dist/sharing/metafile-cjs.json +1 -1
- package/dist/sharing/metafile-esm.json +1 -1
- package/dist/skills/index.d.cts +1 -0
- package/dist/skills/index.d.ts +1 -0
- package/dist/skills/metafile-cjs.json +1 -1
- package/dist/skills/metafile-esm.json +1 -1
- package/dist/soul/metafile-cjs.json +1 -1
- package/dist/soul/metafile-esm.json +1 -1
- package/dist/terminal/metafile-cjs.json +1 -1
- package/dist/terminal/metafile-esm.json +1 -1
- package/dist/ui/index.d.cts +1 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/metafile-cjs.json +1 -1
- package/dist/ui/metafile-esm.json +1 -1
- package/dist/utils/index.cjs +20 -20
- package/dist/utils/index.d.cts +4 -1
- package/dist/utils/index.d.ts +4 -1
- package/dist/utils/index.js +17 -17
- package/dist/utils/metafile-cjs.json +1 -1
- package/dist/utils/metafile-esm.json +1 -1
- package/native/mxc/LICENSE.microsoft-mxc-sdk.md +20 -20
- package/native/mxc/README.md +25 -25
- package/native/mxc/package.json +58 -58
- package/ownership/CLEAN_ROOM_CONTRIBUTOR_GUIDE.md +63 -63
- package/ownership/evidence/PROPRIETARY-COMMAND-1/implementation-record.md +77 -77
- package/ownership/evidence/PROPRIETARY-COMMAND-1/provenance-review.md +51 -51
- package/ownership/evidence/PROPRIETARY-MEDIA-1/implementation-record.md +131 -131
- package/ownership/evidence/PROPRIETARY-MEDIA-1/provenance-review.md +50 -50
- package/ownership/evidence/PROPRIETARY-PTY-1/implementation-record.md +86 -86
- package/ownership/evidence/PROPRIETARY-PTY-1/provenance-review.md +52 -52
- package/ownership/evidence/PROPRIETARY-RUNTIME-1/implementation-record.md +68 -68
- package/ownership/evidence/PROPRIETARY-RUNTIME-1/provenance-review.md +32 -32
- package/ownership/evidence/PROPRIETARY-TOOLCHAIN-1/implementation-record.md +53 -53
- package/ownership/evidence/PROPRIETARY-TOOLCHAIN-1/provenance-review.md +32 -32
- package/ownership/evidence/PROPRIETARY-UI-1/implementation-record.md +96 -96
- package/ownership/evidence/PROPRIETARY-UI-1/provenance-review.md +46 -46
- package/ownership/ownership-policy.schema.json +192 -192
- package/ownership/templates/clean-room-implementation-record.md +70 -70
- package/ownership/templates/provenance-review.md +51 -51
- package/package.json +23 -22
|
@@ -4,9 +4,45 @@ type XenoJsonValue = XenoJsonPrimitive | XenoJsonObject | XenoJsonValue[];
|
|
|
4
4
|
interface XenoJsonObject {
|
|
5
5
|
[key: string]: XenoJsonValue;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
declare const XENO_BUILTIN_ARTIFACT_KINDS: readonly [
|
|
8
|
+
"plan",
|
|
9
|
+
"requirements",
|
|
10
|
+
"design",
|
|
11
|
+
"task-graph",
|
|
12
|
+
"patch",
|
|
13
|
+
"diff",
|
|
14
|
+
"file",
|
|
15
|
+
"document",
|
|
16
|
+
"diagram",
|
|
17
|
+
"screenshot",
|
|
18
|
+
"recording",
|
|
19
|
+
"browser-snapshot",
|
|
20
|
+
"test-report",
|
|
21
|
+
"review-report",
|
|
22
|
+
"security-report",
|
|
23
|
+
"performance-report",
|
|
24
|
+
"release-report",
|
|
25
|
+
"sbom",
|
|
26
|
+
"provenance",
|
|
27
|
+
"attestation"
|
|
28
|
+
];
|
|
29
|
+
type XenoArtifactKind = (typeof XENO_BUILTIN_ARTIFACT_KINDS)[number] | `custom:${string}`;
|
|
30
|
+
declare const XENO_ARTIFACT_STATES: readonly [
|
|
31
|
+
"draft",
|
|
32
|
+
"pending_review",
|
|
33
|
+
"approved",
|
|
34
|
+
"rejected",
|
|
35
|
+
"superseded",
|
|
36
|
+
"archived"
|
|
37
|
+
];
|
|
38
|
+
type XenoArtifactState = (typeof XENO_ARTIFACT_STATES)[number];
|
|
39
|
+
declare const XENO_ARTIFACT_SENSITIVITIES: readonly [
|
|
40
|
+
"public",
|
|
41
|
+
"internal",
|
|
42
|
+
"confidential",
|
|
43
|
+
"restricted"
|
|
44
|
+
];
|
|
45
|
+
type XenoArtifactSensitivity = (typeof XENO_ARTIFACT_SENSITIVITIES)[number];
|
|
10
46
|
interface XenoContentHash {
|
|
11
47
|
algorithm: "sha256" | `custom:${string}`;
|
|
12
48
|
value: string;
|
|
@@ -51,7 +87,14 @@ interface XenoArtifactIdentity {
|
|
|
51
87
|
workspaceId?: string;
|
|
52
88
|
repositoryId?: string;
|
|
53
89
|
}
|
|
54
|
-
|
|
90
|
+
declare const XENO_ARTIFACT_ACTOR_KINDS: readonly [
|
|
91
|
+
"agent",
|
|
92
|
+
"tool",
|
|
93
|
+
"user",
|
|
94
|
+
"system",
|
|
95
|
+
"integration"
|
|
96
|
+
];
|
|
97
|
+
type XenoArtifactActorKind = (typeof XENO_ARTIFACT_ACTOR_KINDS)[number];
|
|
55
98
|
interface XenoArtifactActor {
|
|
56
99
|
kind: XenoArtifactActorKind;
|
|
57
100
|
id: string;
|
|
@@ -68,8 +111,45 @@ interface XenoArtifactProvenance {
|
|
|
68
111
|
sourceArtifactIds?: string[];
|
|
69
112
|
attributes?: XenoJsonObject;
|
|
70
113
|
}
|
|
71
|
-
|
|
72
|
-
|
|
114
|
+
declare const XENO_EVIDENCE_NODE_TYPES: readonly [
|
|
115
|
+
"requirement",
|
|
116
|
+
"design-decision",
|
|
117
|
+
"risk",
|
|
118
|
+
"task",
|
|
119
|
+
"agent",
|
|
120
|
+
"run",
|
|
121
|
+
"tool-call",
|
|
122
|
+
"edit",
|
|
123
|
+
"commit",
|
|
124
|
+
"test-case",
|
|
125
|
+
"test-run",
|
|
126
|
+
"finding",
|
|
127
|
+
"approval",
|
|
128
|
+
"artifact",
|
|
129
|
+
"release",
|
|
130
|
+
"claim"
|
|
131
|
+
];
|
|
132
|
+
type XenoEvidenceNodeType = (typeof XENO_EVIDENCE_NODE_TYPES)[number] | `custom:${string}`;
|
|
133
|
+
declare const XENO_EVIDENCE_EDGE_TYPES: readonly [
|
|
134
|
+
"decomposes",
|
|
135
|
+
"depends_on",
|
|
136
|
+
"implements",
|
|
137
|
+
"changes",
|
|
138
|
+
"tests",
|
|
139
|
+
"verifies",
|
|
140
|
+
"finds",
|
|
141
|
+
"fixes",
|
|
142
|
+
"reviews",
|
|
143
|
+
"approves",
|
|
144
|
+
"rejects",
|
|
145
|
+
"supersedes",
|
|
146
|
+
"derived_from",
|
|
147
|
+
"produced_by",
|
|
148
|
+
"supports_claim",
|
|
149
|
+
"contradicts_claim",
|
|
150
|
+
"released_as"
|
|
151
|
+
];
|
|
152
|
+
type XenoEvidenceEdgeType = (typeof XENO_EVIDENCE_EDGE_TYPES)[number] | `custom:${string}`;
|
|
73
153
|
interface XenoEvidenceReference {
|
|
74
154
|
type: XenoEvidenceNodeType;
|
|
75
155
|
id: string;
|
|
@@ -247,7 +327,17 @@ interface XenoArtifactListQuery {
|
|
|
247
327
|
sensitivity?: XenoArtifactSensitivity[];
|
|
248
328
|
includeSuperseded?: boolean;
|
|
249
329
|
}
|
|
250
|
-
|
|
330
|
+
declare const AGENT_PROFILE_EXTERNAL_ACTIONS: readonly [
|
|
331
|
+
"publish",
|
|
332
|
+
"deploy",
|
|
333
|
+
"push",
|
|
334
|
+
"send",
|
|
335
|
+
"purchase",
|
|
336
|
+
"sign",
|
|
337
|
+
"file-legal",
|
|
338
|
+
"change-infrastructure"
|
|
339
|
+
];
|
|
340
|
+
type AgentProfileExternalAction = (typeof AGENT_PROFILE_EXTERNAL_ACTIONS)[number];
|
|
251
341
|
type AgentProfileActionDecision = "allow" | "ask" | "deny";
|
|
252
342
|
declare const XENO_CAPABILITY_LEASE_SCHEMA_VERSION: 1;
|
|
253
343
|
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}`;
|
|
@@ -373,6 +463,7 @@ interface ToolOperationSnapshot {
|
|
|
373
463
|
promotable: boolean;
|
|
374
464
|
processId?: string;
|
|
375
465
|
taskId?: string;
|
|
466
|
+
displayName?: string;
|
|
376
467
|
pid?: number;
|
|
377
468
|
commandFingerprint?: string;
|
|
378
469
|
outputPath?: string;
|
package/dist/automation/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var T=1;var L=new Set(["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"]),D=new Set(["browser.click","browser.type","browser.key","browser.select","browser.scroll","browser.tabs.close","browser.upload","browser.download","browser.record.start","browser.record.stop"]),k=new Set(["computer.observe","computer.screenshot","computer.window-state","computer.wait"]),U=new Set(["computer.point","computer.click","computer.double-click","computer.right-click","computer.drag","computer.type","computer.key","computer.scroll","computer.launch"]),M=[...L,...D,...k,...U];function
|
|
1
|
+
var T=1;var L=new Set(["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"]),D=new Set(["browser.click","browser.type","browser.key","browser.select","browser.scroll","browser.tabs.close","browser.upload","browser.download","browser.record.start","browser.record.stop"]),k=new Set(["computer.observe","computer.screenshot","computer.window-state","computer.wait"]),U=new Set(["computer.point","computer.click","computer.double-click","computer.right-click","computer.drag","computer.type","computer.key","computer.scroll","computer.launch"]),M=[...L,...D,...k,...U];function A(e){if(L.has(e))return{operation:e,surface:"browser",effect:"observe",evidence:{before:"disabled",after:e==="browser.wait"||e==="browser.tabs.list"?"optional":"required",recording:"optional"}};if(D.has(e)){let t=e==="browser.record.start"||e==="browser.record.stop";return{operation:e,surface:"browser",effect:"act",evidence:{before:"required",after:"required",recording:e==="browser.record.stop"?"required":"optional"}}}if(k.has(e))return{operation:e,surface:"computer",effect:"observe",evidence:{before:"disabled",after:e==="computer.wait"?"optional":"required",recording:"optional"}};if(U.has(e))return{operation:e,surface:"computer",effect:"act",evidence:{before:"required",after:"required",recording:"optional"}};throw new TypeError(`Unsupported XENO automation operation: ${e}`)}function B(e){return L.has(e)||D.has(e)||k.has(e)||U.has(e)}var a=class extends Error{constructor(r,n,o,i){super(n,i);this.code=r;this.detail=o;this.name="XenoAutomationError"}code;detail};import{createHash as Pe}from"node:crypto";function Oe(e,t){let r=0;for(let n=0;n<t;n+=1)r=r<<1|e>>>n&1;return r}function re(e,t=!1){let r=e.reduce((s,u)=>Math.max(s,u),0);if(r===0){if(t)return{tree:null,codes:e.map(()=>({bits:0,length:0}))};throw new Error("DEFLATE Huffman tree has no symbols")}if(r>15||e.some(s=>!Number.isInteger(s)||s<0||s>15))throw new Error("Invalid DEFLATE Huffman code length");let n=new Uint16Array(r+1);for(let s of e)s>0&&(n[s]+=1);let o=1;for(let s=1;s<=r;s+=1)if(o=(o<<1)-n[s],o<0)throw new Error("Oversubscribed DEFLATE Huffman tree");let i=new Uint32Array(r+1),d=0;for(let s=1;s<=r;s+=1)d=d+n[s-1]<<1,i[s]=d;let c=new Array(r+1),l=e.map(()=>({bits:0,length:0}));for(let s=0;s<e.length;s+=1){let u=e[s];if(u===0)continue;let p=i[u]++,v=Oe(p,u),f=c[u]??new Map;f.set(v,s),c[u]=f,l[s]={bits:v,length:u}}return{tree:{maxBits:r,byLength:c},codes:l}}function xe(){let e=new Array(288).fill(0);for(let t=0;t<=143;t+=1)e[t]=8;for(let t=144;t<=255;t+=1)e[t]=9;for(let t=256;t<=279;t+=1)e[t]=7;for(let t=280;t<=287;t+=1)e[t]=8;return e}var Mt=re(xe()),Bt=re(new Array(32).fill(5));var Ht=String.raw`
|
|
2
2
|
using System;
|
|
3
3
|
using System.ComponentModel;
|
|
4
4
|
using System.Runtime.InteropServices;
|
|
@@ -896,4 +896,4 @@ namespace Xeno.Security
|
|
|
896
896
|
}
|
|
897
897
|
}
|
|
898
898
|
}
|
|
899
|
-
`;var Vt=512*1024,$t=744*60*60*1e3,Ft=Object.freeze(["allowedFilesystemRead","allowedFilesystemWrite","outsideFilesystemReadDenied","outsideFilesystemWriteDenied","unlistedFilesystemReadDenied","unlistedFilesystemWriteDenied","symlinkEscapeDenied","networkDefaultDeny","environmentSecretsExcluded","childProcessPolicyInherited","standardCommandLaunch","processTreeCleanup","timeoutEnforced","hostPolicyRecoveryClean","uiRestrictionsEnforced"]);var Jt=10*6e4,qt=Object.freeze({"win32-x64-wxc-exec.exe":"db0a3422be9e1b396cc1b2547c70ff16b27412438a31c10a45abf370cac86ae2","win32-arm64-wxc-exec.exe":"e430d0e4f44f616e91db684f8d825a6dc93e06a1262b8d00bcaac7522a317aab","linux-x64-lxc-exec":"1efe3f817f5ae9ba9f9f2fd59142e79b2dde7a4dd024576b0ddb635fc87edeb5","linux-arm64-lxc-exec":"fdc00ccecf362ae3ddd8ccad93fd7c8b5b1f03c68897ab05ef1c9f1d327ea3fe","darwin-arm64-mxc-exec-mac":"77c07a86f483ed91dd5be290cd77878ac0c56fe113cdb8c764e7e5201c744ad2"}),Kt=Object.freeze({"win32-x64-wxc-host-prep.exe":"531fb3cdb4b0c964908fd71b71d40961417afb399cbab72f92a25e95309a6416","win32-arm64-wxc-host-prep.exe":"3ef702332286a39153fc259310b5021e3de3c191751d7522684f6475f73af5ef"});var ur=Object.freeze({policyEnforcement:!0,restrictedIdentity:!1,lowIntegrity:!1,processTreeControl:!1,filesystemIsolation:!1,networkIsolation:!1,inheritedHandleAllowlist:!1,environmentSanitization:!0}),fr=Object.freeze({policyEnforcement:!0,restrictedIdentity:!0,lowIntegrity:!0,processTreeControl:!0,filesystemIsolation:!1,networkIsolation:!1,inheritedHandleAllowlist:!0,environmentSanitization:!0}),pr=Object.freeze({policyEnforcement:!0,restrictedIdentity:!0,lowIntegrity:!1,processTreeControl:!0,filesystemIsolation:!1,networkIsolation:!1,inheritedHandleAllowlist:!1,environmentSanitization:!0}),mr=Object.freeze({policyEnforcement:!0,restrictedIdentity:!0,lowIntegrity:!1,processTreeControl:!0,filesystemIsolation:!0,networkIsolation:!0,inheritedHandleAllowlist:!0,environmentSanitization:!0}),hr=Object.freeze({policyEnforcement:!0,restrictedIdentity:!1,lowIntegrity:!1,processTreeControl:!1,filesystemIsolation:!1,networkIsolation:!1,inheritedHandleAllowlist:!1,environmentSanitization:!0});var _e=1,V=class extends Error{constructor(r,n){super(n);this.code=r;this.name="XenoSecureExecutionContractError"}code};function Re(e){let t=[];if(!e||typeof e!="object")return["Contract must be an object"];if(e.schemaVersion!==_e&&t.push("Unsupported schemaVersion"),e.contractId?.trim()||t.push("contractId is required"),(!e.identity?.runId?.trim()||!e.identity?.agentId?.trim())&&t.push("runId and agentId are required"),oe(e.createdAt)||t.push("createdAt must be an ISO 8601 timestamp"),e.expiresAt&&(!oe(e.expiresAt)||Date.parse(e.expiresAt)<=Date.parse(e.createdAt))&&t.push("expiresAt must be later than createdAt"),e.requestedLevel!==e.effectiveLevel&&t.push("requestedLevel and effectiveLevel must match"),e.trustMode==="untrusted"&&e.effectiveLevel!=="contained"&&t.push("Untrusted execution requires contained mode"),e.effectiveLevel==="contained"&&(e.adapter.certified||t.push("Contained mode requires a certified adapter"),e.adapter.certificationArtifactId||t.push("Contained mode requires a certification artifact"),(!e.adapter.capabilities.filesystemIsolation||e.filesystem.enforcement!=="os")&&t.push("Contained mode requires OS filesystem isolation"),(!e.adapter.capabilities.networkIsolation||e.network.enforcement!=="os")&&t.push("Contained mode requires OS network isolation"),e.network.default!=="deny"&&t.push("Contained networking must default deny")),e.network.enforcement==="none"&&!e.network.acknowledgedUnrestricted&&t.push("Unrestricted networking must be explicitly acknowledged"),e.filesystem.writeRoots.length>0&&e.profile.permissionProfile==="read-only"&&t.push("Read-only profiles cannot receive write roots"),(!Array.isArray(e.browser.readAllowedDomains)||!Array.isArray(e.browser.actAllowedDomains))&&t.push("Browser read/action domain policies are required"),(!Array.isArray(e.browser.allowedSchemes)||e.browser.allowedSchemes.some(r=>r!=="http"&&r!=="https"))&&t.push("Browser allowed schemes are invalid"),(!Array.isArray(e.browser.allowedPorts)||e.browser.allowedPorts.some(r=>!Number.isInteger(r)||r<1||r>65535))&&t.push("Browser allowed ports are invalid"),e.secrets.some(r=>!r.secretId.trim())&&t.push("Secret projections require non-empty secret IDs"),new Set(e.secrets.map(r=>r.secretId)).size!==e.secrets.length&&t.push("Secret IDs must be unique"),new Set(e.capabilityLeaseIds).size!==e.capabilityLeaseIds.length&&t.push("Capability lease IDs must be unique"),/^[a-f0-9]{64}$/.test(e.profile.fingerprint)||t.push("Profile fingerprint is invalid"),!/^[a-f0-9]{64}$/.test(e.fingerprint))t.push("Contract fingerprint is invalid");else{let r={...e};delete r.fingerprint,Oe(r)!==e.fingerprint&&t.push("Contract fingerprint does not match content")}return t}function ie(e){let t=Re(e);if(t.length>0){let r=t.includes("Contract fingerprint does not match content");throw new V(r?"SECURITY_CONTRACT_FINGERPRINT_MISMATCH":"SECURITY_CONTRACT_INVALID",t.join("; "))}}function Oe(e){return Ce("sha256").update(JSON.stringify($(e))).digest("hex")}function $(e){return Array.isArray(e)?e.map($):!e||typeof e!="object"?e:Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[r])=>t.localeCompare(r)).map(([t,r])=>[t,$(r)]))}function oe(e){return typeof e=="string"&&e.includes("T")&&Number.isFinite(Date.parse(e))}var Ne=/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,255}$/,ae=1048576;function ue(e){(!e||typeof e!="object")&&A("Automation request must be an object"),e.protocolVersion!==1&&A("Unsupported automation protocol version"),E(e.operationId,"operationId"),E(e.idempotencyKey,"idempotencyKey"),E(e.capabilityLeaseId,"capabilityLeaseId"),E(e.governingToolName,"governingToolName"),(!Number.isSafeInteger(e.expectedLeaseVersion)||e.expectedLeaseVersion<1)&&A("expectedLeaseVersion must be a positive safe integer"),me(e.requestedAt)||A("requestedAt must be an ISO 8601 timestamp"),B(e.operation)||A(`Unsupported automation operation: ${e.operation}`),(!e.parameters||typeof e.parameters!="object"||Array.isArray(e.parameters))&&A("parameters must be a JSON object");let t;try{t=Buffer.byteLength(JSON.stringify(e.parameters),"utf8")}catch(r){throw new a("AUTOMATION_REQUEST_INVALID","parameters must be serializable JSON",void 0,{cause:r})}if(t>ae&&A(`parameters exceed ${ae} bytes`),E(e.identity?.runId,"identity.runId"),E(e.identity?.agentId,"identity.agentId"),ie(e.executionContract),xe(e),!e.executionContract.capabilityLeaseIds.includes(e.capabilityLeaseId))throw new a("AUTOMATION_CONTRACT_INVALID",`Capability lease ${e.capabilityLeaseId} is not bound to the execution contract`);if(e.executionContract.expiresAt&&Date.parse(e.executionContract.expiresAt)<=Date.now())throw new a("AUTOMATION_CONTRACT_EXPIRED","Execution contract has expired")}function _(e){(!e||typeof e!="object")&&m("Adapter manifest must be an object"),e.protocolVersion!==1&&m("Adapter protocol version is unsupported"),C(e.adapterId,"adapterId"),C(e.adapterVersion,"adapterVersion"),C(e.platform,"platform"),C(e.architecture,"architecture"),e.targetBinding!=="atomic-preflight"&&m("Adapter must implement atomic preflight target binding"),(!Array.isArray(e.operations)||e.operations.length===0)&&m("Adapter must declare operations");let t=new Set;for(let r of e.operations)B(r)||m(`Adapter declares unknown operation ${r}`),t.has(r)&&m(`Adapter declares duplicate operation ${r}`),t.add(r);e.certified&&!e.certificationArtifactId&&m("A certified automation adapter requires a certification artifact"),Array.isArray(e.limitations)||m("Adapter limitations must be an array"),e.operations.some(r=>r.startsWith("browser."))&&(!e.policyEnforcement.domain||!e.policyEnforcement.scheme||!e.policyEnforcement.port)&&m("Browser adapters must enforce domain, scheme, and port policy"),e.operations.some(r=>r.startsWith("computer."))&&!e.supports.immediateStop&&m("Computer-use adapters must support immediate stop")}function H(e,t,r){let n=I(e.operation);if(!t.operations.includes(e.operation))throw new a("AUTOMATION_OPERATION_UNSUPPORTED",`Adapter ${t.adapterId} does not support ${e.operation}`);if(n.surface==="browser"){let o=e.executionContract.browser.mode;if(o==="none"||n.effect==="act"&&o!=="act")throw new a("AUTOMATION_POLICY_DENIED",`Execution contract denies ${e.operation}`);if(Pe(e,r,n.effect==="act"),e.operation==="browser.download"&&e.executionContract.browser.downloads==="deny")throw new a("AUTOMATION_POLICY_DENIED","Execution contract denies browser downloads");if(e.operation==="browser.upload"&&e.executionContract.browser.uploads==="deny")throw new a("AUTOMATION_POLICY_DENIED","Execution contract denies browser uploads");if(e.operation.startsWith("browser.record.")&&e.executionContract.browser.recording!=="bounded")throw new a("AUTOMATION_POLICY_DENIED","Execution contract denies browser recording")}else{let o=e.executionContract.computer.mode;if(o==="none"||n.effect==="act"&&o!=="act")throw new a("AUTOMATION_POLICY_DENIED",`Execution contract denies ${e.operation}`);let i=e.executionContract.computer.allowedApplications,d=e.operation==="computer.launch"?Le(e):r.applicationId??e.declaredTarget?.applicationId;if((e.operation==="computer.launch"||i.length>0)&&(!d||!i.includes(d)))throw new a("AUTOMATION_POLICY_DENIED",`Application ${d??"<unknown>"} is not allowed`)}}function fe(e,t){let r=I(e.operation),n=r.surface==="browser"?r.effect==="act"?"browser-act":"browser-read":r.effect==="act"?"computer-act":"computer-observe";return{subject:{runId:e.identity.runId,agentId:e.identity.agentId,...e.identity.turnId?{turnId:e.identity.turnId}:{},toolName:e.governingToolName,operationId:e.operationId},kind:n,operation:e.operation,...se(e,t)?{resource:se(e,t)}:{},...de(t)?{destination:de(t)}:{}}}function se(e,t){return e.declaredTarget?.resource??Xe(t)}function pe(e){let t=I(e.operation).evidence,r=e.evidencePolicy??{},n=F(t.before,r.before),o=F(t.after,r.after),i=F(t.recording,r.recording),d=r.retainUntil;return d&&!me(d)&&A("evidencePolicy.retainUntil must be an ISO 8601 timestamp"),{before:n,after:o,recording:i,sensitivity:r.sensitivity??"confidential",...d?{retainUntil:d}:{},...r.legalHold!==void 0?{legalHold:r.legalHold}:{}}}function xe(e){let t=e.executionContract.identity,r=["runId","agentId","sessionId","turnId","taskId","workspaceId"];for(let n of r){let o=t[n],i=e.identity[n];if(o!==void 0&&o!==i)throw new a("AUTOMATION_IDENTITY_MISMATCH",`Automation identity ${n} does not match the execution contract`)}}function Pe(e,t,r){let n=t.url??t.origin??e.declaredTarget?.url??e.declaredTarget?.origin;if(!n){if(["browser.tabs.list","browser.wait"].includes(e.operation))return;throw new a("AUTOMATION_PREFLIGHT_INVALID","Browser preflight did not bind an effective URL")}let o;try{o=new URL(n)}catch{throw new a("AUTOMATION_POLICY_DENIED","Browser target URL is invalid")}if(o.username||o.password)throw new a("AUTOMATION_POLICY_DENIED","Browser target URLs cannot contain credentials");let i=o.protocol.replace(/:$/,"");i!=="http"&&i!=="https"&&w(`Browser scheme ${o.protocol} is not supported`);let d=i,c=o.hostname.toLowerCase().replace(/\.$/,""),l=o.port?Number(o.port):d==="https"?443:80,s=e.executionContract.browser,u=De(c);if(le(c,s.deniedDomains)&&w(`Browser domain ${c} is denied`),ce(o,e.executionContract.network.denyDestinations)&&w(`Network policy explicitly denies ${d}://${c}:${l}`),u&&s.allowLoopbackDevelopment)return;s.allowedSchemes.includes(d)||w(`Browser scheme ${o.protocol} is not allowed`),s.allowedPorts.includes(l)||w(`Browser port ${l} is not allowed`);let p=r?s.actAllowedDomains:s.readAllowedDomains;le(c,p)||w(`Browser domain ${c} is outside the ${r?"action":"read"} allowlist`),e.executionContract.network.default==="deny"&&(ce(o,e.executionContract.network.allowDestinations)||w(`Network policy does not allow ${d}://${c}:${l}`))}function ce(e,t){let r=e.protocol.replace(/:$/,""),n=e.hostname.toLowerCase().replace(/\.$/,""),o=e.port?Number(e.port):r==="https"?443:80;return t.some(i=>{let d=i.scheme?.replace(/^custom:/,"");return i.host===n&&(i.port===void 0||i.port===o)&&(d===void 0||d===r)})}function Xe(e){return e.resource??e.tabId??e.pageId??e.deviceId??e.applicationId}function de(e){let t=e.origin??e.url;if(!t)return e.domain;try{return new URL(t).origin}catch{return t}}function Le(e){let t=e.parameters.target,r=t&&typeof t=="object"&&!Array.isArray(t)?t.app_id:void 0,n=e.parameters.applicationId??r??e.declaredTarget?.applicationId;return typeof n=="string"&&n.length>0?n:void 0}function le(e,t){return t.some(r=>{let n=r.toLowerCase();if(n.startsWith(".")){let o=n.slice(1);return e===o||e.endsWith(`.${o}`)}return e===n})}function De(e){return e==="localhost"||e==="127.0.0.1"||e==="[::1]"||e==="::1"}function F(e,t){let r={disabled:0,optional:1,required:2};return!t||r[t]<=r[e]?e:t}function E(e,t){(typeof e!="string"||!Ne.test(e))&&A(`${t} is invalid`)}function C(e,t){(typeof e!="string"||e.trim().length===0||e.length>256)&&m(`${t} is invalid`)}function me(e){return typeof e=="string"&&e.includes("T")&&Number.isFinite(Date.parse(e))}function w(e){throw new a("AUTOMATION_POLICY_DENIED",e)}function A(e){throw new a("AUTOMATION_REQUEST_INVALID",e)}function m(e){throw new a("AUTOMATION_OPERATION_UNSUPPORTED",e)}import{createHash as Me}from"node:crypto";import{createHash as ke}from"node:crypto";function R(e){return{algorithm:"sha256",value:ke("sha256").update(e).digest("hex")}}var Ue="[\\u0000-\\u001f\\u007f]",Xr=new RegExp(Ue);var O=class extends Error{constructor(r,n,o,i){super(n,i);this.code=r;this.detail=o;this.name="XenoArtifactRepositoryError"}code;detail};var G=32*1024*1024,Be=1024*1024*1024,Ve=/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,255}$/;function W(e){let r=(e.now??(()=>new Date().toISOString()))(),n=new Set;return e.evidence.map((o,i)=>{if(Fe(o),n.has(o.evidenceId))throw new a("AUTOMATION_EVIDENCE_INVALID",`Duplicate evidence ID ${o.evidenceId}`);n.add(o.evidenceId);let d=$e(o),c=Me("sha256").update(`${e.request.operationId}\0${o.evidenceId}\0${d.hash.value}`).digest("hex").slice(0,32);return{schemaVersion:1,artifactId:`automation_${c}`,revision:1,kind:o.kind,title:o.title,...o.description?{description:o.description}:{},state:"draft",createdAt:r,mediaType:o.mediaType,sensitivity:o.sensitivity??e.policy.sensitivity,identity:{...e.request.identity},content:d,provenance:{producer:{kind:"tool",id:e.request.governingToolName,displayName:e.manifest.adapterId,profileFingerprint:e.request.executionContract.profile.fingerprint},operationId:e.request.operationId,executionContractFingerprint:e.request.executionContract.fingerprint,capabilityLeaseIds:[e.request.capabilityLeaseId],attributes:{automationProtocolVersion:e.request.protocolVersion,automationOperation:e.request.operation,automationEvidenceId:o.evidenceId,automationEvidencePhase:o.phase,adapterId:e.manifest.adapterId,adapterVersion:e.manifest.adapterVersion,evidenceIndex:i}},...o.anchors?{anchors:structuredClone(o.anchors)}:{},...e.policy.retainUntil||e.policy.legalHold!==void 0?{retention:{...e.policy.retainUntil?{retainUntil:e.policy.retainUntil}:{},...e.policy.legalHold!==void 0?{legalHold:e.policy.legalHold}:{}}}:{},extensions:{...o.extensions??{},xenoAutomation:{phase:o.phase,adapter:e.manifest.adapterId,certifiedAdapter:e.manifest.certified}}}})}async function z(e,t){if(!e)return t.map(n=>structuredClone(n));let r=[];for(let n of t)try{let o=await e.create(n);r.push(o.artifact)}catch(o){if(o instanceof O&&o.code==="ARTIFACT_ALREADY_EXISTS"){let i=await e.require(n.artifactId,n.revision);if(i.artifact.content.hash.value===n.content.hash.value){r.push(i.artifact);continue}}throw new a("AUTOMATION_EVIDENCE_PERSISTENCE_FAILED",`Failed to persist automation evidence ${n.artifactId}`,{artifactId:n.artifactId},{cause:o})}return r}function N(e,t,r){if(t[r]==="required"&&!e.some(n=>n.phase===r))throw new a("AUTOMATION_EVIDENCE_REQUIRED",`Automation operation requires ${r} evidence before it can be trusted`)}function $e(e){if(e.content.type==="text"){let t=Buffer.byteLength(e.content.text,"utf8");return he(t),{hash:R(e.content.text),sizeBytes:t,storage:{type:"inline",text:e.content.text},encoding:"utf8",...e.redactedPreview?{redactedPreview:e.redactedPreview}:{}}}if(e.content.type==="base64"){let t=He(e.content.base64);return he(t.byteLength),{hash:R(t),sizeBytes:t.byteLength,storage:{type:"inline",base64:e.content.base64},encoding:"base64",...e.redactedPreview?{redactedPreview:e.redactedPreview}:{}}}if(!Number.isSafeInteger(e.content.sizeBytes)||e.content.sizeBytes<0||e.content.sizeBytes>Be)throw new a("AUTOMATION_EVIDENCE_INVALID","Referenced evidence size is invalid");if(!e.content.hash?.algorithm||!e.content.hash.value)throw new a("AUTOMATION_EVIDENCE_INVALID","Referenced evidence requires a content hash");if(e.content.hash.algorithm==="sha256"&&!/^[a-f0-9]{64}$/.test(e.content.hash.value))throw new a("AUTOMATION_EVIDENCE_INVALID","Referenced evidence SHA-256 is invalid");return{hash:{...e.content.hash},sizeBytes:e.content.sizeBytes,storage:structuredClone(e.content.storage),...e.content.encoding?{encoding:e.content.encoding}:{},...e.redactedPreview?{redactedPreview:e.redactedPreview}:{}}}function Fe(e){(!e||typeof e!="object")&&g("Evidence must be an object"),Ve.test(e.evidenceId)||g("Evidence ID is invalid"),["before","action","after","recording","diagnostic"].includes(e.phase)||g("Evidence phase is invalid"),(!e.kind||!e.title?.trim()||e.title.length>512)&&g("Evidence kind and title are required"),/^[\w!#$&^_.+-]+\/[\w!#$&^_.+-]+(?:;.*)?$/.test(e.mediaType)||g("Evidence media type is invalid")}function He(e){(e.length===0||e.length>Math.ceil(G/3)*4+4)&&g("Inline base64 evidence is empty or too large"),(!/^[A-Za-z0-9+/]*={0,2}$/.test(e)||e.length%4!==0)&&g("Inline evidence is not canonical base64");let t=Buffer.from(e,"base64");return t.toString("base64")!==e&&g("Inline evidence is not canonical base64"),t}function he(e){e>G&&g(`Inline evidence exceeds ${G} bytes`)}function g(e){throw new a("AUTOMATION_EVIDENCE_INVALID",e)}import{createHash as je}from"node:crypto";var Ie=3e4,Ge=1e3,Ae=class{adapter;leaseAuthority;artifactRepository;now;executions=new Map;active=new Map;constructor(t){this.adapter=t.adapter,this.leaseAuthority=t.leaseAuthority,this.artifactRepository=t.artifactRepository,this.now=t.now??(()=>new Date().toISOString())}execute(t,r){let n=Ke(t),o=this.executions.get(t.operationId);if(o){if(o.fingerprint!==n)throw new a("AUTOMATION_OPERATION_CONFLICT",`Operation ${t.operationId} was already submitted with different authority or parameters`);return o.promise}let i=new AbortController,d=Ye(r,i);this.active.set(t.operationId,i);let c=this.executeFresh(t,i.signal).finally(()=>{d(),this.active.delete(t.operationId)});return this.executions.set(t.operationId,{fingerprint:n,promise:c}),this.trimIdempotencyRecords(),c}async stop(t,r="human-stop"){let n=this.active.get(t);return n?(n.abort(new Error(r)),await this.adapter.stop?.(t,r),!0):!1}async executeFresh(t,r){ue(t),q(r);let n=await this.adapter.manifest();_(n);let o=I(t.operation),i=pe(t),d=this.now(),c=await this.adapter.preflight(t,r);We(c,this.now()),H(t,n,c.observedTarget),q(r);let l=c.evidence??[];N(l,i,"before");let s=await z(this.artifactRepository,W({request:t,manifest:n,policy:i,evidence:l,now:this.now}));if(q(r),Date.parse(c.expiresAt)<=Date.parse(this.now()))throw new a("AUTOMATION_PREFLIGHT_INVALID","Automation preflight expired before authority consumption");let u=fe(t,c.observedTarget),p=await this.leaseAuthority.consume(t.capabilityLeaseId,t.expectedLeaseVersion,u),v={contractFingerprint:t.executionContract.fingerprint,lease:p,capabilityUse:u},f;try{f=await this.adapter.execute(t,c,v,r)}catch(h){return J({request:t,manifest:n,descriptorEffect:o.effect,target:c.observedTarget,lease:p,artifacts:s,startedAt:d,completedAt:this.now(),status:r.aborted?"cancelled":"error",code:r.aborted?"AUTOMATION_CANCELLED":"AUTOMATION_ADAPTER_ERROR",message:r.aborted?"Automation operation was stopped":Ze(h)})}ze(f);let ee=Je(c.observedTarget,f.observedTarget),x;try{H(t,n,f.observedTarget)}catch(h){x=h instanceof Error?h:new Error(String(h))}let S=f.evidence??[];qe(l,S);let te=[],P;try{N(S,i,"after"),N([...l,...S],i,"recording"),te=await z(this.artifactRepository,W({request:t,manifest:n,policy:i,evidence:S,now:this.now}))}catch(h){P=h instanceof Error?h:new Error(String(h))}let X=[...s,...te];return ee||x?J({request:t,manifest:n,descriptorEffect:o.effect,target:f.observedTarget,lease:p,artifacts:X,startedAt:f.startedAt,completedAt:f.completedAt,status:"error",code:"AUTOMATION_TARGET_CHANGED",message:ee??x.message}):P?J({request:t,manifest:n,descriptorEffect:o.effect,target:f.observedTarget,lease:p,artifacts:X,startedAt:f.startedAt,completedAt:f.completedAt,status:"evidence-incomplete",code:"AUTOMATION_EVIDENCE_INCOMPLETE",message:P.message}):{operationId:t.operationId,status:f.status,effect:o.effect,startedAt:f.startedAt,completedAt:f.completedAt,adapter:ge(n),target:structuredClone(f.observedTarget),...f.data!==void 0?{data:structuredClone(f.data)}:{},artifacts:X,lease:be(p),...f.error?{error:{...f.error}}:{}}}trimIdempotencyRecords(){for(;this.executions.size>Ge;){let t=this.executions.keys().next().value;if(!t||this.active.has(t))break;this.executions.delete(t)}}};function We(e,t){if(!e||typeof e!="object"||!e.token?.trim())throw new a("AUTOMATION_PREFLIGHT_INVALID","Adapter returned an invalid preflight token");let r=Date.parse(e.preparedAt),n=Date.parse(e.expiresAt),o=Date.parse(t);if(!Number.isFinite(r)||!Number.isFinite(n)||n<=r||n<=o)throw new a("AUTOMATION_PREFLIGHT_INVALID","Adapter returned an expired or invalid preflight window");if(n-r>Ie)throw new a("AUTOMATION_PREFLIGHT_INVALID",`Preflight TTL exceeds ${Ie} ms`);if(!e.observedTarget||typeof e.observedTarget!="object")throw new a("AUTOMATION_PREFLIGHT_INVALID","Adapter did not bind an observed target")}function ze(e){if(!e||typeof e!="object")throw new a("AUTOMATION_REQUEST_INVALID","Adapter returned no result");if(!["ok","denied","cancelled","error"].includes(e.status))throw new a("AUTOMATION_REQUEST_INVALID","Adapter returned an invalid status");if(!Number.isFinite(Date.parse(e.startedAt))||!Number.isFinite(Date.parse(e.completedAt)))throw new a("AUTOMATION_REQUEST_INVALID","Adapter result timestamps are invalid");if(Date.parse(e.completedAt)<Date.parse(e.startedAt))throw new a("AUTOMATION_REQUEST_INVALID","Adapter completion precedes its start");if(!e.observedTarget||typeof e.observedTarget!="object")throw new a("AUTOMATION_REQUEST_INVALID","Adapter result has no observed target")}function Je(e,t){let r=["tabId","deviceId","displayId"];for(let n of r)if(e[n]!==void 0&&e[n]!==t[n])return`Adapter changed bound ${n} between preflight and execution`}function qe(e,t){let r=new Set(e.map(n=>n.evidenceId));for(let n of t){if(r.has(n.evidenceId))throw new a("AUTOMATION_EVIDENCE_INVALID",`Duplicate evidence ID ${n.evidenceId}`);r.add(n.evidenceId)}}function J(e){return{operationId:e.request.operationId,status:e.status,effect:e.descriptorEffect,startedAt:e.startedAt,completedAt:e.completedAt,adapter:ge(e.manifest),target:structuredClone(e.target),artifacts:e.artifacts,lease:be(e.lease),error:{code:e.code,message:e.message}}}function ge(e){return{adapterId:e.adapterId,adapterVersion:e.adapterVersion,platform:e.platform,architecture:e.architecture}}function be(e){return{leaseId:e.leaseId,version:e.version,state:e.state,useCount:e.useCount}}function Ke(e){return je("sha256").update(JSON.stringify(K(e))).digest("hex")}function K(e){return Array.isArray(e)?e.map(K):!e||typeof e!="object"?e:Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[r])=>t.localeCompare(r)).map(([t,r])=>[t,K(r)]))}function Ye(e,t){if(!e)return()=>{};let r=()=>t.abort(e.reason);return e.aborted?r():e.addEventListener("abort",r,{once:!0}),()=>e.removeEventListener("abort",r)}function q(e){if(e.aborted)throw new a("AUTOMATION_CANCELLED","Automation operation was stopped before dispatch")}function Ze(e){return e instanceof Error&&e.message.slice(0,1024)||"Automation adapter failed"}function Qe(e,t=()=>new Date().toISOString()){let r=[];et(r,"manifest.valid",()=>_(e));let n=new Set(e.operations);return y(r,n,e.supports.consoleInspection,"browser.console.read","console inspection"),y(r,n,e.supports.networkInspection,"browser.network.read","network inspection"),y(r,n,e.supports.storageInspection,"browser.storage.read","storage inspection"),y(r,n,e.supports.pageErrorInspection,"browser.page-errors.read","page-error inspection"),y(r,n,e.supports.recordings,"browser.record.start","recording start"),y(r,n,e.supports.recordings,"browser.record.stop","recording stop"),n.has("browser.upload")&&b(r,"policy.upload",e.policyEnforcement.upload,"Upload policy is enforced"),n.has("browser.download")&&b(r,"policy.download",e.policyEnforcement.download,"Download policy is enforced"),[...n].some(o=>o.startsWith("browser."))&&(b(r,"policy.redirect",e.policyEnforcement.redirect,"Redirect policy is enforced"),b(r,"control.handback",e.supports.deterministicHandback,"Deterministic hand-back is supported")),[...n].some(o=>o.startsWith("computer."))&&(b(r,"control.stop",e.supports.immediateStop,"Immediate human stop is supported"),b(r,"privacy.redaction",e.supports.sensitiveRegionRedaction,"Sensitive-region redaction is supported")),b(r,"certification.binding",!e.certified||!!e.certificationArtifactId,e.certified?"Certification artifact is bound":"Adapter does not claim certification"),{protocolVersion:1,adapter:{adapterId:e.adapterId,adapterVersion:e.adapterVersion,platform:e.platform,architecture:e.architecture},generatedAt:t(),passed:r.every(o=>o.status==="pass"),checks:r}}function on(e){let r=Qe(e).checks.filter(n=>n.status==="fail");if(r.length>0)throw new a("AUTOMATION_OPERATION_UNSUPPORTED",r.map(n=>`${n.id}: ${n.message}`).join("; "))}function y(e,t,r,n,o){let i=t.has(n);b(e,`capability.${n}`,r===i,r===i?`${o} declaration matches the operation catalog`:`${o} declaration does not match ${n}`)}function et(e,t,r){try{r(),e.push({id:t,status:"pass",message:"Manifest satisfies the protocol contract"})}catch(n){e.push({id:t,status:"fail",message:n instanceof Error?n.message:String(n)})}}function b(e,t,r,n){e.push({id:t,status:r?"pass":"fail",message:n})}var tt=6e4,rt=48*1024*1024,we=class{endpoint;token;timeoutMs;maxResponseBytes;fetchImpl;constructor(t){if(this.endpoint=nt(t.baseUrl),this.token=ot(t.token),this.timeoutMs=Ee(t.timeoutMs??tt,1e3,3e5,"timeoutMs"),this.maxResponseBytes=Ee(t.maxResponseBytes??rt,1024,128*1024*1024,"maxResponseBytes"),this.fetchImpl=t.fetch??globalThis.fetch,typeof this.fetchImpl!="function")throw new a("AUTOMATION_TRANSPORT_ERROR","A Fetch API implementation is required")}manifest(){return this.request("manifest","GET")}preflight(t,r){return this.request("preflight","POST",t,r)}execute(t,r,n,o){return this.request("execute","POST",{request:t,preflight:r,grant:n},o)}async stop(t,r){await this.request("stop","POST",{operationId:t,reason:r.slice(0,512)})}async request(t,r,n,o){let i=new AbortController,d=st(o,i),c=setTimeout(()=>i.abort(new Error("automation transport timeout")),this.timeoutMs);c.unref?.();try{let l=new URL(t,this.endpoint),s=await this.fetchImpl(l,{method:r,redirect:"error",cache:"no-store",credentials:"omit",headers:{authorization:`Bearer ${this.token}`,accept:"application/json",...r==="POST"?{"content-type":"application/json"}:{}},...r==="POST"?{body:JSON.stringify(n??{})}:{},signal:i.signal}),u=await it(s,this.maxResponseBytes);if(!s.ok){let p=at(u);throw new a("AUTOMATION_TRANSPORT_ERROR",`XENO Browser rejected ${t}: ${p.message}`,{status:s.status,route:t,adapterCode:p.code})}if(!Y(u)||u.ok!==!0||!("result"in u))throw new a("AUTOMATION_RESPONSE_INVALID",`XENO Browser returned an invalid ${t} envelope`);return u.result}catch(l){if(l instanceof a)throw l;let s=o?.aborted;throw new a(s?"AUTOMATION_CANCELLED":"AUTOMATION_TRANSPORT_ERROR",s?"Automation transport was stopped":`XENO Browser ${t} transport failed`,{route:t},{cause:l})}finally{clearTimeout(c),d()}}};function nt(e){let t;try{t=new URL(e)}catch(n){throw new a("AUTOMATION_TRANSPORT_ERROR","XENO Browser base URL is invalid",void 0,{cause:n})}if(t.protocol!=="http:"&&t.protocol!=="https:")throw new a("AUTOMATION_TRANSPORT_ERROR","XENO Browser transport requires HTTP(S)");if(t.username||t.password||t.search||t.hash)throw new a("AUTOMATION_TRANSPORT_ERROR","XENO Browser base URL cannot contain credentials, query, or fragment");let r=t.hostname.toLowerCase().replace(/^\[|\]$/g,"").replace(/\.$/,"");if(r!=="localhost"&&r!=="127.0.0.1"&&r!=="::1")throw new a("AUTOMATION_TRANSPORT_ERROR","XENO Browser transport must use a loopback host");if(!t.port)throw new a("AUTOMATION_TRANSPORT_ERROR","XENO Browser transport requires an explicit port");return t.pathname="/v1/automation/",t}function ot(e){if(typeof e!="string"||e.length<32||e.length>512||/\s/.test(e))throw new a("AUTOMATION_TRANSPORT_ERROR","XENO Browser session token is invalid");return e}async function it(e,t){let r=Number(e.headers.get("content-length"));if(Number.isFinite(r)&&r>t)throw new a("AUTOMATION_RESPONSE_INVALID",`XENO Browser response exceeds ${t} bytes`);if(e.headers.get("content-type")?.split(";")[0]?.trim().toLowerCase()!=="application/json")throw new a("AUTOMATION_RESPONSE_INVALID","XENO Browser response is not application/json");if(!e.body)throw new a("AUTOMATION_RESPONSE_INVALID","XENO Browser response body is missing");let o=e.body.getReader(),i=[],d=0;for(;;){let{done:s,value:u}=await o.read();if(s)break;if(d+=u.byteLength,d>t)throw await o.cancel("response too large"),new a("AUTOMATION_RESPONSE_INVALID",`XENO Browser response exceeds ${t} bytes`);i.push(u)}let c=new Uint8Array(d),l=0;for(let s of i)c.set(s,l),l+=s.byteLength;try{return JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(c))}catch(s){throw new a("AUTOMATION_RESPONSE_INVALID","XENO Browser response contains invalid JSON",void 0,{cause:s})}}function at(e){return Y(e)&&Y(e.error)?{code:typeof e.error.code=="string"?e.error.code.slice(0,128):"UNKNOWN",message:typeof e.error.message=="string"?e.error.message.slice(0,1024):"request failed"}:{code:"UNKNOWN",message:"request failed"}}function st(e,t){if(!e)return()=>{};let r=()=>t.abort(e.reason);return e.aborted?r():e.addEventListener("abort",r,{once:!0}),()=>e.removeEventListener("abort",r)}function Ee(e,t,r,n){if(!Number.isSafeInteger(e)||e<t||e>r)throw new a("AUTOMATION_TRANSPORT_ERROR",`${n} must be an integer from ${t} to ${r}`);return e}function Y(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}import{createHash as ct,randomUUID as dt}from"node:crypto";var lt=8*1024*1024,ut=4;function un(e){return Tt(e.operations??M).map(r=>ft(r,e.runtime))}function ft(e,t){return{definition:{name:e,description:At(e),input_schema:pt(e)},projectPolicyInput(r){let n=wt(e,r),o=bt(e,r);return{observabilityInput:n,permissionInput:o,permissionPreview:Et(e,r),approvalKey:`xeno-automation:${e}:${St(r)}`,riskLevel:gt(e)}},async execute(r,n){let o=n?.authorization;if(!o||o.toolName!==e)return{success:!1,output:"",error:"Governed automation requires a host-issued authorization receipt",errorCode:"AUTOMATION_AUTHORIZATION_RECEIPT_REQUIRED",retryable:!1};let i=n.operationId??`automation_${dt()}`,d=Q(e,r);n.reportProgress?.({activity:"state",message:`Authorizing ${e}`});try{let c=await t.execute({operation:e,governingToolName:e,operationId:i,idempotencyKey:i,parameters:structuredClone(r),...d?{declaredTarget:d}:{},authorization:o,...n.signal?{signal:n.signal}:{},...n.reportProgress?{reportProgress:n.reportProgress}:{}}),l=c.status==="ok";return{success:l,output:JSON.stringify(yt(c)),...l?{}:{error:c.error?.message??`Governed automation ended with ${c.status}`,errorCode:c.error?.code??`AUTOMATION_${c.status.toUpperCase().replaceAll("-","_")}`},assistantContent:vt(c),evidence:c.artifacts.map(s=>({id:s.artifactId,kind:"artifact",status:c.status==="evidence-incomplete"?"failed":"verified",observedAt:s.updatedAt??s.createdAt,operationId:i,detail:{artifact_kind:s.kind,revision:s.revision,sensitivity:s.sensitivity}})),retryable:c.error?.retryable??!1}}catch(c){let l=n.signal?.aborted===!0;return{success:!1,output:"",error:l?"Governed automation was stopped":Ct(c),errorCode:l?"AUTOMATION_CANCELLED":_t(c),retryable:!l}}}}}function pt(e){let t=mt(e),r=ht(e);return{type:"object",properties:t,...r.length>0?{required:r}:{},...e==="browser.locate"?{oneOf:[{required:["selector"]},{required:["text"]}]}:{},additionalProperties:!1}}function mt(e){let t=(d,c=8192)=>({type:"string",minLength:1,maxLength:c,description:d}),r={type:"number"},n={type:"boolean"},o={type:"object",properties:{x:r,y:r},required:["x","y"],additionalProperties:!1},i={deviceId:t("Target xeno-use device ID.",256),applicationId:t("Expected or launch-target application ID.",512),displayId:t("Target display ID.",256)};switch(e){case"browser.navigate":return{url:t("Destination URL."),waitUntil:{enum:["load","none"]},tabId:t("Expected active tab ID. Hosts with multiple visible tabs should require this.",256)};case"browser.wait":return{until:{enum:["load","ms"]},value:{type:"integer",minimum:0,maximum:6e4}};case"browser.snapshot":return{mode:{enum:["text","html","markdown","a11y"]},tabId:t("Expected active tab ID.",256)};case"browser.screenshot":return{tabId:t("Expected active tab ID.",256)};case"browser.locate":return{selector:t("CSS selector."),text:t("Visible text to locate.")};case"browser.click":return{selector:t("CSS selector returned by browser.snapshot or browser.locate."),tabId:t("Expected active tab ID.",256)};case"browser.type":return{selector:t("CSS selector."),text:{type:"string",maxLength:65536},clear:n,submit:n,tabId:t("Expected active tab ID.",256)};case"browser.key":return{combo:t("Key combo such as Control+a or Enter.",256),tabId:t("Expected active tab ID.",256)};case"browser.select":return{selector:t("CSS selector."),value:t("Option value."),tabId:t("Expected active tab ID.",256)};case"browser.scroll":return{selector:t("Optional CSS selector."),dx:r,dy:r,tabId:t("Expected active tab ID.",256)};case"browser.tabs.open":return{url:t("URL to open in an isolated browser tab.")};case"browser.tabs.close":return{tabId:t("Tab ID to close.",256)};case"browser.console.read":case"browser.network.read":case"browser.page-errors.read":return{limit:{type:"integer",minimum:1,maximum:1e3},clear:n,tabId:t("Expected active tab ID.",256)};case"browser.storage.read":return{tabId:t("Expected active tab ID.",256)};case"browser.upload":return{selector:t("File input or drop-target selector."),backendNodeId:{type:"integer",minimum:1},hostPaths:{type:"array",items:t("Host file path.",32768),minItems:1,maxItems:64},drop:n,tabId:t("Expected active tab ID.",256)};case"browser.download":return{toPath:t("Approved destination path.",32768),trigger:{type:"object",properties:{url:t("Download URL."),selector:t("Download trigger selector.")},oneOf:[{required:["url"]},{required:["selector"]}],additionalProperties:!1},tabId:t("Expected active tab ID.",256)};case"browser.record.start":return{maxDurationMs:{type:"integer",minimum:1e3,maximum:6e4},intervalMs:{type:"integer",minimum:100,maximum:5e3},tabId:t("Expected active tab ID.",256)};case"browser.record.stop":return{tabId:t("Expected active tab ID.",256)};case"computer.observe":case"computer.screenshot":case"computer.window-state":return i;case"computer.point":return{...i,point:o,durationMs:{type:"integer",minimum:0,maximum:6e4}};case"computer.click":return{...i,point:o,button:{enum:["left","right","middle"]},modifiers:It()};case"computer.double-click":case"computer.right-click":return{...i,point:o};case"computer.drag":return{...i,from:o,to:o,durationMs:{type:"integer",minimum:0,maximum:6e4}};case"computer.type":return{...i,text:{type:"string",maxLength:65536}};case"computer.key":return{...i,combo:t("Key combo such as Control+a or Enter.",256)};case"computer.scroll":return{...i,at:o,delta:o};case"computer.wait":return{...i,milliseconds:{type:"integer",minimum:0,maximum:3e5}};case"computer.launch":return{...i,applicationId:t("Explicitly allowlisted application ID.",512)};case"browser.back":case"browser.forward":case"browser.reload":return{tabId:t("Expected active tab ID.",256)};case"browser.tabs.list":return{}}}function ht(e){switch(e){case"browser.navigate":case"browser.tabs.open":return["url"];case"browser.click":return["selector"];case"browser.type":return["selector","text"];case"browser.key":return["combo"];case"browser.select":return["selector","value"];case"browser.upload":return["hostPaths"];case"browser.download":return["toPath","trigger"];case"computer.point":case"computer.click":case"computer.double-click":case"computer.right-click":return["point"];case"computer.drag":return["from","to"];case"computer.type":return["text"];case"computer.key":return["combo"];case"computer.scroll":return["at","delta"];case"computer.launch":return["applicationId"];default:return[]}}function It(){return{type:"object",properties:{shift:{type:"boolean"},ctrl:{type:"boolean"},alt:{type:"boolean"},meta:{type:"boolean"}},additionalProperties:!1}}function At(e){let t=I(e),r=e.split(".").slice(1).join(" ");return`${t.effect==="act"?"Act on":"Inspect"} the ${t.surface} using governed ${r} automation. The host requires policy approval, an exact capability lease, target-bound preflight, and durable evidence.`}function gt(e){return I(e).effect==="observe"?e==="browser.navigate"||e==="browser.tabs.open"?"medium":"low":["browser.type","browser.upload","browser.download","computer.type","computer.key","computer.launch"].includes(e)?"high":"medium"}function bt(e,t){let r=Q(e,t),n={operation:e};r&&(n.target=r);for(let o of["selector","clear","submit","combo","value","dx","dy","point","from","to","at","delta","milliseconds"])t[o]!==void 0&&(n[o]=structuredClone(t[o]));return typeof t.text=="string"&&(n.text=`[redacted ${t.text.length} characters]`),Array.isArray(t.hostPaths)&&(n.hostPaths=t.hostPaths.map(()=>"[redacted host path]")),typeof t.toPath=="string"&&(n.toPath="[redacted destination path]"),n}function wt(e,t){let r=structuredClone(t);return typeof r.text=="string"&&(r.text=`[redacted ${r.text.length} characters]`),Array.isArray(r.hostPaths)&&(r.hostPaths=r.hostPaths.map(()=>"[redacted host path]")),typeof r.toPath=="string"&&(r.toPath="[redacted destination path]"),ve(r.trigger)&&typeof r.trigger.url=="string"&&(r.trigger={...r.trigger,url:ye(r.trigger.url)}),typeof r.url=="string"&&(r.url=ye(r.url)),{operation:e,...r}}function Et(e,t){let r=Q(e,t),n=r?.url??r?.applicationId??r?.deviceId??r?.tabId??r?.resource??"current target";return`${e} on ${n}`}function Q(e,t){let r={};return typeof t.url=="string"&&(r.url=t.url),typeof t.tabId=="string"&&(r.tabId=t.tabId),typeof t.deviceId=="string"&&(r.deviceId=t.deviceId),typeof t.applicationId=="string"&&(r.applicationId=t.applicationId),typeof t.displayId=="string"&&(r.displayId=t.displayId),(e==="browser.navigate"||e==="browser.tabs.list"||e==="browser.tabs.open")&&(r.resource="browser-tabs"),Object.keys(r).length>0?r:void 0}function yt(e){return{operationId:e.operationId,status:e.status,effect:e.effect,startedAt:e.startedAt,completedAt:e.completedAt,adapter:e.adapter,target:e.target,...e.data!==void 0?{data:e.data}:{},artifacts:e.artifacts.map(t=>({artifactId:t.artifactId,revision:t.revision,kind:t.kind,title:t.title,state:t.state,mediaType:t.mediaType,sensitivity:t.sensitivity,hash:t.content.hash,sizeBytes:t.content.sizeBytes})),lease:e.lease,...e.error?{error:e.error}:{}}}function vt(e){let t=[];for(let r of e.artifacts){if(t.length>=ut||!r.mediaType.startsWith("image/"))continue;let n=r.content.storage;if(n.type!=="inline"||typeof n.base64!="string")continue;let o=Math.floor(n.base64.length*.75);o<=0||o>lt||t.push({type:"image_url",image_url:{url:`data:${r.mediaType};base64,${n.base64}`,detail:"high"}})}return t}function Tt(e){let t=new Set(M),r=new Set;for(let n of e){if(!t.has(n))throw new TypeError(`Unsupported XENO automation operation: ${String(n)}`);r.add(n)}return Array.from(r)}function St(e){return ct("sha256").update(Z(e)).digest("hex")}function Z(e){return Array.isArray(e)?`[${e.map(Z).join(",")}]`:ve(e)?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${Z(e[t])}`).join(",")}}`:JSON.stringify(e)??"null"}function ye(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch{return"[invalid URL]"}}function Ct(e){return e instanceof Error?e.message:String(e)}function _t(e){return e&&typeof e=="object"&&"code"in e&&typeof e.code=="string"?e.code:"AUTOMATION_EXECUTION_FAILED"}function ve(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}export{M as XENO_AUTOMATION_OPERATIONS,T as XENO_AUTOMATION_PROTOCOL_VERSION,a as XenoAutomationError,Ae as XenoGovernedAutomationExecutor,we as XenoLoopbackAutomationAdapter,N as assertRequiredXenoAutomationEvidence,_ as assertValidXenoAutomationAdapterManifest,ue as assertValidXenoAutomationRequest,on as assertXenoAutomationAdapterConformant,H as assertXenoAutomationAuthority,fe as buildXenoAutomationCapabilityUse,Qe as createXenoAutomationConformanceReport,un as createXenoGovernedAutomationTools,I as describeXenoAutomationOperation,B as isXenoAutomationOperation,W as materializeXenoAutomationEvidence,z as persistXenoAutomationEvidence,pe as resolveXenoAutomationEvidencePolicy};
|
|
899
|
+
`;var Wt=512*1024,zt=744*60*60*1e3,Jt=Object.freeze(["allowedFilesystemRead","allowedFilesystemWrite","outsideFilesystemReadDenied","outsideFilesystemWriteDenied","unlistedFilesystemReadDenied","unlistedFilesystemWriteDenied","symlinkEscapeDenied","networkDefaultDeny","environmentSecretsExcluded","childProcessPolicyInherited","standardCommandLaunch","processTreeCleanup","timeoutEnforced","hostPolicyRecoveryClean","uiRestrictionsEnforced"]);var er=10*6e4,tr=Object.freeze({"win32-x64-wxc-exec.exe":"db0a3422be9e1b396cc1b2547c70ff16b27412438a31c10a45abf370cac86ae2","win32-arm64-wxc-exec.exe":"e430d0e4f44f616e91db684f8d825a6dc93e06a1262b8d00bcaac7522a317aab","linux-x64-lxc-exec":"1efe3f817f5ae9ba9f9f2fd59142e79b2dde7a4dd024576b0ddb635fc87edeb5","linux-arm64-lxc-exec":"fdc00ccecf362ae3ddd8ccad93fd7c8b5b1f03c68897ab05ef1c9f1d327ea3fe","darwin-arm64-mxc-exec-mac":"77c07a86f483ed91dd5be290cd77878ac0c56fe113cdb8c764e7e5201c744ad2"}),rr=Object.freeze({"win32-x64-wxc-host-prep.exe":"531fb3cdb4b0c964908fd71b71d40961417afb399cbab72f92a25e95309a6416","win32-arm64-wxc-host-prep.exe":"3ef702332286a39153fc259310b5021e3de3c191751d7522684f6475f73af5ef"});var hr=Object.freeze({policyEnforcement:!0,restrictedIdentity:!1,lowIntegrity:!1,processTreeControl:!1,filesystemIsolation:!1,networkIsolation:!1,inheritedHandleAllowlist:!1,environmentSanitization:!0}),gr=Object.freeze({policyEnforcement:!0,restrictedIdentity:!0,lowIntegrity:!0,processTreeControl:!0,filesystemIsolation:!1,networkIsolation:!1,inheritedHandleAllowlist:!0,environmentSanitization:!0}),br=Object.freeze({policyEnforcement:!0,restrictedIdentity:!0,lowIntegrity:!1,processTreeControl:!0,filesystemIsolation:!1,networkIsolation:!1,inheritedHandleAllowlist:!1,environmentSanitization:!0}),Er=Object.freeze({policyEnforcement:!0,restrictedIdentity:!0,lowIntegrity:!1,processTreeControl:!0,filesystemIsolation:!0,networkIsolation:!0,inheritedHandleAllowlist:!0,environmentSanitization:!0}),wr=Object.freeze({policyEnforcement:!0,restrictedIdentity:!1,lowIntegrity:!1,processTreeControl:!1,filesystemIsolation:!1,networkIsolation:!1,inheritedHandleAllowlist:!1,environmentSanitization:!0});var Xe=1,V=class extends Error{constructor(r,n){super(n);this.code=r;this.name="XenoSecureExecutionContractError"}code};function Le(e){let t=[];if(!e||typeof e!="object")return["Contract must be an object"];if(e.schemaVersion!==Xe&&t.push("Unsupported schemaVersion"),e.contractId?.trim()||t.push("contractId is required"),(!e.identity?.runId?.trim()||!e.identity?.agentId?.trim())&&t.push("runId and agentId are required"),oe(e.createdAt)||t.push("createdAt must be an ISO 8601 timestamp"),e.expiresAt&&(!oe(e.expiresAt)||Date.parse(e.expiresAt)<=Date.parse(e.createdAt))&&t.push("expiresAt must be later than createdAt"),e.requestedLevel!==e.effectiveLevel&&t.push("requestedLevel and effectiveLevel must match"),e.trustMode==="untrusted"&&e.effectiveLevel!=="contained"&&t.push("Untrusted execution requires contained mode"),e.effectiveLevel==="contained"&&(e.adapter.certified||t.push("Contained mode requires a certified adapter"),e.adapter.certificationArtifactId||t.push("Contained mode requires a certification artifact"),(!e.adapter.capabilities.filesystemIsolation||e.filesystem.enforcement!=="os")&&t.push("Contained mode requires OS filesystem isolation"),(!e.adapter.capabilities.networkIsolation||e.network.enforcement!=="os")&&t.push("Contained mode requires OS network isolation"),e.network.default!=="deny"&&t.push("Contained networking must default deny")),e.network.enforcement==="none"&&!e.network.acknowledgedUnrestricted&&t.push("Unrestricted networking must be explicitly acknowledged"),e.filesystem.writeRoots.length>0&&e.profile.permissionProfile==="read-only"&&t.push("Read-only profiles cannot receive write roots"),(!Array.isArray(e.browser.readAllowedDomains)||!Array.isArray(e.browser.actAllowedDomains))&&t.push("Browser read/action domain policies are required"),(!Array.isArray(e.browser.allowedSchemes)||e.browser.allowedSchemes.some(r=>r!=="http"&&r!=="https"))&&t.push("Browser allowed schemes are invalid"),(!Array.isArray(e.browser.allowedPorts)||e.browser.allowedPorts.some(r=>!Number.isInteger(r)||r<1||r>65535))&&t.push("Browser allowed ports are invalid"),e.secrets.some(r=>!r.secretId.trim())&&t.push("Secret projections require non-empty secret IDs"),new Set(e.secrets.map(r=>r.secretId)).size!==e.secrets.length&&t.push("Secret IDs must be unique"),new Set(e.capabilityLeaseIds).size!==e.capabilityLeaseIds.length&&t.push("Capability lease IDs must be unique"),/^[a-f0-9]{64}$/.test(e.profile.fingerprint)||t.push("Profile fingerprint is invalid"),!/^[a-f0-9]{64}$/.test(e.fingerprint))t.push("Contract fingerprint is invalid");else{let r={...e};delete r.fingerprint,De(r)!==e.fingerprint&&t.push("Contract fingerprint does not match content")}return t}function ie(e){let t=Le(e);if(t.length>0){let r=t.includes("Contract fingerprint does not match content");throw new V(r?"SECURITY_CONTRACT_FINGERPRINT_MISMATCH":"SECURITY_CONTRACT_INVALID",t.join("; "))}}function De(e){return Pe("sha256").update(JSON.stringify($(e))).digest("hex")}function $(e){return Array.isArray(e)?e.map($):!e||typeof e!="object"?e:Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[r])=>t.localeCompare(r)).map(([t,r])=>[t,$(r)]))}function oe(e){return typeof e=="string"&&e.includes("T")&&Number.isFinite(Date.parse(e))}var ke=/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,255}$/,ae=1048576;function ue(e){(!e||typeof e!="object")&&h("Automation request must be an object"),e.protocolVersion!==1&&h("Unsupported automation protocol version"),w(e.operationId,"operationId"),w(e.idempotencyKey,"idempotencyKey"),w(e.capabilityLeaseId,"capabilityLeaseId"),w(e.governingToolName,"governingToolName"),(!Number.isSafeInteger(e.expectedLeaseVersion)||e.expectedLeaseVersion<1)&&h("expectedLeaseVersion must be a positive safe integer"),me(e.requestedAt)||h("requestedAt must be an ISO 8601 timestamp"),B(e.operation)||h(`Unsupported automation operation: ${e.operation}`),(!e.parameters||typeof e.parameters!="object"||Array.isArray(e.parameters))&&h("parameters must be a JSON object");let t;try{t=Buffer.byteLength(JSON.stringify(e.parameters),"utf8")}catch(r){throw new a("AUTOMATION_REQUEST_INVALID","parameters must be serializable JSON",void 0,{cause:r})}if(t>ae&&h(`parameters exceed ${ae} bytes`),w(e.identity?.runId,"identity.runId"),w(e.identity?.agentId,"identity.agentId"),ie(e.executionContract),Ue(e),!e.executionContract.capabilityLeaseIds.includes(e.capabilityLeaseId))throw new a("AUTOMATION_CONTRACT_INVALID",`Capability lease ${e.capabilityLeaseId} is not bound to the execution contract`);if(e.executionContract.expiresAt&&Date.parse(e.executionContract.expiresAt)<=Date.now())throw new a("AUTOMATION_CONTRACT_EXPIRED","Execution contract has expired")}function _(e){(!e||typeof e!="object")&&m("Adapter manifest must be an object"),e.protocolVersion!==1&&m("Adapter protocol version is unsupported"),C(e.adapterId,"adapterId"),C(e.adapterVersion,"adapterVersion"),C(e.platform,"platform"),C(e.architecture,"architecture"),e.targetBinding!=="atomic-preflight"&&m("Adapter must implement atomic preflight target binding"),(!Array.isArray(e.operations)||e.operations.length===0)&&m("Adapter must declare operations");let t=new Set;for(let r of e.operations)B(r)||m(`Adapter declares unknown operation ${r}`),t.has(r)&&m(`Adapter declares duplicate operation ${r}`),t.add(r);e.certified&&!e.certificationArtifactId&&m("A certified automation adapter requires a certification artifact"),Array.isArray(e.limitations)||m("Adapter limitations must be an array"),e.operations.some(r=>r.startsWith("browser."))&&(!e.policyEnforcement.domain||!e.policyEnforcement.scheme||!e.policyEnforcement.port)&&m("Browser adapters must enforce domain, scheme, and port policy"),e.operations.some(r=>r.startsWith("computer."))&&!e.supports.immediateStop&&m("Computer-use adapters must support immediate stop")}function H(e,t,r){let n=A(e.operation);if(!t.operations.includes(e.operation))throw new a("AUTOMATION_OPERATION_UNSUPPORTED",`Adapter ${t.adapterId} does not support ${e.operation}`);if(n.surface==="browser"){let o=e.executionContract.browser.mode;if(o==="none"||n.effect==="act"&&o!=="act")throw new a("AUTOMATION_POLICY_DENIED",`Execution contract denies ${e.operation}`);if(Me(e,r,n.effect==="act"),e.operation==="browser.download"&&e.executionContract.browser.downloads==="deny")throw new a("AUTOMATION_POLICY_DENIED","Execution contract denies browser downloads");if(e.operation==="browser.upload"&&e.executionContract.browser.uploads==="deny")throw new a("AUTOMATION_POLICY_DENIED","Execution contract denies browser uploads");if(e.operation.startsWith("browser.record.")&&e.executionContract.browser.recording!=="bounded")throw new a("AUTOMATION_POLICY_DENIED","Execution contract denies browser recording")}else{let o=e.executionContract.computer.mode;if(o==="none"||n.effect==="act"&&o!=="act")throw new a("AUTOMATION_POLICY_DENIED",`Execution contract denies ${e.operation}`);let i=e.executionContract.computer.allowedApplications,d=e.operation==="computer.launch"?Ve(e):r.applicationId??e.declaredTarget?.applicationId;if((e.operation==="computer.launch"||i.length>0)&&(!d||!i.includes(d)))throw new a("AUTOMATION_POLICY_DENIED",`Application ${d??"<unknown>"} is not allowed`)}}function fe(e,t){let r=A(e.operation),n=r.surface==="browser"?r.effect==="act"?"browser-act":"browser-read":r.effect==="act"?"computer-act":"computer-observe";return{subject:{runId:e.identity.runId,agentId:e.identity.agentId,...e.identity.turnId?{turnId:e.identity.turnId}:{},toolName:e.governingToolName,operationId:e.operationId},kind:n,operation:e.operation,...se(e,t)?{resource:se(e,t)}:{},...de(t)?{destination:de(t)}:{}}}function se(e,t){return e.declaredTarget?.resource??Be(t)}function pe(e){let t=A(e.operation).evidence,r=e.evidencePolicy??{},n=F(t.before,r.before),o=F(t.after,r.after),i=F(t.recording,r.recording),d=r.retainUntil;return d&&!me(d)&&h("evidencePolicy.retainUntil must be an ISO 8601 timestamp"),{before:n,after:o,recording:i,sensitivity:r.sensitivity??"confidential",...d?{retainUntil:d}:{},...r.legalHold!==void 0?{legalHold:r.legalHold}:{}}}function Ue(e){let t=e.executionContract.identity,r=["runId","agentId","sessionId","turnId","taskId","workspaceId"];for(let n of r){let o=t[n],i=e.identity[n];if(o!==void 0&&o!==i)throw new a("AUTOMATION_IDENTITY_MISMATCH",`Automation identity ${n} does not match the execution contract`)}}function Me(e,t,r){let n=t.url??t.origin??e.declaredTarget?.url??e.declaredTarget?.origin;if(!n){if(["browser.tabs.list","browser.wait"].includes(e.operation))return;throw new a("AUTOMATION_PREFLIGHT_INVALID","Browser preflight did not bind an effective URL")}let o;try{o=new URL(n)}catch{throw new a("AUTOMATION_POLICY_DENIED","Browser target URL is invalid")}if(o.username||o.password)throw new a("AUTOMATION_POLICY_DENIED","Browser target URLs cannot contain credentials");let i=o.protocol.replace(/:$/,"");i!=="http"&&i!=="https"&&E(`Browser scheme ${o.protocol} is not supported`);let d=i,c=o.hostname.toLowerCase().replace(/\.$/,""),l=o.port?Number(o.port):d==="https"?443:80,s=e.executionContract.browser,u=$e(c);if(le(c,s.deniedDomains)&&E(`Browser domain ${c} is denied`),ce(o,e.executionContract.network.denyDestinations)&&E(`Network policy explicitly denies ${d}://${c}:${l}`),u&&s.allowLoopbackDevelopment)return;s.allowedSchemes.includes(d)||E(`Browser scheme ${o.protocol} is not allowed`),s.allowedPorts.includes(l)||E(`Browser port ${l} is not allowed`);let p=r?s.actAllowedDomains:s.readAllowedDomains;le(c,p)||E(`Browser domain ${c} is outside the ${r?"action":"read"} allowlist`),e.executionContract.network.default==="deny"&&(ce(o,e.executionContract.network.allowDestinations)||E(`Network policy does not allow ${d}://${c}:${l}`))}function ce(e,t){let r=e.protocol.replace(/:$/,""),n=e.hostname.toLowerCase().replace(/\.$/,""),o=e.port?Number(e.port):r==="https"?443:80;return t.some(i=>{let d=i.scheme?.replace(/^custom:/,"");return i.host===n&&(i.port===void 0||i.port===o)&&(d===void 0||d===r)})}function Be(e){return e.resource??e.tabId??e.pageId??e.deviceId??e.applicationId}function de(e){let t=e.origin??e.url;if(!t)return e.domain;try{return new URL(t).origin}catch{return t}}function Ve(e){let t=e.parameters.target,r=t&&typeof t=="object"&&!Array.isArray(t)?t.app_id:void 0,n=e.parameters.applicationId??r??e.declaredTarget?.applicationId;return typeof n=="string"&&n.length>0?n:void 0}function le(e,t){return t.some(r=>{let n=r.toLowerCase();if(n.startsWith(".")){let o=n.slice(1);return e===o||e.endsWith(`.${o}`)}return e===n})}function $e(e){return e==="localhost"||e==="127.0.0.1"||e==="[::1]"||e==="::1"}function F(e,t){let r={disabled:0,optional:1,required:2};return!t||r[t]<=r[e]?e:t}function w(e,t){(typeof e!="string"||!ke.test(e))&&h(`${t} is invalid`)}function C(e,t){(typeof e!="string"||e.trim().length===0||e.length>256)&&m(`${t} is invalid`)}function me(e){return typeof e=="string"&&e.includes("T")&&Number.isFinite(Date.parse(e))}function E(e){throw new a("AUTOMATION_POLICY_DENIED",e)}function h(e){throw new a("AUTOMATION_REQUEST_INVALID",e)}function m(e){throw new a("AUTOMATION_OPERATION_UNSUPPORTED",e)}import{createHash as je}from"node:crypto";var Ie=["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"],Ae=["draft","pending_review","approved","rejected","superseded","archived"],he=["public","internal","confidential","restricted"],ge=["agent","tool","user","system","integration"],be=["requirement","design-decision","risk","task","agent","run","tool-call","edit","commit","test-case","test-run","finding","approval","artifact","release","claim"],Ee=["decomposes","depends_on","implements","changes","tests","verifies","finds","fixes","reviews","approves","rejects","supersedes","derived_from","produced_by","supports_claim","contradicts_claim","released_as"];import{createHash as Fe}from"node:crypto";function R(e){return{algorithm:"sha256",value:Fe("sha256").update(e).digest("hex")}}var He="[\\u0000-\\u001f\\u007f]",Hr=new RegExp(He);var jr=new Set(Ae),Gr=new Set(he),Wr=new Set(ge),zr=new Set(Ie),Jr=new Set(be),qr=new Set(Ee);var N=class extends Error{constructor(r,n,o,i){super(n,i);this.code=r;this.detail=o;this.name="XenoArtifactRepositoryError"}code;detail};var G=32*1024*1024,Ge=1024*1024*1024,We=/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,255}$/;function W(e){let r=(e.now??(()=>new Date().toISOString()))(),n=new Set;return e.evidence.map((o,i)=>{if(Je(o),n.has(o.evidenceId))throw new a("AUTOMATION_EVIDENCE_INVALID",`Duplicate evidence ID ${o.evidenceId}`);n.add(o.evidenceId);let d=ze(o),c=je("sha256").update(`${e.request.operationId}\0${o.evidenceId}\0${d.hash.value}`).digest("hex").slice(0,32);return{schemaVersion:1,artifactId:`automation_${c}`,revision:1,kind:o.kind,title:o.title,...o.description?{description:o.description}:{},state:"draft",createdAt:r,mediaType:o.mediaType,sensitivity:o.sensitivity??e.policy.sensitivity,identity:{...e.request.identity},content:d,provenance:{producer:{kind:"tool",id:e.request.governingToolName,displayName:e.manifest.adapterId,profileFingerprint:e.request.executionContract.profile.fingerprint},operationId:e.request.operationId,executionContractFingerprint:e.request.executionContract.fingerprint,capabilityLeaseIds:[e.request.capabilityLeaseId],attributes:{automationProtocolVersion:e.request.protocolVersion,automationOperation:e.request.operation,automationEvidenceId:o.evidenceId,automationEvidencePhase:o.phase,adapterId:e.manifest.adapterId,adapterVersion:e.manifest.adapterVersion,evidenceIndex:i}},...o.anchors?{anchors:structuredClone(o.anchors)}:{},...e.policy.retainUntil||e.policy.legalHold!==void 0?{retention:{...e.policy.retainUntil?{retainUntil:e.policy.retainUntil}:{},...e.policy.legalHold!==void 0?{legalHold:e.policy.legalHold}:{}}}:{},extensions:{...o.extensions??{},xenoAutomation:{phase:o.phase,adapter:e.manifest.adapterId,certifiedAdapter:e.manifest.certified}}}})}async function z(e,t){if(!e)return t.map(n=>structuredClone(n));let r=[];for(let n of t)try{let o=await e.create(n);r.push(o.artifact)}catch(o){if(o instanceof N&&o.code==="ARTIFACT_ALREADY_EXISTS"){let i=await e.require(n.artifactId,n.revision);if(i.artifact.content.hash.value===n.content.hash.value){r.push(i.artifact);continue}}throw new a("AUTOMATION_EVIDENCE_PERSISTENCE_FAILED",`Failed to persist automation evidence ${n.artifactId}`,{artifactId:n.artifactId},{cause:o})}return r}function O(e,t,r){if(t[r]==="required"&&!e.some(n=>n.phase===r))throw new a("AUTOMATION_EVIDENCE_REQUIRED",`Automation operation requires ${r} evidence before it can be trusted`)}function ze(e){if(e.content.type==="text"){let t=Buffer.byteLength(e.content.text,"utf8");return we(t),{hash:R(e.content.text),sizeBytes:t,storage:{type:"inline",text:e.content.text},encoding:"utf8",...e.redactedPreview?{redactedPreview:e.redactedPreview}:{}}}if(e.content.type==="base64"){let t=qe(e.content.base64);return we(t.byteLength),{hash:R(t),sizeBytes:t.byteLength,storage:{type:"inline",base64:e.content.base64},encoding:"base64",...e.redactedPreview?{redactedPreview:e.redactedPreview}:{}}}if(!Number.isSafeInteger(e.content.sizeBytes)||e.content.sizeBytes<0||e.content.sizeBytes>Ge)throw new a("AUTOMATION_EVIDENCE_INVALID","Referenced evidence size is invalid");if(!e.content.hash?.algorithm||!e.content.hash.value)throw new a("AUTOMATION_EVIDENCE_INVALID","Referenced evidence requires a content hash");if(e.content.hash.algorithm==="sha256"&&!/^[a-f0-9]{64}$/.test(e.content.hash.value))throw new a("AUTOMATION_EVIDENCE_INVALID","Referenced evidence SHA-256 is invalid");return{hash:{...e.content.hash},sizeBytes:e.content.sizeBytes,storage:structuredClone(e.content.storage),...e.content.encoding?{encoding:e.content.encoding}:{},...e.redactedPreview?{redactedPreview:e.redactedPreview}:{}}}function Je(e){(!e||typeof e!="object")&&g("Evidence must be an object"),We.test(e.evidenceId)||g("Evidence ID is invalid"),["before","action","after","recording","diagnostic"].includes(e.phase)||g("Evidence phase is invalid"),(!e.kind||!e.title?.trim()||e.title.length>512)&&g("Evidence kind and title are required"),/^[\w!#$&^_.+-]+\/[\w!#$&^_.+-]+(?:;.*)?$/.test(e.mediaType)||g("Evidence media type is invalid")}function qe(e){(e.length===0||e.length>Math.ceil(G/3)*4+4)&&g("Inline base64 evidence is empty or too large"),(!/^[A-Za-z0-9+/]*={0,2}$/.test(e)||e.length%4!==0)&&g("Inline evidence is not canonical base64");let t=Buffer.from(e,"base64");return t.toString("base64")!==e&&g("Inline evidence is not canonical base64"),t}function we(e){e>G&&g(`Inline evidence exceeds ${G} bytes`)}function g(e){throw new a("AUTOMATION_EVIDENCE_INVALID",e)}import{createHash as Ke}from"node:crypto";var ye=3e4,Ye=1e3,ve=class{adapter;leaseAuthority;artifactRepository;now;executions=new Map;active=new Map;constructor(t){this.adapter=t.adapter,this.leaseAuthority=t.leaseAuthority,this.artifactRepository=t.artifactRepository,this.now=t.now??(()=>new Date().toISOString())}execute(t,r){let n=rt(t),o=this.executions.get(t.operationId);if(o){if(o.fingerprint!==n)throw new a("AUTOMATION_OPERATION_CONFLICT",`Operation ${t.operationId} was already submitted with different authority or parameters`);return o.promise}let i=new AbortController,d=nt(r,i);this.active.set(t.operationId,i);let c=this.executeFresh(t,i.signal).finally(()=>{d(),this.active.delete(t.operationId)});return this.executions.set(t.operationId,{fingerprint:n,promise:c}),this.trimIdempotencyRecords(),c}async stop(t,r="human-stop"){let n=this.active.get(t);return n?(n.abort(new Error(r)),await this.adapter.stop?.(t,r),!0):!1}async executeFresh(t,r){ue(t),q(r);let n=await this.adapter.manifest();_(n);let o=A(t.operation),i=pe(t),d=this.now(),c=await this.adapter.preflight(t,r);Ze(c,this.now()),H(t,n,c.observedTarget),q(r);let l=c.evidence??[];O(l,i,"before");let s=await z(this.artifactRepository,W({request:t,manifest:n,policy:i,evidence:l,now:this.now}));if(q(r),Date.parse(c.expiresAt)<=Date.parse(this.now()))throw new a("AUTOMATION_PREFLIGHT_INVALID","Automation preflight expired before authority consumption");let u=fe(t,c.observedTarget),p=await this.leaseAuthority.consume(t.capabilityLeaseId,t.expectedLeaseVersion,u),v={contractFingerprint:t.executionContract.fingerprint,lease:p,capabilityUse:u},f;try{f=await this.adapter.execute(t,c,v,r)}catch(I){return J({request:t,manifest:n,descriptorEffect:o.effect,target:c.observedTarget,lease:p,artifacts:s,startedAt:d,completedAt:this.now(),status:r.aborted?"cancelled":"error",code:r.aborted?"AUTOMATION_CANCELLED":"AUTOMATION_ADAPTER_ERROR",message:r.aborted?"Automation operation was stopped":ot(I)})}Qe(f);let ee=et(c.observedTarget,f.observedTarget),x;try{H(t,n,f.observedTarget)}catch(I){x=I instanceof Error?I:new Error(String(I))}let S=f.evidence??[];tt(l,S);let te=[],P;try{O(S,i,"after"),O([...l,...S],i,"recording"),te=await z(this.artifactRepository,W({request:t,manifest:n,policy:i,evidence:S,now:this.now}))}catch(I){P=I instanceof Error?I:new Error(String(I))}let X=[...s,...te];return ee||x?J({request:t,manifest:n,descriptorEffect:o.effect,target:f.observedTarget,lease:p,artifacts:X,startedAt:f.startedAt,completedAt:f.completedAt,status:"error",code:"AUTOMATION_TARGET_CHANGED",message:ee??x.message}):P?J({request:t,manifest:n,descriptorEffect:o.effect,target:f.observedTarget,lease:p,artifacts:X,startedAt:f.startedAt,completedAt:f.completedAt,status:"evidence-incomplete",code:"AUTOMATION_EVIDENCE_INCOMPLETE",message:P.message}):{operationId:t.operationId,status:f.status,effect:o.effect,startedAt:f.startedAt,completedAt:f.completedAt,adapter:Te(n),target:structuredClone(f.observedTarget),...f.data!==void 0?{data:structuredClone(f.data)}:{},artifacts:X,lease:Se(p),...f.error?{error:{...f.error}}:{}}}trimIdempotencyRecords(){for(;this.executions.size>Ye;){let t=this.executions.keys().next().value;if(!t||this.active.has(t))break;this.executions.delete(t)}}};function Ze(e,t){if(!e||typeof e!="object"||!e.token?.trim())throw new a("AUTOMATION_PREFLIGHT_INVALID","Adapter returned an invalid preflight token");let r=Date.parse(e.preparedAt),n=Date.parse(e.expiresAt),o=Date.parse(t);if(!Number.isFinite(r)||!Number.isFinite(n)||n<=r||n<=o)throw new a("AUTOMATION_PREFLIGHT_INVALID","Adapter returned an expired or invalid preflight window");if(n-r>ye)throw new a("AUTOMATION_PREFLIGHT_INVALID",`Preflight TTL exceeds ${ye} ms`);if(!e.observedTarget||typeof e.observedTarget!="object")throw new a("AUTOMATION_PREFLIGHT_INVALID","Adapter did not bind an observed target")}function Qe(e){if(!e||typeof e!="object")throw new a("AUTOMATION_REQUEST_INVALID","Adapter returned no result");if(!["ok","denied","cancelled","error"].includes(e.status))throw new a("AUTOMATION_REQUEST_INVALID","Adapter returned an invalid status");if(!Number.isFinite(Date.parse(e.startedAt))||!Number.isFinite(Date.parse(e.completedAt)))throw new a("AUTOMATION_REQUEST_INVALID","Adapter result timestamps are invalid");if(Date.parse(e.completedAt)<Date.parse(e.startedAt))throw new a("AUTOMATION_REQUEST_INVALID","Adapter completion precedes its start");if(!e.observedTarget||typeof e.observedTarget!="object")throw new a("AUTOMATION_REQUEST_INVALID","Adapter result has no observed target")}function et(e,t){let r=["tabId","deviceId","displayId"];for(let n of r)if(e[n]!==void 0&&e[n]!==t[n])return`Adapter changed bound ${n} between preflight and execution`}function tt(e,t){let r=new Set(e.map(n=>n.evidenceId));for(let n of t){if(r.has(n.evidenceId))throw new a("AUTOMATION_EVIDENCE_INVALID",`Duplicate evidence ID ${n.evidenceId}`);r.add(n.evidenceId)}}function J(e){return{operationId:e.request.operationId,status:e.status,effect:e.descriptorEffect,startedAt:e.startedAt,completedAt:e.completedAt,adapter:Te(e.manifest),target:structuredClone(e.target),artifacts:e.artifacts,lease:Se(e.lease),error:{code:e.code,message:e.message}}}function Te(e){return{adapterId:e.adapterId,adapterVersion:e.adapterVersion,platform:e.platform,architecture:e.architecture}}function Se(e){return{leaseId:e.leaseId,version:e.version,state:e.state,useCount:e.useCount}}function rt(e){return Ke("sha256").update(JSON.stringify(K(e))).digest("hex")}function K(e){return Array.isArray(e)?e.map(K):!e||typeof e!="object"?e:Object.fromEntries(Object.entries(e).filter(([,t])=>t!==void 0).sort(([t],[r])=>t.localeCompare(r)).map(([t,r])=>[t,K(r)]))}function nt(e,t){if(!e)return()=>{};let r=()=>t.abort(e.reason);return e.aborted?r():e.addEventListener("abort",r,{once:!0}),()=>e.removeEventListener("abort",r)}function q(e){if(e.aborted)throw new a("AUTOMATION_CANCELLED","Automation operation was stopped before dispatch")}function ot(e){return e instanceof Error&&e.message.slice(0,1024)||"Automation adapter failed"}function it(e,t=()=>new Date().toISOString()){let r=[];at(r,"manifest.valid",()=>_(e));let n=new Set(e.operations);return y(r,n,e.supports.consoleInspection,"browser.console.read","console inspection"),y(r,n,e.supports.networkInspection,"browser.network.read","network inspection"),y(r,n,e.supports.storageInspection,"browser.storage.read","storage inspection"),y(r,n,e.supports.pageErrorInspection,"browser.page-errors.read","page-error inspection"),y(r,n,e.supports.recordings,"browser.record.start","recording start"),y(r,n,e.supports.recordings,"browser.record.stop","recording stop"),n.has("browser.upload")&&b(r,"policy.upload",e.policyEnforcement.upload,"Upload policy is enforced"),n.has("browser.download")&&b(r,"policy.download",e.policyEnforcement.download,"Download policy is enforced"),[...n].some(o=>o.startsWith("browser."))&&(b(r,"policy.redirect",e.policyEnforcement.redirect,"Redirect policy is enforced"),b(r,"control.handback",e.supports.deterministicHandback,"Deterministic hand-back is supported")),[...n].some(o=>o.startsWith("computer."))&&(b(r,"control.stop",e.supports.immediateStop,"Immediate human stop is supported"),b(r,"privacy.redaction",e.supports.sensitiveRegionRedaction,"Sensitive-region redaction is supported")),b(r,"certification.binding",!e.certified||!!e.certificationArtifactId,e.certified?"Certification artifact is bound":"Adapter does not claim certification"),{protocolVersion:1,adapter:{adapterId:e.adapterId,adapterVersion:e.adapterVersion,platform:e.platform,architecture:e.architecture},generatedAt:t(),passed:r.every(o=>o.status==="pass"),checks:r}}function wn(e){let r=it(e).checks.filter(n=>n.status==="fail");if(r.length>0)throw new a("AUTOMATION_OPERATION_UNSUPPORTED",r.map(n=>`${n.id}: ${n.message}`).join("; "))}function y(e,t,r,n,o){let i=t.has(n);b(e,`capability.${n}`,r===i,r===i?`${o} declaration matches the operation catalog`:`${o} declaration does not match ${n}`)}function at(e,t,r){try{r(),e.push({id:t,status:"pass",message:"Manifest satisfies the protocol contract"})}catch(n){e.push({id:t,status:"fail",message:n instanceof Error?n.message:String(n)})}}function b(e,t,r,n){e.push({id:t,status:r?"pass":"fail",message:n})}var st=6e4,ct=48*1024*1024,Ce=class{endpoint;token;timeoutMs;maxResponseBytes;fetchImpl;constructor(t){if(this.endpoint=dt(t.baseUrl),this.token=lt(t.token),this.timeoutMs=_e(t.timeoutMs??st,1e3,3e5,"timeoutMs"),this.maxResponseBytes=_e(t.maxResponseBytes??ct,1024,128*1024*1024,"maxResponseBytes"),this.fetchImpl=t.fetch??globalThis.fetch,typeof this.fetchImpl!="function")throw new a("AUTOMATION_TRANSPORT_ERROR","A Fetch API implementation is required")}manifest(){return this.request("manifest","GET")}preflight(t,r){return this.request("preflight","POST",t,r)}execute(t,r,n,o){return this.request("execute","POST",{request:t,preflight:r,grant:n},o)}async stop(t,r){await this.request("stop","POST",{operationId:t,reason:r.slice(0,512)})}async request(t,r,n,o){let i=new AbortController,d=pt(o,i),c=setTimeout(()=>i.abort(new Error("automation transport timeout")),this.timeoutMs);c.unref?.();try{let l=new URL(t,this.endpoint),s=await this.fetchImpl(l,{method:r,redirect:"error",cache:"no-store",credentials:"omit",headers:{authorization:`Bearer ${this.token}`,accept:"application/json",...r==="POST"?{"content-type":"application/json"}:{}},...r==="POST"?{body:JSON.stringify(n??{})}:{},signal:i.signal}),u=await ut(s,this.maxResponseBytes);if(!s.ok){let p=ft(u);throw new a("AUTOMATION_TRANSPORT_ERROR",`XENO Browser rejected ${t}: ${p.message}`,{status:s.status,route:t,adapterCode:p.code})}if(!Y(u)||u.ok!==!0||!("result"in u))throw new a("AUTOMATION_RESPONSE_INVALID",`XENO Browser returned an invalid ${t} envelope`);return u.result}catch(l){if(l instanceof a)throw l;let s=o?.aborted;throw new a(s?"AUTOMATION_CANCELLED":"AUTOMATION_TRANSPORT_ERROR",s?"Automation transport was stopped":`XENO Browser ${t} transport failed`,{route:t},{cause:l})}finally{clearTimeout(c),d()}}};function dt(e){let t;try{t=new URL(e)}catch(n){throw new a("AUTOMATION_TRANSPORT_ERROR","XENO Browser base URL is invalid",void 0,{cause:n})}if(t.protocol!=="http:"&&t.protocol!=="https:")throw new a("AUTOMATION_TRANSPORT_ERROR","XENO Browser transport requires HTTP(S)");if(t.username||t.password||t.search||t.hash)throw new a("AUTOMATION_TRANSPORT_ERROR","XENO Browser base URL cannot contain credentials, query, or fragment");let r=t.hostname.toLowerCase().replace(/^\[|\]$/g,"").replace(/\.$/,"");if(r!=="localhost"&&r!=="127.0.0.1"&&r!=="::1")throw new a("AUTOMATION_TRANSPORT_ERROR","XENO Browser transport must use a loopback host");if(!t.port)throw new a("AUTOMATION_TRANSPORT_ERROR","XENO Browser transport requires an explicit port");return t.pathname="/v1/automation/",t}function lt(e){if(typeof e!="string"||e.length<32||e.length>512||/\s/.test(e))throw new a("AUTOMATION_TRANSPORT_ERROR","XENO Browser session token is invalid");return e}async function ut(e,t){let r=Number(e.headers.get("content-length"));if(Number.isFinite(r)&&r>t)throw new a("AUTOMATION_RESPONSE_INVALID",`XENO Browser response exceeds ${t} bytes`);if(e.headers.get("content-type")?.split(";")[0]?.trim().toLowerCase()!=="application/json")throw new a("AUTOMATION_RESPONSE_INVALID","XENO Browser response is not application/json");if(!e.body)throw new a("AUTOMATION_RESPONSE_INVALID","XENO Browser response body is missing");let o=e.body.getReader(),i=[],d=0;for(;;){let{done:s,value:u}=await o.read();if(s)break;if(d+=u.byteLength,d>t)throw await o.cancel("response too large"),new a("AUTOMATION_RESPONSE_INVALID",`XENO Browser response exceeds ${t} bytes`);i.push(u)}let c=new Uint8Array(d),l=0;for(let s of i)c.set(s,l),l+=s.byteLength;try{return JSON.parse(new TextDecoder("utf-8",{fatal:!0}).decode(c))}catch(s){throw new a("AUTOMATION_RESPONSE_INVALID","XENO Browser response contains invalid JSON",void 0,{cause:s})}}function ft(e){return Y(e)&&Y(e.error)?{code:typeof e.error.code=="string"?e.error.code.slice(0,128):"UNKNOWN",message:typeof e.error.message=="string"?e.error.message.slice(0,1024):"request failed"}:{code:"UNKNOWN",message:"request failed"}}function pt(e,t){if(!e)return()=>{};let r=()=>t.abort(e.reason);return e.aborted?r():e.addEventListener("abort",r,{once:!0}),()=>e.removeEventListener("abort",r)}function _e(e,t,r,n){if(!Number.isSafeInteger(e)||e<t||e>r)throw new a("AUTOMATION_TRANSPORT_ERROR",`${n} must be an integer from ${t} to ${r}`);return e}function Y(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}import{createHash as mt,randomUUID as It}from"node:crypto";var At=8*1024*1024,ht=4;function _n(e){return Ot(e.operations??M).map(r=>gt(r,e.runtime))}function gt(e,t){return{definition:{name:e,description:vt(e),input_schema:bt(e)},projectPolicyInput(r){let n=Ct(e,r),o=St(e,r);return{observabilityInput:n,permissionInput:o,permissionPreview:_t(e,r),approvalKey:`xeno-automation:${e}:${xt(r)}`,riskLevel:Tt(e)}},async execute(r,n){let o=n?.authorization;if(!o||o.toolName!==e)return{success:!1,output:"",error:"Governed automation requires a host-issued authorization receipt",errorCode:"AUTOMATION_AUTHORIZATION_RECEIPT_REQUIRED",retryable:!1};let i=n.operationId??`automation_${It()}`,d=Q(e,r);n.reportProgress?.({activity:"state",message:`Authorizing ${e}`});try{let c=await t.execute({operation:e,governingToolName:e,operationId:i,idempotencyKey:i,parameters:structuredClone(r),...d?{declaredTarget:d}:{},authorization:o,...n.signal?{signal:n.signal}:{},...n.reportProgress?{reportProgress:n.reportProgress}:{}}),l=c.status==="ok";return{success:l,output:JSON.stringify(Rt(c)),...l?{}:{error:c.error?.message??`Governed automation ended with ${c.status}`,errorCode:c.error?.code??`AUTOMATION_${c.status.toUpperCase().replaceAll("-","_")}`},assistantContent:Nt(c),evidence:c.artifacts.map(s=>({id:s.artifactId,kind:"artifact",status:c.status==="evidence-incomplete"?"failed":"verified",observedAt:s.updatedAt??s.createdAt,operationId:i,detail:{artifact_kind:s.kind,revision:s.revision,sensitivity:s.sensitivity}})),retryable:c.error?.retryable??!1}}catch(c){let l=n.signal?.aborted===!0;return{success:!1,output:"",error:l?"Governed automation was stopped":Pt(c),errorCode:l?"AUTOMATION_CANCELLED":Xt(c),retryable:!l}}}}}function bt(e){let t=Et(e),r=wt(e);return{type:"object",properties:t,...r.length>0?{required:r}:{},...e==="browser.locate"?{oneOf:[{required:["selector"]},{required:["text"]}]}:{},additionalProperties:!1}}function Et(e){let t=(d,c=8192)=>({type:"string",minLength:1,maxLength:c,description:d}),r={type:"number"},n={type:"boolean"},o={type:"object",properties:{x:r,y:r},required:["x","y"],additionalProperties:!1},i={deviceId:t("Target xeno-use device ID.",256),applicationId:t("Expected or launch-target application ID.",512),displayId:t("Target display ID.",256)};switch(e){case"browser.navigate":return{url:t("Destination URL."),waitUntil:{enum:["load","none"]},tabId:t("Expected active tab ID. Hosts with multiple visible tabs should require this.",256)};case"browser.wait":return{until:{enum:["load","ms"]},value:{type:"integer",minimum:0,maximum:6e4}};case"browser.snapshot":return{mode:{enum:["text","html","markdown","a11y"]},tabId:t("Expected active tab ID.",256)};case"browser.screenshot":return{tabId:t("Expected active tab ID.",256)};case"browser.locate":return{selector:t("CSS selector."),text:t("Visible text to locate.")};case"browser.click":return{selector:t("CSS selector returned by browser.snapshot or browser.locate."),tabId:t("Expected active tab ID.",256)};case"browser.type":return{selector:t("CSS selector."),text:{type:"string",maxLength:65536},clear:n,submit:n,tabId:t("Expected active tab ID.",256)};case"browser.key":return{combo:t("Key combo such as Control+a or Enter.",256),tabId:t("Expected active tab ID.",256)};case"browser.select":return{selector:t("CSS selector."),value:t("Option value."),tabId:t("Expected active tab ID.",256)};case"browser.scroll":return{selector:t("Optional CSS selector."),dx:r,dy:r,tabId:t("Expected active tab ID.",256)};case"browser.tabs.open":return{url:t("URL to open in an isolated browser tab.")};case"browser.tabs.close":return{tabId:t("Tab ID to close.",256)};case"browser.console.read":case"browser.network.read":case"browser.page-errors.read":return{limit:{type:"integer",minimum:1,maximum:1e3},clear:n,tabId:t("Expected active tab ID.",256)};case"browser.storage.read":return{tabId:t("Expected active tab ID.",256)};case"browser.upload":return{selector:t("File input or drop-target selector."),backendNodeId:{type:"integer",minimum:1},hostPaths:{type:"array",items:t("Host file path.",32768),minItems:1,maxItems:64},drop:n,tabId:t("Expected active tab ID.",256)};case"browser.download":return{toPath:t("Approved destination path.",32768),trigger:{type:"object",properties:{url:t("Download URL."),selector:t("Download trigger selector.")},oneOf:[{required:["url"]},{required:["selector"]}],additionalProperties:!1},tabId:t("Expected active tab ID.",256)};case"browser.record.start":return{maxDurationMs:{type:"integer",minimum:1e3,maximum:6e4},intervalMs:{type:"integer",minimum:100,maximum:5e3},tabId:t("Expected active tab ID.",256)};case"browser.record.stop":return{tabId:t("Expected active tab ID.",256)};case"computer.observe":case"computer.screenshot":case"computer.window-state":return i;case"computer.point":return{...i,point:o,durationMs:{type:"integer",minimum:0,maximum:6e4}};case"computer.click":return{...i,point:o,button:{enum:["left","right","middle"]},modifiers:yt()};case"computer.double-click":case"computer.right-click":return{...i,point:o};case"computer.drag":return{...i,from:o,to:o,durationMs:{type:"integer",minimum:0,maximum:6e4}};case"computer.type":return{...i,text:{type:"string",maxLength:65536}};case"computer.key":return{...i,combo:t("Key combo such as Control+a or Enter.",256)};case"computer.scroll":return{...i,at:o,delta:o};case"computer.wait":return{...i,milliseconds:{type:"integer",minimum:0,maximum:3e5}};case"computer.launch":return{...i,applicationId:t("Explicitly allowlisted application ID.",512)};case"browser.back":case"browser.forward":case"browser.reload":return{tabId:t("Expected active tab ID.",256)};case"browser.tabs.list":return{}}}function wt(e){switch(e){case"browser.navigate":case"browser.tabs.open":return["url"];case"browser.click":return["selector"];case"browser.type":return["selector","text"];case"browser.key":return["combo"];case"browser.select":return["selector","value"];case"browser.upload":return["hostPaths"];case"browser.download":return["toPath","trigger"];case"computer.point":case"computer.click":case"computer.double-click":case"computer.right-click":return["point"];case"computer.drag":return["from","to"];case"computer.type":return["text"];case"computer.key":return["combo"];case"computer.scroll":return["at","delta"];case"computer.launch":return["applicationId"];default:return[]}}function yt(){return{type:"object",properties:{shift:{type:"boolean"},ctrl:{type:"boolean"},alt:{type:"boolean"},meta:{type:"boolean"}},additionalProperties:!1}}function vt(e){let t=A(e),r=e.split(".").slice(1).join(" ");return`${t.effect==="act"?"Act on":"Inspect"} the ${t.surface} using governed ${r} automation. The host requires policy approval, an exact capability lease, target-bound preflight, and durable evidence.`}function Tt(e){return A(e).effect==="observe"?e==="browser.navigate"||e==="browser.tabs.open"?"medium":"low":["browser.type","browser.upload","browser.download","computer.type","computer.key","computer.launch"].includes(e)?"high":"medium"}function St(e,t){let r=Q(e,t),n={operation:e};r&&(n.target=r);for(let o of["selector","clear","submit","combo","value","dx","dy","point","from","to","at","delta","milliseconds"])t[o]!==void 0&&(n[o]=structuredClone(t[o]));return typeof t.text=="string"&&(n.text=`[redacted ${t.text.length} characters]`),Array.isArray(t.hostPaths)&&(n.hostPaths=t.hostPaths.map(()=>"[redacted host path]")),typeof t.toPath=="string"&&(n.toPath="[redacted destination path]"),n}function Ct(e,t){let r=structuredClone(t);return typeof r.text=="string"&&(r.text=`[redacted ${r.text.length} characters]`),Array.isArray(r.hostPaths)&&(r.hostPaths=r.hostPaths.map(()=>"[redacted host path]")),typeof r.toPath=="string"&&(r.toPath="[redacted destination path]"),Ne(r.trigger)&&typeof r.trigger.url=="string"&&(r.trigger={...r.trigger,url:Re(r.trigger.url)}),typeof r.url=="string"&&(r.url=Re(r.url)),{operation:e,...r}}function _t(e,t){let r=Q(e,t),n=r?.url??r?.applicationId??r?.deviceId??r?.tabId??r?.resource??"current target";return`${e} on ${n}`}function Q(e,t){let r={};return typeof t.url=="string"&&(r.url=t.url),typeof t.tabId=="string"&&(r.tabId=t.tabId),typeof t.deviceId=="string"&&(r.deviceId=t.deviceId),typeof t.applicationId=="string"&&(r.applicationId=t.applicationId),typeof t.displayId=="string"&&(r.displayId=t.displayId),(e==="browser.navigate"||e==="browser.tabs.list"||e==="browser.tabs.open")&&(r.resource="browser-tabs"),Object.keys(r).length>0?r:void 0}function Rt(e){return{operationId:e.operationId,status:e.status,effect:e.effect,startedAt:e.startedAt,completedAt:e.completedAt,adapter:e.adapter,target:e.target,...e.data!==void 0?{data:e.data}:{},artifacts:e.artifacts.map(t=>({artifactId:t.artifactId,revision:t.revision,kind:t.kind,title:t.title,state:t.state,mediaType:t.mediaType,sensitivity:t.sensitivity,hash:t.content.hash,sizeBytes:t.content.sizeBytes})),lease:e.lease,...e.error?{error:e.error}:{}}}function Nt(e){let t=[];for(let r of e.artifacts){if(t.length>=ht||!r.mediaType.startsWith("image/"))continue;let n=r.content.storage;if(n.type!=="inline"||typeof n.base64!="string")continue;let o=Math.floor(n.base64.length*.75);o<=0||o>At||t.push({type:"image_url",image_url:{url:`data:${r.mediaType};base64,${n.base64}`,detail:"high"}})}return t}function Ot(e){let t=new Set(M),r=new Set;for(let n of e){if(!t.has(n))throw new TypeError(`Unsupported XENO automation operation: ${String(n)}`);r.add(n)}return Array.from(r)}function xt(e){return mt("sha256").update(Z(e)).digest("hex")}function Z(e){return Array.isArray(e)?`[${e.map(Z).join(",")}]`:Ne(e)?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${Z(e[t])}`).join(",")}}`:JSON.stringify(e)??"null"}function Re(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch{return"[invalid URL]"}}function Pt(e){return e instanceof Error?e.message:String(e)}function Xt(e){return e&&typeof e=="object"&&"code"in e&&typeof e.code=="string"?e.code:"AUTOMATION_EXECUTION_FAILED"}function Ne(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}export{M as XENO_AUTOMATION_OPERATIONS,T as XENO_AUTOMATION_PROTOCOL_VERSION,a as XenoAutomationError,ve as XenoGovernedAutomationExecutor,Ce as XenoLoopbackAutomationAdapter,O as assertRequiredXenoAutomationEvidence,_ as assertValidXenoAutomationAdapterManifest,ue as assertValidXenoAutomationRequest,wn as assertXenoAutomationAdapterConformant,H as assertXenoAutomationAuthority,fe as buildXenoAutomationCapabilityUse,it as createXenoAutomationConformanceReport,_n as createXenoGovernedAutomationTools,A as describeXenoAutomationOperation,B as isXenoAutomationOperation,W as materializeXenoAutomationEvidence,z as persistXenoAutomationEvidence,pe as resolveXenoAutomationEvidencePolicy};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/automation/types.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/automation/types.ts":{"bytes":7223,"imports":[],"format":"esm"},"src/automation/operations.ts":{"bytes":3367,"imports":[],"format":"esm"},"src/automation/errors.ts":{"bytes":866,"imports":[],"format":"esm"},"src/security/path-policy.ts":{"bytes":5541,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/media/xeno-deflate.ts":{"bytes":20035,"imports":[],"format":"esm"},"src/security/windows-process-containment.ts":{"bytes":50179,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/media/xeno-deflate.ts","kind":"import-statement","original":"../media/xeno-deflate.js"}],"format":"esm"},"src/security/linux-process-containment.ts":{"bytes":5665,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/security/containment-certification.ts":{"bytes":13312,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/security/environment-policy.ts":{"bytes":1195,"imports":[],"format":"esm"},"src/security/mxc-containment.ts":{"bytes":28272,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"src/security/environment-policy.ts","kind":"import-statement","original":"./environment-policy.js"},{"path":"src/security/path-policy.ts","kind":"import-statement","original":"./path-policy.js"}],"format":"esm"},"src/security/process-containment.ts":{"bytes":17308,"imports":[{"path":"src/security/windows-process-containment.ts","kind":"import-statement","original":"./windows-process-containment.js"},{"path":"src/security/linux-process-containment.ts","kind":"import-statement","original":"./linux-process-containment.js"},{"path":"src/security/path-policy.ts","kind":"import-statement","original":"./path-policy.js"},{"path":"src/security/containment-certification.ts","kind":"import-statement","original":"./containment-certification.js"},{"path":"src/security/mxc-containment.ts","kind":"import-statement","original":"./mxc-containment.js"}],"format":"esm"},"src/security/secure-execution-contract.ts":{"bytes":24510,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"src/security/path-policy.ts","kind":"import-statement","original":"./path-policy.js"},{"path":"src/security/process-containment.ts","kind":"import-statement","original":"./process-containment.js"}],"format":"esm"},"src/automation/policy.ts":{"bytes":15653,"imports":[{"path":"src/security/secure-execution-contract.ts","kind":"import-statement","original":"../security/secure-execution-contract.js"},{"path":"src/automation/errors.ts","kind":"import-statement","original":"./errors.js"},{"path":"src/automation/operations.ts","kind":"import-statement","original":"./operations.js"},{"path":"src/automation/types.ts","kind":"import-statement","original":"./types.js"}],"format":"esm"},"src/artifacts/types.ts":{"bytes":11224,"imports":[],"format":"esm"},"src/artifacts/hash.ts":{"bytes":1489,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/utils/custom-names.ts":{"bytes":2210,"imports":[],"format":"esm"},"src/artifacts/validation.ts":{"bytes":25271,"imports":[{"path":"src/artifacts/types.ts","kind":"import-statement","original":"./types.js"},{"path":"node:buffer","kind":"import-statement","external":true},{"path":"src/artifacts/hash.ts","kind":"import-statement","original":"./hash.js"},{"path":"src/utils/custom-names.ts","kind":"import-statement","original":"../utils/custom-names.js"},{"path":"src/artifacts/types.ts","kind":"import-statement","original":"./types.js"}],"format":"esm"},"src/artifacts/repository.ts":{"bytes":29289,"imports":[{"path":"src/artifacts/types.ts","kind":"import-statement","original":"./types.js"},{"path":"src/artifacts/validation.ts","kind":"import-statement","original":"./validation.js"}],"format":"esm"},"src/automation/evidence.ts":{"bytes":8618,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/artifacts/repository.ts","kind":"import-statement","original":"../artifacts/repository.js"},{"path":"src/artifacts/hash.ts","kind":"import-statement","original":"../artifacts/hash.js"},{"path":"src/artifacts/types.ts","kind":"import-statement","original":"../artifacts/types.js"},{"path":"src/automation/errors.ts","kind":"import-statement","original":"./errors.js"}],"format":"esm"},"src/automation/executor.ts":{"bytes":14249,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/automation/errors.ts","kind":"import-statement","original":"./errors.js"},{"path":"src/automation/evidence.ts","kind":"import-statement","original":"./evidence.js"},{"path":"src/automation/operations.ts","kind":"import-statement","original":"./operations.js"},{"path":"src/automation/policy.ts","kind":"import-statement","original":"./policy.js"}],"format":"esm"},"src/automation/conformance.ts":{"bytes":4331,"imports":[{"path":"src/automation/errors.ts","kind":"import-statement","original":"./errors.js"},{"path":"src/automation/policy.ts","kind":"import-statement","original":"./policy.js"},{"path":"src/automation/types.ts","kind":"import-statement","original":"./types.js"}],"format":"esm"},"src/automation/http-adapter.ts":{"bytes":8862,"imports":[{"path":"src/automation/errors.ts","kind":"import-statement","original":"./errors.js"}],"format":"esm"},"src/automation/tool-pack.ts":{"bytes":19206,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/automation/operations.ts","kind":"import-statement","original":"./operations.js"}],"format":"esm"},"src/automation/index.ts":{"bytes":282,"imports":[{"path":"src/automation/types.ts","kind":"import-statement","original":"./types.js"},{"path":"src/automation/operations.ts","kind":"import-statement","original":"./operations.js"},{"path":"src/automation/errors.ts","kind":"import-statement","original":"./errors.js"},{"path":"src/automation/policy.ts","kind":"import-statement","original":"./policy.js"},{"path":"src/automation/evidence.ts","kind":"import-statement","original":"./evidence.js"},{"path":"src/automation/executor.ts","kind":"import-statement","original":"./executor.js"},{"path":"src/automation/conformance.ts","kind":"import-statement","original":"./conformance.js"},{"path":"src/automation/http-adapter.ts","kind":"import-statement","original":"./http-adapter.js"},{"path":"src/automation/tool-pack.ts","kind":"import-statement","original":"./tool-pack.js"}],"format":"esm"}},"outputs":{"dist/automation/index.cjs":{"imports":[{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true},{"path":"node:crypto","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/automation/index.ts","inputs":{"src/automation/index.ts":{"bytesInOutput":737},"src/automation/types.ts":{"bytesInOutput":8},"src/automation/operations.ts":{"bytesInOutput":1638},"src/automation/errors.ts":{"bytesInOutput":129},"src/security/secure-execution-contract.ts":{"bytesInOutput":3310},"src/media/xeno-deflate.ts":{"bytesInOutput":1061},"src/security/windows-process-containment.ts":{"bytesInOutput":45908},"src/security/containment-certification.ts":{"bytesInOutput":442},"src/security/mxc-containment.ts":{"bytesInOutput":709},"src/security/process-containment.ts":{"bytesInOutput":999},"src/automation/policy.ts":{"bytesInOutput":7870},"src/automation/evidence.ts":{"bytesInOutput":4445},"src/artifacts/types.ts":{"bytesInOutput":818},"src/artifacts/hash.ts":{"bytesInOutput":129},"src/artifacts/validation.ts":{"bytesInOutput":146},"src/artifacts/repository.ts":{"bytesInOutput":137},"src/automation/executor.ts":{"bytesInOutput":6081},"src/automation/conformance.ts":{"bytesInOutput":2191},"src/automation/http-adapter.ts":{"bytesInOutput":4320},"src/automation/tool-pack.ts":{"bytesInOutput":10033}},"bytes":92152}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/automation/types.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/automation/types.ts":{"bytes":7223,"imports":[],"format":"esm"},"src/automation/operations.ts":{"bytes":3367,"imports":[],"format":"esm"},"src/automation/errors.ts":{"bytes":866,"imports":[],"format":"esm"},"src/security/path-policy.ts":{"bytes":5541,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/media/xeno-deflate.ts":{"bytes":20035,"imports":[],"format":"esm"},"src/security/windows-process-containment.ts":{"bytes":50179,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"src/media/xeno-deflate.ts","kind":"import-statement","original":"../media/xeno-deflate.js"}],"format":"esm"},"src/security/linux-process-containment.ts":{"bytes":5665,"imports":[{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/security/containment-certification.ts":{"bytes":13312,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true}],"format":"esm"},"src/security/environment-policy.ts":{"bytes":1195,"imports":[],"format":"esm"},"src/security/mxc-containment.ts":{"bytes":28272,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:fs","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"node:child_process","kind":"import-statement","external":true},{"path":"node:url","kind":"import-statement","external":true},{"path":"src/security/environment-policy.ts","kind":"import-statement","original":"./environment-policy.js"},{"path":"src/security/path-policy.ts","kind":"import-statement","original":"./path-policy.js"}],"format":"esm"},"src/security/process-containment.ts":{"bytes":17308,"imports":[{"path":"src/security/windows-process-containment.ts","kind":"import-statement","original":"./windows-process-containment.js"},{"path":"src/security/linux-process-containment.ts","kind":"import-statement","original":"./linux-process-containment.js"},{"path":"src/security/path-policy.ts","kind":"import-statement","original":"./path-policy.js"},{"path":"src/security/containment-certification.ts","kind":"import-statement","original":"./containment-certification.js"},{"path":"src/security/mxc-containment.ts","kind":"import-statement","original":"./mxc-containment.js"}],"format":"esm"},"src/security/secure-execution-contract.ts":{"bytes":24510,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:os","kind":"import-statement","external":true},{"path":"src/security/path-policy.ts","kind":"import-statement","original":"./path-policy.js"},{"path":"src/security/process-containment.ts","kind":"import-statement","original":"./process-containment.js"}],"format":"esm"},"src/automation/policy.ts":{"bytes":15653,"imports":[{"path":"src/security/secure-execution-contract.ts","kind":"import-statement","original":"../security/secure-execution-contract.js"},{"path":"src/automation/errors.ts","kind":"import-statement","original":"./errors.js"},{"path":"src/automation/operations.ts","kind":"import-statement","original":"./operations.js"},{"path":"src/automation/types.ts","kind":"import-statement","original":"./types.js"}],"format":"esm"},"src/artifacts/types.ts":{"bytes":11224,"imports":[],"format":"esm"},"src/artifacts/hash.ts":{"bytes":1489,"imports":[{"path":"node:crypto","kind":"import-statement","external":true}],"format":"esm"},"src/utils/custom-names.ts":{"bytes":2210,"imports":[],"format":"esm"},"src/artifacts/validation.ts":{"bytes":25271,"imports":[{"path":"src/artifacts/types.ts","kind":"import-statement","original":"./types.js"},{"path":"node:buffer","kind":"import-statement","external":true},{"path":"src/artifacts/hash.ts","kind":"import-statement","original":"./hash.js"},{"path":"src/utils/custom-names.ts","kind":"import-statement","original":"../utils/custom-names.js"},{"path":"src/artifacts/types.ts","kind":"import-statement","original":"./types.js"}],"format":"esm"},"src/artifacts/repository.ts":{"bytes":29289,"imports":[{"path":"src/artifacts/types.ts","kind":"import-statement","original":"./types.js"},{"path":"src/artifacts/validation.ts","kind":"import-statement","original":"./validation.js"}],"format":"esm"},"src/automation/evidence.ts":{"bytes":8618,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/artifacts/repository.ts","kind":"import-statement","original":"../artifacts/repository.js"},{"path":"src/artifacts/hash.ts","kind":"import-statement","original":"../artifacts/hash.js"},{"path":"src/artifacts/types.ts","kind":"import-statement","original":"../artifacts/types.js"},{"path":"src/automation/errors.ts","kind":"import-statement","original":"./errors.js"}],"format":"esm"},"src/automation/executor.ts":{"bytes":14249,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/automation/errors.ts","kind":"import-statement","original":"./errors.js"},{"path":"src/automation/evidence.ts","kind":"import-statement","original":"./evidence.js"},{"path":"src/automation/operations.ts","kind":"import-statement","original":"./operations.js"},{"path":"src/automation/policy.ts","kind":"import-statement","original":"./policy.js"}],"format":"esm"},"src/automation/conformance.ts":{"bytes":4331,"imports":[{"path":"src/automation/errors.ts","kind":"import-statement","original":"./errors.js"},{"path":"src/automation/policy.ts","kind":"import-statement","original":"./policy.js"},{"path":"src/automation/types.ts","kind":"import-statement","original":"./types.js"}],"format":"esm"},"src/automation/http-adapter.ts":{"bytes":8862,"imports":[{"path":"src/automation/errors.ts","kind":"import-statement","original":"./errors.js"}],"format":"esm"},"src/automation/tool-pack.ts":{"bytes":19206,"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"src/automation/operations.ts","kind":"import-statement","original":"./operations.js"}],"format":"esm"},"src/automation/index.ts":{"bytes":282,"imports":[{"path":"src/automation/types.ts","kind":"import-statement","original":"./types.js"},{"path":"src/automation/operations.ts","kind":"import-statement","original":"./operations.js"},{"path":"src/automation/errors.ts","kind":"import-statement","original":"./errors.js"},{"path":"src/automation/policy.ts","kind":"import-statement","original":"./policy.js"},{"path":"src/automation/evidence.ts","kind":"import-statement","original":"./evidence.js"},{"path":"src/automation/executor.ts","kind":"import-statement","original":"./executor.js"},{"path":"src/automation/conformance.ts","kind":"import-statement","original":"./conformance.js"},{"path":"src/automation/http-adapter.ts","kind":"import-statement","original":"./http-adapter.js"},{"path":"src/automation/tool-pack.ts","kind":"import-statement","original":"./tool-pack.js"}],"format":"esm"}},"outputs":{"dist/automation/index.js":{"imports":[{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true},{"path":"node:crypto","kind":"import-statement","external":true}],"exports":["XENO_AUTOMATION_OPERATIONS","XENO_AUTOMATION_PROTOCOL_VERSION","XenoAutomationError","XenoGovernedAutomationExecutor","XenoLoopbackAutomationAdapter","assertRequiredXenoAutomationEvidence","assertValidXenoAutomationAdapterManifest","assertValidXenoAutomationRequest","assertXenoAutomationAdapterConformant","assertXenoAutomationAuthority","buildXenoAutomationCapabilityUse","createXenoAutomationConformanceReport","createXenoGovernedAutomationTools","describeXenoAutomationOperation","isXenoAutomationOperation","materializeXenoAutomationEvidence","persistXenoAutomationEvidence","resolveXenoAutomationEvidencePolicy"],"entryPoint":"src/automation/index.ts","inputs":{"src/automation/types.ts":{"bytesInOutput":8},"src/automation/index.ts":{"bytesInOutput":0},"src/automation/operations.ts":{"bytesInOutput":1638},"src/automation/errors.ts":{"bytesInOutput":129},"src/security/secure-execution-contract.ts":{"bytesInOutput":3308},"src/media/xeno-deflate.ts":{"bytesInOutput":1061},"src/security/windows-process-containment.ts":{"bytesInOutput":45908},"src/security/containment-certification.ts":{"bytesInOutput":442},"src/security/mxc-containment.ts":{"bytesInOutput":709},"src/security/process-containment.ts":{"bytesInOutput":999},"src/automation/policy.ts":{"bytesInOutput":7873},"src/automation/evidence.ts":{"bytesInOutput":4442},"src/artifacts/types.ts":{"bytesInOutput":818},"src/artifacts/hash.ts":{"bytesInOutput":126},"src/artifacts/validation.ts":{"bytesInOutput":146},"src/artifacts/repository.ts":{"bytesInOutput":137},"src/automation/executor.ts":{"bytesInOutput":6074},"src/automation/conformance.ts":{"bytesInOutput":2191},"src/automation/http-adapter.ts":{"bytesInOutput":4316},"src/automation/tool-pack.ts":{"bytesInOutput":10028}},"bytes":91043}}}
|