@xenosystem/agent-sdk 0.8.12

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.
Files changed (175) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +511 -0
  3. package/dist/agents/index.cjs +17 -0
  4. package/dist/agents/index.d.cts +244 -0
  5. package/dist/agents/index.d.ts +244 -0
  6. package/dist/agents/index.js +17 -0
  7. package/dist/agents/metafile-cjs.json +1 -0
  8. package/dist/agents/metafile-esm.json +1 -0
  9. package/dist/artifacts/browser.cjs +1 -0
  10. package/dist/artifacts/browser.d.cts +8 -0
  11. package/dist/artifacts/browser.d.ts +8 -0
  12. package/dist/artifacts/browser.js +1 -0
  13. package/dist/artifacts/diff-artifact-C2tQZWcs.d.cts +354 -0
  14. package/dist/artifacts/diff-artifact-C2tQZWcs.d.ts +354 -0
  15. package/dist/artifacts/index.cjs +10 -0
  16. package/dist/artifacts/index.d.cts +588 -0
  17. package/dist/artifacts/index.d.ts +588 -0
  18. package/dist/artifacts/index.js +10 -0
  19. package/dist/artifacts/metafile-cjs.json +1 -0
  20. package/dist/artifacts/metafile-esm.json +1 -0
  21. package/dist/automation/index.cjs +438 -0
  22. package/dist/automation/index.d.cts +878 -0
  23. package/dist/automation/index.d.ts +878 -0
  24. package/dist/automation/index.js +438 -0
  25. package/dist/automation/metafile-cjs.json +1 -0
  26. package/dist/automation/metafile-esm.json +1 -0
  27. package/dist/control-plane/index.cjs +7 -0
  28. package/dist/control-plane/index.d.cts +403 -0
  29. package/dist/control-plane/index.d.ts +403 -0
  30. package/dist/control-plane/index.js +7 -0
  31. package/dist/control-plane/metafile-cjs.json +1 -0
  32. package/dist/control-plane/metafile-esm.json +1 -0
  33. package/dist/control-room/index.cjs +1 -0
  34. package/dist/control-room/index.d.cts +216 -0
  35. package/dist/control-room/index.d.ts +216 -0
  36. package/dist/control-room/index.js +1 -0
  37. package/dist/control-room/metafile-cjs.json +1 -0
  38. package/dist/control-room/metafile-esm.json +1 -0
  39. package/dist/electron/index.cjs +1476 -0
  40. package/dist/electron/index.d.cts +1583 -0
  41. package/dist/electron/index.d.ts +1583 -0
  42. package/dist/electron/index.js +1476 -0
  43. package/dist/electron/metafile-cjs.json +1 -0
  44. package/dist/electron/metafile-esm.json +1 -0
  45. package/dist/governance/index.cjs +33 -0
  46. package/dist/governance/index.d.cts +397 -0
  47. package/dist/governance/index.d.ts +397 -0
  48. package/dist/governance/index.js +33 -0
  49. package/dist/governance/metafile-cjs.json +1 -0
  50. package/dist/governance/metafile-esm.json +1 -0
  51. package/dist/hooks/index.cjs +9 -0
  52. package/dist/hooks/index.d.cts +198 -0
  53. package/dist/hooks/index.d.ts +198 -0
  54. package/dist/hooks/index.js +9 -0
  55. package/dist/hooks/metafile-cjs.json +1 -0
  56. package/dist/hooks/metafile-esm.json +1 -0
  57. package/dist/hosted/index.cjs +1 -0
  58. package/dist/hosted/index.d.cts +490 -0
  59. package/dist/hosted/index.d.ts +490 -0
  60. package/dist/hosted/index.js +1 -0
  61. package/dist/hosted/metafile-cjs.json +1 -0
  62. package/dist/hosted/metafile-esm.json +1 -0
  63. package/dist/index.cjs +2161 -0
  64. package/dist/index.d.cts +12259 -0
  65. package/dist/index.d.ts +12259 -0
  66. package/dist/index.js +2161 -0
  67. package/dist/intelligence/index.cjs +10 -0
  68. package/dist/intelligence/index.d.cts +220 -0
  69. package/dist/intelligence/index.d.ts +220 -0
  70. package/dist/intelligence/index.js +10 -0
  71. package/dist/intelligence/metafile-cjs.json +1 -0
  72. package/dist/intelligence/metafile-esm.json +1 -0
  73. package/dist/mcp/index.cjs +28 -0
  74. package/dist/mcp/index.d.cts +960 -0
  75. package/dist/mcp/index.d.ts +960 -0
  76. package/dist/mcp/index.js +28 -0
  77. package/dist/mcp/metafile-cjs.json +1 -0
  78. package/dist/mcp/metafile-esm.json +1 -0
  79. package/dist/metafile-cjs.json +1 -0
  80. package/dist/metafile-esm.json +1 -0
  81. package/dist/oracle/index.cjs +1 -0
  82. package/dist/oracle/index.d.cts +310 -0
  83. package/dist/oracle/index.d.ts +310 -0
  84. package/dist/oracle/index.js +1 -0
  85. package/dist/oracle/metafile-cjs.json +1 -0
  86. package/dist/oracle/metafile-esm.json +1 -0
  87. package/dist/providers/index.cjs +11 -0
  88. package/dist/providers/index.d.cts +462 -0
  89. package/dist/providers/index.d.ts +462 -0
  90. package/dist/providers/index.js +11 -0
  91. package/dist/providers/metafile-cjs.json +1 -0
  92. package/dist/providers/metafile-esm.json +1 -0
  93. package/dist/recipes/index.cjs +2 -0
  94. package/dist/recipes/index.d.cts +86 -0
  95. package/dist/recipes/index.d.ts +86 -0
  96. package/dist/recipes/index.js +2 -0
  97. package/dist/recipes/metafile-cjs.json +1 -0
  98. package/dist/recipes/metafile-esm.json +1 -0
  99. package/dist/research/index.cjs +3 -0
  100. package/dist/research/index.d.cts +285 -0
  101. package/dist/research/index.d.ts +285 -0
  102. package/dist/research/index.js +3 -0
  103. package/dist/research/metafile-cjs.json +1 -0
  104. package/dist/research/metafile-esm.json +1 -0
  105. package/dist/session/index.cjs +56 -0
  106. package/dist/session/index.d.cts +523 -0
  107. package/dist/session/index.d.ts +523 -0
  108. package/dist/session/index.js +56 -0
  109. package/dist/session/metafile-cjs.json +1 -0
  110. package/dist/session/metafile-esm.json +1 -0
  111. package/dist/sharing/index.cjs +4 -0
  112. package/dist/sharing/index.d.cts +272 -0
  113. package/dist/sharing/index.d.ts +272 -0
  114. package/dist/sharing/index.js +4 -0
  115. package/dist/sharing/metafile-cjs.json +1 -0
  116. package/dist/sharing/metafile-esm.json +1 -0
  117. package/dist/skills/index.cjs +6 -0
  118. package/dist/skills/index.d.cts +277 -0
  119. package/dist/skills/index.d.ts +277 -0
  120. package/dist/skills/index.js +6 -0
  121. package/dist/skills/metafile-cjs.json +1 -0
  122. package/dist/skills/metafile-esm.json +1 -0
  123. package/dist/soul/index.cjs +32 -0
  124. package/dist/soul/index.d.cts +138 -0
  125. package/dist/soul/index.d.ts +138 -0
  126. package/dist/soul/index.js +32 -0
  127. package/dist/soul/metafile-cjs.json +1 -0
  128. package/dist/soul/metafile-esm.json +1 -0
  129. package/dist/terminal/index.cjs +4 -0
  130. package/dist/terminal/index.d.cts +55 -0
  131. package/dist/terminal/index.d.ts +55 -0
  132. package/dist/terminal/index.js +4 -0
  133. package/dist/terminal/metafile-cjs.json +1 -0
  134. package/dist/terminal/metafile-esm.json +1 -0
  135. package/dist/ui/index.cjs +35 -0
  136. package/dist/ui/index.d.cts +298 -0
  137. package/dist/ui/index.d.ts +298 -0
  138. package/dist/ui/index.js +35 -0
  139. package/dist/ui/metafile-cjs.json +1 -0
  140. package/dist/ui/metafile-esm.json +1 -0
  141. package/dist/utils/index.cjs +23 -0
  142. package/dist/utils/index.d.cts +245 -0
  143. package/dist/utils/index.d.ts +245 -0
  144. package/dist/utils/index.js +23 -0
  145. package/dist/utils/metafile-cjs.json +1 -0
  146. package/dist/utils/metafile-esm.json +1 -0
  147. package/native/mxc/LICENSE.microsoft-mxc-sdk.md +21 -0
  148. package/native/mxc/README.md +25 -0
  149. package/native/mxc/bin/arm64/lxc-exec +0 -0
  150. package/native/mxc/bin/arm64/mxc-exec-mac +0 -0
  151. package/native/mxc/bin/arm64/wxc-exec.exe +0 -0
  152. package/native/mxc/bin/arm64/wxc-host-prep.exe +0 -0
  153. package/native/mxc/bin/x64/lxc-exec +0 -0
  154. package/native/mxc/bin/x64/wxc-exec.exe +0 -0
  155. package/native/mxc/bin/x64/wxc-host-prep.exe +0 -0
  156. package/native/mxc/package.json +58 -0
  157. package/ownership/CLEAN_ROOM_CONTRIBUTOR_GUIDE.md +63 -0
  158. package/ownership/audit.mjs +727 -0
  159. package/ownership/evidence/PROPRIETARY-COMMAND-1/implementation-record.md +77 -0
  160. package/ownership/evidence/PROPRIETARY-COMMAND-1/provenance-review.md +51 -0
  161. package/ownership/evidence/PROPRIETARY-MEDIA-1/implementation-record.md +131 -0
  162. package/ownership/evidence/PROPRIETARY-MEDIA-1/provenance-review.md +50 -0
  163. package/ownership/evidence/PROPRIETARY-PTY-1/implementation-record.md +86 -0
  164. package/ownership/evidence/PROPRIETARY-PTY-1/provenance-review.md +52 -0
  165. package/ownership/evidence/PROPRIETARY-RUNTIME-1/implementation-record.md +68 -0
  166. package/ownership/evidence/PROPRIETARY-RUNTIME-1/provenance-review.md +32 -0
  167. package/ownership/evidence/PROPRIETARY-TOOLCHAIN-1/implementation-record.md +53 -0
  168. package/ownership/evidence/PROPRIETARY-TOOLCHAIN-1/provenance-review.md +32 -0
  169. package/ownership/evidence/PROPRIETARY-UI-1/implementation-record.md +96 -0
  170. package/ownership/evidence/PROPRIETARY-UI-1/provenance-review.md +46 -0
  171. package/ownership/ownership-policy.json +232 -0
  172. package/ownership/ownership-policy.schema.json +192 -0
  173. package/ownership/templates/clean-room-implementation-record.md +70 -0
  174. package/ownership/templates/provenance-review.md +51 -0
  175. package/package.json +209 -0
