arkgate 4.8.22 → 4.8.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/README.md +7 -5
  3. package/bin/ark-check-runtime.mjs +27 -78
  4. package/bin/ark-dashboard.mjs +56 -53
  5. package/bin/ark-layer-match.mjs +1117 -38
  6. package/bin/ark-mcp-runtime.mjs +412 -138
  7. package/bin/ark-mcp.mjs +68 -4
  8. package/bin/ark-shared.mjs +39 -0
  9. package/bin/ark.mjs +65 -97
  10. package/bin/lib/adapter-contract-types.mjs +5 -0
  11. package/bin/lib/adapter-contract.mjs +15 -0
  12. package/bin/lib/agent-projection-command.mjs +5 -1
  13. package/bin/lib/analysis-engine.mjs +15 -11
  14. package/bin/lib/architecture-scan.mjs +50 -6
  15. package/bin/lib/ark-order-doctor.mjs +1 -1
  16. package/bin/lib/ark-order-facts.mjs +410 -15
  17. package/bin/lib/ark-order-invariants.mjs +51 -9
  18. package/bin/lib/ark-order-sensors.mjs +28 -101
  19. package/bin/lib/ark-order-types.mjs +2 -0
  20. package/bin/lib/ark-run-doctor.mjs +14 -0
  21. package/bin/lib/ark-run-facts.mjs +434 -11
  22. package/bin/lib/ark-run-sensors.mjs +5 -3
  23. package/bin/lib/arkgate-pins.mjs +91 -0
  24. package/bin/lib/arkrules-sensors.mjs +50 -249
  25. package/bin/lib/check-args.mjs +23 -1
  26. package/bin/lib/ci-and-commands.mjs +16 -6
  27. package/bin/lib/class-source-scan.mjs +479 -0
  28. package/bin/lib/codex-home.mjs +4 -2
  29. package/bin/lib/config-contract-slices.mjs +701 -0
  30. package/bin/lib/config-contract.mjs +5 -2
  31. package/bin/lib/config-warnings.mjs +32 -0
  32. package/bin/lib/dashboard-cli.mjs +62 -0
  33. package/bin/lib/design-delta.mjs +1 -1
  34. package/bin/lib/diagnostic-catalog.mjs +45 -6
  35. package/bin/lib/doctor-advisories.mjs +84 -1
  36. package/bin/lib/doctor-next-actions.mjs +17 -2
  37. package/bin/lib/doctor-plan.mjs +7 -9
  38. package/bin/lib/effective-contract-load.mjs +121 -59
  39. package/bin/lib/enforcement-honesty.mjs +22 -0
  40. package/bin/lib/enforcement-profiles.mjs +40 -4
  41. package/bin/lib/first-run-help.mjs +3 -2
  42. package/bin/lib/flat-parent-importers.mjs +137 -0
  43. package/bin/lib/flat-parent-pilot.mjs +192 -0
  44. package/bin/lib/gate-files.mjs +29 -2
  45. package/bin/lib/git-change-scope.mjs +109 -0
  46. package/bin/lib/github-enforcement.mjs +1 -1
  47. package/bin/lib/hook-templates.mjs +18 -16
  48. package/bin/lib/host-support-matrix.mjs +3 -1
  49. package/bin/lib/html-report-advisories.mjs +2 -0
  50. package/bin/lib/html-report-depth.mjs +3 -1
  51. package/bin/lib/import-resolve.mjs +13 -1
  52. package/bin/lib/install-migrate.mjs +50 -73
  53. package/bin/lib/invariant-coverage.mjs +59 -11
  54. package/bin/lib/mcp-adoption.mjs +9 -1
  55. package/bin/lib/mcp-hook-payload.mjs +401 -61
  56. package/bin/lib/package-manager.mjs +59 -1
  57. package/bin/lib/passthrough-commands.mjs +83 -0
  58. package/bin/lib/persistence-write-hint.mjs +81 -0
  59. package/bin/lib/physical-cohesion.mjs +16 -18
  60. package/bin/lib/pilot-loop.mjs +21 -8
  61. package/bin/lib/pin-dependent-gates.mjs +117 -0
  62. package/bin/lib/policy-delta-io.mjs +168 -10
  63. package/bin/lib/prepare-change.mjs +120 -6
  64. package/bin/lib/prepare-write.mjs +1 -0
  65. package/bin/lib/presets.mjs +3 -5
  66. package/bin/lib/remediation.mjs +23 -4
  67. package/bin/lib/resolved-candidate-facts.mjs +315 -55
  68. package/bin/lib/rules-inventory.mjs +22 -3
  69. package/bin/lib/rules-under-contract.mjs +179 -5
  70. package/bin/lib/scan-files.mjs +32 -0
  71. package/bin/lib/snippet-analysis.mjs +140 -6
  72. package/bin/lib/source-policy.mjs +34 -0
  73. package/bin/lib/stable-hash.mjs +90 -0
  74. package/bin/lib/start-install-recovery.mjs +71 -1
  75. package/bin/lib/start-preview.mjs +30 -0
  76. package/bin/lib/status-command.mjs +33 -4
  77. package/bin/lib/status-manifest.mjs +32 -4
  78. package/bin/lib/team-parliament-io.mjs +79 -75
  79. package/bin/lib/team-parliament.mjs +6 -1
  80. package/bin/lib/write-path-capabilities.mjs +4 -2
  81. package/dist/chunk-A5EIY3HI.cjs +5 -0
  82. package/dist/chunk-MBXCFLO4.js +16 -0
  83. package/dist/chunk-RNQHRDCQ.cjs +16 -0
  84. package/dist/chunk-SVSQVGFJ.js +5 -0
  85. package/dist/{configTypes-CTELo87-.d.ts → configTypes-BJbaeoj4.d.cts} +53 -4
  86. package/dist/configTypes-BJbaeoj4.d.ts +246 -0
  87. package/dist/eslint/index.cjs +17 -4
  88. package/dist/eslint/index.d.cts +359 -0
  89. package/dist/eslint/index.d.ts +178 -158
  90. package/dist/eslint/index.js +10 -4
  91. package/dist/index.cjs +38 -37
  92. package/dist/index.d.cts +5475 -0
  93. package/dist/index.d.ts +3408 -296
  94. package/dist/index.js +38 -37
  95. package/dist/inspectorListen-6DQVJ4DC.js +1 -0
  96. package/dist/inspectorListen-KGMIQ2TF.cjs +1 -0
  97. package/dist/nestjs/index.cjs +1 -18
  98. package/dist/nestjs/index.d.cts +22 -0
  99. package/dist/nestjs/index.d.ts +1 -3
  100. package/dist/nestjs/index.js +1 -18
  101. package/dist/order/index.cjs +1 -1
  102. package/dist/order/index.d.cts +155 -0
  103. package/dist/order/index.d.ts +15 -3
  104. package/dist/order/index.js +1 -1
  105. package/dist/runtime/index.cjs +13 -30
  106. package/dist/{diagnosticCatalog-WD2TPSwZ.d.ts → runtime/index.d.cts} +814 -290
  107. package/dist/runtime/index.d.ts +2678 -108
  108. package/dist/runtime/index.js +13 -30
  109. package/dist/{types-yDNEQ603.d.ts → types-DRinG-vT.d.cts} +576 -140
  110. package/dist/types-DRinG-vT.d.ts +1792 -0
  111. package/docs/README.md +3 -1
  112. package/docs/agent-guide.md +92 -15
  113. package/docs/ai-gates.md +160 -26
  114. package/docs/arkorder.md +32 -15
  115. package/docs/brownfield-adoption.md +5 -1
  116. package/docs/configuration.md +273 -12
  117. package/docs/develop.md +2 -1
  118. package/docs/diagnostics.md +122 -13
  119. package/docs/package-surface.md +31 -8
  120. package/docs/product-voice.md +1 -1
  121. package/package.json +59 -18
  122. package/schemas/ark.analysis-result.schema.json +15 -0
  123. package/schemas/ark.config.schema.json +163 -4
  124. package/schemas/ark.resolved-candidate-facts.schema.json +1 -1
  125. package/schemas/ark.status-manifest.schema.json +22 -0
  126. package/server.json +3 -9
  127. package/templates/agent-skills/README.md +1 -1
  128. package/templates/agent-skills/ark-adopt/SKILL.md +4 -1
  129. package/templates/agent-skills/ark-order/SKILL.md +4 -2
  130. package/templates/agent-skills/ark-runtime/SKILL.md +6 -1
  131. package/templates/arkrules/PersistenceAdapters.json +1 -1
  132. package/templates/arkrules/PresentationAdapters.json +1 -1
  133. package/templates/skills/ark-adopt.md +4 -1
  134. package/templates/skills/ark-order.md +4 -2
  135. package/templates/skills/ark-runtime.md +6 -1
  136. package/dist/types-fQ9-KrBj.d.ts +0 -183
package/dist/index.d.ts CHANGED
@@ -1,26 +1,4 @@
1
- import { A as AdapterViolationInput, a as ArkRulesFile, E as EffectiveArkRules, R as ResolvedArkRunKernelCallKind, b as ResolvedArkRunDeclarationFact, c as ResolvedArkRunKernelCallFact, d as ResolvedArkRunManagedNewFact, e as ResolvedDependencyFact, f as ResolvedArkRunCompositionRootHitFact, g as ResolvedFactsReason, h as ResolvedArkOrderPlaneCallFact, i as ResolvedArkOrderGenericUpdateFact, j as ResolvedArkOrderRootHitFact, k as ResolvedArkOrderXiFieldWriteFact, l as ResolvedArkOrderIngestWriteFact } from './diagnosticCatalog-WD2TPSwZ.js';
2
- export { m as ADAPTER_DIAGNOSTIC_DOCS_RELATIVE_PATH, n as AICodeGate, o as AICodeGateContext, p as AICodeGateOptions, q as AICodeGateResult, r as AICodeGateViolation, s as AIGateExtension, t as ANALYSIS_IR_SCHEMA_VERSION, u as ARK_ANALYSIS_RESULT_SCHEMA, v as ARK_ANALYSIS_RESULT_SCHEMA_VERSION, w as ARK_DESIGN_DELTA_SCHEMA_VERSION, x as ARK_ENFORCEMENT_STATE_SCHEMA_VERSION, y as AdapterCompletenessReason, z as AdapterDiagnostic, B as AdapterResult, C as AdapterSeverity, D as AnalysisCapabilityUse, F as AnalysisCompilerOptions, G as AnalysisCompleteness, H as AnalysisContract, I as AnalysisEvidence, J as AnalysisFile, K as AnalysisFileChange, L as AnalysisFileInput, M as AnalysisImportEdge, N as AnalysisIr, O as AnalysisMode, P as AnalysisResult, Q as AnalysisViolation, S as AnalyzeArchitectureConvergenceInput, T as AnalyzeChangeInput, U as AnalyzePolicyDeltaInput, V as AnalyzeProjectInput, W as AnalyzeResolvedProjectInput, X as ArchitectureActualChange, Y as ArchitectureChangeMap, Z as ArchitectureChangeMapContract, _ as ArchitectureChangeMapDependency, $ as ArchitectureChangeMapFile, a0 as ArchitectureChangeOperation, a1 as ArchitectureConvergenceClassification, a2 as ArchitectureConvergenceFinding, a3 as ArchitectureConvergenceResult, a4 as ArchitectureDependency, a5 as ArchitectureEngineEdge, a6 as ArchitectureEngineResult, a7 as ArchitectureEngineViolation, a8 as ArkDesignDeltaResult, a9 as ArkEnforcementHost, aa as ArkEnforcementState, ab as ArkRuleSensorViolation, ac as ChangePreflightResult, ad as ClassShapeFact, ae as CollectAnalysisConfigWarningsInput, af as CoverageEvidence, ag as CoverageFiles, ah as CoverageInvariant, ai as DIAGNOSTIC_CATALOG, aj as DIAGNOSTIC_CATALOG_SCHEMA_VERSION, ak as DIAGNOSTIC_DOCS_RELATIVE_PATH, al as DIAGNOSTIC_RULE_IDS, am as DeclarationShape, an as DesignDeltaChange, ao as DesignDeltaEnforcementScope, ap as DesignDeltaIdentity, aq as DesignSmellEvidence, ar as DesignSmellFinding, as as DesignSmellId, at as DiagnosticCatalogEntry, au as DiagnosticCategory, av as EnforcementBoundaryState, aw as EnforcementEvidence, ax as EnforcementEvidenceField, ay as EnforcementVerification, az as EvaluateArchitectureGraphInput, aA as ForbiddenCapabilityUse, aB as InvariantCoverageEvidence, aC as MentionContext, aD as POLICY_DELTA_SCHEMA_VERSION, aE as PolicyDelta, aF as PolicyDeltaAcknowledgement, aG as PolicyDeltaAnalysis, aH as PolicyDeltaClassification, aI as PolicyDeltaFinding, aJ as PreflightResolvedChangeInput, aK as PreparedChangeFile, aL as RESOLVED_CANDIDATE_FACTS_SCHEMA, aM as RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION, aN as ResolvedAmbientFact, aO as ResolvedAnalysisFile, aP as ResolvedAnalysisIr, aQ as ResolvedAnalysisResult, aR as ResolvedCandidateFacts, aS as ResolvedCandidateFactsInput, aT as ResolvedCapability, aU as ResolvedCapabilityFact, aV as ResolvedChangePreflightResult, aW as ResolvedDependencyKind, aX as ResolvedDependencyState, aY as ResolvedFactsCompleteness, aZ as ResolvedFileFact, a_ as ResolvedIntentReferenceFact, a$ as ResolvedPublishFact, b0 as ResolvedSafetyFact, b1 as ResolvedSafetyKind, b2 as ResolvedSafetyReport, b3 as SemanticDependency, b4 as SemanticDependencyKind, b5 as analyzeArchitectureConvergence, b6 as analyzeChange, b7 as analyzePolicyDelta, b8 as analyzeProject, b9 as analyzeResolvedProject, ba as buildArkRuleFileHints, bb as canPromoteInvariant, bc as catalogFixForRuleId, bd as catalogWhyForRuleId, be as classifyArkPolicyDelta, bf as classifyCoverage, bg as collectAnalysisConfigWarnings, bh as collectEmptyAppliesToFindings, bi as collectForbiddenCapabilityUses, bj as countsAsCoverage, bk as createAICodeGate, bl as createAdapterResult, bm as createArchitectureProfile, bn as createArchitectureProfileFromArkConfig, bo as createElevenLayerArkConfig, bp as createResolvedCandidateFacts, bq as deriveArkRuleFileHints, br as describeCoverage, bs as detectArchitectureCycles, bt as deterministicHash, bu as diagnosticDocsFragment, bv as diagnosticDocsPath, bw as elevenLayerProfile, bx as evaluateArchitectureGraph, by as evaluateArkRuleSensors, bz as evaluateInvariantCoverage, bA as explainViolation, bB as extractClassShapesFromSource, bC as extractSemanticDependencies, bD as getDiagnosticCatalogEntry, bE as isCataloguedOrArkRuleFamily, bF as isKnownDiagnosticCode, bG as loadContract, bH as loadResolvedCandidateFacts, bI as policyDeltaAcknowledgementMatches, bJ as preflightChange, bK as preflightResolvedChange, bL as resolvedFactsEvidenceRequirementsHash, bM as serializeDiagnosticCatalog, bN as stableSerialize, bO as toAdapterDiagnostic, bP as version } from './diagnosticCatalog-WD2TPSwZ.js';
3
- export { A as ArchitectureLayer, a as ArchitectureLayerConfig, b as ArchitectureProfile, c as ArchitectureRule, d as ArkCheckConfig, C as CreateArchitectureProfileFromArkConfigOptions, e as CreateArchitectureProfileOptions, f as CreateElevenLayerArkConfigOptions } from './types-fQ9-KrBj.js';
4
- import { a as ArkConfigRule, b as ArkConfigSchemaVersion, c as ArkConfigLoadResult, A as ArkConfig, d as ArkConfigIssue, e as ArkConfigArkRun, f as ArkConfigLayer, g as ArkConfigArkOrder } from './configTypes-CTELo87-.js';
5
-
6
- /**
7
- * Baseline-compatible target key for a violation input.
8
- * Field order and empty-string fallbacks **must** match `baselineKey` in
9
- * `baselineKey.ts` — parity tests guard this so finding refs never orphan freezes.
10
- *
11
- * Note: uses raw ruleId/file strings (including empty) the same way baseline does;
12
- * display `ruleId` / `location.file` may still normalize to ARK_UNKNOWN / `<unknown>`.
13
- */
14
- declare function adapterFindingTargetKey(violation: AdapterViolationInput): string;
15
- /**
16
- * Occurrence-aware target keys for a violation list (parity with baselineOccurrenceKeys).
17
- * First occurrence keeps the historical base key; duplicates get `#N`.
18
- */
19
- declare function adapterFindingOccurrenceTargetKeys(violations: readonly AdapterViolationInput[]): string[];
20
- /** FNV-1a finding ref from a baseline-compatible targetKey (not a security hash). */
21
- declare function adapterFindingRefFromTargetKey(targetKey: string): string;
22
- /** Package-relative docs path with fragment for a public ruleId. */
23
- declare function adapterDocsCodePath(ruleId: string): string;
1
+ import { a as ArkConfigRule, b as ArkConfigSchemaVersion, c as ArkConfigLoadResult, d as ArkConfigLayer, A as ArkConfig, e as ArkConfigIssue, f as ArkConfigArkRun, g as ArkConfigArkOrder } from './configTypes-BJbaeoj4.js';
24
2
 
25
3
  /**
26
4
  * Canonical, pure contract for ark.config.json.
@@ -287,7 +265,7 @@ declare const ARK_CONFIG_SCHEMA: {
287
265
  readonly sliceIdentity: {
288
266
  readonly type: "string";
289
267
  readonly enum: readonly ["path", "stars"];
290
- readonly description: "How a starred sliceFolders prefix is named. Absent and path keep today's ids (every literal and star binding). stars keeps the last literal plus the star bindings, so parallel trees share one feature id. Bare names are unchanged.";
268
+ readonly description: "How a starred sliceFolders prefix is named. Absent and path keep today's ids (every literal and star binding). stars keeps the last literal plus every star binding (a star before the last literal is kept too), so parallel trees share one feature id. Bare names are unchanged.";
291
269
  };
292
270
  readonly sharedRoots: {
293
271
  readonly minItems: 1;
@@ -318,8 +296,136 @@ declare const ARK_CONFIG_SCHEMA: {
318
296
  };
319
297
  };
320
298
  readonly sharedImportsSlice: {
321
- readonly type: "string";
322
- readonly enum: readonly ["deny"];
299
+ readonly description: "deny blocks every shared-root import of a slice. deny-cross-parent leaves that hop as a warning and, in ark-check and CI only, reports a slice that reaches another universe through a shared root. The write hook and ESLint see one edge and do not block it. The object form { mode: \"deny-cross-parent\", stopAt } names composition roots (bootstrap, DI registrations) the whole-graph walk never starts at or passes through; a stop file must still sit under sharedRoots, and stopAt does not silence the direct SHARED_IMPORTS_SLICE warning. arkgate 4.8.22 and older reject deny-cross-parent. arkgate 4.8.23 and older reject the object form (must be one of deny, deny-cross-parent).";
300
+ readonly oneOf: readonly [{
301
+ readonly type: "string";
302
+ readonly enum: readonly ["deny", "deny-cross-parent"];
303
+ }, {
304
+ readonly type: "object";
305
+ readonly additionalProperties: false;
306
+ readonly required: readonly ["mode", "stopAt"];
307
+ readonly properties: {
308
+ readonly mode: {
309
+ readonly type: "string";
310
+ readonly enum: readonly ["deny-cross-parent"];
311
+ };
312
+ readonly stopAt: {
313
+ readonly minItems: 1;
314
+ readonly type: "array";
315
+ readonly items: {
316
+ readonly type: "string";
317
+ readonly minLength: 1;
318
+ };
319
+ readonly uniqueItems: true;
320
+ };
321
+ };
322
+ }];
323
+ };
324
+ readonly childSlices: {
325
+ readonly type: "object";
326
+ readonly additionalProperties: false;
327
+ readonly required: readonly ["sliceFolders"];
328
+ readonly description: "Optional inner wall under this rule. Runs only on a rule with peerIsolation: true and allowed: false; elsewhere it is inert and ark-check warns CONFIG_CHILD_SLICES_INERT (config load still accepts it, as 4.8.23 did). Absent keeps today's universe wall. sliceFolders names children. Flat files are universe common, and so is a commonFolders directory directly under the universe (a folder of that name inside a child belongs to that child). siblings is \"deny\" (default), \"advisory\", or { default, enforce, ratchet }. parentMayImportChild defaults to false. message is the text for inner-wall findings. allowedCrossSlice may use a whole-segment *. It clears only a sibling crossing. Cross-parent has no advisory knob. arkgate 4.8.22 and older reject this key. A build that still rejects unknown childSlices fields rejects allowedCrossSlice at config load. A build that still types siblings as a string enum rejects the object at config load.";
329
+ readonly properties: {
330
+ readonly sliceFolders: {
331
+ readonly minItems: 1;
332
+ readonly type: "array";
333
+ readonly items: {
334
+ readonly type: "string";
335
+ readonly minLength: 1;
336
+ };
337
+ readonly uniqueItems: true;
338
+ };
339
+ readonly sliceIdentity: {
340
+ readonly type: "string";
341
+ readonly enum: readonly ["path", "stars"];
342
+ };
343
+ readonly commonFolders: {
344
+ readonly minItems: 1;
345
+ readonly type: "array";
346
+ readonly items: {
347
+ readonly type: "string";
348
+ readonly minLength: 1;
349
+ };
350
+ readonly uniqueItems: true;
351
+ };
352
+ readonly siblings: {
353
+ readonly description: "\"deny\" or \"advisory\", or { default, enforce, ratchet } so listed subtrees are errors while the default stays advisory. ratchet absent: a new advisory crossing fails only when the baseline in use already records an advisory crossing of this rule. ratchet true: any unrecorded advisory crossing fails when a baseline is in use. ratchet false: measure only, never fails. A string-enum build rejects the object at config load (must be one of deny, advisory). arkgate 4.8.23 and older reject ratchet (unknown field).";
354
+ readonly oneOf: readonly [{
355
+ readonly type: "string";
356
+ readonly enum: readonly ["deny", "advisory"];
357
+ }, {
358
+ readonly type: "object";
359
+ readonly additionalProperties: false;
360
+ readonly required: readonly ["default"];
361
+ readonly properties: {
362
+ readonly default: {
363
+ readonly type: "string";
364
+ readonly enum: readonly ["deny", "advisory"];
365
+ };
366
+ readonly enforce: {
367
+ readonly type: "array";
368
+ readonly items: {
369
+ readonly type: "string";
370
+ readonly minLength: 1;
371
+ };
372
+ readonly uniqueItems: true;
373
+ };
374
+ readonly ratchet: {
375
+ readonly type: "boolean";
376
+ };
377
+ };
378
+ }];
379
+ };
380
+ readonly parentMayImportChild: {
381
+ readonly type: "boolean";
382
+ };
383
+ readonly message: {
384
+ readonly type: "string";
385
+ readonly minLength: 1;
386
+ readonly description: "Text for inner-wall findings (CROSS_SIBLING_SLICE and universe common importing a child). The rule message stays the universe-wall text (CROSS_PARENT_SLICE and fail-closed denies). Absent: ArkGate default text, never the rule message. arkgate 4.8.23 and older reject this field (unknown field).";
387
+ };
388
+ readonly sliceAliases: {
389
+ readonly type: "array";
390
+ readonly minItems: 1;
391
+ readonly description: "Maps a source path glob onto a child slice id (universe id plus one child segment) so files outside the slice trees take that universe and child for both walls. A path without a wildcard also covers everything under it, as sharedRoots does. A bare name, a universe id alone, a target outside every universe shape, and a wildcard in to are rejected. Under stars identity a target written against the 4.8.23 stars id (star bindings before the last literal dropped, e.g. api/v1/x for modules/*/api/*) still loads when it maps to one universe shape, and ark-check warns CONFIG_SLICE_LEGACY_STARS_ID with the new id; it is rejected only when it maps to more than one shape. Config load checks only the shape; doctor reports a target universe no file belongs to. The glob may not overlap a slice folder, and two aliases may not match the same file. Doctor lists each alias as an owed move. A build that rejects unknown childSlices fields fails at config load (unknown field). arkgate 4.8.22 and older reject childSlices.";
392
+ readonly items: {
393
+ readonly type: "object";
394
+ readonly additionalProperties: false;
395
+ readonly required: readonly ["from", "to"];
396
+ readonly properties: {
397
+ readonly from: {
398
+ readonly type: "string";
399
+ readonly minLength: 1;
400
+ };
401
+ readonly to: {
402
+ readonly type: "string";
403
+ readonly minLength: 1;
404
+ };
405
+ };
406
+ };
407
+ };
408
+ readonly allowedCrossSlice: {
409
+ readonly type: "array";
410
+ readonly minItems: 1;
411
+ readonly description: "Directed child-slice allowances. * matches one whole path segment (features/projects/*). ** and a partial segment are rejected. A bare name is rejected. This list clears only CROSS_SIBLING_SLICE. It cannot clear CROSS_PARENT_SLICE or CROSS_PARENT_VIA_SHARED. The universe allowedCrossSlice still treats * as a literal. A build that rejects unknown childSlices fields fails at config load (unknown field).";
412
+ readonly items: {
413
+ readonly type: "object";
414
+ readonly additionalProperties: false;
415
+ readonly required: readonly ["from", "to"];
416
+ readonly properties: {
417
+ readonly from: {
418
+ readonly type: "string";
419
+ readonly minLength: 1;
420
+ };
421
+ readonly to: {
422
+ readonly type: "string";
423
+ readonly minLength: 1;
424
+ };
425
+ };
426
+ };
427
+ };
428
+ };
323
429
  };
324
430
  };
325
431
  };
@@ -480,325 +586,3092 @@ declare function loadArkConfigContract(input: unknown, source?: string): ArkConf
480
586
  declare function parseArkConfigJson(json: string, source?: string): ArkConfigLoadResult;
481
587
 
482
588
  /**
483
- * Canonical, pure contract for ArkGate MCP project identity.
589
+ * Type vocabulary for ArkRules files (ADR 0012).
484
590
  *
485
- * Filesystem canonicalization, hashing, clocks, and runtime ids belong to the
486
- * Tooling adapter. This module owns the stable payload and published schemas so
487
- * every MCP surface speaks the same identity/binding language.
591
+ * Pure declarations only — runtime validation and the published JSON Schema live in
592
+ * ./arkRulesContract.ts so generate:cli-pure can emit a self-contained artifact.
488
593
  */
