arkgate 4.8.23 → 4.8.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/README.md +7 -5
  3. package/bin/ark-check-runtime.mjs +24 -77
  4. package/bin/ark-dashboard.mjs +56 -53
  5. package/bin/ark-layer-match.mjs +596 -112
  6. package/bin/ark-mcp-runtime.mjs +412 -138
  7. package/bin/ark-mcp.mjs +68 -4
  8. package/bin/ark-shared.mjs +39 -0
  9. package/bin/ark.mjs +65 -97
  10. package/bin/lib/adapter-contract-types.mjs +5 -0
  11. package/bin/lib/adapter-contract.mjs +15 -0
  12. package/bin/lib/agent-projection-command.mjs +5 -1
  13. package/bin/lib/analysis-engine.mjs +15 -11
  14. package/bin/lib/architecture-scan.mjs +50 -6
  15. package/bin/lib/ark-order-doctor.mjs +1 -1
  16. package/bin/lib/ark-order-facts.mjs +410 -15
  17. package/bin/lib/ark-order-invariants.mjs +51 -9
  18. package/bin/lib/ark-order-sensors.mjs +28 -101
  19. package/bin/lib/ark-order-types.mjs +2 -0
  20. package/bin/lib/ark-run-doctor.mjs +14 -0
  21. package/bin/lib/ark-run-facts.mjs +434 -11
  22. package/bin/lib/ark-run-sensors.mjs +5 -3
  23. package/bin/lib/arkgate-pins.mjs +91 -0
  24. package/bin/lib/arkrules-sensors.mjs +50 -249
  25. package/bin/lib/check-args.mjs +23 -1
  26. package/bin/lib/ci-and-commands.mjs +16 -6
  27. package/bin/lib/class-source-scan.mjs +479 -0
  28. package/bin/lib/codex-home.mjs +4 -2
  29. package/bin/lib/config-contract-slices.mjs +701 -0
  30. package/bin/lib/config-contract.mjs +5 -493
  31. package/bin/lib/config-warnings.mjs +32 -0
  32. package/bin/lib/dashboard-cli.mjs +62 -0
  33. package/bin/lib/design-delta.mjs +1 -1
  34. package/bin/lib/diagnostic-catalog.mjs +16 -9
  35. package/bin/lib/doctor-advisories.mjs +25 -1
  36. package/bin/lib/doctor-next-actions.mjs +17 -2
  37. package/bin/lib/doctor-plan.mjs +6 -8
  38. package/bin/lib/effective-contract-load.mjs +121 -59
  39. package/bin/lib/enforcement-profiles.mjs +40 -4
  40. package/bin/lib/first-run-help.mjs +3 -2
  41. package/bin/lib/flat-parent-importers.mjs +137 -0
  42. package/bin/lib/flat-parent-pilot.mjs +40 -100
  43. package/bin/lib/gate-files.mjs +29 -2
  44. package/bin/lib/git-change-scope.mjs +109 -0
  45. package/bin/lib/github-enforcement.mjs +1 -1
  46. package/bin/lib/hook-templates.mjs +18 -16
  47. package/bin/lib/host-support-matrix.mjs +3 -1
  48. package/bin/lib/import-resolve.mjs +13 -1
  49. package/bin/lib/install-migrate.mjs +50 -73
  50. package/bin/lib/invariant-coverage.mjs +59 -11
  51. package/bin/lib/mcp-adoption.mjs +9 -1
  52. package/bin/lib/mcp-hook-payload.mjs +401 -61
  53. package/bin/lib/package-manager.mjs +59 -1
  54. package/bin/lib/passthrough-commands.mjs +83 -0
  55. package/bin/lib/persistence-write-hint.mjs +81 -0
  56. package/bin/lib/pin-dependent-gates.mjs +117 -0
  57. package/bin/lib/policy-delta-io.mjs +168 -10
  58. package/bin/lib/prepare-change.mjs +120 -6
  59. package/bin/lib/prepare-write.mjs +1 -0
  60. package/bin/lib/presets.mjs +3 -5
  61. package/bin/lib/remediation.mjs +23 -4
  62. package/bin/lib/resolved-candidate-facts.mjs +315 -55
  63. package/bin/lib/rules-inventory.mjs +22 -3
  64. package/bin/lib/rules-under-contract.mjs +179 -5
  65. package/bin/lib/scan-files.mjs +32 -0
  66. package/bin/lib/snippet-analysis.mjs +140 -6
  67. package/bin/lib/source-policy.mjs +34 -0
  68. package/bin/lib/stable-hash.mjs +90 -0
  69. package/bin/lib/start-install-recovery.mjs +71 -1
  70. package/bin/lib/start-preview.mjs +30 -0
  71. package/bin/lib/status-command.mjs +33 -4
  72. package/bin/lib/status-manifest.mjs +32 -4
  73. package/bin/lib/team-parliament-io.mjs +77 -75
  74. package/bin/lib/team-parliament.mjs +6 -1
  75. package/bin/lib/write-path-capabilities.mjs +4 -2
  76. package/dist/chunk-A5EIY3HI.cjs +5 -0
  77. package/dist/chunk-MBXCFLO4.js +16 -0
  78. package/dist/chunk-RNQHRDCQ.cjs +16 -0
  79. package/dist/chunk-SVSQVGFJ.js +5 -0
  80. package/dist/{configTypes-Bbf_MFGe.d.ts → configTypes-BJbaeoj4.d.cts} +18 -3
  81. package/dist/configTypes-BJbaeoj4.d.ts +246 -0
  82. package/dist/eslint/index.cjs +17 -4
  83. package/dist/eslint/index.d.cts +359 -0
  84. package/dist/eslint/index.d.ts +130 -156
  85. package/dist/eslint/index.js +10 -4
  86. package/dist/index.cjs +35 -34
  87. package/dist/index.d.cts +5475 -0
  88. package/dist/index.d.ts +3312 -299
  89. package/dist/index.js +35 -34
  90. package/dist/inspectorListen-6DQVJ4DC.js +1 -0
  91. package/dist/inspectorListen-KGMIQ2TF.cjs +1 -0
  92. package/dist/nestjs/index.cjs +1 -18
  93. package/dist/nestjs/index.d.cts +22 -0
  94. package/dist/nestjs/index.d.ts +1 -3
  95. package/dist/nestjs/index.js +1 -18
  96. package/dist/order/index.cjs +1 -1
  97. package/dist/order/index.d.cts +155 -0
  98. package/dist/order/index.d.ts +15 -3
  99. package/dist/order/index.js +1 -1
  100. package/dist/runtime/index.cjs +13 -30
  101. package/dist/{diagnosticCatalog-35mrwAHe.d.ts → runtime/index.d.cts} +804 -290
  102. package/dist/runtime/index.d.ts +2678 -108
  103. package/dist/runtime/index.js +13 -30
  104. package/dist/{types-Bdj32QwA.d.ts → types-DRinG-vT.d.cts} +576 -140
  105. package/dist/types-DRinG-vT.d.ts +1792 -0
  106. package/docs/README.md +2 -1
  107. package/docs/agent-guide.md +84 -15
  108. package/docs/ai-gates.md +160 -26
  109. package/docs/arkorder.md +32 -15
  110. package/docs/brownfield-adoption.md +5 -1
  111. package/docs/configuration.md +196 -26
  112. package/docs/develop.md +2 -1
  113. package/docs/diagnostics.md +96 -19
  114. package/docs/package-surface.md +31 -8
  115. package/docs/product-voice.md +1 -1
  116. package/package.json +59 -18
  117. package/schemas/ark.analysis-result.schema.json +15 -0
  118. package/schemas/ark.config.schema.json +47 -10
  119. package/schemas/ark.resolved-candidate-facts.schema.json +1 -1
  120. package/schemas/ark.status-manifest.schema.json +22 -0
  121. package/server.json +3 -9
  122. package/templates/agent-skills/README.md +1 -1
  123. package/templates/agent-skills/ark-adopt/SKILL.md +4 -1
  124. package/templates/agent-skills/ark-order/SKILL.md +4 -2
  125. package/templates/agent-skills/ark-runtime/SKILL.md +6 -1
  126. package/templates/arkrules/PersistenceAdapters.json +1 -1
  127. package/templates/arkrules/PresentationAdapters.json +1 -1
  128. package/templates/skills/ark-adopt.md +4 -1
  129. package/templates/skills/ark-order.md +4 -2
  130. package/templates/skills/ark-runtime.md +6 -1
  131. package/dist/types-Ik_OakcI.d.ts +0 -183
