arkgate 4.8.23 → 4.8.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +153 -0
- package/README.md +7 -5
- package/bin/ark-check-runtime.mjs +41 -91
- package/bin/ark-dashboard.mjs +56 -53
- package/bin/ark-layer-match.mjs +707 -121
- package/bin/ark-mcp-runtime.mjs +448 -169
- package/bin/ark-mcp.mjs +68 -4
- package/bin/ark-shared.mjs +42 -22
- package/bin/ark.mjs +65 -97
- package/bin/lib/adapter-contract-types.mjs +5 -0
- package/bin/lib/adapter-contract.mjs +15 -0
- package/bin/lib/adoption-stance.mjs +2 -2
- package/bin/lib/adr-path.mjs +3 -3
- package/bin/lib/agent-gates.mjs +0 -61
- package/bin/lib/agent-homes.mjs +12 -21
- package/bin/lib/agent-projection-command.mjs +9 -5
- package/bin/lib/ambient-state.mjs +9 -30
- package/bin/lib/analysis-engine.mjs +15 -11
- package/bin/lib/architecture-scan.mjs +61 -15
- package/bin/lib/ark-order-doctor.mjs +4 -29
- package/bin/lib/ark-order-facts.mjs +319 -17
- package/bin/lib/ark-order-sensors.mjs +28 -101
- package/bin/lib/ark-order-types.mjs +3 -2
- package/bin/lib/ark-run-doctor.mjs +17 -28
- package/bin/lib/ark-run-facts.mjs +461 -48
- package/bin/lib/ark-run-sensors.mjs +6 -4
- package/bin/lib/arkgate-pins.mjs +91 -0
- package/bin/lib/arkrule-file-hints.mjs +2 -47
- package/bin/lib/arkrules-contract.mjs +124 -133
- package/bin/lib/arkrules-sensors.mjs +55 -252
- package/bin/lib/check-args.mjs +85 -1
- package/bin/lib/ci-and-commands.mjs +24 -78
- package/bin/lib/ci-merge-boundary.mjs +1 -1
- package/bin/lib/class-source-scan.mjs +479 -0
- package/bin/lib/clone-detection.mjs +474 -0
- package/bin/lib/codex-home.mjs +5 -3
- package/bin/lib/config-contract-slices.mjs +739 -0
- package/bin/lib/config-contract.mjs +42 -607
- package/bin/lib/config-extras.mjs +16 -22
- package/bin/lib/config-warnings.mjs +32 -0
- package/bin/lib/contract-smells.mjs +33 -15
- package/bin/lib/core-ratchet.mjs +0 -2
- package/bin/lib/dashboard-cli.mjs +62 -0
- package/bin/lib/deep-module-coach.mjs +2 -4
- package/bin/lib/deploy-path.mjs +13 -38
- package/bin/lib/design-delta.mjs +1 -1
- package/bin/lib/design-smells.mjs +2 -2
- package/bin/lib/diagnostic-catalog.mjs +23 -9
- package/bin/lib/doctor-advisories.mjs +78 -8
- package/bin/lib/doctor-green-cite.mjs +1 -1
- package/bin/lib/doctor-human.mjs +1 -1
- package/bin/lib/doctor-next-actions.mjs +19 -4
- package/bin/lib/doctor-plan.mjs +9 -13
- package/bin/lib/duplication-io.mjs +572 -0
- package/bin/lib/effective-contract-load.mjs +282 -83
- package/bin/lib/enforcement-profiles.mjs +40 -4
- package/bin/lib/entry-points-io.mjs +424 -0
- package/bin/lib/extra-merge-teeth.mjs +36 -0
- package/bin/lib/field-install.mjs +38 -14
- package/bin/lib/first-run-help.mjs +10 -5
- package/bin/lib/flat-parent-importers.mjs +139 -0
- package/bin/lib/flat-parent-pilot.mjs +40 -100
- package/bin/lib/gate-files.mjs +58 -90
- package/bin/lib/git-change-scope.mjs +109 -0
- package/bin/lib/github-enforcement.mjs +166 -29
- package/bin/lib/golden-pattern.mjs +1 -1
- package/bin/lib/hook-templates.mjs +17 -15
- package/bin/lib/host-support-matrix.mjs +3 -1
- package/bin/lib/html-report-advisories.mjs +4 -0
- package/bin/lib/html-report-depth.mjs +2 -2
- package/bin/lib/html-report.mjs +2 -2
- package/bin/lib/import-graph-projection.mjs +112 -0
- package/bin/lib/import-resolve.mjs +13 -1
- package/bin/lib/improvement-compass-doctor.mjs +1 -24
- package/bin/lib/install-migrate.mjs +50 -73
- package/bin/lib/invariant-coverage-io.mjs +4 -3
- package/bin/lib/invariant-coverage.mjs +85 -11
- package/bin/lib/invariant-probe-cli.mjs +347 -0
- package/bin/lib/invariant-probe-io.mjs +165 -0
- package/bin/lib/invariant-probe-runner.mjs +268 -0
- package/bin/lib/invariant-probe-sites.mjs +174 -0
- package/bin/lib/invariant-probe-workspace.mjs +183 -0
- package/bin/lib/invariant-probe.mjs +461 -0
- package/bin/lib/invariant-tests-path.mjs +16 -22
- package/bin/lib/literal-path-drift.mjs +4 -2
- package/bin/lib/managed-upgrade.mjs +2 -8
- package/bin/lib/mcp-adoption.mjs +13 -6
- package/bin/lib/mcp-hook-payload.mjs +403 -63
- package/bin/lib/orphan-modules-io.mjs +458 -0
- package/bin/lib/orphan-modules.mjs +251 -0
- package/bin/lib/outside-importers.mjs +197 -0
- package/bin/lib/package-manager.mjs +60 -2
- package/bin/lib/parse-health.mjs +1 -1
- package/bin/lib/passthrough-commands.mjs +83 -0
- package/bin/lib/persistence-write-hint.mjs +106 -0
- package/bin/lib/pin-dependent-gates.mjs +117 -0
- package/bin/lib/policy-delta-io.mjs +219 -14
- package/bin/lib/post-green-path.mjs +1 -1
- package/bin/lib/prepare-change.mjs +115 -7
- package/bin/lib/prepare-write.mjs +2 -2
- package/bin/lib/presets.mjs +59 -73
- package/bin/lib/product-copy.mjs +1 -6
- package/bin/lib/project-root.mjs +31 -62
- package/bin/lib/remediation.mjs +23 -4
- package/bin/lib/resolved-candidate-facts.mjs +405 -117
- package/bin/lib/rules-inventory.mjs +22 -3
- package/bin/lib/rules-under-contract.mjs +247 -9
- package/bin/lib/scan-files.mjs +36 -4
- package/bin/lib/schema-validation.mjs +130 -0
- package/bin/lib/sensor-promote-cli.mjs +2 -11
- package/bin/lib/sensor-promote-io.mjs +33 -22
- package/bin/lib/sensor-promotion.mjs +1 -1
- package/bin/lib/skill-catalog-apply.mjs +1 -1
- package/bin/lib/skill-install.mjs +42 -38
- package/bin/lib/snippet-analysis.mjs +140 -6
- package/bin/lib/source-policy.mjs +34 -0
- package/bin/lib/start-install-recovery.mjs +72 -2
- package/bin/lib/start-preview.mjs +31 -1
- package/bin/lib/states-transitions-presence.mjs +3 -3
- package/bin/lib/status-command.mjs +35 -22
- package/bin/lib/status-manifest.mjs +50 -30
- package/bin/lib/status-transition-catalog.mjs +0 -6
- package/bin/lib/suggestions.mjs +3 -3
- package/bin/lib/team-parliament-io.mjs +76 -88
- package/bin/lib/team-parliament.mjs +21 -10
- package/bin/lib/upgrade-behavior-changes.mjs +2 -2
- package/bin/lib/upgrade-command.mjs +2 -24
- package/bin/lib/upgrade-outcome.mjs +1 -1
- package/bin/lib/upstream-report.mjs +21 -10
- package/bin/lib/violations.mjs +10 -9
- package/bin/lib/weakest-link.mjs +13 -0
- package/bin/lib/write-path-capabilities.mjs +6 -4
- package/dist/chunk-A5EIY3HI.cjs +5 -0
- package/dist/chunk-AHACEKSV.js +16 -0
- package/dist/chunk-SVSQVGFJ.js +5 -0
- package/dist/chunk-UN5EH4QV.cjs +16 -0
- package/dist/{configTypes-Bbf_MFGe.d.ts → configTypes-GPvvdleM.d.cts} +30 -4
- package/dist/configTypes-GPvvdleM.d.ts +257 -0
- package/dist/eslint/index.cjs +18 -5
- package/dist/eslint/index.d.cts +368 -0
- package/dist/eslint/index.d.ts +139 -156
- package/dist/eslint/index.js +11 -5
- package/dist/index.cjs +36 -35
- package/dist/index.d.cts +5547 -0
- package/dist/index.d.ts +3283 -198
- package/dist/index.js +36 -35
- package/dist/inspectorListen-6DQVJ4DC.js +1 -0
- package/dist/inspectorListen-KGMIQ2TF.cjs +1 -0
- package/dist/nestjs/index.cjs +1 -18
- package/dist/nestjs/index.d.cts +22 -0
- package/dist/nestjs/index.d.ts +1 -3
- package/dist/nestjs/index.js +1 -18
- package/dist/order/index.cjs +1 -1
- package/dist/order/index.d.cts +155 -0
- package/dist/order/index.d.ts +15 -3
- package/dist/order/index.js +1 -1
- package/dist/runtime/index.cjs +13 -30
- package/dist/{diagnosticCatalog-35mrwAHe.d.ts → runtime/index.d.cts} +828 -276
- package/dist/runtime/index.d.ts +2741 -133
- package/dist/runtime/index.js +13 -30
- package/dist/{types-Bdj32QwA.d.ts → types-CnauMQQL.d.cts} +607 -163
- package/dist/types-CnauMQQL.d.ts +1800 -0
- package/docs/README.md +3 -1
- package/docs/agent-guide.md +217 -16
- package/docs/ai-gates.md +174 -26
- package/docs/arkorder.md +32 -15
- package/docs/brownfield-adoption.md +5 -1
- package/docs/configuration.md +230 -31
- package/docs/develop.md +2 -1
- package/docs/diagnostics.md +212 -19
- package/docs/package-surface.md +35 -9
- package/docs/product-voice.md +7 -1
- package/package.json +69 -19
- package/schemas/ark.analysis-result.schema.json +15 -0
- package/schemas/ark.config.schema.json +77 -12
- package/schemas/ark.invariant-probe.schema.json +368 -0
- package/schemas/ark.resolved-candidate-facts.schema.json +1 -1
- package/schemas/ark.status-manifest.schema.json +22 -0
- package/server.json +3 -9
- package/templates/agent-skills/README.md +1 -1
- package/templates/agent-skills/ark-adopt/SKILL.md +5 -1
- package/templates/agent-skills/ark-contract/SKILL.md +17 -0
- package/templates/agent-skills/ark-coverage/SKILL.md +2 -0
- package/templates/agent-skills/ark-explore/SKILL.md +7 -0
- package/templates/agent-skills/ark-fix/SKILL.md +20 -0
- package/templates/agent-skills/ark-order/SKILL.md +4 -2
- package/templates/agent-skills/ark-place/SKILL.md +8 -0
- package/templates/agent-skills/ark-runtime/SKILL.md +6 -1
- package/templates/arkrules/PersistenceAdapters.json +1 -1
- package/templates/arkrules/PresentationAdapters.json +1 -1
- package/templates/skills/ark-adopt.md +5 -1
- package/templates/skills/ark-contract.md +17 -0
- package/templates/skills/ark-coverage.md +2 -0
- package/templates/skills/ark-explore.md +7 -0
- package/templates/skills/ark-fix.md +20 -0
- package/templates/skills/ark-order.md +4 -2
- package/templates/skills/ark-place.md +8 -0
- package/templates/skills/ark-runtime.md +6 -1
- package/bin/lib/ark-order-error.mjs +0 -18
- package/bin/lib/ark-order-invariants.mjs +0 -346
- package/dist/types-Ik_OakcI.d.ts +0 -183
|
@@ -1,5 +1,453 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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 ArkConfig, V as ArkConfigLoadResult, X as DependencyInformationPackage, C as CreateArkKernelOptions, A as ArkKernel, Y as ArkKernelConfig, Z as CreateArkKernelFromConfigOptions, _ as TraceRecordType, $ as TraceRecord, a0 as OutboxStatus, a1 as OutboxRecord, a2 as ObservabilityDriftReport } from '../types-CnauMQQL.cjs';
|
|
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-CnauMQQL.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
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`).
|
|
8
|
+
*/
|
|
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;
|
|
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;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* DependencyGraph implementation.
|
|
30
|
+
*
|
|
31
|
+
* Collects declared and observed relationships.
|
|
32
|
+
* Generates Mermaid diagrams and JSON.
|
|
33
|
+
* Supports simple violation detection via rule functions.
|
|
34
|
+
*/
|
|
35
|
+
|
|
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;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Sync declared intent relationships from a registry into a dependency graph.
|
|
48
|
+
*
|
|
49
|
+
* - `dependsOn` → `declared` edges
|
|
50
|
+
* - `produces` → `produces` edges
|
|
51
|
+
*/
|
|
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;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* defineIntent
|
|
67
|
+
*
|
|
68
|
+
* The primary ergonomic function for declaring semantic intents.
|
|
69
|
+
*
|
|
70
|
+
* Uses a default shared registry for convenience, while still allowing
|
|
71
|
+
* isolated registries via `createIntentRegistry()`.
|
|
72
|
+
*
|
|
73
|
+
* Intents are the core of Ark's governance model. They give every
|
|
74
|
+
* architectural concept (domain events, use cases, adapter operations, workflows)
|
|
75
|
+
* an explicit, namespaced, machine-readable identity.
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Define a new semantic intent.
|
|
80
|
+
*
|
|
81
|
+
* This is the main entry point most users (and AI generators) will use.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* // Domain event
|
|
86
|
+
* const OrderPlaced = defineIntent<'Domain.Order.OrderPlaced', {
|
|
87
|
+
* orderId: string;
|
|
88
|
+
* amount: number;
|
|
89
|
+
* }>('Domain.Order.OrderPlaced');
|
|
90
|
+
*
|
|
91
|
+
* const event = OrderPlaced({ orderId: 'o-42', amount: 99.5 });
|
|
92
|
+
*
|
|
93
|
+
* // Application operation that declares a dependency at definition time
|
|
94
|
+
* const ConfirmOrder = defineIntent<'Application.ConfirmOrder', { orderId: string }>(
|
|
95
|
+
* 'Application.ConfirmOrder',
|
|
96
|
+
* { dependsOn: ['Domain.Order.OrderPlaced'] }
|
|
97
|
+
* );
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @param name - Unique semantic name. Recommended convention:
|
|
101
|
+
* - `Domain.*` for domain concepts and events
|
|
102
|
+
* - `Application.*` for use cases / orchestration
|
|
103
|
+
* - `Adapter.*` for external integrations
|
|
104
|
+
* - `Workflow.*` for sagas and long-running processes
|
|
105
|
+
* @param options - Optional initial relationship declarations (`dependsOn`, `produces`)
|
|
106
|
+
*/
|
|
107
|
+
declare function defineIntent<N extends IntentName, P = unknown>(name: N, options?: DefineIntentOptions): IntentCreator<N, P>;
|
|
108
|
+
/**
|
|
109
|
+
* Create an isolated IntentRegistry.
|
|
110
|
+
* Useful for testing, multiple bounded contexts, or advanced governance setups.
|
|
111
|
+
*/
|
|
112
|
+
declare function createIntentRegistry(): IntentRegistry;
|
|
113
|
+
/**
|
|
114
|
+
* The default registry backing the top-level `defineIntent` calls.
|
|
115
|
+
* You can inspect it or use it directly if needed.
|
|
116
|
+
*/
|
|
117
|
+
declare const defaultIntentRegistry: IntentRegistry;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Runtime validation for semantic intent naming conventions.
|
|
121
|
+
*/
|
|
122
|
+
interface IntentNameValidation {
|
|
123
|
+
valid: boolean;
|
|
124
|
+
reason?: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Validate that an intent name follows Ark naming conventions.
|
|
128
|
+
*/
|
|
129
|
+
declare function validateIntentName(name: string): IntentNameValidation;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Basic MetadataRegistry implementation.
|
|
133
|
+
*/
|
|
134
|
+
|
|
135
|
+
declare function createMetadataRegistry(): MetadataRegistry;
|
|
136
|
+
|
|
137
|
+
/**
|
|
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.
|
|
151
|
+
*/
|
|
152
|
+
|
|
153
|
+
declare class PolicyViolationError extends Error {
|
|
154
|
+
readonly violations: PolicyViolation[];
|
|
155
|
+
constructor(violations: PolicyViolation[]);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* definePolicy
|
|
160
|
+
*
|
|
161
|
+
* Factory function to create architectural policies in a declarative way.
|
|
162
|
+
*/
|
|
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>;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Built-in architectural policy helpers.
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
interface LayerFlowRule {
|
|
203
|
+
from: string;
|
|
204
|
+
to: string;
|
|
205
|
+
allowed: boolean;
|
|
206
|
+
message?: string;
|
|
207
|
+
}
|
|
208
|
+
interface LayerPolicyOptions {
|
|
209
|
+
name?: string;
|
|
210
|
+
severity?: 'hard' | 'soft';
|
|
211
|
+
/** Prefix rules — e.g. { from: 'Domain', to: 'Adapter', allowed: false } */
|
|
212
|
+
rules: LayerFlowRule[];
|
|
213
|
+
resolveLayer?: (name: string) => string | undefined;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Create a policy that enforces layer-crossing rules on graph edges or intent relationships.
|
|
217
|
+
*/
|
|
218
|
+
declare function defineLayerPolicy<Context extends {
|
|
219
|
+
edges?: GraphEdge[];
|
|
220
|
+
relationships?: IntentRelationship[];
|
|
221
|
+
}>(options: LayerPolicyOptions): Policy<Context>;
|
|
222
|
+
/** True when a policy requires graph/registry context to enforce layer rules. */
|
|
223
|
+
declare function isLayerPolicy(policy: Policy): boolean;
|
|
224
|
+
/** Preset architectural policy factories. */
|
|
225
|
+
declare const architecturalPolicies: {
|
|
226
|
+
/**
|
|
227
|
+
* @deprecated Use cleanArchitectureMatrix() for full layer rules.
|
|
228
|
+
* Blocks Domain → Adapter declared dependencies only.
|
|
229
|
+
*/
|
|
230
|
+
layerIsolation(): Policy<{
|
|
231
|
+
edges?: GraphEdge[];
|
|
232
|
+
relationships?: IntentRelationship[];
|
|
233
|
+
}>;
|
|
234
|
+
/**
|
|
235
|
+
* Clean-architecture dependency matrix (declared dependsOn / declared edges only).
|
|
236
|
+
* Does not block observed event flows (Domain events consumed by Application).
|
|
237
|
+
*/
|
|
238
|
+
cleanArchitectureMatrix(): Policy<{
|
|
239
|
+
edges?: GraphEdge[];
|
|
240
|
+
relationships?: IntentRelationship[];
|
|
241
|
+
}>;
|
|
242
|
+
};
|
|
243
|
+
declare function defineArchitectureProfilePolicy<Context extends {
|
|
244
|
+
edges?: GraphEdge[];
|
|
245
|
+
relationships?: IntentRelationship[];
|
|
246
|
+
}>(profile: ArchitectureProfile, options?: Omit<LayerPolicyOptions, 'rules' | 'resolveLayer'>): Policy<Context>;
|
|
247
|
+
|
|
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;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Reference in-process event buffer. **Not production durability** — state is lost on
|
|
262
|
+
* process exit. Use only for tests/demos/local single-process work; inject a durable
|
|
263
|
+
* store for production. This is not an atomic outbox (see `docs/production-hardening.md`).
|
|
264
|
+
*/
|
|
265
|
+
declare class InMemoryEventBuffer implements EventBufferStore {
|
|
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;
|
|
287
|
+
enqueue(event: DomainEvent): Promise<EventBufferRecord>;
|
|
288
|
+
markDispatched(id: string): Promise<void>;
|
|
289
|
+
markFailed(id: string, error: unknown): Promise<void>;
|
|
290
|
+
list(status?: EventBufferStatus): Promise<EventBufferRecord[]>;
|
|
291
|
+
clear(): Promise<void>;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* @deprecated Use InMemoryEventBuffer.
|
|
295
|
+
* @alias Kept as a public alias of `arkgate/runtime` until its removal.
|
|
296
|
+
*/
|
|
297
|
+
declare const InMemoryOutboxStore: typeof InMemoryEventBuffer;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* EventBus implementation — public surface + publish orchestration.
|
|
301
|
+
*
|
|
302
|
+
* Publish pipeline stages live in cohesive modules (R8):
|
|
303
|
+
* guards → interceptors → contract re-check → observed layer flow →
|
|
304
|
+
* policy → history/outbox/trace → handlers → onPublish hook
|
|
305
|
+
*/
|
|
306
|
+
|
|
307
|
+
declare function createEventBus<Context = unknown>(options?: EventBusOptions<Context>): EventBus;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Helpers for building policy evaluation context on event publish.
|
|
311
|
+
*/
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Standard context for policies evaluated during event publish.
|
|
315
|
+
* Includes the event plus optional registry relationships and graph edges
|
|
316
|
+
* so layer policies (e.g. architecturalPolicies.layerIsolation) can run.
|
|
317
|
+
*/
|
|
318
|
+
interface PublishPolicyContext {
|
|
319
|
+
event: DomainEvent;
|
|
320
|
+
relationships?: IntentRelationship[];
|
|
321
|
+
edges?: GraphEdge[];
|
|
322
|
+
}
|
|
323
|
+
interface GraphPolicyContext {
|
|
324
|
+
relationships?: IntentRelationship[];
|
|
325
|
+
edges?: GraphEdge[];
|
|
326
|
+
}
|
|
327
|
+
interface BuildPublishPolicyContextOptions {
|
|
328
|
+
intentRegistry?: IntentRegistry;
|
|
329
|
+
dependencyGraph?: DependencyGraph;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Build a getPolicyContext function that feeds registry + graph data to policies.
|
|
333
|
+
*
|
|
334
|
+
* @example
|
|
335
|
+
* ```ts
|
|
336
|
+
* const bus = createEventBus({
|
|
337
|
+
* intentRegistry: registry,
|
|
338
|
+
* dependencyGraph: graph,
|
|
339
|
+
* policies: [architecturalPolicies.layerIsolation()],
|
|
340
|
+
* });
|
|
341
|
+
* ```
|
|
342
|
+
*/
|
|
343
|
+
declare function buildPublishPolicyContext(options: BuildPublishPolicyContextOptions): (event: DomainEvent) => PublishPolicyContext;
|
|
344
|
+
declare function definePublishPolicy(options: DefinePolicyOptions<PublishPolicyContext>): Policy<PublishPolicyContext>;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Event bus governance errors.
|
|
348
|
+
*/
|
|
349
|
+
declare class UnregisteredIntentError extends Error {
|
|
350
|
+
readonly intentName: string;
|
|
351
|
+
constructor(intentName: string);
|
|
352
|
+
}
|
|
353
|
+
declare class InvalidIntentNameError extends Error {
|
|
354
|
+
readonly intentName: string;
|
|
355
|
+
readonly reason: string;
|
|
356
|
+
constructor(intentName: string, reason: string);
|
|
357
|
+
}
|
|
358
|
+
declare class LayerPolicyContextError extends Error {
|
|
359
|
+
constructor();
|
|
360
|
+
}
|
|
361
|
+
declare class EventContractViolationError extends Error {
|
|
362
|
+
readonly intentName: string;
|
|
363
|
+
readonly issues: unknown[];
|
|
364
|
+
constructor(intentName: string, issues: unknown[]);
|
|
365
|
+
}
|
|
366
|
+
declare class UnknownEventSourceError extends Error {
|
|
367
|
+
readonly intentName: string;
|
|
368
|
+
readonly source?: string;
|
|
369
|
+
constructor(intentName: string, source?: string);
|
|
370
|
+
}
|
|
371
|
+
declare class SourceMetadataOverrideError extends Error {
|
|
372
|
+
readonly boundSource: string;
|
|
373
|
+
readonly attemptedSource: string;
|
|
374
|
+
constructor(boundSource: string, attemptedSource: string);
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Thrown when the OBSERVED producer→event flow crosses a forbidden layer boundary
|
|
378
|
+
* under `enforceObservedLayerFlow: 'hard'`. Unlike declared-model policy errors, this
|
|
379
|
+
* reflects what the running system actually did at publish time.
|
|
380
|
+
*/
|
|
381
|
+
declare class ObservedLayerFlowViolationError extends Error {
|
|
382
|
+
readonly source: string;
|
|
383
|
+
readonly intentName: string;
|
|
384
|
+
readonly fromLayer: string;
|
|
385
|
+
readonly toLayer: string;
|
|
386
|
+
constructor(source: string, intentName: string, fromLayer: string, toLayer: string, message?: string);
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* A kernel built from an `ark.config.json` was explicitly asked for hard
|
|
390
|
+
* observed-layer-flow enforcement (`enforceObservedLayerFlow: 'hard'`), but some
|
|
391
|
+
* deny-rule layers declare no `intentPrefixes` and are not canonical 11-layer
|
|
392
|
+
* names (which get built-in prefixes), so no intent maps to them and the rule
|
|
393
|
+
* would be a silent no-op. With the strict default (hard implied, not passed),
|
|
394
|
+
* the kernel builds and records a `layer.observedFlowUnresolvable` audit record
|
|
395
|
+
* instead. Fix: add `intentPrefixes`, or pass `'soft' | 'off'`.
|
|
396
|
+
*/
|
|
397
|
+
declare class ArkKernelConfigError extends Error {
|
|
398
|
+
readonly code: 'ARKRUN_LAYER_FLOW_UNRESOLVABLE';
|
|
399
|
+
readonly layers: string[];
|
|
400
|
+
constructor(layers: string[]);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
declare function createObservabilityReporter(options: CreateObservabilityReporterOptions): ObservabilityReporter;
|
|
404
|
+
|
|
405
|
+
/** Current Ark manifest JSON schema version. */
|
|
406
|
+
declare const MANIFEST_SCHEMA_VERSION = "1.0";
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Aggregates kernel registries into a single machine-readable manifest.
|
|
410
|
+
*/
|
|
411
|
+
|
|
412
|
+
interface CreateArkManifestOptions {
|
|
413
|
+
registry?: IntentRegistry;
|
|
414
|
+
policyEngine?: PolicyEngine;
|
|
415
|
+
metadata?: MetadataRegistry;
|
|
416
|
+
graph?: DependencyGraph;
|
|
417
|
+
profile?: ArchitectureProfile;
|
|
418
|
+
projections?: ProjectionRegistry;
|
|
419
|
+
eventContracts?: EventContractRegistry;
|
|
420
|
+
observability?: ObservabilityReporter;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Create a machine-readable snapshot of the current architectural contract.
|
|
424
|
+
* Intended for AI agents, codegen tools, and documentation generators.
|
|
425
|
+
*/
|
|
426
|
+
declare function createArkManifest(options?: CreateArkManifestOptions): ArkManifest;
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* In-process workflow engine with durable-store seams.
|
|
430
|
+
*/
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Reference in-process workflow store. **Not production durability.**
|
|
434
|
+
* See `docs/production-hardening.md`.
|
|
435
|
+
*/
|
|
436
|
+
declare class InMemoryWorkflowStore implements WorkflowStore {
|
|
437
|
+
private readonly snapshots;
|
|
438
|
+
save<P extends SagaContext>(snapshot: WorkflowSnapshot<P>, _tx?: unknown): void;
|
|
439
|
+
get<P extends SagaContext = SagaContext>(id: string, _tx?: unknown): WorkflowSnapshot<P> | undefined;
|
|
440
|
+
list(workflowName?: string): WorkflowSnapshot[];
|
|
441
|
+
claim(workerId: string, timeoutMs: number, workflowName?: string): WorkflowSnapshot | undefined;
|
|
442
|
+
clear(): void;
|
|
443
|
+
}
|
|
444
|
+
declare function createWorkflowEngine(bus: EventBus, options?: CreateWorkflowEngineOptions): WorkflowEngine;
|
|
445
|
+
declare function createSaga<P extends SagaContext = SagaContext>(def: SagaDefinition<P>, bus: EventBus, options?: CreateWorkflowEngineOptions & {
|
|
446
|
+
id?: string;
|
|
447
|
+
}): SagaInstance<P>;
|
|
448
|
+
|
|
449
|
+
/** ArkGate library version — single source of truth. */
|
|
450
|
+
declare const version = "4.8.25";
|
|
3
451
|
|
|
4
452
|
/** Versioned public result contract types + JSON Schema (adapter envelope). */
|
|
5
453
|
/**
|
|
@@ -8,8 +456,6 @@ import { A as ArkConfig, c as ArkConfigLoadResult } from './configTypes-Bbf_MFGe
|
|
|
8
456
|
* 1.4 added optional evidence.arkruleId + evidence.arkruleSource (ADR 0012 / AR03).
|
|
9
457
|
*/
|
|
10
458
|
declare const ARK_ANALYSIS_RESULT_SCHEMA_VERSION: "1.5";
|
|
11
|
-
/** Repo-relative diagnostics docs path (parity with ACS02 diagnostic catalog). */
|
|
12
|
-
declare const ADAPTER_DIAGNOSTIC_DOCS_RELATIVE_PATH: "docs/diagnostics.md";
|
|
13
459
|
type AdapterSeverity = 'error' | 'warning';
|
|
14
460
|
type AnalysisCompleteness = 'complete' | 'partial' | 'unavailable';
|
|
15
461
|
type AnalysisMode = 'lexical-compatibility' | 'resolved-candidate-facts';
|
|
@@ -77,6 +523,12 @@ type AdapterDiagnostic = {
|
|
|
77
523
|
arkruleId?: string;
|
|
78
524
|
/** AR03 — ArkRules source file path. */
|
|
79
525
|
arkruleSource?: string;
|
|
526
|
+
/** Nested-wall reason. Not part of the baseline key. */
|
|
527
|
+
reasonId?: 'CROSS_PARENT_SLICE' | 'CROSS_SIBLING_SLICE' | 'CROSS_PARENT_VIA_SHARED';
|
|
528
|
+
/** Last segment of the importer universe id, with a reasonId. */
|
|
529
|
+
universeFrom?: string;
|
|
530
|
+
/** Last segment of the importee universe id, with a reasonId. */
|
|
531
|
+
universeTo?: string;
|
|
80
532
|
};
|
|
81
533
|
/** Added in schema 1.1; optional in TypeScript so 1.0 consumer-owned values remain valid. */
|
|
82
534
|
nextAction?: string;
|
|
@@ -347,6 +799,17 @@ declare const ARK_ANALYSIS_RESULT_SCHEMA: {
|
|
|
347
799
|
readonly type: "string";
|
|
348
800
|
readonly minLength: 1;
|
|
349
801
|
};
|
|
802
|
+
readonly reasonId: {
|
|
803
|
+
readonly enum: readonly ["CROSS_PARENT_SLICE", "CROSS_SIBLING_SLICE", "CROSS_PARENT_VIA_SHARED"];
|
|
804
|
+
};
|
|
805
|
+
readonly universeFrom: {
|
|
806
|
+
readonly type: "string";
|
|
807
|
+
readonly minLength: 1;
|
|
808
|
+
};
|
|
809
|
+
readonly universeTo: {
|
|
810
|
+
readonly type: "string";
|
|
811
|
+
readonly minLength: 1;
|
|
812
|
+
};
|
|
350
813
|
};
|
|
351
814
|
};
|
|
352
815
|
readonly nextAction: {
|
|
@@ -397,9 +860,6 @@ declare function createAdapterResult(input: {
|
|
|
397
860
|
warnings?: readonly AdapterViolationInput[];
|
|
398
861
|
}): CurrentAdapterResult;
|
|
399
862
|
|
|
400
|
-
/** ArkGate library version — single source of truth. */
|
|
401
|
-
declare const version = "4.8.23";
|
|
402
|
-
|
|
403
863
|
/**
|
|
404
864
|
* AI Code Gate (basic).
|
|
405
865
|
*
|
|
@@ -420,6 +880,12 @@ interface AICodeGateViolation {
|
|
|
420
880
|
toLayer?: string;
|
|
421
881
|
/** Nested-wall reason. Absent on a classic layer deny and on a child-only parent import. */
|
|
422
882
|
reasonId?: string;
|
|
883
|
+
/** Last segment of the importer universe id, with a reasonId. */
|
|
884
|
+
universeFrom?: string;
|
|
885
|
+
/** Last segment of the importee universe id, with a reasonId. */
|
|
886
|
+
universeTo?: string;
|
|
887
|
+
/** True when a peerIsolation rule produced this finding (also mirrored in details). */
|
|
888
|
+
peerIsolation?: boolean;
|
|
423
889
|
/** False for an advisory sibling crossing. Omitted findings still block the snippet. */
|
|
424
890
|
failsStrict?: boolean;
|
|
425
891
|
details?: unknown;
|
|
@@ -451,11 +917,6 @@ interface AICodeGate<Context = AICodeGateContext> {
|
|
|
451
917
|
validate(source: string, context?: Context): AICodeGateResult;
|
|
452
918
|
}
|
|
453
919
|
|
|
454
|
-
declare function createArchitectureProfile(options: CreateArchitectureProfileOptions): ArchitectureProfile;
|
|
455
|
-
declare function createArchitectureProfileFromArkConfig(config: ArkCheckConfig, options?: CreateArchitectureProfileFromArkConfigOptions): ArchitectureProfile;
|
|
456
|
-
declare const elevenLayerProfile: ArchitectureProfile;
|
|
457
|
-
declare function createElevenLayerArkConfig(options?: CreateElevenLayerArkConfigOptions): ArkCheckConfig;
|
|
458
|
-
|
|
459
920
|
/**
|
|
460
921
|
* Basic AI Code Gate implementation.
|
|
461
922
|
*
|
|
@@ -551,6 +1012,10 @@ declare function deterministicHash(value: string): string;
|
|
|
551
1012
|
/** Serialize JSON-like values with sorted object keys for reproducible hashes. */
|
|
552
1013
|
declare function stableSerialize(value: unknown): string;
|
|
553
1014
|
|
|
1015
|
+
/**
|
|
1016
|
+
* ArkOrder resolver-fact extraction (ADR 0029). Syntax only — no verdicts.
|
|
1017
|
+
*/
|
|
1018
|
+
|
|
554
1019
|
type ResolvedArkOrderPlaneCallFact = {
|
|
555
1020
|
file: string;
|
|
556
1021
|
line: number;
|
|
@@ -580,6 +1045,18 @@ type ResolvedArkOrderReleaseKeyCountFact = {
|
|
|
580
1045
|
line: number;
|
|
581
1046
|
keyCount: number;
|
|
582
1047
|
};
|
|
1048
|
+
/** A freshness key (ttl/freshUntil/maxAge) inside the ξ literal of plane.release / proposeRelease. */
|
|
1049
|
+
type ResolvedArkOrderXiTtlFact = {
|
|
1050
|
+
file: string;
|
|
1051
|
+
line: number;
|
|
1052
|
+
key: string;
|
|
1053
|
+
};
|
|
1054
|
+
/** A literal `allowedKinds` entry that a literal `informationBudget.cannotObserve` denies. */
|
|
1055
|
+
type ResolvedArkOrderBudgetLeakFact = {
|
|
1056
|
+
file: string;
|
|
1057
|
+
line: number;
|
|
1058
|
+
kind: string;
|
|
1059
|
+
};
|
|
583
1060
|
|
|
584
1061
|
/**
|
|
585
1062
|
* Versioned type vocabulary for resolved candidate facts (schema 1.0).
|
|
@@ -655,6 +1132,8 @@ type ResolvedClassShapeFact = {
|
|
|
655
1132
|
referencesGuardOrPublish: boolean;
|
|
656
1133
|
}[];
|
|
657
1134
|
dataOnly?: boolean;
|
|
1135
|
+
/** Source offset where the class-shape scan stopped (unwalkable body/header). */
|
|
1136
|
+
truncatedUntil?: number;
|
|
658
1137
|
};
|
|
659
1138
|
type ResolvedDependencyFact = {
|
|
660
1139
|
from: string;
|
|
@@ -734,8 +1213,10 @@ type ResolvedCandidateFactsInput = {
|
|
|
734
1213
|
arkOrderXiFieldWrites?: readonly ResolvedArkOrderXiFieldWriteFact[];
|
|
735
1214
|
arkOrderIngestWritesXi?: readonly ResolvedArkOrderIngestWriteFact[];
|
|
736
1215
|
arkOrderReleaseKeyCounts?: readonly ResolvedArkOrderReleaseKeyCountFact[];
|
|
1216
|
+
arkOrderXiTtlKeys?: readonly ResolvedArkOrderXiTtlFact[];
|
|
1217
|
+
arkOrderBudgetLeaks?: readonly ResolvedArkOrderBudgetLeakFact[];
|
|
737
1218
|
};
|
|
738
|
-
type ResolvedCandidateFacts = Omit<ResolvedCandidateFactsInput, 'candidateTreeHash' | 'classShapes' | 'arkRunKernelCalls' | 'arkOrderPlaneCalls' | 'arkOrderGenericUpdates' | 'arkOrderXiFieldWrites' | 'arkOrderIngestWritesXi' | 'arkOrderReleaseKeyCounts' | 'arkOrderRootHits' | 'arkRunManagedNews' | 'arkRunCompositionRootHits' | 'arkRunDeclarations'> & {
|
|
1219
|
+
type ResolvedCandidateFacts = Omit<ResolvedCandidateFactsInput, 'candidateTreeHash' | 'classShapes' | 'arkRunKernelCalls' | 'arkOrderPlaneCalls' | 'arkOrderGenericUpdates' | 'arkOrderXiFieldWrites' | 'arkOrderIngestWritesXi' | 'arkOrderReleaseKeyCounts' | 'arkOrderXiTtlKeys' | 'arkOrderBudgetLeaks' | 'arkOrderRootHits' | 'arkRunManagedNews' | 'arkRunCompositionRootHits' | 'arkRunDeclarations'> & {
|
|
739
1220
|
schemaVersion: typeof RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION;
|
|
740
1221
|
completenessReasons: ResolvedFactsReason[];
|
|
741
1222
|
candidateTreeHash: string;
|
|
@@ -757,6 +1238,8 @@ type ResolvedCandidateFacts = Omit<ResolvedCandidateFactsInput, 'candidateTreeHa
|
|
|
757
1238
|
arkOrderXiFieldWrites: ResolvedArkOrderXiFieldWriteFact[];
|
|
758
1239
|
arkOrderIngestWritesXi: ResolvedArkOrderIngestWriteFact[];
|
|
759
1240
|
arkOrderReleaseKeyCounts: ResolvedArkOrderReleaseKeyCountFact[];
|
|
1241
|
+
arkOrderXiTtlKeys: ResolvedArkOrderXiTtlFact[];
|
|
1242
|
+
arkOrderBudgetLeaks: ResolvedArkOrderBudgetLeakFact[];
|
|
760
1243
|
factsHash: string;
|
|
761
1244
|
};
|
|
762
1245
|
|
|
@@ -1180,6 +1663,10 @@ declare const RESOLVED_CANDIDATE_FACTS_SCHEMA: {
|
|
|
1180
1663
|
readonly dataOnly: {
|
|
1181
1664
|
readonly type: "boolean";
|
|
1182
1665
|
};
|
|
1666
|
+
readonly truncatedUntil: {
|
|
1667
|
+
readonly type: "integer";
|
|
1668
|
+
readonly minimum: 0;
|
|
1669
|
+
};
|
|
1183
1670
|
readonly mutatingMethods: {
|
|
1184
1671
|
readonly type: "array";
|
|
1185
1672
|
readonly items: {
|
|
@@ -1466,6 +1953,52 @@ declare const RESOLVED_CANDIDATE_FACTS_SCHEMA: {
|
|
|
1466
1953
|
};
|
|
1467
1954
|
};
|
|
1468
1955
|
};
|
|
1956
|
+
readonly arkOrderXiTtlKeys: {
|
|
1957
|
+
readonly type: "array";
|
|
1958
|
+
readonly items: {
|
|
1959
|
+
readonly type: "object";
|
|
1960
|
+
readonly additionalProperties: false;
|
|
1961
|
+
readonly required: readonly ["file", "line", "key"];
|
|
1962
|
+
readonly properties: {
|
|
1963
|
+
readonly file: {
|
|
1964
|
+
readonly type: "string";
|
|
1965
|
+
readonly minLength: 1;
|
|
1966
|
+
readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
|
|
1967
|
+
};
|
|
1968
|
+
readonly line: {
|
|
1969
|
+
readonly type: "integer";
|
|
1970
|
+
readonly minimum: 1;
|
|
1971
|
+
};
|
|
1972
|
+
readonly key: {
|
|
1973
|
+
readonly type: "string";
|
|
1974
|
+
readonly minLength: 1;
|
|
1975
|
+
};
|
|
1976
|
+
};
|
|
1977
|
+
};
|
|
1978
|
+
};
|
|
1979
|
+
readonly arkOrderBudgetLeaks: {
|
|
1980
|
+
readonly type: "array";
|
|
1981
|
+
readonly items: {
|
|
1982
|
+
readonly type: "object";
|
|
1983
|
+
readonly additionalProperties: false;
|
|
1984
|
+
readonly required: readonly ["file", "line", "kind"];
|
|
1985
|
+
readonly properties: {
|
|
1986
|
+
readonly file: {
|
|
1987
|
+
readonly type: "string";
|
|
1988
|
+
readonly minLength: 1;
|
|
1989
|
+
readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
|
|
1990
|
+
};
|
|
1991
|
+
readonly line: {
|
|
1992
|
+
readonly type: "integer";
|
|
1993
|
+
readonly minimum: 1;
|
|
1994
|
+
};
|
|
1995
|
+
readonly kind: {
|
|
1996
|
+
readonly type: "string";
|
|
1997
|
+
readonly minLength: 1;
|
|
1998
|
+
};
|
|
1999
|
+
};
|
|
2000
|
+
};
|
|
2001
|
+
};
|
|
1469
2002
|
readonly factsHash: {
|
|
1470
2003
|
readonly type: "string";
|
|
1471
2004
|
readonly minLength: 1;
|
|
@@ -1698,17 +2231,12 @@ type ArkRuleInvariantEntry = {
|
|
|
1698
2231
|
mode?: ArkRuleMode;
|
|
1699
2232
|
appliesTo?: string[];
|
|
1700
2233
|
};
|
|
1701
|
-
type ArkRulesFile = {
|
|
1702
|
-
$schema?: string;
|
|
1703
|
-
schemaVersion: '1.0';
|
|
1704
|
-
layer: string;
|
|
1705
|
-
structure?: ArkRuleStructureEntry[];
|
|
1706
|
-
invariants?: ArkRuleInvariantEntry[];
|
|
1707
|
-
};
|
|
1708
2234
|
type ArkRuleProvenance = {
|
|
1709
2235
|
sourceFile: string;
|
|
1710
2236
|
ruleId: string;
|
|
1711
2237
|
layer: string;
|
|
2238
|
+
/** Set when the rule was read from a child-slice file. Absent on central files. */
|
|
2239
|
+
childId?: string;
|
|
1712
2240
|
};
|
|
1713
2241
|
type EffectiveStructureRule = ArkRuleStructureEntry & {
|
|
1714
2242
|
mode: ArkRuleMode;
|
|
@@ -1722,6 +2250,8 @@ type EffectiveArkRules = {
|
|
|
1722
2250
|
schemaVersion: '1.0';
|
|
1723
2251
|
byLayer: Record<string, {
|
|
1724
2252
|
sourceFile: string;
|
|
2253
|
+
/** Every file merged into this layer, central paths first. Absent on older catalogs. */
|
|
2254
|
+
sourceFiles?: string[];
|
|
1725
2255
|
structure: EffectiveStructureRule[];
|
|
1726
2256
|
invariants: EffectiveInvariantRule[];
|
|
1727
2257
|
}>;
|
|
@@ -1729,6 +2259,30 @@ type EffectiveArkRules = {
|
|
|
1729
2259
|
invariants: EffectiveInvariantRule[];
|
|
1730
2260
|
};
|
|
1731
2261
|
|
|
2262
|
+
/** Priority order: guard-family operators first, constants last. */
|
|
2263
|
+
declare const INVARIANT_PROBE_OPERATORS: readonly ["negate-guard", "drop-throw", "flip-comparison", "boundary-shift", "const-shift"];
|
|
2264
|
+
type ProbeOperator = (typeof INVARIANT_PROBE_OPERATORS)[number];
|
|
2265
|
+
declare const INVARIANT_PROBE_VERDICTS: readonly ["killed", "survived", "not-reached", "inconclusive", "unprobeable"];
|
|
2266
|
+
type ProbeVerdict = (typeof INVARIANT_PROBE_VERDICTS)[number];
|
|
2267
|
+
declare const INVARIANT_PROBE_REASONS: readonly ["all-killed", "mutant-survived", "reach-canary-survived", "baseline-red", "baseline-timeout", "runner-error", "file-not-loaded", "mutant-runtime-error", "no-symbol", "declaration-only", "symbol-not-found", "no-covering-test", "no-site"];
|
|
2268
|
+
type ProbeReason = (typeof INVARIANT_PROBE_REASONS)[number];
|
|
2269
|
+
/** What promotion and status read from one row. */
|
|
2270
|
+
type InvariantProbeSummary = {
|
|
2271
|
+
verdict: ProbeVerdict;
|
|
2272
|
+
reason: ProbeReason;
|
|
2273
|
+
/** False when a hashed input changed since the run; a stale row changes nothing. */
|
|
2274
|
+
fresh: boolean;
|
|
2275
|
+
survivors: Array<{
|
|
2276
|
+
operator: ProbeOperator;
|
|
2277
|
+
line: number;
|
|
2278
|
+
original: string;
|
|
2279
|
+
replacement: string;
|
|
2280
|
+
}>;
|
|
2281
|
+
staleBecause?: string[];
|
|
2282
|
+
symbolFile?: string;
|
|
2283
|
+
probedOn?: string;
|
|
2284
|
+
};
|
|
2285
|
+
|
|
1732
2286
|
/**
|
|
1733
2287
|
* Pure invariant coverage evidence (ADR 0014 / AR09–AR10).
|
|
1734
2288
|
*
|
|
@@ -1744,53 +2298,6 @@ type EffectiveArkRules = {
|
|
|
1744
2298
|
* method.
|
|
1745
2299
|
*/
|
|
1746
2300
|
type DeclarationShape = 'function' | 'class' | 'const' | 'method' | 'type' | 'interface' | 'enum';
|
|
1747
|
-
/** Where a bare mention of an id or symbol sat. Never coverage. */
|
|
1748
|
-
type MentionContext = 'test-body' | 'comment' | 'string' | 'import';
|
|
1749
|
-
/**
|
|
1750
|
-
* One coverage verdict. Best evidence wins: test-title, then declaration,
|
|
1751
|
-
* then mention-only, then none. A comment in another file, when the symbol
|
|
1752
|
-
* still occurs in code, is `declaration-miss` and does not count.
|
|
1753
|
-
* Regexes, the test-file vs source split, and `Aggregate.method` lookup stay
|
|
1754
|
-
* behind this value.
|
|
1755
|
-
*/
|
|
1756
|
-
type CoverageEvidence = {
|
|
1757
|
-
kind: 'test-title';
|
|
1758
|
-
file: string;
|
|
1759
|
-
title: string;
|
|
1760
|
-
} | {
|
|
1761
|
-
kind: 'declaration';
|
|
1762
|
-
file: string;
|
|
1763
|
-
shape: DeclarationShape;
|
|
1764
|
-
} | {
|
|
1765
|
-
kind: 'mention-only';
|
|
1766
|
-
file: string;
|
|
1767
|
-
context: MentionContext;
|
|
1768
|
-
} | {
|
|
1769
|
-
kind: 'declaration-miss';
|
|
1770
|
-
symbol: string;
|
|
1771
|
-
} | {
|
|
1772
|
-
kind: 'none';
|
|
1773
|
-
};
|
|
1774
|
-
/** Invariant fields the classifier reads. A full catalog entry is assignable. */
|
|
1775
|
-
type CoverageInvariant = {
|
|
1776
|
-
id: string;
|
|
1777
|
-
coverage?: {
|
|
1778
|
-
test?: boolean;
|
|
1779
|
-
symbol?: string;
|
|
1780
|
-
} | null;
|
|
1781
|
-
};
|
|
1782
|
-
/** File set the classifier reads. Tooling has already loaded the contents. */
|
|
1783
|
-
type CoverageFiles = {
|
|
1784
|
-
/** Project-relative path → file contents (tests and sources). */
|
|
1785
|
-
fileContents: Readonly<Record<string, string>>;
|
|
1786
|
-
/** Paths already classified as tests. */
|
|
1787
|
-
testFiles?: readonly string[];
|
|
1788
|
-
/**
|
|
1789
|
-
* Declared runner roots. A test title inside a root beats one outside it.
|
|
1790
|
-
* The outside-roots finding stays a separate verdict.
|
|
1791
|
-
*/
|
|
1792
|
-
coverageRoots?: readonly string[];
|
|
1793
|
-
};
|
|
1794
2301
|
type InvariantCoverageEvidence = {
|
|
1795
2302
|
invariantId: string;
|
|
1796
2303
|
layer: string;
|
|
@@ -1828,48 +2335,13 @@ type InvariantCoverageEvidence = {
|
|
|
1828
2335
|
* so existing promote fixtures stay valid; the evaluator always sets it.
|
|
1829
2336
|
*/
|
|
1830
2337
|
coverageRootsDeclared?: boolean;
|
|
1831
|
-
};
|
|
1832
|
-
type InvariantUncoveredKind = 'never-had-tests' | 'tests-disappeared';
|
|
1833
|
-
type InvariantCoverageRuleId = 'INVARIANT_UNCOVERED' | 'INVARIANT_COVERAGE_OUTSIDE_ROOTS';
|
|
1834
|
-
type InvariantCoverageViolation = {
|
|
1835
|
-
ruleId: InvariantCoverageRuleId;
|
|
1836
|
-
message: string;
|
|
1837
|
-
file: string;
|
|
1838
|
-
line: number;
|
|
1839
|
-
arkruleId: string;
|
|
1840
|
-
arkruleSource: string;
|
|
1841
|
-
fromLayer: string;
|
|
1842
|
-
severity: 'error' | 'warning';
|
|
1843
|
-
failsStrict: boolean;
|
|
1844
|
-
/**
|
|
1845
|
-
* Adopt residual (no test suite) vs regression (suite exists, coverage gone).
|
|
1846
|
-
* Only INVARIANT_UNCOVERED carries it: an outside-roots finding is about
|
|
1847
|
-
* WHERE the covering test lives, not about whether one exists.
|
|
1848
|
-
*/
|
|
1849
|
-
kind?: InvariantUncoveredKind;
|
|
1850
|
-
};
|
|
1851
|
-
type EvaluateInvariantCoverageInput = {
|
|
1852
|
-
arkRules: EffectiveArkRules;
|
|
1853
|
-
/** Project-relative path → file contents (tests + domain sources). */
|
|
1854
|
-
fileContents: Readonly<Record<string, string>>;
|
|
1855
|
-
/** Paths considered tests (already filtered by Tooling via globs). */
|
|
1856
|
-
testFiles?: readonly string[];
|
|
1857
|
-
/** When true, missing test files make coverage partial (never green covered). */
|
|
1858
|
-
testGlobsMissing?: boolean;
|
|
1859
|
-
/**
|
|
1860
|
-
* Tooling hit MAX_COVERAGE_FILES. Partial must not claim the repo never had tests —
|
|
1861
|
-
* the suite may exist outside the scan budget.
|
|
1862
|
-
*/
|
|
1863
|
-
coverageBudgetExhausted?: boolean;
|
|
1864
|
-
/** Numbers behind the scan: what was loaded, what was discarded and why. */
|
|
1865
|
-
coverageStats?: InvariantCoverageStats;
|
|
1866
2338
|
/**
|
|
1867
|
-
*
|
|
1868
|
-
*
|
|
1869
|
-
*
|
|
1870
|
-
*
|
|
2339
|
+
* Committed mutation-probe evidence for this invariant (ADR 0039), attached
|
|
2340
|
+
* by Tooling when `.ark/invariant-probe.json` has a row. Additive: absent on
|
|
2341
|
+
* every evaluation that has no artifact. Only a fresh `survived` /
|
|
2342
|
+
* `not-reached` changes promotion; every other state changes nothing.
|
|
1871
2343
|
*/
|
|
1872
|
-
|
|
2344
|
+
probe?: InvariantProbeSummary;
|
|
1873
2345
|
};
|
|
1874
2346
|
/**
|
|
1875
2347
|
* What the Tooling scan actually saw. Every discard has a counted reason —
|
|
@@ -1911,31 +2383,6 @@ type InvariantCoverageStats = {
|
|
|
1911
2383
|
outOfRoot: number;
|
|
1912
2384
|
};
|
|
1913
2385
|
};
|
|
1914
|
-
/**
|
|
1915
|
-
* Best coverage evidence for `invariant` in `files`.
|
|
1916
|
-
* test-title beats a declaration; a declaration beats a bare mention; a bare
|
|
1917
|
-
* mention beats silence. Callers do not re-scan to explain the verdict.
|
|
1918
|
-
*/
|
|
1919
|
-
declare function classifyCoverage(invariant: CoverageInvariant, files: CoverageFiles): CoverageEvidence;
|
|
1920
|
-
/**
|
|
1921
|
-
* Policy: a test title or any declaration counts, including type, interface,
|
|
1922
|
-
* and enum. A mention-only verdict never counts. `none` does not count.
|
|
1923
|
-
*/
|
|
1924
|
-
declare function countsAsCoverage(ev: CoverageEvidence): boolean;
|
|
1925
|
-
/** Sentence for the verdict. `INVARIANT_UNCOVERED` prints this; it does not re-derive it. */
|
|
1926
|
-
declare function describeCoverage(invariant: CoverageInvariant, ev: CoverageEvidence): string;
|
|
1927
|
-
declare function evaluateInvariantCoverage(input: EvaluateInvariantCoverageInput): {
|
|
1928
|
-
coverage: InvariantCoverageEvidence[];
|
|
1929
|
-
violations: InvariantCoverageViolation[];
|
|
1930
|
-
partial: boolean;
|
|
1931
|
-
};
|
|
1932
|
-
/**
|
|
1933
|
-
* Deterministic promotion gate: refuse advisory→enforced when invariant is uncovered.
|
|
1934
|
-
*/
|
|
1935
|
-
declare function canPromoteInvariant(coverage: InvariantCoverageEvidence | undefined): {
|
|
1936
|
-
ok: boolean;
|
|
1937
|
-
reason: string;
|
|
1938
|
-
};
|
|
1939
2386
|
|
|
1940
2387
|
/**
|
|
1941
2388
|
* Pure ArkRules structure sensor evaluation (ADR 0013).
|
|
@@ -1958,85 +2405,37 @@ type ClassShapeFact = {
|
|
|
1958
2405
|
}[];
|
|
1959
2406
|
/** Heuristic: data-only class (fields, no methods beyond accessors). */
|
|
1960
2407
|
dataOnly?: boolean;
|
|
1961
|
-
};
|
|
1962
|
-
type ArkRuleSensorViolation = {
|
|
1963
|
-
ruleId: string;
|
|
1964
|
-
code: string;
|
|
1965
|
-
message: string;
|
|
1966
|
-
file: string;
|
|
1967
|
-
line: number;
|
|
1968
|
-
fromLayer?: string;
|
|
1969
|
-
arkruleId: string;
|
|
1970
|
-
arkruleSource: string;
|
|
1971
|
-
severity: 'error' | 'warning';
|
|
1972
|
-
sensor: ArkRuleSensorId;
|
|
1973
|
-
/** When true, advisory surfaces only (does not fail strict). */
|
|
1974
|
-
failsStrict: boolean;
|
|
1975
|
-
};
|
|
1976
|
-
type EvaluateArkRuleSensorsInput = {
|
|
1977
|
-
arkRules: EffectiveArkRules;
|
|
1978
|
-
classShapes: readonly ClassShapeFact[];
|
|
1979
|
-
/** Project-relative paths in scope for the analysis. */
|
|
1980
|
-
files: readonly string[];
|
|
1981
|
-
/**
|
|
1982
|
-
* Optional layer membership: path → layer name. When omitted, structure rules
|
|
1983
|
-
* apply by appliesTo globs only (or all files when appliesTo is absent).
|
|
1984
|
-
*/
|
|
1985
|
-
layerForFile?: (path: string) => string | null | undefined;
|
|
1986
2408
|
/**
|
|
1987
|
-
*
|
|
2409
|
+
* Set when the scanner could not walk the class to its end: the character
|
|
2410
|
+
* offset (in the source file) where analysis stopped. Enumerable on purpose so
|
|
2411
|
+
* it survives fact canonicalisation and serialisation; enforced structure
|
|
2412
|
+
* sensors report it instead of passing in silence.
|
|
1988
2413
|
*/
|
|
1989
|
-
|
|
1990
|
-
orchestrationHeavy?: boolean;
|
|
1991
|
-
adapterThick?: boolean;
|
|
1992
|
-
persistenceWrite?: boolean;
|
|
1993
|
-
}>>;
|
|
1994
|
-
};
|
|
1995
|
-
/**
|
|
1996
|
-
* Evaluate all structure sensors. Empty Effective Contract → no findings (byte-for-byte parity).
|
|
1997
|
-
*/
|
|
1998
|
-
declare function evaluateArkRuleSensors(input: EvaluateArkRuleSensorsInput): ArkRuleSensorViolation[];
|
|
1999
|
-
/**
|
|
2000
|
-
* ADR 0012 D3 — a structure rule whose appliesTo matches zero governed files is
|
|
2001
|
-
* never silent green. Advisory → warning; enforced → failsStrict.
|
|
2002
|
-
* Rules without appliesTo (whole-layer) never emit this signal.
|
|
2003
|
-
*/
|
|
2004
|
-
declare function collectEmptyAppliesToFindings(arkRules: EffectiveArkRules, files: readonly string[]): ArkRuleSensorViolation[];
|
|
2005
|
-
/** Optional resolved-import facts when the collector already classified the specifier. */
|
|
2006
|
-
type ResolvedPersistenceImportFact = {
|
|
2007
|
-
specifier?: string;
|
|
2008
|
-
resolvedFile?: string;
|
|
2009
|
-
layer?: string | null;
|
|
2414
|
+
truncatedUntil?: number;
|
|
2010
2415
|
};
|
|
2416
|
+
|
|
2011
2417
|
/**
|
|
2012
|
-
*
|
|
2013
|
-
* Prefers false negatives over false positives (ADR 0013 discipline).
|
|
2014
|
-
* Returns null when neither flag is set (callers may omit the path).
|
|
2015
|
-
*/
|
|
2016
|
-
declare function deriveArkRuleFileHints(_file: string, content: string, resolvedImports?: readonly ResolvedPersistenceImportFact[]): {
|
|
2017
|
-
orchestrationHeavy?: boolean;
|
|
2018
|
-
adapterThick?: boolean;
|
|
2019
|
-
persistenceWrite?: boolean;
|
|
2020
|
-
} | null;
|
|
2021
|
-
/**
|
|
2022
|
-
* Build fileHints map from path→content. Omits paths with no flags (sparse map).
|
|
2023
|
-
*/
|
|
2024
|
-
declare function buildArkRuleFileHints(fileContents: Readonly<Record<string, string>>, resolvedImportsByFile?: Readonly<Record<string, readonly ResolvedPersistenceImportFact[]>>): Record<string, {
|
|
2025
|
-
orchestrationHeavy?: boolean;
|
|
2026
|
-
adapterThick?: boolean;
|
|
2027
|
-
persistenceWrite?: boolean;
|
|
2028
|
-
}>;
|
|
2029
|
-
/**
|
|
2030
|
-
* Lightweight class-shape extraction from TypeScript source text (no compiler).
|
|
2031
|
-
* Conservative: prefers false negatives over false positives for mutability.
|
|
2032
|
-
* Tooling may replace with TypeScript-API facts; sensors consume the same shape.
|
|
2418
|
+
* Config-key version floors plus pin evidence (#338).
|
|
2033
2419
|
*
|
|
2034
|
-
*
|
|
2035
|
-
*
|
|
2036
|
-
*
|
|
2037
|
-
*
|
|
2420
|
+
* A slice key such as `childSlices` is rejected at config load by an older
|
|
2421
|
+
* arkgate (the rule schema sets `additionalProperties: false`). ArkGate warns
|
|
2422
|
+
* about that only with evidence that this repo pins such an older arkgate: an
|
|
2423
|
+
* exact package.json dependency, the installed copy, the lockfile, a hook
|
|
2424
|
+
* script, or a CI workflow. Without evidence it stays silent.
|
|
2425
|
+
*
|
|
2426
|
+
* Pure: Tooling reads the files and passes their text here.
|
|
2038
2427
|
*/
|
|
2039
|
-
|
|
2428
|
+
/** Where a pin was found. */
|
|
2429
|
+
type ArkgatePinSource = 'package-json' | 'package-lock' | 'installed' | 'hook' | 'ci';
|
|
2430
|
+
type ArkgatePinEvidence = {
|
|
2431
|
+
/** Repo-relative file that pins arkgate. */
|
|
2432
|
+
file: string;
|
|
2433
|
+
/** 1-based line of the pin. */
|
|
2434
|
+
line: number;
|
|
2435
|
+
/** Pinned version, without a leading `v`. */
|
|
2436
|
+
version: string;
|
|
2437
|
+
source: ArkgatePinSource;
|
|
2438
|
+
};
|
|
2040
2439
|
|
|
2041
2440
|
declare const POLICY_DELTA_SCHEMA_VERSION: "1.0";
|
|
2042
2441
|
type PolicyDeltaClassification = 'strengthening' | 'neutral' | 'judgment-required' | 'weakening';
|
|
@@ -2116,6 +2515,10 @@ type AnalysisResult = {
|
|
|
2116
2515
|
type AnalyzeResolvedProjectInput = {
|
|
2117
2516
|
contract: AnalysisContract;
|
|
2118
2517
|
facts: unknown;
|
|
2518
|
+
/** Tooling FS evidence of arkgate pins. Omitted: version-floor warnings stay silent. */
|
|
2519
|
+
arkgatePins?: readonly ArkgatePinEvidence[];
|
|
2520
|
+
/** The running arkgate version, for the version-floor nextAction. */
|
|
2521
|
+
runningArkgateVersion?: string;
|
|
2119
2522
|
/**
|
|
2120
2523
|
* D0 adopted or --require-gates / --strict-merge. When true, a missing
|
|
2121
2524
|
* domain-invariant tests path fails closed. Omitted stays silent.
|
|
@@ -2158,12 +2561,20 @@ type AnalyzeResolvedProjectInput = {
|
|
|
2158
2561
|
persistenceWrite?: boolean;
|
|
2159
2562
|
}>>;
|
|
2160
2563
|
};
|
|
2564
|
+
/** Tooling-supplied analysis evidence for one side (base or candidate) of a preflight. */
|
|
2565
|
+
type ResolvedAnalysisSideInputs = Pick<AnalyzeResolvedProjectInput, 'adopted' | 'invariantTestsPathPresent' | 'coverageRootsPresent' | 'coverageInputs' | 'fileHints'>;
|
|
2161
2566
|
type PreflightResolvedChangeInput = {
|
|
2162
2567
|
contract: AnalysisContract;
|
|
2163
2568
|
baseFacts: unknown;
|
|
2164
2569
|
candidateFacts: unknown;
|
|
2165
2570
|
changes: readonly AnalysisFileChange[];
|
|
2166
2571
|
changeMap?: ArchitectureChangeMapContract;
|
|
2572
|
+
/**
|
|
2573
|
+
* ArkRules evidence (coverage contents, structural hints) for the on-disk base and
|
|
2574
|
+
* the in-memory candidate, so preflight runs the same engine inputs as ark-check.
|
|
2575
|
+
*/
|
|
2576
|
+
baseAnalysisInputs?: ResolvedAnalysisSideInputs;
|
|
2577
|
+
candidateAnalysisInputs?: ResolvedAnalysisSideInputs;
|
|
2167
2578
|
};
|
|
2168
2579
|
type ResolvedAnalysisFile = ResolvedFileFact & {
|
|
2169
2580
|
layer: string | null;
|
|
@@ -2342,6 +2753,13 @@ type CollectAnalysisConfigWarningsInput = {
|
|
|
2342
2753
|
config: ArkConfig;
|
|
2343
2754
|
rules: ArkConfig['rules'];
|
|
2344
2755
|
files: readonly string[];
|
|
2756
|
+
/**
|
|
2757
|
+
* Tooling FS evidence of arkgate pins in this repo (package.json, lockfile,
|
|
2758
|
+
* installed copy, hook scripts, CI). Omitted: version-floor warnings stay silent.
|
|
2759
|
+
*/
|
|
2760
|
+
arkgatePins?: readonly ArkgatePinEvidence[];
|
|
2761
|
+
/** The running arkgate version. The version-floor nextAction targets it when newer. */
|
|
2762
|
+
runningArkgateVersion?: string;
|
|
2345
2763
|
manifest?: {
|
|
2346
2764
|
architecture?: {
|
|
2347
2765
|
layers?: readonly {
|
|
@@ -2390,6 +2808,8 @@ declare function analyzeResolvedProject(input: AnalyzeResolvedProjectInput): Res
|
|
|
2390
2808
|
*/
|
|
2391
2809
|
declare function preflightChange(input: AnalyzeChangeInput): ChangePreflightResult;
|
|
2392
2810
|
|
|
2811
|
+
/** Atomic preflight over one validated base/candidate facts pair (ADR 0011). */
|
|
2812
|
+
|
|
2393
2813
|
/**
|
|
2394
2814
|
* Validate that the supplied candidate is exactly the declared in-memory
|
|
2395
2815
|
* overlay, then return its canonical resolved verdict. No project file is read
|
|
@@ -2400,6 +2820,89 @@ declare function preflightResolvedChange(input: PreflightResolvedChangeInput): R
|
|
|
2400
2820
|
/** Canonical config diagnostics over repo-relative file paths. */
|
|
2401
2821
|
declare function collectAnalysisConfigWarnings(input: CollectAnalysisConfigWarningsInput): ArchitectureEngineViolation[];
|
|
2402
2822
|
|
|
2823
|
+
/**
|
|
2824
|
+
* Public diagnostic code catalog (ACS02).
|
|
2825
|
+
*
|
|
2826
|
+
* Closed vocabulary of stable `ruleId` values emitted by ArkGate adapters with
|
|
2827
|
+
* human/agent `why` / `fix` anchors and docs fragment ids. Cataloguing only —
|
|
2828
|
+
* no new rule semantics, no LLM verdict, no enforcement from prose.
|
|
2829
|
+
*
|
|
2830
|
+
* **Canonical** for docs, agent projection (ACS04), and finding refs (ACS06).
|
|
2831
|
+
* Runtime remediation remains in `remediation.ts`; parity tests bind the two.
|
|
2832
|
+
*
|
|
2833
|
+
* Zero Node I/O. Optional CLI surface: generated `bin/lib/diagnostic-catalog.mjs`.
|
|
2834
|
+
*
|
|
2835
|
+
* @see docs/diagnostics.md
|
|
2836
|
+
* @see docs/plans/agent-contract-surface-4.3/README.md
|
|
2837
|
+
*/
|
|
2838
|
+
/** Product-relative docs path (shipped in the npm tarball when listed in package files). */
|
|
2839
|
+
declare const DIAGNOSTIC_DOCS_RELATIVE_PATH: "docs/diagnostics.md";
|
|
2840
|
+
/** Schema id for serializing the catalog snapshot (agents / install projection). */
|
|
2841
|
+
declare const DIAGNOSTIC_CATALOG_SCHEMA_VERSION: "1.0";
|
|
2842
|
+
type DiagnosticCategory = 'layer' | 'capability' | 'publish' | 'safety' | 'arkrules' | 'arkrun' | 'arkorder' | 'preflight' | 'analysis' | 'drift' | 'snippet-policy' | 'config' | 'adapter' | 'meta';
|
|
2843
|
+
type DiagnosticCatalogEntry = {
|
|
2844
|
+
/** Stable public violation / diagnostic id. */
|
|
2845
|
+
ruleId: string;
|
|
2846
|
+
/** Short title for indexes and agent projection. */
|
|
2847
|
+
title: string;
|
|
2848
|
+
/** Why this finding exists (contract intent). */
|
|
2849
|
+
why: string;
|
|
2850
|
+
/**
|
|
2851
|
+
* Canonical fix guidance (agent + human). Contextual nextAction on live
|
|
2852
|
+
* findings may specialize this (e.g. type-only vs value layer import).
|
|
2853
|
+
*/
|
|
2854
|
+
fix: string;
|
|
2855
|
+
/** Markdown fragment id for docs/diagnostics.md (without leading #). */
|
|
2856
|
+
docsAnchor: string;
|
|
2857
|
+
category: DiagnosticCategory;
|
|
2858
|
+
/**
|
|
2859
|
+
* When true, finding is commonly advisory / non-blocking in default profiles
|
|
2860
|
+
* (doctor/config warnings, type-only placement debt, empty ArkRule scope).
|
|
2861
|
+
* Not a severity bit for the engine — documentation only.
|
|
2862
|
+
*/
|
|
2863
|
+
oftenAdvisory?: boolean;
|
|
2864
|
+
};
|
|
2865
|
+
/**
|
|
2866
|
+
* Closed public catalog. Order is stable (category groups, then ruleId) for
|
|
2867
|
+
* deterministic serialization and docs generation.
|
|
2868
|
+
*
|
|
2869
|
+
* Every production-emitted `ruleId` must appear here. Remediation switch cases
|
|
2870
|
+
* and adapter nextAction branches are parity-tested against this list.
|
|
2871
|
+
*/
|
|
2872
|
+
declare const DIAGNOSTIC_CATALOG: readonly DiagnosticCatalogEntry[];
|
|
2873
|
+
/** All public ruleIds in catalog order. */
|
|
2874
|
+
declare const DIAGNOSTIC_RULE_IDS: readonly string[];
|
|
2875
|
+
declare function isKnownDiagnosticCode(ruleId: string | null | undefined): boolean;
|
|
2876
|
+
/**
|
|
2877
|
+
* True when the code is catalogued or is an ArkRule-family id handled by the
|
|
2878
|
+
* ARKRULE_* prefix fallback in remediation (structure sensors may add members later
|
|
2879
|
+
* only via catalog + ROADMAP — prefix alone is not a license for free-form ids).
|
|
2880
|
+
*/
|
|
2881
|
+
declare function isCataloguedOrArkRuleFamily(ruleId: string | null | undefined): boolean;
|
|
2882
|
+
declare function getDiagnosticCatalogEntry(ruleId: string | null | undefined): DiagnosticCatalogEntry | undefined;
|
|
2883
|
+
/** Fragment for docs links, e.g. `#LAYER_IMPORT_VIOLATION`. */
|
|
2884
|
+
declare function diagnosticDocsFragment(ruleId: string): string;
|
|
2885
|
+
/**
|
|
2886
|
+
* Repo-relative docs path with fragment (for agents and JSON).
|
|
2887
|
+
* Package consumers resolve against the installed package root or GitHub tree.
|
|
2888
|
+
*/
|
|
2889
|
+
declare function diagnosticDocsPath(ruleId: string): string;
|
|
2890
|
+
/** Catalog snapshot for JSON export / agent projection (stable field order). */
|
|
2891
|
+
declare function serializeDiagnosticCatalog(): {
|
|
2892
|
+
schemaVersion: typeof DIAGNOSTIC_CATALOG_SCHEMA_VERSION;
|
|
2893
|
+
docsPath: typeof DIAGNOSTIC_DOCS_RELATIVE_PATH;
|
|
2894
|
+
codes: readonly DiagnosticCatalogEntry[];
|
|
2895
|
+
};
|
|
2896
|
+
/**
|
|
2897
|
+
* Static catalog fix for a ruleId when no live violation context is available.
|
|
2898
|
+
* Live adapters should still use deterministicNextAction for specialized edges.
|
|
2899
|
+
*/
|
|
2900
|
+
declare function catalogFixForRuleId(ruleId: string | null | undefined): string | undefined;
|
|
2901
|
+
/**
|
|
2902
|
+
* Static catalog why for a ruleId (agent “why” surface).
|
|
2903
|
+
*/
|
|
2904
|
+
declare function catalogWhyForRuleId(ruleId: string | null | undefined): string | undefined;
|
|
2905
|
+
|
|
2403
2906
|
/** Public, evidence-backed enforcement state shared by doctor adapters. */
|
|
2404
2907
|
declare const ARK_ENFORCEMENT_STATE_SCHEMA_VERSION: "1.1";
|
|
2405
2908
|
type EnforcementVerification = boolean | 'unverified';
|
|
@@ -2491,86 +2994,135 @@ type ArkDesignDeltaResult = {
|
|
|
2491
2994
|
};
|
|
2492
2995
|
|
|
2493
2996
|
/**
|
|
2494
|
-
*
|
|
2495
|
-
*
|
|
2496
|
-
* Closed vocabulary of stable `ruleId` values emitted by ArkGate adapters with
|
|
2497
|
-
* human/agent `why` / `fix` anchors and docs fragment ids. Cataloguing only —
|
|
2498
|
-
* no new rule semantics, no LLM verdict, no enforcement from prose.
|
|
2499
|
-
*
|
|
2500
|
-
* **Canonical** for docs, agent projection (ACS04), and finding refs (ACS06).
|
|
2501
|
-
* Runtime remediation remains in `remediation.ts`; parity tests bind the two.
|
|
2502
|
-
*
|
|
2503
|
-
* Zero Node I/O. Optional CLI surface: generated `bin/lib/diagnostic-catalog.mjs`.
|
|
2504
|
-
*
|
|
2505
|
-
* @see docs/diagnostics.md
|
|
2506
|
-
* @see docs/plans/agent-contract-surface-4.3/README.md
|
|
2997
|
+
* In-memory shadow / replay / compare for ArkRun information packages (XP07 / ADR 0033).
|
|
2998
|
+
* Not durable. Not a second bus. Stripped snapshots only.
|
|
2507
2999
|
*/
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
* Canonical fix guidance (agent + human). Contextual nextAction on live
|
|
2522
|
-
* findings may specialize this (e.g. type-only vs value layer import).
|
|
2523
|
-
*/
|
|
2524
|
-
fix: string;
|
|
2525
|
-
/** Markdown fragment id for docs/diagnostics.md (without leading #). */
|
|
2526
|
-
docsAnchor: string;
|
|
2527
|
-
category: DiagnosticCategory;
|
|
2528
|
-
/**
|
|
2529
|
-
* When true, finding is commonly advisory / non-blocking in default profiles
|
|
2530
|
-
* (doctor/config warnings, type-only placement debt, empty ArkRule scope).
|
|
2531
|
-
* Not a severity bit for the engine — documentation only.
|
|
2532
|
-
*/
|
|
2533
|
-
oftenAdvisory?: boolean;
|
|
2534
|
-
};
|
|
3000
|
+
|
|
3001
|
+
type InformationPackageDiff = {
|
|
3002
|
+
readonly path: string;
|
|
3003
|
+
readonly left: unknown;
|
|
3004
|
+
readonly right: unknown;
|
|
3005
|
+
};
|
|
3006
|
+
type InformationPackageCompare = {
|
|
3007
|
+
readonly equal: boolean;
|
|
3008
|
+
readonly diffs: readonly InformationPackageDiff[];
|
|
3009
|
+
};
|
|
3010
|
+
/** Shadow: identity snapshot. The live kernel is not copied. */
|
|
3011
|
+
declare function shadowInformationPackage(pack: DependencyInformationPackage): DependencyInformationPackage;
|
|
3012
|
+
declare function compareInformationPackages(left: DependencyInformationPackage, right: DependencyInformationPackage): InformationPackageCompare;
|
|
2535
3013
|
/**
|
|
2536
|
-
*
|
|
2537
|
-
*
|
|
2538
|
-
*
|
|
2539
|
-
* Every production-emitted `ruleId` must appear here. Remediation switch cases
|
|
2540
|
-
* and adapter nextAction branches are parity-tested against this list.
|
|
3014
|
+
* Replay: apply sequential snapshots as the "tape". Each step is compared to
|
|
3015
|
+
* the previous shadow. No bus, no store, no time travel across processes.
|
|
2541
3016
|
*/
|
|
2542
|
-
declare
|
|
2543
|
-
|
|
2544
|
-
declare const DIAGNOSTIC_RULE_IDS: readonly string[];
|
|
2545
|
-
declare function isKnownDiagnosticCode(ruleId: string | null | undefined): boolean;
|
|
3017
|
+
declare function replayInformationPackages(tape: readonly DependencyInformationPackage[]): InformationPackageCompare[];
|
|
3018
|
+
|
|
2546
3019
|
/**
|
|
2547
|
-
*
|
|
2548
|
-
*
|
|
2549
|
-
*
|
|
3020
|
+
* Default cap for in-memory history, trace, audit, and default event-buffer
|
|
3021
|
+
* records. Without a cap a long-running process grows without bound on every
|
|
3022
|
+
* publish. Pass `maxHistorySize: Infinity` to explicitly opt back into unbounded
|
|
3023
|
+
* retention. An injected `eventBuffer` owns its own retention.
|
|
2550
3024
|
*/
|
|
2551
|
-
declare
|
|
2552
|
-
declare function
|
|
2553
|
-
/** Fragment for docs links, e.g. `#LAYER_IMPORT_VIOLATION`. */
|
|
2554
|
-
declare function diagnosticDocsFragment(ruleId: string): string;
|
|
3025
|
+
declare const DEFAULT_MAX_HISTORY_SIZE = 1000;
|
|
3026
|
+
declare function createArkKernel(options?: CreateArkKernelOptions): ArkKernel;
|
|
2555
3027
|
/**
|
|
2556
|
-
*
|
|
2557
|
-
*
|
|
3028
|
+
* Preferred ArkRun factory. Each call is a new isolated instance — there is no
|
|
3029
|
+
* process-wide singleton.
|
|
2558
3030
|
*/
|
|
2559
|
-
declare function
|
|
2560
|
-
|
|
2561
|
-
declare function serializeDiagnosticCatalog(): {
|
|
2562
|
-
schemaVersion: typeof DIAGNOSTIC_CATALOG_SCHEMA_VERSION;
|
|
2563
|
-
docsPath: typeof DIAGNOSTIC_DOCS_RELATIVE_PATH;
|
|
2564
|
-
codes: readonly DiagnosticCatalogEntry[];
|
|
2565
|
-
};
|
|
3031
|
+
declare function createStrictArkKernel(options?: CreateArkKernelOptions): ArkKernel;
|
|
3032
|
+
declare function createArkKernelFromConfig(config: ArkKernelConfig, options?: CreateArkKernelFromConfigOptions): ArkKernel;
|
|
2566
3033
|
/**
|
|
2567
|
-
*
|
|
2568
|
-
*
|
|
3034
|
+
* Strict kernel whose runtime layer profile comes from `ark.config.json`.
|
|
3035
|
+
* Hard observed-layer-flow needs every layer a deny rule names to resolve an
|
|
3036
|
+
* intent: declared `intentPrefixes`, or a canonical 11-layer name (`DomainModel`,
|
|
3037
|
+
* `ApplicationOrchestration`, … — what `ark init` writes) which gets the built-in
|
|
3038
|
+
* prefixes. A custom-named deny layer without prefixes is recorded as a
|
|
3039
|
+
* `layer.observedFlowUnresolvable` audit record (`ARKRUN_LAYER_FLOW_UNRESOLVABLE`);
|
|
3040
|
+
* passing `enforceObservedLayerFlow: 'hard'` explicitly throws `ArkKernelConfigError`
|
|
3041
|
+
* instead.
|
|
2569
3042
|
*/
|
|
2570
|
-
declare function
|
|
3043
|
+
declare function createStrictArkKernelFromConfig(config: ArkKernelConfig, options?: CreateArkKernelFromConfigOptions): ArkKernel;
|
|
3044
|
+
declare function createLenientArkKernelFromConfig(config: ArkKernelConfig, options?: CreateArkKernelFromConfigOptions): ArkKernel;
|
|
3045
|
+
declare function createLenientArkKernel(options?: CreateArkKernelOptions): ArkKernel;
|
|
3046
|
+
|
|
3047
|
+
interface ArkTestSnapshot {
|
|
3048
|
+
events: DomainEvent[];
|
|
3049
|
+
traces: TraceRecord[];
|
|
3050
|
+
audit: AuditRecord[];
|
|
3051
|
+
outbox: OutboxRecord[];
|
|
3052
|
+
observability: ObservabilityDriftReport;
|
|
3053
|
+
}
|
|
3054
|
+
interface ArkTestHarness {
|
|
3055
|
+
events(intent?: string): DomainEvent[];
|
|
3056
|
+
traces(type?: TraceRecordType): TraceRecord[];
|
|
3057
|
+
audit(query?: AuditQuery): Promise<AuditRecord[]>;
|
|
3058
|
+
outbox(status?: OutboxStatus): Promise<OutboxRecord[]>;
|
|
3059
|
+
observability(): ObservabilityDriftReport;
|
|
3060
|
+
snapshot(): Promise<ArkTestSnapshot>;
|
|
3061
|
+
clear(): Promise<void>;
|
|
3062
|
+
}
|
|
3063
|
+
|
|
3064
|
+
declare function createArkTestHarness(kernel: ArkKernel): ArkTestHarness;
|
|
3065
|
+
|
|
2571
3066
|
/**
|
|
2572
|
-
*
|
|
3067
|
+
* Ports & Adapters basic contracts.
|
|
2573
3068
|
*/
|
|
2574
|
-
|
|
3069
|
+
interface Port<T = unknown> {
|
|
3070
|
+
readonly name: string;
|
|
3071
|
+
readonly ownerLayer?: string;
|
|
3072
|
+
readonly intent?: IntentName;
|
|
3073
|
+
readonly allowedAdapters?: string[];
|
|
3074
|
+
readonly __port?: T;
|
|
3075
|
+
}
|
|
3076
|
+
interface Adapter<T = unknown> {
|
|
3077
|
+
readonly name?: string;
|
|
3078
|
+
readonly layer?: string;
|
|
3079
|
+
readonly intent?: IntentName;
|
|
3080
|
+
readonly port: Port<T>;
|
|
3081
|
+
readonly impl: T;
|
|
3082
|
+
}
|
|
3083
|
+
interface DefinePortOptions {
|
|
3084
|
+
ownerLayer?: string;
|
|
3085
|
+
intent?: IntentName;
|
|
3086
|
+
allowedAdapters?: string[];
|
|
3087
|
+
}
|
|
3088
|
+
interface CreateAdapterOptions {
|
|
3089
|
+
name?: string;
|
|
3090
|
+
layer?: string;
|
|
3091
|
+
intent?: IntentName;
|
|
3092
|
+
requiredKeys?: string[];
|
|
3093
|
+
}
|
|
3094
|
+
/**
|
|
3095
|
+
* Simple contract checker (duck typing + optional required keys).
|
|
3096
|
+
*/
|
|
3097
|
+
type ContractCheckResult = {
|
|
3098
|
+
ok: true;
|
|
3099
|
+
} | {
|
|
3100
|
+
ok: false;
|
|
3101
|
+
missing: string[];
|
|
3102
|
+
};
|
|
3103
|
+
interface AdapterGovernanceIssue {
|
|
3104
|
+
ruleId: 'ADAPTER_NOT_ALLOWED_FOR_PORT';
|
|
3105
|
+
message: string;
|
|
3106
|
+
port: string;
|
|
3107
|
+
adapter?: string;
|
|
3108
|
+
}
|
|
3109
|
+
type AdapterGovernanceResult = {
|
|
3110
|
+
ok: true;
|
|
3111
|
+
issues: [];
|
|
3112
|
+
} | {
|
|
3113
|
+
ok: false;
|
|
3114
|
+
issues: AdapterGovernanceIssue[];
|
|
3115
|
+
};
|
|
3116
|
+
|
|
3117
|
+
/**
|
|
3118
|
+
* Ports and Adapters utilities.
|
|
3119
|
+
*
|
|
3120
|
+
* definePort + createAdapter with basic runtime contract validation.
|
|
3121
|
+
*/
|
|
3122
|
+
|
|
3123
|
+
declare function definePort<T = unknown>(name: string, options?: DefinePortOptions): Port<T>;
|
|
3124
|
+
declare function createAdapter<T>(port: Port<T>, impl: T, requiredKeysOrOptions?: string[] | CreateAdapterOptions, adapterOptions?: CreateAdapterOptions): Adapter<T>;
|
|
3125
|
+
declare function checkContract(impl: unknown, requiredKeys?: string[]): ContractCheckResult;
|
|
3126
|
+
declare function checkAdapterGovernance(adapter: Adapter): AdapterGovernanceResult;
|
|
2575
3127
|
|
|
2576
|
-
export { type
|
|
3128
|
+
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 };
|