489
- declare const ARK_PROJECT_IDENTITY_SCHEMA_VERSION: "1.0";
490
- declare const ARK_PROJECT_IDENTITY_SCHEMA_URL = "https://unpkg.com/arkgate@4/schemas/ark.project-identity.schema.json";
491
- type ProjectIdentity = {
492
- schemaVersion: typeof ARK_PROJECT_IDENTITY_SCHEMA_VERSION;
493
- projectId: string;
494
- resolvedRoot: string;
495
- resolvedConfigPath: string;
496
- arkgateVersion: string;
497
- contractHash: string;
498
- contractSource: 'project' | 'default-profile' | 'manifest';
499
- runtimeId: string;
500
- processStartedAt: string;
594
+ /** Closed sensor vocabulary (ADR 0013). Unknown sensors fail closed at load time. */
595
+ declare const ARK_RULE_SENSOR_IDS: readonly ["aggregate-private-state", "always-valid-factory", "domain-event-on-mutation", "orchestration-only", "thin-adapter", "writes-via-aggregate", "no-anemic-model", "invariant-coverage"];
596
+ type ArkRuleSensorId = (typeof ARK_RULE_SENSOR_IDS)[number];
597
+ type ArkRuleMode = 'advisory' | 'enforced';
598
+ type ArkRuleStructureEntry = {
599
+ id: string;
600
+ sensor: ArkRuleSensorId;
601
+ mode?: ArkRuleMode;
602
+ appliesTo?: string[];
603
+ description?: string;
501
604
  };
502
- type ProjectExpectation = {
503
- expectedRoot?: string;
504
- expectedProjectId?: string;
605
+ type ArkRuleInvariantCoverage = {
606
+ test?: boolean;
607
+ symbol?: string;
505
608
  };
506
- type ProjectBinding = {
507
- status: 'matched' | 'unverified' | 'mismatch';
508
- authoritative: boolean;
509
- expectedRoot?: string;
510
- expectedProjectId?: string;
511
- code?: 'PROJECT_ROOT_MISMATCH' | 'PROJECT_ID_MISMATCH' | 'INVALID_PROJECT_EXPECTATION';
512
- message?: string;
609
+ type ArkRuleInvariantEntry = {
610
+ id: string;
611
+ description: string;
612
+ aggregate?: string;
613
+ coverage?: ArkRuleInvariantCoverage;
614
+ mode?: ArkRuleMode;
615
+ appliesTo?: string[];
513
616
  };
514
- declare const PROJECT_EXPECTATION_SCHEMA: {
515
- readonly type: "object";
516
- readonly additionalProperties: false;
517
- readonly properties: {
518
- readonly expectedRoot: {
519
- readonly type: "string";
520
- readonly minLength: 1;
521
- readonly description: string;
522
- };
523
- readonly expectedProjectId: {
524
- readonly type: "string";
525
- readonly pattern: "^sha256:[a-f0-9]{64}$";
526
- readonly description: "Project id previously returned by ark_identity or ark_manifest.";
527
- };
528
- };
617
+ type ArkRulesFile = {
618
+ $schema?: string;
619
+ schemaVersion: '1.0';
620
+ layer: string;
621
+ structure?: ArkRuleStructureEntry[];
622
+ invariants?: ArkRuleInvariantEntry[];
529
623
  };
530
- declare const PROJECT_BINDING_SCHEMA: {
531
- readonly type: "object";
532
- readonly additionalProperties: false;
533
- readonly required: readonly ["status", "authoritative"];
534
- readonly properties: {
535
- readonly status: {
536
- readonly enum: readonly ["matched", "unverified", "mismatch"];
537
- };
538
- readonly authoritative: {
539
- readonly type: "boolean";
540
- };
541
- readonly expectedRoot: {
542
- readonly type: "string";
543
- readonly minLength: 1;
544
- };
545
- readonly expectedProjectId: {
546
- readonly type: "string";
547
- readonly pattern: "^sha256:[a-f0-9]{64}$";
548
- };
549
- readonly code: {
550
- readonly enum: readonly ["PROJECT_ROOT_MISMATCH", "PROJECT_ID_MISMATCH", "INVALID_PROJECT_EXPECTATION"];
551
- };
552
- readonly message: {
553
- readonly type: "string";
554
- readonly minLength: 1;
555
- };
556
- };
624
+ type ArkRuleProvenance = {
625
+ sourceFile: string;
626
+ ruleId: string;
627
+ layer: string;
557
628
  };
558
- declare const ARK_PROJECT_IDENTITY_SCHEMA: {
629
+ type EffectiveStructureRule = ArkRuleStructureEntry & {
630
+ mode: ArkRuleMode;
631
+ provenance: ArkRuleProvenance;
632
+ };
633
+ type EffectiveInvariantRule = ArkRuleInvariantEntry & {
634
+ mode: ArkRuleMode;
635
+ provenance: ArkRuleProvenance;
636
+ };
637
+ type EffectiveArkRules = {
638
+ schemaVersion: '1.0';
639
+ byLayer: Record<string, {
640
+ sourceFile: string;
641
+ structure: EffectiveStructureRule[];
642
+ invariants: EffectiveInvariantRule[];
643
+ }>;
644
+ structure: EffectiveStructureRule[];
645
+ invariants: EffectiveInvariantRule[];
646
+ };
647
+ type ArkRulesIssue = {
648
+ path: string;
649
+ message: string;
650
+ };
651
+
652
+ /**
653
+ * Canonical, pure contract for arkrules/<Layer>.json (ADR 0012).
654
+ *
655
+ * Tooling adapters own filesystem I/O; this module owns JSON parsing, validation,
656
+ * diagnostics, and the published JSON Schema. The standalone CLI artifact is generated
657
+ * into bin/lib/arkrules-contract.mjs + schemas/ark.arkrules.schema.json.
658
+ */
659
+
660
+ declare const ARK_RULES_SCHEMA_VERSION: "1.0";
661
+ /** Closed sensor vocabulary — keep in lockstep with arkRulesTypes.ARK_RULE_SENSOR_IDS. */
662
+ declare const ARK_RULE_SENSORS: readonly ["aggregate-private-state", "always-valid-factory", "domain-event-on-mutation", "orchestration-only", "thin-adapter", "writes-via-aggregate", "no-anemic-model", "invariant-coverage"];
663
+ declare const ARK_RULES_SCHEMA: {
559
664
  readonly $schema: "https://json-schema.org/draft/2020-12/schema";
560
- readonly $id: "https://unpkg.com/arkgate@4/schemas/ark.project-identity.schema.json";
561
- readonly title: "ArkGate MCP project identity";
562
- readonly description: "Stable project binding plus separate runtime and architecture-contract evidence.";
665
+ readonly $id: "https://unpkg.com/arkgate/schemas/ark.arkrules.schema.json";
666
+ readonly title: "ArkGate ArkRules (intra-layer contract)";
667
+ readonly description: "Per-layer structure sensors and invariant catalog consumed by the ArkGate Effective Contract.";
563
668
  readonly type: "object";
564
669
  readonly additionalProperties: false;
565
- readonly required: readonly ["schemaVersion", "projectId", "resolvedRoot", "resolvedConfigPath", "arkgateVersion", "contractHash", "contractSource", "runtimeId", "processStartedAt"];
670
+ readonly required: readonly ["schemaVersion", "layer"];
566
671
  readonly properties: {
567
- readonly schemaVersion: {
568
- readonly const: "1.0";
569
- };
570
- readonly projectId: {
571
- readonly type: "string";
572
- readonly pattern: "^sha256:[a-f0-9]{64}$";
573
- };
574
- readonly resolvedRoot: {
672
+ readonly $schema: {
575
673
  readonly type: "string";
576
674
  readonly minLength: 1;
675
+ readonly default: "https://unpkg.com/arkgate/schemas/ark.arkrules.schema.json";
577
676
  };
578
- readonly resolvedConfigPath: {
677
+ readonly schemaVersion: {
579
678
  readonly type: "string";
580
- readonly minLength: 1;
679
+ readonly const: "1.0";
680
+ readonly default: "1.0";
581
681
  };
582
- readonly arkgateVersion: {
682
+ readonly layer: {
583
683
  readonly type: "string";
584
684
  readonly minLength: 1;
585
685
  };
586
- readonly contractHash: {
587
- readonly type: "string";
588
- readonly pattern: "^sha256:[a-f0-9]{64}$";
589
- };
590
- readonly contractSource: {
591
- readonly enum: readonly ["project", "default-profile", "manifest"];
592
- };
593
- readonly runtimeId: {
594
- readonly type: "string";
595
- readonly minLength: 1;
686
+ readonly structure: {
687
+ readonly type: "array";
688
+ readonly default: readonly [];
689
+ readonly items: {
690
+ readonly $ref: "#/$defs/structureEntry";
691
+ };
596
692
  };
597
- readonly processStartedAt: {
598
- readonly type: "string";
599
- readonly format: "date-time";
693
+ readonly invariants: {
694
+ readonly type: "array";
695
+ readonly default: readonly [];
696
+ readonly items: {
697
+ readonly $ref: "#/$defs/invariantEntry";
698
+ };
600
699
  };
601
700
  };
602
701
  readonly $defs: {
603
- readonly expectation: {
702
+ readonly structureEntry: {
604
703
  readonly type: "object";
605
704
  readonly additionalProperties: false;
705
+ readonly required: readonly ["id", "sensor"];
606
706
  readonly properties: {
607
- readonly expectedRoot: {
707
+ readonly id: {
608
708
  readonly type: "string";
609
709
  readonly minLength: 1;
610
- readonly description: string;
611
710
  };
612
- readonly expectedProjectId: {
711
+ readonly sensor: {
613
712
  readonly type: "string";
614
- readonly pattern: "^sha256:[a-f0-9]{64}$";
615
- readonly description: "Project id previously returned by ark_identity or ark_manifest.";
713
+ readonly enum: readonly ["aggregate-private-state", "always-valid-factory", "domain-event-on-mutation", "orchestration-only", "thin-adapter", "writes-via-aggregate", "no-anemic-model", "invariant-coverage"];
714
+ };
715
+ readonly mode: {
716
+ readonly type: "string";
717
+ readonly enum: readonly ["advisory", "enforced"];
718
+ readonly default: "advisory";
719
+ };
720
+ readonly appliesTo: {
721
+ readonly type: "array";
722
+ readonly items: {
723
+ readonly type: "string";
724
+ readonly minLength: 1;
725
+ };
726
+ readonly uniqueItems: true;
727
+ };
728
+ readonly description: {
729
+ readonly type: "string";
730
+ readonly minLength: 1;
616
731
  };
617
732
  };
618
733
  };
619
- readonly binding: {
734
+ readonly invariantEntry: {
620
735
  readonly type: "object";
621
736
  readonly additionalProperties: false;
622
- readonly required: readonly ["status", "authoritative"];
737
+ readonly required: readonly ["id", "description"];
623
738
  readonly properties: {
624
- readonly status: {
625
- readonly enum: readonly ["matched", "unverified", "mismatch"];
626
- };
627
- readonly authoritative: {
628
- readonly type: "boolean";
629
- };
630
- readonly expectedRoot: {
739
+ readonly id: {
631
740
  readonly type: "string";
632
741
  readonly minLength: 1;
633
742
  };
634
- readonly expectedProjectId: {
743
+ readonly description: {
635
744
  readonly type: "string";
636
- readonly pattern: "^sha256:[a-f0-9]{64}$";
745
+ readonly minLength: 1;
637
746
  };
638
- readonly code: {
639
- readonly enum: readonly ["PROJECT_ROOT_MISMATCH", "PROJECT_ID_MISMATCH", "INVALID_PROJECT_EXPECTATION"];
640
- };
641
- readonly message: {
747
+ readonly aggregate: {
642
748
  readonly type: "string";
643
749
  readonly minLength: 1;
644
750
  };
751
+ readonly coverage: {
752
+ readonly type: "object";
753
+ readonly additionalProperties: false;
754
+ readonly properties: {
755
+ readonly test: {
756
+ readonly type: "boolean";
757
+ };
758
+ readonly symbol: {
759
+ readonly type: "string";
760
+ readonly minLength: 1;
761
+ };
762
+ };
763
+ };
764
+ readonly mode: {
765
+ readonly type: "string";
766
+ readonly enum: readonly ["advisory", "enforced"];
767
+ readonly default: "advisory";
768
+ };
769
+ readonly appliesTo: {
770
+ readonly type: "array";
771
+ readonly items: {
772
+ readonly type: "string";
773
+ readonly minLength: 1;
774
+ };
775
+ readonly uniqueItems: true;
776
+ };
777
+ };
778
+ };
779
+ };
780
+ };
781
+ declare class ArkRulesValidationError extends Error {
782
+ readonly issues: ArkRulesIssue[];
783
+ readonly source: string;
784
+ constructor(source: string, issues: ArkRulesIssue[]);
785
+ }
786
+ declare function loadArkRulesContract(input: unknown, source?: string, expectedLayer?: string): {
787
+ config: ArkRulesFile;
788
+ };
789
+ declare function parseArkRulesJson(json: string, source?: string, expectedLayer?: string): {
790
+ config: ArkRulesFile;
791
+ };
792
+ /**
793
+ * Build the Effective Contract from already-validated ArkRules files.
794
+ * Callers supply `{ layer → { sourceFile, file } }` after resolving references.
795
+ */
796
+ declare function buildEffectiveArkRules(parts: ReadonlyArray<{
797
+ layer: string;
798
+ sourceFile: string;
799
+ file: ArkRulesFile;
800
+ }>): EffectiveArkRules;
801
+ /** Empty Effective Contract used when `arkRules` is absent (byte-for-byte verdict parity). */
802
+ declare function emptyEffectiveArkRules(): EffectiveArkRules;
803
+
804
+ /** Versioned public result contract types + JSON Schema (adapter envelope). */
805
+ /**
806
+ * 1.5 adds stable finding refs on every factory-emitted diagnostic (ACS06):
807
+ * `findingRef`, `targetKey` (baseline-compatible), `docsCodePath`.
808
+ * 1.4 added optional evidence.arkruleId + evidence.arkruleSource (ADR 0012 / AR03).
809
+ */
810
+ declare const ARK_ANALYSIS_RESULT_SCHEMA_VERSION: "1.5";
811
+ /** Repo-relative diagnostics docs path (parity with ACS02 diagnostic catalog). */
812
+ declare const ADAPTER_DIAGNOSTIC_DOCS_RELATIVE_PATH: "docs/diagnostics.md";
813
+ type AdapterSeverity = 'error' | 'warning';
814
+ type AnalysisCompleteness = 'complete' | 'partial' | 'unavailable';
815
+ type AnalysisMode = 'lexical-compatibility' | 'resolved-candidate-facts';
816
+ type AdapterCompletenessReason = {
817
+ code: string;
818
+ message: string;
819
+ file?: string;
820
+ };
821
+ type AdapterViolationInput = {
822
+ ruleId?: unknown;
823
+ code?: unknown;
824
+ message?: unknown;
825
+ file?: unknown;
826
+ line?: unknown;
827
+ column?: unknown;
828
+ target?: unknown;
829
+ fromLayer?: unknown;
830
+ toLayer?: unknown;
831
+ typeOnly?: unknown;
832
+ targetTypeOnlyExports?: unknown;
833
+ sourcePureTypeModule?: unknown;
834
+ namedBindingsTypeOnly?: unknown;
835
+ portProofEligible?: unknown;
836
+ peerIsolation?: unknown;
837
+ edgeKind?: unknown;
838
+ severity?: unknown;
839
+ /** When false, finding is non-blocking (e.g. type-only placement debt). */
840
+ failsStrict?: unknown;
841
+ /** Nested-wall reason. The ruleId stays LAYER_IMPORT_VIOLATION. Not part of the baseline key. */
842
+ reasonId?: unknown;
843
+ /** Last segment of the importer universe id, when the finding has a reasonId. */
844
+ universeFrom?: unknown;
845
+ /** Last segment of the importee universe id, when the finding has a reasonId. */
846
+ universeTo?: unknown;
847
+ nextAction?: unknown;
848
+ /** U04: the denied capability id on CAPABILITY_VIOLATION. */
849
+ capability?: unknown;
850
+ /** AR03: ArkRule identity for structure/invariant diagnostics. */
851
+ arkruleId?: unknown;
852
+ /** AR03: project-relative ArkRules source file that declared the rule. */
853
+ arkruleSource?: unknown;
854
+ };
855
+ type AdapterDiagnostic = {
856
+ ruleId: string;
857
+ severity: AdapterSeverity;
858
+ message: string;
859
+ location: {
860
+ file: string;
861
+ line: number;
862
+ column: number;
863
+ };
864
+ evidence: {
865
+ target?: string;
866
+ fromLayer?: string;
867
+ toLayer?: string;
868
+ typeOnly?: boolean;
869
+ targetTypeOnlyExports?: boolean;
870
+ sourcePureTypeModule?: boolean;
871
+ namedBindingsTypeOnly?: boolean;
872
+ portProofEligible?: boolean;
873
+ peerIsolation?: boolean;
874
+ capability?: string;
875
+ edgeKind?: string;
876
+ /** AR03 — ArkRule id (structure or invariant). */
877
+ arkruleId?: string;
878
+ /** AR03 — ArkRules source file path. */
879
+ arkruleSource?: string;
880
+ /** Nested-wall reason. Not part of the baseline key. */
881
+ reasonId?: 'CROSS_PARENT_SLICE' | 'CROSS_SIBLING_SLICE' | 'CROSS_PARENT_VIA_SHARED';
882
+ /** Last segment of the importer universe id, with a reasonId. */
883
+ universeFrom?: string;
884
+ /** Last segment of the importee universe id, with a reasonId. */
885
+ universeTo?: string;
886
+ };
887
+ /** Added in schema 1.1; optional in TypeScript so 1.0 consumer-owned values remain valid. */
888
+ nextAction?: string;
889
+ /**
890
+ * ACS06 / schema 1.5 — compact stable id for multi-turn re-address
891
+ * (`fnv1a-` + hex). Always derived from `targetKey`. Optional so 1.0–1.4
892
+ * consumer-owned diagnostics remain assignable.
893
+ */
894
+ findingRef?: string;
895
+ /**
896
+ * ACS06 / schema 1.5 — baseline-compatible freeze identity
897
+ * (`ruleId|file|fromLayer|toLayer|target`, with occurrence `#N` suffixes in lists).
898
+ * Must match `baselineKey` / `baselineOccurrenceKeys` so refs never orphan baselines.
899
+ */
900
+ targetKey?: string;
901
+ /**
902
+ * ACS06 / schema 1.5 — package-relative docs path with rule anchor
903
+ * (`docs/diagnostics.md#RULE_ID`). Optional for legacy consumer-owned values.
904
+ */
905
+ docsCodePath?: string;
906
+ };
907
+ type LegacyAdapterResult = {
908
+ schemaVersion: '1.0' | '1.1';
909
+ valid: boolean;
910
+ diagnostics: AdapterDiagnostic[];
911
+ completeness?: never;
912
+ mode?: never;
913
+ };
914
+ type Version12AdapterResultBase = {
915
+ schemaVersion: '1.2';
916
+ diagnostics: AdapterDiagnostic[];
917
+ mode?: never;
918
+ };
919
+ type Version12AdapterResult = (Version12AdapterResultBase & {
920
+ completeness: 'complete';
921
+ valid: boolean;
922
+ }) | (Version12AdapterResultBase & {
923
+ completeness: 'partial' | 'unavailable';
924
+ valid: false;
925
+ });
926
+ type CurrentAdapterResultBase = {
927
+ schemaVersion: typeof ARK_ANALYSIS_RESULT_SCHEMA_VERSION;
928
+ completenessReasons: AdapterCompletenessReason[];
929
+ diagnostics: AdapterDiagnostic[];
930
+ };
931
+ type ResolvedAdapterEvidence = {
932
+ policyHash: string;
933
+ resolverIdentity: string;
934
+ factsHash: string;
935
+ candidateTreeHash: string;
936
+ };
937
+ type CurrentAdapterResult = (CurrentAdapterResultBase & Partial<ResolvedAdapterEvidence> & {
938
+ mode: 'lexical-compatibility';
939
+ valid: boolean;
940
+ completeness: 'complete';
941
+ }) | (CurrentAdapterResultBase & Partial<ResolvedAdapterEvidence> & {
942
+ mode: 'lexical-compatibility';
943
+ valid: false;
944
+ completeness: 'partial' | 'unavailable';
945
+ }) | (CurrentAdapterResultBase & ResolvedAdapterEvidence & {
946
+ mode: 'resolved-candidate-facts';
947
+ valid: boolean;
948
+ completeness: 'complete';
949
+ }) | (CurrentAdapterResultBase & ResolvedAdapterEvidence & {
950
+ mode: 'resolved-candidate-facts';
951
+ valid: false;
952
+ completeness: 'partial';
953
+ }) | (CurrentAdapterResultBase & Partial<ResolvedAdapterEvidence> & {
954
+ mode: 'resolved-candidate-facts';
955
+ valid: false;
956
+ completeness: 'unavailable';
957
+ });
958
+ type AdapterResult = LegacyAdapterResult | Version12AdapterResult | CurrentAdapterResult;
959
+ declare const ARK_ANALYSIS_RESULT_SCHEMA: {
960
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
961
+ readonly $id: "https://unpkg.com/arkgate@3/schemas/ark.analysis-result.schema.json";
962
+ readonly title: "ArkGate analysis result";
963
+ readonly type: "object";
964
+ readonly additionalProperties: false;
965
+ readonly required: readonly ["schemaVersion", "mode", "valid", "completeness", "completenessReasons", "diagnostics"];
966
+ readonly allOf: readonly [{
967
+ readonly if: {
968
+ readonly properties: {
969
+ readonly completeness: {
970
+ readonly enum: readonly ["partial", "unavailable"];
971
+ };
972
+ };
973
+ readonly required: readonly ["completeness"];
974
+ };
975
+ readonly then: {
976
+ readonly properties: {
977
+ readonly valid: {
978
+ readonly const: false;
979
+ };
980
+ };
981
+ };
982
+ }, {
983
+ readonly if: {
984
+ readonly properties: {
985
+ readonly mode: {
986
+ readonly const: "resolved-candidate-facts";
987
+ };
988
+ readonly completeness: {
989
+ readonly enum: readonly ["complete", "partial"];
990
+ };
991
+ };
992
+ readonly required: readonly ["mode", "completeness"];
993
+ };
994
+ readonly then: {
995
+ readonly required: readonly ["policyHash", "resolverIdentity", "factsHash", "candidateTreeHash"];
996
+ };
997
+ }, {
998
+ readonly if: {
999
+ readonly properties: {
1000
+ readonly completeness: {
1001
+ readonly const: "complete";
1002
+ };
1003
+ };
1004
+ readonly required: readonly ["completeness"];
1005
+ };
1006
+ readonly then: {
1007
+ readonly properties: {
1008
+ readonly completenessReasons: {
1009
+ readonly maxItems: 0;
1010
+ };
1011
+ };
1012
+ };
1013
+ readonly else: {
1014
+ readonly properties: {
1015
+ readonly completenessReasons: {
1016
+ readonly minItems: 1;
1017
+ };
1018
+ };
1019
+ };
1020
+ }];
1021
+ readonly properties: {
1022
+ readonly schemaVersion: {
1023
+ readonly const: "1.5";
1024
+ };
1025
+ readonly mode: {
1026
+ readonly enum: readonly ["lexical-compatibility", "resolved-candidate-facts"];
1027
+ };
1028
+ readonly valid: {
1029
+ readonly type: "boolean";
1030
+ };
1031
+ readonly completeness: {
1032
+ readonly enum: readonly ["complete", "partial", "unavailable"];
1033
+ };
1034
+ readonly completenessReasons: {
1035
+ readonly type: "array";
1036
+ readonly items: {
1037
+ readonly type: "object";
1038
+ readonly additionalProperties: false;
1039
+ readonly required: readonly ["code", "message"];
1040
+ readonly properties: {
1041
+ readonly code: {
1042
+ readonly type: "string";
1043
+ readonly minLength: 1;
1044
+ };
1045
+ readonly message: {
1046
+ readonly type: "string";
1047
+ readonly minLength: 1;
1048
+ };
1049
+ readonly file: {
1050
+ readonly type: "string";
1051
+ readonly minLength: 1;
1052
+ };
1053
+ };
1054
+ };
1055
+ };
1056
+ readonly policyHash: {
1057
+ readonly type: "string";
1058
+ readonly minLength: 1;
1059
+ };
1060
+ readonly resolverIdentity: {
1061
+ readonly type: "string";
1062
+ readonly minLength: 1;
1063
+ };
1064
+ readonly factsHash: {
1065
+ readonly type: "string";
1066
+ readonly minLength: 1;
1067
+ };
1068
+ readonly candidateTreeHash: {
1069
+ readonly type: "string";
1070
+ readonly minLength: 1;
1071
+ };
1072
+ readonly diagnostics: {
1073
+ readonly type: "array";
1074
+ readonly items: {
1075
+ readonly type: "object";
1076
+ readonly additionalProperties: false;
1077
+ readonly required: readonly ["ruleId", "severity", "message", "location", "evidence"];
1078
+ readonly properties: {
1079
+ readonly ruleId: {
1080
+ readonly type: "string";
1081
+ readonly minLength: 1;
1082
+ };
1083
+ readonly severity: {
1084
+ readonly enum: readonly ["error", "warning"];
1085
+ };
1086
+ readonly message: {
1087
+ readonly type: "string";
1088
+ readonly minLength: 1;
1089
+ };
1090
+ readonly location: {
1091
+ readonly type: "object";
1092
+ readonly additionalProperties: false;
1093
+ readonly required: readonly ["file", "line", "column"];
1094
+ readonly properties: {
1095
+ readonly file: {
1096
+ readonly type: "string";
1097
+ readonly minLength: 1;
1098
+ };
1099
+ readonly line: {
1100
+ readonly type: "integer";
1101
+ readonly minimum: 1;
1102
+ };
1103
+ readonly column: {
1104
+ readonly type: "integer";
1105
+ readonly minimum: 1;
1106
+ };
1107
+ };
1108
+ };
1109
+ readonly evidence: {
1110
+ readonly type: "object";
1111
+ readonly additionalProperties: false;
1112
+ readonly properties: {
1113
+ readonly target: {
1114
+ readonly type: "string";
1115
+ };
1116
+ readonly fromLayer: {
1117
+ readonly type: "string";
1118
+ };
1119
+ readonly toLayer: {
1120
+ readonly type: "string";
1121
+ };
1122
+ readonly typeOnly: {
1123
+ readonly type: "boolean";
1124
+ };
1125
+ readonly targetTypeOnlyExports: {
1126
+ readonly type: "boolean";
1127
+ };
1128
+ readonly sourcePureTypeModule: {
1129
+ readonly type: "boolean";
1130
+ };
1131
+ readonly namedBindingsTypeOnly: {
1132
+ readonly type: "boolean";
1133
+ };
1134
+ readonly portProofEligible: {
1135
+ readonly type: "boolean";
1136
+ };
1137
+ readonly peerIsolation: {
1138
+ readonly type: "boolean";
1139
+ };
1140
+ readonly capability: {
1141
+ readonly type: "string";
1142
+ readonly minLength: 1;
1143
+ };
1144
+ readonly edgeKind: {
1145
+ readonly type: "string";
1146
+ readonly minLength: 1;
1147
+ };
1148
+ readonly arkruleId: {
1149
+ readonly type: "string";
1150
+ readonly minLength: 1;
1151
+ };
1152
+ readonly arkruleSource: {
1153
+ readonly type: "string";
1154
+ readonly minLength: 1;
1155
+ };
1156
+ readonly reasonId: {
1157
+ readonly enum: readonly ["CROSS_PARENT_SLICE", "CROSS_SIBLING_SLICE", "CROSS_PARENT_VIA_SHARED"];
1158
+ };
1159
+ readonly universeFrom: {
1160
+ readonly type: "string";
1161
+ readonly minLength: 1;
1162
+ };
1163
+ readonly universeTo: {
1164
+ readonly type: "string";
1165
+ readonly minLength: 1;
1166
+ };
1167
+ };
1168
+ };
1169
+ readonly nextAction: {
1170
+ readonly type: "string";
1171
+ readonly minLength: 1;
1172
+ };
1173
+ /** ACS06 — compact multi-turn id; always derived from targetKey when emitted. */
1174
+ readonly findingRef: {
1175
+ readonly type: "string";
1176
+ readonly minLength: 1;
1177
+ readonly pattern: "^fnv1a-[0-9a-f]{8}$";
1178
+ };
1179
+ /**
1180
+ * ACS06 — baseline-compatible freeze identity
1181
+ * (`ruleId|file|from|to|target` with optional `#N` occurrence suffix).
1182
+ */
1183
+ readonly targetKey: {
1184
+ readonly type: "string";
1185
+ readonly minLength: 1;
1186
+ };
1187
+ /** ACS06 — package-relative diagnostics anchor path. */
1188
+ readonly docsCodePath: {
1189
+ readonly type: "string";
1190
+ readonly minLength: 1;
1191
+ };
1192
+ };
645
1193
  };
646
1194
  };
647
1195
  };
648
1196
  };
1197
+
1198
+ /**
1199
+ * Baseline-compatible target key for a violation input.
1200
+ * Field order and empty-string fallbacks **must** match `baselineKey` in
1201
+ * `baselineKey.ts` — parity tests guard this so finding refs never orphan freezes.
1202
+ *
1203
+ * Note: uses raw ruleId/file strings (including empty) the same way baseline does;
1204
+ * display `ruleId` / `location.file` may still normalize to ARK_UNKNOWN / `<unknown>`.
1205
+ */
1206
+ declare function adapterFindingTargetKey(violation: AdapterViolationInput): string;
1207
+ /**
1208
+ * Occurrence-aware target keys for a violation list (parity with baselineOccurrenceKeys).
1209
+ * First occurrence keeps the historical base key; duplicates get `#N`.
1210
+ */
1211
+ declare function adapterFindingOccurrenceTargetKeys(violations: readonly AdapterViolationInput[]): string[];
1212
+ /** FNV-1a finding ref from a baseline-compatible targetKey (not a security hash). */
1213
+ declare function adapterFindingRefFromTargetKey(targetKey: string): string;
1214
+ /** Package-relative docs path with fragment for a public ruleId. */
1215
+ declare function adapterDocsCodePath(ruleId: string): string;
1216
+
1217
+ declare function toAdapterDiagnostic(violation: AdapterViolationInput, fallbackSeverity?: AdapterSeverity,
1218
+ /**
1219
+ * Optional precomputed baseline-compatible targetKey (e.g. occurrence-aware from
1220
+ * `adapterFindingOccurrenceTargetKeys`). When omitted, uses the first-occurrence key.
1221
+ */
1222
+ targetKeyOverride?: string): AdapterDiagnostic;
1223
+ declare function createAdapterResult(input: {
1224
+ valid: boolean;
1225
+ completeness?: AnalysisCompleteness;
1226
+ mode?: AnalysisMode;
1227
+ policyHash?: unknown;
1228
+ resolverIdentity?: unknown;
1229
+ factsHash?: unknown;
1230
+ candidateTreeHash?: unknown;
1231
+ completenessReasons?: readonly AdapterCompletenessReason[];
1232
+ violations?: readonly AdapterViolationInput[];
1233
+ warnings?: readonly AdapterViolationInput[];
1234
+ }): CurrentAdapterResult;
1235
+
1236
+ /** ArkGate library version — single source of truth. */
1237
+ declare const version = "4.8.24";
1238
+
1239
+ /**
1240
+ * Canonical, pure contract for ArkGate MCP project identity.
1241
+ *
1242
+ * Filesystem canonicalization, hashing, clocks, and runtime ids belong to the
1243
+ * Tooling adapter. This module owns the stable payload and published schemas so
1244
+ * every MCP surface speaks the same identity/binding language.
1245
+ */
1246
+ declare const ARK_PROJECT_IDENTITY_SCHEMA_VERSION: "1.0";
1247
+ declare const ARK_PROJECT_IDENTITY_SCHEMA_URL = "https://unpkg.com/arkgate@4/schemas/ark.project-identity.schema.json";
1248
+ type ProjectIdentity = {
1249
+ schemaVersion: typeof ARK_PROJECT_IDENTITY_SCHEMA_VERSION;
1250
+ projectId: string;
1251
+ resolvedRoot: string;
1252
+ resolvedConfigPath: string;
1253
+ arkgateVersion: string;
1254
+ contractHash: string;
1255
+ contractSource: 'project' | 'default-profile' | 'manifest';
1256
+ runtimeId: string;
1257
+ processStartedAt: string;
1258
+ };
1259
+ type ProjectExpectation = {
1260
+ expectedRoot?: string;
1261
+ expectedProjectId?: string;
1262
+ };
1263
+ type ProjectBinding = {
1264
+ status: 'matched' | 'unverified' | 'mismatch';
1265
+ authoritative: boolean;
1266
+ expectedRoot?: string;
1267
+ expectedProjectId?: string;
1268
+ code?: 'PROJECT_ROOT_MISMATCH' | 'PROJECT_ID_MISMATCH' | 'INVALID_PROJECT_EXPECTATION';
1269
+ message?: string;
1270
+ };
1271
+ declare const PROJECT_EXPECTATION_SCHEMA: {
1272
+ readonly type: "object";
1273
+ readonly additionalProperties: false;
1274
+ readonly properties: {
1275
+ readonly expectedRoot: {
1276
+ readonly type: "string";
1277
+ readonly minLength: 1;
1278
+ readonly description: string;
1279
+ };
1280
+ readonly expectedProjectId: {
1281
+ readonly type: "string";
1282
+ readonly pattern: "^sha256:[a-f0-9]{64}$";
1283
+ readonly description: "Project id previously returned by ark_identity or ark_manifest.";
1284
+ };
1285
+ };
1286
+ };
1287
+ declare const PROJECT_BINDING_SCHEMA: {
1288
+ readonly type: "object";
1289
+ readonly additionalProperties: false;
1290
+ readonly required: readonly ["status", "authoritative"];
1291
+ readonly properties: {
1292
+ readonly status: {
1293
+ readonly enum: readonly ["matched", "unverified", "mismatch"];
1294
+ };
1295
+ readonly authoritative: {
1296
+ readonly type: "boolean";
1297
+ };
1298
+ readonly expectedRoot: {
1299
+ readonly type: "string";
1300
+ readonly minLength: 1;
1301
+ };
1302
+ readonly expectedProjectId: {
1303
+ readonly type: "string";
1304
+ readonly pattern: "^sha256:[a-f0-9]{64}$";
1305
+ };
1306
+ readonly code: {
1307
+ readonly enum: readonly ["PROJECT_ROOT_MISMATCH", "PROJECT_ID_MISMATCH", "INVALID_PROJECT_EXPECTATION"];
1308
+ };
1309
+ readonly message: {
1310
+ readonly type: "string";
1311
+ readonly minLength: 1;
1312
+ };
1313
+ };
1314
+ };
1315
+ declare const ARK_PROJECT_IDENTITY_SCHEMA: {
1316
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
1317
+ readonly $id: "https://unpkg.com/arkgate@4/schemas/ark.project-identity.schema.json";
1318
+ readonly title: "ArkGate MCP project identity";
1319
+ readonly description: "Stable project binding plus separate runtime and architecture-contract evidence.";
1320
+ readonly type: "object";
1321
+ readonly additionalProperties: false;
1322
+ readonly required: readonly ["schemaVersion", "projectId", "resolvedRoot", "resolvedConfigPath", "arkgateVersion", "contractHash", "contractSource", "runtimeId", "processStartedAt"];
1323
+ readonly properties: {
1324
+ readonly schemaVersion: {
1325
+ readonly const: "1.0";
1326
+ };
1327
+ readonly projectId: {
1328
+ readonly type: "string";
1329
+ readonly pattern: "^sha256:[a-f0-9]{64}$";
1330
+ };
1331
+ readonly resolvedRoot: {
1332
+ readonly type: "string";
1333
+ readonly minLength: 1;
1334
+ };
1335
+ readonly resolvedConfigPath: {
1336
+ readonly type: "string";
1337
+ readonly minLength: 1;
1338
+ };
1339
+ readonly arkgateVersion: {
1340
+ readonly type: "string";
1341
+ readonly minLength: 1;
1342
+ };
1343
+ readonly contractHash: {
1344
+ readonly type: "string";
1345
+ readonly pattern: "^sha256:[a-f0-9]{64}$";
1346
+ };
1347
+ readonly contractSource: {
1348
+ readonly enum: readonly ["project", "default-profile", "manifest"];
1349
+ };
1350
+ readonly runtimeId: {
1351
+ readonly type: "string";
1352
+ readonly minLength: 1;
1353
+ };
1354
+ readonly processStartedAt: {
1355
+ readonly type: "string";
1356
+ readonly format: "date-time";
1357
+ };
1358
+ };
1359
+ readonly $defs: {
1360
+ readonly expectation: {
1361
+ readonly type: "object";
1362
+ readonly additionalProperties: false;
1363
+ readonly properties: {
1364
+ readonly expectedRoot: {
1365
+ readonly type: "string";
1366
+ readonly minLength: 1;
1367
+ readonly description: string;
1368
+ };
1369
+ readonly expectedProjectId: {
1370
+ readonly type: "string";
1371
+ readonly pattern: "^sha256:[a-f0-9]{64}$";
1372
+ readonly description: "Project id previously returned by ark_identity or ark_manifest.";
1373
+ };
1374
+ };
1375
+ };
1376
+ readonly binding: {
1377
+ readonly type: "object";
1378
+ readonly additionalProperties: false;
1379
+ readonly required: readonly ["status", "authoritative"];
1380
+ readonly properties: {
1381
+ readonly status: {
1382
+ readonly enum: readonly ["matched", "unverified", "mismatch"];
1383
+ };
1384
+ readonly authoritative: {
1385
+ readonly type: "boolean";
1386
+ };
1387
+ readonly expectedRoot: {
1388
+ readonly type: "string";
1389
+ readonly minLength: 1;
1390
+ };
1391
+ readonly expectedProjectId: {
1392
+ readonly type: "string";
1393
+ readonly pattern: "^sha256:[a-f0-9]{64}$";
1394
+ };
1395
+ readonly code: {
1396
+ readonly enum: readonly ["PROJECT_ROOT_MISMATCH", "PROJECT_ID_MISMATCH", "INVALID_PROJECT_EXPECTATION"];
1397
+ };
1398
+ readonly message: {
1399
+ readonly type: "string";
1400
+ readonly minLength: 1;
1401
+ };
1402
+ };
1403
+ };
1404
+ };
1405
+ };
1406
+ /**
1407
+ * Stable identity: contract edits and MCP restarts must not change which project
1408
+ * this is. Callers must pass canonical real paths and a SHA-256 hex function.
1409
+ */
1410
+ declare function createProjectId(resolvedRoot: string, resolvedConfigPath: string, sha256Hex: (value: string) => string): string;
1411
+ declare function createProjectIdentity(input: Omit<ProjectIdentity, 'schemaVersion'>): ProjectIdentity;
1412
+
1413
+ /**
1414
+ * AI Code Gate (basic).
1415
+ *
1416
+ * Allows validation of generated source code against the defined architecture.
1417
+ */
1418
+ interface AICodeGateViolation {
1419
+ /** Stable rule identifier for agents and CI pipelines. */
1420
+ ruleId: string;
1421
+ /** @deprecated Use ruleId — kept for backward compatibility. */
1422
+ code: string;
1423
+ message: string;
1424
+ line?: number;
1425
+ suggestion?: string;
1426
+ source?: string;
1427
+ filePath?: string;
1428
+ target?: string;
1429
+ fromLayer?: string;
1430
+ toLayer?: string;
1431
+ /** Nested-wall reason. Absent on a classic layer deny and on a child-only parent import. */
1432
+ reasonId?: string;
1433
+ /** Last segment of the importer universe id, with a reasonId. */
1434
+ universeFrom?: string;
1435
+ /** Last segment of the importee universe id, with a reasonId. */
1436
+ universeTo?: string;
1437
+ /** True when a peerIsolation rule produced this finding (also mirrored in details). */
1438
+ peerIsolation?: boolean;
1439
+ /** False for an advisory sibling crossing. Omitted findings still block the snippet. */
1440
+ failsStrict?: boolean;
1441
+ details?: unknown;
1442
+ }
1443
+ /** Extension point for external analyzers (AST, semantic, etc.). */
1444
+ interface AIGateExtension<Context = unknown> {
1445
+ readonly name: string;
1446
+ analyze(source: string, context?: Context): AICodeGateViolation[];
1447
+ }
1448
+ interface AICodeGateContext {
1449
+ filePath?: string;
1450
+ agentId?: string;
1451
+ layer?: string;
1452
+ [key: string]: unknown;
1453
+ }
1454
+ interface AICodeGateResult {
1455
+ /** Single-source snippets do not carry project-wide resolver evidence. */
1456
+ mode: 'lexical-compatibility';
1457
+ /** A snippet result is intentionally never an authoritative complete verdict. */
1458
+ completeness: 'partial';
1459
+ completenessReasons: string[];
1460
+ /** Authoritative verdict. Always false until the complete candidate is resolved. */
1461
+ valid: boolean;
1462
+ /** Compatibility signal for the bounded lexical checks performed here. */
1463
+ lexicalValid: boolean;
1464
+ violations: AICodeGateViolation[];
1465
+ }
1466
+ interface AICodeGate<Context = AICodeGateContext> {
1467
+ validate(source: string, context?: Context): AICodeGateResult;
1468
+ }
1469
+
1470
+ /**
1471
+ * Policy types for the Ark kernel.
1472
+ *
1473
+ * Policies allow declaring architectural rules that can be checked at runtime.
1474
+ * Supports both hard policies (must never be violated) and soft policies (warnings).
1475
+ */
1476
+ type PolicySeverity = 'hard' | 'soft';
1477
+ type PolicyEnforcementMode = 'runtime' | 'static' | 'runtime-and-static' | 'advisory';
1478
+ /**
1479
+ * Represents a single violation of a policy.
1480
+ */
1481
+ interface PolicyViolation {
1482
+ /** Name of the policy that was violated */
1483
+ policyName: string;
1484
+ /** Severity level of the policy */
1485
+ severity: PolicySeverity;
1486
+ /** Human-readable explanation of the violation */
1487
+ message: string;
1488
+ /** Optional additional structured details */
1489
+ details?: unknown;
1490
+ }
1491
+ /**
1492
+ * A Policy defines a rule that can be evaluated against a context.
1493
+ *
1494
+ * @template Context - The shape of data the policy evaluates (e.g. { registry, events })
1495
+ */
1496
+ interface Policy<Context = unknown> {
1497
+ /** Unique name of the policy (used in violations and reporting) */
1498
+ readonly name: string;
1499
+ /** Whether this is a hard rule (enforced strictly) or soft (advisory) */
1500
+ readonly severity: PolicySeverity;
1501
+ /** Optional tags for policy classification (e.g. 'layer', 'naming') */
1502
+ readonly tags?: readonly string[];
1503
+ readonly owner?: string;
1504
+ readonly version?: string;
1505
+ readonly rationale?: string;
1506
+ readonly enforcementMode?: PolicyEnforcementMode;
1507
+ readonly deprecated?: boolean | string;
1508
+ readonly replacedBy?: string;
1509
+ /**
1510
+ * Evaluates the policy against the given context.
1511
+ * Return true / [] for pass, false / single violation / array for failure.
1512
+ */
1513
+ check(context: Context): boolean | PolicyViolation | PolicyViolation[];
1514
+ }
1515
+
1516
+ /**
1517
+ * Core domain primitives for Ark.
1518
+ * These types are the foundation for all governance concepts.
1519
+ */
1520
+ /**
1521
+ * Semantic intent names follow a convention:
1522
+ * - Domain.* for domain events and entities
1523
+ * - Application.* for use-cases / orchestration
1524
+ * - Adapter.* for integration points
1525
+ * - Workflow.* for sagas and processes
1526
+ * - Job.* for background jobs and scheduling
1527
+ * - Presentation.* for UI/API adapters
1528
+ * - Reporting.* for read models and projections
1529
+ * - Metadata.* for extensibility contracts
1530
+ * - Security.* / Audit.* / Observability.* for cross-cutting kernel concerns
1531
+ * - Kernel.* for Ark-owned governance signals
1532
+ */
1533
+ type IntentName = `Domain.${string}` | `Application.${string}` | `Adapter.${string}` | `Workflow.${string}` | `Job.${string}` | `Presentation.${string}` | `Reporting.${string}` | `Metadata.${string}` | `Security.${string}` | `Audit.${string}` | `Observability.${string}` | `Kernel.${string}`;
1534
+ type CorrelationId = string;
1535
+ interface EventMetadata {
1536
+ occurredAt: string;
1537
+ source: string;
1538
+ kernelInstanceId?: string;
1539
+ eventVersion?: string;
1540
+ schemaVersion?: string;
1541
+ allowInterception?: boolean;
1542
+ interceptions?: Array<{
1543
+ interceptorId: string;
1544
+ timestamp: string;
1545
+ }>;
1546
+ correlationId?: CorrelationId;
1547
+ causationId?: string;
1548
+ traceId?: string;
1549
+ spanId?: string;
1550
+ parentSpanId?: string;
1551
+ [key: string]: unknown;
1552
+ }
1553
+ interface DomainEvent<Name extends IntentName = IntentName, Payload = unknown> {
1554
+ intent: Name;
1555
+ payload: Payload;
1556
+ metadata: EventMetadata;
1557
+ }
1558
+
1559
+ /**
1560
+ * Intent-specific types for the Ark kernel.
1561
+ *
1562
+ * Intents provide semantic naming for every important concept in the system
1563
+ * (domain events, application operations, adapters, workflows).
1564
+ */
1565
+
1566
+ /**
1567
+ * An IntentCreator is a callable that creates a strongly-typed DomainEvent
1568
+ * when invoked with a payload.
1569
+ *
1570
+ * It also carries the semantic `name`.
1571
+ *
1572
+ * @example
1573
+ * const OrderPlaced = defineIntent<'Domain.Order.OrderPlaced', { orderId: string }>('Domain.Order.OrderPlaced');
1574
+ * const event = OrderPlaced({ orderId: 'o-1' });
1575
+ */
1576
+ interface IntentCreator<Name extends IntentName, Payload = unknown> {
1577
+ /**
1578
+ * Creates a DomainEvent for this intent.
1579
+ */
1580
+ (payload: Payload): DomainEvent<Name, Payload>;
1581
+ /**
1582
+ * The fully-qualified semantic name of the intent (e.g. "Domain.Order.OrderPlaced").
1583
+ */
1584
+ readonly name: Name;
1585
+ }
1586
+
1587
+ /**
1588
+ * Architecture layer profiles.
1589
+ *
1590
+ * A profile turns semantic names such as `Domain.Order.Placed` into governed
1591
+ * layer names and dependency rules.
1592
+ */
1593
+
1594
+ interface ArchitectureLayer {
1595
+ name: string;
1596
+ prefixes: string[];
1597
+ /**
1598
+ * Custom matcher for teams whose intent names don't follow prefix conventions.
1599
+ * Checked before any prefix matching, in layer declaration order. A layer may
1600
+ * use `match` alone (with `prefixes: []`), prefixes alone, or both.
1601
+ */
1602
+ match?: (name: string) => boolean;
1603
+ description?: string;
1604
+ trustBoundary?: 'public' | 'auth' | 'admin' | 'internal';
1605
+ owners?: string[];
1606
+ order?: number;
1607
+ }
1608
+ type ArchitectureRule = ArkConfigRule;
1609
+ interface ArchitectureProfile {
1610
+ name: string;
1611
+ layers: ArchitectureLayer[];
1612
+ rules: ArchitectureRule[];
1613
+ resolveLayer(name: string): string | undefined;
1614
+ }
1615
+ interface CreateArchitectureProfileOptions {
1616
+ name: string;
1617
+ layers: ArchitectureLayer[];
1618
+ rules?: ArchitectureRule[];
1619
+ }
1620
+ interface CreateArchitectureProfileFromArkConfigOptions {
1621
+ /** Runtime profile name. Default: config.name or "ark.config.json". */
1622
+ name?: string;
1623
+ }
1624
+ type ArchitectureLayerConfig = ArkConfigLayer;
1625
+ type ArkCheckConfig = Omit<ArkConfig, '$schema' | 'schemaVersion' | 'rules'> & {
1626
+ $schema?: string;
1627
+ schemaVersion?: ArkConfig['schemaVersion'];
1628
+ rules?: ArchitectureRule[];
1629
+ };
1630
+ interface CreateElevenLayerArkConfigOptions {
1631
+ /** Source root used in generated file patterns. Default: "src". */
1632
+ rootDir?: string;
1633
+ /** Include entries for ark-check. Default: [rootDir]. */
1634
+ include?: string[];
1635
+ /** Mark generated layers optional. Default: true. */
1636
+ optionalLayers?: boolean;
1637
+ }
1638
+
1639
+ declare function createArchitectureProfile(options: CreateArchitectureProfileOptions): ArchitectureProfile;
1640
+ declare function createArchitectureProfileFromArkConfig(config: ArkCheckConfig, options?: CreateArchitectureProfileFromArkConfigOptions): ArchitectureProfile;
1641
+ declare const elevenLayerProfile: ArchitectureProfile;
1642
+ declare function createElevenLayerArkConfig(options?: CreateElevenLayerArkConfigOptions): ArkCheckConfig;
1643
+
1644
+ /**
1645
+ * Basic AI Code Gate implementation.
1646
+ *
1647
+ * Uses simple string heuristics + registered intent names to detect obvious
1648
+ * architectural violations in generated code (e.g. direct infra imports from domain).
1649
+ * Not a full static analyzer — documented limitation.
1650
+ */
1651
+
1652
+ interface AICodeGatePolicyContext<Context = AICodeGateContext> {
1653
+ source: string;
1654
+ context?: Context;
1655
+ }
1656
+ interface AICodeGateOptions<Context = AICodeGateContext> {
1657
+ policies?: Policy<AICodeGatePolicyContext<Context>>[];
1658
+ intents?: Array<string | Pick<IntentCreator<IntentName, unknown>, 'name'>>;
1659
+ /**
1660
+ * Additional forbidden patterns (regex or strings).
1661
+ */
1662
+ forbiddenPatterns?: Array<string | RegExp>;
1663
+ /**
1664
+ * External analyzer extensions (type-only contract; plug in AST tools later).
1665
+ */
1666
+ extensions?: AIGateExtension<Context>[];
1667
+ /**
1668
+ * Optional architecture profile for layer-aware generated-code checks.
1669
+ * When context.layer is provided, intent references are checked against it.
1670
+ */
1671
+ architectureProfile?: ArchitectureProfile;
1672
+ /**
1673
+ * When true, flag string literals that look like intent names but are not registered.
1674
+ */
1675
+ enforceIntentAllowlist?: boolean;
1676
+ /**
1677
+ * Optional TypeScript module object. When provided, AICodeGate adds AST-backed checks
1678
+ * for publish misuse without taking a runtime dependency on TypeScript.
1679
+ */
1680
+ typescript?: unknown;
1681
+ /**
1682
+ * Ambient globals forbidden per layer (layer name → entries such as "fetch" or
1683
+ * "Date.now"). Checked only when `typescript` is provided and context.layer resolves
1684
+ * to a listed layer — mirrors ark-check's FORBIDDEN_GLOBAL rule.
1685
+ */
1686
+ forbiddenGlobals?: Record<string, string[]>;
1687
+ /**
1688
+ * Layer → effective capability deny set (U04 walls; ADR 0009). Enforced like
1689
+ * forbiddenGlobals when the target file's layer is known. An ambient use
1690
+ * already covered by the layer's forbiddenGlobals reports only
1691
+ * FORBIDDEN_GLOBAL (D7 — one violation, one voice).
1692
+ */
1693
+ capabilityWalls?: Record<string, string[]>;
1694
+ /**
1695
+ * Layer names whose role is infrastructure and may therefore import infrastructure
1696
+ * (a persistence adapter importing the DB is correct, not a violation). The built-in
1697
+ * infra-import heuristics are suppressed for these layers and for any layer whose
1698
+ * name matches the conventional infra tokens. Populate from ark.config.json layers
1699
+ * flagged `mayImportInfrastructure: true`, so unconventionally-named infra layers
1700
+ * opt in explicitly. User-supplied `forbiddenPatterns` still apply everywhere.
1701
+ */
1702
+ infrastructureLayers?: string[];
1703
+ /**
1704
+ * Preferred single resolve step: import specifier or absolute source file →
1705
+ * `{ layer, relPath }` for contract + peerIsolation. Prefer this over the
1706
+ * legacy layer-only callback.
1707
+ */
1708
+ resolveImportTarget?: (specifierOrFilePath: string, fromFilePath?: string) => {
1709
+ layer?: string;
1710
+ relPath?: string;
1711
+ } | undefined;
1712
+ /**
1713
+ * @deprecated Prefer resolveImportTarget. Layer-only resolve for governed imports.
1714
+ */
1715
+ resolveImportLayer?: (specifier: string, fromFilePath?: string) => string | undefined;
1716
+ /**
1717
+ * Layer configs (patterns) used to infer sliceFolders when a peerIsolation rule
1718
+ * omits an explicit list.
1719
+ */
1720
+ architectureLayers?: Array<{
1721
+ name: string;
1722
+ patterns?: string[];
1723
+ }>;
1724
+ /** Explicit file-level escape hatch for reviewed non-literal import()/require() calls. */
1725
+ allowNonLiteralDynamicImport?: (filePath?: string) => boolean;
1726
+ }
1727
+ declare function createAICodeGate<Context = AICodeGateContext>(options?: AICodeGateOptions<Context>): AICodeGate<Context>;
1728
+
1729
+ /**
1730
+ * Portable identity/fingerprint primitives for pure Domain contracts.
1731
+ *
1732
+ * FNV-1a is intentional: no Node crypto dependency for CLI/MCP/browserless consumers.
1733
+ */
1734
+ /** Stable FNV-1a hash. Identity/fingerprint only — not a security primitive. */
1735
+ declare function deterministicHash(value: string): string;
1736
+ /** Serialize JSON-like values with sorted object keys for reproducible hashes. */
1737
+ declare function stableSerialize(value: unknown): string;
1738
+
1739
+ /**
1740
+ * ArkOrder resolver-fact extraction (ADR 0029). Syntax only — no verdicts.
1741
+ */
1742
+
1743
+ type ResolvedArkOrderPlaneCallFact = {
1744
+ file: string;
1745
+ line: number;
1746
+ callee: string;
1747
+ };
1748
+ type ResolvedArkOrderGenericUpdateFact = {
1749
+ file: string;
1750
+ line: number;
1751
+ method: string;
1752
+ };
1753
+ type ResolvedArkOrderRootHitFact = {
1754
+ file: string;
1755
+ matchedRoot: string;
1756
+ hasPlaneFactory: boolean;
1757
+ };
1758
+ type ResolvedArkOrderXiFieldWriteFact = {
1759
+ file: string;
1760
+ line: number;
1761
+ key: string;
1762
+ };
1763
+ type ResolvedArkOrderIngestWriteFact = {
1764
+ file: string;
1765
+ line: number;
1766
+ };
1767
+ type ResolvedArkOrderReleaseKeyCountFact = {
1768
+ file: string;
1769
+ line: number;
1770
+ keyCount: number;
1771
+ };
1772
+ /** A freshness key (ttl/freshUntil/maxAge) inside the ξ literal of plane.release / proposeRelease. */
1773
+ type ResolvedArkOrderXiTtlFact = {
1774
+ file: string;
1775
+ line: number;
1776
+ key: string;
1777
+ };
1778
+ /** A literal `allowedKinds` entry that a literal `informationBudget.cannotObserve` denies. */
1779
+ type ResolvedArkOrderBudgetLeakFact = {
1780
+ file: string;
1781
+ line: number;
1782
+ kind: string;
1783
+ };
1784
+
1785
+ /**
1786
+ * Versioned type vocabulary for resolved candidate facts (schema 1.0).
1787
+ *
1788
+ * Pure declarations + schema version identity. Create/load live in
1789
+ * resolvedCandidateFacts.ts; JSON Schema lives in resolvedCandidateFactsSchema.ts.
1790
+ */
1791
+
1792
+ /** 1.1 adds optional classShapes[] (ADR 0013). 1.2 adds optional ArkRun facts (ADR 0022). 1.0/1.1 remain loadable. */
1793
+ declare const RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION: "1.2";
1794
+ type ResolvedFactsCompleteness = 'complete' | 'partial' | 'unavailable';
1795
+ type ResolvedDependencyKind = 'import' | 'export' | 'dynamic-import' | 'require';
1796
+ type ResolvedDependencyState = 'resolved-project' | 'resolved-external' | 'unresolved' | 'dynamic';
1797
+ type ResolvedCapability = 'network' | 'filesystem' | 'clock' | 'randomness' | 'environment' | 'process' | 'persistence';
1798
+ type ResolvedFactsReason = {
1799
+ code: string;
1800
+ message: string;
1801
+ file?: string;
1802
+ };
1803
+ type ResolvedFileFact = {
1804
+ path: string;
1805
+ contentHash: string;
1806
+ parseStatus: 'parsed' | 'invalid';
1807
+ parseDiagnosticCount: number;
1808
+ exportsOnlyTypes: boolean;
1809
+ typeOnlyExportNames: string[];
1810
+ hasTopLevelSideEffects: boolean;
1811
+ };
1812
+ /** ADR 0022 kernel API call-site evidence. Sensors consume this in RN04. */
1813
+ type ResolvedArkRunKernelCallKind = 'factory' | 'publisher' | 'publish' | 'raise' | 'send' | 'subscribe' | 'register-handler' | 'resolve' | 'resolve-singleton';
1814
+ type ResolvedArkRunKernelCallFact = {
1815
+ file: string;
1816
+ line: number;
1817
+ kind: ResolvedArkRunKernelCallKind;
1818
+ callee: string;
1819
+ viaImport: boolean;
1820
+ receiver?: string;
1821
+ nameLiteral?: string;
1822
+ };
1823
+ /** `new` of a class admitted for kernel creation (classShapes name or kernel import). */
1824
+ type ResolvedArkRunManagedNewFact = {
1825
+ file: string;
1826
+ line: number;
1827
+ typeName: string;
1828
+ importedFrom?: string;
1829
+ };
1830
+ /** Governed file that matched an `arkRun.compositionRoots` glob. */
1831
+ type ResolvedArkRunCompositionRootHitFact = {
1832
+ file: string;
1833
+ matchedRoot: string;
1834
+ hasKernelFactory: boolean;
1835
+ };
1836
+ /** File-scoped interaction declaration lists (ADR 0023). Sensors consume this in RN04. */
1837
+ type ResolvedArkRunDeclarationFact = {
1838
+ file: string;
1839
+ line: number;
1840
+ uses: string[];
1841
+ reactsTo: string[];
1842
+ raises: string[];
1843
+ sends: string[];
1844
+ };
1845
+ /** ADR 0013 class-shape evidence for ArkRules structure sensors. */
1846
+ type ResolvedClassShapeFact = {
1847
+ file: string;
1848
+ className: string;
1849
+ exported: boolean;
1850
+ hasPublicMutableFields: boolean;
1851
+ hasPublicSetters: boolean;
1852
+ hasPublicConstructor: boolean;
1853
+ hasStaticFactory: boolean;
1854
+ mutatingMethods: readonly {
1855
+ name: string;
1856
+ referencesGuardOrPublish: boolean;
1857
+ }[];
1858
+ dataOnly?: boolean;
1859
+ /** Source offset where the class-shape scan stopped (unwalkable body/header). */
1860
+ truncatedUntil?: number;
1861
+ };
1862
+ type ResolvedDependencyFact = {
1863
+ from: string;
1864
+ specifier?: string;
1865
+ kind: ResolvedDependencyKind;
1866
+ typeOnly: boolean;
1867
+ line: number;
1868
+ resolution: ResolvedDependencyState;
1869
+ target?: string;
1870
+ namedBindings?: string[];
1871
+ targetTypeOnlyExports?: boolean;
1872
+ sourcePureTypeModule?: boolean;
1873
+ namedBindingsTypeOnly?: boolean;
1874
+ portProofEligible?: boolean;
1875
+ };
1876
+ type ResolvedCapabilityFact = {
1877
+ file: string;
1878
+ line: number;
1879
+ symbol: string;
1880
+ capability: ResolvedCapability;
1881
+ source: 'ambient-global' | 'import-based';
1882
+ };
1883
+ type ResolvedAmbientFact = {
1884
+ file: string;
1885
+ line: number;
1886
+ symbol: string;
1887
+ };
1888
+ type ResolvedPublishFact = {
1889
+ file: string;
1890
+ line: number;
1891
+ rawIntentName?: string;
1892
+ objectHasIntent: boolean;
1893
+ arkPublishCandidate: boolean;
1894
+ hasSource: boolean;
1895
+ sourceIntent?: string;
1896
+ };
1897
+ type ResolvedIntentReferenceFact = {
1898
+ file: string;
1899
+ line: number;
1900
+ intent: string;
1901
+ };
1902
+ type ResolvedSafetyKind = 'ts-suppression' | 'any-cast' | 'dynamic-import' | 'dynamic-require' | 'in-memory-store';
1903
+ /** Neutral syntax evidence for policy-controlled safety diagnostics. */
1904
+ type ResolvedSafetyFact = {
1905
+ file: string;
1906
+ line: number;
1907
+ kind: ResolvedSafetyKind;
1908
+ symbol?: string;
1909
+ };
1910
+ type ResolvedCandidateFactsInput = {
1911
+ schemaVersion: '1.0' | '1.1' | typeof RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION;
1912
+ completeness: ResolvedFactsCompleteness;
1913
+ completenessReasons: readonly ResolvedFactsReason[];
1914
+ resolverIdentity: string;
1915
+ compilerIdentity: string;
1916
+ compilerOptionsHash: string;
1917
+ tsconfigHash: string;
1918
+ evidenceRequirementsHash: string;
1919
+ projectPackageName?: string;
1920
+ files: readonly ResolvedFileFact[];
1921
+ dependencies: readonly ResolvedDependencyFact[];
1922
+ capabilityUses: readonly ResolvedCapabilityFact[];
1923
+ ambientUses: readonly ResolvedAmbientFact[];
1924
+ publishCalls: readonly ResolvedPublishFact[];
1925
+ intentReferences: readonly ResolvedIntentReferenceFact[];
1926
+ safetyUses: readonly ResolvedSafetyFact[];
1927
+ /** ADR 0013 — optional on 1.0; default [] on load. */
1928
+ classShapes?: readonly ResolvedClassShapeFact[];
1929
+ /** ADR 0022 / RN03 — optional on 1.0/1.1; default [] on load. */
1930
+ arkRunKernelCalls?: readonly ResolvedArkRunKernelCallFact[];
1931
+ arkRunManagedNews?: readonly ResolvedArkRunManagedNewFact[];
1932
+ arkRunCompositionRootHits?: readonly ResolvedArkRunCompositionRootHitFact[];
1933
+ arkRunDeclarations?: readonly ResolvedArkRunDeclarationFact[];
1934
+ arkOrderPlaneCalls?: readonly ResolvedArkOrderPlaneCallFact[];
1935
+ arkOrderGenericUpdates?: readonly ResolvedArkOrderGenericUpdateFact[];
1936
+ arkOrderRootHits?: readonly ResolvedArkOrderRootHitFact[];
1937
+ arkOrderXiFieldWrites?: readonly ResolvedArkOrderXiFieldWriteFact[];
1938
+ arkOrderIngestWritesXi?: readonly ResolvedArkOrderIngestWriteFact[];
1939
+ arkOrderReleaseKeyCounts?: readonly ResolvedArkOrderReleaseKeyCountFact[];
1940
+ arkOrderXiTtlKeys?: readonly ResolvedArkOrderXiTtlFact[];
1941
+ arkOrderBudgetLeaks?: readonly ResolvedArkOrderBudgetLeakFact[];
1942
+ };
1943
+ type ResolvedCandidateFacts = Omit<ResolvedCandidateFactsInput, 'candidateTreeHash' | 'classShapes' | 'arkRunKernelCalls' | 'arkOrderPlaneCalls' | 'arkOrderGenericUpdates' | 'arkOrderXiFieldWrites' | 'arkOrderIngestWritesXi' | 'arkOrderReleaseKeyCounts' | 'arkOrderXiTtlKeys' | 'arkOrderBudgetLeaks' | 'arkOrderRootHits' | 'arkRunManagedNews' | 'arkRunCompositionRootHits' | 'arkRunDeclarations'> & {
1944
+ schemaVersion: typeof RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION;
1945
+ completenessReasons: ResolvedFactsReason[];
1946
+ candidateTreeHash: string;
1947
+ files: ResolvedFileFact[];
1948
+ dependencies: ResolvedDependencyFact[];
1949
+ capabilityUses: ResolvedCapabilityFact[];
1950
+ ambientUses: ResolvedAmbientFact[];
1951
+ publishCalls: ResolvedPublishFact[];
1952
+ intentReferences: ResolvedIntentReferenceFact[];
1953
+ safetyUses: ResolvedSafetyFact[];
1954
+ classShapes: ResolvedClassShapeFact[];
1955
+ arkRunKernelCalls: ResolvedArkRunKernelCallFact[];
1956
+ arkRunManagedNews: ResolvedArkRunManagedNewFact[];
1957
+ arkRunCompositionRootHits: ResolvedArkRunCompositionRootHitFact[];
1958
+ arkRunDeclarations: ResolvedArkRunDeclarationFact[];
1959
+ arkOrderPlaneCalls: ResolvedArkOrderPlaneCallFact[];
1960
+ arkOrderGenericUpdates: ResolvedArkOrderGenericUpdateFact[];
1961
+ arkOrderRootHits: ResolvedArkOrderRootHitFact[];
1962
+ arkOrderXiFieldWrites: ResolvedArkOrderXiFieldWriteFact[];
1963
+ arkOrderIngestWritesXi: ResolvedArkOrderIngestWriteFact[];
1964
+ arkOrderReleaseKeyCounts: ResolvedArkOrderReleaseKeyCountFact[];
1965
+ arkOrderXiTtlKeys: ResolvedArkOrderXiTtlFact[];
1966
+ arkOrderBudgetLeaks: ResolvedArkOrderBudgetLeakFact[];
1967
+ factsHash: string;
1968
+ };
1969
+
1970
+ /**
1971
+ * Canonical create/load for versioned resolved candidate facts.
1972
+ *
1973
+ * Types: resolvedCandidateFactsTypes.ts · Schema: resolvedCandidateFactsSchema.ts ·
1974
+ * Hash: stableHash.ts. Plan-B god-module pilot cluster (pattern-b:god-module).
1975
+ */
1976
+
1977
+ /** Identity of the policy-controlled evidence a resolver must attempt to collect. */
1978
+ declare function resolvedFactsEvidenceRequirementsHash(config: ArkConfig): string;
1979
+ declare function createResolvedCandidateFacts(input: ResolvedCandidateFactsInput): ResolvedCandidateFacts;
1980
+ declare function loadResolvedCandidateFacts(input: unknown): ResolvedCandidateFacts;
1981
+
1982
+ declare const RESOLVED_CANDIDATE_FACTS_SCHEMA: {
1983
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
1984
+ readonly $id: "https://unpkg.com/arkgate@3/schemas/ark.resolved-candidate-facts.schema.json";
1985
+ readonly title: "ArkGate resolved candidate facts";
1986
+ readonly type: "object";
1987
+ readonly additionalProperties: false;
1988
+ readonly required: readonly ["schemaVersion", "completeness", "completenessReasons", "resolverIdentity", "compilerIdentity", "compilerOptionsHash", "tsconfigHash", "candidateTreeHash", "evidenceRequirementsHash", "files", "dependencies", "capabilityUses", "ambientUses", "publishCalls", "intentReferences", "safetyUses", "factsHash"];
1989
+ readonly properties: {
1990
+ readonly schemaVersion: {
1991
+ readonly enum: readonly ["1.0", "1.1", "1.2"];
1992
+ };
1993
+ readonly completeness: {
1994
+ readonly enum: readonly ["complete", "partial", "unavailable"];
1995
+ };
1996
+ readonly completenessReasons: {
1997
+ readonly type: "array";
1998
+ readonly items: {
1999
+ readonly type: "object";
2000
+ readonly additionalProperties: false;
2001
+ readonly required: readonly ["code", "message"];
2002
+ readonly properties: {
2003
+ readonly code: {
2004
+ readonly type: "string";
2005
+ readonly minLength: 1;
2006
+ };
2007
+ readonly message: {
2008
+ readonly type: "string";
2009
+ readonly minLength: 1;
2010
+ };
2011
+ readonly file: {
2012
+ readonly type: "string";
2013
+ readonly minLength: 1;
2014
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2015
+ };
2016
+ };
2017
+ };
2018
+ };
2019
+ readonly resolverIdentity: {
2020
+ readonly type: "string";
2021
+ readonly minLength: 1;
2022
+ };
2023
+ readonly compilerIdentity: {
2024
+ readonly type: "string";
2025
+ readonly minLength: 1;
2026
+ };
2027
+ readonly compilerOptionsHash: {
2028
+ readonly type: "string";
2029
+ readonly minLength: 1;
2030
+ };
2031
+ readonly tsconfigHash: {
2032
+ readonly type: "string";
2033
+ readonly minLength: 1;
2034
+ };
2035
+ readonly candidateTreeHash: {
2036
+ readonly type: "string";
2037
+ readonly minLength: 1;
2038
+ };
2039
+ readonly evidenceRequirementsHash: {
2040
+ readonly type: "string";
2041
+ readonly minLength: 1;
2042
+ };
2043
+ readonly projectPackageName: {
2044
+ readonly type: "string";
2045
+ readonly minLength: 1;
2046
+ };
2047
+ readonly files: {
2048
+ readonly type: "array";
2049
+ readonly uniqueItems: true;
2050
+ readonly items: {
2051
+ readonly type: "object";
2052
+ readonly additionalProperties: false;
2053
+ readonly required: readonly ["path", "contentHash", "parseStatus", "parseDiagnosticCount", "exportsOnlyTypes", "typeOnlyExportNames", "hasTopLevelSideEffects"];
2054
+ readonly properties: {
2055
+ readonly path: {
2056
+ readonly type: "string";
2057
+ readonly minLength: 1;
2058
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2059
+ };
2060
+ readonly contentHash: {
2061
+ readonly type: "string";
2062
+ readonly minLength: 1;
2063
+ };
2064
+ readonly parseStatus: {
2065
+ readonly enum: readonly ["parsed", "invalid"];
2066
+ };
2067
+ readonly parseDiagnosticCount: {
2068
+ readonly type: "integer";
2069
+ readonly minimum: 0;
2070
+ };
2071
+ readonly exportsOnlyTypes: {
2072
+ readonly type: "boolean";
2073
+ };
2074
+ readonly typeOnlyExportNames: {
2075
+ readonly type: "array";
2076
+ readonly items: {
2077
+ readonly type: "string";
2078
+ readonly minLength: 1;
2079
+ };
2080
+ };
2081
+ readonly hasTopLevelSideEffects: {
2082
+ readonly type: "boolean";
2083
+ };
2084
+ };
2085
+ readonly allOf: readonly [{
2086
+ readonly if: {
2087
+ readonly properties: {
2088
+ readonly parseStatus: {
2089
+ readonly const: "parsed";
2090
+ };
2091
+ };
2092
+ };
2093
+ readonly then: {
2094
+ readonly properties: {
2095
+ readonly parseDiagnosticCount: {
2096
+ readonly const: 0;
2097
+ };
2098
+ };
2099
+ };
2100
+ }, {
2101
+ readonly if: {
2102
+ readonly properties: {
2103
+ readonly parseStatus: {
2104
+ readonly const: "invalid";
2105
+ };
2106
+ };
2107
+ };
2108
+ readonly then: {
2109
+ readonly properties: {
2110
+ readonly parseDiagnosticCount: {
2111
+ readonly minimum: 1;
2112
+ };
2113
+ };
2114
+ };
2115
+ }];
2116
+ };
2117
+ };
2118
+ readonly dependencies: {
2119
+ readonly type: "array";
2120
+ readonly items: {
2121
+ readonly type: "object";
2122
+ readonly additionalProperties: false;
2123
+ readonly required: readonly ["from", "kind", "typeOnly", "line", "resolution"];
2124
+ readonly properties: {
2125
+ readonly from: {
2126
+ readonly type: "string";
2127
+ readonly minLength: 1;
2128
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2129
+ };
2130
+ readonly specifier: {
2131
+ readonly type: "string";
2132
+ readonly minLength: 1;
2133
+ };
2134
+ readonly kind: {
2135
+ readonly enum: readonly ["import", "export", "dynamic-import", "require"];
2136
+ };
2137
+ readonly typeOnly: {
2138
+ readonly type: "boolean";
2139
+ };
2140
+ readonly line: {
2141
+ readonly type: "integer";
2142
+ readonly minimum: 1;
2143
+ };
2144
+ readonly resolution: {
2145
+ readonly enum: readonly ["resolved-project", "resolved-external", "unresolved", "dynamic"];
2146
+ };
2147
+ readonly target: {
2148
+ readonly type: "string";
2149
+ readonly minLength: 1;
2150
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2151
+ };
2152
+ readonly namedBindings: {
2153
+ readonly type: "array";
2154
+ readonly items: {
2155
+ readonly type: "string";
2156
+ readonly minLength: 1;
2157
+ };
2158
+ };
2159
+ readonly targetTypeOnlyExports: {
2160
+ readonly type: "boolean";
2161
+ };
2162
+ readonly sourcePureTypeModule: {
2163
+ readonly type: "boolean";
2164
+ };
2165
+ readonly namedBindingsTypeOnly: {
2166
+ readonly type: "boolean";
2167
+ };
2168
+ readonly portProofEligible: {
2169
+ readonly type: "boolean";
2170
+ };
2171
+ };
2172
+ readonly allOf: readonly [{
2173
+ readonly if: {
2174
+ readonly properties: {
2175
+ readonly resolution: {
2176
+ readonly const: "resolved-project";
2177
+ };
2178
+ };
2179
+ };
2180
+ readonly then: {
2181
+ readonly required: readonly ["target"];
2182
+ };
2183
+ readonly else: {
2184
+ readonly not: {
2185
+ readonly required: readonly ["target"];
2186
+ };
2187
+ };
2188
+ }, {
2189
+ readonly if: {
2190
+ readonly properties: {
2191
+ readonly resolution: {
2192
+ readonly const: "dynamic";
2193
+ };
2194
+ };
2195
+ };
2196
+ readonly else: {
2197
+ readonly required: readonly ["specifier"];
2198
+ };
2199
+ }];
2200
+ };
2201
+ };
2202
+ readonly capabilityUses: {
2203
+ readonly type: "array";
2204
+ readonly items: {
2205
+ readonly type: "object";
2206
+ readonly additionalProperties: false;
2207
+ readonly required: readonly ["file", "line", "symbol", "capability", "source"];
2208
+ readonly properties: {
2209
+ readonly file: {
2210
+ readonly type: "string";
2211
+ readonly minLength: 1;
2212
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2213
+ };
2214
+ readonly line: {
2215
+ readonly type: "integer";
2216
+ readonly minimum: 1;
2217
+ };
2218
+ readonly symbol: {
2219
+ readonly type: "string";
2220
+ readonly minLength: 1;
2221
+ };
2222
+ readonly capability: {
2223
+ readonly enum: readonly ["network", "filesystem", "clock", "randomness", "environment", "process", "persistence"];
2224
+ };
2225
+ readonly source: {
2226
+ readonly enum: readonly ["ambient-global", "import-based"];
2227
+ };
2228
+ };
2229
+ };
2230
+ };
2231
+ readonly ambientUses: {
2232
+ readonly type: "array";
2233
+ readonly items: {
2234
+ readonly type: "object";
2235
+ readonly additionalProperties: false;
2236
+ readonly required: readonly ["file", "line", "symbol"];
2237
+ readonly properties: {
2238
+ readonly file: {
2239
+ readonly type: "string";
2240
+ readonly minLength: 1;
2241
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2242
+ };
2243
+ readonly line: {
2244
+ readonly type: "integer";
2245
+ readonly minimum: 1;
2246
+ };
2247
+ readonly symbol: {
2248
+ readonly type: "string";
2249
+ readonly minLength: 1;
2250
+ };
2251
+ };
2252
+ };
2253
+ };
2254
+ readonly publishCalls: {
2255
+ readonly type: "array";
2256
+ readonly items: {
2257
+ readonly type: "object";
2258
+ readonly additionalProperties: false;
2259
+ readonly required: readonly ["file", "line", "objectHasIntent", "arkPublishCandidate", "hasSource"];
2260
+ readonly properties: {
2261
+ readonly file: {
2262
+ readonly type: "string";
2263
+ readonly minLength: 1;
2264
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2265
+ };
2266
+ readonly line: {
2267
+ readonly type: "integer";
2268
+ readonly minimum: 1;
2269
+ };
2270
+ readonly rawIntentName: {
2271
+ readonly type: "string";
2272
+ readonly minLength: 1;
2273
+ };
2274
+ readonly objectHasIntent: {
2275
+ readonly type: "boolean";
2276
+ };
2277
+ readonly arkPublishCandidate: {
2278
+ readonly type: "boolean";
2279
+ };
2280
+ readonly hasSource: {
2281
+ readonly type: "boolean";
2282
+ };
2283
+ readonly sourceIntent: {
2284
+ readonly type: "string";
2285
+ readonly minLength: 1;
2286
+ };
2287
+ };
2288
+ };
2289
+ };
2290
+ readonly intentReferences: {
2291
+ readonly type: "array";
2292
+ readonly items: {
2293
+ readonly type: "object";
2294
+ readonly additionalProperties: false;
2295
+ readonly required: readonly ["file", "line", "intent"];
2296
+ readonly properties: {
2297
+ readonly file: {
2298
+ readonly type: "string";
2299
+ readonly minLength: 1;
2300
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2301
+ };
2302
+ readonly line: {
2303
+ readonly type: "integer";
2304
+ readonly minimum: 1;
2305
+ };
2306
+ readonly intent: {
2307
+ readonly type: "string";
2308
+ readonly minLength: 1;
2309
+ };
2310
+ };
2311
+ };
2312
+ };
2313
+ readonly safetyUses: {
2314
+ readonly type: "array";
2315
+ readonly items: {
2316
+ readonly type: "object";
2317
+ readonly additionalProperties: false;
2318
+ readonly required: readonly ["file", "line", "kind"];
2319
+ readonly properties: {
2320
+ readonly file: {
2321
+ readonly type: "string";
2322
+ readonly minLength: 1;
2323
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2324
+ };
2325
+ readonly line: {
2326
+ readonly type: "integer";
2327
+ readonly minimum: 1;
2328
+ };
2329
+ readonly kind: {
2330
+ readonly enum: readonly ["ts-suppression", "any-cast", "dynamic-import", "dynamic-require", "in-memory-store"];
2331
+ };
2332
+ readonly symbol: {
2333
+ readonly type: "string";
2334
+ readonly minLength: 1;
2335
+ };
2336
+ };
2337
+ readonly allOf: readonly [{
2338
+ readonly if: {
2339
+ readonly properties: {
2340
+ readonly kind: {
2341
+ readonly const: "in-memory-store";
2342
+ };
2343
+ };
2344
+ };
2345
+ readonly then: {
2346
+ readonly required: readonly ["symbol"];
2347
+ };
2348
+ readonly else: {
2349
+ readonly not: {
2350
+ readonly required: readonly ["symbol"];
2351
+ };
2352
+ };
2353
+ }];
2354
+ };
2355
+ };
2356
+ readonly classShapes: {
2357
+ readonly type: "array";
2358
+ readonly items: {
2359
+ readonly type: "object";
2360
+ readonly additionalProperties: false;
2361
+ readonly required: readonly ["file", "className", "exported", "hasPublicMutableFields", "hasPublicSetters", "hasPublicConstructor", "hasStaticFactory", "mutatingMethods"];
2362
+ readonly properties: {
2363
+ readonly file: {
2364
+ readonly type: "string";
2365
+ readonly minLength: 1;
2366
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2367
+ };
2368
+ readonly className: {
2369
+ readonly type: "string";
2370
+ readonly minLength: 1;
2371
+ };
2372
+ readonly exported: {
2373
+ readonly type: "boolean";
2374
+ };
2375
+ readonly hasPublicMutableFields: {
2376
+ readonly type: "boolean";
2377
+ };
2378
+ readonly hasPublicSetters: {
2379
+ readonly type: "boolean";
2380
+ };
2381
+ readonly hasPublicConstructor: {
2382
+ readonly type: "boolean";
2383
+ };
2384
+ readonly hasStaticFactory: {
2385
+ readonly type: "boolean";
2386
+ };
2387
+ readonly dataOnly: {
2388
+ readonly type: "boolean";
2389
+ };
2390
+ readonly truncatedUntil: {
2391
+ readonly type: "integer";
2392
+ readonly minimum: 0;
2393
+ };
2394
+ readonly mutatingMethods: {
2395
+ readonly type: "array";
2396
+ readonly items: {
2397
+ readonly type: "object";
2398
+ readonly additionalProperties: false;
2399
+ readonly required: readonly ["name", "referencesGuardOrPublish"];
2400
+ readonly properties: {
2401
+ readonly name: {
2402
+ readonly type: "string";
2403
+ readonly minLength: 1;
2404
+ };
2405
+ readonly referencesGuardOrPublish: {
2406
+ readonly type: "boolean";
2407
+ };
2408
+ };
2409
+ };
2410
+ };
2411
+ };
2412
+ };
2413
+ };
2414
+ readonly arkRunKernelCalls: {
2415
+ readonly type: "array";
2416
+ readonly items: {
2417
+ readonly type: "object";
2418
+ readonly additionalProperties: false;
2419
+ readonly required: readonly ["file", "line", "kind", "callee", "viaImport"];
2420
+ readonly properties: {
2421
+ readonly file: {
2422
+ readonly type: "string";
2423
+ readonly minLength: 1;
2424
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2425
+ };
2426
+ readonly line: {
2427
+ readonly type: "integer";
2428
+ readonly minimum: 1;
2429
+ };
2430
+ readonly kind: {
2431
+ readonly enum: readonly ["factory", "publisher", "publish", "raise", "send", "subscribe", "register-handler", "resolve", "resolve-singleton"];
2432
+ };
2433
+ readonly callee: {
2434
+ readonly type: "string";
2435
+ readonly minLength: 1;
2436
+ };
2437
+ readonly viaImport: {
2438
+ readonly type: "boolean";
2439
+ };
2440
+ readonly receiver: {
2441
+ readonly type: "string";
2442
+ readonly minLength: 1;
2443
+ };
2444
+ readonly nameLiteral: {
2445
+ readonly type: "string";
2446
+ readonly minLength: 1;
2447
+ };
2448
+ };
2449
+ };
2450
+ };
2451
+ readonly arkRunManagedNews: {
2452
+ readonly type: "array";
2453
+ readonly items: {
2454
+ readonly type: "object";
2455
+ readonly additionalProperties: false;
2456
+ readonly required: readonly ["file", "line", "typeName"];
2457
+ readonly properties: {
2458
+ readonly file: {
2459
+ readonly type: "string";
2460
+ readonly minLength: 1;
2461
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2462
+ };
2463
+ readonly line: {
2464
+ readonly type: "integer";
2465
+ readonly minimum: 1;
2466
+ };
2467
+ readonly typeName: {
2468
+ readonly type: "string";
2469
+ readonly minLength: 1;
2470
+ };
2471
+ readonly importedFrom: {
2472
+ readonly type: "string";
2473
+ readonly minLength: 1;
2474
+ };
2475
+ };
2476
+ };
2477
+ };
2478
+ readonly arkRunCompositionRootHits: {
2479
+ readonly type: "array";
2480
+ readonly items: {
2481
+ readonly type: "object";
2482
+ readonly additionalProperties: false;
2483
+ readonly required: readonly ["file", "matchedRoot", "hasKernelFactory"];
2484
+ readonly properties: {
2485
+ readonly file: {
2486
+ readonly type: "string";
2487
+ readonly minLength: 1;
2488
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2489
+ };
2490
+ readonly matchedRoot: {
2491
+ readonly type: "string";
2492
+ readonly minLength: 1;
2493
+ };
2494
+ readonly hasKernelFactory: {
2495
+ readonly type: "boolean";
2496
+ };
2497
+ };
2498
+ };
2499
+ };
2500
+ readonly arkRunDeclarations: {
2501
+ readonly type: "array";
2502
+ readonly items: {
2503
+ readonly type: "object";
2504
+ readonly additionalProperties: false;
2505
+ readonly required: readonly ["file", "line", "uses", "reactsTo", "raises", "sends"];
2506
+ readonly properties: {
2507
+ readonly file: {
2508
+ readonly type: "string";
2509
+ readonly minLength: 1;
2510
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2511
+ };
2512
+ readonly line: {
2513
+ readonly type: "integer";
2514
+ readonly minimum: 1;
2515
+ };
2516
+ readonly uses: {
2517
+ readonly type: "array";
2518
+ readonly items: {
2519
+ readonly type: "string";
2520
+ readonly minLength: 1;
2521
+ };
2522
+ };
2523
+ readonly reactsTo: {
2524
+ readonly type: "array";
2525
+ readonly items: {
2526
+ readonly type: "string";
2527
+ readonly minLength: 1;
2528
+ };
2529
+ };
2530
+ readonly raises: {
2531
+ readonly type: "array";
2532
+ readonly items: {
2533
+ readonly type: "string";
2534
+ readonly minLength: 1;
2535
+ };
2536
+ };
2537
+ readonly sends: {
2538
+ readonly type: "array";
2539
+ readonly items: {
2540
+ readonly type: "string";
2541
+ readonly minLength: 1;
2542
+ };
2543
+ };
2544
+ };
2545
+ };
2546
+ };
2547
+ readonly arkOrderPlaneCalls: {
2548
+ readonly type: "array";
2549
+ readonly items: {
2550
+ readonly type: "object";
2551
+ readonly additionalProperties: false;
2552
+ readonly required: readonly ["file", "line", "callee"];
2553
+ readonly properties: {
2554
+ readonly file: {
2555
+ readonly type: "string";
2556
+ readonly minLength: 1;
2557
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2558
+ };
2559
+ readonly line: {
2560
+ readonly type: "integer";
2561
+ readonly minimum: 1;
2562
+ };
2563
+ readonly callee: {
2564
+ readonly type: "string";
2565
+ readonly minLength: 1;
2566
+ };
2567
+ };
2568
+ };
2569
+ };
2570
+ readonly arkOrderGenericUpdates: {
2571
+ readonly type: "array";
2572
+ readonly items: {
2573
+ readonly type: "object";
2574
+ readonly additionalProperties: false;
2575
+ readonly required: readonly ["file", "line", "method"];
2576
+ readonly properties: {
2577
+ readonly file: {
2578
+ readonly type: "string";
2579
+ readonly minLength: 1;
2580
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2581
+ };
2582
+ readonly line: {
2583
+ readonly type: "integer";
2584
+ readonly minimum: 1;
2585
+ };
2586
+ readonly method: {
2587
+ readonly type: "string";
2588
+ readonly minLength: 1;
2589
+ };
2590
+ };
2591
+ };
2592
+ };
2593
+ readonly arkOrderRootHits: {
2594
+ readonly type: "array";
2595
+ readonly items: {
2596
+ readonly type: "object";
2597
+ readonly additionalProperties: false;
2598
+ readonly required: readonly ["file", "matchedRoot", "hasPlaneFactory"];
2599
+ readonly properties: {
2600
+ readonly file: {
2601
+ readonly type: "string";
2602
+ readonly minLength: 1;
2603
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2604
+ };
2605
+ readonly matchedRoot: {
2606
+ readonly type: "string";
2607
+ readonly minLength: 1;
2608
+ };
2609
+ readonly hasPlaneFactory: {
2610
+ readonly type: "boolean";
2611
+ };
2612
+ };
2613
+ };
2614
+ };
2615
+ readonly arkOrderXiFieldWrites: {
2616
+ readonly type: "array";
2617
+ readonly items: {
2618
+ readonly type: "object";
2619
+ readonly additionalProperties: false;
2620
+ readonly required: readonly ["file", "line", "key"];
2621
+ readonly properties: {
2622
+ readonly file: {
2623
+ readonly type: "string";
2624
+ readonly minLength: 1;
2625
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2626
+ };
2627
+ readonly line: {
2628
+ readonly type: "integer";
2629
+ readonly minimum: 1;
2630
+ };
2631
+ readonly key: {
2632
+ readonly type: "string";
2633
+ readonly minLength: 1;
2634
+ };
2635
+ };
2636
+ };
2637
+ };
2638
+ readonly arkOrderIngestWritesXi: {
2639
+ readonly type: "array";
2640
+ readonly items: {
2641
+ readonly type: "object";
2642
+ readonly additionalProperties: false;
2643
+ readonly required: readonly ["file", "line"];
2644
+ readonly properties: {
2645
+ readonly file: {
2646
+ readonly type: "string";
2647
+ readonly minLength: 1;
2648
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2649
+ };
2650
+ readonly line: {
2651
+ readonly type: "integer";
2652
+ readonly minimum: 1;
2653
+ };
2654
+ };
2655
+ };
2656
+ };
2657
+ readonly arkOrderReleaseKeyCounts: {
2658
+ readonly type: "array";
2659
+ readonly items: {
2660
+ readonly type: "object";
2661
+ readonly additionalProperties: false;
2662
+ readonly required: readonly ["file", "line", "keyCount"];
2663
+ readonly properties: {
2664
+ readonly file: {
2665
+ readonly type: "string";
2666
+ readonly minLength: 1;
2667
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2668
+ };
2669
+ readonly line: {
2670
+ readonly type: "integer";
2671
+ readonly minimum: 1;
2672
+ };
2673
+ readonly keyCount: {
2674
+ readonly type: "integer";
2675
+ readonly minimum: 1;
2676
+ };
2677
+ };
2678
+ };
2679
+ };
2680
+ readonly arkOrderXiTtlKeys: {
2681
+ readonly type: "array";
2682
+ readonly items: {
2683
+ readonly type: "object";
2684
+ readonly additionalProperties: false;
2685
+ readonly required: readonly ["file", "line", "key"];
2686
+ readonly properties: {
2687
+ readonly file: {
2688
+ readonly type: "string";
2689
+ readonly minLength: 1;
2690
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2691
+ };
2692
+ readonly line: {
2693
+ readonly type: "integer";
2694
+ readonly minimum: 1;
2695
+ };
2696
+ readonly key: {
2697
+ readonly type: "string";
2698
+ readonly minLength: 1;
2699
+ };
2700
+ };
2701
+ };
2702
+ };
2703
+ readonly arkOrderBudgetLeaks: {
2704
+ readonly type: "array";
2705
+ readonly items: {
2706
+ readonly type: "object";
2707
+ readonly additionalProperties: false;
2708
+ readonly required: readonly ["file", "line", "kind"];
2709
+ readonly properties: {
2710
+ readonly file: {
2711
+ readonly type: "string";
2712
+ readonly minLength: 1;
2713
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2714
+ };
2715
+ readonly line: {
2716
+ readonly type: "integer";
2717
+ readonly minimum: 1;
2718
+ };
2719
+ readonly kind: {
2720
+ readonly type: "string";
2721
+ readonly minLength: 1;
2722
+ };
2723
+ };
2724
+ };
2725
+ };
2726
+ readonly factsHash: {
2727
+ readonly type: "string";
2728
+ readonly minLength: 1;
2729
+ };
2730
+ };
2731
+ readonly allOf: readonly [{
2732
+ readonly if: {
2733
+ readonly properties: {
2734
+ readonly completeness: {
2735
+ readonly const: "complete";
2736
+ };
2737
+ };
2738
+ };
2739
+ readonly then: {
2740
+ readonly properties: {
2741
+ readonly completenessReasons: {
2742
+ readonly maxItems: 0;
2743
+ };
2744
+ readonly files: {
2745
+ readonly items: {
2746
+ readonly properties: {
2747
+ readonly parseStatus: {
2748
+ readonly const: "parsed";
2749
+ };
2750
+ };
2751
+ };
2752
+ };
2753
+ };
2754
+ };
2755
+ }, {
2756
+ readonly if: {
2757
+ readonly properties: {
2758
+ readonly completeness: {
2759
+ readonly enum: readonly ["partial", "unavailable"];
2760
+ };
2761
+ };
2762
+ };
2763
+ readonly then: {
2764
+ readonly properties: {
2765
+ readonly completenessReasons: {
2766
+ readonly minItems: 1;
2767
+ };
2768
+ };
2769
+ };
2770
+ }];
2771
+ };
2772
+
2773
+ /**
2774
+ * Stable, pure vocabulary for ArkGate's importable analysis engine.
2775
+ *
2776
+ * This module owns the Analysis IR types and re-exports the resolved-candidate-facts
2777
+ * pilot cluster (plan-B / pattern-b:god-module). Parsing and filesystem discovery
2778
+ * belong to adapters.
2779
+ *
2780
+ * Cluster:
2781
+ * - `stableHash` — identity/fingerprint primitives
2782
+ * - `resolvedCandidateFactsTypes` — versioned fact types
2783
+ * - `resolvedCandidateFacts` — create/load/canonicalize
2784
+ * - `resolvedCandidateFactsSchema` — published JSON Schema
2785
+ *
2786
+ * Consumer import paths through this facade remain stable (same pattern as Kernel
2787
+ * `analysis.ts` after U02).
2788
+ */
2789
+
2790
+ declare const ANALYSIS_IR_SCHEMA_VERSION: "1.0";
2791
+ type AnalysisFileInput = {
2792
+ path: string;
2793
+ content: string;
2794
+ };
2795
+ type AnalysisFileChange = {
2796
+ path: string;
2797
+ content: string;
2798
+ } | {
2799
+ path: string;
2800
+ delete: true;
2801
+ };
2802
+ type AnalysisCompilerOptions = Readonly<Record<string, unknown>>;
2803
+ type AnalysisFile = AnalysisFileInput & {
2804
+ contentHash: string;
2805
+ layer: string | null;
2806
+ };
2807
+ type AnalysisImportEdge = {
2808
+ from: string;
2809
+ specifier: string;
2810
+ to: string | null;
2811
+ resolution: 'resolved' | 'unresolved';
2812
+ fromLayer: string | null;
2813
+ toLayer: string | null;
2814
+ evidence: AnalysisEvidence;
2815
+ };
2816
+ /** A capability use is reserved for C04's symbol-aware implementation. */
2817
+ type AnalysisCapabilityUse = {
2818
+ file: string;
2819
+ symbol: string;
2820
+ capability: string;
2821
+ evidence: AnalysisEvidence;
2822
+ };
2823
+ type AnalysisEvidence = {
2824
+ kind: 'import' | 'policy';
2825
+ file: string;
2826
+ line: number;
2827
+ excerpt: string;
2828
+ };
2829
+ type AnalysisViolation = {
2830
+ ruleId: string;
2831
+ message: string;
2832
+ edge?: AnalysisImportEdge;
2833
+ /** U04 (additive): present on CAPABILITY_VIOLATION — the denied capability id. */
2834
+ capability?: string;
2835
+ /** U04 (additive): the matched module specifier or ambient path. */
2836
+ symbol?: string;
2837
+ evidence: AnalysisEvidence;
2838
+ };
2839
+ type AnalysisIr = {
2840
+ schemaVersion: typeof ANALYSIS_IR_SCHEMA_VERSION;
2841
+ policyHash: string;
2842
+ compilerOptionsHash: string;
2843
+ files: AnalysisFile[];
2844
+ layers: string[];
2845
+ edges: AnalysisImportEdge[];
2846
+ capabilityUses: AnalysisCapabilityUse[];
2847
+ violations: AnalysisViolation[];
2848
+ };
2849
+
2850
+ declare const ARK_CHANGE_MAP_SCHEMA_VERSION: "1.0";
2851
+ type ArchitectureChangeOperation = 'create' | 'update' | 'delete';
2852
+ type ArchitectureChangeMapFile = {
2853
+ path: string;
2854
+ operation: ArchitectureChangeOperation;
2855
+ layer: string;
2856
+ };
2857
+ type ArchitectureChangeMapDependency = {
2858
+ from: string;
2859
+ to: string;
2860
+ };
2861
+ type ArchitectureChangeMap = {
2862
+ $schema: string;
2863
+ schemaVersion: typeof ARK_CHANGE_MAP_SCHEMA_VERSION;
2864
+ files: ArchitectureChangeMapFile[];
2865
+ dependencies: ArchitectureChangeMapDependency[];
2866
+ };
2867
+ type ArchitectureChangeMapContract = {
2868
+ map: ArchitectureChangeMap;
2869
+ hash: string;
2870
+ };
2871
+
2872
+ type ArchitectureDependency = {
2873
+ from: string;
2874
+ to: string;
2875
+ };
2876
+ type ArchitectureActualChange = {
2877
+ path: string;
2878
+ operation: ArchitectureChangeOperation;
2879
+ };
2880
+ type ArchitectureConvergenceClassification = 'satisfied' | 'missing' | 'contradictory' | 'unplanned';
2881
+ type ArchitectureConvergenceFinding = {
2882
+ id: string;
2883
+ classification: ArchitectureConvergenceClassification;
2884
+ subject: 'file' | 'dependency';
2885
+ message: string;
2886
+ nextAction?: string;
2887
+ path?: string;
2888
+ from?: string;
2889
+ to?: string;
2890
+ expectedOperation?: ArchitectureChangeOperation;
2891
+ actualOperation?: ArchitectureChangeOperation | 'added' | 'removed';
2892
+ };
2893
+ type ArchitectureConvergenceResult = {
2894
+ schemaVersion: '1.0';
2895
+ readOnly: true;
2896
+ changeMapHash: string;
2897
+ structurallyConverged: boolean;
2898
+ behavioralCompletion: 'not-evaluated';
2899
+ summary: Record<ArchitectureConvergenceClassification, number>;
2900
+ findings: ArchitectureConvergenceFinding[];
2901
+ };
2902
+ type AnalyzeArchitectureConvergenceInput = {
2903
+ changeMap: ArchitectureChangeMapContract;
2904
+ changes: readonly ArchitectureActualChange[];
2905
+ baseDependencies: readonly ArchitectureDependency[];
2906
+ candidateDependencies: readonly ArchitectureDependency[];
2907
+ };
2908
+ declare function analyzeArchitectureConvergence(input: AnalyzeArchitectureConvergenceInput): ArchitectureConvergenceResult;
2909
+
2910
+ type SemanticDependencyKind = 'import' | 'export' | 'dynamic-import' | 'require';
2911
+ type SemanticDependency = {
2912
+ specifier?: string;
2913
+ kind: SemanticDependencyKind;
2914
+ line: number;
2915
+ typeOnly: boolean;
2916
+ unresolved: boolean;
2917
+ node: unknown;
2918
+ };
2919
+ type ForbiddenCapabilityUse = {
2920
+ name: string;
2921
+ line: number;
2922
+ node: unknown;
2923
+ };
2924
+ /** Extract every dependency form whose specifier is statically knowable, plus unresolved calls. */
2925
+ declare function extractSemanticDependencies(ts: any, sourceFile: any): SemanticDependency[];
2926
+ /** Resolve forbidden ambient capabilities through symbols, aliases, globalThis, and static keys. */
2927
+ declare function collectForbiddenCapabilityUses(ts: any, sourceFile: any, forbidden: readonly string[]): ForbiddenCapabilityUse[];
2928
+
2929
+ type LayerFlowConfigShape = {
2930
+ layers: readonly {
2931
+ name: string;
2932
+ intentPrefixes?: readonly string[];
2933
+ }[];
2934
+ rules?: readonly {
2935
+ from: string;
2936
+ to: string;
2937
+ allowed?: boolean;
2938
+ peerIsolation?: boolean;
2939
+ }[];
2940
+ };
2941
+
2942
+ /**
2943
+ * Pure invariant coverage evidence (ADR 0014 / AR09–AR10).
2944
+ *
2945
+ * Mines test titles and symbol declarations against the Effective ArkRules catalog.
2946
+ * `classifyCoverage` returns one verdict; `countsAsCoverage` is the policy;
2947
+ * `describeCoverage` is the sentence. A bare mention is never coverage.
2948
+ * No filesystem — Tooling supplies file contents and test globs.
2949
+ */
2950
+
2951
+ /**
2952
+ * How a `coverage.symbol` identifier is declared. `type`, `interface`, and
2953
+ * `enum` are declarations — the same witness as function, class, const, and
2954
+ * method.
2955
+ */
2956
+ type DeclarationShape = 'function' | 'class' | 'const' | 'method' | 'type' | 'interface' | 'enum';
2957
+ /** Where a bare mention of an id or symbol sat. Never coverage. */
2958
+ type MentionContext = 'test-body' | 'comment' | 'string' | 'import';
2959
+ /**
2960
+ * One coverage verdict. Best evidence wins: test-title, then declaration,
2961
+ * then mention-only, then none. A comment in another file, when the symbol
2962
+ * still occurs in code, is `declaration-miss` and does not count.
2963
+ * Regexes, the test-file vs source split, and `Aggregate.method` lookup stay
2964
+ * behind this value.
2965
+ */
2966
+ type CoverageEvidence = {
2967
+ kind: 'test-title';
2968
+ file: string;
2969
+ title: string;
2970
+ } | {
2971
+ kind: 'declaration';
2972
+ file: string;
2973
+ shape: DeclarationShape;
2974
+ } | {
2975
+ kind: 'mention-only';
2976
+ file: string;
2977
+ context: MentionContext;
2978
+ } | {
2979
+ kind: 'declaration-miss';
2980
+ symbol: string;
2981
+ } | {
2982
+ kind: 'none';
2983
+ };
2984
+ /** Invariant fields the classifier reads. A full catalog entry is assignable. */
2985
+ type CoverageInvariant = {
2986
+ id: string;
2987
+ coverage?: {
2988
+ test?: boolean;
2989
+ symbol?: string;
2990
+ } | null;
2991
+ };
2992
+ /** File set the classifier reads. Tooling has already loaded the contents. */
2993
+ type CoverageFiles = {
2994
+ /** Project-relative path → file contents (tests and sources). */
2995
+ fileContents: Readonly<Record<string, string>>;
2996
+ /** Paths already classified as tests. */
2997
+ testFiles?: readonly string[];
2998
+ /**
2999
+ * Declared runner roots. A test title inside a root beats one outside it.
3000
+ * The outside-roots finding stays a separate verdict.
3001
+ */
3002
+ coverageRoots?: readonly string[];
3003
+ };
3004
+ type InvariantCoverageEvidence = {
3005
+ invariantId: string;
3006
+ layer: string;
3007
+ sourceFile: string;
3008
+ mode: 'advisory' | 'enforced';
3009
+ covered: boolean;
3010
+ evidence: Array<'test-title' | 'symbol'>;
3011
+ /** When no test globs were supplied, coverage cannot be proven. */
3012
+ partial: boolean;
3013
+ description: string;
3014
+ /** Test file that supplied the `test-title` evidence, when there was one. */
3015
+ testEvidenceFile?: string;
3016
+ /**
3017
+ * Non-test file that declares `coverage.symbol`. Absent when the name only
3018
+ * appears in an import or a call. ArkGate never runs tests; this path is the
3019
+ * declaration text, not a passing suite.
3020
+ */
3021
+ symbolEvidenceFile?: string;
3022
+ /**
3023
+ * Declaration shape when `evidence` includes `symbol`. Additive: readers that
3024
+ * only know `test-title` | `symbol` ignore it.
3025
+ */
3026
+ shape?: DeclarationShape;
3027
+ /**
3028
+ * The only covering test found sits outside `coverage.coverageRoots` — the
3029
+ * places the project declares its runner executes. ArkGate never runs tests,
3030
+ * so a title match outside those roots is a test that exists, not a test that
3031
+ * runs. Absent (undefined) when no roots were declared: without a declaration
3032
+ * there is nothing to compare against, and silence is honest.
3033
+ */
3034
+ outsideDeclaredRoots?: boolean;
3035
+ /**
3036
+ * True when `coverage.coverageRoots` was non-empty for this evaluation.
3037
+ * `false` when the project declared nothing. Omitted on hand-built evidence
3038
+ * so existing promote fixtures stay valid; the evaluator always sets it.
3039
+ */
3040
+ coverageRootsDeclared?: boolean;
3041
+ };
3042
+ type InvariantUncoveredKind = 'never-had-tests' | 'tests-disappeared';
3043
+ type InvariantCoverageRuleId = 'INVARIANT_UNCOVERED' | 'INVARIANT_COVERAGE_OUTSIDE_ROOTS';
3044
+ type InvariantCoverageViolation = {
3045
+ ruleId: InvariantCoverageRuleId;
3046
+ message: string;
3047
+ file: string;
3048
+ line: number;
3049
+ arkruleId: string;
3050
+ arkruleSource: string;
3051
+ fromLayer: string;
3052
+ severity: 'error' | 'warning';
3053
+ failsStrict: boolean;
3054
+ /**
3055
+ * Adopt residual (no test suite) vs regression (suite exists, coverage gone).
3056
+ * Only INVARIANT_UNCOVERED carries it: an outside-roots finding is about
3057
+ * WHERE the covering test lives, not about whether one exists.
3058
+ */
3059
+ kind?: InvariantUncoveredKind;
3060
+ };
3061
+ type EvaluateInvariantCoverageInput = {
3062
+ arkRules: EffectiveArkRules;
3063
+ /** Project-relative path → file contents (tests + domain sources). */
3064
+ fileContents: Readonly<Record<string, string>>;
3065
+ /** Paths considered tests (already filtered by Tooling via globs). */
3066
+ testFiles?: readonly string[];
3067
+ /** When true, missing test files make coverage partial (never green covered). */
3068
+ testGlobsMissing?: boolean;
3069
+ /**
3070
+ * Tooling hit MAX_COVERAGE_FILES. Partial must not claim the repo never had tests —
3071
+ * the suite may exist outside the scan budget.
3072
+ */
3073
+ coverageBudgetExhausted?: boolean;
3074
+ /** Numbers behind the scan: what was loaded, what was discarded and why. */
3075
+ coverageStats?: InvariantCoverageStats;
3076
+ /**
3077
+ * Declared (`coverage.coverageRoots`) path prefixes where the project says its
3078
+ * runner actually executes tests. ArkGate never executes anything: this is a
3079
+ * second DECLARATION to compare the first against. Absent or empty means no
3080
+ * declaration was made, so no outside-roots claim is possible.
3081
+ */
3082
+ coverageRoots?: readonly string[];
3083
+ };
3084
+ /**
3085
+ * What the Tooling scan actually saw. Every discard has a counted reason —
3086
+ * a silent drop would make an uncovered verdict unexplainable.
3087
+ */
3088
+ type InvariantCoverageStats = {
3089
+ /**
3090
+ * Files actually opened and read. Always >= filesLoaded: a test is read
3091
+ * before it can be judged for naming an invariant, so the file budget bounds
3092
+ * RETENTION, not I/O. Reporting only the retained count made
3093
+ * `coverage.maxFiles` read as a knob on how much the scan opens.
3094
+ */
3095
+ filesRead?: number;
3096
+ /** Files retained as coverage evidence (tests + production). */
3097
+ filesLoaded: number;
3098
+ /** Test files retained (subset of filesLoaded). */
3099
+ testFilesRetained: number;
3100
+ /** The file budget in force for this scan (config `coverage.maxFiles` or the default). */
3101
+ maxFiles: number;
3102
+ discarded: {
3103
+ /** Reached the file budget. */
3104
+ budget: number;
3105
+ /** Test file naming no catalogued invariant (scanned, then dropped). */
3106
+ noInvariantMention: number;
3107
+ /** Larger than the per-file byte cap. */
3108
+ oversize: number;
3109
+ /**
3110
+ * stat/read failed on a file or a directory: permissions, a broken symlink,
3111
+ * or something that moved mid-scan. Files and directories share one counter.
3112
+ */
3113
+ unreadable: number;
3114
+ /** Directory deeper than the walk depth limit — its files were never seen. */
3115
+ depthLimited: number;
3116
+ /**
3117
+ * Symlink inside the tree whose target resolves outside the project root.
3118
+ * Refused as evidence: a file that is not in this repo must not prove an
3119
+ * invariant covered.
3120
+ */
3121
+ outOfRoot: number;
3122
+ };
3123
+ };
3124
+ /**
3125
+ * Best coverage evidence for `invariant` in `files`.
3126
+ * test-title beats a declaration; a declaration beats a bare mention; a bare
3127
+ * mention beats silence. Callers do not re-scan to explain the verdict.
3128
+ */
3129
+ declare function classifyCoverage(invariant: CoverageInvariant, files: CoverageFiles): CoverageEvidence;
3130
+ /**
3131
+ * Policy: a test title or any declaration counts, including type, interface,
3132
+ * and enum. A mention-only verdict never counts. `none` does not count.
3133
+ */
3134
+ declare function countsAsCoverage(ev: CoverageEvidence): boolean;
3135
+ /** Sentence for the verdict. `INVARIANT_UNCOVERED` prints this; it does not re-derive it. */
3136
+ declare function describeCoverage(invariant: CoverageInvariant, ev: CoverageEvidence): string;
3137
+ declare function evaluateInvariantCoverage(input: EvaluateInvariantCoverageInput): {
3138
+ coverage: InvariantCoverageEvidence[];
3139
+ violations: InvariantCoverageViolation[];
3140
+ partial: boolean;
3141
+ };
3142
+ /**
3143
+ * Deterministic promotion gate: refuse advisory→enforced when invariant is uncovered.
3144
+ */
3145
+ declare function canPromoteInvariant(coverage: InvariantCoverageEvidence | undefined): {
3146
+ ok: boolean;
3147
+ reason: string;
3148
+ };
3149
+
3150
+ /**
3151
+ * Pure ArkRules structure sensor evaluation (ADR 0013).
3152
+ *
3153
+ * Consumes closed class-shape / file facts + Effective ArkRules. Emits violations with
3154
+ * arkrule provenance. No filesystem, no TypeScript compiler.
3155
+ */
3156
+
3157
+ type ClassShapeFact = {
3158
+ file: string;
3159
+ className: string;
3160
+ exported: boolean;
3161
+ hasPublicMutableFields: boolean;
3162
+ hasPublicSetters: boolean;
3163
+ hasPublicConstructor: boolean;
3164
+ hasStaticFactory: boolean;
3165
+ mutatingMethods: readonly {
3166
+ name: string;
3167
+ referencesGuardOrPublish: boolean;
3168
+ }[];
3169
+ /** Heuristic: data-only class (fields, no methods beyond accessors). */
3170
+ dataOnly?: boolean;
3171
+ /**
3172
+ * Set when the scanner could not walk the class to its end: the character
3173
+ * offset (in the source file) where analysis stopped. Enumerable on purpose so
3174
+ * it survives fact canonicalisation and serialisation; enforced structure
3175
+ * sensors report it instead of passing in silence.
3176
+ */
3177
+ truncatedUntil?: number;
3178
+ };
3179
+ type ArkRuleSensorViolation = {
3180
+ ruleId: string;
3181
+ code: string;
3182
+ message: string;
3183
+ file: string;
3184
+ line: number;
3185
+ fromLayer?: string;
3186
+ arkruleId: string;
3187
+ arkruleSource: string;
3188
+ severity: 'error' | 'warning';
3189
+ sensor: ArkRuleSensorId;
3190
+ /** When true, advisory surfaces only (does not fail strict). */
3191
+ failsStrict: boolean;
3192
+ };
3193
+ type EvaluateArkRuleSensorsInput = {
3194
+ arkRules: EffectiveArkRules;
3195
+ classShapes: readonly ClassShapeFact[];
3196
+ /** Project-relative paths in scope for the analysis. */
3197
+ files: readonly string[];
3198
+ /**
3199
+ * Optional layer membership: path → layer name. When omitted, structure rules
3200
+ * apply by appliesTo globs only (or all files when appliesTo is absent).
3201
+ */
3202
+ layerForFile?: (path: string) => string | null | undefined;
3203
+ /**
3204
+ * Optional thin/orchestration heuristic flags per file (Tooling-supplied).
3205
+ */
3206
+ fileHints?: Readonly<Record<string, {
3207
+ orchestrationHeavy?: boolean;
3208
+ adapterThick?: boolean;
3209
+ persistenceWrite?: boolean;
3210
+ }>>;
3211
+ };
3212
+ /**
3213
+ * Evaluate all structure sensors. Empty Effective Contract → no findings (byte-for-byte parity).
3214
+ */
3215
+ declare function evaluateArkRuleSensors(input: EvaluateArkRuleSensorsInput): ArkRuleSensorViolation[];
3216
+ /**
3217
+ * ADR 0012 D3 — a structure rule whose appliesTo matches zero governed files is
3218
+ * never silent green. Advisory → warning; enforced → failsStrict.
3219
+ * Rules without appliesTo (whole-layer) never emit this signal.
3220
+ */
3221
+ declare function collectEmptyAppliesToFindings(arkRules: EffectiveArkRules, files: readonly string[]): ArkRuleSensorViolation[];
3222
+ /**
3223
+ * IO / ORM import evidence and receiver-bound write tokens live in
3224
+ * persistenceWriteHint (shared with ArkOrder — one definition, not lockstep copies).
3225
+ * Callee must be a persistence client (db|tx|client|prisma|drizzle, `new PrismaClient()`,
3226
+ * or a name bound to a driver constructor); not repo.update(.
3227
+ */
3228
+ /** Optional resolved-import facts when the collector already classified the specifier. */
3229
+ type ResolvedPersistenceImportFact = {
3230
+ specifier?: string;
3231
+ resolvedFile?: string;
3232
+ layer?: string | null;
3233
+ };
3234
+ /**
3235
+ * Pure Tooling/Domain heuristic for orchestration-only / thin-adapter fileHints.
3236
+ * Prefers false negatives over false positives (ADR 0013 discipline).
3237
+ * Returns null when neither flag is set (callers may omit the path).
3238
+ */
3239
+ declare function deriveArkRuleFileHints(_file: string, content: string, resolvedImports?: readonly ResolvedPersistenceImportFact[]): {
3240
+ orchestrationHeavy?: boolean;
3241
+ adapterThick?: boolean;
3242
+ persistenceWrite?: boolean;
3243
+ } | null;
3244
+ /**
3245
+ * Build fileHints map from path→content. Omits paths with no flags (sparse map).
3246
+ */
3247
+ declare function buildArkRuleFileHints(fileContents: Readonly<Record<string, string>>, resolvedImportsByFile?: Readonly<Record<string, readonly ResolvedPersistenceImportFact[]>>): Record<string, {
3248
+ orchestrationHeavy?: boolean;
3249
+ adapterThick?: boolean;
3250
+ persistenceWrite?: boolean;
3251
+ }>;
3252
+ /**
3253
+ * Lightweight class-shape extraction from TypeScript source text (no compiler).
3254
+ * Conservative: prefers false negatives over false positives for mutability.
3255
+ * Tooling may replace with TypeScript-API facts; sensors consume the same shape.
3256
+ *
3257
+ * The header and body are walked by the shared tokenizer (classSourceScan):
3258
+ * type parameters (`class Box<T>`), generic `extends` / `implements` clauses, and
3259
+ * braces inside strings, comments, or template literals are handled. A class whose
3260
+ * header or body cannot be walked is still reported, with a truncation mark, so
3261
+ * enforced sensors say so instead of passing in silence.
3262
+ *
3263
+ * Limitation (AR05/AR06): only `export class` / `export abstract class` forms.
3264
+ * `export default class`, re-exported classes, and non-exported aggregates are
3265
+ * invisible — enforced structure sensors stay silent (false negative). Silence
3266
+ * is never proof of compliance.
3267
+ */
3268
+ declare function extractClassShapesFromSource(file: string, content: string): ClassShapeFact[];
3269
+
3270
+ /**
3271
+ * Config-key version floors plus pin evidence (#338).
3272
+ *
3273
+ * A slice key such as `childSlices` is rejected at config load by an older
3274
+ * arkgate (the rule schema sets `additionalProperties: false`). ArkGate warns
3275
+ * about that only with evidence that this repo pins such an older arkgate: an
3276
+ * exact package.json dependency, the installed copy, the lockfile, a hook
3277
+ * script, or a CI workflow. Without evidence it stays silent.
3278
+ *
3279
+ * Pure: Tooling reads the files and passes their text here.
3280
+ */
3281
+ /** Where a pin was found. */
3282
+ type ArkgatePinSource = 'package-json' | 'package-lock' | 'installed' | 'hook' | 'ci';
3283
+ type ArkgatePinEvidence = {
3284
+ /** Repo-relative file that pins arkgate. */
3285
+ file: string;
3286
+ /** 1-based line of the pin. */
3287
+ line: number;
3288
+ /** Pinned version, without a leading `v`. */
3289
+ version: string;
3290
+ source: ArkgatePinSource;
3291
+ };
3292
+
3293
+ declare const POLICY_DELTA_SCHEMA_VERSION: "1.0";
3294
+ type PolicyDeltaClassification = 'strengthening' | 'neutral' | 'judgment-required' | 'weakening';
3295
+ type PolicyDeltaFinding = {
3296
+ id: string;
3297
+ path: string;
3298
+ classification: Exclude<PolicyDeltaClassification, 'neutral'>;
3299
+ message: string;
3300
+ nextAction?: string;
3301
+ before?: unknown;
3302
+ after?: unknown;
3303
+ };
3304
+ type PolicyDelta = {
3305
+ schemaVersion: typeof POLICY_DELTA_SCHEMA_VERSION;
3306
+ classification: PolicyDeltaClassification;
3307
+ findings: PolicyDeltaFinding[];
3308
+ };
3309
+ type PolicyDeltaAcknowledgement = {
3310
+ schemaVersion: typeof POLICY_DELTA_SCHEMA_VERSION;
3311
+ basePolicyHash: string;
3312
+ candidatePolicyHash: string;
3313
+ findingIds: readonly string[];
3314
+ reason: string;
3315
+ /**
3316
+ * Relative decision-note path under a conventional home (`docs/adr/`,
3317
+ * `docs/decisions/`, or the AP01 single-file homes). Tooling checks the file.
3318
+ * Hash matching does not require it.
3319
+ */
3320
+ adrPath?: string;
3321
+ };
3322
+ type ClassifyArkPolicyDeltaOptions = {
3323
+ baseArkRules?: EffectiveArkRules;
3324
+ candidateArkRules?: EffectiveArkRules;
3325
+ /**
3326
+ * AR11 — coverage evidence for candidate invariants. Required to auto-allow
3327
+ * advisory→enforced promotion; without it (or when uncovered), promotion is
3328
+ * judgment-required / refused.
3329
+ */
3330
+ candidateInvariantCoverage?: readonly InvariantCoverageEvidence[];
3331
+ };
3332
+ declare function classifyArkPolicyDelta(base: ArkConfig, candidate: ArkConfig, options?: ClassifyArkPolicyDeltaOptions): PolicyDelta;
3333
+ declare function policyDeltaAcknowledgementMatches(acknowledgement: PolicyDeltaAcknowledgement | undefined, expected: {
3334
+ basePolicyHash: string;
3335
+ candidatePolicyHash: string;
3336
+ findingIds: readonly string[];
3337
+ }): boolean;
3338
+
3339
+ type AnalysisContract = ArkConfigLoadResult & {
3340
+ policyHash: string;
3341
+ /**
3342
+ * ADR 0012 Effective ArkRules (empty when arkRules is absent).
3343
+ * Included in policyHash when non-empty so arkrules edits invalidate identity.
3344
+ */
3345
+ arkRules?: EffectiveArkRules;
3346
+ /**
3347
+ * ADR 0013 class-shape facts for ArkRules sensors (Tooling-supplied).
3348
+ * Empty / absent when ArkRules are not active.
3349
+ */
3350
+ classShapes?: ClassShapeFact[];
3351
+ };
3352
+ type AnalyzeProjectInput = {
3353
+ contract: AnalysisContract;
3354
+ files: readonly AnalysisFileInput[];
3355
+ compilerOptions?: AnalysisCompilerOptions;
3356
+ };
3357
+ type AnalyzeChangeInput = AnalyzeProjectInput & {
3358
+ changes: readonly AnalysisFileChange[];
3359
+ changeMap?: ArchitectureChangeMapContract;
3360
+ };
3361
+ type AnalysisResult = {
3362
+ mode: 'lexical-compatibility';
3363
+ completeness: ResolvedFactsCompleteness;
3364
+ completenessReasons: ResolvedFactsReason[];
3365
+ valid: boolean;
3366
+ ir: AnalysisIr;
3367
+ };
3368
+ type AnalyzeResolvedProjectInput = {
3369
+ contract: AnalysisContract;
3370
+ facts: unknown;
3371
+ /** Tooling FS evidence of arkgate pins. Omitted: version-floor warnings stay silent. */
3372
+ arkgatePins?: readonly ArkgatePinEvidence[];
3373
+ /** The running arkgate version, for the version-floor nextAction. */
3374
+ runningArkgateVersion?: string;
3375
+ /**
3376
+ * D0 adopted or --require-gates / --strict-merge. When true, a missing
3377
+ * domain-invariant tests path fails closed. Omitted stays silent.
3378
+ */
3379
+ adopted?: boolean;
3380
+ /**
3381
+ * Tooling FS check for the declared tests path. `false` means empty on disk.
3382
+ * Omitted: a non-empty config declaration is enough.
3383
+ */
3384
+ invariantTestsPathPresent?: boolean;
3385
+ /**
3386
+ * Tooling FS check for declared `coverage.coverageRoots`. `false` means
3387
+ * missing or empty on disk. Omitted: a non-empty config declaration is enough.
3388
+ */
3389
+ coverageRootsPresent?: boolean;
3390
+ /**
3391
+ * AR10 — Tooling-supplied contents for invariant coverage evidence.
3392
+ * When omitted and the Effective Contract has invariants, coverage is partial
3393
+ * (never false green covered).
3394
+ */
3395
+ coverageInputs?: {
3396
+ fileContents: Readonly<Record<string, string>>;
3397
+ testFiles?: readonly string[];
3398
+ testGlobsMissing?: boolean;
3399
+ coverageBudgetExhausted?: boolean;
3400
+ /** Declared `coverage.coverageRoots`: where the project says its runner runs. */
3401
+ coverageRoots?: readonly string[];
3402
+ /** Counted scan facts: files loaded, tests retained, discards by reason. */
3403
+ stats?: InvariantCoverageStats;
3404
+ };
3405
+ /**
3406
+ * AR07 — Tooling-supplied orchestration/thin-adapter heuristics per file.
3407
+ * Prefer deriveArkRuleFileHints / buildArkRuleFileHints (Domain pure).
3408
+ * When omitted, orchestration-only, thin-adapter, and writes-via-aggregate
3409
+ * sensors stay silent.
3410
+ */
3411
+ fileHints?: Readonly<Record<string, {
3412
+ orchestrationHeavy?: boolean;
3413
+ adapterThick?: boolean;
3414
+ persistenceWrite?: boolean;
3415
+ }>>;
3416
+ };
3417
+ /** Tooling-supplied analysis evidence for one side (base or candidate) of a preflight. */
3418
+ type ResolvedAnalysisSideInputs = Pick<AnalyzeResolvedProjectInput, 'adopted' | 'invariantTestsPathPresent' | 'coverageRootsPresent' | 'coverageInputs' | 'fileHints'>;
3419
+ type PreflightResolvedChangeInput = {
3420
+ contract: AnalysisContract;
3421
+ baseFacts: unknown;
3422
+ candidateFacts: unknown;
3423
+ changes: readonly AnalysisFileChange[];
3424
+ changeMap?: ArchitectureChangeMapContract;
3425
+ /**
3426
+ * ArkRules evidence (coverage contents, structural hints) for the on-disk base and
3427
+ * the in-memory candidate, so preflight runs the same engine inputs as ark-check.
3428
+ */
3429
+ baseAnalysisInputs?: ResolvedAnalysisSideInputs;
3430
+ candidateAnalysisInputs?: ResolvedAnalysisSideInputs;
3431
+ };
3432
+ type ResolvedAnalysisFile = ResolvedFileFact & {
3433
+ layer: string | null;
3434
+ };
3435
+ type ResolvedAnalysisIr = {
3436
+ schemaVersion: '1.0';
3437
+ policyHash: string;
3438
+ compilerOptionsHash: string;
3439
+ files: ResolvedAnalysisFile[];
3440
+ layers: string[];
3441
+ edges: ArchitectureEngineEdge[];
3442
+ capabilityUses: ResolvedCapabilityFact[];
3443
+ violations: ArchitectureEngineViolation[];
3444
+ warnings: ArchitectureEngineViolation[];
3445
+ };
3446
+ type ResolvedSafetyReport = {
3447
+ tsSuppressions: {
3448
+ file: string;
3449
+ line: number;
3450
+ }[];
3451
+ anyCasts: {
3452
+ file: string;
3453
+ line: number;
3454
+ }[];
3455
+ nonLiteralDynamicImports: {
3456
+ file: string;
3457
+ line: number;
3458
+ kind: 'import' | 'require';
3459
+ }[];
3460
+ inMemoryProductionStores: {
3461
+ file: string;
3462
+ line: number;
3463
+ store: string;
3464
+ }[];
3465
+ disabledPeerIsolationRules: {
3466
+ from: string;
3467
+ to: string;
3468
+ }[];
3469
+ thresholds: {
3470
+ maxTsSuppressions: number;
3471
+ maxAnyCasts: number;
3472
+ };
3473
+ };
3474
+ type ResolvedAnalysisResult = {
3475
+ mode: 'resolved-candidate-facts';
3476
+ completeness: ResolvedFactsCompleteness;
3477
+ completenessReasons: ResolvedFactsReason[];
3478
+ valid: boolean;
3479
+ strictValid: boolean;
3480
+ policyHash: string;
3481
+ factsHash: ResolvedCandidateFacts['factsHash'];
3482
+ resolverIdentity: ResolvedCandidateFacts['resolverIdentity'];
3483
+ candidateTreeHash: ResolvedCandidateFacts['candidateTreeHash'];
3484
+ safety: ResolvedSafetyReport;
3485
+ ir: ResolvedAnalysisIr;
3486
+ };
3487
+ type ResolvedChangePreflightResult = {
3488
+ schemaVersion: '1.0';
3489
+ mode: 'resolved-candidate-facts';
3490
+ valid: boolean;
3491
+ readOnly: true;
3492
+ policyHash: string;
3493
+ resolverIdentity: string;
3494
+ compilerIdentity: string;
3495
+ compilerOptionsHash: string;
3496
+ tsconfigHash: string;
3497
+ baseCompilerOptionsHash: string;
3498
+ candidateCompilerOptionsHash: string;
3499
+ baseTsconfigHash: string;
3500
+ candidateTsconfigHash: string;
3501
+ evidenceRequirementsHash: string;
3502
+ baseFactsHash: string;
3503
+ candidateFactsHash: string;
3504
+ baseTreeHash: string;
3505
+ candidateTreeHash: string;
3506
+ baseCompleteness: ResolvedFactsCompleteness;
3507
+ candidateCompleteness: ResolvedFactsCompleteness;
3508
+ baseCompletenessReasons: ResolvedFactsReason[];
3509
+ candidateCompletenessReasons: ResolvedFactsReason[];
3510
+ changeMapHash?: string;
3511
+ convergence?: ArchitectureConvergenceResult;
3512
+ changes: PreparedChangeFile[];
3513
+ violations: ArchitectureEngineViolation[];
3514
+ warnings: ArchitectureEngineViolation[];
3515
+ };
3516
+ type AnalyzePolicyDeltaInput = {
3517
+ baseConfig: unknown;
3518
+ candidateConfig: unknown;
3519
+ acknowledgement?: PolicyDeltaAcknowledgement;
3520
+ baseSource?: string;
3521
+ candidateSource?: string;
3522
+ /** Optional pre-resolved Effective ArkRules for each side (ADR 0012 / AR02). */
3523
+ baseArkRules?: EffectiveArkRules;
3524
+ candidateArkRules?: EffectiveArkRules;
3525
+ /**
3526
+ * AR11 — optional coverage evidence for candidate invariants.
3527
+ * When omitted, advisory→enforced promotion is judgment-required (refuse auto-allow).
3528
+ */
3529
+ candidateInvariantCoverage?: readonly InvariantCoverageEvidence[];
3530
+ };
3531
+ type PolicyDeltaAnalysis = {
3532
+ schemaVersion: '1.0';
3533
+ basePolicyHash: string;
3534
+ candidatePolicyHash: string;
3535
+ classification: PolicyDeltaClassification;
3536
+ findings: PolicyDeltaFinding[];
3537
+ blockingFindingIds: string[];
3538
+ requiresAcknowledgement: boolean;
3539
+ acknowledged: boolean;
3540
+ valid: boolean;
3541
+ };
3542
+ type ArchitectureEngineViolation = {
3543
+ ruleId: string;
3544
+ message: string;
3545
+ file?: string;
3546
+ line?: number;
3547
+ target?: string;
3548
+ fromLayer?: string;
3549
+ toLayer?: string;
3550
+ nextAction?: string;
3551
+ [key: string]: unknown;
3552
+ };
3553
+ type ArchitectureEngineEdge = {
3554
+ from: string;
3555
+ fromLayer: string | null;
3556
+ to?: string;
3557
+ toLayer?: string;
3558
+ line: number;
3559
+ kind: string;
3560
+ typeOnly?: boolean;
3561
+ targetTypeOnlyExports?: boolean;
3562
+ sourcePureTypeModule?: boolean;
3563
+ namedBindingsTypeOnly?: boolean;
3564
+ portProofEligible?: boolean;
3565
+ };
3566
+ type EvaluateArchitectureGraphInput = {
3567
+ config: ArkConfig;
3568
+ rules: ArkConfig['rules'];
3569
+ files: readonly string[];
3570
+ contentViolations: readonly ArchitectureEngineViolation[];
3571
+ edges: readonly ArchitectureEngineEdge[];
3572
+ warnings?: readonly ArchitectureEngineViolation[];
3573
+ safety?: unknown;
3574
+ };
3575
+ type ArchitectureEngineResult = {
3576
+ violations: ArchitectureEngineViolation[];
3577
+ warnings: ArchitectureEngineViolation[];
3578
+ safety?: unknown;
3579
+ };
3580
+ type PreparedChangeFile = {
3581
+ path: string;
3582
+ operation: 'create' | 'update' | 'delete';
3583
+ beforeContentHash?: string;
3584
+ candidateContentHash?: string;
3585
+ };
3586
+ type ChangePreflightResult = {
3587
+ schemaVersion: '1.0';
3588
+ mode: 'lexical-compatibility';
3589
+ valid: boolean;
3590
+ readOnly: true;
3591
+ policyHash: string;
3592
+ compilerOptionsHash: string;
3593
+ baseTreeHash: string;
3594
+ candidateTreeHash: string;
3595
+ baseCompleteness: ResolvedFactsCompleteness;
3596
+ candidateCompleteness: ResolvedFactsCompleteness;
3597
+ baseCompletenessReasons: ResolvedFactsReason[];
3598
+ candidateCompletenessReasons: ResolvedFactsReason[];
3599
+ changeMapHash?: string;
3600
+ convergence?: ArchitectureConvergenceResult;
3601
+ changes: PreparedChangeFile[];
3602
+ violations: ArchitectureEngineViolation[];
3603
+ warnings: ArchitectureEngineViolation[];
3604
+ };
3605
+ type CollectAnalysisConfigWarningsInput = {
3606
+ config: ArkConfig;
3607
+ rules: ArkConfig['rules'];
3608
+ files: readonly string[];
3609
+ /**
3610
+ * Tooling FS evidence of arkgate pins in this repo (package.json, lockfile,
3611
+ * installed copy, hook scripts, CI). Omitted: version-floor warnings stay silent.
3612
+ */
3613
+ arkgatePins?: readonly ArkgatePinEvidence[];
3614
+ /** The running arkgate version. The version-floor nextAction targets it when newer. */
3615
+ runningArkgateVersion?: string;
3616
+ manifest?: {
3617
+ architecture?: {
3618
+ layers?: readonly {
3619
+ name?: string;
3620
+ prefixes?: readonly string[];
3621
+ }[];
3622
+ };
3623
+ };
3624
+ };
3625
+
649
3626
  /**
650
- * Stable identity: contract edits and MCP restarts must not change which project
651
- * this is. Callers must pass canonical real paths and a SHA-256 hex function.
3627
+ * Contract loading, project/change analysis, and policy-delta analysis
3628
+ * (U02 pilot 2). Reached through the src/kernel/analysis.ts facade; consumer
3629
+ * import paths never change.
652
3630
  */
653
- declare function createProjectId(resolvedRoot: string, resolvedConfigPath: string, sha256Hex: (value: string) => string): string;
654
- declare function createProjectIdentity(input: Omit<ProjectIdentity, 'schemaVersion'>): ProjectIdentity;
3631
+
3632
+ type LoadContractOptions = {
3633
+ /** Pre-resolved Effective ArkRules (from resolveEffectiveContract). */
3634
+ arkRules?: EffectiveArkRules;
3635
+ };
3636
+ declare function loadContract(input: unknown, source?: string, options?: LoadContractOptions): AnalysisContract;
3637
+ declare function analyzePolicyDelta(input: AnalyzePolicyDeltaInput): PolicyDeltaAnalysis;
3638
+ declare function analyzeProject(input: AnalyzeProjectInput): AnalysisResult;
3639
+ declare function analyzeChange(input: AnalyzeChangeInput): AnalysisResult;
3640
+ declare function explainViolation(violation: AnalysisViolation): string;
3641
+
3642
+ declare function detectArchitectureCycles(graph: ReadonlyMap<string, ReadonlySet<string>>): ArchitectureEngineViolation[];
3643
+ /** Canonical graph and layer-policy evaluator shared by library, CLI, and MCP adapters. */
3644
+ declare function evaluateArchitectureGraph(input: EvaluateArchitectureGraphInput): ArchitectureEngineResult;
655
3645
 
656
3646
  /**
657
- * Canonical, pure contract for arkrules/<Layer>.json (ADR 0012).
3647
+ * Pure evaluation of validated, resolver-supplied candidate facts (ADR 0011).
658
3648
  *
659
- * Tooling adapters own filesystem I/O; this module owns JSON parsing, validation,
660
- * diagnostics, and the published JSON Schema. The standalone CLI artifact is generated
661
- * into bin/lib/arkrules-contract.mjs + schemas/ark.arkrules.schema.json.
3649
+ * Filesystem discovery and TypeScript resolution remain Tooling concerns. This
3650
+ * module only classifies canonical paths against the supplied contract and
3651
+ * produces the one architecture verdict consumed by every resolved adapter.
662
3652
  */
663
3653
 
664
- declare const ARK_RULES_SCHEMA_VERSION: "1.0";
665
- /** Closed sensor vocabulary — keep in lockstep with arkRulesTypes.ARK_RULE_SENSOR_IDS. */
666
- declare const ARK_RULE_SENSORS: readonly ["aggregate-private-state", "always-valid-factory", "domain-event-on-mutation", "orchestration-only", "thin-adapter", "writes-via-aggregate", "no-anemic-model", "invariant-coverage"];
667
- declare const ARK_RULES_SCHEMA: {
668
- readonly $schema: "https://json-schema.org/draft/2020-12/schema";
669
- readonly $id: "https://unpkg.com/arkgate/schemas/ark.arkrules.schema.json";
670
- readonly title: "ArkGate ArkRules (intra-layer contract)";
671
- readonly description: "Per-layer structure sensors and invariant catalog consumed by the ArkGate Effective Contract.";
672
- readonly type: "object";
673
- readonly additionalProperties: false;
674
- readonly required: readonly ["schemaVersion", "layer"];
675
- readonly properties: {
676
- readonly $schema: {
677
- readonly type: "string";
678
- readonly minLength: 1;
679
- readonly default: "https://unpkg.com/arkgate/schemas/ark.arkrules.schema.json";
680
- };
681
- readonly schemaVersion: {
682
- readonly type: "string";
683
- readonly const: "1.0";
684
- readonly default: "1.0";
685
- };
686
- readonly layer: {
687
- readonly type: "string";
688
- readonly minLength: 1;
689
- };
690
- readonly structure: {
691
- readonly type: "array";
692
- readonly default: readonly [];
693
- readonly items: {
694
- readonly $ref: "#/$defs/structureEntry";
695
- };
696
- };
697
- readonly invariants: {
698
- readonly type: "array";
699
- readonly default: readonly [];
700
- readonly items: {
701
- readonly $ref: "#/$defs/invariantEntry";
702
- };
703
- };
704
- };
705
- readonly $defs: {
706
- readonly structureEntry: {
707
- readonly type: "object";
708
- readonly additionalProperties: false;
709
- readonly required: readonly ["id", "sensor"];
710
- readonly properties: {
711
- readonly id: {
712
- readonly type: "string";
713
- readonly minLength: 1;
714
- };
715
- readonly sensor: {
716
- readonly type: "string";
717
- readonly enum: readonly ["aggregate-private-state", "always-valid-factory", "domain-event-on-mutation", "orchestration-only", "thin-adapter", "writes-via-aggregate", "no-anemic-model", "invariant-coverage"];
718
- };
719
- readonly mode: {
720
- readonly type: "string";
721
- readonly enum: readonly ["advisory", "enforced"];
722
- readonly default: "advisory";
723
- };
724
- readonly appliesTo: {
725
- readonly type: "array";
726
- readonly items: {
727
- readonly type: "string";
728
- readonly minLength: 1;
729
- };
730
- readonly uniqueItems: true;
731
- };
732
- readonly description: {
733
- readonly type: "string";
734
- readonly minLength: 1;
735
- };
736
- };
737
- };
738
- readonly invariantEntry: {
739
- readonly type: "object";
740
- readonly additionalProperties: false;
741
- readonly required: readonly ["id", "description"];
742
- readonly properties: {
743
- readonly id: {
744
- readonly type: "string";
745
- readonly minLength: 1;
746
- };
747
- readonly description: {
748
- readonly type: "string";
749
- readonly minLength: 1;
750
- };
751
- readonly aggregate: {
752
- readonly type: "string";
753
- readonly minLength: 1;
754
- };
755
- readonly coverage: {
756
- readonly type: "object";
757
- readonly additionalProperties: false;
758
- readonly properties: {
759
- readonly test: {
760
- readonly type: "boolean";
761
- };
762
- readonly symbol: {
763
- readonly type: "string";
764
- readonly minLength: 1;
765
- };
766
- };
767
- };
768
- readonly mode: {
769
- readonly type: "string";
770
- readonly enum: readonly ["advisory", "enforced"];
771
- readonly default: "advisory";
772
- };
773
- readonly appliesTo: {
774
- readonly type: "array";
775
- readonly items: {
776
- readonly type: "string";
777
- readonly minLength: 1;
778
- };
779
- readonly uniqueItems: true;
780
- };
781
- };
782
- };
783
- };
784
- };
785
- declare function loadArkRulesContract(input: unknown, source?: string, expectedLayer?: string): {
786
- config: ArkRulesFile;
787
- };
788
- declare function parseArkRulesJson(json: string, source?: string, expectedLayer?: string): {
789
- config: ArkRulesFile;
790
- };
3654
+ /** Validate supplied facts and evaluate their graph without host effects. */
3655
+ declare function analyzeResolvedProject(input: AnalyzeResolvedProjectInput): ResolvedAnalysisResult;
3656
+
791
3657
  /**
792
- * Build the Effective Contract from already-validated ArkRules files.
793
- * Callers supply `{ layer → { sourceFile, file } }` after resolving references.
3658
+ * Evaluate one create/update/delete set as a single in-memory candidate.
3659
+ * The function never writes and returns hashes that bind a later host commit to
3660
+ * the exact base, policy, compiler options, and candidate contents it checked.
794
3661
  */
795
- declare function buildEffectiveArkRules(parts: ReadonlyArray<{
796
- layer: string;
797
- sourceFile: string;
798
- file: ArkRulesFile;
799
- }>): EffectiveArkRules;
800
- /** Empty Effective Contract used when `arkRules` is absent (byte-for-byte verdict parity). */
801
- declare function emptyEffectiveArkRules(): EffectiveArkRules;
3662
+ declare function preflightChange(input: AnalyzeChangeInput): ChangePreflightResult;
3663
+
3664
+ /** Atomic preflight over one validated base/candidate facts pair (ADR 0011). */
3665
+
3666
+ /**
3667
+ * Validate that the supplied candidate is exactly the declared in-memory
3668
+ * overlay, then return its canonical resolved verdict. No project file is read
3669
+ * or written here.
3670
+ */
3671
+ declare function preflightResolvedChange(input: PreflightResolvedChangeInput): ResolvedChangePreflightResult;
3672
+
3673
+ /** Canonical config diagnostics over repo-relative file paths. */
3674
+ declare function collectAnalysisConfigWarnings(input: CollectAnalysisConfigWarningsInput): ArchitectureEngineViolation[];
802
3675
 
803
3676
  /**
804
3677
  * Pure Effective Contract composition (ADR 0012).
@@ -859,7 +3732,7 @@ declare function effectiveContractPolicyPayload(contract: EffectiveContract): un
859
3732
  */
860
3733
 
861
3734
  /** Closed factory names from ADR 0022 `arkrun-missing-root`. */
862
- declare const ARKRUN_KERNEL_FACTORY_CALLEES: readonly ["createArkKernel", "createStrictArkKernel", "createArkKernelFromConfig", "createStrictArkKernelFromConfig"];
3735
+ declare const ARKRUN_KERNEL_FACTORY_CALLEES: readonly ["createArkKernel", "createStrictArkKernel", "createLenientArkKernel", "createArkKernelFromConfig", "createStrictArkKernelFromConfig", "createLenientArkKernelFromConfig"];
863
3736
  /** Closed interaction callees from ADR 0022 undeclared-emit/handle/depend. */
864
3737
  declare const ARKRUN_KERNEL_INTERACTION_CALLEES: readonly ["publisher", "publish", "raise", "raiseAsync", "send", "sendTo", "subscribe", "registerHandler", "resolve", "resolveSingleton"];
865
3738
  declare function isArkRunKernelModuleSpecifier(specifier: string): boolean;
@@ -878,7 +3751,22 @@ declare function arkRunKernelCallKind(callee: string): ResolvedArkRunKernelCallK
878
3751
  declare function extractArkRunValueImportDependenciesFromSource(file: string, content: string): ResolvedDependencyFact[];
879
3752
  /** PascalCase named bindings from value import clauses (snippet admitted constructors). */
880
3753
  declare function extractArkRunImportedConstructorNamesFromSource(content: string): string[];
881
- declare function extractArkRunKernelCallsFromSource(file: string, content: string): ResolvedArkRunKernelCallFact[];
3754
+ type ExtractArkRunKernelCallsOptions = {
3755
+ /**
3756
+ * Relative specifiers that resolve to a kernel/composition root module
3757
+ * (see {@link createArkRunKernelRootSpecifierMatcher}); identifiers imported
3758
+ * from them are traced as kernel receivers.
3759
+ */
3760
+ isKernelRootSpecifier?: (specifier: string) => boolean;
3761
+ /**
3762
+ * The project's effective intent prefixes (configured `layers[].intentPrefixes`
3763
+ * plus the canonical defaults — {@link arkRunEffectiveIntentPrefixes}). An
3764
+ * untraced receiver counts as a kernel call when its name literal carries one.
3765
+ * Omitted: only the canonical prefixes count.
3766
+ */
3767
+ intentPrefixes?: readonly string[];
3768
+ };
3769
+ declare function extractArkRunKernelCallsFromSource(file: string, content: string, options?: ExtractArkRunKernelCallsOptions): ResolvedArkRunKernelCallFact[];
882
3770
  declare function extractArkRunManagedNewsFromSource(file: string, content: string, admittedTypeNames: ReadonlySet<string>): ResolvedArkRunManagedNewFact[];
883
3771
  /** File-scoped `uses` / `reactsTo` / `raises` / `sends` string-literal lists (ADR 0023). */
884
3772
  declare function extractArkRunDeclarationsFromSource(file: string, content: string): ResolvedArkRunDeclarationFact[];
@@ -1023,6 +3911,11 @@ type ArkRunDoctorSection = {
1023
3911
  failMergeWhen: string;
1024
3912
  note: string;
1025
3913
  mergePlanes: MergePlanesHonesty;
3914
+ /**
3915
+ * Deny-rule layers a kernel built from this config cannot map an intent to
3916
+ * (no `intentPrefixes`, not a canonical name). Empty when the extra is off.
3917
+ */
3918
+ layerFlowUnresolvable: string[];
1026
3919
  };
1027
3920
  type ArkRunStatusSlice = {
1028
3921
  notAScore: true;
@@ -1057,6 +3950,8 @@ declare function summarizeArkRunSection(input?: {
1057
3950
  covered?: number;
1058
3951
  uncovered?: number;
1059
3952
  } | null;
3953
+ /** Config layers + rules, for the runtime layer-flow resolvability advisory. */
3954
+ layerFlow?: LayerFlowConfigShape | null;
1060
3955
  }): ArkRunDoctorSection;
1061
3956
  /** Thin status slice — counts only; residual null means unknown, not green. */
1062
3957
  declare function projectStatusArkRun(input?: {
@@ -1172,6 +4067,8 @@ type EvaluateArkOrderSensorsInput = {
1172
4067
  line: number;
1173
4068
  keyCount: number;
1174
4069
  }[];
4070
+ xiTtlKeys?: readonly ResolvedArkOrderXiTtlFact[];
4071
+ budgetLeaks?: readonly ResolvedArkOrderBudgetLeakFact[];
1175
4072
  dependencies: readonly ResolvedDependencyFact[];
1176
4073
  layerForFile: (path: string) => string | null | undefined;
1177
4074
  classification?: ExtraMergeTeethClassification;
@@ -1234,7 +4131,19 @@ type BuildRulesInventoryInput = {
1234
4131
  layerContexts?: readonly RulesInventoryLayerContext[];
1235
4132
  /** Invariant / structure ids already under contract (to compute underContract count). */
1236
4133
  contractedRuleIds?: readonly string[];
1237
- /** Baseline keys currently frozen for arkrule residual. */
4134
+ /**
4135
+ * Declared structure rules as (layer, sensor). A structure suggestion is under
4136
+ * contract when its layer declares a rule on the same sensor, whatever the
4137
+ * author called the rule id.
4138
+ */
4139
+ contractedStructure?: readonly {
4140
+ layer: string;
4141
+ sensor: string;
4142
+ }[];
4143
+ /**
4144
+ * Raw baseline keys (`ruleId|file|…`). Only ArkRules-plane keys (ruleId
4145
+ * `ARKRULE_*` / `INVARIANT_*`) count as frozen residual; others are ignored.
4146
+ */
1238
4147
  frozenKeys?: readonly string[];
1239
4148
  };
1240
4149
  declare function buildRulesInventory(input: BuildRulesInventoryInput): RulesInventoryResult;
@@ -1252,6 +4161,179 @@ declare function inventoryToExtractionCard(candidate: RulesInventoryCandidate):
1252
4161
  next: string;
1253
4162
  };
1254
4163
 
4164
+ /** Public, evidence-backed enforcement state shared by doctor adapters. */
4165
+ declare const ARK_ENFORCEMENT_STATE_SCHEMA_VERSION: "1.1";
4166
+ type EnforcementVerification = boolean | 'unverified';
4167
+ type EnforcementEvidenceField = 'configured' | 'installed' | 'active' | 'runtimeObserved' | 'operationCoverage' | 'bypassable' | 'required' | 'hard';
4168
+ type EnforcementEvidence = {
4169
+ field: 'configured' | 'installed' | 'runtimeObserved' | 'hard';
4170
+ source: string;
4171
+ value: boolean;
4172
+ } | {
4173
+ field: 'active' | 'operationCoverage' | 'bypassable' | 'required';
4174
+ source: string;
4175
+ value: EnforcementVerification;
4176
+ };
4177
+ /**
4178
+ * State for one enforcement boundary.
4179
+ *
4180
+ * `configured` records valid wiring, while `installed` requires the referenced
4181
+ * package or executable to resolve. Runtime/provider facts remain
4182
+ * `unverified` until observed; local files never prove `required: true`.
4183
+ */
4184
+ type EnforcementBoundaryState = {
4185
+ supported: boolean;
4186
+ analyzed: boolean;
4187
+ configured: boolean;
4188
+ installed: boolean;
4189
+ active: EnforcementVerification;
4190
+ runtimeObserved: boolean;
4191
+ operation: string | null;
4192
+ operationCoverage: EnforcementVerification;
4193
+ bypassable: EnforcementVerification;
4194
+ required: EnforcementVerification;
4195
+ hard: boolean;
4196
+ evidence: readonly EnforcementEvidence[];
4197
+ };
4198
+ type ArkEnforcementHost = 'claude' | 'grok' | 'cursor' | 'codex' | 'unknown';
4199
+ type ArkEnforcementState = {
4200
+ schemaVersion: typeof ARK_ENFORCEMENT_STATE_SCHEMA_VERSION;
4201
+ activeHost: ArkEnforcementHost;
4202
+ localWrite: EnforcementBoundaryState;
4203
+ advisoryMcp: EnforcementBoundaryState;
4204
+ ciMerge: EnforcementBoundaryState;
4205
+ };
4206
+
4207
+ /** Public neutral contract for the opt-in new-code design-fitness ratchet. */
4208
+ declare const ARK_DESIGN_DELTA_SCHEMA_VERSION: "1.0";
4209
+ type DesignSmellId = 'io-under-application' | 'handler-in-persistence' | 'god-module' | 'domain-logic-in-ui' | 'facade-sql-in-routes' | 'mixed-pattern-cluster' | 'soft-contract';
4210
+ type DesignDeltaIdentity = {
4211
+ kind: 'git-tree' | 'candidate-tree';
4212
+ value: string;
4213
+ commit?: string;
4214
+ };
4215
+ type DesignSmellEvidence = {
4216
+ kind: string;
4217
+ path: string;
4218
+ line?: number;
4219
+ symbol?: string;
4220
+ detail?: string;
4221
+ magnitude: number;
4222
+ };
4223
+ type DesignSmellFinding = {
4224
+ smellId: DesignSmellId;
4225
+ fingerprint: string;
4226
+ identity: string;
4227
+ evidence: DesignSmellEvidence;
4228
+ repairHint: string;
4229
+ };
4230
+ type DesignDeltaChange = DesignSmellFinding & {
4231
+ classification: 'new' | 'worsened';
4232
+ baseMagnitude: number;
4233
+ candidateMagnitude: number;
4234
+ };
4235
+ /** Created-path merge vs full new+worsened ratchet (Z10). Omitted on older producers. */
4236
+ type DesignDeltaEnforcementScope = 'created-paths' | 'touched-new-or-worsened';
4237
+ type ArkDesignDeltaResult = {
4238
+ schemaVersion: typeof ARK_DESIGN_DELTA_SCHEMA_VERSION;
4239
+ mode: 'git-base' | 'write-candidate';
4240
+ complete: boolean;
4241
+ valid: boolean;
4242
+ base: DesignDeltaIdentity;
4243
+ candidate: DesignDeltaIdentity;
4244
+ supportedSmellIds: readonly DesignSmellId[];
4245
+ touchedPaths: readonly string[];
4246
+ changes: readonly DesignDeltaChange[];
4247
+ baseFindingCount: number;
4248
+ candidateFindingCount: number;
4249
+ historicalResidualCount: number;
4250
+ enforcementScope?: DesignDeltaEnforcementScope;
4251
+ error?: string;
4252
+ };
4253
+
4254
+ /**
4255
+ * Public diagnostic code catalog (ACS02).
4256
+ *
4257
+ * Closed vocabulary of stable `ruleId` values emitted by ArkGate adapters with
4258
+ * human/agent `why` / `fix` anchors and docs fragment ids. Cataloguing only —
4259
+ * no new rule semantics, no LLM verdict, no enforcement from prose.
4260
+ *
4261
+ * **Canonical** for docs, agent projection (ACS04), and finding refs (ACS06).
4262
+ * Runtime remediation remains in `remediation.ts`; parity tests bind the two.
4263
+ *
4264
+ * Zero Node I/O. Optional CLI surface: generated `bin/lib/diagnostic-catalog.mjs`.
4265
+ *
4266
+ * @see docs/diagnostics.md
4267
+ * @see docs/plans/agent-contract-surface-4.3/README.md
4268
+ */
4269
+ /** Product-relative docs path (shipped in the npm tarball when listed in package files). */
4270
+ declare const DIAGNOSTIC_DOCS_RELATIVE_PATH: "docs/diagnostics.md";
4271
+ /** Schema id for serializing the catalog snapshot (agents / install projection). */
4272
+ declare const DIAGNOSTIC_CATALOG_SCHEMA_VERSION: "1.0";
4273
+ type DiagnosticCategory = 'layer' | 'capability' | 'publish' | 'safety' | 'arkrules' | 'arkrun' | 'arkorder' | 'preflight' | 'analysis' | 'drift' | 'snippet-policy' | 'config' | 'adapter' | 'meta';
4274
+ type DiagnosticCatalogEntry = {
4275
+ /** Stable public violation / diagnostic id. */
4276
+ ruleId: string;
4277
+ /** Short title for indexes and agent projection. */
4278
+ title: string;
4279
+ /** Why this finding exists (contract intent). */
4280
+ why: string;
4281
+ /**
4282
+ * Canonical fix guidance (agent + human). Contextual nextAction on live
4283
+ * findings may specialize this (e.g. type-only vs value layer import).
4284
+ */
4285
+ fix: string;
4286
+ /** Markdown fragment id for docs/diagnostics.md (without leading #). */
4287
+ docsAnchor: string;
4288
+ category: DiagnosticCategory;
4289
+ /**
4290
+ * When true, finding is commonly advisory / non-blocking in default profiles
4291
+ * (doctor/config warnings, type-only placement debt, empty ArkRule scope).
4292
+ * Not a severity bit for the engine — documentation only.
4293
+ */
4294
+ oftenAdvisory?: boolean;
4295
+ };
4296
+ /**
4297
+ * Closed public catalog. Order is stable (category groups, then ruleId) for
4298
+ * deterministic serialization and docs generation.
4299
+ *
4300
+ * Every production-emitted `ruleId` must appear here. Remediation switch cases
4301
+ * and adapter nextAction branches are parity-tested against this list.
4302
+ */
4303
+ declare const DIAGNOSTIC_CATALOG: readonly DiagnosticCatalogEntry[];
4304
+ /** All public ruleIds in catalog order. */
4305
+ declare const DIAGNOSTIC_RULE_IDS: readonly string[];
4306
+ declare function isKnownDiagnosticCode(ruleId: string | null | undefined): boolean;
4307
+ /**
4308
+ * True when the code is catalogued or is an ArkRule-family id handled by the
4309
+ * ARKRULE_* prefix fallback in remediation (structure sensors may add members later
4310
+ * only via catalog + ROADMAP — prefix alone is not a license for free-form ids).
4311
+ */
4312
+ declare function isCataloguedOrArkRuleFamily(ruleId: string | null | undefined): boolean;
4313
+ declare function getDiagnosticCatalogEntry(ruleId: string | null | undefined): DiagnosticCatalogEntry | undefined;
4314
+ /** Fragment for docs links, e.g. `#LAYER_IMPORT_VIOLATION`. */
4315
+ declare function diagnosticDocsFragment(ruleId: string): string;
4316
+ /**
4317
+ * Repo-relative docs path with fragment (for agents and JSON).
4318
+ * Package consumers resolve against the installed package root or GitHub tree.
4319
+ */
4320
+ declare function diagnosticDocsPath(ruleId: string): string;
4321
+ /** Catalog snapshot for JSON export / agent projection (stable field order). */
4322
+ declare function serializeDiagnosticCatalog(): {
4323
+ schemaVersion: typeof DIAGNOSTIC_CATALOG_SCHEMA_VERSION;
4324
+ docsPath: typeof DIAGNOSTIC_DOCS_RELATIVE_PATH;
4325
+ codes: readonly DiagnosticCatalogEntry[];
4326
+ };
4327
+ /**
4328
+ * Static catalog fix for a ruleId when no live violation context is available.
4329
+ * Live adapters should still use deterministicNextAction for specialized edges.
4330
+ */
4331
+ declare function catalogFixForRuleId(ruleId: string | null | undefined): string | undefined;
4332
+ /**
4333
+ * Static catalog why for a ruleId (agent “why” surface).
4334
+ */
4335
+ declare function catalogWhyForRuleId(ruleId: string | null | undefined): string | undefined;
4336
+
1255
4337
  /**
1256
4338
  * Doctor / status / report ArkOrder section. Always notAScore.
1257
4339
  * Residual is a unique ARKORDER finding-id count — never a score or LLM verdict.
@@ -1368,6 +4450,11 @@ type StatusManifest = {
1368
4450
  lastCheck: StatusLastCheckSlice;
1369
4451
  rules: StatusRulesSlice;
1370
4452
  nextAction: StatusNextAction;
4453
+ /**
4454
+ * Contract validity for the resolved config. Present only when a config file exists and
4455
+ * failed the shared contract validator (same fail-closed rules as ark-check / MCP / ESLint).
4456
+ */
4457
+ contract?: StatusContractSlice;
1371
4458
  /**
1372
4459
  * Improvement compass residual map with honesty mode (DF02).
1373
4460
  * Tooling should always supply a projection (including mode=unavailable).
@@ -1386,6 +4473,11 @@ type StatusManifest = {
1386
4473
  */
1387
4474
  arkOrder?: ArkOrderStatusSlice;
1388
4475
  };
4476
+ type StatusContractSlice = {
4477
+ valid: false;
4478
+ /** Validator messages (`<json path>: <message>`), in validator order. */
4479
+ errors: string[];
4480
+ };
1389
4481
  type StatusVsBaseSlice = {
1390
4482
  baseRef: string;
1391
4483
  line: string;
@@ -1402,6 +4494,11 @@ type StatusManifestFacts = {
1402
4494
  arkgateVersion: string;
1403
4495
  resolvedRoot: string;
1404
4496
  resolvedConfigPath?: string | null;
4497
+ /**
4498
+ * Contract validator messages for the resolved config. Non-empty → the config is invalid
4499
+ * (every enforcing surface refuses it). Empty/omitted → valid or not evaluated.
4500
+ */
4501
+ configErrors?: string[] | null;
1405
4502
  projectId?: string | null;
1406
4503
  /**
1407
4504
  * Optional agent expectation (same shape as MCP `project`).
@@ -1478,10 +4575,6 @@ declare function classifyStatusWritePath(input: {
1478
4575
  activeHost?: string | null;
1479
4576
  }): StatusWritePathClass;
1480
4577
  declare function defaultHonestLabel(writePath: StatusWritePathClass, host: string | null): string;
1481
- /**
1482
- * Deterministic next action from residual facts (no LLM).
1483
- * Prefer explicit override from productHonesty when provided.
1484
- */
1485
4578
  declare function resolveStatusNextAction(facts: StatusManifestFacts, binding: ProjectBinding, activation: StatusActivationSlice, lastCheck: StatusLastCheckSlice, rules: StatusRulesSlice): StatusNextAction;
1486
4579
  declare function buildStatusManifest(facts: StatusManifestFacts): StatusManifest;
1487
4580
  /**
@@ -1688,6 +4781,25 @@ declare const ARK_STATUS_MANIFEST_SCHEMA: {
1688
4781
  };
1689
4782
  };
1690
4783
  };
4784
+ readonly contract: {
4785
+ readonly type: "object";
4786
+ readonly description: "Present only when the resolved config fails the shared contract validator (the same fail-closed rules ark-check, MCP and ESLint apply).";
4787
+ readonly additionalProperties: false;
4788
+ readonly required: readonly ["valid", "errors"];
4789
+ readonly properties: {
4790
+ readonly valid: {
4791
+ readonly const: false;
4792
+ };
4793
+ readonly errors: {
4794
+ readonly type: "array";
4795
+ readonly minItems: 1;
4796
+ readonly items: {
4797
+ readonly type: "string";
4798
+ readonly minLength: 1;
4799
+ };
4800
+ };
4801
+ };
4802
+ };
1691
4803
  readonly improvementCompass: {
1692
4804
  readonly type: "object";
1693
4805
  readonly description: "Thin improvement-compass residual ids with honesty mode (notAScore). full | subset | unavailable. Never a gate input; full lenses on doctor JSON. When full, residual ids ⊆ doctor residual for the same facts. unavailable never invents green residual.";
@@ -2360,4 +5472,4 @@ declare function agentSkillPackageFileRelativePath(skillName: string): string;
2360
5472
  */
2361
5473
  declare function flatSkillTemplateFileRelativePath(skillName: string): string;
2362
5474
 
2363
- export { AGENT_PROJECTION_BEGIN_MARKER, AGENT_PROJECTION_END_MARKER, AGENT_PROJECTION_ENFORCEMENT_SURFACES, AGENT_PROJECTION_NON_ENFORCEMENT_LABEL, AGENT_SKILLS_PACKAGE_RELATIVE_ROOT, AGENT_SKILL_ENTRY_FILENAME, ARKORDER_RULE_IDS, ARKORDER_TIER1_SENSOR_IDS, ARKRUN_INTERACTION_NAME_INCOMPLETE, ARKRUN_KERNEL_FACTORY_CALLEES, ARKRUN_KERNEL_INTERACTION_CALLEES, ARKRUN_RULE_IDS, ARKRUN_TIER1_SENSOR_IDS, ARKRUN_TRANSPORT_BYPASS_SPECIFIERS, ARK_AGENT_PROJECTION_SCHEMA_VERSION, ARK_AGENT_SKILLS_PACKAGE_SCHEMA_VERSION, ARK_CONFIG_SCHEMA, ARK_CONFIG_SCHEMA_VERSION, ARK_FIRST_CLASS_SKILL_NAMES, ARK_IMPROVEMENT_COMPASS_SCHEMA_VERSION, ARK_PROJECT_IDENTITY_SCHEMA, ARK_PROJECT_IDENTITY_SCHEMA_URL, ARK_PROJECT_IDENTITY_SCHEMA_VERSION, ARK_RULES_SCHEMA, ARK_RULES_SCHEMA_VERSION, ARK_RULE_SENSORS, ARK_RUN_DOCTOR_SCHEMA_VERSION, ARK_SKILL_CAPACITY, ARK_SKILL_CAPACITY_DEDICATED_DOORS, ARK_SKILL_DESCRIPTION_VERSION_PATTERN, ARK_SKILL_NAMES, ARK_SKILL_NAME_COUNT, ARK_SKILL_NORTH_STAR, ARK_SKILL_REQUIRED_SURFACES, ARK_SKILL_STUB_REDIRECTS, ARK_STATUS_MANIFEST_SCHEMA, ARK_STATUS_MANIFEST_SCHEMA_URL, ARK_STATUS_MANIFEST_SCHEMA_VERSION, AdapterViolationInput, type AgentProjectionCatalogEntry, type AgentProjectionFacts, type AgentProjectionLayerSummary, type AgentProjectionMergeAction, type AgentProjectionMergeResult, type AgentProjectionMeta, type AgentProjectionProfile, type AgentSkillPackageEntry, type AgentSkillValidationIssue, ArkConfig, ArkConfigLoadResult, type ArkFirstClassSkillName, type ArkOrderRuleId, type ArkOrderSensorFinding, ArkRulesFile, type ArkRunDoctorSection, type ArkRunRuleId, type ArkRunSensorFinding, type ArkRunStatusSlice, type ArkRunTier1SensorId, type ArkSkillCapacityDedicatedSurface, type ArkSkillCapacitySurface, type ArkSkillName, type ArkSkillNorthStar, type ArkSkillRequiredSurface, type ArkSkillStubName, DEFAULT_AGENT_PROJECTION_RULE_IDS, EXTRA_MERGE_TEETH_GOVERNED_FLOOR, EffectiveArkRules, type EffectiveContract, EffectiveContractError, type EffectiveContractWarning, type EvaluateArkRunSensorsInput, type EvaluateArkRunSensorsResult, type ExtraMergeTeethClassification, FLAT_SKILL_TEMPLATES_RELATIVE_ROOT, IMPROVEMENT_COMPASS_OUT_OF_SCOPE_LENSES, IMPROVEMENT_COMPASS_TOP_RESIDUAL_CAP, IMPROVEMENT_LENS_IDS, type ImprovementCompass, type ImprovementCompassEvidence, type ImprovementCompassFacts, type ImprovementCompassNextAction, type ImprovementCompassSmellFact, type ImprovementCompassViolationFact, type ImprovementLens, type ImprovementLensId, type ImprovementLensStatus, MERGE_PLANES_DUAL_STAMP, type MergePlanesHonesty, PROJECT_BINDING_SCHEMA, PROJECT_EXPECTATION_SCHEMA, type ParseSkillDocumentResult, type ParsedSkillFrontmatter, type ProjectBinding, type ProjectExpectation, type ProjectIdentity, ResolvedArkRunCompositionRootHitFact, ResolvedArkRunDeclarationFact, ResolvedArkRunKernelCallFact, ResolvedArkRunKernelCallKind, ResolvedArkRunManagedNewFact, ResolvedDependencyFact, ResolvedFactsReason, type RulesInventoryCandidate, type RulesInventoryResult, STATUS_COMPASS_FACTS_SOURCES, STATUS_COMPASS_MODES, STATUS_COMPASS_REASON_CODES, type SkillProductCapacityIssue, type SkillProductCapacityIssueCode, type StatusActivationSlice, type StatusCheckVerdict, type StatusCompassFactsSource, type StatusCompassMode, type StatusCompassReasonCode, type StatusImprovementCompassSlice, type StatusLastCheckSlice, type StatusManifest, type StatusManifestFacts, type StatusNextAction, type StatusProjectIdentitySlice, type StatusRulesSlice, type StatusWritePathClass, type ValidateAgentSkillDocumentInput, type ValidateAgentSkillsPackageResult, type ValidateSkillProductCapacityInput, type ValidateSkillProductCapacityResult, adapterDocsCodePath, adapterFindingOccurrenceTargetKeys, adapterFindingRefFromTargetKey, adapterFindingTargetKey, agentProjectionContentIdentity, agentSkillEntryRelativePath, agentSkillPackageFileRelativePath, arkRunKernelCallKind, arkSkillStubRedirect, buildAgentProjectionBeginMarker, buildAgentProjectionBlock, buildAgentProjectionBody, buildAgentProjectionMeta, buildEffectiveArkRules, buildImprovementCompass, buildRulesInventory, buildStatusManifest, classifyResolvedLayerCoverage, classifyStatusWritePath, composeMergePlanesHonesty, createProjectId, createProjectIdentity, defaultHonestLabel, demoteExtraPlaneTeethUnderClassificationFloor, effectiveContractPolicyPayload, emptyEffectiveArkRules, evaluateArkOrderSensors, evaluateArkRunEditorSensors, evaluateArkRunEditorSensorsFromSource, evaluateArkRunSensors, evaluateStatusBinding, extraMergeTeethAllowed, extractAgentProjectionBlock, extractArkRunDeclarationsFromSource, extractArkRunImportedConstructorNamesFromSource, extractArkRunKernelCallsFromSource, extractArkRunManagedNewsFromSource, extractArkRunValueImportDependenciesFromSource, flatSkillTemplateFileRelativePath, formatAgentProjectionCatalogShortList, formatAgentProjectionLayers, formatArkRunDoctorLines, formatImprovementCompassDoctorLines, formatImprovementCompassResidualLabels, inventoryToExtractionCard, isArkOrderRuleId, isArkRunKernelModuleSpecifier, isArkRunRuleId, isArkRunTransportBypassSpecifier, isArkSkillName, isExtraPlaneFinding, isFirstClassArkSkillName, isValidAgentSkillName, loadArkConfigContract, loadArkRulesContract, mergeAgentProjectionDocument, normalizeExtraMergeTeethClassification, normalizeSkillContent, normalizeStatusImprovementCompass, parseAgentProjectionStamp, parseArkConfigJson, parseArkRulesJson, parseSkillDescriptionVersion, parseSkillDocument, primaryImprovementCompassNextAction, projectStatusArkRun, projectStatusImprovementCompass, projectionHasNonEnforcementLabel, projectionMatchesPackageVersion, resolveEffectiveContract, resolveStatusNextAction, skillDescriptionVersionPrefix, stampSkillDescription, statusCompassResidualIsSubsetOfDoctor, stripSkillDescriptionVersion, summarizeArkRunSection, unavailableStatusImprovementCompass, validateAgentSkillDocument, validateAgentSkillsPackage, validateSkillProductCapacity };
5475
+ export { ADAPTER_DIAGNOSTIC_DOCS_RELATIVE_PATH, AGENT_PROJECTION_BEGIN_MARKER, AGENT_PROJECTION_END_MARKER, AGENT_PROJECTION_ENFORCEMENT_SURFACES, AGENT_PROJECTION_NON_ENFORCEMENT_LABEL, AGENT_SKILLS_PACKAGE_RELATIVE_ROOT, AGENT_SKILL_ENTRY_FILENAME, type AICodeGate, type AICodeGateContext, type AICodeGateOptions, type AICodeGateResult, type AICodeGateViolation, type AIGateExtension, ANALYSIS_IR_SCHEMA_VERSION, ARKORDER_RULE_IDS, ARKORDER_TIER1_SENSOR_IDS, ARKRUN_INTERACTION_NAME_INCOMPLETE, ARKRUN_KERNEL_FACTORY_CALLEES, ARKRUN_KERNEL_INTERACTION_CALLEES, ARKRUN_RULE_IDS, ARKRUN_TIER1_SENSOR_IDS, ARKRUN_TRANSPORT_BYPASS_SPECIFIERS, ARK_AGENT_PROJECTION_SCHEMA_VERSION, ARK_AGENT_SKILLS_PACKAGE_SCHEMA_VERSION, ARK_ANALYSIS_RESULT_SCHEMA, ARK_ANALYSIS_RESULT_SCHEMA_VERSION, ARK_CONFIG_SCHEMA, ARK_CONFIG_SCHEMA_VERSION, ARK_DESIGN_DELTA_SCHEMA_VERSION, ARK_ENFORCEMENT_STATE_SCHEMA_VERSION, ARK_FIRST_CLASS_SKILL_NAMES, ARK_IMPROVEMENT_COMPASS_SCHEMA_VERSION, ARK_PROJECT_IDENTITY_SCHEMA, ARK_PROJECT_IDENTITY_SCHEMA_URL, ARK_PROJECT_IDENTITY_SCHEMA_VERSION, ARK_RULES_SCHEMA, ARK_RULES_SCHEMA_VERSION, ARK_RULE_SENSORS, ARK_RUN_DOCTOR_SCHEMA_VERSION, ARK_SKILL_CAPACITY, ARK_SKILL_CAPACITY_DEDICATED_DOORS, ARK_SKILL_DESCRIPTION_VERSION_PATTERN, ARK_SKILL_NAMES, ARK_SKILL_NAME_COUNT, ARK_SKILL_NORTH_STAR, ARK_SKILL_REQUIRED_SURFACES, ARK_SKILL_STUB_REDIRECTS, ARK_STATUS_MANIFEST_SCHEMA, ARK_STATUS_MANIFEST_SCHEMA_URL, ARK_STATUS_MANIFEST_SCHEMA_VERSION, type AdapterCompletenessReason, type AdapterDiagnostic, type AdapterResult, type AdapterSeverity, type AdapterViolationInput, type AgentProjectionCatalogEntry, type AgentProjectionFacts, type AgentProjectionLayerSummary, type AgentProjectionMergeAction, type AgentProjectionMergeResult, type AgentProjectionMeta, type AgentProjectionProfile, type AgentSkillPackageEntry, type AgentSkillValidationIssue, type AnalysisCapabilityUse, type AnalysisCompilerOptions, type AnalysisCompleteness, type AnalysisContract, type AnalysisEvidence, type AnalysisFile, type AnalysisFileChange, type AnalysisFileInput, type AnalysisImportEdge, type AnalysisIr, type AnalysisMode, type AnalysisResult, type AnalysisViolation, type AnalyzeArchitectureConvergenceInput, type AnalyzeChangeInput, type AnalyzePolicyDeltaInput, type AnalyzeProjectInput, type AnalyzeResolvedProjectInput, type ArchitectureActualChange, type ArchitectureChangeMap, type ArchitectureChangeMapContract, type ArchitectureChangeMapDependency, type ArchitectureChangeMapFile, type ArchitectureChangeOperation, type ArchitectureConvergenceClassification, type ArchitectureConvergenceFinding, type ArchitectureConvergenceResult, type ArchitectureDependency, type ArchitectureEngineEdge, type ArchitectureEngineResult, type ArchitectureEngineViolation, type ArchitectureLayer, type ArchitectureLayerConfig, type ArchitectureProfile, type ArchitectureRule, type ArkCheckConfig, ArkConfig, ArkConfigLoadResult, type ArkDesignDeltaResult, type ArkEnforcementHost, type ArkEnforcementState, type ArkFirstClassSkillName, type ArkOrderRuleId, type ArkOrderSensorFinding, type ArkRuleSensorViolation, type ArkRulesFile, type ArkRulesIssue, ArkRulesValidationError, type ArkRunDoctorSection, type ArkRunRuleId, type ArkRunSensorFinding, type ArkRunStatusSlice, type ArkRunTier1SensorId, type ArkSkillCapacityDedicatedSurface, type ArkSkillCapacitySurface, type ArkSkillName, type ArkSkillNorthStar, type ArkSkillRequiredSurface, type ArkSkillStubName, type ChangePreflightResult, type ClassShapeFact, type CollectAnalysisConfigWarningsInput, type CoverageEvidence, type CoverageFiles, type CoverageInvariant, type CreateArchitectureProfileFromArkConfigOptions, type CreateArchitectureProfileOptions, type CreateElevenLayerArkConfigOptions, DEFAULT_AGENT_PROJECTION_RULE_IDS, DIAGNOSTIC_CATALOG, DIAGNOSTIC_CATALOG_SCHEMA_VERSION, DIAGNOSTIC_DOCS_RELATIVE_PATH, DIAGNOSTIC_RULE_IDS, type DeclarationShape, type DesignDeltaChange, type DesignDeltaEnforcementScope, type DesignDeltaIdentity, type DesignSmellEvidence, type DesignSmellFinding, type DesignSmellId, type DiagnosticCatalogEntry, type DiagnosticCategory, EXTRA_MERGE_TEETH_GOVERNED_FLOOR, type EffectiveArkRules, type EffectiveContract, EffectiveContractError, type EffectiveContractWarning, type EnforcementBoundaryState, type EnforcementEvidence, type EnforcementEvidenceField, type EnforcementVerification, type EvaluateArchitectureGraphInput, type EvaluateArkRunSensorsInput, type EvaluateArkRunSensorsResult, type ExtraMergeTeethClassification, FLAT_SKILL_TEMPLATES_RELATIVE_ROOT, type ForbiddenCapabilityUse, IMPROVEMENT_COMPASS_OUT_OF_SCOPE_LENSES, IMPROVEMENT_COMPASS_TOP_RESIDUAL_CAP, IMPROVEMENT_LENS_IDS, type ImprovementCompass, type ImprovementCompassEvidence, type ImprovementCompassFacts, type ImprovementCompassNextAction, type ImprovementCompassSmellFact, type ImprovementCompassViolationFact, type ImprovementLens, type ImprovementLensId, type ImprovementLensStatus, type InvariantCoverageEvidence, MERGE_PLANES_DUAL_STAMP, type MentionContext, type MergePlanesHonesty, POLICY_DELTA_SCHEMA_VERSION, PROJECT_BINDING_SCHEMA, PROJECT_EXPECTATION_SCHEMA, type ParseSkillDocumentResult, type ParsedSkillFrontmatter, type PolicyDelta, type PolicyDeltaAcknowledgement, type PolicyDeltaAnalysis, type PolicyDeltaClassification, type PolicyDeltaFinding, type PreflightResolvedChangeInput, type PreparedChangeFile, type ProjectBinding, type ProjectExpectation, type ProjectIdentity, RESOLVED_CANDIDATE_FACTS_SCHEMA, RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION, type ResolvedAmbientFact, type ResolvedAnalysisFile, type ResolvedAnalysisIr, type ResolvedAnalysisResult, type ResolvedArkRunCompositionRootHitFact, type ResolvedArkRunDeclarationFact, type ResolvedArkRunKernelCallFact, type ResolvedArkRunKernelCallKind, type ResolvedArkRunManagedNewFact, type ResolvedCandidateFacts, type ResolvedCandidateFactsInput, type ResolvedCapability, type ResolvedCapabilityFact, type ResolvedChangePreflightResult, type ResolvedDependencyFact, type ResolvedDependencyKind, type ResolvedDependencyState, type ResolvedFactsCompleteness, type ResolvedFactsReason, type ResolvedFileFact, type ResolvedIntentReferenceFact, type ResolvedPublishFact, type ResolvedSafetyFact, type ResolvedSafetyKind, type ResolvedSafetyReport, type RulesInventoryCandidate, type RulesInventoryResult, STATUS_COMPASS_FACTS_SOURCES, STATUS_COMPASS_MODES, STATUS_COMPASS_REASON_CODES, type SemanticDependency, type SemanticDependencyKind, type SkillProductCapacityIssue, type SkillProductCapacityIssueCode, type StatusActivationSlice, type StatusCheckVerdict, type StatusCompassFactsSource, type StatusCompassMode, type StatusCompassReasonCode, type StatusImprovementCompassSlice, type StatusLastCheckSlice, type StatusManifest, type StatusManifestFacts, type StatusNextAction, type StatusProjectIdentitySlice, type StatusRulesSlice, type StatusWritePathClass, type ValidateAgentSkillDocumentInput, type ValidateAgentSkillsPackageResult, type ValidateSkillProductCapacityInput, type ValidateSkillProductCapacityResult, adapterDocsCodePath, adapterFindingOccurrenceTargetKeys, adapterFindingRefFromTargetKey, adapterFindingTargetKey, agentProjectionContentIdentity, agentSkillEntryRelativePath, agentSkillPackageFileRelativePath, analyzeArchitectureConvergence, analyzeChange, analyzePolicyDelta, analyzeProject, analyzeResolvedProject, arkRunKernelCallKind, arkSkillStubRedirect, buildAgentProjectionBeginMarker, buildAgentProjectionBlock, buildAgentProjectionBody, buildAgentProjectionMeta, buildArkRuleFileHints, buildEffectiveArkRules, buildImprovementCompass, buildRulesInventory, buildStatusManifest, canPromoteInvariant, catalogFixForRuleId, catalogWhyForRuleId, classifyArkPolicyDelta, classifyCoverage, classifyResolvedLayerCoverage, classifyStatusWritePath, collectAnalysisConfigWarnings, collectEmptyAppliesToFindings, collectForbiddenCapabilityUses, composeMergePlanesHonesty, countsAsCoverage, createAICodeGate, createAdapterResult, createArchitectureProfile, createArchitectureProfileFromArkConfig, createElevenLayerArkConfig, createProjectId, createProjectIdentity, createResolvedCandidateFacts, defaultHonestLabel, demoteExtraPlaneTeethUnderClassificationFloor, deriveArkRuleFileHints, describeCoverage, detectArchitectureCycles, deterministicHash, diagnosticDocsFragment, diagnosticDocsPath, effectiveContractPolicyPayload, elevenLayerProfile, emptyEffectiveArkRules, evaluateArchitectureGraph, evaluateArkOrderSensors, evaluateArkRuleSensors, evaluateArkRunEditorSensors, evaluateArkRunEditorSensorsFromSource, evaluateArkRunSensors, evaluateInvariantCoverage, evaluateStatusBinding, explainViolation, extraMergeTeethAllowed, extractAgentProjectionBlock, extractArkRunDeclarationsFromSource, extractArkRunImportedConstructorNamesFromSource, extractArkRunKernelCallsFromSource, extractArkRunManagedNewsFromSource, extractArkRunValueImportDependenciesFromSource, extractClassShapesFromSource, extractSemanticDependencies, flatSkillTemplateFileRelativePath, formatAgentProjectionCatalogShortList, formatAgentProjectionLayers, formatArkRunDoctorLines, formatImprovementCompassDoctorLines, formatImprovementCompassResidualLabels, getDiagnosticCatalogEntry, inventoryToExtractionCard, isArkOrderRuleId, isArkRunKernelModuleSpecifier, isArkRunRuleId, isArkRunTransportBypassSpecifier, isArkSkillName, isCataloguedOrArkRuleFamily, isExtraPlaneFinding, isFirstClassArkSkillName, isKnownDiagnosticCode, isValidAgentSkillName, loadArkConfigContract, loadArkRulesContract, loadContract, loadResolvedCandidateFacts, mergeAgentProjectionDocument, normalizeExtraMergeTeethClassification, normalizeSkillContent, normalizeStatusImprovementCompass, parseAgentProjectionStamp, parseArkConfigJson, parseArkRulesJson, parseSkillDescriptionVersion, parseSkillDocument, policyDeltaAcknowledgementMatches, preflightChange, preflightResolvedChange, primaryImprovementCompassNextAction, projectStatusArkRun, projectStatusImprovementCompass, projectionHasNonEnforcementLabel, projectionMatchesPackageVersion, resolveEffectiveContract, resolveStatusNextAction, resolvedFactsEvidenceRequirementsHash, serializeDiagnosticCatalog, skillDescriptionVersionPrefix, stableSerialize, stampSkillDescription, statusCompassResidualIsSubsetOfDoctor, stripSkillDescriptionVersion, summarizeArkRunSection, toAdapterDiagnostic, unavailableStatusImprovementCompass, validateAgentSkillDocument, validateAgentSkillsPackage, validateSkillProductCapacity, version };