@@ -1,58 +1,66 @@
1
- export { 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, A as AdapterViolationInput, 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, ac as ChangePreflightResult, ae as CollectAnalysisConfigWarningsInput, ai as DIAGNOSTIC_CATALOG, aj as DIAGNOSTIC_CATALOG_SCHEMA_VERSION, ak as DIAGNOSTIC_DOCS_RELATIVE_PATH, al as DIAGNOSTIC_RULE_IDS, 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, 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, f as ResolvedArkRunCompositionRootHitFact, b as ResolvedArkRunDeclarationFact, c as ResolvedArkRunKernelCallFact, R as ResolvedArkRunKernelCallKind, d as ResolvedArkRunManagedNewFact, aR as ResolvedCandidateFacts, aS as ResolvedCandidateFactsInput, aT as ResolvedCapability, aU as ResolvedCapabilityFact, aV as ResolvedChangePreflightResult, e as ResolvedDependencyFact, aW as ResolvedDependencyKind, aX as ResolvedDependencyState, aY as ResolvedFactsCompleteness, g as ResolvedFactsReason, 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, bc as catalogFixForRuleId, bd as catalogWhyForRuleId, be as classifyArkPolicyDelta, bg as collectAnalysisConfigWarnings, bi as collectForbiddenCapabilityUses, bk as createAICodeGate, bl as createAdapterResult, bm as createArchitectureProfile, bn as createArchitectureProfileFromArkConfig, bo as createElevenLayerArkConfig, bp as createResolvedCandidateFacts, bs as detectArchitectureCycles, bt as deterministicHash, bu as diagnosticDocsFragment, bv as diagnosticDocsPath, bw as elevenLayerProfile, bx as evaluateArchitectureGraph, bA as explainViolation, 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-35mrwAHe.js';
2
- import { P as PolicyViolation, g as PolicySeverity, h as PolicyEnforcementMode, i as Policy, I as IntentName, j as IntentCreator, k as IntentRelationship, b as ArchitectureProfile, D as DomainEvent } from '../types-Ik_OakcI.js';
3
- export { A as ArchitectureLayer, a as ArchitectureLayerConfig, c as ArchitectureRule, d as ArkCheckConfig, l as CorrelationId, C as CreateArchitectureProfileFromArkConfigOptions, e as CreateArchitectureProfileOptions, f as CreateElevenLayerArkConfigOptions, E as EventMetadata, m as IntentRelationshipKind } from '../types-Ik_OakcI.js';
4
- import { I as IntentRegistry, D as DefineIntentOptions, a as DependencyGraph, G as GraphEdge, b as AuditStore, c as AuditRecord, d as AuditQuery, e as CreateAuditTrailOptions, f as AuditTrail, E as EventContractRegistry, g as EventContract, h as EventContractValidationResult, M as MetadataRegistry, R as ReadModelStore, i as CreateProjectionRegistryOptions, P as ProjectionRegistry, j as EventBufferStore, k as EventBufferRecord, l as EventBufferStatus, m as EventBusOptions, n as EventBus, o as CreateObservabilityReporterOptions, O as ObservabilityReporter, p as PolicyEngine, q as ArkManifest, W as WorkflowStore, S as SagaContext, r as WorkflowSnapshot, s as SagaDefinition, t as CreateWorkflowEngineOptions, u as SagaInstance, v as WorkflowEngine, w as DependencyInformationPackage, C as CreateArkKernelOptions, A as ArkKernel, x as ArkKernelConfig, y as CreateArkKernelFromConfigOptions, T as TraceRecordType, z as TraceRecord, B as OutboxStatus, F as OutboxRecord, H as ObservabilityDriftReport } from '../types-Bdj32QwA.js';
5
- export { J as ARK_RUN_COMPONENT_LIFETIMES, K as ARK_RUN_EPHEMERAL_DEFAULT, L as ARK_RUN_GRAPH_DEFAULT_SLICE, N as ARK_RUN_GRAPH_NODE_KINDS, Q as ARK_RUN_GRAPH_PROCESS_EDGE_KINDS, U as ARK_RUN_GRAPH_SCHEMA_VERSION, V as ARK_RUN_GRAPH_SLICES, X as ARK_RUN_GRAPH_TECHNICAL_EDGE_KINDS, Y as ARK_RUN_INFORMATION_PACKAGE_SCHEMA_VERSION, Z as ARK_RUN_INSPECTOR_DEFAULT_HOST, _ as ARK_RUN_INSPECTOR_DEFAULT_PORT, $ as ARK_RUN_INSPECTOR_EVENTS_PATH, a0 as ARK_RUN_INSPECTOR_GRAPH_PATH, a1 as ARK_RUN_INSPECTOR_MONITOR_SAMPLE_LIMIT, a2 as ARK_RUN_INSPECTOR_OUTBOX_PATH, a3 as ARK_RUN_INSPECTOR_SCHEMA_VERSION, a4 as ARK_RUN_INSPECTOR_SNAPSHOT_PATH, a5 as ARK_RUN_INSPECTOR_SSE_EVENT, a6 as ARK_RUN_INSPECTOR_TRANSPORT_FALLBACK, a7 as ARK_RUN_INSPECTOR_WORKFLOWS_PATH, a8 as ARK_RUN_TRANSPORT_KINDS, a9 as ArkManifestArchitecture, aa as ArkManifestData, ab as ArkManifestEntityLink, ac as ArkManifestGraph, ad as ArkManifestIntent, ae as ArkManifestPolicy, af as ArkManifestProjection, ag as ArkRunBrokerAdapter, ah as ArkRunComponentLifetime, ai as ArkRunDeliveredVia, aj as ArkRunExtendedInfo, ak as ArkRunGraph, al as ArkRunGraphEdge, am as ArkRunGraphEdgeKind, an as ArkRunGraphMatch, ao as ArkRunGraphMatchInput, ap as ArkRunGraphNode, aq as ArkRunGraphNodeKind, ar as ArkRunGraphProcessEdgeKind, as as ArkRunGraphQuery, at as ArkRunGraphResolvedQuery, au as ArkRunGraphSlice, av as ArkRunGraphTechnicalEdgeKind, aw as ArkRunInformationPackageComponent, ax as ArkRunInspectorBind, ay as ArkRunInspectorBindError, az as ArkRunInspectorBindInput, aA as ArkRunInspectorHandle, aB as ArkRunInspectorHardening, aC as ArkRunInspectorHardeningDurability, aD as ArkRunInspectorMonitorBuildOptions, aE as ArkRunInspectorOutboxMonitor, aF as ArkRunInspectorOutboxRecordSummary, aG as ArkRunInspectorProductionError, aH as ArkRunInspectorSnapshot, aI as ArkRunInspectorSnapshotInput, aJ as ArkRunInspectorSource, aK as ArkRunInspectorStoreDurability, aL as ArkRunInspectorStoreDurabilityKind, aM as ArkRunInspectorStoreRole, aN as ArkRunInspectorTransportFacts, aO as ArkRunInspectorWorkflowSummary, aP as ArkRunInspectorWorkflowsMonitor, aQ as ArkRunPublisher, aR as ArkRunRegisterOptions, aS as ArkRunRegistrationHandle, aT as ArkRunSendOptions, aU as ArkRunSendPlan, aV as ArkRunSendPlanInput, aW as ArkRunSendResult, aX as ArkRunTransportKind, aY as AuditRecordInput, aZ as AuditRecordType, a_ as EntityMeta, a$ as EventContractIssue, b0 as EventHandler, b1 as EventInterceptionInfo, b2 as EventInterceptor, b3 as EventInterceptorContext, b4 as EventPayloadPatch, b5 as EventPayloadSchema, b6 as EventPublisher, b7 as EventSchemaField, b8 as EventSchemaFieldType, b9 as FieldMeta, ba as GraphNode, bb as InvalidArkRunGraphQueryError, bc as InvalidArkRunSendOptionError, bd as ObservabilityFlow, be as ObservedLayerFlowMode, bf as OutboxStore, bg as PolicyEvaluationResult, bh as ProjectionCheckpoint, bi as ProjectionDefinition, bj as PublishedEventRecord, bk as RetryPolicy, bl as SagaStatus, bm as SagaStep, bn as StartArkRunInspectorOptions, bo as TraceSink, bp as Unsubscribe, bq as WorkflowDefinition, br as WorkflowStatus, bs as WorkflowStep, bt as appendDecisionTape, bu as arkRunGraphQueryFromSearchParams, bv as arkRunInspectorUrl, bw as buildArkRunInspectorHardening, bx as buildArkRunInspectorOutboxMonitor, by as buildArkRunInspectorSnapshot, bz as buildArkRunInspectorWorkflowsMonitor, bA as buildDependencyInformationPackage, bB as classifyArkRunInspectorStoreDurability, bC as closeArkRunGraphQuery, bD as closedArkRunEphemeral, bE as closedArkRunTransportKind, bF as formatArkRunGraphMermaid, bG as formatArkRunInspectorSseEvent, bH as isArkRunInspectorLoopbackHost, bI as isArkRunInspectorProductionEnv, bJ as requestArkRunGraph, bK as resolveArkRunInspectorBind, bL as resolveArkRunSendPlan, bM as startArkRunInspector, bN as unavailableArkRunInspectorOutboxMonitor, bO as unavailableArkRunInspectorWorkflowsMonitor } from '../types-Bdj32QwA.js';
6
- import '../configTypes-Bbf_MFGe.js';
1
+ import { a as AuditStore, b as AuditRecord, c as AuditQuery, d as CreateAuditTrailOptions, e as AuditTrail, f as CreateArchitectureProfileOptions, g as ArchitectureProfile, h as ArkCheckConfig, i as CreateArchitectureProfileFromArkConfigOptions, j as CreateElevenLayerArkConfigOptions, D as DependencyGraph, I as IntentRegistry, E as EventContractRegistry, k as EventContract, l as DomainEvent, m as EventContractValidationResult, n as IntentName, o as DefineIntentOptions, p as IntentCreator, M as MetadataRegistry, R as ReadModelStore, q as CreateProjectionRegistryOptions, P as ProjectionRegistry, r as PolicyViolation, s as PolicySeverity, t as PolicyEnforcementMode, u as Policy, G as GraphEdge, v as IntentRelationship, w as EventBufferStore, x as EventBufferRecord, y as EventBufferStatus, z as EventBusOptions, B as EventBus, F as CreateObservabilityReporterOptions, O as ObservabilityReporter, H as PolicyEngine, J as ArkManifest, W as WorkflowStore, S as SagaContext, K as WorkflowSnapshot, L as SagaDefinition, N as CreateWorkflowEngineOptions, Q as SagaInstance, T as WorkflowEngine, U as DependencyInformationPackage, C as CreateArkKernelOptions, A as ArkKernel, V as ArkKernelConfig, X as CreateArkKernelFromConfigOptions, Y as TraceRecordType, Z as TraceRecord, _ as OutboxStatus, $ as OutboxRecord, a0 as ObservabilityDriftReport, a1 as ArkConfig, a2 as ArkConfigLoadResult } from '../types-DRinG-vT.js';
2
+ export { a3 as ARK_RUN_COMPONENT_LIFETIMES, a4 as ARK_RUN_EPHEMERAL_DEFAULT, a5 as ARK_RUN_GRAPH_DEFAULT_SLICE, a6 as ARK_RUN_GRAPH_NODE_KINDS, a7 as ARK_RUN_GRAPH_PROCESS_EDGE_KINDS, a8 as ARK_RUN_GRAPH_SCHEMA_VERSION, a9 as ARK_RUN_GRAPH_SLICES, aa as ARK_RUN_GRAPH_TECHNICAL_EDGE_KINDS, ab as ARK_RUN_INFORMATION_PACKAGE_SCHEMA_VERSION, ac as ARK_RUN_INSPECTOR_DEFAULT_HOST, ad as ARK_RUN_INSPECTOR_DEFAULT_PORT, ae as ARK_RUN_INSPECTOR_EVENTS_PATH, af as ARK_RUN_INSPECTOR_GRAPH_PATH, ag as ARK_RUN_INSPECTOR_MONITOR_SAMPLE_LIMIT, ah as ARK_RUN_INSPECTOR_OUTBOX_PATH, ai as ARK_RUN_INSPECTOR_SCHEMA_VERSION, aj as ARK_RUN_INSPECTOR_SNAPSHOT_PATH, ak as ARK_RUN_INSPECTOR_SSE_EVENT, al as ARK_RUN_INSPECTOR_TRANSPORT_FALLBACK, am as ARK_RUN_INSPECTOR_WORKFLOWS_PATH, an as ARK_RUN_TRANSPORT_KINDS, ao as ArchitectureLayer, ap as ArchitectureLayerConfig, aq as ArchitectureRule, ar as ArkManifestArchitecture, as as ArkManifestData, at as ArkManifestEntityLink, au as ArkManifestGraph, av as ArkManifestIntent, aw as ArkManifestPolicy, ax as ArkManifestProjection, ay as ArkRunBrokerAdapter, az as ArkRunComponentLifetime, aA as ArkRunDeliveredVia, aB as ArkRunExtendedInfo, aC as ArkRunGraph, aD as ArkRunGraphEdge, aE as ArkRunGraphEdgeKind, aF as ArkRunGraphMatch, aG as ArkRunGraphMatchInput, aH as ArkRunGraphNode, aI as ArkRunGraphNodeKind, aJ as ArkRunGraphProcessEdgeKind, aK as ArkRunGraphQuery, aL as ArkRunGraphResolvedQuery, aM as ArkRunGraphSlice, aN as ArkRunGraphTechnicalEdgeKind, aO as ArkRunInformationPackageComponent, aP as ArkRunInspectorBind, aQ as ArkRunInspectorBindError, aR as ArkRunInspectorBindInput, aS as ArkRunInspectorHandle, aT as ArkRunInspectorHardening, aU as ArkRunInspectorHardeningDurability, aV as ArkRunInspectorMonitorBuildOptions, aW as ArkRunInspectorOutboxMonitor, aX as ArkRunInspectorOutboxRecordSummary, aY as ArkRunInspectorProductionError, aZ as ArkRunInspectorSnapshot, a_ as ArkRunInspectorSnapshotInput, a$ as ArkRunInspectorSource, b0 as ArkRunInspectorStoreDurability, b1 as ArkRunInspectorStoreDurabilityKind, b2 as ArkRunInspectorStoreRole, b3 as ArkRunInspectorTransportFacts, b4 as ArkRunInspectorWorkflowSummary, b5 as ArkRunInspectorWorkflowsMonitor, b6 as ArkRunPublisher, b7 as ArkRunRegisterOptions, b8 as ArkRunRegistrationHandle, b9 as ArkRunSendOptions, ba as ArkRunSendPlan, bb as ArkRunSendPlanInput, bc as ArkRunSendResult, bd as ArkRunTransportKind, be as AuditRecordInput, bf as AuditRecordType, bg as CorrelationId, bh as EntityMeta, bi as EventContractIssue, bj as EventHandler, bk as EventInterceptionInfo, bl as EventInterceptor, bm as EventInterceptorContext, bn as EventMetadata, bo as EventPayloadPatch, bp as EventPayloadSchema, bq as EventPublisher, br as EventSchemaField, bs as EventSchemaFieldType, bt as FieldMeta, bu as GraphNode, bv as IntentRelationshipKind, bw as InvalidArkRunGraphQueryError, bx as InvalidArkRunSendOptionError, by as ObservabilityFlow, bz as ObservedLayerFlowMode, bA as OutboxStore, bB as PolicyEvaluationResult, bC as ProjectionCheckpoint, bD as ProjectionDefinition, bE as PublishedEventRecord, bF as RetryPolicy, bG as SagaStatus, bH as SagaStep, bI as StartArkRunInspectorOptions, bJ as TraceSink, bK as Unsubscribe, bL as WorkflowDefinition, bM as WorkflowStatus, bN as WorkflowStep, bO as appendDecisionTape, bP as arkRunGraphQueryFromSearchParams, bQ as arkRunInspectorUrl, bR as buildArkRunInspectorHardening, bS as buildArkRunInspectorOutboxMonitor, bT as buildArkRunInspectorSnapshot, bU as buildArkRunInspectorWorkflowsMonitor, bV as buildDependencyInformationPackage, bW as classifyArkRunInspectorStoreDurability, bX as closeArkRunGraphQuery, bY as closedArkRunEphemeral, bZ as closedArkRunTransportKind, b_ as formatArkRunGraphMermaid, b$ as formatArkRunInspectorSseEvent, c0 as isArkRunInspectorLoopbackHost, c1 as isArkRunInspectorProductionEnv, c2 as requestArkRunGraph, c3 as resolveArkRunInspectorBind, c4 as resolveArkRunSendPlan, c5 as startArkRunInspector, c6 as unavailableArkRunInspectorOutboxMonitor, c7 as unavailableArkRunInspectorWorkflowsMonitor } from '../types-DRinG-vT.js';
7
3
 
8
4
  /**
9
- * Typed error thrown when hard policies are violated.
5
+ * Reference in-process audit store. **Not production durability** — records do not
6
+ * survive process restarts. For production, inject an `AuditStore` that writes to your
7
+ * durable log/DB (see `docs/production-hardening.md`).
10
8
  */
11
-
12
- declare class PolicyViolationError extends Error {
13
- readonly violations: PolicyViolation[];
14
- constructor(violations: PolicyViolation[]);
9
+ declare class InMemoryAuditStore implements AuditStore {
10
+ private readonly maxRecords?;
11
+ private readonly records;
12
+ constructor(maxRecords?: number | undefined);
13
+ append(record: AuditRecord): void;
14
+ query(query?: AuditQuery): AuditRecord[];
15
+ clear(): void;
15
16
  }
17
+ /**
18
+ * Create an audit trail. Defaults to `InMemoryAuditStore` (**not** production durability).
19
+ * Pass `options.store` for a durable backend.
20
+ */
21
+ declare function createAuditTrail(options?: CreateAuditTrailOptions): AuditTrail;
22
+
23
+ declare function createArchitectureProfile(options: CreateArchitectureProfileOptions): ArchitectureProfile;
24
+ declare function createArchitectureProfileFromArkConfig(config: ArkCheckConfig, options?: CreateArchitectureProfileFromArkConfigOptions): ArchitectureProfile;
25
+ declare const elevenLayerProfile: ArchitectureProfile;
26
+ declare function createElevenLayerArkConfig(options?: CreateElevenLayerArkConfigOptions): ArkCheckConfig;
16
27
 
17
28
  /**
18
- * definePolicy
29
+ * DependencyGraph implementation.
19
30
  *
20
- * Factory function to create architectural policies in a declarative way.
31
+ * Collects declared and observed relationships.
32
+ * Generates Mermaid diagrams and JSON.
33
+ * Supports simple violation detection via rule functions.
21
34
  */
22
35
 
23
- interface DefinePolicyOptions<Context = unknown> {
24
- name: string;
25
- severity?: PolicySeverity;
26
- tags?: readonly string[];
27
- owner?: string;
28
- version?: string;
29
- rationale?: string;
30
- enforcementMode?: PolicyEnforcementMode;
31
- deprecated?: boolean | string;
32
- replacedBy?: string;
33
- check: (context: Context) => boolean | PolicyViolation | PolicyViolation[];
36
+ declare function createDependencyGraph(): DependencyGraph;
37
+
38
+ /**
39
+ * Bridge IntentRegistry relationships into a DependencyGraph.
40
+ */
41
+
42
+ interface SyncRegistryOptions {
43
+ /** Skip edges whose target intent is not registered (default: false). */
44
+ requireRegisteredTargets?: boolean;
34
45
  }
35
46
  /**
36
- * Creates a Policy from a declarative configuration.
37
- *
38
- * The provided `check` function is called as-is. The PolicyEngine is responsible
39
- * for normalizing results (booleans, single violations, arrays) into a consistent
40
- * set of PolicyViolation objects.
47
+ * Sync declared intent relationships from a registry into a dependency graph.
41
48
  *
42
- * @example
43
- * ```ts
44
- * const noDomainToInfra = definePolicy({
45
- * name: 'Domain must not depend on infrastructure',
46
- * severity: 'hard',
47
- * check: (ctx) => {
48
- * const violations: PolicyViolation[] = [];
49
- * // ... logic using ctx.registry.getAllRelationships()
50
- * return violations.length > 0 ? violations : true;
51
- * }
52
- * });
53
- * ```
49
+ * - `dependsOn` → `declared` edges
50
+ * - `produces` → `produces` edges
54
51
  */
55
- declare function definePolicy<Context = unknown>(options: DefinePolicyOptions<Context>): Policy<Context>;
52
+ declare function syncRegistryToGraph(registry: IntentRegistry, graph: DependencyGraph, options?: SyncRegistryOptions): void;
53
+
54
+ declare class EventContractRegistryImpl implements EventContractRegistry {
55
+ private readonly contracts;
56
+ register(contract: EventContract): void;
57
+ get(intent: string, version?: string): EventContract | undefined;
58
+ list(intent?: string): EventContract[];
59
+ validate(event: DomainEvent): EventContractValidationResult;
60
+ clear(): void;
61
+ private key;
62
+ }
63
+ declare function createEventContractRegistry(): EventContractRegistry;
56
64
 
57
65
  /**
58
66
  * defineIntent
@@ -121,30 +129,71 @@ interface IntentNameValidation {
121
129
  declare function validateIntentName(name: string): IntentNameValidation;
122
130
 
123
131
  /**
124
- * DependencyGraph implementation.
125
- *
126
- * Collects declared and observed relationships.
127
- * Generates Mermaid diagrams and JSON.
128
- * Supports simple violation detection via rule functions.
132
+ * Basic MetadataRegistry implementation.
129
133
  */
130
134
 
131
- declare function createDependencyGraph(): DependencyGraph;
135
+ declare function createMetadataRegistry(): MetadataRegistry;
132
136
 
133
137
  /**
134
- * Bridge IntentRegistry relationships into a DependencyGraph.
138
+ * Reference in-process read-model store. **Not production durability.**
139
+ * See `docs/production-hardening.md`.
140
+ */
141
+ declare class InMemoryReadModelStore implements ReadModelStore {
142
+ private readonly states;
143
+ load<State = unknown>(name: string): State | undefined;
144
+ save<State = unknown>(name: string, state: State): void;
145
+ clear(name?: string): void;
146
+ }
147
+ declare function createProjectionRegistry(options?: CreateProjectionRegistryOptions): ProjectionRegistry;
148
+
149
+ /**
150
+ * Typed error thrown when hard policies are violated.
135
151
  */
136
152
 
137
- interface SyncRegistryOptions {
138
- /** Skip edges whose target intent is not registered (default: false). */
139
- requireRegisteredTargets?: boolean;
153
+ declare class PolicyViolationError extends Error {
154
+ readonly violations: PolicyViolation[];
155
+ constructor(violations: PolicyViolation[]);
140
156
  }
157
+
141
158
  /**
142
- * Sync declared intent relationships from a registry into a dependency graph.
159
+ * definePolicy
143
160
  *
144
- * - `dependsOn` → `declared` edges
145
- * - `produces` → `produces` edges
161
+ * Factory function to create architectural policies in a declarative way.
146
162
  */
147
- declare function syncRegistryToGraph(registry: IntentRegistry, graph: DependencyGraph, options?: SyncRegistryOptions): void;
163
+
164
+ interface DefinePolicyOptions<Context = unknown> {
165
+ name: string;
166
+ severity?: PolicySeverity;
167
+ tags?: readonly string[];
168
+ owner?: string;
169
+ version?: string;
170
+ rationale?: string;
171
+ enforcementMode?: PolicyEnforcementMode;
172
+ deprecated?: boolean | string;
173
+ replacedBy?: string;
174
+ check: (context: Context) => boolean | PolicyViolation | PolicyViolation[];
175
+ }
176
+ /**
177
+ * Creates a Policy from a declarative configuration.
178
+ *
179
+ * The provided `check` function is called as-is. The PolicyEngine is responsible
180
+ * for normalizing results (booleans, single violations, arrays) into a consistent
181
+ * set of PolicyViolation objects.
182
+ *
183
+ * @example
184
+ * ```ts
185
+ * const noDomainToInfra = definePolicy({
186
+ * name: 'Domain must not depend on infrastructure',
187
+ * severity: 'hard',
188
+ * check: (ctx) => {
189
+ * const violations: PolicyViolation[] = [];
190
+ * // ... logic using ctx.registry.getAllRelationships()
191
+ * return violations.length > 0 ? violations : true;
192
+ * }
193
+ * });
194
+ * ```
195
+ */
196
+ declare function definePolicy<Context = unknown>(options: DefinePolicyOptions<Context>): Policy<Context>;
148
197
 
149
198
  /**
150
199
  * Built-in architectural policy helpers.
@@ -196,61 +245,45 @@ declare function defineArchitectureProfilePolicy<Context extends {
196
245
  relationships?: IntentRelationship[];
197
246
  }>(profile: ArchitectureProfile, options?: Omit<LayerPolicyOptions, 'rules' | 'resolveLayer'>): Policy<Context>;
198
247
 
199
- /**
200
- * Reference in-process audit store. **Not production durability** — records do not
201
- * survive process restarts. For production, inject an `AuditStore` that writes to your
202
- * durable log/DB (see `docs/production-hardening.md`).
203
- */
204
- declare class InMemoryAuditStore implements AuditStore {
205
- private readonly maxRecords?;
206
- private readonly records;
207
- constructor(maxRecords?: number | undefined);
208
- append(record: AuditRecord): void;
209
- query(query?: AuditQuery): AuditRecord[];
210
- clear(): void;
211
- }
212
- /**
213
- * Create an audit trail. Defaults to `InMemoryAuditStore` (**not** production durability).
214
- * Pass `options.store` for a durable backend.
215
- */
216
- declare function createAuditTrail(options?: CreateAuditTrailOptions): AuditTrail;
217
-
218
- declare class EventContractRegistryImpl implements EventContractRegistry {
219
- private readonly contracts;
220
- register(contract: EventContract): void;
221
- get(intent: string, version?: string): EventContract | undefined;
222
- list(intent?: string): EventContract[];
223
- validate(event: DomainEvent): EventContractValidationResult;
224
- clear(): void;
225
- private key;
226
- }
227
- declare function createEventContractRegistry(): EventContractRegistry;
228
-
229
- /**
230
- * Basic MetadataRegistry implementation.
231
- */
232
-
233
- declare function createMetadataRegistry(): MetadataRegistry;
234
-
235
- /**
236
- * Reference in-process read-model store. **Not production durability.**
237
- * See `docs/production-hardening.md`.
238
- */
239
- declare class InMemoryReadModelStore implements ReadModelStore {
240
- private readonly states;
241
- load<State = unknown>(name: string): State | undefined;
242
- save<State = unknown>(name: string, state: State): void;
243
- clear(name?: string): void;
248
+ interface InMemoryEventBufferOptions {
249
+ /**
250
+ * Maximum records retained. When exceeded, the oldest settled record
251
+ * (`dispatched` / `failed`) is evicted first; only when every record is still
252
+ * `pending` is the oldest pending record evicted, and `evictedPending` counts
253
+ * it so the loss is visible. A record evicted while still in flight that is
254
+ * settled afterwards (`markDispatched` / `markFailed`) was delivered, not lost,
255
+ * so it leaves the count. Default: unbounded (`Infinity`). Kernels built by
256
+ * `createArkKernel` pass `maxHistorySize` (default 1000).
257
+ */
258
+ maxRecords?: number;
244
259
  }
245
- declare function createProjectionRegistry(options?: CreateProjectionRegistryOptions): ProjectionRegistry;
246
-
247
260
  /**
248
261
  * Reference in-process event buffer. **Not production durability** — state is lost on
249
262
  * process exit. Use only for tests/demos/local single-process work; inject a durable
250
- * This is not an atomic outbox (see `docs/production-hardening.md`).
263
+ * store for production. This is not an atomic outbox (see `docs/production-hardening.md`).
251
264
  */
252
265
  declare class InMemoryEventBuffer implements EventBufferStore {
253
266
  private readonly records;
267
+ private readonly maxRecords;
268
+ /**
269
+ * Ids evicted while `pending`, oldest first. A later settle removes the id (the
270
+ * record was in flight, not lost). Bounded to {@link EVICTED_PENDING_TRACK_LIMIT}
271
+ * ids so the tracker itself cannot grow without limit; ids that fall off stay counted.
272
+ */
273
+ private readonly evictedPendingIds;
274
+ private evictedPendingCount;
275
+ constructor(options?: InMemoryEventBufferOptions);
276
+ /**
277
+ * Pending records dropped because the cap was reached with nothing settled to
278
+ * evict, and never settled afterwards. Records still in flight when evicted
279
+ * (e.g. fire-and-forget local handlers) leave the count once the kernel
280
+ * settles them.
281
+ */
282
+ get evictedPending(): number;
283
+ private trackEvictedPending;
284
+ /** A settle for an evicted in-flight record: delivered, so not a loss. */
285
+ private settleEvicted;
286
+ private evictOverflow;
254
287
  enqueue(event: DomainEvent): Promise<EventBufferRecord>;
255
288
  markDispatched(id: string): Promise<void>;
256
289
  markFailed(id: string, error: unknown): Promise<void>;
@@ -349,6 +382,20 @@ declare class ObservedLayerFlowViolationError extends Error {
349
382
  readonly toLayer: string;
350
383
  constructor(source: string, intentName: string, fromLayer: string, toLayer: string, message?: string);
351
384
  }
385
+ /**
386
+ * A kernel built from an `ark.config.json` was explicitly asked for hard
387
+ * observed-layer-flow enforcement (`enforceObservedLayerFlow: 'hard'`), but some
388
+ * deny-rule layers declare no `intentPrefixes` and are not canonical 11-layer
389
+ * names (which get built-in prefixes), so no intent maps to them and the rule
390
+ * would be a silent no-op. With the strict default (hard implied, not passed),
391
+ * the kernel builds and records a `layer.observedFlowUnresolvable` audit record
392
+ * instead. Fix: add `intentPrefixes`, or pass `'soft' | 'off'`.
393
+ */
394
+ declare class ArkKernelConfigError extends Error {
395
+ readonly code: 'ARKRUN_LAYER_FLOW_UNRESOLVABLE';
396
+ readonly layers: string[];
397
+ constructor(layers: string[]);
398
+ }
352
399
 
353
400
  declare function createObservabilityReporter(options: CreateObservabilityReporterOptions): ObservabilityReporter;
354
401
 
@@ -396,6 +443,420 @@ declare function createSaga<P extends SagaContext = SagaContext>(def: SagaDefini
396
443
  id?: string;
397
444
  }): SagaInstance<P>;
398
445
 
446
+ /** ArkGate library version — single source of truth. */
447
+ declare const version = "4.8.24";
448
+
449
+ /** Versioned public result contract types + JSON Schema (adapter envelope). */
450
+ /**
451
+ * 1.5 adds stable finding refs on every factory-emitted diagnostic (ACS06):
452
+ * `findingRef`, `targetKey` (baseline-compatible), `docsCodePath`.
453
+ * 1.4 added optional evidence.arkruleId + evidence.arkruleSource (ADR 0012 / AR03).
454
+ */
455
+ declare const ARK_ANALYSIS_RESULT_SCHEMA_VERSION: "1.5";
456
+ type AdapterSeverity = 'error' | 'warning';
457
+ type AnalysisCompleteness = 'complete' | 'partial' | 'unavailable';
458
+ type AnalysisMode = 'lexical-compatibility' | 'resolved-candidate-facts';
459
+ type AdapterCompletenessReason = {
460
+ code: string;
461
+ message: string;
462
+ file?: string;
463
+ };
464
+ type AdapterViolationInput = {
465
+ ruleId?: unknown;
466
+ code?: unknown;
467
+ message?: unknown;
468
+ file?: unknown;
469
+ line?: unknown;
470
+ column?: unknown;
471
+ target?: unknown;
472
+ fromLayer?: unknown;
473
+ toLayer?: unknown;
474
+ typeOnly?: unknown;
475
+ targetTypeOnlyExports?: unknown;
476
+ sourcePureTypeModule?: unknown;
477
+ namedBindingsTypeOnly?: unknown;
478
+ portProofEligible?: unknown;
479
+ peerIsolation?: unknown;
480
+ edgeKind?: unknown;
481
+ severity?: unknown;
482
+ /** When false, finding is non-blocking (e.g. type-only placement debt). */
483
+ failsStrict?: unknown;
484
+ /** Nested-wall reason. The ruleId stays LAYER_IMPORT_VIOLATION. Not part of the baseline key. */
485
+ reasonId?: unknown;
486
+ /** Last segment of the importer universe id, when the finding has a reasonId. */
487
+ universeFrom?: unknown;
488
+ /** Last segment of the importee universe id, when the finding has a reasonId. */
489
+ universeTo?: unknown;
490
+ nextAction?: unknown;
491
+ /** U04: the denied capability id on CAPABILITY_VIOLATION. */
492
+ capability?: unknown;
493
+ /** AR03: ArkRule identity for structure/invariant diagnostics. */
494
+ arkruleId?: unknown;
495
+ /** AR03: project-relative ArkRules source file that declared the rule. */
496
+ arkruleSource?: unknown;
497
+ };
498
+ type AdapterDiagnostic = {
499
+ ruleId: string;
500
+ severity: AdapterSeverity;
501
+ message: string;
502
+ location: {
503
+ file: string;
504
+ line: number;
505
+ column: number;
506
+ };
507
+ evidence: {
508
+ target?: string;
509
+ fromLayer?: string;
510
+ toLayer?: string;
511
+ typeOnly?: boolean;
512
+ targetTypeOnlyExports?: boolean;
513
+ sourcePureTypeModule?: boolean;
514
+ namedBindingsTypeOnly?: boolean;
515
+ portProofEligible?: boolean;
516
+ peerIsolation?: boolean;
517
+ capability?: string;
518
+ edgeKind?: string;
519
+ /** AR03 — ArkRule id (structure or invariant). */
520
+ arkruleId?: string;
521
+ /** AR03 — ArkRules source file path. */
522
+ arkruleSource?: string;
523
+ /** Nested-wall reason. Not part of the baseline key. */
524
+ reasonId?: 'CROSS_PARENT_SLICE' | 'CROSS_SIBLING_SLICE' | 'CROSS_PARENT_VIA_SHARED';
525
+ /** Last segment of the importer universe id, with a reasonId. */
526
+ universeFrom?: string;
527
+ /** Last segment of the importee universe id, with a reasonId. */
528
+ universeTo?: string;
529
+ };
530
+ /** Added in schema 1.1; optional in TypeScript so 1.0 consumer-owned values remain valid. */
531
+ nextAction?: string;
532
+ /**
533
+ * ACS06 / schema 1.5 — compact stable id for multi-turn re-address
534
+ * (`fnv1a-` + hex). Always derived from `targetKey`. Optional so 1.0–1.4
535
+ * consumer-owned diagnostics remain assignable.
536
+ */
537
+ findingRef?: string;
538
+ /**
539
+ * ACS06 / schema 1.5 — baseline-compatible freeze identity
540
+ * (`ruleId|file|fromLayer|toLayer|target`, with occurrence `#N` suffixes in lists).
541
+ * Must match `baselineKey` / `baselineOccurrenceKeys` so refs never orphan baselines.
542
+ */
543
+ targetKey?: string;
544
+ /**
545
+ * ACS06 / schema 1.5 — package-relative docs path with rule anchor
546
+ * (`docs/diagnostics.md#RULE_ID`). Optional for legacy consumer-owned values.
547
+ */
548
+ docsCodePath?: string;
549
+ };
550
+ type LegacyAdapterResult = {
551
+ schemaVersion: '1.0' | '1.1';
552
+ valid: boolean;
553
+ diagnostics: AdapterDiagnostic[];
554
+ completeness?: never;
555
+ mode?: never;
556
+ };
557
+ type Version12AdapterResultBase = {
558
+ schemaVersion: '1.2';
559
+ diagnostics: AdapterDiagnostic[];
560
+ mode?: never;
561
+ };
562
+ type Version12AdapterResult = (Version12AdapterResultBase & {
563
+ completeness: 'complete';
564
+ valid: boolean;
565
+ }) | (Version12AdapterResultBase & {
566
+ completeness: 'partial' | 'unavailable';
567
+ valid: false;
568
+ });
569
+ type CurrentAdapterResultBase = {
570
+ schemaVersion: typeof ARK_ANALYSIS_RESULT_SCHEMA_VERSION;
571
+ completenessReasons: AdapterCompletenessReason[];
572
+ diagnostics: AdapterDiagnostic[];
573
+ };
574
+ type ResolvedAdapterEvidence = {
575
+ policyHash: string;
576
+ resolverIdentity: string;
577
+ factsHash: string;
578
+ candidateTreeHash: string;
579
+ };
580
+ type CurrentAdapterResult = (CurrentAdapterResultBase & Partial<ResolvedAdapterEvidence> & {
581
+ mode: 'lexical-compatibility';
582
+ valid: boolean;
583
+ completeness: 'complete';
584
+ }) | (CurrentAdapterResultBase & Partial<ResolvedAdapterEvidence> & {
585
+ mode: 'lexical-compatibility';
586
+ valid: false;
587
+ completeness: 'partial' | 'unavailable';
588
+ }) | (CurrentAdapterResultBase & ResolvedAdapterEvidence & {
589
+ mode: 'resolved-candidate-facts';
590
+ valid: boolean;
591
+ completeness: 'complete';
592
+ }) | (CurrentAdapterResultBase & ResolvedAdapterEvidence & {
593
+ mode: 'resolved-candidate-facts';
594
+ valid: false;
595
+ completeness: 'partial';
596
+ }) | (CurrentAdapterResultBase & Partial<ResolvedAdapterEvidence> & {
597
+ mode: 'resolved-candidate-facts';
598
+ valid: false;
599
+ completeness: 'unavailable';
600
+ });
601
+ type AdapterResult = LegacyAdapterResult | Version12AdapterResult | CurrentAdapterResult;
602
+ declare const ARK_ANALYSIS_RESULT_SCHEMA: {
603
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
604
+ readonly $id: "https://unpkg.com/arkgate@3/schemas/ark.analysis-result.schema.json";
605
+ readonly title: "ArkGate analysis result";
606
+ readonly type: "object";
607
+ readonly additionalProperties: false;
608
+ readonly required: readonly ["schemaVersion", "mode", "valid", "completeness", "completenessReasons", "diagnostics"];
609
+ readonly allOf: readonly [{
610
+ readonly if: {
611
+ readonly properties: {
612
+ readonly completeness: {
613
+ readonly enum: readonly ["partial", "unavailable"];
614
+ };
615
+ };
616
+ readonly required: readonly ["completeness"];
617
+ };
618
+ readonly then: {
619
+ readonly properties: {
620
+ readonly valid: {
621
+ readonly const: false;
622
+ };
623
+ };
624
+ };
625
+ }, {
626
+ readonly if: {
627
+ readonly properties: {
628
+ readonly mode: {
629
+ readonly const: "resolved-candidate-facts";
630
+ };
631
+ readonly completeness: {
632
+ readonly enum: readonly ["complete", "partial"];
633
+ };
634
+ };
635
+ readonly required: readonly ["mode", "completeness"];
636
+ };
637
+ readonly then: {
638
+ readonly required: readonly ["policyHash", "resolverIdentity", "factsHash", "candidateTreeHash"];
639
+ };
640
+ }, {
641
+ readonly if: {
642
+ readonly properties: {
643
+ readonly completeness: {
644
+ readonly const: "complete";
645
+ };
646
+ };
647
+ readonly required: readonly ["completeness"];
648
+ };
649
+ readonly then: {
650
+ readonly properties: {
651
+ readonly completenessReasons: {
652
+ readonly maxItems: 0;
653
+ };
654
+ };
655
+ };
656
+ readonly else: {
657
+ readonly properties: {
658
+ readonly completenessReasons: {
659
+ readonly minItems: 1;
660
+ };
661
+ };
662
+ };
663
+ }];
664
+ readonly properties: {
665
+ readonly schemaVersion: {
666
+ readonly const: "1.5";
667
+ };
668
+ readonly mode: {
669
+ readonly enum: readonly ["lexical-compatibility", "resolved-candidate-facts"];
670
+ };
671
+ readonly valid: {
672
+ readonly type: "boolean";
673
+ };
674
+ readonly completeness: {
675
+ readonly enum: readonly ["complete", "partial", "unavailable"];
676
+ };
677
+ readonly completenessReasons: {
678
+ readonly type: "array";
679
+ readonly items: {
680
+ readonly type: "object";
681
+ readonly additionalProperties: false;
682
+ readonly required: readonly ["code", "message"];
683
+ readonly properties: {
684
+ readonly code: {
685
+ readonly type: "string";
686
+ readonly minLength: 1;
687
+ };
688
+ readonly message: {
689
+ readonly type: "string";
690
+ readonly minLength: 1;
691
+ };
692
+ readonly file: {
693
+ readonly type: "string";
694
+ readonly minLength: 1;
695
+ };
696
+ };
697
+ };
698
+ };
699
+ readonly policyHash: {
700
+ readonly type: "string";
701
+ readonly minLength: 1;
702
+ };
703
+ readonly resolverIdentity: {
704
+ readonly type: "string";
705
+ readonly minLength: 1;
706
+ };
707
+ readonly factsHash: {
708
+ readonly type: "string";
709
+ readonly minLength: 1;
710
+ };
711
+ readonly candidateTreeHash: {
712
+ readonly type: "string";
713
+ readonly minLength: 1;
714
+ };
715
+ readonly diagnostics: {
716
+ readonly type: "array";
717
+ readonly items: {
718
+ readonly type: "object";
719
+ readonly additionalProperties: false;
720
+ readonly required: readonly ["ruleId", "severity", "message", "location", "evidence"];
721
+ readonly properties: {
722
+ readonly ruleId: {
723
+ readonly type: "string";
724
+ readonly minLength: 1;
725
+ };
726
+ readonly severity: {
727
+ readonly enum: readonly ["error", "warning"];
728
+ };
729
+ readonly message: {
730
+ readonly type: "string";
731
+ readonly minLength: 1;
732
+ };
733
+ readonly location: {
734
+ readonly type: "object";
735
+ readonly additionalProperties: false;
736
+ readonly required: readonly ["file", "line", "column"];
737
+ readonly properties: {
738
+ readonly file: {
739
+ readonly type: "string";
740
+ readonly minLength: 1;
741
+ };
742
+ readonly line: {
743
+ readonly type: "integer";
744
+ readonly minimum: 1;
745
+ };
746
+ readonly column: {
747
+ readonly type: "integer";
748
+ readonly minimum: 1;
749
+ };
750
+ };
751
+ };
752
+ readonly evidence: {
753
+ readonly type: "object";
754
+ readonly additionalProperties: false;
755
+ readonly properties: {
756
+ readonly target: {
757
+ readonly type: "string";
758
+ };
759
+ readonly fromLayer: {
760
+ readonly type: "string";
761
+ };
762
+ readonly toLayer: {
763
+ readonly type: "string";
764
+ };
765
+ readonly typeOnly: {
766
+ readonly type: "boolean";
767
+ };
768
+ readonly targetTypeOnlyExports: {
769
+ readonly type: "boolean";
770
+ };
771
+ readonly sourcePureTypeModule: {
772
+ readonly type: "boolean";
773
+ };
774
+ readonly namedBindingsTypeOnly: {
775
+ readonly type: "boolean";
776
+ };
777
+ readonly portProofEligible: {
778
+ readonly type: "boolean";
779
+ };
780
+ readonly peerIsolation: {
781
+ readonly type: "boolean";
782
+ };
783
+ readonly capability: {
784
+ readonly type: "string";
785
+ readonly minLength: 1;
786
+ };
787
+ readonly edgeKind: {
788
+ readonly type: "string";
789
+ readonly minLength: 1;
790
+ };
791
+ readonly arkruleId: {
792
+ readonly type: "string";
793
+ readonly minLength: 1;
794
+ };
795
+ readonly arkruleSource: {
796
+ readonly type: "string";
797
+ readonly minLength: 1;
798
+ };
799
+ readonly reasonId: {
800
+ readonly enum: readonly ["CROSS_PARENT_SLICE", "CROSS_SIBLING_SLICE", "CROSS_PARENT_VIA_SHARED"];
801
+ };
802
+ readonly universeFrom: {
803
+ readonly type: "string";
804
+ readonly minLength: 1;
805
+ };
806
+ readonly universeTo: {
807
+ readonly type: "string";
808
+ readonly minLength: 1;
809
+ };
810
+ };
811
+ };
812
+ readonly nextAction: {
813
+ readonly type: "string";
814
+ readonly minLength: 1;
815
+ };
816
+ /** ACS06 — compact multi-turn id; always derived from targetKey when emitted. */
817
+ readonly findingRef: {
818
+ readonly type: "string";
819
+ readonly minLength: 1;
820
+ readonly pattern: "^fnv1a-[0-9a-f]{8}$";
821
+ };
822
+ /**
823
+ * ACS06 — baseline-compatible freeze identity
824
+ * (`ruleId|file|from|to|target` with optional `#N` occurrence suffix).
825
+ */
826
+ readonly targetKey: {
827
+ readonly type: "string";
828
+ readonly minLength: 1;
829
+ };
830
+ /** ACS06 — package-relative diagnostics anchor path. */
831
+ readonly docsCodePath: {
832
+ readonly type: "string";
833
+ readonly minLength: 1;
834
+ };
835
+ };
836
+ };
837
+ };
838
+ };
839
+ };
840
+
841
+ declare function toAdapterDiagnostic(violation: AdapterViolationInput, fallbackSeverity?: AdapterSeverity,
842
+ /**
843
+ * Optional precomputed baseline-compatible targetKey (e.g. occurrence-aware from
844
+ * `adapterFindingOccurrenceTargetKeys`). When omitted, uses the first-occurrence key.
845
+ */
846
+ targetKeyOverride?: string): AdapterDiagnostic;
847
+ declare function createAdapterResult(input: {
848
+ valid: boolean;
849
+ completeness?: AnalysisCompleteness;
850
+ mode?: AnalysisMode;
851
+ policyHash?: unknown;
852
+ resolverIdentity?: unknown;
853
+ factsHash?: unknown;
854
+ candidateTreeHash?: unknown;
855
+ completenessReasons?: readonly AdapterCompletenessReason[];
856
+ violations?: readonly AdapterViolationInput[];
857
+ warnings?: readonly AdapterViolationInput[];
858
+ }): CurrentAdapterResult;
859
+
399
860
  /**
400
861
  * In-memory shadow / replay / compare for ArkRun information packages (XP07 / ADR 0033).
401
862
  * Not durable. Not a second bus. Stripped snapshots only.
@@ -420,9 +881,10 @@ declare function compareInformationPackages(left: DependencyInformationPackage,
420
881
  declare function replayInformationPackages(tape: readonly DependencyInformationPackage[]): InformationPackageCompare[];
421
882
 
422
883
  /**
423
- * Default cap for in-memory history, trace, and audit records. Without a cap a
424
- * long-running process grows without bound on every publish. Pass
425
- * `maxHistorySize: Infinity` to explicitly opt back into unbounded retention.
884
+ * Default cap for in-memory history, trace, audit, and default event-buffer
885
+ * records. Without a cap a long-running process grows without bound on every
886
+ * publish. Pass `maxHistorySize: Infinity` to explicitly opt back into unbounded
887
+ * retention. An injected `eventBuffer` owns its own retention.
426
888
  */
427
889
  declare const DEFAULT_MAX_HISTORY_SIZE = 1000;
428
890
  declare function createArkKernel(options?: CreateArkKernelOptions): ArkKernel;
@@ -432,6 +894,16 @@ declare function createArkKernel(options?: CreateArkKernelOptions): ArkKernel;
432
894
  */
433
895
  declare function createStrictArkKernel(options?: CreateArkKernelOptions): ArkKernel;
434
896
  declare function createArkKernelFromConfig(config: ArkKernelConfig, options?: CreateArkKernelFromConfigOptions): ArkKernel;
897
+ /**
898
+ * Strict kernel whose runtime layer profile comes from `ark.config.json`.
899
+ * Hard observed-layer-flow needs every layer a deny rule names to resolve an
900
+ * intent: declared `intentPrefixes`, or a canonical 11-layer name (`DomainModel`,
901
+ * `ApplicationOrchestration`, … — what `ark init` writes) which gets the built-in
902
+ * prefixes. A custom-named deny layer without prefixes is recorded as a
903
+ * `layer.observedFlowUnresolvable` audit record (`ARKRUN_LAYER_FLOW_UNRESOLVABLE`);
904
+ * passing `enforceObservedLayerFlow: 'hard'` explicitly throws `ArkKernelConfigError`
905
+ * instead.
906
+ */
435
907
  declare function createStrictArkKernelFromConfig(config: ArkKernelConfig, options?: CreateArkKernelFromConfigOptions): ArkKernel;
436
908
  declare function createLenientArkKernelFromConfig(config: ArkKernelConfig, options?: CreateArkKernelFromConfigOptions): ArkKernel;
437
909
  declare function createLenientArkKernel(options?: CreateArkKernelOptions): ArkKernel;
@@ -517,4 +989,2102 @@ declare function createAdapter<T>(port: Port<T>, impl: T, requiredKeysOrOptions?
517
989
  declare function checkContract(impl: unknown, requiredKeys?: string[]): ContractCheckResult;
518
990
  declare function checkAdapterGovernance(adapter: Adapter): AdapterGovernanceResult;
519
991
 
520
- export { type Adapter, type AdapterGovernanceIssue, type AdapterGovernanceResult, ArchitectureProfile, ArkKernel, ArkKernelConfig, ArkManifest, type ArkTestHarness, type ArkTestSnapshot, AuditQuery, AuditRecord, AuditStore, AuditTrail, type BuildPublishPolicyContextOptions, type ContractCheckResult, type CreateAdapterOptions, CreateArkKernelFromConfigOptions, CreateArkKernelOptions, type CreateArkManifestOptions, CreateAuditTrailOptions, CreateObservabilityReporterOptions, CreateProjectionRegistryOptions, CreateWorkflowEngineOptions, DEFAULT_MAX_HISTORY_SIZE, DefineIntentOptions, type DefinePolicyOptions, type DefinePortOptions, DependencyGraph, DependencyInformationPackage, DomainEvent, EventBufferRecord, EventBufferStatus, EventBufferStore, EventBus, EventBusOptions, EventContract, EventContractRegistry, EventContractRegistryImpl, EventContractValidationResult, EventContractViolationError, GraphEdge, type GraphPolicyContext, InMemoryAuditStore, InMemoryEventBuffer, InMemoryOutboxStore, InMemoryReadModelStore, InMemoryWorkflowStore, type InformationPackageCompare, type InformationPackageDiff, IntentCreator, IntentCreator as IntentDefinition, IntentName, type IntentNameValidation, IntentRegistry, IntentRelationship, InvalidIntentNameError, type LayerFlowRule, LayerPolicyContextError, type LayerPolicyOptions, MANIFEST_SCHEMA_VERSION, MetadataRegistry, ObservabilityDriftReport, ObservabilityReporter, ObservedLayerFlowViolationError, OutboxRecord, OutboxStatus, Policy, PolicyEnforcementMode, PolicyEngine, PolicySeverity, PolicyViolation, PolicyViolationError, type Port, ProjectionRegistry, type PublishPolicyContext, ReadModelStore, SagaDefinition, SagaInstance, SourceMetadataOverrideError, type SyncRegistryOptions, TraceRecord, TraceRecordType, UnknownEventSourceError, UnregisteredIntentError, WorkflowEngine, WorkflowSnapshot, WorkflowStore, architecturalPolicies, buildPublishPolicyContext, checkAdapterGovernance, checkContract, compareInformationPackages, createAdapter, createArkKernel, createArkKernelFromConfig, createArkManifest, createArkTestHarness, createAuditTrail, createDependencyGraph, createEventBus, createEventContractRegistry, createIntentRegistry, createLenientArkKernel, createLenientArkKernelFromConfig, createMetadataRegistry, createObservabilityReporter, createProjectionRegistry, createSaga, createStrictArkKernel, createStrictArkKernelFromConfig, createWorkflowEngine, defaultIntentRegistry, defineArchitectureProfilePolicy, defineIntent, defineLayerPolicy, definePolicy, definePort, definePublishPolicy, isLayerPolicy, replayInformationPackages, shadowInformationPackage, syncRegistryToGraph, validateIntentName };
992
+ /**
993
+ * AI Code Gate (basic).
994
+ *
995
+ * Allows validation of generated source code against the defined architecture.
996
+ */
997
+ interface AICodeGateViolation {
998
+ /** Stable rule identifier for agents and CI pipelines. */
999
+ ruleId: string;
1000
+ /** @deprecated Use ruleId — kept for backward compatibility. */
1001
+ code: string;
1002
+ message: string;
1003
+ line?: number;
1004
+ suggestion?: string;
1005
+ source?: string;
1006
+ filePath?: string;
1007
+ target?: string;
1008
+ fromLayer?: string;
1009
+ toLayer?: string;
1010
+ /** Nested-wall reason. Absent on a classic layer deny and on a child-only parent import. */
1011
+ reasonId?: string;
1012
+ /** Last segment of the importer universe id, with a reasonId. */
1013
+ universeFrom?: string;
1014
+ /** Last segment of the importee universe id, with a reasonId. */
1015
+ universeTo?: string;
1016
+ /** True when a peerIsolation rule produced this finding (also mirrored in details). */
1017
+ peerIsolation?: boolean;
1018
+ /** False for an advisory sibling crossing. Omitted findings still block the snippet. */
1019
+ failsStrict?: boolean;
1020
+ details?: unknown;
1021
+ }
1022
+ /** Extension point for external analyzers (AST, semantic, etc.). */
1023
+ interface AIGateExtension<Context = unknown> {
1024
+ readonly name: string;
1025
+ analyze(source: string, context?: Context): AICodeGateViolation[];
1026
+ }
1027
+ interface AICodeGateContext {
1028
+ filePath?: string;
1029
+ agentId?: string;
1030
+ layer?: string;
1031
+ [key: string]: unknown;
1032
+ }
1033
+ interface AICodeGateResult {
1034
+ /** Single-source snippets do not carry project-wide resolver evidence. */
1035
+ mode: 'lexical-compatibility';
1036
+ /** A snippet result is intentionally never an authoritative complete verdict. */
1037
+ completeness: 'partial';
1038
+ completenessReasons: string[];
1039
+ /** Authoritative verdict. Always false until the complete candidate is resolved. */
1040
+ valid: boolean;
1041
+ /** Compatibility signal for the bounded lexical checks performed here. */
1042
+ lexicalValid: boolean;
1043
+ violations: AICodeGateViolation[];
1044
+ }
1045
+ interface AICodeGate<Context = AICodeGateContext> {
1046
+ validate(source: string, context?: Context): AICodeGateResult;
1047
+ }
1048
+
1049
+ /**
1050
+ * Basic AI Code Gate implementation.
1051
+ *
1052
+ * Uses simple string heuristics + registered intent names to detect obvious
1053
+ * architectural violations in generated code (e.g. direct infra imports from domain).
1054
+ * Not a full static analyzer — documented limitation.
1055
+ */
1056
+
1057
+ interface AICodeGatePolicyContext<Context = AICodeGateContext> {
1058
+ source: string;
1059
+ context?: Context;
1060
+ }
1061
+ interface AICodeGateOptions<Context = AICodeGateContext> {
1062
+ policies?: Policy<AICodeGatePolicyContext<Context>>[];
1063
+ intents?: Array<string | Pick<IntentCreator<IntentName, unknown>, 'name'>>;
1064
+ /**
1065
+ * Additional forbidden patterns (regex or strings).
1066
+ */
1067
+ forbiddenPatterns?: Array<string | RegExp>;
1068
+ /**
1069
+ * External analyzer extensions (type-only contract; plug in AST tools later).
1070
+ */
1071
+ extensions?: AIGateExtension<Context>[];
1072
+ /**
1073
+ * Optional architecture profile for layer-aware generated-code checks.
1074
+ * When context.layer is provided, intent references are checked against it.
1075
+ */
1076
+ architectureProfile?: ArchitectureProfile;
1077
+ /**
1078
+ * When true, flag string literals that look like intent names but are not registered.
1079
+ */
1080
+ enforceIntentAllowlist?: boolean;
1081
+ /**
1082
+ * Optional TypeScript module object. When provided, AICodeGate adds AST-backed checks
1083
+ * for publish misuse without taking a runtime dependency on TypeScript.
1084
+ */
1085
+ typescript?: unknown;
1086
+ /**
1087
+ * Ambient globals forbidden per layer (layer name → entries such as "fetch" or
1088
+ * "Date.now"). Checked only when `typescript` is provided and context.layer resolves
1089
+ * to a listed layer — mirrors ark-check's FORBIDDEN_GLOBAL rule.
1090
+ */
1091
+ forbiddenGlobals?: Record<string, string[]>;
1092
+ /**
1093
+ * Layer → effective capability deny set (U04 walls; ADR 0009). Enforced like
1094
+ * forbiddenGlobals when the target file's layer is known. An ambient use
1095
+ * already covered by the layer's forbiddenGlobals reports only
1096
+ * FORBIDDEN_GLOBAL (D7 — one violation, one voice).
1097
+ */
1098
+ capabilityWalls?: Record<string, string[]>;
1099
+ /**
1100
+ * Layer names whose role is infrastructure and may therefore import infrastructure
1101
+ * (a persistence adapter importing the DB is correct, not a violation). The built-in
1102
+ * infra-import heuristics are suppressed for these layers and for any layer whose
1103
+ * name matches the conventional infra tokens. Populate from ark.config.json layers
1104
+ * flagged `mayImportInfrastructure: true`, so unconventionally-named infra layers
1105
+ * opt in explicitly. User-supplied `forbiddenPatterns` still apply everywhere.
1106
+ */
1107
+ infrastructureLayers?: string[];
1108
+ /**
1109
+ * Preferred single resolve step: import specifier or absolute source file →
1110
+ * `{ layer, relPath }` for contract + peerIsolation. Prefer this over the
1111
+ * legacy layer-only callback.
1112
+ */
1113
+ resolveImportTarget?: (specifierOrFilePath: string, fromFilePath?: string) => {
1114
+ layer?: string;
1115
+ relPath?: string;
1116
+ } | undefined;
1117
+ /**
1118
+ * @deprecated Prefer resolveImportTarget. Layer-only resolve for governed imports.
1119
+ */
1120
+ resolveImportLayer?: (specifier: string, fromFilePath?: string) => string | undefined;
1121
+ /**
1122
+ * Layer configs (patterns) used to infer sliceFolders when a peerIsolation rule
1123
+ * omits an explicit list.
1124
+ */
1125
+ architectureLayers?: Array<{
1126
+ name: string;
1127
+ patterns?: string[];
1128
+ }>;
1129
+ /** Explicit file-level escape hatch for reviewed non-literal import()/require() calls. */
1130
+ allowNonLiteralDynamicImport?: (filePath?: string) => boolean;
1131
+ }
1132
+ declare function createAICodeGate<Context = AICodeGateContext>(options?: AICodeGateOptions<Context>): AICodeGate<Context>;
1133
+
1134
+ /**
1135
+ * Portable identity/fingerprint primitives for pure Domain contracts.
1136
+ *
1137
+ * FNV-1a is intentional: no Node crypto dependency for CLI/MCP/browserless consumers.
1138
+ */
1139
+ /** Stable FNV-1a hash. Identity/fingerprint only — not a security primitive. */
1140
+ declare function deterministicHash(value: string): string;
1141
+ /** Serialize JSON-like values with sorted object keys for reproducible hashes. */
1142
+ declare function stableSerialize(value: unknown): string;
1143
+
1144
+ /**
1145
+ * ArkOrder resolver-fact extraction (ADR 0029). Syntax only — no verdicts.
1146
+ */
1147
+
1148
+ type ResolvedArkOrderPlaneCallFact = {
1149
+ file: string;
1150
+ line: number;
1151
+ callee: string;
1152
+ };
1153
+ type ResolvedArkOrderGenericUpdateFact = {
1154
+ file: string;
1155
+ line: number;
1156
+ method: string;
1157
+ };
1158
+ type ResolvedArkOrderRootHitFact = {
1159
+ file: string;
1160
+ matchedRoot: string;
1161
+ hasPlaneFactory: boolean;
1162
+ };
1163
+ type ResolvedArkOrderXiFieldWriteFact = {
1164
+ file: string;
1165
+ line: number;
1166
+ key: string;
1167
+ };
1168
+ type ResolvedArkOrderIngestWriteFact = {
1169
+ file: string;
1170
+ line: number;
1171
+ };
1172
+ type ResolvedArkOrderReleaseKeyCountFact = {
1173
+ file: string;
1174
+ line: number;
1175
+ keyCount: number;
1176
+ };
1177
+ /** A freshness key (ttl/freshUntil/maxAge) inside the ξ literal of plane.release / proposeRelease. */
1178
+ type ResolvedArkOrderXiTtlFact = {
1179
+ file: string;
1180
+ line: number;
1181
+ key: string;
1182
+ };
1183
+ /** A literal `allowedKinds` entry that a literal `informationBudget.cannotObserve` denies. */
1184
+ type ResolvedArkOrderBudgetLeakFact = {
1185
+ file: string;
1186
+ line: number;
1187
+ kind: string;
1188
+ };
1189
+
1190
+ /**
1191
+ * Versioned type vocabulary for resolved candidate facts (schema 1.0).
1192
+ *
1193
+ * Pure declarations + schema version identity. Create/load live in
1194
+ * resolvedCandidateFacts.ts; JSON Schema lives in resolvedCandidateFactsSchema.ts.
1195
+ */
1196
+
1197
+ /** 1.1 adds optional classShapes[] (ADR 0013). 1.2 adds optional ArkRun facts (ADR 0022). 1.0/1.1 remain loadable. */
1198
+ declare const RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION: "1.2";
1199
+ type ResolvedFactsCompleteness = 'complete' | 'partial' | 'unavailable';
1200
+ type ResolvedDependencyKind = 'import' | 'export' | 'dynamic-import' | 'require';
1201
+ type ResolvedDependencyState = 'resolved-project' | 'resolved-external' | 'unresolved' | 'dynamic';
1202
+ type ResolvedCapability = 'network' | 'filesystem' | 'clock' | 'randomness' | 'environment' | 'process' | 'persistence';
1203
+ type ResolvedFactsReason = {
1204
+ code: string;
1205
+ message: string;
1206
+ file?: string;
1207
+ };
1208
+ type ResolvedFileFact = {
1209
+ path: string;
1210
+ contentHash: string;
1211
+ parseStatus: 'parsed' | 'invalid';
1212
+ parseDiagnosticCount: number;
1213
+ exportsOnlyTypes: boolean;
1214
+ typeOnlyExportNames: string[];
1215
+ hasTopLevelSideEffects: boolean;
1216
+ };
1217
+ /** ADR 0022 kernel API call-site evidence. Sensors consume this in RN04. */
1218
+ type ResolvedArkRunKernelCallKind = 'factory' | 'publisher' | 'publish' | 'raise' | 'send' | 'subscribe' | 'register-handler' | 'resolve' | 'resolve-singleton';
1219
+ type ResolvedArkRunKernelCallFact = {
1220
+ file: string;
1221
+ line: number;
1222
+ kind: ResolvedArkRunKernelCallKind;
1223
+ callee: string;
1224
+ viaImport: boolean;
1225
+ receiver?: string;
1226
+ nameLiteral?: string;
1227
+ };
1228
+ /** `new` of a class admitted for kernel creation (classShapes name or kernel import). */
1229
+ type ResolvedArkRunManagedNewFact = {
1230
+ file: string;
1231
+ line: number;
1232
+ typeName: string;
1233
+ importedFrom?: string;
1234
+ };
1235
+ /** Governed file that matched an `arkRun.compositionRoots` glob. */
1236
+ type ResolvedArkRunCompositionRootHitFact = {
1237
+ file: string;
1238
+ matchedRoot: string;
1239
+ hasKernelFactory: boolean;
1240
+ };
1241
+ /** File-scoped interaction declaration lists (ADR 0023). Sensors consume this in RN04. */
1242
+ type ResolvedArkRunDeclarationFact = {
1243
+ file: string;
1244
+ line: number;
1245
+ uses: string[];
1246
+ reactsTo: string[];
1247
+ raises: string[];
1248
+ sends: string[];
1249
+ };
1250
+ /** ADR 0013 class-shape evidence for ArkRules structure sensors. */
1251
+ type ResolvedClassShapeFact = {
1252
+ file: string;
1253
+ className: string;
1254
+ exported: boolean;
1255
+ hasPublicMutableFields: boolean;
1256
+ hasPublicSetters: boolean;
1257
+ hasPublicConstructor: boolean;
1258
+ hasStaticFactory: boolean;
1259
+ mutatingMethods: readonly {
1260
+ name: string;
1261
+ referencesGuardOrPublish: boolean;
1262
+ }[];
1263
+ dataOnly?: boolean;
1264
+ /** Source offset where the class-shape scan stopped (unwalkable body/header). */
1265
+ truncatedUntil?: number;
1266
+ };
1267
+ type ResolvedDependencyFact = {
1268
+ from: string;
1269
+ specifier?: string;
1270
+ kind: ResolvedDependencyKind;
1271
+ typeOnly: boolean;
1272
+ line: number;
1273
+ resolution: ResolvedDependencyState;
1274
+ target?: string;
1275
+ namedBindings?: string[];
1276
+ targetTypeOnlyExports?: boolean;
1277
+ sourcePureTypeModule?: boolean;
1278
+ namedBindingsTypeOnly?: boolean;
1279
+ portProofEligible?: boolean;
1280
+ };
1281
+ type ResolvedCapabilityFact = {
1282
+ file: string;
1283
+ line: number;
1284
+ symbol: string;
1285
+ capability: ResolvedCapability;
1286
+ source: 'ambient-global' | 'import-based';
1287
+ };
1288
+ type ResolvedAmbientFact = {
1289
+ file: string;
1290
+ line: number;
1291
+ symbol: string;
1292
+ };
1293
+ type ResolvedPublishFact = {
1294
+ file: string;
1295
+ line: number;
1296
+ rawIntentName?: string;
1297
+ objectHasIntent: boolean;
1298
+ arkPublishCandidate: boolean;
1299
+ hasSource: boolean;
1300
+ sourceIntent?: string;
1301
+ };
1302
+ type ResolvedIntentReferenceFact = {
1303
+ file: string;
1304
+ line: number;
1305
+ intent: string;
1306
+ };
1307
+ type ResolvedSafetyKind = 'ts-suppression' | 'any-cast' | 'dynamic-import' | 'dynamic-require' | 'in-memory-store';
1308
+ /** Neutral syntax evidence for policy-controlled safety diagnostics. */
1309
+ type ResolvedSafetyFact = {
1310
+ file: string;
1311
+ line: number;
1312
+ kind: ResolvedSafetyKind;
1313
+ symbol?: string;
1314
+ };
1315
+ type ResolvedCandidateFactsInput = {
1316
+ schemaVersion: '1.0' | '1.1' | typeof RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION;
1317
+ completeness: ResolvedFactsCompleteness;
1318
+ completenessReasons: readonly ResolvedFactsReason[];
1319
+ resolverIdentity: string;
1320
+ compilerIdentity: string;
1321
+ compilerOptionsHash: string;
1322
+ tsconfigHash: string;
1323
+ evidenceRequirementsHash: string;
1324
+ projectPackageName?: string;
1325
+ files: readonly ResolvedFileFact[];
1326
+ dependencies: readonly ResolvedDependencyFact[];
1327
+ capabilityUses: readonly ResolvedCapabilityFact[];
1328
+ ambientUses: readonly ResolvedAmbientFact[];
1329
+ publishCalls: readonly ResolvedPublishFact[];
1330
+ intentReferences: readonly ResolvedIntentReferenceFact[];
1331
+ safetyUses: readonly ResolvedSafetyFact[];
1332
+ /** ADR 0013 — optional on 1.0; default [] on load. */
1333
+ classShapes?: readonly ResolvedClassShapeFact[];
1334
+ /** ADR 0022 / RN03 — optional on 1.0/1.1; default [] on load. */
1335
+ arkRunKernelCalls?: readonly ResolvedArkRunKernelCallFact[];
1336
+ arkRunManagedNews?: readonly ResolvedArkRunManagedNewFact[];
1337
+ arkRunCompositionRootHits?: readonly ResolvedArkRunCompositionRootHitFact[];
1338
+ arkRunDeclarations?: readonly ResolvedArkRunDeclarationFact[];
1339
+ arkOrderPlaneCalls?: readonly ResolvedArkOrderPlaneCallFact[];
1340
+ arkOrderGenericUpdates?: readonly ResolvedArkOrderGenericUpdateFact[];
1341
+ arkOrderRootHits?: readonly ResolvedArkOrderRootHitFact[];
1342
+ arkOrderXiFieldWrites?: readonly ResolvedArkOrderXiFieldWriteFact[];
1343
+ arkOrderIngestWritesXi?: readonly ResolvedArkOrderIngestWriteFact[];
1344
+ arkOrderReleaseKeyCounts?: readonly ResolvedArkOrderReleaseKeyCountFact[];
1345
+ arkOrderXiTtlKeys?: readonly ResolvedArkOrderXiTtlFact[];
1346
+ arkOrderBudgetLeaks?: readonly ResolvedArkOrderBudgetLeakFact[];
1347
+ };
1348
+ type ResolvedCandidateFacts = Omit<ResolvedCandidateFactsInput, 'candidateTreeHash' | 'classShapes' | 'arkRunKernelCalls' | 'arkOrderPlaneCalls' | 'arkOrderGenericUpdates' | 'arkOrderXiFieldWrites' | 'arkOrderIngestWritesXi' | 'arkOrderReleaseKeyCounts' | 'arkOrderXiTtlKeys' | 'arkOrderBudgetLeaks' | 'arkOrderRootHits' | 'arkRunManagedNews' | 'arkRunCompositionRootHits' | 'arkRunDeclarations'> & {
1349
+ schemaVersion: typeof RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION;
1350
+ completenessReasons: ResolvedFactsReason[];
1351
+ candidateTreeHash: string;
1352
+ files: ResolvedFileFact[];
1353
+ dependencies: ResolvedDependencyFact[];
1354
+ capabilityUses: ResolvedCapabilityFact[];
1355
+ ambientUses: ResolvedAmbientFact[];
1356
+ publishCalls: ResolvedPublishFact[];
1357
+ intentReferences: ResolvedIntentReferenceFact[];
1358
+ safetyUses: ResolvedSafetyFact[];
1359
+ classShapes: ResolvedClassShapeFact[];
1360
+ arkRunKernelCalls: ResolvedArkRunKernelCallFact[];
1361
+ arkRunManagedNews: ResolvedArkRunManagedNewFact[];
1362
+ arkRunCompositionRootHits: ResolvedArkRunCompositionRootHitFact[];
1363
+ arkRunDeclarations: ResolvedArkRunDeclarationFact[];
1364
+ arkOrderPlaneCalls: ResolvedArkOrderPlaneCallFact[];
1365
+ arkOrderGenericUpdates: ResolvedArkOrderGenericUpdateFact[];
1366
+ arkOrderRootHits: ResolvedArkOrderRootHitFact[];
1367
+ arkOrderXiFieldWrites: ResolvedArkOrderXiFieldWriteFact[];
1368
+ arkOrderIngestWritesXi: ResolvedArkOrderIngestWriteFact[];
1369
+ arkOrderReleaseKeyCounts: ResolvedArkOrderReleaseKeyCountFact[];
1370
+ arkOrderXiTtlKeys: ResolvedArkOrderXiTtlFact[];
1371
+ arkOrderBudgetLeaks: ResolvedArkOrderBudgetLeakFact[];
1372
+ factsHash: string;
1373
+ };
1374
+
1375
+ /**
1376
+ * Canonical create/load for versioned resolved candidate facts.
1377
+ *
1378
+ * Types: resolvedCandidateFactsTypes.ts · Schema: resolvedCandidateFactsSchema.ts ·
1379
+ * Hash: stableHash.ts. Plan-B god-module pilot cluster (pattern-b:god-module).
1380
+ */
1381
+
1382
+ /** Identity of the policy-controlled evidence a resolver must attempt to collect. */
1383
+ declare function resolvedFactsEvidenceRequirementsHash(config: ArkConfig): string;
1384
+ declare function createResolvedCandidateFacts(input: ResolvedCandidateFactsInput): ResolvedCandidateFacts;
1385
+ declare function loadResolvedCandidateFacts(input: unknown): ResolvedCandidateFacts;
1386
+
1387
+ declare const RESOLVED_CANDIDATE_FACTS_SCHEMA: {
1388
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
1389
+ readonly $id: "https://unpkg.com/arkgate@3/schemas/ark.resolved-candidate-facts.schema.json";
1390
+ readonly title: "ArkGate resolved candidate facts";
1391
+ readonly type: "object";
1392
+ readonly additionalProperties: false;
1393
+ readonly required: readonly ["schemaVersion", "completeness", "completenessReasons", "resolverIdentity", "compilerIdentity", "compilerOptionsHash", "tsconfigHash", "candidateTreeHash", "evidenceRequirementsHash", "files", "dependencies", "capabilityUses", "ambientUses", "publishCalls", "intentReferences", "safetyUses", "factsHash"];
1394
+ readonly properties: {
1395
+ readonly schemaVersion: {
1396
+ readonly enum: readonly ["1.0", "1.1", "1.2"];
1397
+ };
1398
+ readonly completeness: {
1399
+ readonly enum: readonly ["complete", "partial", "unavailable"];
1400
+ };
1401
+ readonly completenessReasons: {
1402
+ readonly type: "array";
1403
+ readonly items: {
1404
+ readonly type: "object";
1405
+ readonly additionalProperties: false;
1406
+ readonly required: readonly ["code", "message"];
1407
+ readonly properties: {
1408
+ readonly code: {
1409
+ readonly type: "string";
1410
+ readonly minLength: 1;
1411
+ };
1412
+ readonly message: {
1413
+ readonly type: "string";
1414
+ readonly minLength: 1;
1415
+ };
1416
+ readonly file: {
1417
+ readonly type: "string";
1418
+ readonly minLength: 1;
1419
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1420
+ };
1421
+ };
1422
+ };
1423
+ };
1424
+ readonly resolverIdentity: {
1425
+ readonly type: "string";
1426
+ readonly minLength: 1;
1427
+ };
1428
+ readonly compilerIdentity: {
1429
+ readonly type: "string";
1430
+ readonly minLength: 1;
1431
+ };
1432
+ readonly compilerOptionsHash: {
1433
+ readonly type: "string";
1434
+ readonly minLength: 1;
1435
+ };
1436
+ readonly tsconfigHash: {
1437
+ readonly type: "string";
1438
+ readonly minLength: 1;
1439
+ };
1440
+ readonly candidateTreeHash: {
1441
+ readonly type: "string";
1442
+ readonly minLength: 1;
1443
+ };
1444
+ readonly evidenceRequirementsHash: {
1445
+ readonly type: "string";
1446
+ readonly minLength: 1;
1447
+ };
1448
+ readonly projectPackageName: {
1449
+ readonly type: "string";
1450
+ readonly minLength: 1;
1451
+ };
1452
+ readonly files: {
1453
+ readonly type: "array";
1454
+ readonly uniqueItems: true;
1455
+ readonly items: {
1456
+ readonly type: "object";
1457
+ readonly additionalProperties: false;
1458
+ readonly required: readonly ["path", "contentHash", "parseStatus", "parseDiagnosticCount", "exportsOnlyTypes", "typeOnlyExportNames", "hasTopLevelSideEffects"];
1459
+ readonly properties: {
1460
+ readonly path: {
1461
+ readonly type: "string";
1462
+ readonly minLength: 1;
1463
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1464
+ };
1465
+ readonly contentHash: {
1466
+ readonly type: "string";
1467
+ readonly minLength: 1;
1468
+ };
1469
+ readonly parseStatus: {
1470
+ readonly enum: readonly ["parsed", "invalid"];
1471
+ };
1472
+ readonly parseDiagnosticCount: {
1473
+ readonly type: "integer";
1474
+ readonly minimum: 0;
1475
+ };
1476
+ readonly exportsOnlyTypes: {
1477
+ readonly type: "boolean";
1478
+ };
1479
+ readonly typeOnlyExportNames: {
1480
+ readonly type: "array";
1481
+ readonly items: {
1482
+ readonly type: "string";
1483
+ readonly minLength: 1;
1484
+ };
1485
+ };
1486
+ readonly hasTopLevelSideEffects: {
1487
+ readonly type: "boolean";
1488
+ };
1489
+ };
1490
+ readonly allOf: readonly [{
1491
+ readonly if: {
1492
+ readonly properties: {
1493
+ readonly parseStatus: {
1494
+ readonly const: "parsed";
1495
+ };
1496
+ };
1497
+ };
1498
+ readonly then: {
1499
+ readonly properties: {
1500
+ readonly parseDiagnosticCount: {
1501
+ readonly const: 0;
1502
+ };
1503
+ };
1504
+ };
1505
+ }, {
1506
+ readonly if: {
1507
+ readonly properties: {
1508
+ readonly parseStatus: {
1509
+ readonly const: "invalid";
1510
+ };
1511
+ };
1512
+ };
1513
+ readonly then: {
1514
+ readonly properties: {
1515
+ readonly parseDiagnosticCount: {
1516
+ readonly minimum: 1;
1517
+ };
1518
+ };
1519
+ };
1520
+ }];
1521
+ };
1522
+ };
1523
+ readonly dependencies: {
1524
+ readonly type: "array";
1525
+ readonly items: {
1526
+ readonly type: "object";
1527
+ readonly additionalProperties: false;
1528
+ readonly required: readonly ["from", "kind", "typeOnly", "line", "resolution"];
1529
+ readonly properties: {
1530
+ readonly from: {
1531
+ readonly type: "string";
1532
+ readonly minLength: 1;
1533
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1534
+ };
1535
+ readonly specifier: {
1536
+ readonly type: "string";
1537
+ readonly minLength: 1;
1538
+ };
1539
+ readonly kind: {
1540
+ readonly enum: readonly ["import", "export", "dynamic-import", "require"];
1541
+ };
1542
+ readonly typeOnly: {
1543
+ readonly type: "boolean";
1544
+ };
1545
+ readonly line: {
1546
+ readonly type: "integer";
1547
+ readonly minimum: 1;
1548
+ };
1549
+ readonly resolution: {
1550
+ readonly enum: readonly ["resolved-project", "resolved-external", "unresolved", "dynamic"];
1551
+ };
1552
+ readonly target: {
1553
+ readonly type: "string";
1554
+ readonly minLength: 1;
1555
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1556
+ };
1557
+ readonly namedBindings: {
1558
+ readonly type: "array";
1559
+ readonly items: {
1560
+ readonly type: "string";
1561
+ readonly minLength: 1;
1562
+ };
1563
+ };
1564
+ readonly targetTypeOnlyExports: {
1565
+ readonly type: "boolean";
1566
+ };
1567
+ readonly sourcePureTypeModule: {
1568
+ readonly type: "boolean";
1569
+ };
1570
+ readonly namedBindingsTypeOnly: {
1571
+ readonly type: "boolean";
1572
+ };
1573
+ readonly portProofEligible: {
1574
+ readonly type: "boolean";
1575
+ };
1576
+ };
1577
+ readonly allOf: readonly [{
1578
+ readonly if: {
1579
+ readonly properties: {
1580
+ readonly resolution: {
1581
+ readonly const: "resolved-project";
1582
+ };
1583
+ };
1584
+ };
1585
+ readonly then: {
1586
+ readonly required: readonly ["target"];
1587
+ };
1588
+ readonly else: {
1589
+ readonly not: {
1590
+ readonly required: readonly ["target"];
1591
+ };
1592
+ };
1593
+ }, {
1594
+ readonly if: {
1595
+ readonly properties: {
1596
+ readonly resolution: {
1597
+ readonly const: "dynamic";
1598
+ };
1599
+ };
1600
+ };
1601
+ readonly else: {
1602
+ readonly required: readonly ["specifier"];
1603
+ };
1604
+ }];
1605
+ };
1606
+ };
1607
+ readonly capabilityUses: {
1608
+ readonly type: "array";
1609
+ readonly items: {
1610
+ readonly type: "object";
1611
+ readonly additionalProperties: false;
1612
+ readonly required: readonly ["file", "line", "symbol", "capability", "source"];
1613
+ readonly properties: {
1614
+ readonly file: {
1615
+ readonly type: "string";
1616
+ readonly minLength: 1;
1617
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1618
+ };
1619
+ readonly line: {
1620
+ readonly type: "integer";
1621
+ readonly minimum: 1;
1622
+ };
1623
+ readonly symbol: {
1624
+ readonly type: "string";
1625
+ readonly minLength: 1;
1626
+ };
1627
+ readonly capability: {
1628
+ readonly enum: readonly ["network", "filesystem", "clock", "randomness", "environment", "process", "persistence"];
1629
+ };
1630
+ readonly source: {
1631
+ readonly enum: readonly ["ambient-global", "import-based"];
1632
+ };
1633
+ };
1634
+ };
1635
+ };
1636
+ readonly ambientUses: {
1637
+ readonly type: "array";
1638
+ readonly items: {
1639
+ readonly type: "object";
1640
+ readonly additionalProperties: false;
1641
+ readonly required: readonly ["file", "line", "symbol"];
1642
+ readonly properties: {
1643
+ readonly file: {
1644
+ readonly type: "string";
1645
+ readonly minLength: 1;
1646
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1647
+ };
1648
+ readonly line: {
1649
+ readonly type: "integer";
1650
+ readonly minimum: 1;
1651
+ };
1652
+ readonly symbol: {
1653
+ readonly type: "string";
1654
+ readonly minLength: 1;
1655
+ };
1656
+ };
1657
+ };
1658
+ };
1659
+ readonly publishCalls: {
1660
+ readonly type: "array";
1661
+ readonly items: {
1662
+ readonly type: "object";
1663
+ readonly additionalProperties: false;
1664
+ readonly required: readonly ["file", "line", "objectHasIntent", "arkPublishCandidate", "hasSource"];
1665
+ readonly properties: {
1666
+ readonly file: {
1667
+ readonly type: "string";
1668
+ readonly minLength: 1;
1669
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1670
+ };
1671
+ readonly line: {
1672
+ readonly type: "integer";
1673
+ readonly minimum: 1;
1674
+ };
1675
+ readonly rawIntentName: {
1676
+ readonly type: "string";
1677
+ readonly minLength: 1;
1678
+ };
1679
+ readonly objectHasIntent: {
1680
+ readonly type: "boolean";
1681
+ };
1682
+ readonly arkPublishCandidate: {
1683
+ readonly type: "boolean";
1684
+ };
1685
+ readonly hasSource: {
1686
+ readonly type: "boolean";
1687
+ };
1688
+ readonly sourceIntent: {
1689
+ readonly type: "string";
1690
+ readonly minLength: 1;
1691
+ };
1692
+ };
1693
+ };
1694
+ };
1695
+ readonly intentReferences: {
1696
+ readonly type: "array";
1697
+ readonly items: {
1698
+ readonly type: "object";
1699
+ readonly additionalProperties: false;
1700
+ readonly required: readonly ["file", "line", "intent"];
1701
+ readonly properties: {
1702
+ readonly file: {
1703
+ readonly type: "string";
1704
+ readonly minLength: 1;
1705
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1706
+ };
1707
+ readonly line: {
1708
+ readonly type: "integer";
1709
+ readonly minimum: 1;
1710
+ };
1711
+ readonly intent: {
1712
+ readonly type: "string";
1713
+ readonly minLength: 1;
1714
+ };
1715
+ };
1716
+ };
1717
+ };
1718
+ readonly safetyUses: {
1719
+ readonly type: "array";
1720
+ readonly items: {
1721
+ readonly type: "object";
1722
+ readonly additionalProperties: false;
1723
+ readonly required: readonly ["file", "line", "kind"];
1724
+ readonly properties: {
1725
+ readonly file: {
1726
+ readonly type: "string";
1727
+ readonly minLength: 1;
1728
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1729
+ };
1730
+ readonly line: {
1731
+ readonly type: "integer";
1732
+ readonly minimum: 1;
1733
+ };
1734
+ readonly kind: {
1735
+ readonly enum: readonly ["ts-suppression", "any-cast", "dynamic-import", "dynamic-require", "in-memory-store"];
1736
+ };
1737
+ readonly symbol: {
1738
+ readonly type: "string";
1739
+ readonly minLength: 1;
1740
+ };
1741
+ };
1742
+ readonly allOf: readonly [{
1743
+ readonly if: {
1744
+ readonly properties: {
1745
+ readonly kind: {
1746
+ readonly const: "in-memory-store";
1747
+ };
1748
+ };
1749
+ };
1750
+ readonly then: {
1751
+ readonly required: readonly ["symbol"];
1752
+ };
1753
+ readonly else: {
1754
+ readonly not: {
1755
+ readonly required: readonly ["symbol"];
1756
+ };
1757
+ };
1758
+ }];
1759
+ };
1760
+ };
1761
+ readonly classShapes: {
1762
+ readonly type: "array";
1763
+ readonly items: {
1764
+ readonly type: "object";
1765
+ readonly additionalProperties: false;
1766
+ readonly required: readonly ["file", "className", "exported", "hasPublicMutableFields", "hasPublicSetters", "hasPublicConstructor", "hasStaticFactory", "mutatingMethods"];
1767
+ readonly properties: {
1768
+ readonly file: {
1769
+ readonly type: "string";
1770
+ readonly minLength: 1;
1771
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1772
+ };
1773
+ readonly className: {
1774
+ readonly type: "string";
1775
+ readonly minLength: 1;
1776
+ };
1777
+ readonly exported: {
1778
+ readonly type: "boolean";
1779
+ };
1780
+ readonly hasPublicMutableFields: {
1781
+ readonly type: "boolean";
1782
+ };
1783
+ readonly hasPublicSetters: {
1784
+ readonly type: "boolean";
1785
+ };
1786
+ readonly hasPublicConstructor: {
1787
+ readonly type: "boolean";
1788
+ };
1789
+ readonly hasStaticFactory: {
1790
+ readonly type: "boolean";
1791
+ };
1792
+ readonly dataOnly: {
1793
+ readonly type: "boolean";
1794
+ };
1795
+ readonly truncatedUntil: {
1796
+ readonly type: "integer";
1797
+ readonly minimum: 0;
1798
+ };
1799
+ readonly mutatingMethods: {
1800
+ readonly type: "array";
1801
+ readonly items: {
1802
+ readonly type: "object";
1803
+ readonly additionalProperties: false;
1804
+ readonly required: readonly ["name", "referencesGuardOrPublish"];
1805
+ readonly properties: {
1806
+ readonly name: {
1807
+ readonly type: "string";
1808
+ readonly minLength: 1;
1809
+ };
1810
+ readonly referencesGuardOrPublish: {
1811
+ readonly type: "boolean";
1812
+ };
1813
+ };
1814
+ };
1815
+ };
1816
+ };
1817
+ };
1818
+ };
1819
+ readonly arkRunKernelCalls: {
1820
+ readonly type: "array";
1821
+ readonly items: {
1822
+ readonly type: "object";
1823
+ readonly additionalProperties: false;
1824
+ readonly required: readonly ["file", "line", "kind", "callee", "viaImport"];
1825
+ readonly properties: {
1826
+ readonly file: {
1827
+ readonly type: "string";
1828
+ readonly minLength: 1;
1829
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1830
+ };
1831
+ readonly line: {
1832
+ readonly type: "integer";
1833
+ readonly minimum: 1;
1834
+ };
1835
+ readonly kind: {
1836
+ readonly enum: readonly ["factory", "publisher", "publish", "raise", "send", "subscribe", "register-handler", "resolve", "resolve-singleton"];
1837
+ };
1838
+ readonly callee: {
1839
+ readonly type: "string";
1840
+ readonly minLength: 1;
1841
+ };
1842
+ readonly viaImport: {
1843
+ readonly type: "boolean";
1844
+ };
1845
+ readonly receiver: {
1846
+ readonly type: "string";
1847
+ readonly minLength: 1;
1848
+ };
1849
+ readonly nameLiteral: {
1850
+ readonly type: "string";
1851
+ readonly minLength: 1;
1852
+ };
1853
+ };
1854
+ };
1855
+ };
1856
+ readonly arkRunManagedNews: {
1857
+ readonly type: "array";
1858
+ readonly items: {
1859
+ readonly type: "object";
1860
+ readonly additionalProperties: false;
1861
+ readonly required: readonly ["file", "line", "typeName"];
1862
+ readonly properties: {
1863
+ readonly file: {
1864
+ readonly type: "string";
1865
+ readonly minLength: 1;
1866
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1867
+ };
1868
+ readonly line: {
1869
+ readonly type: "integer";
1870
+ readonly minimum: 1;
1871
+ };
1872
+ readonly typeName: {
1873
+ readonly type: "string";
1874
+ readonly minLength: 1;
1875
+ };
1876
+ readonly importedFrom: {
1877
+ readonly type: "string";
1878
+ readonly minLength: 1;
1879
+ };
1880
+ };
1881
+ };
1882
+ };
1883
+ readonly arkRunCompositionRootHits: {
1884
+ readonly type: "array";
1885
+ readonly items: {
1886
+ readonly type: "object";
1887
+ readonly additionalProperties: false;
1888
+ readonly required: readonly ["file", "matchedRoot", "hasKernelFactory"];
1889
+ readonly properties: {
1890
+ readonly file: {
1891
+ readonly type: "string";
1892
+ readonly minLength: 1;
1893
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1894
+ };
1895
+ readonly matchedRoot: {
1896
+ readonly type: "string";
1897
+ readonly minLength: 1;
1898
+ };
1899
+ readonly hasKernelFactory: {
1900
+ readonly type: "boolean";
1901
+ };
1902
+ };
1903
+ };
1904
+ };
1905
+ readonly arkRunDeclarations: {
1906
+ readonly type: "array";
1907
+ readonly items: {
1908
+ readonly type: "object";
1909
+ readonly additionalProperties: false;
1910
+ readonly required: readonly ["file", "line", "uses", "reactsTo", "raises", "sends"];
1911
+ readonly properties: {
1912
+ readonly file: {
1913
+ readonly type: "string";
1914
+ readonly minLength: 1;
1915
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1916
+ };
1917
+ readonly line: {
1918
+ readonly type: "integer";
1919
+ readonly minimum: 1;
1920
+ };
1921
+ readonly uses: {
1922
+ readonly type: "array";
1923
+ readonly items: {
1924
+ readonly type: "string";
1925
+ readonly minLength: 1;
1926
+ };
1927
+ };
1928
+ readonly reactsTo: {
1929
+ readonly type: "array";
1930
+ readonly items: {
1931
+ readonly type: "string";
1932
+ readonly minLength: 1;
1933
+ };
1934
+ };
1935
+ readonly raises: {
1936
+ readonly type: "array";
1937
+ readonly items: {
1938
+ readonly type: "string";
1939
+ readonly minLength: 1;
1940
+ };
1941
+ };
1942
+ readonly sends: {
1943
+ readonly type: "array";
1944
+ readonly items: {
1945
+ readonly type: "string";
1946
+ readonly minLength: 1;
1947
+ };
1948
+ };
1949
+ };
1950
+ };
1951
+ };
1952
+ readonly arkOrderPlaneCalls: {
1953
+ readonly type: "array";
1954
+ readonly items: {
1955
+ readonly type: "object";
1956
+ readonly additionalProperties: false;
1957
+ readonly required: readonly ["file", "line", "callee"];
1958
+ readonly properties: {
1959
+ readonly file: {
1960
+ readonly type: "string";
1961
+ readonly minLength: 1;
1962
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1963
+ };
1964
+ readonly line: {
1965
+ readonly type: "integer";
1966
+ readonly minimum: 1;
1967
+ };
1968
+ readonly callee: {
1969
+ readonly type: "string";
1970
+ readonly minLength: 1;
1971
+ };
1972
+ };
1973
+ };
1974
+ };
1975
+ readonly arkOrderGenericUpdates: {
1976
+ readonly type: "array";
1977
+ readonly items: {
1978
+ readonly type: "object";
1979
+ readonly additionalProperties: false;
1980
+ readonly required: readonly ["file", "line", "method"];
1981
+ readonly properties: {
1982
+ readonly file: {
1983
+ readonly type: "string";
1984
+ readonly minLength: 1;
1985
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1986
+ };
1987
+ readonly line: {
1988
+ readonly type: "integer";
1989
+ readonly minimum: 1;
1990
+ };
1991
+ readonly method: {
1992
+ readonly type: "string";
1993
+ readonly minLength: 1;
1994
+ };
1995
+ };
1996
+ };
1997
+ };
1998
+ readonly arkOrderRootHits: {
1999
+ readonly type: "array";
2000
+ readonly items: {
2001
+ readonly type: "object";
2002
+ readonly additionalProperties: false;
2003
+ readonly required: readonly ["file", "matchedRoot", "hasPlaneFactory"];
2004
+ readonly properties: {
2005
+ readonly file: {
2006
+ readonly type: "string";
2007
+ readonly minLength: 1;
2008
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2009
+ };
2010
+ readonly matchedRoot: {
2011
+ readonly type: "string";
2012
+ readonly minLength: 1;
2013
+ };
2014
+ readonly hasPlaneFactory: {
2015
+ readonly type: "boolean";
2016
+ };
2017
+ };
2018
+ };
2019
+ };
2020
+ readonly arkOrderXiFieldWrites: {
2021
+ readonly type: "array";
2022
+ readonly items: {
2023
+ readonly type: "object";
2024
+ readonly additionalProperties: false;
2025
+ readonly required: readonly ["file", "line", "key"];
2026
+ readonly properties: {
2027
+ readonly file: {
2028
+ readonly type: "string";
2029
+ readonly minLength: 1;
2030
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2031
+ };
2032
+ readonly line: {
2033
+ readonly type: "integer";
2034
+ readonly minimum: 1;
2035
+ };
2036
+ readonly key: {
2037
+ readonly type: "string";
2038
+ readonly minLength: 1;
2039
+ };
2040
+ };
2041
+ };
2042
+ };
2043
+ readonly arkOrderIngestWritesXi: {
2044
+ readonly type: "array";
2045
+ readonly items: {
2046
+ readonly type: "object";
2047
+ readonly additionalProperties: false;
2048
+ readonly required: readonly ["file", "line"];
2049
+ readonly properties: {
2050
+ readonly file: {
2051
+ readonly type: "string";
2052
+ readonly minLength: 1;
2053
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2054
+ };
2055
+ readonly line: {
2056
+ readonly type: "integer";
2057
+ readonly minimum: 1;
2058
+ };
2059
+ };
2060
+ };
2061
+ };
2062
+ readonly arkOrderReleaseKeyCounts: {
2063
+ readonly type: "array";
2064
+ readonly items: {
2065
+ readonly type: "object";
2066
+ readonly additionalProperties: false;
2067
+ readonly required: readonly ["file", "line", "keyCount"];
2068
+ readonly properties: {
2069
+ readonly file: {
2070
+ readonly type: "string";
2071
+ readonly minLength: 1;
2072
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2073
+ };
2074
+ readonly line: {
2075
+ readonly type: "integer";
2076
+ readonly minimum: 1;
2077
+ };
2078
+ readonly keyCount: {
2079
+ readonly type: "integer";
2080
+ readonly minimum: 1;
2081
+ };
2082
+ };
2083
+ };
2084
+ };
2085
+ readonly arkOrderXiTtlKeys: {
2086
+ readonly type: "array";
2087
+ readonly items: {
2088
+ readonly type: "object";
2089
+ readonly additionalProperties: false;
2090
+ readonly required: readonly ["file", "line", "key"];
2091
+ readonly properties: {
2092
+ readonly file: {
2093
+ readonly type: "string";
2094
+ readonly minLength: 1;
2095
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2096
+ };
2097
+ readonly line: {
2098
+ readonly type: "integer";
2099
+ readonly minimum: 1;
2100
+ };
2101
+ readonly key: {
2102
+ readonly type: "string";
2103
+ readonly minLength: 1;
2104
+ };
2105
+ };
2106
+ };
2107
+ };
2108
+ readonly arkOrderBudgetLeaks: {
2109
+ readonly type: "array";
2110
+ readonly items: {
2111
+ readonly type: "object";
2112
+ readonly additionalProperties: false;
2113
+ readonly required: readonly ["file", "line", "kind"];
2114
+ readonly properties: {
2115
+ readonly file: {
2116
+ readonly type: "string";
2117
+ readonly minLength: 1;
2118
+ readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
2119
+ };
2120
+ readonly line: {
2121
+ readonly type: "integer";
2122
+ readonly minimum: 1;
2123
+ };
2124
+ readonly kind: {
2125
+ readonly type: "string";
2126
+ readonly minLength: 1;
2127
+ };
2128
+ };
2129
+ };
2130
+ };
2131
+ readonly factsHash: {
2132
+ readonly type: "string";
2133
+ readonly minLength: 1;
2134
+ };
2135
+ };
2136
+ readonly allOf: readonly [{
2137
+ readonly if: {
2138
+ readonly properties: {
2139
+ readonly completeness: {
2140
+ readonly const: "complete";
2141
+ };
2142
+ };
2143
+ };
2144
+ readonly then: {
2145
+ readonly properties: {
2146
+ readonly completenessReasons: {
2147
+ readonly maxItems: 0;
2148
+ };
2149
+ readonly files: {
2150
+ readonly items: {
2151
+ readonly properties: {
2152
+ readonly parseStatus: {
2153
+ readonly const: "parsed";
2154
+ };
2155
+ };
2156
+ };
2157
+ };
2158
+ };
2159
+ };
2160
+ }, {
2161
+ readonly if: {
2162
+ readonly properties: {
2163
+ readonly completeness: {
2164
+ readonly enum: readonly ["partial", "unavailable"];
2165
+ };
2166
+ };
2167
+ };
2168
+ readonly then: {
2169
+ readonly properties: {
2170
+ readonly completenessReasons: {
2171
+ readonly minItems: 1;
2172
+ };
2173
+ };
2174
+ };
2175
+ }];
2176
+ };
2177
+
2178
+ /**
2179
+ * Stable, pure vocabulary for ArkGate's importable analysis engine.
2180
+ *
2181
+ * This module owns the Analysis IR types and re-exports the resolved-candidate-facts
2182
+ * pilot cluster (plan-B / pattern-b:god-module). Parsing and filesystem discovery
2183
+ * belong to adapters.
2184
+ *
2185
+ * Cluster:
2186
+ * - `stableHash` — identity/fingerprint primitives
2187
+ * - `resolvedCandidateFactsTypes` — versioned fact types
2188
+ * - `resolvedCandidateFacts` — create/load/canonicalize
2189
+ * - `resolvedCandidateFactsSchema` — published JSON Schema
2190
+ *
2191
+ * Consumer import paths through this facade remain stable (same pattern as Kernel
2192
+ * `analysis.ts` after U02).
2193
+ */
2194
+
2195
+ declare const ANALYSIS_IR_SCHEMA_VERSION: "1.0";
2196
+ type AnalysisFileInput = {
2197
+ path: string;
2198
+ content: string;
2199
+ };
2200
+ type AnalysisFileChange = {
2201
+ path: string;
2202
+ content: string;
2203
+ } | {
2204
+ path: string;
2205
+ delete: true;
2206
+ };
2207
+ type AnalysisCompilerOptions = Readonly<Record<string, unknown>>;
2208
+ type AnalysisFile = AnalysisFileInput & {
2209
+ contentHash: string;
2210
+ layer: string | null;
2211
+ };
2212
+ type AnalysisImportEdge = {
2213
+ from: string;
2214
+ specifier: string;
2215
+ to: string | null;
2216
+ resolution: 'resolved' | 'unresolved';
2217
+ fromLayer: string | null;
2218
+ toLayer: string | null;
2219
+ evidence: AnalysisEvidence;
2220
+ };
2221
+ /** A capability use is reserved for C04's symbol-aware implementation. */
2222
+ type AnalysisCapabilityUse = {
2223
+ file: string;
2224
+ symbol: string;
2225
+ capability: string;
2226
+ evidence: AnalysisEvidence;
2227
+ };
2228
+ type AnalysisEvidence = {
2229
+ kind: 'import' | 'policy';
2230
+ file: string;
2231
+ line: number;
2232
+ excerpt: string;
2233
+ };
2234
+ type AnalysisViolation = {
2235
+ ruleId: string;
2236
+ message: string;
2237
+ edge?: AnalysisImportEdge;
2238
+ /** U04 (additive): present on CAPABILITY_VIOLATION — the denied capability id. */
2239
+ capability?: string;
2240
+ /** U04 (additive): the matched module specifier or ambient path. */
2241
+ symbol?: string;
2242
+ evidence: AnalysisEvidence;
2243
+ };
2244
+ type AnalysisIr = {
2245
+ schemaVersion: typeof ANALYSIS_IR_SCHEMA_VERSION;
2246
+ policyHash: string;
2247
+ compilerOptionsHash: string;
2248
+ files: AnalysisFile[];
2249
+ layers: string[];
2250
+ edges: AnalysisImportEdge[];
2251
+ capabilityUses: AnalysisCapabilityUse[];
2252
+ violations: AnalysisViolation[];
2253
+ };
2254
+
2255
+ declare const ARK_CHANGE_MAP_SCHEMA_VERSION: "1.0";
2256
+ type ArchitectureChangeOperation = 'create' | 'update' | 'delete';
2257
+ type ArchitectureChangeMapFile = {
2258
+ path: string;
2259
+ operation: ArchitectureChangeOperation;
2260
+ layer: string;
2261
+ };
2262
+ type ArchitectureChangeMapDependency = {
2263
+ from: string;
2264
+ to: string;
2265
+ };
2266
+ type ArchitectureChangeMap = {
2267
+ $schema: string;
2268
+ schemaVersion: typeof ARK_CHANGE_MAP_SCHEMA_VERSION;
2269
+ files: ArchitectureChangeMapFile[];
2270
+ dependencies: ArchitectureChangeMapDependency[];
2271
+ };
2272
+ type ArchitectureChangeMapContract = {
2273
+ map: ArchitectureChangeMap;
2274
+ hash: string;
2275
+ };
2276
+
2277
+ type ArchitectureDependency = {
2278
+ from: string;
2279
+ to: string;
2280
+ };
2281
+ type ArchitectureActualChange = {
2282
+ path: string;
2283
+ operation: ArchitectureChangeOperation;
2284
+ };
2285
+ type ArchitectureConvergenceClassification = 'satisfied' | 'missing' | 'contradictory' | 'unplanned';
2286
+ type ArchitectureConvergenceFinding = {
2287
+ id: string;
2288
+ classification: ArchitectureConvergenceClassification;
2289
+ subject: 'file' | 'dependency';
2290
+ message: string;
2291
+ nextAction?: string;
2292
+ path?: string;
2293
+ from?: string;
2294
+ to?: string;
2295
+ expectedOperation?: ArchitectureChangeOperation;
2296
+ actualOperation?: ArchitectureChangeOperation | 'added' | 'removed';
2297
+ };
2298
+ type ArchitectureConvergenceResult = {
2299
+ schemaVersion: '1.0';
2300
+ readOnly: true;
2301
+ changeMapHash: string;
2302
+ structurallyConverged: boolean;
2303
+ behavioralCompletion: 'not-evaluated';
2304
+ summary: Record<ArchitectureConvergenceClassification, number>;
2305
+ findings: ArchitectureConvergenceFinding[];
2306
+ };
2307
+ type AnalyzeArchitectureConvergenceInput = {
2308
+ changeMap: ArchitectureChangeMapContract;
2309
+ changes: readonly ArchitectureActualChange[];
2310
+ baseDependencies: readonly ArchitectureDependency[];
2311
+ candidateDependencies: readonly ArchitectureDependency[];
2312
+ };
2313
+ declare function analyzeArchitectureConvergence(input: AnalyzeArchitectureConvergenceInput): ArchitectureConvergenceResult;
2314
+
2315
+ type SemanticDependencyKind = 'import' | 'export' | 'dynamic-import' | 'require';
2316
+ type SemanticDependency = {
2317
+ specifier?: string;
2318
+ kind: SemanticDependencyKind;
2319
+ line: number;
2320
+ typeOnly: boolean;
2321
+ unresolved: boolean;
2322
+ node: unknown;
2323
+ };
2324
+ type ForbiddenCapabilityUse = {
2325
+ name: string;
2326
+ line: number;
2327
+ node: unknown;
2328
+ };
2329
+ /** Extract every dependency form whose specifier is statically knowable, plus unresolved calls. */
2330
+ declare function extractSemanticDependencies(ts: any, sourceFile: any): SemanticDependency[];
2331
+ /** Resolve forbidden ambient capabilities through symbols, aliases, globalThis, and static keys. */
2332
+ declare function collectForbiddenCapabilityUses(ts: any, sourceFile: any, forbidden: readonly string[]): ForbiddenCapabilityUse[];
2333
+
2334
+ /**
2335
+ * Type vocabulary for ArkRules files (ADR 0012).
2336
+ *
2337
+ * Pure declarations only — runtime validation and the published JSON Schema live in
2338
+ * ./arkRulesContract.ts so generate:cli-pure can emit a self-contained artifact.
2339
+ */
2340
+ /** Closed sensor vocabulary (ADR 0013). Unknown sensors fail closed at load time. */
2341
+ 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"];
2342
+ type ArkRuleSensorId = (typeof ARK_RULE_SENSOR_IDS)[number];
2343
+ type ArkRuleMode = 'advisory' | 'enforced';
2344
+ type ArkRuleStructureEntry = {
2345
+ id: string;
2346
+ sensor: ArkRuleSensorId;
2347
+ mode?: ArkRuleMode;
2348
+ appliesTo?: string[];
2349
+ description?: string;
2350
+ };
2351
+ type ArkRuleInvariantCoverage = {
2352
+ test?: boolean;
2353
+ symbol?: string;
2354
+ };
2355
+ type ArkRuleInvariantEntry = {
2356
+ id: string;
2357
+ description: string;
2358
+ aggregate?: string;
2359
+ coverage?: ArkRuleInvariantCoverage;
2360
+ mode?: ArkRuleMode;
2361
+ appliesTo?: string[];
2362
+ };
2363
+ type ArkRuleProvenance = {
2364
+ sourceFile: string;
2365
+ ruleId: string;
2366
+ layer: string;
2367
+ };
2368
+ type EffectiveStructureRule = ArkRuleStructureEntry & {
2369
+ mode: ArkRuleMode;
2370
+ provenance: ArkRuleProvenance;
2371
+ };
2372
+ type EffectiveInvariantRule = ArkRuleInvariantEntry & {
2373
+ mode: ArkRuleMode;
2374
+ provenance: ArkRuleProvenance;
2375
+ };
2376
+ type EffectiveArkRules = {
2377
+ schemaVersion: '1.0';
2378
+ byLayer: Record<string, {
2379
+ sourceFile: string;
2380
+ structure: EffectiveStructureRule[];
2381
+ invariants: EffectiveInvariantRule[];
2382
+ }>;
2383
+ structure: EffectiveStructureRule[];
2384
+ invariants: EffectiveInvariantRule[];
2385
+ };
2386
+
2387
+ /**
2388
+ * Pure invariant coverage evidence (ADR 0014 / AR09–AR10).
2389
+ *
2390
+ * Mines test titles and symbol declarations against the Effective ArkRules catalog.
2391
+ * `classifyCoverage` returns one verdict; `countsAsCoverage` is the policy;
2392
+ * `describeCoverage` is the sentence. A bare mention is never coverage.
2393
+ * No filesystem — Tooling supplies file contents and test globs.
2394
+ */
2395
+
2396
+ /**
2397
+ * How a `coverage.symbol` identifier is declared. `type`, `interface`, and
2398
+ * `enum` are declarations — the same witness as function, class, const, and
2399
+ * method.
2400
+ */
2401
+ type DeclarationShape = 'function' | 'class' | 'const' | 'method' | 'type' | 'interface' | 'enum';
2402
+ type InvariantCoverageEvidence = {
2403
+ invariantId: string;
2404
+ layer: string;
2405
+ sourceFile: string;
2406
+ mode: 'advisory' | 'enforced';
2407
+ covered: boolean;
2408
+ evidence: Array<'test-title' | 'symbol'>;
2409
+ /** When no test globs were supplied, coverage cannot be proven. */
2410
+ partial: boolean;
2411
+ description: string;
2412
+ /** Test file that supplied the `test-title` evidence, when there was one. */
2413
+ testEvidenceFile?: string;
2414
+ /**
2415
+ * Non-test file that declares `coverage.symbol`. Absent when the name only
2416
+ * appears in an import or a call. ArkGate never runs tests; this path is the
2417
+ * declaration text, not a passing suite.
2418
+ */
2419
+ symbolEvidenceFile?: string;
2420
+ /**
2421
+ * Declaration shape when `evidence` includes `symbol`. Additive: readers that
2422
+ * only know `test-title` | `symbol` ignore it.
2423
+ */
2424
+ shape?: DeclarationShape;
2425
+ /**
2426
+ * The only covering test found sits outside `coverage.coverageRoots` — the
2427
+ * places the project declares its runner executes. ArkGate never runs tests,
2428
+ * so a title match outside those roots is a test that exists, not a test that
2429
+ * runs. Absent (undefined) when no roots were declared: without a declaration
2430
+ * there is nothing to compare against, and silence is honest.
2431
+ */
2432
+ outsideDeclaredRoots?: boolean;
2433
+ /**
2434
+ * True when `coverage.coverageRoots` was non-empty for this evaluation.
2435
+ * `false` when the project declared nothing. Omitted on hand-built evidence
2436
+ * so existing promote fixtures stay valid; the evaluator always sets it.
2437
+ */
2438
+ coverageRootsDeclared?: boolean;
2439
+ };
2440
+ /**
2441
+ * What the Tooling scan actually saw. Every discard has a counted reason —
2442
+ * a silent drop would make an uncovered verdict unexplainable.
2443
+ */
2444
+ type InvariantCoverageStats = {
2445
+ /**
2446
+ * Files actually opened and read. Always >= filesLoaded: a test is read
2447
+ * before it can be judged for naming an invariant, so the file budget bounds
2448
+ * RETENTION, not I/O. Reporting only the retained count made
2449
+ * `coverage.maxFiles` read as a knob on how much the scan opens.
2450
+ */
2451
+ filesRead?: number;
2452
+ /** Files retained as coverage evidence (tests + production). */
2453
+ filesLoaded: number;
2454
+ /** Test files retained (subset of filesLoaded). */
2455
+ testFilesRetained: number;
2456
+ /** The file budget in force for this scan (config `coverage.maxFiles` or the default). */
2457
+ maxFiles: number;
2458
+ discarded: {
2459
+ /** Reached the file budget. */
2460
+ budget: number;
2461
+ /** Test file naming no catalogued invariant (scanned, then dropped). */
2462
+ noInvariantMention: number;
2463
+ /** Larger than the per-file byte cap. */
2464
+ oversize: number;
2465
+ /**
2466
+ * stat/read failed on a file or a directory: permissions, a broken symlink,
2467
+ * or something that moved mid-scan. Files and directories share one counter.
2468
+ */
2469
+ unreadable: number;
2470
+ /** Directory deeper than the walk depth limit — its files were never seen. */
2471
+ depthLimited: number;
2472
+ /**
2473
+ * Symlink inside the tree whose target resolves outside the project root.
2474
+ * Refused as evidence: a file that is not in this repo must not prove an
2475
+ * invariant covered.
2476
+ */
2477
+ outOfRoot: number;
2478
+ };
2479
+ };
2480
+
2481
+ /**
2482
+ * Pure ArkRules structure sensor evaluation (ADR 0013).
2483
+ *
2484
+ * Consumes closed class-shape / file facts + Effective ArkRules. Emits violations with
2485
+ * arkrule provenance. No filesystem, no TypeScript compiler.
2486
+ */
2487
+
2488
+ type ClassShapeFact = {
2489
+ file: string;
2490
+ className: string;
2491
+ exported: boolean;
2492
+ hasPublicMutableFields: boolean;
2493
+ hasPublicSetters: boolean;
2494
+ hasPublicConstructor: boolean;
2495
+ hasStaticFactory: boolean;
2496
+ mutatingMethods: readonly {
2497
+ name: string;
2498
+ referencesGuardOrPublish: boolean;
2499
+ }[];
2500
+ /** Heuristic: data-only class (fields, no methods beyond accessors). */
2501
+ dataOnly?: boolean;
2502
+ /**
2503
+ * Set when the scanner could not walk the class to its end: the character
2504
+ * offset (in the source file) where analysis stopped. Enumerable on purpose so
2505
+ * it survives fact canonicalisation and serialisation; enforced structure
2506
+ * sensors report it instead of passing in silence.
2507
+ */
2508
+ truncatedUntil?: number;
2509
+ };
2510
+
2511
+ /**
2512
+ * Config-key version floors plus pin evidence (#338).
2513
+ *
2514
+ * A slice key such as `childSlices` is rejected at config load by an older
2515
+ * arkgate (the rule schema sets `additionalProperties: false`). ArkGate warns
2516
+ * about that only with evidence that this repo pins such an older arkgate: an
2517
+ * exact package.json dependency, the installed copy, the lockfile, a hook
2518
+ * script, or a CI workflow. Without evidence it stays silent.
2519
+ *
2520
+ * Pure: Tooling reads the files and passes their text here.
2521
+ */
2522
+ /** Where a pin was found. */
2523
+ type ArkgatePinSource = 'package-json' | 'package-lock' | 'installed' | 'hook' | 'ci';
2524
+ type ArkgatePinEvidence = {
2525
+ /** Repo-relative file that pins arkgate. */
2526
+ file: string;
2527
+ /** 1-based line of the pin. */
2528
+ line: number;
2529
+ /** Pinned version, without a leading `v`. */
2530
+ version: string;
2531
+ source: ArkgatePinSource;
2532
+ };
2533
+
2534
+ declare const POLICY_DELTA_SCHEMA_VERSION: "1.0";
2535
+ type PolicyDeltaClassification = 'strengthening' | 'neutral' | 'judgment-required' | 'weakening';
2536
+ type PolicyDeltaFinding = {
2537
+ id: string;
2538
+ path: string;
2539
+ classification: Exclude<PolicyDeltaClassification, 'neutral'>;
2540
+ message: string;
2541
+ nextAction?: string;
2542
+ before?: unknown;
2543
+ after?: unknown;
2544
+ };
2545
+ type PolicyDelta = {
2546
+ schemaVersion: typeof POLICY_DELTA_SCHEMA_VERSION;
2547
+ classification: PolicyDeltaClassification;
2548
+ findings: PolicyDeltaFinding[];
2549
+ };
2550
+ type PolicyDeltaAcknowledgement = {
2551
+ schemaVersion: typeof POLICY_DELTA_SCHEMA_VERSION;
2552
+ basePolicyHash: string;
2553
+ candidatePolicyHash: string;
2554
+ findingIds: readonly string[];
2555
+ reason: string;
2556
+ /**
2557
+ * Relative decision-note path under a conventional home (`docs/adr/`,
2558
+ * `docs/decisions/`, or the AP01 single-file homes). Tooling checks the file.
2559
+ * Hash matching does not require it.
2560
+ */
2561
+ adrPath?: string;
2562
+ };
2563
+ type ClassifyArkPolicyDeltaOptions = {
2564
+ baseArkRules?: EffectiveArkRules;
2565
+ candidateArkRules?: EffectiveArkRules;
2566
+ /**
2567
+ * AR11 — coverage evidence for candidate invariants. Required to auto-allow
2568
+ * advisory→enforced promotion; without it (or when uncovered), promotion is
2569
+ * judgment-required / refused.
2570
+ */
2571
+ candidateInvariantCoverage?: readonly InvariantCoverageEvidence[];
2572
+ };
2573
+ declare function classifyArkPolicyDelta(base: ArkConfig, candidate: ArkConfig, options?: ClassifyArkPolicyDeltaOptions): PolicyDelta;
2574
+ declare function policyDeltaAcknowledgementMatches(acknowledgement: PolicyDeltaAcknowledgement | undefined, expected: {
2575
+ basePolicyHash: string;
2576
+ candidatePolicyHash: string;
2577
+ findingIds: readonly string[];
2578
+ }): boolean;
2579
+
2580
+ type AnalysisContract = ArkConfigLoadResult & {
2581
+ policyHash: string;
2582
+ /**
2583
+ * ADR 0012 Effective ArkRules (empty when arkRules is absent).
2584
+ * Included in policyHash when non-empty so arkrules edits invalidate identity.
2585
+ */
2586
+ arkRules?: EffectiveArkRules;
2587
+ /**
2588
+ * ADR 0013 class-shape facts for ArkRules sensors (Tooling-supplied).
2589
+ * Empty / absent when ArkRules are not active.
2590
+ */
2591
+ classShapes?: ClassShapeFact[];
2592
+ };
2593
+ type AnalyzeProjectInput = {
2594
+ contract: AnalysisContract;
2595
+ files: readonly AnalysisFileInput[];
2596
+ compilerOptions?: AnalysisCompilerOptions;
2597
+ };
2598
+ type AnalyzeChangeInput = AnalyzeProjectInput & {
2599
+ changes: readonly AnalysisFileChange[];
2600
+ changeMap?: ArchitectureChangeMapContract;
2601
+ };
2602
+ type AnalysisResult = {
2603
+ mode: 'lexical-compatibility';
2604
+ completeness: ResolvedFactsCompleteness;
2605
+ completenessReasons: ResolvedFactsReason[];
2606
+ valid: boolean;
2607
+ ir: AnalysisIr;
2608
+ };
2609
+ type AnalyzeResolvedProjectInput = {
2610
+ contract: AnalysisContract;
2611
+ facts: unknown;
2612
+ /** Tooling FS evidence of arkgate pins. Omitted: version-floor warnings stay silent. */
2613
+ arkgatePins?: readonly ArkgatePinEvidence[];
2614
+ /** The running arkgate version, for the version-floor nextAction. */
2615
+ runningArkgateVersion?: string;
2616
+ /**
2617
+ * D0 adopted or --require-gates / --strict-merge. When true, a missing
2618
+ * domain-invariant tests path fails closed. Omitted stays silent.
2619
+ */
2620
+ adopted?: boolean;
2621
+ /**
2622
+ * Tooling FS check for the declared tests path. `false` means empty on disk.
2623
+ * Omitted: a non-empty config declaration is enough.
2624
+ */
2625
+ invariantTestsPathPresent?: boolean;
2626
+ /**
2627
+ * Tooling FS check for declared `coverage.coverageRoots`. `false` means
2628
+ * missing or empty on disk. Omitted: a non-empty config declaration is enough.
2629
+ */
2630
+ coverageRootsPresent?: boolean;
2631
+ /**
2632
+ * AR10 — Tooling-supplied contents for invariant coverage evidence.
2633
+ * When omitted and the Effective Contract has invariants, coverage is partial
2634
+ * (never false green covered).
2635
+ */
2636
+ coverageInputs?: {
2637
+ fileContents: Readonly<Record<string, string>>;
2638
+ testFiles?: readonly string[];
2639
+ testGlobsMissing?: boolean;
2640
+ coverageBudgetExhausted?: boolean;
2641
+ /** Declared `coverage.coverageRoots`: where the project says its runner runs. */
2642
+ coverageRoots?: readonly string[];
2643
+ /** Counted scan facts: files loaded, tests retained, discards by reason. */
2644
+ stats?: InvariantCoverageStats;
2645
+ };
2646
+ /**
2647
+ * AR07 — Tooling-supplied orchestration/thin-adapter heuristics per file.
2648
+ * Prefer deriveArkRuleFileHints / buildArkRuleFileHints (Domain pure).
2649
+ * When omitted, orchestration-only, thin-adapter, and writes-via-aggregate
2650
+ * sensors stay silent.
2651
+ */
2652
+ fileHints?: Readonly<Record<string, {
2653
+ orchestrationHeavy?: boolean;
2654
+ adapterThick?: boolean;
2655
+ persistenceWrite?: boolean;
2656
+ }>>;
2657
+ };
2658
+ /** Tooling-supplied analysis evidence for one side (base or candidate) of a preflight. */
2659
+ type ResolvedAnalysisSideInputs = Pick<AnalyzeResolvedProjectInput, 'adopted' | 'invariantTestsPathPresent' | 'coverageRootsPresent' | 'coverageInputs' | 'fileHints'>;
2660
+ type PreflightResolvedChangeInput = {
2661
+ contract: AnalysisContract;
2662
+ baseFacts: unknown;
2663
+ candidateFacts: unknown;
2664
+ changes: readonly AnalysisFileChange[];
2665
+ changeMap?: ArchitectureChangeMapContract;
2666
+ /**
2667
+ * ArkRules evidence (coverage contents, structural hints) for the on-disk base and
2668
+ * the in-memory candidate, so preflight runs the same engine inputs as ark-check.
2669
+ */
2670
+ baseAnalysisInputs?: ResolvedAnalysisSideInputs;
2671
+ candidateAnalysisInputs?: ResolvedAnalysisSideInputs;
2672
+ };
2673
+ type ResolvedAnalysisFile = ResolvedFileFact & {
2674
+ layer: string | null;
2675
+ };
2676
+ type ResolvedAnalysisIr = {
2677
+ schemaVersion: '1.0';
2678
+ policyHash: string;
2679
+ compilerOptionsHash: string;
2680
+ files: ResolvedAnalysisFile[];
2681
+ layers: string[];
2682
+ edges: ArchitectureEngineEdge[];
2683
+ capabilityUses: ResolvedCapabilityFact[];
2684
+ violations: ArchitectureEngineViolation[];
2685
+ warnings: ArchitectureEngineViolation[];
2686
+ };
2687
+ type ResolvedSafetyReport = {
2688
+ tsSuppressions: {
2689
+ file: string;
2690
+ line: number;
2691
+ }[];
2692
+ anyCasts: {
2693
+ file: string;
2694
+ line: number;
2695
+ }[];
2696
+ nonLiteralDynamicImports: {
2697
+ file: string;
2698
+ line: number;
2699
+ kind: 'import' | 'require';
2700
+ }[];
2701
+ inMemoryProductionStores: {
2702
+ file: string;
2703
+ line: number;
2704
+ store: string;
2705
+ }[];
2706
+ disabledPeerIsolationRules: {
2707
+ from: string;
2708
+ to: string;
2709
+ }[];
2710
+ thresholds: {
2711
+ maxTsSuppressions: number;
2712
+ maxAnyCasts: number;
2713
+ };
2714
+ };
2715
+ type ResolvedAnalysisResult = {
2716
+ mode: 'resolved-candidate-facts';
2717
+ completeness: ResolvedFactsCompleteness;
2718
+ completenessReasons: ResolvedFactsReason[];
2719
+ valid: boolean;
2720
+ strictValid: boolean;
2721
+ policyHash: string;
2722
+ factsHash: ResolvedCandidateFacts['factsHash'];
2723
+ resolverIdentity: ResolvedCandidateFacts['resolverIdentity'];
2724
+ candidateTreeHash: ResolvedCandidateFacts['candidateTreeHash'];
2725
+ safety: ResolvedSafetyReport;
2726
+ ir: ResolvedAnalysisIr;
2727
+ };
2728
+ type ResolvedChangePreflightResult = {
2729
+ schemaVersion: '1.0';
2730
+ mode: 'resolved-candidate-facts';
2731
+ valid: boolean;
2732
+ readOnly: true;
2733
+ policyHash: string;
2734
+ resolverIdentity: string;
2735
+ compilerIdentity: string;
2736
+ compilerOptionsHash: string;
2737
+ tsconfigHash: string;
2738
+ baseCompilerOptionsHash: string;
2739
+ candidateCompilerOptionsHash: string;
2740
+ baseTsconfigHash: string;
2741
+ candidateTsconfigHash: string;
2742
+ evidenceRequirementsHash: string;
2743
+ baseFactsHash: string;
2744
+ candidateFactsHash: string;
2745
+ baseTreeHash: string;
2746
+ candidateTreeHash: string;
2747
+ baseCompleteness: ResolvedFactsCompleteness;
2748
+ candidateCompleteness: ResolvedFactsCompleteness;
2749
+ baseCompletenessReasons: ResolvedFactsReason[];
2750
+ candidateCompletenessReasons: ResolvedFactsReason[];
2751
+ changeMapHash?: string;
2752
+ convergence?: ArchitectureConvergenceResult;
2753
+ changes: PreparedChangeFile[];
2754
+ violations: ArchitectureEngineViolation[];
2755
+ warnings: ArchitectureEngineViolation[];
2756
+ };
2757
+ type AnalyzePolicyDeltaInput = {
2758
+ baseConfig: unknown;
2759
+ candidateConfig: unknown;
2760
+ acknowledgement?: PolicyDeltaAcknowledgement;
2761
+ baseSource?: string;
2762
+ candidateSource?: string;
2763
+ /** Optional pre-resolved Effective ArkRules for each side (ADR 0012 / AR02). */
2764
+ baseArkRules?: EffectiveArkRules;
2765
+ candidateArkRules?: EffectiveArkRules;
2766
+ /**
2767
+ * AR11 — optional coverage evidence for candidate invariants.
2768
+ * When omitted, advisory→enforced promotion is judgment-required (refuse auto-allow).
2769
+ */
2770
+ candidateInvariantCoverage?: readonly InvariantCoverageEvidence[];
2771
+ };
2772
+ type PolicyDeltaAnalysis = {
2773
+ schemaVersion: '1.0';
2774
+ basePolicyHash: string;
2775
+ candidatePolicyHash: string;
2776
+ classification: PolicyDeltaClassification;
2777
+ findings: PolicyDeltaFinding[];
2778
+ blockingFindingIds: string[];
2779
+ requiresAcknowledgement: boolean;
2780
+ acknowledged: boolean;
2781
+ valid: boolean;
2782
+ };
2783
+ type ArchitectureEngineViolation = {
2784
+ ruleId: string;
2785
+ message: string;
2786
+ file?: string;
2787
+ line?: number;
2788
+ target?: string;
2789
+ fromLayer?: string;
2790
+ toLayer?: string;
2791
+ nextAction?: string;
2792
+ [key: string]: unknown;
2793
+ };
2794
+ type ArchitectureEngineEdge = {
2795
+ from: string;
2796
+ fromLayer: string | null;
2797
+ to?: string;
2798
+ toLayer?: string;
2799
+ line: number;
2800
+ kind: string;
2801
+ typeOnly?: boolean;
2802
+ targetTypeOnlyExports?: boolean;
2803
+ sourcePureTypeModule?: boolean;
2804
+ namedBindingsTypeOnly?: boolean;
2805
+ portProofEligible?: boolean;
2806
+ };
2807
+ type EvaluateArchitectureGraphInput = {
2808
+ config: ArkConfig;
2809
+ rules: ArkConfig['rules'];
2810
+ files: readonly string[];
2811
+ contentViolations: readonly ArchitectureEngineViolation[];
2812
+ edges: readonly ArchitectureEngineEdge[];
2813
+ warnings?: readonly ArchitectureEngineViolation[];
2814
+ safety?: unknown;
2815
+ };
2816
+ type ArchitectureEngineResult = {
2817
+ violations: ArchitectureEngineViolation[];
2818
+ warnings: ArchitectureEngineViolation[];
2819
+ safety?: unknown;
2820
+ };
2821
+ type PreparedChangeFile = {
2822
+ path: string;
2823
+ operation: 'create' | 'update' | 'delete';
2824
+ beforeContentHash?: string;
2825
+ candidateContentHash?: string;
2826
+ };
2827
+ type ChangePreflightResult = {
2828
+ schemaVersion: '1.0';
2829
+ mode: 'lexical-compatibility';
2830
+ valid: boolean;
2831
+ readOnly: true;
2832
+ policyHash: string;
2833
+ compilerOptionsHash: string;
2834
+ baseTreeHash: string;
2835
+ candidateTreeHash: string;
2836
+ baseCompleteness: ResolvedFactsCompleteness;
2837
+ candidateCompleteness: ResolvedFactsCompleteness;
2838
+ baseCompletenessReasons: ResolvedFactsReason[];
2839
+ candidateCompletenessReasons: ResolvedFactsReason[];
2840
+ changeMapHash?: string;
2841
+ convergence?: ArchitectureConvergenceResult;
2842
+ changes: PreparedChangeFile[];
2843
+ violations: ArchitectureEngineViolation[];
2844
+ warnings: ArchitectureEngineViolation[];
2845
+ };
2846
+ type CollectAnalysisConfigWarningsInput = {
2847
+ config: ArkConfig;
2848
+ rules: ArkConfig['rules'];
2849
+ files: readonly string[];
2850
+ /**
2851
+ * Tooling FS evidence of arkgate pins in this repo (package.json, lockfile,
2852
+ * installed copy, hook scripts, CI). Omitted: version-floor warnings stay silent.
2853
+ */
2854
+ arkgatePins?: readonly ArkgatePinEvidence[];
2855
+ /** The running arkgate version. The version-floor nextAction targets it when newer. */
2856
+ runningArkgateVersion?: string;
2857
+ manifest?: {
2858
+ architecture?: {
2859
+ layers?: readonly {
2860
+ name?: string;
2861
+ prefixes?: readonly string[];
2862
+ }[];
2863
+ };
2864
+ };
2865
+ };
2866
+
2867
+ /**
2868
+ * Contract loading, project/change analysis, and policy-delta analysis
2869
+ * (U02 pilot 2). Reached through the src/kernel/analysis.ts facade; consumer
2870
+ * import paths never change.
2871
+ */
2872
+
2873
+ type LoadContractOptions = {
2874
+ /** Pre-resolved Effective ArkRules (from resolveEffectiveContract). */
2875
+ arkRules?: EffectiveArkRules;
2876
+ };
2877
+ declare function loadContract(input: unknown, source?: string, options?: LoadContractOptions): AnalysisContract;
2878
+ declare function analyzePolicyDelta(input: AnalyzePolicyDeltaInput): PolicyDeltaAnalysis;
2879
+ declare function analyzeProject(input: AnalyzeProjectInput): AnalysisResult;
2880
+ declare function analyzeChange(input: AnalyzeChangeInput): AnalysisResult;
2881
+ declare function explainViolation(violation: AnalysisViolation): string;
2882
+
2883
+ declare function detectArchitectureCycles(graph: ReadonlyMap<string, ReadonlySet<string>>): ArchitectureEngineViolation[];
2884
+ /** Canonical graph and layer-policy evaluator shared by library, CLI, and MCP adapters. */
2885
+ declare function evaluateArchitectureGraph(input: EvaluateArchitectureGraphInput): ArchitectureEngineResult;
2886
+
2887
+ /**
2888
+ * Pure evaluation of validated, resolver-supplied candidate facts (ADR 0011).
2889
+ *
2890
+ * Filesystem discovery and TypeScript resolution remain Tooling concerns. This
2891
+ * module only classifies canonical paths against the supplied contract and
2892
+ * produces the one architecture verdict consumed by every resolved adapter.
2893
+ */
2894
+
2895
+ /** Validate supplied facts and evaluate their graph without host effects. */
2896
+ declare function analyzeResolvedProject(input: AnalyzeResolvedProjectInput): ResolvedAnalysisResult;
2897
+
2898
+ /**
2899
+ * Evaluate one create/update/delete set as a single in-memory candidate.
2900
+ * The function never writes and returns hashes that bind a later host commit to
2901
+ * the exact base, policy, compiler options, and candidate contents it checked.
2902
+ */
2903
+ declare function preflightChange(input: AnalyzeChangeInput): ChangePreflightResult;
2904
+
2905
+ /** Atomic preflight over one validated base/candidate facts pair (ADR 0011). */
2906
+
2907
+ /**
2908
+ * Validate that the supplied candidate is exactly the declared in-memory
2909
+ * overlay, then return its canonical resolved verdict. No project file is read
2910
+ * or written here.
2911
+ */
2912
+ declare function preflightResolvedChange(input: PreflightResolvedChangeInput): ResolvedChangePreflightResult;
2913
+
2914
+ /** Canonical config diagnostics over repo-relative file paths. */
2915
+ declare function collectAnalysisConfigWarnings(input: CollectAnalysisConfigWarningsInput): ArchitectureEngineViolation[];
2916
+
2917
+ /**
2918
+ * Public diagnostic code catalog (ACS02).
2919
+ *
2920
+ * Closed vocabulary of stable `ruleId` values emitted by ArkGate adapters with
2921
+ * human/agent `why` / `fix` anchors and docs fragment ids. Cataloguing only —
2922
+ * no new rule semantics, no LLM verdict, no enforcement from prose.
2923
+ *
2924
+ * **Canonical** for docs, agent projection (ACS04), and finding refs (ACS06).
2925
+ * Runtime remediation remains in `remediation.ts`; parity tests bind the two.
2926
+ *
2927
+ * Zero Node I/O. Optional CLI surface: generated `bin/lib/diagnostic-catalog.mjs`.
2928
+ *
2929
+ * @see docs/diagnostics.md
2930
+ * @see docs/plans/agent-contract-surface-4.3/README.md
2931
+ */
2932
+ /** Product-relative docs path (shipped in the npm tarball when listed in package files). */
2933
+ declare const DIAGNOSTIC_DOCS_RELATIVE_PATH: "docs/diagnostics.md";
2934
+ /** Schema id for serializing the catalog snapshot (agents / install projection). */
2935
+ declare const DIAGNOSTIC_CATALOG_SCHEMA_VERSION: "1.0";
2936
+ type DiagnosticCategory = 'layer' | 'capability' | 'publish' | 'safety' | 'arkrules' | 'arkrun' | 'arkorder' | 'preflight' | 'analysis' | 'drift' | 'snippet-policy' | 'config' | 'adapter' | 'meta';
2937
+ type DiagnosticCatalogEntry = {
2938
+ /** Stable public violation / diagnostic id. */
2939
+ ruleId: string;
2940
+ /** Short title for indexes and agent projection. */
2941
+ title: string;
2942
+ /** Why this finding exists (contract intent). */
2943
+ why: string;
2944
+ /**
2945
+ * Canonical fix guidance (agent + human). Contextual nextAction on live
2946
+ * findings may specialize this (e.g. type-only vs value layer import).
2947
+ */
2948
+ fix: string;
2949
+ /** Markdown fragment id for docs/diagnostics.md (without leading #). */
2950
+ docsAnchor: string;
2951
+ category: DiagnosticCategory;
2952
+ /**
2953
+ * When true, finding is commonly advisory / non-blocking in default profiles
2954
+ * (doctor/config warnings, type-only placement debt, empty ArkRule scope).
2955
+ * Not a severity bit for the engine — documentation only.
2956
+ */
2957
+ oftenAdvisory?: boolean;
2958
+ };
2959
+ /**
2960
+ * Closed public catalog. Order is stable (category groups, then ruleId) for
2961
+ * deterministic serialization and docs generation.
2962
+ *
2963
+ * Every production-emitted `ruleId` must appear here. Remediation switch cases
2964
+ * and adapter nextAction branches are parity-tested against this list.
2965
+ */
2966
+ declare const DIAGNOSTIC_CATALOG: readonly DiagnosticCatalogEntry[];
2967
+ /** All public ruleIds in catalog order. */
2968
+ declare const DIAGNOSTIC_RULE_IDS: readonly string[];
2969
+ declare function isKnownDiagnosticCode(ruleId: string | null | undefined): boolean;
2970
+ /**
2971
+ * True when the code is catalogued or is an ArkRule-family id handled by the
2972
+ * ARKRULE_* prefix fallback in remediation (structure sensors may add members later
2973
+ * only via catalog + ROADMAP — prefix alone is not a license for free-form ids).
2974
+ */
2975
+ declare function isCataloguedOrArkRuleFamily(ruleId: string | null | undefined): boolean;
2976
+ declare function getDiagnosticCatalogEntry(ruleId: string | null | undefined): DiagnosticCatalogEntry | undefined;
2977
+ /** Fragment for docs links, e.g. `#LAYER_IMPORT_VIOLATION`. */
2978
+ declare function diagnosticDocsFragment(ruleId: string): string;
2979
+ /**
2980
+ * Repo-relative docs path with fragment (for agents and JSON).
2981
+ * Package consumers resolve against the installed package root or GitHub tree.
2982
+ */
2983
+ declare function diagnosticDocsPath(ruleId: string): string;
2984
+ /** Catalog snapshot for JSON export / agent projection (stable field order). */
2985
+ declare function serializeDiagnosticCatalog(): {
2986
+ schemaVersion: typeof DIAGNOSTIC_CATALOG_SCHEMA_VERSION;
2987
+ docsPath: typeof DIAGNOSTIC_DOCS_RELATIVE_PATH;
2988
+ codes: readonly DiagnosticCatalogEntry[];
2989
+ };
2990
+ /**
2991
+ * Static catalog fix for a ruleId when no live violation context is available.
2992
+ * Live adapters should still use deterministicNextAction for specialized edges.
2993
+ */
2994
+ declare function catalogFixForRuleId(ruleId: string | null | undefined): string | undefined;
2995
+ /**
2996
+ * Static catalog why for a ruleId (agent “why” surface).
2997
+ */
2998
+ declare function catalogWhyForRuleId(ruleId: string | null | undefined): string | undefined;
2999
+
3000
+ /** Public, evidence-backed enforcement state shared by doctor adapters. */
3001
+ declare const ARK_ENFORCEMENT_STATE_SCHEMA_VERSION: "1.1";
3002
+ type EnforcementVerification = boolean | 'unverified';
3003
+ type EnforcementEvidenceField = 'configured' | 'installed' | 'active' | 'runtimeObserved' | 'operationCoverage' | 'bypassable' | 'required' | 'hard';
3004
+ type EnforcementEvidence = {
3005
+ field: 'configured' | 'installed' | 'runtimeObserved' | 'hard';
3006
+ source: string;
3007
+ value: boolean;
3008
+ } | {
3009
+ field: 'active' | 'operationCoverage' | 'bypassable' | 'required';
3010
+ source: string;
3011
+ value: EnforcementVerification;
3012
+ };
3013
+ /**
3014
+ * State for one enforcement boundary.
3015
+ *
3016
+ * `configured` records valid wiring, while `installed` requires the referenced
3017
+ * package or executable to resolve. Runtime/provider facts remain
3018
+ * `unverified` until observed; local files never prove `required: true`.
3019
+ */
3020
+ type EnforcementBoundaryState = {
3021
+ supported: boolean;
3022
+ analyzed: boolean;
3023
+ configured: boolean;
3024
+ installed: boolean;
3025
+ active: EnforcementVerification;
3026
+ runtimeObserved: boolean;
3027
+ operation: string | null;
3028
+ operationCoverage: EnforcementVerification;
3029
+ bypassable: EnforcementVerification;
3030
+ required: EnforcementVerification;
3031
+ hard: boolean;
3032
+ evidence: readonly EnforcementEvidence[];
3033
+ };
3034
+ type ArkEnforcementHost = 'claude' | 'grok' | 'cursor' | 'codex' | 'unknown';
3035
+ type ArkEnforcementState = {
3036
+ schemaVersion: typeof ARK_ENFORCEMENT_STATE_SCHEMA_VERSION;
3037
+ activeHost: ArkEnforcementHost;
3038
+ localWrite: EnforcementBoundaryState;
3039
+ advisoryMcp: EnforcementBoundaryState;
3040
+ ciMerge: EnforcementBoundaryState;
3041
+ };
3042
+
3043
+ /** Public neutral contract for the opt-in new-code design-fitness ratchet. */
3044
+ declare const ARK_DESIGN_DELTA_SCHEMA_VERSION: "1.0";
3045
+ type DesignSmellId = 'io-under-application' | 'handler-in-persistence' | 'god-module' | 'domain-logic-in-ui' | 'facade-sql-in-routes' | 'mixed-pattern-cluster' | 'soft-contract';
3046
+ type DesignDeltaIdentity = {
3047
+ kind: 'git-tree' | 'candidate-tree';
3048
+ value: string;
3049
+ commit?: string;
3050
+ };
3051
+ type DesignSmellEvidence = {
3052
+ kind: string;
3053
+ path: string;
3054
+ line?: number;
3055
+ symbol?: string;
3056
+ detail?: string;
3057
+ magnitude: number;
3058
+ };
3059
+ type DesignSmellFinding = {
3060
+ smellId: DesignSmellId;
3061
+ fingerprint: string;
3062
+ identity: string;
3063
+ evidence: DesignSmellEvidence;
3064
+ repairHint: string;
3065
+ };
3066
+ type DesignDeltaChange = DesignSmellFinding & {
3067
+ classification: 'new' | 'worsened';
3068
+ baseMagnitude: number;
3069
+ candidateMagnitude: number;
3070
+ };
3071
+ /** Created-path merge vs full new+worsened ratchet (Z10). Omitted on older producers. */
3072
+ type DesignDeltaEnforcementScope = 'created-paths' | 'touched-new-or-worsened';
3073
+ type ArkDesignDeltaResult = {
3074
+ schemaVersion: typeof ARK_DESIGN_DELTA_SCHEMA_VERSION;
3075
+ mode: 'git-base' | 'write-candidate';
3076
+ complete: boolean;
3077
+ valid: boolean;
3078
+ base: DesignDeltaIdentity;
3079
+ candidate: DesignDeltaIdentity;
3080
+ supportedSmellIds: readonly DesignSmellId[];
3081
+ touchedPaths: readonly string[];
3082
+ changes: readonly DesignDeltaChange[];
3083
+ baseFindingCount: number;
3084
+ candidateFindingCount: number;
3085
+ historicalResidualCount: number;
3086
+ enforcementScope?: DesignDeltaEnforcementScope;
3087
+ error?: string;
3088
+ };
3089
+
3090
+ export { type AICodeGate, type AICodeGateContext, type AICodeGateOptions, type AICodeGateResult, type AICodeGateViolation, type AIGateExtension, ANALYSIS_IR_SCHEMA_VERSION, ARK_ANALYSIS_RESULT_SCHEMA, ARK_ANALYSIS_RESULT_SCHEMA_VERSION, ARK_DESIGN_DELTA_SCHEMA_VERSION, ARK_ENFORCEMENT_STATE_SCHEMA_VERSION, type Adapter, type AdapterCompletenessReason, type AdapterDiagnostic, type AdapterGovernanceIssue, type AdapterGovernanceResult, type AdapterResult, type AdapterSeverity, type AdapterViolationInput, 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, ArchitectureProfile, ArkCheckConfig, type ArkDesignDeltaResult, type ArkEnforcementHost, type ArkEnforcementState, ArkKernel, ArkKernelConfig, ArkKernelConfigError, ArkManifest, type ArkTestHarness, type ArkTestSnapshot, AuditQuery, AuditRecord, AuditStore, AuditTrail, type BuildPublishPolicyContextOptions, type ChangePreflightResult, type CollectAnalysisConfigWarningsInput, type ContractCheckResult, type CreateAdapterOptions, CreateArchitectureProfileFromArkConfigOptions, CreateArchitectureProfileOptions, CreateArkKernelFromConfigOptions, CreateArkKernelOptions, type CreateArkManifestOptions, CreateAuditTrailOptions, CreateElevenLayerArkConfigOptions, CreateObservabilityReporterOptions, CreateProjectionRegistryOptions, CreateWorkflowEngineOptions, DEFAULT_MAX_HISTORY_SIZE, DIAGNOSTIC_CATALOG, DIAGNOSTIC_CATALOG_SCHEMA_VERSION, DIAGNOSTIC_DOCS_RELATIVE_PATH, DIAGNOSTIC_RULE_IDS, DefineIntentOptions, type DefinePolicyOptions, type DefinePortOptions, DependencyGraph, DependencyInformationPackage, type DesignDeltaChange, type DesignDeltaEnforcementScope, type DesignDeltaIdentity, type DesignSmellEvidence, type DesignSmellFinding, type DesignSmellId, type DiagnosticCatalogEntry, type DiagnosticCategory, DomainEvent, type EnforcementBoundaryState, type EnforcementEvidence, type EnforcementEvidenceField, type EnforcementVerification, type EvaluateArchitectureGraphInput, EventBufferRecord, EventBufferStatus, EventBufferStore, EventBus, EventBusOptions, EventContract, EventContractRegistry, EventContractRegistryImpl, EventContractValidationResult, EventContractViolationError, type ForbiddenCapabilityUse, GraphEdge, type GraphPolicyContext, InMemoryAuditStore, InMemoryEventBuffer, type InMemoryEventBufferOptions, InMemoryOutboxStore, InMemoryReadModelStore, InMemoryWorkflowStore, type InformationPackageCompare, type InformationPackageDiff, IntentCreator, IntentCreator as IntentDefinition, IntentName, type IntentNameValidation, IntentRegistry, IntentRelationship, InvalidIntentNameError, type LayerFlowRule, LayerPolicyContextError, type LayerPolicyOptions, MANIFEST_SCHEMA_VERSION, MetadataRegistry, ObservabilityDriftReport, ObservabilityReporter, ObservedLayerFlowViolationError, OutboxRecord, OutboxStatus, POLICY_DELTA_SCHEMA_VERSION, Policy, type PolicyDelta, type PolicyDeltaAcknowledgement, type PolicyDeltaAnalysis, type PolicyDeltaClassification, type PolicyDeltaFinding, PolicyEnforcementMode, PolicyEngine, PolicySeverity, PolicyViolation, PolicyViolationError, type Port, type PreflightResolvedChangeInput, type PreparedChangeFile, ProjectionRegistry, type PublishPolicyContext, RESOLVED_CANDIDATE_FACTS_SCHEMA, RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION, ReadModelStore, 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, SagaDefinition, SagaInstance, type SemanticDependency, type SemanticDependencyKind, SourceMetadataOverrideError, type SyncRegistryOptions, TraceRecord, TraceRecordType, UnknownEventSourceError, UnregisteredIntentError, WorkflowEngine, WorkflowSnapshot, WorkflowStore, analyzeArchitectureConvergence, analyzeChange, analyzePolicyDelta, analyzeProject, analyzeResolvedProject, architecturalPolicies, buildPublishPolicyContext, catalogFixForRuleId, catalogWhyForRuleId, checkAdapterGovernance, checkContract, classifyArkPolicyDelta, collectAnalysisConfigWarnings, collectForbiddenCapabilityUses, compareInformationPackages, createAICodeGate, createAdapter, createAdapterResult, createArchitectureProfile, createArchitectureProfileFromArkConfig, createArkKernel, createArkKernelFromConfig, createArkManifest, createArkTestHarness, createAuditTrail, createDependencyGraph, createElevenLayerArkConfig, createEventBus, createEventContractRegistry, createIntentRegistry, createLenientArkKernel, createLenientArkKernelFromConfig, createMetadataRegistry, createObservabilityReporter, createProjectionRegistry, createResolvedCandidateFacts, createSaga, createStrictArkKernel, createStrictArkKernelFromConfig, createWorkflowEngine, defaultIntentRegistry, defineArchitectureProfilePolicy, defineIntent, defineLayerPolicy, definePolicy, definePort, definePublishPolicy, detectArchitectureCycles, deterministicHash, diagnosticDocsFragment, diagnosticDocsPath, elevenLayerProfile, evaluateArchitectureGraph, explainViolation, extractSemanticDependencies, getDiagnosticCatalogEntry, isCataloguedOrArkRuleFamily, isKnownDiagnosticCode, isLayerPolicy, loadContract, loadResolvedCandidateFacts, policyDeltaAcknowledgementMatches, preflightChange, preflightResolvedChange, replayInformationPackages, resolvedFactsEvidenceRequirementsHash, serializeDiagnosticCatalog, shadowInformationPackage, stableSerialize, syncRegistryToGraph, toAdapterDiagnostic, validateIntentName, version };