arkgate 4.8.23 → 4.8.24

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 (131) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +7 -5
  3. package/bin/ark-check-runtime.mjs +24 -77
  4. package/bin/ark-dashboard.mjs +56 -53
  5. package/bin/ark-layer-match.mjs +596 -112
  6. package/bin/ark-mcp-runtime.mjs +412 -138
  7. package/bin/ark-mcp.mjs +68 -4
  8. package/bin/ark-shared.mjs +39 -0
  9. package/bin/ark.mjs +65 -97
  10. package/bin/lib/adapter-contract-types.mjs +5 -0
  11. package/bin/lib/adapter-contract.mjs +15 -0
  12. package/bin/lib/agent-projection-command.mjs +5 -1
  13. package/bin/lib/analysis-engine.mjs +15 -11
  14. package/bin/lib/architecture-scan.mjs +50 -6
  15. package/bin/lib/ark-order-doctor.mjs +1 -1
  16. package/bin/lib/ark-order-facts.mjs +410 -15
  17. package/bin/lib/ark-order-invariants.mjs +51 -9
  18. package/bin/lib/ark-order-sensors.mjs +28 -101
  19. package/bin/lib/ark-order-types.mjs +2 -0
  20. package/bin/lib/ark-run-doctor.mjs +14 -0
  21. package/bin/lib/ark-run-facts.mjs +434 -11
  22. package/bin/lib/ark-run-sensors.mjs +5 -3
  23. package/bin/lib/arkgate-pins.mjs +91 -0
  24. package/bin/lib/arkrules-sensors.mjs +50 -249
  25. package/bin/lib/check-args.mjs +23 -1
  26. package/bin/lib/ci-and-commands.mjs +16 -6
  27. package/bin/lib/class-source-scan.mjs +479 -0
  28. package/bin/lib/codex-home.mjs +4 -2
  29. package/bin/lib/config-contract-slices.mjs +701 -0
  30. package/bin/lib/config-contract.mjs +5 -493
  31. package/bin/lib/config-warnings.mjs +32 -0
  32. package/bin/lib/dashboard-cli.mjs +62 -0
  33. package/bin/lib/design-delta.mjs +1 -1
  34. package/bin/lib/diagnostic-catalog.mjs +16 -9
  35. package/bin/lib/doctor-advisories.mjs +25 -1
  36. package/bin/lib/doctor-next-actions.mjs +17 -2
  37. package/bin/lib/doctor-plan.mjs +6 -8
  38. package/bin/lib/effective-contract-load.mjs +121 -59
  39. package/bin/lib/enforcement-profiles.mjs +40 -4
  40. package/bin/lib/first-run-help.mjs +3 -2
  41. package/bin/lib/flat-parent-importers.mjs +137 -0
  42. package/bin/lib/flat-parent-pilot.mjs +40 -100
  43. package/bin/lib/gate-files.mjs +29 -2
  44. package/bin/lib/git-change-scope.mjs +109 -0
  45. package/bin/lib/github-enforcement.mjs +1 -1
  46. package/bin/lib/hook-templates.mjs +18 -16
  47. package/bin/lib/host-support-matrix.mjs +3 -1
  48. package/bin/lib/import-resolve.mjs +13 -1
  49. package/bin/lib/install-migrate.mjs +50 -73
  50. package/bin/lib/invariant-coverage.mjs +59 -11
  51. package/bin/lib/mcp-adoption.mjs +9 -1
  52. package/bin/lib/mcp-hook-payload.mjs +401 -61
  53. package/bin/lib/package-manager.mjs +59 -1
  54. package/bin/lib/passthrough-commands.mjs +83 -0
  55. package/bin/lib/persistence-write-hint.mjs +81 -0
  56. package/bin/lib/pin-dependent-gates.mjs +117 -0
  57. package/bin/lib/policy-delta-io.mjs +168 -10
  58. package/bin/lib/prepare-change.mjs +120 -6
  59. package/bin/lib/prepare-write.mjs +1 -0
  60. package/bin/lib/presets.mjs +3 -5
  61. package/bin/lib/remediation.mjs +23 -4
  62. package/bin/lib/resolved-candidate-facts.mjs +315 -55
  63. package/bin/lib/rules-inventory.mjs +22 -3
  64. package/bin/lib/rules-under-contract.mjs +179 -5
  65. package/bin/lib/scan-files.mjs +32 -0
  66. package/bin/lib/snippet-analysis.mjs +140 -6
  67. package/bin/lib/source-policy.mjs +34 -0
  68. package/bin/lib/stable-hash.mjs +90 -0
  69. package/bin/lib/start-install-recovery.mjs +71 -1
  70. package/bin/lib/start-preview.mjs +30 -0
  71. package/bin/lib/status-command.mjs +33 -4
  72. package/bin/lib/status-manifest.mjs +32 -4
  73. package/bin/lib/team-parliament-io.mjs +77 -75
  74. package/bin/lib/team-parliament.mjs +6 -1
  75. package/bin/lib/write-path-capabilities.mjs +4 -2
  76. package/dist/chunk-A5EIY3HI.cjs +5 -0
  77. package/dist/chunk-MBXCFLO4.js +16 -0
  78. package/dist/chunk-RNQHRDCQ.cjs +16 -0
  79. package/dist/chunk-SVSQVGFJ.js +5 -0
  80. package/dist/{configTypes-Bbf_MFGe.d.ts → configTypes-BJbaeoj4.d.cts} +18 -3
  81. package/dist/configTypes-BJbaeoj4.d.ts +246 -0
  82. package/dist/eslint/index.cjs +17 -4
  83. package/dist/eslint/index.d.cts +359 -0
  84. package/dist/eslint/index.d.ts +130 -156
  85. package/dist/eslint/index.js +10 -4
  86. package/dist/index.cjs +35 -34
  87. package/dist/index.d.cts +5475 -0
  88. package/dist/index.d.ts +3312 -299
  89. package/dist/index.js +35 -34
  90. package/dist/inspectorListen-6DQVJ4DC.js +1 -0
  91. package/dist/inspectorListen-KGMIQ2TF.cjs +1 -0
  92. package/dist/nestjs/index.cjs +1 -18
  93. package/dist/nestjs/index.d.cts +22 -0
  94. package/dist/nestjs/index.d.ts +1 -3
  95. package/dist/nestjs/index.js +1 -18
  96. package/dist/order/index.cjs +1 -1
  97. package/dist/order/index.d.cts +155 -0
  98. package/dist/order/index.d.ts +15 -3
  99. package/dist/order/index.js +1 -1
  100. package/dist/runtime/index.cjs +13 -30
  101. package/dist/{diagnosticCatalog-35mrwAHe.d.ts → runtime/index.d.cts} +804 -290
  102. package/dist/runtime/index.d.ts +2678 -108
  103. package/dist/runtime/index.js +13 -30
  104. package/dist/{types-Bdj32QwA.d.ts → types-DRinG-vT.d.cts} +576 -140
  105. package/dist/types-DRinG-vT.d.ts +1792 -0
  106. package/docs/README.md +2 -1
  107. package/docs/agent-guide.md +84 -15
  108. package/docs/ai-gates.md +160 -26
  109. package/docs/arkorder.md +32 -15
  110. package/docs/brownfield-adoption.md +5 -1
  111. package/docs/configuration.md +196 -26
  112. package/docs/develop.md +2 -1
  113. package/docs/diagnostics.md +96 -19
  114. package/docs/package-surface.md +31 -8
  115. package/docs/product-voice.md +1 -1
  116. package/package.json +59 -18
  117. package/schemas/ark.analysis-result.schema.json +15 -0
  118. package/schemas/ark.config.schema.json +47 -10
  119. package/schemas/ark.resolved-candidate-facts.schema.json +1 -1
  120. package/schemas/ark.status-manifest.schema.json +22 -0
  121. package/server.json +3 -9
  122. package/templates/agent-skills/README.md +1 -1
  123. package/templates/agent-skills/ark-adopt/SKILL.md +4 -1
  124. package/templates/agent-skills/ark-order/SKILL.md +4 -2
  125. package/templates/agent-skills/ark-runtime/SKILL.md +6 -1
  126. package/templates/arkrules/PersistenceAdapters.json +1 -1
  127. package/templates/arkrules/PresentationAdapters.json +1 -1
  128. package/templates/skills/ark-adopt.md +4 -1
  129. package/templates/skills/ark-order.md +4 -2
  130. package/templates/skills/ark-runtime.md +6 -1
  131. package/dist/types-Ik_OakcI.d.ts +0 -183
