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
|
@@ -0,0 +1,1800 @@
|
|
|
1
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
2
|
+
type AuditRecordType = 'event.published' | 'event.rawPublish' | 'event.handoffFailed' | 'event.intercepted' | 'interceptor.error' | 'policy.softViolation' | 'policy.hardViolation' | 'layer.observedViolation' | 'layer.observedFlowUnresolvable' | 'handler.error' | 'hook.error' | 'workflow.started' | 'workflow.step.completed' | 'workflow.step.failed' | 'workflow.compensation.completed' | 'workflow.completed' | 'workflow.failed' | 'projection.applied' | 'metadata.changed';
|
|
3
|
+
interface AuditRecord {
|
|
4
|
+
id: string;
|
|
5
|
+
type: AuditRecordType;
|
|
6
|
+
timestamp: string;
|
|
7
|
+
source?: string;
|
|
8
|
+
actor?: string;
|
|
9
|
+
intent?: string;
|
|
10
|
+
correlationId?: string;
|
|
11
|
+
causationId?: string;
|
|
12
|
+
subject?: string;
|
|
13
|
+
details?: unknown;
|
|
14
|
+
}
|
|
15
|
+
interface AuditRecordInput {
|
|
16
|
+
type: AuditRecordType;
|
|
17
|
+
timestamp?: string;
|
|
18
|
+
source?: string;
|
|
19
|
+
actor?: string;
|
|
20
|
+
intent?: string;
|
|
21
|
+
correlationId?: string;
|
|
22
|
+
causationId?: string;
|
|
23
|
+
subject?: string;
|
|
24
|
+
details?: unknown;
|
|
25
|
+
}
|
|
26
|
+
interface AuditQuery {
|
|
27
|
+
type?: AuditRecordType;
|
|
28
|
+
intent?: string;
|
|
29
|
+
correlationId?: string;
|
|
30
|
+
subject?: string;
|
|
31
|
+
since?: string;
|
|
32
|
+
until?: string;
|
|
33
|
+
limit?: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Pluggable persistence for audit records.
|
|
37
|
+
*
|
|
38
|
+
* **Durability stance (R9):** Default is `InMemoryAuditStore` — reference only, not
|
|
39
|
+
* production durability (lost on restart). Implement this interface for durable audit.
|
|
40
|
+
* See `docs/production-hardening.md`.
|
|
41
|
+
*/
|
|
42
|
+
interface AuditStore {
|
|
43
|
+
append(record: AuditRecord): MaybePromise<void>;
|
|
44
|
+
query(query?: AuditQuery): MaybePromise<AuditRecord[]>;
|
|
45
|
+
clear(): MaybePromise<void>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* High-level audit API used by the event bus / kernel.
|
|
49
|
+
* Durability is that of the injected `AuditStore` (default in-memory).
|
|
50
|
+
*/
|
|
51
|
+
interface AuditTrail {
|
|
52
|
+
record(input: AuditRecordInput): Promise<AuditRecord>;
|
|
53
|
+
query(query?: AuditQuery): Promise<AuditRecord[]>;
|
|
54
|
+
clear(): Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
interface CreateAuditTrailOptions {
|
|
57
|
+
/** Durable store when provided; otherwise `InMemoryAuditStore` (not production durability). */
|
|
58
|
+
store?: AuditStore;
|
|
59
|
+
maxRecords?: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Type vocabulary for the ark.config.json contract (U02 pilot 1).
|
|
64
|
+
*
|
|
65
|
+
* Pure declarations only — no runtime values. The loader/validator logic and the
|
|
66
|
+
* published JSON Schema live in ./configContract.ts. Extra defaulting lives in
|
|
67
|
+
* ./configExtras.ts (generated sibling `config-extras.mjs`). Type-only imports
|
|
68
|
+
* from this file are erased on transpile.
|
|
69
|
+
*/
|
|
70
|
+
type ArkConfigSchemaVersion = '1.0' | '1.1' | '1.2' | '1.3';
|
|
71
|
+
type ArkConfigCyclePolicy = 'strict' | 'soft' | 'framework-soft' | 'off';
|
|
72
|
+
type ArkConfigLayerCapabilities = {
|
|
73
|
+
deny?: string[];
|
|
74
|
+
};
|
|
75
|
+
/** Who this folder is for. Metadata — not import-rule teeth. Absence is silent. */
|
|
76
|
+
type ArkConfigLayerTrustBoundary = 'public' | 'auth' | 'admin' | 'internal';
|
|
77
|
+
type ArkConfigLayer = {
|
|
78
|
+
name: string;
|
|
79
|
+
patterns: string[];
|
|
80
|
+
exclude?: string[];
|
|
81
|
+
intentPrefixes?: string[];
|
|
82
|
+
/**
|
|
83
|
+
* App-context caption for this layer.
|
|
84
|
+
* Metadata — excluded from policy hash. Absence is silent.
|
|
85
|
+
*/
|
|
86
|
+
description?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Who this folder is for: public | auth | admin | internal.
|
|
89
|
+
* Metadata — excluded from policy hash. Absence is silent. Not host/CI TLS.
|
|
90
|
+
*/
|
|
91
|
+
trustBoundary?: ArkConfigLayerTrustBoundary;
|
|
92
|
+
/**
|
|
93
|
+
* Who owns this house: GitHub handles or emails (same identity as stewards).
|
|
94
|
+
* Metadata — excluded from policy hash. Absence is silent unless
|
|
95
|
+
* `requireLayerOwners` is true. Not import-rule teeth.
|
|
96
|
+
*/
|
|
97
|
+
owners?: string[];
|
|
98
|
+
forbiddenGlobals?: string[];
|
|
99
|
+
/** ADR 0009 D2 — opt-in effect-capability walls; absence changes no verdict. */
|
|
100
|
+
capabilities?: ArkConfigLayerCapabilities;
|
|
101
|
+
/** Dual-depth sugar: `pure: true` denies all seven capabilities. */
|
|
102
|
+
pure?: boolean;
|
|
103
|
+
mayImportInfrastructure?: boolean;
|
|
104
|
+
optional?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Future house: empty globs are expected. `--strict-config` must not fail.
|
|
107
|
+
* Typo warning (`CONFIG_LAYER_PATTERN_NO_MATCHES`) is skipped.
|
|
108
|
+
*/
|
|
109
|
+
reserved?: boolean;
|
|
110
|
+
/** Alias of reserved — empty pattern matches are allowed. */
|
|
111
|
+
allowEmpty?: boolean;
|
|
112
|
+
};
|
|
113
|
+
/** How a starred `sliceFolders` prefix is named. Absent equals `path`. */
|
|
114
|
+
type ArkConfigSliceIdentity = 'path' | 'stars';
|
|
115
|
+
type ArkConfigRule = {
|
|
116
|
+
from: string;
|
|
117
|
+
to: string;
|
|
118
|
+
allowed: boolean;
|
|
119
|
+
message?: string;
|
|
120
|
+
peerIsolation?: boolean;
|
|
121
|
+
sliceFolders?: string[];
|
|
122
|
+
/**
|
|
123
|
+
* How a starred `sliceFolders` prefix is named.
|
|
124
|
+
* Absent and `path` keep today's ids. `stars` is the last literal plus every
|
|
125
|
+
* star binding (a star before the last literal is kept too).
|
|
126
|
+
*/
|
|
127
|
+
sliceIdentity?: ArkConfigSliceIdentity;
|
|
128
|
+
/** Roots the repo declares shared on purpose — evidence, not unclassifiable. */
|
|
129
|
+
sharedRoots?: string[];
|
|
130
|
+
/** Directed slice→slice edges the repo declares on purpose. */
|
|
131
|
+
allowedCrossSlice?: ArkConfigCrossSliceEdge[];
|
|
132
|
+
/**
|
|
133
|
+
* `"deny"` blocks a shared root from importing a slice.
|
|
134
|
+
* `"deny-cross-parent"` leaves that hop allowed and asks the whole-graph
|
|
135
|
+
* check to report a slice that reaches another universe through shared.
|
|
136
|
+
* The object form carries `stopAt`: composition roots the walk never
|
|
137
|
+
* passes through.
|
|
138
|
+
*/
|
|
139
|
+
sharedImportsSlice?: ArkConfigSharedImportsSlice;
|
|
140
|
+
/**
|
|
141
|
+
* Optional inner wall. Absent keeps today's universe-wall output.
|
|
142
|
+
* `siblings` defaults to deny. An object keeps that default and lists enforced subtrees.
|
|
143
|
+
* `parentMayImportChild` defaults to false.
|
|
144
|
+
*/
|
|
145
|
+
childSlices?: ArkConfigChildSlices;
|
|
146
|
+
};
|
|
147
|
+
type ArkConfigSharedImportsSlice = 'deny' | 'deny-cross-parent' | {
|
|
148
|
+
mode: 'deny-cross-parent';
|
|
149
|
+
stopAt: string[];
|
|
150
|
+
};
|
|
151
|
+
type ArkConfigChildSlices = {
|
|
152
|
+
sliceFolders: string[];
|
|
153
|
+
sliceIdentity?: ArkConfigSliceIdentity;
|
|
154
|
+
commonFolders?: string[];
|
|
155
|
+
/**
|
|
156
|
+
* `ratchet` on the object form: absent turns the anti-growth ratchet on only
|
|
157
|
+
* when the baseline already records an advisory crossing of this rule;
|
|
158
|
+
* `true` always; `false` measures only.
|
|
159
|
+
*/
|
|
160
|
+
siblings?: 'deny' | 'advisory' | {
|
|
161
|
+
default: 'deny' | 'advisory';
|
|
162
|
+
enforce?: string[];
|
|
163
|
+
ratchet?: boolean;
|
|
164
|
+
};
|
|
165
|
+
parentMayImportChild?: boolean;
|
|
166
|
+
/** Text for inner-wall findings (sibling, common → child). Absent: ArkGate default, never the rule message. */
|
|
167
|
+
message?: string;
|
|
168
|
+
/**
|
|
169
|
+
* Directed child-slice allowances. `*` is one whole path segment.
|
|
170
|
+
* Clears a sibling crossing only. The universe `allowedCrossSlice` does not read this list.
|
|
171
|
+
*/
|
|
172
|
+
allowedCrossSlice?: ArkConfigCrossSliceEdge[];
|
|
173
|
+
/**
|
|
174
|
+
* Files outside the slice trees, borrowed onto a child id until they move.
|
|
175
|
+
* `to` is the universe id plus one child segment.
|
|
176
|
+
*/
|
|
177
|
+
sliceAliases?: ArkConfigSliceAlias[];
|
|
178
|
+
/**
|
|
179
|
+
* Filename at each child slice root. `<Layer>` is the only token.
|
|
180
|
+
* Example: `arkrules.<Layer>.json`.
|
|
181
|
+
*/
|
|
182
|
+
arkRulesFile?: string;
|
|
183
|
+
};
|
|
184
|
+
type ArkConfigSliceAlias = {
|
|
185
|
+
from: string;
|
|
186
|
+
to: string;
|
|
187
|
+
/** True: the path stays. It is not an owed move and does not clear other honesty debt. */
|
|
188
|
+
pinned?: boolean;
|
|
189
|
+
/** Doctor label, such as `framework-route`. A label alone does not pin. */
|
|
190
|
+
reason?: string;
|
|
191
|
+
};
|
|
192
|
+
type ArkConfigCrossSliceEdge = {
|
|
193
|
+
from: string;
|
|
194
|
+
to: string;
|
|
195
|
+
};
|
|
196
|
+
type ArkConfigSafety = {
|
|
197
|
+
maxTsSuppressions?: number;
|
|
198
|
+
maxAnyCasts?: number;
|
|
199
|
+
allowInMemory?: boolean;
|
|
200
|
+
allowDisabledPeerIsolation?: boolean;
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* Optional invariant-coverage scan controls. Absence keeps the built-in
|
|
204
|
+
* defaults (test-name heuristic, 400-file budget) and changes no verdict.
|
|
205
|
+
*/
|
|
206
|
+
type ArkConfigCoverage = {
|
|
207
|
+
/** Globs that decide which files count as tests (replaces the name heuristic). */
|
|
208
|
+
testGlobs?: string[];
|
|
209
|
+
/** Max files loaded as coverage evidence before the budget is exhausted. */
|
|
210
|
+
maxFiles?: number;
|
|
211
|
+
/**
|
|
212
|
+
* Path prefixes where this project declares its test runner actually executes
|
|
213
|
+
* tests. ArkGate never runs anything: this is a second declaration to compare
|
|
214
|
+
* the coverage scan against, so a covering test found outside them is reported
|
|
215
|
+
* (INVARIANT_COVERAGE_OUTSIDE_ROOTS) instead of silently certifying the
|
|
216
|
+
* invariant. Absence is silent unless any catalogued invariant is enforced —
|
|
217
|
+
* then missing roots fail closed (INVARIANT_COVERAGE_ROOTS_MISSING).
|
|
218
|
+
*/
|
|
219
|
+
coverageRoots?: string[];
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* ADR 0012 — optional map of layer name → project-relative ArkRules file path.
|
|
223
|
+
* Absence changes no inter-layer verdict.
|
|
224
|
+
*/
|
|
225
|
+
/** One path, or several paths merged into that layer's catalog. */
|
|
226
|
+
type ArkConfigArkRulesRef = string | string[];
|
|
227
|
+
type ArkConfigArkRulesRefs = Record<string, ArkConfigArkRulesRef>;
|
|
228
|
+
/** ADR 0020 — advisory never adds merge teeth; enforced is the extra's merge plane. */
|
|
229
|
+
type ArkConfigArkRunMode = 'advisory' | 'enforced';
|
|
230
|
+
/**
|
|
231
|
+
* ADR 0020 — optional inline ArkRun extra (schema 1.2+). Absence is silent.
|
|
232
|
+
* Present objects are fully defaulted by the loader.
|
|
233
|
+
*/
|
|
234
|
+
type ArkConfigArkRun = {
|
|
235
|
+
mode: ArkConfigArkRunMode;
|
|
236
|
+
compositionRoots: string[];
|
|
237
|
+
kernelRoots?: string[];
|
|
238
|
+
managedLayers: string[];
|
|
239
|
+
requireDeclarations: boolean;
|
|
240
|
+
ignoreDirectNewForErrors?: boolean;
|
|
241
|
+
};
|
|
242
|
+
/** ADR 0027 — advisory never adds merge teeth; enforced is the extra's merge plane. */
|
|
243
|
+
type ArkConfigArkOrderMode = 'advisory' | 'enforced';
|
|
244
|
+
/**
|
|
245
|
+
* ADR 0027 — optional inline ArkOrder extra (schema 1.3+). Absence is silent.
|
|
246
|
+
* Present objects are fully defaulted by the loader.
|
|
247
|
+
*/
|
|
248
|
+
type ArkConfigArkOrder = {
|
|
249
|
+
mode: ArkConfigArkOrderMode;
|
|
250
|
+
planeRoots: string[];
|
|
251
|
+
managedLayers: string[];
|
|
252
|
+
/**
|
|
253
|
+
* Haken cap on one `release()` / `assertXiKeyCap` (default 7).
|
|
254
|
+
* Not a cap on the `xiKeys` watchlist length.
|
|
255
|
+
*/
|
|
256
|
+
maxXiKeys: number;
|
|
257
|
+
/**
|
|
258
|
+
* Slow product keys the team can already name (plan, cost code, protocol).
|
|
259
|
+
* Optional. Empty → `ARKORDER_XI_FIELD_WRITE` stays silent.
|
|
260
|
+
* Repo-wide watchlist — not compared to `maxXiKeys`.
|
|
261
|
+
*/
|
|
262
|
+
xiKeys: string[];
|
|
263
|
+
/**
|
|
264
|
+
* Optional globs that narrow ξ field-write observation inside `managedLayers`.
|
|
265
|
+
* Same glob engine as `layers[].patterns`. Absence or empty → every file in
|
|
266
|
+
* those layers. Non-empty → emit only when the layer is managed AND the file
|
|
267
|
+
* matches at least one glob.
|
|
268
|
+
*/
|
|
269
|
+
appliesTo?: string[];
|
|
270
|
+
};
|
|
271
|
+
type ArkConfig = {
|
|
272
|
+
$schema: string;
|
|
273
|
+
schemaVersion: ArkConfigSchemaVersion;
|
|
274
|
+
name?: string;
|
|
275
|
+
include: string[];
|
|
276
|
+
exclude?: string[];
|
|
277
|
+
excludeGenerated?: boolean;
|
|
278
|
+
frameworkOverlay?: string;
|
|
279
|
+
layers: ArkConfigLayer[];
|
|
280
|
+
rules: ArkConfigRule[];
|
|
281
|
+
cyclePolicy?: ArkConfigCyclePolicy;
|
|
282
|
+
dynamicImportAllowlist?: string[];
|
|
283
|
+
safety?: ArkConfigSafety;
|
|
284
|
+
/**
|
|
285
|
+
* Invariant-coverage scan controls (test globs + file budget).
|
|
286
|
+
* Absence keeps the defaults; it never turns coverage on by itself.
|
|
287
|
+
*/
|
|
288
|
+
coverage?: ArkConfigCoverage;
|
|
289
|
+
/** ADR 0012 — modular ArkRules references (schema 1.1+). */
|
|
290
|
+
arkRules?: ArkConfigArkRulesRefs;
|
|
291
|
+
/** ADR 0020 — optional ArkRun extra (schema 1.2+). Absence changes no Layers/ArkRules verdict. */
|
|
292
|
+
arkRun?: ArkConfigArkRun;
|
|
293
|
+
/** ADR 0027 — optional ArkOrder extra (schema 1.3+). Absence changes no Layers/ArkRules/ArkRun verdict. */
|
|
294
|
+
arkOrder?: ArkConfigArkOrder;
|
|
295
|
+
/**
|
|
296
|
+
* Optional GitHub handles or emails who may loosen the contract or grow the baseline.
|
|
297
|
+
* Metadata — excluded from policy hash. Absence means no steward lock (policy-ack still applies).
|
|
298
|
+
*/
|
|
299
|
+
stewards?: string[];
|
|
300
|
+
/**
|
|
301
|
+
* When true, every non-reserved layer must name `owners`. Absence/false is
|
|
302
|
+
* silent. This flag is policy teeth (stays in policyHash). Owners themselves
|
|
303
|
+
* stay metadata.
|
|
304
|
+
*/
|
|
305
|
+
requireLayerOwners?: boolean;
|
|
306
|
+
};
|
|
307
|
+
/** Original input version when the loader rewrote schemaVersion toward current. */
|
|
308
|
+
type ArkConfigMigratedFrom = 'unversioned' | '1.0' | '1.1' | '1.2' | null;
|
|
309
|
+
type ArkConfigLoadResult = {
|
|
310
|
+
config: ArkConfig;
|
|
311
|
+
migratedFrom: ArkConfigMigratedFrom;
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Architecture layer profiles.
|
|
316
|
+
*
|
|
317
|
+
* A profile turns semantic names such as `Domain.Order.Placed` into governed
|
|
318
|
+
* layer names and dependency rules.
|
|
319
|
+
*/
|
|
320
|
+
|
|
321
|
+
interface ArchitectureLayer {
|
|
322
|
+
name: string;
|
|
323
|
+
prefixes: string[];
|
|
324
|
+
/**
|
|
325
|
+
* Custom matcher for teams whose intent names don't follow prefix conventions.
|
|
326
|
+
* Checked before any prefix matching, in layer declaration order. A layer may
|
|
327
|
+
* use `match` alone (with `prefixes: []`), prefixes alone, or both.
|
|
328
|
+
*/
|
|
329
|
+
match?: (name: string) => boolean;
|
|
330
|
+
description?: string;
|
|
331
|
+
trustBoundary?: 'public' | 'auth' | 'admin' | 'internal';
|
|
332
|
+
owners?: string[];
|
|
333
|
+
order?: number;
|
|
334
|
+
}
|
|
335
|
+
type ArchitectureRule = ArkConfigRule;
|
|
336
|
+
interface ArchitectureProfile {
|
|
337
|
+
name: string;
|
|
338
|
+
layers: ArchitectureLayer[];
|
|
339
|
+
rules: ArchitectureRule[];
|
|
340
|
+
resolveLayer(name: string): string | undefined;
|
|
341
|
+
}
|
|
342
|
+
interface CreateArchitectureProfileOptions {
|
|
343
|
+
name: string;
|
|
344
|
+
layers: ArchitectureLayer[];
|
|
345
|
+
rules?: ArchitectureRule[];
|
|
346
|
+
}
|
|
347
|
+
interface CreateArchitectureProfileFromArkConfigOptions {
|
|
348
|
+
/** Runtime profile name. Default: config.name or "ark.config.json". */
|
|
349
|
+
name?: string;
|
|
350
|
+
}
|
|
351
|
+
type ArchitectureLayerConfig = ArkConfigLayer;
|
|
352
|
+
type ArkCheckConfig = Omit<ArkConfig, '$schema' | 'schemaVersion' | 'rules'> & {
|
|
353
|
+
$schema?: string;
|
|
354
|
+
schemaVersion?: ArkConfig['schemaVersion'];
|
|
355
|
+
rules?: ArchitectureRule[];
|
|
356
|
+
};
|
|
357
|
+
interface CreateElevenLayerArkConfigOptions {
|
|
358
|
+
/** Source root used in generated file patterns. Default: "src". */
|
|
359
|
+
rootDir?: string;
|
|
360
|
+
/** Include entries for ark-check. Default: [rootDir]. */
|
|
361
|
+
include?: string[];
|
|
362
|
+
/** Mark generated layers optional. Default: true. */
|
|
363
|
+
optionalLayers?: boolean;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Dependency Graph types.
|
|
368
|
+
*
|
|
369
|
+
* Used to model declared + observed relationships between intents,
|
|
370
|
+
* and to generate visualizations (Mermaid) and detect violations.
|
|
371
|
+
*/
|
|
372
|
+
|
|
373
|
+
interface GraphEdge {
|
|
374
|
+
from: string;
|
|
375
|
+
to: string;
|
|
376
|
+
kind?: 'declared' | 'observed' | 'produces';
|
|
377
|
+
}
|
|
378
|
+
interface GraphNode {
|
|
379
|
+
id: string;
|
|
380
|
+
kind?: string;
|
|
381
|
+
}
|
|
382
|
+
interface DependencyGraph {
|
|
383
|
+
/**
|
|
384
|
+
* Register a declared dependency between two semantic names.
|
|
385
|
+
*/
|
|
386
|
+
registerDependency(from: string, to: string, kind?: GraphEdge['kind']): void;
|
|
387
|
+
/**
|
|
388
|
+
* Register an observed event flow (producer -> consumer).
|
|
389
|
+
*/
|
|
390
|
+
registerEventFlow(producer: string, consumer: string): void;
|
|
391
|
+
/**
|
|
392
|
+
* Return all nodes.
|
|
393
|
+
*/
|
|
394
|
+
getNodes(): GraphNode[];
|
|
395
|
+
/**
|
|
396
|
+
* Return all edges.
|
|
397
|
+
*/
|
|
398
|
+
getEdges(): GraphEdge[];
|
|
399
|
+
/**
|
|
400
|
+
* Export as JSON.
|
|
401
|
+
*/
|
|
402
|
+
toJSON(): {
|
|
403
|
+
nodes: GraphNode[];
|
|
404
|
+
edges: GraphEdge[];
|
|
405
|
+
};
|
|
406
|
+
/**
|
|
407
|
+
* Export as Mermaid flowchart.
|
|
408
|
+
*/
|
|
409
|
+
toMermaid(): string;
|
|
410
|
+
/**
|
|
411
|
+
* Export as Mermaid flowchart grouped into profile layers.
|
|
412
|
+
*/
|
|
413
|
+
toLayerMermaid(profile: ArchitectureProfile): string;
|
|
414
|
+
/**
|
|
415
|
+
* Detect violations by running provided policies or simple rules.
|
|
416
|
+
* For simplicity here we accept predicates that return violation messages.
|
|
417
|
+
*/
|
|
418
|
+
detectViolations(rules?: Array<(edges: GraphEdge[]) => string[]>): string[];
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Core domain primitives for Ark.
|
|
423
|
+
* These types are the foundation for all governance concepts.
|
|
424
|
+
*/
|
|
425
|
+
/**
|
|
426
|
+
* Semantic intent names follow a convention:
|
|
427
|
+
* - Domain.* for domain events and entities
|
|
428
|
+
* - Application.* for use-cases / orchestration
|
|
429
|
+
* - Adapter.* for integration points
|
|
430
|
+
* - Workflow.* for sagas and processes
|
|
431
|
+
* - Job.* for background jobs and scheduling
|
|
432
|
+
* - Presentation.* for UI/API adapters
|
|
433
|
+
* - Reporting.* for read models and projections
|
|
434
|
+
* - Metadata.* for extensibility contracts
|
|
435
|
+
* - Security.* / Audit.* / Observability.* for cross-cutting kernel concerns
|
|
436
|
+
* - Kernel.* for Ark-owned governance signals
|
|
437
|
+
*/
|
|
438
|
+
type IntentName = `Domain.${string}` | `Application.${string}` | `Adapter.${string}` | `Workflow.${string}` | `Job.${string}` | `Presentation.${string}` | `Reporting.${string}` | `Metadata.${string}` | `Security.${string}` | `Audit.${string}` | `Observability.${string}` | `Kernel.${string}`;
|
|
439
|
+
type CorrelationId = string;
|
|
440
|
+
interface EventMetadata {
|
|
441
|
+
occurredAt: string;
|
|
442
|
+
source: string;
|
|
443
|
+
kernelInstanceId?: string;
|
|
444
|
+
eventVersion?: string;
|
|
445
|
+
schemaVersion?: string;
|
|
446
|
+
allowInterception?: boolean;
|
|
447
|
+
interceptions?: Array<{
|
|
448
|
+
interceptorId: string;
|
|
449
|
+
timestamp: string;
|
|
450
|
+
}>;
|
|
451
|
+
correlationId?: CorrelationId;
|
|
452
|
+
causationId?: string;
|
|
453
|
+
traceId?: string;
|
|
454
|
+
spanId?: string;
|
|
455
|
+
parentSpanId?: string;
|
|
456
|
+
[key: string]: unknown;
|
|
457
|
+
}
|
|
458
|
+
interface DomainEvent<Name extends IntentName = IntentName, Payload = unknown> {
|
|
459
|
+
intent: Name;
|
|
460
|
+
payload: Payload;
|
|
461
|
+
metadata: EventMetadata;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Intent-specific types for the Ark kernel.
|
|
466
|
+
*
|
|
467
|
+
* Intents provide semantic naming for every important concept in the system
|
|
468
|
+
* (domain events, application operations, adapters, workflows).
|
|
469
|
+
*/
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* An IntentCreator is a callable that creates a strongly-typed DomainEvent
|
|
473
|
+
* when invoked with a payload.
|
|
474
|
+
*
|
|
475
|
+
* It also carries the semantic `name`.
|
|
476
|
+
*
|
|
477
|
+
* @example
|
|
478
|
+
* const OrderPlaced = defineIntent<'Domain.Order.OrderPlaced', { orderId: string }>('Domain.Order.OrderPlaced');
|
|
479
|
+
* const event = OrderPlaced({ orderId: 'o-1' });
|
|
480
|
+
*/
|
|
481
|
+
interface IntentCreator<Name extends IntentName, Payload = unknown> {
|
|
482
|
+
/**
|
|
483
|
+
* Creates a DomainEvent for this intent.
|
|
484
|
+
*/
|
|
485
|
+
(payload: Payload): DomainEvent<Name, Payload>;
|
|
486
|
+
/**
|
|
487
|
+
* The fully-qualified semantic name of the intent (e.g. "Domain.Order.OrderPlaced").
|
|
488
|
+
*/
|
|
489
|
+
readonly name: Name;
|
|
490
|
+
}
|
|
491
|
+
/** Kind of relationship between two intents. */
|
|
492
|
+
type IntentRelationshipKind = 'dependsOn' | 'produces';
|
|
493
|
+
/**
|
|
494
|
+
* Relationship declarations between intents.
|
|
495
|
+
* Used for dependency analysis and graph generation.
|
|
496
|
+
*/
|
|
497
|
+
interface IntentRelationship {
|
|
498
|
+
from: string;
|
|
499
|
+
to: string;
|
|
500
|
+
kind: IntentRelationshipKind;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* IntentRegistry
|
|
505
|
+
*
|
|
506
|
+
* Central registry for semantic intents.
|
|
507
|
+
* Supports registration, duplicate prevention, and declared dependency relationships.
|
|
508
|
+
*
|
|
509
|
+
* This is a core building block for governance, dependency graphs, and policy enforcement.
|
|
510
|
+
*/
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Options for declaring relationships when defining an intent.
|
|
514
|
+
*/
|
|
515
|
+
interface DefineIntentOptions {
|
|
516
|
+
/** Other intents this one depends on (semantic names) */
|
|
517
|
+
dependsOn?: IntentName[];
|
|
518
|
+
/** Intents that this one produces / triggers */
|
|
519
|
+
produces?: IntentName[];
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* IntentRegistry manages all registered intents and their declared relationships.
|
|
523
|
+
*/
|
|
524
|
+
declare class IntentRegistry {
|
|
525
|
+
private readonly intents;
|
|
526
|
+
private readonly dependencies;
|
|
527
|
+
private readonly productions;
|
|
528
|
+
/**
|
|
529
|
+
* Define/register a new intent.
|
|
530
|
+
*
|
|
531
|
+
* @param name - Semantic intent name following the convention (Domain.*, Application.*, etc.)
|
|
532
|
+
* @param options - Optional relationship declarations
|
|
533
|
+
* @throws Error if an intent with the same name is already registered
|
|
534
|
+
*/
|
|
535
|
+
define<N extends IntentName, P = unknown>(name: N, options?: DefineIntentOptions): IntentCreator<N, P>;
|
|
536
|
+
/**
|
|
537
|
+
* Declare that one intent depends on / relates to another.
|
|
538
|
+
* This information is used by the DependencyGraph (future iterations) and for policy checks.
|
|
539
|
+
*
|
|
540
|
+
* @param from - The source intent (e.g. an Application operation)
|
|
541
|
+
* @param to - The target intent it depends on (e.g. a Domain event or concept)
|
|
542
|
+
*/
|
|
543
|
+
declareDependency(from: string, to: string): void;
|
|
544
|
+
/**
|
|
545
|
+
* Declare that one intent produces / emits another (e.g. use case → domain event).
|
|
546
|
+
*/
|
|
547
|
+
declareProduction(from: string, to: string): void;
|
|
548
|
+
/**
|
|
549
|
+
* Retrieve a previously defined intent creator by name.
|
|
550
|
+
*/
|
|
551
|
+
get<N extends IntentName = IntentName, P = unknown>(name: string): IntentCreator<N, P> | undefined;
|
|
552
|
+
/**
|
|
553
|
+
* List all registered intent creators.
|
|
554
|
+
*/
|
|
555
|
+
list(): IntentCreator<IntentName, unknown>[];
|
|
556
|
+
/**
|
|
557
|
+
* Get all declared dependencies for a given intent.
|
|
558
|
+
*/
|
|
559
|
+
getDependencies(intentName: string): string[];
|
|
560
|
+
/**
|
|
561
|
+
* Get all intents produced / emitted by a given intent.
|
|
562
|
+
*/
|
|
563
|
+
getProductions(intentName: string): string[];
|
|
564
|
+
/**
|
|
565
|
+
* Get all declared relationships (useful for graph generation).
|
|
566
|
+
*/
|
|
567
|
+
getAllRelationships(): IntentRelationship[];
|
|
568
|
+
/**
|
|
569
|
+
* Check if an intent name has been registered.
|
|
570
|
+
*/
|
|
571
|
+
has(name: string): boolean;
|
|
572
|
+
/**
|
|
573
|
+
* Clear the registry. Primarily useful for tests.
|
|
574
|
+
*/
|
|
575
|
+
clear(): void;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
type EventSchemaFieldType = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'unknown';
|
|
579
|
+
interface EventSchemaField {
|
|
580
|
+
type: EventSchemaFieldType;
|
|
581
|
+
required?: boolean;
|
|
582
|
+
description?: string;
|
|
583
|
+
/** Allowed literal values for this field. Compared with Object.is. */
|
|
584
|
+
enum?: unknown[];
|
|
585
|
+
/** Nested object fields when type is "object". */
|
|
586
|
+
fields?: EventPayloadSchema;
|
|
587
|
+
/** Array item schema when type is "array". */
|
|
588
|
+
items?: EventSchemaField;
|
|
589
|
+
}
|
|
590
|
+
type EventPayloadSchema = Record<string, EventSchemaField>;
|
|
591
|
+
/**
|
|
592
|
+
* Minimal Standard Schema interface (https://standardschema.dev).
|
|
593
|
+
* Any zod/valibot/arktype (or other spec-compliant) schema satisfies this,
|
|
594
|
+
* so Ark stays zero-dependency while accepting the validators you already use.
|
|
595
|
+
*/
|
|
596
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
597
|
+
readonly '~standard': {
|
|
598
|
+
readonly version: 1;
|
|
599
|
+
readonly vendor: string;
|
|
600
|
+
readonly validate: (value: unknown) => StandardSchemaResult<Output> | Promise<StandardSchemaResult<Output>>;
|
|
601
|
+
readonly types?: {
|
|
602
|
+
readonly input: Input;
|
|
603
|
+
readonly output: Output;
|
|
604
|
+
} | undefined;
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
type StandardSchemaResult<Output> = {
|
|
608
|
+
readonly value: Output;
|
|
609
|
+
readonly issues?: undefined;
|
|
610
|
+
} | {
|
|
611
|
+
readonly issues: ReadonlyArray<StandardSchemaIssue>;
|
|
612
|
+
};
|
|
613
|
+
interface StandardSchemaIssue {
|
|
614
|
+
readonly message: string;
|
|
615
|
+
readonly path?: ReadonlyArray<PropertyKey | {
|
|
616
|
+
readonly key: PropertyKey;
|
|
617
|
+
}> | undefined;
|
|
618
|
+
}
|
|
619
|
+
interface EventContract {
|
|
620
|
+
intent: IntentName;
|
|
621
|
+
version: string;
|
|
622
|
+
schema?: EventPayloadSchema;
|
|
623
|
+
/**
|
|
624
|
+
* A Standard Schema validator (zod, valibot, arktype, ...) for the payload.
|
|
625
|
+
* Runs in addition to `schema` when both are present. Must validate
|
|
626
|
+
* synchronously — async validators produce a contract issue.
|
|
627
|
+
*/
|
|
628
|
+
standardSchema?: StandardSchemaV1;
|
|
629
|
+
owner?: string;
|
|
630
|
+
rationale?: string;
|
|
631
|
+
deprecated?: boolean | string;
|
|
632
|
+
allowAdditionalFields?: boolean;
|
|
633
|
+
}
|
|
634
|
+
interface EventContractIssue {
|
|
635
|
+
intent: string;
|
|
636
|
+
version?: string;
|
|
637
|
+
field?: string;
|
|
638
|
+
message: string;
|
|
639
|
+
}
|
|
640
|
+
interface EventContractValidationResult {
|
|
641
|
+
ok: boolean;
|
|
642
|
+
contract?: EventContract;
|
|
643
|
+
issues: EventContractIssue[];
|
|
644
|
+
}
|
|
645
|
+
interface EventContractRegistry {
|
|
646
|
+
register(contract: EventContract): void;
|
|
647
|
+
get(intent: string, version?: string): EventContract | undefined;
|
|
648
|
+
list(intent?: string): EventContract[];
|
|
649
|
+
validate(event: DomainEvent): EventContractValidationResult;
|
|
650
|
+
clear(): void;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Metadata System (basic) for extensibility.
|
|
655
|
+
*
|
|
656
|
+
* Allows declaring entities, fields and simple rules/behaviors as data.
|
|
657
|
+
* This can be used by tools, codegen, or AI to understand the domain without hardcoding.
|
|
658
|
+
*/
|
|
659
|
+
interface FieldMeta {
|
|
660
|
+
type: string;
|
|
661
|
+
identity?: boolean;
|
|
662
|
+
required?: boolean;
|
|
663
|
+
description?: string;
|
|
664
|
+
relation?: {
|
|
665
|
+
entity: string;
|
|
666
|
+
kind?: 'one' | 'many';
|
|
667
|
+
};
|
|
668
|
+
readonly?: boolean;
|
|
669
|
+
deprecated?: boolean | string;
|
|
670
|
+
tags?: string[];
|
|
671
|
+
[key: string]: unknown;
|
|
672
|
+
}
|
|
673
|
+
interface EntityRuleMeta {
|
|
674
|
+
name: string;
|
|
675
|
+
description?: string;
|
|
676
|
+
severity?: 'hard' | 'soft';
|
|
677
|
+
}
|
|
678
|
+
interface EntityMeta {
|
|
679
|
+
name: string;
|
|
680
|
+
version?: string;
|
|
681
|
+
owner?: string;
|
|
682
|
+
layer?: string;
|
|
683
|
+
tags?: string[];
|
|
684
|
+
fields: Record<string, FieldMeta>;
|
|
685
|
+
rules?: EntityRuleMeta[];
|
|
686
|
+
/** Intent names this entity emits (domain events). */
|
|
687
|
+
emits?: string[];
|
|
688
|
+
/** Intent names this entity consumes / reacts to. */
|
|
689
|
+
consumes?: string[];
|
|
690
|
+
/** Read-model or projection names that derive from this entity. */
|
|
691
|
+
projections?: string[];
|
|
692
|
+
deprecated?: boolean | string;
|
|
693
|
+
[key: string]: unknown;
|
|
694
|
+
}
|
|
695
|
+
interface MetadataRegistrationOptions {
|
|
696
|
+
allowOverwrite?: boolean;
|
|
697
|
+
}
|
|
698
|
+
interface MetadataIssue {
|
|
699
|
+
entity: string;
|
|
700
|
+
field?: string;
|
|
701
|
+
message: string;
|
|
702
|
+
}
|
|
703
|
+
interface MetadataValidationResult {
|
|
704
|
+
ok: boolean;
|
|
705
|
+
issues: MetadataIssue[];
|
|
706
|
+
}
|
|
707
|
+
interface MetadataRegistry {
|
|
708
|
+
entity(name: string, meta: Omit<EntityMeta, 'name'>, options?: MetadataRegistrationOptions): EntityMeta;
|
|
709
|
+
getEntity(name: string): EntityMeta | undefined;
|
|
710
|
+
listEntities(): EntityMeta[];
|
|
711
|
+
findEntitiesByIntent(intentName: string): EntityMeta[];
|
|
712
|
+
validate(): MetadataValidationResult;
|
|
713
|
+
toJSON(): EntityMeta[];
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
interface ProjectionDefinition<State = unknown> {
|
|
717
|
+
name: string;
|
|
718
|
+
sourceIntents: IntentName[];
|
|
719
|
+
initialState: State | (() => State);
|
|
720
|
+
project(event: DomainEvent<IntentName, unknown>, state: State): MaybePromise<State>;
|
|
721
|
+
}
|
|
722
|
+
interface ProjectionCheckpoint {
|
|
723
|
+
projection: string;
|
|
724
|
+
appliedCount: number;
|
|
725
|
+
lastIntent?: string;
|
|
726
|
+
lastCorrelationId?: string;
|
|
727
|
+
updatedAt?: string;
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Pluggable projection/read-model state.
|
|
731
|
+
*
|
|
732
|
+
* **Durability stance (R9):** Default `InMemoryReadModelStore` is reference-only (not
|
|
733
|
+
* production durability). Inject a durable store for production. See
|
|
734
|
+
* `docs/production-hardening.md`.
|
|
735
|
+
*/
|
|
736
|
+
interface ReadModelStore {
|
|
737
|
+
load<State = unknown>(name: string): MaybePromise<State | undefined>;
|
|
738
|
+
save<State = unknown>(name: string, state: State): MaybePromise<void>;
|
|
739
|
+
clear(name?: string): MaybePromise<void>;
|
|
740
|
+
}
|
|
741
|
+
interface ProjectionRegistry {
|
|
742
|
+
register<State>(definition: ProjectionDefinition<State>): void;
|
|
743
|
+
list(): ProjectionDefinition[];
|
|
744
|
+
apply(event: DomainEvent<IntentName, unknown>): Promise<string[]>;
|
|
745
|
+
getState<State = unknown>(name: string): Promise<State | undefined>;
|
|
746
|
+
getCheckpoint(name: string): ProjectionCheckpoint | undefined;
|
|
747
|
+
getCheckpoints(): ProjectionCheckpoint[];
|
|
748
|
+
clear(): Promise<void>;
|
|
749
|
+
}
|
|
750
|
+
interface CreateProjectionRegistryOptions {
|
|
751
|
+
store?: ReadModelStore;
|
|
752
|
+
auditTrail?: AuditTrail;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Policy types for the Ark kernel.
|
|
757
|
+
*
|
|
758
|
+
* Policies allow declaring architectural rules that can be checked at runtime.
|
|
759
|
+
* Supports both hard policies (must never be violated) and soft policies (warnings).
|
|
760
|
+
*/
|
|
761
|
+
type PolicySeverity = 'hard' | 'soft';
|
|
762
|
+
type PolicyEnforcementMode = 'runtime' | 'static' | 'runtime-and-static' | 'advisory';
|
|
763
|
+
/**
|
|
764
|
+
* Represents a single violation of a policy.
|
|
765
|
+
*/
|
|
766
|
+
interface PolicyViolation {
|
|
767
|
+
/** Name of the policy that was violated */
|
|
768
|
+
policyName: string;
|
|
769
|
+
/** Severity level of the policy */
|
|
770
|
+
severity: PolicySeverity;
|
|
771
|
+
/** Human-readable explanation of the violation */
|
|
772
|
+
message: string;
|
|
773
|
+
/** Optional additional structured details */
|
|
774
|
+
details?: unknown;
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* A Policy defines a rule that can be evaluated against a context.
|
|
778
|
+
*
|
|
779
|
+
* @template Context - The shape of data the policy evaluates (e.g. { registry, events })
|
|
780
|
+
*/
|
|
781
|
+
interface Policy<Context = unknown> {
|
|
782
|
+
/** Unique name of the policy (used in violations and reporting) */
|
|
783
|
+
readonly name: string;
|
|
784
|
+
/** Whether this is a hard rule (enforced strictly) or soft (advisory) */
|
|
785
|
+
readonly severity: PolicySeverity;
|
|
786
|
+
/** Optional tags for policy classification (e.g. 'layer', 'naming') */
|
|
787
|
+
readonly tags?: readonly string[];
|
|
788
|
+
readonly owner?: string;
|
|
789
|
+
readonly version?: string;
|
|
790
|
+
readonly rationale?: string;
|
|
791
|
+
readonly enforcementMode?: PolicyEnforcementMode;
|
|
792
|
+
readonly deprecated?: boolean | string;
|
|
793
|
+
readonly replacedBy?: string;
|
|
794
|
+
/**
|
|
795
|
+
* Evaluates the policy against the given context.
|
|
796
|
+
* Return true / [] for pass, false / single violation / array for failure.
|
|
797
|
+
*/
|
|
798
|
+
check(context: Context): boolean | PolicyViolation | PolicyViolation[];
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* PolicyEngine
|
|
803
|
+
*
|
|
804
|
+
* Evaluates collections of policies against a context.
|
|
805
|
+
* Supports hard and soft policies.
|
|
806
|
+
* - Hard policies: violations cause enforcement to throw.
|
|
807
|
+
* - Soft policies: violations are reported as warnings but do not throw.
|
|
808
|
+
*/
|
|
809
|
+
|
|
810
|
+
interface PolicyEvaluationResult {
|
|
811
|
+
passed: boolean;
|
|
812
|
+
violations: PolicyViolation[];
|
|
813
|
+
hardViolations: PolicyViolation[];
|
|
814
|
+
softViolations: PolicyViolation[];
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* The PolicyEngine is responsible for registering policies and evaluating
|
|
818
|
+
* them against a given context.
|
|
819
|
+
*/
|
|
820
|
+
declare class PolicyEngine<Context = unknown> {
|
|
821
|
+
private readonly policies;
|
|
822
|
+
constructor(initialPolicies?: Policy<Context>[]);
|
|
823
|
+
/**
|
|
824
|
+
* Adds a policy to the engine.
|
|
825
|
+
*/
|
|
826
|
+
add(policy: Policy<Context>): void;
|
|
827
|
+
/**
|
|
828
|
+
* Returns all registered policies.
|
|
829
|
+
*/
|
|
830
|
+
getPolicies(): Policy<Context>[];
|
|
831
|
+
/**
|
|
832
|
+
* Evaluates all policies against the provided context.
|
|
833
|
+
*/
|
|
834
|
+
evaluate(context: Context): PolicyEvaluationResult;
|
|
835
|
+
/**
|
|
836
|
+
* Enforces all policies.
|
|
837
|
+
*
|
|
838
|
+
* - Soft violations are collected and can be observed (returned or logged).
|
|
839
|
+
* - Hard violations cause an error to be thrown (by default).
|
|
840
|
+
*
|
|
841
|
+
* @returns Evaluation result (including any soft violations)
|
|
842
|
+
* @throws Error if any hard policy is violated
|
|
843
|
+
*/
|
|
844
|
+
enforce(context: Context): PolicyEvaluationResult;
|
|
845
|
+
/**
|
|
846
|
+
* Clears all registered policies.
|
|
847
|
+
*/
|
|
848
|
+
clear(): void;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
type EventBufferStatus = 'pending' | 'dispatched' | 'failed';
|
|
852
|
+
interface EventBufferRecord {
|
|
853
|
+
id: string;
|
|
854
|
+
event: DomainEvent;
|
|
855
|
+
status: EventBufferStatus;
|
|
856
|
+
attempts: number;
|
|
857
|
+
createdAt: string;
|
|
858
|
+
updatedAt: string;
|
|
859
|
+
error?: string;
|
|
860
|
+
ownerId?: string;
|
|
861
|
+
expiresAt?: string;
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* Pluggable transactional event buffer for publish handoff (Outbox pattern).
|
|
865
|
+
*
|
|
866
|
+
* Provides agnostic primitives (tx parameter, claim leases) to allow production implementations
|
|
867
|
+
* to safely handle concurrency, atomic handoffs, and background processing.
|
|
868
|
+
*
|
|
869
|
+
* **Durability stance (R9):** ArkGate ships only a reference in-process store
|
|
870
|
+
* (`InMemoryEventBuffer`) for tests, demos, and single-process development — it does
|
|
871
|
+
* not survive process restarts and is **not production durability**. Inject your own
|
|
872
|
+
* for a transactional outbox. See `docs/production-hardening.md`.
|
|
873
|
+
*/
|
|
874
|
+
interface EventBufferStore {
|
|
875
|
+
enqueue(event: DomainEvent, tx?: unknown): Promise<EventBufferRecord>;
|
|
876
|
+
claim?(workerId: string, timeoutMs: number): Promise<EventBufferRecord | undefined>;
|
|
877
|
+
markDispatched(id: string, tx?: unknown): Promise<void>;
|
|
878
|
+
markFailed(id: string, error: unknown, tx?: unknown): Promise<void>;
|
|
879
|
+
list(status?: EventBufferStatus): Promise<EventBufferRecord[]>;
|
|
880
|
+
clear(): Promise<void>;
|
|
881
|
+
}
|
|
882
|
+
/** @deprecated Use EventBufferStatus. */
|
|
883
|
+
type OutboxStatus = EventBufferStatus;
|
|
884
|
+
/** @deprecated Use EventBufferRecord. */
|
|
885
|
+
type OutboxRecord = EventBufferRecord;
|
|
886
|
+
/** @deprecated Use EventBufferStore. */
|
|
887
|
+
type OutboxStore = EventBufferStore;
|
|
888
|
+
|
|
889
|
+
/**
|
|
890
|
+
* Event Bus types for the Ark kernel.
|
|
891
|
+
*
|
|
892
|
+
* The Event Bus is the central nervous system for Domain Events.
|
|
893
|
+
* It provides publish/subscribe, history for observability, and metadata handling.
|
|
894
|
+
*/
|
|
895
|
+
|
|
896
|
+
/** Standard trace record for observability and agent consumption. */
|
|
897
|
+
type TraceRecordType = 'event.published' | 'event.rawPublish' | 'event.handoffFailed' | 'event.intercepted' | 'interceptor.error' | 'policy.hardViolation' | 'policy.softViolation' | 'layer.observedViolation' | 'handler.error' | 'hook.error';
|
|
898
|
+
/**
|
|
899
|
+
* Runtime enforcement mode for observed producer→event layer flows.
|
|
900
|
+
* - 'off': flows are recorded (for drift reports) but never enforced.
|
|
901
|
+
* - 'soft': a `layer.observedViolation` trace + audit record is emitted; publish proceeds.
|
|
902
|
+
* - 'hard': publish throws `ObservedLayerFlowViolationError` before the event reaches
|
|
903
|
+
* history, outbox, or subscribers.
|
|
904
|
+
*/
|
|
905
|
+
type ObservedLayerFlowMode = 'off' | 'soft' | 'hard';
|
|
906
|
+
interface TraceRecord {
|
|
907
|
+
type: TraceRecordType;
|
|
908
|
+
timestamp: string;
|
|
909
|
+
intent: string;
|
|
910
|
+
correlationId?: string;
|
|
911
|
+
traceId?: string;
|
|
912
|
+
spanId?: string;
|
|
913
|
+
details?: unknown;
|
|
914
|
+
}
|
|
915
|
+
type TraceSink = (record: TraceRecord) => void;
|
|
916
|
+
/**
|
|
917
|
+
* Options when creating an EventBus.
|
|
918
|
+
*/
|
|
919
|
+
interface EventBusOptions<Context = unknown> {
|
|
920
|
+
/** Optional hook called after every successful publish */
|
|
921
|
+
onPublish?: (event: DomainEvent) => void | Promise<void>;
|
|
922
|
+
/** Native audit trail used to persist publish, policy, and handler events. */
|
|
923
|
+
auditTrail?: AuditTrail;
|
|
924
|
+
/** Event contracts used to validate payload shape and event versions. */
|
|
925
|
+
eventContracts?: EventContractRegistry;
|
|
926
|
+
/** When true, events without a registered contract are rejected. */
|
|
927
|
+
strictEventContracts?: boolean;
|
|
928
|
+
/** When true, metadata.source must be explicit and not "unknown". */
|
|
929
|
+
requireKnownSource?: boolean;
|
|
930
|
+
/**
|
|
931
|
+
* Architecture profile used to enforce the OBSERVED producer→event layer flow at
|
|
932
|
+
* publish time. Required for `enforceObservedLayerFlow` to have effect.
|
|
933
|
+
*/
|
|
934
|
+
architectureProfile?: ArchitectureProfile;
|
|
935
|
+
/**
|
|
936
|
+
* Enforce each published event's real producer→event flow (metadata.source → intent)
|
|
937
|
+
* against `architectureProfile` layer rules at runtime. Unlike the declared-model layer
|
|
938
|
+
* policy, this checks what the system actually did. Default: 'off'.
|
|
939
|
+
*/
|
|
940
|
+
enforceObservedLayerFlow?: ObservedLayerFlowMode;
|
|
941
|
+
/** Optional non-atomic event buffer for dispatch handoff. */
|
|
942
|
+
eventBuffer?: EventBufferStore;
|
|
943
|
+
/**
|
|
944
|
+
* When true, the event-buffer record written for a publish is marked
|
|
945
|
+
* `dispatched` once local delivery finishes (handlers + onPublish), or `failed`
|
|
946
|
+
* when a rethrown handler error aborts it. Use only when no external relay
|
|
947
|
+
* drains the buffer. Default: false — records stay `pending` for a
|
|
948
|
+
* consumer-owned relay (`claim` / `markDispatched`). `createArkKernel` turns
|
|
949
|
+
* this on for its default in-memory buffer only.
|
|
950
|
+
*/
|
|
951
|
+
settleBufferOnLocalDelivery?: boolean;
|
|
952
|
+
/** @deprecated Use eventBuffer. */
|
|
953
|
+
outbox?: EventBufferStore;
|
|
954
|
+
/** Stable id stamped into event metadata for this kernel/event bus instance. */
|
|
955
|
+
instanceId?: string;
|
|
956
|
+
/** Lightweight tracing hooks for OpenTelemetry or custom tracer bridges. */
|
|
957
|
+
traceSinks?: TraceSink[];
|
|
958
|
+
/** Called when soft policies produce violations (publish still proceeds). */
|
|
959
|
+
onSoftViolation?: (result: PolicyEvaluationResult, event: DomainEvent) => void | Promise<void>;
|
|
960
|
+
/** Called when a subscriber handler throws or rejects. */
|
|
961
|
+
onHandlerError?: (error: unknown, event: DomainEvent, intentName: string) => void | Promise<void>;
|
|
962
|
+
/** When true, rethrow handler errors after calling onHandlerError. Default: false. */
|
|
963
|
+
rethrowHandlerErrors?: boolean;
|
|
964
|
+
/**
|
|
965
|
+
* Policies to evaluate on every publish.
|
|
966
|
+
* If provided, they run before subscribers are notified.
|
|
967
|
+
* Hard violations will cause publish to throw.
|
|
968
|
+
*/
|
|
969
|
+
policies?: Policy<Context>[];
|
|
970
|
+
/**
|
|
971
|
+
* Function to build the context object passed to policies for a given event.
|
|
972
|
+
* Default: { event }, or { event, relationships, edges } when registry/graph provided.
|
|
973
|
+
*/
|
|
974
|
+
getPolicyContext?: (event: DomainEvent) => Context;
|
|
975
|
+
/**
|
|
976
|
+
* Intent registry whose relationships are injected into the default policy context.
|
|
977
|
+
* Enables layer policies (e.g. architecturalPolicies.layerIsolation) on publish.
|
|
978
|
+
*/
|
|
979
|
+
intentRegistry?: IntentRegistry;
|
|
980
|
+
/**
|
|
981
|
+
* Dependency graph whose edges are injected into the default policy context.
|
|
982
|
+
*/
|
|
983
|
+
dependencyGraph?: DependencyGraph;
|
|
984
|
+
/**
|
|
985
|
+
* Pre-configured PolicyEngine to use (alternative to policies array).
|
|
986
|
+
*/
|
|
987
|
+
policyEngine?: PolicyEngine<Context>;
|
|
988
|
+
/**
|
|
989
|
+
* Maximum publish history entries to retain. Oldest evicted when exceeded.
|
|
990
|
+
* Default: unlimited.
|
|
991
|
+
*/
|
|
992
|
+
maxHistorySize?: number;
|
|
993
|
+
/**
|
|
994
|
+
* When true (default: true if intentRegistry is provided), reject publish/subscribe
|
|
995
|
+
* for intents not registered in intentRegistry and optionally validate naming.
|
|
996
|
+
*/
|
|
997
|
+
strictRegistry?: boolean;
|
|
998
|
+
/**
|
|
999
|
+
* When true (default: matches strictRegistry), validate intent names follow
|
|
1000
|
+
* Domain.* / Application.* / Adapter.* / Workflow.* conventions at runtime.
|
|
1001
|
+
*/
|
|
1002
|
+
validateIntentNaming?: boolean;
|
|
1003
|
+
}
|
|
1004
|
+
/**
|
|
1005
|
+
* A subscriber is a function that receives events of a specific intent.
|
|
1006
|
+
*/
|
|
1007
|
+
type EventHandler<N extends IntentName, P = unknown> = (event: DomainEvent<N, P>) => void | Promise<void>;
|
|
1008
|
+
type EventPayloadPatch = Record<string, unknown> | unknown[];
|
|
1009
|
+
interface EventInterceptorContext<N extends IntentName = IntentName, P = unknown> {
|
|
1010
|
+
readonly event: Readonly<DomainEvent<N, P>>;
|
|
1011
|
+
intercept(patch: EventPayloadPatch): void;
|
|
1012
|
+
}
|
|
1013
|
+
type EventInterceptor<N extends IntentName = IntentName, P = unknown> = (context: EventInterceptorContext<N, P>) => void | Promise<void>;
|
|
1014
|
+
interface EventInterceptionInfo {
|
|
1015
|
+
registrationId: string;
|
|
1016
|
+
interceptorId: string;
|
|
1017
|
+
intent: string;
|
|
1018
|
+
createdAt: string;
|
|
1019
|
+
lastInterceptedAt?: string;
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Unsubscribe function returned by subscribe.
|
|
1023
|
+
*/
|
|
1024
|
+
type Unsubscribe = () => void;
|
|
1025
|
+
/**
|
|
1026
|
+
* Record of a published event for observability.
|
|
1027
|
+
*/
|
|
1028
|
+
interface PublishedEventRecord {
|
|
1029
|
+
event: DomainEvent;
|
|
1030
|
+
publishedAt: string;
|
|
1031
|
+
subscribersNotified: number;
|
|
1032
|
+
}
|
|
1033
|
+
interface EventPublisher {
|
|
1034
|
+
readonly source: string;
|
|
1035
|
+
publish<N extends IntentName, P>(intent: IntentCreator<N, P>, payload: P, metadata?: Partial<EventMetadata>, control?: EventDispatchControl): Promise<void>;
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* Internal dispatch control for ArkRun send ports.
|
|
1039
|
+
* `publish()` keeps historical defaults (notify + await handlers).
|
|
1040
|
+
*/
|
|
1041
|
+
interface EventDispatchControl {
|
|
1042
|
+
notifySubscribers?: boolean;
|
|
1043
|
+
awaitHandlers?: boolean;
|
|
1044
|
+
runOnPublish?: boolean;
|
|
1045
|
+
tx?: unknown;
|
|
1046
|
+
/**
|
|
1047
|
+
* When false, skip local-delivery settlement of the buffer record even if the
|
|
1048
|
+
* bus settles on local delivery (the caller owns the outcome, e.g. a broker
|
|
1049
|
+
* handoff). Default: the bus `settleBufferOnLocalDelivery` option.
|
|
1050
|
+
*/
|
|
1051
|
+
settleBufferOnLocalDelivery?: boolean;
|
|
1052
|
+
/** Receives the event-buffer record written for this publish, when any. */
|
|
1053
|
+
onBufferRecord?: (record: EventBufferRecord) => void;
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* The public EventBus interface.
|
|
1057
|
+
*/
|
|
1058
|
+
interface EventBus {
|
|
1059
|
+
/**
|
|
1060
|
+
* Publish an event.
|
|
1061
|
+
* Accepts either a pre-built DomainEvent or an IntentCreator + payload (plus optional metadata).
|
|
1062
|
+
*/
|
|
1063
|
+
publish<N extends IntentName, P>(eventOrCreator: DomainEvent<N, P> | IntentCreator<N, P>, payloadOrMeta?: P | Partial<EventMetadata>, metadata?: Partial<EventMetadata>, control?: EventDispatchControl): Promise<void>;
|
|
1064
|
+
/**
|
|
1065
|
+
* Create a source-bound publisher capability. The returned publisher stamps
|
|
1066
|
+
* metadata.source internally and rejects attempts to publish as another source.
|
|
1067
|
+
*/
|
|
1068
|
+
createPublisher<N extends IntentName, P>(source: N | IntentCreator<N, P>): EventPublisher;
|
|
1069
|
+
/**
|
|
1070
|
+
* Subscribe to events for a specific intent (by name or creator).
|
|
1071
|
+
* Returns an unsubscribe function.
|
|
1072
|
+
*/
|
|
1073
|
+
subscribe<N extends IntentName, P>(intent: N | IntentCreator<N, P>, handler: EventHandler<N, P>): Unsubscribe;
|
|
1074
|
+
/**
|
|
1075
|
+
* Register an add-only interceptor for one intent.
|
|
1076
|
+
* Interceptors may enrich payloads, but cannot overwrite existing payload fields.
|
|
1077
|
+
*/
|
|
1078
|
+
registerInterceptor<N extends IntentName, P>(intent: N | IntentCreator<N, P>, interceptor: EventInterceptor<N, P>, interceptorId?: string): string;
|
|
1079
|
+
/**
|
|
1080
|
+
* Remove a registered interceptor by registration id.
|
|
1081
|
+
*/
|
|
1082
|
+
unregisterInterceptor(registrationId: string): boolean;
|
|
1083
|
+
/**
|
|
1084
|
+
* List registered interceptors.
|
|
1085
|
+
*/
|
|
1086
|
+
listInterceptors(intent?: string): EventInterceptionInfo[];
|
|
1087
|
+
/**
|
|
1088
|
+
* Returns the history of published events (for observability and testing).
|
|
1089
|
+
*/
|
|
1090
|
+
getHistory(): PublishedEventRecord[];
|
|
1091
|
+
/**
|
|
1092
|
+
* Clears publish history (useful in tests).
|
|
1093
|
+
*/
|
|
1094
|
+
clearHistory(): void;
|
|
1095
|
+
/**
|
|
1096
|
+
* Returns the observability trace (publish, soft violations, handler errors).
|
|
1097
|
+
*/
|
|
1098
|
+
getTrace(): TraceRecord[];
|
|
1099
|
+
/**
|
|
1100
|
+
* Clears the observability trace.
|
|
1101
|
+
*/
|
|
1102
|
+
clearTrace(): void;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
interface ObservabilityFlow {
|
|
1106
|
+
from: string;
|
|
1107
|
+
to: string;
|
|
1108
|
+
}
|
|
1109
|
+
interface ObservabilityDriftReport {
|
|
1110
|
+
generatedAt: string;
|
|
1111
|
+
declaredProductions: ObservabilityFlow[];
|
|
1112
|
+
observedProductions: ObservabilityFlow[];
|
|
1113
|
+
declaredButUnobserved: ObservabilityFlow[];
|
|
1114
|
+
observedButUndeclared: ObservabilityFlow[];
|
|
1115
|
+
unknownSources: ObservabilityFlow[];
|
|
1116
|
+
unregisteredObservedSources: string[];
|
|
1117
|
+
unregisteredObservedIntents: string[];
|
|
1118
|
+
registeredButNeverObserved: string[];
|
|
1119
|
+
}
|
|
1120
|
+
interface ObservabilityReporter {
|
|
1121
|
+
report(): ObservabilityDriftReport;
|
|
1122
|
+
}
|
|
1123
|
+
interface CreateObservabilityReporterOptions {
|
|
1124
|
+
registry?: IntentRegistry;
|
|
1125
|
+
eventBus?: EventBus;
|
|
1126
|
+
graph?: DependencyGraph;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* Machine-readable manifest types for agent and tooling consumption.
|
|
1131
|
+
*/
|
|
1132
|
+
|
|
1133
|
+
interface ArkManifestIntent {
|
|
1134
|
+
name: string;
|
|
1135
|
+
dependencies: string[];
|
|
1136
|
+
productions: string[];
|
|
1137
|
+
}
|
|
1138
|
+
interface ArkManifestPolicy {
|
|
1139
|
+
/** Stable slug for agents (derived from policy name). */
|
|
1140
|
+
id: string;
|
|
1141
|
+
name: string;
|
|
1142
|
+
severity: 'hard' | 'soft';
|
|
1143
|
+
tags?: string[];
|
|
1144
|
+
description?: string;
|
|
1145
|
+
owner?: string;
|
|
1146
|
+
version?: string;
|
|
1147
|
+
rationale?: string;
|
|
1148
|
+
enforcementMode?: PolicyEnforcementMode;
|
|
1149
|
+
deprecated?: boolean | string;
|
|
1150
|
+
replacedBy?: string;
|
|
1151
|
+
}
|
|
1152
|
+
interface ArkManifestEntityLink {
|
|
1153
|
+
entity: string;
|
|
1154
|
+
emits?: string[];
|
|
1155
|
+
consumes?: string[];
|
|
1156
|
+
}
|
|
1157
|
+
interface ArkManifestGraph {
|
|
1158
|
+
nodes: GraphNode[];
|
|
1159
|
+
edges: GraphEdge[];
|
|
1160
|
+
}
|
|
1161
|
+
interface ArkManifestArchitecture {
|
|
1162
|
+
profile: string;
|
|
1163
|
+
layers: ArchitectureLayer[];
|
|
1164
|
+
rules: ArchitectureRule[];
|
|
1165
|
+
}
|
|
1166
|
+
interface ArkManifestProjection {
|
|
1167
|
+
name: string;
|
|
1168
|
+
sourceIntents: string[];
|
|
1169
|
+
checkpoint?: ProjectionCheckpoint;
|
|
1170
|
+
}
|
|
1171
|
+
interface ArkManifestData {
|
|
1172
|
+
/** Manifest schema version for agent/tooling compatibility. */
|
|
1173
|
+
schemaVersion: string;
|
|
1174
|
+
version: string;
|
|
1175
|
+
exportedAt: string;
|
|
1176
|
+
intents: ArkManifestIntent[];
|
|
1177
|
+
relationships: IntentRelationship[];
|
|
1178
|
+
policies: ArkManifestPolicy[];
|
|
1179
|
+
entities: EntityMeta[];
|
|
1180
|
+
graph: ArkManifestGraph;
|
|
1181
|
+
architecture?: ArkManifestArchitecture;
|
|
1182
|
+
projections: ArkManifestProjection[];
|
|
1183
|
+
eventContracts: EventContract[];
|
|
1184
|
+
observability?: ObservabilityDriftReport;
|
|
1185
|
+
/** Cross-registry links for agent contract discovery. */
|
|
1186
|
+
links: {
|
|
1187
|
+
entityIntents: ArkManifestEntityLink[];
|
|
1188
|
+
};
|
|
1189
|
+
}
|
|
1190
|
+
interface ArkManifest {
|
|
1191
|
+
toJSON(): ArkManifestData;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
/**
|
|
1195
|
+
* Workflow / Saga support.
|
|
1196
|
+
*/
|
|
1197
|
+
|
|
1198
|
+
type SagaContext = Record<string, unknown>;
|
|
1199
|
+
type SagaStatus = 'idle' | 'running' | 'compensating' | 'completed' | 'failed';
|
|
1200
|
+
type WorkflowStatus = SagaStatus | 'waiting';
|
|
1201
|
+
interface RetryPolicy {
|
|
1202
|
+
attempts: number;
|
|
1203
|
+
delayMs?: number;
|
|
1204
|
+
}
|
|
1205
|
+
interface WorkflowStep<P extends SagaContext = SagaContext> {
|
|
1206
|
+
name: string;
|
|
1207
|
+
onEvent?: IntentName;
|
|
1208
|
+
retry?: RetryPolicy;
|
|
1209
|
+
timeoutMs?: number;
|
|
1210
|
+
/**
|
|
1211
|
+
* Execute one step. The signal is aborted when `timeoutMs` elapses; implementations
|
|
1212
|
+
* performing I/O must pass it to the underlying client for cooperative cancellation.
|
|
1213
|
+
*/
|
|
1214
|
+
execute: (payload: P, bus: EventBus, signal: AbortSignal) => MaybePromise<Partial<P> | void>;
|
|
1215
|
+
compensate?: (payload: P, bus: EventBus, error?: unknown) => MaybePromise<void>;
|
|
1216
|
+
}
|
|
1217
|
+
interface WorkflowStartTrigger<P extends SagaContext = SagaContext> {
|
|
1218
|
+
intent: IntentName;
|
|
1219
|
+
mapEventToPayload(event: DomainEvent<IntentName, unknown>): P;
|
|
1220
|
+
}
|
|
1221
|
+
interface WorkflowDefinition<P extends SagaContext = SagaContext> {
|
|
1222
|
+
name: string;
|
|
1223
|
+
steps: WorkflowStep<P>[];
|
|
1224
|
+
startOn?: WorkflowStartTrigger<P>;
|
|
1225
|
+
}
|
|
1226
|
+
interface WorkflowSnapshot<P extends SagaContext = SagaContext> {
|
|
1227
|
+
id: string;
|
|
1228
|
+
version?: number;
|
|
1229
|
+
workflowName: string;
|
|
1230
|
+
status: WorkflowStatus;
|
|
1231
|
+
context: P;
|
|
1232
|
+
completedSteps: string[];
|
|
1233
|
+
currentStep?: string;
|
|
1234
|
+
failedStep?: string;
|
|
1235
|
+
attempts: Record<string, number>;
|
|
1236
|
+
startedAt: string;
|
|
1237
|
+
updatedAt: string;
|
|
1238
|
+
completedAt?: string;
|
|
1239
|
+
error?: string;
|
|
1240
|
+
ownerId?: string;
|
|
1241
|
+
expiresAt?: string;
|
|
1242
|
+
}
|
|
1243
|
+
/**
|
|
1244
|
+
* Pluggable saga/workflow snapshot store with OCC and leases.
|
|
1245
|
+
*
|
|
1246
|
+
* **Durability stance (R9):** Default `InMemoryWorkflowStore` is reference-only (not
|
|
1247
|
+
* production durability). Inject a durable store for production. See
|
|
1248
|
+
* `docs/production-hardening.md`.
|
|
1249
|
+
*/
|
|
1250
|
+
interface WorkflowStore {
|
|
1251
|
+
save<P extends SagaContext>(snapshot: WorkflowSnapshot<P>, tx?: unknown): MaybePromise<void>;
|
|
1252
|
+
get<P extends SagaContext = SagaContext>(id: string, tx?: unknown): MaybePromise<WorkflowSnapshot<P> | undefined>;
|
|
1253
|
+
list(workflowName?: string): MaybePromise<WorkflowSnapshot[]>;
|
|
1254
|
+
claim?(workerId: string, timeoutMs: number, workflowName?: string): MaybePromise<WorkflowSnapshot | undefined>;
|
|
1255
|
+
clear(): MaybePromise<void>;
|
|
1256
|
+
}
|
|
1257
|
+
interface WorkflowEngine {
|
|
1258
|
+
register<P extends SagaContext>(definition: WorkflowDefinition<P>): void;
|
|
1259
|
+
start<P extends SagaContext>(workflowName: string, initialPayload: P, options?: {
|
|
1260
|
+
id?: string;
|
|
1261
|
+
tx?: unknown;
|
|
1262
|
+
}): Promise<WorkflowSnapshot<P>>;
|
|
1263
|
+
resume<P extends SagaContext>(id: string, options?: {
|
|
1264
|
+
tx?: unknown;
|
|
1265
|
+
}): Promise<WorkflowSnapshot<P> | undefined>;
|
|
1266
|
+
get<P extends SagaContext = SagaContext>(id: string, tx?: unknown): Promise<WorkflowSnapshot<P> | undefined>;
|
|
1267
|
+
list(workflowName?: string): Promise<WorkflowSnapshot[]>;
|
|
1268
|
+
}
|
|
1269
|
+
interface CreateWorkflowEngineOptions {
|
|
1270
|
+
store?: WorkflowStore;
|
|
1271
|
+
auditTrail?: AuditTrail;
|
|
1272
|
+
defaultRetry?: RetryPolicy;
|
|
1273
|
+
}
|
|
1274
|
+
interface SagaStep<P extends SagaContext = SagaContext> extends WorkflowStep<P> {
|
|
1275
|
+
}
|
|
1276
|
+
interface SagaDefinition<P extends SagaContext = SagaContext> {
|
|
1277
|
+
name: string;
|
|
1278
|
+
steps: SagaStep<P>[];
|
|
1279
|
+
}
|
|
1280
|
+
interface SagaInstance<P extends SagaContext = SagaContext> {
|
|
1281
|
+
id: string;
|
|
1282
|
+
definition: SagaDefinition<P>;
|
|
1283
|
+
readonly status: SagaStatus;
|
|
1284
|
+
readonly completedSteps: string[];
|
|
1285
|
+
run(initialPayload: P): Promise<void>;
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
/**
|
|
1289
|
+
* Serializable ArkRun information package (ADR 0023 D4).
|
|
1290
|
+
* Tooling snapshot only — never a gate verdict. Strips factories, live
|
|
1291
|
+
* instances, and input DTOs so inspectors cannot reach construction.
|
|
1292
|
+
*/
|
|
1293
|
+
declare const ARK_RUN_INFORMATION_PACKAGE_SCHEMA_VERSION: "1.0";
|
|
1294
|
+
declare const ARK_RUN_COMPONENT_LIFETIMES: readonly ["singleton", "transient"];
|
|
1295
|
+
type ArkRunComponentLifetime = (typeof ARK_RUN_COMPONENT_LIFETIMES)[number];
|
|
1296
|
+
type ArkRunExtendedInfo = {
|
|
1297
|
+
label?: string;
|
|
1298
|
+
architectureKind?: string;
|
|
1299
|
+
tags?: string[];
|
|
1300
|
+
group?: string;
|
|
1301
|
+
metadata?: Record<string, string | number | boolean | null>;
|
|
1302
|
+
};
|
|
1303
|
+
type ArkRunInformationPackageComponent = {
|
|
1304
|
+
id: string;
|
|
1305
|
+
lifetime: ArkRunComponentLifetime;
|
|
1306
|
+
uses: string[];
|
|
1307
|
+
reactsTo: string[];
|
|
1308
|
+
raises: string[];
|
|
1309
|
+
sends: string[];
|
|
1310
|
+
extendedInfo?: ArkRunExtendedInfo;
|
|
1311
|
+
};
|
|
1312
|
+
declare const ARK_RUN_DECISION_TAPE_RESIDUAL_KINDS: readonly ["absorb", "escalate_up", "hold"];
|
|
1313
|
+
type ArkRunDecisionTapeResidualKind = (typeof ARK_RUN_DECISION_TAPE_RESIDUAL_KINDS)[number];
|
|
1314
|
+
/** Additive Order residual tape (ADR 0034 D6). Not a bus. Not durable. */
|
|
1315
|
+
type ArkRunDecisionTapeRecord = {
|
|
1316
|
+
xiHash: string;
|
|
1317
|
+
event: {
|
|
1318
|
+
kind: string;
|
|
1319
|
+
payload?: Record<string, string | number | boolean | null>;
|
|
1320
|
+
};
|
|
1321
|
+
residual: {
|
|
1322
|
+
kind: ArkRunDecisionTapeResidualKind;
|
|
1323
|
+
reasonCode?: string;
|
|
1324
|
+
eventId?: string;
|
|
1325
|
+
target?: string;
|
|
1326
|
+
};
|
|
1327
|
+
};
|
|
1328
|
+
type DependencyInformationPackage = {
|
|
1329
|
+
schemaVersion: typeof ARK_RUN_INFORMATION_PACKAGE_SCHEMA_VERSION;
|
|
1330
|
+
kernelInstanceId: string;
|
|
1331
|
+
components: ArkRunInformationPackageComponent[];
|
|
1332
|
+
/** Optional; omitted keeps the 4.8.x component snapshot shape. */
|
|
1333
|
+
decisionTape?: ArkRunDecisionTapeRecord[];
|
|
1334
|
+
};
|
|
1335
|
+
declare function buildDependencyInformationPackage(input: {
|
|
1336
|
+
kernelInstanceId?: unknown;
|
|
1337
|
+
components?: unknown;
|
|
1338
|
+
decisionTape?: unknown;
|
|
1339
|
+
}): DependencyInformationPackage;
|
|
1340
|
+
declare function appendDecisionTape(pack: DependencyInformationPackage, record: unknown): DependencyInformationPackage;
|
|
1341
|
+
|
|
1342
|
+
/**
|
|
1343
|
+
* ArkRun requestGraph slices (RN13). Tooling only — never a gate verdict.
|
|
1344
|
+
* Consumes the information package so factories and live instances cannot leak.
|
|
1345
|
+
*/
|
|
1346
|
+
|
|
1347
|
+
declare const ARK_RUN_GRAPH_SCHEMA_VERSION: "1.0";
|
|
1348
|
+
declare const ARK_RUN_GRAPH_DEFAULT_SLICE: "process";
|
|
1349
|
+
declare const ARK_RUN_GRAPH_SLICES: readonly ["process", "technical"];
|
|
1350
|
+
declare const ARK_RUN_GRAPH_NODE_KINDS: readonly ["component", "interaction"];
|
|
1351
|
+
declare const ARK_RUN_GRAPH_PROCESS_EDGE_KINDS: readonly ["raises", "reactsTo", "sends"];
|
|
1352
|
+
declare const ARK_RUN_GRAPH_TECHNICAL_EDGE_KINDS: readonly ["uses"];
|
|
1353
|
+
type ArkRunGraphSlice = (typeof ARK_RUN_GRAPH_SLICES)[number];
|
|
1354
|
+
type ArkRunGraphNodeKind = (typeof ARK_RUN_GRAPH_NODE_KINDS)[number];
|
|
1355
|
+
type ArkRunGraphProcessEdgeKind = (typeof ARK_RUN_GRAPH_PROCESS_EDGE_KINDS)[number];
|
|
1356
|
+
type ArkRunGraphTechnicalEdgeKind = (typeof ARK_RUN_GRAPH_TECHNICAL_EDGE_KINDS)[number];
|
|
1357
|
+
type ArkRunGraphEdgeKind = ArkRunGraphProcessEdgeKind | ArkRunGraphTechnicalEdgeKind;
|
|
1358
|
+
declare class InvalidArkRunGraphQueryError extends Error {
|
|
1359
|
+
readonly option: 'slice' | 'degreesOfSeparation' | 'nodeIds' | 'include' | 'exclude';
|
|
1360
|
+
constructor(option: InvalidArkRunGraphQueryError['option'], detail?: string);
|
|
1361
|
+
}
|
|
1362
|
+
type ArkRunGraphMatch = {
|
|
1363
|
+
tokens: string[];
|
|
1364
|
+
ids: string[];
|
|
1365
|
+
labels: string[];
|
|
1366
|
+
tags: string[];
|
|
1367
|
+
groups: string[];
|
|
1368
|
+
architectureKinds: string[];
|
|
1369
|
+
};
|
|
1370
|
+
type ArkRunGraphResolvedQuery = {
|
|
1371
|
+
slice: ArkRunGraphSlice;
|
|
1372
|
+
nodeIds: string[];
|
|
1373
|
+
degreesOfSeparation: number | null;
|
|
1374
|
+
include: ArkRunGraphMatch;
|
|
1375
|
+
exclude: ArkRunGraphMatch;
|
|
1376
|
+
};
|
|
1377
|
+
type ArkRunGraphQuery = {
|
|
1378
|
+
slice?: ArkRunGraphSlice;
|
|
1379
|
+
nodeIds?: readonly string[];
|
|
1380
|
+
degreesOfSeparation?: number;
|
|
1381
|
+
include?: string | readonly string[] | ArkRunGraphMatchInput;
|
|
1382
|
+
exclude?: string | readonly string[] | ArkRunGraphMatchInput;
|
|
1383
|
+
};
|
|
1384
|
+
type ArkRunGraphMatchInput = {
|
|
1385
|
+
ids?: readonly string[];
|
|
1386
|
+
labels?: readonly string[];
|
|
1387
|
+
tags?: readonly string[];
|
|
1388
|
+
groups?: readonly string[];
|
|
1389
|
+
architectureKinds?: readonly string[];
|
|
1390
|
+
};
|
|
1391
|
+
type ArkRunGraphNode = {
|
|
1392
|
+
id: string;
|
|
1393
|
+
kind: ArkRunGraphNodeKind;
|
|
1394
|
+
lifetime?: ArkRunComponentLifetime;
|
|
1395
|
+
label?: string;
|
|
1396
|
+
group?: string;
|
|
1397
|
+
architectureKind?: string;
|
|
1398
|
+
tags?: string[];
|
|
1399
|
+
};
|
|
1400
|
+
type ArkRunGraphEdge = {
|
|
1401
|
+
from: string;
|
|
1402
|
+
to: string;
|
|
1403
|
+
kind: ArkRunGraphEdgeKind;
|
|
1404
|
+
};
|
|
1405
|
+
type ArkRunGraph = {
|
|
1406
|
+
schemaVersion: typeof ARK_RUN_GRAPH_SCHEMA_VERSION;
|
|
1407
|
+
kernelInstanceId: string;
|
|
1408
|
+
slice: ArkRunGraphSlice;
|
|
1409
|
+
query: ArkRunGraphResolvedQuery;
|
|
1410
|
+
nodes: ArkRunGraphNode[];
|
|
1411
|
+
edges: ArkRunGraphEdge[];
|
|
1412
|
+
mermaid: string;
|
|
1413
|
+
};
|
|
1414
|
+
declare function closeArkRunGraphQuery(input?: unknown): ArkRunGraphResolvedQuery;
|
|
1415
|
+
declare function arkRunGraphQueryFromSearchParams(params: {
|
|
1416
|
+
slice?: string | null;
|
|
1417
|
+
nodeIds?: string | null;
|
|
1418
|
+
degreesOfSeparation?: string | null;
|
|
1419
|
+
include?: string | null;
|
|
1420
|
+
exclude?: string | null;
|
|
1421
|
+
}): ArkRunGraphQuery;
|
|
1422
|
+
/**
|
|
1423
|
+
* Render a closed ArkRun graph as Mermaid flowchart text.
|
|
1424
|
+
* Process slices are left-to-right; technical slices are top-down.
|
|
1425
|
+
*/
|
|
1426
|
+
declare function formatArkRunGraphMermaid(graph: Pick<ArkRunGraph, 'slice' | 'nodes' | 'edges'>): string;
|
|
1427
|
+
/**
|
|
1428
|
+
* Slice the information package into a process or technical graph.
|
|
1429
|
+
* Optional nodeIds + degreesOfSeparation keep a neighborhood; include/exclude
|
|
1430
|
+
* are closed token or field queries. Never a score.
|
|
1431
|
+
*/
|
|
1432
|
+
declare function requestArkRunGraph(pkgInput?: unknown, queryInput?: unknown): ArkRunGraph;
|
|
1433
|
+
|
|
1434
|
+
/**
|
|
1435
|
+
* Closed ArkRun send-port vocabulary (ADR 0024).
|
|
1436
|
+
* Pure plan only — delivery is Kernel. Not a durability claim.
|
|
1437
|
+
*/
|
|
1438
|
+
declare const ARK_RUN_TRANSPORT_KINDS: readonly ["local", "localBlocking", "broker"];
|
|
1439
|
+
type ArkRunTransportKind = (typeof ARK_RUN_TRANSPORT_KINDS)[number];
|
|
1440
|
+
type ArkRunDeliveredVia = 'local' | 'broker';
|
|
1441
|
+
/** Await local recording / adapter handoff before `send()` resolves. Not durability. */
|
|
1442
|
+
declare const ARK_RUN_EPHEMERAL_DEFAULT = true;
|
|
1443
|
+
declare class InvalidArkRunSendOptionError extends Error {
|
|
1444
|
+
readonly option: 'transport' | 'ephemeral';
|
|
1445
|
+
constructor(option: 'transport' | 'ephemeral');
|
|
1446
|
+
}
|
|
1447
|
+
type ArkRunSendPlan = {
|
|
1448
|
+
transport: ArkRunTransportKind;
|
|
1449
|
+
ephemeral: boolean;
|
|
1450
|
+
deliveredVia: ArkRunDeliveredVia;
|
|
1451
|
+
fallbackToLocal: boolean;
|
|
1452
|
+
notifySubscribers: boolean;
|
|
1453
|
+
awaitHandlers: boolean;
|
|
1454
|
+
awaitHandoff: boolean;
|
|
1455
|
+
};
|
|
1456
|
+
type ArkRunSendPlanInput = {
|
|
1457
|
+
transport?: unknown;
|
|
1458
|
+
ephemeral?: unknown;
|
|
1459
|
+
brokerBound: boolean;
|
|
1460
|
+
};
|
|
1461
|
+
declare function closedArkRunTransportKind(value: unknown): ArkRunTransportKind;
|
|
1462
|
+
declare function closedArkRunEphemeral(value: unknown): boolean;
|
|
1463
|
+
/**
|
|
1464
|
+
* Decide where a send goes and what `send()` waits for.
|
|
1465
|
+
* Missing broker → in-process local fallback (not cloud portability).
|
|
1466
|
+
*/
|
|
1467
|
+
declare function resolveArkRunSendPlan(input: ArkRunSendPlanInput): ArkRunSendPlan;
|
|
1468
|
+
|
|
1469
|
+
/**
|
|
1470
|
+
* Closed ArkRun inspector bind + snapshot vocabulary (RN12).
|
|
1471
|
+
* Pure plan only — HTTP listen is Kernel. Not a durability claim.
|
|
1472
|
+
*/
|
|
1473
|
+
|
|
1474
|
+
declare const ARK_RUN_INSPECTOR_SCHEMA_VERSION: "1.0";
|
|
1475
|
+
declare const ARK_RUN_INSPECTOR_DEFAULT_HOST = "127.0.0.1";
|
|
1476
|
+
declare const ARK_RUN_INSPECTOR_DEFAULT_PORT = 0;
|
|
1477
|
+
declare const ARK_RUN_INSPECTOR_SNAPSHOT_PATH = "/snapshot";
|
|
1478
|
+
declare const ARK_RUN_INSPECTOR_EVENTS_PATH = "/events";
|
|
1479
|
+
declare const ARK_RUN_INSPECTOR_GRAPH_PATH = "/graph";
|
|
1480
|
+
declare const ARK_RUN_INSPECTOR_OUTBOX_PATH = "/outbox";
|
|
1481
|
+
declare const ARK_RUN_INSPECTOR_WORKFLOWS_PATH = "/workflows";
|
|
1482
|
+
declare const ARK_RUN_INSPECTOR_SSE_EVENT = "snapshot";
|
|
1483
|
+
declare const ARK_RUN_INSPECTOR_TRANSPORT_FALLBACK: "in-process-local";
|
|
1484
|
+
/** Server-side sample cap for outbox/workflows monitors (DoS floor). */
|
|
1485
|
+
declare const ARK_RUN_INSPECTOR_MONITOR_SAMPLE_LIMIT = 32;
|
|
1486
|
+
/** Outbox statuses the Queues monitor surfaces (dispatched is omitted). */
|
|
1487
|
+
declare const ARK_RUN_INSPECTOR_OUTBOX_MONITOR_STATUSES: readonly ["pending", "failed"];
|
|
1488
|
+
type ArkRunInspectorOutboxMonitorStatus = (typeof ARK_RUN_INSPECTOR_OUTBOX_MONITOR_STATUSES)[number];
|
|
1489
|
+
type ArkRunInspectorStoreDurabilityKind = 'memory' | 'durable';
|
|
1490
|
+
type ArkRunInspectorStoreRole = 'outbox' | 'audit' | 'workflow';
|
|
1491
|
+
type ArkRunInspectorStoreDurability = {
|
|
1492
|
+
role: ArkRunInspectorStoreRole;
|
|
1493
|
+
id: string;
|
|
1494
|
+
kind: ArkRunInspectorStoreDurabilityKind;
|
|
1495
|
+
};
|
|
1496
|
+
type ArkRunInspectorHardeningDurability = {
|
|
1497
|
+
stores: ArkRunInspectorStoreDurability[];
|
|
1498
|
+
};
|
|
1499
|
+
type ArkRunInspectorHardening = {
|
|
1500
|
+
durability: ArkRunInspectorHardeningDurability;
|
|
1501
|
+
};
|
|
1502
|
+
type ArkRunInspectorOutboxRecordSummary = {
|
|
1503
|
+
id: string;
|
|
1504
|
+
status: ArkRunInspectorOutboxMonitorStatus;
|
|
1505
|
+
attempts: number;
|
|
1506
|
+
intent?: string;
|
|
1507
|
+
error?: string;
|
|
1508
|
+
updatedAt?: string;
|
|
1509
|
+
};
|
|
1510
|
+
type ArkRunInspectorOutboxMonitor = {
|
|
1511
|
+
available: boolean;
|
|
1512
|
+
pendingCount: number;
|
|
1513
|
+
failedCount: number;
|
|
1514
|
+
pending: ArkRunInspectorOutboxRecordSummary[];
|
|
1515
|
+
failed: ArkRunInspectorOutboxRecordSummary[];
|
|
1516
|
+
/** Cap applied to pending/failed sample arrays (counts remain accurate). */
|
|
1517
|
+
sampleLimit: number;
|
|
1518
|
+
};
|
|
1519
|
+
type ArkRunInspectorWorkflowSummary = {
|
|
1520
|
+
id: string;
|
|
1521
|
+
name: string;
|
|
1522
|
+
status: string;
|
|
1523
|
+
currentStep?: string;
|
|
1524
|
+
error?: string;
|
|
1525
|
+
};
|
|
1526
|
+
type ArkRunInspectorWorkflowsMonitor = {
|
|
1527
|
+
available: boolean;
|
|
1528
|
+
total: number;
|
|
1529
|
+
runningCount: number;
|
|
1530
|
+
compensatingCount: number;
|
|
1531
|
+
failedCount: number;
|
|
1532
|
+
pendingCount: number;
|
|
1533
|
+
workflows: ArkRunInspectorWorkflowSummary[];
|
|
1534
|
+
/** Cap applied to workflows sample array (counts remain accurate). */
|
|
1535
|
+
sampleLimit: number;
|
|
1536
|
+
};
|
|
1537
|
+
type ArkRunInspectorMonitorBuildOptions = {
|
|
1538
|
+
/** Bound samples; clamped to 0…ARK_RUN_INSPECTOR_MONITOR_SAMPLE_LIMIT. Default 32. */
|
|
1539
|
+
sampleLimit?: number;
|
|
1540
|
+
};
|
|
1541
|
+
declare class ArkRunInspectorProductionError extends Error {
|
|
1542
|
+
constructor();
|
|
1543
|
+
}
|
|
1544
|
+
declare class ArkRunInspectorBindError extends Error {
|
|
1545
|
+
constructor(host: string);
|
|
1546
|
+
}
|
|
1547
|
+
type ArkRunInspectorBind = {
|
|
1548
|
+
host: string;
|
|
1549
|
+
port: number;
|
|
1550
|
+
};
|
|
1551
|
+
type ArkRunInspectorTransportFacts = {
|
|
1552
|
+
kinds: ArkRunTransportKind[];
|
|
1553
|
+
ephemeralDefault: boolean;
|
|
1554
|
+
brokerBound: boolean;
|
|
1555
|
+
cloudSdksShipped: false;
|
|
1556
|
+
fallback: typeof ARK_RUN_INSPECTOR_TRANSPORT_FALLBACK;
|
|
1557
|
+
};
|
|
1558
|
+
type ArkRunInspectorSnapshot = {
|
|
1559
|
+
schemaVersion: typeof ARK_RUN_INSPECTOR_SCHEMA_VERSION;
|
|
1560
|
+
kernelInstanceId: string;
|
|
1561
|
+
bind: {
|
|
1562
|
+
host: string;
|
|
1563
|
+
port: number;
|
|
1564
|
+
loopback: true;
|
|
1565
|
+
};
|
|
1566
|
+
package: DependencyInformationPackage;
|
|
1567
|
+
transport: ArkRunInspectorTransportFacts;
|
|
1568
|
+
observability: unknown;
|
|
1569
|
+
/** Explicit store durability facts from real kernel ports (never component-id inference). */
|
|
1570
|
+
hardening: ArkRunInspectorHardening;
|
|
1571
|
+
/** Optional OD04 queue facts when the caller supplies them (endpoints preferred). */
|
|
1572
|
+
outbox?: ArkRunInspectorOutboxMonitor;
|
|
1573
|
+
/** Optional OD04 workflow facts when the caller supplies them (endpoints preferred). */
|
|
1574
|
+
workflows?: ArkRunInspectorWorkflowsMonitor;
|
|
1575
|
+
};
|
|
1576
|
+
type ArkRunInspectorBindInput = {
|
|
1577
|
+
host?: unknown;
|
|
1578
|
+
port?: unknown;
|
|
1579
|
+
nodeEnv?: unknown;
|
|
1580
|
+
processNodeEnv?: unknown;
|
|
1581
|
+
};
|
|
1582
|
+
type ArkRunInspectorSnapshotInput = {
|
|
1583
|
+
kernelInstanceId?: unknown;
|
|
1584
|
+
host?: unknown;
|
|
1585
|
+
port?: unknown;
|
|
1586
|
+
package?: unknown;
|
|
1587
|
+
observability?: unknown;
|
|
1588
|
+
ephemeralDefault?: unknown;
|
|
1589
|
+
brokerBound?: unknown;
|
|
1590
|
+
hardening?: unknown;
|
|
1591
|
+
outbox?: unknown;
|
|
1592
|
+
workflows?: unknown;
|
|
1593
|
+
};
|
|
1594
|
+
declare function isArkRunInspectorProductionEnv(nodeEnv: unknown): boolean;
|
|
1595
|
+
declare function isArkRunInspectorLoopbackHost(host: unknown): boolean;
|
|
1596
|
+
declare function resolveArkRunInspectorBind(input?: ArkRunInspectorBindInput): ArkRunInspectorBind;
|
|
1597
|
+
declare function arkRunInspectorUrl(host: string, port: number, path: string): string;
|
|
1598
|
+
/**
|
|
1599
|
+
* Classify a store port by constructor / declared id. `InMemory*` → memory; else durable.
|
|
1600
|
+
*/
|
|
1601
|
+
declare function classifyArkRunInspectorStoreDurability(id: unknown, role: ArkRunInspectorStoreRole): ArkRunInspectorStoreDurability;
|
|
1602
|
+
/**
|
|
1603
|
+
* Build hardening.durability facts from explicit store rows (not package.components).
|
|
1604
|
+
*/
|
|
1605
|
+
declare function buildArkRunInspectorHardening(input?: unknown): ArkRunInspectorHardening;
|
|
1606
|
+
/**
|
|
1607
|
+
* Sanitize EventBufferStore.list rows into pending/failed monitor facts (no payloads).
|
|
1608
|
+
* Counts cover the full input; sample arrays are capped at sampleLimit (≤32).
|
|
1609
|
+
*/
|
|
1610
|
+
declare function buildArkRunInspectorOutboxMonitor(records?: unknown, options?: ArkRunInspectorMonitorBuildOptions): ArkRunInspectorOutboxMonitor;
|
|
1611
|
+
declare function unavailableArkRunInspectorOutboxMonitor(): ArkRunInspectorOutboxMonitor;
|
|
1612
|
+
/**
|
|
1613
|
+
* Sanitize WorkflowEngine.list rows into monitor facts (id/name/status/step/error only).
|
|
1614
|
+
* Counts cover the full input; the workflows sample is capped at sampleLimit (≤32).
|
|
1615
|
+
*/
|
|
1616
|
+
declare function buildArkRunInspectorWorkflowsMonitor(snapshots?: unknown, options?: ArkRunInspectorMonitorBuildOptions): ArkRunInspectorWorkflowsMonitor;
|
|
1617
|
+
declare function unavailableArkRunInspectorWorkflowsMonitor(): ArkRunInspectorWorkflowsMonitor;
|
|
1618
|
+
declare function buildArkRunInspectorSnapshot(input?: ArkRunInspectorSnapshotInput): ArkRunInspectorSnapshot;
|
|
1619
|
+
declare function formatArkRunInspectorSseEvent(snapshot: unknown): string;
|
|
1620
|
+
|
|
1621
|
+
/**
|
|
1622
|
+
* Per-kernel managed-component registry. Factories stay private so the
|
|
1623
|
+
* information package cannot observe construction (ADR 0023 D4).
|
|
1624
|
+
*/
|
|
1625
|
+
|
|
1626
|
+
type ArkRunRegisterOptions<T = unknown> = {
|
|
1627
|
+
id: string;
|
|
1628
|
+
lifetime?: ArkRunComponentLifetime;
|
|
1629
|
+
uses?: readonly string[];
|
|
1630
|
+
reactsTo?: readonly string[];
|
|
1631
|
+
raises?: readonly string[];
|
|
1632
|
+
sends?: readonly string[];
|
|
1633
|
+
extendedInfo?: ArkRunExtendedInfo;
|
|
1634
|
+
factory?: () => T;
|
|
1635
|
+
};
|
|
1636
|
+
type ArkRunRegistrationHandle = ArkRunInformationPackageComponent;
|
|
1637
|
+
|
|
1638
|
+
type ArkRunInspectorListenSource = {
|
|
1639
|
+
getInspectorSnapshot(bind: ArkRunInspectorBind): ArkRunInspectorSnapshot;
|
|
1640
|
+
requestGraph(query?: ArkRunGraphQuery): ArkRunGraph;
|
|
1641
|
+
/** OD04: pending/failed outbox summaries (EventBufferStore.list). */
|
|
1642
|
+
listInspectorOutbox?(): Promise<ArkRunInspectorOutboxMonitor>;
|
|
1643
|
+
/** OD04: workflow/saga summaries (WorkflowEngine.list). */
|
|
1644
|
+
listInspectorWorkflows?(): Promise<ArkRunInspectorWorkflowsMonitor>;
|
|
1645
|
+
/** Duck-typed kernel ports when explicit list* helpers are absent. */
|
|
1646
|
+
outbox?: {
|
|
1647
|
+
list(status?: 'pending' | 'dispatched' | 'failed'): Promise<unknown[]>;
|
|
1648
|
+
};
|
|
1649
|
+
eventBuffer?: {
|
|
1650
|
+
list(status?: 'pending' | 'dispatched' | 'failed'): Promise<unknown[]>;
|
|
1651
|
+
};
|
|
1652
|
+
workflowEngine?: {
|
|
1653
|
+
list(workflowName?: string): Promise<unknown[]>;
|
|
1654
|
+
};
|
|
1655
|
+
};
|
|
1656
|
+
type ArkRunInspectorHandle = {
|
|
1657
|
+
host: string;
|
|
1658
|
+
port: number;
|
|
1659
|
+
url: string;
|
|
1660
|
+
snapshotUrl: string;
|
|
1661
|
+
eventsUrl: string;
|
|
1662
|
+
graphUrl: string;
|
|
1663
|
+
outboxUrl: string;
|
|
1664
|
+
workflowsUrl: string;
|
|
1665
|
+
close(): Promise<void>;
|
|
1666
|
+
};
|
|
1667
|
+
|
|
1668
|
+
type StartArkRunInspectorOptions = {
|
|
1669
|
+
host?: string;
|
|
1670
|
+
port?: number;
|
|
1671
|
+
/** Participates in the production veto together with process NODE_ENV. */
|
|
1672
|
+
nodeEnv?: string;
|
|
1673
|
+
sseIntervalMs?: number;
|
|
1674
|
+
};
|
|
1675
|
+
/** What the inspector reads: snapshot, graph, and optional outbox / workflow monitors. */
|
|
1676
|
+
type ArkRunInspectorSource = ArkRunInspectorListenSource;
|
|
1677
|
+
declare function startArkRunInspector(source: ArkRunInspectorSource, options?: StartArkRunInspectorOptions): Promise<ArkRunInspectorHandle>;
|
|
1678
|
+
|
|
1679
|
+
/**
|
|
1680
|
+
* ArkRun send ports (ADR 0024): local / localBlocking / broker-with-local-fallback.
|
|
1681
|
+
* Consumers inject broker adapters. This package does not ship cloud SDKs.
|
|
1682
|
+
* Fallback is in-process local delivery — not cloud portability.
|
|
1683
|
+
*/
|
|
1684
|
+
|
|
1685
|
+
/**
|
|
1686
|
+
* Consumer-owned broker handoff. Resolving means the adapter accepted the
|
|
1687
|
+
* message, not that downstream consumers processed it. Not a durability claim.
|
|
1688
|
+
*/
|
|
1689
|
+
interface ArkRunBrokerAdapter {
|
|
1690
|
+
send(event: DomainEvent): void | Promise<void>;
|
|
1691
|
+
}
|
|
1692
|
+
interface ArkRunSendOptions {
|
|
1693
|
+
transport?: ArkRunTransportKind;
|
|
1694
|
+
/** Override kernel `ephemeral`. Default remains true when both are omitted. */
|
|
1695
|
+
ephemeral?: boolean;
|
|
1696
|
+
source?: string;
|
|
1697
|
+
metadata?: Partial<EventMetadata>;
|
|
1698
|
+
}
|
|
1699
|
+
type ArkRunSendResult = ArkRunSendPlan;
|
|
1700
|
+
|
|
1701
|
+
interface ArkKernel {
|
|
1702
|
+
instanceId: string;
|
|
1703
|
+
profile: ArchitectureProfile;
|
|
1704
|
+
registry: IntentRegistry;
|
|
1705
|
+
graph: DependencyGraph;
|
|
1706
|
+
metadata: MetadataRegistry;
|
|
1707
|
+
auditTrail: AuditTrail;
|
|
1708
|
+
eventContracts: EventContractRegistry;
|
|
1709
|
+
eventBuffer: EventBufferStore;
|
|
1710
|
+
/** @deprecated Use eventBuffer. */
|
|
1711
|
+
outbox: EventBufferStore;
|
|
1712
|
+
projections: ProjectionRegistry;
|
|
1713
|
+
policyEngine: PolicyEngine;
|
|
1714
|
+
eventBus: EventBus;
|
|
1715
|
+
workflowEngine: WorkflowEngine;
|
|
1716
|
+
observability: ObservabilityReporter;
|
|
1717
|
+
publisher<N extends IntentName, P>(source: N | IntentCreator<N, P>): ArkRunPublisher;
|
|
1718
|
+
/**
|
|
1719
|
+
* One send site for local / localBlocking / broker (ADR 0024).
|
|
1720
|
+
* Missing broker falls back to in-process local delivery — not cloud portability.
|
|
1721
|
+
*/
|
|
1722
|
+
send<N extends IntentName, P>(intent: IntentCreator<N, P>, payload: P, options?: ArkRunSendOptions): Promise<ArkRunSendResult>;
|
|
1723
|
+
/** Handle is declaration metadata only; the factory never leaves the registry. */
|
|
1724
|
+
register<T>(options: ArkRunRegisterOptions<T>): ArkRunRegistrationHandle;
|
|
1725
|
+
resolve<T = unknown>(id: string): T;
|
|
1726
|
+
resolveSingleton<T = unknown>(id: string): T;
|
|
1727
|
+
/** Tooling snapshot of ids, lifetime, and declarations — never construction. */
|
|
1728
|
+
getDependencyInformationPackage(): DependencyInformationPackage;
|
|
1729
|
+
/**
|
|
1730
|
+
* Process or technical graph slice of the information package.
|
|
1731
|
+
* Optional nodeIds, degreesOfSeparation, and include/exclude query.
|
|
1732
|
+
* Mermaid is a helper string on the result — never a score.
|
|
1733
|
+
*/
|
|
1734
|
+
requestGraph(query?: ArkRunGraphQuery): ArkRunGraph;
|
|
1735
|
+
/**
|
|
1736
|
+
* Inspector snapshot (package + transport facts + observability). Never
|
|
1737
|
+
* includes factories, live instances, broker adapters, or input DTOs.
|
|
1738
|
+
*/
|
|
1739
|
+
getInspectorSnapshot(bind?: ArkRunInspectorBind): ArkRunInspectorSnapshot;
|
|
1740
|
+
/**
|
|
1741
|
+
* Opt-in loopback inspector. Refuses NODE_ENV=production and public binds.
|
|
1742
|
+
* Loads HTTP only when called.
|
|
1743
|
+
*/
|
|
1744
|
+
startInspector(options?: StartArkRunInspectorOptions): Promise<ArkRunInspectorHandle>;
|
|
1745
|
+
syncGraph(): void;
|
|
1746
|
+
manifest(): ArkManifest;
|
|
1747
|
+
}
|
|
1748
|
+
interface CreateArkKernelOptions {
|
|
1749
|
+
/**
|
|
1750
|
+
* When true (default), createArkKernel uses the hardened runtime defaults:
|
|
1751
|
+
* strict event contracts and hard observed-layer enforcement.
|
|
1752
|
+
* Set to false only for explicit migration/legacy paths.
|
|
1753
|
+
*/
|
|
1754
|
+
strict?: boolean;
|
|
1755
|
+
profile?: ArchitectureProfile;
|
|
1756
|
+
policies?: Policy[];
|
|
1757
|
+
auditTrail?: AuditTrail;
|
|
1758
|
+
eventContracts?: EventContractRegistry;
|
|
1759
|
+
eventBuffer?: EventBufferStore;
|
|
1760
|
+
/** @deprecated Use eventBuffer. */
|
|
1761
|
+
outbox?: EventBufferStore;
|
|
1762
|
+
metadata?: MetadataRegistry;
|
|
1763
|
+
projections?: ProjectionRegistry;
|
|
1764
|
+
/**
|
|
1765
|
+
* Cap for in-memory event history, trace, and audit records.
|
|
1766
|
+
* Defaults to DEFAULT_MAX_HISTORY_SIZE (1000); oldest records are evicted
|
|
1767
|
+
* first. Pass Infinity for unbounded retention (pre-1.6 behavior).
|
|
1768
|
+
*/
|
|
1769
|
+
maxHistorySize?: number;
|
|
1770
|
+
autoApplyProjections?: boolean;
|
|
1771
|
+
strictEventContracts?: boolean;
|
|
1772
|
+
requireKnownSource?: boolean;
|
|
1773
|
+
/**
|
|
1774
|
+
* Enforce observed producer→event layer flows against the profile at runtime.
|
|
1775
|
+
* Defaults to 'hard' when strict is true and 'off' when strict is false.
|
|
1776
|
+
*/
|
|
1777
|
+
enforceObservedLayerFlow?: ObservedLayerFlowMode;
|
|
1778
|
+
instanceId?: string;
|
|
1779
|
+
/**
|
|
1780
|
+
* Consumer-injected broker adapter. Absence is normal: broker sends fall back
|
|
1781
|
+
* to in-process local delivery. Not cloud portability. This package does not
|
|
1782
|
+
* ship cloud SDKs.
|
|
1783
|
+
*/
|
|
1784
|
+
broker?: ArkRunBrokerAdapter;
|
|
1785
|
+
/**
|
|
1786
|
+
* Await local bus recording / broker adapter handoff before `send()` resolves.
|
|
1787
|
+
* Default true (CLI, tests, short-lived workers). Not a durability claim.
|
|
1788
|
+
*/
|
|
1789
|
+
ephemeral?: boolean;
|
|
1790
|
+
}
|
|
1791
|
+
interface ArkRunPublisher extends EventPublisher {
|
|
1792
|
+
send<N extends IntentName, P>(intent: IntentCreator<N, P>, payload: P, options?: Omit<ArkRunSendOptions, 'source'>): Promise<ArkRunSendResult>;
|
|
1793
|
+
}
|
|
1794
|
+
interface CreateArkKernelFromConfigOptions extends Omit<CreateArkKernelOptions, 'profile'> {
|
|
1795
|
+
/** Runtime profile name. Default: config.name or "ark.config.json". */
|
|
1796
|
+
profileName?: string;
|
|
1797
|
+
}
|
|
1798
|
+
type ArkKernelConfig = ArkCheckConfig;
|
|
1799
|
+
|
|
1800
|
+
export { type TraceRecord as $, type ArkKernel as A, type EventBus as B, type CreateArkKernelOptions as C, type DependencyGraph as D, type EventContractRegistry as E, type CreateObservabilityReporterOptions as F, type GraphEdge as G, PolicyEngine as H, IntentRegistry as I, type ArkManifest as J, type WorkflowSnapshot as K, type SagaDefinition as L, type MetadataRegistry as M, type CreateWorkflowEngineOptions as N, type ObservabilityReporter as O, type ProjectionRegistry as P, type SagaInstance as Q, type ReadModelStore as R, type SagaContext as S, type WorkflowEngine as T, type ArkConfig as U, type ArkConfigLoadResult as V, type WorkflowStore as W, type DependencyInformationPackage as X, type ArkKernelConfig as Y, type CreateArkKernelFromConfigOptions as Z, type TraceRecordType as _, type AuditStore as a, type ArkRunInspectorSource as a$, type OutboxStatus as a0, type OutboxRecord as a1, type ObservabilityDriftReport as a2, ARK_RUN_COMPONENT_LIFETIMES as a3, ARK_RUN_EPHEMERAL_DEFAULT as a4, ARK_RUN_GRAPH_DEFAULT_SLICE as a5, ARK_RUN_GRAPH_NODE_KINDS as a6, ARK_RUN_GRAPH_PROCESS_EDGE_KINDS as a7, ARK_RUN_GRAPH_SCHEMA_VERSION as a8, ARK_RUN_GRAPH_SLICES as a9, type ArkRunDeliveredVia as aA, type ArkRunExtendedInfo as aB, type ArkRunGraph as aC, type ArkRunGraphEdge as aD, type ArkRunGraphEdgeKind as aE, type ArkRunGraphMatch as aF, type ArkRunGraphMatchInput as aG, type ArkRunGraphNode as aH, type ArkRunGraphNodeKind as aI, type ArkRunGraphProcessEdgeKind as aJ, type ArkRunGraphQuery as aK, type ArkRunGraphResolvedQuery as aL, type ArkRunGraphSlice as aM, type ArkRunGraphTechnicalEdgeKind as aN, type ArkRunInformationPackageComponent as aO, type ArkRunInspectorBind as aP, ArkRunInspectorBindError as aQ, type ArkRunInspectorBindInput as aR, type ArkRunInspectorHandle as aS, type ArkRunInspectorHardening as aT, type ArkRunInspectorHardeningDurability as aU, type ArkRunInspectorMonitorBuildOptions as aV, type ArkRunInspectorOutboxMonitor as aW, type ArkRunInspectorOutboxRecordSummary as aX, ArkRunInspectorProductionError as aY, type ArkRunInspectorSnapshot as aZ, type ArkRunInspectorSnapshotInput as a_, ARK_RUN_GRAPH_TECHNICAL_EDGE_KINDS as aa, ARK_RUN_INFORMATION_PACKAGE_SCHEMA_VERSION as ab, ARK_RUN_INSPECTOR_DEFAULT_HOST as ac, ARK_RUN_INSPECTOR_DEFAULT_PORT as ad, ARK_RUN_INSPECTOR_EVENTS_PATH as ae, ARK_RUN_INSPECTOR_GRAPH_PATH as af, ARK_RUN_INSPECTOR_MONITOR_SAMPLE_LIMIT as ag, ARK_RUN_INSPECTOR_OUTBOX_PATH as ah, ARK_RUN_INSPECTOR_SCHEMA_VERSION as ai, ARK_RUN_INSPECTOR_SNAPSHOT_PATH as aj, ARK_RUN_INSPECTOR_SSE_EVENT as ak, ARK_RUN_INSPECTOR_TRANSPORT_FALLBACK as al, ARK_RUN_INSPECTOR_WORKFLOWS_PATH as am, ARK_RUN_TRANSPORT_KINDS as an, type ArchitectureLayer as ao, type ArchitectureLayerConfig as ap, type ArchitectureRule as aq, type ArkManifestArchitecture as ar, type ArkManifestData as as, type ArkManifestEntityLink as at, type ArkManifestGraph as au, type ArkManifestIntent as av, type ArkManifestPolicy as aw, type ArkManifestProjection as ax, type ArkRunBrokerAdapter as ay, type ArkRunComponentLifetime as az, type AuditRecord as b, formatArkRunInspectorSseEvent as b$, type ArkRunInspectorStoreDurability as b0, type ArkRunInspectorStoreDurabilityKind as b1, type ArkRunInspectorStoreRole as b2, type ArkRunInspectorTransportFacts as b3, type ArkRunInspectorWorkflowSummary as b4, type ArkRunInspectorWorkflowsMonitor as b5, type ArkRunPublisher as b6, type ArkRunRegisterOptions as b7, type ArkRunRegistrationHandle as b8, type ArkRunSendOptions as b9, type OutboxStore as bA, type PolicyEvaluationResult as bB, type ProjectionCheckpoint as bC, type ProjectionDefinition as bD, type PublishedEventRecord as bE, type RetryPolicy as bF, type SagaStatus as bG, type SagaStep as bH, type StartArkRunInspectorOptions as bI, type TraceSink as bJ, type Unsubscribe as bK, type WorkflowDefinition as bL, type WorkflowStatus as bM, type WorkflowStep as bN, appendDecisionTape as bO, arkRunGraphQueryFromSearchParams as bP, arkRunInspectorUrl as bQ, buildArkRunInspectorHardening as bR, buildArkRunInspectorOutboxMonitor as bS, buildArkRunInspectorSnapshot as bT, buildArkRunInspectorWorkflowsMonitor as bU, buildDependencyInformationPackage as bV, classifyArkRunInspectorStoreDurability as bW, closeArkRunGraphQuery as bX, closedArkRunEphemeral as bY, closedArkRunTransportKind as bZ, formatArkRunGraphMermaid as b_, type ArkRunSendPlan as ba, type ArkRunSendPlanInput as bb, type ArkRunSendResult as bc, type ArkRunTransportKind as bd, type AuditRecordInput as be, type AuditRecordType as bf, type CorrelationId as bg, type EntityMeta as bh, type EventContractIssue as bi, type EventHandler as bj, type EventInterceptionInfo as bk, type EventInterceptor as bl, type EventInterceptorContext as bm, type EventMetadata as bn, type EventPayloadPatch as bo, type EventPayloadSchema as bp, type EventPublisher as bq, type EventSchemaField as br, type EventSchemaFieldType as bs, type FieldMeta as bt, type GraphNode as bu, type IntentRelationshipKind as bv, InvalidArkRunGraphQueryError as bw, InvalidArkRunSendOptionError as bx, type ObservabilityFlow as by, type ObservedLayerFlowMode as bz, type AuditQuery as c, isArkRunInspectorLoopbackHost as c0, isArkRunInspectorProductionEnv as c1, requestArkRunGraph as c2, resolveArkRunInspectorBind as c3, resolveArkRunSendPlan as c4, startArkRunInspector as c5, unavailableArkRunInspectorOutboxMonitor as c6, unavailableArkRunInspectorWorkflowsMonitor as c7, type CreateAuditTrailOptions as d, type AuditTrail as e, type CreateArchitectureProfileOptions as f, type ArchitectureProfile as g, type ArkCheckConfig as h, type CreateArchitectureProfileFromArkConfigOptions as i, type CreateElevenLayerArkConfigOptions as j, type EventContract as k, type DomainEvent as l, type EventContractValidationResult as m, type IntentName as n, type DefineIntentOptions as o, type IntentCreator as p, type CreateProjectionRegistryOptions as q, type PolicyViolation as r, type PolicySeverity as s, type PolicyEnforcementMode as t, type Policy as u, type IntentRelationship as v, type EventBufferStore as w, type EventBufferRecord as x, type EventBufferStatus as y, type EventBusOptions as z };
|