@@ -0,0 +1 @@
1
+ "use strict";var E=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var ne=Object.prototype.hasOwnProperty;var ie=(e,t)=>{for(var n in t)E(e,n,{get:t[n],enumerable:!0})},re=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of te(t))!ne.call(e,r)&&r!==n&&E(e,r,{get:()=>t[r],enumerable:!(i=ee(t,r))||i.enumerable});return e};var oe=e=>re(E({},"__esModule",{value:!0}),e);var Oe={};ie(Oe,{XENO_ORACLE_REPORT_SCHEMA_VERSION:()=>q,XenoOracleCoordinator:()=>j,XenoOracleValidationError:()=>u,assertValidXenoOracleReport:()=>O,xenoArtifactToOracleReport:()=>Xe,xenoOracleReportToArtifact:()=>Ie});module.exports=oe(Oe);var $=require("node:crypto");var D=require("node:crypto");function y(e){return{algorithm:"sha256",value:(0,D.createHash)("sha256").update(e).digest("hex")}}function k(e){return JSON.stringify(x(e,new Set))}function S(e){return y(k(e))}function x(e,t){if(e===null||typeof e!="object"){if(typeof e=="number"&&!Number.isFinite(e))throw new TypeError("Artifact JSON cannot contain non-finite numbers");return e}if(t.has(e))throw new TypeError("Artifact JSON cannot contain cycles");if(t.add(e),Array.isArray(e)){let i=e.map(r=>x(r,t));return t.delete(e),i}let n={};for(let i of Object.keys(e).sort((r,a)=>r.localeCompare(a))){let r=e[i];if(r===void 0)throw new TypeError(`Artifact JSON property ${i} is undefined`);n[i]=x(r,t)}return t.delete(e),n}var T=require("node:buffer");var C=class extends Error{code="ARTIFACT_INVALID";issues;constructor(t,n){super(t),this.name="XenoArtifactValidationError",this.issues=n.map(i=>({...i}))}};var se=/^[a-z0-9][a-z0-9._/-]{0,127}$/,ae="[\\u0000-\\u001f\\u007f]",ce=new RegExp(ae),de=/^[a-f0-9]{64}$/,ue=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,pe=new Set(["draft","pending_review","approved","rejected","superseded","archived"]),le=new Set(["public","internal","confidential","restricted"]),fe=new Set(["agent","tool","user","system","integration"]),me=new Set(["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"]),ge=new Set(["requirement","design-decision","risk","task","agent","run","tool-call","edit","commit","test-case","test-run","finding","approval","artifact","release","claim"]),he=new Set(["decomposes","depends_on","implements","changes","tests","verifies","finds","fixes","reviews","approves","rejects","supersedes","derived_from","produced_by","supports_claim","contradicts_claim","released_as"]);function o(e,t,n,i){e.push({path:t,code:n,message:i})}function s(e,t,n,i=1024){return typeof e!="string"||e.trim().length===0?(o(n,t,"required_string","Value must be a non-empty string"),!1):(e.length>i&&o(n,t,"string_too_long",`Value must not exceed ${i} characters`),ce.test(e)&&o(n,t,"control_character","Value must not contain control characters"),!0)}function b(e,t,n){e!==void 0&&(!Number.isFinite(Date.parse(e))||!e.includes("T"))&&o(n,t,"invalid_timestamp","Value must be an ISO 8601 timestamp")}function v(e,t,n,i){if(typeof e!="string"||!e.startsWith(t))return;let r=e.slice(t.length);se.test(r)||o(i,n,"invalid_custom_name",`Custom name after ${t} is invalid`)}function ye(e,t,n){if(!e||typeof e!="object"){o(n,t,"missing_actor","Actor is required");return}s(e.kind,`${t}.kind`,n,64),fe.has(e.kind)||o(n,`${t}.kind`,"unknown_actor_kind","Actor kind is not supported"),s(e.id,`${t}.id`,n,512),e?.displayName!==void 0&&s(e.displayName,`${t}.displayName`,n,512),e?.profileFingerprint!==void 0&&!/^[a-f0-9]{64}$/.test(e.profileFingerprint)&&o(n,`${t}.profileFingerprint`,"invalid_fingerprint","Profile fingerprint must be 64 lowercase hexadecimal characters")}function ve(e,t,n){if(!e||typeof e!="object"){o(n,t,"invalid_anchor","Anchor must be an object");return}switch(e.kind){case"file":s(e.path,`${t}.path`,n,4096);break;case"source-line":s(e.path,`${t}.path`,n,4096),(!Number.isInteger(e.startLine)||e.startLine<1)&&o(n,`${t}.startLine`,"invalid_line","startLine must be a positive integer"),e.endLine!==void 0&&(!Number.isInteger(e.endLine)||e.endLine<e.startLine)&&o(n,`${t}.endLine`,"invalid_line_range","endLine must be greater than or equal to startLine");break;case"diff-hunk":s(e.path,`${t}.path`,n,4096),s(e.hunkId,`${t}.hunkId`,n,512);break;case"symbol":s(e.path,`${t}.path`,n,4096),s(e.symbol,`${t}.symbol`,n,1024);break;case"dom-node":s(e.pageId,`${t}.pageId`,n,512),!e.selector&&!e.accessibilityId&&!e.snapshotArtifactId&&o(n,t,"missing_dom_locator","DOM anchors require a selector, accessibility ID, or snapshot artifact ID");break;case"timeline":s(e.recordingArtifactId,`${t}.recordingArtifactId`,n,512),(!Number.isFinite(e.startMs)||e.startMs<0)&&o(n,`${t}.startMs`,"invalid_time","startMs must be a non-negative finite number"),e.endMs!==void 0&&(!Number.isFinite(e.endMs)||e.endMs<e.startMs)&&o(n,`${t}.endMs`,"invalid_time_range","endMs must be greater than or equal to startMs");break;case"region":s(e.mediaArtifactId,`${t}.mediaArtifactId`,n,512),[e.x,e.y,e.width,e.height].every(Number.isFinite)?(e.width<=0||e.height<=0)&&o(n,t,"invalid_region_size","Region width and height must be positive"):o(n,t,"invalid_region","Region coordinates must be finite numbers");break;case"artifact":s(e.artifactId,`${t}.artifactId`,n,512);break;default:typeof e.kind!="string"||!e.kind.startsWith("custom:")?o(n,`${t}.kind`,"unknown_anchor","Anchor kind is not supported"):v(e.kind,"custom:",`${t}.kind`,n)}}function A(e,t,n,i){if(!(e===null||typeof e=="string"||typeof e=="boolean")){if(typeof e=="number"){Number.isFinite(e)||o(n,t,"non_finite_number","JSON numbers must be finite");return}if(typeof e!="object"){o(n,t,"non_json_value","Value must be JSON-serializable");return}if(i.has(e)){o(n,t,"cyclic_value","Value must not contain cycles");return}if(i.add(e),Array.isArray(e))e.forEach((r,a)=>A(r,`${t}[${a}]`,n,i));else for(let[r,a]of Object.entries(e))a===void 0?o(n,`${t}.${r}`,"undefined_value","Undefined is not valid JSON"):A(a,`${t}.${r}`,n,i);i.delete(e)}}function Ae(e){let t=[];if(!e||typeof e!="object")return[{path:"$",code:"invalid_artifact",message:"Artifact must be an object"}];if(e.schemaVersion!==1&&o(t,"schemaVersion","unsupported_schema",`schemaVersion must be ${1}`),s(e.artifactId,"artifactId",t,512),(!Number.isInteger(e.revision)||e.revision<1)&&o(t,"revision","invalid_revision","revision must be a positive integer"),s(e.kind,"kind",t,160),typeof e.kind=="string"&&!me.has(e.kind)&&!e.kind.startsWith("custom:")&&o(t,"kind","unknown_artifact_kind","Artifact kind is not supported"),v(e.kind,"custom:","kind",t),s(e.title,"title",t,1024),e.description!==void 0&&s(e.description,"description",t,32768),s(e.state,"state",t,64),pe.has(e.state)||o(t,"state","unknown_state","Artifact state is not supported"),s(e.createdAt,"createdAt",t,128),b(e.createdAt,"createdAt",t),b(e.updatedAt,"updatedAt",t),e.updatedAt&&Number.isFinite(Date.parse(e.createdAt))&&Date.parse(e.updatedAt)<Date.parse(e.createdAt)&&o(t,"updatedAt","timestamp_order","updatedAt must not precede createdAt"),s(e.mediaType,"mediaType",t,255),s(e.sensitivity,"sensitivity",t,64),le.has(e.sensitivity)||o(t,"sensitivity","unknown_sensitivity","Sensitivity is not supported"),e.identity)for(let[i,r]of Object.entries(e.identity))r!==void 0&&s(r,`identity.${i}`,t,512);if(!e.content||typeof e.content!="object")o(t,"content","missing_content","content descriptor is required");else{!e.content.hash||typeof e.content.hash!="object"?o(t,"content.hash","missing_hash","content hash is required"):(s(e.content.hash.algorithm,"content.hash.algorithm",t,128),v(e.content.hash.algorithm,"custom:","content.hash.algorithm",t),typeof e.content.hash.algorithm=="string"&&e.content.hash.algorithm!=="sha256"&&!e.content.hash.algorithm.startsWith("custom:")&&o(t,"content.hash.algorithm","unknown_hash_algorithm","Hash algorithm is not supported"),s(e.content.hash.value,"content.hash.value",t,512),e.content.hash.algorithm==="sha256"&&!de.test(e.content.hash.value)&&o(t,"content.hash.value","invalid_sha256","SHA-256 hash must be 64 lowercase hexadecimal characters")),(!Number.isSafeInteger(e.content.sizeBytes)||e.content.sizeBytes<0)&&o(t,"content.sizeBytes","invalid_size","sizeBytes must be a non-negative safe integer");let i=e.content.storage;if(!i||typeof i!="object")o(t,"content.storage","missing_storage","storage reference is required");else if(i.type==="inline")if(i.text===void 0==(i.base64===void 0))o(t,"content.storage","invalid_inline_storage","Inline storage requires exactly one of text or base64");else{let r;i.text!==void 0?r=T.Buffer.from(i.text,"utf8"):i.base64!==void 0&&(ue.test(i.base64)?r=T.Buffer.from(i.base64,"base64"):o(t,"content.storage.base64","invalid_base64","Inline base64 content is malformed")),r&&e.content.sizeBytes!==r.byteLength&&o(t,"content.sizeBytes","content_size_mismatch","sizeBytes does not match inline content"),r&&e.content.hash.algorithm==="sha256"&&y(r).value!==e.content.hash.value&&o(t,"content.hash.value","content_hash_mismatch","Hash does not match inline content")}else i.type==="file"?s(i.path,"content.storage.path",t,4096):i.type==="blob"?s(i.uri,"content.storage.uri",t,8192):i.type==="git"?(s(i.commit,"content.storage.commit",t,512),s(i.path,"content.storage.path",t,4096)):i.type==="url"?(s(i.url,"content.storage.url",t,8192),b(i.expiresAt,"content.storage.expiresAt",t)):i.type==="external"?(s(i.provider,"content.storage.provider",t,255),s(i.locator,"content.storage.locator",t,8192)):o(t,"content.storage.type","unknown_storage","Storage type is not supported");e.content.encoding!==void 0&&(typeof e.content.encoding!="string"||e.content.encoding!=="utf8"&&e.content.encoding!=="base64"&&e.content.encoding!=="binary"&&!e.content.encoding.startsWith("custom:"))&&o(t,"content.encoding","unknown_encoding","Content encoding is not supported"),v(e.content.encoding,"custom:","content.encoding",t)}!e.provenance||typeof e.provenance!="object"?o(t,"provenance","missing_provenance","provenance is required"):(ye(e.provenance.producer,"provenance.producer",t),e.provenance.capabilityLeaseIds?.forEach((i,r)=>s(i,`provenance.capabilityLeaseIds[${r}]`,t,512)),e.provenance.sourceArtifactIds?.forEach((i,r)=>s(i,`provenance.sourceArtifactIds[${r}]`,t,512)),e.provenance.attributes&&A(e.provenance.attributes,"provenance.attributes",t,new Set));let n=new Set;return e.relationships?.forEach((i,r)=>{let a=`relationships[${r}]`;s(i.relation,`${a}.relation`,t,160),typeof i.relation=="string"&&!he.has(i.relation)&&!i.relation.startsWith("custom:")&&o(t,`${a}.relation`,"unknown_relationship","Relationship type is not supported"),v(i.relation,"custom:",`${a}.relation`,t),s(i.target?.type,`${a}.target.type`,t,160),typeof i.target?.type=="string"&&!ge.has(i.target.type)&&!i.target.type.startsWith("custom:")&&o(t,`${a}.target.type`,"unknown_reference_type","Evidence reference type is not supported"),v(i.target?.type,"custom:",`${a}.target.type`,t),s(i.target?.id,`${a}.target.id`,t,512);let d=`${i.relation}:${i.target?.type}:${i.target?.id}:${i.target?.revision??""}`;n.has(d)&&o(t,a,"duplicate_relationship","Duplicate relationship"),n.add(d),i.attributes&&A(i.attributes,`${a}.attributes`,t,new Set)}),e.anchors?.forEach((i,r)=>ve(i,`anchors[${r}]`,t)),e.revision===1&&e.predecessorRevision!==void 0&&o(t,"predecessorRevision","unexpected_predecessor","First revision cannot have a predecessor"),e.revision>1&&(!Number.isInteger(e.predecessorRevision)||(e.predecessorRevision??0)>=e.revision)&&o(t,"predecessorRevision","invalid_predecessor","Later revisions require an earlier predecessor revision"),b(e.retention?.retainUntil,"retention.retainUntil",t),e.retention?.legalHold!==void 0&&typeof e.retention.legalHold!="boolean"&&o(t,"retention.legalHold","invalid_boolean","legalHold must be a boolean"),e.extensions&&A(e.extensions,"extensions",t,new Set),t}function J(e){let t=Ae(e);if(t.length>0)throw new C("XENO artifact validation failed",t)}function L(e,t={}){for(let n of e){let i=n.codePointAt(0);if(i===127)return!0;if(!(i>31)&&!(i===9&&t.allowTab===!0)&&!((i===10||i===13)&&t.allowLineBreaks===!0))return!0}return!1}var q="xeno.oracle-report.v1",u=class extends Error{constructor(n){super(`XENO Oracle report is invalid: ${n.join("; ")}`);this.issues=n;this.name="XenoOracleValidationError"}issues;code="XENO_ORACLE_INVALID"},j=class{execute;adjudicate;now;idFactory;constructor(t){if(typeof t?.execute!="function"||typeof t?.adjudicate!="function")throw new TypeError("Oracle execution and adjudication functions are required");this.execute=t.execute,this.adjudicate=t.adjudicate,this.now=t.now??(()=>new Date().toISOString()),this.idFactory=t.idFactory??(n=>`${n}_${(0,$.randomUUID)()}`)}async run(t){let n=W(t.question,"question",128e3),i=t.runId??`oracle_run_${(0,$.randomUUID)()}`;Z(i,"runId");let r=[t.primary,...t.critics,t.adjudicator];we(r,t.primary,t.critics,t.adjudicator);let a=this.now(),d=await this.execute({runId:i,question:n,participant:structuredClone(t.primary)}),p=P(d,t.primary,this.idFactory("opinion"),this.now()),R=await Promise.all(t.critics.map(async l=>{let h=await this.execute({runId:i,question:n,participant:structuredClone(l),primaryOpinion:structuredClone(p)});return P(h,l,this.idFactory("opinion"),this.now())})),c=[p,...R],g=await this.adjudicate({runId:i,question:n,participant:structuredClone(t.adjudicator),opinions:structuredClone(c)}),X=be(g,t.adjudicator,this.now()),G=this.now(),Y=new Set(r.map(_)),Q=new Set(c.flatMap(l=>l.citations.map(h=>h.citationId))),M={schemaVersion:q,reportId:this.idFactory("oracle"),runId:i,question:n,questionHash:y(n),startedAt:a,completedAt:G,opinions:c,adjudication:X,summary:{participantCount:r.length,distinctModelCount:Y.size,totalInputTokens:c.reduce((l,h)=>l+h.usage.inputTokens,X.usage.inputTokens),totalOutputTokens:c.reduce((l,h)=>l+h.usage.outputTokens,X.usage.outputTokens),unresolvedDisagreements:X.disagreements.filter(l=>l.resolution==="unresolved").length,citationCount:Q.size}};return O(M),M}};function O(e){let t=[];e?.schemaVersion!==q&&t.push("schemaVersion must be xeno.oracle-report.v1"),f(e?.reportId,"reportId",t),f(e?.runId,"runId",t),m(e?.question,"question",t,128e3),(e?.questionHash?.algorithm!=="sha256"||e.questionHash.value!==y(e.question??"").value)&&t.push("questionHash does not match question"),I(e?.startedAt,"startedAt",t),I(e?.completedAt,"completedAt",t),Date.parse(e?.completedAt)<Date.parse(e?.startedAt)&&t.push("completedAt cannot precede startedAt"),(!Array.isArray(e?.opinions)||e.opinions.length<2)&&t.push("at least two independent opinions are required");let n=new Set,i=new Set,r=new Set;for(let c of e?.opinions??[]){z(c,t),n.has(c.participant.participantId)&&t.push(`duplicate participant ${c.participant.participantId}`),n.add(c.participant.participantId),i.add(_(c.participant));for(let g of c.citations)r.add(g.citationId)}i.size<2&&t.push("Oracle requires at least two distinct provider/model identities"),B(e?.adjudication,r,t),e?.adjudication?.participant&&(n.add(e.adjudication.participant.participantId),i.add(_(e.adjudication.participant)));let a=[...(e?.opinions??[]).map(c=>c.usage),e?.adjudication?.usage].filter(Boolean),d=a.reduce((c,g)=>c+g.inputTokens,0),p=a.reduce((c,g)=>c+g.outputTokens,0);e?.summary?.participantCount!==n.size&&t.push("summary participantCount is inconsistent"),e?.summary?.distinctModelCount!==i.size&&t.push("summary distinctModelCount is inconsistent"),(e?.summary?.totalInputTokens!==d||e?.summary?.totalOutputTokens!==p)&&t.push("summary token usage is inconsistent"),e?.summary?.citationCount!==r.size&&t.push("summary citationCount is inconsistent");let R=e?.adjudication?.disagreements?.filter(c=>c.resolution==="unresolved").length??0;if(e?.summary?.unresolvedDisagreements!==R&&t.push("summary unresolvedDisagreements is inconsistent"),t.length>0)throw new u([...new Set(t)])}function Ie(e,t){O(e);let n=e,i=k(n),r={schemaVersion:1,artifactId:t.artifactId??`oracle_${y(`${e.runId}:${e.questionHash.value}`).value.slice(0,24)}`,revision:1,kind:"custom:oracle-report",title:"Cross-model Oracle report",description:`${e.summary.distinctModelCount} distinct models; ${e.summary.unresolvedDisagreements} unresolved disagreements`,state:"pending_review",createdAt:e.completedAt,mediaType:"application/vnd.xeno.oracle-report+json",sensitivity:t.sensitivity??"internal",...t.identity?{identity:structuredClone(t.identity)}:{},content:{hash:S(n),sizeBytes:Buffer.byteLength(i,"utf8"),encoding:"utf8",storage:{type:"inline",text:i},redactedPreview:`${e.adjudication.verdict}: ${e.adjudication.conclusion.slice(0,240)}`},provenance:{producer:structuredClone(t.producer),attributes:{distinctModelCount:e.summary.distinctModelCount,participants:e.opinions.map(a=>`${a.participant.providerId}:${a.participant.model}`),adjudicator:`${e.adjudication.participant.providerId}:${e.adjudication.participant.model}`}},...t.accessPolicyId?{accessPolicyId:t.accessPolicyId}:{},extensions:{"xeno.oracle.verdict":e.adjudication.verdict,"xeno.oracle.confidence":e.adjudication.confidence,"xeno.oracle.unresolved":e.summary.unresolvedDisagreements,"xeno.oracle.questionHash":e.questionHash.value}};return J(r),r}function Xe(e){if(e.kind!=="custom:oracle-report"||e.mediaType!=="application/vnd.xeno.oracle-report+json")throw new u([`Artifact ${e.artifactId} is not an Oracle report`]);if(e.content.storage.type!=="inline"||typeof e.content.storage.text!="string")throw new u(["Oracle reports require inline JSON content"]);let t;try{t=JSON.parse(e.content.storage.text)}catch{throw new u(["Oracle report content is invalid JSON"])}if(O(t),S(t).value!==e.content.hash.value)throw new u(["Oracle report content hash does not match the artifact"]);return structuredClone(t)}function P(e,t,n,i){let r=U(e.usage),a={...structuredClone(e.opinion),opinionId:n,participant:structuredClone(t),completedAt:i,usage:r},d=[];if(z(a,d),d.length>0)throw new u(d);return a}function be(e,t,n){let i={...structuredClone(e.adjudication),participant:structuredClone(t),completedAt:n,usage:U(e.usage)},r=[];if(B(i,void 0,r),r.length>0)throw new u(r);return i}function we(e,t,n,i){let r=[];(n.length<1||n.length>8)&&r.push("Oracle requires one through eight critic models"),t.role!=="primary"&&r.push("primary participant role must be primary"),n.some(p=>p.role!=="critic")&&r.push("critic participant roles must be critic"),i.role!=="adjudicator"&&r.push("adjudicator participant role must be adjudicator");let a=new Set,d=new Set;for(let p of e)H(p,r),a.has(p.participantId)&&r.push(`duplicate participant ${p.participantId}`),a.add(p.participantId),d.add(_(p));if(d.size<2&&r.push("Oracle requires at least two distinct provider/model identities"),r.length>0)throw new u([...new Set(r)])}function z(e,t){f(e?.opinionId,"opinionId",t),H(e?.participant,t),m(e?.answer,"opinion answer",t,256e3),m(e?.publicRationale,"opinion publicRationale",t,128e3),V(e?.verdict)||t.push("opinion verdict is invalid"),N(e?.confidence,"opinion confidence",t),I(e?.completedAt,"opinion completedAt",t),K(e?.usage,"opinion usage",t);let n=new Set;for(let r of e?.citations??[])_e(r,t),n.has(r.citationId)&&t.push(`duplicate citation ${r.citationId}`),n.add(r.citationId);let i=new Set;for(let r of e?.claims??[]){f(r?.claimId,"claimId",t),i.has(r.claimId)&&t.push(`duplicate claim ${r.claimId}`),i.add(r.claimId),m(r?.statement,`claim ${r.claimId} statement`,t,32e3),V(r?.verdict)||t.push(`claim ${r.claimId} verdict is invalid`),N(r?.confidence,`claim ${r.claimId} confidence`,t);for(let a of r?.citationIds??[])n.has(a)||t.push(`claim ${r.claimId} references unknown citation ${a}`)}}function B(e,t,n){H(e?.participant,n),e?.participant?.role!=="adjudicator"&&n.push("adjudication participant role must be adjudicator"),m(e?.conclusion,"adjudication conclusion",n,256e3),m(e?.publicRationale,"adjudication publicRationale",n,128e3),V(e?.verdict)||n.push("adjudication verdict is invalid"),N(e?.confidence,"adjudication confidence",n),I(e?.completedAt,"adjudication completedAt",n),K(e?.usage,"adjudication usage",n);let i=new Set;for(let r of e?.disagreements??[])f(r?.disagreementId,"disagreementId",n),i.has(r.disagreementId)&&n.push(`duplicate disagreement ${r.disagreementId}`),i.add(r.disagreementId),m(r?.summary,`disagreement ${r.disagreementId} summary`,n,32e3),(!Array.isArray(r?.participantIds)||r.participantIds.length<2)&&n.push(`disagreement ${r.disagreementId} requires at least two participants`),["low","medium","high"].includes(r?.severity)||n.push(`disagreement ${r.disagreementId} severity is invalid`),r?.resolution!=="resolved"&&r?.resolution!=="unresolved"&&n.push(`disagreement ${r.disagreementId} resolution is invalid`);if(t)for(let r of e?.citationIds??[])t.has(r)||n.push(`adjudication references unknown citation ${r}`)}function H(e,t){f(e?.participantId,"participantId",t),f(e?.providerId,"providerId",t),m(e?.model,"participant model",t,512),e?.connectionId!==void 0&&f(e.connectionId,"connectionId",t),["primary","critic","adjudicator"].includes(e?.role)||t.push("participant role is invalid")}function _e(e,t){f(e?.citationId,"citationId",t);try{let n=new URL(e?.uri);n.protocol!=="https:"&&n.protocol!=="http:"&&t.push(`citation ${e.citationId} must use HTTP(S)`),(n.username||n.password)&&t.push(`citation ${e.citationId} cannot contain credentials`)}catch{t.push(`citation ${e?.citationId??"(unknown)"} URI is invalid`)}e?.retrievedAt!==void 0&&I(e.retrievedAt,`citation ${e.citationId} retrievedAt`,t),e?.contentHash&&(e.contentHash.algorithm!=="sha256"||!/^[a-f0-9]{64}$/u.test(e.contentHash.value))&&t.push(`citation ${e.citationId} contentHash is invalid`)}function U(e){return{inputTokens:F(e?.inputTokens),outputTokens:F(e?.outputTokens)}}function K(e,t,n){(!Number.isInteger(e?.inputTokens)||e.inputTokens<0)&&n.push(`${t} inputTokens must be a non-negative integer`),(!Number.isInteger(e?.outputTokens)||e.outputTokens<0)&&n.push(`${t} outputTokens must be a non-negative integer`)}function F(e){return Number.isInteger(e)&&(e??-1)>=0?e:0}function _(e){return`${e.providerId.trim().toLowerCase()}\0${e.model.trim().toLowerCase()}`}function W(e,t,n){let i=typeof e=="string"?e.trim():"";if(!i||i.length>n||L(i,{allowTab:!0,allowLineBreaks:!0}))throw new u([`${t} must be non-empty bounded text`]);return i}function Z(e,t){let n=typeof e=="string"?e.trim():"";if(!/^[A-Za-z0-9][A-Za-z0-9._:@/-]{0,255}$/u.test(n))throw new u([`${t} is invalid`]);return n}function f(e,t,n){try{Z(e,t)}catch{n.push(`${t} is invalid`)}}function m(e,t,n,i){try{W(e,t,i)}catch{n.push(`${t} must be non-empty bounded text`)}}function N(e,t,n){(typeof e!="number"||!Number.isFinite(e)||e<0||e>1)&&n.push(`${t} must be between 0 and 1`)}function I(e,t,n){(typeof e!="string"||!Number.isFinite(Date.parse(e)))&&n.push(`${t} must be an ISO timestamp`)}function V(e){return e==="supported"||e==="contested"||e==="unsupported"||e==="insufficient-evidence"}0&&(module.exports={XENO_ORACLE_REPORT_SCHEMA_VERSION,XenoOracleCoordinator,XenoOracleValidationError,assertValidXenoOracleReport,xenoArtifactToOracleReport,xenoOracleReportToArtifact});
@@ -0,0 +1,310 @@
1
+ declare const XENO_ARTIFACT_SCHEMA_VERSION: 1;
2
+ type XenoJsonPrimitive = string | number | boolean | null;
3
+ type XenoJsonValue = XenoJsonPrimitive | XenoJsonObject | XenoJsonValue[];
4
+ interface XenoJsonObject {
5
+ [key: string]: XenoJsonValue;
6
+ }
7
+ type XenoArtifactKind = "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" | `custom:${string}`;
8
+ type XenoArtifactState = "draft" | "pending_review" | "approved" | "rejected" | "superseded" | "archived";
9
+ type XenoArtifactSensitivity = "public" | "internal" | "confidential" | "restricted";
10
+ interface XenoContentHash {
11
+ algorithm: "sha256" | `custom:${string}`;
12
+ value: string;
13
+ }
14
+ type XenoArtifactStorageReference = {
15
+ type: "inline";
16
+ text?: string;
17
+ base64?: string;
18
+ } | {
19
+ type: "file";
20
+ path: string;
21
+ } | {
22
+ type: "blob";
23
+ uri: string;
24
+ } | {
25
+ type: "git";
26
+ commit: string;
27
+ path: string;
28
+ repositoryId?: string;
29
+ } | {
30
+ type: "url";
31
+ url: string;
32
+ expiresAt?: string;
33
+ } | {
34
+ type: "external";
35
+ provider: string;
36
+ locator: string;
37
+ };
38
+ interface XenoArtifactContent {
39
+ hash: XenoContentHash;
40
+ sizeBytes: number;
41
+ storage: XenoArtifactStorageReference;
42
+ encoding?: "utf8" | "base64" | "binary" | `custom:${string}`;
43
+ redactedPreview?: string;
44
+ }
45
+ interface XenoArtifactIdentity {
46
+ runId?: string;
47
+ sessionId?: string;
48
+ turnId?: string;
49
+ taskId?: string;
50
+ agentId?: string;
51
+ workspaceId?: string;
52
+ repositoryId?: string;
53
+ }
54
+ type XenoArtifactActorKind = "agent" | "tool" | "user" | "system" | "integration";
55
+ interface XenoArtifactActor {
56
+ kind: XenoArtifactActorKind;
57
+ id: string;
58
+ displayName?: string;
59
+ profileFingerprint?: string;
60
+ }
61
+ interface XenoArtifactProvenance {
62
+ producer: XenoArtifactActor;
63
+ eventId?: string;
64
+ toolCallId?: string;
65
+ operationId?: string;
66
+ executionContractFingerprint?: string;
67
+ capabilityLeaseIds?: string[];
68
+ sourceArtifactIds?: string[];
69
+ attributes?: XenoJsonObject;
70
+ }
71
+ type XenoEvidenceNodeType = "requirement" | "design-decision" | "risk" | "task" | "agent" | "run" | "tool-call" | "edit" | "commit" | "test-case" | "test-run" | "finding" | "approval" | "artifact" | "release" | "claim" | `custom:${string}`;
72
+ type XenoEvidenceEdgeType = "decomposes" | "depends_on" | "implements" | "changes" | "tests" | "verifies" | "finds" | "fixes" | "reviews" | "approves" | "rejects" | "supersedes" | "derived_from" | "produced_by" | "supports_claim" | "contradicts_claim" | "released_as" | `custom:${string}`;
73
+ interface XenoEvidenceReference {
74
+ type: XenoEvidenceNodeType;
75
+ id: string;
76
+ revision?: number;
77
+ }
78
+ interface XenoArtifactRelationship {
79
+ relation: XenoEvidenceEdgeType;
80
+ target: XenoEvidenceReference;
81
+ description?: string;
82
+ attributes?: XenoJsonObject;
83
+ }
84
+ type XenoArtifactAnchor = {
85
+ kind: "file";
86
+ path: string;
87
+ repositoryId?: string;
88
+ commit?: string;
89
+ } | {
90
+ kind: "source-line";
91
+ path: string;
92
+ startLine: number;
93
+ endLine?: number;
94
+ repositoryId?: string;
95
+ commit?: string;
96
+ } | {
97
+ kind: "diff-hunk";
98
+ path: string;
99
+ hunkId: string;
100
+ artifactId?: string;
101
+ revision?: number;
102
+ } | {
103
+ kind: "symbol";
104
+ path: string;
105
+ symbol: string;
106
+ repositoryId?: string;
107
+ commit?: string;
108
+ } | {
109
+ kind: "dom-node";
110
+ pageId: string;
111
+ selector?: string;
112
+ accessibilityId?: string;
113
+ snapshotArtifactId?: string;
114
+ } | {
115
+ kind: "timeline";
116
+ startMs: number;
117
+ endMs?: number;
118
+ recordingArtifactId: string;
119
+ } | {
120
+ kind: "region";
121
+ x: number;
122
+ y: number;
123
+ width: number;
124
+ height: number;
125
+ mediaArtifactId: string;
126
+ } | {
127
+ kind: "artifact";
128
+ artifactId: string;
129
+ revision?: number;
130
+ } | {
131
+ kind: `custom:${string}`;
132
+ data: XenoJsonObject;
133
+ };
134
+ interface XenoArtifactRetention {
135
+ policyId?: string;
136
+ retainUntil?: string;
137
+ legalHold?: boolean;
138
+ }
139
+ interface XenoArtifactEnvelope {
140
+ schemaVersion: typeof XENO_ARTIFACT_SCHEMA_VERSION;
141
+ artifactId: string;
142
+ revision: number;
143
+ kind: XenoArtifactKind;
144
+ title: string;
145
+ description?: string;
146
+ state: XenoArtifactState;
147
+ createdAt: string;
148
+ updatedAt?: string;
149
+ mediaType: string;
150
+ sensitivity: XenoArtifactSensitivity;
151
+ identity?: XenoArtifactIdentity;
152
+ content: XenoArtifactContent;
153
+ provenance: XenoArtifactProvenance;
154
+ relationships?: XenoArtifactRelationship[];
155
+ anchors?: XenoArtifactAnchor[];
156
+ predecessorRevision?: number;
157
+ accessPolicyId?: string;
158
+ retention?: XenoArtifactRetention;
159
+ extensions?: Record<string, XenoJsonValue>;
160
+ }
161
+ declare const XENO_ORACLE_REPORT_SCHEMA_VERSION: "xeno.oracle-report.v1";
162
+ type XenoOracleRole = "primary" | "critic" | "adjudicator";
163
+ type XenoOracleVerdict = "supported" | "contested" | "unsupported" | "insufficient-evidence";
164
+ interface XenoOracleModelIdentity {
165
+ participantId: string;
166
+ role: XenoOracleRole;
167
+ connectionId?: string;
168
+ providerId: string;
169
+ model: string;
170
+ }
171
+ interface XenoOracleCitation {
172
+ citationId: string;
173
+ uri: string;
174
+ title?: string;
175
+ publisher?: string;
176
+ retrievedAt?: string;
177
+ revision?: string;
178
+ license?: string;
179
+ contentHash?: XenoContentHash;
180
+ }
181
+ interface XenoOracleClaim {
182
+ claimId: string;
183
+ statement: string;
184
+ verdict: XenoOracleVerdict;
185
+ confidence: number;
186
+ citationIds: string[];
187
+ }
188
+ interface XenoOracleOpinionDraft {
189
+ answer: string;
190
+ verdict: XenoOracleVerdict;
191
+ confidence: number;
192
+ claims: XenoOracleClaim[];
193
+ citations: XenoOracleCitation[];
194
+ publicRationale: string;
195
+ }
196
+ interface XenoOracleOpinion extends XenoOracleOpinionDraft {
197
+ opinionId: string;
198
+ participant: XenoOracleModelIdentity;
199
+ completedAt: string;
200
+ usage: {
201
+ inputTokens: number;
202
+ outputTokens: number;
203
+ };
204
+ }
205
+ interface XenoOracleDisagreement {
206
+ disagreementId: string;
207
+ summary: string;
208
+ participantIds: string[];
209
+ severity: "low" | "medium" | "high";
210
+ resolution: "resolved" | "unresolved";
211
+ }
212
+ interface XenoOracleAdjudicationDraft {
213
+ conclusion: string;
214
+ verdict: XenoOracleVerdict;
215
+ confidence: number;
216
+ consensusPoints: string[];
217
+ disagreements: XenoOracleDisagreement[];
218
+ citationIds: string[];
219
+ publicRationale: string;
220
+ }
221
+ interface XenoOracleAdjudication extends XenoOracleAdjudicationDraft {
222
+ participant: XenoOracleModelIdentity;
223
+ completedAt: string;
224
+ usage: {
225
+ inputTokens: number;
226
+ outputTokens: number;
227
+ };
228
+ }
229
+ interface XenoOracleReport {
230
+ schemaVersion: typeof XENO_ORACLE_REPORT_SCHEMA_VERSION;
231
+ reportId: string;
232
+ runId: string;
233
+ question: string;
234
+ questionHash: XenoContentHash;
235
+ startedAt: string;
236
+ completedAt: string;
237
+ opinions: XenoOracleOpinion[];
238
+ adjudication: XenoOracleAdjudication;
239
+ summary: {
240
+ participantCount: number;
241
+ distinctModelCount: number;
242
+ totalInputTokens: number;
243
+ totalOutputTokens: number;
244
+ unresolvedDisagreements: number;
245
+ citationCount: number;
246
+ };
247
+ }
248
+ interface XenoOracleExecutionRequest {
249
+ runId: string;
250
+ question: string;
251
+ participant: XenoOracleModelIdentity;
252
+ primaryOpinion?: XenoOracleOpinion;
253
+ }
254
+ interface XenoOracleExecutionResult {
255
+ opinion: XenoOracleOpinionDraft;
256
+ usage?: {
257
+ inputTokens?: number;
258
+ outputTokens?: number;
259
+ };
260
+ }
261
+ interface XenoOracleAdjudicationRequest {
262
+ runId: string;
263
+ question: string;
264
+ participant: XenoOracleModelIdentity;
265
+ opinions: XenoOracleOpinion[];
266
+ }
267
+ interface XenoOracleAdjudicationResult {
268
+ adjudication: XenoOracleAdjudicationDraft;
269
+ usage?: {
270
+ inputTokens?: number;
271
+ outputTokens?: number;
272
+ };
273
+ }
274
+ interface XenoOracleCoordinatorOptions {
275
+ execute: (request: XenoOracleExecutionRequest) => Promise<XenoOracleExecutionResult>;
276
+ adjudicate: (request: XenoOracleAdjudicationRequest) => Promise<XenoOracleAdjudicationResult>;
277
+ now?: () => string;
278
+ idFactory?: (prefix: "oracle" | "opinion") => string;
279
+ }
280
+ interface XenoOracleRunOptions {
281
+ runId?: string;
282
+ question: string;
283
+ primary: XenoOracleModelIdentity;
284
+ critics: XenoOracleModelIdentity[];
285
+ adjudicator: XenoOracleModelIdentity;
286
+ }
287
+ interface XenoOracleArtifactContext {
288
+ producer: XenoArtifactActor;
289
+ identity?: XenoArtifactIdentity;
290
+ sensitivity?: XenoArtifactSensitivity;
291
+ accessPolicyId?: string;
292
+ artifactId?: string;
293
+ }
294
+ declare class XenoOracleValidationError extends Error {
295
+ readonly issues: string[];
296
+ readonly code = "XENO_ORACLE_INVALID";
297
+ constructor(issues: string[]);
298
+ }
299
+ declare class XenoOracleCoordinator {
300
+ private readonly execute;
301
+ private readonly adjudicate;
302
+ private readonly now;
303
+ private readonly idFactory;
304
+ constructor(options: XenoOracleCoordinatorOptions);
305
+ run(options: XenoOracleRunOptions): Promise<XenoOracleReport>;
306
+ }
307
+ declare function assertValidXenoOracleReport(report: XenoOracleReport): void;
308
+ declare function xenoOracleReportToArtifact(report: XenoOracleReport, context: XenoOracleArtifactContext): XenoArtifactEnvelope;
309
+ declare function xenoArtifactToOracleReport(artifact: XenoArtifactEnvelope): XenoOracleReport;
310
+ export { XENO_ORACLE_REPORT_SCHEMA_VERSION, type XenoOracleAdjudication, type XenoOracleAdjudicationDraft, type XenoOracleAdjudicationRequest, type XenoOracleAdjudicationResult, type XenoOracleArtifactContext, type XenoOracleCitation, type XenoOracleClaim, XenoOracleCoordinator, type XenoOracleCoordinatorOptions, type XenoOracleDisagreement, type XenoOracleExecutionRequest, type XenoOracleExecutionResult, type XenoOracleModelIdentity, type XenoOracleOpinion, type XenoOracleOpinionDraft, type XenoOracleReport, type XenoOracleRole, type XenoOracleRunOptions, XenoOracleValidationError, type XenoOracleVerdict, assertValidXenoOracleReport, xenoArtifactToOracleReport, xenoOracleReportToArtifact };
@@ -0,0 +1,310 @@
1
+ declare const XENO_ARTIFACT_SCHEMA_VERSION: 1;
2
+ type XenoJsonPrimitive = string | number | boolean | null;
3
+ type XenoJsonValue = XenoJsonPrimitive | XenoJsonObject | XenoJsonValue[];
4
+ interface XenoJsonObject {
5
+ [key: string]: XenoJsonValue;
6
+ }
7
+ type XenoArtifactKind = "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" | `custom:${string}`;
8
+ type XenoArtifactState = "draft" | "pending_review" | "approved" | "rejected" | "superseded" | "archived";
9
+ type XenoArtifactSensitivity = "public" | "internal" | "confidential" | "restricted";
10
+ interface XenoContentHash {
11
+ algorithm: "sha256" | `custom:${string}`;
12
+ value: string;
13
+ }
14
+ type XenoArtifactStorageReference = {
15
+ type: "inline";
16
+ text?: string;
17
+ base64?: string;
18
+ } | {
19
+ type: "file";
20
+ path: string;
21
+ } | {
22
+ type: "blob";
23
+ uri: string;
24
+ } | {
25
+ type: "git";
26
+ commit: string;
27
+ path: string;
28
+ repositoryId?: string;
29
+ } | {
30
+ type: "url";
31
+ url: string;
32
+ expiresAt?: string;
33
+ } | {
34
+ type: "external";
35
+ provider: string;
36
+ locator: string;
37
+ };
38
+ interface XenoArtifactContent {
39
+ hash: XenoContentHash;
40
+ sizeBytes: number;
41
+ storage: XenoArtifactStorageReference;
42
+ encoding?: "utf8" | "base64" | "binary" | `custom:${string}`;
43
+ redactedPreview?: string;
44
+ }
45
+ interface XenoArtifactIdentity {
46
+ runId?: string;
47
+ sessionId?: string;
48
+ turnId?: string;
49
+ taskId?: string;
50
+ agentId?: string;
51
+ workspaceId?: string;
52
+ repositoryId?: string;
53
+ }
54
+ type XenoArtifactActorKind = "agent" | "tool" | "user" | "system" | "integration";
55
+ interface XenoArtifactActor {
56
+ kind: XenoArtifactActorKind;
57
+ id: string;
58
+ displayName?: string;
59
+ profileFingerprint?: string;
60
+ }
61
+ interface XenoArtifactProvenance {
62
+ producer: XenoArtifactActor;
63
+ eventId?: string;
64
+ toolCallId?: string;
65
+ operationId?: string;
66
+ executionContractFingerprint?: string;
67
+ capabilityLeaseIds?: string[];
68
+ sourceArtifactIds?: string[];
69
+ attributes?: XenoJsonObject;
70
+ }
71
+ type XenoEvidenceNodeType = "requirement" | "design-decision" | "risk" | "task" | "agent" | "run" | "tool-call" | "edit" | "commit" | "test-case" | "test-run" | "finding" | "approval" | "artifact" | "release" | "claim" | `custom:${string}`;
72
+ type XenoEvidenceEdgeType = "decomposes" | "depends_on" | "implements" | "changes" | "tests" | "verifies" | "finds" | "fixes" | "reviews" | "approves" | "rejects" | "supersedes" | "derived_from" | "produced_by" | "supports_claim" | "contradicts_claim" | "released_as" | `custom:${string}`;
73
+ interface XenoEvidenceReference {
74
+ type: XenoEvidenceNodeType;
75
+ id: string;
76
+ revision?: number;
77
+ }
78
+ interface XenoArtifactRelationship {
79
+ relation: XenoEvidenceEdgeType;
80
+ target: XenoEvidenceReference;
81
+ description?: string;
82
+ attributes?: XenoJsonObject;
83
+ }
84
+ type XenoArtifactAnchor = {
85
+ kind: "file";
86
+ path: string;
87
+ repositoryId?: string;
88
+ commit?: string;
89
+ } | {
90
+ kind: "source-line";
91
+ path: string;
92
+ startLine: number;
93
+ endLine?: number;
94
+ repositoryId?: string;
95
+ commit?: string;
96
+ } | {
97
+ kind: "diff-hunk";
98
+ path: string;
99
+ hunkId: string;
100
+ artifactId?: string;
101
+ revision?: number;
102
+ } | {
103
+ kind: "symbol";
104
+ path: string;
105
+ symbol: string;
106
+ repositoryId?: string;
107
+ commit?: string;
108
+ } | {
109
+ kind: "dom-node";
110
+ pageId: string;
111
+ selector?: string;
112
+ accessibilityId?: string;
113
+ snapshotArtifactId?: string;
114
+ } | {
115
+ kind: "timeline";
116
+ startMs: number;
117
+ endMs?: number;
118
+ recordingArtifactId: string;
119
+ } | {
120
+ kind: "region";
121
+ x: number;
122
+ y: number;
123
+ width: number;
124
+ height: number;
125
+ mediaArtifactId: string;
126
+ } | {
127
+ kind: "artifact";
128
+ artifactId: string;
129
+ revision?: number;
130
+ } | {
131
+ kind: `custom:${string}`;
132
+ data: XenoJsonObject;
133
+ };
134
+ interface XenoArtifactRetention {
135
+ policyId?: string;
136
+ retainUntil?: string;
137
+ legalHold?: boolean;
138
+ }
139
+ interface XenoArtifactEnvelope {
140
+ schemaVersion: typeof XENO_ARTIFACT_SCHEMA_VERSION;
141
+ artifactId: string;
142
+ revision: number;
143
+ kind: XenoArtifactKind;
144
+ title: string;
145
+ description?: string;
146
+ state: XenoArtifactState;
147
+ createdAt: string;
148
+ updatedAt?: string;
149
+ mediaType: string;
150
+ sensitivity: XenoArtifactSensitivity;
151
+ identity?: XenoArtifactIdentity;
152
+ content: XenoArtifactContent;
153
+ provenance: XenoArtifactProvenance;
154
+ relationships?: XenoArtifactRelationship[];
155
+ anchors?: XenoArtifactAnchor[];
156
+ predecessorRevision?: number;
157
+ accessPolicyId?: string;
158
+ retention?: XenoArtifactRetention;
159
+ extensions?: Record<string, XenoJsonValue>;
160
+ }
161
+ declare const XENO_ORACLE_REPORT_SCHEMA_VERSION: "xeno.oracle-report.v1";
162
+ type XenoOracleRole = "primary" | "critic" | "adjudicator";
163
+ type XenoOracleVerdict = "supported" | "contested" | "unsupported" | "insufficient-evidence";
164
+ interface XenoOracleModelIdentity {
165
+ participantId: string;
166
+ role: XenoOracleRole;
167
+ connectionId?: string;
168
+ providerId: string;
169
+ model: string;
170
+ }
171
+ interface XenoOracleCitation {
172
+ citationId: string;
173
+ uri: string;
174
+ title?: string;
175
+ publisher?: string;
176
+ retrievedAt?: string;
177
+ revision?: string;
178
+ license?: string;
179
+ contentHash?: XenoContentHash;
180
+ }
181
+ interface XenoOracleClaim {
182
+ claimId: string;
183
+ statement: string;
184
+ verdict: XenoOracleVerdict;
185
+ confidence: number;
186
+ citationIds: string[];
187
+ }
188
+ interface XenoOracleOpinionDraft {
189
+ answer: string;
190
+ verdict: XenoOracleVerdict;
191
+ confidence: number;
192
+ claims: XenoOracleClaim[];
193
+ citations: XenoOracleCitation[];
194
+ publicRationale: string;
195
+ }
196
+ interface XenoOracleOpinion extends XenoOracleOpinionDraft {
197
+ opinionId: string;
198
+ participant: XenoOracleModelIdentity;
199
+ completedAt: string;
200
+ usage: {
201
+ inputTokens: number;
202
+ outputTokens: number;
203
+ };
204
+ }
205
+ interface XenoOracleDisagreement {
206
+ disagreementId: string;
207
+ summary: string;
208
+ participantIds: string[];
209
+ severity: "low" | "medium" | "high";
210
+ resolution: "resolved" | "unresolved";
211
+ }
212
+ interface XenoOracleAdjudicationDraft {
213
+ conclusion: string;
214
+ verdict: XenoOracleVerdict;
215
+ confidence: number;
216
+ consensusPoints: string[];
217
+ disagreements: XenoOracleDisagreement[];
218
+ citationIds: string[];
219
+ publicRationale: string;
220
+ }
221
+ interface XenoOracleAdjudication extends XenoOracleAdjudicationDraft {
222
+ participant: XenoOracleModelIdentity;
223
+ completedAt: string;
224
+ usage: {
225
+ inputTokens: number;
226
+ outputTokens: number;
227
+ };
228
+ }
229
+ interface XenoOracleReport {
230
+ schemaVersion: typeof XENO_ORACLE_REPORT_SCHEMA_VERSION;
231
+ reportId: string;
232
+ runId: string;
233
+ question: string;
234
+ questionHash: XenoContentHash;
235
+ startedAt: string;
236
+ completedAt: string;
237
+ opinions: XenoOracleOpinion[];
238
+ adjudication: XenoOracleAdjudication;
239
+ summary: {
240
+ participantCount: number;
241
+ distinctModelCount: number;
242
+ totalInputTokens: number;
243
+ totalOutputTokens: number;
244
+ unresolvedDisagreements: number;
245
+ citationCount: number;
246
+ };
247
+ }
248
+ interface XenoOracleExecutionRequest {
249
+ runId: string;
250
+ question: string;
251
+ participant: XenoOracleModelIdentity;
252
+ primaryOpinion?: XenoOracleOpinion;
253
+ }
254
+ interface XenoOracleExecutionResult {
255
+ opinion: XenoOracleOpinionDraft;
256
+ usage?: {
257
+ inputTokens?: number;
258
+ outputTokens?: number;
259
+ };
260
+ }
261
+ interface XenoOracleAdjudicationRequest {
262
+ runId: string;
263
+ question: string;
264
+ participant: XenoOracleModelIdentity;
265
+ opinions: XenoOracleOpinion[];
266
+ }
267
+ interface XenoOracleAdjudicationResult {
268
+ adjudication: XenoOracleAdjudicationDraft;
269
+ usage?: {
270
+ inputTokens?: number;
271
+ outputTokens?: number;
272
+ };
273
+ }
274
+ interface XenoOracleCoordinatorOptions {
275
+ execute: (request: XenoOracleExecutionRequest) => Promise<XenoOracleExecutionResult>;
276
+ adjudicate: (request: XenoOracleAdjudicationRequest) => Promise<XenoOracleAdjudicationResult>;
277
+ now?: () => string;
278
+ idFactory?: (prefix: "oracle" | "opinion") => string;
279
+ }
280
+ interface XenoOracleRunOptions {
281
+ runId?: string;
282
+ question: string;
283
+ primary: XenoOracleModelIdentity;
284
+ critics: XenoOracleModelIdentity[];
285
+ adjudicator: XenoOracleModelIdentity;
286
+ }
287
+ interface XenoOracleArtifactContext {
288
+ producer: XenoArtifactActor;
289
+ identity?: XenoArtifactIdentity;
290
+ sensitivity?: XenoArtifactSensitivity;
291
+ accessPolicyId?: string;
292
+ artifactId?: string;
293
+ }
294
+ declare class XenoOracleValidationError extends Error {
295
+ readonly issues: string[];
296
+ readonly code = "XENO_ORACLE_INVALID";
297
+ constructor(issues: string[]);
298
+ }
299
+ declare class XenoOracleCoordinator {
300
+ private readonly execute;
301
+ private readonly adjudicate;
302
+ private readonly now;
303
+ private readonly idFactory;
304
+ constructor(options: XenoOracleCoordinatorOptions);
305
+ run(options: XenoOracleRunOptions): Promise<XenoOracleReport>;
306
+ }
307
+ declare function assertValidXenoOracleReport(report: XenoOracleReport): void;
308
+ declare function xenoOracleReportToArtifact(report: XenoOracleReport, context: XenoOracleArtifactContext): XenoArtifactEnvelope;
309
+ declare function xenoArtifactToOracleReport(artifact: XenoArtifactEnvelope): XenoOracleReport;
310
+ export { XENO_ORACLE_REPORT_SCHEMA_VERSION, type XenoOracleAdjudication, type XenoOracleAdjudicationDraft, type XenoOracleAdjudicationRequest, type XenoOracleAdjudicationResult, type XenoOracleArtifactContext, type XenoOracleCitation, type XenoOracleClaim, XenoOracleCoordinator, type XenoOracleCoordinatorOptions, type XenoOracleDisagreement, type XenoOracleExecutionRequest, type XenoOracleExecutionResult, type XenoOracleModelIdentity, type XenoOracleOpinion, type XenoOracleOpinionDraft, type XenoOracleReport, type XenoOracleRole, type XenoOracleRunOptions, XenoOracleValidationError, type XenoOracleVerdict, assertValidXenoOracleReport, xenoArtifactToOracleReport, xenoOracleReportToArtifact };