@@ -0,0 +1,16 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10; var _class11; var _class12;var _chunkA5EIY3HIcjs = require('./chunk-A5EIY3HI.cjs');var Ct="4.8.24";var U= (_class =class{constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this); }static{_chunkA5EIY3HIcjs.a.call(void 0, this,"IntentRegistry")}__init() {this.intents=new Map}__init2() {this.dependencies=new Map}__init3() {this.productions=new Map}define(e,n){if(this.intents.has(e))throw new Error(`Intent "${e}" is already registered. Intent names must be unique within a registry.`);let r=_chunkA5EIY3HIcjs.a.call(void 0, i=>({intent:e,payload:i,metadata:{occurredAt:new Date().toISOString(),source:"unknown"}}),"fn");Object.defineProperty(r,"name",{value:e,enumerable:!0,configurable:!1,writable:!1});let o=r;if(this.intents.set(e,o),_optionalChain([n, 'optionalAccess', _2 => _2.dependsOn]))for(let i of n.dependsOn)this.declareDependency(e,i);if(_optionalChain([n, 'optionalAccess', _3 => _3.produces]))for(let i of n.produces)this.declareProduction(e,i);return o}declareDependency(e,n){this.dependencies.has(e)||this.dependencies.set(e,new Set),this.dependencies.get(e).add(n)}declareProduction(e,n){this.productions.has(e)||this.productions.set(e,new Set),this.productions.get(e).add(n)}get(e){return this.intents.get(e)}list(){return Array.from(this.intents.values())}getDependencies(e){let n=this.dependencies.get(e);return n?Array.from(n):[]}getProductions(e){let n=this.productions.get(e);return n?Array.from(n):[]}getAllRelationships(){let e=[];for(let[n,r]of this.dependencies.entries())for(let o of r)e.push({from:n,to:o,kind:"dependsOn"});for(let[n,r]of this.productions.entries())for(let o of r)e.push({from:n,to:o,kind:"produces"});return e}has(e){return this.intents.has(e)}clear(){this.intents.clear(),this.dependencies.clear(),this.productions.clear()}}, _class);var Pt=new U;function Qn(t,e){return Pt.define(t,e)}_chunkA5EIY3HIcjs.a.call(void 0, Qn,"defineIntent");function Me(){return new U}_chunkA5EIY3HIcjs.a.call(void 0, Me,"createIntentRegistry");var er=Pt;var xt=["Domain.","Application.","Adapter.","Workflow.","Job.","Presentation.","Reporting.","Metadata.","Security.","Audit.","Observability.","Kernel."];function Ne(t){if(!t||typeof t!="string")return{valid:!1,reason:"Intent name must be a non-empty string"};if(!xt.some(n=>t.startsWith(n)))return{valid:!1,reason:`Intent "${t}" must start with one of: ${xt.join(", ")}`};let e=t.slice(t.indexOf(".")+1);return!e||!/^[A-Za-z][A-Za-z0-9_.]*$/.test(e)?{valid:!1,reason:`Intent "${t}" has an invalid segment after the layer prefix`}:{valid:!0}}_chunkA5EIY3HIcjs.a.call(void 0, Ne,"validateIntentName");var P=class extends Error{static{_chunkA5EIY3HIcjs.a.call(void 0, this,"PolicyViolationError")}constructor(e){let n=e.map(r=>`- ${r.policyName}: ${r.message}`).join(`
2
+ `);super(`Hard policy violation(s) detected:
3
+ ${n}`),this.name="PolicyViolationError",this.violations=e}};var N= (_class2 =class{static{_chunkA5EIY3HIcjs.a.call(void 0, this,"PolicyEngine")}__init4() {this.policies=[]}constructor(e=[]){;_class2.prototype.__init4.call(this);for(let n of e)this.add(n)}add(e){if(this.policies.some(n=>n.name===e.name))throw new Error(`Policy "${e.name}" is already registered in this engine.`);this.policies.push(e)}getPolicies(){return[...this.policies]}evaluate(e){let n=[];for(let i of this.policies){let s=i.check(e);if(s!==!0){if(s===!1){n.push({policyName:i.name,severity:i.severity,message:`Policy "${i.name}" was violated.`});continue}if(Array.isArray(s))for(let l of s)n.push({policyName:i.name,severity:i.severity,message:l.message,details:l.details});else n.push({policyName:i.name,severity:i.severity,message:s.message,details:s.details})}}let r=n.filter(i=>i.severity==="hard"),o=n.filter(i=>i.severity==="soft");return{passed:n.length===0,violations:n,hardViolations:r,softViolations:o}}enforce(e){let n=this.evaluate(e);if(n.hardViolations.length>0)throw new P(n.hardViolations);return n}clear(){this.policies.length=0}}, _class2);function q(t){let e=_nullishCoalesce(t.severity, () => ("soft"));return{name:t.name,severity:e,tags:t.tags,owner:t.owner,version:t.version,rationale:t.rationale,enforcementMode:t.enforcementMode,deprecated:t.deprecated,replacedBy:t.replacedBy,check:t.check}}_chunkA5EIY3HIcjs.a.call(void 0, q,"definePolicy");function tr(t){let e=t.indexOf(".");return e>=0?t.slice(0,e):t}_chunkA5EIY3HIcjs.a.call(void 0, tr,"defaultLayerOf");function Lt(t,e){return _nullishCoalesce(_optionalChain([e, 'access', _4 => _4.resolveLayer, 'optionalCall', _5 => _5(t)]), () => (tr(t)))}_chunkA5EIY3HIcjs.a.call(void 0, Lt,"resolveLayer");function nr(t,e,n){return t===n.from&&e===n.to}_chunkA5EIY3HIcjs.a.call(void 0, nr,"matchesRule");function Te(t){let e=_nullishCoalesce(t.name, () => ("Layer isolation")),n=_nullishCoalesce(t.severity, () => ("hard"));return q({name:e,severity:n,tags:["layer"],check:_chunkA5EIY3HIcjs.a.call(void 0, r=>{let o=[...(_nullishCoalesce(r.edges, () => ([]))).filter(s=>s.kind==="declared"||s.kind==="produces").map(s=>({from:s.from,to:s.to})),...(_nullishCoalesce(r.relationships, () => ([]))).filter(s=>s.kind==="dependsOn").map(s=>({from:s.from,to:s.to}))],i=[];for(let s of o){let l=Lt(s.from,t),c=Lt(s.to,t);for(let d of t.rules)!d.allowed&&nr(l,c,d)&&i.push({policyName:e,severity:n,message:_nullishCoalesce(d.message, () => (`Layer violation: ${s.from} (${l}) must not relate to ${s.to} (${c})`))})}return i.length>0?i:!0},"check")})}_chunkA5EIY3HIcjs.a.call(void 0, Te,"defineLayerPolicy");function Fe(t){return _nullishCoalesce(_optionalChain([t, 'access', _6 => _6.tags, 'optionalAccess', _7 => _7.includes, 'call', _8 => _8("layer")]), () => (!1))}_chunkA5EIY3HIcjs.a.call(void 0, Fe,"isLayerPolicy");var Ot={layerIsolation(){return Ot.cleanArchitectureMatrix()},cleanArchitectureMatrix(){return Te({name:"Clean architecture matrix",severity:"hard",rules:[{from:"Domain",to:"Adapter",allowed:!1},{from:"Domain",to:"Application",allowed:!1},{from:"Adapter",to:"Application",allowed:!1},{from:"Adapter",to:"Domain",allowed:!1}]})}};function _e(t,e={}){return Te({name:_nullishCoalesce(e.name, () => (`${t.name} layer policy`)),severity:_nullishCoalesce(e.severity, () => ("hard")),rules:t.rules,resolveLayer:t.resolveLayer})}_chunkA5EIY3HIcjs.a.call(void 0, _e,"defineArchitectureProfilePolicy");function Be(t){return e=>({event:e,relationships:_optionalChain([t, 'access', _9 => _9.intentRegistry, 'optionalAccess', _10 => _10.getAllRelationships, 'call', _11 => _11()]),edges:_optionalChain([t, 'access', _12 => _12.dependencyGraph, 'optionalAccess', _13 => _13.getEdges, 'call', _14 => _14()])})}_chunkA5EIY3HIcjs.a.call(void 0, Be,"buildPublishPolicyContext");function rr(t){return q(t)}_chunkA5EIY3HIcjs.a.call(void 0, rr,"definePublishPolicy");var z=class extends Error{static{_chunkA5EIY3HIcjs.a.call(void 0, this,"UnregisteredIntentError")}constructor(e){super(`Intent "${e}" is not registered. Register it with IntentRegistry.define() before publish/subscribe, including metadata.source producer intents in strict mode.`),this.name="UnregisteredIntentError",this.intentName=e}},J= exports.q =class extends Error{static{_chunkA5EIY3HIcjs.a.call(void 0, this,"InvalidIntentNameError")}constructor(e,n){super(`Invalid intent name "${e}": ${n}`),this.name="InvalidIntentNameError",this.intentName=e,this.reason=n}},Y= exports.r =class extends Error{static{_chunkA5EIY3HIcjs.a.call(void 0, this,"LayerPolicyContextError")}constructor(){super("Layer/architecture policies require intentRegistry, dependencyGraph, or a custom getPolicyContext. Without graph/registry context, layer policies cannot inspect relationships."),this.name="LayerPolicyContextError"}},X= exports.s =class extends Error{static{_chunkA5EIY3HIcjs.a.call(void 0, this,"EventContractViolationError")}constructor(e,n){super(`Event contract violation for "${e}". Register a matching event contract/version or fix the payload before publishing.`),this.name="EventContractViolationError",this.intentName=e,this.issues=n}},T= exports.t =class extends Error{static{_chunkA5EIY3HIcjs.a.call(void 0, this,"UnknownEventSourceError")}constructor(e,n){super(n?`Event "${e}" metadata.source "${n}" is not registered. Register the producer intent or publish from a known source.`:`Event "${e}" must include metadata.source. Strict Ark uses source to enforce observed layer flow.`),this.name="UnknownEventSourceError",this.intentName=e,this.source=n}},x= exports.u =class extends Error{static{_chunkA5EIY3HIcjs.a.call(void 0, this,"SourceMetadataOverrideError")}constructor(e,n){super(`Source-bound publisher for "${e}" cannot publish with metadata.source "${n}". Create a publisher for the intended source instead.`),this.name="SourceMetadataOverrideError",this.boundSource=e,this.attemptedSource=n}},Z= exports.v =class extends Error{static{_chunkA5EIY3HIcjs.a.call(void 0, this,"ObservedLayerFlowViolationError")}constructor(e,n,r,o,i){super(_nullishCoalesce(i, () => (`Observed layer violation: "${e}" (${r}) must not produce "${n}" (${o}). Route this through an allowed layer or adjust the architecture profile rule.`))),this.name="ObservedLayerFlowViolationError",this.source=e,this.intentName=n,this.fromLayer=r,this.toLayer=o}},F= exports.w =class extends Error{static{_chunkA5EIY3HIcjs.a.call(void 0, this,"ArkKernelConfigError")}constructor(e){super(`Hard observed-layer-flow enforcement cannot resolve layer(s) ${e.map(n=>`"${n}"`).join(", ")}: they appear in a deny rule but declare no intentPrefixes (and are not canonical 11-layer names), so no intent maps to them and the rule would never fire. Add intentPrefixes to those layers in ark.config.json, or pass enforceObservedLayerFlow: 'soft' | 'off' explicitly.`),this.name="ArkKernelConfigError",this.code="ARKRUN_LAYER_FLOW_UNRESOLVABLE",this.layers=e}};function Q(t,e){if(!(!e.strictRegistry&&!e.validateIntentNaming)){if(e.validateIntentNaming){let n=Ne(t);if(!n.valid)throw new J(t,n.reason)}if(e.strictRegistry&&e.intentRegistry&&!e.intentRegistry.has(t))throw new z(t)}}_chunkA5EIY3HIcjs.a.call(void 0, Q,"assertIntentAllowed");function $t(t,e){if(e.requireKnownSource){if(!t.metadata.source||t.metadata.source==="unknown")throw new T(t.intent);if(e.intentRegistry&&!e.intentRegistry.has(t.metadata.source))throw new T(t.intent,t.metadata.source)}}_chunkA5EIY3HIcjs.a.call(void 0, $t,"assertSourceAllowed");function ee(t,e){if(!e.eventContracts)return;let n=e.eventContracts.validate(t);if(!n.ok&&(e.strictEventContracts||n.contract))throw new X(t.intent,n.issues)}_chunkA5EIY3HIcjs.a.call(void 0, ee,"assertContractAllowed");function _(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}_chunkA5EIY3HIcjs.a.call(void 0, _,"isPlainRecord");function B(t){return Array.isArray(t)?t.map(B):_(t)?Object.fromEntries(Object.entries(t).map(([e,n])=>[e,B(n)])):t}_chunkA5EIY3HIcjs.a.call(void 0, B,"clonePatchValue");function je(t,e,n="payload"){let r={...t};for(let[o,i]of Object.entries(e)){let s=`${n}.${o}`;if(!(o in r)||r[o]===void 0){r[o]=B(i);continue}if(_(r[o])&&_(i)){r[o]=je(r[o],i,s);continue}if(Array.isArray(r[o])&&Array.isArray(i)){r[o]=Ge(r[o],i,s);continue}throw new Error(`Interceptor patch cannot overwrite existing ${s}.`)}return r}_chunkA5EIY3HIcjs.a.call(void 0, je,"mergeRecordPatch");function Ge(t,e,n="payload"){let r=[...t];return e.forEach((o,i)=>{let s=`${n}[${i}]`;if(i>=r.length||r[i]===void 0){r[i]=B(o);return}if(_(r[i])&&_(o)){r[i]=je(r[i],o,s);return}if(Array.isArray(r[i])&&Array.isArray(o)){r[i]=Ge(r[i],o,s);return}throw new Error(`Interceptor patch cannot overwrite existing ${s}.`)}),r}_chunkA5EIY3HIcjs.a.call(void 0, Ge,"mergeArrayPatch");function Dt(t,e){if(Array.isArray(e)){if(t===void 0)return B(e);if(!Array.isArray(t))throw new Error("Array interceptor patch requires an array payload.");return Ge(t,e)}if(t===void 0)return B(e);if(!_(t))throw new Error("Object interceptor patch requires an object payload.");return je(t,e)}_chunkA5EIY3HIcjs.a.call(void 0, Dt,"applyPayloadPatch");async function Mt(t,e){if(t.metadata.allowInterception===!1)return t;let n=[...e.interceptorsForIntent(t.intent)],r=t;for(let o of n){let i=[];try{if(await Promise.resolve(o.interceptor({event:r,intercept:_chunkA5EIY3HIcjs.a.call(void 0, c=>{i.push(c)},"intercept")})),i.length===0)continue;let s=new Date().toISOString(),l={...r,metadata:{...r.metadata,interceptions:[..._nullishCoalesce(r.metadata.interceptions, () => ([])),{interceptorId:o.interceptorId,timestamp:s}]}};for(let c of i)l={...l,payload:Dt(l.payload,c),metadata:{...l.metadata}};ee(l,{eventContracts:e.eventContracts,strictEventContracts:e.strictEventContracts}),r=l,o.lastInterceptedAt=s,e.appendTrace({type:"event.intercepted",timestamp:s,intent:r.intent,correlationId:r.metadata.correlationId,traceId:r.metadata.traceId,spanId:r.metadata.spanId,details:{registrationId:o.registrationId,interceptorId:o.interceptorId,patchesApplied:i.length}}),await e.recordAudit("event.intercepted",r,{registrationId:o.registrationId,interceptorId:o.interceptorId,patchesApplied:i.length})}catch(s){await or(o,r,s,e)}}return r}_chunkA5EIY3HIcjs.a.call(void 0, Mt,"applyInterceptors");async function or(t,e,n,r){let o=n instanceof Error?n.message:String(n);r.appendTrace({type:"interceptor.error",timestamp:new Date().toISOString(),intent:e.intent,correlationId:e.metadata.correlationId,traceId:e.metadata.traceId,spanId:e.metadata.spanId,details:{registrationId:t.registrationId,interceptorId:t.interceptorId,error:o}}),await r.recordAudit("interceptor.error",e,{registrationId:t.registrationId,interceptorId:t.interceptorId,error:o})}_chunkA5EIY3HIcjs.a.call(void 0, or,"recordInterceptorError");function Wt(t){if(t==="deny"||t==="deny-cross-parent")return t;if(t!==null&&typeof t=="object"){let e=t.mode;if(e==="deny-cross-parent")return e}}_chunkA5EIY3HIcjs.a.call(void 0, Wt,"sharedImportsSliceMode");function Vi(t){if(t===null||typeof t!="object")return[];let e=t.stopAt;return Array.isArray(e)?e.filter(n=>typeof n=="string"&&n.length>0):[]}_chunkA5EIY3HIcjs.a.call(void 0, Vi,"sharedImportsSliceStopAt");var Nt=new Map;function Tt(t){return/[.*+?^${}()|[\]\\]/.test(t)?`\\${t}`:t}_chunkA5EIY3HIcjs.a.call(void 0, Tt,"escapeLiteral");function pe(t){let e="";for(let n=0;n<t.length;n+=1){let r=t[n];if(r==="\\"&&n+1<t.length){let o=t[n+1];if("*?{}[],".includes(o)||o==="\\"){e+="\\"+o,n+=1;continue}e+="/";continue}e+=r}return e}_chunkA5EIY3HIcjs.a.call(void 0, pe,"normalizeGlobSeparators");function ir(t){let e=0;for(let n=0;n<t.length;n+=1){let r=t[n];if(r==="\\"){n+=1;continue}if(r==="{")e+=1;else if(r==="}"&&(e-=1,e<0))return!1}return e===0}_chunkA5EIY3HIcjs.a.call(void 0, ir,"bracesBalanced");function G(t){let e=Nt.get(t);if(e)return e;let n=pe(t),r=ir(n),o="",i=0;for(let l=0;l<n.length;l+=1){let c=n[l];c==="\\"&&l+1<n.length?(o+=Tt(n[l+1]),l+=1):c==="*"?n[l+1]==="*"?n[l+2]==="/"?(o+="(?:.*/)?",l+=2):(o+=".*",l+=1):o+="[^/]*":c==="?"?o+="[^/]":c==="{"&&r?(o+="(?:",i+=1):c==="}"&&r&&i>0?(o+=")",i-=1):c===","&&r&&i>0?o+="|":o+=Tt(c)}let s=new RegExp(`^${o}$`);return Nt.set(t,s),s}_chunkA5EIY3HIcjs.a.call(void 0, G,"globToRegExp");function sr(t){return pe(String(t)).split("/").filter(Boolean).filter(n=>n!=="**"&&n!=="*"&&!n.includes("*")&&!n.includes("?")&&!n.includes("{")&&!n.includes("["))}_chunkA5EIY3HIcjs.a.call(void 0, sr,"concreteGlobSegments");function ar(t,e){let n=pe(String(t)),r=sr(n),o=n.replace(/\*/g,"").length,i=r.length*1e4+o;if(e==null||e==="")return i;let s=String(e).split(/[/\\]/).filter(Boolean);if(r.length===0)return o;let l=0,c=-1;for(let d of r){let f=-1;for(let p=l;p<s.length;p+=1)if(s[p]===d){f=p;break}if(f<0)return i;c=f,l=f+1}return(c+1)*1e6+r.length*1e4+o}_chunkA5EIY3HIcjs.a.call(void 0, ar,"patternSpecificity");function Wi(t,e){let n=String(t).split(/[/\\]/).join("/"),r,o=-1;for(let i of _nullishCoalesce(e, () => ([])))if(!(_nullishCoalesce(i.exclude, () => ([]))).some(s=>G(s).test(n))){for(let s of _nullishCoalesce(i.patterns, () => ([])))if(G(s).test(n)){let l=ar(s,n);l>o&&(o=l,r=i.name)}}return r}_chunkA5EIY3HIcjs.a.call(void 0, Wi,"layerForRelativePath");function te(t,e,n){return qt(t,e,n==="stars"?"stars":"path")}_chunkA5EIY3HIcjs.a.call(void 0, te,"sliceIdForPath");function Ke(t,e){return qt(t,e?[...e]:void 0,Ut)}_chunkA5EIY3HIcjs.a.call(void 0, Ke,"legacyStarsSliceIdForPath");var Ut="stars-4.8.23";function qt(t,e,n){if(!_optionalChain([e, 'optionalAccess', _15 => _15.length]))return;let r=String(t).split(/[/\\]/).filter(Boolean);if(r.length===0)return;let o=new Set;for(let i of e){if(typeof i!="string"||i.length===0)continue;let s=lr(i);if(s.anchored){let l=dr(r,s.anchored,n);if(l)return l;continue}s.bare!==void 0&&o.add(s.bare)}return gr(r,o)}_chunkA5EIY3HIcjs.a.call(void 0, qt,"sliceIdWithBinding");var ce=new Map;function lr(t){let e=ce.get(t);if(e)return e;let n={};return zt(t)?n={anchored:cr(t)}:!t.includes("/")&&!t.includes("\\")&&!t.includes("*")&&(n={bare:t.toLowerCase()}),ce.size>=1024&&ce.clear(),ce.set(t,n),n}_chunkA5EIY3HIcjs.a.call(void 0, lr,"parsedSliceFolder");function zt(t){let e=t.split(/[/\\]/).filter(n=>n.length>0);return e.length<2||e[0]==="*"||e[0]==="**"?!1:e.some(n=>n==="*")}_chunkA5EIY3HIcjs.a.call(void 0, zt,"isAnchoredSliceEntry");function cr(t){return t.split(/[/\\]/).filter(e=>e.length>0).map(e=>e.toLowerCase())}_chunkA5EIY3HIcjs.a.call(void 0, cr,"anchoredSlicePattern");function dr(t,e,n){let r=Yt(t,_nullishCoalesce(e[0], () => ("")));for(let o of r){let i=ur(t,e,o,n);if(i)return i}}_chunkA5EIY3HIcjs.a.call(void 0, dr,"anchoredSliceIdFromPattern");function ur(t,e,n,r="path"){let o=[],i=[],s=-1,l=n;for(let c=0;c<e.length;c+=1){let d=e[c];if(d==="*"){if(l>=t.length-1){for(let f=c;f<e.length;f+=1)if(e[f]!=="*")return;break}o.push(t[l].toLowerCase()),i.push(!0),l+=1;continue}if(d==="**"||l>=t.length||t[l].toLowerCase()!==d)return;o.push(t[l].toLowerCase()),i.push(!1),s=o.length-1,l+=1}if(o.length!==0)return r===Ut?s<0?void 0:o.slice(s).join("/"):r==="stars"?s<0?void 0:o.filter((c,d)=>d>=s||i[d]).join("/"):o.join("/")}_chunkA5EIY3HIcjs.a.call(void 0, ur,"bindAnchoredSlice");function Jt(t){let e=-1;for(let r=0;r<t.length;r+=1)t[r]!=="*"&&(e=r);if(e<0)return null;let n=[];for(let r=0;r<t.length;r+=1)(r>=e||t[r]==="*")&&n.push(r);return n}_chunkA5EIY3HIcjs.a.call(void 0, Jt,"starsKeptSegmentIndexes");function Ui(t){let e=[];for(let n of _nullishCoalesce(t, () => ([]))){if(!n||n.sliceIdentity!=="stars")continue;let r=new Map,o=new Map;for(let i of _nullishCoalesce(n.sliceFolders, () => ([]))){if(typeof i!="string"||i.length===0)continue;let s=fr(i);if(!s)continue;let l=i.split(/[/\\]/).filter(f=>f.length>0).join("/").toLowerCase(),c=_nullishCoalesce(o.get(s), () => (new Set));if(c.has(l))continue;c.add(l),o.set(s,c);let d=_nullishCoalesce(r.get(s), () => ([]));d.push(i),r.set(s,d)}for(let[i,s]of r)s.length<2||e.push({from:n.from,to:n.to,stem:i,paths:s,message:pr(n.from,n.to,s,i)})}return e}_chunkA5EIY3HIcjs.a.call(void 0, Ui,"sliceIdentityCollisions");function fr(t){if(!zt(t))return;let e=t.split(/[/\\]/).filter(r=>r.length>0).map(r=>r.toLowerCase());if(e.some(r=>r==="**"))return;let n=Jt(e);if(n)return n.map(r=>e[r]).join("/")}_chunkA5EIY3HIcjs.a.call(void 0, fr,"starsIdentityStem");function pr(t,e,n,r){let o=n.length===2?`${n[0]} and ${n[1]}`:`${n.slice(0,-1).join(", ")}, and ${n[n.length-1]}`;return`${t} \u2192 ${e}: sliceIdentity "stars" gives one slice id to ${o}. They bind as ${r}.`}_chunkA5EIY3HIcjs.a.call(void 0, pr,"formatSliceIdentityCollision");function gr(t,e){if(e.size!==0){for(let n=0;n<t.length-1;n+=1)if(e.has(t[n].toLowerCase())&&!(n+1>=t.length-1))return`${t[n].toLowerCase()}/${t[n+1].toLowerCase()}`}}_chunkA5EIY3HIcjs.a.call(void 0, gr,"bareSliceId");function mr(t){let e=new Set;for(let n of _nullishCoalesce(t, () => ([]))){let o=pe(String(n)).split("/").filter(Boolean);for(let i=0;i<o.length;i+=1){let s=o[i];if((s==="**"||s==="*")&&i>0){let l=o[i-1];l&&!l.includes("*")&&!l.includes("{")&&!l.includes("}")&&e.add(l)}}}return[...e]}_chunkA5EIY3HIcjs.a.call(void 0, mr,"inferSliceFoldersFromPatterns");function Ue(t,e,n){if(Array.isArray(t.sliceFolders)&&t.sliceFolders.length>0)return t.sliceFolders.filter(o=>typeof o=="string"&&o.length>0);let r=(_nullishCoalesce(n, () => ([]))).find(o=>o.name===e);return mr(_optionalChain([r, 'optionalAccess', _16 => _16.patterns]))}_chunkA5EIY3HIcjs.a.call(void 0, Ue,"resolveSliceFolders");function Ft(t){return String(t).split(/[/\\]/).filter(e=>!!e&&e!==".").map(e=>e.toLowerCase())}_chunkA5EIY3HIcjs.a.call(void 0, Ft,"normalizeSegments");function ne(t){let e=t.length;for(;e>0&&t[e-1]==="/";)e-=1;return t.slice(0,e)}_chunkA5EIY3HIcjs.a.call(void 0, ne,"trimTrailingSlashes");var hr=["src","app"];function Yt(t,e){let n=(_nullishCoalesce(t[0], () => (""))).toLowerCase(),r=e.toLowerCase();return hr.includes(n)&&r!==n?[0,1]:[0]}_chunkA5EIY3HIcjs.a.call(void 0, Yt,"anchorOffsets");function yr(t){let e=ne(t.replace(/^[./]+/,""));return e==="*"||e==="**"}_chunkA5EIY3HIcjs.a.call(void 0, yr,"isBlanketRoot");function de(t,e){if(!t||!_optionalChain([e, 'optionalAccess', _17 => _17.length]))return!1;let n=String(t).split(/[/\\]/).join("/"),r=n.toLowerCase(),o=Ft(n);for(let i of e){if(typeof i!="string"||i.length===0||yr(i))continue;if(i.includes("*")){let c=ne(i.toLowerCase());if(G(c).test(r)||G(`${c}/**`).test(r))return!0;continue}let s=Ft(i);if(s.length===0)continue;let l=Yt(o,_nullishCoalesce(s[0], () => ("")));for(let c of l){if(c+s.length>o.length)continue;let d=!0;for(let f=0;f<s.length;f+=1)if(o[c+f]!==s[f]){d=!1;break}if(d)return!0}}return!1}_chunkA5EIY3HIcjs.a.call(void 0, de,"pathUnderSharedRoot");function _t(t,e){let n=String(t).split(/[/\\]/).filter(Boolean).join("/").toLowerCase();if(!n)return!1;let r=e.toLowerCase();return n===r?!0:!n.includes("/")&&r.endsWith(`/${n}`)}_chunkA5EIY3HIcjs.a.call(void 0, _t,"sliceMatchesDeclaration");function Bt(t,e,n){return!_optionalChain([t, 'optionalAccess', _18 => _18.length])||!e||!n?!1:t.some(r=>r&&typeof r.from=="string"&&typeof r.to=="string"&&_t(r.from,e)&&_t(r.to,n))}_chunkA5EIY3HIcjs.a.call(void 0, Bt,"crossSliceEdgeAllowed");function wr(t){if(!t.fromPath)return{denied:!0,reason:"missing-path"};if(t.folderCount<=0)return{denied:!0,reason:"no-slice-folders"};let e=!!t.fromSlice||t.fromShared===!0;if(!t.toPath)return e?t.fromSlice?{denied:!0,reason:"missing-path"}:{denied:!1}:{denied:!0,reason:"unclassifiable-path"};let n=!!t.toSlice||t.toShared===!0;return!e||!n?{denied:!0,reason:"unclassifiable-path"}:t.sharedImportsSlice==="deny"&&t.fromShared===!0&&t.toSlice&&!t.fromSlice?{denied:!0,reason:"shared-imports-slice"}:!t.fromSlice||!t.toSlice?{denied:!1}:t.fromSlice===t.toSlice?{denied:!1}:t.crossSliceAllowed?{denied:!1}:{denied:!0,reason:"cross-slice"}}_chunkA5EIY3HIcjs.a.call(void 0, wr,"peerIsolationDecision");function Xt(t){return ne(t.trim().replace(/\\/g,"/")).toLowerCase()}_chunkA5EIY3HIcjs.a.call(void 0, Xt,"aliasGlobPattern");function Zt(t,e){let n=Xt(t);if(!n||n==="*"||n==="**")return!1;let r=String(e).replace(/\\/g,"/").replace(/^\/+/,"").toLowerCase(),o=We(r),i=G(n),l=(_nullishCoalesce(n.split("/").pop(), () => (""))).includes("*")?null:G(`${n}/**`),c=_chunkA5EIY3HIcjs.a.call(void 0, d=>i.test(d)||l!==null&&l.test(d),"hit");return c(r)||o!==r&&c(o)}_chunkA5EIY3HIcjs.a.call(void 0, Zt,"aliasGlobMatches");function qi(t,e){return!t||!_optionalChain([e, 'optionalAccess', _19 => _19.length])?!1:de(t,[...e])?!0:e.some(n=>typeof n=="string"&&Zt(n,t))}_chunkA5EIY3HIcjs.a.call(void 0, qi,"pathMatchesSharedWalkStop");function qe(t){let e=Xt(t).split("/").filter(Boolean);return e.length<2||e.some(n=>n.includes("*")||n==="."||n==="..")?null:{universeId:e.slice(0,-1).join("/"),childId:e.join("/")}}_chunkA5EIY3HIcjs.a.call(void 0, qe,"splitAliasTarget");function Qt(t,e){for(let n of _nullishCoalesce(_optionalChain([e, 'access', _20 => _20.childSlices, 'optionalAccess', _21 => _21.sliceAliases]), () => ([])))if(!(!n||typeof n.from!="string"||typeof n.to!="string")&&Zt(n.from,t))return n;return null}_chunkA5EIY3HIcjs.a.call(void 0, Qt,"firstSliceAliasEntry");function Sr(t,e){let n=Qt(t,e);return n?qe(n.to):null}_chunkA5EIY3HIcjs.a.call(void 0, Sr,"firstSliceAlias");function Ve(t,e,n){if(!t)return{};let r=_nullishCoalesce(n, () => (e.sliceFolders)),o=te(t,r?[...r]:void 0,e.sliceIdentity),i=ue(t,o,e.childSlices);if(o||i.childId||i.mismatched)return i.childId?{universeId:o,childId:i.childId}:{universeId:o};let s=Sr(t,e);return s?{universeId:s.universeId,childId:s.childId}:{}}_chunkA5EIY3HIcjs.a.call(void 0, Ve,"resolveGovernedSlice");function Ir(t){let e=[];for(let n of _nullishCoalesce(t, () => ([]))){if(typeof n!="string"||n.length===0)continue;let r=n.split(/[/\\]/).filter(Boolean).map(l=>l.toLowerCase());if(r.length===1&&r[0]&&!r[0].includes("*")){e.push({literals:[r[0],null],legacy:[r[0],null]});continue}if(r.some(l=>l==="**"||l.includes("*")&&l!=="*"))continue;let o=Jt(r);if(!o||!r.includes("*"))continue;let i=_chunkA5EIY3HIcjs.a.call(void 0, l=>l==="*"?null:l,"star"),s=_nullishCoalesce(o.find(l=>r[l]!=="*"), () => (0));e.push({literals:o.map(l=>i(_nullishCoalesce(r[l], () => ("")))),legacy:r.slice(s).map(i)})}return e}_chunkA5EIY3HIcjs.a.call(void 0, Ir,"starsUniverseShapes");function jt(t,e){return t.length===e.length&&t.every((n,r)=>n===null||e[r]==="*"||n===e[r])}_chunkA5EIY3HIcjs.a.call(void 0, jt,"literalsMatch");function j(t,e){let n=e.split("/").filter(Boolean).map(i=>i.toLowerCase()),r=Ir(t);if(n.length===0||r.some(i=>jt(i.literals,n)))return[];let o=new Set;for(let i of r)if(i.legacy.length!==i.literals.length&&jt(i.legacy,n)){let s=[...n],l=i.literals.length-i.legacy.length;o.add([...i.literals.slice(0,l).map(()=>"*"),...s].join("/"))}return[...o].sort()}_chunkA5EIY3HIcjs.a.call(void 0, j,"legacyStarsIdTargets");function en(t,e){if(t.sliceIdentity!=="stars")return;let n=qe(e);if(n)return j(t.sliceFolders,n.universeId).length===1?n.universeId:void 0}_chunkA5EIY3HIcjs.a.call(void 0, en,"legacyAliasUniverse");function Gt(t,e,n){let r=Ve(t,e,n);if(!t||e.sliceIdentity!=="stars")return r;if(r.universeId){let o=Qt(t,e);if(!te(t,[...n],e.sliceIdentity)&&o&&en(e,o.to)!==void 0)return{...r,legacyAlias:!0,legacyUniverse:r.universeId,legacyChild:r.childId};let s=Ke(t,n),l=e.childSlices,c=_optionalChain([l, 'optionalAccess', _22 => _22.sliceIdentity])==="stars"?Ke(t,l.sliceFolders):void 0;return{...r,...s?{legacyUniverse:s}:{},...c&&r.childId?{legacyChild:c}:{}}}return r}_chunkA5EIY3HIcjs.a.call(void 0, Gt,"placeForPair");function vr(t,e,n,r){let o=Gt(n,t,e),i=Gt(r,t,e),s=o.legacyUniverse,l=i.legacyUniverse,c=_chunkA5EIY3HIcjs.a.call(void 0, (y,u)=>{if(!y.legacyAlias||u.legacyAlias||!u.universeId||_optionalChain([u, 'access', _23 => _23.legacyUniverse, 'optionalAccess', _24 => _24.toLowerCase, 'call', _25 => _25()])!==_optionalChain([y, 'access', _26 => _26.universeId, 'optionalAccess', _27 => _27.toLowerCase, 'call', _28 => _28()]))return y;let w=_optionalChain([y, 'access', _29 => _29.childId, 'optionalAccess', _30 => _30.split, 'call', _31 => _31("/"), 'access', _32 => _32.pop, 'call', _33 => _33()]);return{...y,universeId:u.universeId,...w?{childId:`${u.universeId}/${w}`}:{}}},"adopt"),d=c(o,i),f=c(i,o),p=Bt(t.allowedCrossSlice,d.universeId,f.universeId)||t.sliceIdentity==="stars"&&(s!==d.universeId||l!==f.universeId)&&Bt(t.allowedCrossSlice,s,l),m=_optionalChain([t, 'access', _34 => _34.childSlices, 'optionalAccess', _35 => _35.sliceIdentity])==="stars"&&o.legacyChild!==void 0&&i.legacyChild!==void 0&&o.legacyChild!==i.legacyChild&&tn(t.childSlices.allowedCrossSlice,o.legacyChild,i.legacyChild),h=_chunkA5EIY3HIcjs.a.call(void 0, y=>({...y.universeId?{universeId:y.universeId}:{},...y.childId?{childId:y.childId}:{}}),"strip");return{from:h(d),to:h(f),crossSliceAllowed:p,legacyChildAllowed:m}}_chunkA5EIY3HIcjs.a.call(void 0, vr,"resolveGovernedSlicePair");function br(t,e){switch(t){case"cross-slice":return`cross-slice edge ${_nullishCoalesce(e.fromSlice, () => ("?"))} \u2192 ${_nullishCoalesce(e.toSlice, () => ("?"))}. Extract the shared code, use events/ports across slices, or declare the edge in the rule's allowedCrossSlice.`;case"shared-imports-slice":return`shared root imports slice ${_nullishCoalesce(e.toSlice, () => ("?"))} (${_nullishCoalesce(e.fromPath, () => ("?"))} \u2192 ${_nullishCoalesce(e.toPath, () => ("?"))}). The wall is direct-only.`;case"unclassifiable-path":{let n=[e.fromSlice?void 0:e.fromPath,e.toSlice?void 0:e.toPath].filter(o=>!!o);return`unclassifiable path${n.length>0?` (${n.join(", ")})`:""} \u2014 ArkGate cannot place it in a slice, so it cannot prove this is not a cross-slice edge. Move it into a slice, or declare its root in the rule's sharedRoots.`}case"no-slice-folders":return"no slice folders \u2014 peerIsolation is on but no slice folder resolves from the rule or the layer patterns. Set sliceFolders on the rule.";default:return"no path evidence for this edge \u2014 peerIsolation needs the importer and importee paths."}}_chunkA5EIY3HIcjs.a.call(void 0, br,"peerIsolationDenyExplanation");function Ar(t,e){return`cross-parent slice ${_nullishCoalesce(t, () => ("?"))} \u2192 ${_nullishCoalesce(e, () => ("?"))}. The child wall cannot allow another universe.`}_chunkA5EIY3HIcjs.a.call(void 0, Ar,"crossParentExplanation");function kr(t,e,n){return`cross-sibling slice ${t} \u2192 ${e} inside ${n}.`}_chunkA5EIY3HIcjs.a.call(void 0, kr,"crossSiblingExplanation");function Er(t){return`universe common imports child ${t}. parentMayImportChild is off.`}_chunkA5EIY3HIcjs.a.call(void 0, Er,"parentImportsChildExplanation");function Ht(t){if(!t)return;let e=t.split("/").filter(Boolean);return e.length>0?e[e.length-1]:void 0}_chunkA5EIY3HIcjs.a.call(void 0, Ht,"universePairLabel");function Rr(t,e){if(!t||!_optionalChain([e, 'optionalAccess', _36 => _36.length]))return!1;let n=t.toLowerCase();return e.some(r=>typeof r=="string"&&r.length>0&&r.toLowerCase()===n)}_chunkA5EIY3HIcjs.a.call(void 0, Rr,"isCommonFolderName");function ue(t,e,n){if(!t||!_optionalChain([n, 'optionalAccess', _37 => _37.sliceFolders, 'optionalAccess', _38 => _38.length]))return{};let r=te(t,n.sliceFolders,n.sliceIdentity);if(!r||!e)return{};let o=r.toLowerCase(),i=e.toLowerCase();if(o===i)return{};if(!o.startsWith(`${i}/`))return{mismatched:{childId:r,universeId:e}};let s=o.slice(i.length+1).split("/")[0];return Rr(s,n.commonFolders)?{}:{childId:r}}_chunkA5EIY3HIcjs.a.call(void 0, ue,"resolveChildSliceId");function Cr(t){return ne(t.trim().replace(/\\/g,"/")).toLowerCase()}_chunkA5EIY3HIcjs.a.call(void 0, Cr,"siblingEntryKey");function We(t){return t.replace(/^(?:src|app)\//,"")}_chunkA5EIY3HIcjs.a.call(void 0, We,"stripSrcOrApp");function Pr(t,e){let n=t.replace(/\\/g,"/").replace(/^\/+/,"").toLowerCase(),r=We(e);if(!r)return!1;let o=We(n);return n===r||n.startsWith(`${r}/`)||o===r||o.startsWith(`${r}/`)}_chunkA5EIY3HIcjs.a.call(void 0, Pr,"pathUnderSubtree");function xr(t,e,n){if(!e||!_optionalChain([n, 'optionalAccess', _39 => _39.length]))return!1;let r=e.toLowerCase();for(let o of n){if(typeof o!="string")continue;let i=Cr(o);if(!(!i||i.includes("*"))&&(r===i||t&&Pr(t,i)))return!0}return!1}_chunkA5EIY3HIcjs.a.call(void 0, xr,"importerInEnforcedSubtree");function Lr(t,e,n){return t==null||t==="deny"?!1:t==="advisory"?!0:t.default==="deny"?!1:!xr(e,n,t.enforce)}_chunkA5EIY3HIcjs.a.call(void 0, Lr,"siblingCrossingAdvisory");function fe(t){if(typeof t!="string")return null;let e=ne(t.trim().replace(/\\/g,"/")).toLowerCase();if(!e.includes("/"))return null;let n=e.split("/");for(let r of n)if(r.length===0||r==="."||r===".."||r.includes("*")&&r!=="*")return null;return n}_chunkA5EIY3HIcjs.a.call(void 0, fe,"childSlicePatternSegments");function Kt(t,e){let n=fe(t),r=fe(e);if(!n||!r||n.length!==r.length)return!1;for(let o=0;o<n.length;o+=1){let i=n[o];if(i!=="*"&&i!==r[o])return!1}return!0}_chunkA5EIY3HIcjs.a.call(void 0, Kt,"childSlicePatternMatches");function tn(t,e,n){if(!_optionalChain([t, 'optionalAccess', _40 => _40.length]))return!1;for(let r of t)if(!(!r||typeof r.from!="string"||typeof r.to!="string")&&Kt(r.from,e)&&Kt(r.to,n))return!0;return!1}_chunkA5EIY3HIcjs.a.call(void 0, tn,"childCrossSliceAllowed");function Or(t,e){let n=fe(t),r=fe(e);if(!n||!r)return!1;let o=n.slice(0,-1),i=r.slice(0,-1);if(o.length!==i.length)return!0;for(let s=0;s<o.length;s+=1){let l=o[s],c=i[s];if(l==="*"||c==="*"||l!==c)return!0}return!1}_chunkA5EIY3HIcjs.a.call(void 0, Or,"childAllowanceSpansUniverses");function $r(t){let e=wr({fromPath:t.fromPath,toPath:t.toPath,folderCount:t.folderCount,fromSlice:t.fromSlice,toSlice:t.toSlice,fromShared:t.fromShared,toShared:t.toShared,crossSliceAllowed:t.crossSliceAllowed,sharedImportsSlice:Wt(t.rule.sharedImportsSlice)});if(e.denied){let s=!!t.rule.childSlices&&e.reason==="cross-slice";return{crossing:e.reason==="cross-slice"?"cross-parent":"fail-closed",decision:"deny",...s?{reasonId:"CROSS_PARENT_SLICE"}:{},explanation:s?Ar(t.fromSlice,t.toSlice):br(_nullishCoalesce(e.reason, () => ("missing-path")),{fromPath:t.fromPath,toPath:t.toPath,fromSlice:t.fromSlice,toSlice:t.toSlice}),peerIsolationReason:e.reason,fromUniverse:t.fromSlice,toUniverse:t.toSlice}}let n=t.rule.childSlices;if(!n||!t.fromSlice||!t.toSlice||t.fromSlice!==t.toSlice||!t.toPath)return{crossing:"none",decision:"allow",fromUniverse:t.fromSlice,toUniverse:t.toSlice};let r=_nullishCoalesce(t.fromChild, () => (ue(t.fromPath,t.fromSlice,n).childId)),o=_nullishCoalesce(t.toChild, () => (ue(t.toPath,t.toSlice,n).childId)),i={crossing:"none",decision:"allow",fromUniverse:t.fromSlice,toUniverse:t.toSlice};return r&&o&&r!==o?t.legacyChildAllowed||tn(n.allowedCrossSlice,r,o)?i:{crossing:"cross-sibling",decision:Lr(n.siblings,t.fromPath,r)?"advisory":"deny",reasonId:"CROSS_SIBLING_SLICE",explanation:kr(r,o,t.fromSlice),fromUniverse:t.fromSlice,toUniverse:t.toSlice}:!r&&o&&n.parentMayImportChild!==!0?{crossing:"parent-imports-child",decision:"deny",explanation:Er(o),fromUniverse:t.fromSlice,toUniverse:t.toSlice}:i}_chunkA5EIY3HIcjs.a.call(void 0, $r,"evaluateNestedSliceWall");function nn(t){return _optionalChain([t, 'optionalAccess', _41 => _41.crossing])==="cross-sibling"||_optionalChain([t, 'optionalAccess', _42 => _42.crossing])==="parent-imports-child"}_chunkA5EIY3HIcjs.a.call(void 0, nn,"isChildWallCrossing");function zi(t,e){return nn(e)?_optionalChain([t, 'optionalAccess', _43 => _43.childSlices, 'optionalAccess', _44 => _44.message]):_optionalChain([t, 'optionalAccess', _45 => _45.message])}_chunkA5EIY3HIcjs.a.call(void 0, zi,"sliceConsumerMessage");function Ji(t){let e=t.verdict.explanation,n=nn(t.verdict),r=n?t.childMessage:t.ruleMessage;if(t.surface==="intent"){let o=_nullishCoalesce(t.defaultMessage, () => (`${t.fromLayer} must not reference ${t.toLayer} intent.`));return n&&e?`${_nullishCoalesce(t.childMessage, () => (o))} ${e}`:t.verdict.reasonId&&e?`${o} ${e}`:e&&t.verdict.peerIsolationReason!=="cross-slice"?`${o} ${e}`:r?e?`${r} (${e})`:r:o}if(r)return e?`${r} (${e})`:r;if(e){let o=_nullishCoalesce(t.kind, () => ("import"));return`${t.fromLayer} must not ${o} another slice of ${t.toLayer} (${t.fromPath} \u2192 ${t.toPath}): ${e}`}return`${t.fromLayer} must not ${_nullishCoalesce(t.kind, () => ("import"))} ${t.toLayer}.`}_chunkA5EIY3HIcjs.a.call(void 0, Ji,"composeSliceDenialMessage");function Yi(t){if(!t||t.decision==="allow")return{};let e=Ht(t.fromUniverse),n=Ht(t.toUniverse);return{...t.reasonId?{reasonId:t.reasonId}:{},...t.reasonId&&e&&n?{universeFrom:e,universeTo:n}:{},...t.decision==="advisory"?{failsStrict:!1,severity:"warning"}:{}}}_chunkA5EIY3HIcjs.a.call(void 0, Yi,"sliceFindingExtras");function Xi(t,e){let n=[],r=new Set,o=new Set;for(let i of _nullishCoalesce(t, () => ([])))if(_optionalChain([i, 'optionalAccess', _46 => _46.peerIsolation])&&i.allowed===!1&&n.push(...Dr(i,e)),!!_optionalChain([i, 'optionalAccess', _47 => _47.childSlices])){if(!i.peerIsolation||i.allowed!==!1){n.push({ruleId:"CONFIG_CHILD_SLICES_INERT",failsStrict:!1,fromLayer:i.from,toLayer:i.to,message:`${i.from} \u2192 ${i.to}: childSlices is inert on this rule and enforces nothing. The child wall runs only inside a universe wall. Add "peerIsolation": true and "allowed": false to the same rule, or remove childSlices.`});continue}for(let s of e){let l=te(s,i.sliceFolders,i.sliceIdentity),c=ue(s,l,i.childSlices);if(!c.mismatched)continue;let d=`${i.from}\0${i.to}\0${c.mismatched.universeId}\0${c.mismatched.childId}`;r.has(d)||(r.add(d),n.push({ruleId:"CONFIG_CHILD_SLICE_EXTENDS",failsStrict:!1,fromLayer:i.from,toLayer:i.to,path:s,message:`${i.from} \u2192 ${i.to}: child id ${c.mismatched.childId} does not extend universe id ${c.mismatched.universeId} (${s}).`}))}for(let s of _nullishCoalesce(i.childSlices.allowedCrossSlice, () => ([]))){if(!s||typeof s.from!="string"||typeof s.to!="string"||!Or(s.from,s.to))continue;let l=`${s.from.trim().toLowerCase()}\0${s.to.trim().toLowerCase()}`;o.has(l)||(o.add(l),n.push({ruleId:"CONFIG_CHILD_SLICE_CROSS_UNIVERSE",failsStrict:!1,fromLayer:i.from,toLayer:i.to,message:`childSlices.allowedCrossSlice ${s.from} \u2192 ${s.to} cannot cross the universe wall. The universe wall still denies that edge.`}))}}return n}_chunkA5EIY3HIcjs.a.call(void 0, Xi,"childSliceConfigFindings");function Vt(t,e){let n=new Map;if(!_optionalChain([t, 'optionalAccess', _48 => _48.length]))return n;for(let r of e){if(typeof r!="string")continue;let o=te(r,[...t],"stars"),i=Ke(r,t);if(!o||!i||o===i)continue;let s=_nullishCoalesce(n.get(i), () => (new Set));s.add(o),n.set(i,s)}return n}_chunkA5EIY3HIcjs.a.call(void 0, Vt,"observedIdsByLegacy");function He(t,e,n,r){let o=r?`/${r}`:"",i=`${_nullishCoalesce(e[0], () => (t))}${o}`,s=[..._nullishCoalesce(n.get(t.toLowerCase()), () => ([]))].sort().map(l=>`${l}${o}`);return s.length===1?`${s[0]}`:s.length>1?`${i} (one entry per module: ${s.join(", ")})`:i}_chunkA5EIY3HIcjs.a.call(void 0, He,"newIdHint");function Dr(t,e){let n=[],r=_chunkA5EIY3HIcjs.a.call(void 0, i=>n.push({ruleId:"CONFIG_SLICE_LEGACY_STARS_ID",failsStrict:!1,fromLayer:t.from,toLayer:t.to,message:`${t.from} \u2192 ${t.to}: ${i} It keeps its 4.8.23 meaning for this release only.`}),"push"),o=t.childSlices;if(t.sliceIdentity==="stars"){let i=Vt(t.sliceFolders,e);for(let s of _nullishCoalesce(_optionalChain([o, 'optionalAccess', _49 => _49.sliceAliases]), () => ([]))){if(!s||typeof s.to!="string")continue;let l=qe(s.to);if(!l||en(t,s.to)===void 0)continue;let c=j(t.sliceFolders,l.universeId),d=l.childId.split("/").pop();r(`sliceAliases to "${s.to}" is a 4.8.23 stars id (the star before the last literal was dropped). The id is now ${He(l.universeId,c,i,d)}; write that instead.`)}for(let s of _nullishCoalesce(t.allowedCrossSlice, () => ([]))){if(!s||typeof s.from!="string"||typeof s.to!="string")continue;let l=[s.from,s.to].filter(d=>d.includes("/")&&j(t.sliceFolders,d).length>0);if(l.length===0)continue;let c=_chunkA5EIY3HIcjs.a.call(void 0, d=>l.includes(d)?He(d,j(t.sliceFolders,d),i):d,"rename");r(`allowedCrossSlice ${s.from} \u2192 ${s.to} names a 4.8.23 stars id. The ids are now ${c(s.from)} \u2192 ${c(s.to)}; write those instead.`)}}if(_optionalChain([o, 'optionalAccess', _50 => _50.sliceIdentity])==="stars"){let i=Vt(o.sliceFolders,e);for(let s of _nullishCoalesce(o.allowedCrossSlice, () => ([]))){if(!s||typeof s.from!="string"||typeof s.to!="string")continue;let l=[s.from,s.to].filter(d=>j(o.sliceFolders,d).length>0);if(l.length===0)continue;let c=_chunkA5EIY3HIcjs.a.call(void 0, d=>l.includes(d)?He(d,j(o.sliceFolders,d),i):d,"rename");r(`childSlices.allowedCrossSlice ${s.from} \u2192 ${s.to} names a 4.8.23 stars id. The ids are now ${c(s.from)} \u2192 ${c(s.to)}; write those instead.`)}}return n}_chunkA5EIY3HIcjs.a.call(void 0, Dr,"legacyStarsIdFindings");function Zi(t){if(t!==null&&typeof t=="object"){let e=t.ratchet;if(e===!0)return"always";if(e===!1)return"never"}return"auto"}_chunkA5EIY3HIcjs.a.call(void 0, Zi,"siblingRatchetMode");function rn(t,e,n,r){return _optionalChain([Mr, 'call', _51 => _51(t,e,n,r), 'optionalAccess', _52 => _52.rule])}_chunkA5EIY3HIcjs.a.call(void 0, rn,"findDeniedEdgeRule");function Mr(t,e,n,r){for(let o of _nullishCoalesce(t, () => ([])))if(!(o.from!==e||o.to!==n)&&o.allowed===!1){if(o.peerIsolation){let i=_optionalChain([r, 'optionalAccess', _53 => _53.fromPath]),s=_optionalChain([r, 'optionalAccess', _54 => _54.toPath]),l=Ue(o,e,_optionalChain([r, 'optionalAccess', _55 => _55.layers])),c=vr(o,l,i,s),d=c.from,f=c.to,p=d.universeId,m=f.universeId,h=$r({rule:o,fromPath:i,toPath:s,folderCount:l.length,fromSlice:p,toSlice:m,fromChild:d.childId,toChild:f.childId,fromShared:!p&&de(i,o.sharedRoots),toShared:!m&&de(s,o.sharedRoots),crossSliceAllowed:c.crossSliceAllowed,legacyChildAllowed:c.legacyChildAllowed});if(h.decision!=="allow")return{rule:o,peerIsolationReason:h.peerIsolationReason,fromSlice:p,toSlice:m,sliceVerdict:h};continue}if(e!==n)return{rule:o}}}_chunkA5EIY3HIcjs.a.call(void 0, Mr,"findDeniedEdgeDecision");function Qi(t,e,n,r){let o=_optionalChain([r, 'optionalAccess', _56 => _56.fromPath]),i=_optionalChain([r, 'optionalAccess', _57 => _57.toPath]);if(!(!o||!i))for(let s of _nullishCoalesce(t, () => ([]))){if(s.from!==e||s.to!==n||s.allowed!==!1||!s.peerIsolation||Wt(s.sharedImportsSlice)==="deny")continue;let l=Ue(s,e,_optionalChain([r, 'optionalAccess', _58 => _58.layers])),c=Ve(o,s,l).universeId,d=Ve(i,s,l).universeId;if(!(c||!d)&&de(o,s.sharedRoots))return{fromPath:o,toPath:i,toSlice:d}}}_chunkA5EIY3HIcjs.a.call(void 0, Qi,"findSharedImportsSliceBridge");function es(t,e,n){return Ue(t,e,n)}_chunkA5EIY3HIcjs.a.call(void 0, es,"peerSliceFolders");async function on(t,e){if(e.mode==="off"||!e.architectureProfile)return;let n=t.metadata.source;if(!n||n==="unknown")return;let r=e.architectureProfile,o=r.resolveLayer(n),i=r.resolveLayer(t.intent);if(!o||!i)return;let s=rn(r.rules.filter(f=>f.peerIsolation!==!0),o,i);if(!s)return;let l=e.mode,c=_nullishCoalesce(s.message, () => (`Observed layer violation: "${n}" (${o}) must not produce "${t.intent}" (${i}).`)),d={source:n,intent:t.intent,fromLayer:o,toLayer:i,severity:l,message:c,rule:s};if(e.appendTrace({type:"layer.observedViolation",timestamp:new Date().toISOString(),intent:t.intent,correlationId:t.metadata.correlationId,traceId:t.metadata.traceId,spanId:t.metadata.spanId,details:d}),await e.recordAudit("layer.observedViolation",t,d),l==="hard")throw new Z(n,t.intent,o,i,c)}_chunkA5EIY3HIcjs.a.call(void 0, on,"assertObservedLayerFlowAllowed");async function sn(t,e){let n=e.getPolicyContext(t),r;try{r=e.policyEngine.enforce(n)}catch(o){throw o instanceof P&&(e.appendTrace({type:"policy.hardViolation",timestamp:new Date().toISOString(),intent:t.intent,correlationId:t.metadata.correlationId,traceId:t.metadata.traceId,spanId:t.metadata.spanId,details:{violations:o.violations}}),await e.recordAudit("policy.hardViolation",t,{violations:o.violations})),o}r.softViolations.length>0&&(e.appendTrace({type:"policy.softViolation",timestamp:new Date().toISOString(),intent:t.intent,correlationId:t.metadata.correlationId,traceId:t.metadata.traceId,spanId:t.metadata.spanId,details:{violations:r.softViolations}}),await e.recordAudit("policy.softViolation",t,{violations:r.softViolations}),e.onSoftViolation&&await e.safeHook(()=>e.onSoftViolation(r,t),"onSoftViolation",t))}_chunkA5EIY3HIcjs.a.call(void 0, sn,"enforcePublishPolicy");function Nr(t,e){t.history.push(e),t.maxHistorySize!==void 0&&t.history.length>t.maxHistorySize&&t.history.splice(0,t.history.length-t.maxHistorySize)}_chunkA5EIY3HIcjs.a.call(void 0, Nr,"appendHistory");function L(t,e){t.trace.push(e),t.maxHistorySize!==void 0&&t.trace.length>t.maxHistorySize&&t.trace.splice(0,t.trace.length-t.maxHistorySize);for(let n of t.traceSinks)try{n(e)}catch (e2){}}_chunkA5EIY3HIcjs.a.call(void 0, L,"appendTrace");async function re(t,e,n,r){if(t.auditTrail)try{await t.auditTrail.record({type:e,source:n.metadata.source,intent:n.intent,correlationId:n.metadata.correlationId,causationId:n.metadata.causationId,subject:n.intent,details:r})}catch(o){L(t,{type:"hook.error",timestamp:new Date().toISOString(),intent:n.intent,correlationId:n.metadata.correlationId,traceId:n.metadata.traceId,spanId:n.metadata.spanId,details:{hook:"auditTrail",error:o instanceof Error?o.message:String(o)}})}}_chunkA5EIY3HIcjs.a.call(void 0, re,"recordAudit");async function an(t,e){let n={intent:e.intent,source:e.metadata.source,suggestion:"Publish through a registered intent creator so strict registry, contracts, and agent tooling share one source of truth."};L(t,{type:"event.rawPublish",timestamp:new Date().toISOString(),intent:e.intent,correlationId:e.metadata.correlationId,traceId:e.metadata.traceId,spanId:e.metadata.spanId,details:n}),await re(t,"event.rawPublish",e,n)}_chunkA5EIY3HIcjs.a.call(void 0, an,"recordRawPublishDiagnostic");async function ln(t,e,n,r){let o={event:e,publishedAt:new Date().toISOString(),subscribersNotified:n};Nr(t,o);let i=await _optionalChain([t, 'access', _59 => _59.eventBuffer, 'optionalAccess', _60 => _60.enqueue, 'call', _61 => _61(e,r)]);return L(t,{type:"event.published",timestamp:o.publishedAt,intent:e.intent,correlationId:e.metadata.correlationId,traceId:e.metadata.traceId,spanId:e.metadata.spanId,details:{subscribersNotified:n}}),await re(t,"event.published",e,{subscribersNotified:n}),{record:o,bufferRecord:_nullishCoalesce(i, () => (void 0))}}_chunkA5EIY3HIcjs.a.call(void 0, ln,"recordSuccessfulPublish");async function cn(t,e,n,r){let o=t.eventBuffer;if(o)try{r.ok?await o.markDispatched(n):await o.markFailed(n,r.error)}catch(i){L(t,{type:"hook.error",timestamp:new Date().toISOString(),intent:e.intent,correlationId:e.metadata.correlationId,traceId:e.metadata.traceId,spanId:e.metadata.spanId,details:{hook:"eventBuffer",error:i instanceof Error?i.message:String(i)}})}}_chunkA5EIY3HIcjs.a.call(void 0, cn,"settleBufferRecord");async function dn(t,e,n,r){let o={transport:r,error:n instanceof Error?n.message:String(n)};L(t,{type:"event.handoffFailed",timestamp:new Date().toISOString(),intent:e.intent,correlationId:e.metadata.correlationId,traceId:e.metadata.traceId,spanId:e.metadata.spanId,details:o}),await re(t,"event.handoffFailed",e,o)}_chunkA5EIY3HIcjs.a.call(void 0, dn,"recordHandoffFailure");function ze(t,e,n){return{...t,...e,occurredAt:e.occurredAt||t.occurredAt||new Date().toISOString(),source:e.source||t.source||"unknown",kernelInstanceId:_nullishCoalesce(_nullishCoalesce(e.kernelInstanceId, () => (t.kernelInstanceId)), () => (n)),eventVersion:_nullishCoalesce(e.eventVersion, () => (t.eventVersion)),schemaVersion:_nullishCoalesce(e.schemaVersion, () => (t.schemaVersion)),allowInterception:_nullishCoalesce(e.allowInterception, () => (t.allowInterception)),interceptions:_nullishCoalesce(e.interceptions, () => (t.interceptions)),correlationId:_nullishCoalesce(e.correlationId, () => (t.correlationId)),causationId:_nullishCoalesce(e.causationId, () => (t.causationId)),traceId:_nullishCoalesce(e.traceId, () => (t.traceId)),spanId:_nullishCoalesce(e.spanId, () => (t.spanId)),parentSpanId:_nullishCoalesce(e.parentSpanId, () => (t.parentSpanId))}}_chunkA5EIY3HIcjs.a.call(void 0, ze,"enrichMetadata");function Tr(){let t=globalThis.crypto;return t&&typeof t.randomUUID=="function"?t.randomUUID().replace(/-/g,"").slice(0,10):Math.random().toString(36).slice(2,12).padEnd(10,"0")}_chunkA5EIY3HIcjs.a.call(void 0, Tr,"randomNonce");var Fr=Tr(),un=new Map;function k(t){let e=(_nullishCoalesce(un.get(t), () => (0)))+1;return un.set(t,e),`${t}-${Date.now()}-${Fr}-${e}`}_chunkA5EIY3HIcjs.a.call(void 0, k,"nextRuntimeId");function _r(){return k("interceptor")}_chunkA5EIY3HIcjs.a.call(void 0, _r,"nextInterceptorRegistrationId");var H= (_class3 =class{static{_chunkA5EIY3HIcjs.a.call(void 0, this,"EventBusImpl")}__init5() {this.subscriptions=[]}__init6() {this.subscriptionsByIntent=new Map}__init7() {this.interceptors=[]}__init8() {this.interceptorsByIntent=new Map}constructor(e={}){;_class3.prototype.__init5.call(this);_class3.prototype.__init6.call(this);_class3.prototype.__init7.call(this);_class3.prototype.__init8.call(this);if(this.onPublish=e.onPublish,this.onSoftViolation=e.onSoftViolation,this.onHandlerError=e.onHandlerError,this.eventContracts=e.eventContracts,this.strictEventContracts=_nullishCoalesce(e.strictEventContracts, () => (!1)),this.requireKnownSource=_nullishCoalesce(e.requireKnownSource, () => (!1)),this.architectureProfile=e.architectureProfile,this.enforceObservedLayerFlowMode=_nullishCoalesce(e.enforceObservedLayerFlow, () => ("off")),this.rethrowHandlerErrors=_nullishCoalesce(e.rethrowHandlerErrors, () => (!1)),this.settleBufferOnLocalDelivery=_nullishCoalesce(e.settleBufferOnLocalDelivery, () => (!1)),this.intentRegistry=e.intentRegistry,this.dependencyGraph=e.dependencyGraph,this.strictRegistry=_nullishCoalesce(e.strictRegistry, () => (e.intentRegistry!==void 0)),this.validateIntentNaming=_nullishCoalesce(e.validateIntentNaming, () => (this.strictRegistry)),this.recording={history:[],trace:[],maxHistorySize:e.maxHistorySize,traceSinks:[..._nullishCoalesce(e.traceSinks, () => ([]))],auditTrail:e.auditTrail,eventBuffer:_nullishCoalesce(e.eventBuffer, () => (e.outbox)),instanceId:e.instanceId},e.policyEngine?this.policyEngine=e.policyEngine:e.policies&&e.policies.length>0&&(this.policyEngine=new N(e.policies)),(_nullishCoalesce(_nullishCoalesce(_optionalChain([this, 'access', _62 => _62.policyEngine, 'optionalAccess', _63 => _63.getPolicies, 'call', _64 => _64()]), () => (e.policies)), () => ([]))).some(Fe)&&!e.intentRegistry&&!e.dependencyGraph&&!e.getPolicyContext)throw new Y;e.getPolicyContext?this.getPolicyContext=e.getPolicyContext:e.intentRegistry||e.dependencyGraph?this.getPolicyContext=Be({intentRegistry:e.intentRegistry,dependencyGraph:e.dependencyGraph}):this.getPolicyContext=r=>({event:r})}async publish(e,n,r,o){await this.dispatch(e,n,r,o)}async dispatch(e,n,r,o={}){let i=o.notifySubscribers!==!1,s=o.awaitHandlers!==!1,l=o.runOnPublish!==!1,c,d=typeof e!="function";if(d){let u=e,w=_nullishCoalesce(_nullishCoalesce(r, () => (n)), () => ({}));c={...u,metadata:ze(u.metadata,w,this.recording.instanceId)}}else{let u=e,w=n,g=_nullishCoalesce(r, () => ({})),I=u(w);c={...I,metadata:ze(I.metadata,g,this.recording.instanceId)}}d&&this.strictRegistry&&await an(this.recording,c),Q(c.intent,{strictRegistry:this.strictRegistry,validateIntentNaming:this.validateIntentNaming,intentRegistry:this.intentRegistry}),$t(c,{requireKnownSource:this.requireKnownSource,intentRegistry:this.intentRegistry}),ee(c,{eventContracts:this.eventContracts,strictEventContracts:this.strictEventContracts}),c=await Mt(c,{interceptorsForIntent:_chunkA5EIY3HIcjs.a.call(void 0, u=>_nullishCoalesce(this.interceptorsByIntent.get(u), () => ([])),"interceptorsForIntent"),eventContracts:this.eventContracts,strictEventContracts:this.strictEventContracts,appendTrace:_chunkA5EIY3HIcjs.a.call(void 0, u=>this.appendTrace(u),"appendTrace"),recordAudit:_chunkA5EIY3HIcjs.a.call(void 0, (u,w,g)=>this.recordAudit(u,w,g),"recordAudit")}),ee(c,{eventContracts:this.eventContracts,strictEventContracts:this.strictEventContracts}),await on(c,{mode:this.enforceObservedLayerFlowMode,architectureProfile:this.architectureProfile,appendTrace:_chunkA5EIY3HIcjs.a.call(void 0, u=>this.appendTrace(u),"appendTrace"),recordAudit:_chunkA5EIY3HIcjs.a.call(void 0, (u,w,g)=>this.recordAudit(u,w,g),"recordAudit")}),_optionalChain([this, 'access', _65 => _65.dependencyGraph, 'optionalAccess', _66 => _66.registerEventFlow, 'call', _67 => _67(c.metadata.source,c.intent)]);let f=[..._nullishCoalesce(this.subscriptionsByIntent.get(c.intent), () => ([]))];this.policyEngine&&await sn(c,{policyEngine:this.policyEngine,getPolicyContext:this.getPolicyContext,appendTrace:_chunkA5EIY3HIcjs.a.call(void 0, u=>this.appendTrace(u),"appendTrace"),recordAudit:_chunkA5EIY3HIcjs.a.call(void 0, (u,w,g)=>this.recordAudit(u,w,g),"recordAudit"),onSoftViolation:this.onSoftViolation,safeHook:_chunkA5EIY3HIcjs.a.call(void 0, (u,w,g)=>this.safeHook(u,w,g),"safeHook")});let{bufferRecord:p}=await ln(this.recording,c,i?f.length:0,o.tx);p&&_optionalChain([o, 'access', _68 => _68.onBufferRecord, 'optionalCall', _69 => _69(p)]);let m=p!==void 0&&(_nullishCoalesce(o.settleBufferOnLocalDelivery, () => (this.settleBufferOnLocalDelivery))),h=(async()=>{i&&await Promise.all(f.map(u=>this.invokeHandler(u,c))),l&&this.onPublish&&await this.safeHook(()=>this.onPublish(c),"onPublish",c)})(),y=m?h.then(()=>this.settleBufferRecord(c,p.id,{ok:!0}),async u=>{throw await this.settleBufferRecord(c,p.id,{ok:!1,error:u}),u}):h;return s?await y:y.then(void 0,()=>{}),c}async settleBufferRecord(e,n,r){await cn(this.recording,e,n,r)}async recordHandoffFailure(e,n,r){await dn(this.recording,e,n,r)}createPublisher(e){let n=typeof e=="string"?e:e.name;return Q(n,{strictRegistry:this.strictRegistry,validateIntentNaming:this.validateIntentNaming,intentRegistry:this.intentRegistry}),{source:n,publish:_chunkA5EIY3HIcjs.a.call(void 0, async(r,o,i={},s)=>{if(i.source&&i.source!==n)throw new x(n,i.source);await this.publish(r,o,{...i,source:n},s)},"publish")}}subscribe(e,n){let r=typeof e=="string"?e:e.name;Q(r,{strictRegistry:this.strictRegistry,validateIntentNaming:this.validateIntentNaming,intentRegistry:this.intentRegistry});let o={intentName:r,handler:n};this.subscriptions.push(o);let i=_nullishCoalesce(this.subscriptionsByIntent.get(r), () => ([]));return i.push(o),this.subscriptionsByIntent.set(r,i),()=>{let s=this.subscriptions.indexOf(o);s>=0&&this.subscriptions.splice(s,1);let l=this.subscriptionsByIntent.get(r);if(!l)return;let c=l.indexOf(o);c>=0&&l.splice(c,1),l.length===0&&this.subscriptionsByIntent.delete(r)}}registerInterceptor(e,n,r){let o=typeof e=="string"?e:e.name;Q(o,{strictRegistry:this.strictRegistry,validateIntentNaming:this.validateIntentNaming,intentRegistry:this.intentRegistry});let i={registrationId:_r(),interceptorId:_nullishCoalesce(r, () => (o)),intentName:o,interceptor:n,createdAt:new Date().toISOString()};this.interceptors.push(i);let s=_nullishCoalesce(this.interceptorsByIntent.get(o), () => ([]));return s.push(i),this.interceptorsByIntent.set(o,s),i.registrationId}unregisterInterceptor(e){let n=this.interceptors.find(i=>i.registrationId===e);if(!n)return!1;let r=this.interceptors.indexOf(n);r>=0&&this.interceptors.splice(r,1);let o=this.interceptorsByIntent.get(n.intentName);if(o){let i=o.indexOf(n);i>=0&&o.splice(i,1),o.length===0&&this.interceptorsByIntent.delete(n.intentName)}return!0}listInterceptors(e){return this.interceptors.filter(n=>!e||n.intentName===e).map(n=>({registrationId:n.registrationId,interceptorId:n.interceptorId,intent:n.intentName,createdAt:n.createdAt,lastInterceptedAt:n.lastInterceptedAt}))}getHistory(){return[...this.recording.history]}clearHistory(){this.recording.history.length=0}getTrace(){return[...this.recording.trace]}clearTrace(){this.recording.trace.length=0}appendTrace(e){L(this.recording,e)}async recordAudit(e,n,r){await re(this.recording,e,n,r)}async invokeHandler(e,n){try{await Promise.resolve(e.handler(n))}catch(r){if(this.appendTrace({type:"handler.error",timestamp:new Date().toISOString(),intent:n.intent,correlationId:n.metadata.correlationId,traceId:n.metadata.traceId,spanId:n.metadata.spanId,details:{error:r instanceof Error?r.message:String(r)}}),await this.recordAudit("handler.error",n,{handlerIntent:e.intentName,error:r instanceof Error?r.message:String(r)}),this.onHandlerError&&await this.safeHook(()=>this.onHandlerError(r,n,e.intentName),"onHandlerError",n),this.rethrowHandlerErrors)throw r}}async safeHook(e,n,r){try{await Promise.resolve(e())}catch(o){this.appendTrace({type:"hook.error",timestamp:new Date().toISOString(),intent:r.intent,correlationId:r.metadata.correlationId,traceId:r.metadata.traceId,spanId:r.metadata.spanId,details:{hook:n,error:o instanceof Error?o.message:String(o)}}),await this.recordAudit("hook.error",r,{hook:n,error:o instanceof Error?o.message:String(o)})}}}, _class3);function Br(t){return new H(t)}_chunkA5EIY3HIcjs.a.call(void 0, Br,"createEventBus");function jr(t){if(!(!t||t.length===0))return t.map(e=>typeof e=="object"&&e!==null&&"key"in e?String(e.key):String(e)).join(".")}_chunkA5EIY3HIcjs.a.call(void 0, jr,"formatStandardSchemaPath");function Gr(t){if(Array.isArray(t))return"array";if(t===null)return"object";let e=typeof t;return e==="string"||e==="number"||e==="boolean"||e==="object"?e:"unknown"}_chunkA5EIY3HIcjs.a.call(void 0, Gr,"actualType");function Hr(t,e){return t?`${t}.${e}`:e}_chunkA5EIY3HIcjs.a.call(void 0, Hr,"formatPath");function fn(t,e,n,r,o){let i=Gr(t);if(e.type!=="unknown"&&i!==e.type){o.push({intent:r.intent,version:r.version,field:n,message:`Expected ${e.type}, received ${i}.`});return}if(e.enum&&!e.enum.some(s=>Object.is(s,t))&&o.push({intent:r.intent,version:r.version,field:n,message:"Value is not allowed by event contract enum."}),e.type==="object"&&e.fields){if(t===null||typeof t!="object"||Array.isArray(t)){o.push({intent:r.intent,version:r.version,field:n,message:"Nested object field must be a non-array object."});return}pn(t,e.fields,r,o,n)}e.type==="array"&&e.items&&Array.isArray(t)&&t.forEach((s,l)=>{fn(s,e.items,`${n}[${l}]`,r,o)})}_chunkA5EIY3HIcjs.a.call(void 0, fn,"validateSchemaField");function pn(t,e,n,r,o){for(let[i,s]of Object.entries(e)){let l=Hr(o,i),c=t[i];if(c===void 0){s.required&&r.push({intent:n.intent,version:n.version,field:l,message:"Required field is missing."});continue}fn(c,s,l,n,r)}}_chunkA5EIY3HIcjs.a.call(void 0, pn,"validateObjectSchema");var ge= (_class4 =class{constructor() { _class4.prototype.__init9.call(this); }static{_chunkA5EIY3HIcjs.a.call(void 0, this,"EventContractRegistryImpl")}__init9() {this.contracts=new Map}register(e){let n=this.key(e.intent,e.version);if(this.contracts.has(n))throw new Error(`Event contract "${n}" is already registered.`);this.contracts.set(n,{allowAdditionalFields:!0,...e})}get(e,n){return n?this.contracts.get(this.key(e,n)):this.list(e).at(-1)}list(e){return Array.from(this.contracts.values()).filter(n=>!e||n.intent===e)}validate(e){let n=e.metadata.eventVersion,r=this.get(e.intent,n),o=[];if(!r)return{ok:!1,issues:[{intent:e.intent,version:n,message:n?`No event contract registered for version "${n}".`:"No event contract registered for intent."}]};r.deprecated&&o.push({intent:e.intent,version:r.version,message:typeof r.deprecated=="string"?r.deprecated:"Event contract is deprecated."});let i=e.payload!=null&&typeof e.payload=="object"?e.payload:void 0;if(r.schema){if(!i)o.push({intent:e.intent,version:r.version,message:"Payload must be an object for schema validation."});else if(pn(i,r.schema,r,o),r.allowAdditionalFields===!1)for(let s of Object.keys(i))r.schema[s]||o.push({intent:e.intent,version:r.version,field:s,message:"Additional field is not allowed by event contract."})}if(r.standardSchema){let s=r.standardSchema["~standard"].validate(e.payload);if(s instanceof Promise)o.push({intent:e.intent,version:r.version,message:"Standard Schema validator returned a Promise; event contract validation is synchronous."});else if(s.issues)for(let l of s.issues)o.push({intent:e.intent,version:r.version,field:jr(l.path),message:l.message})}return{ok:o.length===0,contract:r,issues:o}}clear(){this.contracts.clear()}key(e,n){return`${e}@${n}`}}, _class4);function Je(){return new ge}_chunkA5EIY3HIcjs.a.call(void 0, Je,"createEventContractRegistry");function Kr(){return k("outbox")}_chunkA5EIY3HIcjs.a.call(void 0, Kr,"nextOutboxId");function gn(t){return{...t,event:{...t.event,metadata:{...t.event.metadata}}}}_chunkA5EIY3HIcjs.a.call(void 0, gn,"cloneRecord");var Vr=1e4,K= exports.U = (_class5 =class{static{_chunkA5EIY3HIcjs.a.call(void 0, this,"InMemoryEventBuffer")}__init10() {this.records=new Map}__init11() {this.evictedPendingIds=new Set}__init12() {this.evictedPendingCount=0}constructor(e={}){;_class5.prototype.__init10.call(this);_class5.prototype.__init11.call(this);_class5.prototype.__init12.call(this);let n=e.maxRecords;this.maxRecords=typeof n=="number"&&!Number.isNaN(n)&&n>=0?n:1/0}get evictedPending(){return this.evictedPendingCount}trackEvictedPending(e){for(this.evictedPendingCount+=1,this.evictedPendingIds.add(e);this.evictedPendingIds.size>Vr;){let n=this.evictedPendingIds.values().next().value;this.evictedPendingIds.delete(n)}}settleEvicted(e){this.evictedPendingIds.delete(e)&&(this.evictedPendingCount-=1)}evictOverflow(){for(;this.records.size>this.maxRecords;){let e;for(let[n,r]of this.records)if(r.status!=="pending"){e=n;break}e===void 0&&(e=this.records.keys().next().value,this.trackEvictedPending(e)),this.records.delete(e)}}async enqueue(e){let n=new Date().toISOString(),r={id:Kr(),event:e,status:"pending",attempts:0,createdAt:n,updatedAt:n};this.records.set(r.id,r);let o=gn(r);return this.evictOverflow(),o}async markDispatched(e){let n=this.records.get(e);if(!n){this.settleEvicted(e);return}n.status="dispatched",n.updatedAt=new Date().toISOString()}async markFailed(e,n){let r=this.records.get(e);if(!r){this.settleEvicted(e);return}r.status="failed",r.attempts+=1,r.error=n instanceof Error?n.message:String(n),r.updatedAt=new Date().toISOString()}async list(e){return Array.from(this.records.values()).filter(n=>!e||n.status===e).map(gn)}async clear(){this.records.clear(),this.evictedPendingIds.clear()}}, _class5),Wr= exports.V =K;function Ye(t){return`${t.from}->${t.to}`}_chunkA5EIY3HIcjs.a.call(void 0, Ye,"flowKey");function mn(t){let e=new Set,n=[];for(let r of t){let o=Ye(r);e.has(o)||(e.add(o),n.push(r))}return n}_chunkA5EIY3HIcjs.a.call(void 0, mn,"uniqueFlows");function hn(t,e){let n=new Set(e.map(Ye));return t.filter(r=>!n.has(Ye(r)))}_chunkA5EIY3HIcjs.a.call(void 0, hn,"difference");function Xe(t){let e=t.registry,n=t.eventBus,r=t.graph;return{report(){let o=e?e.getAllRelationships().filter(u=>u.kind==="produces").map(u=>({from:u.from,to:u.to})):[],i=o.length>0||!r?[]:r.getEdges().filter(u=>u.kind==="produces").map(u=>({from:u.from,to:u.to})),s=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _70 => _70.getHistory, 'call', _71 => _71(), 'access', _72 => _72.map, 'call', _73 => _73(u=>({from:u.event.metadata.source,to:u.event.intent}))]), () => ([])),l=s.length>0||!r?[]:r.getEdges().filter(u=>u.kind==="observed").map(u=>({from:u.from,to:u.to})),c=mn([...o,...i]),d=mn([...s,...l]),f=d.filter(u=>!u.from||u.from==="unknown"),p=e?Array.from(new Set(d.map(u=>u.from).filter(u=>u&&u!=="unknown"&&!e.has(u)))):[],m=e?Array.from(new Set(d.map(u=>u.to).filter(u=>!e.has(u)))):[],h=new Set(d.flatMap(u=>[u.from,u.to])),y=e?e.list().map(u=>u.name).filter(u=>!h.has(u)):[];return{generatedAt:new Date().toISOString(),declaredProductions:c,observedProductions:d,declaredButUnobserved:hn(c,d),observedButUndeclared:hn(d.filter(u=>u.from!=="unknown"),c),unknownSources:f,unregisteredObservedSources:p,unregisteredObservedIntents:m,registeredButNeverObserved:y}}}}_chunkA5EIY3HIcjs.a.call(void 0, Xe,"createObservabilityReporter");function Ur(){return k("audit")}_chunkA5EIY3HIcjs.a.call(void 0, Ur,"createAuditId");function qr(t,e){return!(e.type&&t.type!==e.type||e.intent&&t.intent!==e.intent||e.correlationId&&t.correlationId!==e.correlationId||e.subject&&t.subject!==e.subject||e.since&&t.timestamp<e.since||e.until&&t.timestamp>e.until)}_chunkA5EIY3HIcjs.a.call(void 0, qr,"matchesQuery");var me= (_class6 =class{constructor(e){;_class6.prototype.__init13.call(this);this.maxRecords=e}static{_chunkA5EIY3HIcjs.a.call(void 0, this,"InMemoryAuditStore")}__init13() {this.records=[]}append(e){this.records.push(e),this.maxRecords!==void 0&&this.records.length>this.maxRecords&&this.records.splice(0,this.records.length-this.maxRecords)}query(e={}){let n=this.records.filter(r=>qr(r,e));return e.limit===void 0?[...n]:n.slice(-e.limit)}clear(){this.records.length=0}}, _class6),he=class{constructor(e){this.store=e}static{_chunkA5EIY3HIcjs.a.call(void 0, this,"AuditTrailImpl")}async record(e){let n={id:Ur(),timestamp:_nullishCoalesce(e.timestamp, () => (new Date().toISOString())),type:e.type,source:e.source,actor:e.actor,intent:e.intent,correlationId:e.correlationId,causationId:e.causationId,subject:e.subject,details:e.details};return await this.store.append(n),n}async query(e){return this.store.query(e)}async clear(){await this.store.clear()}};function Ze(t={}){return new he(_nullishCoalesce(t.store, () => (new me(t.maxRecords))))}_chunkA5EIY3HIcjs.a.call(void 0, Ze,"createAuditTrail");var ye= (_class7 =class{constructor() { _class7.prototype.__init14.call(this);_class7.prototype.__init15.call(this); }static{_chunkA5EIY3HIcjs.a.call(void 0, this,"DependencyGraphImpl")}__init14() {this.nodes=new Map}__init15() {this.edges=[]}registerDependency(e,n,r="declared"){this.ensureNode(e),this.ensureNode(n),this.addEdge({from:e,to:n,kind:r})}registerEventFlow(e,n){this.ensureNode(e),this.ensureNode(n),this.addEdge({from:e,to:n,kind:"observed"})}getNodes(){return Array.from(this.nodes.values())}getEdges(){return[...this.edges]}toJSON(){return{nodes:this.getNodes(),edges:this.getEdges()}}toMermaid(){let e=`flowchart TD
4
+ `;for(let r of this.edges){let o=r.kind?`|${r.kind}|`:"";e+=` ${this.safeId(r.from)} -->${o} ${this.safeId(r.to)}
5
+ `}let n=new Set(this.edges.flatMap(r=>[r.from,r.to]));for(let r of this.nodes.keys())n.has(r)||(e+=` ${this.safeId(r)}
6
+ `);return e.trim()}toLayerMermaid(e){let n=new Map;for(let i of this.nodes.keys()){let s=_nullishCoalesce(e.resolveLayer(i), () => ("Unclassified")),l=_nullishCoalesce(n.get(s), () => ([]));l.push(i),n.set(s,l)}let r=`flowchart TD
7
+ `;for(let i of e.layers){let s=_nullishCoalesce(n.get(i.name), () => ([]));if(s.length!==0){r+=` subgraph ${this.safeId(i.name)}[${i.name}]
8
+ `;for(let l of s)r+=` ${this.safeId(l)}[${l}]
9
+ `;r+=` end
10
+ `}}let o=_nullishCoalesce(n.get("Unclassified"), () => ([]));if(o.length>0){r+=` subgraph Unclassified[Unclassified]
11
+ `;for(let i of o)r+=` ${this.safeId(i)}[${i}]
12
+ `;r+=` end
13
+ `}for(let i of this.edges){let s=i.kind?`|${i.kind}|`:"";r+=` ${this.safeId(i.from)} -->${s} ${this.safeId(i.to)}
14
+ `}return r.trim()}detectViolations(e=[]){let n=[],r=this.findSimpleCycles();r.length>0&&n.push(`Cycle detected: ${r.map(o=>o.join("->")).join(", ")}`);for(let o of e)try{let i=o(this.edges);i&&i.length&&n.push(...i)}catch(i){n.push(`Rule error: ${i.message}`)}return n}ensureNode(e){this.nodes.has(e)||this.nodes.set(e,{id:e})}addEdge(e){this.edges.some(r=>r.from===e.from&&r.to===e.to&&r.kind===e.kind)||this.edges.push(e)}findSimpleCycles(){let e=new Map;for(let l of this.edges)e.has(l.from)||e.set(l.from,[]),e.get(l.from).push(l.to);let n=[],r=new Set,o=[],i=_chunkA5EIY3HIcjs.a.call(void 0, l=>{r.add(l),o.push(l);for(let c of e.get(l)||[])if(!r.has(c))i(c);else if(o.includes(c)){let d=o.indexOf(c),f=o.slice(d).concat(c);n.push(f)}o.pop()},"dfs");for(let l of e.keys())r.has(l)||i(l);let s=new Set(n.map(l=>l.join("->")));return Array.from(s).map(l=>l.split("->"))}safeId(e){return e.replace(/[^a-zA-Z0-9_]/g,"_")}}, _class7);function Qe(){return new ye}_chunkA5EIY3HIcjs.a.call(void 0, Qe,"createDependencyGraph");function et(t,e,n={}){let r=_nullishCoalesce(n.requireRegisteredTargets, () => (!1));for(let o of t.getAllRelationships())r&&!t.has(o.to)||(o.kind==="dependsOn"?e.registerDependency(o.from,o.to,"declared"):e.registerDependency(o.from,o.to,"produces"))}_chunkA5EIY3HIcjs.a.call(void 0, et,"syncRegistryToGraph");var O={type:"array",items:{type:"string",minLength:1},uniqueItems:!0},yn={type:"object",additionalProperties:!1,properties:{mode:{type:"string",enum:["advisory","enforced"],default:"advisory"},compositionRoots:{...O,default:[]},kernelRoots:{...O},managedLayers:{...O,default:[]},requireDeclarations:{type:"boolean",default:!0},ignoreDirectNewForErrors:{type:"boolean",default:!0}}},wn={type:"object",additionalProperties:!1,properties:{mode:{type:"string",enum:["advisory","enforced"],default:"advisory"},planeRoots:{...O,default:[]},managedLayers:{...O,default:[]},maxXiKeys:{type:"integer",minimum:1,default:7},xiKeys:{...O,default:[]},appliesTo:{...O,default:[]}}};function oe(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}_chunkA5EIY3HIcjs.a.call(void 0, oe,"isObject");function Sn(t){let e=new Set;if(!Array.isArray(t.layers))return e;for(let n of t.layers)oe(n)&&typeof n.name=="string"&&n.name.length>0&&e.add(n.name);return e}_chunkA5EIY3HIcjs.a.call(void 0, Sn,"declaredLayerNames");function In(t){if(!oe(t))return t;let e={mode:t.mode===void 0?"advisory":t.mode,compositionRoots:t.compositionRoots===void 0?[]:t.compositionRoots,managedLayers:t.managedLayers===void 0?[]:t.managedLayers,requireDeclarations:t.requireDeclarations===void 0?!0:t.requireDeclarations};return t.kernelRoots!==void 0&&(e.kernelRoots=t.kernelRoots),t.ignoreDirectNewForErrors!==void 0&&(e.ignoreDirectNewForErrors=t.ignoreDirectNewForErrors),{...t,...e}}_chunkA5EIY3HIcjs.a.call(void 0, In,"defaultedArkRun");function vn(t){if(!oe(t))return t;let e=typeof t.maxXiKeys=="number"&&t.maxXiKeys>0?t.maxXiKeys:7;return{...t,mode:t.mode===void 0?"advisory":t.mode,planeRoots:t.planeRoots===void 0?[]:t.planeRoots,managedLayers:t.managedLayers===void 0?[]:t.managedLayers,maxXiKeys:e,xiKeys:t.xiKeys===void 0?[]:t.xiKeys}}_chunkA5EIY3HIcjs.a.call(void 0, vn,"defaultedArkOrder");function bn(t,e){let n=t.arkRun;if(n===void 0||!oe(n))return;let r=Sn(t),o=n.managedLayers;if(Array.isArray(o)&&o.forEach((i,s)=>{typeof i=="string"&&i.length>0&&!r.has(i)&&e.push({path:`$.arkRun.managedLayers[${s}]`,message:`layer ${JSON.stringify(i)} is not declared in layers[]`})}),n.mode==="enforced"){let i=_nullishCoalesce(n.kernelRoots, () => (n.compositionRoots));(!Array.isArray(i)||i.length===0)&&e.push({path:n.kernelRoots!==void 0?"$.arkRun.kernelRoots":"$.arkRun.compositionRoots",message:"ARKRUN_MISSING_ROOT: enforced mode requires at least one kernel root"}),(!Array.isArray(o)||o.length===0)&&e.push({path:"$.arkRun.managedLayers",message:"enforced mode requires at least one managed layer"})}}_chunkA5EIY3HIcjs.a.call(void 0, bn,"validateArkRunExtra");function An(t,e){let n=t.arkOrder;if(n===void 0||!oe(n))return;let r=Sn(t),o=n.managedLayers;if(Array.isArray(o)&&o.forEach((i,s)=>{typeof i=="string"&&i.length>0&&!r.has(i)&&e.push({path:`$.arkOrder.managedLayers[${s}]`,message:`layer ${JSON.stringify(i)} is not declared in layers[]`})}),n.mode==="enforced"){let i=n.planeRoots;(!Array.isArray(i)||i.length===0)&&e.push({path:"$.arkOrder.planeRoots",message:"ARKORDER_MISSING_PLANE: enforced mode requires at least one plane root"}),(!Array.isArray(o)||o.length===0)&&e.push({path:"$.arkOrder.managedLayers",message:"enforced mode requires at least one managed layer"})}}_chunkA5EIY3HIcjs.a.call(void 0, An,"validateArkOrderExtra");var Se={type:"array",items:{type:"string",minLength:1},uniqueItems:!0},xn={description:'deny blocks every shared-root import of a slice. deny-cross-parent leaves that hop as a warning and, in ark-check and CI only, reports a slice that reaches another universe through a shared root. The write hook and ESLint see one edge and do not block it. The object form { mode: "deny-cross-parent", stopAt } names composition roots (bootstrap, DI registrations) the whole-graph walk never starts at or passes through; a stop file must still sit under sharedRoots, and stopAt does not silence the direct SHARED_IMPORTS_SLICE warning. arkgate 4.8.22 and older reject deny-cross-parent. arkgate 4.8.23 and older reject the object form (must be one of deny, deny-cross-parent).',oneOf:[{type:"string",enum:["deny","deny-cross-parent"]},{type:"object",additionalProperties:!1,required:["mode","stopAt"],properties:{mode:{type:"string",enum:["deny-cross-parent"]},stopAt:{...Se,minItems:1}}}]},Ln={type:"object",additionalProperties:!1,required:["sliceFolders"],description:`Optional inner wall under this rule. Runs only on a rule with peerIsolation: true and allowed: false; elsewhere it is inert and ark-check warns CONFIG_CHILD_SLICES_INERT (config load still accepts it, as 4.8.23 did). Absent keeps today's universe wall. sliceFolders names children. Flat files are universe common, and so is a commonFolders directory directly under the universe (a folder of that name inside a child belongs to that child). siblings is "deny" (default), "advisory", or { default, enforce, ratchet }. parentMayImportChild defaults to false. message is the text for inner-wall findings. allowedCrossSlice may use a whole-segment *. It clears only a sibling crossing. Cross-parent has no advisory knob. arkgate 4.8.22 and older reject this key. A build that still rejects unknown childSlices fields rejects allowedCrossSlice at config load. A build that still types siblings as a string enum rejects the object at config load.`,properties:{sliceFolders:{...Se,minItems:1},sliceIdentity:{type:"string",enum:["path","stars"]},commonFolders:{...Se,minItems:1},siblings:{description:'"deny" or "advisory", or { default, enforce, ratchet } so listed subtrees are errors while the default stays advisory. ratchet absent: a new advisory crossing fails only when the baseline in use already records an advisory crossing of this rule. ratchet true: any unrecorded advisory crossing fails when a baseline is in use. ratchet false: measure only, never fails. A string-enum build rejects the object at config load (must be one of deny, advisory). arkgate 4.8.23 and older reject ratchet (unknown field).',oneOf:[{type:"string",enum:["deny","advisory"]},{type:"object",additionalProperties:!1,required:["default"],properties:{default:{type:"string",enum:["deny","advisory"]},enforce:{...Se},ratchet:{type:"boolean"}}}]},parentMayImportChild:{type:"boolean"},message:{type:"string",minLength:1,description:"Text for inner-wall findings (CROSS_SIBLING_SLICE and universe common importing a child). The rule message stays the universe-wall text (CROSS_PARENT_SLICE and fail-closed denies). Absent: ArkGate default text, never the rule message. arkgate 4.8.23 and older reject this field (unknown field)."},sliceAliases:{type:"array",minItems:1,description:"Maps a source path glob onto a child slice id (universe id plus one child segment) so files outside the slice trees take that universe and child for both walls. A path without a wildcard also covers everything under it, as sharedRoots does. A bare name, a universe id alone, a target outside every universe shape, and a wildcard in to are rejected. Under stars identity a target written against the 4.8.23 stars id (star bindings before the last literal dropped, e.g. api/v1/x for modules/*/api/*) still loads when it maps to one universe shape, and ark-check warns CONFIG_SLICE_LEGACY_STARS_ID with the new id; it is rejected only when it maps to more than one shape. Config load checks only the shape; doctor reports a target universe no file belongs to. The glob may not overlap a slice folder, and two aliases may not match the same file. Doctor lists each alias as an owed move. A build that rejects unknown childSlices fields fails at config load (unknown field). arkgate 4.8.22 and older reject childSlices.",items:{type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1}}}},allowedCrossSlice:{type:"array",minItems:1,description:"Directed child-slice allowances. * matches one whole path segment (features/projects/*). ** and a partial segment are rejected. A bare name is rejected. This list clears only CROSS_SIBLING_SLICE. It cannot clear CROSS_PARENT_SLICE or CROSS_PARENT_VIA_SHARED. The universe allowedCrossSlice still treats * as a literal. A build that rejects unknown childSlices fields fails at config load (unknown field).",items:{type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1}}}}}};function b(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}_chunkA5EIY3HIcjs.a.call(void 0, b,"isObject");function Ie(t,e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`}_chunkA5EIY3HIcjs.a.call(void 0, Ie,"propertyPath");function C(t){let e=t.length;for(;e>0&&t[e-1]==="/";)e-=1;return t.slice(0,e)}_chunkA5EIY3HIcjs.a.call(void 0, C,"trimTrailingSlashes");function On(t,e){Zr(t,e),eo(t,e),oo(t,e),So(t,e)}_chunkA5EIY3HIcjs.a.call(void 0, On,"validateSliceContract");var kn='must be "deny", "deny-cross-parent", or { "mode": "deny-cross-parent", "stopAt": ["<composition root path or glob>"] }',En="must not cover the whole tree. Name the composition root itself (bootstrap file, DI registrations folder).";function zr(t){return t==="*"||t==="**"}_chunkA5EIY3HIcjs.a.call(void 0, zr,"isWildcardSegment");function $n(t){let e=t.toLowerCase().split("/").filter(o=>o.length>0&&o!==".");(e[0]==="src"||e[0]==="app")&&(e=e.slice(1));let n=e.length;for(;n>0&&zr(_nullishCoalesce(e[n-1], () => ("")));)n-=1;let r=e.slice(0,n);return r.some(o=>o.includes("*"))?null:r}_chunkA5EIY3HIcjs.a.call(void 0, $n,"coveredFolder");function Jr(t,e){return t.length<=e.length&&t.every((n,r)=>e[r]===n)}_chunkA5EIY3HIcjs.a.call(void 0, Jr,"isPrefixOf");function Yr(t,e){let n=t.layers;if(!Array.isArray(n))return[];let r=new Set([e.from,e.to].filter(i=>typeof i=="string")),o=[];for(let i of n){if(!b(i)||typeof i.name!="string"||!r.has(i.name))continue;let s=Array.isArray(i.patterns)?i.patterns:[];for(let l of s){if(typeof l!="string")continue;let c=l.replace(/\\/g,"/").split("/"),d=c.findIndex(m=>m.includes("*")),f=d===-1?c:c.slice(0,d),p=$n(f.join("/"));p&&o.push(p)}}return o}_chunkA5EIY3HIcjs.a.call(void 0, Yr,"ruleLayerFolders");function Xr(t,e){let n=C(t.trim().replace(/\\/g,"/"));if(n.length===0)return"must be a non-empty path or glob";let r=n.replace(/^[./]+/,"");if(r===""||r==="*"||r==="**")return En;for(let i of n.split("/"))if(i.length===0||i==="."||i==="..")return"must be a path or glob without empty, . or .. segments";let o=$n(n);return o===null?null:o.length===0?En:e.some(i=>Jr(o,i))?"must not cover a whole layer root of this rule. Name the composition root itself (bootstrap file, DI registrations folder).":null}_chunkA5EIY3HIcjs.a.call(void 0, Xr,"stopAtEntryIssue");function Zr(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!b(r)||r.sharedImportsSlice===void 0)return;let i=r.sharedImportsSlice,s=`$.rules[${o}].sharedImportsSlice`;if(typeof i=="string"){i!=="deny"&&i!=="deny-cross-parent"&&e.push({path:s,message:kn});return}if(!b(i)){e.push({path:s,message:kn});return}for(let f of Object.keys(i))f!=="mode"&&f!=="stopAt"&&e.push({path:Ie(s,f),message:"unknown field"});i.mode===void 0?e.push({path:`${s}.mode`,message:"is required"}):i.mode!=="deny-cross-parent"&&e.push({path:`${s}.mode`,message:'must be deny-cross-parent. stopAt has no meaning for deny; use the string "deny".'});let l=i.stopAt;if(l===void 0){e.push({path:`${s}.stopAt`,message:"is required"});return}if(!Array.isArray(l)||l.length===0){e.push({path:`${s}.stopAt`,message:"must be a non-empty array of paths or globs"});return}let c=new Set,d=Yr(t,r);l.forEach((f,p)=>{let m=`${s}.stopAt[${p}]`;if(typeof f!="string"){e.push({path:m,message:"must be a non-empty path or glob"});return}let h=Xr(f,d);if(h){e.push({path:m,message:h});return}let y=C(f.trim().replace(/\\/g,"/")).toLowerCase();if(c.has(y)){e.push({path:m,message:"duplicate stopAt entry"});return}c.add(y)})})}_chunkA5EIY3HIcjs.a.call(void 0, Zr,"validateSharedImportsSlice");var Qr=["deny","advisory"],Rn='must be "deny", "advisory", or { "default": "deny" | "advisory", "enforce": ["<child id or subtree path>"], "ratchet": true | false }';function eo(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!b(r))return;let i=r.childSlices;if(!b(i)||i.siblings===void 0)return;let s=i.siblings,l=`$.rules[${o}].childSlices.siblings`;if(typeof s=="string"){Qr.includes(s)||e.push({path:l,message:Rn});return}if(!b(s)){e.push({path:l,message:Rn});return}for(let d of Object.keys(s))d!=="default"&&d!=="enforce"&&d!=="ratchet"&&e.push({path:Ie(l,d),message:"unknown field"});if(s.ratchet!==void 0&&typeof s.ratchet!="boolean"&&e.push({path:`${l}.ratchet`,message:"must be a boolean"}),s.default===void 0?e.push({path:`${l}.default`,message:"is required"}):s.default!=="deny"&&s.default!=="advisory"&&e.push({path:`${l}.default`,message:"must be deny or advisory"}),s.enforce===void 0)return;if(!Array.isArray(s.enforce)){e.push({path:`${l}.enforce`,message:"must be an array of child slice ids or subtree paths"});return}let c=new Set;s.enforce.forEach((d,f)=>{let p=`${l}.enforce[${f}]`;if(typeof d!="string"||d.trim().length===0){e.push({path:p,message:"must be a non-empty child slice id or subtree path"});return}let m=C(d.trim().replace(/\\/g,"/"));if(m.split("/").some(h=>h.length===0||h==="."||h==="..")){e.push({path:p,message:"must be a child slice id or subtree path without . or .."});return}if(m.includes("*")){e.push({path:p,message:"must be a child slice id or subtree path. * is not a wildcard on siblings.enforce"});return}if(c.has(m)){e.push({path:p,message:"duplicate enforce entry"});return}c.add(m)})})}_chunkA5EIY3HIcjs.a.call(void 0, eo,"validateChildSliceSiblings");var to="must be a slice id with a slash. A bare name is ambiguous across universes.",no="* matches one whole path segment. ** and a partial segment are not wildcards.";function ro(t){let e=C(t.trim().replace(/\\/g,"/"));if(e.length===0)return"must be a non-empty slice id";if(!e.includes("/"))return to;let n=e.split("/");for(let r of n){if(r.length===0||r==="."||r==="..")return"must be a slice id without empty, . or .. segments";if(r.includes("*")&&r!=="*")return no}return null}_chunkA5EIY3HIcjs.a.call(void 0, ro,"childCrossSlicePatternIssue");function Cn(t){return C(t.trim().replace(/\\/g,"/")).toLowerCase()}_chunkA5EIY3HIcjs.a.call(void 0, Cn,"childCrossSlicePatternKey");function oo(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!b(r))return;let i=r.childSlices;if(!b(i)||i.allowedCrossSlice===void 0)return;let s=i.allowedCrossSlice,l=`$.rules[${o}].childSlices.allowedCrossSlice`;if(!Array.isArray(s)){e.push({path:l,message:"must be an array of { from, to } child slice ids"});return}let c=new Set;s.forEach((d,f)=>{let p=`${l}[${f}]`;if(!b(d)){e.push({path:p,message:"must be an object with from and to"});return}for(let h of Object.keys(d))h!=="from"&&h!=="to"&&e.push({path:Ie(p,h),message:"unknown field"});for(let h of["from","to"]){let y=d[h],u=`${p}.${h}`;if(typeof y!="string"||y.trim().length===0){e.push({path:u,message:"must be a non-empty slice id"});continue}let w=ro(y);w&&e.push({path:u,message:w})}if(typeof d.from!="string"||typeof d.to!="string")return;let m=`${Cn(d.from)}\0${Cn(d.to)}`;if(!m.startsWith("\0")&&!m.endsWith("\0")){if(c.has(m)){e.push({path:p,message:"duplicate child slice allowance"});return}c.add(m)}})})}_chunkA5EIY3HIcjs.a.call(void 0, oo,"validateChildSliceAllowedCrossSlice");var V="must be a child of a universe shape this rule names (its universe sliceFolders shape plus one child segment). A bare name, a universe id alone, a target outside every universe shape, and a wildcard are rejected. Config load checks the shape only; doctor reports a target universe no file belongs to.",io="is a 4.8.23 stars id (star bindings before the last literal dropped) that maps to more than one universe shape of this rule. Write the new stars id, which keeps every star binding (e.g. orders/api/v1/x for modules/*/api/*).",so="overlaps a slice folder. An alias covers only files outside the slice trees.",ao="two slice aliases match the same file";function lo(t){return C(t.trim().replace(/\\/g,"/")).toLowerCase().split("/").filter(e=>e.length>0)}_chunkA5EIY3HIcjs.a.call(void 0, lo,"aliasPathSegments");function co(t){let e=t[t.length-1];return e===void 0||e.includes("*")?[...t]:[...t,"**"]}_chunkA5EIY3HIcjs.a.call(void 0, co,"aliasSegmentsWithSubtree");function Dn(t){let e=[];for(let n of t){if(n.includes("*"))break;e.push(n)}return e}_chunkA5EIY3HIcjs.a.call(void 0, Dn,"concreteGlobPrefix");function ie(t,e){if(t.length>e.length)return!1;for(let n=0;n<t.length;n+=1)if(t[n]!==e[n])return!1;return!0}_chunkA5EIY3HIcjs.a.call(void 0, ie,"segmentsArePrefix");function uo(t){let e=t.split(/[/\\]/).filter(Boolean).map(r=>r.toLowerCase());if(e.length<2||e[0]==="*"||e[0]==="**"||!e.some(r=>r==="*"))return null;let n=[];for(let r of e){if(r==="*"||r==="**")break;if(r.includes("*"))return null;n.push(r)}return n.length>0?n:null}_chunkA5EIY3HIcjs.a.call(void 0, uo,"anchoredSlicePrefix");function fo(t,e){let n=Dn(t),r=n.length<t.length,o=n[0]==="src"||n[0]==="app"?n.slice(1):n;return ie(e,n)||ie(e,o)?!0:r?ie(n,e)&&n.length<e.length||ie(n,["src",...e])&&n.length<e.length+1||ie(n,["app",...e])&&n.length<e.length+1:!1}_chunkA5EIY3HIcjs.a.call(void 0, fo,"globOverlapsAnchored");function po(t,e){for(let r=0;r<t.length;r+=1){if(t[r]!==e&&t[r]!=="*")continue;let o=t.slice(r+1);if(o.length>=2||o.some(i=>i==="*"||i==="**"))return!0}let n=Dn(t);return n.length<t.length&&(n.length===0||n.length===1&&(n[0]==="src"||n[0]==="app"))}_chunkA5EIY3HIcjs.a.call(void 0, po,"globOverlapsBare");function go(t,e){let n=e.split(/[/\\]/).filter(Boolean).map(o=>o.toLowerCase());if(n.length===1&&n[0]&&!n[0].includes("*"))return po(t,n[0]);let r=uo(e);return r?fo(t,r):!1}_chunkA5EIY3HIcjs.a.call(void 0, go,"globOverlapsSliceEntry");function mo(t){let e=C(t.trim().replace(/\\/g,"/"));if(e.length===0)return"must be a non-empty path glob";if(e==="*"||e==="**")return"must not cover the whole tree";for(let n of e.split("/")){if(n.length===0||n==="."||n==="..")return"must be a path glob without empty, . or .. segments";if(!(n==="*"||n==="**")&&(n.includes("*")||n.includes("?")||n.includes("{")||n.includes("[")))return"* matches one whole path segment. ** is a whole segment. A partial segment is not a wildcard."}return null}_chunkA5EIY3HIcjs.a.call(void 0, mo,"aliasGlobIssue");function ho(t,e){let n=[];if(!Array.isArray(t))return n;let r=e==="stars";for(let o of t){if(typeof o!="string"||o.length===0)continue;let i=o.split(/[/\\]/).filter(Boolean).map(s=>s.toLowerCase());if(i.length===1&&i[0]&&!i[0].includes("*")){n.push({literals:[i[0],null]});continue}if(!i.some(s=>s==="**"||s.includes("*")&&s!=="*")&&i.includes("*")){if(r){let s=-1;for(let d=0;d<i.length;d+=1)i[d]!=="*"&&(s=d);if(s<0)continue;let l=i.filter((d,f)=>f>=s||d==="*").map(d=>d==="*"?null:d),c=i.slice(s).map(d=>d==="*"?null:d);n.push(c.length===l.length?{literals:l}:{literals:l,legacy:c});continue}n.push({literals:i.map(s=>s==="*"?null:s)})}}return n}_chunkA5EIY3HIcjs.a.call(void 0, ho,"universeShapes");function we(t,e){return t.literals.length!==e.length?!1:t.literals.every((n,r)=>n===null||n===e[r])}_chunkA5EIY3HIcjs.a.call(void 0, we,"shapeMatches");function yo(t,e){let n=C(t.trim().replace(/\\/g,"/"));if(n.length===0||n.split("/").some(i=>i.length===0||i==="."||i==="..")||n.includes("*")||!n.includes("/"))return V;let r=n.split("/").map(i=>i.toLowerCase());if(e.length===0||e.some(i=>we(i,r)))return V;if(e.some(i=>we(i,r.slice(0,-1))))return null;let o=new Set(e.filter(i=>i.legacy!==void 0&&!we({literals:i.legacy},r)&&we({literals:i.legacy},r.slice(0,-1))).map(i=>i.literals.map(s=>_nullishCoalesce(s, () => ("*"))).join("/")));return o.size===1?null:o.size>1?io:V}_chunkA5EIY3HIcjs.a.call(void 0, yo,"aliasTargetIssue");function Pn(t){let e=t[0];return(e==="src"||e==="app")&&t.length>1?[t,t.slice(1)]:[t]}_chunkA5EIY3HIcjs.a.call(void 0, Pn,"aliasGlobVariants");function wo(t,e){let n=Pn(t),r=Pn(e);for(let o of n)if($(o,e,0,0,new Map))return!0;for(let o of r)if($(t,o,0,0,new Map))return!0;return!1}_chunkA5EIY3HIcjs.a.call(void 0, wo,"aliasesCanMatchSameFile");function $(t,e,n,r,o){let i=`${n}:${r}`,s=o.get(i);if(s!==void 0)return s;let l=!1;if(n===t.length&&r===e.length)l=!0;else if(n<t.length&&t[n]==="**")l=$(t,e,n+1,r,o)||r<e.length&&$(t,e,n,r+1,o);else if(r<e.length&&e[r]==="**")l=$(t,e,n,r+1,o)||n<t.length&&$(t,e,n+1,r,o);else if(n<t.length&&r<e.length){let c=t[n],d=e[r];(c===d||c==="*"||d==="*")&&(l=$(t,e,n+1,r+1,o))}return o.set(i,l),l}_chunkA5EIY3HIcjs.a.call(void 0, $,"globsCanMatchSame");function So(t,e){let n=t.rules;Array.isArray(n)&&n.forEach((r,o)=>{if(!b(r))return;let i=r.childSlices;if(!b(i)||i.sliceAliases===void 0)return;let s=i.sliceAliases,l=`$.rules[${o}].childSlices.sliceAliases`;if(!Array.isArray(s)){e.push({path:l,message:"must be an array of { from, to } slice aliases"});return}let c=ho(r.sliceFolders,r.sliceIdentity),d=[...Array.isArray(r.sliceFolders)?r.sliceFolders:[],...Array.isArray(i.sliceFolders)?i.sliceFolders:[]].filter(p=>typeof p=="string"&&p.length>0),f=[];s.forEach((p,m)=>{let h=`${l}[${m}]`;if(!b(p)){e.push({path:h,message:"must be an object with from and to"});return}for(let w of Object.keys(p))w!=="from"&&w!=="to"&&e.push({path:Ie(h,w),message:"unknown field"});let y=p.from,u=p.to;if(typeof y!="string"||y.trim().length===0)e.push({path:`${h}.from`,message:"must be a non-empty path glob"});else{let w=mo(y);if(w)e.push({path:`${h}.from`,message:w});else{let g=co(lo(y));d.some(I=>go(g,I))&&e.push({path:`${h}.from`,message:so});for(let I of f)if(wo(I,g)){e.push({path:h,message:ao});break}f.push(g)}}if(typeof u!="string"||u.trim().length===0)e.push({path:`${h}.to`,message:V});else{let w=yo(u,c);w&&e.push({path:`${h}.to`,message:w})}})})}_chunkA5EIY3HIcjs.a.call(void 0, So,"validateChildSliceAliases");function ve(t){if(typeof t!="string")return null;let e=t.trim().replace(/^@/,"").toLowerCase();return e.length>0?e:null}_chunkA5EIY3HIcjs.a.call(void 0, ve,"normalizeStewardId");function Mn(t){let e=ve(t);return!e||tt(e)||e.includes(" ")||e.includes("@")?!1:/^(?!-)[a-z0-9-]{1,39}(?<!-)$/.test(e)}_chunkA5EIY3HIcjs.a.call(void 0, Mn,"isGitHubHandle");function Io(t){if(typeof t!="string")return!1;let e=t.trim().toLowerCase();if(!e.includes("@")||e.includes(" ")||tt(e))return!1;let n=e.split("@");if(n.length!==2||!n[0]||/\s/.test(e))return!1;let r=n[1].lastIndexOf(".");return r>0&&r<n[1].length-1}_chunkA5EIY3HIcjs.a.call(void 0, Io,"isGitHubEmail");function vo(t){if(typeof t!="string")return null;let e=t.trim().match(/^(?:\d+\+)?([^@]+)@users\.noreply\.github\.com$/i);return e&&Mn(e[1])?ve(e[1]):null}_chunkA5EIY3HIcjs.a.call(void 0, vo,"githubHandleFromEmail");function Nn(t){let e=vo(t);if(e)return e;let n=ve(t);return!n||tt(n)?null:Mn(n)||Io(n)?n:null}_chunkA5EIY3HIcjs.a.call(void 0, Nn,"canonicalStewardId");var bo=/bot\b|\[bot\]|dependabot|renovate|github-actions|imgbot|codecov/i;function tt(t){let e=ve(t);return!e||bo.test(e)}_chunkA5EIY3HIcjs.a.call(void 0, tt,"isAutomationAuthor");var A="1.3",Ao=["public","auth","admin","internal"];function ko(t){return _optionalChain([t, 'optionalAccess', _74 => _74.optional])===!0||_optionalChain([t, 'optionalAccess', _75 => _75.reserved])===!0||_optionalChain([t, 'optionalAccess', _76 => _76.allowEmpty])===!0}_chunkA5EIY3HIcjs.a.call(void 0, ko,"isFutureHouseLayer");function Eo(t){let e=t&&typeof t=="object"?t.owners:void 0;if(!Array.isArray(e)||e.length===0)return;let n=e.filter(r=>typeof r=="string"&&r.length>0);return n.length>0?n:void 0}_chunkA5EIY3HIcjs.a.call(void 0, Eo,"layerOwnersList");function ma(t){return _optionalChain([t, 'optionalAccess', _77 => _77.requireLayerOwners])!==!0||!Array.isArray(t.layers)?[]:t.layers.filter(e=>!ko(e)&&!Eo(e)).map(e=>e.name)}_chunkA5EIY3HIcjs.a.call(void 0, ma,"layersMissingRequiredOwners");function ha(t){return`Add a GitHub handle or email to ${t}'s owners in ark.config.json (/ark-adopt).`}_chunkA5EIY3HIcjs.a.call(void 0, ha,"missingLayerOwnersNextAction");var Ae="https://unpkg.com/arkgate@4/schemas/ark.config.schema.json",Tn=["DomainModel","ApplicationOrchestration","PersistenceAdapters","IntegrationAdapters","WorkflowSagaEngine","BackgroundJobsScheduling","PresentationAdapters","ReportingReadModels","ExtensibilityMetadata","SecurityAuditObservability","Kernel"],Ro=new Set(["PresentationAdapters->ApplicationOrchestration","ApplicationOrchestration->DomainModel","WorkflowSagaEngine->ApplicationOrchestration","WorkflowSagaEngine->DomainModel","BackgroundJobsScheduling->ApplicationOrchestration"]);function Co(){let t=[];for(let e of Tn)for(let n of Tn)e===n||Ro.has(`${e}->${n}`)||t.push({from:e,to:n,allowed:!1});return t}_chunkA5EIY3HIcjs.a.call(void 0, Co,"createDefaultRules");var ke=Co(),nt=[{from:"unversioned",to:"1.0"},{from:"1.0",to:"1.1"},{from:"1.1",to:"1.2"},{from:"1.2",to:"1.3"}],v={type:"array",items:{type:"string",minLength:1},uniqueItems:!0},Fn={$schema:"https://json-schema.org/draft/2020-12/schema",$id:Ae,title:"ArkGate architecture contract",description:"Versioned contract consumed identically by ArkGate CLI, MCP, and ESLint surfaces.",type:"object",additionalProperties:!1,required:["$schema","schemaVersion","include","layers","rules"],properties:{$schema:{type:"string",minLength:1,default:Ae,description:"Editor-facing URL or local path for this JSON Schema."},schemaVersion:{type:"string",const:A,default:A},name:{type:"string",minLength:1},include:{...v,minItems:1,default:["src"]},exclude:{...v,default:[]},excludeGenerated:{type:"boolean",default:!0},frameworkOverlay:{type:"string",minLength:1},layers:{type:"array",default:[],items:{$ref:"#/$defs/layer"}},rules:{type:"array",default:ke,items:{$ref:"#/$defs/rule"}},cyclePolicy:{type:"string",enum:["strict","soft","framework-soft","off"],default:"strict"},dynamicImportAllowlist:{...v,default:[]},safety:{$ref:"#/$defs/safety",default:{maxTsSuppressions:0,maxAnyCasts:0,allowInMemory:!1,allowDisabledPeerIsolation:!1}},coverage:{$ref:"#/$defs/coverage"},arkRules:{type:"object",additionalProperties:{type:"string",minLength:1},default:{}},arkRun:{$ref:"#/$defs/arkRun"},arkOrder:{$ref:"#/$defs/arkOrder"},stewards:{...v,default:[]},requireLayerOwners:{type:"boolean"}},$defs:{layer:{type:"object",additionalProperties:!1,required:["name","patterns"],properties:{name:{type:"string",minLength:1},patterns:{...v,minItems:1},exclude:v,intentPrefixes:v,description:{type:"string",minLength:1},trustBoundary:{type:"string",enum:[...Ao]},owners:{...v,minItems:1},forbiddenGlobals:v,capabilities:{type:"object",additionalProperties:!1,properties:{deny:{type:"array",uniqueItems:!0,items:{type:"string",enum:["network","filesystem","clock","randomness","environment","process","persistence"]}}}},pure:{type:"boolean"},mayImportInfrastructure:{type:"boolean"},optional:{type:"boolean"},reserved:{type:"boolean"},allowEmpty:{type:"boolean"}}},rule:{type:"object",additionalProperties:!1,required:["from","to","allowed"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1},allowed:{type:"boolean"},message:{type:"string",minLength:1},peerIsolation:{type:"boolean"},sliceFolders:{...v,minItems:1},sliceIdentity:{type:"string",enum:["path","stars"],description:"How a starred sliceFolders prefix is named. Absent and path keep today's ids (every literal and star binding). stars keeps the last literal plus every star binding (a star before the last literal is kept too), so parallel trees share one feature id. Bare names are unchanged."},sharedRoots:{...v,minItems:1},allowedCrossSlice:{type:"array",minItems:1,items:{type:"object",additionalProperties:!1,required:["from","to"],properties:{from:{type:"string",minLength:1},to:{type:"string",minLength:1}}}},sharedImportsSlice:xn,childSlices:Ln}},safety:{type:"object",additionalProperties:!1,properties:{maxTsSuppressions:{type:"integer",minimum:0,default:0},maxAnyCasts:{type:"integer",minimum:0,default:0},allowInMemory:{type:"boolean",default:!1},allowDisabledPeerIsolation:{type:"boolean",default:!1}}},coverage:{type:"object",additionalProperties:!1,description:"Invariant coverage scan controls. testGlobs replaces the built-in test-name heuristic; maxFiles raises or lowers the evidence file budget and also bounds structural-hint preload for orchestration-only, thin-adapter, and writes-via-aggregate (default 400; there is no arkrules.hintBudget); coverageRoots declares where the project runs its tests, so a covering test found outside them is reported instead of silently certifying an invariant. When any invariant is enforced, missing coverageRoots fails closed.",properties:{testGlobs:{...v,minItems:1},maxFiles:{type:"integer",minimum:1,description:"Evidence file budget (default 400) and structural-hint preload cap for orchestration-only, thin-adapter, and writes-via-aggregate. Raise this when hinted/governed counts show truncated sensors. There is no separate arkrules.hintBudget."},coverageRoots:{...v,minItems:1}}},arkRun:yn,arkOrder:wn}},R=class extends Error{static{_chunkA5EIY3HIcjs.a.call(void 0, this,"ArkConfigValidationError")}constructor(e,n){super(`Invalid ArkGate config (${e}):
15
+ ${n.map(r=>`- ${r.path}: ${r.message}`).join(`
16
+ `)}`),this.name="ArkConfigValidationError",this.source=e,this.issues=n}};function _n(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}_chunkA5EIY3HIcjs.a.call(void 0, _n,"isObject");function be(t,e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`}_chunkA5EIY3HIcjs.a.call(void 0, be,"propertyPath");function W(t){return t===null?"null":Array.isArray(t)?"array":typeof t}_chunkA5EIY3HIcjs.a.call(void 0, W,"valueType");function Po(t,e){let n="#/$defs/";if(t.startsWith(n))return e.$defs[t.slice(n.length)]}_chunkA5EIY3HIcjs.a.call(void 0, Po,"resolveSchemaRef");function se(t,e,n,r,o){if(e.$ref){let i=Po(e.$ref,r);if(!i){o.push({path:n,message:`schema reference ${e.$ref} cannot be resolved`});return}se(t,i,n,r,o);return}if(e.const!==void 0&&!Object.is(t,e.const)){o.push({path:n,message:`must equal ${JSON.stringify(e.const)}`});return}if(e.enum&&!e.enum.some(i=>Object.is(i,t))){o.push({path:n,message:`must be one of ${e.enum.map(String).join(", ")}`});return}if(e.type==="object"){if(!_n(t)){o.push({path:n,message:`must be an object; received ${W(t)}`});return}let i=_nullishCoalesce(e.properties, () => ({}));for(let s of _nullishCoalesce(e.required, () => ([])))t[s]===void 0&&o.push({path:be(n,s),message:"is required"});if(e.additionalProperties===!1)for(let s of Object.keys(t))s in i||o.push({path:be(n,s),message:"unknown field"});else if(e.additionalProperties!==void 0&&e.additionalProperties!==!0&&typeof e.additionalProperties=="object"){let s=e.additionalProperties;for(let l of Object.keys(t))l in i||se(t[l],s,be(n,l),r,o)}for(let[s,l]of Object.entries(i))t[s]!==void 0&&se(t[s],l,be(n,s),r,o);return}if(e.type==="array"){if(!Array.isArray(t)){o.push({path:n,message:`must be an array; received ${W(t)}`});return}if(e.minItems!==void 0&&t.length<e.minItems&&o.push({path:n,message:`must contain at least ${e.minItems} item(s)`}),e.uniqueItems){let i=t.map(s=>JSON.stringify(s));new Set(i).size!==i.length&&o.push({path:n,message:"must not contain duplicate items"})}e.items&&t.forEach((i,s)=>se(i,e.items,`${n}[${s}]`,r,o));return}if(e.type==="string"){if(typeof t!="string"){o.push({path:n,message:`must be a string; received ${W(t)}`});return}e.minLength!==void 0&&t.length<e.minLength&&o.push({path:n,message:`must contain at least ${e.minLength} character(s)`});return}if(e.type==="boolean"){typeof t!="boolean"&&o.push({path:n,message:`must be a boolean; received ${W(t)}`});return}if(e.type==="integer"){if(!Number.isInteger(t)){o.push({path:n,message:`must be an integer; received ${W(t)}`});return}e.minimum!==void 0&&t<e.minimum&&o.push({path:n,message:`must be at least ${e.minimum}`})}}_chunkA5EIY3HIcjs.a.call(void 0, se,"validateNode");function xo(t,e){let n=t.layers;Array.isArray(n)&&n.forEach((r,o)=>{if(!r||typeof r!="object"||Array.isArray(r)||!("owners"in r))return;let i=r.owners;Array.isArray(i)&&i.forEach((s,l)=>{typeof s=="string"&&(Nn(s)||e.push({path:`$.layers[${o}].owners[${l}]`,message:"must be a GitHub handle or email (not a display name)"}))})})}_chunkA5EIY3HIcjs.a.call(void 0, xo,"validateLayerOwners");function Lo(t){let e={...t,$schema:t.$schema===void 0?Ae:t.$schema,schemaVersion:t.schemaVersion===void 0?A:t.schemaVersion,include:t.include===void 0?["src"]:t.include,layers:t.layers===void 0?[]:t.layers,rules:t.rules===void 0?ke.map(n=>({...n})):t.rules};return t.arkRun!==void 0&&(e.arkRun=In(t.arkRun)),t.arkOrder!==void 0&&(e.arkOrder=vn(t.arkOrder)),e}_chunkA5EIY3HIcjs.a.call(void 0, Lo,"defaultedConfig");function Oo(t){return t===A?null:t==="unversioned"?"unversioned":t==="1.0"||t==="1.1"||t==="1.2"?t:null}_chunkA5EIY3HIcjs.a.call(void 0, Oo,"migratedFromOf");function $o(){let t=new Set([A]);for(let e of nt)e.from!=="unversioned"&&t.add(e.from),t.add(e.to);return t}_chunkA5EIY3HIcjs.a.call(void 0, $o,"knownInputVersions");function Do(t,e="ark.config.json"){if(!_n(t))throw new R(e,[{path:"$",message:`must be an object; received ${W(t)}`}]);let n=$o(),r=t.schemaVersion===void 0?"unversioned":typeof t.schemaVersion=="string"?t.schemaVersion:null;if(r===null)throw new R(e,[{path:"$.schemaVersion",message:`unsupported version ${JSON.stringify(t.schemaVersion)}; expected ${A}`}]);if(r!=="unversioned"&&!n.has(r))throw new R(e,[{path:"$.schemaVersion",message:`unsupported version ${JSON.stringify(r)}; expected ${A}`}]);let o=r,i={...t},s=0;for(;o!==A&&s<nt.length+1;){s+=1;let l=nt.find(c=>c.from===o);if(!l)throw new R(e,[{path:"$.schemaVersion",message:`unsupported version ${JSON.stringify(o)}; expected ${A}`}]);o=l.to,i.schemaVersion=o}if(o!==A)throw new R(e,[{path:"$.schemaVersion",message:`unsupported version ${JSON.stringify(r)}; expected ${A}`}]);return{candidate:Lo(i),migratedFrom:Oo(r)}}_chunkA5EIY3HIcjs.a.call(void 0, Do,"migrateArkConfig");function Mo(t,e="ark.config.json"){let{candidate:n,migratedFrom:r}=Do(t,e),o=[];if(se(n,Fn,"$",Fn,o),bn(n,o),An(n,o),xo(n,o),On(n,o),o.length>0)throw new R(e,o);return{config:n,migratedFrom:r}}_chunkA5EIY3HIcjs.a.call(void 0, Mo,"loadArkConfigContract");function ya(t,e="ark.config.json"){let n;try{n=JSON.parse(t)}catch(r){throw new R(e,[{path:"$",message:`invalid JSON: ${r instanceof Error?r.message:String(r)}`}])}return Mo(n,e)}_chunkA5EIY3HIcjs.a.call(void 0, ya,"parseArkConfigJson");function Bn(t){let e={$schema:typeof t.$schema=="string"&&t.$schema.length>0?t.$schema:Ae,schemaVersion:A};for(let[n,r]of Object.entries(t))n!=="$schema"&&n!=="schemaVersion"&&(e[n]=r);return e}_chunkA5EIY3HIcjs.a.call(void 0, Bn,"withArkConfigMetadata");var jn={RAW_EVENT_PUBLISH:"Publish through a registered intent creator; raw event objects or intent strings bypass Ark contracts and tooling.",PUBLISH_MISSING_SOURCE:"Strict Ark publish calls must include metadata.source."},No= exports.da =Object.freeze([{layer:"DomainModel",prefixes:["Domain."]},{layer:"ApplicationOrchestration",prefixes:["Application."]},{layer:"PersistenceAdapters",prefixes:["Adapter.Persistence.","Adapter.Repository."]},{layer:"IntegrationAdapters",prefixes:["Adapter.Integration.","Adapter.External."]},{layer:"WorkflowSagaEngine",prefixes:["Workflow."]},{layer:"BackgroundJobsScheduling",prefixes:["Job."]},{layer:"PresentationAdapters",prefixes:["Presentation.","Adapter.Presentation.","Adapter.Api."]},{layer:"ReportingReadModels",prefixes:["Reporting."]},{layer:"ExtensibilityMetadata",prefixes:["Metadata."]},{layer:"SecurityAuditObservability",prefixes:["Security.","Audit.","Observability."]},{layer:"Kernel",prefixes:["Kernel."]}]);function rt(t){let e=(_nullishCoalesce(t.intentPrefixes, () => ([]))).filter(n=>n.trim().length>0);return e.length>0?e:_nullishCoalesce(_optionalChain([No, 'access', _78 => _78.find, 'call', _79 => _79(n=>n.layer===t.name), 'optionalAccess', _80 => _80.prefixes]), () => ([]))}_chunkA5EIY3HIcjs.a.call(void 0, rt,"effectiveIntentPrefixes");function Gn(t){let e=new Set(t.layers.filter(r=>rt(r).length>0).map(r=>r.name)),n=new Set;for(let r of _nullishCoalesce(t.rules, () => ([])))if(!(r.allowed!==!1||r.peerIsolation===!0))for(let o of[r.from,r.to])e.has(o)||n.add(o);return[...n].sort()}_chunkA5EIY3HIcjs.a.call(void 0, Gn,"unresolvableLayerFlowLayers");function Ia(t,e){return _optionalChain([e, 'access', _81 => _81.flatMap, 'call', _82 => _82((r,o)=>(_nullishCoalesce(_nullishCoalesce(r.prefixes, () => (r.intentPrefixes)), () => ([]))).map(i=>({layer:r.name,layerIndex:o,prefix:i.endsWith(".")?i:`${i}.`}))), 'access', _83 => _83.filter, 'call', _84 => _84(({prefix:r})=>t.startsWith(r)), 'access', _85 => _85.sort, 'call', _86 => _86((r,o)=>o.prefix.length-r.prefix.length||r.layerIndex-o.layerIndex), 'access', _87 => _87[0], 'optionalAccess', _88 => _88.layer])}_chunkA5EIY3HIcjs.a.call(void 0, Ia,"resolveIntentLayer");function To(t){return/^(Domain|Application|Adapter|Workflow|Job|Presentation|Reporting|Metadata|Security|Audit|Observability|Kernel)\.[A-Za-z0-9_.]+$/.test(t)}_chunkA5EIY3HIcjs.a.call(void 0, To,"looksLikeArkIntent");function va(t){if(!t.publishCall)return[];let e=[];return(t.rawIntentName!==void 0&&To(t.rawIntentName)||t.objectHasIntent)&&e.push({ruleId:"RAW_EVENT_PUBLISH",message:jn.RAW_EVENT_PUBLISH}),t.arkPublishCandidate&&!t.hasSource&&e.push({ruleId:"PUBLISH_MISSING_SOURCE",message:jn.PUBLISH_MISSING_SOURCE}),e}_chunkA5EIY3HIcjs.a.call(void 0, va,"classifyPublishFacts");function Fo(t){return t.endsWith(".")?t:`${t}.`}_chunkA5EIY3HIcjs.a.call(void 0, Fo,"normalizePrefix");function _o(t,e){let n=t.prefixes.length?Math.max(...t.prefixes.map(o=>o.length)):0;return(e.prefixes.length?Math.max(...e.prefixes.map(o=>o.length)):0)-n}_chunkA5EIY3HIcjs.a.call(void 0, _o,"byLongestPrefix");function ot(t){let e=t.layers.map(o=>({...o,prefixes:o.prefixes.map(Fo)})),n=[...e].sort(_o),r=[..._nullishCoalesce(t.rules, () => ([]))];return{name:t.name,layers:e,rules:r,resolveLayer(o){return _nullishCoalesce(_optionalChain([e, 'access', _89 => _89.find, 'call', _90 => _90(i=>_optionalChain([i, 'access', _91 => _91.match, 'optionalCall', _92 => _92(o)])), 'optionalAccess', _93 => _93.name]), () => (_optionalChain([n, 'access', _94 => _94.find, 'call', _95 => _95(i=>i.prefixes.some(s=>o.startsWith(s))), 'optionalAccess', _96 => _96.name])))}}}_chunkA5EIY3HIcjs.a.call(void 0, ot,"createArchitectureProfile");function it(t,e={}){return ot({name:_nullishCoalesce(_nullishCoalesce(e.name, () => (t.name)), () => ("ark.config.json")),layers:t.layers.map((n,r)=>({name:n.name,prefixes:[...rt(n)],description:n.description,trustBoundary:n.trustBoundary,owners:n.owners,order:r+1})),rules:_nullishCoalesce(t.rules, () => ([]))})}_chunkA5EIY3HIcjs.a.call(void 0, it,"createArchitectureProfileFromArkConfig");var Bo=[{name:"DomainModel",prefixes:["Domain"],description:"Rich domain model, business rules, and domain events.",order:1},{name:"ApplicationOrchestration",prefixes:["Application"],description:"Use cases and command orchestration.",order:2},{name:"PersistenceAdapters",prefixes:["Adapter.Persistence","Adapter.Repository"],description:"Database, repository, and storage adapters.",order:3},{name:"IntegrationAdapters",prefixes:["Adapter.Integration","Adapter.External"],description:"External systems, APIs, and integration adapters.",order:4},{name:"WorkflowSagaEngine",prefixes:["Workflow"],description:"Sagas, workflows, and long-running processes.",order:5},{name:"BackgroundJobsScheduling",prefixes:["Job"],description:"Background jobs, scheduled work, and async processors.",order:6},{name:"PresentationAdapters",prefixes:["Presentation","Adapter.Presentation","Adapter.Api"],description:"API, UI, controller, and presentation adapters.",order:7},{name:"ReportingReadModels",prefixes:["Reporting"],description:"Read models, projections, and reporting surfaces.",order:8},{name:"ExtensibilityMetadata",prefixes:["Metadata"],description:"Metadata, extensions, and schema contracts.",order:9},{name:"SecurityAuditObservability",prefixes:["Security","Audit","Observability"],description:"Security, audit, and observability concerns.",order:10},{name:"Kernel",prefixes:["Kernel"],description:"Ark-owned governance and kernel signals.",order:11}],ae= exports.ja =ot({name:"Ark 11-layer Hexagonal Event-Driven Profile",layers:Bo,rules:ke.map(t=>({...t}))}),jo={DomainModel:["domain"],ApplicationOrchestration:["application","app"],PersistenceAdapters:["adapters/persistence","adapters/repository","repositories","infra/persistence"],IntegrationAdapters:["adapters/integration","adapters/external","integrations"],WorkflowSagaEngine:["workflows","sagas"],BackgroundJobsScheduling:["jobs","schedules"],PresentationAdapters:["presentation","adapters/presentation","adapters/api"],ReportingReadModels:["reporting","read-models","projections"],ExtensibilityMetadata:["metadata","extensions"],SecurityAuditObservability:["security","audit","observability"],Kernel:["kernel"]};function Go(t={}){let e=_nullishCoalesce(t.rootDir, () => ("src")),n=_nullishCoalesce(t.optionalLayers, () => (!0)),r=e==="."?"":`${e}/`;return Bn({include:_nullishCoalesce(t.include, () => ([e])),layers:ae.layers.map(o=>({name:o.name,patterns:(_nullishCoalesce(jo[o.name], () => ([o.name]))).map(i=>`${r}${i}/**`),intentPrefixes:o.prefixes,optional:n})),rules:[...ae.rules]})}_chunkA5EIY3HIcjs.a.call(void 0, Go,"createElevenLayerArkConfig");var Ee= (_class8 =class{constructor() { _class8.prototype.__init16.call(this); }static{_chunkA5EIY3HIcjs.a.call(void 0, this,"MetadataRegistryImpl")}__init16() {this.entities=new Map}entity(e,n,r={}){if(this.entities.has(e)&&!r.allowOverwrite)throw new Error(`Entity metadata "${e}" is already registered.`);let o={name:e,fields:{},...n};return this.entities.set(e,o),o}getEntity(e){return this.entities.get(e)}listEntities(){return Array.from(this.entities.values())}findEntitiesByIntent(e){return this.listEntities().filter(n=>_optionalChain([n, 'access', _97 => _97.emits, 'optionalAccess', _98 => _98.includes, 'call', _99 => _99(e)])||_optionalChain([n, 'access', _100 => _100.consumes, 'optionalAccess', _101 => _101.includes, 'call', _102 => _102(e)]))}validate(){let e=[];for(let n of this.entities.values()){n.name.trim()||e.push({entity:n.name,message:"Entity name is required."});for(let[r,o]of Object.entries(n.fields))r.trim()||e.push({entity:n.name,field:r,message:"Field name is required."}),(!o.type||typeof o.type!="string")&&e.push({entity:n.name,field:r,message:"Field type must be a non-empty string."}),o.relation&&!this.entities.has(o.relation.entity)&&e.push({entity:n.name,field:r,message:`Related entity "${o.relation.entity}" is not registered.`})}return{ok:e.length===0,issues:e}}toJSON(){return this.listEntities()}}, _class8);function st(){return new Ee}_chunkA5EIY3HIcjs.a.call(void 0, st,"createMetadataRegistry");var Re= (_class9 =class{constructor() { _class9.prototype.__init17.call(this); }static{_chunkA5EIY3HIcjs.a.call(void 0, this,"InMemoryReadModelStore")}__init17() {this.states=new Map}load(e){return this.states.get(e)}save(e,n){this.states.set(e,n)}clear(e){e?this.states.delete(e):this.states.clear()}}, _class9);function Ho(t){return typeof t.initialState=="function"?t.initialState():t.initialState}_chunkA5EIY3HIcjs.a.call(void 0, Ho,"initialState");var Ce= (_class10 =class{static{_chunkA5EIY3HIcjs.a.call(void 0, this,"ProjectionRegistryImpl")}__init18() {this.definitions=new Map}__init19() {this.checkpoints=new Map}constructor(e={}){;_class10.prototype.__init18.call(this);_class10.prototype.__init19.call(this);this.store=_nullishCoalesce(e.store, () => (new Re)),this.auditTrail=e.auditTrail}register(e){if(this.definitions.has(e.name))throw new Error(`Projection "${e.name}" is already registered.`);this.definitions.set(e.name,e),this.checkpoints.set(e.name,{projection:e.name,appliedCount:0})}list(){return Array.from(this.definitions.values())}async apply(e){let n=[];for(let r of this.definitions.values()){if(!r.sourceIntents.includes(e.intent))continue;let o=await _asyncNullishCoalesce(await this.store.load(r.name), async () => (Ho(r))),i=await r.project(e,o);await this.store.save(r.name,i);let s=this.checkpoints.get(r.name);this.checkpoints.set(r.name,{projection:r.name,appliedCount:(_nullishCoalesce(_optionalChain([s, 'optionalAccess', _103 => _103.appliedCount]), () => (0)))+1,lastIntent:e.intent,lastCorrelationId:e.metadata.correlationId,updatedAt:new Date().toISOString()}),await _optionalChain([this, 'access', _104 => _104.auditTrail, 'optionalAccess', _105 => _105.record, 'call', _106 => _106({type:"projection.applied",source:"Kernel.ProjectionRegistry",intent:e.intent,correlationId:e.metadata.correlationId,causationId:e.metadata.causationId,subject:r.name,details:{projection:r.name}})]),n.push(r.name)}return n}async getState(e){return this.store.load(e)}getCheckpoint(e){return this.checkpoints.get(e)}getCheckpoints(){return Array.from(this.checkpoints.values())}async clear(){await this.store.clear();for(let e of this.definitions.values())this.checkpoints.set(e.name,{projection:e.name,appliedCount:0})}}, _class10);function at(t){return new Ce(t)}_chunkA5EIY3HIcjs.a.call(void 0, at,"createProjectionRegistry");var lt="1.0";function Ko(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}_chunkA5EIY3HIcjs.a.call(void 0, Ko,"policyId");var ct=class{constructor(e){this.data=e}static{_chunkA5EIY3HIcjs.a.call(void 0, this,"ArkManifestImpl")}toJSON(){return{...this.data}}};function dt(t={}){let e=t.registry,n=t.policyEngine,r=t.metadata,o=t.graph,i=t.profile,s=t.projections,l=t.eventContracts,c=t.observability,d=e?e.list().map(g=>({name:g.name,dependencies:e.getDependencies(g.name),productions:e.getProductions(g.name)})):[],f=e?e.getAllRelationships():[],p=n?n.getPolicies().map(g=>({id:Ko(g.name),name:g.name,severity:g.severity,tags:g.tags?[...g.tags]:void 0,owner:g.owner,version:g.version,rationale:g.rationale,enforcementMode:g.enforcementMode,deprecated:g.deprecated,replacedBy:g.replacedBy,description:_optionalChain([g, 'access', _107 => _107.tags, 'optionalAccess', _108 => _108.includes, 'call', _109 => _109("layer")])?"Enforces clean-architecture layer dependency rules on declared relationships.":void 0})):[],m=r?r.toJSON():[],h=o?o.toJSON():{nodes:[],edges:[]},y=m.filter(g=>(_nullishCoalesce(_optionalChain([g, 'access', _110 => _110.emits, 'optionalAccess', _111 => _111.length]), () => (0)))>0||(_nullishCoalesce(_optionalChain([g, 'access', _112 => _112.consumes, 'optionalAccess', _113 => _113.length]), () => (0)))>0).map(g=>({entity:g.name,emits:g.emits,consumes:g.consumes})),u=s?s.list().map(g=>({name:g.name,sourceIntents:g.sourceIntents,checkpoint:s.getCheckpoint(g.name)})):[],w={schemaVersion:"1.0",version:Ct,exportedAt:new Date().toISOString(),intents:d,relationships:f,policies:p,entities:m,graph:h,architecture:i?{profile:i.name,layers:i.layers,rules:i.rules}:void 0,projections:u,eventContracts:_nullishCoalesce(_optionalChain([l, 'optionalAccess', _114 => _114.list, 'call', _115 => _115()]), () => ([])),observability:_optionalChain([c, 'optionalAccess', _116 => _116.report, 'call', _117 => _117()]),links:{entityIntents:y}};return new ct(w)}_chunkA5EIY3HIcjs.a.call(void 0, dt,"createArkManifest");function Hn(t){return k(t)}_chunkA5EIY3HIcjs.a.call(void 0, Hn,"createWorkflowId");function ut(t){return t instanceof Error?t.message:String(t)}_chunkA5EIY3HIcjs.a.call(void 0, ut,"errorMessage");function Vo(t){return new Promise(e=>{setTimeout(e,t)})}_chunkA5EIY3HIcjs.a.call(void 0, Vo,"sleep");async function Wo(t,e,n){let r=new AbortController;if(e===void 0)return t(r.signal);let o,i=new Promise((s,l)=>{o=setTimeout(()=>{let c=new Error(`Workflow step "${n}" timed out after ${e}ms.`);r.abort(c),l(c)},e)});try{return await Promise.race([t(r.signal),i])}finally{o&&clearTimeout(o)}}_chunkA5EIY3HIcjs.a.call(void 0, Wo,"withTimeout");var Pe= (_class11 =class{constructor() { _class11.prototype.__init20.call(this); }static{_chunkA5EIY3HIcjs.a.call(void 0, this,"InMemoryWorkflowStore")}__init20() {this.snapshots=new Map}save(e,n){let r=this.snapshots.get(e.id);if(r&&r.version!==e.version)throw new Error(`Optimistic concurrency conflict for workflow ${e.id}`);let o=(_nullishCoalesce(e.version, () => (0)))+1;this.snapshots.set(e.id,{...e,version:o,context:{...e.context}}),e.version=o}get(e,n){let r=this.snapshots.get(e);return r?{...r,context:{...r.context}}:void 0}list(e){return Array.from(this.snapshots.values()).filter(n=>!e||n.workflowName===e).map(n=>({...n,context:{...n.context}}))}claim(e,n,r){let o=Date.now();for(let i of this.snapshots.values()){if(r&&i.workflowName!==r||i.status!=="running"&&i.status!=="compensating")continue;let s=i.expiresAt?new Date(i.expiresAt).getTime()<o:!0;if(!i.ownerId||s){i.ownerId=e,i.expiresAt=new Date(o+n).toISOString();let l=(_nullishCoalesce(i.version, () => (0)))+1;return i.version=l,this.snapshots.set(i.id,{...i,context:{...i.context}}),{...i,context:{...i.context}}}}}clear(){this.snapshots.clear()}}, _class11),ft= (_class12 =class{constructor(e,n={}){;_class12.prototype.__init21.call(this);this.bus=e;this.options=n;this.store=_nullishCoalesce(n.store, () => (new Pe))}static{_chunkA5EIY3HIcjs.a.call(void 0, this,"WorkflowEngineImpl")}__init21() {this.definitions=new Map}register(e){if(this.definitions.has(e.name))throw new Error(`Workflow "${e.name}" is already registered.`);let n=new Set;for(let r of e.steps){if(n.has(r.name))throw new Error(`Workflow "${e.name}" has duplicate step name "${r.name}".`);n.add(r.name)}if(this.definitions.set(e.name,e),e.startOn){let r=e.startOn;this.bus.subscribe(r.intent,async o=>{await this.start(e.name,r.mapEventToPayload(o))})}}async start(e,n,r={}){let o=this.definitions.get(e);if(!o)throw new Error(`Workflow "${e}" is not registered.`);let i=new Date().toISOString(),s={id:_nullishCoalesce(r.id, () => (Hn(e))),version:0,workflowName:e,status:"running",context:{...n},completedSteps:[],attempts:{},startedAt:i,updatedAt:i};return await this.store.save(s,r.tx),await this.audit("workflow.started",s,{workflowName:e}),this.executeSnapshot(s,o,r.tx)}async resume(e,n={}){let r=await this.get(e,n.tx);if(!r)return;if(r.status!=="running"&&r.status!=="compensating")return r;let o=this.definitions.get(r.workflowName);if(!o)throw new Error(`Workflow "${r.workflowName}" is not registered.`);return this.executeSnapshot(r,o,n.tx)}async executeSnapshot(e,n,r){try{let o=n.steps.filter(i=>!e.completedSteps.includes(i.name));for(let i of o)await this.runStep(e,i,r);return e.status="completed",e.currentStep=void 0,e.completedAt=new Date().toISOString(),e.updatedAt=e.completedAt,await this.store.save(e,r),await this.audit("workflow.completed",e,{workflowName:e.workflowName}),{...e,context:{...e.context}}}catch(o){throw await this.compensate(e,n.steps,o,r),e.status="failed",e.currentStep=void 0,e.error=ut(o),e.updatedAt=new Date().toISOString(),await this.store.save(e,r),await this.audit("workflow.failed",e,{workflowName:e.workflowName,error:e.error,failedStep:e.failedStep}),o}}async get(e,n){return this.store.get(e,n)}async list(e){return this.store.list(e)}async runStep(e,n,r){let o=_nullishCoalesce(_nullishCoalesce(n.retry, () => (this.options.defaultRetry)), () => ({attempts:1})),i=Math.max(1,o.attempts);e.currentStep=n.name,e.updatedAt=new Date().toISOString(),await this.store.save(e,r);for(let s=1;s<=i;s+=1){e.attempts[n.name]=s,await this.store.save(e,r);let l;try{l=await Wo(c=>Promise.resolve(n.execute(e.context,this.bus,c)),n.timeoutMs,n.name)}catch(c){if(s<i){o.delayMs&&await Vo(o.delayMs);continue}throw e.failedStep=n.name,e.updatedAt=new Date().toISOString(),await this.store.save(e,r),await this.audit("workflow.step.failed",e,{step:n.name,attempt:s,error:ut(c)}),c}l&&Object.assign(e.context,l),e.completedSteps.push(n.name),e.currentStep=void 0,e.updatedAt=new Date().toISOString(),await this.store.save(e,r),await this.audit("workflow.step.completed",e,{step:n.name,attempt:s});return}throw new Error(`Workflow step "${n.name}" did not complete.`)}async compensate(e,n,r,o){e.status="compensating",e.updatedAt=new Date().toISOString(),await this.store.save(e,o);let i=n.filter(s=>e.completedSteps.includes(s.name));for(let s=i.length-1;s>=0;s-=1){let l=i[s];if(l.compensate)try{await Promise.resolve(l.compensate(e.context,this.bus,r)),await this.audit("workflow.compensation.completed",e,{step:l.name})}catch(c){await this.audit("workflow.step.failed",e,{step:l.name,compensation:!0,error:ut(c)})}}}async audit(e,n,r){await _optionalChain([this, 'access', _118 => _118.options, 'access', _119 => _119.auditTrail, 'optionalAccess', _120 => _120.record, 'call', _121 => _121({type:e,source:"Kernel.WorkflowEngine",subject:n.id,details:r})])}}, _class12);function xe(t,e){return new ft(t,e)}_chunkA5EIY3HIcjs.a.call(void 0, xe,"createWorkflowEngine");function Uo(t,e,n={}){let r=xe(e,n),o={name:t.name,steps:t.steps};r.register(o);let i=_nullishCoalesce(n.id, () => (Hn(t.name))),s="idle",l=[];return{id:i,definition:t,get status(){return s},get completedSteps(){return[...l]},async run(c){s="running",l=[];try{let d=await r.start(t.name,c,{id:i});s=d.status==="waiting"?"idle":d.status,l=[...d.completedSteps]}catch(d){let f=await r.get(i);throw s=_optionalChain([f, 'optionalAccess', _122 => _122.status])==="waiting"?"idle":_nullishCoalesce(_optionalChain([f, 'optionalAccess', _123 => _123.status]), () => ("failed")),l=_nullishCoalesce(_optionalChain([f, 'optionalAccess', _124 => _124.completedSteps]), () => ([])),d}}}}_chunkA5EIY3HIcjs.a.call(void 0, Uo,"createSaga");async function Kn(t,e={}){let n=_chunkA5EIY3HIcjs.N.call(void 0, {host:e.host,port:e.port,nodeEnv:e.nodeEnv,processNodeEnv:process.env.NODE_ENV}),{listenArkRunInspector:r}=await Promise.resolve().then(() => _interopRequireWildcard(require("./inspectorListen-KGMIQ2TF.cjs")));return r(t,{bind:n,sseIntervalMs:e.sseIntervalMs})}_chunkA5EIY3HIcjs.a.call(void 0, Kn,"startArkRunInspector");var qo=new Set(["singleton","transient"]);function Vn(t){let e={id:t.id,lifetime:t.lifetime,uses:[...t.uses],reactsTo:[...t.reactsTo],raises:[...t.raises],sends:[...t.sends]};if(t.extendedInfo){let n=t.extendedInfo;e.extendedInfo={...n.label?{label:n.label}:{},...n.architectureKind?{architectureKind:n.architectureKind}:{},...n.tags?{tags:[...n.tags]}:{},...n.group?{group:n.group}:{},...n.metadata?{metadata:{...n.metadata}}:{}}}return e}_chunkA5EIY3HIcjs.a.call(void 0, Vn,"cloneComponent");function zo(t){if(t===void 0)return"singleton";if(typeof t=="string"&&qo.has(t))return t;throw new Error('ArkRun component lifetime must be "singleton" or "transient".')}_chunkA5EIY3HIcjs.a.call(void 0, zo,"closedLifetime");function Wn(){let t=new Map,e=new Map,n=new Set;function r(s){let l=t.get(s);if(!l)throw new Error(`ArkRun component "${s}" is not registered.`);return l}_chunkA5EIY3HIcjs.a.call(void 0, r,"mustRecord");function o(s,l){if(!l.factory)throw new Error(`ArkRun component "${s}" has no factory; declarations-only registrations cannot be resolved.`);if(n.has(s))throw new Error(`ArkRun component "${s}" has a circular resolve.`);n.add(s);try{return l.factory()}finally{n.delete(s)}}_chunkA5EIY3HIcjs.a.call(void 0, o,"instantiate");function i(s,l){if(e.has(s))return e.get(s);let c=o(s,l);return e.set(s,c),c}return _chunkA5EIY3HIcjs.a.call(void 0, i,"singleton"),{register(s){let l=typeof _optionalChain([s, 'optionalAccess', _125 => _125.id])=="string"?s.id.trim():"";if(!l)throw new Error("ArkRun component id must be a non-empty string.");if(t.has(l))throw new Error(`ArkRun component "${l}" is already registered.`);let c=zo(s.lifetime),d=_chunkA5EIY3HIcjs.e.call(void 0, {id:l,lifetime:c,uses:s.uses,reactsTo:s.reactsTo,raises:s.raises,sends:s.sends,extendedInfo:s.extendedInfo});if(!d)throw new Error("ArkRun component id must be a non-empty string.");let f=typeof s.factory=="function"?s.factory:void 0;return t.set(l,{component:d,factory:f}),Vn(d)},resolve(s){let l=r(s);return l.component.lifetime==="transient"?o(s,l):i(s,l)},resolveSingleton(s){let l=r(s);if(l.component.lifetime==="transient")throw new Error(`ArkRun component "${s}" is transient; resolveSingleton requires lifetime "singleton".`);return i(s,l)},snapshotComponents(){return[...t.values()].map(s=>Vn(s.component))}}}_chunkA5EIY3HIcjs.a.call(void 0, Wn,"createComponentRegistry");function Jo(t){let e={..._nullishCoalesce(t.metadata, () => ({}))};if(t.source===void 0)return e;if(e.source&&e.source!==t.source)throw new x(t.source,e.source);return e.source=t.source,e}_chunkA5EIY3HIcjs.a.call(void 0, Jo,"stampMetadata");async function pt(t,e,n,r={}){let o=_chunkA5EIY3HIcjs.x.call(void 0, {transport:r.transport,ephemeral:_nullishCoalesce(r.ephemeral, () => (t.defaultEphemeral)),brokerBound:typeof _optionalChain([t, 'access', _126 => _126.broker, 'optionalAccess', _127 => _127.send])=="function"}),i=Jo(r),s=o.deliveredVia==="broker"&&t.broker!==void 0,l,c=await t.eventBus.dispatch(e,n,i,{notifySubscribers:o.notifySubscribers,awaitHandlers:o.awaitHandlers,...s?{settleBufferOnLocalDelivery:!1}:{},onBufferRecord:_chunkA5EIY3HIcjs.a.call(void 0, d=>{l=d.id},"onBufferRecord")});if(s&&t.broker){let d=t.eventBus,f=t.broker,p=(async()=>{try{await f.send(c)}catch(m){throw l!==void 0&&await d.settleBufferRecord(c,l,{ok:!1,error:m}),await d.recordHandoffFailure(c,m,"broker"),m}l!==void 0&&await d.settleBufferRecord(c,l,{ok:!0})})();o.awaitHandoff?await p:p.then(void 0,()=>{})}return o}_chunkA5EIY3HIcjs.a.call(void 0, pt,"sendOnArkRunTransport");var Yo=1e3;function Xo(){return k("ark-kernel")}_chunkA5EIY3HIcjs.a.call(void 0, Xo,"nextKernelInstanceId");function Un(t,e){let n=_optionalChain([t, 'access', _128 => _128.constructor, 'optionalAccess', _129 => _129.name]);return typeof n=="string"&&n.length>0?n:e}_chunkA5EIY3HIcjs.a.call(void 0, Un,"portConstructorId");function gt(t={}){let e=_nullishCoalesce(t.strict, () => (!0)),n=_nullishCoalesce(t.instanceId, () => (Xo())),r=_nullishCoalesce(t.profile, () => (ae)),o=_nullishCoalesce(t.maxHistorySize, () => (Yo)),i=Me(),s=Qe(),l=_nullishCoalesce(t.metadata, () => (st())),c=t.auditTrail===void 0,d=_nullishCoalesce(t.auditTrail, () => (Ze({maxRecords:o}))),f=_nullishCoalesce(t.eventContracts, () => (Je())),p=t.eventBuffer===void 0&&t.outbox===void 0,m=_nullishCoalesce(_nullishCoalesce(t.eventBuffer, () => (t.outbox)), () => (new K({maxRecords:o}))),h=_nullishCoalesce(t.projections, () => (at({auditTrail:d}))),y=new N([_e(r),..._nullishCoalesce(t.policies, () => ([]))]),u=_chunkA5EIY3HIcjs.a.call(void 0, ()=>{et(i,s,{requireRegisteredTargets:!0})},"syncGraph"),w=_nullishCoalesce(t.ephemeral, () => (!0)),g=t.broker,I=new H({intentRegistry:i,dependencyGraph:s,policyEngine:y,strictRegistry:!0,validateIntentNaming:!0,auditTrail:d,eventContracts:f,strictEventContracts:_nullishCoalesce(t.strictEventContracts, () => (e)),requireKnownSource:_nullishCoalesce(t.requireKnownSource, () => (!0)),architectureProfile:r,enforceObservedLayerFlow:_nullishCoalesce(t.enforceObservedLayerFlow, () => ((e?"hard":"off"))),eventBuffer:m,settleBufferOnLocalDelivery:p,instanceId:n,maxHistorySize:o,onPublish:t.autoApplyProjections===!1?void 0:async S=>{await h.apply(S)}}),ht=xe(I,{auditTrail:d}),Le=Xe({registry:i,eventBus:I,graph:s}),D=Wn(),zn=typeof _optionalChain([g, 'optionalAccess', _130 => _130.send])=="function",Jn=p?"InMemoryEventBuffer":Un(m,"EventBufferStore"),Yn=c?"InMemoryAuditStore":Un(d,"AuditTrail"),Xn=_chunkA5EIY3HIcjs.Q.call(void 0, {stores:[_chunkA5EIY3HIcjs.P.call(void 0, Jn,"outbox"),_chunkA5EIY3HIcjs.P.call(void 0, Yn,"audit"),_chunkA5EIY3HIcjs.P.call(void 0, "InMemoryWorkflowStore","workflow")]}),Oe={instanceId:n,profile:r,registry:i,graph:s,metadata:l,auditTrail:d,eventContracts:f,eventBuffer:m,outbox:m,projections:h,policyEngine:y,eventBus:I,workflowEngine:ht,observability:Le,publisher(S){let M=I.createPublisher(S);return{source:M.source,publish:M.publish,send(E,$e,Zn={}){return pt({eventBus:I,broker:g,defaultEphemeral:w},E,$e,{...Zn,source:M.source})}}},send(S,M,E={}){return pt({eventBus:I,broker:g,defaultEphemeral:w},S,M,E)},register(S){return D.register(S)},resolve(S){return D.resolve(S)},resolveSingleton(S){return D.resolveSingleton(S)},getDependencyInformationPackage(){return _chunkA5EIY3HIcjs.f.call(void 0, {kernelInstanceId:n,components:D.snapshotComponents()})},requestGraph(S){return _chunkA5EIY3HIcjs.r.call(void 0, {kernelInstanceId:n,components:D.snapshotComponents()},S)},getInspectorSnapshot(S){return _chunkA5EIY3HIcjs.V.call(void 0, {kernelInstanceId:n,host:_optionalChain([S, 'optionalAccess', _131 => _131.host]),port:_optionalChain([S, 'optionalAccess', _132 => _132.port]),package:{kernelInstanceId:n,components:D.snapshotComponents()},observability:Le.report(),ephemeralDefault:w,brokerBound:zn,hardening:Xn})},startInspector(S){return Kn({getInspectorSnapshot:_chunkA5EIY3HIcjs.a.call(void 0, E=>Oe.getInspectorSnapshot(E),"getInspectorSnapshot"),requestGraph:_chunkA5EIY3HIcjs.a.call(void 0, E=>Oe.requestGraph(E),"requestGraph"),async listInspectorOutbox(){let[E,$e]=await Promise.all([m.list("pending"),m.list("failed")]);return _chunkA5EIY3HIcjs.R.call(void 0, [...E,...$e],{sampleLimit:_chunkA5EIY3HIcjs.I})},async listInspectorWorkflows(){return _chunkA5EIY3HIcjs.T.call(void 0, await ht.list(),{sampleLimit:_chunkA5EIY3HIcjs.I})}},S)},syncGraph:u,manifest(){return u(),dt({registry:i,policyEngine:y,metadata:l,graph:s,profile:r,projections:h,eventContracts:f,observability:Le})}};return Oe}_chunkA5EIY3HIcjs.a.call(void 0, gt,"createArkKernel");function Zo(t={}){return gt({...t,strict:!0,strictEventContracts:_nullishCoalesce(t.strictEventContracts, () => (!0)),requireKnownSource:_nullishCoalesce(t.requireKnownSource, () => (!0)),enforceObservedLayerFlow:_nullishCoalesce(t.enforceObservedLayerFlow, () => ("hard"))})}_chunkA5EIY3HIcjs.a.call(void 0, Zo,"createStrictArkKernel");function mt(t,e,n){let{profileName:r,...o}=e,i=e.enforceObservedLayerFlow,s=(_nullishCoalesce(i, () => (n)))==="hard"?Gn(t):[];if(i==="hard"&&s.length>0)throw new F(s);return{options:{...o,profile:it(t,{name:r})},unresolvable:s}}_chunkA5EIY3HIcjs.a.call(void 0, mt,"planKernelFromConfig");function qn(t,e){return e.length===0||Promise.resolve().then(()=>t.auditTrail.record({type:"layer.observedFlowUnresolvable",subject:e.join(","),details:{code:"ARKRUN_LAYER_FLOW_UNRESOLVABLE",layers:e,message:new F(e).message}})).catch(()=>{}),t}_chunkA5EIY3HIcjs.a.call(void 0, qn,"withUnresolvableNotice");function Tl(t,e={}){let n=_nullishCoalesce(e.strict, () => (!0)),r=mt(t,e,n?"hard":"off");return qn(gt(r.options),r.unresolvable)}_chunkA5EIY3HIcjs.a.call(void 0, Tl,"createArkKernelFromConfig");function Fl(t,e={}){let n=mt(t,e,"hard");return qn(Zo(n.options),n.unresolvable)}_chunkA5EIY3HIcjs.a.call(void 0, Fl,"createStrictArkKernelFromConfig");function _l(t,e={}){return Qo(mt(t,e,"off").options)}_chunkA5EIY3HIcjs.a.call(void 0, _l,"createLenientArkKernelFromConfig");function Qo(t={}){return gt({...t,strict:!1,strictEventContracts:_nullishCoalesce(t.strictEventContracts, () => (!1)),enforceObservedLayerFlow:_nullishCoalesce(t.enforceObservedLayerFlow, () => ("off"))})}_chunkA5EIY3HIcjs.a.call(void 0, Qo,"createLenientArkKernel");exports.a = Ct; exports.b = U; exports.c = Qn; exports.d = Me; exports.e = er; exports.f = Ne; exports.g = P; exports.h = N; exports.i = q; exports.j = Te; exports.k = Fe; exports.l = Ot; exports.m = _e; exports.n = Be; exports.o = rr; exports.p = z; exports.q = J; exports.r = Y; exports.s = X; exports.t = T; exports.u = x; exports.v = Z; exports.w = F; exports.x = Wt; exports.y = Vi; exports.z = G; exports.A = ar; exports.B = Wi; exports.C = Ui; exports.D = de; exports.E = Bt; exports.F = qi; exports.G = Ve; exports.H = vr; exports.I = Ht; exports.J = zi; exports.K = Ji; exports.L = Yi; exports.M = Xi; exports.N = Zi; exports.O = Mr; exports.P = Qi; exports.Q = es; exports.R = Br; exports.S = ge; exports.T = Je; exports.U = K; exports.V = Wr; exports.W = Xe; exports.X = me; exports.Y = Ze; exports.Z = Qe; exports._ = et; exports.$ = ma; exports.aa = ha; exports.ba = Mo; exports.ca = ya; exports.da = No; exports.ea = Ia; exports.fa = To; exports.ga = va; exports.ha = ot; exports.ia = it; exports.ja = ae; exports.ka = Go; exports.la = st; exports.ma = Re; exports.na = at; exports.oa = lt; exports.pa = dt; exports.qa = Pe; exports.ra = xe; exports.sa = Uo; exports.ta = Kn; exports.ua = Yo; exports.va = gt; exports.wa = Zo; exports.xa = Tl; exports.ya = Fl; exports.za = _l; exports.Aa = Qo;
@@ -0,0 +1,5 @@
1
+ var G=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var i=(n,e)=>G(n,"name",{value:e,configurable:!0});var Jn=(n,e,r,t)=>{for(var s=t>1?void 0:t?v(e,r):e,u=n.length-1,a;u>=0;u--)(a=n[u])&&(s=(t?a(e,r,s):a(s))||s);return t&&s&&G(e,r,s),s};var D="1.0",nn=["singleton","transient"],en=["absorb","escalate_up","hold"],rn=new Set(nn);function E(n,e){return n<e?-1:n>e?1:0}i(E,"compare");function tn(n){return[...new Set(n)].sort(E)}i(tn,"uniqueSorted");function k(n){if(!Array.isArray(n))return[];let e=[];for(let r of n)typeof r=="string"&&r.length>0&&e.push(r);return tn(e)}i(k,"nameList");function on(n){if(n===null)return null;if(typeof n=="string"||typeof n=="boolean"||typeof n=="number"&&Number.isFinite(n))return n}i(on,"jsonPrimitive");function sn(n){return typeof n=="string"&&rn.has(n)?n:"singleton"}i(sn,"closedLifetime");function L(n){if(n===null||typeof n!="object"||Array.isArray(n))return;let e={};for(let r of Object.keys(n).sort(E)){if(r.length===0)continue;let t=on(n[r]);t!==void 0&&(e[r]=t)}return Object.keys(e).length>0?e:void 0}i(L,"sanitizeMetadata");function un(n){if(n===null||typeof n!="object"||Array.isArray(n))return;let e=n,r={};typeof e.label=="string"&&e.label.length>0&&(r.label=e.label),typeof e.architectureKind=="string"&&e.architectureKind.length>0&&(r.architectureKind=e.architectureKind);let t=k(e.tags);t.length>0&&(r.tags=t),typeof e.group=="string"&&e.group.length>0&&(r.group=e.group);let s=L(e.metadata);return s&&(r.metadata=s),Object.keys(r).length>0?r:void 0}i(un,"sanitizeArkRunExtendedInfo");function an(n){if(n===null||typeof n!="object"||Array.isArray(n))return;let e=n,r=typeof e.id=="string"?e.id.trim():"";if(!r)return;let t={id:r,lifetime:sn(e.lifetime),uses:k(e.uses),reactsTo:k(e.reactsTo),raises:k(e.raises),sends:k(e.sends)},s=un(e.extendedInfo);return s&&(t.extendedInfo=s),t}i(an,"sanitizeArkRunComponent");var cn=new Set(en);function dn(n){return L(n)}i(dn,"sanitizeTapePayload");function U(n){if(n===null||typeof n!="object"||Array.isArray(n))return;let e=n,r=typeof e.xiHash=="string"?e.xiHash.trim():"";if(!r)return;let t=e.event;if(t===null||typeof t!="object"||Array.isArray(t))return;let s=t,u=typeof s.kind=="string"?s.kind.trim():"";if(!u)return;let a=e.residual;if(a===null||typeof a!="object"||Array.isArray(a))return;let o=a,c=typeof o.kind=="string"&&cn.has(o.kind)?o.kind:void 0;if(!c)return;let d={kind:u},p=dn(s.payload);p&&(d.payload=p);let w={kind:c};return typeof o.reasonCode=="string"&&o.reasonCode.length>0&&(w.reasonCode=o.reasonCode),typeof o.eventId=="string"&&o.eventId.length>0&&(w.eventId=o.eventId),typeof o.target=="string"&&o.target.length>0&&(w.target=o.target),{xiHash:r,event:d,residual:w}}i(U,"sanitizeDecisionTapeRecord");function pn(n){if(!Array.isArray(n))return[];let e=[];for(let r of n){let t=U(r);t&&e.push(t)}return e}i(pn,"sanitizeDecisionTape");function R(n){let e=typeof n.kernelInstanceId=="string"?n.kernelInstanceId:"",r=Array.isArray(n.components)?n.components:[],t=new Set,s=[];for(let a of r){let o=an(a);!o||t.has(o.id)||(t.add(o.id),s.push(o))}s.sort((a,o)=>E(a.id,o.id));let u=pn(n.decisionTape);return{schemaVersion:"1.0",kernelInstanceId:e,components:s,...u.length>0?{decisionTape:u}:{}}}i(R,"buildDependencyInformationPackage");function Yn(n,e){let r=U(e),t=n.decisionTape??[],s=r?[...t,r]:[...t];return{schemaVersion:n.schemaVersion,kernelInstanceId:n.kernelInstanceId,components:n.components,...s.length>0?{decisionTape:s}:{}}}i(Yn,"appendDecisionTape");var fn="1.0",ln="process",gn=["process","technical"],ee=["component","interaction"],re=["raises","reactsTo","sends"],te=["uses"],l=class extends Error{static{i(this,"InvalidArkRunGraphQueryError")}option;constructor(e,r){super(r??(e==="slice"?'ArkRun graph slice must be "process" or "technical".':e==="degreesOfSeparation"?"ArkRun graph degreesOfSeparation must be a non-negative integer.":`ArkRun graph ${e} is not a closed query.`)),this.name="InvalidArkRunGraphQueryError",this.option=e}},kn=new Set(gn),Rn=new Set(["slice","nodeIds","degreesOfSeparation","include","exclude"]),An=new Set(["ids","labels","tags","groups","architectureKinds"]);function y(n,e){return n<e?-1:n>e?1:0}i(y,"compare");function C(n){return[...new Set(n)].sort(y)}i(C,"uniqueSorted");function H(){return{tokens:[],ids:[],labels:[],tags:[],groups:[],architectureKinds:[]}}i(H,"emptyMatch");function T(n){return n.tokens.length+n.ids.length+n.labels.length+n.tags.length+n.groups.length+n.architectureKinds.length>0}i(T,"matchHasCriteria");function f(n,e){if(n==null||n==="")return[];if(typeof n=="string")return C(n.split(",").map(t=>t.trim()).filter(t=>t.length>0));if(!Array.isArray(n))throw new l(e);let r=[];for(let t of n){if(typeof t!="string")throw new l(e);let s=t.trim();s.length>0&&r.push(s)}return C(r)}i(f,"nameList");function V(n,e){if(e==="*")return n.length>0;if(!e.includes("*"))return n===e;let r="^";for(let t of e)t==="*"?r+=".*":/[.*+?^${}()|[\]\\]/.test(t)?r+=`\\${t}`:r+=t;return r+="$",new RegExp(r).test(n)}i(V,"globMatch");function A(n,e){return n?e.some(r=>V(n,r)):!1}i(A,"anyGlob");function j(n){if(n==null||n==="")return ln;if(typeof n=="string"&&kn.has(n))return n;throw new l("slice")}i(j,"closedSlice");function W(n){if(n==null||n==="")return null;if(typeof n=="string"&&/^(0|[1-9]\d*)$/.test(n))return Number(n);if(typeof n=="number"&&Number.isInteger(n)&&n>=0)return n;throw new l("degreesOfSeparation")}i(W,"closedDegrees");function F(n,e){if(n==null||n==="")return H();if(typeof n=="string"||Array.isArray(n))return{...H(),tokens:f(n,e)};if(typeof n!="object")throw new l(e);let r=n;for(let t of Object.keys(r))if(!An.has(t))throw new l(e);return{tokens:[],ids:f(r.ids,e),labels:f(r.labels,e),tags:f(r.tags,e),groups:f(r.groups,e),architectureKinds:f(r.architectureKinds,e)}}i(F,"closedMatch");function Q(n={}){if(n==null||n==="")return Q({});if(typeof n!="object"||Array.isArray(n))throw new l("slice","ArkRun graph query must be an object.");let e=n;for(let r of Object.keys(e))if(!Rn.has(r))throw new l("slice",`ArkRun graph query key "${r}" is not closed.`);return{slice:j(e.slice),nodeIds:f(e.nodeIds,"nodeIds"),degreesOfSeparation:W(e.degreesOfSeparation),include:F(e.include,"include"),exclude:F(e.exclude,"exclude")}}i(Q,"closeArkRunGraphQuery");function oe(n){let e={};n.slice&&(e.slice=j(n.slice));let r=f(n.nodeIds??void 0,"nodeIds");r.length>0&&(e.nodeIds=r);let t=W(n.degreesOfSeparation??void 0);t!==null&&(e.degreesOfSeparation=t);let s=f(n.include??void 0,"include");s.length>0&&(e.include=s);let u=f(n.exclude??void 0,"exclude");return u.length>0&&(e.exclude=u),e}i(oe,"arkRunGraphQueryFromSearchParams");function mn(n){let e=[n.id];return n.label&&e.push(n.label),n.group&&e.push(n.group),n.architectureKind&&e.push(n.architectureKind),n.tags&&e.push(...n.tags),e}i(mn,"nodeFields");function $(n,e){if(!T(e))return!0;let r=mn(n);return e.tokens.some(t=>r.some(s=>V(s,t)))||A(n.id,e.ids)||A(n.label,e.labels)||n.tags?.some(t=>A(t,e.tags))||A(n.group,e.groups)?!0:A(n.architectureKind,e.architectureKinds)}i($,"nodeMatches");function yn(n){if(n&&typeof n=="object"&&!Array.isArray(n)){let e=n;return R({kernelInstanceId:e.kernelInstanceId,components:e.components})}return R({})}i(yn,"asPackage");function hn(n){let e={id:n.id,kind:"component",lifetime:n.lifetime},r=n.extendedInfo;return r?.label&&(e.label=r.label),r?.group&&(e.group=r.group),r?.architectureKind&&(e.architectureKind=r.architectureKind),r?.tags&&r.tags.length>0&&(e.tags=[...r.tags]),e}i(hn,"componentNode");function S(n){return{id:n,kind:"interaction"}}i(S,"interactionNode");function m(n,e){let r=n.get(e.id);(!r||r.kind==="interaction"&&e.kind==="component")&&n.set(e.id,e)}i(m,"addNode");function _(n,e,r,t,s){let u=`${r}\0${s}\0${t}`;e.has(u)||(e.add(u),n.push({from:r,to:t,kind:s}))}i(_,"addEdge");function bn(n,e){let r=new Map,t=[],s=new Set;for(let u of n){if(m(r,hn(u)),e==="technical"){for(let a of u.uses)m(r,r.get(a)??S(a)),_(t,s,u.id,a,"uses");continue}for(let a of u.raises)m(r,r.get(a)??S(a)),_(t,s,u.id,a,"raises");for(let a of u.reactsTo)m(r,r.get(a)??S(a)),_(t,s,a,u.id,"reactsTo");for(let a of u.sends)m(r,r.get(a)??S(a)),_(t,s,u.id,a,"sends")}return{nodes:r,edges:t}}i(bn,"buildSlice");function In(n){let e=new Map,r=i((t,s)=>{let u=e.get(t);u?u.push(s):e.set(t,[s])},"push");for(let t of n)r(t.from,t.to),r(t.to,t.from);return e}i(In,"adjacency");function wn(n,e,r,t){let s=e.filter(o=>n.has(o));if(s.length===0)return new Set;let u=new Set,a=s.map(o=>({id:o,depth:0}));for(;a.length>0;){let o=a.shift();if(!(!o||u.has(o.id))&&(u.add(o.id),!(r!==null&&o.depth>=r)))for(let c of t.get(o.id)??[])!u.has(c)&&n.has(c)&&a.push({id:c,depth:o.depth+1})}return u}i(wn,"neighborhood");function h(n){let e=n.replace(/[^A-Za-z0-9_]/g,"_");return/^[A-Za-z_]/.test(e)?e:`n_${e}`}i(h,"mermaidSafeId");function B(n){return n.replace(/\\/g,"\\\\").replace(/"/g,"#quot;").replace(/]/g,"#93;")}i(B,"mermaidLabel");function Sn(n){let e=new Set,r=new Map;for(let t of n){let s=h(t),u=s,a=2;for(;e.has(u);)u=`${s}_${a}`,a+=1;e.add(u),r.set(t,u)}return r}i(Sn,"uniqueMermaidIds");function _n(n){let e=n.slice==="technical"?"TD":"LR",r=n.nodes.map(o=>o.id),t=Sn(r),s=C(n.nodes.map(o=>o.group).filter(o=>!!o)),u=[`flowchart ${e}`],a=i((o,c)=>{let d=t.get(o.id)??h(o.id),p=B(o.label??o.id);u.push(`${c}${d}["${p}"]`)},"emitNode");for(let o of s){let c=h(`group_${o}`);u.push(` subgraph ${c}["${B(o)}"]`);for(let d of n.nodes)d.group===o&&a(d," ");u.push(" end")}for(let o of n.nodes)o.group||a(o," ");for(let o of n.edges){let c=t.get(o.from)??h(o.from),d=t.get(o.to)??h(o.to);u.push(` ${c} -->|${o.kind}| ${d}`)}return u.join(`
2
+ `)}i(_n,"formatArkRunGraphMermaid");function xn(n,e,r){let t=new Set(n.keys());if(T(r.include)&&(t=new Set([...t].filter(o=>{let c=n.get(o);return c!==void 0&&$(c,r.include)}))),T(r.exclude))for(let o of[...t]){let c=n.get(o);c&&$(c,r.exclude)&&t.delete(o)}let s=e.filter(o=>t.has(o.from)&&t.has(o.to));r.nodeIds.length>0&&(t=wn(t,r.nodeIds,r.degreesOfSeparation,In(s)));let u=[...t].sort(y).map(o=>n.get(o)).filter(o=>!!o),a=s.filter(o=>t.has(o.from)&&t.has(o.to)).sort((o,c)=>y(o.from,c.from)||y(o.kind,c.kind)||y(o.to,c.to));return{nodes:u,edges:a}}i(xn,"filterGraph");function se(n={},e={}){let r=yn(n),t=Q(e),s=bn(r.components,t.slice),u=xn(s.nodes,s.edges,t),a={schemaVersion:fn,kernelInstanceId:r.kernelInstanceId,slice:t.slice,query:t,nodes:u.nodes,edges:u.edges,mermaid:""};return a.mermaid=_n(a),a}i(se,"requestArkRunGraph");var O=["local","localBlocking","broker"],z=!0,Nn=new Set(O),x=class extends Error{static{i(this,"InvalidArkRunSendOptionError")}option;constructor(e){super(e==="transport"?'ArkRun transport must be "local", "localBlocking", or "broker".':"ArkRun ephemeral must be a boolean."),this.name="InvalidArkRunSendOptionError",this.option=e}};function En(n){if(n===void 0)return"local";if(typeof n=="string"&&Nn.has(n))return n;throw new x("transport")}i(En,"closedArkRunTransportKind");function Cn(n){if(n===void 0)return!0;if(n===!0||n===!1)return n;throw new x("ephemeral")}i(Cn,"closedArkRunEphemeral");function ae(n){let e=En(n.transport),r=Cn(n.ephemeral),t=e==="broker"&&n.brokerBound!==!0,s=e==="broker"&&!t?"broker":"local",u=e==="localBlocking";return{transport:e,ephemeral:r,deliveredVia:s,fallbackToLocal:t,notifySubscribers:s==="local",awaitHandlers:u,awaitHandoff:r||u}}i(ae,"resolveArkRunSendPlan");var Tn="1.0",q="127.0.0.1",On=0,le="/snapshot",ge="/events",ke="/graph",Re="/outbox",Ae="/workflows",Kn="snapshot",Mn="in-process-local",b=32;var P=class extends Error{static{i(this,"ArkRunInspectorProductionError")}constructor(){super("ArkRun inspector refuses to start when NODE_ENV=production."),this.name="ArkRunInspectorProductionError"}},I=class extends Error{static{i(this,"ArkRunInspectorBindError")}constructor(e){super(`ArkRun inspector binds loopback only (default 127.0.0.1). Public host "${e}" is rejected.`),this.name="ArkRunInspectorBindError"}},Pn=new Set(["","*","0","0.0.0.0","::","::0","[::]","[::0]","::ffff:0.0.0.0","[::ffff:0.0.0.0]"]);function J(n){return n==="production"}i(J,"isArkRunInspectorProductionEnv");function Gn(n){let e=n.split(".");if(e.length!==4)return;let r=[];for(let t of e){if(!/^\d{1,3}$/.test(t))return;let s=Number(t);if(s>255)return;r.push(s)}return r}i(Gn,"ipv4Octets");function X(n){if(n.startsWith("[::ffff:")&&n.endsWith("]"))return n.slice(8,-1);if(n.startsWith("::ffff:"))return n.slice(7)}i(X,"unwrapIpv4Mapped");function Y(n){if(typeof n!="string")return!1;let e=n.trim().toLowerCase();if(e==="localhost"||e==="::1"||e==="[::1]")return!0;let r=X(e);if(r)return Y(r);let t=Gn(e);return t!==void 0&&t[0]===127}i(Y,"isArkRunInspectorLoopbackHost");function Z(n){if(n===void 0)return q;if(typeof n!="string")throw new I(String(n));let e=n.trim();if(Pn.has(e.toLowerCase())||!Y(e))throw new I(e);let r=e.toLowerCase();if(r==="localhost")return q;if(r==="[::1]")return"::1";let t=X(r);return t?Z(t):r}i(Z,"closedHost");function Dn(n){if(n===void 0)return On;if(typeof n!="number"||!Number.isInteger(n)||n<0||n>65535)throw new I(`port:${String(n)}`);return n}i(Dn,"closedPort");function Ln(n={}){if(J(n.nodeEnv)||J(n.processNodeEnv))throw new P;return{host:Z(n.host),port:Dn(n.port)}}i(Ln,"resolveArkRunInspectorBind");function me(n,e,r){return`http://${n.includes(":")?`[${n}]`:n}:${e}${r}`}i(me,"arkRunInspectorUrl");function Un(n){if(n!==void 0)try{return JSON.parse(JSON.stringify(n))}catch{return}}i(Un,"jsonClone");function Hn(n){return{kinds:[...O],ephemeralDefault:n.ephemeralDefault===!1?!1:!0,brokerBound:n.brokerBound===!0,cloudSdksShipped:!1,fallback:Mn}}i(Hn,"closedTransportFacts");function g(n){if(!(!n||typeof n!="object"||Array.isArray(n)))return n}i(g,"asRecord");function Fn(n){let e=g(n);if(!e||typeof e.id!="string")return;let r=e.status;if(r!=="pending"&&r!=="failed")return;let t=g(e.event),s=t&&typeof t.intent=="string"?t.intent:typeof e.intent=="string"?e.intent:void 0,u={id:e.id,status:r,attempts:typeof e.attempts=="number"&&Number.isFinite(e.attempts)?e.attempts:0};return s&&(u.intent=s),typeof e.error=="string"&&e.error.length>0&&(u.error=e.error),typeof e.updatedAt=="string"&&(u.updatedAt=e.updatedAt),u}i(Fn,"closedOutboxSummary");function N(n){if(typeof n!="number"||!Number.isFinite(n))return b;let e=Math.trunc(n);return e<0?0:e>b?b:e}i(N,"closedSampleLimit");function $n(n,e){let r=typeof n=="string"&&n.trim().length>0?n.trim():n&&typeof n=="object"&&"constructor"in n?String(n.constructor?.name??e):e,t=/^InMemory/i.test(r)?"memory":"durable";return{role:e,id:r,kind:t}}i($n,"classifyArkRunInspectorStoreDurability");function Bn(n={}){let e=g(n),r=g(e?.durability)??e,t=Array.isArray(r?.stores)?r.stores:Array.isArray(e?.stores)?e.stores:[],s=[];for(let u of t){let a=g(u);if(!a)continue;let o=a.role;if(o!=="outbox"&&o!=="audit"&&o!=="workflow")continue;let c=typeof a.id=="string"?a.id:typeof a.name=="string"?a.name:void 0;if(!c)continue;let d=a.kind==="memory"||a.kind==="durable"?a.kind:$n(c,o).kind;s.push({role:o,id:c,kind:d})}return{durability:{stores:s}}}i(Bn,"buildArkRunInspectorHardening");function Vn(n=[],e={}){let r=N(e.sampleLimit),t=Array.isArray(n)?n:[],s=[],u=[];for(let a of t){let o=Fn(a);o&&(o.status==="pending"?s.push(o):u.push(o))}return{available:!0,pendingCount:s.length,failedCount:u.length,pending:s.slice(0,r),failed:u.slice(0,r),sampleLimit:r}}i(Vn,"buildArkRunInspectorOutboxMonitor");function K(){return{available:!1,pendingCount:0,failedCount:0,pending:[],failed:[],sampleLimit:b}}i(K,"unavailableArkRunInspectorOutboxMonitor");function jn(n){let e=g(n);if(!e||typeof e.id!="string")return;let r=typeof e.workflowName=="string"?e.workflowName:typeof e.name=="string"?e.name:void 0;if(!r)return;let t={id:e.id,name:r,status:typeof e.status=="string"?e.status:"unknown"};return typeof e.currentStep=="string"&&(t.currentStep=e.currentStep),typeof e.error=="string"&&e.error.length>0&&(t.error=e.error),t}i(jn,"closedWorkflowSummary");function Wn(n){return n==="idle"||n==="waiting"}i(Wn,"isPendingWorkflowStatus");function Qn(n=[],e={}){let r=N(e.sampleLimit),t=Array.isArray(n)?n:[],s=[],u=0,a=0,o=0,c=0;for(let d of t){let p=jn(d);p&&(s.push(p),p.status==="running"?u+=1:p.status==="compensating"?a+=1:p.status==="failed"?o+=1:Wn(p.status)&&(c+=1))}return{available:!0,total:s.length,runningCount:u,compensatingCount:a,failedCount:o,pendingCount:c,workflows:s.slice(0,r),sampleLimit:r}}i(Qn,"buildArkRunInspectorWorkflowsMonitor");function M(){return{available:!1,total:0,runningCount:0,compensatingCount:0,failedCount:0,pendingCount:0,workflows:[],sampleLimit:b}}i(M,"unavailableArkRunInspectorWorkflowsMonitor");function zn(n){if(n===void 0)return;let e=g(n);if(!e||e.available===!1)return K();let r=N(e.sampleLimit);if(Array.isArray(e.pending)||Array.isArray(e.failed)||Array.isArray(e.records)){let t=[...Array.isArray(e.pending)?e.pending:[],...Array.isArray(e.failed)?e.failed:[],...Array.isArray(e.records)?e.records:[]],s=Vn(t,{sampleLimit:r}),u=typeof e.pendingCount=="number"&&Number.isFinite(e.pendingCount)?Math.max(0,Math.trunc(e.pendingCount)):s.pendingCount,a=typeof e.failedCount=="number"&&Number.isFinite(e.failedCount)?Math.max(0,Math.trunc(e.failedCount)):s.failedCount;return{...s,pendingCount:u,failedCount:a,sampleLimit:r}}return K()}i(zn,"closedOutboxMonitor");function qn(n){if(n===void 0)return;let e=g(n);if(!e||e.available===!1)return M();let r=N(e.sampleLimit);if(Array.isArray(e.workflows)){let t=Qn(e.workflows,{sampleLimit:r}),s=typeof e.total=="number"&&Number.isFinite(e.total)?Math.max(0,Math.trunc(e.total)):t.total,u=typeof e.runningCount=="number"&&Number.isFinite(e.runningCount)?Math.max(0,Math.trunc(e.runningCount)):t.runningCount,a=typeof e.compensatingCount=="number"&&Number.isFinite(e.compensatingCount)?Math.max(0,Math.trunc(e.compensatingCount)):t.compensatingCount,o=typeof e.failedCount=="number"&&Number.isFinite(e.failedCount)?Math.max(0,Math.trunc(e.failedCount)):t.failedCount,c=typeof e.pendingCount=="number"&&Number.isFinite(e.pendingCount)?Math.max(0,Math.trunc(e.pendingCount)):t.pendingCount;return{...t,total:s,runningCount:u,compensatingCount:a,failedCount:o,pendingCount:c,sampleLimit:r}}return M()}i(qn,"closedWorkflowsMonitor");function ye(n={}){let e=Ln({host:n.host,port:n.port}),r=R({kernelInstanceId:n.kernelInstanceId,components:n.package&&typeof n.package=="object"&&!Array.isArray(n.package)&&Array.isArray(n.package.components)?n.package.components:[]}),t=zn(n.outbox),s=qn(n.workflows),u={schemaVersion:Tn,kernelInstanceId:typeof n.kernelInstanceId=="string"?n.kernelInstanceId:r.kernelInstanceId,bind:{host:e.host,port:e.port,loopback:!0},package:{...r,schemaVersion:"1.0"},transport:Hn(n),observability:Un(n.observability)??{},hardening:Bn(n.hardening)};return t&&(u.outbox=t),s&&(u.workflows=s),u}i(ye,"buildArkRunInspectorSnapshot");function he(n){return`event: ${Kn}
3
+ data: ${JSON.stringify(n)}
4
+
5
+ `}i(he,"formatArkRunInspectorSseEvent");export{i as a,Jn as b,D as c,nn as d,an as e,R as f,Yn as g,fn as h,ln as i,gn as j,ee as k,re as l,te as m,l as n,Q as o,oe as p,_n as q,se as r,O as s,z as t,x as u,En as v,Cn as w,ae as x,Tn as y,q as z,On as A,le as B,ge as C,ke as D,Re as E,Ae as F,Kn as G,Mn as H,b as I,P as J,I as K,J as L,Y as M,Ln as N,me as O,$n as P,Bn as Q,Vn as R,K as S,Qn as T,M as U,ye as V,he as W};
@@ -60,7 +60,8 @@ type ArkConfigRule = {
60
60
  sliceFolders?: string[];
61
61
  /**
62
62
  * How a starred `sliceFolders` prefix is named.
63
- * Absent and `path` keep today's ids. `stars` is the last literal plus the star bindings.
63
+ * Absent and `path` keep today's ids. `stars` is the last literal plus every
64
+ * star binding (a star before the last literal is kept too).
64
65
  */
65
66
  sliceIdentity?: ArkConfigSliceIdentity;
66
67
  /** Roots the repo declares shared on purpose — evidence, not unclassifiable. */
@@ -71,8 +72,10 @@ type ArkConfigRule = {
71
72
  * `"deny"` blocks a shared root from importing a slice.
72
73
  * `"deny-cross-parent"` leaves that hop allowed and asks the whole-graph
73
74
  * check to report a slice that reaches another universe through shared.
75
+ * The object form carries `stopAt`: composition roots the walk never
76
+ * passes through.
74
77
  */
75
- sharedImportsSlice?: 'deny' | 'deny-cross-parent';
78
+ sharedImportsSlice?: ArkConfigSharedImportsSlice;
76
79
  /**
77
80
  * Optional inner wall. Absent keeps today's universe-wall output.
78
81
  * `siblings` defaults to deny. An object keeps that default and lists enforced subtrees.
@@ -80,15 +83,27 @@ type ArkConfigRule = {
80
83
  */
81
84
  childSlices?: ArkConfigChildSlices;
82
85
  };
86
+ type ArkConfigSharedImportsSlice = 'deny' | 'deny-cross-parent' | {
87
+ mode: 'deny-cross-parent';
88
+ stopAt: string[];
89
+ };
83
90
  type ArkConfigChildSlices = {
84
91
  sliceFolders: string[];
85
92
  sliceIdentity?: ArkConfigSliceIdentity;
86
93
  commonFolders?: string[];
94
+ /**
95
+ * `ratchet` on the object form: absent turns the anti-growth ratchet on only
96
+ * when the baseline already records an advisory crossing of this rule;
97
+ * `true` always; `false` measures only.
98
+ */
87
99
  siblings?: 'deny' | 'advisory' | {
88
100
  default: 'deny' | 'advisory';
89
101
  enforce?: string[];
102
+ ratchet?: boolean;
90
103
  };
91
104
  parentMayImportChild?: boolean;
105
+ /** Text for inner-wall findings (sibling, common → child). Absent: ArkGate default, never the rule message. */
106
+ message?: string;
92
107
  /**
93
108
  * Directed child-slice allowances. `*` is one whole path segment.
94
109
  * Clears a sibling crossing only. The universe `allowedCrossSlice` does not read this list.
@@ -228,4 +243,4 @@ type ArkConfigLoadResult = {
228
243
  migratedFrom: ArkConfigMigratedFrom;
229
244
  };
230
245
 
231
- export type { ArkConfig as A, ArkConfigRule as a, ArkConfigSchemaVersion as b, ArkConfigLoadResult as c, ArkConfigIssue as d, ArkConfigArkRun as e, ArkConfigLayer as f, ArkConfigArkOrder as g };
246
+ export type { ArkConfig as A, ArkConfigRule as a, ArkConfigSchemaVersion as b, ArkConfigLoadResult as c, ArkConfigLayer as d, ArkConfigIssue as e, ArkConfigArkRun as f, ArkConfigArkOrder as g };