arkgate 4.8.24 → 4.8.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +85 -0
- package/README.md +2 -2
- package/bin/ark-check-runtime.mjs +17 -14
- package/bin/ark-layer-match.mjs +115 -13
- package/bin/ark-mcp-runtime.mjs +36 -31
- package/bin/ark-shared.mjs +4 -23
- package/bin/lib/adoption-stance.mjs +2 -2
- package/bin/lib/adr-path.mjs +3 -3
- package/bin/lib/agent-gates.mjs +0 -61
- package/bin/lib/agent-homes.mjs +12 -21
- package/bin/lib/agent-projection-command.mjs +4 -4
- package/bin/lib/ambient-state.mjs +9 -30
- package/bin/lib/analysis-engine.mjs +14 -14
- package/bin/lib/architecture-scan.mjs +11 -9
- package/bin/lib/ark-order-doctor.mjs +3 -28
- package/bin/lib/ark-order-facts.mjs +6 -99
- package/bin/lib/ark-order-types.mjs +1 -2
- package/bin/lib/ark-run-doctor.mjs +3 -28
- package/bin/lib/ark-run-facts.mjs +30 -40
- package/bin/lib/ark-run-sensors.mjs +1 -1
- package/bin/lib/arkrule-file-hints.mjs +2 -47
- package/bin/lib/arkrules-contract.mjs +124 -133
- package/bin/lib/arkrules-sensors.mjs +7 -5
- package/bin/lib/check-args.mjs +63 -1
- package/bin/lib/ci-and-commands.mjs +8 -72
- package/bin/lib/ci-merge-boundary.mjs +1 -1
- package/bin/lib/class-source-scan.mjs +5 -5
- package/bin/lib/clone-detection.mjs +474 -0
- package/bin/lib/codex-home.mjs +1 -1
- package/bin/lib/config-contract-slices.mjs +44 -6
- package/bin/lib/config-contract.mjs +40 -117
- package/bin/lib/config-extras.mjs +16 -22
- package/bin/lib/contract-smells.mjs +33 -15
- package/bin/lib/core-ratchet.mjs +0 -2
- package/bin/lib/dashboard-cli.mjs +2 -2
- package/bin/lib/deep-module-coach.mjs +2 -4
- package/bin/lib/deploy-path.mjs +13 -38
- package/bin/lib/design-smells.mjs +2 -2
- package/bin/lib/diagnostic-catalog.mjs +8 -1
- package/bin/lib/doctor-advisories.mjs +55 -9
- package/bin/lib/doctor-green-cite.mjs +1 -1
- package/bin/lib/doctor-human.mjs +1 -1
- package/bin/lib/doctor-next-actions.mjs +2 -2
- package/bin/lib/doctor-plan.mjs +4 -6
- package/bin/lib/duplication-io.mjs +572 -0
- package/bin/lib/effective-contract-load.mjs +181 -44
- package/bin/lib/entry-points-io.mjs +424 -0
- package/bin/lib/extra-merge-teeth.mjs +36 -0
- package/bin/lib/field-install.mjs +38 -14
- package/bin/lib/first-run-help.mjs +7 -3
- package/bin/lib/flat-parent-importers.mjs +5 -3
- package/bin/lib/gate-files.mjs +30 -89
- package/bin/lib/github-enforcement.mjs +165 -28
- package/bin/lib/golden-pattern.mjs +1 -1
- package/bin/lib/hook-templates.mjs +16 -16
- package/bin/lib/html-report-advisories.mjs +4 -0
- package/bin/lib/html-report-depth.mjs +2 -2
- package/bin/lib/html-report.mjs +2 -2
- package/bin/lib/import-graph-projection.mjs +112 -0
- package/bin/lib/improvement-compass-doctor.mjs +1 -24
- package/bin/lib/invariant-coverage-io.mjs +4 -3
- package/bin/lib/invariant-coverage.mjs +26 -0
- package/bin/lib/invariant-probe-cli.mjs +347 -0
- package/bin/lib/invariant-probe-io.mjs +165 -0
- package/bin/lib/invariant-probe-runner.mjs +268 -0
- package/bin/lib/invariant-probe-sites.mjs +174 -0
- package/bin/lib/invariant-probe-workspace.mjs +183 -0
- package/bin/lib/invariant-probe.mjs +461 -0
- package/bin/lib/invariant-tests-path.mjs +16 -22
- package/bin/lib/literal-path-drift.mjs +4 -2
- package/bin/lib/managed-upgrade.mjs +2 -8
- package/bin/lib/mcp-adoption.mjs +4 -5
- package/bin/lib/mcp-hook-payload.mjs +4 -4
- package/bin/lib/orphan-modules-io.mjs +458 -0
- package/bin/lib/orphan-modules.mjs +251 -0
- package/bin/lib/outside-importers.mjs +197 -0
- package/bin/lib/package-manager.mjs +3 -3
- package/bin/lib/parse-health.mjs +1 -1
- package/bin/lib/persistence-write-hint.mjs +33 -8
- package/bin/lib/pin-dependent-gates.mjs +2 -2
- package/bin/lib/policy-delta-io.mjs +55 -8
- package/bin/lib/post-green-path.mjs +1 -1
- package/bin/lib/prepare-change.mjs +3 -9
- package/bin/lib/prepare-write.mjs +1 -2
- package/bin/lib/presets.mjs +56 -68
- package/bin/lib/product-copy.mjs +1 -6
- package/bin/lib/project-root.mjs +31 -62
- package/bin/lib/resolved-candidate-facts.mjs +90 -62
- package/bin/lib/rules-under-contract.mjs +72 -8
- package/bin/lib/scan-files.mjs +4 -4
- package/bin/lib/schema-validation.mjs +130 -0
- package/bin/lib/sensor-promote-cli.mjs +2 -11
- package/bin/lib/sensor-promote-io.mjs +33 -22
- package/bin/lib/sensor-promotion.mjs +1 -1
- package/bin/lib/skill-catalog-apply.mjs +1 -1
- package/bin/lib/skill-install.mjs +42 -38
- package/bin/lib/snippet-analysis.mjs +1 -1
- package/bin/lib/start-install-recovery.mjs +1 -1
- package/bin/lib/start-preview.mjs +1 -1
- package/bin/lib/states-transitions-presence.mjs +3 -3
- package/bin/lib/status-command.mjs +2 -18
- package/bin/lib/status-manifest.mjs +18 -26
- package/bin/lib/status-transition-catalog.mjs +0 -6
- package/bin/lib/suggestions.mjs +3 -3
- package/bin/lib/team-parliament-io.mjs +3 -17
- package/bin/lib/team-parliament.mjs +15 -9
- package/bin/lib/upgrade-behavior-changes.mjs +2 -2
- package/bin/lib/upgrade-command.mjs +2 -24
- package/bin/lib/upgrade-outcome.mjs +1 -1
- package/bin/lib/upstream-report.mjs +21 -10
- package/bin/lib/violations.mjs +10 -9
- package/bin/lib/weakest-link.mjs +13 -0
- package/bin/lib/write-path-capabilities.mjs +2 -2
- package/dist/chunk-AHACEKSV.js +16 -0
- package/dist/chunk-UN5EH4QV.cjs +16 -0
- package/dist/{configTypes-BJbaeoj4.d.cts → configTypes-GPvvdleM.d.cts} +12 -1
- package/dist/{configTypes-BJbaeoj4.d.ts → configTypes-GPvvdleM.d.ts} +12 -1
- package/dist/eslint/index.cjs +11 -11
- package/dist/eslint/index.d.cts +10 -1
- package/dist/eslint/index.d.ts +10 -1
- package/dist/eslint/index.js +11 -11
- package/dist/index.cjs +34 -34
- package/dist/index.d.cts +587 -515
- package/dist/index.d.ts +587 -515
- package/dist/index.js +34 -34
- package/dist/nestjs/index.cjs +1 -1
- package/dist/nestjs/index.d.cts +1 -1
- package/dist/nestjs/index.d.ts +1 -1
- package/dist/nestjs/index.js +1 -1
- package/dist/order/index.cjs +1 -1
- package/dist/order/index.js +1 -1
- package/dist/runtime/index.cjs +12 -12
- package/dist/runtime/index.d.cts +174 -136
- package/dist/runtime/index.d.ts +174 -136
- package/dist/runtime/index.js +12 -12
- package/dist/{types-DRinG-vT.d.cts → types-CnauMQQL.d.cts} +33 -25
- package/dist/{types-DRinG-vT.d.ts → types-CnauMQQL.d.ts} +33 -25
- package/docs/README.md +2 -1
- package/docs/agent-guide.md +134 -2
- package/docs/ai-gates.md +15 -1
- package/docs/configuration.md +40 -11
- package/docs/diagnostics.md +118 -2
- package/docs/package-surface.md +4 -1
- package/docs/product-voice.md +7 -1
- package/package.json +11 -2
- package/schemas/ark.config.schema.json +31 -3
- package/schemas/ark.invariant-probe.schema.json +368 -0
- package/server.json +2 -2
- package/templates/agent-skills/README.md +1 -1
- package/templates/agent-skills/ark-adopt/SKILL.md +1 -0
- package/templates/agent-skills/ark-contract/SKILL.md +17 -0
- package/templates/agent-skills/ark-coverage/SKILL.md +2 -0
- package/templates/agent-skills/ark-explore/SKILL.md +7 -0
- package/templates/agent-skills/ark-fix/SKILL.md +20 -0
- package/templates/agent-skills/ark-place/SKILL.md +8 -0
- package/templates/skills/ark-adopt.md +1 -0
- package/templates/skills/ark-contract.md +17 -0
- package/templates/skills/ark-coverage.md +2 -0
- package/templates/skills/ark-explore.md +7 -0
- package/templates/skills/ark-fix.md +20 -0
- package/templates/skills/ark-place.md +8 -0
- package/bin/lib/ark-order-error.mjs +0 -18
- package/bin/lib/ark-order-invariants.mjs +0 -388
- package/bin/lib/stable-hash.mjs +0 -90
- package/dist/chunk-MBXCFLO4.js +0 -16
- package/dist/chunk-RNQHRDCQ.cjs +0 -16
package/dist/runtime/index.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return 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 _chunkRNQHRDCQcjs = require('../chunk-RNQHRDCQ.cjs');var _chunkA5EIY3HIcjs = require('../chunk-A5EIY3HI.cjs');var Mt="docs/diagnostics.md",wo= exports.DIAGNOSTIC_CATALOG_SCHEMA_VERSION ="1.0";function k(e,t,n,r,a,s){return{ruleId:e,title:n,why:r,fix:a,docsAnchor:e,category:t,..._optionalChain([s, 'optionalAccess', _2 => _2.oftenAdvisory])?{oftenAdvisory:!0}:{}}}_chunkA5EIY3HIcjs.a.call(void 0, k,"entry");var dt=Object.freeze([k("LAYER_IMPORT_VIOLATION","layer","This import is not allowed","This file imported a folder it may not reach. The write doesn\u2019t land. The same check fails the pull request.","Branch by import kind: constants/types/pure \u2192 adopt into DomainModel or SharedKernel (do not invent a port); kernel/events/bootstrap from Persistence \u2192 inject a port or move the map to SharedTypes (Persistence must not emit); define a port only when the target is a real use-case. Type-only edges use `import type`. Then preflight again. Do not weaken the layer rule without a hash-bound policy acknowledgement."),k("LAYER_INTENT_REFERENCE_VIOLATION","layer","Intent referenced across a blocked layer edge","A string intent (or intent-like reference) names a layer that the file\u2019s layer may not reach under the contract rules \u2014 the same plane as import edges, for event/intent coupling.","Reference that intent from a layer allowed to know about it (usually an adapter or application layer), or relocate the reference \u2014 then preflight again."),k("LAYER_REFERENCE_VIOLATION","layer","Layer reference blocked (snippet / AI gate)","Snippet analysis found an intent or string reference that would couple layers in a direction the architecture profile forbids.","Move the reference to an allowed layer or introduce a port/event boundary, then re-run the snippet gate."),k("SHARED_IMPORTS_SLICE","layer","A shared root imports a slice",'A declared shared root imports a slice directly. That hop is allowed while sharedImportsSlice is unset or "deny-cross-parent", so this is advisory: the universe wall is direct-only.','Move the code the shared root needs into the shared root, or invert the dependency. Set sharedImportsSlice: "deny" to make these edges errors. With "deny-cross-parent", a slice that reaches another universe through a shared root is reported as LAYER_IMPORT_VIOLATION with reasonId CROSS_PARENT_VIA_SHARED. This warning does not fail the check.',{oftenAdvisory:!0}),k("CIRCULAR_DEPENDENCY","layer","Dependency cycle","Two or more modules import each other in a loop. Cycles make ownership unclear and break stable layer direction.","Extract the shared dependency into a third module, invert one edge behind a port, or merge units that are truly one \u2014 then preflight again."),k("FORBIDDEN_GLOBAL","capability","Forbidden ambient global or dual import","The file\u2019s layer lists this ambient (or its exact import dual, e.g. process / node:process) in forbiddenGlobals. Pure layers must not reach wall-clock, network, process, or similar effects directly.","Inject the capability through a small port (Clock, HttpPort, Config, \u2026), bind the implementation outside the walled layer, then preflight again."),k("CAPABILITY_VIOLATION","capability","Denied effect capability","The layer denies an effect capability (network, filesystem, clock, randomness, environment, process, persistence) and the candidate uses that effect via ambient or import evidence.","Define a capability port in the walled layer, bind the implementation in an adapter layer, then preflight again. Never mechanical-safe \u2014 port shape is a design decision."),k("RAW_EVENT_PUBLISH","publish","Raw event publish","Publish went through a raw string or object instead of a registered intent creator, bypassing Ark intent contracts and tooling.","Publish through a registered intent creator, then run Ark again."),k("PUBLISH_MISSING_SOURCE","publish","Publish missing metadata.source","A strict Ark publish call omitted metadata.source, so the publishing layer cannot be verified.","Add metadata.source to the publish call, then run Ark again."),k("PUBLISH_SOURCE_LAYER_MISMATCH","publish","Publish source layer mismatch","metadata.source resolves to a different layer than the file performing the publish.","Use a source intent owned by the same layer as this file, or move the publish call to the owning layer."),k("UNKNOWN_INTENT","publish","Unknown intent reference","Snippet analysis saw an intent string that is not registered in the intent registry / profile under check.","Register the intent or use a known intent name from the project registry, then re-run the gate."),k("DYNAMIC_IMPORT_NOT_ALLOWLISTED","safety","Non-literal dynamic import","A dynamic import(expr) cannot be resolved statically and the file is not on dynamicImportAllowlist. Unresolved dynamics can hide layer edges.","Rewrite to a static import when possible, or add only reviewed files to dynamicImportAllowlist after human sign-off."),k("DYNAMIC_REQUIRE_NOT_ALLOWLISTED","safety","Non-literal require","A require(expr) cannot be resolved statically and is not allowlisted \u2014 same hide-the-edge risk as dynamic import.","Prefer static import, or allowlist only reviewed files after sign-off."),k("TS_SUPPRESSION_THRESHOLD_EXCEEDED","safety","@ts-ignore / @ts-nocheck threshold","Count of TypeScript suppressions in governed production source exceeds safety.maxTsSuppressions.","Remove suppressions by fixing types, or raise the threshold only with an explicit production exception in ark.config.json."),k("ANY_CAST_THRESHOLD_EXCEEDED","safety","Explicit any cast threshold","Count of explicit any casts exceeds safety.maxAnyCasts.","Replace any with precise types, or raise the threshold only with a documented exception."),k("IN_MEMORY_STORE_IN_PRODUCTION_SOURCE","safety","In-memory store in production source","Governed production source references an Ark InMemory* store without safety.allowInMemory \u2014 durable systems should not ship ephemeral stores by accident.","Provide a durable store implementation, or set safety.allowInMemory only for an explicitly ephemeral service."),k("PEER_ISOLATION_DISABLED","safety","peerIsolation disabled on a rule","A same-layer or peer rule disables peerIsolation (or omits it where required), which allows cross-slice coupling the contract otherwise blocks.","Restore peerIsolation: true, or set safety.allowDisabledPeerIsolation only with a documented production exception."),k("ARKRULE_STRUCTURE","arkrules","ArkRule structure sensor failed","An opt-in ArkRules structure sensor (private state, factory shape, event publish, persistence write outside an aggregate, \u2026) failed on a governed file for a declared arkruleId.","Restore the declared structure for the ArkRule (see arkruleSource), then preflight again. Do not demote the rule without a hash-bound policy acknowledgement."),k("ARKRULE_INVARIANT","arkrules","ArkRule invariant failed","Reserved / remediation-recognized code for invariant-plane failures bound to an ArkRule id (coverage path also emits INVARIANT_UNCOVERED).","Fix the invariant for the ArkRule declared in arkrules/<Layer>.json, then preflight again. Do not demote without acknowledgement."),k("ARKRULE_SCOPE_EMPTY","arkrules","ArkRule appliesTo matched zero files","An ArkRule\u2019s appliesTo globs matched no governed files \u2014 the rule cannot observe what it claims to protect.","Fix appliesTo globs so they match governed files, or remove the rule. Enforced empty scope fails; advisory empty scope warns.",{oftenAdvisory:!0}),k("ARKRULE_HINT_BUDGET_EXHAUSTED","arkrules","Structural-hint budget exhausted","orchestration-only, thin-adapter, and writes-via-aggregate only evaluate files the hint loader preloaded. When eligible governed files exceed that budget (coverage.maxFiles, default 400 \u2014 there is no arkrules.hintBudget), those sensors never saw the rest of their scope. Enforced + unreviewed is not green. The finding names exact hinted/governed counts and per-sensor reviewed N/M of scope.","Raise coverage.maxFiles in ark.config.json (this cap also bounds structural-hint preload; --doctor names the coupling) so hinted/governed counts match, then re-run with --strict-config. An enforced hint sensor that cannot see its scope fails strict."),k("ARKRULE_FILE_UNREFERENCED","arkrules","ArkRules file not referenced","A JSON file under arkrules/ is not referenced by the arkRules map in ark.config.json (or no map exists), so none of its rules are enforced or reported. Drift looks like governance until someone notices.",'Reference the file from arkRules ("<Layer>": "arkrules/<file>.json"), or delete it. Advisory only: it never fails the check.',{oftenAdvisory:!0}),k("INVARIANT_CATALOG_EMPTY","arkrules","Domain invariant catalog is empty","ArkRules is on and a Domain-role layer has code, but invariants[] has no phrases the code must preserve. Empty looks like \u201Cdone\u201D until someone fills the catalog.","Add 1\u20132 short phrases to invariants[] in arkrules/<Domain>.json (or the mapped file). Starters show the shape. Advisory unless a domain structure rule is already enforced \u2014 then --strict-merge can refuse. Do not freeze this finding.",{oftenAdvisory:!0}),k("INVARIANT_UNCOVERED","arkrules","Invariant without coverage evidence","An ArkRules invariant is under contract but no covering test title or declared symbol evidence was found (or coverage is partial). Kind is never-had-tests (adopt residual) vs tests-disappeared (suite exists).","Add a test title or declared symbol covering the arkruleId, then preflight again. Treat never-had-tests as adopt residual; treat tests-disappeared as a regression. Missing test globs report partial \u2014 never fake green. When the message reports an exhausted file budget, raise coverage.maxFiles (or narrow coverage.testGlobs) in ark.config.json."),k("INVARIANT_COVERAGE_OUTSIDE_ROOTS","arkrules","Covering test outside the declared coverage roots","The only test naming this invariant sits outside coverage.coverageRoots \u2014 the places the project declares its runner executes. ArkGate matches declared text and never executes tests, so it cannot tell whether that file is ever run: coverage there is a test that exists, not a test that runs.","Move the test under a declared coverage root, or add its root to coverage.coverageRoots in ark.config.json. Advisory: it never fails strict, but promotion to enforced refuses on it.",{oftenAdvisory:!0}),k("INVARIANT_TESTS_PATH_MISSING","arkrules","Domain-invariant tests path missing under adopted","The project is adopted (required CI or explicit advisory) and has domain invariants that want test evidence, but ark.config.json does not name where those tests live. Green coverage without a real tests path is an empty checkbox.","Add coverage.testGlobs or coverage.coverageRoots in ark.config.json pointing at a real tests folder, then re-run. Adopted mode fails closed until that path is present. Not freezable."),k("INVARIANT_COVERAGE_ROOTS_MISSING","arkrules","Coverage roots missing while an invariant is enforced","A catalogued domain invariant is enforced, but ark.config.json does not name coverage.coverageRoots \u2014 the folders where the project says its test runner actually goes. Without that declaration, INVARIANT_COVERAGE_OUTSIDE_ROOTS cannot fire and coverage can certify a test no runner runs.","Add coverage.coverageRoots in ark.config.json pointing at the folder the test runner uses, then re-run. testGlobs alone is not enough. Fail-closed until that path is present. Not freezable."),k("ARKRUN_MISSING_ROOT","arkrun","No kernel factory in composition roots","The ArkRun extra is on but no kernel factory (createArkKernel / createStrictArkKernel / createLenientArkKernel, their *FromConfig variants, or ArkModule.forRoot / forRootAsync imported from arkgate/nestjs) was found in arkRun.compositionRoots, so agents can skip the kernel while the write gate stays green.","Import createStrictArkKernel from arkgate/runtime (same npm package; @arkgate/runtime is deprecated) and call it in a composition root listed in arkRun.compositionRoots, then preflight again. Never mechanical-safe \u2014 factory placement is a design decision."),k("ARKRUN_KERNEL_IN_DOMAIN","arkrun","Domain-role layer imports the kernel","A Domain-role layer imports arkgate/runtime, arkgate/nestjs, @arkgate/runtime, or kernel types. Domain stays kernel-free; composition roots and adapters own the factory.","Move the kernel import out of the Domain-role layer into a composition root or adapter. Import from arkgate/runtime (same npm package; @arkgate/runtime is deprecated), then preflight again. Never mechanical-safe."),k("ARKRUN_DIRECT_NEW","arkrun","Managed type constructed with new","A managed non-Domain file constructs an admitted type with new outside an ArkRun composition-root factory, skipping kernel resolve/registration.","Resolve the type from the kernel instead of constructing it with new, then preflight again. Never mechanical-safe \u2014 rewiring construction is a design decision."),k("ARKRUN_UNDECLARED_EMIT","arkrun","Emit name not in raises/sends","A publisher / publish / raise / send call on a receiver traced to the kernel names an intent (string literal or same-file define/defineIntent binding) that is not listed in the file\u2019s raises or sends declaration.","Add the existing call-site name to raises or sends on the managed component, then preflight again. Mechanical-safe only when that literal already exists and the edit is the declaration list; inventing a new emit stays judgment."),k("ARKRUN_UNDECLARED_HANDLE","arkrun","Handle name not in reactsTo","A subscribe / registerHandler call on a receiver traced to the kernel names an intent (string literal or same-file define/defineIntent binding) that is not listed in the file\u2019s reactsTo declaration.","Add the existing call-site name to reactsTo on the managed component, then preflight again. Mechanical-safe only when that literal already exists and the edit is the declaration list; inventing a new handle stays judgment."),k("ARKRUN_UNDECLARED_DEPEND","arkrun","Depend name not in uses","A resolve / resolveSingleton call on a receiver traced to the kernel names a component that is not listed in the file\u2019s uses declaration.","Add the existing call-site name to uses on the managed component, then preflight again. Mechanical-safe only when that literal already exists and the edit is the declaration list; inventing a new depend stays judgment."),k("ARKRUN_TRANSPORT_BYPASS","arkrun","Homemade broker or emitter import","A managed layer imports a closed broker/queue/emitter specifier (EventEmitter, queue clients, \u2026) instead of the ArkRun kernel transport.","Send through the ArkRun kernel transport instead of importing that broker or emitter, then preflight again. Never mechanical-safe \u2014 homemade buses stay judgment."),k("ARKORDER_MISSING_PLANE","arkorder","No createOrderPlane in plane roots","The ArkOrder extra is on but no createOrderPlane factory was found in arkOrder.planeRoots, so agents can skip the pattern plane while the write gate stays green.","Import createOrderPlane from arkgate/order and call it in a plane root listed in arkOrder.planeRoots, then preflight again. Never mechanical-safe \u2014 factory placement is a design decision."),k("ARKORDER_KERNEL_IN_DOMAIN","arkorder","Domain-role layer imports the order plane","A Domain-role layer imports arkgate/order. Domain stays plane-free; planeRoots own the factory.","Move the arkgate/order import out of the Domain-role layer into a plane root or adapter, then preflight again. Never mechanical-safe."),k("ARKORDER_GENERIC_UPDATE","arkorder","Generic update of a big product choice","A call to update/patch/set rewrites a named product choice (like billing plan) as if it were a seat count.","Don't use a generic update. First freeze with release(). Later, propose the change, then apply it."),k("ARKORDER_TOO_MANY_PARAMS","arkorder","Too many slow keys","\u03BE has more keys than arkOrder.maxXiKeys. Haken requires a few slow modes, not a dump of microstate.","Cut \u03BE to the slow keys that actually slave the rest, then preflight again. Never mechanical-safe."),k("ARKORDER_INGEST_WRITES_XI","arkorder","ingest assigned into \u03BE","An ingest() result is written into a Release or \u03BE store. ingest may absorb, escalate_up, or hold; it never mints a pattern.","Keep ingest results as absorb/escalate_up/hold only. Change \u03BE with proposeRelease then apply(ProposeResult). Never mechanical-safe."),k("ARKORDER_XI_FIELD_WRITE","arkorder","Big product choice written like a seat count","A use-case writes a named product choice (like billing plan) through a database update. Invoices and seats can flow. That choice cannot.","Keep invoices and seats as events. Change the choice through the valve (proposeRelease then apply), not a generic update."),k("ARKORDER_INFORMATION_BUDGET","arkorder","Projection observes a forbidden kind","h(\u03BE) allowedKinds includes a kind listed in informationBudget.cannotObserve. A scale may not look at what it was told not to see.","Cut that kind from the projector or from cannotObserve, then preflight again. Never mechanical-safe."),k("ARKORDER_XI_TTL","arkorder","Slow key carries a freshness field","\u03BE named ttl/freshUntil/maxAge. Freshness belongs on \u03C3. A slow parameter that expires per transaction is not slow.","Move freshness onto \u03C3 (freshUntil) and keep \u03BE stable, then preflight again. Never mechanical-safe."),k("ARKORDER_STALE_SIGMA","arkorder","\u03C3 is stale","ingest ran after \u03C3.freshUntil (or sigmaMaxAgeMs). \u03BE does not TTL.","Call refreshSigma and ingest again, or proposeRelease then apply(ProposeResult) if the pattern changed. Never mechanical-safe."),k("ARKORDER_UNVALVED_RELEASE","arkorder","Second freeze without the valve","release() already froze the big choice. A later release() with a different value does not land. First freeze is release(); later change is proposeRelease then apply.","Change the choice with proposeRelease then apply. release() is only the first freeze. Never mechanical-safe."),k("ARKORDER_STALE_PROPOSAL","arkorder","Proposal is not bound to the current Release","apply() got a ProposeResult computed against another Release (another apply landed first), one missing its base binding, or one whose reviewed blast radius is not the transition that would commit. The binding is data, not a capability: a proposal that states the current base and the exact transition applies whoever built it.","Run proposeRelease again against the current Release, review the new blast radius, then apply that proposal. Never mechanical-safe."),k("INVALID_CHANGE_PATH","preflight","Unsafe change path","A change set entry is not a safe, non-empty project-relative path (absolute, escape, empty, or NUL).","Use canonical project-relative paths only in the atomic change set, then preflight again."),k("DUPLICATE_CHANGE_PATH","preflight","Duplicate path in change set","The atomic change set lists more than one operation for the same path.","Collapse to one create/update/delete per path, then preflight again."),k("DELETE_TARGET_MISSING","preflight","Delete target missing","A delete operation targets a path that is not present in the supplied base tree.","Remove the delete, or include the file in the base tree facts, then preflight again."),k("CHANGE_SET_EMPTY","preflight","Empty change set","Atomic preflight was invoked with no create, update, or delete operations.","Provide at least one change operation, then preflight again."),k("FACTS_IDENTITY_MISMATCH","preflight","Base/candidate facts identity mismatch","Base and candidate resolved facts disagree on resolver, compiler, evidence requirements, or package identity \u2014 verdicts would not be comparable.","Regenerate both fact snapshots with the same resolver/compiler/evidence requirements, then preflight again."),k("CANDIDATE_DELETE_NOT_APPLIED","preflight","Candidate still contains deleted path","Facts claim a delete, but the candidate tree still includes the path.","Ensure the candidate facts apply the delete (path absent), then preflight again."),k("CANDIDATE_CHANGE_MISSING","preflight","Declared change missing from candidate","The change set declares a create/update whose path is missing from candidate facts.","Include the new content in the candidate facts (or drop the operation), then preflight again."),k("CANDIDATE_CONTENT_HASH_MISMATCH","preflight","Candidate content hash mismatch","The candidate file content hash does not match the hash expected for the declared change.","Rebuild candidate facts from the exact proposed content, then preflight again."),k("UNDECLARED_CANDIDATE_CHANGE","preflight","Undeclared candidate change","Candidate facts differ from base for a path that was not listed in the explicit change set.","Declare every path that changes in the atomic change set, then preflight again."),k("ATOMIC_PREFLIGHT_UNAVAILABLE","preflight","Atomic preflight unavailable","The host/MCP path could not run the atomic preflight engine (missing facts, incomplete setup, or unsupported mode).","Use resolved-candidate facts / ark_prepare_change with a complete batch, or fall back to ark-check on disk. Do not treat missing preflight as green."),k("WRITE_GATE_UNAVAILABLE","preflight","Write gate could not run","The write gate could not load its own inputs (ark.config.json missing, unreadable, or invalid; a referenced ArkRules file missing or invalid; or the built library missing), so it cannot judge this governed source write (existing files included), or a write would leave ark.config.json or a referenced ArkRules file unloadable. No checker, no write: the hook blocks instead of letting the write through unchecked.","Fix the reported input (repair ark.config.json or the ArkRules file, or run `npm run build` / reinstall arkgate from npm), then retry the same write. Do not remove the hook to get past it."),k("DESIGN_SMELL_REGRESSION","preflight","Design smell regression on base-relative ratchet","Compared to the base ref, the candidate introduces a created-path domain-logic-in-ui file under --strict-merge, or introduces or worsens a blocking design-smell class under --fail-on-new-smells.","Move the new UI business rule out of the created file (or revert a --fail-on-new-smells regression), then re-run with the same base ref."),k("ANALYSIS_PARSE_INCOMPLETE","analysis","Parse incomplete","Governed source could not be fully parsed; evidence includes the TypeScript diagnostic (line + message). Incremental mid-edit parse is normal for agents. Contract exclude paths skip the write hook.","Finish the source or fix the reported syntax error, then re-run `npx arkgate-check`. The write hook does not deny solely on mid-edit parse. Partial never means pass."),k("LEXICAL_EVIDENCE_INCOMPLETE","analysis","Lexical evidence incomplete","This check only saw one file, so it cannot fully prove how the import resolves. The result is provisional \u2014 `ark-check` on the project is the authority.","For a complete verdict, run `npx arkgate-check --root . --config ark.config.json` (or ark_prepare_change over MCP with the full candidate batch). Read lexicalValid for the one-file result."),k("ANALYSIS_COVERS_NO_FILES","analysis","Analysis covered no files","No file matched the contract include and layer patterns under the analyzed root, so the run had nothing to check. Every rule is vacuously satisfied on an empty set: a green here would read exactly like a green over a governed tree while certifying nothing. Usual causes are a --root that is not the tree the contract describes (including a contract found outside the requested root, whose directory is then adopted as the project root), include / exclude patterns that match nothing, or layer patterns written for a different layout.","Point --root at the tree the contract describes, or keep the contract inside that tree, or fix the include / exclude / layer patterns so they match real files \u2014 then re-run `npx arkgate-check --root . --config ark.config.json`. This is a refusal about ArkGate\u2019s own inputs, not a finding about your code; no baseline or policy acknowledgement can suppress it."),k("ANALYSIS_HOST_UNAVAILABLE","analysis","Analysis host unavailable","No usable TypeScript / analysis host was available for this invocation.","Install a supported TypeScript version visible to the project, then re-run. Unavailable analysis is fail-closed."),k("ADAPTER_NOT_ALLOWED_FOR_PORT","adapter","Adapter not allowed for port","Runtime/port wiring selected an adapter implementation that the architecture profile does not allow for that port.","Bind an allowed adapter for the port, or adjust the profile with an explicit policy decision \u2014 then re-run."),k("FORBIDDEN_PATTERN","snippet-policy","Forbidden regex pattern","Snippet content matched a project or profile forbiddenPatterns rule.","Remove or rewrite the matching code so the pattern no longer matches, then re-run the snippet gate."),k("FORBIDDEN_SUBSTRING","snippet-policy","Forbidden substring","Snippet content contained a forbidden substring from the AI gate options/profile.","Remove the forbidden substring, then re-run the snippet gate."),k("FORBIDDEN_IMPORT","snippet-policy","Forbidden import target","Snippet imported or required a module listed as forbidden for the active profile.","Import an allowed module or inject the dependency behind a port, then re-run."),k("POLICY_VIOLATION","snippet-policy","Policy engine violation","A registered Policy failed on the snippet or generated code under evaluation.","Adjust the code to satisfy the named policy, or change the policy only through an explicit contract decision."),k("EXTENSION_ERROR","snippet-policy","AI gate extension error","A registered AICodeGate extension threw while analyzing the snippet.","Fix or remove the failing extension; do not ignore extension failures as pass."),k("AST_ANALYZER_ERROR","snippet-policy","AST analyzer error","Built-in AST/symbol analysis failed (host error or unexpected analyzer exception).","Ensure TypeScript host and snippet are valid; re-run. If the analyzer crashes on valid input, file a bug with a minimal fixture."),k("CONFIG_INVALID_DYNAMIC_IMPORT_ALLOWLIST","config","Invalid dynamicImportAllowlist","dynamicImportAllowlist is present but not an array of file globs.","Set dynamicImportAllowlist to an array of project-relative globs (or omit it).",{oftenAdvisory:!0}),k("CONFIG_INVALID_SAFETY","config","Invalid safety object","The safety field is present but not an object.","Use a safety object with optional maxTsSuppressions, maxAnyCasts, allowInMemory, allowDisabledPeerIsolation.",{oftenAdvisory:!0}),k("CONFIG_INVALID_SAFETY_THRESHOLD","config","Invalid safety threshold","A safety threshold (maxTsSuppressions / maxAnyCasts) is not a non-negative integer.","Set each threshold to a non-negative integer.",{oftenAdvisory:!0}),k("CONFIG_NO_LAYERS","config","No layers configured","ark.config.json has no file layers, so import-boundary enforcement cannot classify files.","Declare at least one layer with name + patterns (or run ark start / a preset).",{oftenAdvisory:!0}),k("CONFIG_LAYER_WITHOUT_NAME","config","Layer missing name","A configured layer entry has no name.","Give every layer a unique non-empty name.",{oftenAdvisory:!0}),k("CONFIG_INVALID_FORBIDDEN_GLOBALS","config","Invalid forbiddenGlobals","A layer\u2019s forbiddenGlobals is not an array of strings; the entry is ignored.",'Use an array of strings (e.g. ["fetch", "Date.now"]).',{oftenAdvisory:!0}),k("CONFIG_LAYER_WITHOUT_PATTERNS","config","Layer without patterns","A named layer has no file patterns and will never classify files.","Add patterns globs that match the layer\u2019s source tree.",{oftenAdvisory:!0}),k("CONFIG_INVALID_LAYER_PATTERN","config","Invalid layer pattern","A layer pattern is not a valid glob / failed to compile.","Fix the pattern syntax for that layer.",{oftenAdvisory:!0}),k("CONFIG_LAYER_PATTERN_NO_MATCHES","config","Layer pattern matched no files","A layer pattern matched zero included files (often a typo or include mismatch). Reserved/allowEmpty houses do not emit this.","Adjust the pattern or include roots, or mark the layer reserved/allowEmpty if the glob is a future house.",{oftenAdvisory:!0}),k("CONFIG_DUPLICATE_LAYER","config","Duplicate layer name","The same layer name appears more than once in configuration.","Rename or merge duplicate layer entries.",{oftenAdvisory:!0}),k("CONFIG_RULE_UNKNOWN_FROM_LAYER","config","Rule unknown from layer","A dependency rule references a source layer name that is not declared.","Fix the rule\u2019s from field to a declared layer name.",{oftenAdvisory:!0}),k("CONFIG_RULE_UNKNOWN_TO_LAYER","config","Rule unknown to layer","A dependency rule references a target layer name that is not declared.","Fix the rule\u2019s to field to a declared layer name.",{oftenAdvisory:!0}),k("CONFIG_AMBIGUOUS_LAYERS","config","Ambiguous layer classification","Some files match multiple layers at equal specificity; classification falls back to declaration order.","Disambiguate overlapping patterns so each file has one clear layer owner.",{oftenAdvisory:!0}),k("CONFIG_UNCLASSIFIED_FILES","config","Unclassified included files","Included source files match no layer pattern; import rules will not enforce on them.","Extend layer patterns or narrow include so every governed file is classified.",{oftenAdvisory:!0}),k("CONFIG_LAYER_MISSING_OWNER","config","Layer missing owner","requireLayerOwners is on and this layer has no owners. Writes to that house fail closed, like a folder with no name on the door.","Add a GitHub handle or email to that layer\u2019s owners in ark.config.json (/ark-adopt), then re-run. Reserved/allowEmpty houses may stay unnamed. Turn the flag off only if you no longer want owners required."),k("CONFIG_SLICE_IDENTITY_COLLISION","config","Starred slice prefixes share one id","sliceIdentity is stars and two different sliceFolders prefixes bind as the same slice id. Parallel trees of one feature do that on purpose; unrelated trees that share the last folder name merge by accident.","Keep stars when those prefixes are one feature. Otherwise use path, or rename the last literal so the prefixes do not bind as the same id. Doctor names both paths.",{oftenAdvisory:!0}),k("CONFIG_CHILD_SLICES_VERSION","config","Config needs a newer arkgate than a pinned copy",'ark.config.json uses a slice key (childSlices, sharedImportsSlice "deny-cross-parent" or its object form, sliceIdentity, sharedImportsSlice, childSlices.message, siblings.ratchet) that an arkgate pinned in this repo rejects at config load. Emitted only with evidence of that pin: an exact package.json dependency, the installed node_modules/arkgate, package-lock.json, a scripts/*hook* or host hook command, or a CI workflow. Silent otherwise.',"Bump the named file to the version the finding gives (or newer), then run Ark again. This warning does not fail the check.",{oftenAdvisory:!0}),k("CONFIG_CHILD_SLICE_EXTENDS","config","Child slice id does not extend its universe","A path resolved a child id that is not the universe id plus a further segment. The child wall does not treat that id as a child, so the edge is universe common until the folders line up.","Point childSlices.sliceFolders at children under the same universe id the outer sliceFolders already names. Doctor names the path.",{oftenAdvisory:!0}),k("CONFIG_CHILD_SLICE_CROSS_UNIVERSE","config","Child slice allowance cannot cross the universe wall","childSlices.allowedCrossSlice names a pattern that can match two universes. That list clears only a sibling crossing inside one universe. The universe wall still denies the edge.","Narrow the pattern so both sides share one universe prefix (features/projects/* to features/projects/d2d-item), or remove the entry. This warning does not fail the check.",{oftenAdvisory:!0}),k("CONFIG_CHILD_SLICES_INERT","config","childSlices on a rule that cannot run it","A rule sets childSlices without peerIsolation: true and allowed: false. The child wall runs only inside a universe wall, so on this rule childSlices enforces nothing. Config load still accepts it (arkgate 4.8.23 did too).",'Add "peerIsolation": true and "allowed": false to the same rule so the child wall runs, or remove childSlices. This warning does not fail the check.',{oftenAdvisory:!0}),k("CONFIG_SLICE_LEGACY_STARS_ID","config","Slice id written in the 4.8.23 stars form",'Under sliceIdentity "stars", a sliceAliases target or an allowedCrossSlice entry names the 4.8.23 stars id, which dropped a star binding before the last literal (modules/*/api/* bound api/v1). The id now keeps that binding (orders/api/v1). For one release the entry keeps its 4.8.23 meaning, so verdicts do not change.',"Rewrite the entry with the new id the warning names (for example orders/api/v1/x instead of api/v1/x). A sliceAliases target that maps to more than one universe shape is rejected at config load. This warning does not fail the check.",{oftenAdvisory:!0}),k("LITERAL_PATH_DRIFT","drift","Literal path moved by a rename","A repo path written inside a string, a comment or a docstring no longer resolves, and the rename set says where it went. Nothing in the gate sees this class: `tsc` resolves imports, not strings, and ESLint does not either, so the rename compiles green and the reference lies afterwards. It appears in four forms \u2014 the tsconfig alias, a relative literal, a path written without the include-root prefix, and prose \u2014 and a hand sweep reliably covers one of them.","Apply the suggested replacement, or re-run `npx arkgate-check --path-drift --base-ref <ref> --write` to apply every writable anchored replacement at once. The rewrite is mechanical and one-directional: the destination comes from the rename, it must itself resolve and be path-shaped, and the token is rewritten in the form the author wrote it in. A destination that leaves the alias root of the literal is reported with the target only and must be rewritten by hand."),k("LITERAL_PATH_UNRESOLVED","drift","Literal path does not resolve","A literal that looks like a repo path does not resolve under this root, and no rename explains where it went. Unlike LITERAL_PATH_DRIFT this is a candidate, not a verdict: with nothing to anchor it, ArkGate cannot tell a dead reference from an illustrative path in a comment, an example in documentation, or a path belonging to another tree.","Read the candidate and decide: fix the path, or leave it. Advisory only \u2014 it never fails a run and is never rewritten by --write, because there is no destination to propose. Run `--path-drift --all` to list the sweep.",{oftenAdvisory:!0}),k("ARK_UNKNOWN","meta","Unknown diagnostic","A diagnostic lacked a stable ruleId/code; adapters may emit this fallback so agents never see an empty id.","Resolve the underlying finding without weakening ark.config.json, then run Ark again. Prefer fixing the producer to emit a catalogued ruleId.")]),Ht=new Map(dt.map(e=>[e.ruleId,e])),To= exports.DIAGNOSTIC_RULE_IDS =Object.freeze(dt.map(e=>e.ruleId));function No(e){return typeof e=="string"&&e.length>0&&Ht.has(e)}_chunkA5EIY3HIcjs.a.call(void 0, No,"isKnownDiagnosticCode");function Po(e){return typeof e!="string"||e.length===0?!1:Ht.has(e)?!0:e.startsWith("ARKRULE_")}_chunkA5EIY3HIcjs.a.call(void 0, Po,"isCataloguedOrArkRuleFamily");function ut(e){if(!(typeof e!="string"||e.length===0))return Ht.get(e)}_chunkA5EIY3HIcjs.a.call(void 0, ut,"getDiagnosticCatalogEntry");function Wr(e){return`#${_nullishCoalesce(_optionalChain([ut, 'call', _3 => _3(e), 'optionalAccess', _4 => _4.docsAnchor]), () => (e))}`}_chunkA5EIY3HIcjs.a.call(void 0, Wr,"diagnosticDocsFragment");function Lo(e){return`${Mt}${Wr(e)}`}_chunkA5EIY3HIcjs.a.call(void 0, Lo,"diagnosticDocsPath");function Do(){return{schemaVersion:"1.0",docsPath:Mt,codes:dt}}_chunkA5EIY3HIcjs.a.call(void 0, Do,"serializeDiagnosticCatalog");function Fo(e){return _optionalChain([ut, 'call', _5 => _5(e), 'optionalAccess', _6 => _6.fix])}_chunkA5EIY3HIcjs.a.call(void 0, Fo,"catalogFixForRuleId");function $o(e){return _optionalChain([ut, 'call', _7 => _7(e), 'optionalAccess', _8 => _8.why])}_chunkA5EIY3HIcjs.a.call(void 0, $o,"catalogWhyForRuleId");var Mo=Object.freeze([Object.freeze({reasonId:"CROSS_PARENT_SLICE",ruleId:"LAYER_IMPORT_VIOLATION",title:"Cross-universe slice",why:"This import crosses two universe slices. The child wall cannot allow another universe.",fix:"Keep the import inside one universe, or move the shared code into a folder both universes may use."}),Object.freeze({reasonId:"CROSS_SIBLING_SLICE",ruleId:"LAYER_IMPORT_VIOLATION",title:"Cross-sibling slice",why:"This import crosses two feature slices inside one universe.",fix:"Import universe-common code, or move the shared piece into the feature that owns it.",advisoryNote:"This crossing is a warning (siblings advisory). With a baseline in use, a new one fails only when the baseline already records an advisory crossing of this rule and the count grows, or when siblings.ratchet is true; ratchet false measures only."}),Object.freeze({reasonId:"CROSS_PARENT_VIA_SHARED",ruleId:"LAYER_IMPORT_VIOLATION",title:"Cross-universe through a shared root",why:"A slice reaches another universe only through a shared root. ark-check and CI report this path. The write hook and ESLint see one edge at a time and do not block it.",fix:"Stop the shared root from importing the other universe, or move that import into the universe that owns it. A shared hop that stays inside one universe is allowed. If the shared hop is a composition root (bootstrap, DI registrations), list it in sharedImportsSlice.stopAt; a path through a stop is not a crossing."})]),Ho=new Map(Mo.map(e=>[e.reasonId,e]));function qr(e){if(!(typeof e!="string"||e.length===0))return Ho.get(e)}_chunkA5EIY3HIcjs.a.call(void 0, qr,"sliceReasonHint");var Ko=/(^|\/)(constants|types|enums|shared-types|shared\/(?:types|constants)|test-projects)(\/|\.|$)|(?:^|\/)[^/]*(?:constants|types)(?:\.[cm]?[jt]sx?)?$/i,Uo=/(^|\/)(?:kernel(?:\/|$)|events?(?:\/|\.|$)|bootstrap(?:\.[cm]?[jt]sx?)?$|emitter(?:\.[cm]?[jt]sx?)?$)|(?:^|\/)(?:intents?|publish)(?:\/|\.|$)/i,Vo=/(use-?cases?|usecases?|application|orchestrat|services?|handlers?)(\/|\.|$)/i;function Go(e,t){let n=String(_nullishCoalesce(e, () => (""))).replace(/\\/g,"/").trim(),r=String(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _9 => _9.fromLayer]), () => (""))),a=String(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _10 => _10.toLayer]), () => ("")));return Ko.test(n)?"pure-shared":r==="PersistenceAdapters"&&(Uo.test(n)||/events?|intents?|kernel|bootstrap/i.test(`${a} ${n}`))?"kernel-emit":Vo.test(n)||(r==="DomainModel"||r==="ApplicationOrchestration")&&a==="PersistenceAdapters"?"use-case":"unknown"}_chunkA5EIY3HIcjs.a.call(void 0, Go,"classifyLayerImportKind");function jo(e,t){return t.failsStrict===!1&&e.advisoryNote?`${e.fix} ${e.advisoryNote}`:e.fix}_chunkA5EIY3HIcjs.a.call(void 0, jo,"sliceHintAction");function Bo(e){let t=qr(typeof e.reasonId=="string"?e.reasonId:void 0);if(t)return`${jo(t,e)} Then preflight again.`;if(e.typeOnly||e.targetTypeOnlyExports||e.namedBindingsTypeOnly)return"Move the referenced type to a mutually allowed layer, use `import type`, then preflight again.";if(e.peerIsolation)return"Extract the shared dependency to a shared layer, test at the public interface, then preflight again.";let n=Go(typeof e.target=="string"?e.target:"",{fromLayer:typeof e.fromLayer=="string"?e.fromLayer:void 0,toLayer:typeof e.toLayer=="string"?e.toLayer:void 0});return n==="pure-shared"?"Adopt the imported constants/types/pure module into DomainModel or SharedKernel (do not inject a port). Then preflight again.":n==="kernel-emit"?"Persistence must not emit. Inject a port or move the event map to SharedTypes; do not import kernel/events/bootstrap from a repository. Then preflight again.":n==="use-case"||e.portProofEligible?`Define a port in ${_nullishCoalesce(e.fromLayer, () => ("the source layer"))}, inject the ${_nullishCoalesce(e.toLayer, () => ("outer-layer"))} implementation, test at the public interface, then preflight again.`:"Classify the import: if it is constants/types/pure, adopt into DomainModel or SharedKernel; define a port only if the target is a real use-case. Then preflight again."}_chunkA5EIY3HIcjs.a.call(void 0, Bo,"layerImportNextAction");function zo(e){return typeof e.target=="string"&&e.target.trim().length>0?e.target.trim():void 0}_chunkA5EIY3HIcjs.a.call(void 0, zo,"arkRunCallSiteName");function Wo(e){let t=zo(e),n=typeof e.fromLayer=="string"&&e.fromLayer.length>0?e.fromLayer:void 0;switch(e.ruleId){case"ARKRUN_MISSING_ROOT":return t?`Import createStrictArkKernel from arkgate/runtime and call it in composition root ${t} listed in arkRun.compositionRoots, then preflight again.`:"Import createStrictArkKernel from arkgate/runtime (same npm package; @arkgate/runtime is deprecated) and call it in a composition root listed in arkRun.compositionRoots, then preflight again. Never mechanical-safe \u2014 factory placement is a design decision.";case"ARKRUN_KERNEL_IN_DOMAIN":return t?`Move the kernel import of ${t} out of ${_nullishCoalesce(n, () => ("the Domain-role layer"))} into a composition root or adapter. Import from arkgate/runtime, then preflight again.`:"Move the kernel import out of the Domain-role layer into a composition root or adapter. Import from arkgate/runtime (same npm package; @arkgate/runtime is deprecated), then preflight again. Never mechanical-safe.";case"ARKRUN_DIRECT_NEW":return t?`Resolve ${t} from the kernel instead of constructing it with new, then preflight again.`:"Resolve the type from the kernel instead of constructing it with new, then preflight again. Never mechanical-safe \u2014 rewiring construction is a design decision.";case"ARKRUN_UNDECLARED_EMIT":return t?`Add ${t} to raises or sends on the managed component, then preflight again.`:"Add the existing call-site name to raises or sends on the managed component, then preflight again. Mechanical-safe only when that literal already exists and the edit is the declaration list; inventing a new emit stays judgment.";case"ARKRUN_UNDECLARED_HANDLE":return t?`Add ${t} to reactsTo on the managed component, then preflight again.`:"Add the existing call-site name to reactsTo on the managed component, then preflight again. Mechanical-safe only when that literal already exists and the edit is the declaration list; inventing a new handle stays judgment.";case"ARKRUN_UNDECLARED_DEPEND":return t?`Add ${t} to uses on the managed component, then preflight again.`:"Add the existing call-site name to uses on the managed component, then preflight again. Mechanical-safe only when that literal already exists and the edit is the declaration list; inventing a new depend stays judgment.";case"ARKRUN_TRANSPORT_BYPASS":return t?`Send through the ArkRun kernel transport instead of importing ${t}, then preflight again.`:"Send through the ArkRun kernel transport instead of importing that broker or emitter, then preflight again. Never mechanical-safe \u2014 homemade buses stay judgment.";default:return`Resolve ${typeof e.ruleId=="string"&&e.ruleId.length>0?e.ruleId:"ARK_UNKNOWN"} without weakening ark.config.json, then run Ark again.`}}_chunkA5EIY3HIcjs.a.call(void 0, Wo,"arkRunNextAction");function le(e){switch(e.ruleId){case"LAYER_IMPORT_VIOLATION":return Bo(e);case"CONFIG_CHILD_SLICES_VERSION":return typeof e.nextAction=="string"&&e.nextAction.length>0?e.nextAction:"Bump the pinned arkgate named in the finding to the version it gives, then run Ark again.";case"FORBIDDEN_GLOBAL":return`Inject ${_nullishCoalesce(e.target, () => ("the capability"))} through a port, test at the public interface, then preflight again.`;case"CAPABILITY_VIOLATION":return`Define a ${String(_nullishCoalesce(e.capability, () => ("capability")))} port in ${_nullishCoalesce(e.fromLayer, () => ("the walled layer"))}, bind the implementation outside it, test at the public interface, then preflight again.`;case"CIRCULAR_DEPENDENCY":return"Extract the shared dependency into a third module, test at the public interface, then preflight again.";case"RAW_EVENT_PUBLISH":return"Publish through a registered intent creator, then run Ark again.";case"LITERAL_PATH_DRIFT":return typeof e.target=="string"&&e.target.length>0?`Rewrite the literal to ${e.target}, or run \`arkgate-check --path-drift --base-ref <ref> --write\` to apply every anchored replacement.`:"Rewrite the literal to the rename destination, or run `arkgate-check --path-drift --base-ref <ref> --write` to apply every anchored replacement.";case"LITERAL_PATH_UNRESOLVED":return"Read the candidate and decide: fix the path, or leave it. Advisory \u2014 with no rename to anchor it there is no destination to propose, so --write never touches it.";case"PUBLISH_MISSING_SOURCE":return"Add metadata.source to the publish call, then run Ark again.";case"INVARIANT_COVERAGE_OUTSIDE_ROOTS":return"Move the covering test under a declared coverage root, or add its root to coverage.coverageRoots in ark.config.json, then run Ark again.";case"INVARIANT_CATALOG_EMPTY":return typeof e.file=="string"&&e.file.length>0?`Add 1\u20132 short phrases to invariants[] in ${e.file}, then run ark-check --doctor. Starters show the shape.`:"Add 1\u20132 short phrases to invariants[] in arkrules/<Domain>.json, then run ark-check --doctor. Starters show the shape.";case"INVARIANT_TESTS_PATH_MISSING":return"Add coverage.testGlobs or coverage.coverageRoots in ark.config.json pointing at a real tests folder, then re-run. Adopted mode fails closed until that path is present.";case"INVARIANT_COVERAGE_ROOTS_MISSING":return"Add coverage.coverageRoots in ark.config.json pointing at the folder the test runner uses, then re-run. An enforced invariant fails closed until that path is present.";case"ARKRULE_STRUCTURE":case"ARKRULE_INVARIANT":case"INVARIANT_UNCOVERED":return`Fix the structure or invariant for ${typeof e.arkruleId=="string"&&e.arkruleId.length>0?e.arkruleId:"the ArkRule"} (declared in ${typeof e.arkruleSource=="string"&&e.arkruleSource.length>0?e.arkruleSource:"arkrules/<Layer>.json"}), then preflight again. Do not demote the rule without a hash-bound policy acknowledgement.`;case"ARKRUN_MISSING_ROOT":case"ARKRUN_KERNEL_IN_DOMAIN":case"ARKRUN_DIRECT_NEW":case"ARKRUN_UNDECLARED_EMIT":case"ARKRUN_UNDECLARED_HANDLE":case"ARKRUN_UNDECLARED_DEPEND":case"ARKRUN_TRANSPORT_BYPASS":return Wo(e);case"ARKORDER_MISSING_PLANE":return typeof e.target=="string"&&e.target.length>0?`Import createOrderPlane from arkgate/order and call it in plane root ${e.target} listed in arkOrder.planeRoots, then preflight again.`:"Import createOrderPlane from arkgate/order and call it in a plane root listed in arkOrder.planeRoots, then preflight again. Never mechanical-safe \u2014 factory placement is a design decision.";case"ARKORDER_KERNEL_IN_DOMAIN":return"Move the arkgate/order import out of the Domain-role layer into a plane root or adapter, then preflight again. Never mechanical-safe.";case"ARKORDER_GENERIC_UPDATE":return"Don't use a generic update. First freeze with release(). Later, propose the change, then apply it.";case"ARKORDER_TOO_MANY_PARAMS":return"Cut \u03BE to the slow keys that actually slave the rest, then preflight again. Never mechanical-safe.";case"ARKORDER_INGEST_WRITES_XI":return"Keep ingest results as absorb/escalate_up/hold only. Change \u03BE with proposeRelease then apply(ProposeResult). Never mechanical-safe.";case"ARKORDER_XI_FIELD_WRITE":return typeof e.target=="string"&&e.target.length>0?`Don't write ${e.target} from a use-case. Take the event in, or change that choice through the valve (proposeRelease then apply), not a generic update.`:"Don't write a named product choice from a use-case. Take the event in, or change that choice through the valve (proposeRelease then apply), not a generic update.";case"ARKORDER_UNVALVED_RELEASE":return"Change the choice with proposeRelease then apply. release() is only the first freeze. Never mechanical-safe.";default:return typeof e.ruleId=="string"&&e.ruleId.startsWith("ARKRULE_")?`Fix the ArkRule ${typeof e.arkruleId=="string"?e.arkruleId:e.ruleId}, then preflight again.`:`Resolve ${typeof e.ruleId=="string"&&e.ruleId.length>0?e.ruleId:"ARK_UNKNOWN"} without weakening ark.config.json, then run Ark again.`}}_chunkA5EIY3HIcjs.a.call(void 0, le,"deterministicNextAction");var pt="1.5",Kt="docs/diagnostics.md",Yr= exports.ARK_ANALYSIS_RESULT_SCHEMA ={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://unpkg.com/arkgate@3/schemas/ark.analysis-result.schema.json",title:"ArkGate analysis result",type:"object",additionalProperties:!1,required:["schemaVersion","mode","valid","completeness","completenessReasons","diagnostics"],allOf:[{if:{properties:{completeness:{enum:["partial","unavailable"]}},required:["completeness"]},then:{properties:{valid:{const:!1}}}},{if:{properties:{mode:{const:"resolved-candidate-facts"},completeness:{enum:["complete","partial"]}},required:["mode","completeness"]},then:{required:["policyHash","resolverIdentity","factsHash","candidateTreeHash"]}},{if:{properties:{completeness:{const:"complete"}},required:["completeness"]},then:{properties:{completenessReasons:{maxItems:0}}},else:{properties:{completenessReasons:{minItems:1}}}}],properties:{schemaVersion:{const:"1.5"},mode:{enum:["lexical-compatibility","resolved-candidate-facts"]},valid:{type:"boolean"},completeness:{enum:["complete","partial","unavailable"]},completenessReasons:{type:"array",items:{type:"object",additionalProperties:!1,required:["code","message"],properties:{code:{type:"string",minLength:1},message:{type:"string",minLength:1},file:{type:"string",minLength:1}}}},policyHash:{type:"string",minLength:1},resolverIdentity:{type:"string",minLength:1},factsHash:{type:"string",minLength:1},candidateTreeHash:{type:"string",minLength:1},diagnostics:{type:"array",items:{type:"object",additionalProperties:!1,required:["ruleId","severity","message","location","evidence"],properties:{ruleId:{type:"string",minLength:1},severity:{enum:["error","warning"]},message:{type:"string",minLength:1},location:{type:"object",additionalProperties:!1,required:["file","line","column"],properties:{file:{type:"string",minLength:1},line:{type:"integer",minimum:1},column:{type:"integer",minimum:1}}},evidence:{type:"object",additionalProperties:!1,properties:{target:{type:"string"},fromLayer:{type:"string"},toLayer:{type:"string"},typeOnly:{type:"boolean"},targetTypeOnlyExports:{type:"boolean"},sourcePureTypeModule:{type:"boolean"},namedBindingsTypeOnly:{type:"boolean"},portProofEligible:{type:"boolean"},peerIsolation:{type:"boolean"},capability:{type:"string",minLength:1},edgeKind:{type:"string",minLength:1},arkruleId:{type:"string",minLength:1},arkruleSource:{type:"string",minLength:1},reasonId:{enum:["CROSS_PARENT_SLICE","CROSS_SIBLING_SLICE","CROSS_PARENT_VIA_SHARED"]},universeFrom:{type:"string",minLength:1},universeTo:{type:"string",minLength:1}}},nextAction:{type:"string",minLength:1},findingRef:{type:"string",minLength:1,pattern:"^fnv1a-[0-9a-f]{8}$"},targetKey:{type:"string",minLength:1},docsCodePath:{type:"string",minLength:1}}}}}};function ft(e){let t=typeof e.ruleId=="string"?e.ruleId:typeof e.code=="string"?e.code:void 0,n=typeof e.file=="string"?e.file:void 0,r=typeof e.fromLayer=="string"?e.fromLayer:void 0,a=typeof e.toLayer=="string"?e.toLayer:void 0,s=typeof e.target=="string"?e.target:void 0;return[t,n,_nullishCoalesce(r, () => ("")),_nullishCoalesce(a, () => ("")),_nullishCoalesce(s, () => (""))].join("|")}_chunkA5EIY3HIcjs.a.call(void 0, ft,"adapterFindingTargetKey");function gt(e){let t=new Map;return e.map(n=>{let r=ft(n),a=(_nullishCoalesce(t.get(r), () => (0)))+1;return t.set(r,a),a===1?r:`${r}#${a}`})}_chunkA5EIY3HIcjs.a.call(void 0, gt,"adapterFindingOccurrenceTargetKeys");function Ut(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`fnv1a-${(t>>>0).toString(16).padStart(8,"0")}`}_chunkA5EIY3HIcjs.a.call(void 0, Ut,"adapterFindingRefFromTargetKey");function Vt(e){return`${Kt}#${e}`}_chunkA5EIY3HIcjs.a.call(void 0, Vt,"adapterDocsCodePath");function S(e){return typeof e=="string"&&e.length>0?e:void 0}_chunkA5EIY3HIcjs.a.call(void 0, S,"text");function Xr(e,t){return Number.isInteger(e)&&Number(e)>0?Number(e):t}_chunkA5EIY3HIcjs.a.call(void 0, Xr,"positiveInteger");function qo(e,t,n){return le({ruleId:e,target:_nullishCoalesce(_nullishCoalesce(S(t.target), () => (S(n.target))), () => (void 0)),fromLayer:_nullishCoalesce(S(t.fromLayer), () => (void 0)),toLayer:_nullishCoalesce(S(t.toLayer), () => (void 0)),typeOnly:t.typeOnly===!0,targetTypeOnlyExports:t.targetTypeOnlyExports===!0,namedBindingsTypeOnly:t.namedBindingsTypeOnly===!0,portProofEligible:t.portProofEligible===!0,peerIsolation:t.peerIsolation===!0,sourcePureTypeModule:t.sourcePureTypeModule===!0,edgeKind:_nullishCoalesce(S(t.edgeKind), () => (void 0)),capability:_nullishCoalesce(_nullishCoalesce(S(t.capability), () => (S(n.capability))), () => (void 0)),arkruleId:_nullishCoalesce(S(t.arkruleId), () => (void 0)),arkruleSource:_nullishCoalesce(S(t.arkruleSource), () => (void 0)),reasonId:_nullishCoalesce(S(t.reasonId), () => (void 0))})}_chunkA5EIY3HIcjs.a.call(void 0, qo,"nextActionForDiagnostic");var Yo=new Set(["CROSS_PARENT_SLICE","CROSS_SIBLING_SLICE","CROSS_PARENT_VIA_SHARED"]);function Xo(e){let t=e.details,n=t!==null&&typeof t=="object"?t.reasonId:void 0,r=_nullishCoalesce(S(e.reasonId), () => (S(n)));return r&&Yo.has(r)?r:void 0}_chunkA5EIY3HIcjs.a.call(void 0, Xo,"sliceReasonOf");function Gt(e,t="error",n){let r=_nullishCoalesce(_nullishCoalesce(S(e.ruleId), () => (S(e.code))), () => ("ARK_UNKNOWN")),a=e.severity==="warning"||e.failsStrict===!1||e.typeOnly===!0&&e.peerIsolation!==!0?"warning":t,s=Xo(e),o={...S(e.target)?{target:S(e.target)}:{},...S(e.fromLayer)?{fromLayer:S(e.fromLayer)}:{},...S(e.toLayer)?{toLayer:S(e.toLayer)}:{},...typeof e.typeOnly=="boolean"?{typeOnly:e.typeOnly}:{},...typeof e.targetTypeOnlyExports=="boolean"?{targetTypeOnlyExports:e.targetTypeOnlyExports}:{},...typeof e.sourcePureTypeModule=="boolean"?{sourcePureTypeModule:e.sourcePureTypeModule}:{},...typeof e.namedBindingsTypeOnly=="boolean"?{namedBindingsTypeOnly:e.namedBindingsTypeOnly}:{},...typeof e.portProofEligible=="boolean"?{portProofEligible:e.portProofEligible}:{},...typeof e.peerIsolation=="boolean"?{peerIsolation:e.peerIsolation}:{},...S(e.capability)?{capability:S(e.capability)}:{},...S(e.edgeKind)?{edgeKind:S(e.edgeKind)}:{},...S(e.arkruleId)?{arkruleId:S(e.arkruleId)}:{},...S(e.arkruleSource)?{arkruleSource:S(e.arkruleSource)}:{},...s?{reasonId:s}:{},...s&&S(e.universeFrom)?{universeFrom:S(e.universeFrom)}:{},...s&&S(e.universeTo)?{universeTo:S(e.universeTo)}:{}},l=_nullishCoalesce(n, () => (ft(e))),c=Ut(l);return{ruleId:r,severity:a,message:_nullishCoalesce(S(e.message), () => (r)),location:{file:_nullishCoalesce(S(e.file), () => ("<unknown>")),line:Xr(e.line,1),column:Xr(e.column,1)},evidence:o,nextAction:_nullishCoalesce(S(e.nextAction), () => (qo(r,o,e))),findingRef:c,targetKey:l,docsCodePath:Vt(r)}}_chunkA5EIY3HIcjs.a.call(void 0, Gt,"toAdapterDiagnostic");function Zo(e){let t=_nullishCoalesce(e.completeness, () => ("complete")),n=_nullishCoalesce(e.mode, () => ("lexical-compatibility"));if(t==="complete"&&(_nullishCoalesce(_optionalChain([e, 'access', _11 => _11.completenessReasons, 'optionalAccess', _12 => _12.length]), () => (0)))>0)throw new Error("completenessReasons must be empty when completeness is complete.");let r=t==="complete"?[]:e.completenessReasons&&e.completenessReasons.length>0?e.completenessReasons.map(h=>({code:_nullishCoalesce(S(h.code), () => ("ANALYSIS_EVIDENCE_INCOMPLETE")),message:_nullishCoalesce(S(h.message), () => (`Analysis ${t}: required evidence is incomplete.`)),...S(h.file)?{file:S(h.file)}:{}})):[{code:t==="unavailable"?"ANALYSIS_UNAVAILABLE":"ANALYSIS_EVIDENCE_INCOMPLETE",message:`Analysis ${t}: required evidence is incomplete.`}],a={...S(e.policyHash)?{policyHash:S(e.policyHash)}:{},...S(e.resolverIdentity)?{resolverIdentity:S(e.resolverIdentity)}:{},...S(e.factsHash)?{factsHash:S(e.factsHash)}:{},...S(e.candidateTreeHash)?{candidateTreeHash:S(e.candidateTreeHash)}:{}};if(n==="resolved-candidate-facts"&&t!=="unavailable"){for(let h of["policyHash","resolverIdentity","factsHash","candidateTreeHash"])if(!a[h])throw new Error(`${h} is required for resolved ${t} adapter evidence.`)}let s=_nullishCoalesce(e.violations, () => ([])),o=_nullishCoalesce(e.warnings, () => ([])),l=gt(s),c=gt(o),f=[...s.map((h,p)=>Gt(h,"error",l[p])),...o.map((h,p)=>Gt(h,"warning",c[p]))],g={schemaVersion:"1.5",completenessReasons:r,diagnostics:f};if(n==="resolved-candidate-facts"){if(t==="unavailable")return{...g,mode:n,valid:!1,completeness:t,...a};let h={policyHash:a.policyHash,resolverIdentity:a.resolverIdentity,factsHash:a.factsHash,candidateTreeHash:a.candidateTreeHash};return t==="complete"?{...g,mode:n,valid:e.valid,completeness:t,...h}:{...g,mode:n,valid:!1,completeness:t,...h}}return t==="complete"?{...g,mode:n,valid:e.valid,completeness:t,...a}:{...g,mode:n,valid:!1,completeness:t,...a}}_chunkA5EIY3HIcjs.a.call(void 0, Zo,"createAdapterResult");function Zr(e){return{events(t){return e.eventBus.getHistory().map(n=>n.event).filter(n=>!t||n.intent===t)},traces(t){return e.eventBus.getTrace().filter(n=>!t||n.type===t)},audit(t){return e.auditTrail.query(t)},outbox(t){return e.outbox.list(t)},observability(){return e.syncGraph(),e.observability.report()},async snapshot(){return{events:this.events(),traces:this.traces(),audit:await this.audit(),outbox:await this.outbox(),observability:this.observability()}},async clear(){e.eventBus.clearHistory(),e.eventBus.clearTrace(),await e.auditTrail.clear(),await e.outbox.clear()}}}_chunkA5EIY3HIcjs.a.call(void 0, Zr,"createArkTestHarness");function Jr(e,t={}){return{name:e,ownerLayer:t.ownerLayer,intent:t.intent,allowedAdapters:t.allowedAdapters?[...t.allowedAdapters]:void 0}}_chunkA5EIY3HIcjs.a.call(void 0, Jr,"definePort");function Qr(e,t,n,r={}){let a=Array.isArray(n)?{...r,requiredKeys:n}:{..._nullishCoalesce(n, () => ({}))},s=a.requiredKeys;if(s&&s.length>0){let c=s.filter(f=>!ts(t,f));if(c.length>0)throw new Error(`Adapter for port "${e.name}" is missing required members: ${c.join(", ")}`)}let o={name:a.name,layer:a.layer,intent:a.intent,port:e,impl:t},l=jt(o);if(!l.ok)throw new Error(l.issues.map(c=>c.message).join(`
|
|
2
|
-
`));return o}_chunkA5EIY3HIcjs.a.call(void 0, Qr,"createAdapter");function es(e,t=[]){let n=t.filter(r=>!ts(e,r));return n.length===0?{ok:!0}:{ok:!1,missing:n}}_chunkA5EIY3HIcjs.a.call(void 0, es,"checkContract");function jt(e){let t=_nullishCoalesce(e.port.allowedAdapters, () => ([]));return t.length===0?{ok:!0,issues:[]}:[e.name,e.intent].filter(a=>typeof a=="string"&&a.length>0).some(a=>t.includes(a))?{ok:!0,issues:[]}:{ok:!1,issues:[{ruleId:"ADAPTER_NOT_ALLOWED_FOR_PORT",port:e.port.name,adapter:_nullishCoalesce(e.name, () => (e.intent)),message:`Adapter "${_nullishCoalesce(_nullishCoalesce(e.name, () => (e.intent)), () => ("unknown"))}" is not allowed for port "${e.port.name}".`}]}}_chunkA5EIY3HIcjs.a.call(void 0, jt,"checkAdapterGovernance");function ts(e,t){return e!=null&&(typeof e=="object"||typeof e=="function")&&t in e}_chunkA5EIY3HIcjs.a.call(void 0, ts,"hasMember");var zt=Object.freeze(["network","filesystem","clock","randomness","environment","process","persistence"]),qt=Object.freeze({fetch:"network",XMLHttpRequest:"network",Date:"clock","Date.now":"clock","Math.random":"randomness","process.env":"environment",process:"process"}),Yt=Object.freeze(Object.keys(qt).sort()),Bt=Object.freeze({fs:"filesystem","node:fs":"filesystem","fs/promises":"filesystem","node:fs/promises":"filesystem","fs-extra":"filesystem","graceful-fs":"filesystem",memfs:"filesystem",chokidar:"filesystem",http:"network",https:"network",http2:"network",net:"network",tls:"network",dgram:"network",dns:"network","node:http":"network","node:https":"network","node:http2":"network","node:net":"network","node:tls":"network","node:dgram":"network","node:dns":"network",axios:"network",undici:"network","node-fetch":"network",got:"network",ky:"network",superagent:"network",ws:"network",process:"process","node:process":"process",child_process:"process","node:child_process":"process","@prisma/client":"persistence",prisma:"persistence",pg:"persistence",mysql:"persistence",mysql2:"persistence",mongodb:"persistence",mongoose:"persistence",sqlite3:"persistence","better-sqlite3":"persistence",redis:"persistence",ioredis:"persistence",typeorm:"persistence",knex:"persistence","drizzle-orm":"persistence",sequelize:"persistence",kysely:"persistence","@supabase/supabase-js":"persistence"}),Wt=Object.freeze({process:Object.freeze(["process","node:process"])});function Be(e){if(!e||e.startsWith(".")||e.startsWith("/"))return null;let t=Bt[e];if(t)return t;let n=e.indexOf("/");if(n<0)return null;let r=e.slice(0,n),a=Bt[r];if(a)return a;let s=e.indexOf("/",n+1);return s<0?null:_nullishCoalesce(Bt[e.slice(0,s)], () => (null))}_chunkA5EIY3HIcjs.a.call(void 0, Be,"capabilityForModuleSpecifier");function Re(e,t){for(let n of t)if(_optionalChain([Wt, 'access', _13 => _13[n], 'optionalAccess', _14 => _14.includes, 'call', _15 => _15(e)]))return n;return null}_chunkA5EIY3HIcjs.a.call(void 0, Re,"forbiddenGlobalForModuleSpecifier");function mt(e){let t=e.split(".");for(let n=t.length;n>=1;n-=1){let r=t.slice(0,n).join("."),a=qt[r];if(a)return a}return null}_chunkA5EIY3HIcjs.a.call(void 0, mt,"capabilityForAmbientName");function we(e){if(_optionalChain([e, 'optionalAccess', _16 => _16.pure])===!0)return[...zt].sort();let n=(_nullishCoalesce(_optionalChain([e, 'optionalAccess', _17 => _17.capabilities, 'optionalAccess', _18 => _18.deny]), () => ([]))).filter(r=>zt.includes(r));return[...new Set(n)].sort()}_chunkA5EIY3HIcjs.a.call(void 0, we,"effectiveCapabilityDeny");function ze(e,t){if(t.length===0)return!1;let n=new Set(t),r=e.split(".");for(let a=r.length;a>=1;a-=1)if(n.has(r.slice(0,a).join(".")))return!0;return!1}_chunkA5EIY3HIcjs.a.call(void 0, ze,"ambientCoveredByForbiddenGlobals");function yt(e){let t=new Set,n=new Set,r=Object.keys(qt);for(let a of _nullishCoalesce(_optionalChain([e, 'optionalAccess', _19 => _19.forbiddenGlobals]), () => ([]))){let s=r.filter(o=>o===a||o.startsWith(`${a}.`));if(s.length===0)n.add(a);else for(let o of s)t.add(`ambient:${o}`);for(let o of _nullishCoalesce(Wt[a], () => ([])))t.add(`import-exact:${o}`)}for(let a of we(e)){if(t.add(`import:${a}`),a==="process")for(let s of Wt.process)t.add(`import-exact:${s}`);for(let s of r)mt(s)===a&&t.add(`ambient:${s}`)}return{atoms:[...t].sort(),rawGlobals:[...n].sort()}}_chunkA5EIY3HIcjs.a.call(void 0, yt,"loweredLayerCoverage");function Te(e,t){return t&&e.isStringLiteralLike(t)?t.text:void 0}_chunkA5EIY3HIcjs.a.call(void 0, Te,"literalText");function ss(e,t){return e.getLineAndCharacterOfPosition(t.getStart(e)).line+1}_chunkA5EIY3HIcjs.a.call(void 0, ss,"lineOf");function ns(e,t){if(e.isImportDeclaration(t)){let r=t.importClause;if(!r)return!1;if(r.isTypeOnly)return!0;let a=r.namedBindings;return!!(a&&e.isNamedImports(a)&&a.elements.length>0&&a.elements.every(s=>s.isTypeOnly))}if(t.isTypeOnly)return!0;let n=t.exportClause;return!!(n&&e.isNamedExports(n)&&n.elements.length>0&&n.elements.every(r=>r.isTypeOnly))}_chunkA5EIY3HIcjs.a.call(void 0, ns,"isTypeOnlyReference");function as(e,t){let n={noLib:!0,noResolve:!0,target:e.ScriptTarget.Latest},r=e.createCompilerHost(n,!0);return r.getSourceFile=a=>a===t.fileName?t:void 0,r.fileExists=a=>a===t.fileName,r.readFile=a=>a===t.fileName?t.text:void 0,e.createProgram([t.fileName],n,r).getTypeChecker()}_chunkA5EIY3HIcjs.a.call(void 0, as,"singleFileChecker");function Xt(e,t){try{return e.getSymbolAtLocation(t)}catch (e2){return}}_chunkA5EIY3HIcjs.a.call(void 0, Xt,"symbolAt");function Zt(e,t,n,r){let a=r.parent&&e.isShorthandPropertyAssignment(r.parent)&&r.parent.name===r,s;try{s=a?t.getShorthandAssignmentValueSymbol(r.parent):Xt(t,r)}catch (e3){s=void 0}return!!_optionalChain([s, 'optionalAccess', _20 => _20.declarations, 'optionalAccess', _21 => _21.some, 'call', _22 => _22(o=>o.getSourceFile().fileName===n.fileName)])}_chunkA5EIY3HIcjs.a.call(void 0, Zt,"localDeclaration");function Ne(e,t){let n,r=[],a=_chunkA5EIY3HIcjs.a.call(void 0, (o,l,c,f=!1)=>r.push({specifier:c,kind:l,line:ss(t,o),typeOnly:f,unresolved:c===void 0,node:o}),"add"),s=_chunkA5EIY3HIcjs.a.call(void 0, o=>{if(e.isImportDeclaration(o))a(o,"import",Te(e,o.moduleSpecifier),ns(e,o));else if(e.isExportDeclaration(o)&&o.moduleSpecifier)a(o,"export",Te(e,o.moduleSpecifier),ns(e,o));else if(e.isImportEqualsDeclaration(o)&&e.isExternalModuleReference(o.moduleReference))a(o,"require",Te(e,o.moduleReference.expression),o.isTypeOnly===!0);else if(e.isCallExpression(o)){let l=o.expression.kind===e.SyntaxKind.ImportKeyword,f=e.isIdentifier(o.expression)&&o.expression.text==="require"&&!Zt(e,_nullishCoalesce(n, () => ((n=as(e,t)))),t,o.expression);(l||f)&&a(o,f?"require":"dynamic-import",Te(e,o.arguments[0]))}e.forEachChild(o,s)},"visit");return s(t),r}_chunkA5EIY3HIcjs.a.call(void 0, Ne,"extractSemanticDependencies");function Jo(e,t){let n=[],r=t;for(;e.isPropertyAccessExpression(r)||e.isElementAccessExpression(r);){if(e.isPropertyAccessExpression(r))n.unshift(r.name.text);else{let a=Te(e,r.argumentExpression);if(a===void 0)return;n.unshift(a)}r=r.expression}if(e.isIdentifier(r))return n.unshift(r.text),{root:r,segments:n}}_chunkA5EIY3HIcjs.a.call(void 0, Jo,"staticAccessPath");function Qo(e,t){let n=t.parent;return e.isPropertyAccessExpression(n)||e.isElementAccessExpression(n)?!1:e.isExpressionNode(t)&&!e.isInTypeQuery(t)||e.isShorthandPropertyAssignment(n)&&n.name===t}_chunkA5EIY3HIcjs.a.call(void 0, Qo,"runtimeIdentifierReference");function rs(e,t){let n=t[0]==="globalThis"?t.slice(1):t;for(let r=n.length;r>=1;r-=1){let a=n.slice(0,r).join(".");if(e.has(a))return a}}_chunkA5EIY3HIcjs.a.call(void 0, rs,"bestForbiddenMatch");function Pe(e,t,n){if(n.length===0)return[];let r=new Set(n),a=as(e,t),s=new Map,o=new Set;for(let p of t.statements)if(e.isVariableStatement(p))for(let R of p.declarationList.declarations)e.isIdentifier(R.name)&&o.add(R.name.text);let l=_chunkA5EIY3HIcjs.a.call(void 0, p=>{let R=Jo(e,p);if(!R)return;let u=Xt(a,R.root),m=u?s.get(u):void 0;return m?[...m,...R.segments.slice(1)]:Zt(e,a,t,R.root)||o.has(R.root.text)?void 0:R.segments},"resolvePath");for(let p of t.statements)if(e.isVariableStatement(p))for(let R of p.declarationList.declarations){if(!R.initializer||!e.isIdentifier(R.name))continue;let u=l(R.initializer),m=Xt(a,R.name);!u||!m||s.set(m,u)}let c=[],f=new Set,g=_chunkA5EIY3HIcjs.a.call(void 0, (p,R)=>{let u=ss(t,R),m=`${p}:${R.getStart(t)}`;f.has(m)||(f.add(m),c.push({name:p,line:u,node:R}))},"flag"),h=_chunkA5EIY3HIcjs.a.call(void 0, p=>{let R=p.parent&&(e.isPropertyAccessExpression(p.parent)||e.isElementAccessExpression(p.parent))&&p.parent.expression===p;if((e.isPropertyAccessExpression(p)||e.isElementAccessExpression(p))&&!R){let u=l(p),m=u?rs(r,u):void 0;m&&g(m,p)}else e.isIdentifier(p)&&r.has(p.text)&&Qo(e,p)&&!Zt(e,a,t,p)&&g(p.text,p);if(e.isVariableDeclaration(p)&&e.isObjectBindingPattern(p.name)&&p.initializer){let u=l(p.initializer);if(u)for(let m of p.name.elements){if(!e.isIdentifier(m.name))continue;let v=m.propertyName?_nullishCoalesce(Te(e,m.propertyName), () => (m.propertyName.text)):m.name.text,w=rs(r,[...u,v]);w&&g(w,p.initializer)}}e.forEachChild(p,h)},"visit");return h(t),c}_chunkA5EIY3HIcjs.a.call(void 0, Pe,"collectForbiddenCapabilityUses");function Jt(e,t,n){let r=[];for(let a of _nullishCoalesce(_optionalChain([n, 'optionalAccess', _23 => _23.dependencies]), () => (Ne(e,t)))){if(a.typeOnly||!a.specifier)continue;let s=Be(a.specifier);s&&r.push({capability:s,symbol:a.specifier,line:a.line,source:"import-based"})}for(let a of _nullishCoalesce(_optionalChain([n, 'optionalAccess', _24 => _24.ambientUses]), () => (Pe(e,t,Yt)))){let s=mt(a.name);s&&r.push({capability:s,symbol:a.name,line:a.line,source:"ambient-global"})}return r.sort((a,s)=>a.line-s.line||a.capability.localeCompare(s.capability)||a.symbol.localeCompare(s.symbol))}_chunkA5EIY3HIcjs.a.call(void 0, Jt,"collectCapabilityUses");function z(e,t,n){return{ruleId:e,code:e,message:t,...n}}_chunkA5EIY3HIcjs.a.call(void 0, z,"violation");function ei(e,t){return e?t==="unclassifiable-path"||t==="missing-path"?"Move the file into a slice, or declare its root in the rule's sharedRoots.":t==="no-slice-folders"?"Set sliceFolders on the peerIsolation rule.":t==="shared-imports-slice"?"Move the code the shared root needs into the shared root, or invert the dependency.":"Extract shared code to a shared layer, or coordinate slices via events/ports \u2014 do not import across feature/context slices.":"Depend on a port/interface owned by an inner layer instead, or move this code to a layer allowed to make this import."}_chunkA5EIY3HIcjs.a.call(void 0, ei,"peerSuggestion");function Le(e,t){return e.slice(0,t).split(`
|
|
3
|
-
`).length}_chunkA5EIY3HIcjs.a.call(void 0, Le,"lineOf");var ti=new Set(["publish","subscribe","defineIntent","registerHandler"]);function ni(e,t){return e.index+e[0].indexOf(t)}_chunkA5EIY3HIcjs.a.call(void 0, ni,"captureIndex");function ri(e){let t=[],n=new Set,r=_chunkA5EIY3HIcjs.a.call(void 0, (l,c)=>{!l||n.has(c)||(n.add(c),t.push({value:l,index:c}))},"push"),a=_chunkA5EIY3HIcjs.a.call(void 0, l=>{l.lastIndex=0;let c;for(;(c=l.exec(e))!==null;){let f=c[1];f&&r(f,ni(c,f))}},"pushFrom");a(/\b(?:publish|subscribe|defineIntent|registerHandler)\s{0,8}(?:<[^>]{0,120}>)?\s{0,8}\(\s{0,8}['"`]([A-Za-z][A-Za-z0-9_.]*)['"`]/g),a(/\b(?:intent|onEvent)\s{0,8}:\s{0,8}['"`]([A-Za-z][A-Za-z0-9_.]*)['"`]/g);let s=/\breactsTo\s{0,8}:\s{0,8}\[([^\]]{0,2000})\]/g,o;for(;(o=s.exec(e))!==null;){let l=_nullishCoalesce(o[1], () => ("")),c=o.index+o[0].indexOf(l),f=/['"`]([A-Za-z][A-Za-z0-9_.]*)['"`]/g,g;for(;(g=f.exec(l))!==null;){let h=g[1];h&&r(h,c+g.index+g[0].indexOf(h))}}return a(/\bmetadata\s{0,8}:\s{0,8}\{[^}]{0,400}\bsource\s{0,8}:\s{0,8}['"`]([A-Za-z][A-Za-z0-9_.]*)['"`]/g),a(/\bpublish\s{0,8}(?:<[^>]{0,120}>)?\s{0,8}\([^;]{0,400}?\bsource\s{0,8}:\s{0,8}['"`]([A-Za-z][A-Za-z0-9_.]*)['"`]/g),t.sort((l,c)=>l.index-c.index)}_chunkA5EIY3HIcjs.a.call(void 0, ri,"extractQuotedStrings");function si(e){let t=[],n=[{kind:"import",re:/\bimport\s+(?:type\s+)?(?:[^'"]*?\s+from\s*)?['"]([^'"]+)['"]/g},{kind:"export",re:/\bexport\s+(?:type\s+)?[^'"]*?\s+from\s*['"]([^'"]+)['"]/g},{kind:"dynamic-import",re:/\bimport\s*\(\s*['"]([^'"]+)['"]\s*\)/g},{kind:"require",re:/\brequire\s*\(\s*['"]([^'"]+)['"]\s*\)/g}];for(let r of n){let a;for(;(a=r.re.exec(e))!==null;){let s=a.index+a[0].indexOf(a[1]),o=a[0],l=r.kind==="import"&&/\bimport\s+type\b/.test(o)||r.kind==="export"&&/\bexport\s+type\b/.test(o);t.push({value:a[1],index:s,kind:r.kind,typeOnly:l})}}return t.sort((r,a)=>r.index-a.index)}_chunkA5EIY3HIcjs.a.call(void 0, si,"extractModuleSpecifiers");function ai(e,t){return!!(t&&(e.isParenthesizedExpression(t)||e.isAsExpression(t)||typeof e.isTypeAssertionExpression=="function"&&e.isTypeAssertionExpression(t)||typeof e.isSatisfiesExpression=="function"&&e.isSatisfiesExpression(t)))}_chunkA5EIY3HIcjs.a.call(void 0, ai,"isSyntaxWrapper");function Qt(e,t){let n=t;for(;_optionalChain([n, 'optionalAccess', _25 => _25.parent])&&ai(e,n.parent);)n=n.parent;return n}_chunkA5EIY3HIcjs.a.call(void 0, Qt,"unwrapWrappers");function en(e,t){if(!t||!e.isCallExpression(t))return;let n=t.expression;if(e.isIdentifier(n))return n.text;if(e.isPropertyAccessExpression(n))return n.name.text}_chunkA5EIY3HIcjs.a.call(void 0, en,"callCalleeName");function oi(e,t){let n=t.parent;if(!n||!e.isObjectLiteralExpression(n))return!1;let r=Qt(e,n),a=r.parent;if(!a)return!1;if(e.isCallExpression(a)&&en(e,a)==="publish"){let s=a.arguments;return s[1]===r||s[2]===r}if(e.isPropertyAssignment(a)&&tn(e,a.name)==="metadata"){let s=a.parent;if(!s)return!1;let l=Qt(e,s).parent;return!!(l&&e.isCallExpression(l)&&en(e,l)==="publish")}return!1}_chunkA5EIY3HIcjs.a.call(void 0, oi,"isPublishMetadataSource");function os(e,t){let n=Qt(e,t),r=n.parent;if(!r)return!1;if(e.isCallExpression(r)){let a=en(e,r);if(a&&ti.has(a)&&r.arguments.some(s=>s===n))return!0}if(e.isArrayLiteralExpression(r))return os(e,r);if(e.isPropertyAssignment(r)){let a=tn(e,r.name);if(a==="intent"||a==="onEvent"||a==="reactsTo"||a==="source"&&oi(e,r))return!0}return!1}_chunkA5EIY3HIcjs.a.call(void 0, os,"isDeclaredIntentSite");function ii(e,t){let n=e.createSourceFile("generated.ts",t,e.ScriptTarget.Latest,!0),r=[],a=_chunkA5EIY3HIcjs.a.call(void 0, s=>{e.isStringLiteralLike(s)&&os(e,s)&&r.push({value:s.text,index:s.getStart(n)}),e.forEachChild(s,a)},"visit");return a(n),r}_chunkA5EIY3HIcjs.a.call(void 0, ii,"extractQuotedStringsAst");function li(e){let t=e.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);return["adapter","adapters","infra","infrastructure","persistence","repository","repositories","integration","database","db"].some(n=>t.includes(n))}_chunkA5EIY3HIcjs.a.call(void 0, li,"hasInfrastructureToken");function ci(e){let t=e.toLowerCase();return["sequelize","prisma","typeorm","mongoose","knex"].some(n=>t===n||t.startsWith(`${n}/`))}_chunkA5EIY3HIcjs.a.call(void 0, ci,"isKnownInfrastructurePackage");function di(e){let t=e.toLowerCase();return["adapter","infra","persistence","repository","repositories","integration","database"].some(n=>t.includes(n))}_chunkA5EIY3HIcjs.a.call(void 0, di,"layerHasInfrastructureRole");function qe(e,t){return t&&e.isStringLiteralLike(t)?t.text:void 0}_chunkA5EIY3HIcjs.a.call(void 0, qe,"tsStringLiteralText");function tn(e,t){if(t&&(e.isIdentifier(t)||e.isStringLiteralLike(t)))return t.text}_chunkA5EIY3HIcjs.a.call(void 0, tn,"tsPropertyName");function is(e,t,n){if(!(!t||!e.isObjectLiteralExpression(t)))return t.properties.find(r=>!e.isPropertyAssignment(r)&&!e.isShorthandPropertyAssignment(r)?!1:tn(e,r.name)===n)}_chunkA5EIY3HIcjs.a.call(void 0, is,"tsObjectProperty");function Ye(e,t,n){return is(e,t,n)!==void 0}_chunkA5EIY3HIcjs.a.call(void 0, Ye,"tsObjectHasProperty");function We(e,t,n){let r=is(e,t,n);return r&&e.isPropertyAssignment(r)?r.initializer:void 0}_chunkA5EIY3HIcjs.a.call(void 0, We,"tsObjectPropertyValue");function ui(e,t){let n=We(e,t,"metadata");return Ye(e,n,"source")}_chunkA5EIY3HIcjs.a.call(void 0, ui,"tsObjectHasMetadataSource");function ls(e,t){return t?e.isIdentifier(t)?/^[A-Z]/.test(t.text):e.isPropertyAccessExpression(t)?ls(e,t.name):!1:!1}_chunkA5EIY3HIcjs.a.call(void 0, ls,"tsLooksLikeIntentCreatorExpression");function pi(e,t){if(!e.isCallExpression(t))return!1;let n=t.expression;return e.isPropertyAccessExpression(n)?n.name.text==="publish":e.isIdentifier(n)&&n.text==="publish"}_chunkA5EIY3HIcjs.a.call(void 0, pi,"tsIsPublishCall");function fi(e,t){if(!e.isCallExpression(t))return!1;let n=t.arguments[0],r=qe(e,n);return r!==void 0&&_chunkRNQHRDCQcjs.fa.call(void 0, r)||Ye(e,n,"intent")||ls(e,n)}_chunkA5EIY3HIcjs.a.call(void 0, fi,"tsIsArkPublishCandidate");function gi(e,t){if(!e.isCallExpression(t))return!1;let[n,r,a]=t.arguments;return ui(e,n)||Ye(e,r,"source")||Ye(e,a,"source")}_chunkA5EIY3HIcjs.a.call(void 0, gi,"tsPublishHasSource");function mi(e,t){if(!e.isCallExpression(t))return;let[n,r,a]=t.arguments,s=We(e,n,"metadata");return _nullishCoalesce(_nullishCoalesce(qe(e,We(e,s,"source")), () => (qe(e,We(e,r,"source")))), () => (qe(e,We(e,a,"source"))))}_chunkA5EIY3HIcjs.a.call(void 0, mi,"tsPublishSourceLiteral");function yi(e,t,n,r){let a=e.createSourceFile("generated.ts",t,e.ScriptTarget.Latest,!0),s=n,o=_optionalChain([s, 'optionalAccess', _26 => _26.filePath]),l=_optionalChain([s, 'optionalAccess', _27 => _27.layer]),c=[],f=_chunkA5EIY3HIcjs.a.call(void 0, h=>a.getLineAndCharacterOfPosition(h.getStart(a)).line+1,"lineForNode"),g=_chunkA5EIY3HIcjs.a.call(void 0, h=>{if(pi(e,h)){let p=h.arguments[0],R=qe(e,p);for(let m of _chunkRNQHRDCQcjs.ga.call(void 0, {publishCall:!0,rawIntentName:R,objectHasIntent:Ye(e,p,"intent"),arkPublishCandidate:fi(e,h),hasSource:gi(e,h)}))c.push(z(m.ruleId,m.message,{line:f(h),filePath:o}));let u=mi(e,h);if(r&&l&&u&&_chunkRNQHRDCQcjs.fa.call(void 0, u)){let m=r.resolveLayer(u);m&&m!==l&&c.push(z("PUBLISH_SOURCE_LAYER_MISMATCH",`Publish source "${u}" resolves to ${m}, but the target file is classified as ${l}.`,{line:f(h),filePath:o,target:u,fromLayer:l,toLayer:m}))}}e.forEachChild(h,g)},"visit");return g(a),c}_chunkA5EIY3HIcjs.a.call(void 0, yi,"analyzePublishAst");function cs(e={}){let t=new Set((e.intents||[]).map(s=>typeof s=="string"?s:s.name)),n=e.forbiddenPatterns||[],r=new Set(_nullishCoalesce(e.infrastructureLayers, () => ([]))),a=_nullishCoalesce(e.enforceIntentAllowlist, () => (t.size>0));return{validate(s,o){let l=[],c=o,f=_optionalChain([c, 'optionalAccess', _28 => _28.filePath]),g=_optionalChain([c, 'optionalAccess', _29 => _29.layer]),h=e.typescript,p=h?h.createSourceFile(_nullishCoalesce(f, () => ("generated.ts")),s,h.ScriptTarget.Latest,!0):void 0,R=p?Ne(e.typescript,p):void 0,u=R?R.filter(A=>A.specifier!==void 0).map(A=>({value:A.specifier,index:A.node.getStart(p),kind:A.kind,typeOnly:A.typeOnly})):si(s),m=e.typescript?ii(e.typescript,s):ri(s);if(e.typescript&&!_optionalChain([e, 'access', _30 => _30.allowNonLiteralDynamicImport, 'optionalCall', _31 => _31(f)]))for(let A of _nullishCoalesce(_optionalChain([R, 'optionalAccess', _32 => _32.filter, 'call', _33 => _33(({unresolved:b})=>b)]), () => ([]))){let b=A.kind==="require";l.push(z(b?"DYNAMIC_REQUIRE_NOT_ALLOWLISTED":"DYNAMIC_IMPORT_NOT_ALLOWLISTED",`Non-literal ${b?"require call":"dynamic import"} cannot be resolved statically; add the reviewed file to dynamicImportAllowlist.`,{line:A.line,filePath:f}))}let v=g!==void 0&&(r.has(g)||di(g)),w=g!==void 0?` If "${g}" is an infrastructure layer, mark it in ark.config.json with "mayImportInfrastructure": true (or name it with an infra token like Adapters/Persistence/Repository).`:"";for(let A of n)if(A instanceof RegExp){A.lastIndex=0;let b=A.exec(s);A.lastIndex=0,b&&l.push(z("FORBIDDEN_PATTERN",`Forbidden pattern matched: ${A}`,{line:b.index===void 0?void 0:Le(s,b.index),filePath:f,suggestion:"Remove infrastructure imports from domain/application layers."+w}))}else s.includes(A)&&l.push(z("FORBIDDEN_SUBSTRING",`Forbidden substring: ${A}`,{line:Le(s,s.indexOf(A)),filePath:f}));for(let A of u){let b=_nullishCoalesce(_optionalChain([e, 'access', _34 => _34.resolveImportTarget, 'optionalCall', _35 => _35(A.value,f)]), () => ((e.resolveImportLayer?{layer:e.resolveImportLayer(A.value,f)}:void 0))),O=typeof f=="string"?_nullishCoalesce(_optionalChain([e, 'access', _36 => _36.resolveImportTarget, 'optionalCall', _37 => _37(f)]), () => ((e.resolveImportLayer?{layer:g,relPath:void 0}:void 0))):void 0,G=_optionalChain([b, 'optionalAccess', _38 => _38.layer]);if(G&&g){let K=_chunkRNQHRDCQcjs.O.call(void 0, _optionalChain([e, 'access', _39 => _39.architectureProfile, 'optionalAccess', _40 => _40.rules]),g,G,{fromPath:_optionalChain([O, 'optionalAccess', _41 => _41.relPath]),toPath:_optionalChain([b, 'optionalAccess', _42 => _42.relPath]),layers:e.architectureLayers});if(K){let j=K.rule;if(A.typeOnly&&!j.peerIsolation)continue;let I=!!j.peerIsolation,D=K.sliceVerdict,X=_chunkRNQHRDCQcjs.L.call(void 0, D),ne=_nullishCoalesce(_chunkRNQHRDCQcjs.J.call(void 0, j,D), () => ((I?`Layer "${g}" must not import across slices into "${G}".`:`Layer "${g}" must not import "${G}".`))),ue=I&&_optionalChain([D, 'optionalAccess', _43 => _43.explanation])&&(X.reasonId||K.peerIsolationReason!=="cross-slice")?D.explanation:void 0;l.push(z("LAYER_IMPORT_VIOLATION",ue?`${ne} ${ue}`:ne,{line:Le(s,A.index),source:A.value,target:A.value,filePath:f,fromLayer:g,toLayer:G,...I?{peerIsolation:!0}:{},...X.reasonId?{reasonId:X.reasonId}:{},...X.universeFrom?{universeFrom:X.universeFrom}:{},...X.universeTo?{universeTo:X.universeTo}:{},...X.failsStrict===!1?{failsStrict:!1}:{},suggestion:ei(I,K.peerIsolationReason),details:{importKind:A.kind,peerIsolation:I,...A.typeOnly?{typeOnly:!0}:{},...X.reasonId?{reasonId:X.reasonId}:{}}}));continue}continue}v||A.typeOnly||!li(A.value)&&!ci(A.value)||l.push(z("FORBIDDEN_IMPORT",`Forbidden ${A.kind} target: "${A.value}".`,{line:Le(s,A.index),source:A.value,target:A.value,filePath:f,suggestion:"Route infrastructure access through an allowed adapter or port boundary."+w,details:{importKind:A.kind}}))}if(e.policies)for(let A of e.policies){let b=A.check({source:s,context:o});if(b!==!0)if(Array.isArray(b))for(let O of b)l.push(z("POLICY_VIOLATION",O.message,{filePath:f,suggestion:`Fix violation of policy "${A.name}".`}));else b===!1?l.push(z("POLICY_VIOLATION",`Policy ${A.name} failed on generated code`)):l.push(z("POLICY_VIOLATION",b.message))}if(a&&t.size>0)for(let A of m)_chunkRNQHRDCQcjs.fa.call(void 0, A.value)&&!t.has(A.value)&&l.push(z("UNKNOWN_INTENT",`Unknown intent reference: "${A.value}"`,{line:Le(s,A.index),filePath:f,target:A.value,suggestion:`Register intent "${A.value}" via defineIntent() or remove the reference.`}));if(e.architectureProfile&&g)for(let A of m){if(!_chunkRNQHRDCQcjs.fa.call(void 0, A.value))continue;let b=e.architectureProfile.resolveLayer(A.value);if(!b)continue;let O=_chunkRNQHRDCQcjs.O.call(void 0, e.architectureProfile.rules,g,b,{fromPath:typeof f=="string"?f:void 0,layers:e.architectureLayers});if(O){let G=O.sliceVerdict,K=`Layer "${g}" must not reference "${b}" through "${A.value}".`,j=G?_chunkRNQHRDCQcjs.K.call(void 0, {surface:"intent",verdict:G,fromLayer:g,toLayer:b,fromPath:typeof f=="string"?f:void 0,ruleMessage:O.rule.message,childMessage:_optionalChain([O, 'access', _44 => _44.rule, 'access', _45 => _45.childSlices, 'optionalAccess', _46 => _46.message]),defaultMessage:K}):_nullishCoalesce(O.rule.message, () => (K)),I=_chunkRNQHRDCQcjs.L.call(void 0, G);l.push(z("LAYER_REFERENCE_VIOLATION",j,{line:Le(s,A.index),filePath:f,target:A.value,fromLayer:g,toLayer:b,...I.reasonId?{reasonId:I.reasonId}:{},...I.failsStrict===!1?{failsStrict:!1}:{},suggestion:"Route the dependency through an allowed intent, port, or event.",details:{rule:O.rule,peerIsolationReason:O.peerIsolationReason,...I.reasonId?{reasonId:I.reasonId}:{}}}))}}if(e.extensions)for(let A of e.extensions)try{let b=A.analyze(s,o);l.push(...b)}catch(b){l.push(z("EXTENSION_ERROR",`Extension "${A.name}" failed: ${b instanceof Error?b.message:String(b)}`))}if(e.typescript&&p&&g&&_optionalChain([e, 'access', _47 => _47.forbiddenGlobals, 'optionalAccess', _48 => _48[g], 'optionalAccess', _49 => _49.length]))try{let A=e.forbiddenGlobals[g];l.push(...Pe(e.typescript,p,A).map(b=>z("FORBIDDEN_GLOBAL",`${g} must not use the ambient global "${b.name}".`,{line:b.line,filePath:f,target:b.name,fromLayer:g,suggestion:"Inject the capability through a port (e.g. a Clock, IdGenerator, or HttpPort) instead of reaching for the ambient global."})));for(let b of _nullishCoalesce(R, () => ([]))){if(b.typeOnly||!b.specifier)continue;let O=Re(b.specifier,A);O&&l.push(z("FORBIDDEN_GLOBAL",`${g} must not use module "${b.specifier}" because it is the import form of forbidden global "${O}".`,{line:b.line,filePath:f,source:b.specifier,target:b.specifier,fromLayer:g,details:{importKind:b.kind,forbiddenGlobal:O},suggestion:"Inject the capability through a port instead of importing the ambient global module form."}))}}catch(A){l.push(z("AST_ANALYZER_ERROR",`TypeScript AST analyzer failed: ${A instanceof Error?A.message:String(A)}`))}if(e.typescript&&p&&g&&_optionalChain([e, 'access', _50 => _50.capabilityWalls, 'optionalAccess', _51 => _51[g], 'optionalAccess', _52 => _52.length]))try{let A=new Set(e.capabilityWalls[g]),b=_nullishCoalesce(_optionalChain([e, 'access', _53 => _53.forbiddenGlobals, 'optionalAccess', _54 => _54[g]]), () => ([]));for(let O of Jt(e.typescript,p))A.has(O.capability)&&(O.source==="ambient-global"&&ze(O.symbol,b)||O.source==="import-based"&&Re(O.symbol,b)||l.push(z("CAPABILITY_VIOLATION",O.source==="import-based"?`${g} denies the ${O.capability} capability; found import of "${O.symbol}".`:`${g} denies the ${O.capability} capability; found ambient "${O.symbol}".`,{line:O.line,filePath:f,target:O.symbol,capability:O.capability,fromLayer:g,suggestion:"Define a small port (ClockPort, HttpPort, StoragePort) and bind the implementation in an adapter layer."})))}catch(A){l.push(z("AST_ANALYZER_ERROR",`TypeScript AST analyzer failed: ${A instanceof Error?A.message:String(A)}`))}if(e.typescript)try{l.push(...yi(e.typescript,s,o,e.architectureProfile))}catch(A){l.push(z("AST_ANALYZER_ERROR",`TypeScript AST analyzer failed: ${A instanceof Error?A.message:String(A)}`))}return{mode:"lexical-compatibility",completeness:"partial",completenessReasons:["LEXICAL_EVIDENCE_INCOMPLETE"],valid:!1,lexicalValid:!l.some(A=>A.failsStrict!==!1),violations:l}}}}_chunkA5EIY3HIcjs.a.call(void 0, cs,"createAICodeGate");function Z(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`fnv1a-${(t>>>0).toString(16).padStart(8,"0")}`}_chunkA5EIY3HIcjs.a.call(void 0, Z,"deterministicHash");function W(e){if(e===null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(W).join(",")}]`;let t=e;return`{${Object.keys(t).sort().map(n=>`${JSON.stringify(n)}:${W(t[n])}`).join(",")}}`}_chunkA5EIY3HIcjs.a.call(void 0, W,"stableSerialize");function ge(e,t){let n=t.hash;for(let r=0;r<e.length;r+=1)n^=e.charCodeAt(r),n=Math.imul(n,16777619);t.hash=n}_chunkA5EIY3HIcjs.a.call(void 0, ge,"feedText");function nn(e,t){if(Array.isArray(e)){ge("[",t);for(let a=0;a<e.length;a+=1){if(a>0&&ge(",",t),!(a in e))continue;let s=e[a];if(s!==null&&typeof s=="object")nn(s,t);else{let o=JSON.stringify(s);o!==void 0&&ge(o,t)}}ge("]",t);return}let n=e,r=Object.keys(n).sort();ge("{",t);for(let a=0;a<r.length;a+=1){a>0&&ge(",",t);let s=r[a];ge(`${JSON.stringify(s)}:`,t);let o=n[s];o!==null&&typeof o=="object"?nn(o,t):ge(`${JSON.stringify(o)}`,t)}ge("}",t)}_chunkA5EIY3HIcjs.a.call(void 0, nn,"feedStable");function rn(e){if(e===null||typeof e!="object")return Z(W(e));let t={hash:2166136261};return nn(e,t),`fnv1a-${(t.hash>>>0).toString(16).padStart(8,"0")}`}_chunkA5EIY3HIcjs.a.call(void 0, rn,"stableHash");var Se="1.2";var ds=["network","filesystem","clock","randomness","environment","process","persistence"];function V(e){let t=e.map((n,r)=>({key:W(n),index:r}));return t.sort((n,r)=>n.key<r.key?-1:n.key>r.key?1:n.index-r.index),t.map(({index:n})=>e[n])}_chunkA5EIY3HIcjs.a.call(void 0, V,"sortCanonical");function J(e){return[...new Set(e)].sort((t,n)=>t<n?-1:t>n?1:0)}_chunkA5EIY3HIcjs.a.call(void 0, J,"sortedUnique");function Xe(e){let t={schemaVersion:"1.2",include:J(_nullishCoalesce(e.include, () => ([]))),exclude:J(_nullishCoalesce(e.exclude, () => ([]))),excludeGenerated:e.excludeGenerated!==!1,dynamicImportAllowlist:J(_nullishCoalesce(e.dynamicImportAllowlist, () => ([]))),layers:V(e.layers.map(n=>({name:n.name,patterns:J(_nullishCoalesce(n.patterns, () => ([]))),exclude:J(_nullishCoalesce(n.exclude, () => ([]))),forbiddenGlobals:J(_nullishCoalesce(n.forbiddenGlobals, () => ([]))),intentPrefixes:J(_nullishCoalesce(n.intentPrefixes, () => ([]))),capabilityDeny:J(_nullishCoalesce(_optionalChain([n, 'access', _55 => _55.capabilities, 'optionalAccess', _56 => _56.deny]), () => ([]))),pure:n.pure===!0}))),safety:{maxTsSuppressions:_nullishCoalesce(_optionalChain([e, 'access', _57 => _57.safety, 'optionalAccess', _58 => _58.maxTsSuppressions]), () => (0)),maxAnyCasts:_nullishCoalesce(_optionalChain([e, 'access', _59 => _59.safety, 'optionalAccess', _60 => _60.maxAnyCasts]), () => (0)),allowInMemory:_optionalChain([e, 'access', _61 => _61.safety, 'optionalAccess', _62 => _62.allowInMemory])===!0,allowDisabledPeerIsolation:_optionalChain([e, 'access', _63 => _63.safety, 'optionalAccess', _64 => _64.allowDisabledPeerIsolation])===!0},...e.arkRun?{arkRun:{mode:e.arkRun.mode,compositionRoots:J(e.arkRun.compositionRoots),managedLayers:J(e.arkRun.managedLayers),requireDeclarations:e.arkRun.requireDeclarations===!0}}:{}};return Z(W(t))}_chunkA5EIY3HIcjs.a.call(void 0, Xe,"resolvedFactsEvidenceRequirementsHash");function hi(e){let t=V(e.completenessReasons.map(I=>({code:I.code,message:I.message,...I.file?{file:I.file}:{}}))),n=e.files.map(I=>({...I,typeOnlyExportNames:J(I.typeOnlyExportNames)})).sort((I,D)=>I.path<D.path?-1:I.path>D.path?1:0),r=V(e.dependencies.map(I=>({...I,...I.namedBindings?{namedBindings:J(I.namedBindings)}:{}}))),a=V(e.capabilityUses.map(I=>({...I}))),s=V(e.ambientUses.map(I=>({...I}))),o=V(e.publishCalls.map(I=>({...I}))),l=V(e.intentReferences.map(I=>({...I}))),c=V(e.safetyUses.map(I=>({...I}))),f=V((_nullishCoalesce(e.classShapes, () => ([]))).map(I=>({...I,mutatingMethods:[..._nullishCoalesce(I.mutatingMethods, () => ([]))].map(D=>({...D}))}))),g=V((_nullishCoalesce(e.arkRunKernelCalls, () => ([]))).map(I=>({...I}))),h=V((_nullishCoalesce(e.arkRunManagedNews, () => ([]))).map(I=>({...I}))),p=V((_nullishCoalesce(e.arkRunCompositionRootHits, () => ([]))).map(I=>({...I}))),R=V((_nullishCoalesce(e.arkRunDeclarations, () => ([]))).map(I=>({...I,uses:J(I.uses),reactsTo:J(I.reactsTo),raises:J(I.raises),sends:J(I.sends)}))),u=V((_nullishCoalesce(e.arkOrderPlaneCalls, () => ([]))).map(I=>({...I}))),m=V((_nullishCoalesce(e.arkOrderGenericUpdates, () => ([]))).map(I=>({...I}))),v=V((_nullishCoalesce(e.arkOrderRootHits, () => ([]))).map(I=>({...I}))),w=V((_nullishCoalesce(e.arkOrderXiFieldWrites, () => ([]))).map(I=>({...I}))),A=V((_nullishCoalesce(e.arkOrderIngestWritesXi, () => ([]))).map(I=>({...I}))),b=V((_nullishCoalesce(e.arkOrderReleaseKeyCounts, () => ([]))).map(I=>({...I}))),O=V((_nullishCoalesce(e.arkOrderXiTtlKeys, () => ([]))).map(I=>({...I}))),G=V((_nullishCoalesce(e.arkOrderBudgetLeaks, () => ([]))).map(I=>({...I}))),K=e.files.map(({path:I,contentHash:D})=>({path:I,contentHash:D})).sort((I,D)=>I.path<D.path?-1:I.path>D.path?1:0),j=rn(K);return{schemaVersion:"1.2",completeness:e.completeness,completenessReasons:t,resolverIdentity:e.resolverIdentity,compilerIdentity:e.compilerIdentity,compilerOptionsHash:e.compilerOptionsHash,tsconfigHash:e.tsconfigHash,candidateTreeHash:j,evidenceRequirementsHash:e.evidenceRequirementsHash,...e.projectPackageName?{projectPackageName:e.projectPackageName}:{},files:n,dependencies:r,capabilityUses:a,ambientUses:s,publishCalls:o,intentReferences:l,safetyUses:c,classShapes:f,arkRunKernelCalls:g,arkRunManagedNews:h,arkRunCompositionRootHits:p,arkRunDeclarations:R,arkOrderPlaneCalls:u,arkOrderGenericUpdates:m,arkOrderRootHits:v,arkOrderXiFieldWrites:w,arkOrderIngestWritesXi:A,arkOrderReleaseKeyCounts:b,arkOrderXiTtlKeys:O,arkOrderBudgetLeaks:G}}_chunkA5EIY3HIcjs.a.call(void 0, hi,"canonicalResolvedFactsInput");function us(e){let t=hi(e);return{...t,factsHash:rn(t)}}_chunkA5EIY3HIcjs.a.call(void 0, us,"createCanonicalResolvedCandidateFacts");function an(e){return us(ps(P(e,"$"),!1))}_chunkA5EIY3HIcjs.a.call(void 0, an,"createResolvedCandidateFacts");function P(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object.`);return e}_chunkA5EIY3HIcjs.a.call(void 0, P,"asRecord");function L(e,t,n){let r=Object.keys(e).find(a=>!t.includes(a));if(r)throw new Error(`${n}.${r} is not part of schema ${"1.2"}.`)}_chunkA5EIY3HIcjs.a.call(void 0, L,"assertOnlyKeys");function N(e,t,n){let r=e[t];if(typeof r!="string"||r.length===0)throw new Error(`${n}.${t} must be a non-empty string.`);return r}_chunkA5EIY3HIcjs.a.call(void 0, N,"requiredText");function me(e,t,n){if(e[t]!==void 0)return N(e,t,n)}_chunkA5EIY3HIcjs.a.call(void 0, me,"optionalText");function F(e,t,n){let r=N(e,t,n),a=r.replace(/\\/g,"/");if(!a||a.startsWith("/")||/^[A-Za-z]:\//.test(a)||/[\u0000-\u001f\u007f]/.test(a))throw new Error(`${n}.${t} must be a canonical project-relative path.`);let s=[];for(let l of a.split("/"))if(!(!l||l==="."))if(l===".."){if(s.length===0)throw new Error(`${n}.${t} must be a canonical project-relative path.`);s.pop()}else s.push(l);let o=s.join("/");if(!o||o!==r)throw new Error(`${n}.${t} must be a canonical project-relative path.`);return o}_chunkA5EIY3HIcjs.a.call(void 0, F,"requiredProjectPath");function B(e,t,n){if(typeof e[t]!="boolean")throw new Error(`${n}.${t} must be a boolean.`);return e[t]}_chunkA5EIY3HIcjs.a.call(void 0, B,"requiredBoolean");function sn(e,t,n){let r=e[t];if(!Number.isInteger(r)||Number(r)<0)throw new Error(`${n}.${t} must be a non-negative integer.`);return Number(r)}_chunkA5EIY3HIcjs.a.call(void 0, sn,"requiredInteger");function Y(e,t,n){let r=sn(e,t,n);if(r===0)throw new Error(`${n}.${t} must be a positive integer.`);return r}_chunkA5EIY3HIcjs.a.call(void 0, Y,"requiredPositiveInteger");function $(e,t,n){let r=e[t];if(!Array.isArray(r))throw new Error(`${n}.${t} must be an array.`);return r}_chunkA5EIY3HIcjs.a.call(void 0, $,"requiredArray");function ye(e,t,n,r){let a=e[t];if(typeof a!="string"||!n.includes(a))throw new Error(`${r}.${t} must be one of ${n.join(", ")}.`);return a}_chunkA5EIY3HIcjs.a.call(void 0, ye,"enumValue");function De(e,t){if(!Array.isArray(e)||e.some(n=>typeof n!="string"||!n))throw new Error(`${t} must be an array of non-empty strings.`);return[...e]}_chunkA5EIY3HIcjs.a.call(void 0, De,"parseStringArray");function Ri(e,t,n){let r=new Set;for(let a of e){let s=t(a);if(r.has(s))throw new Error(`${n} must not contain duplicate facts (${s}).`);r.add(s)}}_chunkA5EIY3HIcjs.a.call(void 0, Ri,"assertUnique");function ps(e,t){L(e,["schemaVersion","completeness","completenessReasons","resolverIdentity","compilerIdentity","compilerOptionsHash","tsconfigHash","evidenceRequirementsHash","projectPackageName","files","dependencies","capabilityUses","ambientUses","publishCalls","intentReferences","safetyUses","classShapes","arkRunKernelCalls","arkRunManagedNews","arkRunCompositionRootHits","arkRunDeclarations","arkOrderPlaneCalls","arkOrderGenericUpdates","arkOrderRootHits","arkOrderXiFieldWrites","arkOrderIngestWritesXi","arkOrderReleaseKeyCounts","arkOrderXiTtlKeys","arkOrderBudgetLeaks",...t?["candidateTreeHash","factsHash"]:[]],"$");let n=ye(e,"schemaVersion",["1.0","1.1","1.2"],"$"),r=ye(e,"completeness",["complete","partial","unavailable"],"$"),a=$(e,"completenessReasons","$").map((E,_)=>{let y=`$.completenessReasons[${_}]`,d=P(E,y);L(d,["code","message","file"],y);let T=d.file===void 0?void 0:F(d,"file",y);return{code:N(d,"code",y),message:N(d,"message",y),...T?{file:T}:{}}});if(r==="complete"&&a.length>0)throw new Error("$.completenessReasons must be empty when completeness is complete.");if(r!=="complete"&&a.length===0)throw new Error("$.completenessReasons must explain partial or unavailable facts.");let s=$(e,"files","$").map((E,_)=>{let y=`$.files[${_}]`,d=P(E,y);return L(d,["path","contentHash","parseStatus","parseDiagnosticCount","exportsOnlyTypes","typeOnlyExportNames","hasTopLevelSideEffects"],y),{path:F(d,"path",y),contentHash:N(d,"contentHash",y),parseStatus:ye(d,"parseStatus",["parsed","invalid"],y),parseDiagnosticCount:sn(d,"parseDiagnosticCount",y),exportsOnlyTypes:B(d,"exportsOnlyTypes",y),typeOnlyExportNames:De(d.typeOnlyExportNames,`${y}.typeOnlyExportNames`),hasTopLevelSideEffects:B(d,"hasTopLevelSideEffects",y)}}),o=$(e,"dependencies","$").map((E,_)=>{let y=`$.dependencies[${_}]`,d=P(E,y);L(d,["from","specifier","kind","typeOnly","line","resolution","target","namedBindings","targetTypeOnlyExports","sourcePureTypeModule","namedBindingsTypeOnly","portProofEligible"],y);let T=me(d,"specifier",y),U=me(d,"target",y),re=ye(d,"resolution",["resolved-project","resolved-external","unresolved","dynamic"],y);if(re==="resolved-project"&&!U)throw new Error(`${y}.target is required for resolved-project dependencies.`);if(re!=="resolved-project"&&U)throw new Error(`${y}.target is only allowed for resolved-project dependencies.`);if(re!=="dynamic"&&!T)throw new Error(`${y}.specifier is required unless resolution is dynamic.`);return{from:F(d,"from",y),...T?{specifier:T}:{},kind:ye(d,"kind",["import","export","dynamic-import","require"],y),typeOnly:B(d,"typeOnly",y),line:Y(d,"line",y),resolution:re,...U?{target:F(d,"target",y)}:{},...d.namedBindings!==void 0?{namedBindings:De(d.namedBindings,`${y}.namedBindings`)}:{},...d.targetTypeOnlyExports!==void 0?{targetTypeOnlyExports:B(d,"targetTypeOnlyExports",y)}:{},...d.sourcePureTypeModule!==void 0?{sourcePureTypeModule:B(d,"sourcePureTypeModule",y)}:{},...d.namedBindingsTypeOnly!==void 0?{namedBindingsTypeOnly:B(d,"namedBindingsTypeOnly",y)}:{},...d.portProofEligible!==void 0?{portProofEligible:B(d,"portProofEligible",y)}:{}}}),l=$(e,"capabilityUses","$").map((E,_)=>{let y=`$.capabilityUses[${_}]`,d=P(E,y);return L(d,["file","line","symbol","capability","source"],y),{file:F(d,"file",y),line:Y(d,"line",y),symbol:N(d,"symbol",y),capability:ye(d,"capability",ds,y),source:ye(d,"source",["ambient-global","import-based"],y)}}),c=$(e,"ambientUses","$").map((E,_)=>{let y=`$.ambientUses[${_}]`,d=P(E,y);return L(d,["file","line","symbol"],y),{file:F(d,"file",y),line:Y(d,"line",y),symbol:N(d,"symbol",y)}}),f=$(e,"publishCalls","$").map((E,_)=>{let y=`$.publishCalls[${_}]`,d=P(E,y);L(d,["file","line","rawIntentName","objectHasIntent","arkPublishCandidate","hasSource","sourceIntent"],y);let T=me(d,"rawIntentName",y),U=me(d,"sourceIntent",y);return{file:F(d,"file",y),line:Y(d,"line",y),...T?{rawIntentName:T}:{},objectHasIntent:B(d,"objectHasIntent",y),arkPublishCandidate:B(d,"arkPublishCandidate",y),hasSource:B(d,"hasSource",y),...U?{sourceIntent:U}:{}}}),g=$(e,"intentReferences","$").map((E,_)=>{let y=`$.intentReferences[${_}]`,d=P(E,y);return L(d,["file","line","intent"],y),{file:F(d,"file",y),line:Y(d,"line",y),intent:N(d,"intent",y)}}),h=$(e,"safetyUses","$").map((E,_)=>{let y=`$.safetyUses[${_}]`,d=P(E,y);L(d,["file","line","kind","symbol"],y);let T=me(d,"symbol",y),U=ye(d,"kind",["ts-suppression","any-cast","dynamic-import","dynamic-require","in-memory-store"],y);if(U==="in-memory-store"&&!T)throw new Error(`${y}.symbol is required for in-memory-store facts.`);if(U!=="in-memory-store"&&T)throw new Error(`${y}.symbol is only allowed for in-memory-store facts.`);return{file:F(d,"file",y),line:Y(d,"line",y),kind:U,...T?{symbol:T}:{}}});Ri(s,E=>E.path,"$.files");let p=new Set(s.map(E=>E.path));for(let E of s){if(E.parseStatus==="parsed"&&E.parseDiagnosticCount!==0)throw new Error(`$.files[${E.path}].parseDiagnosticCount must be 0 when parseStatus is parsed.`);if(E.parseStatus==="invalid"&&E.parseDiagnosticCount===0)throw new Error(`$.files[${E.path}].parseDiagnosticCount must be positive when parseStatus is invalid.`)}if(r==="complete"&&s.some(E=>E.parseStatus==="invalid"))throw new Error("$.completeness cannot be complete when a candidate file failed to parse.");for(let E of o)if(!p.has(E.from))throw new Error(`$.dependencies references missing source file ${E.from}.`);let u=(e.arkRunKernelCalls===void 0?[]:$(e,"arkRunKernelCalls","$")).map((E,_)=>{let y=`$.arkRunKernelCalls[${_}]`,d=P(E,y);L(d,["file","line","kind","callee","viaImport","receiver","nameLiteral"],y);let T=me(d,"receiver",y),U=me(d,"nameLiteral",y);return{file:F(d,"file",y),line:Y(d,"line",y),kind:ye(d,"kind",["factory","publisher","publish","raise","send","subscribe","register-handler","resolve","resolve-singleton"],y),callee:N(d,"callee",y),viaImport:B(d,"viaImport",y),...T?{receiver:T}:{},...U?{nameLiteral:U}:{}}}),v=(e.arkRunManagedNews===void 0?[]:$(e,"arkRunManagedNews","$")).map((E,_)=>{let y=`$.arkRunManagedNews[${_}]`,d=P(E,y);L(d,["file","line","typeName","importedFrom"],y);let T=me(d,"importedFrom",y);return{file:F(d,"file",y),line:Y(d,"line",y),typeName:N(d,"typeName",y),...T?{importedFrom:T}:{}}}),A=(e.arkRunCompositionRootHits===void 0?[]:$(e,"arkRunCompositionRootHits","$")).map((E,_)=>{let y=`$.arkRunCompositionRootHits[${_}]`,d=P(E,y);return L(d,["file","matchedRoot","hasKernelFactory"],y),{file:F(d,"file",y),matchedRoot:N(d,"matchedRoot",y),hasKernelFactory:B(d,"hasKernelFactory",y)}}),b=e.arkRunDeclarations===void 0?[]:$(e,"arkRunDeclarations","$"),G=(e.arkOrderPlaneCalls===void 0?[]:$(e,"arkOrderPlaneCalls","$")).map((E,_)=>{let y=`$.arkOrderPlaneCalls[${_}]`,d=P(E,y);return L(d,["file","line","callee"],y),{file:F(d,"file",y),line:Y(d,"line",y),callee:N(d,"callee",y)}}),j=(e.arkOrderGenericUpdates===void 0?[]:$(e,"arkOrderGenericUpdates","$")).map((E,_)=>{let y=`$.arkOrderGenericUpdates[${_}]`,d=P(E,y);return L(d,["file","line","method"],y),{file:F(d,"file",y),line:Y(d,"line",y),method:N(d,"method",y)}}),D=(e.arkOrderRootHits===void 0?[]:$(e,"arkOrderRootHits","$")).map((E,_)=>{let y=`$.arkOrderRootHits[${_}]`,d=P(E,y);return L(d,["file","matchedRoot","hasPlaneFactory"],y),{file:F(d,"file",y),matchedRoot:N(d,"matchedRoot",y),hasPlaneFactory:B(d,"hasPlaneFactory",y)}}),ne=(e.arkOrderXiFieldWrites===void 0?[]:$(e,"arkOrderXiFieldWrites","$")).map((E,_)=>{let y=`$.arkOrderXiFieldWrites[${_}]`,d=P(E,y);return L(d,["file","line","key"],y),{file:F(d,"file",y),line:Y(d,"line",y),key:N(d,"key",y)}}),ae=(e.arkOrderIngestWritesXi===void 0?[]:$(e,"arkOrderIngestWritesXi","$")).map((E,_)=>{let y=`$.arkOrderIngestWritesXi[${_}]`,d=P(E,y);return L(d,["file","line"],y),{file:F(d,"file",y),line:Y(d,"line",y)}}),pe=(e.arkOrderReleaseKeyCounts===void 0?[]:$(e,"arkOrderReleaseKeyCounts","$")).map((E,_)=>{let y=`$.arkOrderReleaseKeyCounts[${_}]`,d=P(E,y);return L(d,["file","line","keyCount"],y),{file:F(d,"file",y),line:Y(d,"line",y),keyCount:Y(d,"keyCount",y)}}),st=(e.arkOrderXiTtlKeys===void 0?[]:$(e,"arkOrderXiTtlKeys","$")).map((E,_)=>{let y=`$.arkOrderXiTtlKeys[${_}]`,d=P(E,y);return L(d,["file","line","key"],y),{file:F(d,"file",y),line:Y(d,"line",y),key:N(d,"key",y)}}),Nt=(e.arkOrderBudgetLeaks===void 0?[]:$(e,"arkOrderBudgetLeaks","$")).map((E,_)=>{let y=`$.arkOrderBudgetLeaks[${_}]`,d=P(E,y);return L(d,["file","line","kind"],y),{file:F(d,"file",y),line:Y(d,"line",y),kind:N(d,"kind",y)}}),Ve=b.map((E,_)=>{let y=`$.arkRunDeclarations[${_}]`,d=P(E,y);return L(d,["file","line","uses","reactsTo","raises","sends"],y),{file:F(d,"file",y),line:Y(d,"line",y),uses:De(d.uses,`${y}.uses`),reactsTo:De(d.reactsTo,`${y}.reactsTo`),raises:De(d.raises,`${y}.raises`),sends:De(d.sends,`${y}.sends`)}});for(let[E,_]of[["$.capabilityUses",l],["$.ambientUses",c],["$.publishCalls",f],["$.intentReferences",g],["$.safetyUses",h],["$.arkRunKernelCalls",u],["$.arkRunManagedNews",v],["$.arkRunCompositionRootHits",A],["$.arkRunDeclarations",Ve],["$.arkOrderPlaneCalls",G],["$.arkOrderGenericUpdates",j],["$.arkOrderRootHits",D],["$.arkOrderXiFieldWrites",ne],["$.arkOrderIngestWritesXi",ae],["$.arkOrderReleaseKeyCounts",pe],["$.arkOrderXiTtlKeys",st],["$.arkOrderBudgetLeaks",Nt]])for(let y of _)if(!p.has(y.file))throw new Error(`${E} references missing file ${y.file}.`);let Ie=me(e,"projectPackageName","$"),Pt=(e.classShapes===void 0?[]:$(e,"classShapes","$")).map((E,_)=>{let y=`$.classShapes[${_}]`,d=P(E,y);L(d,["file","className","exported","hasPublicMutableFields","hasPublicSetters","hasPublicConstructor","hasStaticFactory","mutatingMethods","dataOnly","truncatedUntil"],y);let T=$(d,"mutatingMethods",y).map((U,re)=>{let ot=`${y}.mutatingMethods[${re}]`,Lt=P(U,ot);return L(Lt,["name","referencesGuardOrPublish"],ot),{name:N(Lt,"name",ot),referencesGuardOrPublish:B(Lt,"referencesGuardOrPublish",ot)}});return{file:F(d,"file",y),className:N(d,"className",y),exported:B(d,"exported",y),hasPublicMutableFields:B(d,"hasPublicMutableFields",y),hasPublicSetters:B(d,"hasPublicSetters",y),hasPublicConstructor:B(d,"hasPublicConstructor",y),hasStaticFactory:B(d,"hasStaticFactory",y),mutatingMethods:T,...d.dataOnly===void 0?{}:{dataOnly:B(d,"dataOnly",y)},...d.truncatedUntil===void 0?{}:{truncatedUntil:sn(d,"truncatedUntil",y)}}});return{schemaVersion:n,completeness:r,completenessReasons:a,resolverIdentity:N(e,"resolverIdentity","$"),compilerIdentity:N(e,"compilerIdentity","$"),compilerOptionsHash:N(e,"compilerOptionsHash","$"),tsconfigHash:N(e,"tsconfigHash","$"),evidenceRequirementsHash:N(e,"evidenceRequirementsHash","$"),...Ie?{projectPackageName:Ie}:{},files:s,dependencies:o,capabilityUses:l,ambientUses:c,publishCalls:f,intentReferences:g,safetyUses:h,classShapes:Pt,arkRunKernelCalls:u,arkRunManagedNews:v,arkRunCompositionRootHits:A,arkRunDeclarations:Ve,arkOrderPlaneCalls:G,arkOrderGenericUpdates:j,arkOrderRootHits:D,arkOrderXiFieldWrites:ne,arkOrderIngestWritesXi:ae,arkOrderReleaseKeyCounts:pe,arkOrderXiTtlKeys:st,arkOrderBudgetLeaks:Nt}}_chunkA5EIY3HIcjs.a.call(void 0, ps,"parseResolvedFactsInput");function Ae(e){let t=P(e,"$"),n=N(t,"factsHash","$"),r=N(t,"candidateTreeHash","$"),a=us(ps(t,!0));if(a.factsHash!==n)throw new Error(`$.factsHash does not match the canonical payload (${a.factsHash}).`);if(r!==a.candidateTreeHash)throw new Error(`$.candidateTreeHash does not match the canonical file tree (${a.candidateTreeHash}).`);return a}_chunkA5EIY3HIcjs.a.call(void 0, Ae,"loadResolvedCandidateFacts");var Ai=["network","filesystem","clock","randomness","environment","process","persistence"],x={type:"string",minLength:1},Q={type:"integer",minimum:1},M={type:"string",minLength:1,pattern:"^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$"},on= exports.RESOLVED_CANDIDATE_FACTS_SCHEMA ={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://unpkg.com/arkgate@3/schemas/ark.resolved-candidate-facts.schema.json",title:"ArkGate resolved candidate facts",type:"object",additionalProperties:!1,required:["schemaVersion","completeness","completenessReasons","resolverIdentity","compilerIdentity","compilerOptionsHash","tsconfigHash","candidateTreeHash","evidenceRequirementsHash","files","dependencies","capabilityUses","ambientUses","publishCalls","intentReferences","safetyUses","factsHash"],properties:{schemaVersion:{enum:["1.0","1.1","1.2"]},completeness:{enum:["complete","partial","unavailable"]},completenessReasons:{type:"array",items:{type:"object",additionalProperties:!1,required:["code","message"],properties:{code:x,message:x,file:M}}},resolverIdentity:x,compilerIdentity:x,compilerOptionsHash:x,tsconfigHash:x,candidateTreeHash:x,evidenceRequirementsHash:x,projectPackageName:x,files:{type:"array",uniqueItems:!0,items:{type:"object",additionalProperties:!1,required:["path","contentHash","parseStatus","parseDiagnosticCount","exportsOnlyTypes","typeOnlyExportNames","hasTopLevelSideEffects"],properties:{path:M,contentHash:x,parseStatus:{enum:["parsed","invalid"]},parseDiagnosticCount:{type:"integer",minimum:0},exportsOnlyTypes:{type:"boolean"},typeOnlyExportNames:{type:"array",items:x},hasTopLevelSideEffects:{type:"boolean"}},allOf:[{if:{properties:{parseStatus:{const:"parsed"}}},then:{properties:{parseDiagnosticCount:{const:0}}}},{if:{properties:{parseStatus:{const:"invalid"}}},then:{properties:{parseDiagnosticCount:{minimum:1}}}}]}},dependencies:{type:"array",items:{type:"object",additionalProperties:!1,required:["from","kind","typeOnly","line","resolution"],properties:{from:M,specifier:x,kind:{enum:["import","export","dynamic-import","require"]},typeOnly:{type:"boolean"},line:Q,resolution:{enum:["resolved-project","resolved-external","unresolved","dynamic"]},target:M,namedBindings:{type:"array",items:x},targetTypeOnlyExports:{type:"boolean"},sourcePureTypeModule:{type:"boolean"},namedBindingsTypeOnly:{type:"boolean"},portProofEligible:{type:"boolean"}},allOf:[{if:{properties:{resolution:{const:"resolved-project"}}},then:{required:["target"]},else:{not:{required:["target"]}}},{if:{properties:{resolution:{const:"dynamic"}}},else:{required:["specifier"]}}]}},capabilityUses:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","symbol","capability","source"],properties:{file:M,line:Q,symbol:x,capability:{enum:Ai},source:{enum:["ambient-global","import-based"]}}}},ambientUses:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","symbol"],properties:{file:M,line:Q,symbol:x}}},publishCalls:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","objectHasIntent","arkPublishCandidate","hasSource"],properties:{file:M,line:Q,rawIntentName:x,objectHasIntent:{type:"boolean"},arkPublishCandidate:{type:"boolean"},hasSource:{type:"boolean"},sourceIntent:x}}},intentReferences:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","intent"],properties:{file:M,line:Q,intent:x}}},safetyUses:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","kind"],properties:{file:M,line:Q,kind:{enum:["ts-suppression","any-cast","dynamic-import","dynamic-require","in-memory-store"]},symbol:x},allOf:[{if:{properties:{kind:{const:"in-memory-store"}}},then:{required:["symbol"]},else:{not:{required:["symbol"]}}}]}},classShapes:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","className","exported","hasPublicMutableFields","hasPublicSetters","hasPublicConstructor","hasStaticFactory","mutatingMethods"],properties:{file:M,className:x,exported:{type:"boolean"},hasPublicMutableFields:{type:"boolean"},hasPublicSetters:{type:"boolean"},hasPublicConstructor:{type:"boolean"},hasStaticFactory:{type:"boolean"},dataOnly:{type:"boolean"},truncatedUntil:{type:"integer",minimum:0},mutatingMethods:{type:"array",items:{type:"object",additionalProperties:!1,required:["name","referencesGuardOrPublish"],properties:{name:x,referencesGuardOrPublish:{type:"boolean"}}}}}}},arkRunKernelCalls:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","kind","callee","viaImport"],properties:{file:M,line:Q,kind:{enum:["factory","publisher","publish","raise","send","subscribe","register-handler","resolve","resolve-singleton"]},callee:x,viaImport:{type:"boolean"},receiver:x,nameLiteral:x}}},arkRunManagedNews:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","typeName"],properties:{file:M,line:Q,typeName:x,importedFrom:x}}},arkRunCompositionRootHits:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","matchedRoot","hasKernelFactory"],properties:{file:M,matchedRoot:x,hasKernelFactory:{type:"boolean"}}}},arkRunDeclarations:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","uses","reactsTo","raises","sends"],properties:{file:M,line:Q,uses:{type:"array",items:x},reactsTo:{type:"array",items:x},raises:{type:"array",items:x},sends:{type:"array",items:x}}}},arkOrderPlaneCalls:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","callee"],properties:{file:M,line:Q,callee:x}}},arkOrderGenericUpdates:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","method"],properties:{file:M,line:Q,method:x}}},arkOrderRootHits:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","matchedRoot","hasPlaneFactory"],properties:{file:M,matchedRoot:x,hasPlaneFactory:{type:"boolean"}}}},arkOrderXiFieldWrites:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","key"],properties:{file:M,line:Q,key:x}}},arkOrderIngestWritesXi:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line"],properties:{file:M,line:Q}}},arkOrderReleaseKeyCounts:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","keyCount"],properties:{file:M,line:Q,keyCount:{type:"integer",minimum:1}}}},arkOrderXiTtlKeys:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","key"],properties:{file:M,line:Q,key:x}}},arkOrderBudgetLeaks:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","kind"],properties:{file:M,line:Q,kind:x}}},factsHash:x},allOf:[{if:{properties:{completeness:{const:"complete"}}},then:{properties:{completenessReasons:{maxItems:0},files:{items:{properties:{parseStatus:{const:"parsed"}}}}}}},{if:{properties:{completeness:{enum:["partial","unavailable"]}}},then:{properties:{completenessReasons:{minItems:1}}}}]};var ln="1.0";function ee(e){return`${e.from}->${e.to}`}_chunkA5EIY3HIcjs.a.call(void 0, ee,"dependencyKey");function Ze(e,t,n,r="dependency"){return{id:`${e}:${r}:${ee(t)}`,classification:e,subject:"dependency",from:t.from,to:t.to,message:n,...e==="missing"?{nextAction:`Add the planned dependency ${ee(t)} to the candidate, then preflight again.`}:e==="contradictory"?{nextAction:`Replace the reverse dependency with ${ee(t)}, then preflight again.`}:e==="unplanned"?{nextAction:r==="dependency-removed"?`Restore the removed dependency ${ee(t)} in the candidate, then preflight again.`:`Remove the unplanned dependency ${ee(t)} from the candidate, then preflight again.`}:{}}}_chunkA5EIY3HIcjs.a.call(void 0, Ze,"dependencyFinding");function Fe(e){let t=[],n=new Map(e.changeMap.map.files.map(p=>[p.path,p])),r=new Map(e.changes.map(p=>[p.path,p])),a=new Map(e.changeMap.map.dependencies.map(p=>[ee(p),p])),s=new Map(e.baseDependencies.map(p=>[ee(p),p])),o=new Map(e.candidateDependencies.map(p=>[ee(p),p]));for(let p of[...n.values()].sort((R,u)=>R.path.localeCompare(u.path))){let R=r.get(p.path);R?R.operation!==p.operation?t.push({id:`contradictory:file:${p.path}`,classification:"contradictory",subject:"file",path:p.path,expectedOperation:p.operation,actualOperation:R.operation,message:`${p.path} was planned as ${p.operation} but the actual operation is ${R.operation}.`,nextAction:`Change ${p.path} to the planned ${p.operation} operation, then preflight again.`}):t.push({id:`satisfied:file:${p.path}`,classification:"satisfied",subject:"file",path:p.path,expectedOperation:p.operation,actualOperation:R.operation,message:`${p.path} matches the planned ${p.operation} operation.`}):t.push({id:`missing:file:${p.path}`,classification:"missing",subject:"file",path:p.path,expectedOperation:p.operation,message:`${p.path} was planned as ${p.operation} but is absent from the actual change.`,nextAction:`${p.operation[0].toUpperCase()}${p.operation.slice(1)} ${p.path} in the complete change set, then preflight again.`})}for(let p of[...r.values()].sort((R,u)=>R.path.localeCompare(u.path)))n.has(p.path)||t.push({id:`unplanned:file:${p.path}`,classification:"unplanned",subject:"file",path:p.path,actualOperation:p.operation,message:`${p.path} has an unplanned ${p.operation} operation.`,nextAction:`Remove ${p.path} from the change set, then preflight again.`});let l=new Set;for(let p of[...a.values()].sort((R,u)=>ee(R).localeCompare(ee(u)))){if(o.has(ee(p))){t.push(Ze("satisfied",p,`${p.from} -> ${p.to} exists in the candidate architecture.`));continue}let R={from:p.to,to:p.from};o.has(ee(R))?(l.add(ee(R)),t.push(Ze("contradictory",p,`${p.from} -> ${p.to} was planned, but the candidate contains the reverse edge.`))):t.push(Ze("missing",p,`${p.from} -> ${p.to} is absent from the candidate architecture.`))}let c=new Set([...n.keys(),...r.keys()]);for(let[p,R]of[...o].sort(([u],[m])=>u.localeCompare(m)))s.has(p)||a.has(p)||l.has(p)||!c.has(R.from)&&!c.has(R.to)||t.push({...Ze("unplanned",R,`${R.from} -> ${R.to} was added without a matching planned dependency.`,"dependency-added"),actualOperation:"added"});let f=new Set(e.changeMap.map.files.filter(p=>p.operation==="delete").map(p=>p.path));for(let[p,R]of[...s].sort(([u],[m])=>u.localeCompare(m)))o.has(p)||f.has(R.from)||f.has(R.to)||!c.has(R.from)&&!c.has(R.to)||t.push({...Ze("unplanned",R,`${R.from} -> ${R.to} was removed without a planned file deletion.`,"dependency-removed"),actualOperation:"removed"});let g={satisfied:0,missing:1,contradictory:2,unplanned:3};t.sort((p,R)=>g[p.classification]-g[R.classification]||(p.subject===R.subject?0:p.subject==="file"?-1:1)||p.id.localeCompare(R.id));let h={satisfied:t.filter(p=>p.classification==="satisfied").length,missing:t.filter(p=>p.classification==="missing").length,contradictory:t.filter(p=>p.classification==="contradictory").length,unplanned:t.filter(p=>p.classification==="unplanned").length};return{schemaVersion:"1.0",readOnly:!0,changeMapHash:e.changeMap.hash,structurallyConverged:h.missing===0&&h.contradictory===0&&h.unplanned===0,behavioralCompletion:"not-evaluated",summary:h,findings:t}}_chunkA5EIY3HIcjs.a.call(void 0, Fe,"analyzeArchitectureConvergence");var fs="https://unpkg.com/arkgate/schemas/ark.arkrules.schema.json",ki=["aggregate-private-state","always-valid-factory","domain-event-on-mutation","orchestration-only","thin-adapter","writes-via-aggregate","no-anemic-model","invariant-coverage"];var gs={type:"array",items:{type:"string",minLength:1},uniqueItems:!0},Hd={$schema:"https://json-schema.org/draft/2020-12/schema",$id:fs,title:"ArkGate ArkRules (intra-layer contract)",description:"Per-layer structure sensors and invariant catalog consumed by the ArkGate Effective Contract.",type:"object",additionalProperties:!1,required:["schemaVersion","layer"],properties:{$schema:{type:"string",minLength:1,default:fs},schemaVersion:{type:"string",const:"1.0",default:"1.0"},layer:{type:"string",minLength:1},structure:{type:"array",default:[],items:{$ref:"#/$defs/structureEntry"}},invariants:{type:"array",default:[],items:{$ref:"#/$defs/invariantEntry"}}},$defs:{structureEntry:{type:"object",additionalProperties:!1,required:["id","sensor"],properties:{id:{type:"string",minLength:1},sensor:{type:"string",enum:[...ki]},mode:{type:"string",enum:["advisory","enforced"],default:"advisory"},appliesTo:gs,description:{type:"string",minLength:1}}},invariantEntry:{type:"object",additionalProperties:!1,required:["id","description"],properties:{id:{type:"string",minLength:1},description:{type:"string",minLength:1},aggregate:{type:"string",minLength:1},coverage:{type:"object",additionalProperties:!1,properties:{test:{type:"boolean"},symbol:{type:"string",minLength:1}}},mode:{type:"string",enum:["advisory","enforced"],default:"advisory"},appliesTo:gs}}}};function Je(){return{schemaVersion:"1.0",byLayer:{},structure:[],invariants:[]}}_chunkA5EIY3HIcjs.a.call(void 0, Je,"emptyEffectiveArkRules");function cn(e){return{...e,layers:e.layers.map(t=>{let{description:n,trustBoundary:r,owners:a,...s}=t;return s})}}_chunkA5EIY3HIcjs.a.call(void 0, cn,"omitLayerDescriptions");function ms(e){let{stewards:t,...n}=cn(e.config);return{config:n,arkRules:{schemaVersion:e.arkRules.schemaVersion,structure:e.arkRules.structure.map(r=>({id:r.id,sensor:r.sensor,mode:r.mode,appliesTo:_nullishCoalesce(r.appliesTo, () => (null)),description:_nullishCoalesce(r.description, () => (null)),provenance:r.provenance})),invariants:e.arkRules.invariants.map(r=>({id:r.id,description:r.description,aggregate:_nullishCoalesce(r.aggregate, () => (null)),coverage:_nullishCoalesce(r.coverage, () => (null)),mode:r.mode,appliesTo:_nullishCoalesce(r.appliesTo, () => (null)),provenance:r.provenance}))}}}_chunkA5EIY3HIcjs.a.call(void 0, ms,"effectiveContractPolicyPayload");var vi=new Set(["public","private","protected","static","async","readonly","abstract","override","declare","get","set"]),Ii=new Set(["(",",","=",":","[","!","&","|","?","{","}",";","+","-","*","%","<",">","~","^"]),bi=new Set(["return","typeof","case","do","else","in","of","new","delete","void","throw","instanceof","yield","await"]);function Ei(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n-=1;if(n<0)return!0;let r=e[n];if(/[A-Za-z0-9_$]/.test(r)){let a=n;for(;a>=0&&/[A-Za-z0-9_$]/.test(e[a]);)a-=1;return bi.has(e.slice(a+1,n+1))}return r==="/"&&e[n-1]==="*"?!1:Ii.has(r)}_chunkA5EIY3HIcjs.a.call(void 0, Ei,"slashStartsRegex");function Si(e,t){if(!Ei(e,t))return t;let n=t+1,r=!1;for(;n<e.length;){let a=e[n];if(a===`
|
|
4
|
-
|
|
5
|
-
`,t);return r===-1?e.length:r}if(n==="/"&&e[t+1]==="*"){let r=e.indexOf("*/",t+2);return r===-1?e.length:r+2}if(n==="/")return Si(e,t);if(n==="'"||n==='"'||n==="`"){let r=t+1;for(;r<e.length;){if(e[r]==="\\"){r+=2;continue}if(e[r]===n)return r+1;r+=1}return e.length}return t}_chunkA5EIY3HIcjs.a.call(void 0, Ce,"skipStringOrComment");function ce(e,t){let n=t;for(;n<e.length;){if(/\s/.test(e[n])){n+=1;continue}if(e[n]==="/"&&(e[n+1]==="/"||e[n+1]==="*")){n=Ce(e,n);continue}break}return n}_chunkA5EIY3HIcjs.a.call(void 0, ce,"skipWsAndComments");function ht(e,t){let n=e[t];if(!n||!/[A-Za-z_$]/.test(n))return null;let r=t+1;for(;r<e.length&&/[A-Za-z0-9_$]/.test(e[r]);)r+=1;return{ident:e.slice(t,r),end:r}}_chunkA5EIY3HIcjs.a.call(void 0, ht,"readIdent");function ke(e,t,n,r){if(e[t]!==n)return null;let a=1,s=t+1;for(;s<e.length&&a>0;){let o=Ce(e,s);if(o!==s){s=o;continue}let l=e[s];l===n?a+=1:l===r&&!(r===">"&&e[s-1]==="=")&&(a-=1),s+=1}return a===0?s:null}_chunkA5EIY3HIcjs.a.call(void 0, ke,"skipBalanced");function dn(e){let t=[],n=0,r;for(;n<e.length&&(n=ce(e,n),!(n>=e.length));){if(e[n]===";"){n+=1;continue}let a=[],s=n;for(;;){let g=ht(e,s);if(!g||!vi.has(g.ident))break;a.push(g.ident),s=ce(e,g.end)}if(a.length===1&&a[0]==="static"&&e[s]==="{"){let g=ke(e,s,"{","}");if(g==null){r=e.length;break}n=g;continue}let o=ht(e,s);if(!o){n+=1;continue}if(s=ce(e,o.end),e[s]==="<"){let g=ke(e,s,"<",">");if(g==null){r=e.length;break}s=ce(e,g)}if(e[s]==="("){let g=ke(e,s,"(",")");if(g==null){r=e.length;break}if(s=ce(e,g),e[s]===":")for(s+=1;s<e.length&&e[s]!=="{"&&e[s]!==";";){let h=Ce(e,s);if(h!==s){s=h;continue}s+=1}if(e[s]==="{"){let h=ke(e,s,"{","}");if(h==null){r=e.length;break}t.push({name:o.ident,modifiers:a,kind:"method",body:e.slice(s+1,h-1)}),n=h;continue}if(e[s]===";"){n=s+1;continue}n=s+1;continue}let l=0,c=0,f=0;for(;s<e.length;){let g=Ce(e,s);if(g!==s){s=g;continue}let h=e[s];if(h==="{")l+=1;else if(h==="}"){if(l===0)break;l-=1}else if(h==="(")c+=1;else if(h===")")c-=1;else if(h==="[")f+=1;else if(h==="]")f-=1;else if(h===";"&&l===0&&c===0&&f===0){s+=1;break}s+=1}s>=e.length&&(l>0||c>0||f>0)&&(r=e.length),t.push({name:o.ident,modifiers:a,kind:"field",body:""}),n=s}return{members:t,truncatedAt:r}}_chunkA5EIY3HIcjs.a.call(void 0, dn,"scanClassMembers");function ys(e,t){let n=t;for(;n<e.length;){let r=ce(e,n);if(r!==n){n=r;continue}let a=e[n];if(a==="{")return n;if(a===";")return null;if(a==="<"||a==="("||a==="["){let o=ke(e,n,a,a==="<"?">":a==="("?")":"]");if(o==null)return null;n=o;continue}if(a==='"'||a==="'"||a==="`"){n=Ce(e,n);continue}n+=1}return null}_chunkA5EIY3HIcjs.a.call(void 0, ys,"findClassBodyBrace");function un(e,t={}){let n=[],r=t.exportedOnly?/\bexport\s+(?:abstract\s+)?class\s+([A-Za-z_$][A-Za-z0-9_$]*)/g:/(?:\b(export)\s+(?:default\s+)?)?(?:\babstract\s+)?\bclass\s+([A-Za-z_$][A-Za-z0-9_$]*)/g,a=hs(e),s;for(;(s=r.exec(a))!==null;){let o=t.exportedOnly?s[1]:s[2],l=t.exportedOnly===!0||s[1]==="export",c=ys(e,s.index+s[0].length);if(c==null){n.push({name:o,start:s.index,exported:l,bodyStart:null,bodyEnd:null});continue}let f=ke(e,c,"{","}");n.push({name:o,start:s.index,exported:l,bodyStart:c+1,bodyEnd:f==null?null:f-1})}return n}_chunkA5EIY3HIcjs.a.call(void 0, un,"findClassDeclarations");function hs(e){let t="",n=0;for(;n<e.length;){let r=Ce(e,n);if(r!==n){t+=e.slice(n,r).replace(/[^\n]/g," "),n=r;continue}t+=e[n],n+=1}return t}_chunkA5EIY3HIcjs.a.call(void 0, hs,"maskStringsAndComments");function Rs(e,t){let n=[];if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return n;let r=hs(e),a=t.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),s=new RegExp(`\\b(?:(namespace|module)\\s+${a}\\s*\\{|(?:const|let|var)\\s+${a}\\s*(?::[^=;]+?)?=(?!=|>)\\s*(class\\b)?)`,"g"),o;for(;(o=s.exec(r))!==null;){let l,c;if(o[1])c="namespace",l=o.index+o[0].length-1;else if(o[2])c="class-expression",l=ys(e,o.index+o[0].length);else{c="object";let g=ce(e,o.index+o[0].length);l=e[g]==="{"?g:null}if(l==null)continue;let f=ke(e,l,"{","}");n.push({kind:c,bodyStart:l+1,bodyEnd:f==null?e.length:f-1})}return n}_chunkA5EIY3HIcjs.a.call(void 0, Rs,"findMemberContainers");function As(e){let t=[],n=0,r=!0;for(;n<e.length;){let a=Ce(e,n);if(a!==n){n=a,r=!1;continue}let s=e[n];if(s==="{"||s==="("||s==="["){n=_nullishCoalesce(ke(e,n,s,s==="{"?"}":s==="("?")":"]"), () => (e.length)),r=!1;continue}if(s===","){r=!0,n+=1;continue}if(r&&/[A-Za-z_$]/.test(s)){let o=ht(e,n);for(;o&&(o.ident==="async"||o.ident==="get"||o.ident==="set");){let l=ce(e,o.end);e[l]==="*"&&(l=ce(e,l+1));let c=ht(e,l);if(!c)break;o=c}if(o){let l=ce(e,o.end);("(:,<".includes(_nullishCoalesce(e[l], () => ("")))||l>=e.length)&&t.push(o.ident),n=o.end,r=!1;continue}}if(r&&s==="*"){n+=1;continue}/\s/.test(s)||(r=!1),n+=1}return t}_chunkA5EIY3HIcjs.a.call(void 0, As,"objectLiteralMemberNames");var Ci="INVARIANT_TESTS_PATH_MISSING",_i="This project is adopted and has domain invariants, but ark.config.json does not name a real tests path. Add coverage.testGlobs or coverage.coverageRoots pointing at the folder where those tests live, then re-run. Without that path, coverage is an empty checkbox.",Oi="INVARIANT_COVERAGE_ROOTS_MISSING",xi="A domain invariant is enforced, but ark.config.json does not name coverage.coverageRoots \u2014 the folders where this project's test runner actually goes. Add coverage.coverageRoots pointing at that folder, then re-run. Without it, coverage can certify a test no runner runs.";function ks(e,t=!1){if(!e)return"";let n=e.discarded,r=[];if(n.budget>0&&!t&&r.push(`${n.budget} past the ${e.maxFiles}-file budget`),n.noInvariantMention>0&&r.push(`${n.noInvariantMention} naming no catalogued invariant`),n.oversize>0&&r.push(`${n.oversize} over the per-file byte cap`),n.unreadable>0&&r.push(`${n.unreadable} unreadable (files or directories)`),n.depthLimited>0&&r.push(`${n.depthLimited} directories past the walk depth limit`),n.outOfRoot>0&&r.push(`${n.outOfRoot} symlinked outside the project root`),r.length===0)return"";let a=t?"":` (loaded ${e.filesLoaded} files, kept ${e.testFilesRetained} tests)`;return` Scan discarded ${r.join(", ")}${a}.`}_chunkA5EIY3HIcjs.a.call(void 0, ks,"formatCoverageDiscards");function bs(e,t){let n=e.replace(/\\/g,"/").replace(/^\.\//,"");return t.some(r=>{let a=r.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/+$/,"");return a===""||a==="."?!0:n===a||n.startsWith(`${a}/`)})}_chunkA5EIY3HIcjs.a.call(void 0, bs,"isUnderCoverageRoot");function fn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}_chunkA5EIY3HIcjs.a.call(void 0, fn,"escapeRegExp");function $e(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}_chunkA5EIY3HIcjs.a.call(void 0, $e,"normalizePath");function gn(e,t){let n=[],r=0,a=e.length;for(;r<a;){let s=e[r],o=e[r+1];if(s==="/"&&o==="/"){for(;r<a&&e[r]!==`
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return 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 _chunkUN5EH4QVcjs = require('../chunk-UN5EH4QV.cjs');var _chunkA5EIY3HIcjs = require('../chunk-A5EIY3HI.cjs');var Kt="docs/diagnostics.md",Ko= exports.DIAGNOSTIC_CATALOG_SCHEMA_VERSION ="1.0";function v(e,t,n,r,a,s){return{ruleId:e,title:n,why:r,fix:a,docsAnchor:e,category:t,..._optionalChain([s, 'optionalAccess', _2 => _2.oftenAdvisory])?{oftenAdvisory:!0}:{}}}_chunkA5EIY3HIcjs.a.call(void 0, v,"entry");var ft=Object.freeze([v("LAYER_IMPORT_VIOLATION","layer","This import is not allowed","This file imported a folder it may not reach. The write doesn\u2019t land. The same check fails the pull request.","Branch by import kind: constants/types/pure \u2192 adopt into DomainModel or SharedKernel (do not invent a port); kernel/events/bootstrap from Persistence \u2192 inject a port or move the map to SharedTypes (Persistence must not emit); define a port only when the target is a real use-case. Type-only edges use `import type`. Then preflight again. Do not weaken the layer rule without a hash-bound policy acknowledgement."),v("LAYER_INTENT_REFERENCE_VIOLATION","layer","Intent referenced across a blocked layer edge","A string intent (or intent-like reference) names a layer that the file\u2019s layer may not reach under the contract rules \u2014 the same plane as import edges, for event/intent coupling.","Reference that intent from a layer allowed to know about it (usually an adapter or application layer), or relocate the reference \u2014 then preflight again."),v("LAYER_REFERENCE_VIOLATION","layer","Layer reference blocked (snippet / AI gate)","Snippet analysis found an intent or string reference that would couple layers in a direction the architecture profile forbids.","Move the reference to an allowed layer or introduce a port/event boundary, then re-run the snippet gate."),v("SHARED_IMPORTS_SLICE","layer","A shared root imports a slice",'A declared shared root imports a slice directly. That hop is allowed while sharedImportsSlice is unset or "deny-cross-parent", so this is advisory: the universe wall is direct-only.','Move the code the shared root needs into the shared root, or invert the dependency. Set sharedImportsSlice: "deny" to make these edges errors. With "deny-cross-parent", a slice that reaches another universe through a shared root is reported as LAYER_IMPORT_VIOLATION with reasonId CROSS_PARENT_VIA_SHARED. This warning does not fail the check.',{oftenAdvisory:!0}),v("CIRCULAR_DEPENDENCY","layer","Dependency cycle","Two or more modules import each other in a loop. Cycles make ownership unclear and break stable layer direction.","Extract the shared dependency into a third module, invert one edge behind a port, or merge units that are truly one \u2014 then preflight again."),v("CROSS_WALL_DUPLICATE","layer","Code copied across a wall","Near-identical code sits on two sides of a slice wall (or in two layers that may not import each other). The wall would deny the import, so the code was copied instead. Status details (`--doctor --all`) and the report list it from token fingerprints taken at status time; they never enter the check, so the verdict does not change. Same-slice copies are counted, never listed.","Move one copy to a shared home the wall allows \u2014 a declared shared root, the universe common folder, or a layer both sides may import \u2014 then import it from both sides. One move at a time, through the write gate (/ark-place names the destination). Advisory only \u2014 it never fails a run.",{oftenAdvisory:!0}),v("CROSS_LAYER_DUPLICATE","layer","Code copied in two layers","Near-identical code sits in two layers, and at least one of them may import the other. Status details (`--doctor --all`) and the report list it from token fingerprints taken at status time; the verdict does not change.","Keep one copy in the lower layer both sides may import, and import it from the other. One move at a time, through the write gate. Advisory only \u2014 it never fails a run.",{oftenAdvisory:!0}),v("FORBIDDEN_GLOBAL","capability","Forbidden ambient global or dual import","The file\u2019s layer lists this ambient (or its exact import dual, e.g. process / node:process) in forbiddenGlobals. Pure layers must not reach wall-clock, network, process, or similar effects directly.","Inject the capability through a small port (Clock, HttpPort, Config, \u2026), bind the implementation outside the walled layer, then preflight again."),v("CAPABILITY_VIOLATION","capability","Denied effect capability","The layer denies an effect capability (network, filesystem, clock, randomness, environment, process, persistence) and the candidate uses that effect via ambient or import evidence.","Define a capability port in the walled layer, bind the implementation in an adapter layer, then preflight again. Never mechanical-safe \u2014 port shape is a design decision."),v("RAW_EVENT_PUBLISH","publish","Raw event publish","Publish went through a raw string or object instead of a registered intent creator, bypassing Ark intent contracts and tooling.","Publish through a registered intent creator, then run Ark again."),v("PUBLISH_MISSING_SOURCE","publish","Publish missing metadata.source","A strict Ark publish call omitted metadata.source, so the publishing layer cannot be verified.","Add metadata.source to the publish call, then run Ark again."),v("PUBLISH_SOURCE_LAYER_MISMATCH","publish","Publish source layer mismatch","metadata.source resolves to a different layer than the file performing the publish.","Use a source intent owned by the same layer as this file, or move the publish call to the owning layer."),v("UNKNOWN_INTENT","publish","Unknown intent reference","Snippet analysis saw an intent string that is not registered in the intent registry / profile under check.","Register the intent or use a known intent name from the project registry, then re-run the gate."),v("DYNAMIC_IMPORT_NOT_ALLOWLISTED","safety","Non-literal dynamic import","A dynamic import(expr) cannot be resolved statically and the file is not on dynamicImportAllowlist. Unresolved dynamics can hide layer edges.","Rewrite to a static import when possible, or add only reviewed files to dynamicImportAllowlist after human sign-off."),v("DYNAMIC_REQUIRE_NOT_ALLOWLISTED","safety","Non-literal require","A require(expr) cannot be resolved statically and is not allowlisted \u2014 same hide-the-edge risk as dynamic import.","Prefer static import, or allowlist only reviewed files after sign-off."),v("TS_SUPPRESSION_THRESHOLD_EXCEEDED","safety","@ts-ignore / @ts-nocheck threshold","Count of TypeScript suppressions in governed production source exceeds safety.maxTsSuppressions.","Remove suppressions by fixing types, or raise the threshold only with an explicit production exception in ark.config.json."),v("ANY_CAST_THRESHOLD_EXCEEDED","safety","Explicit any cast threshold","Count of explicit any casts exceeds safety.maxAnyCasts.","Replace any with precise types, or raise the threshold only with a documented exception."),v("IN_MEMORY_STORE_IN_PRODUCTION_SOURCE","safety","In-memory store in production source","Governed production source references an Ark InMemory* store without safety.allowInMemory \u2014 durable systems should not ship ephemeral stores by accident.","Provide a durable store implementation, or set safety.allowInMemory only for an explicitly ephemeral service."),v("PEER_ISOLATION_DISABLED","safety","peerIsolation disabled on a rule","A same-layer or peer rule disables peerIsolation (or omits it where required), which allows cross-slice coupling the contract otherwise blocks.","Restore peerIsolation: true, or set safety.allowDisabledPeerIsolation only with a documented production exception."),v("ARKRULE_STRUCTURE","arkrules","ArkRule structure sensor failed","An opt-in ArkRules structure sensor (private state, factory shape, event publish, persistence write outside an aggregate, \u2026) failed on a governed file for a declared arkruleId.","Restore the declared structure for the ArkRule (see arkruleSource), then preflight again. Do not demote the rule without a hash-bound policy acknowledgement."),v("ARKRULE_INVARIANT","arkrules","ArkRule invariant failed","Reserved / remediation-recognized code for invariant-plane failures bound to an ArkRule id (coverage path also emits INVARIANT_UNCOVERED).","Fix the invariant for the ArkRule declared in arkrules/<Layer>.json, then preflight again. Do not demote without acknowledgement."),v("ARKRULE_SCOPE_EMPTY","arkrules","ArkRule appliesTo matched zero files","An ArkRule\u2019s appliesTo globs matched no governed files \u2014 the rule cannot observe what it claims to protect.","Fix appliesTo globs so they match governed files, or remove the rule. Enforced empty scope fails; advisory empty scope warns.",{oftenAdvisory:!0}),v("ARKRULE_HINT_BUDGET_EXHAUSTED","arkrules","Structural-hint budget exhausted","orchestration-only, thin-adapter, and writes-via-aggregate only evaluate files the hint loader preloaded. When eligible governed files exceed that budget (coverage.maxFiles, default 400 \u2014 there is no arkrules.hintBudget), those sensors never saw the rest of their scope. Enforced + unreviewed is not green. The finding names exact hinted/governed counts and per-sensor reviewed N/M of scope.","Raise coverage.maxFiles in ark.config.json (this cap also bounds structural-hint preload; --doctor names the coupling) so hinted/governed counts match, then re-run with --strict-config. An enforced hint sensor that cannot see its scope fails strict."),v("ARKRULE_FILE_UNREFERENCED","arkrules","ArkRules file not referenced","A JSON file under arkrules/, or a slice file named arkrules.<Layer>.json beside governed code, is not in the effective catalog, so none of its rules are enforced. Drift looks like governance until someone notices.","Reference a central file from arkRules, set childSlices.arkRulesFile so a slice file is discovered, or delete it. Advisory only: it never fails the check.",{oftenAdvisory:!0}),v("ARKRULE_DUPLICATE_ID","arkrules","ArkRule id declared more than once","Two ArkRules files in one layer declare the same effective id. Central ids stay bare. A slice file is namespaced as <childId>#<localId>, so the same local id in two slices is not a duplicate.","Rename one id, or split the files onto different slices. Config load fails closed. The catalog is not enforced until the id is unique."),v("ARKRULE_SCOPE_ESCAPES_SLICE","arkrules","Slice ArkRule appliesTo leaves its slice","A file discovered from childSlices.arkRulesFile set appliesTo to a glob that can match outside that child slice. The default, when appliesTo is omitted, is the slice directory.","Narrow appliesTo to the slice directory, or omit it. Config load fails closed. The escaping rule is not enforced."),v("INVARIANT_CATALOG_EMPTY","arkrules","Domain invariant catalog is empty","ArkRules is on and a Domain-role layer has code, but invariants[] has no phrases the code must preserve. Empty looks like \u201Cdone\u201D until someone fills the catalog.","Add 1\u20132 short phrases to invariants[] in arkrules/<Domain>.json (or the mapped file). Starters show the shape. Advisory unless a domain structure rule is already enforced \u2014 then --strict-merge can refuse. Do not freeze this finding.",{oftenAdvisory:!0}),v("INVARIANT_UNCOVERED","arkrules","Invariant without coverage evidence","An ArkRules invariant is under contract but no covering test title or declared symbol evidence was found (or coverage is partial). Kind is never-had-tests (adopt residual) vs tests-disappeared (suite exists).","Add a test title or declared symbol covering the arkruleId, then preflight again. Treat never-had-tests as adopt residual; treat tests-disappeared as a regression. Missing test globs report partial \u2014 never fake green. When the message reports an exhausted file budget, raise coverage.maxFiles (or narrow coverage.testGlobs) in ark.config.json."),v("INVARIANT_COVERAGE_OUTSIDE_ROOTS","arkrules","Covering test outside the declared coverage roots","The only test naming this invariant sits outside coverage.coverageRoots \u2014 the places the project declares its runner executes. ArkGate matches declared text and never executes tests, so it cannot tell whether that file is ever run: coverage there is a test that exists, not a test that runs.","Move the test under a declared coverage root, or add its root to coverage.coverageRoots in ark.config.json. Advisory: it never fails strict, but promotion to enforced refuses on it.",{oftenAdvisory:!0}),v("INVARIANT_PROBE_SURVIVED","arkrules","Covering tests do not pin the invariant","The committed invariant probe (.ark/invariant-probe.json, written by arkgate-check --probe-invariants --write) shows, for files that have not changed since, that the covering tests still pass with the invariant's symbol broken on purpose (survived) or never call it (not reached). The test names the rule but does not pin it. A status and inventory line only: it never enters the check, so the verdict does not change.","Add a test case that fails when the rule is broken (the line names the change that went unnoticed), then re-run arkgate-check --probe-invariants --write and commit the file. Promotion to enforced refuses while the fresh artifact says survived or not reached; a stale, killed, inconclusive or missing result changes nothing.",{oftenAdvisory:!0}),v("INVARIANT_TESTS_PATH_MISSING","arkrules","Domain-invariant tests path missing under adopted","The project is adopted (required CI or explicit advisory) and has domain invariants that want test evidence, but ark.config.json does not name where those tests live. Green coverage without a real tests path is an empty checkbox.","Add coverage.testGlobs or coverage.coverageRoots in ark.config.json pointing at a real tests folder, then re-run. Adopted mode fails closed until that path is present. Not freezable."),v("INVARIANT_COVERAGE_ROOTS_MISSING","arkrules","Coverage roots missing while an invariant is enforced","A catalogued domain invariant is enforced, but ark.config.json does not name coverage.coverageRoots \u2014 the folders where the project says its test runner actually goes. Without that declaration, INVARIANT_COVERAGE_OUTSIDE_ROOTS cannot fire and coverage can certify a test no runner runs.","Add coverage.coverageRoots in ark.config.json pointing at the folder the test runner uses, then re-run. testGlobs alone is not enough. Fail-closed until that path is present. Not freezable."),v("ARKRUN_MISSING_ROOT","arkrun","No kernel factory in composition roots","The ArkRun extra is on but no kernel factory (createArkKernel / createStrictArkKernel / createLenientArkKernel, their *FromConfig variants, or ArkModule.forRoot / forRootAsync imported from arkgate/nestjs) was found in arkRun.compositionRoots, so agents can skip the kernel while the write gate stays green.","Import createStrictArkKernel from arkgate/runtime (same npm package; @arkgate/runtime is deprecated) and call it in a composition root listed in arkRun.compositionRoots, then preflight again. Never mechanical-safe \u2014 factory placement is a design decision."),v("ARKRUN_KERNEL_IN_DOMAIN","arkrun","Domain-role layer imports the kernel","A Domain-role layer imports arkgate/runtime, arkgate/nestjs, @arkgate/runtime, or kernel types. Domain stays kernel-free; composition roots and adapters own the factory.","Move the kernel import out of the Domain-role layer into a composition root or adapter. Import from arkgate/runtime (same npm package; @arkgate/runtime is deprecated), then preflight again. Never mechanical-safe."),v("ARKRUN_DIRECT_NEW","arkrun","Managed type constructed with new","A managed non-Domain file constructs an admitted type with new outside an ArkRun composition-root factory, skipping kernel resolve/registration.","Resolve the type from the kernel instead of constructing it with new, then preflight again. Never mechanical-safe \u2014 rewiring construction is a design decision."),v("ARKRUN_UNDECLARED_EMIT","arkrun","Emit name not in raises/sends","A publisher / publish / raise / send call on a receiver traced to the kernel names an intent (string literal or same-file define/defineIntent binding) that is not listed in the file\u2019s raises or sends declaration.","Add the existing call-site name to raises or sends on the managed component, then preflight again. Mechanical-safe only when that literal already exists and the edit is the declaration list; inventing a new emit stays judgment."),v("ARKRUN_UNDECLARED_HANDLE","arkrun","Handle name not in reactsTo","A subscribe / registerHandler call on a receiver traced to the kernel names an intent (string literal or same-file define/defineIntent binding) that is not listed in the file\u2019s reactsTo declaration.","Add the existing call-site name to reactsTo on the managed component, then preflight again. Mechanical-safe only when that literal already exists and the edit is the declaration list; inventing a new handle stays judgment."),v("ARKRUN_UNDECLARED_DEPEND","arkrun","Depend name not in uses","A resolve / resolveSingleton call on a receiver traced to the kernel names a component that is not listed in the file\u2019s uses declaration.","Add the existing call-site name to uses on the managed component, then preflight again. Mechanical-safe only when that literal already exists and the edit is the declaration list; inventing a new depend stays judgment."),v("ARKRUN_TRANSPORT_BYPASS","arkrun","Homemade broker or emitter import","A managed layer imports a closed broker/queue/emitter specifier (EventEmitter, queue clients, \u2026) instead of the ArkRun kernel transport.","Send through the ArkRun kernel transport instead of importing that broker or emitter, then preflight again. Never mechanical-safe \u2014 homemade buses stay judgment."),v("ARKORDER_MISSING_PLANE","arkorder","No createOrderPlane in plane roots","The ArkOrder extra is on but no createOrderPlane factory was found in arkOrder.planeRoots, so agents can skip the pattern plane while the write gate stays green.","Import createOrderPlane from arkgate/order and call it in a plane root listed in arkOrder.planeRoots, then preflight again. Never mechanical-safe \u2014 factory placement is a design decision."),v("ARKORDER_KERNEL_IN_DOMAIN","arkorder","Domain-role layer imports the order plane","A Domain-role layer imports arkgate/order. Domain stays plane-free; planeRoots own the factory.","Move the arkgate/order import out of the Domain-role layer into a plane root or adapter, then preflight again. Never mechanical-safe."),v("ARKORDER_GENERIC_UPDATE","arkorder","Generic update of a big product choice","A call to update/patch/set rewrites a named product choice (like billing plan) as if it were a seat count.","Don't use a generic update. First freeze with release(). Later, propose the change, then apply it."),v("ARKORDER_TOO_MANY_PARAMS","arkorder","Too many slow keys","\u03BE has more keys than arkOrder.maxXiKeys. Haken requires a few slow modes, not a dump of microstate.","Cut \u03BE to the slow keys that actually slave the rest, then preflight again. Never mechanical-safe."),v("ARKORDER_INGEST_WRITES_XI","arkorder","ingest assigned into \u03BE","An ingest() result is written into a Release or \u03BE store. ingest may absorb, escalate_up, or hold; it never mints a pattern.","Keep ingest results as absorb/escalate_up/hold only. Change \u03BE with proposeRelease then apply(ProposeResult). Never mechanical-safe."),v("ARKORDER_XI_FIELD_WRITE","arkorder","Big product choice written like a seat count","A use-case writes a named product choice (like billing plan) through a database update. Invoices and seats can flow. That choice cannot.","Keep invoices and seats as events. Change the choice through the valve (proposeRelease then apply), not a generic update."),v("ARKORDER_INFORMATION_BUDGET","arkorder","Projection observes a forbidden kind","h(\u03BE) allowedKinds includes a kind listed in informationBudget.cannotObserve. A scale may not look at what it was told not to see.","Cut that kind from the projector or from cannotObserve, then preflight again. Never mechanical-safe."),v("ARKORDER_XI_TTL","arkorder","Slow key carries a freshness field","\u03BE named ttl/freshUntil/maxAge. Freshness belongs on \u03C3. A slow parameter that expires per transaction is not slow.","Move freshness onto \u03C3 (freshUntil) and keep \u03BE stable, then preflight again. Never mechanical-safe."),v("ARKORDER_STALE_SIGMA","arkorder","\u03C3 is stale","ingest ran after \u03C3.freshUntil (or sigmaMaxAgeMs). \u03BE does not TTL.","Call refreshSigma and ingest again, or proposeRelease then apply(ProposeResult) if the pattern changed. Never mechanical-safe."),v("ARKORDER_UNVALVED_RELEASE","arkorder","Second freeze without the valve","release() already froze the big choice. A later release() with a different value does not land. First freeze is release(); later change is proposeRelease then apply.","Change the choice with proposeRelease then apply. release() is only the first freeze. Never mechanical-safe."),v("ARKORDER_STALE_PROPOSAL","arkorder","Proposal is not bound to the current Release","apply() got a ProposeResult computed against another Release (another apply landed first), one missing its base binding, or one whose reviewed blast radius is not the transition that would commit. The binding is data, not a capability: a proposal that states the current base and the exact transition applies whoever built it.","Run proposeRelease again against the current Release, review the new blast radius, then apply that proposal. Never mechanical-safe."),v("INVALID_CHANGE_PATH","preflight","Unsafe change path","A change set entry is not a safe, non-empty project-relative path (absolute, escape, empty, or NUL).","Use canonical project-relative paths only in the atomic change set, then preflight again."),v("DUPLICATE_CHANGE_PATH","preflight","Duplicate path in change set","The atomic change set lists more than one operation for the same path.","Collapse to one create/update/delete per path, then preflight again."),v("DELETE_TARGET_MISSING","preflight","Delete target missing","A delete operation targets a path that is not present in the supplied base tree.","Remove the delete, or include the file in the base tree facts, then preflight again."),v("CHANGE_SET_EMPTY","preflight","Empty change set","Atomic preflight was invoked with no create, update, or delete operations.","Provide at least one change operation, then preflight again."),v("FACTS_IDENTITY_MISMATCH","preflight","Base/candidate facts identity mismatch","Base and candidate resolved facts disagree on resolver, compiler, evidence requirements, or package identity \u2014 verdicts would not be comparable.","Regenerate both fact snapshots with the same resolver/compiler/evidence requirements, then preflight again."),v("CANDIDATE_DELETE_NOT_APPLIED","preflight","Candidate still contains deleted path","Facts claim a delete, but the candidate tree still includes the path.","Ensure the candidate facts apply the delete (path absent), then preflight again."),v("CANDIDATE_CHANGE_MISSING","preflight","Declared change missing from candidate","The change set declares a create/update whose path is missing from candidate facts.","Include the new content in the candidate facts (or drop the operation), then preflight again."),v("CANDIDATE_CONTENT_HASH_MISMATCH","preflight","Candidate content hash mismatch","The candidate file content hash does not match the hash expected for the declared change.","Rebuild candidate facts from the exact proposed content, then preflight again."),v("UNDECLARED_CANDIDATE_CHANGE","preflight","Undeclared candidate change","Candidate facts differ from base for a path that was not listed in the explicit change set.","Declare every path that changes in the atomic change set, then preflight again."),v("ATOMIC_PREFLIGHT_UNAVAILABLE","preflight","Atomic preflight unavailable","The host/MCP path could not run the atomic preflight engine (missing facts, incomplete setup, or unsupported mode).","Use resolved-candidate facts / ark_prepare_change with a complete batch, or fall back to ark-check on disk. Do not treat missing preflight as green."),v("WRITE_GATE_UNAVAILABLE","preflight","Write gate could not run","The write gate could not load its own inputs (ark.config.json missing, unreadable, or invalid; a referenced ArkRules file missing or invalid; or the built library missing), so it cannot judge this governed source write (existing files included), or a write would leave ark.config.json or a referenced ArkRules file unloadable. No checker, no write: the hook blocks instead of letting the write through unchecked.","Fix the reported input (repair ark.config.json or the ArkRules file, or run `npm run build` / reinstall arkgate from npm), then retry the same write. Do not remove the hook to get past it."),v("DESIGN_SMELL_REGRESSION","preflight","Design smell regression on base-relative ratchet","Compared to the base ref, the candidate introduces a created-path domain-logic-in-ui file under --strict-merge, or introduces or worsens a blocking design-smell class under --fail-on-new-smells.","Move the new UI business rule out of the created file (or revert a --fail-on-new-smells regression), then re-run with the same base ref."),v("ANALYSIS_PARSE_INCOMPLETE","analysis","Parse incomplete","Governed source could not be fully parsed; evidence includes the TypeScript diagnostic (line + message). Incremental mid-edit parse is normal for agents. Contract exclude paths skip the write hook.","Finish the source or fix the reported syntax error, then re-run `npx arkgate-check`. The write hook does not deny solely on mid-edit parse. Partial never means pass."),v("LEXICAL_EVIDENCE_INCOMPLETE","analysis","Lexical evidence incomplete","This check only saw one file, so it cannot fully prove how the import resolves. The result is provisional \u2014 `ark-check` on the project is the authority.","For a complete verdict, run `npx arkgate-check --root . --config ark.config.json` (or ark_prepare_change over MCP with the full candidate batch). Read lexicalValid for the one-file result."),v("ANALYSIS_COVERS_NO_FILES","analysis","Analysis covered no files","No file matched the contract include and layer patterns under the analyzed root, so the run had nothing to check. Every rule is vacuously satisfied on an empty set: a green here would read exactly like a green over a governed tree while certifying nothing. Usual causes are a --root that is not the tree the contract describes (including a contract found outside the requested root, whose directory is then adopted as the project root), include / exclude patterns that match nothing, or layer patterns written for a different layout.","Point --root at the tree the contract describes, or keep the contract inside that tree, or fix the include / exclude / layer patterns so they match real files \u2014 then re-run `npx arkgate-check --root . --config ark.config.json`. This is a refusal about ArkGate\u2019s own inputs, not a finding about your code; no baseline or policy acknowledgement can suppress it."),v("ANALYSIS_HOST_UNAVAILABLE","analysis","Analysis host unavailable","No usable TypeScript / analysis host was available for this invocation.","Install a supported TypeScript version visible to the project, then re-run. Unavailable analysis is fail-closed."),v("ADAPTER_NOT_ALLOWED_FOR_PORT","adapter","Adapter not allowed for port","Runtime/port wiring selected an adapter implementation that the architecture profile does not allow for that port.","Bind an allowed adapter for the port, or adjust the profile with an explicit policy decision \u2014 then re-run."),v("FORBIDDEN_PATTERN","snippet-policy","Forbidden regex pattern","Snippet content matched a project or profile forbiddenPatterns rule.","Remove or rewrite the matching code so the pattern no longer matches, then re-run the snippet gate."),v("FORBIDDEN_SUBSTRING","snippet-policy","Forbidden substring","Snippet content contained a forbidden substring from the AI gate options/profile.","Remove the forbidden substring, then re-run the snippet gate."),v("FORBIDDEN_IMPORT","snippet-policy","Forbidden import target","Snippet imported or required a module listed as forbidden for the active profile.","Import an allowed module or inject the dependency behind a port, then re-run."),v("POLICY_VIOLATION","snippet-policy","Policy engine violation","A registered Policy failed on the snippet or generated code under evaluation.","Adjust the code to satisfy the named policy, or change the policy only through an explicit contract decision."),v("EXTENSION_ERROR","snippet-policy","AI gate extension error","A registered AICodeGate extension threw while analyzing the snippet.","Fix or remove the failing extension; do not ignore extension failures as pass."),v("AST_ANALYZER_ERROR","snippet-policy","AST analyzer error","Built-in AST/symbol analysis failed (host error or unexpected analyzer exception).","Ensure TypeScript host and snippet are valid; re-run. If the analyzer crashes on valid input, file a bug with a minimal fixture."),v("CONFIG_INVALID_DYNAMIC_IMPORT_ALLOWLIST","config","Invalid dynamicImportAllowlist","dynamicImportAllowlist is present but not an array of file globs.","Set dynamicImportAllowlist to an array of project-relative globs (or omit it).",{oftenAdvisory:!0}),v("CONFIG_INVALID_SAFETY","config","Invalid safety object","The safety field is present but not an object.","Use a safety object with optional maxTsSuppressions, maxAnyCasts, allowInMemory, allowDisabledPeerIsolation.",{oftenAdvisory:!0}),v("CONFIG_INVALID_SAFETY_THRESHOLD","config","Invalid safety threshold","A safety threshold (maxTsSuppressions / maxAnyCasts) is not a non-negative integer.","Set each threshold to a non-negative integer.",{oftenAdvisory:!0}),v("CONFIG_NO_LAYERS","config","No layers configured","ark.config.json has no file layers, so import-boundary enforcement cannot classify files.","Declare at least one layer with name + patterns (or run ark start / a preset).",{oftenAdvisory:!0}),v("CONFIG_LAYER_WITHOUT_NAME","config","Layer missing name","A configured layer entry has no name.","Give every layer a unique non-empty name.",{oftenAdvisory:!0}),v("CONFIG_INVALID_FORBIDDEN_GLOBALS","config","Invalid forbiddenGlobals","A layer\u2019s forbiddenGlobals is not an array of strings; the entry is ignored.",'Use an array of strings (e.g. ["fetch", "Date.now"]).',{oftenAdvisory:!0}),v("CONFIG_LAYER_WITHOUT_PATTERNS","config","Layer without patterns","A named layer has no file patterns and will never classify files.","Add patterns globs that match the layer\u2019s source tree.",{oftenAdvisory:!0}),v("CONFIG_INVALID_LAYER_PATTERN","config","Invalid layer pattern","A layer pattern is not a valid glob / failed to compile.","Fix the pattern syntax for that layer.",{oftenAdvisory:!0}),v("CONFIG_LAYER_PATTERN_NO_MATCHES","config","Layer pattern matched no files","A layer pattern matched zero included files (often a typo or include mismatch). Reserved/allowEmpty houses do not emit this.","Adjust the pattern or include roots, or mark the layer reserved/allowEmpty if the glob is a future house.",{oftenAdvisory:!0}),v("CONFIG_DUPLICATE_LAYER","config","Duplicate layer name","The same layer name appears more than once in configuration.","Rename or merge duplicate layer entries.",{oftenAdvisory:!0}),v("CONFIG_RULE_UNKNOWN_FROM_LAYER","config","Rule unknown from layer","A dependency rule references a source layer name that is not declared.","Fix the rule\u2019s from field to a declared layer name.",{oftenAdvisory:!0}),v("CONFIG_RULE_UNKNOWN_TO_LAYER","config","Rule unknown to layer","A dependency rule references a target layer name that is not declared.","Fix the rule\u2019s to field to a declared layer name.",{oftenAdvisory:!0}),v("CONFIG_AMBIGUOUS_LAYERS","config","Ambiguous layer classification","Some files match multiple layers at equal specificity; classification falls back to declaration order.","Disambiguate overlapping patterns so each file has one clear layer owner.",{oftenAdvisory:!0}),v("CONFIG_UNCLASSIFIED_FILES","config","Unclassified included files","Included source files match no layer pattern; import rules will not enforce on them.","Extend layer patterns or narrow include so every governed file is classified.",{oftenAdvisory:!0}),v("CONFIG_LAYER_MISSING_OWNER","config","Layer missing owner","requireLayerOwners is on and this layer has no owners. Writes to that house fail closed, like a folder with no name on the door.","Add a GitHub handle or email to that layer\u2019s owners in ark.config.json (/ark-adopt), then re-run. Reserved/allowEmpty houses may stay unnamed. Turn the flag off only if you no longer want owners required."),v("CONFIG_SLICE_IDENTITY_COLLISION","config","Starred slice prefixes share one id","sliceIdentity is stars and two different sliceFolders prefixes bind as the same slice id. Parallel trees of one feature do that on purpose; unrelated trees that share the last folder name merge by accident.","Keep stars when those prefixes are one feature. Otherwise use path, or rename the last literal so the prefixes do not bind as the same id. Doctor names both paths.",{oftenAdvisory:!0}),v("CONFIG_CHILD_SLICES_VERSION","config","Config needs a newer arkgate than a pinned copy",'ark.config.json uses a slice key (childSlices, sharedImportsSlice "deny-cross-parent" or its object form, sliceIdentity, sharedImportsSlice, childSlices.message, siblings.ratchet) that an arkgate pinned in this repo rejects at config load. Emitted only with evidence of that pin: an exact package.json dependency, the installed node_modules/arkgate, package-lock.json, a scripts/*hook* or host hook command, or a CI workflow. Silent otherwise.',"Bump the named file to the version the finding gives (or newer), then run Ark again. This warning does not fail the check.",{oftenAdvisory:!0}),v("CONFIG_CHILD_SLICE_EXTENDS","config","Child slice id does not extend its universe","A path resolved a child id that is not the universe id plus a further segment. The child wall does not treat that id as a child, so the edge is universe common until the folders line up.","Point childSlices.sliceFolders at children under the same universe id the outer sliceFolders already names. Doctor names the path.",{oftenAdvisory:!0}),v("CONFIG_CHILD_SLICE_CROSS_UNIVERSE","config","Child slice allowance cannot cross the universe wall","childSlices.allowedCrossSlice names a pattern that can match two universes. That list clears only a sibling crossing inside one universe. The universe wall still denies the edge.","Narrow the pattern so both sides share one universe prefix (features/projects/* to features/projects/d2d-item), or remove the entry. This warning does not fail the check.",{oftenAdvisory:!0}),v("CONFIG_CHILD_SLICES_INERT","config","childSlices on a rule that cannot run it","A rule sets childSlices without peerIsolation: true and allowed: false. The child wall runs only inside a universe wall, so on this rule childSlices enforces nothing. Config load still accepts it (arkgate 4.8.23 did too).",'Add "peerIsolation": true and "allowed": false to the same rule so the child wall runs, or remove childSlices. This warning does not fail the check.',{oftenAdvisory:!0}),v("CONFIG_SLICE_LEGACY_STARS_ID","config","Slice id written in the 4.8.23 stars form",'Under sliceIdentity "stars", a sliceAliases target or an allowedCrossSlice entry names the 4.8.23 stars id, which dropped a star binding before the last literal (modules/*/api/* bound api/v1). The id now keeps that binding (orders/api/v1). For one release the entry keeps its 4.8.23 meaning, so verdicts do not change.',"Rewrite the entry with the new id the warning names (for example orders/api/v1/x instead of api/v1/x). A sliceAliases target that maps to more than one universe shape is rejected at config load. This warning does not fail the check.",{oftenAdvisory:!0}),v("LITERAL_PATH_DRIFT","drift","Literal path moved by a rename","A repo path written inside a string, a comment or a docstring no longer resolves, and the rename set says where it went. Nothing in the gate sees this class: `tsc` resolves imports, not strings, and ESLint does not either, so the rename compiles green and the reference lies afterwards. It appears in four forms \u2014 the tsconfig alias, a relative literal, a path written without the include-root prefix, and prose \u2014 and a hand sweep reliably covers one of them.","Apply the suggested replacement, or re-run `npx arkgate-check --path-drift --base-ref <ref> --write` to apply every writable anchored replacement at once. The rewrite is mechanical and one-directional: the destination comes from the rename, it must itself resolve and be path-shaped, and the token is rewritten in the form the author wrote it in. A destination that leaves the alias root of the literal is reported with the target only and must be rewritten by hand."),v("LITERAL_PATH_UNRESOLVED","drift","Literal path does not resolve","A literal that looks like a repo path does not resolve under this root, and no rename explains where it went. Unlike LITERAL_PATH_DRIFT this is a candidate, not a verdict: with nothing to anchor it, ArkGate cannot tell a dead reference from an illustrative path in a comment, an example in documentation, or a path belonging to another tree.","Read the candidate and decide: fix the path, or leave it. Advisory only \u2014 it never fails a run and is never rewritten by --write, because there is no destination to propose. Run `--path-drift --all` to list the sweep.",{oftenAdvisory:!0}),v("ORPHAN_MODULE","drift","File nothing imports","No governed file, test or entry point imports this module. It is the leftover an agent leaves when a rewrite lands next to the old file. Status reads it from the import facts the check already resolved, so it never changes the verdict. When a dynamic import, an unresolved import or an unmapped entry could reach the file, the item says so (maybe-dynamic, maybe-unresolved) and the list is partial.","Delete the file through the write gate, one file at a time. If a framework, a script or a runtime loader uses it, add a glob with a reason to .ark/entry-points.json (optional reviewBy) instead. Advisory only \u2014 it never fails a run.",{oftenAdvisory:!0}),v("UNUSED_EXPORT","drift","Export nothing imports by name","An export no governed file or test imports by name. Listed only in status details (`--doctor --all`) and the report. Default, namespace, star, dynamic and require use count as using every export, so those files are skipped.","Drop the export keyword (or the code) if nothing outside the file needs it, or keep it when it is public API an entry point exposes. Advisory only \u2014 it never fails a run.",{oftenAdvisory:!0}),v("ARK_UNKNOWN","meta","Unknown diagnostic","A diagnostic lacked a stable ruleId/code; adapters may emit this fallback so agents never see an empty id.","Resolve the underlying finding without weakening ark.config.json, then run Ark again. Prefer fixing the producer to emit a catalogued ruleId.")]),Vt=new Map(ft.map(e=>[e.ruleId,e])),Vo= exports.DIAGNOSTIC_RULE_IDS =Object.freeze(ft.map(e=>e.ruleId));function Uo(e){return typeof e=="string"&&e.length>0&&Vt.has(e)}_chunkA5EIY3HIcjs.a.call(void 0, Uo,"isKnownDiagnosticCode");function Go(e){return typeof e!="string"||e.length===0?!1:Vt.has(e)?!0:e.startsWith("ARKRULE_")}_chunkA5EIY3HIcjs.a.call(void 0, Go,"isCataloguedOrArkRuleFamily");function gt(e){if(!(typeof e!="string"||e.length===0))return Vt.get(e)}_chunkA5EIY3HIcjs.a.call(void 0, gt,"getDiagnosticCatalogEntry");function Yr(e){return`#${_nullishCoalesce(_optionalChain([gt, 'call', _3 => _3(e), 'optionalAccess', _4 => _4.docsAnchor]), () => (e))}`}_chunkA5EIY3HIcjs.a.call(void 0, Yr,"diagnosticDocsFragment");function jo(e){return`${Kt}${Yr(e)}`}_chunkA5EIY3HIcjs.a.call(void 0, jo,"diagnosticDocsPath");function Bo(){return{schemaVersion:"1.0",docsPath:Kt,codes:ft}}_chunkA5EIY3HIcjs.a.call(void 0, Bo,"serializeDiagnosticCatalog");function zo(e){return _optionalChain([gt, 'call', _5 => _5(e), 'optionalAccess', _6 => _6.fix])}_chunkA5EIY3HIcjs.a.call(void 0, zo,"catalogFixForRuleId");function Wo(e){return _optionalChain([gt, 'call', _7 => _7(e), 'optionalAccess', _8 => _8.why])}_chunkA5EIY3HIcjs.a.call(void 0, Wo,"catalogWhyForRuleId");var qo=Object.freeze([Object.freeze({reasonId:"CROSS_PARENT_SLICE",ruleId:"LAYER_IMPORT_VIOLATION",title:"Cross-universe slice",why:"This import crosses two universe slices. The child wall cannot allow another universe.",fix:"Keep the import inside one universe, or move the shared code into a folder both universes may use."}),Object.freeze({reasonId:"CROSS_SIBLING_SLICE",ruleId:"LAYER_IMPORT_VIOLATION",title:"Cross-sibling slice",why:"This import crosses two feature slices inside one universe.",fix:"Import universe-common code, or move the shared piece into the feature that owns it.",advisoryNote:"This crossing is a warning (siblings advisory). With a baseline in use, a new one fails only when the baseline already records an advisory crossing of this rule and the count grows, or when siblings.ratchet is true; ratchet false measures only."}),Object.freeze({reasonId:"CROSS_PARENT_VIA_SHARED",ruleId:"LAYER_IMPORT_VIOLATION",title:"Cross-universe through a shared root",why:"A slice reaches another universe only through a shared root. ark-check and CI report this path. The write hook and ESLint see one edge at a time and do not block it.",fix:"Stop the shared root from importing the other universe, or move that import into the universe that owns it. A shared hop that stays inside one universe is allowed. If the shared hop is a composition root (bootstrap, DI registrations), list it in sharedImportsSlice.stopAt; a path through a stop is not a crossing."})]),Yo=new Map(qo.map(e=>[e.reasonId,e]));function Xr(e){if(!(typeof e!="string"||e.length===0))return Yo.get(e)}_chunkA5EIY3HIcjs.a.call(void 0, Xr,"sliceReasonHint");var Xo=/(^|\/)(constants|types|enums|shared-types|shared\/(?:types|constants)|test-projects)(\/|\.|$)|(?:^|\/)[^/]*(?:constants|types)(?:\.[cm]?[jt]sx?)?$/i,Zo=/(^|\/)(?:kernel(?:\/|$)|events?(?:\/|\.|$)|bootstrap(?:\.[cm]?[jt]sx?)?$|emitter(?:\.[cm]?[jt]sx?)?$)|(?:^|\/)(?:intents?|publish)(?:\/|\.|$)/i,Jo=/(use-?cases?|usecases?|application|orchestrat|services?|handlers?)(\/|\.|$)/i;function Qo(e,t){let n=String(_nullishCoalesce(e, () => (""))).replace(/\\/g,"/").trim(),r=String(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _9 => _9.fromLayer]), () => (""))),a=String(_nullishCoalesce(_optionalChain([t, 'optionalAccess', _10 => _10.toLayer]), () => ("")));return Xo.test(n)?"pure-shared":r==="PersistenceAdapters"&&(Zo.test(n)||/events?|intents?|kernel|bootstrap/i.test(`${a} ${n}`))?"kernel-emit":Jo.test(n)||(r==="DomainModel"||r==="ApplicationOrchestration")&&a==="PersistenceAdapters"?"use-case":"unknown"}_chunkA5EIY3HIcjs.a.call(void 0, Qo,"classifyLayerImportKind");function ei(e,t){return t.failsStrict===!1&&e.advisoryNote?`${e.fix} ${e.advisoryNote}`:e.fix}_chunkA5EIY3HIcjs.a.call(void 0, ei,"sliceHintAction");function ti(e){let t=Xr(typeof e.reasonId=="string"?e.reasonId:void 0);if(t)return`${ei(t,e)} Then preflight again.`;if(e.typeOnly||e.targetTypeOnlyExports||e.namedBindingsTypeOnly)return"Move the referenced type to a mutually allowed layer, use `import type`, then preflight again.";if(e.peerIsolation)return"Extract the shared dependency to a shared layer, test at the public interface, then preflight again.";let n=Qo(typeof e.target=="string"?e.target:"",{fromLayer:typeof e.fromLayer=="string"?e.fromLayer:void 0,toLayer:typeof e.toLayer=="string"?e.toLayer:void 0});return n==="pure-shared"?"Adopt the imported constants/types/pure module into DomainModel or SharedKernel (do not inject a port). Then preflight again.":n==="kernel-emit"?"Persistence must not emit. Inject a port or move the event map to SharedTypes; do not import kernel/events/bootstrap from a repository. Then preflight again.":n==="use-case"||e.portProofEligible?`Define a port in ${_nullishCoalesce(e.fromLayer, () => ("the source layer"))}, inject the ${_nullishCoalesce(e.toLayer, () => ("outer-layer"))} implementation, test at the public interface, then preflight again.`:"Classify the import: if it is constants/types/pure, adopt into DomainModel or SharedKernel; define a port only if the target is a real use-case. Then preflight again."}_chunkA5EIY3HIcjs.a.call(void 0, ti,"layerImportNextAction");function ni(e){return typeof e.target=="string"&&e.target.trim().length>0?e.target.trim():void 0}_chunkA5EIY3HIcjs.a.call(void 0, ni,"arkRunCallSiteName");function ri(e){let t=ni(e),n=typeof e.fromLayer=="string"&&e.fromLayer.length>0?e.fromLayer:void 0;switch(e.ruleId){case"ARKRUN_MISSING_ROOT":return t?`Import createStrictArkKernel from arkgate/runtime and call it in composition root ${t} listed in arkRun.compositionRoots, then preflight again.`:"Import createStrictArkKernel from arkgate/runtime (same npm package; @arkgate/runtime is deprecated) and call it in a composition root listed in arkRun.compositionRoots, then preflight again. Never mechanical-safe \u2014 factory placement is a design decision.";case"ARKRUN_KERNEL_IN_DOMAIN":return t?`Move the kernel import of ${t} out of ${_nullishCoalesce(n, () => ("the Domain-role layer"))} into a composition root or adapter. Import from arkgate/runtime, then preflight again.`:"Move the kernel import out of the Domain-role layer into a composition root or adapter. Import from arkgate/runtime (same npm package; @arkgate/runtime is deprecated), then preflight again. Never mechanical-safe.";case"ARKRUN_DIRECT_NEW":return t?`Resolve ${t} from the kernel instead of constructing it with new, then preflight again.`:"Resolve the type from the kernel instead of constructing it with new, then preflight again. Never mechanical-safe \u2014 rewiring construction is a design decision.";case"ARKRUN_UNDECLARED_EMIT":return t?`Add ${t} to raises or sends on the managed component, then preflight again.`:"Add the existing call-site name to raises or sends on the managed component, then preflight again. Mechanical-safe only when that literal already exists and the edit is the declaration list; inventing a new emit stays judgment.";case"ARKRUN_UNDECLARED_HANDLE":return t?`Add ${t} to reactsTo on the managed component, then preflight again.`:"Add the existing call-site name to reactsTo on the managed component, then preflight again. Mechanical-safe only when that literal already exists and the edit is the declaration list; inventing a new handle stays judgment.";case"ARKRUN_UNDECLARED_DEPEND":return t?`Add ${t} to uses on the managed component, then preflight again.`:"Add the existing call-site name to uses on the managed component, then preflight again. Mechanical-safe only when that literal already exists and the edit is the declaration list; inventing a new depend stays judgment.";case"ARKRUN_TRANSPORT_BYPASS":return t?`Send through the ArkRun kernel transport instead of importing ${t}, then preflight again.`:"Send through the ArkRun kernel transport instead of importing that broker or emitter, then preflight again. Never mechanical-safe \u2014 homemade buses stay judgment.";default:return`Resolve ${typeof e.ruleId=="string"&&e.ruleId.length>0?e.ruleId:"ARK_UNKNOWN"} without weakening ark.config.json, then run Ark again.`}}_chunkA5EIY3HIcjs.a.call(void 0, ri,"arkRunNextAction");function ie(e){switch(e.ruleId){case"LAYER_IMPORT_VIOLATION":return ti(e);case"CONFIG_CHILD_SLICES_VERSION":return typeof e.nextAction=="string"&&e.nextAction.length>0?e.nextAction:"Bump the pinned arkgate named in the finding to the version it gives, then run Ark again.";case"FORBIDDEN_GLOBAL":return`Inject ${_nullishCoalesce(e.target, () => ("the capability"))} through a port, test at the public interface, then preflight again.`;case"CAPABILITY_VIOLATION":return`Define a ${String(_nullishCoalesce(e.capability, () => ("capability")))} port in ${_nullishCoalesce(e.fromLayer, () => ("the walled layer"))}, bind the implementation outside it, test at the public interface, then preflight again.`;case"CIRCULAR_DEPENDENCY":return"Extract the shared dependency into a third module, test at the public interface, then preflight again.";case"RAW_EVENT_PUBLISH":return"Publish through a registered intent creator, then run Ark again.";case"LITERAL_PATH_DRIFT":return typeof e.target=="string"&&e.target.length>0?`Rewrite the literal to ${e.target}, or run \`arkgate-check --path-drift --base-ref <ref> --write\` to apply every anchored replacement.`:"Rewrite the literal to the rename destination, or run `arkgate-check --path-drift --base-ref <ref> --write` to apply every anchored replacement.";case"LITERAL_PATH_UNRESOLVED":return"Read the candidate and decide: fix the path, or leave it. Advisory \u2014 with no rename to anchor it there is no destination to propose, so --write never touches it.";case"PUBLISH_MISSING_SOURCE":return"Add metadata.source to the publish call, then run Ark again.";case"INVARIANT_COVERAGE_OUTSIDE_ROOTS":return"Move the covering test under a declared coverage root, or add its root to coverage.coverageRoots in ark.config.json, then run Ark again.";case"INVARIANT_CATALOG_EMPTY":return typeof e.file=="string"&&e.file.length>0?`Add 1\u20132 short phrases to invariants[] in ${e.file}, then run ark-check --doctor. Starters show the shape.`:"Add 1\u20132 short phrases to invariants[] in arkrules/<Domain>.json, then run ark-check --doctor. Starters show the shape.";case"INVARIANT_TESTS_PATH_MISSING":return"Add coverage.testGlobs or coverage.coverageRoots in ark.config.json pointing at a real tests folder, then re-run. Adopted mode fails closed until that path is present.";case"INVARIANT_COVERAGE_ROOTS_MISSING":return"Add coverage.coverageRoots in ark.config.json pointing at the folder the test runner uses, then re-run. An enforced invariant fails closed until that path is present.";case"ARKRULE_STRUCTURE":case"ARKRULE_INVARIANT":case"INVARIANT_UNCOVERED":return`Fix the structure or invariant for ${typeof e.arkruleId=="string"&&e.arkruleId.length>0?e.arkruleId:"the ArkRule"} (declared in ${typeof e.arkruleSource=="string"&&e.arkruleSource.length>0?e.arkruleSource:"arkrules/<Layer>.json"}), then preflight again. Do not demote the rule without a hash-bound policy acknowledgement.`;case"ARKRUN_MISSING_ROOT":case"ARKRUN_KERNEL_IN_DOMAIN":case"ARKRUN_DIRECT_NEW":case"ARKRUN_UNDECLARED_EMIT":case"ARKRUN_UNDECLARED_HANDLE":case"ARKRUN_UNDECLARED_DEPEND":case"ARKRUN_TRANSPORT_BYPASS":return ri(e);case"ARKORDER_MISSING_PLANE":return typeof e.target=="string"&&e.target.length>0?`Import createOrderPlane from arkgate/order and call it in plane root ${e.target} listed in arkOrder.planeRoots, then preflight again.`:"Import createOrderPlane from arkgate/order and call it in a plane root listed in arkOrder.planeRoots, then preflight again. Never mechanical-safe \u2014 factory placement is a design decision.";case"ARKORDER_KERNEL_IN_DOMAIN":return"Move the arkgate/order import out of the Domain-role layer into a plane root or adapter, then preflight again. Never mechanical-safe.";case"ARKORDER_GENERIC_UPDATE":return"Don't use a generic update. First freeze with release(). Later, propose the change, then apply it.";case"ARKORDER_TOO_MANY_PARAMS":return"Cut \u03BE to the slow keys that actually slave the rest, then preflight again. Never mechanical-safe.";case"ARKORDER_INGEST_WRITES_XI":return"Keep ingest results as absorb/escalate_up/hold only. Change \u03BE with proposeRelease then apply(ProposeResult). Never mechanical-safe.";case"ARKORDER_XI_FIELD_WRITE":return typeof e.target=="string"&&e.target.length>0?`Don't write ${e.target} from a use-case. Take the event in, or change that choice through the valve (proposeRelease then apply), not a generic update.`:"Don't write a named product choice from a use-case. Take the event in, or change that choice through the valve (proposeRelease then apply), not a generic update.";case"ARKORDER_UNVALVED_RELEASE":return"Change the choice with proposeRelease then apply. release() is only the first freeze. Never mechanical-safe.";default:return typeof e.ruleId=="string"&&e.ruleId.startsWith("ARKRULE_")?`Fix the ArkRule ${typeof e.arkruleId=="string"?e.arkruleId:e.ruleId}, then preflight again.`:`Resolve ${typeof e.ruleId=="string"&&e.ruleId.length>0?e.ruleId:"ARK_UNKNOWN"} without weakening ark.config.json, then run Ark again.`}}_chunkA5EIY3HIcjs.a.call(void 0, ie,"deterministicNextAction");var mt="1.5",Ut="docs/diagnostics.md",Zr= exports.ARK_ANALYSIS_RESULT_SCHEMA ={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://unpkg.com/arkgate@3/schemas/ark.analysis-result.schema.json",title:"ArkGate analysis result",type:"object",additionalProperties:!1,required:["schemaVersion","mode","valid","completeness","completenessReasons","diagnostics"],allOf:[{if:{properties:{completeness:{enum:["partial","unavailable"]}},required:["completeness"]},then:{properties:{valid:{const:!1}}}},{if:{properties:{mode:{const:"resolved-candidate-facts"},completeness:{enum:["complete","partial"]}},required:["mode","completeness"]},then:{required:["policyHash","resolverIdentity","factsHash","candidateTreeHash"]}},{if:{properties:{completeness:{const:"complete"}},required:["completeness"]},then:{properties:{completenessReasons:{maxItems:0}}},else:{properties:{completenessReasons:{minItems:1}}}}],properties:{schemaVersion:{const:"1.5"},mode:{enum:["lexical-compatibility","resolved-candidate-facts"]},valid:{type:"boolean"},completeness:{enum:["complete","partial","unavailable"]},completenessReasons:{type:"array",items:{type:"object",additionalProperties:!1,required:["code","message"],properties:{code:{type:"string",minLength:1},message:{type:"string",minLength:1},file:{type:"string",minLength:1}}}},policyHash:{type:"string",minLength:1},resolverIdentity:{type:"string",minLength:1},factsHash:{type:"string",minLength:1},candidateTreeHash:{type:"string",minLength:1},diagnostics:{type:"array",items:{type:"object",additionalProperties:!1,required:["ruleId","severity","message","location","evidence"],properties:{ruleId:{type:"string",minLength:1},severity:{enum:["error","warning"]},message:{type:"string",minLength:1},location:{type:"object",additionalProperties:!1,required:["file","line","column"],properties:{file:{type:"string",minLength:1},line:{type:"integer",minimum:1},column:{type:"integer",minimum:1}}},evidence:{type:"object",additionalProperties:!1,properties:{target:{type:"string"},fromLayer:{type:"string"},toLayer:{type:"string"},typeOnly:{type:"boolean"},targetTypeOnlyExports:{type:"boolean"},sourcePureTypeModule:{type:"boolean"},namedBindingsTypeOnly:{type:"boolean"},portProofEligible:{type:"boolean"},peerIsolation:{type:"boolean"},capability:{type:"string",minLength:1},edgeKind:{type:"string",minLength:1},arkruleId:{type:"string",minLength:1},arkruleSource:{type:"string",minLength:1},reasonId:{enum:["CROSS_PARENT_SLICE","CROSS_SIBLING_SLICE","CROSS_PARENT_VIA_SHARED"]},universeFrom:{type:"string",minLength:1},universeTo:{type:"string",minLength:1}}},nextAction:{type:"string",minLength:1},findingRef:{type:"string",minLength:1,pattern:"^fnv1a-[0-9a-f]{8}$"},targetKey:{type:"string",minLength:1},docsCodePath:{type:"string",minLength:1}}}}}};function ht(e){let t=typeof e.ruleId=="string"?e.ruleId:typeof e.code=="string"?e.code:void 0,n=typeof e.file=="string"?e.file:void 0,r=typeof e.fromLayer=="string"?e.fromLayer:void 0,a=typeof e.toLayer=="string"?e.toLayer:void 0,s=typeof e.target=="string"?e.target:void 0;return[t,n,_nullishCoalesce(r, () => ("")),_nullishCoalesce(a, () => ("")),_nullishCoalesce(s, () => (""))].join("|")}_chunkA5EIY3HIcjs.a.call(void 0, ht,"adapterFindingTargetKey");function yt(e){let t=new Map;return e.map(n=>{let r=ht(n),a=(_nullishCoalesce(t.get(r), () => (0)))+1;return t.set(r,a),a===1?r:`${r}#${a}`})}_chunkA5EIY3HIcjs.a.call(void 0, yt,"adapterFindingOccurrenceTargetKeys");function Gt(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`fnv1a-${(t>>>0).toString(16).padStart(8,"0")}`}_chunkA5EIY3HIcjs.a.call(void 0, Gt,"adapterFindingRefFromTargetKey");function jt(e){return`${Ut}#${e}`}_chunkA5EIY3HIcjs.a.call(void 0, jt,"adapterDocsCodePath");function _(e){return typeof e=="string"&&e.length>0?e:void 0}_chunkA5EIY3HIcjs.a.call(void 0, _,"text");function Jr(e,t){return Number.isInteger(e)&&Number(e)>0?Number(e):t}_chunkA5EIY3HIcjs.a.call(void 0, Jr,"positiveInteger");function si(e,t,n){return ie({ruleId:e,target:_nullishCoalesce(_nullishCoalesce(_(t.target), () => (_(n.target))), () => (void 0)),fromLayer:_nullishCoalesce(_(t.fromLayer), () => (void 0)),toLayer:_nullishCoalesce(_(t.toLayer), () => (void 0)),typeOnly:t.typeOnly===!0,targetTypeOnlyExports:t.targetTypeOnlyExports===!0,namedBindingsTypeOnly:t.namedBindingsTypeOnly===!0,portProofEligible:t.portProofEligible===!0,peerIsolation:t.peerIsolation===!0,sourcePureTypeModule:t.sourcePureTypeModule===!0,edgeKind:_nullishCoalesce(_(t.edgeKind), () => (void 0)),capability:_nullishCoalesce(_nullishCoalesce(_(t.capability), () => (_(n.capability))), () => (void 0)),arkruleId:_nullishCoalesce(_(t.arkruleId), () => (void 0)),arkruleSource:_nullishCoalesce(_(t.arkruleSource), () => (void 0)),reasonId:_nullishCoalesce(_(t.reasonId), () => (void 0))})}_chunkA5EIY3HIcjs.a.call(void 0, si,"nextActionForDiagnostic");var ai=new Set(["CROSS_PARENT_SLICE","CROSS_SIBLING_SLICE","CROSS_PARENT_VIA_SHARED"]);function oi(e){let t=e.details,n=t!==null&&typeof t=="object"?t.reasonId:void 0,r=_nullishCoalesce(_(e.reasonId), () => (_(n)));return r&&ai.has(r)?r:void 0}_chunkA5EIY3HIcjs.a.call(void 0, oi,"sliceReasonOf");function Bt(e,t="error",n){let r=_nullishCoalesce(_nullishCoalesce(_(e.ruleId), () => (_(e.code))), () => ("ARK_UNKNOWN")),a=e.severity==="warning"||e.failsStrict===!1||e.typeOnly===!0&&e.peerIsolation!==!0?"warning":t,s=oi(e),o={..._(e.target)?{target:_(e.target)}:{},..._(e.fromLayer)?{fromLayer:_(e.fromLayer)}:{},..._(e.toLayer)?{toLayer:_(e.toLayer)}:{},...typeof e.typeOnly=="boolean"?{typeOnly:e.typeOnly}:{},...typeof e.targetTypeOnlyExports=="boolean"?{targetTypeOnlyExports:e.targetTypeOnlyExports}:{},...typeof e.sourcePureTypeModule=="boolean"?{sourcePureTypeModule:e.sourcePureTypeModule}:{},...typeof e.namedBindingsTypeOnly=="boolean"?{namedBindingsTypeOnly:e.namedBindingsTypeOnly}:{},...typeof e.portProofEligible=="boolean"?{portProofEligible:e.portProofEligible}:{},...typeof e.peerIsolation=="boolean"?{peerIsolation:e.peerIsolation}:{},..._(e.capability)?{capability:_(e.capability)}:{},..._(e.edgeKind)?{edgeKind:_(e.edgeKind)}:{},..._(e.arkruleId)?{arkruleId:_(e.arkruleId)}:{},..._(e.arkruleSource)?{arkruleSource:_(e.arkruleSource)}:{},...s?{reasonId:s}:{},...s&&_(e.universeFrom)?{universeFrom:_(e.universeFrom)}:{},...s&&_(e.universeTo)?{universeTo:_(e.universeTo)}:{}},c=_nullishCoalesce(n, () => (ht(e))),l=Gt(c);return{ruleId:r,severity:a,message:_nullishCoalesce(_(e.message), () => (r)),location:{file:_nullishCoalesce(_(e.file), () => ("<unknown>")),line:Jr(e.line,1),column:Jr(e.column,1)},evidence:o,nextAction:_nullishCoalesce(_(e.nextAction), () => (si(r,o,e))),findingRef:l,targetKey:c,docsCodePath:jt(r)}}_chunkA5EIY3HIcjs.a.call(void 0, Bt,"toAdapterDiagnostic");function ii(e){let t=_nullishCoalesce(e.completeness, () => ("complete")),n=_nullishCoalesce(e.mode, () => ("lexical-compatibility"));if(t==="complete"&&(_nullishCoalesce(_optionalChain([e, 'access', _11 => _11.completenessReasons, 'optionalAccess', _12 => _12.length]), () => (0)))>0)throw new Error("completenessReasons must be empty when completeness is complete.");let r=t==="complete"?[]:e.completenessReasons&&e.completenessReasons.length>0?e.completenessReasons.map(h=>({code:_nullishCoalesce(_(h.code), () => ("ANALYSIS_EVIDENCE_INCOMPLETE")),message:_nullishCoalesce(_(h.message), () => (`Analysis ${t}: required evidence is incomplete.`)),..._(h.file)?{file:_(h.file)}:{}})):[{code:t==="unavailable"?"ANALYSIS_UNAVAILABLE":"ANALYSIS_EVIDENCE_INCOMPLETE",message:`Analysis ${t}: required evidence is incomplete.`}],a={..._(e.policyHash)?{policyHash:_(e.policyHash)}:{},..._(e.resolverIdentity)?{resolverIdentity:_(e.resolverIdentity)}:{},..._(e.factsHash)?{factsHash:_(e.factsHash)}:{},..._(e.candidateTreeHash)?{candidateTreeHash:_(e.candidateTreeHash)}:{}};if(n==="resolved-candidate-facts"&&t!=="unavailable"){for(let h of["policyHash","resolverIdentity","factsHash","candidateTreeHash"])if(!a[h])throw new Error(`${h} is required for resolved ${t} adapter evidence.`)}let s=_nullishCoalesce(e.violations, () => ([])),o=_nullishCoalesce(e.warnings, () => ([])),c=yt(s),l=yt(o),p=[...s.map((h,u)=>Bt(h,"error",c[u])),...o.map((h,u)=>Bt(h,"warning",l[u]))],f={schemaVersion:"1.5",completenessReasons:r,diagnostics:p};if(n==="resolved-candidate-facts"){if(t==="unavailable")return{...f,mode:n,valid:!1,completeness:t,...a};let h={policyHash:a.policyHash,resolverIdentity:a.resolverIdentity,factsHash:a.factsHash,candidateTreeHash:a.candidateTreeHash};return t==="complete"?{...f,mode:n,valid:e.valid,completeness:t,...h}:{...f,mode:n,valid:!1,completeness:t,...h}}return t==="complete"?{...f,mode:n,valid:e.valid,completeness:t,...a}:{...f,mode:n,valid:!1,completeness:t,...a}}_chunkA5EIY3HIcjs.a.call(void 0, ii,"createAdapterResult");var Wt=Object.freeze(["network","filesystem","clock","randomness","environment","process","persistence"]),Yt=Object.freeze({fetch:"network",XMLHttpRequest:"network",Date:"clock","Date.now":"clock","Math.random":"randomness","process.env":"environment",process:"process"}),Xt=Object.freeze(Object.keys(Yt).sort()),zt=Object.freeze({fs:"filesystem","node:fs":"filesystem","fs/promises":"filesystem","node:fs/promises":"filesystem","fs-extra":"filesystem","graceful-fs":"filesystem",memfs:"filesystem",chokidar:"filesystem",http:"network",https:"network",http2:"network",net:"network",tls:"network",dgram:"network",dns:"network","node:http":"network","node:https":"network","node:http2":"network","node:net":"network","node:tls":"network","node:dgram":"network","node:dns":"network",axios:"network",undici:"network","node-fetch":"network",got:"network",ky:"network",superagent:"network",ws:"network",process:"process","node:process":"process",child_process:"process","node:child_process":"process","@prisma/client":"persistence",prisma:"persistence",pg:"persistence",mysql:"persistence",mysql2:"persistence",mongodb:"persistence",mongoose:"persistence",sqlite3:"persistence","better-sqlite3":"persistence",redis:"persistence",ioredis:"persistence",typeorm:"persistence",knex:"persistence","drizzle-orm":"persistence",sequelize:"persistence",kysely:"persistence","@supabase/supabase-js":"persistence"}),qt=Object.freeze({process:Object.freeze(["process","node:process"])});function ze(e){if(!e||e.startsWith(".")||e.startsWith("/"))return null;let t=zt[e];if(t)return t;let n=e.indexOf("/");if(n<0)return null;let r=e.slice(0,n),a=zt[r];if(a)return a;let s=e.indexOf("/",n+1);return s<0?null:_nullishCoalesce(zt[e.slice(0,s)], () => (null))}_chunkA5EIY3HIcjs.a.call(void 0, ze,"capabilityForModuleSpecifier");function he(e,t){for(let n of t)if(_optionalChain([qt, 'access', _13 => _13[n], 'optionalAccess', _14 => _14.includes, 'call', _15 => _15(e)]))return n;return null}_chunkA5EIY3HIcjs.a.call(void 0, he,"forbiddenGlobalForModuleSpecifier");function Rt(e){let t=e.split(".");for(let n=t.length;n>=1;n-=1){let r=t.slice(0,n).join("."),a=Yt[r];if(a)return a}return null}_chunkA5EIY3HIcjs.a.call(void 0, Rt,"capabilityForAmbientName");function Pe(e){if(_optionalChain([e, 'optionalAccess', _16 => _16.pure])===!0)return[...Wt].sort();let n=(_nullishCoalesce(_optionalChain([e, 'optionalAccess', _17 => _17.capabilities, 'optionalAccess', _18 => _18.deny]), () => ([]))).filter(r=>Wt.includes(r));return[...new Set(n)].sort()}_chunkA5EIY3HIcjs.a.call(void 0, Pe,"effectiveCapabilityDeny");function We(e,t){if(t.length===0)return!1;let n=new Set(t),r=e.split(".");for(let a=r.length;a>=1;a-=1)if(n.has(r.slice(0,a).join(".")))return!0;return!1}_chunkA5EIY3HIcjs.a.call(void 0, We,"ambientCoveredByForbiddenGlobals");function At(e){let t=new Set,n=new Set,r=Object.keys(Yt);for(let a of _nullishCoalesce(_optionalChain([e, 'optionalAccess', _19 => _19.forbiddenGlobals]), () => ([]))){let s=r.filter(o=>o===a||o.startsWith(`${a}.`));if(s.length===0)n.add(a);else for(let o of s)t.add(`ambient:${o}`);for(let o of _nullishCoalesce(qt[a], () => ([])))t.add(`import-exact:${o}`)}for(let a of Pe(e)){if(t.add(`import:${a}`),a==="process")for(let s of qt.process)t.add(`import-exact:${s}`);for(let s of r)Rt(s)===a&&t.add(`ambient:${s}`)}return{atoms:[...t].sort(),rawGlobals:[...n].sort()}}_chunkA5EIY3HIcjs.a.call(void 0, At,"loweredLayerCoverage");function Le(e,t){return t&&e.isStringLiteralLike(t)?t.text:void 0}_chunkA5EIY3HIcjs.a.call(void 0, Le,"literalText");function ts(e,t){return e.getLineAndCharacterOfPosition(t.getStart(e)).line+1}_chunkA5EIY3HIcjs.a.call(void 0, ts,"lineOf");function Qr(e,t){if(e.isImportDeclaration(t)){let r=t.importClause;if(!r)return!1;if(r.isTypeOnly)return!0;let a=r.namedBindings;return!!(a&&e.isNamedImports(a)&&a.elements.length>0&&a.elements.every(s=>s.isTypeOnly))}if(t.isTypeOnly)return!0;let n=t.exportClause;return!!(n&&e.isNamedExports(n)&&n.elements.length>0&&n.elements.every(r=>r.isTypeOnly))}_chunkA5EIY3HIcjs.a.call(void 0, Qr,"isTypeOnlyReference");function ns(e,t){let n={noLib:!0,noResolve:!0,target:e.ScriptTarget.Latest},r=e.createCompilerHost(n,!0);return r.getSourceFile=a=>a===t.fileName?t:void 0,r.fileExists=a=>a===t.fileName,r.readFile=a=>a===t.fileName?t.text:void 0,e.createProgram([t.fileName],n,r).getTypeChecker()}_chunkA5EIY3HIcjs.a.call(void 0, ns,"singleFileChecker");function Zt(e,t){try{return e.getSymbolAtLocation(t)}catch (e2){return}}_chunkA5EIY3HIcjs.a.call(void 0, Zt,"symbolAt");function Jt(e,t,n,r){let a=r.parent&&e.isShorthandPropertyAssignment(r.parent)&&r.parent.name===r,s;try{s=a?t.getShorthandAssignmentValueSymbol(r.parent):Zt(t,r)}catch (e3){s=void 0}return!!_optionalChain([s, 'optionalAccess', _20 => _20.declarations, 'optionalAccess', _21 => _21.some, 'call', _22 => _22(o=>o.getSourceFile().fileName===n.fileName)])}_chunkA5EIY3HIcjs.a.call(void 0, Jt,"localDeclaration");function De(e,t){let n,r=[],a=_chunkA5EIY3HIcjs.a.call(void 0, (o,c,l,p=!1)=>r.push({specifier:l,kind:c,line:ts(t,o),typeOnly:p,unresolved:l===void 0,node:o}),"add"),s=_chunkA5EIY3HIcjs.a.call(void 0, o=>{if(e.isImportDeclaration(o))a(o,"import",Le(e,o.moduleSpecifier),Qr(e,o));else if(e.isExportDeclaration(o)&&o.moduleSpecifier)a(o,"export",Le(e,o.moduleSpecifier),Qr(e,o));else if(e.isImportEqualsDeclaration(o)&&e.isExternalModuleReference(o.moduleReference))a(o,"require",Le(e,o.moduleReference.expression),o.isTypeOnly===!0);else if(e.isCallExpression(o)){let c=o.expression.kind===e.SyntaxKind.ImportKeyword,p=e.isIdentifier(o.expression)&&o.expression.text==="require"&&!Jt(e,_nullishCoalesce(n, () => ((n=ns(e,t)))),t,o.expression);(c||p)&&a(o,p?"require":"dynamic-import",Le(e,o.arguments[0]))}e.forEachChild(o,s)},"visit");return s(t),r}_chunkA5EIY3HIcjs.a.call(void 0, De,"extractSemanticDependencies");function li(e,t){let n=[],r=t;for(;e.isPropertyAccessExpression(r)||e.isElementAccessExpression(r);){if(e.isPropertyAccessExpression(r))n.unshift(r.name.text);else{let a=Le(e,r.argumentExpression);if(a===void 0)return;n.unshift(a)}r=r.expression}if(e.isIdentifier(r))return n.unshift(r.text),{root:r,segments:n}}_chunkA5EIY3HIcjs.a.call(void 0, li,"staticAccessPath");function ci(e,t){let n=t.parent;return e.isPropertyAccessExpression(n)||e.isElementAccessExpression(n)?!1:e.isExpressionNode(t)&&!e.isInTypeQuery(t)||e.isShorthandPropertyAssignment(n)&&n.name===t}_chunkA5EIY3HIcjs.a.call(void 0, ci,"runtimeIdentifierReference");function es(e,t){let n=t[0]==="globalThis"?t.slice(1):t;for(let r=n.length;r>=1;r-=1){let a=n.slice(0,r).join(".");if(e.has(a))return a}}_chunkA5EIY3HIcjs.a.call(void 0, es,"bestForbiddenMatch");function Fe(e,t,n){if(n.length===0)return[];let r=new Set(n),a=ns(e,t),s=new Map,o=new Set;for(let u of t.statements)if(e.isVariableStatement(u))for(let A of u.declarationList.declarations)e.isIdentifier(A.name)&&o.add(A.name.text);let c=_chunkA5EIY3HIcjs.a.call(void 0, u=>{let A=li(e,u);if(!A)return;let d=Zt(a,A.root),g=d?s.get(d):void 0;return g?[...g,...A.segments.slice(1)]:Jt(e,a,t,A.root)||o.has(A.root.text)?void 0:A.segments},"resolvePath");for(let u of t.statements)if(e.isVariableStatement(u))for(let A of u.declarationList.declarations){if(!A.initializer||!e.isIdentifier(A.name))continue;let d=c(A.initializer),g=Zt(a,A.name);!d||!g||s.set(g,d)}let l=[],p=new Set,f=_chunkA5EIY3HIcjs.a.call(void 0, (u,A)=>{let d=ts(t,A),g=`${u}:${A.getStart(t)}`;p.has(g)||(p.add(g),l.push({name:u,line:d,node:A}))},"flag"),h=_chunkA5EIY3HIcjs.a.call(void 0, u=>{let A=u.parent&&(e.isPropertyAccessExpression(u.parent)||e.isElementAccessExpression(u.parent))&&u.parent.expression===u;if((e.isPropertyAccessExpression(u)||e.isElementAccessExpression(u))&&!A){let d=c(u),g=d?es(r,d):void 0;g&&f(g,u)}else e.isIdentifier(u)&&r.has(u.text)&&ci(e,u)&&!Jt(e,a,t,u)&&f(u.text,u);if(e.isVariableDeclaration(u)&&e.isObjectBindingPattern(u.name)&&u.initializer){let d=c(u.initializer);if(d)for(let g of u.name.elements){if(!e.isIdentifier(g.name))continue;let b=g.propertyName?_nullishCoalesce(Le(e,g.propertyName), () => (g.propertyName.text)):g.name.text,x=es(r,[...d,b]);x&&f(x,u.initializer)}}e.forEachChild(u,h)},"visit");return h(t),l}_chunkA5EIY3HIcjs.a.call(void 0, Fe,"collectForbiddenCapabilityUses");function Qt(e,t,n){let r=[];for(let a of _nullishCoalesce(_optionalChain([n, 'optionalAccess', _23 => _23.dependencies]), () => (De(e,t)))){if(a.typeOnly||!a.specifier)continue;let s=ze(a.specifier);s&&r.push({capability:s,symbol:a.specifier,line:a.line,source:"import-based"})}for(let a of _nullishCoalesce(_optionalChain([n, 'optionalAccess', _24 => _24.ambientUses]), () => (Fe(e,t,Xt)))){let s=Rt(a.name);s&&r.push({capability:s,symbol:a.name,line:a.line,source:"ambient-global"})}return r.sort((a,s)=>a.line-s.line||a.capability.localeCompare(s.capability)||a.symbol.localeCompare(s.symbol))}_chunkA5EIY3HIcjs.a.call(void 0, Qt,"collectCapabilityUses");function B(e,t,n){return{ruleId:e,code:e,message:t,...n}}_chunkA5EIY3HIcjs.a.call(void 0, B,"violation");function di(e,t){return e?t==="unclassifiable-path"||t==="missing-path"?"Move the file into a slice, or declare its root in the rule's sharedRoots.":t==="no-slice-folders"?"Set sliceFolders on the peerIsolation rule.":t==="shared-imports-slice"?"Move the code the shared root needs into the shared root, or invert the dependency.":"Extract shared code to a shared layer, or coordinate slices via events/ports \u2014 do not import across feature/context slices.":"Depend on a port/interface owned by an inner layer instead, or move this code to a layer allowed to make this import."}_chunkA5EIY3HIcjs.a.call(void 0, di,"peerSuggestion");function $e(e,t){return e.slice(0,t).split(`
|
|
2
|
+
`).length}_chunkA5EIY3HIcjs.a.call(void 0, $e,"lineOf");var ui=new Set(["publish","subscribe","defineIntent","registerHandler"]);function pi(e,t){return e.index+e[0].indexOf(t)}_chunkA5EIY3HIcjs.a.call(void 0, pi,"captureIndex");function fi(e){let t=[],n=new Set,r=_chunkA5EIY3HIcjs.a.call(void 0, (c,l)=>{!c||n.has(l)||(n.add(l),t.push({value:c,index:l}))},"push"),a=_chunkA5EIY3HIcjs.a.call(void 0, c=>{c.lastIndex=0;let l;for(;(l=c.exec(e))!==null;){let p=l[1];p&&r(p,pi(l,p))}},"pushFrom");a(/\b(?:publish|subscribe|defineIntent|registerHandler)\s{0,8}(?:<[^>]{0,120}>)?\s{0,8}\(\s{0,8}['"`]([A-Za-z][A-Za-z0-9_.]*)['"`]/g),a(/\b(?:intent|onEvent)\s{0,8}:\s{0,8}['"`]([A-Za-z][A-Za-z0-9_.]*)['"`]/g);let s=/\breactsTo\s{0,8}:\s{0,8}\[([^\]]{0,2000})\]/g,o;for(;(o=s.exec(e))!==null;){let c=_nullishCoalesce(o[1], () => ("")),l=o.index+o[0].indexOf(c),p=/['"`]([A-Za-z][A-Za-z0-9_.]*)['"`]/g,f;for(;(f=p.exec(c))!==null;){let h=f[1];h&&r(h,l+f.index+f[0].indexOf(h))}}return a(/\bmetadata\s{0,8}:\s{0,8}\{[^}]{0,400}\bsource\s{0,8}:\s{0,8}['"`]([A-Za-z][A-Za-z0-9_.]*)['"`]/g),a(/\bpublish\s{0,8}(?:<[^>]{0,120}>)?\s{0,8}\([^;]{0,400}?\bsource\s{0,8}:\s{0,8}['"`]([A-Za-z][A-Za-z0-9_.]*)['"`]/g),t.sort((c,l)=>c.index-l.index)}_chunkA5EIY3HIcjs.a.call(void 0, fi,"extractQuotedStrings");function gi(e){let t=[],n=[{kind:"import",re:/\bimport\s+(?:type\s+)?(?:[^'"]*?\s+from\s*)?['"]([^'"]+)['"]/g},{kind:"export",re:/\bexport\s+(?:type\s+)?[^'"]*?\s+from\s*['"]([^'"]+)['"]/g},{kind:"dynamic-import",re:/\bimport\s*\(\s*['"]([^'"]+)['"]\s*\)/g},{kind:"require",re:/\brequire\s*\(\s*['"]([^'"]+)['"]\s*\)/g}];for(let r of n){let a;for(;(a=r.re.exec(e))!==null;){let s=a.index+a[0].indexOf(a[1]),o=a[0],c=r.kind==="import"&&/\bimport\s+type\b/.test(o)||r.kind==="export"&&/\bexport\s+type\b/.test(o);t.push({value:a[1],index:s,kind:r.kind,typeOnly:c})}}return t.sort((r,a)=>r.index-a.index)}_chunkA5EIY3HIcjs.a.call(void 0, gi,"extractModuleSpecifiers");function mi(e,t){return!!(t&&(e.isParenthesizedExpression(t)||e.isAsExpression(t)||typeof e.isTypeAssertionExpression=="function"&&e.isTypeAssertionExpression(t)||typeof e.isSatisfiesExpression=="function"&&e.isSatisfiesExpression(t)))}_chunkA5EIY3HIcjs.a.call(void 0, mi,"isSyntaxWrapper");function en(e,t){let n=t;for(;_optionalChain([n, 'optionalAccess', _25 => _25.parent])&&mi(e,n.parent);)n=n.parent;return n}_chunkA5EIY3HIcjs.a.call(void 0, en,"unwrapWrappers");function tn(e,t){if(!t||!e.isCallExpression(t))return;let n=t.expression;if(e.isIdentifier(n))return n.text;if(e.isPropertyAccessExpression(n))return n.name.text}_chunkA5EIY3HIcjs.a.call(void 0, tn,"callCalleeName");function hi(e,t){let n=t.parent;if(!n||!e.isObjectLiteralExpression(n))return!1;let r=en(e,n),a=r.parent;if(!a)return!1;if(e.isCallExpression(a)&&tn(e,a)==="publish"){let s=a.arguments;return s[1]===r||s[2]===r}if(e.isPropertyAssignment(a)&&nn(e,a.name)==="metadata"){let s=a.parent;if(!s)return!1;let c=en(e,s).parent;return!!(c&&e.isCallExpression(c)&&tn(e,c)==="publish")}return!1}_chunkA5EIY3HIcjs.a.call(void 0, hi,"isPublishMetadataSource");function rs(e,t){let n=en(e,t),r=n.parent;if(!r)return!1;if(e.isCallExpression(r)){let a=tn(e,r);if(a&&ui.has(a)&&r.arguments.some(s=>s===n))return!0}if(e.isArrayLiteralExpression(r))return rs(e,r);if(e.isPropertyAssignment(r)){let a=nn(e,r.name);if(a==="intent"||a==="onEvent"||a==="reactsTo"||a==="source"&&hi(e,r))return!0}return!1}_chunkA5EIY3HIcjs.a.call(void 0, rs,"isDeclaredIntentSite");function yi(e,t){let n=e.createSourceFile("generated.ts",t,e.ScriptTarget.Latest,!0),r=[],a=_chunkA5EIY3HIcjs.a.call(void 0, s=>{e.isStringLiteralLike(s)&&rs(e,s)&&r.push({value:s.text,index:s.getStart(n)}),e.forEachChild(s,a)},"visit");return a(n),r}_chunkA5EIY3HIcjs.a.call(void 0, yi,"extractQuotedStringsAst");function Ri(e){let t=e.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);return["adapter","adapters","infra","infrastructure","persistence","repository","repositories","integration","database","db"].some(n=>t.includes(n))}_chunkA5EIY3HIcjs.a.call(void 0, Ri,"hasInfrastructureToken");function Ai(e){let t=e.toLowerCase();return["sequelize","prisma","typeorm","mongoose","knex"].some(n=>t===n||t.startsWith(`${n}/`))}_chunkA5EIY3HIcjs.a.call(void 0, Ai,"isKnownInfrastructurePackage");function ki(e){let t=e.toLowerCase();return["adapter","infra","persistence","repository","repositories","integration","database"].some(n=>t.includes(n))}_chunkA5EIY3HIcjs.a.call(void 0, ki,"layerHasInfrastructureRole");function Ye(e,t){return t&&e.isStringLiteralLike(t)?t.text:void 0}_chunkA5EIY3HIcjs.a.call(void 0, Ye,"tsStringLiteralText");function nn(e,t){if(t&&(e.isIdentifier(t)||e.isStringLiteralLike(t)))return t.text}_chunkA5EIY3HIcjs.a.call(void 0, nn,"tsPropertyName");function ss(e,t,n){if(!(!t||!e.isObjectLiteralExpression(t)))return t.properties.find(r=>!e.isPropertyAssignment(r)&&!e.isShorthandPropertyAssignment(r)?!1:nn(e,r.name)===n)}_chunkA5EIY3HIcjs.a.call(void 0, ss,"tsObjectProperty");function Xe(e,t,n){return ss(e,t,n)!==void 0}_chunkA5EIY3HIcjs.a.call(void 0, Xe,"tsObjectHasProperty");function qe(e,t,n){let r=ss(e,t,n);return r&&e.isPropertyAssignment(r)?r.initializer:void 0}_chunkA5EIY3HIcjs.a.call(void 0, qe,"tsObjectPropertyValue");function vi(e,t){let n=qe(e,t,"metadata");return Xe(e,n,"source")}_chunkA5EIY3HIcjs.a.call(void 0, vi,"tsObjectHasMetadataSource");function as(e,t){return t?e.isIdentifier(t)?/^[A-Z]/.test(t.text):e.isPropertyAccessExpression(t)?as(e,t.name):!1:!1}_chunkA5EIY3HIcjs.a.call(void 0, as,"tsLooksLikeIntentCreatorExpression");function bi(e,t){if(!e.isCallExpression(t))return!1;let n=t.expression;return e.isPropertyAccessExpression(n)?n.name.text==="publish":e.isIdentifier(n)&&n.text==="publish"}_chunkA5EIY3HIcjs.a.call(void 0, bi,"tsIsPublishCall");function Ii(e,t){if(!e.isCallExpression(t))return!1;let n=t.arguments[0],r=Ye(e,n);return r!==void 0&&_chunkUN5EH4QVcjs.h.call(void 0, r)||Xe(e,n,"intent")||as(e,n)}_chunkA5EIY3HIcjs.a.call(void 0, Ii,"tsIsArkPublishCandidate");function Ei(e,t){if(!e.isCallExpression(t))return!1;let[n,r,a]=t.arguments;return vi(e,n)||Xe(e,r,"source")||Xe(e,a,"source")}_chunkA5EIY3HIcjs.a.call(void 0, Ei,"tsPublishHasSource");function Si(e,t){if(!e.isCallExpression(t))return;let[n,r,a]=t.arguments,s=qe(e,n,"metadata");return _nullishCoalesce(_nullishCoalesce(Ye(e,qe(e,s,"source")), () => (Ye(e,qe(e,r,"source")))), () => (Ye(e,qe(e,a,"source"))))}_chunkA5EIY3HIcjs.a.call(void 0, Si,"tsPublishSourceLiteral");function Ci(e,t,n,r){let a=e.createSourceFile("generated.ts",t,e.ScriptTarget.Latest,!0),s=n,o=_optionalChain([s, 'optionalAccess', _26 => _26.filePath]),c=_optionalChain([s, 'optionalAccess', _27 => _27.layer]),l=[],p=_chunkA5EIY3HIcjs.a.call(void 0, h=>a.getLineAndCharacterOfPosition(h.getStart(a)).line+1,"lineForNode"),f=_chunkA5EIY3HIcjs.a.call(void 0, h=>{if(bi(e,h)){let u=h.arguments[0],A=Ye(e,u);for(let g of _chunkUN5EH4QVcjs.i.call(void 0, {publishCall:!0,rawIntentName:A,objectHasIntent:Xe(e,u,"intent"),arkPublishCandidate:Ii(e,h),hasSource:Ei(e,h)}))l.push(B(g.ruleId,g.message,{line:p(h),filePath:o}));let d=Si(e,h);if(r&&c&&d&&_chunkUN5EH4QVcjs.h.call(void 0, d)){let g=r.resolveLayer(d);g&&g!==c&&l.push(B("PUBLISH_SOURCE_LAYER_MISMATCH",`Publish source "${d}" resolves to ${g}, but the target file is classified as ${c}.`,{line:p(h),filePath:o,target:d,fromLayer:c,toLayer:g}))}}e.forEachChild(h,f)},"visit");return f(a),l}_chunkA5EIY3HIcjs.a.call(void 0, Ci,"analyzePublishAst");function os(e={}){let t=new Set((e.intents||[]).map(s=>typeof s=="string"?s:s.name)),n=e.forbiddenPatterns||[],r=new Set(_nullishCoalesce(e.infrastructureLayers, () => ([]))),a=_nullishCoalesce(e.enforceIntentAllowlist, () => (t.size>0));return{validate(s,o){let c=[],l=o,p=_optionalChain([l, 'optionalAccess', _28 => _28.filePath]),f=_optionalChain([l, 'optionalAccess', _29 => _29.layer]),h=e.typescript,u=h?h.createSourceFile(_nullishCoalesce(p, () => ("generated.ts")),s,h.ScriptTarget.Latest,!0):void 0,A=u?De(e.typescript,u):void 0,d=A?A.filter(k=>k.specifier!==void 0).map(k=>({value:k.specifier,index:k.node.getStart(u),kind:k.kind,typeOnly:k.typeOnly})):gi(s),g=e.typescript?yi(e.typescript,s):fi(s);if(e.typescript&&!_optionalChain([e, 'access', _30 => _30.allowNonLiteralDynamicImport, 'optionalCall', _31 => _31(p)]))for(let k of _nullishCoalesce(_optionalChain([A, 'optionalAccess', _32 => _32.filter, 'call', _33 => _33(({unresolved:E})=>E)]), () => ([]))){let E=k.kind==="require";c.push(B(E?"DYNAMIC_REQUIRE_NOT_ALLOWLISTED":"DYNAMIC_IMPORT_NOT_ALLOWLISTED",`Non-literal ${E?"require call":"dynamic import"} cannot be resolved statically; add the reviewed file to dynamicImportAllowlist.`,{line:k.line,filePath:p}))}let b=f!==void 0&&(r.has(f)||ki(f)),x=f!==void 0?` If "${f}" is an infrastructure layer, mark it in ark.config.json with "mayImportInfrastructure": true (or name it with an infra token like Adapters/Persistence/Repository).`:"";for(let k of n)if(k instanceof RegExp){k.lastIndex=0;let E=k.exec(s);k.lastIndex=0,E&&c.push(B("FORBIDDEN_PATTERN",`Forbidden pattern matched: ${k}`,{line:E.index===void 0?void 0:$e(s,E.index),filePath:p,suggestion:"Remove infrastructure imports from domain/application layers."+x}))}else s.includes(k)&&c.push(B("FORBIDDEN_SUBSTRING",`Forbidden substring: ${k}`,{line:$e(s,s.indexOf(k)),filePath:p}));for(let k of d){let E=_nullishCoalesce(_optionalChain([e, 'access', _34 => _34.resolveImportTarget, 'optionalCall', _35 => _35(k.value,p)]), () => ((e.resolveImportLayer?{layer:e.resolveImportLayer(k.value,p)}:void 0))),C=typeof p=="string"?_nullishCoalesce(_optionalChain([e, 'access', _36 => _36.resolveImportTarget, 'optionalCall', _37 => _37(p)]), () => ((e.resolveImportLayer?{layer:f,relPath:void 0}:void 0))):void 0,U=_optionalChain([E, 'optionalAccess', _38 => _38.layer]);if(U&&f){let K=_chunkUN5EH4QVcjs.E.call(void 0, _optionalChain([e, 'access', _39 => _39.architectureProfile, 'optionalAccess', _40 => _40.rules]),f,U,{fromPath:_optionalChain([C, 'optionalAccess', _41 => _41.relPath]),toPath:_optionalChain([E, 'optionalAccess', _42 => _42.relPath]),layers:e.architectureLayers});if(K){let G=K.rule;if(k.typeOnly&&!G.peerIsolation)continue;let I=!!G.peerIsolation,D=K.sliceVerdict,Y=_chunkUN5EH4QVcjs.B.call(void 0, D),re=_nullishCoalesce(_chunkUN5EH4QVcjs.z.call(void 0, G,D), () => ((I?`Layer "${f}" must not import across slices into "${U}".`:`Layer "${f}" must not import "${U}".`))),me=I&&_optionalChain([D, 'optionalAccess', _43 => _43.explanation])&&(Y.reasonId||K.peerIsolationReason!=="cross-slice")?D.explanation:void 0;c.push(B("LAYER_IMPORT_VIOLATION",me?`${re} ${me}`:re,{line:$e(s,k.index),source:k.value,target:k.value,filePath:p,fromLayer:f,toLayer:U,...I?{peerIsolation:!0}:{},...Y.reasonId?{reasonId:Y.reasonId}:{},...Y.universeFrom?{universeFrom:Y.universeFrom}:{},...Y.universeTo?{universeTo:Y.universeTo}:{},...Y.failsStrict===!1?{failsStrict:!1}:{},suggestion:di(I,K.peerIsolationReason),details:{importKind:k.kind,peerIsolation:I,...k.typeOnly?{typeOnly:!0}:{},...Y.reasonId?{reasonId:Y.reasonId}:{}}}));continue}continue}b||k.typeOnly||!Ri(k.value)&&!Ai(k.value)||c.push(B("FORBIDDEN_IMPORT",`Forbidden ${k.kind} target: "${k.value}".`,{line:$e(s,k.index),source:k.value,target:k.value,filePath:p,suggestion:"Route infrastructure access through an allowed adapter or port boundary."+x,details:{importKind:k.kind}}))}if(e.policies)for(let k of e.policies){let E=k.check({source:s,context:o});if(E!==!0)if(Array.isArray(E))for(let C of E)c.push(B("POLICY_VIOLATION",C.message,{filePath:p,suggestion:`Fix violation of policy "${k.name}".`}));else E===!1?c.push(B("POLICY_VIOLATION",`Policy ${k.name} failed on generated code`)):c.push(B("POLICY_VIOLATION",E.message))}if(a&&t.size>0)for(let k of g)_chunkUN5EH4QVcjs.h.call(void 0, k.value)&&!t.has(k.value)&&c.push(B("UNKNOWN_INTENT",`Unknown intent reference: "${k.value}"`,{line:$e(s,k.index),filePath:p,target:k.value,suggestion:`Register intent "${k.value}" via defineIntent() or remove the reference.`}));if(e.architectureProfile&&f)for(let k of g){if(!_chunkUN5EH4QVcjs.h.call(void 0, k.value))continue;let E=e.architectureProfile.resolveLayer(k.value);if(!E)continue;let C=_chunkUN5EH4QVcjs.E.call(void 0, e.architectureProfile.rules,f,E,{fromPath:typeof p=="string"?p:void 0,layers:e.architectureLayers});if(C){let U=C.sliceVerdict,K=`Layer "${f}" must not reference "${E}" through "${k.value}".`,G=U?_chunkUN5EH4QVcjs.A.call(void 0, {surface:"intent",verdict:U,fromLayer:f,toLayer:E,fromPath:typeof p=="string"?p:void 0,ruleMessage:C.rule.message,childMessage:_optionalChain([C, 'access', _44 => _44.rule, 'access', _45 => _45.childSlices, 'optionalAccess', _46 => _46.message]),defaultMessage:K}):_nullishCoalesce(C.rule.message, () => (K)),I=_chunkUN5EH4QVcjs.B.call(void 0, U);c.push(B("LAYER_REFERENCE_VIOLATION",G,{line:$e(s,k.index),filePath:p,target:k.value,fromLayer:f,toLayer:E,...I.reasonId?{reasonId:I.reasonId}:{},...I.failsStrict===!1?{failsStrict:!1}:{},suggestion:"Route the dependency through an allowed intent, port, or event.",details:{rule:C.rule,peerIsolationReason:C.peerIsolationReason,...I.reasonId?{reasonId:I.reasonId}:{}}}))}}if(e.extensions)for(let k of e.extensions)try{let E=k.analyze(s,o);c.push(...E)}catch(E){c.push(B("EXTENSION_ERROR",`Extension "${k.name}" failed: ${E instanceof Error?E.message:String(E)}`))}if(e.typescript&&u&&f&&_optionalChain([e, 'access', _47 => _47.forbiddenGlobals, 'optionalAccess', _48 => _48[f], 'optionalAccess', _49 => _49.length]))try{let k=e.forbiddenGlobals[f];c.push(...Fe(e.typescript,u,k).map(E=>B("FORBIDDEN_GLOBAL",`${f} must not use the ambient global "${E.name}".`,{line:E.line,filePath:p,target:E.name,fromLayer:f,suggestion:"Inject the capability through a port (e.g. a Clock, IdGenerator, or HttpPort) instead of reaching for the ambient global."})));for(let E of _nullishCoalesce(A, () => ([]))){if(E.typeOnly||!E.specifier)continue;let C=he(E.specifier,k);C&&c.push(B("FORBIDDEN_GLOBAL",`${f} must not use module "${E.specifier}" because it is the import form of forbidden global "${C}".`,{line:E.line,filePath:p,source:E.specifier,target:E.specifier,fromLayer:f,details:{importKind:E.kind,forbiddenGlobal:C},suggestion:"Inject the capability through a port instead of importing the ambient global module form."}))}}catch(k){c.push(B("AST_ANALYZER_ERROR",`TypeScript AST analyzer failed: ${k instanceof Error?k.message:String(k)}`))}if(e.typescript&&u&&f&&_optionalChain([e, 'access', _50 => _50.capabilityWalls, 'optionalAccess', _51 => _51[f], 'optionalAccess', _52 => _52.length]))try{let k=new Set(e.capabilityWalls[f]),E=_nullishCoalesce(_optionalChain([e, 'access', _53 => _53.forbiddenGlobals, 'optionalAccess', _54 => _54[f]]), () => ([]));for(let C of Qt(e.typescript,u))k.has(C.capability)&&(C.source==="ambient-global"&&We(C.symbol,E)||C.source==="import-based"&&he(C.symbol,E)||c.push(B("CAPABILITY_VIOLATION",C.source==="import-based"?`${f} denies the ${C.capability} capability; found import of "${C.symbol}".`:`${f} denies the ${C.capability} capability; found ambient "${C.symbol}".`,{line:C.line,filePath:p,target:C.symbol,capability:C.capability,fromLayer:f,suggestion:"Define a small port (ClockPort, HttpPort, StoragePort) and bind the implementation in an adapter layer."})))}catch(k){c.push(B("AST_ANALYZER_ERROR",`TypeScript AST analyzer failed: ${k instanceof Error?k.message:String(k)}`))}if(e.typescript)try{c.push(...Ci(e.typescript,s,o,e.architectureProfile))}catch(k){c.push(B("AST_ANALYZER_ERROR",`TypeScript AST analyzer failed: ${k instanceof Error?k.message:String(k)}`))}return{mode:"lexical-compatibility",completeness:"partial",completenessReasons:["LEXICAL_EVIDENCE_INCOMPLETE"],valid:!1,lexicalValid:!c.some(k=>k.failsStrict!==!1),violations:c}}}}_chunkA5EIY3HIcjs.a.call(void 0, os,"createAICodeGate");function X(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`fnv1a-${(t>>>0).toString(16).padStart(8,"0")}`}_chunkA5EIY3HIcjs.a.call(void 0, X,"deterministicHash");function z(e){if(e===null||typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(z).join(",")}]`;let t=e;return`{${Object.keys(t).sort().map(n=>`${JSON.stringify(n)}:${z(t[n])}`).join(",")}}`}_chunkA5EIY3HIcjs.a.call(void 0, z,"stableSerialize");function ue(e,t){let n=t.hash;for(let r=0;r<e.length;r+=1)n^=e.charCodeAt(r),n=Math.imul(n,16777619);t.hash=n}_chunkA5EIY3HIcjs.a.call(void 0, ue,"feedText");function rn(e,t){if(Array.isArray(e)){ue("[",t);for(let a=0;a<e.length;a+=1){if(a>0&&ue(",",t),!(a in e))continue;let s=e[a];if(s!==null&&typeof s=="object")rn(s,t);else{let o=JSON.stringify(s);o!==void 0&&ue(o,t)}}ue("]",t);return}let n=e,r=Object.keys(n).sort();ue("{",t);for(let a=0;a<r.length;a+=1){a>0&&ue(",",t);let s=r[a];ue(`${JSON.stringify(s)}:`,t);let o=n[s];o!==null&&typeof o=="object"?rn(o,t):ue(`${JSON.stringify(o)}`,t)}ue("}",t)}_chunkA5EIY3HIcjs.a.call(void 0, rn,"feedStable");function sn(e){if(e===null||typeof e!="object")return X(z(e));let t={hash:2166136261};return rn(e,t),`fnv1a-${(t.hash>>>0).toString(16).padStart(8,"0")}`}_chunkA5EIY3HIcjs.a.call(void 0, sn,"stableHash");var Se="1.2",is=["network","filesystem","clock","randomness","environment","process","persistence"];function V(e){let t=e.map((n,r)=>({key:z(n),index:r}));return t.sort((n,r)=>n.key<r.key?-1:n.key>r.key?1:n.index-r.index),t.map(({index:n})=>e[n])}_chunkA5EIY3HIcjs.a.call(void 0, V,"sortCanonical");function Z(e){return[...new Set(e)].sort((t,n)=>t<n?-1:t>n?1:0)}_chunkA5EIY3HIcjs.a.call(void 0, Z,"sortedUnique");function Ze(e){let t={schemaVersion:"1.2",include:Z(_nullishCoalesce(e.include, () => ([]))),exclude:Z(_nullishCoalesce(e.exclude, () => ([]))),excludeGenerated:e.excludeGenerated!==!1,dynamicImportAllowlist:Z(_nullishCoalesce(e.dynamicImportAllowlist, () => ([]))),layers:V(e.layers.map(n=>({name:n.name,patterns:Z(_nullishCoalesce(n.patterns, () => ([]))),exclude:Z(_nullishCoalesce(n.exclude, () => ([]))),forbiddenGlobals:Z(_nullishCoalesce(n.forbiddenGlobals, () => ([]))),intentPrefixes:Z(_nullishCoalesce(n.intentPrefixes, () => ([]))),capabilityDeny:Z(_nullishCoalesce(_optionalChain([n, 'access', _55 => _55.capabilities, 'optionalAccess', _56 => _56.deny]), () => ([]))),pure:n.pure===!0}))),safety:{maxTsSuppressions:_nullishCoalesce(_optionalChain([e, 'access', _57 => _57.safety, 'optionalAccess', _58 => _58.maxTsSuppressions]), () => (0)),maxAnyCasts:_nullishCoalesce(_optionalChain([e, 'access', _59 => _59.safety, 'optionalAccess', _60 => _60.maxAnyCasts]), () => (0)),allowInMemory:_optionalChain([e, 'access', _61 => _61.safety, 'optionalAccess', _62 => _62.allowInMemory])===!0,allowDisabledPeerIsolation:_optionalChain([e, 'access', _63 => _63.safety, 'optionalAccess', _64 => _64.allowDisabledPeerIsolation])===!0},...e.arkRun?{arkRun:{mode:e.arkRun.mode,compositionRoots:Z(e.arkRun.compositionRoots),managedLayers:Z(e.arkRun.managedLayers),requireDeclarations:e.arkRun.requireDeclarations===!0}}:{}};return X(z(t))}_chunkA5EIY3HIcjs.a.call(void 0, Ze,"resolvedFactsEvidenceRequirementsHash");function _i(e){let t=V(e.completenessReasons.map(I=>({code:I.code,message:I.message,...I.file?{file:I.file}:{}}))),n=e.files.map(I=>({...I,typeOnlyExportNames:Z(I.typeOnlyExportNames)})).sort((I,D)=>I.path<D.path?-1:I.path>D.path?1:0),r=V(e.dependencies.map(I=>({...I,...I.namedBindings?{namedBindings:Z(I.namedBindings)}:{}}))),a=V(e.capabilityUses.map(I=>({...I}))),s=V(e.ambientUses.map(I=>({...I}))),o=V(e.publishCalls.map(I=>({...I}))),c=V(e.intentReferences.map(I=>({...I}))),l=V(e.safetyUses.map(I=>({...I}))),p=V((_nullishCoalesce(e.classShapes, () => ([]))).map(I=>({...I,mutatingMethods:[..._nullishCoalesce(I.mutatingMethods, () => ([]))].map(D=>({...D}))}))),f=V((_nullishCoalesce(e.arkRunKernelCalls, () => ([]))).map(I=>({...I}))),h=V((_nullishCoalesce(e.arkRunManagedNews, () => ([]))).map(I=>({...I}))),u=V((_nullishCoalesce(e.arkRunCompositionRootHits, () => ([]))).map(I=>({...I}))),A=V((_nullishCoalesce(e.arkRunDeclarations, () => ([]))).map(I=>({...I,uses:Z(I.uses),reactsTo:Z(I.reactsTo),raises:Z(I.raises),sends:Z(I.sends)}))),d=V((_nullishCoalesce(e.arkOrderPlaneCalls, () => ([]))).map(I=>({...I}))),g=V((_nullishCoalesce(e.arkOrderGenericUpdates, () => ([]))).map(I=>({...I}))),b=V((_nullishCoalesce(e.arkOrderRootHits, () => ([]))).map(I=>({...I}))),x=V((_nullishCoalesce(e.arkOrderXiFieldWrites, () => ([]))).map(I=>({...I}))),k=V((_nullishCoalesce(e.arkOrderIngestWritesXi, () => ([]))).map(I=>({...I}))),E=V((_nullishCoalesce(e.arkOrderReleaseKeyCounts, () => ([]))).map(I=>({...I}))),C=V((_nullishCoalesce(e.arkOrderXiTtlKeys, () => ([]))).map(I=>({...I}))),U=V((_nullishCoalesce(e.arkOrderBudgetLeaks, () => ([]))).map(I=>({...I}))),K=e.files.map(({path:I,contentHash:D})=>({path:I,contentHash:D})).sort((I,D)=>I.path<D.path?-1:I.path>D.path?1:0),G=sn(K);return{schemaVersion:"1.2",completeness:e.completeness,completenessReasons:t,resolverIdentity:e.resolverIdentity,compilerIdentity:e.compilerIdentity,compilerOptionsHash:e.compilerOptionsHash,tsconfigHash:e.tsconfigHash,candidateTreeHash:G,evidenceRequirementsHash:e.evidenceRequirementsHash,...e.projectPackageName?{projectPackageName:e.projectPackageName}:{},files:n,dependencies:r,capabilityUses:a,ambientUses:s,publishCalls:o,intentReferences:c,safetyUses:l,classShapes:p,arkRunKernelCalls:f,arkRunManagedNews:h,arkRunCompositionRootHits:u,arkRunDeclarations:A,arkOrderPlaneCalls:d,arkOrderGenericUpdates:g,arkOrderRootHits:b,arkOrderXiFieldWrites:x,arkOrderIngestWritesXi:k,arkOrderReleaseKeyCounts:E,arkOrderXiTtlKeys:C,arkOrderBudgetLeaks:U}}_chunkA5EIY3HIcjs.a.call(void 0, _i,"canonicalResolvedFactsInput");function ls(e){let t=_i(e);return{...t,factsHash:sn(t)}}_chunkA5EIY3HIcjs.a.call(void 0, ls,"createCanonicalResolvedCandidateFacts");function on(e){return ls(cs(P(e,"$"),!1))}_chunkA5EIY3HIcjs.a.call(void 0, on,"createResolvedCandidateFacts");function P(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t} must be an object.`);return e}_chunkA5EIY3HIcjs.a.call(void 0, P,"asRecord");function L(e,t,n){let r=Object.keys(e).find(a=>!t.includes(a));if(r)throw new Error(`${n}.${r} is not part of schema ${"1.2"}.`)}_chunkA5EIY3HIcjs.a.call(void 0, L,"assertOnlyKeys");function N(e,t,n){let r=e[t];if(typeof r!="string"||r.length===0)throw new Error(`${n}.${t} must be a non-empty string.`);return r}_chunkA5EIY3HIcjs.a.call(void 0, N,"requiredText");function pe(e,t,n){if(e[t]!==void 0)return N(e,t,n)}_chunkA5EIY3HIcjs.a.call(void 0, pe,"optionalText");function F(e,t,n){let r=N(e,t,n),a=r.replace(/\\/g,"/");if(!a||a.startsWith("/")||/^[A-Za-z]:\//.test(a)||/[\u0000-\u001f\u007f]/.test(a))throw new Error(`${n}.${t} must be a canonical project-relative path.`);let s=[];for(let c of a.split("/"))if(!(!c||c==="."))if(c===".."){if(s.length===0)throw new Error(`${n}.${t} must be a canonical project-relative path.`);s.pop()}else s.push(c);let o=s.join("/");if(!o||o!==r)throw new Error(`${n}.${t} must be a canonical project-relative path.`);return o}_chunkA5EIY3HIcjs.a.call(void 0, F,"requiredProjectPath");function j(e,t,n){if(typeof e[t]!="boolean")throw new Error(`${n}.${t} must be a boolean.`);return e[t]}_chunkA5EIY3HIcjs.a.call(void 0, j,"requiredBoolean");function an(e,t,n){let r=e[t];if(!Number.isInteger(r)||Number(r)<0)throw new Error(`${n}.${t} must be a non-negative integer.`);return Number(r)}_chunkA5EIY3HIcjs.a.call(void 0, an,"requiredInteger");function q(e,t,n){let r=an(e,t,n);if(r===0)throw new Error(`${n}.${t} must be a positive integer.`);return r}_chunkA5EIY3HIcjs.a.call(void 0, q,"requiredPositiveInteger");function $(e,t,n){let r=e[t];if(!Array.isArray(r))throw new Error(`${n}.${t} must be an array.`);return r}_chunkA5EIY3HIcjs.a.call(void 0, $,"requiredArray");function fe(e,t,n,r){let a=e[t];if(typeof a!="string"||!n.includes(a))throw new Error(`${r}.${t} must be one of ${n.join(", ")}.`);return a}_chunkA5EIY3HIcjs.a.call(void 0, fe,"enumValue");function Me(e,t){if(!Array.isArray(e)||e.some(n=>typeof n!="string"||!n))throw new Error(`${t} must be an array of non-empty strings.`);return[...e]}_chunkA5EIY3HIcjs.a.call(void 0, Me,"parseStringArray");function Oi(e,t,n){let r=new Set;for(let a of e){let s=t(a);if(r.has(s))throw new Error(`${n} must not contain duplicate facts (${s}).`);r.add(s)}}_chunkA5EIY3HIcjs.a.call(void 0, Oi,"assertUnique");function cs(e,t){L(e,["schemaVersion","completeness","completenessReasons","resolverIdentity","compilerIdentity","compilerOptionsHash","tsconfigHash","evidenceRequirementsHash","projectPackageName","files","dependencies","capabilityUses","ambientUses","publishCalls","intentReferences","safetyUses","classShapes","arkRunKernelCalls","arkRunManagedNews","arkRunCompositionRootHits","arkRunDeclarations","arkOrderPlaneCalls","arkOrderGenericUpdates","arkOrderRootHits","arkOrderXiFieldWrites","arkOrderIngestWritesXi","arkOrderReleaseKeyCounts","arkOrderXiTtlKeys","arkOrderBudgetLeaks",...t?["candidateTreeHash","factsHash"]:[]],"$");let n=fe(e,"schemaVersion",["1.0","1.1","1.2"],"$"),r=fe(e,"completeness",["complete","partial","unavailable"],"$"),a=$(e,"completenessReasons","$").map((S,R)=>{let m=`$.completenessReasons[${R}]`,y=P(S,m);L(y,["code","message","file"],m);let T=y.file===void 0?void 0:F(y,"file",m);return{code:N(y,"code",m),message:N(y,"message",m),...T?{file:T}:{}}});if(r==="complete"&&a.length>0)throw new Error("$.completenessReasons must be empty when completeness is complete.");if(r!=="complete"&&a.length===0)throw new Error("$.completenessReasons must explain partial or unavailable facts.");let s=$(e,"files","$").map((S,R)=>{let m=`$.files[${R}]`,y=P(S,m);return L(y,["path","contentHash","parseStatus","parseDiagnosticCount","exportsOnlyTypes","typeOnlyExportNames","hasTopLevelSideEffects"],m),{path:F(y,"path",m),contentHash:N(y,"contentHash",m),parseStatus:fe(y,"parseStatus",["parsed","invalid"],m),parseDiagnosticCount:an(y,"parseDiagnosticCount",m),exportsOnlyTypes:j(y,"exportsOnlyTypes",m),typeOnlyExportNames:Me(y.typeOnlyExportNames,`${m}.typeOnlyExportNames`),hasTopLevelSideEffects:j(y,"hasTopLevelSideEffects",m)}}),o=$(e,"dependencies","$").map((S,R)=>{let m=`$.dependencies[${R}]`,y=P(S,m);L(y,["from","specifier","kind","typeOnly","line","resolution","target","namedBindings","targetTypeOnlyExports","sourcePureTypeModule","namedBindingsTypeOnly","portProofEligible"],m);let T=pe(y,"specifier",m),Q=pe(y,"target",m),we=fe(y,"resolution",["resolved-project","resolved-external","unresolved","dynamic"],m);if(we==="resolved-project"&&!Q)throw new Error(`${m}.target is required for resolved-project dependencies.`);if(we!=="resolved-project"&&Q)throw new Error(`${m}.target is only allowed for resolved-project dependencies.`);if(we!=="dynamic"&&!T)throw new Error(`${m}.specifier is required unless resolution is dynamic.`);return{from:F(y,"from",m),...T?{specifier:T}:{},kind:fe(y,"kind",["import","export","dynamic-import","require"],m),typeOnly:j(y,"typeOnly",m),line:q(y,"line",m),resolution:we,...Q?{target:F(y,"target",m)}:{},...y.namedBindings!==void 0?{namedBindings:Me(y.namedBindings,`${m}.namedBindings`)}:{},...y.targetTypeOnlyExports!==void 0?{targetTypeOnlyExports:j(y,"targetTypeOnlyExports",m)}:{},...y.sourcePureTypeModule!==void 0?{sourcePureTypeModule:j(y,"sourcePureTypeModule",m)}:{},...y.namedBindingsTypeOnly!==void 0?{namedBindingsTypeOnly:j(y,"namedBindingsTypeOnly",m)}:{},...y.portProofEligible!==void 0?{portProofEligible:j(y,"portProofEligible",m)}:{}}}),c=$(e,"capabilityUses","$").map((S,R)=>{let m=`$.capabilityUses[${R}]`,y=P(S,m);return L(y,["file","line","symbol","capability","source"],m),{file:F(y,"file",m),line:q(y,"line",m),symbol:N(y,"symbol",m),capability:fe(y,"capability",is,m),source:fe(y,"source",["ambient-global","import-based"],m)}}),l=$(e,"ambientUses","$").map((S,R)=>{let m=`$.ambientUses[${R}]`,y=P(S,m);return L(y,["file","line","symbol"],m),{file:F(y,"file",m),line:q(y,"line",m),symbol:N(y,"symbol",m)}}),p=$(e,"publishCalls","$").map((S,R)=>{let m=`$.publishCalls[${R}]`,y=P(S,m);L(y,["file","line","rawIntentName","objectHasIntent","arkPublishCandidate","hasSource","sourceIntent"],m);let T=pe(y,"rawIntentName",m),Q=pe(y,"sourceIntent",m);return{file:F(y,"file",m),line:q(y,"line",m),...T?{rawIntentName:T}:{},objectHasIntent:j(y,"objectHasIntent",m),arkPublishCandidate:j(y,"arkPublishCandidate",m),hasSource:j(y,"hasSource",m),...Q?{sourceIntent:Q}:{}}}),f=$(e,"intentReferences","$").map((S,R)=>{let m=`$.intentReferences[${R}]`,y=P(S,m);return L(y,["file","line","intent"],m),{file:F(y,"file",m),line:q(y,"line",m),intent:N(y,"intent",m)}}),h=$(e,"safetyUses","$").map((S,R)=>{let m=`$.safetyUses[${R}]`,y=P(S,m);L(y,["file","line","kind","symbol"],m);let T=pe(y,"symbol",m),Q=fe(y,"kind",["ts-suppression","any-cast","dynamic-import","dynamic-require","in-memory-store"],m);if(Q==="in-memory-store"&&!T)throw new Error(`${m}.symbol is required for in-memory-store facts.`);if(Q!=="in-memory-store"&&T)throw new Error(`${m}.symbol is only allowed for in-memory-store facts.`);return{file:F(y,"file",m),line:q(y,"line",m),kind:Q,...T?{symbol:T}:{}}});Oi(s,S=>S.path,"$.files");let u=new Set(s.map(S=>S.path));for(let S of s){if(S.parseStatus==="parsed"&&S.parseDiagnosticCount!==0)throw new Error(`$.files[${S.path}].parseDiagnosticCount must be 0 when parseStatus is parsed.`);if(S.parseStatus==="invalid"&&S.parseDiagnosticCount===0)throw new Error(`$.files[${S.path}].parseDiagnosticCount must be positive when parseStatus is invalid.`)}if(r==="complete"&&s.some(S=>S.parseStatus==="invalid"))throw new Error("$.completeness cannot be complete when a candidate file failed to parse.");for(let S of o)if(!u.has(S.from))throw new Error(`$.dependencies references missing source file ${S.from}.`);let d=(e.arkRunKernelCalls===void 0?[]:$(e,"arkRunKernelCalls","$")).map((S,R)=>{let m=`$.arkRunKernelCalls[${R}]`,y=P(S,m);L(y,["file","line","kind","callee","viaImport","receiver","nameLiteral"],m);let T=pe(y,"receiver",m),Q=pe(y,"nameLiteral",m);return{file:F(y,"file",m),line:q(y,"line",m),kind:fe(y,"kind",["factory","publisher","publish","raise","send","subscribe","register-handler","resolve","resolve-singleton"],m),callee:N(y,"callee",m),viaImport:j(y,"viaImport",m),...T?{receiver:T}:{},...Q?{nameLiteral:Q}:{}}}),b=(e.arkRunManagedNews===void 0?[]:$(e,"arkRunManagedNews","$")).map((S,R)=>{let m=`$.arkRunManagedNews[${R}]`,y=P(S,m);L(y,["file","line","typeName","importedFrom"],m);let T=pe(y,"importedFrom",m);return{file:F(y,"file",m),line:q(y,"line",m),typeName:N(y,"typeName",m),...T?{importedFrom:T}:{}}}),k=(e.arkRunCompositionRootHits===void 0?[]:$(e,"arkRunCompositionRootHits","$")).map((S,R)=>{let m=`$.arkRunCompositionRootHits[${R}]`,y=P(S,m);return L(y,["file","matchedRoot","hasKernelFactory"],m),{file:F(y,"file",m),matchedRoot:N(y,"matchedRoot",m),hasKernelFactory:j(y,"hasKernelFactory",m)}}),E=e.arkRunDeclarations===void 0?[]:$(e,"arkRunDeclarations","$"),U=(e.arkOrderPlaneCalls===void 0?[]:$(e,"arkOrderPlaneCalls","$")).map((S,R)=>{let m=`$.arkOrderPlaneCalls[${R}]`,y=P(S,m);return L(y,["file","line","callee"],m),{file:F(y,"file",m),line:q(y,"line",m),callee:N(y,"callee",m)}}),G=(e.arkOrderGenericUpdates===void 0?[]:$(e,"arkOrderGenericUpdates","$")).map((S,R)=>{let m=`$.arkOrderGenericUpdates[${R}]`,y=P(S,m);return L(y,["file","line","method"],m),{file:F(y,"file",m),line:q(y,"line",m),method:N(y,"method",m)}}),D=(e.arkOrderRootHits===void 0?[]:$(e,"arkOrderRootHits","$")).map((S,R)=>{let m=`$.arkOrderRootHits[${R}]`,y=P(S,m);return L(y,["file","matchedRoot","hasPlaneFactory"],m),{file:F(y,"file",m),matchedRoot:N(y,"matchedRoot",m),hasPlaneFactory:j(y,"hasPlaneFactory",m)}}),re=(e.arkOrderXiFieldWrites===void 0?[]:$(e,"arkOrderXiFieldWrites","$")).map((S,R)=>{let m=`$.arkOrderXiFieldWrites[${R}]`,y=P(S,m);return L(y,["file","line","key"],m),{file:F(y,"file",m),line:q(y,"line",m),key:N(y,"key",m)}}),se=(e.arkOrderIngestWritesXi===void 0?[]:$(e,"arkOrderIngestWritesXi","$")).map((S,R)=>{let m=`$.arkOrderIngestWritesXi[${R}]`,y=P(S,m);return L(y,["file","line"],m),{file:F(y,"file",m),line:q(y,"line",m)}}),ke=(e.arkOrderReleaseKeyCounts===void 0?[]:$(e,"arkOrderReleaseKeyCounts","$")).map((S,R)=>{let m=`$.arkOrderReleaseKeyCounts[${R}]`,y=P(S,m);return L(y,["file","line","keyCount"],m),{file:F(y,"file",m),line:q(y,"line",m),keyCount:q(y,"keyCount",m)}}),Lt=(e.arkOrderXiTtlKeys===void 0?[]:$(e,"arkOrderXiTtlKeys","$")).map((S,R)=>{let m=`$.arkOrderXiTtlKeys[${R}]`,y=P(S,m);return L(y,["file","line","key"],m),{file:F(y,"file",m),line:q(y,"line",m),key:N(y,"key",m)}}),ve=(e.arkOrderBudgetLeaks===void 0?[]:$(e,"arkOrderBudgetLeaks","$")).map((S,R)=>{let m=`$.arkOrderBudgetLeaks[${R}]`,y=P(S,m);return L(y,["file","line","kind"],m),{file:F(y,"file",m),line:q(y,"line",m),kind:N(y,"kind",m)}}),xe=E.map((S,R)=>{let m=`$.arkRunDeclarations[${R}]`,y=P(S,m);return L(y,["file","line","uses","reactsTo","raises","sends"],m),{file:F(y,"file",m),line:q(y,"line",m),uses:Me(y.uses,`${m}.uses`),reactsTo:Me(y.reactsTo,`${m}.reactsTo`),raises:Me(y.raises,`${m}.raises`),sends:Me(y.sends,`${m}.sends`)}});for(let[S,R]of[["$.capabilityUses",c],["$.ambientUses",l],["$.publishCalls",p],["$.intentReferences",f],["$.safetyUses",h],["$.arkRunKernelCalls",d],["$.arkRunManagedNews",b],["$.arkRunCompositionRootHits",k],["$.arkRunDeclarations",xe],["$.arkOrderPlaneCalls",U],["$.arkOrderGenericUpdates",G],["$.arkOrderRootHits",D],["$.arkOrderXiFieldWrites",re],["$.arkOrderIngestWritesXi",se],["$.arkOrderReleaseKeyCounts",ke],["$.arkOrderXiTtlKeys",Lt],["$.arkOrderBudgetLeaks",ve]])for(let m of R)if(!u.has(m.file))throw new Error(`${S} references missing file ${m.file}.`);let it=pe(e,"projectPackageName","$"),lt=(e.classShapes===void 0?[]:$(e,"classShapes","$")).map((S,R)=>{let m=`$.classShapes[${R}]`,y=P(S,m);L(y,["file","className","exported","hasPublicMutableFields","hasPublicSetters","hasPublicConstructor","hasStaticFactory","mutatingMethods","dataOnly","truncatedUntil"],m);let T=$(y,"mutatingMethods",m).map((Q,we)=>{let ct=`${m}.mutatingMethods[${we}]`,Ft=P(Q,ct);return L(Ft,["name","referencesGuardOrPublish"],ct),{name:N(Ft,"name",ct),referencesGuardOrPublish:j(Ft,"referencesGuardOrPublish",ct)}});return{file:F(y,"file",m),className:N(y,"className",m),exported:j(y,"exported",m),hasPublicMutableFields:j(y,"hasPublicMutableFields",m),hasPublicSetters:j(y,"hasPublicSetters",m),hasPublicConstructor:j(y,"hasPublicConstructor",m),hasStaticFactory:j(y,"hasStaticFactory",m),mutatingMethods:T,...y.dataOnly===void 0?{}:{dataOnly:j(y,"dataOnly",m)},...y.truncatedUntil===void 0?{}:{truncatedUntil:an(y,"truncatedUntil",m)}}});return{schemaVersion:n,completeness:r,completenessReasons:a,resolverIdentity:N(e,"resolverIdentity","$"),compilerIdentity:N(e,"compilerIdentity","$"),compilerOptionsHash:N(e,"compilerOptionsHash","$"),tsconfigHash:N(e,"tsconfigHash","$"),evidenceRequirementsHash:N(e,"evidenceRequirementsHash","$"),...it?{projectPackageName:it}:{},files:s,dependencies:o,capabilityUses:c,ambientUses:l,publishCalls:p,intentReferences:f,safetyUses:h,classShapes:lt,arkRunKernelCalls:d,arkRunManagedNews:b,arkRunCompositionRootHits:k,arkRunDeclarations:xe,arkOrderPlaneCalls:U,arkOrderGenericUpdates:G,arkOrderRootHits:D,arkOrderXiFieldWrites:re,arkOrderIngestWritesXi:se,arkOrderReleaseKeyCounts:ke,arkOrderXiTtlKeys:Lt,arkOrderBudgetLeaks:ve}}_chunkA5EIY3HIcjs.a.call(void 0, cs,"parseResolvedFactsInput");function ye(e){let t=P(e,"$"),n=N(t,"factsHash","$"),r=N(t,"candidateTreeHash","$"),a=ls(cs(t,!0));if(a.factsHash!==n)throw new Error(`$.factsHash does not match the canonical payload (${a.factsHash}).`);if(r!==a.candidateTreeHash)throw new Error(`$.candidateTreeHash does not match the canonical file tree (${a.candidateTreeHash}).`);return a}_chunkA5EIY3HIcjs.a.call(void 0, ye,"loadResolvedCandidateFacts");var xi=["network","filesystem","clock","randomness","environment","process","persistence"],w={type:"string",minLength:1},J={type:"integer",minimum:1},M={type:"string",minLength:1,pattern:"^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$"},ln= exports.RESOLVED_CANDIDATE_FACTS_SCHEMA ={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://unpkg.com/arkgate@3/schemas/ark.resolved-candidate-facts.schema.json",title:"ArkGate resolved candidate facts",type:"object",additionalProperties:!1,required:["schemaVersion","completeness","completenessReasons","resolverIdentity","compilerIdentity","compilerOptionsHash","tsconfigHash","candidateTreeHash","evidenceRequirementsHash","files","dependencies","capabilityUses","ambientUses","publishCalls","intentReferences","safetyUses","factsHash"],properties:{schemaVersion:{enum:["1.0","1.1","1.2"]},completeness:{enum:["complete","partial","unavailable"]},completenessReasons:{type:"array",items:{type:"object",additionalProperties:!1,required:["code","message"],properties:{code:w,message:w,file:M}}},resolverIdentity:w,compilerIdentity:w,compilerOptionsHash:w,tsconfigHash:w,candidateTreeHash:w,evidenceRequirementsHash:w,projectPackageName:w,files:{type:"array",uniqueItems:!0,items:{type:"object",additionalProperties:!1,required:["path","contentHash","parseStatus","parseDiagnosticCount","exportsOnlyTypes","typeOnlyExportNames","hasTopLevelSideEffects"],properties:{path:M,contentHash:w,parseStatus:{enum:["parsed","invalid"]},parseDiagnosticCount:{type:"integer",minimum:0},exportsOnlyTypes:{type:"boolean"},typeOnlyExportNames:{type:"array",items:w},hasTopLevelSideEffects:{type:"boolean"}},allOf:[{if:{properties:{parseStatus:{const:"parsed"}}},then:{properties:{parseDiagnosticCount:{const:0}}}},{if:{properties:{parseStatus:{const:"invalid"}}},then:{properties:{parseDiagnosticCount:{minimum:1}}}}]}},dependencies:{type:"array",items:{type:"object",additionalProperties:!1,required:["from","kind","typeOnly","line","resolution"],properties:{from:M,specifier:w,kind:{enum:["import","export","dynamic-import","require"]},typeOnly:{type:"boolean"},line:J,resolution:{enum:["resolved-project","resolved-external","unresolved","dynamic"]},target:M,namedBindings:{type:"array",items:w},targetTypeOnlyExports:{type:"boolean"},sourcePureTypeModule:{type:"boolean"},namedBindingsTypeOnly:{type:"boolean"},portProofEligible:{type:"boolean"}},allOf:[{if:{properties:{resolution:{const:"resolved-project"}}},then:{required:["target"]},else:{not:{required:["target"]}}},{if:{properties:{resolution:{const:"dynamic"}}},else:{required:["specifier"]}}]}},capabilityUses:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","symbol","capability","source"],properties:{file:M,line:J,symbol:w,capability:{enum:xi},source:{enum:["ambient-global","import-based"]}}}},ambientUses:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","symbol"],properties:{file:M,line:J,symbol:w}}},publishCalls:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","objectHasIntent","arkPublishCandidate","hasSource"],properties:{file:M,line:J,rawIntentName:w,objectHasIntent:{type:"boolean"},arkPublishCandidate:{type:"boolean"},hasSource:{type:"boolean"},sourceIntent:w}}},intentReferences:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","intent"],properties:{file:M,line:J,intent:w}}},safetyUses:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","kind"],properties:{file:M,line:J,kind:{enum:["ts-suppression","any-cast","dynamic-import","dynamic-require","in-memory-store"]},symbol:w},allOf:[{if:{properties:{kind:{const:"in-memory-store"}}},then:{required:["symbol"]},else:{not:{required:["symbol"]}}}]}},classShapes:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","className","exported","hasPublicMutableFields","hasPublicSetters","hasPublicConstructor","hasStaticFactory","mutatingMethods"],properties:{file:M,className:w,exported:{type:"boolean"},hasPublicMutableFields:{type:"boolean"},hasPublicSetters:{type:"boolean"},hasPublicConstructor:{type:"boolean"},hasStaticFactory:{type:"boolean"},dataOnly:{type:"boolean"},truncatedUntil:{type:"integer",minimum:0},mutatingMethods:{type:"array",items:{type:"object",additionalProperties:!1,required:["name","referencesGuardOrPublish"],properties:{name:w,referencesGuardOrPublish:{type:"boolean"}}}}}}},arkRunKernelCalls:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","kind","callee","viaImport"],properties:{file:M,line:J,kind:{enum:["factory","publisher","publish","raise","send","subscribe","register-handler","resolve","resolve-singleton"]},callee:w,viaImport:{type:"boolean"},receiver:w,nameLiteral:w}}},arkRunManagedNews:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","typeName"],properties:{file:M,line:J,typeName:w,importedFrom:w}}},arkRunCompositionRootHits:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","matchedRoot","hasKernelFactory"],properties:{file:M,matchedRoot:w,hasKernelFactory:{type:"boolean"}}}},arkRunDeclarations:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","uses","reactsTo","raises","sends"],properties:{file:M,line:J,uses:{type:"array",items:w},reactsTo:{type:"array",items:w},raises:{type:"array",items:w},sends:{type:"array",items:w}}}},arkOrderPlaneCalls:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","callee"],properties:{file:M,line:J,callee:w}}},arkOrderGenericUpdates:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","method"],properties:{file:M,line:J,method:w}}},arkOrderRootHits:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","matchedRoot","hasPlaneFactory"],properties:{file:M,matchedRoot:w,hasPlaneFactory:{type:"boolean"}}}},arkOrderXiFieldWrites:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","key"],properties:{file:M,line:J,key:w}}},arkOrderIngestWritesXi:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line"],properties:{file:M,line:J}}},arkOrderReleaseKeyCounts:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","keyCount"],properties:{file:M,line:J,keyCount:{type:"integer",minimum:1}}}},arkOrderXiTtlKeys:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","key"],properties:{file:M,line:J,key:w}}},arkOrderBudgetLeaks:{type:"array",items:{type:"object",additionalProperties:!1,required:["file","line","kind"],properties:{file:M,line:J,kind:w}}},factsHash:w},allOf:[{if:{properties:{completeness:{const:"complete"}}},then:{properties:{completenessReasons:{maxItems:0},files:{items:{properties:{parseStatus:{const:"parsed"}}}}}}},{if:{properties:{completeness:{enum:["partial","unavailable"]}}},then:{properties:{completenessReasons:{minItems:1}}}}]};var cn="1.0";function ds(e){let t=e.replace(/\\/g,"/");if(!t||t.startsWith("/")||/^[A-Za-z]:\//.test(t)||t.includes("\0"))return;let n=[];for(let a of t.split("/"))if(!(!a||a==="."))if(a===".."){if(n.length===0)return;n.pop()}else n.push(a);let r=n.join("/");return r&&r===t?r:void 0}_chunkA5EIY3HIcjs.a.call(void 0, ds,"canonicalProjectPath");function He(e){return e.flatMap(t=>t.to?[{from:t.from,to:t.to}]:[])}_chunkA5EIY3HIcjs.a.call(void 0, He,"resolvedEdgeDependencies");function ee(e){return`${e.from}->${e.to}`}_chunkA5EIY3HIcjs.a.call(void 0, ee,"dependencyKey");function Je(e,t,n,r="dependency"){return{id:`${e}:${r}:${ee(t)}`,classification:e,subject:"dependency",from:t.from,to:t.to,message:n,...e==="missing"?{nextAction:`Add the planned dependency ${ee(t)} to the candidate, then preflight again.`}:e==="contradictory"?{nextAction:`Replace the reverse dependency with ${ee(t)}, then preflight again.`}:e==="unplanned"?{nextAction:r==="dependency-removed"?`Restore the removed dependency ${ee(t)} in the candidate, then preflight again.`:`Remove the unplanned dependency ${ee(t)} from the candidate, then preflight again.`}:{}}}_chunkA5EIY3HIcjs.a.call(void 0, Je,"dependencyFinding");function Ke(e){let t=[],n=new Map(e.changeMap.map.files.map(u=>[u.path,u])),r=new Map(e.changes.map(u=>[u.path,u])),a=new Map(e.changeMap.map.dependencies.map(u=>[ee(u),u])),s=new Map(e.baseDependencies.map(u=>[ee(u),u])),o=new Map(e.candidateDependencies.map(u=>[ee(u),u]));for(let u of[...n.values()].sort((A,d)=>A.path.localeCompare(d.path))){let A=r.get(u.path);A?A.operation!==u.operation?t.push({id:`contradictory:file:${u.path}`,classification:"contradictory",subject:"file",path:u.path,expectedOperation:u.operation,actualOperation:A.operation,message:`${u.path} was planned as ${u.operation} but the actual operation is ${A.operation}.`,nextAction:`Change ${u.path} to the planned ${u.operation} operation, then preflight again.`}):t.push({id:`satisfied:file:${u.path}`,classification:"satisfied",subject:"file",path:u.path,expectedOperation:u.operation,actualOperation:A.operation,message:`${u.path} matches the planned ${u.operation} operation.`}):t.push({id:`missing:file:${u.path}`,classification:"missing",subject:"file",path:u.path,expectedOperation:u.operation,message:`${u.path} was planned as ${u.operation} but is absent from the actual change.`,nextAction:`${u.operation[0].toUpperCase()}${u.operation.slice(1)} ${u.path} in the complete change set, then preflight again.`})}for(let u of[...r.values()].sort((A,d)=>A.path.localeCompare(d.path)))n.has(u.path)||t.push({id:`unplanned:file:${u.path}`,classification:"unplanned",subject:"file",path:u.path,actualOperation:u.operation,message:`${u.path} has an unplanned ${u.operation} operation.`,nextAction:`Remove ${u.path} from the change set, then preflight again.`});let c=new Set;for(let u of[...a.values()].sort((A,d)=>ee(A).localeCompare(ee(d)))){if(o.has(ee(u))){t.push(Je("satisfied",u,`${u.from} -> ${u.to} exists in the candidate architecture.`));continue}let A={from:u.to,to:u.from};o.has(ee(A))?(c.add(ee(A)),t.push(Je("contradictory",u,`${u.from} -> ${u.to} was planned, but the candidate contains the reverse edge.`))):t.push(Je("missing",u,`${u.from} -> ${u.to} is absent from the candidate architecture.`))}let l=new Set([...n.keys(),...r.keys()]);for(let[u,A]of[...o].sort(([d],[g])=>d.localeCompare(g)))s.has(u)||a.has(u)||c.has(u)||!l.has(A.from)&&!l.has(A.to)||t.push({...Je("unplanned",A,`${A.from} -> ${A.to} was added without a matching planned dependency.`,"dependency-added"),actualOperation:"added"});let p=new Set(e.changeMap.map.files.filter(u=>u.operation==="delete").map(u=>u.path));for(let[u,A]of[...s].sort(([d],[g])=>d.localeCompare(g)))o.has(u)||p.has(A.from)||p.has(A.to)||!l.has(A.from)&&!l.has(A.to)||t.push({...Je("unplanned",A,`${A.from} -> ${A.to} was removed without a planned file deletion.`,"dependency-removed"),actualOperation:"removed"});let f={satisfied:0,missing:1,contradictory:2,unplanned:3};t.sort((u,A)=>f[u.classification]-f[A.classification]||(u.subject===A.subject?0:u.subject==="file"?-1:1)||u.id.localeCompare(A.id));let h={satisfied:t.filter(u=>u.classification==="satisfied").length,missing:t.filter(u=>u.classification==="missing").length,contradictory:t.filter(u=>u.classification==="contradictory").length,unplanned:t.filter(u=>u.classification==="unplanned").length};return{schemaVersion:"1.0",readOnly:!0,changeMapHash:e.changeMap.hash,structurallyConverged:h.missing===0&&h.contradictory===0&&h.unplanned===0,behavioralCompletion:"not-evaluated",summary:h,findings:t}}_chunkA5EIY3HIcjs.a.call(void 0, Ke,"analyzeArchitectureConvergence");var dn="1.0",us="https://unpkg.com/arkgate/schemas/ark.arkrules.schema.json",wi=["aggregate-private-state","always-valid-factory","domain-event-on-mutation","orchestration-only","thin-adapter","writes-via-aggregate","no-anemic-model","invariant-coverage"];var ps={type:"array",items:{type:"string",minLength:1},uniqueItems:!0},Bd={$schema:"https://json-schema.org/draft/2020-12/schema",$id:us,title:"ArkGate ArkRules (intra-layer contract)",description:"Per-layer structure sensors and invariant catalog consumed by the ArkGate Effective Contract.",type:"object",additionalProperties:!1,required:["schemaVersion","layer"],properties:{$schema:{type:"string",minLength:1,default:us},schemaVersion:{type:"string",const:dn,default:dn},layer:{type:"string",minLength:1},structure:{type:"array",default:[],items:{$ref:"#/$defs/structureEntry"}},invariants:{type:"array",default:[],items:{$ref:"#/$defs/invariantEntry"}}},$defs:{structureEntry:{type:"object",additionalProperties:!1,required:["id","sensor"],properties:{id:{type:"string",minLength:1},sensor:{type:"string",enum:[...wi]},mode:{type:"string",enum:["advisory","enforced"],default:"advisory"},appliesTo:ps,description:{type:"string",minLength:1}}},invariantEntry:{type:"object",additionalProperties:!1,required:["id","description"],properties:{id:{type:"string",minLength:1},description:{type:"string",minLength:1},aggregate:{type:"string",minLength:1},coverage:{type:"object",additionalProperties:!1,properties:{test:{type:"boolean"},symbol:{type:"string",minLength:1}}},mode:{type:"string",enum:["advisory","enforced"],default:"advisory"},appliesTo:ps}}}};function Qe(){return{schemaVersion:dn,byLayer:{},structure:[],invariants:[]}}_chunkA5EIY3HIcjs.a.call(void 0, Qe,"emptyEffectiveArkRules");function un(e){return{...e,layers:e.layers.map(t=>{let{description:n,trustBoundary:r,owners:a,...s}=t;return s})}}_chunkA5EIY3HIcjs.a.call(void 0, un,"omitLayerDescriptions");function fs(e){let{stewards:t,...n}=un(e.config);return{config:n,arkRules:{schemaVersion:e.arkRules.schemaVersion,structure:e.arkRules.structure.map(r=>({id:r.id,sensor:r.sensor,mode:r.mode,appliesTo:_nullishCoalesce(r.appliesTo, () => (null)),description:_nullishCoalesce(r.description, () => (null)),provenance:r.provenance})),invariants:e.arkRules.invariants.map(r=>({id:r.id,description:r.description,aggregate:_nullishCoalesce(r.aggregate, () => (null)),coverage:_nullishCoalesce(r.coverage, () => (null)),mode:r.mode,appliesTo:_nullishCoalesce(r.appliesTo, () => (null)),provenance:r.provenance}))}}}_chunkA5EIY3HIcjs.a.call(void 0, fs,"effectiveContractPolicyPayload");var Ti=new Set(["public","private","protected","static","async","readonly","abstract","override","declare","get","set"]),Ni=new Set(["(",",","=",":","[","!","&","|","?","{","}",";","+","-","*","%","<",">","~","^"]),Pi=new Set(["return","typeof","case","do","else","in","of","new","delete","void","throw","instanceof","yield","await"]);function Li(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n-=1;if(n<0)return!0;let r=e[n];if(/[A-Za-z0-9_$]/.test(r)){let a=n;for(;a>=0&&/[A-Za-z0-9_$]/.test(e[a]);)a-=1;return Pi.has(e.slice(a+1,n+1))}return r==="/"&&e[n-1]==="*"?!1:Ni.has(r)}_chunkA5EIY3HIcjs.a.call(void 0, Li,"slashStartsRegex");function Di(e,t){if(!Li(e,t))return t;let n=t+1,r=!1;for(;n<e.length;){let a=e[n];if(a===`
|
|
3
|
+
`||a==="\r")return t;if(a==="\\"){n+=2;continue}if(r)a==="]"&&(r=!1);else if(a==="[")r=!0;else if(a==="/"){for(n+=1;n<e.length&&/[A-Za-z]/.test(e[n]);)n+=1;return n}n+=1}return t}_chunkA5EIY3HIcjs.a.call(void 0, Di,"skipRegexLiteral");function Ce(e,t){let n=e[t];if(n==="/"&&e[t+1]==="/"){let r=e.indexOf(`
|
|
4
|
+
`,t);return r===-1?e.length:r}if(n==="/"&&e[t+1]==="*"){let r=e.indexOf("*/",t+2);return r===-1?e.length:r+2}if(n==="/")return Di(e,t);if(n==="'"||n==='"'||n==="`"){let r=t+1;for(;r<e.length;){if(e[r]==="\\"){r+=2;continue}if(e[r]===n)return r+1;r+=1}return e.length}return t}_chunkA5EIY3HIcjs.a.call(void 0, Ce,"skipStringOrComment");function le(e,t){let n=t;for(;n<e.length;){if(/\s/.test(e[n])){n+=1;continue}if(e[n]==="/"&&(e[n+1]==="/"||e[n+1]==="*")){n=Ce(e,n);continue}break}return n}_chunkA5EIY3HIcjs.a.call(void 0, le,"skipWsAndComments");function kt(e,t){let n=e[t];if(!n||!/[A-Za-z_$]/.test(n))return null;let r=t+1;for(;r<e.length&&/[A-Za-z0-9_$]/.test(e[r]);)r+=1;return{ident:e.slice(t,r),end:r}}_chunkA5EIY3HIcjs.a.call(void 0, kt,"readIdent");function Re(e,t,n,r){if(e[t]!==n)return null;let a=1,s=t+1;for(;s<e.length&&a>0;){let o=Ce(e,s);if(o!==s){s=o;continue}let c=e[s];c===n?a+=1:c===r&&!(r===">"&&e[s-1]==="=")&&(a-=1),s+=1}return a===0?s:null}_chunkA5EIY3HIcjs.a.call(void 0, Re,"skipBalanced");function pn(e){let t=[],n=0,r;for(;n<e.length&&(n=le(e,n),!(n>=e.length));){if(e[n]===";"){n+=1;continue}let a=[],s=n;for(;;){let f=kt(e,s);if(!f||!Ti.has(f.ident))break;a.push(f.ident),s=le(e,f.end)}if(a.length===1&&a[0]==="static"&&e[s]==="{"){let f=Re(e,s,"{","}");if(f==null){r=e.length;break}n=f;continue}let o=kt(e,s);if(!o){n+=1;continue}if(s=le(e,o.end),e[s]==="<"){let f=Re(e,s,"<",">");if(f==null){r=e.length;break}s=le(e,f)}if(e[s]==="("){let f=Re(e,s,"(",")");if(f==null){r=e.length;break}if(s=le(e,f),e[s]===":")for(s+=1;s<e.length&&e[s]!=="{"&&e[s]!==";";){let h=Ce(e,s);if(h!==s){s=h;continue}s+=1}if(e[s]==="{"){let h=Re(e,s,"{","}");if(h==null){r=e.length;break}t.push({name:o.ident,modifiers:a,kind:"method",body:e.slice(s+1,h-1)}),n=h;continue}if(e[s]===";"){n=s+1;continue}n=s+1;continue}let c=0,l=0,p=0;for(;s<e.length;){let f=Ce(e,s);if(f!==s){s=f;continue}let h=e[s];if(h==="{")c+=1;else if(h==="}"){if(c===0)break;c-=1}else if(h==="(")l+=1;else if(h===")")l-=1;else if(h==="[")p+=1;else if(h==="]")p-=1;else if(h===";"&&c===0&&l===0&&p===0){s+=1;break}s+=1}s>=e.length&&(c>0||l>0||p>0)&&(r=e.length),t.push({name:o.ident,modifiers:a,kind:"field",body:""}),n=s}return{members:t,truncatedAt:r}}_chunkA5EIY3HIcjs.a.call(void 0, pn,"scanClassMembers");function gs(e,t){let n=t;for(;n<e.length;){let r=le(e,n);if(r!==n){n=r;continue}let a=e[n];if(a==="{")return n;if(a===";")return null;if(a==="<"||a==="("||a==="["){let o=Re(e,n,a,a==="<"?">":a==="("?")":"]");if(o==null)return null;n=o;continue}if(a==='"'||a==="'"||a==="`"){n=Ce(e,n);continue}n+=1}return null}_chunkA5EIY3HIcjs.a.call(void 0, gs,"findClassBodyBrace");function fn(e,t={}){let n=[],r=t.exportedOnly?/\bexport\s+(?:abstract\s+)?class\s+([A-Za-z_$][A-Za-z0-9_$]*)/g:/(?:\b(export)\s+(?:default\s+)?)?(?:\babstract\s+)?\bclass\s+([A-Za-z_$][A-Za-z0-9_$]*)/g,a=ms(e),s;for(;(s=r.exec(a))!==null;){let o=t.exportedOnly?s[1]:s[2],c=t.exportedOnly===!0||s[1]==="export",l=gs(e,s.index+s[0].length);if(l==null){n.push({name:o,start:s.index,exported:c,bodyStart:null,bodyEnd:null});continue}let p=Re(e,l,"{","}");n.push({name:o,start:s.index,exported:c,bodyStart:l+1,bodyEnd:p==null?null:p-1})}return n}_chunkA5EIY3HIcjs.a.call(void 0, fn,"findClassDeclarations");function ms(e){let t="",n=0;for(;n<e.length;){let r=Ce(e,n);if(r!==n){t+=e.slice(n,r).replace(/[^\n]/g," "),n=r;continue}t+=e[n],n+=1}return t}_chunkA5EIY3HIcjs.a.call(void 0, ms,"maskStringsAndComments");function hs(e,t){let n=[];if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return n;let r=ms(e),a=t.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),s=new RegExp(`\\b(?:(namespace|module)\\s+${a}\\s*\\{|(?:const|let|var)\\s+${a}\\s*(?::[^=;]+?)?=(?!=|>)\\s*(class\\b)?)`,"g"),o;for(;(o=s.exec(r))!==null;){let c,l;if(o[1])l="namespace",c=o.index+o[0].length-1;else if(o[2])l="class-expression",c=gs(e,o.index+o[0].length);else{l="object";let f=le(e,o.index+o[0].length);c=e[f]==="{"?f:null}if(c==null)continue;let p=Re(e,c,"{","}");n.push({kind:l,bodyStart:c+1,bodyEnd:p==null?e.length:p-1})}return n}_chunkA5EIY3HIcjs.a.call(void 0, hs,"findMemberContainers");function ys(e){let t=[],n=0,r=!0;for(;n<e.length;){let a=Ce(e,n);if(a!==n){n=a,r=!1;continue}let s=e[n];if(s==="{"||s==="("||s==="["){n=_nullishCoalesce(Re(e,n,s,s==="{"?"}":s==="("?")":"]"), () => (e.length)),r=!1;continue}if(s===","){r=!0,n+=1;continue}if(r&&/[A-Za-z_$]/.test(s)){let o=kt(e,n);for(;o&&(o.ident==="async"||o.ident==="get"||o.ident==="set");){let c=le(e,o.end);e[c]==="*"&&(c=le(e,c+1));let l=kt(e,c);if(!l)break;o=l}if(o){let c=le(e,o.end);("(:,<".includes(_nullishCoalesce(e[c], () => ("")))||c>=e.length)&&t.push(o.ident),n=o.end,r=!1;continue}}if(r&&s==="*"){n+=1;continue}/\s/.test(s)||(r=!1),n+=1}return t}_chunkA5EIY3HIcjs.a.call(void 0, ys,"objectLiteralMemberNames");function Rs(e){return e==="survived"||e==="not-reached"}_chunkA5EIY3HIcjs.a.call(void 0, Rs,"verdictRefusesPromotion");function Fi(e){switch(e.operator){case"negate-guard":return"the guard is negated";case"drop-throw":return"the throw is removed";case"flip-comparison":return`\`${e.original}\` becomes \`${e.replacement}\``;case"boundary-shift":return`the boundary moves (\`${e.original}\` becomes \`${e.replacement}\`)`;case"const-shift":return`\`${e.original}\` becomes \`${e.replacement}\``}}_chunkA5EIY3HIcjs.a.call(void 0, Fi,"changeText");function As(e,t){if(t.verdict==="not-reached")return`Invariant ${e}: the covering tests load the file but never call the declared symbol (mutation probe: not reached); add a test that calls it and re-run --probe-invariants --write before promoting.`;let n=t.survivors[0],r=n?` (${Fi(n)} at line ${n.line})`:"";return`Invariant ${e}: the mutation probe shows the covering tests do not pin it${r}; strengthen the test and re-run --probe-invariants --write before promoting.`}_chunkA5EIY3HIcjs.a.call(void 0, As,"probeRefusalReason");var $i="INVARIANT_TESTS_PATH_MISSING",Mi="This project is adopted and has domain invariants, but ark.config.json does not name a real tests path. Add coverage.testGlobs or coverage.coverageRoots pointing at the folder where those tests live, then re-run. Without that path, coverage is an empty checkbox.",Hi="INVARIANT_COVERAGE_ROOTS_MISSING",Ki="A domain invariant is enforced, but ark.config.json does not name coverage.coverageRoots \u2014 the folders where this project's test runner actually goes. Add coverage.coverageRoots pointing at that folder, then re-run. Without it, coverage can certify a test no runner runs.";function ks(e,t=!1){if(!e)return"";let n=e.discarded,r=[];if(n.budget>0&&!t&&r.push(`${n.budget} past the ${e.maxFiles}-file budget`),n.noInvariantMention>0&&r.push(`${n.noInvariantMention} naming no catalogued invariant`),n.oversize>0&&r.push(`${n.oversize} over the per-file byte cap`),n.unreadable>0&&r.push(`${n.unreadable} unreadable (files or directories)`),n.depthLimited>0&&r.push(`${n.depthLimited} directories past the walk depth limit`),n.outOfRoot>0&&r.push(`${n.outOfRoot} symlinked outside the project root`),r.length===0)return"";let a=t?"":` (loaded ${e.filesLoaded} files, kept ${e.testFilesRetained} tests)`;return` Scan discarded ${r.join(", ")}${a}.`}_chunkA5EIY3HIcjs.a.call(void 0, ks,"formatCoverageDiscards");function Is(e,t){let n=e.replace(/\\/g,"/").replace(/^\.\//,"");return t.some(r=>{let a=r.replace(/\\/g,"/").replace(/^\.\//,"").replace(/\/+$/,"");return a===""||a==="."?!0:n===a||n.startsWith(`${a}/`)})}_chunkA5EIY3HIcjs.a.call(void 0, Is,"isUnderCoverageRoot");function mn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}_chunkA5EIY3HIcjs.a.call(void 0, mn,"escapeRegExp");function Ve(e){return e.replace(/\\/g,"/").replace(/^\.\//,"")}_chunkA5EIY3HIcjs.a.call(void 0, Ve,"normalizePath");function hn(e,t){let n=[],r=0,a=e.length;for(;r<a;){let s=e[r],o=e[r+1];if(s==="/"&&o==="/"){for(;r<a&&e[r]!==`
|
|
6
5
|
`;)n.push(" "),r+=1;continue}if(s==="/"&&o==="*"){for(n.push(" "," "),r+=2;r<a&&!(e[r]==="*"&&e[r+1]==="/");)n.push(e[r]===`
|
|
7
6
|
`?`
|
|
8
|
-
`:" "),r+=1;r<a&&(n.push(" "," "),r+=2);continue}if(s==='"'||s==="'"||s==="`"){let
|
|
9
|
-
`?" ":
|
|
7
|
+
`:" "),r+=1;r<a&&(n.push(" "," "),r+=2);continue}if(s==='"'||s==="'"||s==="`"){let c=s;for(n.push(t?" ":s),r+=1;r<a;){let l=e[r];if(l==="\\"){let p=e[r+1];t?n.push(" ",p===void 0?"":" "):(n.push("\\"),p!==void 0&&n.push(p)),r+=p===void 0?1:2;continue}if(l===c){n.push(t?" ":l),r+=1;break}n.push(t&&l!==`
|
|
8
|
+
`?" ":l),r+=1}continue}n.push(s),r+=1}return n.join("")}_chunkA5EIY3HIcjs.a.call(void 0, hn,"maskNonCode");function Vi(e,t){if(!t)return;let n=mn(t),s=_optionalChain([new RegExp(`(?:describe|it|test|context)\\s*\\(\\s*(['"\`])((?:(?!\\1)[^\\\\]|\\\\.)*?${n}(?:(?!\\1)[^\\\\]|\\\\.)*?)\\1`,"i"), 'access', _65 => _65.exec, 'call', _66 => _66(hn(e,!1)), 'optionalAccess', _67 => _67[2]]);return s===void 0?void 0:s}_chunkA5EIY3HIcjs.a.call(void 0, Vi,"matchTestTitle");function Es(e,t){if(!t)return;let n=mn(t),r=hn(e,!0),a=[{shape:"function",source:`(?:^|[\\s;{}])(?:export\\s+(?:default\\s+)?)?(?:declare\\s+)?(?:async\\s+)?function\\s*\\*?\\s*${n}\\s*[(<]`},{shape:"class",source:`(?:^|[\\s;{}])(?:export\\s+(?:default\\s+)?)?(?:abstract\\s+)?class\\s+${n}\\b`},{shape:"const",source:`(?:^|[\\s;{}])export\\s+(?:const|let|var)\\s+${n}(?:\\s*:(?:[^=]|=>)+?)?\\s*=(?!>)`},{shape:"type",source:`(?:^|[\\s;{}])(?:export\\s+)?(?:declare\\s+)?type\\s+${n}\\b`},{shape:"interface",source:`(?:^|[\\s;{}])(?:export\\s+)?(?:declare\\s+)?interface\\s+${n}\\b`},{shape:"enum",source:`(?:^|[\\s;{}])(?:export\\s+)?(?:declare\\s+)?(?:const\\s+)?enum\\s+${n}\\b`},{shape:"method",source:`(?:^|[\\n;{}])\\s*(?:(?:public|private|protected|static|async|readonly|override|abstract|get|set|declare)\\s+)*${n}\\s*(?:<[^>\\n]*>)?\\s*\\([^;{}]*\\)\\s*(?::\\s*[^;{]+)?\\s*\\{`}];for(let s of a)if(new RegExp(s.source).test(r))return s.shape}_chunkA5EIY3HIcjs.a.call(void 0, Es,"declarationShape");function Ui(e,t,n){let r=_chunkA5EIY3HIcjs.a.call(void 0, a=>pn(a).members.some(s=>s.kind==="method"&&s.name===n),"hasClassMethod");for(let a of fn(e))if(!(a.name!==t||a.bodyStart==null)&&r(e.slice(a.bodyStart,_nullishCoalesce(a.bodyEnd, () => (e.length)))))return"method";for(let a of hs(e,t)){let s=e.slice(a.bodyStart,a.bodyEnd);if(a.kind==="class-expression"&&r(s)||a.kind==="object"&&ys(s).includes(n))return"method";if(a.kind==="namespace"){let o=Es(s,n);if(o==="function"||o==="const")return o}}}_chunkA5EIY3HIcjs.a.call(void 0, Ui,"classMemberShape");function Gi(e,t){let n=e.lastIndexOf(`
|
|
10
9
|
`,t-1)+1,r=e.indexOf(`
|
|
11
|
-
`,t);return e.slice(n,r===-1?e.length:r)}_chunkA5EIY3HIcjs.a.call(void 0,
|
|
12
|
-
`;)o(a,"comment"),a+=1;continue}if(l==="/"&&c==="*"){for(o(a,"comment"),o(a+1,"comment"),a+=2;a<s&&!(e[a]==="*"&&e[a+1]==="/");)o(a,"comment"),a+=1;a<s&&(o(a,"comment"),o(a+1,"comment"),a+=2);continue}if(l==='"'||l==="'"||l==="`"){let f=l;for(o(a,"string"),a+=1;a<s;){let g=e[a];if(g==="\\"){o(a,"string"),e[a+1]!==void 0&&o(a+1,"string"),a+=e[a+1]===void 0?1:2;continue}if(g===f){o(a,"string"),a+=1;break}o(a,"string"),a+=1}continue}o(a,"code"),a+=1}if(r.has("comment"))return"comment";if(r.has("string"))return"string";if(r.has("test-body"))return"test-body";if(r.has("import"))return"import"}_chunkA5EIY3HIcjs.a.call(void 0, vs,"mentionContext");function Ss(e){if(!e)return;let t=e.split("."),n=_nullishCoalesce(t[t.length-1], () => (""));return n?{className:t.length>1&&t[t.length-2]||null,name:n}:void 0}_chunkA5EIY3HIcjs.a.call(void 0, Ss,"symbolNeedle");function Li(e){return _nullishCoalesce(_optionalChain([Ss, 'call', _68 => _68(_optionalChain([e, 'access', _69 => _69.coverage, 'optionalAccess', _70 => _70.symbol])), 'optionalAccess', _71 => _71.name]), () => (e.id))}_chunkA5EIY3HIcjs.a.call(void 0, Li,"declaredLabel");function Is(e){return Object.keys(e).sort((t,n)=>t<n?-1:t>n?1:0)}_chunkA5EIY3HIcjs.a.call(void 0, Is,"sortedContentFiles");function Di(e,t,n=!0){let r=_nullishCoalesce(t.testFiles, () => ([])),a=new Set(r.map(R=>$e(R))),s=(_nullishCoalesce(t.coverageRoots, () => ([]))).filter(R=>typeof R=="string"&&R.length>0),o=_optionalChain([e, 'access', _72 => _72.coverage, 'optionalAccess', _73 => _73.test])!==!1&&n,l=Ss(_nullishCoalesce(_optionalChain([e, 'access', _74 => _74.coverage, 'optionalAccess', _75 => _75.symbol]), () => (void 0))),c,f;if(o){for(let R of r){let u=t.fileContents[R];if(!u)continue;let m=wi(u,e.id);if(m!==void 0){if(s.length===0||bs(R,s)){c={file:R,title:m};break}f??={file:R,title:m}}}c??=f}let g;if(l)for(let R of Is(t.fileContents)){if(a.has($e(R)))continue;let u=t.fileContents[R];if(!u)continue;let m=l.className?Ti(u,l.className,l.name):Es(u,l.name);if(m){g={file:R,shape:m};break}}let h;if(!c&&!g){if(o)for(let R of r){let u=t.fileContents[R];if(!u)continue;let m=vs(u,e.id,!0);if(m){h={file:R,context:m};break}}if(!h&&l)for(let R of Is(t.fileContents)){if(a.has($e(R)))continue;let u=t.fileContents[R];if(!u)continue;let m=vs(u,l.name,!1);if(m){h={file:R,context:m};break}}}let p=c?{kind:"test-title",file:c.file,title:c.title}:g?{kind:"declaration",file:g.file,shape:g.shape}:h?{kind:"mention-only",file:h.file,context:h.context}:{kind:"none"};return p.kind==="mention-only"&&p.context==="comment"&&l&&Fi(t.fileContents,a,l.name,p.file)&&(p={kind:"declaration-miss",symbol:l.name}),{best:p,...c?{testTitle:c}:{},...g?{declaration:g}:{}}}_chunkA5EIY3HIcjs.a.call(void 0, Di,"rankCoverage");function Fi(e,t,n,r){let a=new RegExp(`(?:^|[^A-Za-z0-9_$])${fn(n)}(?=$|[^A-Za-z0-9_$])`),s=$e(r);for(let o of Object.keys(e)){if(t.has($e(o))||$e(o)===s)continue;let l=e[o];if(l&&a.test(gn(l,!0)))return!0}return!1}_chunkA5EIY3HIcjs.a.call(void 0, Fi,"symbolInCodeElsewhere");function $i(e){switch(e.kind){case"test-title":case"declaration":return!0;case"mention-only":case"declaration-miss":case"none":return!1}}_chunkA5EIY3HIcjs.a.call(void 0, $i,"countsAsCoverage");function Mi(e){switch(e){case"test-body":return"a test body";case"comment":return"a comment";case"string":return"a string";case"import":return"an import"}}_chunkA5EIY3HIcjs.a.call(void 0, Mi,"mentionWhere");function Hi(e,t){switch(t.kind){case"test-title":return`found \`${t.title}\` in a describe/it title in ${t.file}`;case"declaration":return`found \`${t.shape} ${Li(e)}\` in ${t.file}`;case"mention-only":return`${e.id} appears only in ${Mi(t.context)} in ${t.file}; put it in a describe/it title`;case"declaration-miss":return`no declaration matched \`${t.symbol}\``;case"none":return"no scanned test names it in a describe/it title and no declared symbol was found"}}_chunkA5EIY3HIcjs.a.call(void 0, Hi,"describeCoverage");function Cs(e){let t=_nullishCoalesce(e.arkRules.invariants, () => ([]));if(t.length===0)return{coverage:[],violations:[],partial:!1};let n=_nullishCoalesce(e.testFiles, () => ([])),r=e.testGlobsMissing===!0||n.length===0,a=e.coverageBudgetExhausted===!0,s=e.coverageStats,o=ks(s),l=ks(s,!0),c=s?`coverage file budget exhausted: ${s.filesLoaded} files loaded at the ${s.maxFiles}-file cap, ${s.testFilesRetained} tests retained, ${s.discarded.budget} files discarded at the cap; raise "coverage.maxFiles" in ark.config.json (the cap bounds files RETAINED as evidence${typeof s.filesRead=="number"?`; ${s.filesRead} were read`:""})`:"coverage file budget exhausted",f=(_nullishCoalesce(e.coverageRoots, () => ([]))).filter(u=>typeof u=="string"&&u.length>0),g=f.length>0,h=f.join(", "),p=[],R=[];for(let u of t){let m=_optionalChain([u, 'access', _76 => _76.coverage, 'optionalAccess', _77 => _77.test])!==!1,v=_optionalChain([u, 'access', _78 => _78.coverage, 'optionalAccess', _79 => _79.symbol]),w=!r&&m,A=Di(u,{fileContents:e.fileContents,testFiles:n,coverageRoots:f},w),b=A.best,O=[];w&&A.testTitle&&O.push("test-title"),A.declaration&&O.push("symbol");let G=$i(b),K,j;w&&A.testTitle&&(K=A.testTitle.file,g&&(j=!bs(K,f)));let I=_optionalChain([A, 'access', _80 => _80.declaration, 'optionalAccess', _81 => _81.file]),D=_optionalChain([A, 'access', _82 => _82.declaration, 'optionalAccess', _83 => _83.shape]),X=_optionalChain([u, 'access', _84 => _84.coverage, 'optionalAccess', _85 => _85.test])===!0||!!v||u.coverage===void 0,ne=_optionalChain([u, 'access', _86 => _86.coverage, 'optionalAccess', _87 => _87.test])===!1&&!v,ue=X&&G||ne&&u.mode!=="enforced"?!0:G,ae=r&&m&&!G;if(p.push({invariantId:u.id,layer:u.provenance.layer,sourceFile:u.provenance.sourceFile,mode:u.mode,covered:ue&&!ae,evidence:O,partial:ae,description:u.description,...K!==void 0?{testEvidenceFile:K}:{},...I!==void 0?{symbolEvidenceFile:I}:{},...D!==void 0?{shape:D}:{},...j!==void 0?{outsideDeclaredRoots:j}:{},coverageRootsDeclared:g}),j===!0&&K!==void 0&&R.push({ruleId:"INVARIANT_COVERAGE_OUTSIDE_ROOTS",message:`Invariant ${u.id} is covered only by ${K}, which is outside the declared coverage roots (${h}). ArkGate matches declared text and never executes tests, so it cannot tell whether that file is run: move the test under a declared root, or add its root to "coverage.coverageRoots" in ark.config.json.`,file:K,line:1,arkruleId:u.id,arkruleSource:u.provenance.sourceFile,fromLayer:u.provenance.layer,severity:"warning",failsStrict:!1}),!ue||ae){let Ue=u.mode==="enforced"&&!ae,pe=r||n.length===0?"never-had-tests":"tests-disappeared";R.push({ruleId:"INVARIANT_UNCOVERED",message:(ae?a?`Invariant ${u.id} coverage cannot be proven (${c}); reporting partial, not covered.`:`Invariant ${u.id} coverage cannot be proven (test globs missing or empty); reporting partial, not covered (never-had-tests).`:ne?`Invariant ${u.id} is enforced but declares no evidence (coverage.test is false and no coverage.symbol); set coverage.symbol, drop test:false, or keep mode "advisory".`:`Invariant ${u.id}: ${Hi(u,b)} (${pe==="tests-disappeared"?"tests-disappeared \u2014 a suite exists":"never-had-tests \u2014 the scan found no tests at all"}). ArkGate matches declared text; it never executes tests.`)+(ae&&a?l:o),file:u.provenance.sourceFile,line:1,arkruleId:u.id,arkruleSource:u.provenance.sourceFile,fromLayer:u.provenance.layer,severity:Ue?"error":"warning",failsStrict:Ue,kind:pe})}}return{coverage:p,violations:R,partial:p.some(u=>u.partial)}}_chunkA5EIY3HIcjs.a.call(void 0, Cs,"evaluateInvariantCoverage");function _s(e){return e?e.partial?{ok:!1,reason:"Coverage is partial (missing test globs); cannot promote until evidence is complete."}:e.covered?Array.isArray(e.evidence)&&e.evidence.length===0?{ok:!1,reason:`Invariant ${e.invariantId} declares no evidence (coverage.test:false and no symbol); add coverage.symbol or a test title before promoting to enforced.`}:e.outsideDeclaredRoots===!0?{ok:!1,reason:`Invariant ${e.invariantId} is covered only by ${_nullishCoalesce(e.testEvidenceFile, () => ("a test"))}, outside the declared coverage roots; ArkGate cannot tell whether that test runs, so it will not promote on it.`}:e.coverageRootsDeclared===!1?{ok:!1,reason:`Declare coverage.coverageRoots in ark.config.json before promoting ${e.invariantId} to enforced. Without that, ArkGate cannot tell whether a covering test is one the runner executes.`}:{ok:!0,reason:`Invariant ${e.invariantId} has coverage evidence.`}:{ok:!1,reason:`Invariant ${e.invariantId} is uncovered; add a test title or symbol before promoting to enforced.`}:{ok:!1,reason:"No coverage evidence supplied for this invariant; evaluate coverage before promoting to enforced."}}_chunkA5EIY3HIcjs.a.call(void 0, _s,"canPromoteInvariant");function pn(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!="string")continue;let r=n.trim();r.length>0&&t.push(r)}return t}_chunkA5EIY3HIcjs.a.call(void 0, pn,"nonEmptyPathStrings");function Ki(e){return!e||typeof e!="object"?[]:[...pn(e.testGlobs),...pn(e.coverageRoots)]}_chunkA5EIY3HIcjs.a.call(void 0, Ki,"configuredInvariantTestsPaths");function Ui(e){return Ki(e).length>0}_chunkA5EIY3HIcjs.a.call(void 0, Ui,"hasConfiguredInvariantTestsPath");function mn(e){return!Array.isArray(e)||e.length===0?!1:e.some(t=>t!=null&&_optionalChain([t, 'access', _88 => _88.coverage, 'optionalAccess', _89 => _89.test])!==!1)}_chunkA5EIY3HIcjs.a.call(void 0, mn,"catalogDemandsInvariantTestsPath");function Os(e){let t=e.hasDomainInvariants===!0||e.hasDomainInvariants!==!1&&mn(e.invariants);return e.adopted!==!0||!t?[]:Ui(e.coverage)&&e.declaredPathPresent!==!1?[]:[{ruleId:Ci,message:_i,file:"ark.config.json",line:1,severity:"error",failsStrict:!0,freezable:!1}]}_chunkA5EIY3HIcjs.a.call(void 0, Os,"collectMissingInvariantTestsPathFindings");function Vi(e){return!e||typeof e!="object"?[]:pn(e.coverageRoots)}_chunkA5EIY3HIcjs.a.call(void 0, Vi,"configuredCoverageRoots");function Gi(e){return Vi(e).length>0}_chunkA5EIY3HIcjs.a.call(void 0, Gi,"hasConfiguredCoverageRoots");function yn(e){return!Array.isArray(e)||e.length===0?!1:e.some(t=>t!=null&&t.mode==="enforced")}_chunkA5EIY3HIcjs.a.call(void 0, yn,"catalogHasEnforcedInvariant");function xs(e){return e.hasEnforcedInvariant===!0||e.hasEnforcedInvariant!==!1&&yn(e.invariants)?Gi(e.coverage)&&e.declaredPathPresent!==!1?[]:[{ruleId:Oi,message:xi,file:"ark.config.json",line:1,severity:"error",failsStrict:!0,freezable:!1}]:[]}_chunkA5EIY3HIcjs.a.call(void 0, xs,"collectMissingCoverageRootsFindings");var kn="1.0",ji="add a short note under docs/adr/ (or docs/decisions/) and put that file path in --policy-ack as adrPath.";function C(e,t){let n=t.classification==="weakening"||t.classification==="judgment-required"?`Restore the previous protection at ${t.path}, or ${ji}`:void 0,r=_nullishCoalesce(t.nextAction, () => (n));e.push({id:`${t.classification}:${t.path}:${t.kind}`,path:t.path,classification:t.classification,message:t.message,...r?{nextAction:r}:{},...t.before===void 0?{}:{before:t.before},...t.after===void 0?{}:{after:t.after}})}_chunkA5EIY3HIcjs.a.call(void 0, C,"addFinding");function H(e){return[...new Set(_nullishCoalesce(e, () => ([])))].sort()}_chunkA5EIY3HIcjs.a.call(void 0, H,"sortedUnique");function ie(e,t,n,r,a){let s=H(n),o=H(r),l=new Set(s),c=new Set(o),f=o.filter(h=>!l.has(h)),g=s.filter(h=>!c.has(h));f.length===0&&g.length===0||(f.length>0&&C(e,{kind:"added",path:t,classification:a.added,message:a.addedMessage,before:s,after:o}),g.length>0&&C(e,{kind:"removed",path:t,classification:a.removed,message:a.removedMessage,before:s,after:o}))}_chunkA5EIY3HIcjs.a.call(void 0, ie,"compareStringSets");function Qe(e,t,n,r,a,s,o){if(n===r)return;C(e,{kind:r?"enabled":"disabled",path:t,classification:r?a:a==="strengthening"?"weakening":"strengthening",message:r?s:o,before:n,after:r})}_chunkA5EIY3HIcjs.a.call(void 0, Qe,"compareBoolean");function At(e,t){let n=new Map,r=new Set;for(let a of e){let s=t(a);n.has(s)?r.add(s):n.set(s,a)}return{values:n,duplicates:[...r].sort()}}_chunkA5EIY3HIcjs.a.call(void 0, At,"keyed");function Bi(e,t,n){let r=At(t,s=>s.name),a=At(n,s=>s.name);(r.duplicates.length>0||a.duplicates.length>0)&&C(e,{kind:"duplicate-layer",path:"$.layers",classification:"judgment-required",message:"Duplicate layer names make policy ownership ambiguous.",before:r.duplicates,after:a.duplicates});for(let s of[...new Set([...r.values.keys(),...a.values.keys()])].sort()){let o=r.values.get(s),l=a.values.get(s),c=`$.layers[${s}]`;if(!o&&l){C(e,{kind:"layer-added",path:c,classification:"judgment-required",message:"A layer was added; verify overlap, ownership, and rule coverage.",nextAction:"Write a short note under docs/adr/ (or docs/decisions/) for this new layer and put that file path in --policy-ack as adrPath.",after:l});continue}if(o&&!l){C(e,{kind:"layer-removed",path:c,classification:"weakening",message:"Removing a layer can leave its source paths ungoverned.",before:o});continue}if(!o||!l)continue;ie(e,`${c}.patterns`,o.patterns,l.patterns,{added:"strengthening",removed:"weakening",addedMessage:"Additional paths are governed by this layer.",removedMessage:"Paths were removed from this layer and may become ungoverned."}),ie(e,`${c}.exclude`,o.exclude,l.exclude,{added:"weakening",removed:"strengthening",addedMessage:"Additional paths are excluded from this layer.",removedMessage:"Fewer paths are excluded from this layer."});let f=yt(o),g=yt(l);ie(e,`${c}.forbiddenGlobals`,f.rawGlobals,g.rawGlobals,{added:"strengthening",removed:"weakening",addedMessage:"Additional forbidden globals are enforced in this layer.",removedMessage:"A forbidden-global protection was removed from this layer."}),ie(e,`${c}.capabilities`,f.atoms,g.atoms,{added:"strengthening",removed:"weakening",addedMessage:"Additional ambient/import protection is enforced in this layer (coverage atoms).",removedMessage:"An ambient/import protection was lost from this layer (coverage atoms)."}),H(o.intentPrefixes).join("\0")!==H(l.intentPrefixes).join("\0")&&C(e,{kind:"intent-prefixes-changed",path:`${c}.intentPrefixes`,classification:"judgment-required",message:"Intent ownership changed and must be reviewed against publishers and consumers.",before:H(o.intentPrefixes),after:H(l.intentPrefixes)}),Qe(e,`${c}.mayImportInfrastructure`,o.mayImportInfrastructure===!0,l.mayImportInfrastructure===!0,"weakening","The layer may now import infrastructure directly.","Direct infrastructure imports are no longer allowed for this layer."),Qe(e,`${c}.optional`,o.optional===!0,l.optional===!0,"weakening","The layer is now optional and can be absent without a strict warning.","The layer is now required when its contract is active.")}}_chunkA5EIY3HIcjs.a.call(void 0, Bi,"compareLayers");function zi(e,t,n){let r=_chunkA5EIY3HIcjs.a.call(void 0, o=>`${o.from}->${o.to}`,"keyOf"),a=At(t,r),s=At(n,r);(a.duplicates.length>0||s.duplicates.length>0)&&C(e,{kind:"duplicate-rule",path:"$.rules",classification:"judgment-required",message:"Duplicate rule edges make the effective verdict order-dependent.",before:a.duplicates,after:s.duplicates});for(let o of[...new Set([...a.values.keys(),...s.values.keys()])].sort()){let l=a.values.get(o),c=s.values.get(o),f=`$.rules[${o}]`;if(!l&&c){c.allowed===!1?C(e,{kind:"deny-added",path:f,classification:"strengthening",message:"A denied dependency edge was added.",after:c}):C(e,{kind:"allow-added",path:f,classification:"judgment-required",message:"A new import edge was added; confirm this house should import that one.",nextAction:"Write a short note under docs/adr/ (or docs/decisions/) for this new import edge and put that file path in --policy-ack as adrPath.",after:c});continue}if(l&&!c){l.allowed===!1&&C(e,{kind:"deny-removed",path:f,classification:"weakening",message:"A denied dependency edge was removed.",before:l});continue}if(!l||!c)continue;l.allowed!==c.allowed&&C(e,{kind:c.allowed?"deny-disabled":"deny-enabled",path:`${f}.allowed`,classification:c.allowed?"weakening":"strengthening",message:c.allowed?"A previously denied dependency edge is now allowed.":"A dependency edge is now denied.",before:l.allowed,after:c.allowed});let g=l.peerIsolation===!0,h=c.peerIsolation===!0;if(g!==h){let v=l.from===l.to&&c.from===c.to;C(e,{kind:h?"peer-isolation-enabled":"peer-isolation-disabled",path:`${f}.peerIsolation`,classification:v?h?"strengthening":"weakening":"judgment-required",message:v?h?"Cross-slice dependencies inside this layer are now denied.":"Cross-slice dependencies inside this layer are no longer denied.":"Changing peer isolation on a cross-layer edge changes the denial scope.",before:g,after:h})}H(l.sliceFolders).join("\0")!==H(c.sliceFolders).join("\0")&&C(e,{kind:"slice-folders-changed",path:`${f}.sliceFolders`,classification:"judgment-required",message:"Slice ownership folders changed and can reclassify existing dependencies.",before:H(l.sliceFolders),after:H(c.sliceFolders)});let p=_nullishCoalesce(l.sliceIdentity, () => ("path")),R=_nullishCoalesce(c.sliceIdentity, () => ("path"));if(p!==R&&C(e,{kind:"slice-identity-changed",path:`${f}.sliceIdentity`,classification:"judgment-required",message:"Slice identity changed and can reclassify existing slice ids. Baselines and allowedCrossSlice use those ids.",before:p,after:R}),!g&&!h)continue;Rt(e,`${f}.sharedRoots`,"shared-roots",H(l.sharedRoots),H(c.sharedRoots),"Roots declared shared are exempt from the peerIsolation unclassifiable denial.","Roots are no longer declared shared and fall back to the peerIsolation denial."),Rt(e,`${f}.allowedCrossSlice`,"cross-slice-allowance",H((_nullishCoalesce(l.allowedCrossSlice, () => ([]))).map(An)),H((_nullishCoalesce(c.allowedCrossSlice, () => ([]))).map(An)),"Directed cross-slice edges are now allowed by declaration.","Directed cross-slice edges are no longer declared and deny again.");let u=_nullishCoalesce(_chunkRNQHRDCQcjs.x.call(void 0, l.sharedImportsSlice), () => (null)),m=_nullishCoalesce(_chunkRNQHRDCQcjs.x.call(void 0, c.sharedImportsSlice), () => (null));if(u!==m){let v=Hs(m)>Hs(u);C(e,{kind:"shared-imports-slice",path:`${f}.sharedImportsSlice`,classification:v?"strengthening":"weakening",message:al(u,m),before:u,after:m})}else m==="deny-cross-parent"&&Rt(e,`${f}.sharedImportsSlice.stopAt`,"shared-walk-stop",Ts(l.sharedImportsSlice),Ts(c.sharedImportsSlice),"Composition roots now stop the cross-parent walk. Paths through them are no longer reported.","Composition roots no longer stop the cross-parent walk. Paths through them are reported again.");qi(e,f,l,c)}}_chunkA5EIY3HIcjs.a.call(void 0, zi,"compareRules");function ws(e){let t=e.childSlices;return t?JSON.stringify([H(_nullishCoalesce(t.sliceFolders, () => ([]))),_nullishCoalesce(t.sliceIdentity, () => ("path")),H(_nullishCoalesce(t.commonFolders, () => ([])))]):""}_chunkA5EIY3HIcjs.a.call(void 0, ws,"childSliceFoldersKey");function Ts(e){return H(_chunkRNQHRDCQcjs.y.call(void 0, e).map(t=>et(t.trim().replace(/\\/g,"/")).toLowerCase()))}_chunkA5EIY3HIcjs.a.call(void 0, Ts,"stopAtKeys");function Ns(e){return e==="always"?2:e==="auto"?1:0}_chunkA5EIY3HIcjs.a.call(void 0, Ns,"siblingRatchetRank");function Wi(e){return H((_nullishCoalesce(e, () => ([]))).map(t=>et(t.trim().replace(/\\/g,"/")).toLowerCase()))}_chunkA5EIY3HIcjs.a.call(void 0, Wi,"enforceKeys");function Ps(e){if(!e.childSlices)return null;let t=e.childSlices.siblings;return t==null||t==="deny"?{mode:"deny",enforce:[],ratchet:"auto"}:t==="advisory"?{mode:"advisory",enforce:[],ratchet:"auto"}:t.default==="deny"?{mode:"deny",enforce:[],ratchet:"auto"}:{mode:"advisory",enforce:Wi(t.enforce),ratchet:_chunkRNQHRDCQcjs.N.call(void 0, t)}}_chunkA5EIY3HIcjs.a.call(void 0, Ps,"childSliceSiblingPolicy");function qi(e,t,n,r){let a=Ps(n),s=Ps(r);if(a===null&&s===null)return;if(a===null&&s!==null){C(e,{kind:"child-slices-added",path:`${t}.childSlices`,classification:s.mode==="advisory"?"judgment-required":"strengthening",message:s.mode==="advisory"?"A child slice wall was added with advisory sibling crossings.":"A child slice wall was added. Sibling crossings inside a universe are now denied.",after:r.childSlices});return}if(a!==null&&s===null){C(e,{kind:"child-slices-removed",path:`${t}.childSlices`,classification:"weakening",message:"The child slice wall was removed. Sibling crossings inside a universe are allowed again.",before:n.childSlices});return}if(ws(n)!==ws(r)){C(e,{kind:"child-slices-changed",path:`${t}.childSlices`,classification:"judgment-required",message:"Child slice folders changed and can reclassify edges inside a universe.",before:n.childSlices,after:r.childSlices});return}if(a===null||s===null)return;if(a.mode!==s.mode){let c=s.mode==="advisory";C(e,{kind:"child-slices-siblings",path:`${t}.childSlices.siblings`,classification:c?"weakening":"strengthening",message:c?s.enforce.length>0?"Sibling crossings outside the enforce list are now advisory.":"Sibling crossings inside a universe are now advisory.":"Sibling crossings inside a universe are now denied.",before:a.mode,after:s.mode})}else if(a.mode==="advisory"&&(Yi(e,`${t}.childSlices.siblings.enforce`,a.enforce,s.enforce),a.ratchet!==s.ratchet)){let c=Ns(s.ratchet)>Ns(a.ratchet);C(e,{kind:"child-slices-siblings-ratchet",path:`${t}.childSlices.siblings.ratchet`,classification:c?"strengthening":"weakening",message:c?"New advisory sibling crossings past the baseline fail in more cases.":s.ratchet==="never"?"Advisory sibling crossings are measured only and never fail.":"New advisory sibling crossings past the baseline fail in fewer cases.",before:a.ratchet,after:s.ratchet})}let o=_optionalChain([n, 'access', _90 => _90.childSlices, 'optionalAccess', _91 => _91.parentMayImportChild])===!0,l=_optionalChain([r, 'access', _92 => _92.childSlices, 'optionalAccess', _93 => _93.parentMayImportChild])===!0;o!==l&&C(e,{kind:"child-slices-parent-import",path:`${t}.childSlices.parentMayImportChild`,classification:l?"weakening":"strengthening",message:l?"Universe common may now import a child slice.":"Universe common may no longer import a child slice.",before:o,after:l}),Qi(e,t,n,r),Ji(e,t,n,r)}_chunkA5EIY3HIcjs.a.call(void 0, qi,"compareChildSlices");function Yi(e,t,n,r){if(JSON.stringify(n)===JSON.stringify(r))return;let a=r.filter(l=>!n.includes(l)),s=n.filter(l=>!r.includes(l)),o=a.length>0&&s.length>0;C(e,{kind:o?"child-slices-siblings-enforce-changed":"child-slices-siblings-enforce",path:t,classification:o?"judgment-required":a.length>0?"strengthening":"weakening",message:o?"Enforced sibling subtrees were added and removed in the same change.":a.length>0?"Sibling crossings from these subtrees are now errors.":"Sibling crossings from these subtrees are advisory again.",before:n,after:r})}_chunkA5EIY3HIcjs.a.call(void 0, Yi,"compareSiblingEnforceList");function An(e){return JSON.stringify([e.from,e.to])}_chunkA5EIY3HIcjs.a.call(void 0, An,"crossSliceKey");function Ls(e){return H((_nullishCoalesce(_optionalChain([e, 'access', _94 => _94.childSlices, 'optionalAccess', _95 => _95.allowedCrossSlice]), () => ([]))).map(An))}_chunkA5EIY3HIcjs.a.call(void 0, Ls,"childCrossSliceKeys");function Me(e){return et(e.trim().replace(/\\/g,"/")).toLowerCase().split("/").filter(t=>t.length>0)}_chunkA5EIY3HIcjs.a.call(void 0, Me,"allowanceSegments");function Ds(e,t){let n=Me(e),r=Me(t);if(n.length===0||n.length!==r.length)return!1;let a=!1;for(let s=0;s<n.length;s+=1)if(n[s]!==r[s]){if(n[s]==="*"&&r[s]!=="*"){a=!0;continue}return!1}return a}_chunkA5EIY3HIcjs.a.call(void 0, Ds,"patternWidens");function Xi(e,t){let n=JSON.parse(e),r=JSON.parse(t),a=Me(n[0]).join("/")===Me(r[0]).join("/"),s=Me(n[1]).join("/")===Me(r[1]).join("/"),o=Ds(n[0],r[0]),l=Ds(n[1],r[1]);return!(a||o)||!(s||l)?!1:o||l}_chunkA5EIY3HIcjs.a.call(void 0, Xi,"allowanceWidens");function Zi(e){return JSON.stringify([et(e.from.trim().replace(/\\/g,"/")).toLowerCase(),et(e.to.trim().replace(/\\/g,"/")).toLowerCase()])}_chunkA5EIY3HIcjs.a.call(void 0, Zi,"aliasEntryKey");function Fs(e){return H((_nullishCoalesce(_optionalChain([e, 'access', _96 => _96.childSlices, 'optionalAccess', _97 => _97.sliceAliases]), () => ([]))).map(Zi))}_chunkA5EIY3HIcjs.a.call(void 0, Fs,"sliceAliasKeys");function Ji(e,t,n,r){let a=Fs(n),s=Fs(r);if(JSON.stringify(a)===JSON.stringify(s))return;let o=s.filter(f=>!a.includes(f)),l=a.filter(f=>!s.includes(f)),c=o.length>0&&l.length>0;C(e,{kind:c?"slice-aliases-changed":o.length>0?"slice-aliases-added":"slice-aliases-removed",path:`${t}.childSlices.sliceAliases`,classification:c?"judgment-required":o.length>0?"strengthening":"weakening",message:c?"Slice aliases were added and removed in the same change.":o.length>0?"Unclassified files are now under the slice walls.":"Aliased files leave the slice walls.",before:a,after:s})}_chunkA5EIY3HIcjs.a.call(void 0, Ji,"compareSliceAliases");function Qi(e,t,n,r){let a=Ls(n),s=Ls(r);if(JSON.stringify(a)===JSON.stringify(s))return;let o=s.filter(c=>!a.includes(c)),l=a.filter(c=>!s.includes(c));if(o.length>0&&l.length>0&&l.filter(f=>!o.some(g=>Xi(g,f))).length===0){C(e,{kind:"child-slices-cross-slice-allowance-added",path:`${t}.childSlices.allowedCrossSlice`,classification:"weakening",message:"A wildcard widened a declared sibling allowance.",before:a,after:s});return}Rt(e,`${t}.childSlices.allowedCrossSlice`,"child-slices-cross-slice-allowance",a,s,"Sibling crossings inside a universe are now allowed by declaration.","Declared sibling crossings inside a universe deny again.")}_chunkA5EIY3HIcjs.a.call(void 0, Qi,"compareChildCrossSliceAllowances");function Rt(e,t,n,r,a,s,o){if(JSON.stringify(r)===JSON.stringify(a))return;let l=a.filter(g=>!r.includes(g)),c=r.filter(g=>!a.includes(g)),f=l.length>0&&c.length>0;C(e,{kind:f?`${n}-changed`:l.length>0?`${n}-added`:`${n}-removed`,path:t,classification:f?"judgment-required":l.length>0?"weakening":"strengthening",message:f?`${s} Entries were added and removed in the same change.`:l.length>0?s:o,before:r,after:a})}_chunkA5EIY3HIcjs.a.call(void 0, Rt,"compareDeclaredExceptions");function el(e,t,n){let r=_nullishCoalesce(t.safety, () => ({})),a=_nullishCoalesce(n.safety, () => ({}));for(let s of["maxTsSuppressions","maxAnyCasts"]){let o=_nullishCoalesce(r[s], () => (0)),l=_nullishCoalesce(a[s], () => (0));o!==l&&C(e,{kind:l>o?"threshold-raised":"threshold-lowered",path:`$.safety.${s}`,classification:l>o?"weakening":"strengthening",message:l>o?"The safety threshold allows more violations.":"The safety threshold allows fewer violations.",before:o,after:l})}for(let s of["allowInMemory","allowDisabledPeerIsolation"])Qe(e,`$.safety.${s}`,r[s]===!0,a[s]===!0,"weakening","A safety exception was enabled.","A safety exception was disabled.")}_chunkA5EIY3HIcjs.a.call(void 0, el,"compareSafety");function hn(e){return e.mode==="enforced"?"enforced":"advisory"}_chunkA5EIY3HIcjs.a.call(void 0, hn,"arkRunMode");function Rn(e){return e.mode==="enforced"?"enforced":"advisory"}_chunkA5EIY3HIcjs.a.call(void 0, Rn,"arkOrderMode");function tl(e,t,n){let r=t.arkOrder,a=n.arkOrder,s="$.arkOrder";if(!r&&!a)return;if(!r&&a){C(e,{kind:"arkorder-added",path:s,classification:"strengthening",message:`ArkOrder extra was added (${Rn(a)}).`,after:a});return}if(r&&!a){C(e,{kind:"arkorder-removed",path:s,classification:"weakening",message:"ArkOrder extra was removed.",before:r});return}if(!r||!a)return;let o=Rn(r),l=Rn(a);if(o!==l){let c=o==="advisory"&&l==="enforced";C(e,{kind:c?"arkorder-promoted":"arkorder-demoted",path:`${s}.mode`,classification:c?"strengthening":"weakening",message:c?"ArkOrder extra was promoted to enforced.":"ArkOrder extra was demoted to advisory.",before:o,after:l})}ie(e,`${s}.planeRoots`,r.planeRoots,a.planeRoots,{added:"strengthening",removed:"weakening",addedMessage:"Additional ArkOrder plane roots are governed.",removedMessage:"ArkOrder plane roots were removed and may skip the plane."}),ie(e,`${s}.managedLayers`,r.managedLayers,a.managedLayers,{added:"strengthening",removed:"weakening",addedMessage:"Additional layers are managed by ArkOrder.",removedMessage:"Layers were removed from ArkOrder management."})}_chunkA5EIY3HIcjs.a.call(void 0, tl,"compareArkOrder");function nl(e,t,n){let r=t.arkRun,a=n.arkRun,s="$.arkRun";if(!r&&!a)return;if(!r&&a){C(e,{kind:"arkrun-added",path:s,classification:"strengthening",message:`ArkRun extra was added (${hn(a)}).`,after:a});return}if(r&&!a){C(e,{kind:"arkrun-removed",path:s,classification:"weakening",message:"ArkRun extra was removed.",before:r});return}if(!r||!a)return;let o=hn(r),l=hn(a);if(o!==l){let c=o==="advisory"&&l==="enforced";C(e,{kind:c?"arkrun-promoted":"arkrun-demoted",path:`${s}.mode`,classification:c?"strengthening":"weakening",message:c?"ArkRun extra was promoted to enforced.":"ArkRun extra was demoted to advisory.",before:o,after:l})}ie(e,`${s}.compositionRoots`,r.compositionRoots,a.compositionRoots,{added:"strengthening",removed:"weakening",addedMessage:"Additional ArkRun composition roots are governed.",removedMessage:"ArkRun composition roots were removed and may skip the kernel."}),ie(e,`${s}.managedLayers`,r.managedLayers,a.managedLayers,{added:"strengthening",removed:"weakening",addedMessage:"Additional layers are managed by ArkRun.",removedMessage:"Layers were removed from ArkRun management."}),Qe(e,`${s}.requireDeclarations`,r.requireDeclarations!==!1,a.requireDeclarations!==!1,"strengthening","ArkRun now requires interaction declarations.","ArkRun no longer requires interaction declarations.")}_chunkA5EIY3HIcjs.a.call(void 0, nl,"compareArkRun");function rl(e){return e.some(t=>t.classification==="weakening")?"weakening":e.some(t=>t.classification==="judgment-required")?"judgment-required":e.some(t=>t.classification==="strengthening")?"strengthening":"neutral"}_chunkA5EIY3HIcjs.a.call(void 0, rl,"overallClassification");function $s(e,t){return`${e}::${t}`}_chunkA5EIY3HIcjs.a.call(void 0, $s,"ruleKey");function Ms(e){let t=new Map,n=new Map;if(!e)return{structure:t,invariants:n};for(let r of e.structure)t.set($s(r.provenance.layer,r.id),r);for(let r of e.invariants)n.set($s(r.provenance.layer,r.id),r);return{structure:t,invariants:n}}_chunkA5EIY3HIcjs.a.call(void 0, Ms,"indexEffectiveRules");function sl(e,t,n,r,a,s){let o=new Map((_nullishCoalesce(s, () => ([]))).map(p=>[p.invariantId,p])),l=_nullishCoalesce(t.arkRules, () => ({})),c=_nullishCoalesce(n.arkRules, () => ({})),f=[...new Set([...Object.keys(l),...Object.keys(c)])].sort();for(let p of f){let R=l[p],u=c[p],m=`$.arkRules[${p}]`;if(R===void 0&&u!==void 0){C(e,{kind:"arkrules-ref-added",path:m,classification:"strengthening",message:`ArkRules reference for layer ${p} was added.`,after:u});continue}if(R!==void 0&&u===void 0){C(e,{kind:"arkrules-ref-removed",path:m,classification:"weakening",message:`ArkRules reference for layer ${p} was removed.`,before:R});continue}R!==u&&C(e,{kind:"arkrules-ref-path-changed",path:m,classification:"judgment-required",message:`ArkRules file path for layer ${p} changed; verify the effective rules still match intent.`,before:R,after:u})}let g=Ms(r),h=Ms(a);for(let p of[...new Set([...g.structure.keys(),...h.structure.keys()])].sort()){let R=g.structure.get(p),u=h.structure.get(p),m=`$.arkRules.structure[${p}]`;if(!R&&u){C(e,{kind:"arkrule-structure-added",path:m,classification:"strengthening",message:`Structure ArkRule ${u.id} was added (${u.mode}).`,after:u});continue}if(R&&!u){C(e,{kind:"arkrule-structure-removed",path:m,classification:"weakening",message:`Structure ArkRule ${R.id} was removed.`,before:R});continue}if(!(!R||!u)){if(R.mode!==u.mode){let v=R.mode==="advisory"&&u.mode==="enforced";C(e,{kind:v?"arkrule-promoted":"arkrule-demoted",path:`${m}.mode`,classification:v?"strengthening":"weakening",message:v?`Structure ArkRule ${u.id} was promoted to enforced.`:`Structure ArkRule ${u.id} was demoted to advisory.`,before:R.mode,after:u.mode})}R.sensor!==u.sensor&&C(e,{kind:"arkrule-sensor-changed",path:`${m}.sensor`,classification:"judgment-required",message:`Structure ArkRule ${u.id} changed sensor identity.`,before:R.sensor,after:u.sensor})}}for(let p of[...new Set([...g.invariants.keys(),...h.invariants.keys()])].sort()){let R=g.invariants.get(p),u=h.invariants.get(p),m=`$.arkRules.invariants[${p}]`;if(!R&&u){C(e,{kind:"arkrule-invariant-added",path:m,classification:"strengthening",message:`Invariant ${u.id} was added (${u.mode}).`,after:u});continue}if(R&&!u){C(e,{kind:"arkrule-invariant-removed",path:m,classification:"weakening",message:`Invariant ${R.id} was removed.`,before:R});continue}if(!(!R||!u)&&R.mode!==u.mode)if(R.mode==="advisory"&&u.mode==="enforced"){let w=_optionalChain([o, 'optionalAccess', _98 => _98.get, 'call', _99 => _99(u.id)]),A=_s(w);A.ok?C(e,{kind:"arkrule-invariant-promoted",path:`${m}.mode`,classification:"strengthening",message:`Invariant ${u.id} was promoted to enforced (coverage evidence present).`,before:R.mode,after:u.mode}):C(e,{kind:"arkrule-invariant-promote-refused",path:`${m}.mode`,classification:"judgment-required",message:`Invariant ${u.id} cannot be promoted to enforced: ${A.reason}`,before:R.mode,after:u.mode})}else C(e,{kind:"arkrule-invariant-demoted",path:`${m}.mode`,classification:"weakening",message:`Invariant ${u.id} was demoted to advisory.`,before:R.mode,after:u.mode})}}_chunkA5EIY3HIcjs.a.call(void 0, sl,"compareArkRules");function vn(e,t,n){let r=[];ie(r,"$.include",e.include,t.include,{added:"strengthening",removed:"weakening",addedMessage:"Additional project roots are governed.",removedMessage:"Project roots were removed from governance."}),ie(r,"$.exclude",e.exclude,t.exclude,{added:"weakening",removed:"strengthening",addedMessage:"Additional project paths are excluded from governance.",removedMessage:"Fewer project paths are excluded from governance."}),ie(r,"$.dynamicImportAllowlist",e.dynamicImportAllowlist,t.dynamicImportAllowlist,{added:"weakening",removed:"strengthening",addedMessage:"Additional files may use non-literal dynamic imports.",removedMessage:"Fewer files may use non-literal dynamic imports."}),Qe(r,"$.excludeGenerated",e.excludeGenerated!==!1,t.excludeGenerated!==!1,"weakening","Generated source is now excluded from governance.","Generated source is now governed.");let a={off:0,soft:1,"framework-soft":1,strict:2},s=_nullishCoalesce(e.cyclePolicy, () => ("strict")),o=_nullishCoalesce(t.cyclePolicy, () => ("strict"));if(s!==o){let l=a[o]===a[s]?"judgment-required":a[o]>a[s]?"strengthening":"weakening";C(r,{kind:"cycle-policy-changed",path:"$.cyclePolicy",classification:l,message:"The cycle enforcement level changed.",before:s,after:o})}return(_nullishCoalesce(e.frameworkOverlay, () => (null)))!==(_nullishCoalesce(t.frameworkOverlay, () => (null)))&&C(r,{kind:"framework-overlay-changed",path:"$.frameworkOverlay",classification:"judgment-required",message:"The framework overlay changed and may alter effective layer matching.",before:_nullishCoalesce(e.frameworkOverlay, () => (null)),after:_nullishCoalesce(t.frameworkOverlay, () => (null))}),Bi(r,e.layers,t.layers),zi(r,e.rules,t.rules),el(r,e,t),sl(r,e,t,_optionalChain([n, 'optionalAccess', _100 => _100.baseArkRules]),_optionalChain([n, 'optionalAccess', _101 => _101.candidateArkRules]),_optionalChain([n, 'optionalAccess', _102 => _102.candidateInvariantCoverage])),nl(r,e,t),tl(r,e,t),r.sort((l,c)=>l.path.localeCompare(c.path)||l.id.localeCompare(c.id)),{schemaVersion:kn,classification:rl(r),findings:r}}_chunkA5EIY3HIcjs.a.call(void 0, vn,"classifyArkPolicyDelta");function In(e,t){if(!e||e.schemaVersion!==kn||typeof e.basePolicyHash!="string"||typeof e.candidatePolicyHash!="string"||typeof e.reason!="string"||!Array.isArray(e.findingIds)||e.findingIds.some(a=>typeof a!="string")||e.reason.trim().length===0||e.basePolicyHash!==t.basePolicyHash||e.candidatePolicyHash!==t.candidatePolicyHash)return!1;let n=H(e.findingIds),r=H(t.findingIds);return n.length===r.length&&n.every((a,s)=>a===r[s])}_chunkA5EIY3HIcjs.a.call(void 0, In,"policyDeltaAcknowledgementMatches");function et(e){let t=e.length;for(;t>0&&e[t-1]==="/";)t-=1;return e.slice(0,t)}_chunkA5EIY3HIcjs.a.call(void 0, et,"trimTrailingSlashes");function Hs(e){return e==="deny"?2:e==="deny-cross-parent"?1:0}_chunkA5EIY3HIcjs.a.call(void 0, Hs,"sharedImportsSliceRank");function al(e,t){return t==="deny"?"A shared root may no longer import a slice.":e==="deny"&&t==="deny-cross-parent"?"A shared root may import a slice again, except when that hop carries another universe.":e==="deny"?"A shared root may import a slice again.":t==="deny-cross-parent"?"A slice may no longer reach another universe through a shared root. ark-check and CI report that path. The write hook and ESLint see one edge at a time and do not block it.":"A slice may reach another universe through a shared root again."}_chunkA5EIY3HIcjs.a.call(void 0, al,"sharedImportsSliceMessage");function _e(e){let t=[];for(let n of e.replace(/\\/g,"/").split("/"))!n||n==="."||(n===".."&&t.length>0&&t.at(-1)!==".."?t.pop():t.push(n));return t.join("/")}_chunkA5EIY3HIcjs.a.call(void 0, _e,"normalizePath");function Ks(e){return e!==void 0&&/[A-Za-z_$]/.test(e)}_chunkA5EIY3HIcjs.a.call(void 0, Ks,"isIdentifierStart");function kt(e){return e!==void 0&&/[A-Za-z0-9_$]/.test(e)}_chunkA5EIY3HIcjs.a.call(void 0, kt,"isIdentifierCharacter");function te(e,t){for(;t<e.length&&/\s/.test(e[t]);)t+=1;return t}_chunkA5EIY3HIcjs.a.call(void 0, te,"skipWhitespace");function tt(e,t){let n=e[t];if(n!=="'"&&n!=='"')return;let r=t,a="";for(t+=1;t<e.length;t+=1){let s=e[t];if(s===n)return{value:a,offset:r,excerpt:e.slice(r,t+1)};s==="\\"&&t+1<e.length?(a+=e[t+1],t+=1):a+=s}}_chunkA5EIY3HIcjs.a.call(void 0, tt,"readString");function se(e,t,n){return e.startsWith(t,n)&&!kt(e[n-1])&&!kt(e[n+t.length])}_chunkA5EIY3HIcjs.a.call(void 0, se,"isWordAt");function Us(e,t){let n=te(e,t);if(e[n]!=="{")return!1;n+=1;let r=!1;for(;n<e.length;){if(n=te(e,n),e[n]==="}")return r;if(e[n]===","){n+=1;continue}if(!se(e,"type",n))return!1;let a=te(e,n+4);if(a>=e.length||e[a]===","||e[a]==="}"||se(e,"as",a)||!Ks(e[a]))return!1;for(n=a;n<e.length&&kt(e[n]);)n+=1;if(n=te(e,n),se(e,"as",n)){if(n=te(e,n+2),!Ks(e[n]))return!1;for(;n<e.length&&kt(e[n]);)n+=1}r=!0}return!1}_chunkA5EIY3HIcjs.a.call(void 0, Us,"bracedNamedBindingsAreTypeOnly");function ol(e,t){if(t=te(e,t+6),e[t]==="(")return tt(e,te(e,t+1));let n=!1;if(se(e,"type",t)){let a=te(e,t+4);e[a]!==","&&!se(e,"from",a)&&(n=!0)}else Us(e,t)&&(n=!0);let r=Vs(e,t,!0);return r&&n?{...r,typeOnly:!0}:r}_chunkA5EIY3HIcjs.a.call(void 0, ol,"specifierAfterImport");function il(e,t){t=t+6;let n=te(e,t),r=!1;if(se(e,"type",n)){let s=te(e,n+4);(e[s]==="{"||e[s]==="*")&&(r=!0)}else Us(e,n)&&(r=!0);let a=Vs(e,t,!1);return a&&r?{...a,typeOnly:!0}:a}_chunkA5EIY3HIcjs.a.call(void 0, il,"specifierAfterExport");function Vs(e,t,n){for(;t<e.length;t+=1){if(e[t]===";")return;if(se(e,"from",t))return tt(e,te(e,t+4));if(n&&(e[t]==="'"||e[t]==='"'))return tt(e,t);if(t>0&&(se(e,"import",t)||se(e,"export",t)))return}}_chunkA5EIY3HIcjs.a.call(void 0, Vs,"specifierInStaticStatement");function ll(e,t){for(t+=1;t<e.length;t+=1){let n=e[t];if(n==="\\")t+=1;else if(n==="`")return t}return e.length}_chunkA5EIY3HIcjs.a.call(void 0, ll,"skipTemplateLiteral");function cl(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n-=1;if(e[n]===".")return;let r=te(e,t+7);if(e[r]!=="(")return;r=te(e,r+1);let a=tt(e,r);return a?{...a,requireCall:!0}:void 0}_chunkA5EIY3HIcjs.a.call(void 0, cl,"specifierAfterRequire");function dl(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n];if(r==="/"&&e[n+1]==="/"){if(n=e.indexOf(`
|
|
13
|
-
`,n+2),n<0)break;continue}if(r==="/"&&e[n+1]==="*"){let s=e.indexOf("*/",n+2);if(s<0)break;n=s+1;continue}if(r==="`"){n=
|
|
14
|
-
`).length;r.push({file:e.path,symbol:s,capability:
|
|
15
|
-
`).length,l={kind:"import",file:e.path,line:o,excerpt:a.excerpt},c=ul(e.path,s,t);n.push({from:e.path,specifier:s,to:_nullishCoalesce(_optionalChain([c, 'optionalAccess', _103 => _103.path]), () => (null)),resolution:c?"resolved":"unresolved",fromLayer:e.layer,toLayer:_nullishCoalesce(_optionalChain([c, 'optionalAccess', _104 => _104.layer]), () => (null)),evidence:l})}return{edges:n,capabilityUses:r}}_chunkA5EIY3HIcjs.a.call(void 0, Gs,"moduleFactsFor");function ul(e,t,n){let r=e.split("/");r.pop();for(let s of t.split("/"))s==="."||s===""||(s===".."?r.pop():r.push(s));let a=r.join("/");for(let s of[a,`${a}.ts`,`${a}.tsx`,`${a}.mts`,`${a}.cts`,`${a}/index.ts`,`${a}/index.tsx`]){let o=n.get(s);if(o)return o}}_chunkA5EIY3HIcjs.a.call(void 0, ul,"resolveSpecifier");function js(e,t){let n=[];for(let r of e){if(!r.to||!r.fromLayer||!r.toLayer)continue;let a=_chunkRNQHRDCQcjs.O.call(void 0, t.rules,r.fromLayer,r.toLayer,{fromPath:r.from,toPath:r.to,layers:t.layers});if(!a)continue;let s=a.rule;n.push({ruleId:`layer-dependency:${s.from}->${s.to}`,message:_nullishCoalesce(_chunkRNQHRDCQcjs.J.call(void 0, s,a.sliceVerdict), () => (`${s.from} must not depend on ${s.to}.`)),edge:r,evidence:r.evidence})}return n}_chunkA5EIY3HIcjs.a.call(void 0, js,"violationsFor");var pl={code:"LEXICAL_EVIDENCE_INCOMPLETE",message:"Lexical compatibility mode cannot prove parse status, TypeScript/package/symlink resolution, or symbol-aware source-policy and safety evidence. Use the resolved candidate facts APIs for an authoritative verdict."};function fl(e,t){return e.arkRules!==void 0&&Object.keys(e.arkRules).length>0||t.structure.length>0||t.invariants.length>0}_chunkA5EIY3HIcjs.a.call(void 0, fl,"hasActiveArkRules");function gl(e,t){return fl(e,t)?Z(W(ms({config:e,arkRules:t,warnings:[]}))):Z(W(cn(e)))}_chunkA5EIY3HIcjs.a.call(void 0, gl,"policyHashFor");function vt(e,t,n){let r=typeof e=="string"?_chunkRNQHRDCQcjs.ca.call(void 0, e,t):_chunkRNQHRDCQcjs.ba.call(void 0, e,t),a=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _105 => _105.arkRules]), () => (Je()));return{...r,arkRules:a,policyHash:gl(r.config,a)}}_chunkA5EIY3HIcjs.a.call(void 0, vt,"loadContract");function Bs(e){let t=vt(e.baseConfig,_nullishCoalesce(e.baseSource, () => ("base ark.config.json")),{arkRules:e.baseArkRules}),n=vt(e.candidateConfig,_nullishCoalesce(e.candidateSource, () => ("candidate ark.config.json")),{arkRules:e.candidateArkRules}),r=vn(t.config,n.config,{baseArkRules:t.arkRules,candidateArkRules:n.arkRules,candidateInvariantCoverage:e.candidateInvariantCoverage}),a=r.findings.filter(l=>l.classification==="weakening"||l.classification==="judgment-required").map(l=>l.id).sort(),s=a.length>0,o=s&&In(e.acknowledgement,{basePolicyHash:t.policyHash,candidatePolicyHash:n.policyHash,findingIds:a});return{schemaVersion:r.schemaVersion,basePolicyHash:t.policyHash,candidatePolicyHash:n.policyHash,classification:r.classification,findings:r.findings,blockingFindingIds:a,requiresAcknowledgement:s,acknowledged:o,valid:!s||o}}_chunkA5EIY3HIcjs.a.call(void 0, Bs,"analyzePolicyDelta");function nt(e){let t=e.files.map(h=>{let p=_e(h.path);return{path:p,content:h.content,contentHash:Z(h.content),layer:_nullishCoalesce(_chunkRNQHRDCQcjs.B.call(void 0, p,e.contract.config.layers), () => (null))}}).sort((h,p)=>h.path.localeCompare(p.path)),n=new Map(t.map(h=>[h.path,h])),r=[],a=[];for(let h of t){let p=Gs(h,n);r.push(...p.edges),a.push(...p.capabilityUses)}let s=js(r,e.contract.config),o=new Map(e.contract.config.layers.map(h=>[h.name,h])),l=new Map(e.contract.config.layers.map(h=>[h.name,new Set(we(h))]));for(let h of a){let p=_optionalChain([n, 'access', _106 => _106.get, 'call', _107 => _107(h.file), 'optionalAccess', _108 => _108.layer]);if(!p)continue;let R=o.get(p),u=Re(h.symbol,_nullishCoalesce(_optionalChain([R, 'optionalAccess', _109 => _109.forbiddenGlobals]), () => ([])));if(u){s.push({ruleId:"FORBIDDEN_GLOBAL",message:`${p} must not use module "${h.symbol}" because it is the import form of forbidden global "${u}".`,symbol:h.symbol,evidence:h.evidence});continue}_optionalChain([l, 'access', _110 => _110.get, 'call', _111 => _111(p), 'optionalAccess', _112 => _112.has, 'call', _113 => _113(h.capability)])&&s.push({ruleId:"CAPABILITY_VIOLATION",message:`${p} denies the ${h.capability} capability; found import of "${h.symbol}".`,capability:h.capability,symbol:h.symbol,evidence:h.evidence})}let c=t.length===0?"complete":"partial",f=c==="complete"?[]:[{...pl}],g={schemaVersion:ln,policyHash:e.contract.policyHash,compilerOptionsHash:Z(W(_nullishCoalesce(e.compilerOptions, () => ({})))),files:t,layers:e.contract.config.layers.map(h=>h.name),edges:r,capabilityUses:a,violations:s};return{mode:"lexical-compatibility",completeness:c,completenessReasons:f,valid:c==="complete"&&s.length===0,ir:g}}_chunkA5EIY3HIcjs.a.call(void 0, nt,"analyzeProject");function It(e){let t=new Map(e.files.map(n=>[_e(n.path),n]));for(let n of e.changes){let r=_e(n.path);"delete"in n&&n.delete?t.delete(r):"content"in n&&t.set(r,{path:r,content:n.content})}return nt({contract:e.contract,files:[...t.values()],compilerOptions:e.compilerOptions})}_chunkA5EIY3HIcjs.a.call(void 0, It,"analyzeChange");function zs(e){let t=`${e.evidence.file}:${e.evidence.line}`;if(!e.edge)return`${e.ruleId} at ${t}: ${e.message}`;let n=_nullishCoalesce(e.edge.to, () => (e.edge.specifier));return`${e.ruleId} at ${t}: ${e.edge.from} imports ${n}. ${e.message}`}_chunkA5EIY3HIcjs.a.call(void 0, zs,"explainViolation");function En(e){let t=0,n=new Map,r=new Map,a=new Set,s=[],o=[],l=_chunkA5EIY3HIcjs.a.call(void 0, c=>{n.set(c,t),r.set(c,t),t+=1,s.push(c),a.add(c);for(let h of[..._nullishCoalesce(e.get(c), () => ([]))].sort())e.has(h)&&(n.has(h)?a.has(h)&&r.set(c,Math.min(_nullishCoalesce(r.get(c), () => (0)),_nullishCoalesce(n.get(h), () => (0)))):(l(h),r.set(c,Math.min(_nullishCoalesce(r.get(c), () => (0)),_nullishCoalesce(r.get(h), () => (0))))));if(r.get(c)!==n.get(c))return;let f=[],g;do{if(g=s.pop(),g===void 0)break;a.delete(g),f.push(g)}while(g!==c);f.length>1&&o.push(f.sort())},"connect");for(let c of[...e.keys()].sort())n.has(c)||l(c);return o.sort((c,f)=>c[0]<f[0]?-1:c[0]>f[0]?1:0).map(c=>({ruleId:"CIRCULAR_DEPENDENCY",file:c[0],line:1,target:c.join(" \u2192 "),message:`Circular dependency among ${c.length} files: ${c.join(" \u2192 ")} \u2192 ${c[0]}.`,cycleKind:"value"}))}_chunkA5EIY3HIcjs.a.call(void 0, En,"detectArchitectureCycles");function He(e){let t=e.contentViolations.map(s=>({...s})),n=(_nullishCoalesce(e.warnings, () => ([]))).map(s=>({...s})),r=new Map(e.files.map(s=>[s,new Set]));for(let s of e.edges){if(s.to&&s.to!==s.from&&!s.typeOnly&&r.has(s.from)&&_optionalChain([r, 'access', _114 => _114.get, 'call', _115 => _115(s.from), 'optionalAccess', _116 => _116.add, 'call', _117 => _117(s.to)]),!s.to||!s.fromLayer||!s.toLayer)continue;let o=_chunkRNQHRDCQcjs.O.call(void 0, e.rules,s.fromLayer,s.toLayer,{fromPath:s.from,toPath:s.to,layers:e.config.layers});if(!o){let p=_chunkRNQHRDCQcjs.P.call(void 0, e.rules,s.fromLayer,s.toLayer,{fromPath:s.from,toPath:s.to,layers:e.config.layers});p&&n.push({ruleId:"SHARED_IMPORTS_SLICE",file:p.fromPath,line:s.line,fromLayer:s.fromLayer,toLayer:s.toLayer,target:p.toPath,toSlice:p.toSlice,failsStrict:!1,severity:"warning",message:`shared root ${p.fromPath} \u2192 slice ${p.toSlice} (${p.toPath}). The wall is direct-only.`});continue}let l=o.rule,c=!!l.peerIsolation,f=!c&&!!(s.typeOnly||s.namedBindingsTypeOnly),g=o.sliceVerdict,h=g?_chunkRNQHRDCQcjs.K.call(void 0, {surface:"import",verdict:g,fromLayer:s.fromLayer,toLayer:s.toLayer,kind:s.kind,fromPath:s.from,toPath:s.to,ruleMessage:l.message,childMessage:_optionalChain([l, 'access', _118 => _118.childSlices, 'optionalAccess', _119 => _119.message])}):_nullishCoalesce(l.message, () => (`${s.fromLayer} must not ${s.kind} ${s.toLayer}.`));t.push({ruleId:"LAYER_IMPORT_VIOLATION",file:s.from,line:s.line,fromLayer:s.fromLayer,toLayer:s.toLayer,target:s.to,...s.typeOnly?{typeOnly:!0}:{},...s.targetTypeOnlyExports?{targetTypeOnlyExports:!0}:{},...s.sourcePureTypeModule?{sourcePureTypeModule:!0}:{},...s.namedBindingsTypeOnly?{namedBindingsTypeOnly:!0}:{},...!c&&s.portProofEligible?{portProofEligible:!0}:{},...s.kind?{edgeKind:s.kind}:{},...c?{peerIsolation:!0}:{},..._chunkRNQHRDCQcjs.L.call(void 0, g),message:f?`${h} (type-only \u2014 type placement debt; prefer SharedTypes / owning layer; not runtime coupling)`:h,...f?{failsStrict:!1,severity:"warning"}:{}})}t.push(...hl(e));let a=String(_nullishCoalesce(e.config.cyclePolicy, () => ("strict"))).toLowerCase();if(a!=="off"){let s=En(r);a==="soft"||a==="framework-soft"?n.push(...s.map(o=>({...o,message:`${o.message} (soft cycle policy \u2014 advisory only; set cyclePolicy: "strict" to fail the check)`,failsStrict:!1}))):t.push(...s)}return{violations:t,warnings:n,safety:e.safety}}_chunkA5EIY3HIcjs.a.call(void 0, He,"evaluateArchitectureGraph");var ml="CROSS_PARENT_VIA_SHARED",yl="ark-check and CI report this path. The write hook and ESLint see one edge at a time and do not block it.";function Ws(e,t,n){for(let r of _nullishCoalesce(e, () => ([])))if(!(r.from!==t||r.to!==n)&&!(r.allowed!==!1||!r.peerIsolation)&&_chunkRNQHRDCQcjs.x.call(void 0, r.sharedImportsSlice)==="deny-cross-parent")return r}_chunkA5EIY3HIcjs.a.call(void 0, Ws,"denyingCrossParentRule");function bn(e,t,n,r){let a=_chunkRNQHRDCQcjs.G.call(void 0, n,e,_chunkRNQHRDCQcjs.Q.call(void 0, e,t,r)).universeId;return a?{kind:"slice",id:a}:_chunkRNQHRDCQcjs.D.call(void 0, n,e.sharedRoots)?{kind:"shared"}:{kind:"other"}}_chunkA5EIY3HIcjs.a.call(void 0, bn,"placeFile");function qs(e,t){return _chunkRNQHRDCQcjs.F.call(void 0, t,_chunkRNQHRDCQcjs.y.call(void 0, e.sharedImportsSlice))}_chunkA5EIY3HIcjs.a.call(void 0, qs,"isWalkStop");function hl(e){let t=_nullishCoalesce(e.rules, () => ([]));if(!t.some(s=>_chunkRNQHRDCQcjs.x.call(void 0, s.sharedImportsSlice)==="deny-cross-parent"))return[];let n=new Map;for(let s of e.edges){let o=Rl(s);if(!o)continue;let l=n.get(o.from);l?l.push(o):n.set(o.from,[o])}for(let s of n.values())s.sort((o,l)=>o.to<l.to?-1:o.to>l.to?1:o.line-l.line);let r=new Map,a=[...n.values()].flat();a.sort((s,o)=>s.from<o.from?-1:s.from>o.from?1:s.to<o.to?-1:s.to>o.to?1:0);for(let s of a){let o=Ws(t,s.fromLayer,s.toLayer);if(!o)continue;let l=bn(o,s.fromLayer,s.from,e.config.layers),c=bn(o,s.fromLayer,s.to,e.config.layers);if(l.kind!=="slice"||c.kind!=="shared"||qs(o,s.to))continue;let f=[{file:s.to,path:[s.from,s.to]}],g=new Set([s.to]);for(;f.length>0;){let h=f.shift();if(!h)break;for(let p of _nullishCoalesce(n.get(h.file), () => ([]))){let R=Ws(t,p.fromLayer,p.toLayer);if(!R)continue;let u=bn(R,p.fromLayer,p.to,e.config.layers);if(u.kind==="shared"){if(g.has(p.to)||qs(R,p.to))continue;g.add(p.to),f.push({file:p.to,path:[...h.path,p.to]});continue}if(u.kind!=="slice"||u.id.toLowerCase()===l.id.toLowerCase()||_chunkRNQHRDCQcjs.E.call(void 0, o.allowedCrossSlice,l.id,u.id))continue;if(o.sliceIdentity==="stars"){let b=_chunkRNQHRDCQcjs.H.call(void 0, o,_chunkRNQHRDCQcjs.Q.call(void 0, o,s.fromLayer,e.config.layers),s.from,p.to);if(b.crossSliceAllowed||b.from.universeId&&b.from.universeId===b.to.universeId)continue}let m=[...h.path,p.to],v=`${s.from}\0${p.to}`,w={file:s.from,target:p.to,line:s.line,fromLayer:s.fromLayer,toLayer:p.toLayer,fromSlice:l.id,toSlice:u.id,path:m},A=r.get(v);(!A||m.length<A.path.length||m.length===A.path.length&&m.join("\0")<A.path.join("\0"))&&r.set(v,w)}}}return[...r.values()].sort((s,o)=>s.file<o.file?-1:s.file>o.file?1:s.target<o.target?-1:s.target>o.target?1:0).map(s=>{let o=_chunkRNQHRDCQcjs.I.call(void 0, s.fromSlice),l=_chunkRNQHRDCQcjs.I.call(void 0, s.toSlice);return{ruleId:"LAYER_IMPORT_VIOLATION",reasonId:ml,file:s.file,line:s.line,fromLayer:s.fromLayer,toLayer:s.toLayer,target:s.target,peerIsolation:!0,...o&&l?{universeFrom:o,universeTo:l}:{},via:s.path.slice(1,-1),message:`${s.fromLayer} reaches ${s.toLayer} in another universe through a shared root (${s.path.join(" \u2192 ")}): cross-parent via shared ${s.fromSlice} \u2192 ${s.toSlice}. ${yl}`}})}_chunkA5EIY3HIcjs.a.call(void 0, hl,"crossParentViaSharedViolations");function Rl(e){if(!(!e.to||e.to===e.from||!e.fromLayer||!e.toLayer))return{from:e.from,to:e.to,line:e.line,fromLayer:e.fromLayer,toLayer:e.toLayer}}_chunkA5EIY3HIcjs.a.call(void 0, Rl,"valueHop");function Ys(e){if(typeof e.target=="string"&&e.target.length>0)return e.target;let t=String(e.sensor||e.code||"").trim();if(!t&&typeof e.message=="string"){let r=e.message.match(/\(sensor ([a-z0-9-]+)\)/i);_optionalChain([r, 'optionalAccess', _120 => _120[1]])&&(t=r[1])}let n=String(e.symbol||"").trim();return t?n?`${t}:${n}`:t:n}_chunkA5EIY3HIcjs.a.call(void 0, Ys,"structureFreezeTarget");var Al=/\bfrom\s+['"](?:@?prisma\/client|@supabase\/|drizzle-orm(?:\/[^'"]+)?|postgres(?:\/[^'"]+)?|typeorm|knex|mongodb|pg|mysql2|mongoose|better-sqlite3|ioredis|redis|kysely|sequelize)['"]|require\(\s*['"](?:@?prisma\/client|pg|postgres(?:\/[^'"]+)?|drizzle-orm(?:\/[^'"]+)?|knex|typeorm|mongoose)/,kl=/\bfrom\s+['"](?:@\/|~\/)?(?:[\w.-]+\/)*(?:db|database|prisma|drizzle|orm)(?:\.[cm]?[jt]sx?)?['"]|require\(\s*['"](?:@\/|~\/)?(?:[\w.-]+\/)*(?:db|database|prisma|drizzle|orm)/,vl=/\bimport\s+(?:type\s+)?\{([^}]*)\}\s*from\s*['"](?:@\/|~\/)?(?:[\w.-]+\/)*(?:db|database|prisma|drizzle|orm)(?:\.[cm]?[jt]sx?)?['"]/g,Il=["db","tx","client","prisma","prismaClient","drizzle"],bl="(?:insert(?:One|Many)?|update(?:One|Many)?|upsert|delete(?:One|Many)?|createMany|create|replaceOne|findOneAnd(?:Update|Delete|Replace))",El="\\bINSERT\\s+INTO\\b|\\bUPDATE\\s+[A-Za-z_][\\w.]*\\s+SET\\b|\\bDELETE\\s+FROM\\b",Xs="\\((?:[^()]|\\([^()]*\\))*\\)",Sl=`\\bnew\\s+PrismaClient\\s*${Xs}|\\bdrizzle\\s*${Xs}`,Cl=/(?<![\w$])([A-Za-z_$][\w$]*)\s*[?!]?\s*(?::[^=;\n]+)?=(?![=>])\s*(?:await\s+)?(?:new\s+(?:PrismaClient|Pool|Client|MongoClient|Sequelize|Kysely|Knex)\b|(?:drizzle|knex|Knex|postgres)\s*\()/g,_l=/(?<![\w$])([A-Za-z_$][\w$]*)\s*[?!]?\s*:\s*(?:Readonly\s*<\s*)?(?:Prisma\s*\.\s*TransactionClient|PrismaClient|Pool|PoolClient|MongoClient|Sequelize|Kysely|Knex|DataSource|EntityManager|NodePgDatabase|PostgresJsDatabase|BetterSQLite3Database|MySql2Database|LibSQLDatabase)\b/g;function Ol(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}_chunkA5EIY3HIcjs.a.call(void 0, Ol,"escapeRegExp");function bt(e){return Al.test(e)||kl.test(e)}_chunkA5EIY3HIcjs.a.call(void 0, bt,"sourceImportsPersistenceDriverText");function Zs(e,t,n){let r=new RegExp(e.source,"g"),a;for(;(a=r.exec(t))!==null;)a[1]&&n.add(a[1])}_chunkA5EIY3HIcjs.a.call(void 0, Zs,"collectFirstGroup");function xl(e){let t=new Set;Zs(Cl,e,t),Zs(_l,e,t);let n=new RegExp(vl.source,"g"),r;for(;(r=n.exec(e))!==null;)for(let a of(_nullishCoalesce(r[1], () => (""))).split(",")){let s=a.trim().replace(/^type\s+/,"").split(/\s+as\s+/),o=(_nullishCoalesce(_nullishCoalesce(s[1], () => (s[0])), () => (""))).trim();/^[A-Za-z_$][\w$]*$/.test(o)&&t.add(o)}return[...t].sort()}_chunkA5EIY3HIcjs.a.call(void 0, xl,"persistenceClientBindings");function Sn(e){let t=[...Il,...xl(e)].map(Ol).join("|");return new RegExp(`(?:\\b(?:${t})(?![\\w$])|${Sl})(?:\\s*\\.\\s*[A-Za-z_]\\w*)*\\s*\\.\\s*${bl}\\s*\\(|${El}`,"i").test(e)}_chunkA5EIY3HIcjs.a.call(void 0, Sn,"sourceHasPersistenceWrite");var wl=["no-anemic-model"],ea=["ensureInvariants","assertInvariants","validate","publish","emit","raise","record"],_u=new RegExp(`\\b(${ea.join("|")})\\b`),ta="(?:_?pendingEvents|domainEvents|uncommittedEvents|recordedEvents)",Ou=new RegExp(`\\bthis\\.${ta}\\.push\\s*\\(`),xu=new RegExp(`^this\\.${ta}\\s*=\\s*\\[\\s*\\]`);function Tl(){return`${ea.join(", ")}, or events-array .push(`}_chunkA5EIY3HIcjs.a.call(void 0, Tl,"expectedDomainInvariantWordsPhrase");function na(e){return typeof e.truncatedUntil=="number"?e.truncatedUntil:void 0}_chunkA5EIY3HIcjs.a.call(void 0, na,"shapeTruncatedUntil");function Nl(e){let t=na(e);return t==null?"":` shape analysed until character ${t}`}_chunkA5EIY3HIcjs.a.call(void 0, Nl,"shapeTruncationSuffix");function Js(e){return/[.*+?^${}()|[\]\\]/.test(e)?`\\${e}`:e}_chunkA5EIY3HIcjs.a.call(void 0, Js,"escapeGlobLiteral");function Pl(e){let t="";for(let r=0;r<e.length;r+=1){let a=e[r];if(a==="\\"&&r+1<e.length){let s=e[r+1];if("*?{}[],".includes(s)||s==="\\"){t+="\\"+s,r+=1;continue}t+="/";continue}t+=a}let n="";for(let r=0;r<t.length;r+=1){let a=t[r];a==="\\"&&r+1<t.length?(n+=Js(t[r+1]),r+=1):a==="*"?t[r+1]==="*"?t[r+2]==="/"?(n+="(?:.*/)?",r+=2):(n+=".*",r+=1):n+="[^/]*":a==="?"?n+="[^/]":n+=Js(a)}return new RegExp(`^${n}$`)}_chunkA5EIY3HIcjs.a.call(void 0, Pl,"globToRegExp");function Ke(e,t){return!t||t.length===0?!0:t.some(n=>Pl(n).test(e))}_chunkA5EIY3HIcjs.a.call(void 0, Ke,"matchesAppliesTo");function ra(e){return wl.includes(e)}_chunkA5EIY3HIcjs.a.call(void 0, ra,"isTier2");function sa(e){return e.mode==="enforced"&&!ra(e.sensor)?{severity:"error",failsStrict:!0}:{severity:"warning",failsStrict:!1}}_chunkA5EIY3HIcjs.a.call(void 0, sa,"severityFor");function ve(e,t,n,r=1){let{severity:a,failsStrict:s}=sa(e);return{ruleId:"ARKRULE_STRUCTURE",code:e.sensor,message:n,file:t,line:r,fromLayer:e.provenance.layer,arkruleId:e.id,arkruleSource:e.provenance.sourceFile,severity:a,sensor:e.sensor,failsStrict:s}}_chunkA5EIY3HIcjs.a.call(void 0, ve,"baseViolation");function Et(e,t,n){if(!n)return!0;let r=n(e);return r?r===t.provenance.layer:!1}_chunkA5EIY3HIcjs.a.call(void 0, Et,"isInRuleLayer");function St(e,t,n){return t.filter(r=>!(!r.exported||!Ke(r.file,e.appliesTo)||!Et(r.file,e,n)))}_chunkA5EIY3HIcjs.a.call(void 0, St,"shapesForRule");function Cn(e,t,n){let r=na(t);if(r!=null)return ve(e,t.file,`Exported class ${t.className} shape analysed until character ${r}; later ${n} may be invisible (sensor ${e.sensor}).`)}_chunkA5EIY3HIcjs.a.call(void 0, Cn,"truncatedShapeViolation");function Ll(e,t,n){let r=[];for(let a of St(e,t,n)){let s=Cn(e,a,"members");s&&r.push(s),(a.hasPublicSetters||a.hasPublicMutableFields)&&r.push(ve(e,a.file,`Exported class ${a.className} exposes public mutable state (sensor aggregate-private-state).`))}return r}_chunkA5EIY3HIcjs.a.call(void 0, Ll,"evaluateAggregatePrivateState");function Dl(e,t,n){let r=[];for(let a of St(e,t,n)){let s=Cn(e,a,"constructors and factories");if(s&&r.push(s),a.hasPublicConstructor&&!a.hasStaticFactory){if(!(a.hasPublicMutableFields||a.hasPublicSetters||(_nullishCoalesce(_optionalChain([a, 'access', _121 => _121.mutatingMethods, 'optionalAccess', _122 => _122.length]), () => (0)))>0))continue;r.push(ve(e,a.file,`Exported class ${a.className} exposes a public constructor without a static factory (sensor always-valid-factory).`))}}return r}_chunkA5EIY3HIcjs.a.call(void 0, Dl,"evaluateAlwaysValidFactory");function Fl(e,t,n){let r=[],a=Tl();for(let s of St(e,t,n)){let o=Nl(s),l=Cn(e,s,"methods");l&&r.push(l);for(let c of s.mutatingMethods)c.referencesGuardOrPublish||r.push(ve(e,s.file,`Mutating method ${s.className}.${c.name} does not reference ${a} (sensor domain-event-on-mutation).${o}`))}return r}_chunkA5EIY3HIcjs.a.call(void 0, Fl,"evaluateDomainEventOnMutation");function $l(e,t){let n=[];for(let r of t.files)Ke(r,e.appliesTo)&&Et(r,e,t.layerForFile)&&_optionalChain([t, 'access', _123 => _123.fileHints, 'optionalAccess', _124 => _124[r], 'optionalAccess', _125 => _125.orchestrationHeavy])&&n.push(ve(e,r,"File appears to embed domain branching beyond guard-and-delegate orchestration (sensor orchestration-only)."));return n}_chunkA5EIY3HIcjs.a.call(void 0, $l,"evaluateOrchestrationOnly");function Ml(e,t){let n=[];for(let r of t.files)Ke(r,e.appliesTo)&&Et(r,e,t.layerForFile)&&_optionalChain([t, 'access', _126 => _126.fileHints, 'optionalAccess', _127 => _127[r], 'optionalAccess', _128 => _128.adapterThick])&&n.push(ve(e,r,"Adapter module mixes domain branching, persistence, and mapping beyond a thin adapter (sensor thin-adapter)."));return n}_chunkA5EIY3HIcjs.a.call(void 0, Ml,"evaluateThinAdapter");function Hl(e,t){let n=[];for(let r of t.files)Ke(r,e.appliesTo)&&Et(r,e,t.layerForFile)&&_optionalChain([t, 'access', _129 => _129.fileHints, 'optionalAccess', _130 => _130[r], 'optionalAccess', _131 => _131.persistenceWrite])&&n.push(ve(e,r,"File imports a persistence driver and issues a write; route the write through a Domain aggregate and a persistence adapter (sensor writes-via-aggregate)."));return n}_chunkA5EIY3HIcjs.a.call(void 0, Hl,"evaluateWritesViaAggregate");function Kl(e,t,n){let r=[];for(let a of St(e,t,n))if(a.dataOnly===!0){let s=ve(e,a.file,`Exported type ${a.className} looks data-only / anemic (sensor no-anemic-model; advisory only).`);r.push({...s,severity:"warning",failsStrict:!1})}return r}_chunkA5EIY3HIcjs.a.call(void 0, Kl,"evaluateNoAnemicModel");function aa(e){if(!e.arkRules.structure.length)return[];let t=[];for(let n of e.arkRules.structure)switch(n.sensor){case"aggregate-private-state":t.push(...Ll(n,e.classShapes,e.layerForFile));break;case"always-valid-factory":t.push(...Dl(n,e.classShapes,e.layerForFile));break;case"domain-event-on-mutation":t.push(...Fl(n,e.classShapes,e.layerForFile));break;case"orchestration-only":t.push(...$l(n,e));break;case"thin-adapter":t.push(...Ml(n,e));break;case"writes-via-aggregate":t.push(...Hl(n,e));break;case"no-anemic-model":t.push(...Kl(n,e.classShapes,e.layerForFile));break;case"invariant-coverage":break;default:break}return t.sort((n,r)=>n.file.localeCompare(r.file)||n.arkruleId.localeCompare(r.arkruleId)||n.message.localeCompare(r.message))}_chunkA5EIY3HIcjs.a.call(void 0, aa,"evaluateArkRuleSensors");function oa(e,t){let n=[],r=t.map(a=>a.replace(/\\/g,"/"));for(let a of e.structure){if(!a.appliesTo||a.appliesTo.length===0||r.some(c=>Ke(c,a.appliesTo)))continue;let{severity:o,failsStrict:l}=sa(a);n.push({ruleId:"ARKRULE_SCOPE_EMPTY",code:"appliesTo-zero-match",message:`ArkRule structure "${a.id}" appliesTo matched zero governed files (patterns: ${a.appliesTo.join(", ")}). A zero-match scope is almost always misconfiguration.`,file:a.provenance.sourceFile,line:1,fromLayer:a.provenance.layer,arkruleId:a.id,arkruleSource:a.provenance.sourceFile,severity:o,sensor:a.sensor,failsStrict:l})}for(let a of _nullishCoalesce(e.invariants, () => ([]))){if(!a.appliesTo||a.appliesTo.length===0||r.some(l=>Ke(l,a.appliesTo)))continue;let o=a.mode==="enforced";n.push({ruleId:"ARKRULE_SCOPE_EMPTY",code:"appliesTo-zero-match",message:`ArkRule invariant "${a.id}" appliesTo matched zero governed files (patterns: ${a.appliesTo.join(", ")}). A zero-match scope is almost always misconfiguration.`,file:a.provenance.sourceFile,line:1,fromLayer:a.provenance.layer,arkruleId:a.id,arkruleSource:a.provenance.sourceFile,severity:o?"error":"warning",sensor:"invariant-coverage",failsStrict:o})}return n.sort((a,s)=>a.file.localeCompare(s.file)||a.arkruleId.localeCompare(s.arkruleId)||a.message.localeCompare(s.message))}_chunkA5EIY3HIcjs.a.call(void 0, oa,"collectEmptyAppliesToFindings");var Qs=64;function Ul(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===46;)t-=1;return t===e.length?e:e.slice(0,t)}_chunkA5EIY3HIcjs.a.call(void 0, Ul,"stripTrailingDots");function Vl(e){let t=e.trim(),n=t.length>Qs?t.slice(0,Qs):t;return Ul(n)}_chunkA5EIY3HIcjs.a.call(void 0, Vl,"normalizeIntentPrefix");function Gl(e){let t=e.toLowerCase();return t.includes("domain")||t.includes("entity")||t.includes("aggregate")||t.includes("model")}_chunkA5EIY3HIcjs.a.call(void 0, Gl,"layerNameLooksDomain");function jl(e){return e.some(t=>{let n=Vl(t);return n==="Domain"||n.startsWith("Domain.")})}_chunkA5EIY3HIcjs.a.call(void 0, jl,"ownsDomainIntent");function Bl(e,t=[]){return Gl(e)||jl(t)}_chunkA5EIY3HIcjs.a.call(void 0, Bl,"isDomainRoleLayerName");function ia(e){if(e.arkRulesActive!==!0)return[];let t=(_nullishCoalesce(e.layers, () => ([]))).filter(c=>Bl(c.name,_nullishCoalesce(c.intentPrefixes, () => ([])))).map(c=>c.name);if(t.length===0)return[];let n=new Set(t);if(!(_nullishCoalesce(e.files, () => ([]))).some(c=>{let f=typeof c.layer=="string"?c.layer:"";return f.length>0&&n.has(f)}))return[];if((_nullishCoalesce(e.arkRules.invariants, () => ([]))).filter(c=>n.has(c.provenance.layer)).length>0)return[];let s=_nullishCoalesce(t.find(c=>_optionalChain([e, 'access', _132 => _132.arkRules, 'access', _133 => _133.byLayer, 'optionalAccess', _134 => _134[c]])), () => (t[0])),o=_nullishCoalesce(_optionalChain([e, 'access', _135 => _135.arkRules, 'access', _136 => _136.byLayer, 'optionalAccess', _137 => _137[s], 'optionalAccess', _138 => _138.sourceFile]), () => (`arkrules/${s}.json`)),l=(_nullishCoalesce(e.arkRules.structure, () => ([]))).some(c=>c.mode==="enforced"&&n.has(c.provenance.layer)&&!ra(c.sensor));return[{ruleId:"INVARIANT_CATALOG_EMPTY",code:"invariant-catalog-empty",message:`ArkRules is on and ${s} has code, but invariants[] is empty \u2014 there are no phrases the code must preserve. Add 1\u20132 short phrases in ${o}.`,file:o,line:1,fromLayer:s,arkruleId:"invariant-catalog",arkruleSource:o,severity:l?"error":"warning",sensor:"invariant-coverage",failsStrict:l}]}_chunkA5EIY3HIcjs.a.call(void 0, ia,"collectEmptyInvariantCatalogFindings");function zl(e){return e==="PersistenceAdapters"}_chunkA5EIY3HIcjs.a.call(void 0, zl,"isPersistenceDriverLayer");function Wl(e,t){if(bt(e))return!0;if(!t)return!1;for(let n of t){if(zl(n.layer))return!0;let r=n.specifier;if(!r)continue;let a=`from '${r}'`;if(bt(a))return!0}return!1}_chunkA5EIY3HIcjs.a.call(void 0, Wl,"sourceImportsPersistenceDriver");var ql=/\b(?:@Controller|@Get|@Post|@Put|@Delete|Router\(\)|createRouter|express\.Router|fastify\.(?:get|post)|export\s+(?:async\s+)?function\s+(?:GET|POST|PUT|DELETE|PATCH)\b|export\s+const\s+(?:GET|POST|PUT|DELETE|PATCH)\s*=)/,Yl=/(?:^|[;\n])\s*(?:import\s+(?:type\s+)?(?:[^;]{0,512}?\s+from\s+)?|export\s+(?:type\s+)?[^;]{0,512}?\s+from\s+)['"]next\/server(?:\.js)?['"]/,Xl=/\b(?:export\s+)?(?:async\s+)?function\s+(?:can|calculate|compute|should|ensure|validate|is|has)[A-Z]\w*|\b(?:export\s+)?const\s+(?:can|calculate|compute|should|ensure|validate|is|has)[A-Z]\w*\s*=/,Zl=/\bif\s*\(\s*(?:!)?(?:order|invoice|cart|user|account|policy|aggregate|entity|amount|total|balance|status|state)\b/i;function Jl(e,t,n){if(!t)return null;let r=Wl(t,n),a=r&&Sn(t);if(t.length<40)return a?{persistenceWrite:!0}:null;let s=_nullishCoalesce(t.match(new RegExp(Xl.source,"g")), () => ([])),o=_nullishCoalesce(t.match(new RegExp(Zl.source,"g")), () => ([])),l=(_nullishCoalesce(t.match(/\bif\s*\(/g), () => ([]))).length,c=(_nullishCoalesce(t.match(/\bswitch\s*\(/g), () => ([]))).length,f=s.length>=2||s.length>=1&&o.length>=2||o.length>=3&&l+c>=6,g=ql.test(t)||Yl.test(t),h=s.length>=1||o.length>=2,p=/\b(?:mapTo|toDomain|toDto|fromRow|toEntity|fromPrisma|serialize|deserialize)\w*\s*[(=]/.test(t),R=r&&h||g&&h||r&&p&&(l>=4||s.length>=1)||g&&r;return!f&&!R&&!a?null:{...f?{orchestrationHeavy:!0}:{},...R?{adapterThick:!0}:{},...a?{persistenceWrite:!0}:{}}}_chunkA5EIY3HIcjs.a.call(void 0, Jl,"deriveArkRuleFileHints");function la(e,t){let n={};for(let[r,a]of Object.entries(e)){let s=r.replace(/\\/g,"/"),o=Jl(r,a,_optionalChain([t, 'optionalAccess', _139 => _139[s]]));o&&(n[s]=o)}return n}_chunkA5EIY3HIcjs.a.call(void 0, la,"buildArkRuleFileHints");function Ql(e){if(!e)return{};let t=typeof e.governedPercent=="number"?e.governedPercent:null,n=typeof e.populatedLayerCount=="number"?e.populatedLayerCount:null;return n==null&&typeof e.classifiedFiles=="number"&&(n=e.classifiedFiles>0?1:0),{governedPercent:t,populatedLayerCount:n}}_chunkA5EIY3HIcjs.a.call(void 0, Ql,"normalizeExtraMergeTeethClassification");function Ct(e){let t=Ql(e),n=typeof t.governedPercent=="number"?t.governedPercent:null,r=typeof t.populatedLayerCount=="number"?t.populatedLayerCount:null;return n==null&&r==null?!0:(_nullishCoalesce(n, () => (0)))>=50&&(_nullishCoalesce(r, () => (0)))>=1}_chunkA5EIY3HIcjs.a.call(void 0, Ct,"extraMergeTeethAllowed");function ca(e){let t=e.length,n=0,r=new Set;for(let a of e){let s=typeof a.layer=="string"&&a.layer.length>0?a.layer:null;s&&(n+=1,r.add(s))}return{governedPercent:t>0?Math.round(n/t*100):0,populatedLayerCount:r.size}}_chunkA5EIY3HIcjs.a.call(void 0, ca,"classifyResolvedLayerCoverage");var ec=["createArkKernel","createStrictArkKernel","createLenientArkKernel","createArkKernelFromConfig","createStrictArkKernelFromConfig","createLenientArkKernelFromConfig"];var tc=["forRoot","forRootAsync"],nc=["ArkKernel","EventBus","EventPublisher","ArkRunPublisher"];var Fu=new Set(tc),$u=new Set(nc);var Mu=new Set(ec);function da(e){return e==="@arkgate/runtime"||e.startsWith("@arkgate/runtime/")||e==="arkgate/runtime"||e.startsWith("arkgate/runtime/")||e==="arkgate/nestjs"||e.startsWith("arkgate/nestjs/")}_chunkA5EIY3HIcjs.a.call(void 0, da,"isArkRunKernelModuleSpecifier");var rc=["events","node:events","eventemitter2","eventemitter3","emittery","kafkajs","kafka-node","amqplib","amqp","bull","bullmq","mqtt","nats","@aws-sdk/client-sqs","@aws-sdk/client-sns","@aws-sdk/client-eventbridge","@google-cloud/pubsub","@azure/service-bus"],_n=new Set(rc);function ua(e){if(!e||e.startsWith(".")||e.startsWith("/"))return!1;if(_n.has(e))return!0;let t=e.indexOf("/");if(t<0)return!1;let n=e.slice(0,t);if(_n.has(n))return!0;let r=e.indexOf("/",t+1);return r<0?!1:_n.has(e.slice(0,r))}_chunkA5EIY3HIcjs.a.call(void 0, ua,"isArkRunTransportBypassSpecifier");var sc=["arkrun-kernel-in-domain","arkrun-direct-new","arkrun-transport-bypass"],qu=new Set(sc);var pa={"arkrun-missing-root":"ARKRUN_MISSING_ROOT","arkrun-kernel-in-domain":"ARKRUN_KERNEL_IN_DOMAIN","arkrun-direct-new":"ARKRUN_DIRECT_NEW","arkrun-undeclared-emit":"ARKRUN_UNDECLARED_EMIT","arkrun-undeclared-handle":"ARKRUN_UNDECLARED_HANDLE","arkrun-undeclared-depend":"ARKRUN_UNDECLARED_DEPEND","arkrun-transport-bypass":"ARKRUN_TRANSPORT_BYPASS"},ac="ARKRUN_INTERACTION_NAME_INCOMPLETE";function ma(e,t=[]){let n=e.trim();return/^domain(?:model)?$/i.test(n)||/^domain(?=[A-Z_\-\s])/i.test(n)||/^(?:entit(?:y|ies)|aggregates?)(?:$|(?=[A-Z_\-\s]))/i.test(n)?!0:t.some(r=>{let a=r.trim().replace(/\.+$/,"");return a==="Domain"||a.startsWith("Domain.")})}_chunkA5EIY3HIcjs.a.call(void 0, ma,"isDomainRoleLayer");function oc(e,t){return e.file.localeCompare(t.file)||e.ruleId.localeCompare(t.ruleId)||e.line-t.line||e.message.localeCompare(t.message)}_chunkA5EIY3HIcjs.a.call(void 0, oc,"compareFindings");function he(e,t,n,r,a,s,o){let l=e.mode==="enforced"&&o;return{ruleId:pa[t],sensor:t,message:a,file:n,line:r,..._optionalChain([s, 'optionalAccess', _140 => _140.fromLayer])?{fromLayer:s.fromLayer}:{},..._optionalChain([s, 'optionalAccess', _141 => _141.target])?{target:s.target}:{},severity:l?"error":"warning",failsStrict:l,nextAction:le({ruleId:pa[t],fromLayer:_optionalChain([s, 'optionalAccess', _142 => _142.fromLayer]),target:_optionalChain([s, 'optionalAccess', _143 => _143.target])})}}_chunkA5EIY3HIcjs.a.call(void 0, he,"finding");function ic(e,t){let n=[],r=[],a=[],s=[];for(let o of e)o.file===t&&(n.push(...o.uses),r.push(...o.reactsTo),a.push(...o.raises),s.push(...o.sends));return{uses:new Set(n),reactsTo:new Set(r),raises:new Set(a),sends:new Set(s)}}_chunkA5EIY3HIcjs.a.call(void 0, ic,"bagForFile");function fa(e){return e==="publisher"||e==="publish"||e==="raise"||e==="send"}_chunkA5EIY3HIcjs.a.call(void 0, fa,"emitKinds");function ga(e){return e==="subscribe"||e==="register-handler"}_chunkA5EIY3HIcjs.a.call(void 0, ga,"handleKinds");function lc(e){return e==="resolve"||e==="resolve-singleton"}_chunkA5EIY3HIcjs.a.call(void 0, lc,"dependKinds");function cc(e,t,n){let r=[],a=_nullishCoalesce(e.kernelRoots, () => (e.compositionRoots));if(a.length===0)return r.push(he(e,"arkrun-missing-root","ark.config.json",1,"ArkRun kernelRoots is empty; no createArkKernel factory site is declared.",void 0,n)),r;let s=new Map;for(let o of t){let l=_nullishCoalesce(s.get(o.matchedRoot), () => ([]));l.push(o),s.set(o.matchedRoot,l)}for(let o of a){let l=[..._nullishCoalesce(s.get(o), () => ([]))].sort((f,g)=>f.file.localeCompare(g.file));if(l.length===0){r.push(he(e,"arkrun-missing-root","ark.config.json",1,`ArkRun kernel root ${JSON.stringify(o)} matched no governed files and has no createArkKernel factory.`,{target:o},n));continue}if(l.some(f=>f.hasKernelFactory))continue;let c=l[0];r.push(he(e,"arkrun-missing-root",c.file,1,`ArkRun kernel root ${JSON.stringify(o)} has no kernel factory (createArkKernel / createStrictArkKernel / createLenientArkKernel / *FromConfig, or ArkModule.forRoot / forRootAsync from arkgate/nestjs).`,{target:o},n))}return r}_chunkA5EIY3HIcjs.a.call(void 0, cc,"evaluateMissingRoot");function dc(e,t,n,r,a){let s=new Map(t.map(l=>[l.name,_nullishCoalesce(l.intentPrefixes, () => ([]))])),o=[];for(let l of n){let c=l.specifier;if(!c||!da(c))continue;let f=r(l.from);f&&ma(f,_nullishCoalesce(s.get(f), () => ([])))&&o.push(he(e,"arkrun-kernel-in-domain",l.from,l.line,`${f} must not import kernel module ${JSON.stringify(c)}.`,{fromLayer:f,target:c},a))}return o}_chunkA5EIY3HIcjs.a.call(void 0, dc,"evaluateKernelInDomain");function uc(e,t,n,r,a,s){let o=new Set(e.managedLayers);if(o.size===0)return[];let l=new Map(t.map(g=>[g.name,_nullishCoalesce(g.intentPrefixes, () => ([]))])),c=new Set(r.filter(g=>g.hasKernelFactory).map(g=>g.file)),f=[];for(let g of n){if(c.has(g.file))continue;let h=g.typeName;if(e.ignoreDirectNewForErrors!==!1&&(h.endsWith("Error")||h==="Error")||h.endsWith("DTO")||h.endsWith("VO"))continue;let p=a(g.file);!p||!o.has(p)||ma(p,_nullishCoalesce(l.get(p), () => ([])))||f.push(he(e,"arkrun-direct-new",g.file,g.line,`${p} must not construct ${g.typeName} with new outside an ArkRun composition-root factory.`,{fromLayer:p,target:g.typeName},s))}return f}_chunkA5EIY3HIcjs.a.call(void 0, uc,"evaluateDirectNew");function pc(e,t,n,r,a){let s=[],o=[];if(e.requireDeclarations!==!0)return{findings:s,completenessReasons:o};let l=new Set(e.managedLayers);if(l.size===0)return{findings:s,completenessReasons:o};for(let c of t){if(!fa(c.kind)&&!ga(c.kind)&&!lc(c.kind))continue;let f=r(c.file);if(!f||!l.has(f))continue;if(!c.nameLiteral){e.mode==="enforced"&&c.kind!=="publisher"&&o.push({code:ac,file:c.file,message:`ArkRun ${c.kind} call in ${c.file} has no string-literal name or same-file define/defineIntent binding; enforced extra cannot prove the declaration.`});continue}let g=ic(n,c.file);if(fa(c.kind)){if(g.raises.has(c.nameLiteral)||g.sends.has(c.nameLiteral))continue;s.push(he(e,"arkrun-undeclared-emit",c.file,c.line,`Emit ${JSON.stringify(c.nameLiteral)} is not declared in raises or sends.`,{fromLayer:f,target:c.nameLiteral},a));continue}if(ga(c.kind)){if(g.reactsTo.has(c.nameLiteral))continue;s.push(he(e,"arkrun-undeclared-handle",c.file,c.line,`Handle ${JSON.stringify(c.nameLiteral)} is not declared in reactsTo.`,{fromLayer:f,target:c.nameLiteral},a));continue}g.uses.has(c.nameLiteral)||s.push(he(e,"arkrun-undeclared-depend",c.file,c.line,`Depend ${JSON.stringify(c.nameLiteral)} is not declared in uses.`,{fromLayer:f,target:c.nameLiteral},a))}return{findings:s,completenessReasons:o}}_chunkA5EIY3HIcjs.a.call(void 0, pc,"evaluateUndeclared");function fc(e,t,n,r){let a=new Set(e.managedLayers);if(a.size===0)return[];let s=[];for(let o of t){if(o.typeOnly)continue;let l=o.specifier;if(!l||!ua(l))continue;let c=n(o.from);!c||!a.has(c)||s.push(he(e,"arkrun-transport-bypass",o.from,o.line,`${c} must not import broker/queue/emitter ${JSON.stringify(l)}; use the ArkRun kernel transport.`,{fromLayer:c,target:l},r))}return s}_chunkA5EIY3HIcjs.a.call(void 0, fc,"evaluateTransportBypass");function ya(e){let t=e.arkRun;if(!t)return{findings:[],completenessReasons:[]};let n=Ct(e.classification),r=pc(t,e.kernelCalls,e.declarations,e.layerForFile,n),a=[...cc(t,e.compositionRootHits,n),...dc(t,e.layers,e.dependencies,e.layerForFile,n),...uc(t,e.layers,e.managedNews,e.compositionRootHits,e.layerForFile,n),...r.findings,...fc(t,e.dependencies,e.layerForFile,n)].sort(oc),s=[...r.completenessReasons].sort((o,l)=>{let c=`${o.code}\0${_nullishCoalesce(o.file, () => (""))}\0${o.message}`,f=`${l.code}\0${_nullishCoalesce(l.file, () => (""))}\0${l.message}`;return c<f?-1:c>f?1:0});return{findings:a,completenessReasons:s}}_chunkA5EIY3HIcjs.a.call(void 0, ya,"evaluateArkRunSensors");var ha=new Map;function Ra(e){return/[.*+?^${}()|[\]\\]/.test(e)?`\\${e}`:e}_chunkA5EIY3HIcjs.a.call(void 0, Ra,"escapeAppliesToLiteral");function gc(e){let t="";for(let n=0;n<e.length;n+=1){let r=e[n];if(r==="\\"&&n+1<e.length){let a=e[n+1];if("*?{}[],".includes(a)||a==="\\"){t+="\\"+a,n+=1;continue}t+="/";continue}t+=r}return t}_chunkA5EIY3HIcjs.a.call(void 0, gc,"normalizeAppliesToGlob");function mc(e){let t=0;for(let n=0;n<e.length;n+=1){let r=e[n];if(r==="\\"){n+=1;continue}if(r==="{")t+=1;else if(r==="}"&&(t-=1,t<0))return!1}return t===0}_chunkA5EIY3HIcjs.a.call(void 0, mc,"appliesToBracesBalanced");function Aa(e){let t=ha.get(e);if(t)return t;let n=gc(e),r=mc(n),a="",s=0;for(let l=0;l<n.length;l+=1){let c=n[l];c==="\\"&&l+1<n.length?(a+=Ra(n[l+1]),l+=1):c==="*"?n[l+1]==="*"?n[l+2]==="/"?(a+="(?:.*/)?",l+=2):(a+=".*",l+=1):a+="[^/]*":c==="?"?a+="[^/]":c==="{"&&r?(a+="(?:",s+=1):c==="}"&&r&&s>0?(a+=")",s-=1):c===","&&r&&s>0?a+="|":a+=Ra(c)}let o=new RegExp(`^${a}$`);return ha.set(e,o),o}_chunkA5EIY3HIcjs.a.call(void 0, Aa,"arkOrderGlobToRegExp");function ka(e){return e==="arkgate/order"||e.startsWith("arkgate/order/")}_chunkA5EIY3HIcjs.a.call(void 0, ka,"isArkOrderModuleSpecifier");var va={"arkorder-missing-plane":"ARKORDER_MISSING_PLANE","arkorder-kernel-in-domain":"ARKORDER_KERNEL_IN_DOMAIN","arkorder-generic-update":"ARKORDER_GENERIC_UPDATE","arkorder-too-many-params":"ARKORDER_TOO_MANY_PARAMS","arkorder-ingest-writes-xi":"ARKORDER_INGEST_WRITES_XI","arkorder-xi-field-write":"ARKORDER_XI_FIELD_WRITE","arkorder-information-budget":"ARKORDER_INFORMATION_BUDGET","arkorder-xi-ttl":"ARKORDER_XI_TTL"};function yc(e,t){return!t||t.length===0?!0:t.some(n=>Aa(n).test(e))}_chunkA5EIY3HIcjs.a.call(void 0, yc,"matchesArkOrderAppliesTo");function hc(e,t=[]){let n=e.trim();return/^domain(?:model)?$/i.test(n)||/^domain(?=[A-Z_\-\s])/i.test(n)?!0:t.some(r=>{let a=r.trim().replace(/\.+$/,"");return a==="Domain"||a.startsWith("Domain.")})}_chunkA5EIY3HIcjs.a.call(void 0, hc,"isDomainRoleLayer");function de(e,t,n,r,a,s,o){let l=e.mode==="enforced"&&o;return{ruleId:va[t],sensor:t,message:a,file:n,line:r,..._optionalChain([s, 'optionalAccess', _144 => _144.fromLayer])?{fromLayer:s.fromLayer}:{},..._optionalChain([s, 'optionalAccess', _145 => _145.target])?{target:s.target}:{},severity:l?"error":"warning",failsStrict:l,nextAction:le({ruleId:va[t],fromLayer:_optionalChain([s, 'optionalAccess', _146 => _146.fromLayer]),target:_optionalChain([s, 'optionalAccess', _147 => _147.target])})}}_chunkA5EIY3HIcjs.a.call(void 0, de,"finding");function Ia(e){let t=e.arkOrder;if(!t)return{findings:[],completenessReasons:[]};let n=Ct(e.classification),r=[],a=t.planeRoots;if(t.mode==="enforced"&&a.length===0)r.push(de(t,"arkorder-missing-plane","ark.config.json",1,"ArkOrder planeRoots is empty; no createOrderPlane site is declared.",void 0,n));else{let c=new Map;for(let f of e.planeRootHits){let g=_nullishCoalesce(c.get(f.matchedRoot), () => ([]));g.push(f),c.set(f.matchedRoot,g)}for(let f of a){let g=_nullishCoalesce(c.get(f), () => ([]));if(g.length===0){r.push(de(t,"arkorder-missing-plane","ark.config.json",1,`ArkOrder plane root ${JSON.stringify(f)} matched no governed files and has no createOrderPlane factory.`,{target:f},n));continue}g.some(h=>h.hasPlaneFactory)||r.push(de(t,"arkorder-missing-plane",g[0].file,1,`ArkOrder plane root ${JSON.stringify(f)} has no createOrderPlane factory.`,{target:f},n))}}let s=new Map(e.layers.map(c=>[c.name,_nullishCoalesce(c.intentPrefixes, () => ([]))]));for(let c of e.dependencies){let f=c.specifier;if(!f||!ka(f))continue;let g=e.layerForFile(c.from);g&&hc(g,_nullishCoalesce(s.get(g), () => ([])))&&r.push(de(t,"arkorder-kernel-in-domain",c.from,c.line,"Domain-role layer imports arkgate/order; Domain stays plane-free.",{fromLayer:g,target:f},n))}for(let c of e.genericUpdates)r.push(de(t,"arkorder-generic-update",c.file,c.line,`Generic ${c.method}() on the order plane rewrites \u03BE; Haken forbids it.`,{target:c.method},n));let o=_nullishCoalesce(t.xiKeys, () => ([]));for(let c of _nullishCoalesce(e.releaseKeyCounts, () => ([])))c.keyCount<=t.maxXiKeys||r.push(de(t,"arkorder-too-many-params",c.file,c.line,`release() freezes ${c.keyCount} keys; maxXiKeys is ${t.maxXiKeys} (few slow modes).`,{target:String(c.keyCount)},n));for(let c of _nullishCoalesce(e.ingestWritesXi, () => ([])))r.push(de(t,"arkorder-ingest-writes-xi",c.file,c.line,"ingest() result is assigned into a Release or \u03BE store; ingest may absorb or escalate, never mint a pattern.",void 0,n));for(let c of _nullishCoalesce(e.xiTtlKeys, () => ([])))r.push(de(t,"arkorder-xi-ttl",c.file,c.line,`\u03BE key ${JSON.stringify(c.key)} is a freshness field; freshness belongs on \u03C3 (freshUntil), never on \u03BE.`,{target:c.key},n));for(let c of _nullishCoalesce(e.budgetLeaks, () => ([])))r.push(de(t,"arkorder-information-budget",c.file,c.line,`Projection allowedKinds lists ${JSON.stringify(c.kind)}, which informationBudget.cannotObserve denies.`,{target:c.kind},n));let l=new Set(t.managedLayers);for(let c of o.length===0?[]:_nullishCoalesce(e.xiFieldWrites, () => ([]))){let f=e.layerForFile(c.file);!f||!l.has(f)||yc(c.file,t.appliesTo)&&r.push(de(t,"arkorder-xi-field-write",c.file,c.line,`This file writes ${JSON.stringify(c.key)} the same way it would write a seat count. Take the event in, or change that choice through the valve (propose, then apply).`,{fromLayer:f,target:c.key},n))}return r.sort((c,f)=>c.file.localeCompare(f.file)||c.ruleId.localeCompare(f.ruleId)||c.line-f.line),{findings:r,completenessReasons:[]}}_chunkA5EIY3HIcjs.a.call(void 0, Ia,"evaluateArkOrderSensors");var On="4.8.24";function xn(e){let t=e.childSlices;return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:null}_chunkA5EIY3HIcjs.a.call(void 0, xn,"childSlicesOf");var ba=Object.freeze([{key:"sharedImportsSlice.stopAt",minVersion:On,uses:_chunkA5EIY3HIcjs.a.call(void 0, e=>e.sharedImportsSlice!==null&&typeof e.sharedImportsSlice=="object","uses")},{key:"childSlices.message",minVersion:On,uses:_chunkA5EIY3HIcjs.a.call(void 0, e=>_optionalChain([xn, 'call', _148 => _148(e), 'optionalAccess', _149 => _149.message])!==void 0,"uses")},{key:"childSlices.siblings.ratchet",minVersion:On,uses:_chunkA5EIY3HIcjs.a.call(void 0, e=>{let t=_optionalChain([xn, 'call', _150 => _150(e), 'optionalAccess', _151 => _151.siblings]);return t!==null&&typeof t=="object"&&"ratchet"in t},"uses")},{key:"childSlices",minVersion:"4.8.23",uses:_chunkA5EIY3HIcjs.a.call(void 0, e=>xn(e)!==null,"uses")},{key:'sharedImportsSlice: "deny-cross-parent"',minVersion:"4.8.23",uses:_chunkA5EIY3HIcjs.a.call(void 0, e=>e.sharedImportsSlice==="deny-cross-parent","uses")},{key:"sliceIdentity",minVersion:"4.8.21",uses:_chunkA5EIY3HIcjs.a.call(void 0, e=>e.sliceIdentity!==void 0,"uses")},{key:"sharedImportsSlice",minVersion:"4.8.20",uses:_chunkA5EIY3HIcjs.a.call(void 0, e=>e.sharedImportsSlice==="deny","uses")}]);function _t(e){let t=/^v?(\d+)\.(\d+)\.(\d+)/.exec(String(e).trim());return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}_chunkA5EIY3HIcjs.a.call(void 0, _t,"versionCore");function rt(e,t){let n=_t(e),r=_t(t);if(!n&&!r)return 0;if(!n)return-1;if(!r)return 1;for(let a=0;a<3;a+=1){let s=_nullishCoalesce(n[a], () => (0)),o=_nullishCoalesce(r[a], () => (0));if(s<o)return-1;if(s>o)return 1}return 0}_chunkA5EIY3HIcjs.a.call(void 0, rt,"compareArkgateVersion");function Ea(e,t){return t&&_t(t)&&rt(t,e)<0?t.replace(/^v/,""):e}_chunkA5EIY3HIcjs.a.call(void 0, Ea,"effectiveFloor");function Rc(e,t){let n=[],r=null;for(let a of ba){if(!(_nullishCoalesce(e, () => ([]))).some(o=>o&&a.uses(o)))continue;n.push(a.key);let s=Ea(a.minVersion,t);(!r||rt(s,r)>0)&&(r=s)}return r?{keys:n,required:r}:null}_chunkA5EIY3HIcjs.a.call(void 0, Rc,"configVersionFloors");function Sa(e){let t=Rc(e.rules,e.runningVersion);if(!t||!_optionalChain([e, 'access', _152 => _152.pins, 'optionalAccess', _153 => _153.length]))return[];let n=e.runningVersion,r=n&&_t(n)&&rt(n,t.required)>0?n.replace(/^v/,""):t.required,a=_chunkA5EIY3HIcjs.a.call(void 0, l=>ba.filter(c=>t.keys.includes(c.key)&&rt(l.version,Ea(c.minVersion,n))<0).map(c=>c.key),"needing"),s=new Set,o=[];for(let l of e.pins){if(rt(l.version,t.required)>=0)continue;let c=`${l.file}\0${l.line}`;if(s.has(c))continue;s.add(c);let f=a(l);o.push({ruleId:"CONFIG_CHILD_SLICES_VERSION",failsStrict:!1,path:l.file,line:l.line,message:`ark.config.json uses ${f.join(", ")} (needs arkgate ${t.required}+). ${l.file}:${l.line} pins arkgate ${l.version}, which rejects this config at load.`,nextAction:`Bump arkgate in ${l.file} from ${l.version} to ${r}, then run Ark again.`})}return o.sort((l,c)=>l.path.localeCompare(c.path)||l.line-c.line)}_chunkA5EIY3HIcjs.a.call(void 0, Sa,"configVersionPinFindings");function q(e,t,n={}){return{ruleId:e,message:t,...n}}_chunkA5EIY3HIcjs.a.call(void 0, q,"configWarning");function Ot(e){let{config:t,rules:n,files:r,manifest:a}=e,s=[];if(t.dynamicImportAllowlist!==void 0&&(!Array.isArray(t.dynamicImportAllowlist)||t.dynamicImportAllowlist.some(u=>typeof u!="string"))&&s.push(q("CONFIG_INVALID_DYNAMIC_IMPORT_ALLOWLIST","dynamicImportAllowlist must be an array of file globs.")),t.safety!==void 0&&(t.safety===null||typeof t.safety!="object"||Array.isArray(t.safety)))s.push(q("CONFIG_INVALID_SAFETY","safety must be an object."));else if(t.safety)for(let u of["maxTsSuppressions","maxAnyCasts"]){let m=t.safety[u];m!==void 0&&(!Number.isInteger(m)||m<0)&&s.push(q("CONFIG_INVALID_SAFETY_THRESHOLD",`safety.${u} must be a non-negative integer.`))}let o=Array.isArray(t.layers)?t.layers:[],l=Array.isArray(_optionalChain([a, 'optionalAccess', _154 => _154.architecture, 'optionalAccess', _155 => _155.layers]))?a.architecture.layers:[],c=new Set([...o.map(u=>u.name).filter(Boolean),...l.map(u=>u.name).filter(u=>!!u)]);o.length===0&&s.push(q("CONFIG_NO_LAYERS","No file layers are configured; ark-check cannot classify files for import-boundary enforcement."));let f=new Set,g=new Set;for(let u of o){if(!u.name){s.push(q("CONFIG_LAYER_WITHOUT_NAME","A configured layer is missing a name."));continue}f.has(u.name)&&g.add(u.name),f.add(u.name),u.forbiddenGlobals!==void 0&&(!Array.isArray(u.forbiddenGlobals)||u.forbiddenGlobals.some(v=>typeof v!="string"))&&s.push(q("CONFIG_INVALID_FORBIDDEN_GLOBALS",`Layer "${u.name}" has an invalid forbiddenGlobals value; expected an array of strings (e.g. ["fetch", "Date.now"]). The entry is ignored.`,{layer:u.name}));let m=Array.isArray(u.patterns)?u.patterns:[];if(m.length===0){s.push(q("CONFIG_LAYER_WITHOUT_PATTERNS",`Layer "${u.name}" has no file patterns and will never classify files.`,{layer:u.name}));continue}for(let v of m){let w;try{w=_chunkRNQHRDCQcjs.z.call(void 0, v)}catch(b){s.push(q("CONFIG_INVALID_LAYER_PATTERN",`Layer "${u.name}" has an invalid pattern "${v}": ${b instanceof Error?b.message:String(b)}`,{layer:u.name,pattern:v}));continue}let A=u.optional===!0||u.reserved===!0||u.allowEmpty===!0;!r.some(b=>w.test(b))&&!A&&s.push(q("CONFIG_LAYER_PATTERN_NO_MATCHES",`Layer "${u.name}" pattern "${v}" matched no included files (possible typo). Mark the layer reserved/allowEmpty if this house is reserved for later.`,{layer:u.name,pattern:v,failsStrict:!1,reserved:!1}))}}for(let u of g)s.push(q("CONFIG_DUPLICATE_LAYER",`Layer "${u}" is configured more than once.`,{layer:u}));if(c.size>0)for(let u of _nullishCoalesce(n, () => ([])))u.from&&!c.has(u.from)&&s.push(q("CONFIG_RULE_UNKNOWN_FROM_LAYER",`Rule references unknown source layer "${u.from}".`,{fromLayer:u.from,toLayer:u.to})),u.to&&!c.has(u.to)&&s.push(q("CONFIG_RULE_UNKNOWN_TO_LAYER",`Rule references unknown target layer "${u.to}".`,{fromLayer:u.from,toLayer:u.to}));let h=new Set;if(o.length>1)for(let u of r){let m=-1,v=[];for(let w of o)for(let A of _nullishCoalesce(w.patterns, () => ([]))){if(!_chunkRNQHRDCQcjs.z.call(void 0, A).test(u))continue;let b=_chunkRNQHRDCQcjs.A.call(void 0, A,u);b>m?(m=b,v=[w.name]):b===m&&!v.includes(w.name)&&v.push(w.name)}v.length>1&&h.add([...v].sort().join(" + "))}h.size>0&&s.push(q("CONFIG_AMBIGUOUS_LAYERS",`Some files match multiple layers at equal specificity; classification falls back to declaration order. Disambiguate the overlapping patterns: ${[...h].join(", ")}.`,{pairs:[...h]}));let p=r.filter(u=>!_chunkRNQHRDCQcjs.B.call(void 0, u,o));p.length>0&&s.push(q("CONFIG_UNCLASSIFIED_FILES",`${p.length} included source file(s) are not matched by any configured layer; ark-check will not enforce import rules for those source files.`,{count:p.length,samples:p.slice(0,5)}));for(let u of _chunkRNQHRDCQcjs.C.call(void 0, n))s.push(q("CONFIG_SLICE_IDENTITY_COLLISION",u.message,{paths:[...u.paths],fromLayer:u.from,toLayer:u.to,failsStrict:!1}));for(let u of _chunkRNQHRDCQcjs.M.call(void 0, n,r))s.push(q(u.ruleId,u.message,{failsStrict:!1,...u.path?{file:u.path}:{},...u.fromLayer?{fromLayer:u.fromLayer}:{},...u.toLayer?{toLayer:u.toLayer}:{}}));for(let u of Sa({rules:n,pins:e.arkgatePins,runningVersion:e.runningArkgateVersion}))s.push(q(u.ruleId,u.message,{failsStrict:!1,file:u.path,line:u.line,nextAction:u.nextAction}));let R=_chunkRNQHRDCQcjs.$.call(void 0, t);if(R.length>0){let u=_nullishCoalesce(R[0], () => ("this layer"));s.push(q("CONFIG_LAYER_MISSING_OWNER",`${u} has no owner. Add a GitHub handle or email to layers[].owners so this house has a name on the door.`,{layers:R,nextAction:_chunkRNQHRDCQcjs.aa.call(void 0, u)}))}return s}_chunkA5EIY3HIcjs.a.call(void 0, Ot,"collectAnalysisConfigWarnings");function Ca(e,t){let n=e.ruleId==="ARKRULE_STRUCTURE",r=e.ruleId==="ARKRULE_SCOPE_EMPTY",a=e.ruleId==="INVARIANT_CATALOG_EMPTY";return{ruleId:e.ruleId,file:e.file,line:e.line,message:e.message,fromLayer:e.fromLayer,arkruleId:e.arkruleId,arkruleSource:e.arkruleSource,...n?{sensor:e.sensor,code:e.code,target:Ys({sensor:e.sensor,code:e.code})}:{},...r||a?{freezable:!1}:{},nextAction:t}}_chunkA5EIY3HIcjs.a.call(void 0, Ca,"toArkRuleEngineViolation");function Ac(e){let t=e.arkRules;return!!(t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length>0)}_chunkA5EIY3HIcjs.a.call(void 0, Ac,"arkRulesMapIsOn");function _a(e,t){return e.ruleId==="INVARIANT_CATALOG_EMPTY"?t?`Add 1\u20132 short phrases to invariants[] in ${e.arkruleSource} so Domain has policies the code must preserve (advisory \u2014 does not fail the merge until a domain structure rule is enforced).`:`Add 1\u20132 short phrases to invariants[] in ${e.arkruleSource} so Domain has policies the code must preserve. Empty catalog fails --strict-merge because a domain structure rule is already enforced.`:e.ruleId==="ARKRULE_SCOPE_EMPTY"?t?`Review appliesTo for ${e.arkruleId} in ${e.arkruleSource} (zero-match scope; advisory). Empty scope is not freezable; promote only after the folder exists.`:`Fix appliesTo globs for ${e.arkruleId} in ${e.arkruleSource} so they match governed files, or remove the rule. ARKRULE_SCOPE_EMPTY is a config diagnostic and is not freezable (even with --force). Land the rule as advisory until the folder exists, then promote.`:t?`Review ArkRule ${e.arkruleId} in ${e.arkruleSource} (advisory).`:`Fix the structure or invariant for ${e.arkruleId} (declared in ${e.arkruleSource}), then preflight again.`}_chunkA5EIY3HIcjs.a.call(void 0, _a,"arkRuleFindingNextAction");function kc(e,t){return t.some(n=>{try{return _chunkRNQHRDCQcjs.z.call(void 0, n).test(e)}catch (e4){return!1}})}_chunkA5EIY3HIcjs.a.call(void 0, kc,"matchesAny");function vc(e,t){let n=_nullishCoalesce(e.contract.config.safety, () => ({})),r=Number.isInteger(n.maxTsSuppressions)?Number(n.maxTsSuppressions):0,a=Number.isInteger(n.maxAnyCasts)?Number(n.maxAnyCasts):0,s=_nullishCoalesce(e.contract.config.dynamicImportAllowlist, () => ([])),o=t.safetyUses.filter(m=>m.kind==="ts-suppression").map(({file:m,line:v})=>({file:m,line:v})),l=t.safetyUses.filter(m=>m.kind==="any-cast").map(({file:m,line:v})=>({file:m,line:v})),c=t.safetyUses.filter(m=>(m.kind==="dynamic-import"||m.kind==="dynamic-require")&&!kc(m.file,s)).map(m=>({file:m.file,line:m.line,kind:m.kind==="dynamic-require"?"require":"import"})),f=n.allowInMemory===!0||t.projectPackageName==="arkgate"?[]:t.safetyUses.filter(m=>m.kind==="in-memory-store").map(m=>({file:m.file,line:m.line,store:_nullishCoalesce(m.symbol, () => ("in-memory store"))})),g=n.allowDisabledPeerIsolation===!0?[]:(_nullishCoalesce(e.contract.config.rules, () => ([]))).filter(m=>m.peerIsolation===!1||m.allowed===!1&&!!m.from&&m.from===m.to&&m.peerIsolation!==!0).map(m=>({from:m.from,to:m.to})),h={tsSuppressions:o,anyCasts:l,nonLiteralDynamicImports:c,inMemoryProductionStores:f,disabledPeerIsolationRules:g,thresholds:{maxTsSuppressions:r,maxAnyCasts:a}},p=[],R=c.filter(m=>m.kind==="import");if(R.length>0){let m=R[0];p.push({ruleId:"DYNAMIC_IMPORT_NOT_ALLOWLISTED",file:m.file,line:m.line,message:`${R.length} non-literal dynamic import(s) cannot be resolved statically. Add only reviewed files to dynamicImportAllowlist.`})}let u=c.filter(m=>m.kind==="require");if(u.length>0){let m=u[0];p.push({ruleId:"DYNAMIC_REQUIRE_NOT_ALLOWLISTED",file:m.file,line:m.line,message:`${u.length} non-literal require call(s) cannot be resolved statically. Add only reviewed files to dynamicImportAllowlist.`})}if(o.length>r){let m=o[0];p.push({ruleId:"TS_SUPPRESSION_THRESHOLD_EXCEEDED",file:m.file,line:m.line,message:`${o.length} @ts-ignore/@ts-nocheck directive(s) exceed safety.maxTsSuppressions (${r}).`})}if(l.length>a){let m=l[0];p.push({ruleId:"ANY_CAST_THRESHOLD_EXCEEDED",file:m.file,line:m.line,message:`${l.length} explicit any cast(s) exceed safety.maxAnyCasts (${a}).`})}if(f.length>0){let m=f[0];p.push({ruleId:"IN_MEMORY_STORE_IN_PRODUCTION_SOURCE",file:m.file,line:m.line,message:`${f.length} ArkGate InMemory store risk(s) appear in governed production source. Provide durable stores or set safety.allowInMemory only for an explicitly ephemeral service.`})}return g.length>0&&p.push({ruleId:"PEER_ISOLATION_DISABLED",message:`${g.length} rule(s) disable or omit required peerIsolation. Restore peerIsolation: true or set safety.allowDisabledPeerIsolation only with a documented production exception.`}),{report:h,warnings:p}}_chunkA5EIY3HIcjs.a.call(void 0, vc,"evaluateSafety");function Ic(e,t){return[...t].filter(n=>e===n||e.startsWith(`${n}.`)).sort((n,r)=>r.length-n.length)[0]}_chunkA5EIY3HIcjs.a.call(void 0, Ic,"ambientForbiddenGlobal");function Oa(e,t){let n=t.config.layers.filter(r=>(_nullishCoalesce(r.intentPrefixes, () => ([]))).length>0);return _chunkRNQHRDCQcjs.ea.call(void 0, e,n.length>0?n:_chunkRNQHRDCQcjs.da.map(r=>({name:r.layer,prefixes:r.prefixes})))}_chunkA5EIY3HIcjs.a.call(void 0, Oa,"intentLayer");function bc(e,t,n){let r=[],a=new Map(e.contract.config.layers.map(s=>[s.name,s]));for(let s of t.ambientUses){let o=n.get(s.file);!o||!Ic(s.symbol,_nullishCoalesce(_optionalChain([a, 'access', _156 => _156.get, 'call', _157 => _157(o), 'optionalAccess', _158 => _158.forbiddenGlobals]), () => ([])))||r.push({ruleId:"FORBIDDEN_GLOBAL",file:s.file,line:s.line,fromLayer:o,target:s.symbol,message:`${o} must not use the ambient global "${s.symbol}".`})}for(let s of t.capabilityUses){let o=n.get(s.file);if(!o)continue;let l=a.get(o),c=_nullishCoalesce(_optionalChain([l, 'optionalAccess', _159 => _159.forbiddenGlobals]), () => ([])),f=s.source==="import-based"?_optionalChain([t, 'access', _160 => _160.dependencies, 'access', _161 => _161.find, 'call', _162 => _162(g=>g.from===s.file&&g.line===s.line&&g.specifier===s.symbol&&!g.typeOnly), 'optionalAccess', _163 => _163.kind]):void 0;if(!(s.source==="ambient-global"&&ze(s.symbol,c))){if(s.source==="import-based"){let g=Re(s.symbol,c);if(g){r.push({ruleId:"FORBIDDEN_GLOBAL",file:s.file,line:s.line,fromLayer:o,target:s.symbol,...f?{edgeKind:f}:{},message:`${o} must not use module "${s.symbol}" because it is the import form of forbidden global "${g}".`});continue}}we(l).includes(s.capability)&&r.push({ruleId:"CAPABILITY_VIOLATION",file:s.file,line:s.line,fromLayer:o,target:s.symbol,capability:s.capability,...f?{edgeKind:f}:{},message:s.source==="import-based"?`${o} denies the ${s.capability} capability; found import of "${s.symbol}".`:`${o} denies the ${s.capability} capability; found ambient "${s.symbol}".`})}}for(let s of t.publishCalls){let o=n.get(s.file);if(!o)continue;for(let c of _chunkRNQHRDCQcjs.ga.call(void 0, {publishCall:!0,rawIntentName:s.rawIntentName,objectHasIntent:s.objectHasIntent,arkPublishCandidate:s.arkPublishCandidate,hasSource:s.hasSource}))r.push({ruleId:c.ruleId,file:s.file,line:s.line,...c.ruleId==="PUBLISH_MISSING_SOURCE"?{fromLayer:o}:{},message:c.message});if(!s.sourceIntent)continue;let l=Oa(s.sourceIntent,e.contract);!l||l===o||r.push({ruleId:"PUBLISH_SOURCE_LAYER_MISMATCH",file:s.file,line:s.line,fromLayer:o,toLayer:l,target:s.sourceIntent,message:`Publish source "${s.sourceIntent}" resolves to ${l}, but the publishing file is classified as ${o}.`})}for(let s of t.intentReferences){let o=n.get(s.file);if(!o)continue;let l=Oa(s.intent,e.contract);if(!l)continue;let c=_chunkRNQHRDCQcjs.O.call(void 0, e.contract.config.rules,o,l,{fromPath:s.file,layers:e.contract.config.layers});if(!c)continue;let f=c.sliceVerdict,g=`${o} must not reference ${l} intent ${s.intent}.`,h=f?_chunkRNQHRDCQcjs.K.call(void 0, {surface:"intent",verdict:f,fromLayer:o,toLayer:l,fromPath:s.file,ruleMessage:c.rule.message,childMessage:_optionalChain([c, 'access', _164 => _164.rule, 'access', _165 => _165.childSlices, 'optionalAccess', _166 => _166.message]),defaultMessage:g}):_nullishCoalesce(c.rule.message, () => (g));r.push({ruleId:"LAYER_INTENT_REFERENCE_VIOLATION",file:s.file,line:s.line,fromLayer:o,toLayer:l,target:s.intent,...c.rule.peerIsolation?{peerIsolation:!0}:{},..._chunkRNQHRDCQcjs.L.call(void 0, f),message:h})}return r}_chunkA5EIY3HIcjs.a.call(void 0, bc,"contentViolations");function xt(e){let{facts:t}=e,n=Xe(e.contract.config),r=t.evidenceRequirementsHash===n,a=r?t.completeness:"unavailable",s=r?t.completenessReasons:[...t.completenessReasons,{code:"EVIDENCE_REQUIREMENTS_MISMATCH",message:"Resolved facts were collected for different policy-controlled evidence requirements."}].sort((d,T)=>{let U=`${d.code}\0${_nullishCoalesce(d.file, () => (""))}\0${d.message}`,re=`${T.code}\0${_nullishCoalesce(T.file, () => (""))}\0${T.message}`;return U<re?-1:U>re?1:0}),o=t.files.map(d=>({...d,layer:_nullishCoalesce(_chunkRNQHRDCQcjs.B.call(void 0, d.path,e.contract.config.layers), () => (null))})),l=new Map(o.map(d=>[d.path,d.layer])),c=t.dependencies.map(d=>{let T=d.target?_nullishCoalesce(l.get(d.target), () => (_chunkRNQHRDCQcjs.B.call(void 0, d.target,e.contract.config.layers))):void 0;return{from:d.from,fromLayer:_nullishCoalesce(l.get(d.from), () => (null)),...d.resolution==="resolved-project"&&d.target?{to:d.target,...T?{toLayer:T}:{}}:{},line:d.line,kind:d.kind,typeOnly:d.typeOnly,...d.targetTypeOnlyExports?{targetTypeOnlyExports:d.targetTypeOnlyExports}:{},...d.sourcePureTypeModule?{sourcePureTypeModule:d.sourcePureTypeModule}:{},...d.namedBindingsTypeOnly?{namedBindingsTypeOnly:d.namedBindingsTypeOnly}:{},...d.portProofEligible?{portProofEligible:d.portProofEligible}:{}}}),f=Ot({config:e.contract.config,rules:e.contract.config.rules,files:o.map(d=>d.path),arkgatePins:e.arkgatePins,runningArkgateVersion:e.runningArkgateVersion}),g=vc(e,t),h=_nullishCoalesce(e.contract.arkRules, () => (Je())),p=o.map(d=>d.path),u={..._optionalChain([e, 'access', _167 => _167.coverageInputs, 'optionalAccess', _168 => _168.fileContents])&&Object.keys(e.coverageInputs.fileContents).length>0?la(e.coverageInputs.fileContents):{},..._nullishCoalesce(e.fileHints, () => ({}))},m=_chunkA5EIY3HIcjs.a.call(void 0, d=>_nullishCoalesce(l.get(d), () => (_chunkRNQHRDCQcjs.B.call(void 0, d,e.contract.config.layers))),"resolveLayer"),v=[...aa({arkRules:h,classShapes:_nullishCoalesce(_nullishCoalesce(e.contract.classShapes, () => (t.classShapes)), () => ([])),files:p,layerForFile:m,fileHints:u}),...oa(h,p),...ia({arkRulesActive:Ac(e.contract.config),arkRules:h,layers:_nullishCoalesce(e.contract.config.layers, () => ([])),files:p.map(d=>({path:d,layer:m(d)}))})],w=(_nullishCoalesce(_optionalChain([h, 'access', _169 => _169.invariants, 'optionalAccess', _170 => _170.length]), () => (0)))>0,A=xs({hasEnforcedInvariant:yn(h.invariants),coverage:e.contract.config.coverage,...e.coverageRootsPresent===!1?{declaredPathPresent:!1}:{}}),b=A.length>0?[]:Os({adopted:e.adopted===!0,hasDomainInvariants:mn(h.invariants),coverage:e.contract.config.coverage,...e.invariantTestsPathPresent===!1?{declaredPathPresent:!1}:{}}),O=[...A.map(d=>({ruleId:d.ruleId,file:d.file,line:d.line,message:d.message,nextAction:"Add coverage.coverageRoots in ark.config.json pointing at the folder the test runner uses, then re-run. An enforced invariant fails closed until that path is present.",failsStrict:!0,freezable:!1})),...b.map(d=>({ruleId:d.ruleId,file:d.file,line:d.line,message:d.message,nextAction:"Add coverage.testGlobs or coverage.coverageRoots in ark.config.json pointing at a real tests folder, then re-run. Adopted mode fails closed until that path is present.",failsStrict:!0,freezable:!1}))],G=v.filter(d=>d.failsStrict).map(d=>Ca(d,_a(d,!1))),K=v.filter(d=>!d.failsStrict).map(d=>({...Ca(d,_a(d,!0)),failsStrict:!1})),j=w?Cs({arkRules:h,fileContents:_nullishCoalesce(_optionalChain([e, 'access', _171 => _171.coverageInputs, 'optionalAccess', _172 => _172.fileContents]), () => ({})),testFiles:_nullishCoalesce(_optionalChain([e, 'access', _173 => _173.coverageInputs, 'optionalAccess', _174 => _174.testFiles]), () => ([])),testGlobsMissing:_optionalChain([e, 'access', _175 => _175.coverageInputs, 'optionalAccess', _176 => _176.testGlobsMissing])===!0||e.coverageInputs===void 0||(_nullishCoalesce(_optionalChain([e, 'access', _177 => _177.coverageInputs, 'access', _178 => _178.testFiles, 'optionalAccess', _179 => _179.length]), () => (0)))===0,coverageBudgetExhausted:_optionalChain([e, 'access', _180 => _180.coverageInputs, 'optionalAccess', _181 => _181.coverageBudgetExhausted])===!0,..._optionalChain([e, 'access', _182 => _182.coverageInputs, 'optionalAccess', _183 => _183.stats])?{coverageStats:e.coverageInputs.stats}:{},..._optionalChain([e, 'access', _184 => _184.coverageInputs, 'optionalAccess', _185 => _185.coverageRoots])?{coverageRoots:e.coverageInputs.coverageRoots}:{}}):{coverage:[],violations:[],partial:!1},I=j.violations.filter(d=>d.failsStrict).map(d=>({ruleId:d.ruleId,file:d.file,line:d.line,message:d.message,fromLayer:d.fromLayer,arkruleId:d.arkruleId,arkruleSource:d.arkruleSource,nextAction:`Add a test title or declared symbol covering ${d.arkruleId} (declared in ${d.arkruleSource}), then preflight again.`})),D=j.violations.filter(d=>!d.failsStrict).map(d=>({ruleId:d.ruleId,file:d.file,line:d.line,message:d.message,fromLayer:d.fromLayer,arkruleId:d.arkruleId,arkruleSource:d.arkruleSource,failsStrict:!1,nextAction:d.ruleId==="INVARIANT_COVERAGE_OUTSIDE_ROOTS"?`Move ${d.file} under a declared coverage root, or add its root to coverage.coverageRoots in ark.config.json.`:`Cover invariant ${d.arkruleId} in ${d.arkruleSource} (advisory / partial).`})),X=ca(o),ne=ya({arkRun:e.contract.config.arkRun,layers:e.contract.config.layers,kernelCalls:t.arkRunKernelCalls,managedNews:t.arkRunManagedNews,compositionRootHits:t.arkRunCompositionRootHits,declarations:t.arkRunDeclarations,dependencies:t.dependencies,layerForFile:_chunkA5EIY3HIcjs.a.call(void 0, d=>_nullishCoalesce(l.get(d), () => (_chunkRNQHRDCQcjs.B.call(void 0, d,e.contract.config.layers))),"layerForFile"),classification:X}),ue=_optionalChain([e, 'access', _186 => _186.contract, 'access', _187 => _187.config, 'access', _188 => _188.arkRun, 'optionalAccess', _189 => _189.mode]),ae=ne.findings.filter(()=>ue==="enforced").map(d=>({ruleId:d.ruleId,file:d.file,line:d.line,message:d.message,fromLayer:d.fromLayer,target:d.target,nextAction:d.nextAction,sensor:d.sensor,failsStrict:d.failsStrict,...d.severity?{severity:d.severity}:{}})),Ue=ne.findings.filter(()=>ue!=="enforced").map(d=>({ruleId:d.ruleId,file:d.file,line:d.line,message:d.message,fromLayer:d.fromLayer,target:d.target,nextAction:d.nextAction,sensor:d.sensor,failsStrict:!1})),pe=Ia({arkOrder:e.contract.config.arkOrder,layers:e.contract.config.layers,planeCalls:t.arkOrderPlaneCalls,genericUpdates:t.arkOrderGenericUpdates,planeRootHits:t.arkOrderRootHits,xiFieldWrites:t.arkOrderXiFieldWrites,ingestWritesXi:t.arkOrderIngestWritesXi,releaseKeyCounts:t.arkOrderReleaseKeyCounts,xiTtlKeys:t.arkOrderXiTtlKeys,budgetLeaks:t.arkOrderBudgetLeaks,dependencies:t.dependencies,layerForFile:_chunkA5EIY3HIcjs.a.call(void 0, d=>_nullishCoalesce(l.get(d), () => (_chunkRNQHRDCQcjs.B.call(void 0, d,e.contract.config.layers))),"layerForFile"),classification:X}),Tt=_optionalChain([e, 'access', _190 => _190.contract, 'access', _191 => _191.config, 'access', _192 => _192.arkOrder, 'optionalAccess', _193 => _193.mode]),st=pe.findings.filter(()=>Tt==="enforced").map(d=>({ruleId:d.ruleId,file:d.file,line:d.line,message:d.message,fromLayer:d.fromLayer,target:d.target,nextAction:d.nextAction,sensor:d.sensor,failsStrict:d.failsStrict,...d.severity?{severity:d.severity}:{}})),Nn=pe.findings.filter(()=>Tt!=="enforced").map(d=>({ruleId:d.ruleId,file:d.file,line:d.line,message:d.message,fromLayer:d.fromLayer,target:d.target,nextAction:d.nextAction,sensor:d.sensor,failsStrict:!1})),Ve=[...j.partial&&j.coverage.some(d=>d.mode==="enforced"&&d.partial)?[{code:"INVARIANT_COVERAGE_PARTIAL",message:"Enforced ArkRules invariant coverage cannot be fully proven (missing test globs or empty test set); reporting partial, never covered."}]:[],...ne.completenessReasons,...pe.completenessReasons],Ie=He({config:e.contract.config,rules:e.contract.config.rules,files:o.filter(d=>d.layer).map(d=>d.path),contentViolations:[...bc(e,t,l),...G,...O,...I,...ae,...st],edges:c,warnings:[...f,...g.warnings,...K,...D,...Ue,...Nn],safety:g.report}),at=a==="complete"&&Ve.length>0?"partial":a,Pt=at==="complete"?s:[...s,...Ve].sort((d,T)=>{let U=`${d.code}\0${_nullishCoalesce(d.file, () => (""))}\0${d.message}`,re=`${T.code}\0${_nullishCoalesce(T.file, () => (""))}\0${T.message}`;return U<re?-1:U>re?1:0}),E=Ie.violations.filter(d=>d.failsStrict!==!1),_=at==="complete"&&E.length===0,y=_&&Ie.warnings.every(d=>d.failsStrict===!1);return{mode:"resolved-candidate-facts",completeness:at,completenessReasons:Pt,valid:_,strictValid:y,policyHash:e.contract.policyHash,factsHash:t.factsHash,resolverIdentity:t.resolverIdentity,candidateTreeHash:t.candidateTreeHash,safety:g.report,ir:{schemaVersion:"1.0",policyHash:e.contract.policyHash,compilerOptionsHash:t.compilerOptionsHash,files:o,layers:e.contract.config.layers.map(d=>d.name),edges:c,capabilityUses:t.capabilityUses,violations:Ie.violations,warnings:Ie.warnings}}}_chunkA5EIY3HIcjs.a.call(void 0, xt,"analyzeCanonicalResolvedProject");function xa(e){return xt({contract:e.contract,facts:Ae(e.facts),coverageInputs:e.coverageInputs,fileHints:e.fileHints,adopted:e.adopted,invariantTestsPathPresent:e.invariantTestsPathPresent,coverageRootsPresent:e.coverageRootsPresent,arkgatePins:e.arkgatePins,runningArkgateVersion:e.runningArkgateVersion})}_chunkA5EIY3HIcjs.a.call(void 0, xa,"analyzeResolvedProject");function wa(e){return Z(W(e.map(({path:t,contentHash:n})=>({path:t,contentHash:n}))))}_chunkA5EIY3HIcjs.a.call(void 0, wa,"analysisTreeHash");function Ta(e){let t=nt(e),n=new Map(t.ir.files.map(u=>[u.path,u])),r=[],a=new Set,s=[];for(let u of e.changes){let m=u.path.replace(/\\/g,"/"),v=_e(u.path);if(!v||v===".."||v.startsWith("../")||m.startsWith("/")||/^[A-Za-z]:\//.test(m)||m.includes("\0")){s.push({ruleId:"INVALID_CHANGE_PATH",file:"<change-set>",line:1,message:"Every change requires a safe, non-empty project-relative path."});continue}if(a.has(v)){s.push({ruleId:"DUPLICATE_CHANGE_PATH",file:v,line:1,message:`The atomic change set contains more than one operation for ${v}.`});continue}a.add(v),"delete"in u&&u.delete&&!n.has(v)&&s.push({ruleId:"DELETE_TARGET_MISSING",file:v,line:1,message:`Cannot delete ${v} because it is not present in the supplied base tree.`}),r.push("delete"in u&&u.delete?{path:v,delete:!0}:{path:v,content:"content"in u?u.content:""})}e.changes.length===0&&s.push({ruleId:"CHANGE_SET_EMPTY",file:"<change-set>",line:1,message:"Atomic preflight requires at least one create, update, or delete."});let o=It({...e,changes:r}),l=new Map(o.ir.files.map(u=>[u.path,u])),c=o.ir.violations.filter(u=>u.ruleId==="CAPABILITY_VIOLATION"||u.ruleId==="FORBIDDEN_GLOBAL").map(u=>{let m=_optionalChain([l, 'access', _194 => _194.get, 'call', _195 => _195(u.evidence.file), 'optionalAccess', _196 => _196.layer]);return{ruleId:u.ruleId,file:u.evidence.file,line:u.evidence.line,target:u.symbol,...u.capability?{capability:u.capability}:{},...m?{fromLayer:m}:{},edgeKind:"import",message:u.message}}),f=He({config:e.contract.config,rules:e.contract.config.rules,files:o.ir.files.map(u=>u.path),contentViolations:c,edges:o.ir.edges.filter(u=>!!u.fromLayer).map(u=>({from:u.from,fromLayer:u.fromLayer,...u.to?{to:u.to}:{},...u.toLayer?{toLayer:u.toLayer}:{},line:u.evidence.line,kind:"import",...u.typeOnly?{typeOnly:!0}:{},...u.namedBindingsTypeOnly?{namedBindingsTypeOnly:!0}:{}}))}),g=r.map(u=>{let m=_e(u.path),v=n.get(m),w=l.get(m);return{path:m,operation:"delete"in u&&u.delete?"delete":v?"update":"create",...v?{beforeContentHash:v.contentHash}:{},...w?{candidateContentHash:w.contentHash}:{}}}).sort((u,m)=>u.path.localeCompare(m.path)),h=[...s,...f.violations].map(u=>({...u,nextAction:le(u)})),p=h.filter(u=>u.failsStrict!==!1),R=e.changeMap?Fe({changeMap:e.changeMap,changes:g,baseDependencies:t.ir.edges.flatMap(u=>u.to?[{from:u.from,to:u.to}]:[]),candidateDependencies:o.ir.edges.flatMap(u=>u.to?[{from:u.from,to:u.to}]:[])}):void 0;return{schemaVersion:"1.0",mode:"lexical-compatibility",valid:t.completeness==="complete"&&o.valid&&p.length===0&&(_nullishCoalesce(_optionalChain([R, 'optionalAccess', _197 => _197.structurallyConverged]), () => (!0))),readOnly:!0,policyHash:e.contract.policyHash,compilerOptionsHash:o.ir.compilerOptionsHash,baseTreeHash:wa(t.ir.files),candidateTreeHash:wa(o.ir.files),baseCompleteness:t.completeness,candidateCompleteness:o.completeness,baseCompletenessReasons:t.completenessReasons,candidateCompletenessReasons:o.completenessReasons,...e.changeMap?{changeMapHash:e.changeMap.hash}:{},...R?{convergence:R}:{},changes:g,violations:h,warnings:f.warnings}}_chunkA5EIY3HIcjs.a.call(void 0, Ta,"preflightChange");function Ec(e){let t=e.replace(/\\/g,"/");if(!t||t.startsWith("/")||/^[A-Za-z]:\//.test(t)||t.includes("\0"))return;let n=[];for(let a of t.split("/"))if(!(!a||a==="."))if(a===".."){if(n.length===0)return;n.pop()}else n.push(a);let r=n.join("/");return r&&r===t?r:void 0}_chunkA5EIY3HIcjs.a.call(void 0, Ec,"canonicalChangePath");function Sc(e,t){return[["resolverIdentity",e.resolverIdentity,t.resolverIdentity],["compilerIdentity",e.compilerIdentity,t.compilerIdentity],["evidenceRequirementsHash",e.evidenceRequirementsHash,t.evidenceRequirementsHash],["projectPackageName",_nullishCoalesce(e.projectPackageName, () => ("")),_nullishCoalesce(t.projectPackageName, () => (""))]].filter(([,r,a])=>r!==a).map(([r,a,s])=>({ruleId:"FACTS_IDENTITY_MISMATCH",file:"<change-set>",line:1,field:r,before:a,candidate:s,message:`Base and candidate facts must use the same ${r}.`}))}_chunkA5EIY3HIcjs.a.call(void 0, Sc,"identityViolations");function Cc(e,t,n,r){let a=n.get(t),s=r.get(t);return{path:t,operation:"delete"in e&&e.delete?"delete":a?"update":"create",...a?{beforeContentHash:a.contentHash}:{},...s?{candidateContentHash:s.contentHash}:{}}}_chunkA5EIY3HIcjs.a.call(void 0, Cc,"preparedChange");function wt(e){return e.startsWith("ARKRULE_")||e.startsWith("INVARIANT_")}_chunkA5EIY3HIcjs.a.call(void 0, wt,"isArkRulesPlaneRule");function Na(e){let t=typeof e.arkruleId=="string"?e.arkruleId:"";return[e.ruleId,_nullishCoalesce(e.file, () => ("")),t,_nullishCoalesce(e.target, () => (e.message))].join("|")}_chunkA5EIY3HIcjs.a.call(void 0, Na,"ratchetKey");function Pa(e,t){let n=new Map;for(let r of e){if(!wt(r.ruleId)||r.failsStrict===!1)continue;let a=Na(r);n.set(a,(_nullishCoalesce(n.get(a), () => (0)))+1)}return t.map(r=>{if(!wt(r.ruleId))return r;let a=Na(r),s=_nullishCoalesce(n.get(a), () => (0));return s===0?r:(n.set(a,s-1),{...r,preExisting:!0,failsStrict:!1,severity:"warning"})})}_chunkA5EIY3HIcjs.a.call(void 0, Pa,"ratchetPreExistingArkRules");function _c(e,t){return{completeness:e.completeness,completenessReasons:e.completenessReasons,ir:{edges:t?e.ir.edges:[],violations:e.ir.violations.filter(n=>wt(n.ruleId)),warnings:e.ir.warnings.filter(n=>wt(n.ruleId))}}}_chunkA5EIY3HIcjs.a.call(void 0, _c,"baseAnalysisSummary");function La(e){return Oc(e,Ae(e.baseFacts),Ae(e.candidateFacts))}_chunkA5EIY3HIcjs.a.call(void 0, La,"preflightResolvedChange");function Oc(e,t,n){let r=_c(xt({..._nullishCoalesce(e.baseAnalysisInputs, () => ({})),contract:e.contract,facts:t}),e.changeMap!==void 0),a=xt({..._nullishCoalesce(e.candidateAnalysisInputs, () => ({})),contract:e.contract,facts:n}),s=new Map(t.files.map(m=>[m.path,m])),o=new Map(n.files.map(m=>[m.path,m])),l=Sc(t,n),c=new Map,f=[];for(let m of e.changes){let v=Ec(m.path);if(!v){l.push({ruleId:"INVALID_CHANGE_PATH",file:"<change-set>",line:1,message:"Every change requires a canonical project-relative path."});continue}if(c.has(v)){l.push({ruleId:"DUPLICATE_CHANGE_PATH",file:v,line:1,message:`The atomic change set contains more than one operation for ${v}.`});continue}c.set(v,m);let w=s.get(v),A=o.get(v);if("delete"in m&&m.delete)w||l.push({ruleId:"DELETE_TARGET_MISSING",file:v,line:1,message:`Cannot delete ${v} because it is not present in the supplied base facts.`}),A&&l.push({ruleId:"CANDIDATE_DELETE_NOT_APPLIED",file:v,line:1,message:`Candidate facts still contain deleted file ${v}.`});else{let b="content"in m?m.content:"",O=Z(b);A?A.contentHash!==O&&l.push({ruleId:"CANDIDATE_CONTENT_HASH_MISMATCH",file:v,line:1,expectedContentHash:O,candidateContentHash:A.contentHash,message:`Candidate facts for ${v} do not match the declared content.`}):l.push({ruleId:"CANDIDATE_CHANGE_MISSING",file:v,line:1,message:`Candidate facts do not contain changed file ${v}.`})}f.push(Cc(m,v,s,o))}e.changes.length===0&&l.push({ruleId:"CHANGE_SET_EMPTY",file:"<change-set>",line:1,message:"Atomic preflight requires at least one create, update, or delete."});for(let m of new Set([...s.keys(),...o.keys()])){if(c.has(m))continue;let v=s.get(m),w=o.get(m);v&&w&&W(v)===W(w)||l.push({ruleId:"UNDECLARED_CANDIDATE_CHANGE",file:m,line:1,message:`Candidate facts change ${m}, but the atomic change set does not declare it.`})}let g=e.changeMap?Fe({changeMap:e.changeMap,changes:f,baseDependencies:r.ir.edges.flatMap(m=>m.to?[{from:m.from,to:m.to}]:[]),candidateDependencies:a.ir.edges.flatMap(m=>m.to?[{from:m.from,to:m.to}]:[])}):void 0,h=Pa(r.ir.violations,a.ir.violations),p=Pa(r.ir.warnings,a.ir.warnings),R=[...l,...h].map(m=>({...m,nextAction:le(m)})),u=R.filter(m=>m.failsStrict!==!1);return{schemaVersion:"1.0",mode:"resolved-candidate-facts",valid:r.completeness==="complete"&&a.completeness==="complete"&&p.every(m=>m.failsStrict===!1)&&u.length===0&&(_nullishCoalesce(_optionalChain([g, 'optionalAccess', _198 => _198.structurallyConverged]), () => (!0))),readOnly:!0,policyHash:e.contract.policyHash,resolverIdentity:n.resolverIdentity,compilerIdentity:n.compilerIdentity,compilerOptionsHash:n.compilerOptionsHash,tsconfigHash:n.tsconfigHash,baseCompilerOptionsHash:t.compilerOptionsHash,candidateCompilerOptionsHash:n.compilerOptionsHash,baseTsconfigHash:t.tsconfigHash,candidateTsconfigHash:n.tsconfigHash,evidenceRequirementsHash:n.evidenceRequirementsHash,baseFactsHash:t.factsHash,candidateFactsHash:n.factsHash,baseTreeHash:t.candidateTreeHash,candidateTreeHash:n.candidateTreeHash,baseCompleteness:r.completeness,candidateCompleteness:a.completeness,baseCompletenessReasons:r.completenessReasons,candidateCompletenessReasons:a.completenessReasons,...e.changeMap?{changeMapHash:e.changeMap.hash}:{},...g?{convergence:g}:{},changes:f.sort((m,v)=>m.path<v.path?-1:m.path>v.path?1:0),violations:R,warnings:p}}_chunkA5EIY3HIcjs.a.call(void 0, Oc,"preflightCanonicalChange");var xc="1.1";var wc="1.0";function Da(e){return Object.keys(e).sort()}_chunkA5EIY3HIcjs.a.call(void 0, Da,"sortedKeys");function wn(e,t,n,r){if(e===t)return;if(e===null||t===null||typeof e!=typeof t){r.push({path:n,left:e,right:t});return}if(typeof e!="object"||typeof t!="object"){e!==t&&r.push({path:n,left:e,right:t});return}if(Array.isArray(e)||Array.isArray(t)){let l=Array.isArray(e)?e:[],c=Array.isArray(t)?t:[],f=Math.max(l.length,c.length);for(let g=0;g<f;g+=1)wn(l[g],c[g],`${n}[${g}]`,r);return}let a=e,s=t,o=new Set([...Da(a),...Da(s)]);for(let l of[...o].sort())wn(a[l],s[l],n?`${n}.${l}`:l,r)}_chunkA5EIY3HIcjs.a.call(void 0, wn,"walk");function Fa(e){return{schemaVersion:e.schemaVersion,kernelInstanceId:e.kernelInstanceId,components:e.components.map(t=>({id:t.id,lifetime:t.lifetime,uses:[...t.uses],reactsTo:[...t.reactsTo],raises:[...t.raises],sends:[...t.sends],...t.extendedInfo?{extendedInfo:{...t.extendedInfo}}:{}})),...e.decisionTape?{decisionTape:e.decisionTape.map(t=>({xiHash:t.xiHash,event:{kind:t.event.kind,...t.event.payload?{payload:{...t.event.payload}}:{}},residual:{...t.residual}}))}:{}}}_chunkA5EIY3HIcjs.a.call(void 0, Fa,"shadowInformationPackage");function Tn(e,t){let n=[];return wn(e,t,"",n),{equal:n.length===0,diffs:n}}_chunkA5EIY3HIcjs.a.call(void 0, Tn,"compareInformationPackages");function $a(e){let t=[];for(let n=1;n<e.length;n+=1)t.push(Tn(e[n-1],e[n]));return t}_chunkA5EIY3HIcjs.a.call(void 0, $a,"replayInformationPackages");exports.ANALYSIS_IR_SCHEMA_VERSION = ln; exports.ARK_ANALYSIS_RESULT_SCHEMA = Yr; exports.ARK_ANALYSIS_RESULT_SCHEMA_VERSION = pt; exports.ARK_DESIGN_DELTA_SCHEMA_VERSION = wc; exports.ARK_ENFORCEMENT_STATE_SCHEMA_VERSION = xc; exports.ARK_RUN_COMPONENT_LIFETIMES = _chunkA5EIY3HIcjs.d; exports.ARK_RUN_EPHEMERAL_DEFAULT = _chunkA5EIY3HIcjs.t; exports.ARK_RUN_GRAPH_DEFAULT_SLICE = _chunkA5EIY3HIcjs.i; exports.ARK_RUN_GRAPH_NODE_KINDS = _chunkA5EIY3HIcjs.k; exports.ARK_RUN_GRAPH_PROCESS_EDGE_KINDS = _chunkA5EIY3HIcjs.l; exports.ARK_RUN_GRAPH_SCHEMA_VERSION = _chunkA5EIY3HIcjs.h; exports.ARK_RUN_GRAPH_SLICES = _chunkA5EIY3HIcjs.j; exports.ARK_RUN_GRAPH_TECHNICAL_EDGE_KINDS = _chunkA5EIY3HIcjs.m; exports.ARK_RUN_INFORMATION_PACKAGE_SCHEMA_VERSION = _chunkA5EIY3HIcjs.c; exports.ARK_RUN_INSPECTOR_DEFAULT_HOST = _chunkA5EIY3HIcjs.z; exports.ARK_RUN_INSPECTOR_DEFAULT_PORT = _chunkA5EIY3HIcjs.A; exports.ARK_RUN_INSPECTOR_EVENTS_PATH = _chunkA5EIY3HIcjs.C; exports.ARK_RUN_INSPECTOR_GRAPH_PATH = _chunkA5EIY3HIcjs.D; exports.ARK_RUN_INSPECTOR_MONITOR_SAMPLE_LIMIT = _chunkA5EIY3HIcjs.I; exports.ARK_RUN_INSPECTOR_OUTBOX_PATH = _chunkA5EIY3HIcjs.E; exports.ARK_RUN_INSPECTOR_SCHEMA_VERSION = _chunkA5EIY3HIcjs.y; exports.ARK_RUN_INSPECTOR_SNAPSHOT_PATH = _chunkA5EIY3HIcjs.B; exports.ARK_RUN_INSPECTOR_SSE_EVENT = _chunkA5EIY3HIcjs.G; exports.ARK_RUN_INSPECTOR_TRANSPORT_FALLBACK = _chunkA5EIY3HIcjs.H; exports.ARK_RUN_INSPECTOR_WORKFLOWS_PATH = _chunkA5EIY3HIcjs.F; exports.ARK_RUN_TRANSPORT_KINDS = _chunkA5EIY3HIcjs.s; exports.ArkKernelConfigError = _chunkRNQHRDCQcjs.w; exports.ArkRunInspectorBindError = _chunkA5EIY3HIcjs.K; exports.ArkRunInspectorProductionError = _chunkA5EIY3HIcjs.J; exports.DEFAULT_MAX_HISTORY_SIZE = _chunkRNQHRDCQcjs.ua; exports.DIAGNOSTIC_CATALOG = dt; exports.DIAGNOSTIC_CATALOG_SCHEMA_VERSION = wo; exports.DIAGNOSTIC_DOCS_RELATIVE_PATH = Mt; exports.DIAGNOSTIC_RULE_IDS = To; exports.EventContractRegistryImpl = _chunkRNQHRDCQcjs.S; exports.EventContractViolationError = _chunkRNQHRDCQcjs.s; exports.InMemoryAuditStore = _chunkRNQHRDCQcjs.X; exports.InMemoryEventBuffer = _chunkRNQHRDCQcjs.U; exports.InMemoryOutboxStore = _chunkRNQHRDCQcjs.V; exports.InMemoryReadModelStore = _chunkRNQHRDCQcjs.ma; exports.InMemoryWorkflowStore = _chunkRNQHRDCQcjs.qa; exports.IntentRegistry = _chunkRNQHRDCQcjs.b; exports.InvalidArkRunGraphQueryError = _chunkA5EIY3HIcjs.n; exports.InvalidArkRunSendOptionError = _chunkA5EIY3HIcjs.u; exports.InvalidIntentNameError = _chunkRNQHRDCQcjs.q; exports.LayerPolicyContextError = _chunkRNQHRDCQcjs.r; exports.MANIFEST_SCHEMA_VERSION = _chunkRNQHRDCQcjs.oa; exports.ObservedLayerFlowViolationError = _chunkRNQHRDCQcjs.v; exports.POLICY_DELTA_SCHEMA_VERSION = kn; exports.PolicyEngine = _chunkRNQHRDCQcjs.h; exports.PolicyViolationError = _chunkRNQHRDCQcjs.g; exports.RESOLVED_CANDIDATE_FACTS_SCHEMA = on; exports.RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION = Se; exports.SourceMetadataOverrideError = _chunkRNQHRDCQcjs.u; exports.UnknownEventSourceError = _chunkRNQHRDCQcjs.t; exports.UnregisteredIntentError = _chunkRNQHRDCQcjs.p; exports.analyzeArchitectureConvergence = Fe; exports.analyzeChange = It; exports.analyzePolicyDelta = Bs; exports.analyzeProject = nt; exports.analyzeResolvedProject = xa; exports.appendDecisionTape = _chunkA5EIY3HIcjs.g; exports.architecturalPolicies = _chunkRNQHRDCQcjs.l; exports.arkRunGraphQueryFromSearchParams = _chunkA5EIY3HIcjs.p; exports.arkRunInspectorUrl = _chunkA5EIY3HIcjs.O; exports.buildArkRunInspectorHardening = _chunkA5EIY3HIcjs.Q; exports.buildArkRunInspectorOutboxMonitor = _chunkA5EIY3HIcjs.R; exports.buildArkRunInspectorSnapshot = _chunkA5EIY3HIcjs.V; exports.buildArkRunInspectorWorkflowsMonitor = _chunkA5EIY3HIcjs.T; exports.buildDependencyInformationPackage = _chunkA5EIY3HIcjs.f; exports.buildPublishPolicyContext = _chunkRNQHRDCQcjs.n; exports.catalogFixForRuleId = Fo; exports.catalogWhyForRuleId = $o; exports.checkAdapterGovernance = jt; exports.checkContract = es; exports.classifyArkPolicyDelta = vn; exports.classifyArkRunInspectorStoreDurability = _chunkA5EIY3HIcjs.P; exports.closeArkRunGraphQuery = _chunkA5EIY3HIcjs.o; exports.closedArkRunEphemeral = _chunkA5EIY3HIcjs.w; exports.closedArkRunTransportKind = _chunkA5EIY3HIcjs.v; exports.collectAnalysisConfigWarnings = Ot; exports.collectForbiddenCapabilityUses = Pe; exports.compareInformationPackages = Tn; exports.createAICodeGate = cs; exports.createAdapter = Qr; exports.createAdapterResult = Zo; exports.createArchitectureProfile = _chunkRNQHRDCQcjs.ha; exports.createArchitectureProfileFromArkConfig = _chunkRNQHRDCQcjs.ia; exports.createArkKernel = _chunkRNQHRDCQcjs.va; exports.createArkKernelFromConfig = _chunkRNQHRDCQcjs.xa; exports.createArkManifest = _chunkRNQHRDCQcjs.pa; exports.createArkTestHarness = Zr; exports.createAuditTrail = _chunkRNQHRDCQcjs.Y; exports.createDependencyGraph = _chunkRNQHRDCQcjs.Z; exports.createElevenLayerArkConfig = _chunkRNQHRDCQcjs.ka; exports.createEventBus = _chunkRNQHRDCQcjs.R; exports.createEventContractRegistry = _chunkRNQHRDCQcjs.T; exports.createIntentRegistry = _chunkRNQHRDCQcjs.d; exports.createLenientArkKernel = _chunkRNQHRDCQcjs.Aa; exports.createLenientArkKernelFromConfig = _chunkRNQHRDCQcjs.za; exports.createMetadataRegistry = _chunkRNQHRDCQcjs.la; exports.createObservabilityReporter = _chunkRNQHRDCQcjs.W; exports.createProjectionRegistry = _chunkRNQHRDCQcjs.na; exports.createResolvedCandidateFacts = an; exports.createSaga = _chunkRNQHRDCQcjs.sa; exports.createStrictArkKernel = _chunkRNQHRDCQcjs.wa; exports.createStrictArkKernelFromConfig = _chunkRNQHRDCQcjs.ya; exports.createWorkflowEngine = _chunkRNQHRDCQcjs.ra; exports.defaultIntentRegistry = _chunkRNQHRDCQcjs.e; exports.defineArchitectureProfilePolicy = _chunkRNQHRDCQcjs.m; exports.defineIntent = _chunkRNQHRDCQcjs.c; exports.defineLayerPolicy = _chunkRNQHRDCQcjs.j; exports.definePolicy = _chunkRNQHRDCQcjs.i; exports.definePort = Jr; exports.definePublishPolicy = _chunkRNQHRDCQcjs.o; exports.detectArchitectureCycles = En; exports.deterministicHash = Z; exports.diagnosticDocsFragment = Wr; exports.diagnosticDocsPath = Lo; exports.elevenLayerProfile = _chunkRNQHRDCQcjs.ja; exports.evaluateArchitectureGraph = He; exports.explainViolation = zs; exports.extractSemanticDependencies = Ne; exports.formatArkRunGraphMermaid = _chunkA5EIY3HIcjs.q; exports.formatArkRunInspectorSseEvent = _chunkA5EIY3HIcjs.W; exports.getDiagnosticCatalogEntry = ut; exports.isArkRunInspectorLoopbackHost = _chunkA5EIY3HIcjs.M; exports.isArkRunInspectorProductionEnv = _chunkA5EIY3HIcjs.L; exports.isCataloguedOrArkRuleFamily = Po; exports.isKnownDiagnosticCode = No; exports.isLayerPolicy = _chunkRNQHRDCQcjs.k; exports.loadContract = vt; exports.loadResolvedCandidateFacts = Ae; exports.policyDeltaAcknowledgementMatches = In; exports.preflightChange = Ta; exports.preflightResolvedChange = La; exports.replayInformationPackages = $a; exports.requestArkRunGraph = _chunkA5EIY3HIcjs.r; exports.resolveArkRunInspectorBind = _chunkA5EIY3HIcjs.N; exports.resolveArkRunSendPlan = _chunkA5EIY3HIcjs.x; exports.resolvedFactsEvidenceRequirementsHash = Xe; exports.serializeDiagnosticCatalog = Do; exports.shadowInformationPackage = Fa; exports.stableSerialize = W; exports.startArkRunInspector = _chunkRNQHRDCQcjs.ta; exports.syncRegistryToGraph = _chunkRNQHRDCQcjs._; exports.toAdapterDiagnostic = Gt; exports.unavailableArkRunInspectorOutboxMonitor = _chunkA5EIY3HIcjs.S; exports.unavailableArkRunInspectorWorkflowsMonitor = _chunkA5EIY3HIcjs.U; exports.validateIntentName = _chunkRNQHRDCQcjs.f; exports.version = _chunkRNQHRDCQcjs.a;
|
|
10
|
+
`,t);return e.slice(n,r===-1?e.length:r)}_chunkA5EIY3HIcjs.a.call(void 0, Gi,"lineAt");function ji(e){let t=e.trim();return/^import\b/.test(t)||/^export\s+/.test(t)&&/\bfrom\b/.test(t)?!0:/\brequire\s*\(/.test(t)}_chunkA5EIY3HIcjs.a.call(void 0, ji,"isImportLine");function vs(e,t,n){if(!t||!e.includes(t))return;let r=new Set,a=0,s=e.length,o=_chunkA5EIY3HIcjs.a.call(void 0, (c,l)=>{if(e.startsWith(t,c)){if(l==="comment"){r.add("comment");return}if(l==="string"){r.add("string");return}if(ji(Gi(e,c))){r.add("import");return}n&&r.add("test-body")}},"note");for(;a<s;){let c=e[a],l=e[a+1];if(c==="/"&&l==="/"){for(;a<s&&e[a]!==`
|
|
11
|
+
`;)o(a,"comment"),a+=1;continue}if(c==="/"&&l==="*"){for(o(a,"comment"),o(a+1,"comment"),a+=2;a<s&&!(e[a]==="*"&&e[a+1]==="/");)o(a,"comment"),a+=1;a<s&&(o(a,"comment"),o(a+1,"comment"),a+=2);continue}if(c==='"'||c==="'"||c==="`"){let p=c;for(o(a,"string"),a+=1;a<s;){let f=e[a];if(f==="\\"){o(a,"string"),e[a+1]!==void 0&&o(a+1,"string"),a+=e[a+1]===void 0?1:2;continue}if(f===p){o(a,"string"),a+=1;break}o(a,"string"),a+=1}continue}o(a,"code"),a+=1}if(r.has("comment"))return"comment";if(r.has("string"))return"string";if(r.has("test-body"))return"test-body";if(r.has("import"))return"import"}_chunkA5EIY3HIcjs.a.call(void 0, vs,"mentionContext");function Ss(e){if(!e)return;let t=e.split("."),n=_nullishCoalesce(t[t.length-1], () => (""));return n?{className:t.length>1&&t[t.length-2]||null,name:n}:void 0}_chunkA5EIY3HIcjs.a.call(void 0, Ss,"symbolNeedle");function Bi(e){return _nullishCoalesce(_optionalChain([Ss, 'call', _68 => _68(_optionalChain([e, 'access', _69 => _69.coverage, 'optionalAccess', _70 => _70.symbol])), 'optionalAccess', _71 => _71.name]), () => (e.id))}_chunkA5EIY3HIcjs.a.call(void 0, Bi,"declaredLabel");function bs(e){return Object.keys(e).sort((t,n)=>t<n?-1:t>n?1:0)}_chunkA5EIY3HIcjs.a.call(void 0, bs,"sortedContentFiles");function zi(e,t,n=!0){let r=_nullishCoalesce(t.testFiles, () => ([])),a=new Set(r.map(A=>Ve(A))),s=(_nullishCoalesce(t.coverageRoots, () => ([]))).filter(A=>typeof A=="string"&&A.length>0),o=_optionalChain([e, 'access', _72 => _72.coverage, 'optionalAccess', _73 => _73.test])!==!1&&n,c=Ss(_nullishCoalesce(_optionalChain([e, 'access', _74 => _74.coverage, 'optionalAccess', _75 => _75.symbol]), () => (void 0))),l,p;if(o){for(let A of r){let d=t.fileContents[A];if(!d)continue;let g=Vi(d,e.id);if(g!==void 0){if(s.length===0||Is(A,s)){l={file:A,title:g};break}p??={file:A,title:g}}}l??=p}let f;if(c)for(let A of bs(t.fileContents)){if(a.has(Ve(A)))continue;let d=t.fileContents[A];if(!d)continue;let g=c.className?Ui(d,c.className,c.name):Es(d,c.name);if(g){f={file:A,shape:g};break}}let h;if(!l&&!f){if(o)for(let A of r){let d=t.fileContents[A];if(!d)continue;let g=vs(d,e.id,!0);if(g){h={file:A,context:g};break}}if(!h&&c)for(let A of bs(t.fileContents)){if(a.has(Ve(A)))continue;let d=t.fileContents[A];if(!d)continue;let g=vs(d,c.name,!1);if(g){h={file:A,context:g};break}}}let u=l?{kind:"test-title",file:l.file,title:l.title}:f?{kind:"declaration",file:f.file,shape:f.shape}:h?{kind:"mention-only",file:h.file,context:h.context}:{kind:"none"};return u.kind==="mention-only"&&u.context==="comment"&&c&&Wi(t.fileContents,a,c.name,u.file)&&(u={kind:"declaration-miss",symbol:c.name}),{best:u,...l?{testTitle:l}:{},...f?{declaration:f}:{}}}_chunkA5EIY3HIcjs.a.call(void 0, zi,"rankCoverage");function Wi(e,t,n,r){let a=new RegExp(`(?:^|[^A-Za-z0-9_$])${mn(n)}(?=$|[^A-Za-z0-9_$])`),s=Ve(r);for(let o of Object.keys(e)){if(t.has(Ve(o))||Ve(o)===s)continue;let c=e[o];if(c&&a.test(hn(c,!0)))return!0}return!1}_chunkA5EIY3HIcjs.a.call(void 0, Wi,"symbolInCodeElsewhere");function qi(e){switch(e.kind){case"test-title":case"declaration":return!0;case"mention-only":case"declaration-miss":case"none":return!1}}_chunkA5EIY3HIcjs.a.call(void 0, qi,"countsAsCoverage");function Yi(e){switch(e){case"test-body":return"a test body";case"comment":return"a comment";case"string":return"a string";case"import":return"an import"}}_chunkA5EIY3HIcjs.a.call(void 0, Yi,"mentionWhere");function Xi(e,t){switch(t.kind){case"test-title":return`found \`${t.title}\` in a describe/it title in ${t.file}`;case"declaration":return`found \`${t.shape} ${Bi(e)}\` in ${t.file}`;case"mention-only":return`${e.id} appears only in ${Yi(t.context)} in ${t.file}; put it in a describe/it title`;case"declaration-miss":return`no declaration matched \`${t.symbol}\``;case"none":return"no scanned test names it in a describe/it title and no declared symbol was found"}}_chunkA5EIY3HIcjs.a.call(void 0, Xi,"describeCoverage");function Cs(e){let t=_nullishCoalesce(e.arkRules.invariants, () => ([]));if(t.length===0)return{coverage:[],violations:[],partial:!1};let n=_nullishCoalesce(e.testFiles, () => ([])),r=e.testGlobsMissing===!0||n.length===0,a=e.coverageBudgetExhausted===!0,s=e.coverageStats,o=ks(s),c=ks(s,!0),l=s?`coverage file budget exhausted: ${s.filesLoaded} files loaded at the ${s.maxFiles}-file cap, ${s.testFilesRetained} tests retained, ${s.discarded.budget} files discarded at the cap; raise "coverage.maxFiles" in ark.config.json (the cap bounds files RETAINED as evidence${typeof s.filesRead=="number"?`; ${s.filesRead} were read`:""})`:"coverage file budget exhausted",p=(_nullishCoalesce(e.coverageRoots, () => ([]))).filter(d=>typeof d=="string"&&d.length>0),f=p.length>0,h=p.join(", "),u=[],A=[];for(let d of t){let g=_optionalChain([d, 'access', _76 => _76.coverage, 'optionalAccess', _77 => _77.test])!==!1,b=_optionalChain([d, 'access', _78 => _78.coverage, 'optionalAccess', _79 => _79.symbol]),x=!r&&g,k=zi(d,{fileContents:e.fileContents,testFiles:n,coverageRoots:p},x),E=k.best,C=[];x&&k.testTitle&&C.push("test-title"),k.declaration&&C.push("symbol");let U=qi(E),K,G;x&&k.testTitle&&(K=k.testTitle.file,f&&(G=!Is(K,p)));let I=_optionalChain([k, 'access', _80 => _80.declaration, 'optionalAccess', _81 => _81.file]),D=_optionalChain([k, 'access', _82 => _82.declaration, 'optionalAccess', _83 => _83.shape]),Y=_optionalChain([d, 'access', _84 => _84.coverage, 'optionalAccess', _85 => _85.test])===!0||!!b||d.coverage===void 0,re=_optionalChain([d, 'access', _86 => _86.coverage, 'optionalAccess', _87 => _87.test])===!1&&!b,me=Y&&U||re&&d.mode!=="enforced"?!0:U,se=r&&g&&!U;if(u.push({invariantId:d.id,layer:d.provenance.layer,sourceFile:d.provenance.sourceFile,mode:d.mode,covered:me&&!se,evidence:C,partial:se,description:d.description,...K!==void 0?{testEvidenceFile:K}:{},...I!==void 0?{symbolEvidenceFile:I}:{},...D!==void 0?{shape:D}:{},...G!==void 0?{outsideDeclaredRoots:G}:{},coverageRootsDeclared:f}),G===!0&&K!==void 0&&A.push({ruleId:"INVARIANT_COVERAGE_OUTSIDE_ROOTS",message:`Invariant ${d.id} is covered only by ${K}, which is outside the declared coverage roots (${h}). ArkGate matches declared text and never executes tests, so it cannot tell whether that file is run: move the test under a declared root, or add its root to "coverage.coverageRoots" in ark.config.json.`,file:K,line:1,arkruleId:d.id,arkruleSource:d.provenance.sourceFile,fromLayer:d.provenance.layer,severity:"warning",failsStrict:!1}),!me||se){let Oe=d.mode==="enforced"&&!se,ke=r||n.length===0?"never-had-tests":"tests-disappeared";A.push({ruleId:"INVARIANT_UNCOVERED",message:(se?a?`Invariant ${d.id} coverage cannot be proven (${l}); reporting partial, not covered.`:`Invariant ${d.id} coverage cannot be proven (test globs missing or empty); reporting partial, not covered (never-had-tests).`:re?`Invariant ${d.id} is enforced but declares no evidence (coverage.test is false and no coverage.symbol); set coverage.symbol, drop test:false, or keep mode "advisory".`:`Invariant ${d.id}: ${Xi(d,E)} (${ke==="tests-disappeared"?"tests-disappeared \u2014 a suite exists":"never-had-tests \u2014 the scan found no tests at all"}). ArkGate matches declared text; it never executes tests.`)+(se&&a?c:o),file:d.provenance.sourceFile,line:1,arkruleId:d.id,arkruleSource:d.provenance.sourceFile,fromLayer:d.provenance.layer,severity:Oe?"error":"warning",failsStrict:Oe,kind:ke})}}return{coverage:u,violations:A,partial:u.some(d=>d.partial)}}_chunkA5EIY3HIcjs.a.call(void 0, Cs,"evaluateInvariantCoverage");function _s(e){return e?e.partial?{ok:!1,reason:"Coverage is partial (missing test globs); cannot promote until evidence is complete."}:e.covered?Array.isArray(e.evidence)&&e.evidence.length===0?{ok:!1,reason:`Invariant ${e.invariantId} declares no evidence (coverage.test:false and no symbol); add coverage.symbol or a test title before promoting to enforced.`}:e.outsideDeclaredRoots===!0?{ok:!1,reason:`Invariant ${e.invariantId} is covered only by ${_nullishCoalesce(e.testEvidenceFile, () => ("a test"))}, outside the declared coverage roots; ArkGate cannot tell whether that test runs, so it will not promote on it.`}:e.coverageRootsDeclared===!1?{ok:!1,reason:`Declare coverage.coverageRoots in ark.config.json before promoting ${e.invariantId} to enforced. Without that, ArkGate cannot tell whether a covering test is one the runner executes.`}:_optionalChain([e, 'access', _88 => _88.probe, 'optionalAccess', _89 => _89.fresh])===!0&&Rs(e.probe.verdict)?{ok:!1,reason:As(e.invariantId,e.probe),blocker:"probe-survived"}:{ok:!0,reason:`Invariant ${e.invariantId} has coverage evidence.`}:{ok:!1,reason:`Invariant ${e.invariantId} is uncovered; add a test title or symbol before promoting to enforced.`}:{ok:!1,reason:"No coverage evidence supplied for this invariant; evaluate coverage before promoting to enforced."}}_chunkA5EIY3HIcjs.a.call(void 0, _s,"canPromoteInvariant");function gn(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(typeof n!="string")continue;let r=n.trim();r.length>0&&t.push(r)}return t}_chunkA5EIY3HIcjs.a.call(void 0, gn,"nonEmptyPathStrings");function Zi(e){return!e||typeof e!="object"?[]:[...gn(e.testGlobs),...gn(e.coverageRoots)]}_chunkA5EIY3HIcjs.a.call(void 0, Zi,"configuredInvariantTestsPaths");function Ji(e){return Zi(e).length>0}_chunkA5EIY3HIcjs.a.call(void 0, Ji,"hasConfiguredInvariantTestsPath");function yn(e){return!Array.isArray(e)||e.length===0?!1:e.some(t=>t!=null&&_optionalChain([t, 'access', _90 => _90.coverage, 'optionalAccess', _91 => _91.test])!==!1)}_chunkA5EIY3HIcjs.a.call(void 0, yn,"catalogDemandsInvariantTestsPath");function Os(e){let t=e.hasDomainInvariants===!0||e.hasDomainInvariants!==!1&&yn(e.invariants);return e.adopted!==!0||!t?[]:Ji(e.coverage)&&e.declaredPathPresent!==!1?[]:[{ruleId:$i,message:Mi,file:"ark.config.json",line:1,severity:"error",failsStrict:!0,freezable:!1}]}_chunkA5EIY3HIcjs.a.call(void 0, Os,"collectMissingInvariantTestsPathFindings");function Qi(e){return!e||typeof e!="object"?[]:gn(e.coverageRoots)}_chunkA5EIY3HIcjs.a.call(void 0, Qi,"configuredCoverageRoots");function el(e){return Qi(e).length>0}_chunkA5EIY3HIcjs.a.call(void 0, el,"hasConfiguredCoverageRoots");function Rn(e){return!Array.isArray(e)||e.length===0?!1:e.some(t=>t!=null&&t.mode==="enforced")}_chunkA5EIY3HIcjs.a.call(void 0, Rn,"catalogHasEnforcedInvariant");function xs(e){return e.hasEnforcedInvariant===!0||e.hasEnforcedInvariant!==!1&&Rn(e.invariants)?el(e.coverage)&&e.declaredPathPresent!==!1?[]:[{ruleId:Hi,message:Ki,file:"ark.config.json",line:1,severity:"error",failsStrict:!0,freezable:!1}]:[]}_chunkA5EIY3HIcjs.a.call(void 0, xs,"collectMissingCoverageRootsFindings");var bn="1.0",tl="add a short note under docs/adr/ (or docs/decisions/) and put that file path in --policy-ack as adrPath.";function O(e,t){let n=t.classification==="weakening"||t.classification==="judgment-required"?`Restore the previous protection at ${t.path}, or ${tl}`:void 0,r=_nullishCoalesce(t.nextAction, () => (n));e.push({id:`${t.classification}:${t.path}:${t.kind}`,path:t.path,classification:t.classification,message:t.message,...r?{nextAction:r}:{},...t.before===void 0?{}:{before:t.before},...t.after===void 0?{}:{after:t.after}})}_chunkA5EIY3HIcjs.a.call(void 0, O,"addFinding");function H(e){return[...new Set(_nullishCoalesce(e, () => ([])))].sort()}_chunkA5EIY3HIcjs.a.call(void 0, H,"sortedUnique");function oe(e,t,n,r,a){let s=H(n),o=H(r),c=new Set(s),l=new Set(o),p=o.filter(h=>!c.has(h)),f=s.filter(h=>!l.has(h));p.length===0&&f.length===0||(p.length>0&&O(e,{kind:"added",path:t,classification:a.added,message:a.addedMessage,before:s,after:o}),f.length>0&&O(e,{kind:"removed",path:t,classification:a.removed,message:a.removedMessage,before:s,after:o}))}_chunkA5EIY3HIcjs.a.call(void 0, oe,"compareStringSets");function et(e,t,n,r,a,s,o){if(n===r)return;O(e,{kind:r?"enabled":"disabled",path:t,classification:r?a:a==="strengthening"?"weakening":"strengthening",message:r?s:o,before:n,after:r})}_chunkA5EIY3HIcjs.a.call(void 0, et,"compareBoolean");function bt(e,t){let n=new Map,r=new Set;for(let a of e){let s=t(a);n.has(s)?r.add(s):n.set(s,a)}return{values:n,duplicates:[...r].sort()}}_chunkA5EIY3HIcjs.a.call(void 0, bt,"keyed");function nl(e,t,n){let r=bt(t,s=>s.name),a=bt(n,s=>s.name);(r.duplicates.length>0||a.duplicates.length>0)&&O(e,{kind:"duplicate-layer",path:"$.layers",classification:"judgment-required",message:"Duplicate layer names make policy ownership ambiguous.",before:r.duplicates,after:a.duplicates});for(let s of[...new Set([...r.values.keys(),...a.values.keys()])].sort()){let o=r.values.get(s),c=a.values.get(s),l=`$.layers[${s}]`;if(!o&&c){O(e,{kind:"layer-added",path:l,classification:"judgment-required",message:"A layer was added; verify overlap, ownership, and rule coverage.",nextAction:"Write a short note under docs/adr/ (or docs/decisions/) for this new layer and put that file path in --policy-ack as adrPath.",after:c});continue}if(o&&!c){O(e,{kind:"layer-removed",path:l,classification:"weakening",message:"Removing a layer can leave its source paths ungoverned.",before:o});continue}if(!o||!c)continue;oe(e,`${l}.patterns`,o.patterns,c.patterns,{added:"strengthening",removed:"weakening",addedMessage:"Additional paths are governed by this layer.",removedMessage:"Paths were removed from this layer and may become ungoverned."}),oe(e,`${l}.exclude`,o.exclude,c.exclude,{added:"weakening",removed:"strengthening",addedMessage:"Additional paths are excluded from this layer.",removedMessage:"Fewer paths are excluded from this layer."});let p=At(o),f=At(c);oe(e,`${l}.forbiddenGlobals`,p.rawGlobals,f.rawGlobals,{added:"strengthening",removed:"weakening",addedMessage:"Additional forbidden globals are enforced in this layer.",removedMessage:"A forbidden-global protection was removed from this layer."}),oe(e,`${l}.capabilities`,p.atoms,f.atoms,{added:"strengthening",removed:"weakening",addedMessage:"Additional ambient/import protection is enforced in this layer (coverage atoms).",removedMessage:"An ambient/import protection was lost from this layer (coverage atoms)."}),H(o.intentPrefixes).join("\0")!==H(c.intentPrefixes).join("\0")&&O(e,{kind:"intent-prefixes-changed",path:`${l}.intentPrefixes`,classification:"judgment-required",message:"Intent ownership changed and must be reviewed against publishers and consumers.",before:H(o.intentPrefixes),after:H(c.intentPrefixes)}),et(e,`${l}.mayImportInfrastructure`,o.mayImportInfrastructure===!0,c.mayImportInfrastructure===!0,"weakening","The layer may now import infrastructure directly.","Direct infrastructure imports are no longer allowed for this layer."),et(e,`${l}.optional`,o.optional===!0,c.optional===!0,"weakening","The layer is now optional and can be absent without a strict warning.","The layer is now required when its contract is active.")}}_chunkA5EIY3HIcjs.a.call(void 0, nl,"compareLayers");function rl(e,t,n){let r=_chunkA5EIY3HIcjs.a.call(void 0, o=>`${o.from}->${o.to}`,"keyOf"),a=bt(t,r),s=bt(n,r);(a.duplicates.length>0||s.duplicates.length>0)&&O(e,{kind:"duplicate-rule",path:"$.rules",classification:"judgment-required",message:"Duplicate rule edges make the effective verdict order-dependent.",before:a.duplicates,after:s.duplicates});for(let o of[...new Set([...a.values.keys(),...s.values.keys()])].sort()){let c=a.values.get(o),l=s.values.get(o),p=`$.rules[${o}]`;if(!c&&l){l.allowed===!1?O(e,{kind:"deny-added",path:p,classification:"strengthening",message:"A denied dependency edge was added.",after:l}):O(e,{kind:"allow-added",path:p,classification:"judgment-required",message:"A new import edge was added; confirm this house should import that one.",nextAction:"Write a short note under docs/adr/ (or docs/decisions/) for this new import edge and put that file path in --policy-ack as adrPath.",after:l});continue}if(c&&!l){c.allowed===!1&&O(e,{kind:"deny-removed",path:p,classification:"weakening",message:"A denied dependency edge was removed.",before:c});continue}if(!c||!l)continue;c.allowed!==l.allowed&&O(e,{kind:l.allowed?"deny-disabled":"deny-enabled",path:`${p}.allowed`,classification:l.allowed?"weakening":"strengthening",message:l.allowed?"A previously denied dependency edge is now allowed.":"A dependency edge is now denied.",before:c.allowed,after:l.allowed});let f=c.peerIsolation===!0,h=l.peerIsolation===!0;if(f!==h){let b=c.from===c.to&&l.from===l.to;O(e,{kind:h?"peer-isolation-enabled":"peer-isolation-disabled",path:`${p}.peerIsolation`,classification:b?h?"strengthening":"weakening":"judgment-required",message:b?h?"Cross-slice dependencies inside this layer are now denied.":"Cross-slice dependencies inside this layer are no longer denied.":"Changing peer isolation on a cross-layer edge changes the denial scope.",before:f,after:h})}H(c.sliceFolders).join("\0")!==H(l.sliceFolders).join("\0")&&O(e,{kind:"slice-folders-changed",path:`${p}.sliceFolders`,classification:"judgment-required",message:"Slice ownership folders changed and can reclassify existing dependencies.",before:H(c.sliceFolders),after:H(l.sliceFolders)});let u=_nullishCoalesce(c.sliceIdentity, () => ("path")),A=_nullishCoalesce(l.sliceIdentity, () => ("path"));if(u!==A&&O(e,{kind:"slice-identity-changed",path:`${p}.sliceIdentity`,classification:"judgment-required",message:"Slice identity changed and can reclassify existing slice ids. Baselines and allowedCrossSlice use those ids.",before:u,after:A}),!f&&!h)continue;vt(e,`${p}.sharedRoots`,"shared-roots",H(c.sharedRoots),H(l.sharedRoots),"Roots declared shared are exempt from the peerIsolation unclassifiable denial.","Roots are no longer declared shared and fall back to the peerIsolation denial."),vt(e,`${p}.allowedCrossSlice`,"cross-slice-allowance",H((_nullishCoalesce(c.allowedCrossSlice, () => ([]))).map(vn)),H((_nullishCoalesce(l.allowedCrossSlice, () => ([]))).map(vn)),"Directed cross-slice edges are now allowed by declaration.","Directed cross-slice edges are no longer declared and deny again.");let d=_nullishCoalesce(_chunkUN5EH4QVcjs.n.call(void 0, c.sharedImportsSlice), () => (null)),g=_nullishCoalesce(_chunkUN5EH4QVcjs.n.call(void 0, l.sharedImportsSlice), () => (null));if(d!==g){let b=Ks(g)>Ks(d);O(e,{kind:"shared-imports-slice",path:`${p}.sharedImportsSlice`,classification:b?"strengthening":"weakening",message:Rl(d,g),before:d,after:g})}else g==="deny-cross-parent"&&vt(e,`${p}.sharedImportsSlice.stopAt`,"shared-walk-stop",Ts(c.sharedImportsSlice),Ts(l.sharedImportsSlice),"Composition roots now stop the cross-parent walk. Paths through them are no longer reported.","Composition roots no longer stop the cross-parent walk. Paths through them are reported again.");al(e,p,c,l)}}_chunkA5EIY3HIcjs.a.call(void 0, rl,"compareRules");function ws(e){let t=e.childSlices;return t?JSON.stringify([H(_nullishCoalesce(t.sliceFolders, () => ([]))),_nullishCoalesce(t.sliceIdentity, () => ("path")),H(_nullishCoalesce(t.commonFolders, () => ([])))]):""}_chunkA5EIY3HIcjs.a.call(void 0, ws,"childSliceFoldersKey");function Ts(e){return H(_chunkUN5EH4QVcjs.o.call(void 0, e).map(t=>tt(t.trim().replace(/\\/g,"/")).toLowerCase()))}_chunkA5EIY3HIcjs.a.call(void 0, Ts,"stopAtKeys");function Ns(e){return e==="always"?2:e==="auto"?1:0}_chunkA5EIY3HIcjs.a.call(void 0, Ns,"siblingRatchetRank");function sl(e){return H((_nullishCoalesce(e, () => ([]))).map(t=>tt(t.trim().replace(/\\/g,"/")).toLowerCase()))}_chunkA5EIY3HIcjs.a.call(void 0, sl,"enforceKeys");function Ps(e){if(!e.childSlices)return null;let t=e.childSlices.siblings;return t==null||t==="deny"?{mode:"deny",enforce:[],ratchet:"auto"}:t==="advisory"?{mode:"advisory",enforce:[],ratchet:"auto"}:t.default==="deny"?{mode:"deny",enforce:[],ratchet:"auto"}:{mode:"advisory",enforce:sl(t.enforce),ratchet:_chunkUN5EH4QVcjs.D.call(void 0, t)}}_chunkA5EIY3HIcjs.a.call(void 0, Ps,"childSliceSiblingPolicy");function al(e,t,n,r){let a=Ps(n),s=Ps(r);if(a===null&&s===null)return;if(a===null&&s!==null){O(e,{kind:"child-slices-added",path:`${t}.childSlices`,classification:s.mode==="advisory"?"judgment-required":"strengthening",message:s.mode==="advisory"?"A child slice wall was added with advisory sibling crossings.":"A child slice wall was added. Sibling crossings inside a universe are now denied.",after:r.childSlices});return}if(a!==null&&s===null){O(e,{kind:"child-slices-removed",path:`${t}.childSlices`,classification:"weakening",message:"The child slice wall was removed. Sibling crossings inside a universe are allowed again.",before:n.childSlices});return}if(ws(n)!==ws(r)){O(e,{kind:"child-slices-changed",path:`${t}.childSlices`,classification:"judgment-required",message:"Child slice folders changed and can reclassify edges inside a universe.",before:n.childSlices,after:r.childSlices});return}if(a===null||s===null)return;if(a.mode!==s.mode){let l=s.mode==="advisory";O(e,{kind:"child-slices-siblings",path:`${t}.childSlices.siblings`,classification:l?"weakening":"strengthening",message:l?s.enforce.length>0?"Sibling crossings outside the enforce list are now advisory.":"Sibling crossings inside a universe are now advisory.":"Sibling crossings inside a universe are now denied.",before:a.mode,after:s.mode})}else if(a.mode==="advisory"&&(ol(e,`${t}.childSlices.siblings.enforce`,a.enforce,s.enforce),a.ratchet!==s.ratchet)){let l=Ns(s.ratchet)>Ns(a.ratchet);O(e,{kind:"child-slices-siblings-ratchet",path:`${t}.childSlices.siblings.ratchet`,classification:l?"strengthening":"weakening",message:l?"New advisory sibling crossings past the baseline fail in more cases.":s.ratchet==="never"?"Advisory sibling crossings are measured only and never fail.":"New advisory sibling crossings past the baseline fail in fewer cases.",before:a.ratchet,after:s.ratchet})}let o=_optionalChain([n, 'access', _92 => _92.childSlices, 'optionalAccess', _93 => _93.parentMayImportChild])===!0,c=_optionalChain([r, 'access', _94 => _94.childSlices, 'optionalAccess', _95 => _95.parentMayImportChild])===!0;o!==c&&O(e,{kind:"child-slices-parent-import",path:`${t}.childSlices.parentMayImportChild`,classification:c?"weakening":"strengthening",message:c?"Universe common may now import a child slice.":"Universe common may no longer import a child slice.",before:o,after:c}),dl(e,t,n,r),cl(e,t,n,r)}_chunkA5EIY3HIcjs.a.call(void 0, al,"compareChildSlices");function Vs(e,t){if(JSON.stringify(e)===JSON.stringify(t))return null;let n=t.filter(a=>!e.includes(a)),r=e.filter(a=>!t.includes(a));return{added:n,removed:r,bothWays:n.length>0&&r.length>0}}_chunkA5EIY3HIcjs.a.call(void 0, Vs,"stringListDelta");function ol(e,t,n,r){let a=Vs(n,r);if(!a)return;let{added:s,bothWays:o}=a;O(e,{kind:o?"child-slices-siblings-enforce-changed":"child-slices-siblings-enforce",path:t,classification:o?"judgment-required":s.length>0?"strengthening":"weakening",message:o?"Enforced sibling subtrees were added and removed in the same change.":s.length>0?"Sibling crossings from these subtrees are now errors.":"Sibling crossings from these subtrees are advisory again.",before:n,after:r})}_chunkA5EIY3HIcjs.a.call(void 0, ol,"compareSiblingEnforceList");function vn(e){return JSON.stringify([e.from,e.to])}_chunkA5EIY3HIcjs.a.call(void 0, vn,"crossSliceKey");function Ls(e){return H((_nullishCoalesce(_optionalChain([e, 'access', _96 => _96.childSlices, 'optionalAccess', _97 => _97.allowedCrossSlice]), () => ([]))).map(vn))}_chunkA5EIY3HIcjs.a.call(void 0, Ls,"childCrossSliceKeys");function Ue(e){return tt(e.trim().replace(/\\/g,"/")).toLowerCase().split("/").filter(t=>t.length>0)}_chunkA5EIY3HIcjs.a.call(void 0, Ue,"allowanceSegments");function Ds(e,t){let n=Ue(e),r=Ue(t);if(n.length===0||n.length!==r.length)return!1;let a=!1;for(let s=0;s<n.length;s+=1)if(n[s]!==r[s]){if(n[s]==="*"&&r[s]!=="*"){a=!0;continue}return!1}return a}_chunkA5EIY3HIcjs.a.call(void 0, Ds,"patternWidens");function il(e,t){let n=JSON.parse(e),r=JSON.parse(t),a=Ue(n[0]).join("/")===Ue(r[0]).join("/"),s=Ue(n[1]).join("/")===Ue(r[1]).join("/"),o=Ds(n[0],r[0]),c=Ds(n[1],r[1]);return!(a||o)||!(s||c)?!1:o||c}_chunkA5EIY3HIcjs.a.call(void 0, il,"allowanceWidens");function ll(e){return JSON.stringify([tt(e.from.trim().replace(/\\/g,"/")).toLowerCase(),tt(e.to.trim().replace(/\\/g,"/")).toLowerCase()])}_chunkA5EIY3HIcjs.a.call(void 0, ll,"aliasEntryKey");function Fs(e){return H((_nullishCoalesce(_optionalChain([e, 'access', _98 => _98.childSlices, 'optionalAccess', _99 => _99.sliceAliases]), () => ([]))).map(ll))}_chunkA5EIY3HIcjs.a.call(void 0, Fs,"sliceAliasKeys");function cl(e,t,n,r){let a=Fs(n),s=Fs(r);if(JSON.stringify(a)===JSON.stringify(s))return;let o=s.filter(p=>!a.includes(p)),c=a.filter(p=>!s.includes(p)),l=o.length>0&&c.length>0;O(e,{kind:l?"slice-aliases-changed":o.length>0?"slice-aliases-added":"slice-aliases-removed",path:`${t}.childSlices.sliceAliases`,classification:l?"judgment-required":o.length>0?"strengthening":"weakening",message:l?"Slice aliases were added and removed in the same change.":o.length>0?"Unclassified files are now under the slice walls.":"Aliased files leave the slice walls.",before:a,after:s})}_chunkA5EIY3HIcjs.a.call(void 0, cl,"compareSliceAliases");function dl(e,t,n,r){let a=Ls(n),s=Ls(r);if(JSON.stringify(a)===JSON.stringify(s))return;let o=s.filter(l=>!a.includes(l)),c=a.filter(l=>!s.includes(l));if(o.length>0&&c.length>0&&c.filter(p=>!o.some(f=>il(f,p))).length===0){O(e,{kind:"child-slices-cross-slice-allowance-added",path:`${t}.childSlices.allowedCrossSlice`,classification:"weakening",message:"A wildcard widened a declared sibling allowance.",before:a,after:s});return}vt(e,`${t}.childSlices.allowedCrossSlice`,"child-slices-cross-slice-allowance",a,s,"Sibling crossings inside a universe are now allowed by declaration.","Declared sibling crossings inside a universe deny again.")}_chunkA5EIY3HIcjs.a.call(void 0, dl,"compareChildCrossSliceAllowances");function vt(e,t,n,r,a,s,o){let c=Vs(r,a);if(!c)return;let{added:l,bothWays:p}=c;O(e,{kind:p?`${n}-changed`:l.length>0?`${n}-added`:`${n}-removed`,path:t,classification:p?"judgment-required":l.length>0?"weakening":"strengthening",message:p?`${s} Entries were added and removed in the same change.`:l.length>0?s:o,before:r,after:a})}_chunkA5EIY3HIcjs.a.call(void 0, vt,"compareDeclaredExceptions");function ul(e,t,n){let r=_nullishCoalesce(t.safety, () => ({})),a=_nullishCoalesce(n.safety, () => ({}));for(let s of["maxTsSuppressions","maxAnyCasts"]){let o=_nullishCoalesce(r[s], () => (0)),c=_nullishCoalesce(a[s], () => (0));o!==c&&O(e,{kind:c>o?"threshold-raised":"threshold-lowered",path:`$.safety.${s}`,classification:c>o?"weakening":"strengthening",message:c>o?"The safety threshold allows more violations.":"The safety threshold allows fewer violations.",before:o,after:c})}for(let s of["allowInMemory","allowDisabledPeerIsolation"])et(e,`$.safety.${s}`,r[s]===!0,a[s]===!0,"weakening","A safety exception was enabled.","A safety exception was disabled.")}_chunkA5EIY3HIcjs.a.call(void 0, ul,"compareSafety");function An(e){return e.mode==="enforced"?"enforced":"advisory"}_chunkA5EIY3HIcjs.a.call(void 0, An,"arkRunMode");function kn(e){return e.mode==="enforced"?"enforced":"advisory"}_chunkA5EIY3HIcjs.a.call(void 0, kn,"arkOrderMode");function pl(e,t,n){let r=t.arkOrder,a=n.arkOrder,s="$.arkOrder";if(!r&&!a)return;if(!r&&a){O(e,{kind:"arkorder-added",path:s,classification:"strengthening",message:`ArkOrder extra was added (${kn(a)}).`,after:a});return}if(r&&!a){O(e,{kind:"arkorder-removed",path:s,classification:"weakening",message:"ArkOrder extra was removed.",before:r});return}if(!r||!a)return;let o=kn(r),c=kn(a);if(o!==c){let l=o==="advisory"&&c==="enforced";O(e,{kind:l?"arkorder-promoted":"arkorder-demoted",path:`${s}.mode`,classification:l?"strengthening":"weakening",message:l?"ArkOrder extra was promoted to enforced.":"ArkOrder extra was demoted to advisory.",before:o,after:c})}oe(e,`${s}.planeRoots`,r.planeRoots,a.planeRoots,{added:"strengthening",removed:"weakening",addedMessage:"Additional ArkOrder plane roots are governed.",removedMessage:"ArkOrder plane roots were removed and may skip the plane."}),oe(e,`${s}.managedLayers`,r.managedLayers,a.managedLayers,{added:"strengthening",removed:"weakening",addedMessage:"Additional layers are managed by ArkOrder.",removedMessage:"Layers were removed from ArkOrder management."})}_chunkA5EIY3HIcjs.a.call(void 0, pl,"compareArkOrder");function fl(e,t,n){let r=t.arkRun,a=n.arkRun,s="$.arkRun";if(!r&&!a)return;if(!r&&a){O(e,{kind:"arkrun-added",path:s,classification:"strengthening",message:`ArkRun extra was added (${An(a)}).`,after:a});return}if(r&&!a){O(e,{kind:"arkrun-removed",path:s,classification:"weakening",message:"ArkRun extra was removed.",before:r});return}if(!r||!a)return;let o=An(r),c=An(a);if(o!==c){let l=o==="advisory"&&c==="enforced";O(e,{kind:l?"arkrun-promoted":"arkrun-demoted",path:`${s}.mode`,classification:l?"strengthening":"weakening",message:l?"ArkRun extra was promoted to enforced.":"ArkRun extra was demoted to advisory.",before:o,after:c})}oe(e,`${s}.compositionRoots`,r.compositionRoots,a.compositionRoots,{added:"strengthening",removed:"weakening",addedMessage:"Additional ArkRun composition roots are governed.",removedMessage:"ArkRun composition roots were removed and may skip the kernel."}),oe(e,`${s}.managedLayers`,r.managedLayers,a.managedLayers,{added:"strengthening",removed:"weakening",addedMessage:"Additional layers are managed by ArkRun.",removedMessage:"Layers were removed from ArkRun management."}),et(e,`${s}.requireDeclarations`,r.requireDeclarations!==!1,a.requireDeclarations!==!1,"strengthening","ArkRun now requires interaction declarations.","ArkRun no longer requires interaction declarations.")}_chunkA5EIY3HIcjs.a.call(void 0, fl,"compareArkRun");function gl(e){return e.some(t=>t.classification==="weakening")?"weakening":e.some(t=>t.classification==="judgment-required")?"judgment-required":e.some(t=>t.classification==="strengthening")?"strengthening":"neutral"}_chunkA5EIY3HIcjs.a.call(void 0, gl,"overallClassification");function $s(e,t){return`${e}::${t}`}_chunkA5EIY3HIcjs.a.call(void 0, $s,"ruleKey");function Ms(e){let t=new Map,n=new Map;if(!e)return{structure:t,invariants:n};for(let r of e.structure)t.set($s(r.provenance.layer,r.id),r);for(let r of e.invariants)n.set($s(r.provenance.layer,r.id),r);return{structure:t,invariants:n}}_chunkA5EIY3HIcjs.a.call(void 0, Ms,"indexEffectiveRules");function ml(e){return typeof e=="string"?e.length>0?[e]:[]:Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.length>0):[]}_chunkA5EIY3HIcjs.a.call(void 0, ml,"arkRulesRefPaths");function hl(e,t){if(!e)return[];let n=new Set;for(let r of[...e.structure,...e.invariants])_optionalChain([r, 'access', _100 => _100.provenance, 'optionalAccess', _101 => _101.layer])===t&&r.provenance.sourceFile&&n.add(r.provenance.sourceFile);return[...n]}_chunkA5EIY3HIcjs.a.call(void 0, hl,"arkRulesLayerSources");function Hs(e,t,n){return[...new Set([...ml(e),...hl(t,n)])].sort()}_chunkA5EIY3HIcjs.a.call(void 0, Hs,"arkRulesCatalogPaths");function yl(e,t,n,r,a,s){let o=new Map((_nullishCoalesce(s, () => ([]))).map(u=>[u.invariantId,u])),c=_nullishCoalesce(t.arkRules, () => ({})),l=_nullishCoalesce(n.arkRules, () => ({})),p=new Set([...Object.keys(c),...Object.keys(l)]);for(let u of[..._nullishCoalesce(_optionalChain([r, 'optionalAccess', _102 => _102.structure]), () => ([])),..._nullishCoalesce(_optionalChain([r, 'optionalAccess', _103 => _103.invariants]), () => ([])),..._nullishCoalesce(_optionalChain([a, 'optionalAccess', _104 => _104.structure]), () => ([])),..._nullishCoalesce(_optionalChain([a, 'optionalAccess', _105 => _105.invariants]), () => ([]))])_optionalChain([u, 'access', _106 => _106.provenance, 'optionalAccess', _107 => _107.layer])&&p.add(u.provenance.layer);for(let u of[...p].sort()){let A=c[u],d=l[u],g=`$.arkRules[${u}]`,b=Hs(A,r,u),x=Hs(d,a,u);if(b.join("\0")===x.join("\0"))continue;if(typeof A=="string"&&typeof d=="string"&&A!==d&&b.length===1&&x.length===1&&b[0]===A&&x[0]===d){O(e,{kind:"arkrules-ref-path-changed",path:g,classification:"judgment-required",message:`ArkRules file path for layer ${u} changed; verify the effective rules still match intent.`,before:A,after:d});continue}let k=new Set(b),E=new Set(x);for(let C of x)k.has(C)||O(e,{kind:"arkrules-ref-added",path:C,classification:"strengthening",message:`ArkRules reference for layer ${u} was added (${C}).`,after:C});for(let C of b)E.has(C)||O(e,{kind:"arkrules-ref-removed",path:C,classification:"weakening",message:`ArkRules reference for layer ${u} was removed (${C}).`,before:C})}let f=Ms(r),h=Ms(a);for(let u of[...new Set([...f.structure.keys(),...h.structure.keys()])].sort()){let A=f.structure.get(u),d=h.structure.get(u),g=`$.arkRules.structure[${u}]`;if(!A&&d){O(e,{kind:"arkrule-structure-added",path:g,classification:"strengthening",message:`Structure ArkRule ${d.id} was added (${d.mode}).`,after:d});continue}if(A&&!d){O(e,{kind:"arkrule-structure-removed",path:g,classification:"weakening",message:`Structure ArkRule ${A.id} was removed.`,before:A});continue}if(!(!A||!d)){if(A.mode!==d.mode){let b=A.mode==="advisory"&&d.mode==="enforced";O(e,{kind:b?"arkrule-promoted":"arkrule-demoted",path:`${g}.mode`,classification:b?"strengthening":"weakening",message:b?`Structure ArkRule ${d.id} was promoted to enforced.`:`Structure ArkRule ${d.id} was demoted to advisory.`,before:A.mode,after:d.mode})}A.sensor!==d.sensor&&O(e,{kind:"arkrule-sensor-changed",path:`${g}.sensor`,classification:"judgment-required",message:`Structure ArkRule ${d.id} changed sensor identity.`,before:A.sensor,after:d.sensor})}}for(let u of[...new Set([...f.invariants.keys(),...h.invariants.keys()])].sort()){let A=f.invariants.get(u),d=h.invariants.get(u),g=`$.arkRules.invariants[${u}]`;if(!A&&d){O(e,{kind:"arkrule-invariant-added",path:g,classification:"strengthening",message:`Invariant ${d.id} was added (${d.mode}).`,after:d});continue}if(A&&!d){O(e,{kind:"arkrule-invariant-removed",path:g,classification:"weakening",message:`Invariant ${A.id} was removed.`,before:A});continue}if(!(!A||!d)&&A.mode!==d.mode)if(A.mode==="advisory"&&d.mode==="enforced"){let x=_optionalChain([o, 'optionalAccess', _108 => _108.get, 'call', _109 => _109(d.id)]),k=_s(x);k.ok?O(e,{kind:"arkrule-invariant-promoted",path:`${g}.mode`,classification:"strengthening",message:`Invariant ${d.id} was promoted to enforced (coverage evidence present).`,before:A.mode,after:d.mode}):O(e,{kind:"arkrule-invariant-promote-refused",path:`${g}.mode`,classification:"judgment-required",message:`Invariant ${d.id} cannot be promoted to enforced: ${k.reason}`,before:A.mode,after:d.mode})}else O(e,{kind:"arkrule-invariant-demoted",path:`${g}.mode`,classification:"weakening",message:`Invariant ${d.id} was demoted to advisory.`,before:A.mode,after:d.mode})}}_chunkA5EIY3HIcjs.a.call(void 0, yl,"compareArkRules");function In(e,t,n){let r=[];oe(r,"$.include",e.include,t.include,{added:"strengthening",removed:"weakening",addedMessage:"Additional project roots are governed.",removedMessage:"Project roots were removed from governance."}),oe(r,"$.exclude",e.exclude,t.exclude,{added:"weakening",removed:"strengthening",addedMessage:"Additional project paths are excluded from governance.",removedMessage:"Fewer project paths are excluded from governance."}),oe(r,"$.dynamicImportAllowlist",e.dynamicImportAllowlist,t.dynamicImportAllowlist,{added:"weakening",removed:"strengthening",addedMessage:"Additional files may use non-literal dynamic imports.",removedMessage:"Fewer files may use non-literal dynamic imports."}),et(r,"$.excludeGenerated",e.excludeGenerated!==!1,t.excludeGenerated!==!1,"weakening","Generated source is now excluded from governance.","Generated source is now governed.");let a={off:0,soft:1,"framework-soft":1,strict:2},s=_nullishCoalesce(e.cyclePolicy, () => ("strict")),o=_nullishCoalesce(t.cyclePolicy, () => ("strict"));if(s!==o){let c=a[o]===a[s]?"judgment-required":a[o]>a[s]?"strengthening":"weakening";O(r,{kind:"cycle-policy-changed",path:"$.cyclePolicy",classification:c,message:"The cycle enforcement level changed.",before:s,after:o})}return(_nullishCoalesce(e.frameworkOverlay, () => (null)))!==(_nullishCoalesce(t.frameworkOverlay, () => (null)))&&O(r,{kind:"framework-overlay-changed",path:"$.frameworkOverlay",classification:"judgment-required",message:"The framework overlay changed and may alter effective layer matching.",before:_nullishCoalesce(e.frameworkOverlay, () => (null)),after:_nullishCoalesce(t.frameworkOverlay, () => (null))}),nl(r,e.layers,t.layers),rl(r,e.rules,t.rules),ul(r,e,t),yl(r,e,t,_optionalChain([n, 'optionalAccess', _110 => _110.baseArkRules]),_optionalChain([n, 'optionalAccess', _111 => _111.candidateArkRules]),_optionalChain([n, 'optionalAccess', _112 => _112.candidateInvariantCoverage])),fl(r,e,t),pl(r,e,t),r.sort((c,l)=>c.path.localeCompare(l.path)||c.id.localeCompare(l.id)),{schemaVersion:bn,classification:gl(r),findings:r}}_chunkA5EIY3HIcjs.a.call(void 0, In,"classifyArkPolicyDelta");function En(e,t){if(!e||e.schemaVersion!==bn||typeof e.basePolicyHash!="string"||typeof e.candidatePolicyHash!="string"||typeof e.reason!="string"||!Array.isArray(e.findingIds)||e.findingIds.some(a=>typeof a!="string")||e.reason.trim().length===0||e.basePolicyHash!==t.basePolicyHash||e.candidatePolicyHash!==t.candidatePolicyHash)return!1;let n=H(e.findingIds),r=H(t.findingIds);return n.length===r.length&&n.every((a,s)=>a===r[s])}_chunkA5EIY3HIcjs.a.call(void 0, En,"policyDeltaAcknowledgementMatches");function tt(e){let t=e.length;for(;t>0&&e[t-1]==="/";)t-=1;return e.slice(0,t)}_chunkA5EIY3HIcjs.a.call(void 0, tt,"trimTrailingSlashes");function Ks(e){return e==="deny"?2:e==="deny-cross-parent"?1:0}_chunkA5EIY3HIcjs.a.call(void 0, Ks,"sharedImportsSliceRank");function Rl(e,t){return t==="deny"?"A shared root may no longer import a slice.":e==="deny"&&t==="deny-cross-parent"?"A shared root may import a slice again, except when that hop carries another universe.":e==="deny"?"A shared root may import a slice again.":t==="deny-cross-parent"?"A slice may no longer reach another universe through a shared root. ark-check and CI report that path. The write hook and ESLint see one edge at a time and do not block it.":"A slice may reach another universe through a shared root again."}_chunkA5EIY3HIcjs.a.call(void 0, Rl,"sharedImportsSliceMessage");function _e(e){let t=[];for(let n of e.replace(/\\/g,"/").split("/"))!n||n==="."||(n===".."&&t.length>0&&t.at(-1)!==".."?t.pop():t.push(n));return t.join("/")}_chunkA5EIY3HIcjs.a.call(void 0, _e,"normalizePath");function Us(e){return e!==void 0&&/[A-Za-z_$]/.test(e)}_chunkA5EIY3HIcjs.a.call(void 0, Us,"isIdentifierStart");function It(e){return e!==void 0&&/[A-Za-z0-9_$]/.test(e)}_chunkA5EIY3HIcjs.a.call(void 0, It,"isIdentifierCharacter");function te(e,t){for(;t<e.length&&/\s/.test(e[t]);)t+=1;return t}_chunkA5EIY3HIcjs.a.call(void 0, te,"skipWhitespace");function nt(e,t){let n=e[t];if(n!=="'"&&n!=='"')return;let r=t,a="";for(t+=1;t<e.length;t+=1){let s=e[t];if(s===n)return{value:a,offset:r,excerpt:e.slice(r,t+1)};s==="\\"&&t+1<e.length?(a+=e[t+1],t+=1):a+=s}}_chunkA5EIY3HIcjs.a.call(void 0, nt,"readString");function ne(e,t,n){return e.startsWith(t,n)&&!It(e[n-1])&&!It(e[n+t.length])}_chunkA5EIY3HIcjs.a.call(void 0, ne,"isWordAt");function Gs(e,t){let n=te(e,t);if(e[n]!=="{")return!1;n+=1;let r=!1;for(;n<e.length;){if(n=te(e,n),e[n]==="}")return r;if(e[n]===","){n+=1;continue}if(!ne(e,"type",n))return!1;let a=te(e,n+4);if(a>=e.length||e[a]===","||e[a]==="}"||ne(e,"as",a)||!Us(e[a]))return!1;for(n=a;n<e.length&&It(e[n]);)n+=1;if(n=te(e,n),ne(e,"as",n)){if(n=te(e,n+2),!Us(e[n]))return!1;for(;n<e.length&&It(e[n]);)n+=1}r=!0}return!1}_chunkA5EIY3HIcjs.a.call(void 0, Gs,"bracedNamedBindingsAreTypeOnly");function Al(e,t){if(t=te(e,t+6),e[t]==="(")return nt(e,te(e,t+1));let n=!1;if(ne(e,"type",t)){let a=te(e,t+4);e[a]!==","&&!ne(e,"from",a)&&(n=!0)}else Gs(e,t)&&(n=!0);let r=js(e,t,!0);return r&&n?{...r,typeOnly:!0}:r}_chunkA5EIY3HIcjs.a.call(void 0, Al,"specifierAfterImport");function kl(e,t){t=t+6;let n=te(e,t),r=!1;if(ne(e,"type",n)){let s=te(e,n+4);(e[s]==="{"||e[s]==="*")&&(r=!0)}else Gs(e,n)&&(r=!0);let a=js(e,t,!1);return a&&r?{...a,typeOnly:!0}:a}_chunkA5EIY3HIcjs.a.call(void 0, kl,"specifierAfterExport");function js(e,t,n){for(;t<e.length;t+=1){if(e[t]===";")return;if(ne(e,"from",t))return nt(e,te(e,t+4));if(n&&(e[t]==="'"||e[t]==='"'))return nt(e,t);if(t>0&&(ne(e,"import",t)||ne(e,"export",t)))return}}_chunkA5EIY3HIcjs.a.call(void 0, js,"specifierInStaticStatement");function vl(e,t){for(t+=1;t<e.length;t+=1){let n=e[t];if(n==="\\")t+=1;else if(n==="`")return t}return e.length}_chunkA5EIY3HIcjs.a.call(void 0, vl,"skipTemplateLiteral");function bl(e,t){let n=t-1;for(;n>=0&&/\s/.test(e[n]);)n-=1;if(e[n]===".")return;let r=te(e,t+7);if(e[r]!=="(")return;r=te(e,r+1);let a=nt(e,r);return a?{...a,requireCall:!0}:void 0}_chunkA5EIY3HIcjs.a.call(void 0, bl,"specifierAfterRequire");function Il(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n];if(r==="/"&&e[n+1]==="/"){if(n=e.indexOf(`
|
|
12
|
+
`,n+2),n<0)break;continue}if(r==="/"&&e[n+1]==="*"){let s=e.indexOf("*/",n+2);if(s<0)break;n=s+1;continue}if(r==="`"){n=vl(e,n);continue}if(r==="'"||r==='"'){let s=nt(e,n);s&&(n=s.offset+s.excerpt.length-1);continue}let a=r==="i"&&ne(e,"import",n)?Al(e,n):r==="e"&&ne(e,"export",n)?kl(e,n):r==="r"&&ne(e,"require",n)?bl(e,n):void 0;a&&(t.push(a),n=a.offset+a.excerpt.length-1)}return t}_chunkA5EIY3HIcjs.a.call(void 0, Il,"moduleSpecifiers");function Bs(e,t){let n=[],r=[];for(let a of Il(e.content)){let s=a.value;if(!s.startsWith(".")){if(a.typeOnly)continue;let p=ze(s);if(!p)continue;let f=e.content.slice(0,a.offset).split(`
|
|
13
|
+
`).length;r.push({file:e.path,symbol:s,capability:p,evidence:{kind:"import",file:e.path,line:f,excerpt:a.excerpt}});continue}let o=e.content.slice(0,a.offset).split(`
|
|
14
|
+
`).length,c={kind:"import",file:e.path,line:o,excerpt:a.excerpt},l=El(e.path,s,t);n.push({from:e.path,specifier:s,to:_nullishCoalesce(_optionalChain([l, 'optionalAccess', _113 => _113.path]), () => (null)),resolution:l?"resolved":"unresolved",fromLayer:e.layer,toLayer:_nullishCoalesce(_optionalChain([l, 'optionalAccess', _114 => _114.layer]), () => (null)),evidence:c})}return{edges:n,capabilityUses:r}}_chunkA5EIY3HIcjs.a.call(void 0, Bs,"moduleFactsFor");function El(e,t,n){let r=e.split("/");r.pop();for(let s of t.split("/"))s==="."||s===""||(s===".."?r.pop():r.push(s));let a=r.join("/");for(let s of[a,`${a}.ts`,`${a}.tsx`,`${a}.mts`,`${a}.cts`,`${a}/index.ts`,`${a}/index.tsx`]){let o=n.get(s);if(o)return o}}_chunkA5EIY3HIcjs.a.call(void 0, El,"resolveSpecifier");function zs(e,t){let n=[];for(let r of e){if(!r.to||!r.fromLayer||!r.toLayer)continue;let a=_chunkUN5EH4QVcjs.E.call(void 0, t.rules,r.fromLayer,r.toLayer,{fromPath:r.from,toPath:r.to,layers:t.layers});if(!a)continue;let s=a.rule;n.push({ruleId:`layer-dependency:${s.from}->${s.to}`,message:_nullishCoalesce(_chunkUN5EH4QVcjs.z.call(void 0, s,a.sliceVerdict), () => (`${s.from} must not depend on ${s.to}.`)),edge:r,evidence:r.evidence})}return n}_chunkA5EIY3HIcjs.a.call(void 0, zs,"violationsFor");var Sl={code:"LEXICAL_EVIDENCE_INCOMPLETE",message:"Lexical compatibility mode cannot prove parse status, TypeScript/package/symlink resolution, or symbol-aware source-policy and safety evidence. Use the resolved candidate facts APIs for an authoritative verdict."};function Cl(e,t){return e.arkRules!==void 0&&Object.keys(e.arkRules).length>0||t.structure.length>0||t.invariants.length>0}_chunkA5EIY3HIcjs.a.call(void 0, Cl,"hasActiveArkRules");function _l(e,t){return Cl(e,t)?X(z(fs({config:e,arkRules:t,warnings:[]}))):X(z(un(e)))}_chunkA5EIY3HIcjs.a.call(void 0, _l,"policyHashFor");function Et(e,t,n){let r=typeof e=="string"?_chunkUN5EH4QVcjs.e.call(void 0, e,t):_chunkUN5EH4QVcjs.d.call(void 0, e,t),a=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _115 => _115.arkRules]), () => (Qe()));return{...r,arkRules:a,policyHash:_l(r.config,a)}}_chunkA5EIY3HIcjs.a.call(void 0, Et,"loadContract");function Ws(e){let t=Et(e.baseConfig,_nullishCoalesce(e.baseSource, () => ("base ark.config.json")),{arkRules:e.baseArkRules}),n=Et(e.candidateConfig,_nullishCoalesce(e.candidateSource, () => ("candidate ark.config.json")),{arkRules:e.candidateArkRules}),r=In(t.config,n.config,{baseArkRules:t.arkRules,candidateArkRules:n.arkRules,candidateInvariantCoverage:e.candidateInvariantCoverage}),a=r.findings.filter(c=>c.classification==="weakening"||c.classification==="judgment-required").map(c=>c.id).sort(),s=a.length>0,o=s&&En(e.acknowledgement,{basePolicyHash:t.policyHash,candidatePolicyHash:n.policyHash,findingIds:a});return{schemaVersion:r.schemaVersion,basePolicyHash:t.policyHash,candidatePolicyHash:n.policyHash,classification:r.classification,findings:r.findings,blockingFindingIds:a,requiresAcknowledgement:s,acknowledged:o,valid:!s||o}}_chunkA5EIY3HIcjs.a.call(void 0, Ws,"analyzePolicyDelta");function rt(e){let t=e.files.map(h=>{let u=_e(h.path);return{path:u,content:h.content,contentHash:X(h.content),layer:_nullishCoalesce(_chunkUN5EH4QVcjs.r.call(void 0, u,e.contract.config.layers), () => (null))}}).sort((h,u)=>h.path.localeCompare(u.path)),n=new Map(t.map(h=>[h.path,h])),r=[],a=[];for(let h of t){let u=Bs(h,n);r.push(...u.edges),a.push(...u.capabilityUses)}let s=zs(r,e.contract.config),o=new Map(e.contract.config.layers.map(h=>[h.name,h])),c=new Map(e.contract.config.layers.map(h=>[h.name,new Set(Pe(h))]));for(let h of a){let u=_optionalChain([n, 'access', _116 => _116.get, 'call', _117 => _117(h.file), 'optionalAccess', _118 => _118.layer]);if(!u)continue;let A=o.get(u),d=he(h.symbol,_nullishCoalesce(_optionalChain([A, 'optionalAccess', _119 => _119.forbiddenGlobals]), () => ([])));if(d){s.push({ruleId:"FORBIDDEN_GLOBAL",message:`${u} must not use module "${h.symbol}" because it is the import form of forbidden global "${d}".`,symbol:h.symbol,evidence:h.evidence});continue}_optionalChain([c, 'access', _120 => _120.get, 'call', _121 => _121(u), 'optionalAccess', _122 => _122.has, 'call', _123 => _123(h.capability)])&&s.push({ruleId:"CAPABILITY_VIOLATION",message:`${u} denies the ${h.capability} capability; found import of "${h.symbol}".`,capability:h.capability,symbol:h.symbol,evidence:h.evidence})}let l=t.length===0?"complete":"partial",p=l==="complete"?[]:[{...Sl}],f={schemaVersion:cn,policyHash:e.contract.policyHash,compilerOptionsHash:X(z(_nullishCoalesce(e.compilerOptions, () => ({})))),files:t,layers:e.contract.config.layers.map(h=>h.name),edges:r,capabilityUses:a,violations:s};return{mode:"lexical-compatibility",completeness:l,completenessReasons:p,valid:l==="complete"&&s.length===0,ir:f}}_chunkA5EIY3HIcjs.a.call(void 0, rt,"analyzeProject");function St(e){let t=new Map(e.files.map(n=>[_e(n.path),n]));for(let n of e.changes){let r=_e(n.path);"delete"in n&&n.delete?t.delete(r):"content"in n&&t.set(r,{path:r,content:n.content})}return rt({contract:e.contract,files:[...t.values()],compilerOptions:e.compilerOptions})}_chunkA5EIY3HIcjs.a.call(void 0, St,"analyzeChange");function qs(e){let t=`${e.evidence.file}:${e.evidence.line}`;if(!e.edge)return`${e.ruleId} at ${t}: ${e.message}`;let n=_nullishCoalesce(e.edge.to, () => (e.edge.specifier));return`${e.ruleId} at ${t}: ${e.edge.from} imports ${n}. ${e.message}`}_chunkA5EIY3HIcjs.a.call(void 0, qs,"explainViolation");function Cn(e){let t=0,n=new Map,r=new Map,a=new Set,s=[],o=[],c=_chunkA5EIY3HIcjs.a.call(void 0, l=>{n.set(l,t),r.set(l,t),t+=1,s.push(l),a.add(l);for(let h of[..._nullishCoalesce(e.get(l), () => ([]))].sort())e.has(h)&&(n.has(h)?a.has(h)&&r.set(l,Math.min(_nullishCoalesce(r.get(l), () => (0)),_nullishCoalesce(n.get(h), () => (0)))):(c(h),r.set(l,Math.min(_nullishCoalesce(r.get(l), () => (0)),_nullishCoalesce(r.get(h), () => (0))))));if(r.get(l)!==n.get(l))return;let p=[],f;do{if(f=s.pop(),f===void 0)break;a.delete(f),p.push(f)}while(f!==l);p.length>1&&o.push(p.sort())},"connect");for(let l of[...e.keys()].sort())n.has(l)||c(l);return o.sort((l,p)=>l[0]<p[0]?-1:l[0]>p[0]?1:0).map(l=>({ruleId:"CIRCULAR_DEPENDENCY",file:l[0],line:1,target:l.join(" \u2192 "),message:`Circular dependency among ${l.length} files: ${l.join(" \u2192 ")} \u2192 ${l[0]}.`,cycleKind:"value"}))}_chunkA5EIY3HIcjs.a.call(void 0, Cn,"detectArchitectureCycles");function Ge(e){let t=e.contentViolations.map(s=>({...s})),n=(_nullishCoalesce(e.warnings, () => ([]))).map(s=>({...s})),r=new Map(e.files.map(s=>[s,new Set]));for(let s of e.edges){if(s.to&&s.to!==s.from&&!s.typeOnly&&r.has(s.from)&&_optionalChain([r, 'access', _124 => _124.get, 'call', _125 => _125(s.from), 'optionalAccess', _126 => _126.add, 'call', _127 => _127(s.to)]),!s.to||!s.fromLayer||!s.toLayer)continue;let o=_chunkUN5EH4QVcjs.E.call(void 0, e.rules,s.fromLayer,s.toLayer,{fromPath:s.from,toPath:s.to,layers:e.config.layers});if(!o){let u=_chunkUN5EH4QVcjs.F.call(void 0, e.rules,s.fromLayer,s.toLayer,{fromPath:s.from,toPath:s.to,layers:e.config.layers});u&&n.push({ruleId:"SHARED_IMPORTS_SLICE",file:u.fromPath,line:s.line,fromLayer:s.fromLayer,toLayer:s.toLayer,target:u.toPath,toSlice:u.toSlice,failsStrict:!1,severity:"warning",message:`shared root ${u.fromPath} \u2192 slice ${u.toSlice} (${u.toPath}). The wall is direct-only.`});continue}let c=o.rule,l=!!c.peerIsolation,p=!l&&!!(s.typeOnly||s.namedBindingsTypeOnly),f=o.sliceVerdict,h=f?_chunkUN5EH4QVcjs.A.call(void 0, {surface:"import",verdict:f,fromLayer:s.fromLayer,toLayer:s.toLayer,kind:s.kind,fromPath:s.from,toPath:s.to,ruleMessage:c.message,childMessage:_optionalChain([c, 'access', _128 => _128.childSlices, 'optionalAccess', _129 => _129.message])}):_nullishCoalesce(c.message, () => (`${s.fromLayer} must not ${s.kind} ${s.toLayer}.`));t.push({ruleId:"LAYER_IMPORT_VIOLATION",file:s.from,line:s.line,fromLayer:s.fromLayer,toLayer:s.toLayer,target:s.to,...s.typeOnly?{typeOnly:!0}:{},...s.targetTypeOnlyExports?{targetTypeOnlyExports:!0}:{},...s.sourcePureTypeModule?{sourcePureTypeModule:!0}:{},...s.namedBindingsTypeOnly?{namedBindingsTypeOnly:!0}:{},...!l&&s.portProofEligible?{portProofEligible:!0}:{},...s.kind?{edgeKind:s.kind}:{},...l?{peerIsolation:!0}:{},..._chunkUN5EH4QVcjs.B.call(void 0, f),message:p?`${h} (type-only \u2014 type placement debt; prefer SharedTypes / owning layer; not runtime coupling)`:h,...p?{failsStrict:!1,severity:"warning"}:{}})}t.push(...wl(e));let a=String(_nullishCoalesce(e.config.cyclePolicy, () => ("strict"))).toLowerCase();if(a!=="off"){let s=Cn(r);a==="soft"||a==="framework-soft"?n.push(...s.map(o=>({...o,message:`${o.message} (soft cycle policy \u2014 advisory only; set cyclePolicy: "strict" to fail the check)`,failsStrict:!1}))):t.push(...s)}return{violations:t,warnings:n,safety:e.safety}}_chunkA5EIY3HIcjs.a.call(void 0, Ge,"evaluateArchitectureGraph");var Ol="CROSS_PARENT_VIA_SHARED",xl="ark-check and CI report this path. The write hook and ESLint see one edge at a time and do not block it.";function Ys(e,t,n){for(let r of _nullishCoalesce(e, () => ([])))if(!(r.from!==t||r.to!==n)&&!(r.allowed!==!1||!r.peerIsolation)&&_chunkUN5EH4QVcjs.n.call(void 0, r.sharedImportsSlice)==="deny-cross-parent")return r}_chunkA5EIY3HIcjs.a.call(void 0, Ys,"denyingCrossParentRule");function Sn(e,t,n,r){let a=_chunkUN5EH4QVcjs.w.call(void 0, n,e,_chunkUN5EH4QVcjs.G.call(void 0, e,t,r)).universeId;return a?{kind:"slice",id:a}:_chunkUN5EH4QVcjs.t.call(void 0, n,e.sharedRoots)?{kind:"shared"}:{kind:"other"}}_chunkA5EIY3HIcjs.a.call(void 0, Sn,"placeFile");function Xs(e,t){return _chunkUN5EH4QVcjs.v.call(void 0, t,_chunkUN5EH4QVcjs.o.call(void 0, e.sharedImportsSlice))}_chunkA5EIY3HIcjs.a.call(void 0, Xs,"isWalkStop");function wl(e){let t=_nullishCoalesce(e.rules, () => ([]));if(!t.some(s=>_chunkUN5EH4QVcjs.n.call(void 0, s.sharedImportsSlice)==="deny-cross-parent"))return[];let n=new Map;for(let s of e.edges){let o=Tl(s);if(!o)continue;let c=n.get(o.from);c?c.push(o):n.set(o.from,[o])}for(let s of n.values())s.sort((o,c)=>o.to<c.to?-1:o.to>c.to?1:o.line-c.line);let r=new Map,a=[...n.values()].flat();a.sort((s,o)=>s.from<o.from?-1:s.from>o.from?1:s.to<o.to?-1:s.to>o.to?1:0);for(let s of a){let o=Ys(t,s.fromLayer,s.toLayer);if(!o)continue;let c=Sn(o,s.fromLayer,s.from,e.config.layers),l=Sn(o,s.fromLayer,s.to,e.config.layers);if(c.kind!=="slice"||l.kind!=="shared"||Xs(o,s.to))continue;let p=[{file:s.to,path:[s.from,s.to]}],f=new Set([s.to]);for(;p.length>0;){let h=p.shift();if(!h)break;for(let u of _nullishCoalesce(n.get(h.file), () => ([]))){let A=Ys(t,u.fromLayer,u.toLayer);if(!A)continue;let d=Sn(A,u.fromLayer,u.to,e.config.layers);if(d.kind==="shared"){if(f.has(u.to)||Xs(A,u.to))continue;f.add(u.to),p.push({file:u.to,path:[...h.path,u.to]});continue}if(d.kind!=="slice"||d.id.toLowerCase()===c.id.toLowerCase()||_chunkUN5EH4QVcjs.u.call(void 0, o.allowedCrossSlice,c.id,d.id))continue;if(o.sliceIdentity==="stars"){let E=_chunkUN5EH4QVcjs.x.call(void 0, o,_chunkUN5EH4QVcjs.G.call(void 0, o,s.fromLayer,e.config.layers),s.from,u.to);if(E.crossSliceAllowed||E.from.universeId&&E.from.universeId===E.to.universeId)continue}let g=[...h.path,u.to],b=`${s.from}\0${u.to}`,x={file:s.from,target:u.to,line:s.line,fromLayer:s.fromLayer,toLayer:u.toLayer,fromSlice:c.id,toSlice:d.id,path:g},k=r.get(b);(!k||g.length<k.path.length||g.length===k.path.length&&g.join("\0")<k.path.join("\0"))&&r.set(b,x)}}}return[...r.values()].sort((s,o)=>s.file<o.file?-1:s.file>o.file?1:s.target<o.target?-1:s.target>o.target?1:0).map(s=>{let o=_chunkUN5EH4QVcjs.y.call(void 0, s.fromSlice),c=_chunkUN5EH4QVcjs.y.call(void 0, s.toSlice);return{ruleId:"LAYER_IMPORT_VIOLATION",reasonId:Ol,file:s.file,line:s.line,fromLayer:s.fromLayer,toLayer:s.toLayer,target:s.target,peerIsolation:!0,...o&&c?{universeFrom:o,universeTo:c}:{},via:s.path.slice(1,-1),message:`${s.fromLayer} reaches ${s.toLayer} in another universe through a shared root (${s.path.join(" \u2192 ")}): cross-parent via shared ${s.fromSlice} \u2192 ${s.toSlice}. ${xl}`}})}_chunkA5EIY3HIcjs.a.call(void 0, wl,"crossParentViaSharedViolations");function Tl(e){if(!(!e.to||e.to===e.from||!e.fromLayer||!e.toLayer))return{from:e.from,to:e.to,line:e.line,fromLayer:e.fromLayer,toLayer:e.toLayer}}_chunkA5EIY3HIcjs.a.call(void 0, Tl,"valueHop");function Zs(e){if(typeof e.target=="string"&&e.target.length>0)return e.target;let t=String(e.sensor||e.code||"").trim();if(!t&&typeof e.message=="string"){let r=e.message.match(/\(sensor ([a-z0-9-]+)\)/i);_optionalChain([r, 'optionalAccess', _130 => _130[1]])&&(t=r[1])}let n=String(e.symbol||"").trim();return t?n?`${t}:${n}`:t:n}_chunkA5EIY3HIcjs.a.call(void 0, Zs,"structureFreezeTarget");var Nl=/\bfrom\s+['"](?:@?prisma\/client|@supabase\/|drizzle-orm(?:\/[^'"]+)?|postgres(?:\/[^'"]+)?|typeorm|knex|mongodb|pg|mysql2|mongoose|better-sqlite3|ioredis|redis|kysely|sequelize)['"]|require\(\s*['"](?:@?prisma\/client|pg|postgres(?:\/[^'"]+)?|drizzle-orm(?:\/[^'"]+)?|knex|typeorm|mongoose)/,Pl=/\bfrom\s+['"](?:@\/|~\/)?(?:[\w.-]+\/)*(?:db|database|prisma|drizzle|orm)(?:\.[cm]?[jt]sx?)?['"]|require\(\s*['"](?:@\/|~\/)?(?:[\w.-]+\/)*(?:db|database|prisma|drizzle|orm)/,Ll=/\bimport\s+(?:type\s+)?\{([^}]*)\}\s*from\s*['"](?:@\/|~\/)?(?:[\w.-]+\/)*(?:db|database|prisma|drizzle|orm)(?:\.[cm]?[jt]sx?)?['"]/g,Dl=["db","tx","client","prisma","prismaClient","drizzle"],Fl="(?:insert(?:One|Many)?|update(?:One|Many)?|upsert|delete(?:One|Many)?|createMany|create|replaceOne|findOneAnd(?:Update|Delete|Replace))",ta=/\b(?:INSERT\s+INTO|(?<!\b(?:FOR(?:\s+NO\s+KEY)?|DO)\s)UPDATE(?:\s+ONLY)?(?!\s+(?:OF|SET)\b)|DELETE\s+FROM(?:\s+ONLY)?|MERGE\s+INTO|TRUNCATE(?:\s+TABLE)?(?:\s+ONLY)?)\s+(?:(?:(?:"[^"]*"|[A-Za-z_][\w$]*)\s*\.\s*)?(?:"[^"]*"|[A-Za-z_][\w$]*)|\$\{[^}]+\})/i,$l=/^(?:await|return|throw|yield|new|typeof|void|delete|if|else|case|of|in|instanceof|async|function|class|const|let|var|import|export|from|as|default|type)$/,Js=/(^|[^\w$])([A-Za-z_$][\w$]*)\s*`((?:[^`\\]|\\[\s\S])*)`/g,Ml=/\bINSERT\s+INTO\b[\s\S]*?\bON\s+CONFLICT\b[\s\S]*?\bDO\s+UPDATE\s+SET\b[^;`]*/gi,Qs="\\((?:[^()]|\\([^()]*\\))*\\)",Hl=`\\bnew\\s+PrismaClient\\s*${Qs}|\\bdrizzle\\s*${Qs}`,Kl=/(?<![\w$])([A-Za-z_$][\w$]*)\s*[?!]?\s*(?::[^=;\n]+)?=(?![=>])\s*(?:await\s+)?(?:new\s+(?:PrismaClient|Pool|Client|MongoClient|Sequelize|Kysely|Knex)\b|(?:drizzle|knex|Knex|postgres)\s*\()/g,Vl=/(?<![\w$])([A-Za-z_$][\w$]*)\s*[?!]?\s*:\s*(?:Readonly\s*<\s*)?(?:Prisma\s*\.\s*TransactionClient|PrismaClient|Pool|PoolClient|MongoClient|Sequelize|Kysely|Knex|DataSource|EntityManager|NodePgDatabase|PostgresJsDatabase|BetterSQLite3Database|MySql2Database|LibSQLDatabase)\b/g;function Ul(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}_chunkA5EIY3HIcjs.a.call(void 0, Ul,"escapeRegExp");function Ct(e){return Nl.test(e)||Pl.test(e)}_chunkA5EIY3HIcjs.a.call(void 0, Ct,"sourceImportsPersistenceDriverText");function ea(e,t,n){let r=new RegExp(e.source,"g"),a;for(;(a=r.exec(t))!==null;)a[1]&&n.add(a[1])}_chunkA5EIY3HIcjs.a.call(void 0, ea,"collectFirstGroup");function Gl(e){let t=new Set;ea(Kl,e,t),ea(Vl,e,t);let n=new RegExp(Ll.source,"g"),r;for(;(r=n.exec(e))!==null;)for(let a of(_nullishCoalesce(r[1], () => (""))).split(",")){let s=a.trim().replace(/^type\s+/,"").split(/\s+as\s+/),o=(_nullishCoalesce(_nullishCoalesce(s[1], () => (s[0])), () => (""))).trim();/^[A-Za-z_$][\w$]*$/.test(o)&&t.add(o)}return[...t].sort()}_chunkA5EIY3HIcjs.a.call(void 0, Gl,"persistenceClientBindings");function na(e){return e.replace(/\/\*[\s\S]*?\*\/|\/\/[^\n]*|`(?:[^`\\]|\\[\s\S])*`|'(?:[^'\\]|\\[\s\S])*'|"(?:[^"\\]|\\[\s\S])*"/g,t=>t.charCodeAt(0)===47?t.replace(/[^\n]/g," "):t.charCodeAt(0)===96?t.replace(/--[^\n`]*/g,n=>" ".repeat(n.length)):t)}_chunkA5EIY3HIcjs.a.call(void 0, na,"blankPersistenceComments");function ra(e){let t=na(e);Js.lastIndex=0;let n;for(;(n=Js.exec(t))!==null;)if(!$l.test(_nullishCoalesce(n[2], () => ("")))&&ta.test((_nullishCoalesce(n[3], () => (""))).replace(Ml," ")))return!0;return!1}_chunkA5EIY3HIcjs.a.call(void 0, ra,"sourceHasTaggedSqlWrite");function _n(e){let t=na(e),n=[...Dl,...Gl(t)].map(Ul).join("|");return new RegExp(`(?:\\b(?:${n})(?![\\w$])|${Hl})(?:\\s*\\.\\s*[A-Za-z_]\\w*)*\\s*\\.\\s*${Fl}\\s*\\(`,"i").test(t)?!0:ta.test(t)}_chunkA5EIY3HIcjs.a.call(void 0, _n,"sourceHasPersistenceWrite");var jl=["no-anemic-model"],oa=["ensureInvariants","assertInvariants","validate","publish","emit","raise","record"],Ku=new RegExp(`\\b(${oa.join("|")})\\b`),ia="(?:_?pendingEvents|domainEvents|uncommittedEvents|recordedEvents)",Vu=new RegExp(`\\bthis\\.${ia}\\.push\\s*\\(`),Uu=new RegExp(`^this\\.${ia}\\s*=\\s*\\[\\s*\\]`);function Bl(){return`${oa.join(", ")}, or events-array .push(`}_chunkA5EIY3HIcjs.a.call(void 0, Bl,"expectedDomainInvariantWordsPhrase");function la(e){return typeof e.truncatedUntil=="number"?e.truncatedUntil:void 0}_chunkA5EIY3HIcjs.a.call(void 0, la,"shapeTruncatedUntil");function zl(e){let t=la(e);return t==null?"":` shape analysed until character ${t}`}_chunkA5EIY3HIcjs.a.call(void 0, zl,"shapeTruncationSuffix");function sa(e){return/[.*+?^${}()|[\]\\]/.test(e)?`\\${e}`:e}_chunkA5EIY3HIcjs.a.call(void 0, sa,"escapeGlobLiteral");function Wl(e){let t="";for(let r=0;r<e.length;r+=1){let a=e[r];if(a==="\\"&&r+1<e.length){let s=e[r+1];if("*?{}[],".includes(s)||s==="\\"){t+="\\"+s,r+=1;continue}t+="/";continue}t+=a}let n="";for(let r=0;r<t.length;r+=1){let a=t[r];a==="\\"&&r+1<t.length?(n+=sa(t[r+1]),r+=1):a==="*"?t[r+1]==="*"?t[r+2]==="/"?(n+="(?:.*/)?",r+=2):(n+=".*",r+=1):n+="[^/]*":a==="?"?n+="[^/]":n+=sa(a)}return new RegExp(`^${n}$`)}_chunkA5EIY3HIcjs.a.call(void 0, Wl,"globToRegExp");function je(e,t){return!t||t.length===0?!0:t.some(n=>Wl(n).test(e))}_chunkA5EIY3HIcjs.a.call(void 0, je,"matchesAppliesTo");function ca(e){return jl.includes(e)}_chunkA5EIY3HIcjs.a.call(void 0, ca,"isTier2");function da(e){return e.mode==="enforced"&&!ca(e.sensor)?{severity:"error",failsStrict:!0}:{severity:"warning",failsStrict:!1}}_chunkA5EIY3HIcjs.a.call(void 0, da,"severityFor");function Ae(e,t,n,r=1){let{severity:a,failsStrict:s}=da(e);return{ruleId:"ARKRULE_STRUCTURE",code:e.sensor,message:n,file:t,line:r,fromLayer:e.provenance.layer,arkruleId:e.id,arkruleSource:e.provenance.sourceFile,severity:a,sensor:e.sensor,failsStrict:s}}_chunkA5EIY3HIcjs.a.call(void 0, Ae,"baseViolation");function _t(e,t,n){if(!n)return!0;let r=n(e);return r?r===t.provenance.layer:!1}_chunkA5EIY3HIcjs.a.call(void 0, _t,"isInRuleLayer");function Ot(e,t,n){return t.filter(r=>!(!r.exported||!je(r.file,e.appliesTo)||!_t(r.file,e,n)))}_chunkA5EIY3HIcjs.a.call(void 0, Ot,"shapesForRule");function On(e,t,n){let r=la(t);if(r!=null)return Ae(e,t.file,`Exported class ${t.className} shape analysed until character ${r}; later ${n} may be invisible (sensor ${e.sensor}).`)}_chunkA5EIY3HIcjs.a.call(void 0, On,"truncatedShapeViolation");function ql(e,t,n){let r=[];for(let a of Ot(e,t,n)){let s=On(e,a,"members");s&&r.push(s),(a.hasPublicSetters||a.hasPublicMutableFields)&&r.push(Ae(e,a.file,`Exported class ${a.className} exposes public mutable state (sensor aggregate-private-state).`))}return r}_chunkA5EIY3HIcjs.a.call(void 0, ql,"evaluateAggregatePrivateState");function Yl(e,t,n){let r=[];for(let a of Ot(e,t,n)){let s=On(e,a,"constructors and factories");if(s&&r.push(s),a.hasPublicConstructor&&!a.hasStaticFactory){if(!(a.hasPublicMutableFields||a.hasPublicSetters||(_nullishCoalesce(_optionalChain([a, 'access', _131 => _131.mutatingMethods, 'optionalAccess', _132 => _132.length]), () => (0)))>0))continue;r.push(Ae(e,a.file,`Exported class ${a.className} exposes a public constructor without a static factory (sensor always-valid-factory).`))}}return r}_chunkA5EIY3HIcjs.a.call(void 0, Yl,"evaluateAlwaysValidFactory");function Xl(e,t,n){let r=[],a=Bl();for(let s of Ot(e,t,n)){let o=zl(s),c=On(e,s,"methods");c&&r.push(c);for(let l of s.mutatingMethods)l.referencesGuardOrPublish||r.push(Ae(e,s.file,`Mutating method ${s.className}.${l.name} does not reference ${a} (sensor domain-event-on-mutation).${o}`))}return r}_chunkA5EIY3HIcjs.a.call(void 0, Xl,"evaluateDomainEventOnMutation");function Zl(e,t){let n=[];for(let r of t.files)je(r,e.appliesTo)&&_t(r,e,t.layerForFile)&&_optionalChain([t, 'access', _133 => _133.fileHints, 'optionalAccess', _134 => _134[r], 'optionalAccess', _135 => _135.orchestrationHeavy])&&n.push(Ae(e,r,"File appears to embed domain branching beyond guard-and-delegate orchestration (sensor orchestration-only)."));return n}_chunkA5EIY3HIcjs.a.call(void 0, Zl,"evaluateOrchestrationOnly");function Jl(e,t){let n=[];for(let r of t.files)je(r,e.appliesTo)&&_t(r,e,t.layerForFile)&&_optionalChain([t, 'access', _136 => _136.fileHints, 'optionalAccess', _137 => _137[r], 'optionalAccess', _138 => _138.adapterThick])&&n.push(Ae(e,r,"Adapter module mixes domain branching, persistence, and mapping beyond a thin adapter (sensor thin-adapter)."));return n}_chunkA5EIY3HIcjs.a.call(void 0, Jl,"evaluateThinAdapter");function Ql(e,t){let n=[];for(let r of t.files)je(r,e.appliesTo)&&_t(r,e,t.layerForFile)&&_optionalChain([t, 'access', _139 => _139.fileHints, 'optionalAccess', _140 => _140[r], 'optionalAccess', _141 => _141.persistenceWrite])&&n.push(Ae(e,r,"File imports a persistence driver and issues a write; route the write through a Domain aggregate and a persistence adapter (sensor writes-via-aggregate)."));return n}_chunkA5EIY3HIcjs.a.call(void 0, Ql,"evaluateWritesViaAggregate");function ec(e,t,n){let r=[];for(let a of Ot(e,t,n))if(a.dataOnly===!0){let s=Ae(e,a.file,`Exported type ${a.className} looks data-only / anemic (sensor no-anemic-model; advisory only).`);r.push({...s,severity:"warning",failsStrict:!1})}return r}_chunkA5EIY3HIcjs.a.call(void 0, ec,"evaluateNoAnemicModel");function ua(e){if(!e.arkRules.structure.length)return[];let t=[];for(let n of e.arkRules.structure)switch(n.sensor){case"aggregate-private-state":t.push(...ql(n,e.classShapes,e.layerForFile));break;case"always-valid-factory":t.push(...Yl(n,e.classShapes,e.layerForFile));break;case"domain-event-on-mutation":t.push(...Xl(n,e.classShapes,e.layerForFile));break;case"orchestration-only":t.push(...Zl(n,e));break;case"thin-adapter":t.push(...Jl(n,e));break;case"writes-via-aggregate":t.push(...Ql(n,e));break;case"no-anemic-model":t.push(...ec(n,e.classShapes,e.layerForFile));break;case"invariant-coverage":break;default:break}return t.sort((n,r)=>n.file.localeCompare(r.file)||n.arkruleId.localeCompare(r.arkruleId)||n.message.localeCompare(r.message))}_chunkA5EIY3HIcjs.a.call(void 0, ua,"evaluateArkRuleSensors");function pa(e,t){let n=[],r=t.map(a=>a.replace(/\\/g,"/"));for(let a of e.structure){if(!a.appliesTo||a.appliesTo.length===0||r.some(l=>je(l,a.appliesTo)))continue;let{severity:o,failsStrict:c}=da(a);n.push({ruleId:"ARKRULE_SCOPE_EMPTY",code:"appliesTo-zero-match",message:`ArkRule structure "${a.id}" appliesTo matched zero governed files (patterns: ${a.appliesTo.join(", ")}). A zero-match scope is almost always misconfiguration.`,file:a.provenance.sourceFile,line:1,fromLayer:a.provenance.layer,arkruleId:a.id,arkruleSource:a.provenance.sourceFile,severity:o,sensor:a.sensor,failsStrict:c})}for(let a of _nullishCoalesce(e.invariants, () => ([]))){if(!a.appliesTo||a.appliesTo.length===0||r.some(c=>je(c,a.appliesTo)))continue;let o=a.mode==="enforced";n.push({ruleId:"ARKRULE_SCOPE_EMPTY",code:"appliesTo-zero-match",message:`ArkRule invariant "${a.id}" appliesTo matched zero governed files (patterns: ${a.appliesTo.join(", ")}). A zero-match scope is almost always misconfiguration.`,file:a.provenance.sourceFile,line:1,fromLayer:a.provenance.layer,arkruleId:a.id,arkruleSource:a.provenance.sourceFile,severity:o?"error":"warning",sensor:"invariant-coverage",failsStrict:o})}return n.sort((a,s)=>a.file.localeCompare(s.file)||a.arkruleId.localeCompare(s.arkruleId)||a.message.localeCompare(s.message))}_chunkA5EIY3HIcjs.a.call(void 0, pa,"collectEmptyAppliesToFindings");var aa=64;function tc(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===46;)t-=1;return t===e.length?e:e.slice(0,t)}_chunkA5EIY3HIcjs.a.call(void 0, tc,"stripTrailingDots");function nc(e){let t=e.trim(),n=t.length>aa?t.slice(0,aa):t;return tc(n)}_chunkA5EIY3HIcjs.a.call(void 0, nc,"normalizeIntentPrefix");function rc(e){let t=e.toLowerCase();return t.includes("domain")||t.includes("entity")||t.includes("aggregate")||t.includes("model")}_chunkA5EIY3HIcjs.a.call(void 0, rc,"layerNameLooksDomain");function sc(e){return e.some(t=>{let n=nc(t);return n==="Domain"||n.startsWith("Domain.")})}_chunkA5EIY3HIcjs.a.call(void 0, sc,"ownsDomainIntent");function ac(e,t=[]){return rc(e)||sc(t)}_chunkA5EIY3HIcjs.a.call(void 0, ac,"isDomainRoleLayerName");function fa(e){if(e.arkRulesActive!==!0)return[];let t=(_nullishCoalesce(e.layers, () => ([]))).filter(l=>ac(l.name,_nullishCoalesce(l.intentPrefixes, () => ([])))).map(l=>l.name);if(t.length===0)return[];let n=new Set(t);if(!(_nullishCoalesce(e.files, () => ([]))).some(l=>{let p=typeof l.layer=="string"?l.layer:"";return p.length>0&&n.has(p)}))return[];if((_nullishCoalesce(e.arkRules.invariants, () => ([]))).filter(l=>n.has(l.provenance.layer)).length>0)return[];let s=_nullishCoalesce(t.find(l=>_optionalChain([e, 'access', _142 => _142.arkRules, 'access', _143 => _143.byLayer, 'optionalAccess', _144 => _144[l]])), () => (t[0])),o=_nullishCoalesce(_optionalChain([e, 'access', _145 => _145.arkRules, 'access', _146 => _146.byLayer, 'optionalAccess', _147 => _147[s], 'optionalAccess', _148 => _148.sourceFile]), () => (`arkrules/${s}.json`)),c=(_nullishCoalesce(e.arkRules.structure, () => ([]))).some(l=>l.mode==="enforced"&&n.has(l.provenance.layer)&&!ca(l.sensor));return[{ruleId:"INVARIANT_CATALOG_EMPTY",code:"invariant-catalog-empty",message:`ArkRules is on and ${s} has code, but invariants[] is empty \u2014 there are no phrases the code must preserve. Add 1\u20132 short phrases in ${o}.`,file:o,line:1,fromLayer:s,arkruleId:"invariant-catalog",arkruleSource:o,severity:c?"error":"warning",sensor:"invariant-coverage",failsStrict:c}]}_chunkA5EIY3HIcjs.a.call(void 0, fa,"collectEmptyInvariantCatalogFindings");function oc(e){return e==="PersistenceAdapters"}_chunkA5EIY3HIcjs.a.call(void 0, oc,"isPersistenceDriverLayer");function ic(e,t){if(Ct(e))return!0;if(!t)return!1;for(let n of t){if(oc(n.layer))return!0;let r=n.specifier;if(!r)continue;let a=`from '${r}'`;if(Ct(a))return!0}return!1}_chunkA5EIY3HIcjs.a.call(void 0, ic,"sourceImportsPersistenceDriver");var lc=/\b(?:@Controller|@Get|@Post|@Put|@Delete|Router\(\)|createRouter|express\.Router|fastify\.(?:get|post)|export\s+(?:async\s+)?function\s+(?:GET|POST|PUT|DELETE|PATCH)\b|export\s+const\s+(?:GET|POST|PUT|DELETE|PATCH)\s*=)/,cc=/(?:^|[;\n])\s*(?:import\s+(?:type\s+)?(?:[^;]{0,512}?\s+from\s+)?|export\s+(?:type\s+)?[^;]{0,512}?\s+from\s+)['"]next\/server(?:\.js)?['"]/,dc=/\b(?:export\s+)?(?:async\s+)?function\s+(?:can|calculate|compute|should|ensure|validate|is|has)[A-Z]\w*|\b(?:export\s+)?const\s+(?:can|calculate|compute|should|ensure|validate|is|has)[A-Z]\w*\s*=/,uc=/\bif\s*\(\s*(?:!)?(?:order|invoice|cart|user|account|policy|aggregate|entity|amount|total|balance|status|state)\b/i;function pc(e,t,n){if(!t)return null;let r=ic(t,n),a=r&&_n(t)||ra(t);if(t.length<40)return a?{persistenceWrite:!0}:null;let s=_nullishCoalesce(t.match(new RegExp(dc.source,"g")), () => ([])),o=_nullishCoalesce(t.match(new RegExp(uc.source,"g")), () => ([])),c=(_nullishCoalesce(t.match(/\bif\s*\(/g), () => ([]))).length,l=(_nullishCoalesce(t.match(/\bswitch\s*\(/g), () => ([]))).length,p=s.length>=2||s.length>=1&&o.length>=2||o.length>=3&&c+l>=6,f=lc.test(t)||cc.test(t),h=s.length>=1||o.length>=2,u=/\b(?:mapTo|toDomain|toDto|fromRow|toEntity|fromPrisma|serialize|deserialize)\w*\s*[(=]/.test(t),A=r&&h||f&&h||r&&u&&(c>=4||s.length>=1)||f&&r;return!p&&!A&&!a?null:{...p?{orchestrationHeavy:!0}:{},...A?{adapterThick:!0}:{},...a?{persistenceWrite:!0}:{}}}_chunkA5EIY3HIcjs.a.call(void 0, pc,"deriveArkRuleFileHints");function ga(e,t){let n={};for(let[r,a]of Object.entries(e)){let s=r.replace(/\\/g,"/"),o=pc(r,a,_optionalChain([t, 'optionalAccess', _149 => _149[s]]));o&&(n[s]=o)}return n}_chunkA5EIY3HIcjs.a.call(void 0, ga,"buildArkRuleFileHints");function fc(e){if(!e)return{};let t=typeof e.governedPercent=="number"?e.governedPercent:null,n=typeof e.populatedLayerCount=="number"?e.populatedLayerCount:null;return n==null&&typeof e.classifiedFiles=="number"&&(n=e.classifiedFiles>0?1:0),{governedPercent:t,populatedLayerCount:n}}_chunkA5EIY3HIcjs.a.call(void 0, fc,"normalizeExtraMergeTeethClassification");function xt(e){let t=fc(e),n=typeof t.governedPercent=="number"?t.governedPercent:null,r=typeof t.populatedLayerCount=="number"?t.populatedLayerCount:null;return n==null&&r==null?!0:(_nullishCoalesce(n, () => (0)))>=50&&(_nullishCoalesce(r, () => (0)))>=1}_chunkA5EIY3HIcjs.a.call(void 0, xt,"extraMergeTeethAllowed");function ma(e){let t=e.length,n=0,r=new Set;for(let a of e){let s=typeof a.layer=="string"&&a.layer.length>0?a.layer:null;s&&(n+=1,r.add(s))}return{governedPercent:t>0?Math.round(n/t*100):0,populatedLayerCount:r.size}}_chunkA5EIY3HIcjs.a.call(void 0, ma,"classifyResolvedLayerCoverage");var gc=["createArkKernel","createStrictArkKernel","createLenientArkKernel","createArkKernelFromConfig","createStrictArkKernelFromConfig","createLenientArkKernelFromConfig"];var mc=["forRoot","forRootAsync"],hc=["ArkKernel","EventBus","EventPublisher","ArkRunPublisher"];var Yu=new Set(mc),Xu=new Set(hc);var Zu=new Set(gc);function ha(e){return e==="@arkgate/runtime"||e.startsWith("@arkgate/runtime/")||e==="arkgate/runtime"||e.startsWith("arkgate/runtime/")||e==="arkgate/nestjs"||e.startsWith("arkgate/nestjs/")}_chunkA5EIY3HIcjs.a.call(void 0, ha,"isArkRunKernelModuleSpecifier");var yc=["events","node:events","eventemitter2","eventemitter3","emittery","kafkajs","kafka-node","amqplib","amqp","bull","bullmq","mqtt","nats","@aws-sdk/client-sqs","@aws-sdk/client-sns","@aws-sdk/client-eventbridge","@google-cloud/pubsub","@azure/service-bus"],xn=new Set(yc);function ya(e){if(!e||e.startsWith(".")||e.startsWith("/"))return!1;if(xn.has(e))return!0;let t=e.indexOf("/");if(t<0)return!1;let n=e.slice(0,t);if(xn.has(n))return!0;let r=e.indexOf("/",t+1);return r<0?!1:xn.has(e.slice(0,r))}_chunkA5EIY3HIcjs.a.call(void 0, ya,"isArkRunTransportBypassSpecifier");var Rc=["arkrun-kernel-in-domain","arkrun-direct-new","arkrun-transport-bypass"],ip=new Set(Rc);var Ra={"arkrun-missing-root":"ARKRUN_MISSING_ROOT","arkrun-kernel-in-domain":"ARKRUN_KERNEL_IN_DOMAIN","arkrun-direct-new":"ARKRUN_DIRECT_NEW","arkrun-undeclared-emit":"ARKRUN_UNDECLARED_EMIT","arkrun-undeclared-handle":"ARKRUN_UNDECLARED_HANDLE","arkrun-undeclared-depend":"ARKRUN_UNDECLARED_DEPEND","arkrun-transport-bypass":"ARKRUN_TRANSPORT_BYPASS"},Ac="ARKRUN_INTERACTION_NAME_INCOMPLETE";function va(e,t=[]){let n=e.trim();return/^domain(?:model)?$/i.test(n)||/^domain(?=[A-Z_\-\s])/i.test(n)||/^(?:entit(?:y|ies)|aggregates?)(?:$|(?=[A-Z_\-\s]))/i.test(n)?!0:t.some(r=>{let a=r.trim().replace(/\.+$/,"");return a==="Domain"||a.startsWith("Domain.")})}_chunkA5EIY3HIcjs.a.call(void 0, va,"isDomainRoleLayer");function kc(e,t){return e.file.localeCompare(t.file)||e.ruleId.localeCompare(t.ruleId)||e.line-t.line||e.message.localeCompare(t.message)}_chunkA5EIY3HIcjs.a.call(void 0, kc,"compareFindings");function ge(e,t,n,r,a,s,o){let c=e.mode==="enforced"&&o;return{ruleId:Ra[t],sensor:t,message:a,file:n,line:r,..._optionalChain([s, 'optionalAccess', _150 => _150.fromLayer])?{fromLayer:s.fromLayer}:{},..._optionalChain([s, 'optionalAccess', _151 => _151.target])?{target:s.target}:{},severity:c?"error":"warning",failsStrict:c,nextAction:ie({ruleId:Ra[t],fromLayer:_optionalChain([s, 'optionalAccess', _152 => _152.fromLayer]),target:_optionalChain([s, 'optionalAccess', _153 => _153.target])})}}_chunkA5EIY3HIcjs.a.call(void 0, ge,"finding");function vc(e,t){let n=[],r=[],a=[],s=[];for(let o of e)o.file===t&&(n.push(...o.uses),r.push(...o.reactsTo),a.push(...o.raises),s.push(...o.sends));return{uses:new Set(n),reactsTo:new Set(r),raises:new Set(a),sends:new Set(s)}}_chunkA5EIY3HIcjs.a.call(void 0, vc,"bagForFile");function Aa(e){return e==="publisher"||e==="publish"||e==="raise"||e==="send"}_chunkA5EIY3HIcjs.a.call(void 0, Aa,"emitKinds");function ka(e){return e==="subscribe"||e==="register-handler"}_chunkA5EIY3HIcjs.a.call(void 0, ka,"handleKinds");function bc(e){return e==="resolve"||e==="resolve-singleton"}_chunkA5EIY3HIcjs.a.call(void 0, bc,"dependKinds");function Ic(e,t,n){let r=[],a=_nullishCoalesce(e.kernelRoots, () => (e.compositionRoots));if(a.length===0)return r.push(ge(e,"arkrun-missing-root","ark.config.json",1,"ArkRun kernelRoots is empty; no createArkKernel factory site is declared.",void 0,n)),r;let s=new Map;for(let o of t){let c=_nullishCoalesce(s.get(o.matchedRoot), () => ([]));c.push(o),s.set(o.matchedRoot,c)}for(let o of a){let c=[..._nullishCoalesce(s.get(o), () => ([]))].sort((p,f)=>p.file.localeCompare(f.file));if(c.length===0){r.push(ge(e,"arkrun-missing-root","ark.config.json",1,`ArkRun kernel root ${JSON.stringify(o)} matched no governed files and has no createArkKernel factory.`,{target:o},n));continue}if(c.some(p=>p.hasKernelFactory))continue;let l=c[0];r.push(ge(e,"arkrun-missing-root",l.file,1,`ArkRun kernel root ${JSON.stringify(o)} has no kernel factory (createArkKernel / createStrictArkKernel / createLenientArkKernel / *FromConfig, or ArkModule.forRoot / forRootAsync from arkgate/nestjs).`,{target:o},n))}return r}_chunkA5EIY3HIcjs.a.call(void 0, Ic,"evaluateMissingRoot");function Ec(e,t,n,r,a){let s=new Map(t.map(c=>[c.name,_nullishCoalesce(c.intentPrefixes, () => ([]))])),o=[];for(let c of n){let l=c.specifier;if(!l||!ha(l))continue;let p=r(c.from);p&&va(p,_nullishCoalesce(s.get(p), () => ([])))&&o.push(ge(e,"arkrun-kernel-in-domain",c.from,c.line,`${p} must not import kernel module ${JSON.stringify(l)}.`,{fromLayer:p,target:l},a))}return o}_chunkA5EIY3HIcjs.a.call(void 0, Ec,"evaluateKernelInDomain");function Sc(e,t,n,r,a,s){let o=new Set(e.managedLayers);if(o.size===0)return[];let c=new Map(t.map(f=>[f.name,_nullishCoalesce(f.intentPrefixes, () => ([]))])),l=new Set(r.filter(f=>f.hasKernelFactory).map(f=>f.file)),p=[];for(let f of n){if(l.has(f.file))continue;let h=f.typeName;if(e.ignoreDirectNewForErrors!==!1&&(h.endsWith("Error")||h==="Error")||h.endsWith("DTO")||h.endsWith("VO"))continue;let u=a(f.file);!u||!o.has(u)||va(u,_nullishCoalesce(c.get(u), () => ([])))||p.push(ge(e,"arkrun-direct-new",f.file,f.line,`${u} must not construct ${f.typeName} with new outside an ArkRun composition-root factory.`,{fromLayer:u,target:f.typeName},s))}return p}_chunkA5EIY3HIcjs.a.call(void 0, Sc,"evaluateDirectNew");function Cc(e,t,n,r,a){let s=[],o=[];if(e.requireDeclarations!==!0)return{findings:s,completenessReasons:o};let c=new Set(e.managedLayers);if(c.size===0)return{findings:s,completenessReasons:o};for(let l of t){if(!Aa(l.kind)&&!ka(l.kind)&&!bc(l.kind))continue;let p=r(l.file);if(!p||!c.has(p))continue;if(!l.nameLiteral){e.mode==="enforced"&&l.kind!=="publisher"&&o.push({code:Ac,file:l.file,message:`ArkRun ${l.kind} call in ${l.file} has no string-literal name or same-file define/defineIntent binding; enforced extra cannot prove the declaration.`});continue}let f=vc(n,l.file);if(Aa(l.kind)){if(f.raises.has(l.nameLiteral)||f.sends.has(l.nameLiteral))continue;s.push(ge(e,"arkrun-undeclared-emit",l.file,l.line,`Emit ${JSON.stringify(l.nameLiteral)} is not declared in raises or sends.`,{fromLayer:p,target:l.nameLiteral},a));continue}if(ka(l.kind)){if(f.reactsTo.has(l.nameLiteral))continue;s.push(ge(e,"arkrun-undeclared-handle",l.file,l.line,`Handle ${JSON.stringify(l.nameLiteral)} is not declared in reactsTo.`,{fromLayer:p,target:l.nameLiteral},a));continue}f.uses.has(l.nameLiteral)||s.push(ge(e,"arkrun-undeclared-depend",l.file,l.line,`Depend ${JSON.stringify(l.nameLiteral)} is not declared in uses.`,{fromLayer:p,target:l.nameLiteral},a))}return{findings:s,completenessReasons:o}}_chunkA5EIY3HIcjs.a.call(void 0, Cc,"evaluateUndeclared");function _c(e,t,n,r){let a=new Set(e.managedLayers);if(a.size===0)return[];let s=[];for(let o of t){if(o.typeOnly)continue;let c=o.specifier;if(!c||!ya(c))continue;let l=n(o.from);!l||!a.has(l)||s.push(ge(e,"arkrun-transport-bypass",o.from,o.line,`${l} must not import broker/queue/emitter ${JSON.stringify(c)}; use the ArkRun kernel transport.`,{fromLayer:l,target:c},r))}return s}_chunkA5EIY3HIcjs.a.call(void 0, _c,"evaluateTransportBypass");function ba(e){let t=e.arkRun;if(!t)return{findings:[],completenessReasons:[]};let n=xt(e.classification),r=Cc(t,e.kernelCalls,e.declarations,e.layerForFile,n),a=[...Ic(t,e.compositionRootHits,n),...Ec(t,e.layers,e.dependencies,e.layerForFile,n),...Sc(t,e.layers,e.managedNews,e.compositionRootHits,e.layerForFile,n),...r.findings,..._c(t,e.dependencies,e.layerForFile,n)].sort(kc),s=[...r.completenessReasons].sort((o,c)=>{let l=`${o.code}\0${_nullishCoalesce(o.file, () => (""))}\0${o.message}`,p=`${c.code}\0${_nullishCoalesce(c.file, () => (""))}\0${c.message}`;return l<p?-1:l>p?1:0});return{findings:a,completenessReasons:s}}_chunkA5EIY3HIcjs.a.call(void 0, ba,"evaluateArkRunSensors");function Ia(e){return _chunkUN5EH4QVcjs.p.call(void 0, e)}_chunkA5EIY3HIcjs.a.call(void 0, Ia,"arkOrderGlobToRegExp");function Ea(e){return e==="arkgate/order"||e.startsWith("arkgate/order/")}_chunkA5EIY3HIcjs.a.call(void 0, Ea,"isArkOrderModuleSpecifier");var Sa={"arkorder-missing-plane":"ARKORDER_MISSING_PLANE","arkorder-kernel-in-domain":"ARKORDER_KERNEL_IN_DOMAIN","arkorder-generic-update":"ARKORDER_GENERIC_UPDATE","arkorder-too-many-params":"ARKORDER_TOO_MANY_PARAMS","arkorder-ingest-writes-xi":"ARKORDER_INGEST_WRITES_XI","arkorder-xi-field-write":"ARKORDER_XI_FIELD_WRITE","arkorder-information-budget":"ARKORDER_INFORMATION_BUDGET","arkorder-xi-ttl":"ARKORDER_XI_TTL"};function Oc(e,t){return!t||t.length===0?!0:t.some(n=>Ia(n).test(e))}_chunkA5EIY3HIcjs.a.call(void 0, Oc,"matchesArkOrderAppliesTo");function xc(e,t=[]){let n=e.trim();return/^domain(?:model)?$/i.test(n)||/^domain(?=[A-Z_\-\s])/i.test(n)?!0:t.some(r=>{let a=r.trim().replace(/\.+$/,"");return a==="Domain"||a.startsWith("Domain.")})}_chunkA5EIY3HIcjs.a.call(void 0, xc,"isDomainRoleLayer");function ce(e,t,n,r,a,s,o){let c=e.mode==="enforced"&&o;return{ruleId:Sa[t],sensor:t,message:a,file:n,line:r,..._optionalChain([s, 'optionalAccess', _154 => _154.fromLayer])?{fromLayer:s.fromLayer}:{},..._optionalChain([s, 'optionalAccess', _155 => _155.target])?{target:s.target}:{},severity:c?"error":"warning",failsStrict:c,nextAction:ie({ruleId:Sa[t],fromLayer:_optionalChain([s, 'optionalAccess', _156 => _156.fromLayer]),target:_optionalChain([s, 'optionalAccess', _157 => _157.target])})}}_chunkA5EIY3HIcjs.a.call(void 0, ce,"finding");function Ca(e){let t=e.arkOrder;if(!t)return{findings:[],completenessReasons:[]};let n=xt(e.classification),r=[],a=t.planeRoots;if(t.mode==="enforced"&&a.length===0)r.push(ce(t,"arkorder-missing-plane","ark.config.json",1,"ArkOrder planeRoots is empty; no createOrderPlane site is declared.",void 0,n));else{let l=new Map;for(let p of e.planeRootHits){let f=_nullishCoalesce(l.get(p.matchedRoot), () => ([]));f.push(p),l.set(p.matchedRoot,f)}for(let p of a){let f=_nullishCoalesce(l.get(p), () => ([]));if(f.length===0){r.push(ce(t,"arkorder-missing-plane","ark.config.json",1,`ArkOrder plane root ${JSON.stringify(p)} matched no governed files and has no createOrderPlane factory.`,{target:p},n));continue}f.some(h=>h.hasPlaneFactory)||r.push(ce(t,"arkorder-missing-plane",f[0].file,1,`ArkOrder plane root ${JSON.stringify(p)} has no createOrderPlane factory.`,{target:p},n))}}let s=new Map(e.layers.map(l=>[l.name,_nullishCoalesce(l.intentPrefixes, () => ([]))]));for(let l of e.dependencies){let p=l.specifier;if(!p||!Ea(p))continue;let f=e.layerForFile(l.from);f&&xc(f,_nullishCoalesce(s.get(f), () => ([])))&&r.push(ce(t,"arkorder-kernel-in-domain",l.from,l.line,"Domain-role layer imports arkgate/order; Domain stays plane-free.",{fromLayer:f,target:p},n))}for(let l of e.genericUpdates)r.push(ce(t,"arkorder-generic-update",l.file,l.line,`Generic ${l.method}() on the order plane rewrites \u03BE; Haken forbids it.`,{target:l.method},n));let o=_nullishCoalesce(t.xiKeys, () => ([]));for(let l of _nullishCoalesce(e.releaseKeyCounts, () => ([])))l.keyCount<=t.maxXiKeys||r.push(ce(t,"arkorder-too-many-params",l.file,l.line,`release() freezes ${l.keyCount} keys; maxXiKeys is ${t.maxXiKeys} (few slow modes).`,{target:String(l.keyCount)},n));for(let l of _nullishCoalesce(e.ingestWritesXi, () => ([])))r.push(ce(t,"arkorder-ingest-writes-xi",l.file,l.line,"ingest() result is assigned into a Release or \u03BE store; ingest may absorb or escalate, never mint a pattern.",void 0,n));for(let l of _nullishCoalesce(e.xiTtlKeys, () => ([])))r.push(ce(t,"arkorder-xi-ttl",l.file,l.line,`\u03BE key ${JSON.stringify(l.key)} is a freshness field; freshness belongs on \u03C3 (freshUntil), never on \u03BE.`,{target:l.key},n));for(let l of _nullishCoalesce(e.budgetLeaks, () => ([])))r.push(ce(t,"arkorder-information-budget",l.file,l.line,`Projection allowedKinds lists ${JSON.stringify(l.kind)}, which informationBudget.cannotObserve denies.`,{target:l.kind},n));let c=new Set(t.managedLayers);for(let l of o.length===0?[]:_nullishCoalesce(e.xiFieldWrites, () => ([]))){let p=e.layerForFile(l.file);!p||!c.has(p)||Oc(l.file,t.appliesTo)&&r.push(ce(t,"arkorder-xi-field-write",l.file,l.line,`This file writes ${JSON.stringify(l.key)} the same way it would write a seat count. Take the event in, or change that choice through the valve (propose, then apply).`,{fromLayer:p,target:l.key},n))}return r.sort((l,p)=>l.file.localeCompare(p.file)||l.ruleId.localeCompare(p.ruleId)||l.line-p.line),{findings:r,completenessReasons:[]}}_chunkA5EIY3HIcjs.a.call(void 0, Ca,"evaluateArkOrderSensors");var st="4.8.24";function at(e){let t=e.childSlices;return t!==null&&typeof t=="object"&&!Array.isArray(t)?t:null}_chunkA5EIY3HIcjs.a.call(void 0, at,"childSlicesOf");var _a=Object.freeze([{key:"childSlices.arkRulesFile",minVersion:st,uses:_chunkA5EIY3HIcjs.a.call(void 0, e=>typeof _optionalChain([at, 'call', _158 => _158(e), 'optionalAccess', _159 => _159.arkRulesFile])=="string","uses")},{key:"childSlices.sliceAliases.pinned",minVersion:st,uses:_chunkA5EIY3HIcjs.a.call(void 0, e=>{let t=_optionalChain([at, 'call', _160 => _160(e), 'optionalAccess', _161 => _161.sliceAliases]);return Array.isArray(t)?t.some(n=>{if(n===null||typeof n!="object")return!1;let r=n;return r.pinned!==void 0||r.reason!==void 0}):!1},"uses")},{key:"sharedImportsSlice.stopAt",minVersion:st,uses:_chunkA5EIY3HIcjs.a.call(void 0, e=>e.sharedImportsSlice!==null&&typeof e.sharedImportsSlice=="object","uses")},{key:"childSlices.message",minVersion:st,uses:_chunkA5EIY3HIcjs.a.call(void 0, e=>_optionalChain([at, 'call', _162 => _162(e), 'optionalAccess', _163 => _163.message])!==void 0,"uses")},{key:"childSlices.siblings.ratchet",minVersion:st,uses:_chunkA5EIY3HIcjs.a.call(void 0, e=>{let t=_optionalChain([at, 'call', _164 => _164(e), 'optionalAccess', _165 => _165.siblings]);return t!==null&&typeof t=="object"&&"ratchet"in t},"uses")},{key:"childSlices",minVersion:"4.8.23",uses:_chunkA5EIY3HIcjs.a.call(void 0, e=>at(e)!==null,"uses")},{key:'sharedImportsSlice: "deny-cross-parent"',minVersion:"4.8.23",uses:_chunkA5EIY3HIcjs.a.call(void 0, e=>e.sharedImportsSlice==="deny-cross-parent","uses")},{key:"sliceIdentity",minVersion:"4.8.21",uses:_chunkA5EIY3HIcjs.a.call(void 0, e=>e.sliceIdentity!==void 0,"uses")},{key:"sharedImportsSlice",minVersion:"4.8.20",uses:_chunkA5EIY3HIcjs.a.call(void 0, e=>e.sharedImportsSlice==="deny","uses")}]);function wt(e){let t=/^v?(\d+)\.(\d+)\.(\d+)/.exec(String(e).trim());return t?[Number(t[1]),Number(t[2]),Number(t[3])]:null}_chunkA5EIY3HIcjs.a.call(void 0, wt,"versionCore");function ot(e,t){let n=wt(e),r=wt(t);if(!n&&!r)return 0;if(!n)return-1;if(!r)return 1;for(let a=0;a<3;a+=1){let s=_nullishCoalesce(n[a], () => (0)),o=_nullishCoalesce(r[a], () => (0));if(s<o)return-1;if(s>o)return 1}return 0}_chunkA5EIY3HIcjs.a.call(void 0, ot,"compareArkgateVersion");function Oa(e,t){return t&&wt(t)&&ot(t,e)<0?t.replace(/^v/,""):e}_chunkA5EIY3HIcjs.a.call(void 0, Oa,"effectiveFloor");function wc(e,t){let n=[],r=null;for(let a of _a){if(!(_nullishCoalesce(e, () => ([]))).some(o=>o&&a.uses(o)))continue;n.push(a.key);let s=Oa(a.minVersion,t);(!r||ot(s,r)>0)&&(r=s)}return r?{keys:n,required:r}:null}_chunkA5EIY3HIcjs.a.call(void 0, wc,"configVersionFloors");function xa(e){let t=wc(e.rules,e.runningVersion);if(!t||!_optionalChain([e, 'access', _166 => _166.pins, 'optionalAccess', _167 => _167.length]))return[];let n=e.runningVersion,r=n&&wt(n)&&ot(n,t.required)>0?n.replace(/^v/,""):t.required,a=_chunkA5EIY3HIcjs.a.call(void 0, c=>_a.filter(l=>t.keys.includes(l.key)&&ot(c.version,Oa(l.minVersion,n))<0).map(l=>l.key),"needing"),s=new Set,o=[];for(let c of e.pins){if(ot(c.version,t.required)>=0)continue;let l=`${c.file}\0${c.line}`;if(s.has(l))continue;s.add(l);let p=a(c);o.push({ruleId:"CONFIG_CHILD_SLICES_VERSION",failsStrict:!1,path:c.file,line:c.line,message:`ark.config.json uses ${p.join(", ")} (needs arkgate ${t.required}+). ${c.file}:${c.line} pins arkgate ${c.version}, which rejects this config at load.`,nextAction:`Bump arkgate in ${c.file} from ${c.version} to ${r}, then run Ark again.`})}return o.sort((c,l)=>c.path.localeCompare(l.path)||c.line-l.line)}_chunkA5EIY3HIcjs.a.call(void 0, xa,"configVersionPinFindings");function W(e,t,n={}){return{ruleId:e,message:t,...n}}_chunkA5EIY3HIcjs.a.call(void 0, W,"configWarning");function Tt(e){let{config:t,rules:n,files:r,manifest:a}=e,s=[];if(t.dynamicImportAllowlist!==void 0&&(!Array.isArray(t.dynamicImportAllowlist)||t.dynamicImportAllowlist.some(d=>typeof d!="string"))&&s.push(W("CONFIG_INVALID_DYNAMIC_IMPORT_ALLOWLIST","dynamicImportAllowlist must be an array of file globs.")),t.safety!==void 0&&(t.safety===null||typeof t.safety!="object"||Array.isArray(t.safety)))s.push(W("CONFIG_INVALID_SAFETY","safety must be an object."));else if(t.safety)for(let d of["maxTsSuppressions","maxAnyCasts"]){let g=t.safety[d];g!==void 0&&(!Number.isInteger(g)||g<0)&&s.push(W("CONFIG_INVALID_SAFETY_THRESHOLD",`safety.${d} must be a non-negative integer.`))}let o=Array.isArray(t.layers)?t.layers:[],c=Array.isArray(_optionalChain([a, 'optionalAccess', _168 => _168.architecture, 'optionalAccess', _169 => _169.layers]))?a.architecture.layers:[],l=new Set([...o.map(d=>d.name).filter(Boolean),...c.map(d=>d.name).filter(d=>!!d)]);o.length===0&&s.push(W("CONFIG_NO_LAYERS","No file layers are configured; ark-check cannot classify files for import-boundary enforcement."));let p=new Set,f=new Set;for(let d of o){if(!d.name){s.push(W("CONFIG_LAYER_WITHOUT_NAME","A configured layer is missing a name."));continue}p.has(d.name)&&f.add(d.name),p.add(d.name),d.forbiddenGlobals!==void 0&&(!Array.isArray(d.forbiddenGlobals)||d.forbiddenGlobals.some(b=>typeof b!="string"))&&s.push(W("CONFIG_INVALID_FORBIDDEN_GLOBALS",`Layer "${d.name}" has an invalid forbiddenGlobals value; expected an array of strings (e.g. ["fetch", "Date.now"]). The entry is ignored.`,{layer:d.name}));let g=Array.isArray(d.patterns)?d.patterns:[];if(g.length===0){s.push(W("CONFIG_LAYER_WITHOUT_PATTERNS",`Layer "${d.name}" has no file patterns and will never classify files.`,{layer:d.name}));continue}for(let b of g){let x;try{x=_chunkUN5EH4QVcjs.p.call(void 0, b)}catch(E){s.push(W("CONFIG_INVALID_LAYER_PATTERN",`Layer "${d.name}" has an invalid pattern "${b}": ${E instanceof Error?E.message:String(E)}`,{layer:d.name,pattern:b}));continue}let k=d.optional===!0||d.reserved===!0||d.allowEmpty===!0;!r.some(E=>x.test(E))&&!k&&s.push(W("CONFIG_LAYER_PATTERN_NO_MATCHES",`Layer "${d.name}" pattern "${b}" matched no included files (possible typo). Mark the layer reserved/allowEmpty if this house is reserved for later.`,{layer:d.name,pattern:b,failsStrict:!1,reserved:!1}))}}for(let d of f)s.push(W("CONFIG_DUPLICATE_LAYER",`Layer "${d}" is configured more than once.`,{layer:d}));if(l.size>0)for(let d of _nullishCoalesce(n, () => ([])))d.from&&!l.has(d.from)&&s.push(W("CONFIG_RULE_UNKNOWN_FROM_LAYER",`Rule references unknown source layer "${d.from}".`,{fromLayer:d.from,toLayer:d.to})),d.to&&!l.has(d.to)&&s.push(W("CONFIG_RULE_UNKNOWN_TO_LAYER",`Rule references unknown target layer "${d.to}".`,{fromLayer:d.from,toLayer:d.to}));let h=new Set;if(o.length>1)for(let d of r){let g=-1,b=[];for(let x of o)for(let k of _nullishCoalesce(x.patterns, () => ([]))){if(!_chunkUN5EH4QVcjs.p.call(void 0, k).test(d))continue;let E=_chunkUN5EH4QVcjs.q.call(void 0, k,d);E>g?(g=E,b=[x.name]):E===g&&!b.includes(x.name)&&b.push(x.name)}b.length>1&&h.add([...b].sort().join(" + "))}h.size>0&&s.push(W("CONFIG_AMBIGUOUS_LAYERS",`Some files match multiple layers at equal specificity; classification falls back to declaration order. Disambiguate the overlapping patterns: ${[...h].join(", ")}.`,{pairs:[...h]}));let u=r.filter(d=>!_chunkUN5EH4QVcjs.r.call(void 0, d,o));u.length>0&&s.push(W("CONFIG_UNCLASSIFIED_FILES",`${u.length} included source file(s) are not matched by any configured layer; ark-check will not enforce import rules for those source files.`,{count:u.length,samples:u.slice(0,5)}));for(let d of _chunkUN5EH4QVcjs.s.call(void 0, n))s.push(W("CONFIG_SLICE_IDENTITY_COLLISION",d.message,{paths:[...d.paths],fromLayer:d.from,toLayer:d.to,failsStrict:!1}));for(let d of _chunkUN5EH4QVcjs.C.call(void 0, n,r))s.push(W(d.ruleId,d.message,{failsStrict:!1,...d.path?{file:d.path}:{},...d.fromLayer?{fromLayer:d.fromLayer}:{},...d.toLayer?{toLayer:d.toLayer}:{}}));for(let d of xa({rules:n,pins:e.arkgatePins,runningVersion:e.runningArkgateVersion}))s.push(W(d.ruleId,d.message,{failsStrict:!1,file:d.path,line:d.line,nextAction:d.nextAction}));let A=_chunkUN5EH4QVcjs.b.call(void 0, t);if(A.length>0){let d=_nullishCoalesce(A[0], () => ("this layer"));s.push(W("CONFIG_LAYER_MISSING_OWNER",`${d} has no owner. Add a GitHub handle or email to layers[].owners so this house has a name on the door.`,{layers:A,nextAction:_chunkUN5EH4QVcjs.c.call(void 0, d)}))}return s}_chunkA5EIY3HIcjs.a.call(void 0, Tt,"collectAnalysisConfigWarnings");function wa(e,t){let n=e.ruleId==="ARKRULE_STRUCTURE",r=e.ruleId==="ARKRULE_SCOPE_EMPTY",a=e.ruleId==="INVARIANT_CATALOG_EMPTY";return{ruleId:e.ruleId,file:e.file,line:e.line,message:e.message,fromLayer:e.fromLayer,arkruleId:e.arkruleId,arkruleSource:e.arkruleSource,...n?{sensor:e.sensor,code:e.code,target:Zs({sensor:e.sensor,code:e.code})}:{},...r||a?{freezable:!1}:{},nextAction:t}}_chunkA5EIY3HIcjs.a.call(void 0, wa,"toArkRuleEngineViolation");function Tc(e){let t=e.arkRules;return!!(t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length>0)}_chunkA5EIY3HIcjs.a.call(void 0, Tc,"arkRulesMapIsOn");function Ta(e,t){return e.ruleId==="INVARIANT_CATALOG_EMPTY"?t?`Add 1\u20132 short phrases to invariants[] in ${e.arkruleSource} so Domain has policies the code must preserve (advisory \u2014 does not fail the merge until a domain structure rule is enforced).`:`Add 1\u20132 short phrases to invariants[] in ${e.arkruleSource} so Domain has policies the code must preserve. Empty catalog fails --strict-merge because a domain structure rule is already enforced.`:e.ruleId==="ARKRULE_SCOPE_EMPTY"?t?`Review appliesTo for ${e.arkruleId} in ${e.arkruleSource} (zero-match scope; advisory). Empty scope is not freezable; promote only after the folder exists.`:`Fix appliesTo globs for ${e.arkruleId} in ${e.arkruleSource} so they match governed files, or remove the rule. ARKRULE_SCOPE_EMPTY is a config diagnostic and is not freezable (even with --force). Land the rule as advisory until the folder exists, then promote.`:t?`Review ArkRule ${e.arkruleId} in ${e.arkruleSource} (advisory).`:`Fix the structure or invariant for ${e.arkruleId} (declared in ${e.arkruleSource}), then preflight again.`}_chunkA5EIY3HIcjs.a.call(void 0, Ta,"arkRuleFindingNextAction");function Nc(e,t){return t.some(n=>{try{return _chunkUN5EH4QVcjs.p.call(void 0, n).test(e)}catch (e4){return!1}})}_chunkA5EIY3HIcjs.a.call(void 0, Nc,"matchesAny");function Pc(e,t){let n=_nullishCoalesce(e.contract.config.safety, () => ({})),r=Number.isInteger(n.maxTsSuppressions)?Number(n.maxTsSuppressions):0,a=Number.isInteger(n.maxAnyCasts)?Number(n.maxAnyCasts):0,s=_nullishCoalesce(e.contract.config.dynamicImportAllowlist, () => ([])),o=t.safetyUses.filter(g=>g.kind==="ts-suppression").map(({file:g,line:b})=>({file:g,line:b})),c=t.safetyUses.filter(g=>g.kind==="any-cast").map(({file:g,line:b})=>({file:g,line:b})),l=t.safetyUses.filter(g=>(g.kind==="dynamic-import"||g.kind==="dynamic-require")&&!Nc(g.file,s)).map(g=>({file:g.file,line:g.line,kind:g.kind==="dynamic-require"?"require":"import"})),p=n.allowInMemory===!0||t.projectPackageName==="arkgate"?[]:t.safetyUses.filter(g=>g.kind==="in-memory-store").map(g=>({file:g.file,line:g.line,store:_nullishCoalesce(g.symbol, () => ("in-memory store"))})),f=n.allowDisabledPeerIsolation===!0?[]:(_nullishCoalesce(e.contract.config.rules, () => ([]))).filter(g=>g.peerIsolation===!1||g.allowed===!1&&!!g.from&&g.from===g.to&&g.peerIsolation!==!0).map(g=>({from:g.from,to:g.to})),h={tsSuppressions:o,anyCasts:c,nonLiteralDynamicImports:l,inMemoryProductionStores:p,disabledPeerIsolationRules:f,thresholds:{maxTsSuppressions:r,maxAnyCasts:a}},u=[],A=l.filter(g=>g.kind==="import");if(A.length>0){let g=A[0];u.push({ruleId:"DYNAMIC_IMPORT_NOT_ALLOWLISTED",file:g.file,line:g.line,message:`${A.length} non-literal dynamic import(s) cannot be resolved statically. Add only reviewed files to dynamicImportAllowlist.`})}let d=l.filter(g=>g.kind==="require");if(d.length>0){let g=d[0];u.push({ruleId:"DYNAMIC_REQUIRE_NOT_ALLOWLISTED",file:g.file,line:g.line,message:`${d.length} non-literal require call(s) cannot be resolved statically. Add only reviewed files to dynamicImportAllowlist.`})}if(o.length>r){let g=o[0];u.push({ruleId:"TS_SUPPRESSION_THRESHOLD_EXCEEDED",file:g.file,line:g.line,message:`${o.length} @ts-ignore/@ts-nocheck directive(s) exceed safety.maxTsSuppressions (${r}).`})}if(c.length>a){let g=c[0];u.push({ruleId:"ANY_CAST_THRESHOLD_EXCEEDED",file:g.file,line:g.line,message:`${c.length} explicit any cast(s) exceed safety.maxAnyCasts (${a}).`})}if(p.length>0){let g=p[0];u.push({ruleId:"IN_MEMORY_STORE_IN_PRODUCTION_SOURCE",file:g.file,line:g.line,message:`${p.length} ArkGate InMemory store risk(s) appear in governed production source. Provide durable stores or set safety.allowInMemory only for an explicitly ephemeral service.`})}return f.length>0&&u.push({ruleId:"PEER_ISOLATION_DISABLED",message:`${f.length} rule(s) disable or omit required peerIsolation. Restore peerIsolation: true or set safety.allowDisabledPeerIsolation only with a documented production exception.`}),{report:h,warnings:u}}_chunkA5EIY3HIcjs.a.call(void 0, Pc,"evaluateSafety");function Lc(e,t){return[...t].filter(n=>e===n||e.startsWith(`${n}.`)).sort((n,r)=>r.length-n.length)[0]}_chunkA5EIY3HIcjs.a.call(void 0, Lc,"ambientForbiddenGlobal");function Na(e,t){let n=t.config.layers.filter(r=>(_nullishCoalesce(r.intentPrefixes, () => ([]))).length>0);return _chunkUN5EH4QVcjs.g.call(void 0, e,n.length>0?n:_chunkUN5EH4QVcjs.f.map(r=>({name:r.layer,prefixes:r.prefixes})))}_chunkA5EIY3HIcjs.a.call(void 0, Na,"intentLayer");function Dc(e,t,n){let r=[],a=new Map(e.contract.config.layers.map(s=>[s.name,s]));for(let s of t.ambientUses){let o=n.get(s.file);!o||!Lc(s.symbol,_nullishCoalesce(_optionalChain([a, 'access', _170 => _170.get, 'call', _171 => _171(o), 'optionalAccess', _172 => _172.forbiddenGlobals]), () => ([])))||r.push({ruleId:"FORBIDDEN_GLOBAL",file:s.file,line:s.line,fromLayer:o,target:s.symbol,message:`${o} must not use the ambient global "${s.symbol}".`})}for(let s of t.capabilityUses){let o=n.get(s.file);if(!o)continue;let c=a.get(o),l=_nullishCoalesce(_optionalChain([c, 'optionalAccess', _173 => _173.forbiddenGlobals]), () => ([])),p=s.source==="import-based"?_optionalChain([t, 'access', _174 => _174.dependencies, 'access', _175 => _175.find, 'call', _176 => _176(f=>f.from===s.file&&f.line===s.line&&f.specifier===s.symbol&&!f.typeOnly), 'optionalAccess', _177 => _177.kind]):void 0;if(!(s.source==="ambient-global"&&We(s.symbol,l))){if(s.source==="import-based"){let f=he(s.symbol,l);if(f){r.push({ruleId:"FORBIDDEN_GLOBAL",file:s.file,line:s.line,fromLayer:o,target:s.symbol,...p?{edgeKind:p}:{},message:`${o} must not use module "${s.symbol}" because it is the import form of forbidden global "${f}".`});continue}}Pe(c).includes(s.capability)&&r.push({ruleId:"CAPABILITY_VIOLATION",file:s.file,line:s.line,fromLayer:o,target:s.symbol,capability:s.capability,...p?{edgeKind:p}:{},message:s.source==="import-based"?`${o} denies the ${s.capability} capability; found import of "${s.symbol}".`:`${o} denies the ${s.capability} capability; found ambient "${s.symbol}".`})}}for(let s of t.publishCalls){let o=n.get(s.file);if(!o)continue;for(let l of _chunkUN5EH4QVcjs.i.call(void 0, {publishCall:!0,rawIntentName:s.rawIntentName,objectHasIntent:s.objectHasIntent,arkPublishCandidate:s.arkPublishCandidate,hasSource:s.hasSource}))r.push({ruleId:l.ruleId,file:s.file,line:s.line,...l.ruleId==="PUBLISH_MISSING_SOURCE"?{fromLayer:o}:{},message:l.message});if(!s.sourceIntent)continue;let c=Na(s.sourceIntent,e.contract);!c||c===o||r.push({ruleId:"PUBLISH_SOURCE_LAYER_MISMATCH",file:s.file,line:s.line,fromLayer:o,toLayer:c,target:s.sourceIntent,message:`Publish source "${s.sourceIntent}" resolves to ${c}, but the publishing file is classified as ${o}.`})}for(let s of t.intentReferences){let o=n.get(s.file);if(!o)continue;let c=Na(s.intent,e.contract);if(!c)continue;let l=_chunkUN5EH4QVcjs.E.call(void 0, e.contract.config.rules,o,c,{fromPath:s.file,layers:e.contract.config.layers});if(!l)continue;let p=l.sliceVerdict,f=`${o} must not reference ${c} intent ${s.intent}.`,h=p?_chunkUN5EH4QVcjs.A.call(void 0, {surface:"intent",verdict:p,fromLayer:o,toLayer:c,fromPath:s.file,ruleMessage:l.rule.message,childMessage:_optionalChain([l, 'access', _178 => _178.rule, 'access', _179 => _179.childSlices, 'optionalAccess', _180 => _180.message]),defaultMessage:f}):_nullishCoalesce(l.rule.message, () => (f));r.push({ruleId:"LAYER_INTENT_REFERENCE_VIOLATION",file:s.file,line:s.line,fromLayer:o,toLayer:c,target:s.intent,...l.rule.peerIsolation?{peerIsolation:!0}:{},..._chunkUN5EH4QVcjs.B.call(void 0, p),message:h})}return r}_chunkA5EIY3HIcjs.a.call(void 0, Dc,"contentViolations");function Pa(e,t){return t==="enforced"?{violations:e.map(n=>({ruleId:n.ruleId,file:n.file,line:n.line,message:n.message,fromLayer:n.fromLayer,target:n.target,nextAction:n.nextAction,sensor:n.sensor,failsStrict:n.failsStrict,...n.severity?{severity:n.severity}:{}})),warnings:[]}:{violations:[],warnings:e.map(n=>({ruleId:n.ruleId,file:n.file,line:n.line,message:n.message,fromLayer:n.fromLayer,target:n.target,nextAction:n.nextAction,sensor:n.sensor,failsStrict:!1}))}}_chunkA5EIY3HIcjs.a.call(void 0, Pa,"splitExtraPlaneFindings");function Nt(e){let{facts:t}=e,n=Ze(e.contract.config),r=t.evidenceRequirementsHash===n,a=r?t.completeness:"unavailable",s=r?t.completenessReasons:[...t.completenessReasons,{code:"EVIDENCE_REQUIREMENTS_MISMATCH",message:"Resolved facts were collected for different policy-controlled evidence requirements."}].sort((R,m)=>{let y=`${R.code}\0${_nullishCoalesce(R.file, () => (""))}\0${R.message}`,T=`${m.code}\0${_nullishCoalesce(m.file, () => (""))}\0${m.message}`;return y<T?-1:y>T?1:0}),o=t.files.map(R=>({...R,layer:_nullishCoalesce(_chunkUN5EH4QVcjs.r.call(void 0, R.path,e.contract.config.layers), () => (null))})),c=new Map(o.map(R=>[R.path,R.layer])),l=t.dependencies.map(R=>{let m=R.target?_nullishCoalesce(c.get(R.target), () => (_chunkUN5EH4QVcjs.r.call(void 0, R.target,e.contract.config.layers))):void 0;return{from:R.from,fromLayer:_nullishCoalesce(c.get(R.from), () => (null)),...R.resolution==="resolved-project"&&R.target?{to:R.target,...m?{toLayer:m}:{}}:{},line:R.line,kind:R.kind,typeOnly:R.typeOnly,...R.targetTypeOnlyExports?{targetTypeOnlyExports:R.targetTypeOnlyExports}:{},...R.sourcePureTypeModule?{sourcePureTypeModule:R.sourcePureTypeModule}:{},...R.namedBindingsTypeOnly?{namedBindingsTypeOnly:R.namedBindingsTypeOnly}:{},...R.portProofEligible?{portProofEligible:R.portProofEligible}:{}}}),p=Tt({config:e.contract.config,rules:e.contract.config.rules,files:o.map(R=>R.path),arkgatePins:e.arkgatePins,runningArkgateVersion:e.runningArkgateVersion}),f=Pc(e,t),h=_nullishCoalesce(e.contract.arkRules, () => (Qe())),u=o.map(R=>R.path),d={..._optionalChain([e, 'access', _181 => _181.coverageInputs, 'optionalAccess', _182 => _182.fileContents])&&Object.keys(e.coverageInputs.fileContents).length>0?ga(e.coverageInputs.fileContents):{},..._nullishCoalesce(e.fileHints, () => ({}))},g=_chunkA5EIY3HIcjs.a.call(void 0, R=>_nullishCoalesce(c.get(R), () => (_chunkUN5EH4QVcjs.r.call(void 0, R,e.contract.config.layers))),"resolveLayer"),b=[...ua({arkRules:h,classShapes:_nullishCoalesce(_nullishCoalesce(e.contract.classShapes, () => (t.classShapes)), () => ([])),files:u,layerForFile:g,fileHints:d}),...pa(h,u),...fa({arkRulesActive:Tc(e.contract.config),arkRules:h,layers:_nullishCoalesce(e.contract.config.layers, () => ([])),files:u.map(R=>({path:R,layer:g(R)}))})],x=(_nullishCoalesce(_optionalChain([h, 'access', _183 => _183.invariants, 'optionalAccess', _184 => _184.length]), () => (0)))>0,k=xs({hasEnforcedInvariant:Rn(h.invariants),coverage:e.contract.config.coverage,...e.coverageRootsPresent===!1?{declaredPathPresent:!1}:{}}),E=k.length>0?[]:Os({adopted:e.adopted===!0,hasDomainInvariants:yn(h.invariants),coverage:e.contract.config.coverage,...e.invariantTestsPathPresent===!1?{declaredPathPresent:!1}:{}}),C=[...k.map(R=>({ruleId:R.ruleId,file:R.file,line:R.line,message:R.message,nextAction:"Add coverage.coverageRoots in ark.config.json pointing at the folder the test runner uses, then re-run. An enforced invariant fails closed until that path is present.",failsStrict:!0,freezable:!1})),...E.map(R=>({ruleId:R.ruleId,file:R.file,line:R.line,message:R.message,nextAction:"Add coverage.testGlobs or coverage.coverageRoots in ark.config.json pointing at a real tests folder, then re-run. Adopted mode fails closed until that path is present.",failsStrict:!0,freezable:!1}))],U=b.filter(R=>R.failsStrict).map(R=>wa(R,Ta(R,!1))),K=b.filter(R=>!R.failsStrict).map(R=>({...wa(R,Ta(R,!0)),failsStrict:!1})),G=x?Cs({arkRules:h,fileContents:_nullishCoalesce(_optionalChain([e, 'access', _185 => _185.coverageInputs, 'optionalAccess', _186 => _186.fileContents]), () => ({})),testFiles:_nullishCoalesce(_optionalChain([e, 'access', _187 => _187.coverageInputs, 'optionalAccess', _188 => _188.testFiles]), () => ([])),testGlobsMissing:_optionalChain([e, 'access', _189 => _189.coverageInputs, 'optionalAccess', _190 => _190.testGlobsMissing])===!0||e.coverageInputs===void 0||(_nullishCoalesce(_optionalChain([e, 'access', _191 => _191.coverageInputs, 'access', _192 => _192.testFiles, 'optionalAccess', _193 => _193.length]), () => (0)))===0,coverageBudgetExhausted:_optionalChain([e, 'access', _194 => _194.coverageInputs, 'optionalAccess', _195 => _195.coverageBudgetExhausted])===!0,..._optionalChain([e, 'access', _196 => _196.coverageInputs, 'optionalAccess', _197 => _197.stats])?{coverageStats:e.coverageInputs.stats}:{},..._optionalChain([e, 'access', _198 => _198.coverageInputs, 'optionalAccess', _199 => _199.coverageRoots])?{coverageRoots:e.coverageInputs.coverageRoots}:{}}):{coverage:[],violations:[],partial:!1},I=G.violations.filter(R=>R.failsStrict).map(R=>({ruleId:R.ruleId,file:R.file,line:R.line,message:R.message,fromLayer:R.fromLayer,arkruleId:R.arkruleId,arkruleSource:R.arkruleSource,nextAction:`Add a test title or declared symbol covering ${R.arkruleId} (declared in ${R.arkruleSource}), then preflight again.`})),D=G.violations.filter(R=>!R.failsStrict).map(R=>({ruleId:R.ruleId,file:R.file,line:R.line,message:R.message,fromLayer:R.fromLayer,arkruleId:R.arkruleId,arkruleSource:R.arkruleSource,failsStrict:!1,nextAction:R.ruleId==="INVARIANT_COVERAGE_OUTSIDE_ROOTS"?`Move ${R.file} under a declared coverage root, or add its root to coverage.coverageRoots in ark.config.json.`:`Cover invariant ${R.arkruleId} in ${R.arkruleSource} (advisory / partial).`})),Y=ma(o),re=ba({arkRun:e.contract.config.arkRun,layers:e.contract.config.layers,kernelCalls:t.arkRunKernelCalls,managedNews:t.arkRunManagedNews,compositionRootHits:t.arkRunCompositionRootHits,declarations:t.arkRunDeclarations,dependencies:t.dependencies,layerForFile:_chunkA5EIY3HIcjs.a.call(void 0, R=>_nullishCoalesce(c.get(R), () => (_chunkUN5EH4QVcjs.r.call(void 0, R,e.contract.config.layers))),"layerForFile"),classification:Y}),{violations:me,warnings:se}=Pa(re.findings,_optionalChain([e, 'access', _200 => _200.contract, 'access', _201 => _201.config, 'access', _202 => _202.arkRun, 'optionalAccess', _203 => _203.mode])),Oe=Ca({arkOrder:e.contract.config.arkOrder,layers:e.contract.config.layers,planeCalls:t.arkOrderPlaneCalls,genericUpdates:t.arkOrderGenericUpdates,planeRootHits:t.arkOrderRootHits,xiFieldWrites:t.arkOrderXiFieldWrites,ingestWritesXi:t.arkOrderIngestWritesXi,releaseKeyCounts:t.arkOrderReleaseKeyCounts,xiTtlKeys:t.arkOrderXiTtlKeys,budgetLeaks:t.arkOrderBudgetLeaks,dependencies:t.dependencies,layerForFile:_chunkA5EIY3HIcjs.a.call(void 0, R=>_nullishCoalesce(c.get(R), () => (_chunkUN5EH4QVcjs.r.call(void 0, R,e.contract.config.layers))),"layerForFile"),classification:Y}),{violations:ke,warnings:Pn}=Pa(Oe.findings,_optionalChain([e, 'access', _204 => _204.contract, 'access', _205 => _205.config, 'access', _206 => _206.arkOrder, 'optionalAccess', _207 => _207.mode])),Dt=[...G.partial&&G.coverage.some(R=>R.mode==="enforced"&&R.partial)?[{code:"INVARIANT_COVERAGE_PARTIAL",message:"Enforced ArkRules invariant coverage cannot be fully proven (missing test globs or empty test set); reporting partial, never covered."}]:[],...re.completenessReasons,...Oe.completenessReasons],ve=Ge({config:e.contract.config,rules:e.contract.config.rules,files:o.filter(R=>R.layer).map(R=>R.path),contentViolations:[...Dc(e,t,c),...U,...C,...I,...me,...ke],edges:l,warnings:[...p,...f.warnings,...K,...D,...se,...Pn],safety:f.report}),xe=a==="complete"&&Dt.length>0?"partial":a,it=xe==="complete"?s:[...s,...Dt].sort((R,m)=>{let y=`${R.code}\0${_nullishCoalesce(R.file, () => (""))}\0${R.message}`,T=`${m.code}\0${_nullishCoalesce(m.file, () => (""))}\0${m.message}`;return y<T?-1:y>T?1:0}),Ln=ve.violations.filter(R=>R.failsStrict!==!1),lt=xe==="complete"&&Ln.length===0,S=lt&&ve.warnings.every(R=>R.failsStrict===!1);return{mode:"resolved-candidate-facts",completeness:xe,completenessReasons:it,valid:lt,strictValid:S,policyHash:e.contract.policyHash,factsHash:t.factsHash,resolverIdentity:t.resolverIdentity,candidateTreeHash:t.candidateTreeHash,safety:f.report,ir:{schemaVersion:"1.0",policyHash:e.contract.policyHash,compilerOptionsHash:t.compilerOptionsHash,files:o,layers:e.contract.config.layers.map(R=>R.name),edges:l,capabilityUses:t.capabilityUses,violations:ve.violations,warnings:ve.warnings}}}_chunkA5EIY3HIcjs.a.call(void 0, Nt,"analyzeCanonicalResolvedProject");function La(e){return Nt({contract:e.contract,facts:ye(e.facts),coverageInputs:e.coverageInputs,fileHints:e.fileHints,adopted:e.adopted,invariantTestsPathPresent:e.invariantTestsPathPresent,coverageRootsPresent:e.coverageRootsPresent,arkgatePins:e.arkgatePins,runningArkgateVersion:e.runningArkgateVersion})}_chunkA5EIY3HIcjs.a.call(void 0, La,"analyzeResolvedProject");function Da(e){return X(z(e.map(({path:t,contentHash:n})=>({path:t,contentHash:n}))))}_chunkA5EIY3HIcjs.a.call(void 0, Da,"analysisTreeHash");function Fa(e){let t=rt(e),n=new Map(t.ir.files.map(d=>[d.path,d])),r=[],a=new Set,s=[];for(let d of e.changes){let g=d.path.replace(/\\/g,"/"),b=_e(d.path);if(!b||b===".."||b.startsWith("../")||g.startsWith("/")||/^[A-Za-z]:\//.test(g)||g.includes("\0")){s.push({ruleId:"INVALID_CHANGE_PATH",file:"<change-set>",line:1,message:"Every change requires a safe, non-empty project-relative path."});continue}if(a.has(b)){s.push({ruleId:"DUPLICATE_CHANGE_PATH",file:b,line:1,message:`The atomic change set contains more than one operation for ${b}.`});continue}a.add(b),"delete"in d&&d.delete&&!n.has(b)&&s.push({ruleId:"DELETE_TARGET_MISSING",file:b,line:1,message:`Cannot delete ${b} because it is not present in the supplied base tree.`}),r.push("delete"in d&&d.delete?{path:b,delete:!0}:{path:b,content:"content"in d?d.content:""})}e.changes.length===0&&s.push({ruleId:"CHANGE_SET_EMPTY",file:"<change-set>",line:1,message:"Atomic preflight requires at least one create, update, or delete."});let o=St({...e,changes:r}),c=new Map(o.ir.files.map(d=>[d.path,d])),l=o.ir.violations.filter(d=>d.ruleId==="CAPABILITY_VIOLATION"||d.ruleId==="FORBIDDEN_GLOBAL").map(d=>{let g=_optionalChain([c, 'access', _208 => _208.get, 'call', _209 => _209(d.evidence.file), 'optionalAccess', _210 => _210.layer]);return{ruleId:d.ruleId,file:d.evidence.file,line:d.evidence.line,target:d.symbol,...d.capability?{capability:d.capability}:{},...g?{fromLayer:g}:{},edgeKind:"import",message:d.message}}),p=Ge({config:e.contract.config,rules:e.contract.config.rules,files:o.ir.files.map(d=>d.path),contentViolations:l,edges:o.ir.edges.filter(d=>!!d.fromLayer).map(d=>({from:d.from,fromLayer:d.fromLayer,...d.to?{to:d.to}:{},...d.toLayer?{toLayer:d.toLayer}:{},line:d.evidence.line,kind:"import",...d.typeOnly?{typeOnly:!0}:{},...d.namedBindingsTypeOnly?{namedBindingsTypeOnly:!0}:{}}))}),f=r.map(d=>{let g=_e(d.path),b=n.get(g),x=c.get(g);return{path:g,operation:"delete"in d&&d.delete?"delete":b?"update":"create",...b?{beforeContentHash:b.contentHash}:{},...x?{candidateContentHash:x.contentHash}:{}}}).sort((d,g)=>d.path.localeCompare(g.path)),h=[...s,...p.violations].map(d=>({...d,nextAction:ie(d)})),u=h.filter(d=>d.failsStrict!==!1),A=e.changeMap?Ke({changeMap:e.changeMap,changes:f,baseDependencies:He(t.ir.edges),candidateDependencies:He(o.ir.edges)}):void 0;return{schemaVersion:"1.0",mode:"lexical-compatibility",valid:t.completeness==="complete"&&o.valid&&u.length===0&&(_nullishCoalesce(_optionalChain([A, 'optionalAccess', _211 => _211.structurallyConverged]), () => (!0))),readOnly:!0,policyHash:e.contract.policyHash,compilerOptionsHash:o.ir.compilerOptionsHash,baseTreeHash:Da(t.ir.files),candidateTreeHash:Da(o.ir.files),baseCompleteness:t.completeness,candidateCompleteness:o.completeness,baseCompletenessReasons:t.completenessReasons,candidateCompletenessReasons:o.completenessReasons,...e.changeMap?{changeMapHash:e.changeMap.hash}:{},...A?{convergence:A}:{},changes:f,violations:h,warnings:p.warnings}}_chunkA5EIY3HIcjs.a.call(void 0, Fa,"preflightChange");function Fc(e,t){return[["resolverIdentity",e.resolverIdentity,t.resolverIdentity],["compilerIdentity",e.compilerIdentity,t.compilerIdentity],["evidenceRequirementsHash",e.evidenceRequirementsHash,t.evidenceRequirementsHash],["projectPackageName",_nullishCoalesce(e.projectPackageName, () => ("")),_nullishCoalesce(t.projectPackageName, () => (""))]].filter(([,r,a])=>r!==a).map(([r,a,s])=>({ruleId:"FACTS_IDENTITY_MISMATCH",file:"<change-set>",line:1,field:r,before:a,candidate:s,message:`Base and candidate facts must use the same ${r}.`}))}_chunkA5EIY3HIcjs.a.call(void 0, Fc,"identityViolations");function $c(e,t,n,r){let a=n.get(t),s=r.get(t);return{path:t,operation:"delete"in e&&e.delete?"delete":a?"update":"create",...a?{beforeContentHash:a.contentHash}:{},...s?{candidateContentHash:s.contentHash}:{}}}_chunkA5EIY3HIcjs.a.call(void 0, $c,"preparedChange");function Pt(e){return e.startsWith("ARKRULE_")||e.startsWith("INVARIANT_")}_chunkA5EIY3HIcjs.a.call(void 0, Pt,"isArkRulesPlaneRule");function $a(e){let t=typeof e.arkruleId=="string"?e.arkruleId:"";return[e.ruleId,_nullishCoalesce(e.file, () => ("")),t,_nullishCoalesce(e.target, () => (e.message))].join("|")}_chunkA5EIY3HIcjs.a.call(void 0, $a,"ratchetKey");function Ma(e,t){let n=new Map;for(let r of e){if(!Pt(r.ruleId)||r.failsStrict===!1)continue;let a=$a(r);n.set(a,(_nullishCoalesce(n.get(a), () => (0)))+1)}return t.map(r=>{if(!Pt(r.ruleId))return r;let a=$a(r),s=_nullishCoalesce(n.get(a), () => (0));return s===0?r:(n.set(a,s-1),{...r,preExisting:!0,failsStrict:!1,severity:"warning"})})}_chunkA5EIY3HIcjs.a.call(void 0, Ma,"ratchetPreExistingArkRules");function Mc(e,t){return{completeness:e.completeness,completenessReasons:e.completenessReasons,ir:{edges:t?e.ir.edges:[],violations:e.ir.violations.filter(n=>Pt(n.ruleId)),warnings:e.ir.warnings.filter(n=>Pt(n.ruleId))}}}_chunkA5EIY3HIcjs.a.call(void 0, Mc,"baseAnalysisSummary");function Ha(e){return Hc(e,ye(e.baseFacts),ye(e.candidateFacts))}_chunkA5EIY3HIcjs.a.call(void 0, Ha,"preflightResolvedChange");function Hc(e,t,n){let r=Mc(Nt({..._nullishCoalesce(e.baseAnalysisInputs, () => ({})),contract:e.contract,facts:t}),e.changeMap!==void 0),a=Nt({..._nullishCoalesce(e.candidateAnalysisInputs, () => ({})),contract:e.contract,facts:n}),s=new Map(t.files.map(g=>[g.path,g])),o=new Map(n.files.map(g=>[g.path,g])),c=Fc(t,n),l=new Map,p=[];for(let g of e.changes){let b=ds(g.path);if(!b){c.push({ruleId:"INVALID_CHANGE_PATH",file:"<change-set>",line:1,message:"Every change requires a canonical project-relative path."});continue}if(l.has(b)){c.push({ruleId:"DUPLICATE_CHANGE_PATH",file:b,line:1,message:`The atomic change set contains more than one operation for ${b}.`});continue}l.set(b,g);let x=s.get(b),k=o.get(b);if("delete"in g&&g.delete)x||c.push({ruleId:"DELETE_TARGET_MISSING",file:b,line:1,message:`Cannot delete ${b} because it is not present in the supplied base facts.`}),k&&c.push({ruleId:"CANDIDATE_DELETE_NOT_APPLIED",file:b,line:1,message:`Candidate facts still contain deleted file ${b}.`});else{let E="content"in g?g.content:"",C=X(E);k?k.contentHash!==C&&c.push({ruleId:"CANDIDATE_CONTENT_HASH_MISMATCH",file:b,line:1,expectedContentHash:C,candidateContentHash:k.contentHash,message:`Candidate facts for ${b} do not match the declared content.`}):c.push({ruleId:"CANDIDATE_CHANGE_MISSING",file:b,line:1,message:`Candidate facts do not contain changed file ${b}.`})}p.push($c(g,b,s,o))}e.changes.length===0&&c.push({ruleId:"CHANGE_SET_EMPTY",file:"<change-set>",line:1,message:"Atomic preflight requires at least one create, update, or delete."});for(let g of new Set([...s.keys(),...o.keys()])){if(l.has(g))continue;let b=s.get(g),x=o.get(g);b&&x&&z(b)===z(x)||c.push({ruleId:"UNDECLARED_CANDIDATE_CHANGE",file:g,line:1,message:`Candidate facts change ${g}, but the atomic change set does not declare it.`})}let f=e.changeMap?Ke({changeMap:e.changeMap,changes:p,baseDependencies:He(r.ir.edges),candidateDependencies:He(a.ir.edges)}):void 0,h=Ma(r.ir.violations,a.ir.violations),u=Ma(r.ir.warnings,a.ir.warnings),A=[...c,...h].map(g=>({...g,nextAction:ie(g)})),d=A.filter(g=>g.failsStrict!==!1);return{schemaVersion:"1.0",mode:"resolved-candidate-facts",valid:r.completeness==="complete"&&a.completeness==="complete"&&u.every(g=>g.failsStrict===!1)&&d.length===0&&(_nullishCoalesce(_optionalChain([f, 'optionalAccess', _212 => _212.structurallyConverged]), () => (!0))),readOnly:!0,policyHash:e.contract.policyHash,resolverIdentity:n.resolverIdentity,compilerIdentity:n.compilerIdentity,compilerOptionsHash:n.compilerOptionsHash,tsconfigHash:n.tsconfigHash,baseCompilerOptionsHash:t.compilerOptionsHash,candidateCompilerOptionsHash:n.compilerOptionsHash,baseTsconfigHash:t.tsconfigHash,candidateTsconfigHash:n.tsconfigHash,evidenceRequirementsHash:n.evidenceRequirementsHash,baseFactsHash:t.factsHash,candidateFactsHash:n.factsHash,baseTreeHash:t.candidateTreeHash,candidateTreeHash:n.candidateTreeHash,baseCompleteness:r.completeness,candidateCompleteness:a.completeness,baseCompletenessReasons:r.completenessReasons,candidateCompletenessReasons:a.completenessReasons,...e.changeMap?{changeMapHash:e.changeMap.hash}:{},...f?{convergence:f}:{},changes:p.sort((g,b)=>g.path<b.path?-1:g.path>b.path?1:0),violations:A,warnings:u}}_chunkA5EIY3HIcjs.a.call(void 0, Hc,"preflightCanonicalChange");var Kc="1.1";var Vc="1.0";function Ka(e){return{events(t){return e.eventBus.getHistory().map(n=>n.event).filter(n=>!t||n.intent===t)},traces(t){return e.eventBus.getTrace().filter(n=>!t||n.type===t)},audit(t){return e.auditTrail.query(t)},outbox(t){return e.outbox.list(t)},observability(){return e.syncGraph(),e.observability.report()},async snapshot(){return{events:this.events(),traces:this.traces(),audit:await this.audit(),outbox:await this.outbox(),observability:this.observability()}},async clear(){e.eventBus.clearHistory(),e.eventBus.clearTrace(),await e.auditTrail.clear(),await e.outbox.clear()}}}_chunkA5EIY3HIcjs.a.call(void 0, Ka,"createArkTestHarness");function Va(e,t={}){return{name:e,ownerLayer:t.ownerLayer,intent:t.intent,allowedAdapters:t.allowedAdapters?[...t.allowedAdapters]:void 0}}_chunkA5EIY3HIcjs.a.call(void 0, Va,"definePort");function Ua(e,t,n,r={}){let a=Array.isArray(n)?{...r,requiredKeys:n}:{..._nullishCoalesce(n, () => ({}))},s=a.requiredKeys;if(s&&s.length>0){let l=s.filter(p=>!ja(t,p));if(l.length>0)throw new Error(`Adapter for port "${e.name}" is missing required members: ${l.join(", ")}`)}let o={name:a.name,layer:a.layer,intent:a.intent,port:e,impl:t},c=wn(o);if(!c.ok)throw new Error(c.issues.map(l=>l.message).join(`
|
|
15
|
+
`));return o}_chunkA5EIY3HIcjs.a.call(void 0, Ua,"createAdapter");function Ga(e,t=[]){let n=t.filter(r=>!ja(e,r));return n.length===0?{ok:!0}:{ok:!1,missing:n}}_chunkA5EIY3HIcjs.a.call(void 0, Ga,"checkContract");function wn(e){let t=_nullishCoalesce(e.port.allowedAdapters, () => ([]));return t.length===0?{ok:!0,issues:[]}:[e.name,e.intent].filter(a=>typeof a=="string"&&a.length>0).some(a=>t.includes(a))?{ok:!0,issues:[]}:{ok:!1,issues:[{ruleId:"ADAPTER_NOT_ALLOWED_FOR_PORT",port:e.port.name,adapter:_nullishCoalesce(e.name, () => (e.intent)),message:`Adapter "${_nullishCoalesce(_nullishCoalesce(e.name, () => (e.intent)), () => ("unknown"))}" is not allowed for port "${e.port.name}".`}]}}_chunkA5EIY3HIcjs.a.call(void 0, wn,"checkAdapterGovernance");function ja(e,t){return e!=null&&(typeof e=="object"||typeof e=="function")&&t in e}_chunkA5EIY3HIcjs.a.call(void 0, ja,"hasMember");function Ba(e){return Object.keys(e).sort()}_chunkA5EIY3HIcjs.a.call(void 0, Ba,"sortedKeys");function Tn(e,t,n,r){if(e===t)return;if(e===null||t===null||typeof e!=typeof t){r.push({path:n,left:e,right:t});return}if(typeof e!="object"||typeof t!="object"){e!==t&&r.push({path:n,left:e,right:t});return}if(Array.isArray(e)||Array.isArray(t)){let c=Array.isArray(e)?e:[],l=Array.isArray(t)?t:[],p=Math.max(c.length,l.length);for(let f=0;f<p;f+=1)Tn(c[f],l[f],`${n}[${f}]`,r);return}let a=e,s=t,o=new Set([...Ba(a),...Ba(s)]);for(let c of[...o].sort())Tn(a[c],s[c],n?`${n}.${c}`:c,r)}_chunkA5EIY3HIcjs.a.call(void 0, Tn,"walk");function za(e){return{schemaVersion:e.schemaVersion,kernelInstanceId:e.kernelInstanceId,components:e.components.map(t=>({id:t.id,lifetime:t.lifetime,uses:[...t.uses],reactsTo:[...t.reactsTo],raises:[...t.raises],sends:[...t.sends],...t.extendedInfo?{extendedInfo:{...t.extendedInfo}}:{}})),...e.decisionTape?{decisionTape:e.decisionTape.map(t=>({xiHash:t.xiHash,event:{kind:t.event.kind,...t.event.payload?{payload:{...t.event.payload}}:{}},residual:{...t.residual}}))}:{}}}_chunkA5EIY3HIcjs.a.call(void 0, za,"shadowInformationPackage");function Nn(e,t){let n=[];return Tn(e,t,"",n),{equal:n.length===0,diffs:n}}_chunkA5EIY3HIcjs.a.call(void 0, Nn,"compareInformationPackages");function Wa(e){let t=[];for(let n=1;n<e.length;n+=1)t.push(Nn(e[n-1],e[n]));return t}_chunkA5EIY3HIcjs.a.call(void 0, Wa,"replayInformationPackages");exports.ANALYSIS_IR_SCHEMA_VERSION = cn; exports.ARK_ANALYSIS_RESULT_SCHEMA = Zr; exports.ARK_ANALYSIS_RESULT_SCHEMA_VERSION = mt; exports.ARK_DESIGN_DELTA_SCHEMA_VERSION = Vc; exports.ARK_ENFORCEMENT_STATE_SCHEMA_VERSION = Kc; exports.ARK_RUN_COMPONENT_LIFETIMES = _chunkA5EIY3HIcjs.d; exports.ARK_RUN_EPHEMERAL_DEFAULT = _chunkA5EIY3HIcjs.t; exports.ARK_RUN_GRAPH_DEFAULT_SLICE = _chunkA5EIY3HIcjs.i; exports.ARK_RUN_GRAPH_NODE_KINDS = _chunkA5EIY3HIcjs.k; exports.ARK_RUN_GRAPH_PROCESS_EDGE_KINDS = _chunkA5EIY3HIcjs.l; exports.ARK_RUN_GRAPH_SCHEMA_VERSION = _chunkA5EIY3HIcjs.h; exports.ARK_RUN_GRAPH_SLICES = _chunkA5EIY3HIcjs.j; exports.ARK_RUN_GRAPH_TECHNICAL_EDGE_KINDS = _chunkA5EIY3HIcjs.m; exports.ARK_RUN_INFORMATION_PACKAGE_SCHEMA_VERSION = _chunkA5EIY3HIcjs.c; exports.ARK_RUN_INSPECTOR_DEFAULT_HOST = _chunkA5EIY3HIcjs.z; exports.ARK_RUN_INSPECTOR_DEFAULT_PORT = _chunkA5EIY3HIcjs.A; exports.ARK_RUN_INSPECTOR_EVENTS_PATH = _chunkA5EIY3HIcjs.C; exports.ARK_RUN_INSPECTOR_GRAPH_PATH = _chunkA5EIY3HIcjs.D; exports.ARK_RUN_INSPECTOR_MONITOR_SAMPLE_LIMIT = _chunkA5EIY3HIcjs.I; exports.ARK_RUN_INSPECTOR_OUTBOX_PATH = _chunkA5EIY3HIcjs.E; exports.ARK_RUN_INSPECTOR_SCHEMA_VERSION = _chunkA5EIY3HIcjs.y; exports.ARK_RUN_INSPECTOR_SNAPSHOT_PATH = _chunkA5EIY3HIcjs.B; exports.ARK_RUN_INSPECTOR_SSE_EVENT = _chunkA5EIY3HIcjs.G; exports.ARK_RUN_INSPECTOR_TRANSPORT_FALLBACK = _chunkA5EIY3HIcjs.H; exports.ARK_RUN_INSPECTOR_WORKFLOWS_PATH = _chunkA5EIY3HIcjs.F; exports.ARK_RUN_TRANSPORT_KINDS = _chunkA5EIY3HIcjs.s; exports.ArkKernelConfigError = _chunkUN5EH4QVcjs.aa; exports.ArkRunInspectorBindError = _chunkA5EIY3HIcjs.K; exports.ArkRunInspectorProductionError = _chunkA5EIY3HIcjs.J; exports.DEFAULT_MAX_HISTORY_SIZE = _chunkUN5EH4QVcjs.ua; exports.DIAGNOSTIC_CATALOG = ft; exports.DIAGNOSTIC_CATALOG_SCHEMA_VERSION = Ko; exports.DIAGNOSTIC_DOCS_RELATIVE_PATH = Kt; exports.DIAGNOSTIC_RULE_IDS = Vo; exports.EventContractRegistryImpl = _chunkUN5EH4QVcjs.ca; exports.EventContractViolationError = _chunkUN5EH4QVcjs.Y; exports.InMemoryAuditStore = _chunkUN5EH4QVcjs.ha; exports.InMemoryEventBuffer = _chunkUN5EH4QVcjs.ea; exports.InMemoryOutboxStore = _chunkUN5EH4QVcjs.fa; exports.InMemoryReadModelStore = _chunkUN5EH4QVcjs.ma; exports.InMemoryWorkflowStore = _chunkUN5EH4QVcjs.qa; exports.IntentRegistry = _chunkUN5EH4QVcjs.H; exports.InvalidArkRunGraphQueryError = _chunkA5EIY3HIcjs.n; exports.InvalidArkRunSendOptionError = _chunkA5EIY3HIcjs.u; exports.InvalidIntentNameError = _chunkUN5EH4QVcjs.W; exports.LayerPolicyContextError = _chunkUN5EH4QVcjs.X; exports.MANIFEST_SCHEMA_VERSION = _chunkUN5EH4QVcjs.oa; exports.ObservedLayerFlowViolationError = _chunkUN5EH4QVcjs.$; exports.POLICY_DELTA_SCHEMA_VERSION = bn; exports.PolicyEngine = _chunkUN5EH4QVcjs.N; exports.PolicyViolationError = _chunkUN5EH4QVcjs.M; exports.RESOLVED_CANDIDATE_FACTS_SCHEMA = ln; exports.RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION = Se; exports.SourceMetadataOverrideError = _chunkUN5EH4QVcjs._; exports.UnknownEventSourceError = _chunkUN5EH4QVcjs.Z; exports.UnregisteredIntentError = _chunkUN5EH4QVcjs.V; exports.analyzeArchitectureConvergence = Ke; exports.analyzeChange = St; exports.analyzePolicyDelta = Ws; exports.analyzeProject = rt; exports.analyzeResolvedProject = La; exports.appendDecisionTape = _chunkA5EIY3HIcjs.g; exports.architecturalPolicies = _chunkUN5EH4QVcjs.R; exports.arkRunGraphQueryFromSearchParams = _chunkA5EIY3HIcjs.p; exports.arkRunInspectorUrl = _chunkA5EIY3HIcjs.O; exports.buildArkRunInspectorHardening = _chunkA5EIY3HIcjs.Q; exports.buildArkRunInspectorOutboxMonitor = _chunkA5EIY3HIcjs.R; exports.buildArkRunInspectorSnapshot = _chunkA5EIY3HIcjs.V; exports.buildArkRunInspectorWorkflowsMonitor = _chunkA5EIY3HIcjs.T; exports.buildDependencyInformationPackage = _chunkA5EIY3HIcjs.f; exports.buildPublishPolicyContext = _chunkUN5EH4QVcjs.T; exports.catalogFixForRuleId = zo; exports.catalogWhyForRuleId = Wo; exports.checkAdapterGovernance = wn; exports.checkContract = Ga; exports.classifyArkPolicyDelta = In; exports.classifyArkRunInspectorStoreDurability = _chunkA5EIY3HIcjs.P; exports.closeArkRunGraphQuery = _chunkA5EIY3HIcjs.o; exports.closedArkRunEphemeral = _chunkA5EIY3HIcjs.w; exports.closedArkRunTransportKind = _chunkA5EIY3HIcjs.v; exports.collectAnalysisConfigWarnings = Tt; exports.collectForbiddenCapabilityUses = Fe; exports.compareInformationPackages = Nn; exports.createAICodeGate = os; exports.createAdapter = Ua; exports.createAdapterResult = ii; exports.createArchitectureProfile = _chunkUN5EH4QVcjs.j; exports.createArchitectureProfileFromArkConfig = _chunkUN5EH4QVcjs.k; exports.createArkKernel = _chunkUN5EH4QVcjs.va; exports.createArkKernelFromConfig = _chunkUN5EH4QVcjs.xa; exports.createArkManifest = _chunkUN5EH4QVcjs.pa; exports.createArkTestHarness = Ka; exports.createAuditTrail = _chunkUN5EH4QVcjs.ia; exports.createDependencyGraph = _chunkUN5EH4QVcjs.ja; exports.createElevenLayerArkConfig = _chunkUN5EH4QVcjs.m; exports.createEventBus = _chunkUN5EH4QVcjs.ba; exports.createEventContractRegistry = _chunkUN5EH4QVcjs.da; exports.createIntentRegistry = _chunkUN5EH4QVcjs.J; exports.createLenientArkKernel = _chunkUN5EH4QVcjs.Aa; exports.createLenientArkKernelFromConfig = _chunkUN5EH4QVcjs.za; exports.createMetadataRegistry = _chunkUN5EH4QVcjs.la; exports.createObservabilityReporter = _chunkUN5EH4QVcjs.ga; exports.createProjectionRegistry = _chunkUN5EH4QVcjs.na; exports.createResolvedCandidateFacts = on; exports.createSaga = _chunkUN5EH4QVcjs.sa; exports.createStrictArkKernel = _chunkUN5EH4QVcjs.wa; exports.createStrictArkKernelFromConfig = _chunkUN5EH4QVcjs.ya; exports.createWorkflowEngine = _chunkUN5EH4QVcjs.ra; exports.defaultIntentRegistry = _chunkUN5EH4QVcjs.K; exports.defineArchitectureProfilePolicy = _chunkUN5EH4QVcjs.S; exports.defineIntent = _chunkUN5EH4QVcjs.I; exports.defineLayerPolicy = _chunkUN5EH4QVcjs.P; exports.definePolicy = _chunkUN5EH4QVcjs.O; exports.definePort = Va; exports.definePublishPolicy = _chunkUN5EH4QVcjs.U; exports.detectArchitectureCycles = Cn; exports.deterministicHash = X; exports.diagnosticDocsFragment = Yr; exports.diagnosticDocsPath = jo; exports.elevenLayerProfile = _chunkUN5EH4QVcjs.l; exports.evaluateArchitectureGraph = Ge; exports.explainViolation = qs; exports.extractSemanticDependencies = De; exports.formatArkRunGraphMermaid = _chunkA5EIY3HIcjs.q; exports.formatArkRunInspectorSseEvent = _chunkA5EIY3HIcjs.W; exports.getDiagnosticCatalogEntry = gt; exports.isArkRunInspectorLoopbackHost = _chunkA5EIY3HIcjs.M; exports.isArkRunInspectorProductionEnv = _chunkA5EIY3HIcjs.L; exports.isCataloguedOrArkRuleFamily = Go; exports.isKnownDiagnosticCode = Uo; exports.isLayerPolicy = _chunkUN5EH4QVcjs.Q; exports.loadContract = Et; exports.loadResolvedCandidateFacts = ye; exports.policyDeltaAcknowledgementMatches = En; exports.preflightChange = Fa; exports.preflightResolvedChange = Ha; exports.replayInformationPackages = Wa; exports.requestArkRunGraph = _chunkA5EIY3HIcjs.r; exports.resolveArkRunInspectorBind = _chunkA5EIY3HIcjs.N; exports.resolveArkRunSendPlan = _chunkA5EIY3HIcjs.x; exports.resolvedFactsEvidenceRequirementsHash = Ze; exports.serializeDiagnosticCatalog = Bo; exports.shadowInformationPackage = za; exports.stableSerialize = z; exports.startArkRunInspector = _chunkUN5EH4QVcjs.ta; exports.syncRegistryToGraph = _chunkUN5EH4QVcjs.ka; exports.toAdapterDiagnostic = Bt; exports.unavailableArkRunInspectorOutboxMonitor = _chunkA5EIY3HIcjs.S; exports.unavailableArkRunInspectorWorkflowsMonitor = _chunkA5EIY3HIcjs.U; exports.validateIntentName = _chunkUN5EH4QVcjs.L; exports.version = _chunkUN5EH4QVcjs.a;
|