arkgate 4.8.23 → 4.8.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +68 -0
- package/README.md +7 -5
- package/bin/ark-check-runtime.mjs +24 -77
- package/bin/ark-dashboard.mjs +56 -53
- package/bin/ark-layer-match.mjs +596 -112
- package/bin/ark-mcp-runtime.mjs +412 -138
- package/bin/ark-mcp.mjs +68 -4
- package/bin/ark-shared.mjs +39 -0
- 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/agent-projection-command.mjs +5 -1
- package/bin/lib/analysis-engine.mjs +15 -11
- package/bin/lib/architecture-scan.mjs +50 -6
- package/bin/lib/ark-order-doctor.mjs +1 -1
- package/bin/lib/ark-order-facts.mjs +410 -15
- package/bin/lib/ark-order-invariants.mjs +51 -9
- package/bin/lib/ark-order-sensors.mjs +28 -101
- package/bin/lib/ark-order-types.mjs +2 -0
- package/bin/lib/ark-run-doctor.mjs +14 -0
- package/bin/lib/ark-run-facts.mjs +434 -11
- package/bin/lib/ark-run-sensors.mjs +5 -3
- package/bin/lib/arkgate-pins.mjs +91 -0
- package/bin/lib/arkrules-sensors.mjs +50 -249
- package/bin/lib/check-args.mjs +23 -1
- package/bin/lib/ci-and-commands.mjs +16 -6
- package/bin/lib/class-source-scan.mjs +479 -0
- package/bin/lib/codex-home.mjs +4 -2
- package/bin/lib/config-contract-slices.mjs +701 -0
- package/bin/lib/config-contract.mjs +5 -493
- package/bin/lib/config-warnings.mjs +32 -0
- package/bin/lib/dashboard-cli.mjs +62 -0
- package/bin/lib/design-delta.mjs +1 -1
- package/bin/lib/diagnostic-catalog.mjs +16 -9
- package/bin/lib/doctor-advisories.mjs +25 -1
- package/bin/lib/doctor-next-actions.mjs +17 -2
- package/bin/lib/doctor-plan.mjs +6 -8
- package/bin/lib/effective-contract-load.mjs +121 -59
- package/bin/lib/enforcement-profiles.mjs +40 -4
- package/bin/lib/first-run-help.mjs +3 -2
- package/bin/lib/flat-parent-importers.mjs +137 -0
- package/bin/lib/flat-parent-pilot.mjs +40 -100
- package/bin/lib/gate-files.mjs +29 -2
- package/bin/lib/git-change-scope.mjs +109 -0
- package/bin/lib/github-enforcement.mjs +1 -1
- package/bin/lib/hook-templates.mjs +18 -16
- package/bin/lib/host-support-matrix.mjs +3 -1
- package/bin/lib/import-resolve.mjs +13 -1
- package/bin/lib/install-migrate.mjs +50 -73
- package/bin/lib/invariant-coverage.mjs +59 -11
- package/bin/lib/mcp-adoption.mjs +9 -1
- package/bin/lib/mcp-hook-payload.mjs +401 -61
- package/bin/lib/package-manager.mjs +59 -1
- package/bin/lib/passthrough-commands.mjs +83 -0
- package/bin/lib/persistence-write-hint.mjs +81 -0
- package/bin/lib/pin-dependent-gates.mjs +117 -0
- package/bin/lib/policy-delta-io.mjs +168 -10
- package/bin/lib/prepare-change.mjs +120 -6
- package/bin/lib/prepare-write.mjs +1 -0
- package/bin/lib/presets.mjs +3 -5
- package/bin/lib/remediation.mjs +23 -4
- package/bin/lib/resolved-candidate-facts.mjs +315 -55
- package/bin/lib/rules-inventory.mjs +22 -3
- package/bin/lib/rules-under-contract.mjs +179 -5
- package/bin/lib/scan-files.mjs +32 -0
- package/bin/lib/snippet-analysis.mjs +140 -6
- package/bin/lib/source-policy.mjs +34 -0
- package/bin/lib/stable-hash.mjs +90 -0
- package/bin/lib/start-install-recovery.mjs +71 -1
- package/bin/lib/start-preview.mjs +30 -0
- package/bin/lib/status-command.mjs +33 -4
- package/bin/lib/status-manifest.mjs +32 -4
- package/bin/lib/team-parliament-io.mjs +77 -75
- package/bin/lib/team-parliament.mjs +6 -1
- package/bin/lib/write-path-capabilities.mjs +4 -2
- package/dist/chunk-A5EIY3HI.cjs +5 -0
- package/dist/chunk-MBXCFLO4.js +16 -0
- package/dist/chunk-RNQHRDCQ.cjs +16 -0
- package/dist/chunk-SVSQVGFJ.js +5 -0
- package/dist/{configTypes-Bbf_MFGe.d.ts → configTypes-BJbaeoj4.d.cts} +18 -3
- package/dist/configTypes-BJbaeoj4.d.ts +246 -0
- package/dist/eslint/index.cjs +17 -4
- package/dist/eslint/index.d.cts +359 -0
- package/dist/eslint/index.d.ts +130 -156
- package/dist/eslint/index.js +10 -4
- package/dist/index.cjs +35 -34
- package/dist/index.d.cts +5475 -0
- package/dist/index.d.ts +3312 -299
- package/dist/index.js +35 -34
- 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} +804 -290
- package/dist/runtime/index.d.ts +2678 -108
- package/dist/runtime/index.js +13 -30
- package/dist/{types-Bdj32QwA.d.ts → types-DRinG-vT.d.cts} +576 -140
- package/dist/types-DRinG-vT.d.ts +1792 -0
- package/docs/README.md +2 -1
- package/docs/agent-guide.md +84 -15
- package/docs/ai-gates.md +160 -26
- package/docs/arkorder.md +32 -15
- package/docs/brownfield-adoption.md +5 -1
- package/docs/configuration.md +196 -26
- package/docs/develop.md +2 -1
- package/docs/diagnostics.md +96 -19
- package/docs/package-surface.md +31 -8
- package/docs/product-voice.md +1 -1
- package/package.json +59 -18
- package/schemas/ark.analysis-result.schema.json +15 -0
- package/schemas/ark.config.schema.json +47 -10
- 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 +4 -1
- package/templates/agent-skills/ark-order/SKILL.md +4 -2
- 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 +4 -1
- package/templates/skills/ark-order.md +4 -2
- package/templates/skills/ark-runtime.md +6 -1
- package/dist/types-Ik_OakcI.d.ts +0 -183
|
@@ -1,128 +1,355 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
+
}
|
|
3
35
|
/**
|
|
4
|
-
*
|
|
36
|
+
* Pluggable persistence for audit records.
|
|
5
37
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* -
|
|
9
|
-
* - Soft policies: violations are reported as warnings but do not throw.
|
|
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`.
|
|
10
41
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
hardViolations: PolicyViolation[];
|
|
16
|
-
softViolations: PolicyViolation[];
|
|
42
|
+
interface AuditStore {
|
|
43
|
+
append(record: AuditRecord): MaybePromise<void>;
|
|
44
|
+
query(query?: AuditQuery): MaybePromise<AuditRecord[]>;
|
|
45
|
+
clear(): MaybePromise<void>;
|
|
17
46
|
}
|
|
18
47
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
48
|
+
* High-level audit API used by the event bus / kernel.
|
|
49
|
+
* Durability is that of the injected `AuditStore` (default in-memory).
|
|
21
50
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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[];
|
|
25
82
|
/**
|
|
26
|
-
*
|
|
83
|
+
* App-context caption for this layer.
|
|
84
|
+
* Metadata — excluded from policy hash. Absence is silent.
|
|
27
85
|
*/
|
|
28
|
-
|
|
86
|
+
description?: string;
|
|
29
87
|
/**
|
|
30
|
-
*
|
|
88
|
+
* Who this folder is for: public | auth | admin | internal.
|
|
89
|
+
* Metadata — excluded from policy hash. Absence is silent. Not host/CI TLS.
|
|
31
90
|
*/
|
|
32
|
-
|
|
91
|
+
trustBoundary?: ArkConfigLayerTrustBoundary;
|
|
33
92
|
/**
|
|
34
|
-
*
|
|
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.
|
|
35
96
|
*/
|
|
36
|
-
|
|
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;
|
|
37
105
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* - Soft violations are collected and can be observed (returned or logged).
|
|
41
|
-
* - Hard violations cause an error to be thrown (by default).
|
|
42
|
-
*
|
|
43
|
-
* @returns Evaluation result (including any soft violations)
|
|
44
|
-
* @throws Error if any hard policy is violated
|
|
106
|
+
* Future house: empty globs are expected. `--strict-config` must not fail.
|
|
107
|
+
* Typo warning (`CONFIG_LAYER_PATTERN_NO_MATCHES`) is skipped.
|
|
45
108
|
*/
|
|
46
|
-
|
|
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[];
|
|
47
122
|
/**
|
|
48
|
-
*
|
|
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).
|
|
49
126
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
|
|
55
|
-
*
|
|
56
|
-
* Central registry for semantic intents.
|
|
57
|
-
* Supports registration, duplicate prevention, and declared dependency relationships.
|
|
58
|
-
*
|
|
59
|
-
* This is a core building block for governance, dependency graphs, and policy enforcement.
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Options for declaring relationships when defining an intent.
|
|
64
|
-
*/
|
|
65
|
-
interface DefineIntentOptions {
|
|
66
|
-
/** Other intents this one depends on (semantic names) */
|
|
67
|
-
dependsOn?: IntentName[];
|
|
68
|
-
/** Intents that this one produces / triggers */
|
|
69
|
-
produces?: IntentName[];
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* IntentRegistry manages all registered intents and their declared relationships.
|
|
73
|
-
*/
|
|
74
|
-
declare class IntentRegistry {
|
|
75
|
-
private readonly intents;
|
|
76
|
-
private readonly dependencies;
|
|
77
|
-
private readonly productions;
|
|
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[];
|
|
78
132
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
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.
|
|
84
138
|
*/
|
|
85
|
-
|
|
139
|
+
sharedImportsSlice?: ArkConfigSharedImportsSlice;
|
|
86
140
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* @param from - The source intent (e.g. an Application operation)
|
|
91
|
-
* @param to - The target intent it depends on (e.g. a Domain event or concept)
|
|
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.
|
|
92
144
|
*/
|
|
93
|
-
|
|
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[];
|
|
94
155
|
/**
|
|
95
|
-
*
|
|
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.
|
|
96
159
|
*/
|
|
97
|
-
|
|
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;
|
|
98
168
|
/**
|
|
99
|
-
*
|
|
169
|
+
* Directed child-slice allowances. `*` is one whole path segment.
|
|
170
|
+
* Clears a sibling crossing only. The universe `allowedCrossSlice` does not read this list.
|
|
100
171
|
*/
|
|
101
|
-
|
|
172
|
+
allowedCrossSlice?: ArkConfigCrossSliceEdge[];
|
|
102
173
|
/**
|
|
103
|
-
*
|
|
174
|
+
* Files outside the slice trees, borrowed onto a child id until they move.
|
|
175
|
+
* `to` is the universe id plus one child segment.
|
|
104
176
|
*/
|
|
105
|
-
|
|
177
|
+
sliceAliases?: ArkConfigSliceAlias[];
|
|
178
|
+
};
|
|
179
|
+
type ArkConfigSliceAlias = {
|
|
180
|
+
from: string;
|
|
181
|
+
to: string;
|
|
182
|
+
};
|
|
183
|
+
type ArkConfigCrossSliceEdge = {
|
|
184
|
+
from: string;
|
|
185
|
+
to: string;
|
|
186
|
+
};
|
|
187
|
+
type ArkConfigSafety = {
|
|
188
|
+
maxTsSuppressions?: number;
|
|
189
|
+
maxAnyCasts?: number;
|
|
190
|
+
allowInMemory?: boolean;
|
|
191
|
+
allowDisabledPeerIsolation?: boolean;
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Optional invariant-coverage scan controls. Absence keeps the built-in
|
|
195
|
+
* defaults (test-name heuristic, 400-file budget) and changes no verdict.
|
|
196
|
+
*/
|
|
197
|
+
type ArkConfigCoverage = {
|
|
198
|
+
/** Globs that decide which files count as tests (replaces the name heuristic). */
|
|
199
|
+
testGlobs?: string[];
|
|
200
|
+
/** Max files loaded as coverage evidence before the budget is exhausted. */
|
|
201
|
+
maxFiles?: number;
|
|
106
202
|
/**
|
|
107
|
-
*
|
|
203
|
+
* Path prefixes where this project declares its test runner actually executes
|
|
204
|
+
* tests. ArkGate never runs anything: this is a second declaration to compare
|
|
205
|
+
* the coverage scan against, so a covering test found outside them is reported
|
|
206
|
+
* (INVARIANT_COVERAGE_OUTSIDE_ROOTS) instead of silently certifying the
|
|
207
|
+
* invariant. Absence is silent unless any catalogued invariant is enforced —
|
|
208
|
+
* then missing roots fail closed (INVARIANT_COVERAGE_ROOTS_MISSING).
|
|
108
209
|
*/
|
|
109
|
-
|
|
210
|
+
coverageRoots?: string[];
|
|
211
|
+
};
|
|
212
|
+
/**
|
|
213
|
+
* ADR 0012 — optional map of layer name → project-relative ArkRules file path.
|
|
214
|
+
* Absence changes no inter-layer verdict.
|
|
215
|
+
*/
|
|
216
|
+
type ArkConfigArkRulesRefs = Record<string, string>;
|
|
217
|
+
/** ADR 0020 — advisory never adds merge teeth; enforced is the extra's merge plane. */
|
|
218
|
+
type ArkConfigArkRunMode = 'advisory' | 'enforced';
|
|
219
|
+
/**
|
|
220
|
+
* ADR 0020 — optional inline ArkRun extra (schema 1.2+). Absence is silent.
|
|
221
|
+
* Present objects are fully defaulted by the loader.
|
|
222
|
+
*/
|
|
223
|
+
type ArkConfigArkRun = {
|
|
224
|
+
mode: ArkConfigArkRunMode;
|
|
225
|
+
compositionRoots: string[];
|
|
226
|
+
kernelRoots?: string[];
|
|
227
|
+
managedLayers: string[];
|
|
228
|
+
requireDeclarations: boolean;
|
|
229
|
+
ignoreDirectNewForErrors?: boolean;
|
|
230
|
+
};
|
|
231
|
+
/** ADR 0027 — advisory never adds merge teeth; enforced is the extra's merge plane. */
|
|
232
|
+
type ArkConfigArkOrderMode = 'advisory' | 'enforced';
|
|
233
|
+
/**
|
|
234
|
+
* ADR 0027 — optional inline ArkOrder extra (schema 1.3+). Absence is silent.
|
|
235
|
+
* Present objects are fully defaulted by the loader.
|
|
236
|
+
*/
|
|
237
|
+
type ArkConfigArkOrder = {
|
|
238
|
+
mode: ArkConfigArkOrderMode;
|
|
239
|
+
planeRoots: string[];
|
|
240
|
+
managedLayers: string[];
|
|
110
241
|
/**
|
|
111
|
-
*
|
|
242
|
+
* Haken cap on one `release()` / `assertXiKeyCap` (default 7).
|
|
243
|
+
* Not a cap on the `xiKeys` watchlist length.
|
|
112
244
|
*/
|
|
113
|
-
|
|
245
|
+
maxXiKeys: number;
|
|
114
246
|
/**
|
|
115
|
-
*
|
|
247
|
+
* Slow product keys the team can already name (plan, cost code, protocol).
|
|
248
|
+
* Optional. Empty → `ARKORDER_XI_FIELD_WRITE` stays silent.
|
|
249
|
+
* Repo-wide watchlist — not compared to `maxXiKeys`.
|
|
116
250
|
*/
|
|
117
|
-
|
|
251
|
+
xiKeys: string[];
|
|
118
252
|
/**
|
|
119
|
-
*
|
|
253
|
+
* Optional globs that narrow ξ field-write observation inside `managedLayers`.
|
|
254
|
+
* Same glob engine as `layers[].patterns`. Absence or empty → every file in
|
|
255
|
+
* those layers. Non-empty → emit only when the layer is managed AND the file
|
|
256
|
+
* matches at least one glob.
|
|
120
257
|
*/
|
|
121
|
-
|
|
258
|
+
appliesTo?: string[];
|
|
259
|
+
};
|
|
260
|
+
type ArkConfig = {
|
|
261
|
+
$schema: string;
|
|
262
|
+
schemaVersion: ArkConfigSchemaVersion;
|
|
263
|
+
name?: string;
|
|
264
|
+
include: string[];
|
|
265
|
+
exclude?: string[];
|
|
266
|
+
excludeGenerated?: boolean;
|
|
267
|
+
frameworkOverlay?: string;
|
|
268
|
+
layers: ArkConfigLayer[];
|
|
269
|
+
rules: ArkConfigRule[];
|
|
270
|
+
cyclePolicy?: ArkConfigCyclePolicy;
|
|
271
|
+
dynamicImportAllowlist?: string[];
|
|
272
|
+
safety?: ArkConfigSafety;
|
|
122
273
|
/**
|
|
123
|
-
*
|
|
274
|
+
* Invariant-coverage scan controls (test globs + file budget).
|
|
275
|
+
* Absence keeps the defaults; it never turns coverage on by itself.
|
|
124
276
|
*/
|
|
125
|
-
|
|
277
|
+
coverage?: ArkConfigCoverage;
|
|
278
|
+
/** ADR 0012 — modular ArkRules references (schema 1.1+). */
|
|
279
|
+
arkRules?: ArkConfigArkRulesRefs;
|
|
280
|
+
/** ADR 0020 — optional ArkRun extra (schema 1.2+). Absence changes no Layers/ArkRules verdict. */
|
|
281
|
+
arkRun?: ArkConfigArkRun;
|
|
282
|
+
/** ADR 0027 — optional ArkOrder extra (schema 1.3+). Absence changes no Layers/ArkRules/ArkRun verdict. */
|
|
283
|
+
arkOrder?: ArkConfigArkOrder;
|
|
284
|
+
/**
|
|
285
|
+
* Optional GitHub handles or emails who may loosen the contract or grow the baseline.
|
|
286
|
+
* Metadata — excluded from policy hash. Absence means no steward lock (policy-ack still applies).
|
|
287
|
+
*/
|
|
288
|
+
stewards?: string[];
|
|
289
|
+
/**
|
|
290
|
+
* When true, every non-reserved layer must name `owners`. Absence/false is
|
|
291
|
+
* silent. This flag is policy teeth (stays in policyHash). Owners themselves
|
|
292
|
+
* stay metadata.
|
|
293
|
+
*/
|
|
294
|
+
requireLayerOwners?: boolean;
|
|
295
|
+
};
|
|
296
|
+
/** Original input version when the loader rewrote schemaVersion toward current. */
|
|
297
|
+
type ArkConfigMigratedFrom = 'unversioned' | '1.0' | '1.1' | '1.2' | null;
|
|
298
|
+
type ArkConfigLoadResult = {
|
|
299
|
+
config: ArkConfig;
|
|
300
|
+
migratedFrom: ArkConfigMigratedFrom;
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Architecture layer profiles.
|
|
305
|
+
*
|
|
306
|
+
* A profile turns semantic names such as `Domain.Order.Placed` into governed
|
|
307
|
+
* layer names and dependency rules.
|
|
308
|
+
*/
|
|
309
|
+
|
|
310
|
+
interface ArchitectureLayer {
|
|
311
|
+
name: string;
|
|
312
|
+
prefixes: string[];
|
|
313
|
+
/**
|
|
314
|
+
* Custom matcher for teams whose intent names don't follow prefix conventions.
|
|
315
|
+
* Checked before any prefix matching, in layer declaration order. A layer may
|
|
316
|
+
* use `match` alone (with `prefixes: []`), prefixes alone, or both.
|
|
317
|
+
*/
|
|
318
|
+
match?: (name: string) => boolean;
|
|
319
|
+
description?: string;
|
|
320
|
+
trustBoundary?: 'public' | 'auth' | 'admin' | 'internal';
|
|
321
|
+
owners?: string[];
|
|
322
|
+
order?: number;
|
|
323
|
+
}
|
|
324
|
+
type ArchitectureRule = ArkConfigRule;
|
|
325
|
+
interface ArchitectureProfile {
|
|
326
|
+
name: string;
|
|
327
|
+
layers: ArchitectureLayer[];
|
|
328
|
+
rules: ArchitectureRule[];
|
|
329
|
+
resolveLayer(name: string): string | undefined;
|
|
330
|
+
}
|
|
331
|
+
interface CreateArchitectureProfileOptions {
|
|
332
|
+
name: string;
|
|
333
|
+
layers: ArchitectureLayer[];
|
|
334
|
+
rules?: ArchitectureRule[];
|
|
335
|
+
}
|
|
336
|
+
interface CreateArchitectureProfileFromArkConfigOptions {
|
|
337
|
+
/** Runtime profile name. Default: config.name or "ark.config.json". */
|
|
338
|
+
name?: string;
|
|
339
|
+
}
|
|
340
|
+
type ArchitectureLayerConfig = ArkConfigLayer;
|
|
341
|
+
type ArkCheckConfig = Omit<ArkConfig, '$schema' | 'schemaVersion' | 'rules'> & {
|
|
342
|
+
$schema?: string;
|
|
343
|
+
schemaVersion?: ArkConfig['schemaVersion'];
|
|
344
|
+
rules?: ArchitectureRule[];
|
|
345
|
+
};
|
|
346
|
+
interface CreateElevenLayerArkConfigOptions {
|
|
347
|
+
/** Source root used in generated file patterns. Default: "src". */
|
|
348
|
+
rootDir?: string;
|
|
349
|
+
/** Include entries for ark-check. Default: [rootDir]. */
|
|
350
|
+
include?: string[];
|
|
351
|
+
/** Mark generated layers optional. Default: true. */
|
|
352
|
+
optionalLayers?: boolean;
|
|
126
353
|
}
|
|
127
354
|
|
|
128
355
|
/**
|
|
@@ -180,65 +407,161 @@ interface DependencyGraph {
|
|
|
180
407
|
detectViolations(rules?: Array<(edges: GraphEdge[]) => string[]>): string[];
|
|
181
408
|
}
|
|
182
409
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
410
|
+
/**
|
|
411
|
+
* Core domain primitives for Ark.
|
|
412
|
+
* These types are the foundation for all governance concepts.
|
|
413
|
+
*/
|
|
414
|
+
/**
|
|
415
|
+
* Semantic intent names follow a convention:
|
|
416
|
+
* - Domain.* for domain events and entities
|
|
417
|
+
* - Application.* for use-cases / orchestration
|
|
418
|
+
* - Adapter.* for integration points
|
|
419
|
+
* - Workflow.* for sagas and processes
|
|
420
|
+
* - Job.* for background jobs and scheduling
|
|
421
|
+
* - Presentation.* for UI/API adapters
|
|
422
|
+
* - Reporting.* for read models and projections
|
|
423
|
+
* - Metadata.* for extensibility contracts
|
|
424
|
+
* - Security.* / Audit.* / Observability.* for cross-cutting kernel concerns
|
|
425
|
+
* - Kernel.* for Ark-owned governance signals
|
|
426
|
+
*/
|
|
427
|
+
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}`;
|
|
428
|
+
type CorrelationId = string;
|
|
429
|
+
interface EventMetadata {
|
|
430
|
+
occurredAt: string;
|
|
431
|
+
source: string;
|
|
432
|
+
kernelInstanceId?: string;
|
|
433
|
+
eventVersion?: string;
|
|
434
|
+
schemaVersion?: string;
|
|
435
|
+
allowInterception?: boolean;
|
|
436
|
+
interceptions?: Array<{
|
|
437
|
+
interceptorId: string;
|
|
438
|
+
timestamp: string;
|
|
439
|
+
}>;
|
|
440
|
+
correlationId?: CorrelationId;
|
|
193
441
|
causationId?: string;
|
|
194
|
-
|
|
195
|
-
|
|
442
|
+
traceId?: string;
|
|
443
|
+
spanId?: string;
|
|
444
|
+
parentSpanId?: string;
|
|
445
|
+
[key: string]: unknown;
|
|
196
446
|
}
|
|
197
|
-
interface
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
actor?: string;
|
|
202
|
-
intent?: string;
|
|
203
|
-
correlationId?: string;
|
|
204
|
-
causationId?: string;
|
|
205
|
-
subject?: string;
|
|
206
|
-
details?: unknown;
|
|
207
|
-
}
|
|
208
|
-
interface AuditQuery {
|
|
209
|
-
type?: AuditRecordType;
|
|
210
|
-
intent?: string;
|
|
211
|
-
correlationId?: string;
|
|
212
|
-
subject?: string;
|
|
213
|
-
since?: string;
|
|
214
|
-
until?: string;
|
|
215
|
-
limit?: number;
|
|
447
|
+
interface DomainEvent<Name extends IntentName = IntentName, Payload = unknown> {
|
|
448
|
+
intent: Name;
|
|
449
|
+
payload: Payload;
|
|
450
|
+
metadata: EventMetadata;
|
|
216
451
|
}
|
|
452
|
+
|
|
217
453
|
/**
|
|
218
|
-
*
|
|
454
|
+
* Intent-specific types for the Ark kernel.
|
|
219
455
|
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
* See `docs/production-hardening.md`.
|
|
456
|
+
* Intents provide semantic naming for every important concept in the system
|
|
457
|
+
* (domain events, application operations, adapters, workflows).
|
|
223
458
|
*/
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* An IntentCreator is a callable that creates a strongly-typed DomainEvent
|
|
462
|
+
* when invoked with a payload.
|
|
463
|
+
*
|
|
464
|
+
* It also carries the semantic `name`.
|
|
465
|
+
*
|
|
466
|
+
* @example
|
|
467
|
+
* const OrderPlaced = defineIntent<'Domain.Order.OrderPlaced', { orderId: string }>('Domain.Order.OrderPlaced');
|
|
468
|
+
* const event = OrderPlaced({ orderId: 'o-1' });
|
|
469
|
+
*/
|
|
470
|
+
interface IntentCreator<Name extends IntentName, Payload = unknown> {
|
|
471
|
+
/**
|
|
472
|
+
* Creates a DomainEvent for this intent.
|
|
473
|
+
*/
|
|
474
|
+
(payload: Payload): DomainEvent<Name, Payload>;
|
|
475
|
+
/**
|
|
476
|
+
* The fully-qualified semantic name of the intent (e.g. "Domain.Order.OrderPlaced").
|
|
477
|
+
*/
|
|
478
|
+
readonly name: Name;
|
|
228
479
|
}
|
|
480
|
+
/** Kind of relationship between two intents. */
|
|
481
|
+
type IntentRelationshipKind = 'dependsOn' | 'produces';
|
|
229
482
|
/**
|
|
230
|
-
*
|
|
231
|
-
*
|
|
483
|
+
* Relationship declarations between intents.
|
|
484
|
+
* Used for dependency analysis and graph generation.
|
|
232
485
|
*/
|
|
233
|
-
interface
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
486
|
+
interface IntentRelationship {
|
|
487
|
+
from: string;
|
|
488
|
+
to: string;
|
|
489
|
+
kind: IntentRelationshipKind;
|
|
237
490
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* IntentRegistry
|
|
494
|
+
*
|
|
495
|
+
* Central registry for semantic intents.
|
|
496
|
+
* Supports registration, duplicate prevention, and declared dependency relationships.
|
|
497
|
+
*
|
|
498
|
+
* This is a core building block for governance, dependency graphs, and policy enforcement.
|
|
499
|
+
*/
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Options for declaring relationships when defining an intent.
|
|
503
|
+
*/
|
|
504
|
+
interface DefineIntentOptions {
|
|
505
|
+
/** Other intents this one depends on (semantic names) */
|
|
506
|
+
dependsOn?: IntentName[];
|
|
507
|
+
/** Intents that this one produces / triggers */
|
|
508
|
+
produces?: IntentName[];
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* IntentRegistry manages all registered intents and their declared relationships.
|
|
512
|
+
*/
|
|
513
|
+
declare class IntentRegistry {
|
|
514
|
+
private readonly intents;
|
|
515
|
+
private readonly dependencies;
|
|
516
|
+
private readonly productions;
|
|
517
|
+
/**
|
|
518
|
+
* Define/register a new intent.
|
|
519
|
+
*
|
|
520
|
+
* @param name - Semantic intent name following the convention (Domain.*, Application.*, etc.)
|
|
521
|
+
* @param options - Optional relationship declarations
|
|
522
|
+
* @throws Error if an intent with the same name is already registered
|
|
523
|
+
*/
|
|
524
|
+
define<N extends IntentName, P = unknown>(name: N, options?: DefineIntentOptions): IntentCreator<N, P>;
|
|
525
|
+
/**
|
|
526
|
+
* Declare that one intent depends on / relates to another.
|
|
527
|
+
* This information is used by the DependencyGraph (future iterations) and for policy checks.
|
|
528
|
+
*
|
|
529
|
+
* @param from - The source intent (e.g. an Application operation)
|
|
530
|
+
* @param to - The target intent it depends on (e.g. a Domain event or concept)
|
|
531
|
+
*/
|
|
532
|
+
declareDependency(from: string, to: string): void;
|
|
533
|
+
/**
|
|
534
|
+
* Declare that one intent produces / emits another (e.g. use case → domain event).
|
|
535
|
+
*/
|
|
536
|
+
declareProduction(from: string, to: string): void;
|
|
537
|
+
/**
|
|
538
|
+
* Retrieve a previously defined intent creator by name.
|
|
539
|
+
*/
|
|
540
|
+
get<N extends IntentName = IntentName, P = unknown>(name: string): IntentCreator<N, P> | undefined;
|
|
541
|
+
/**
|
|
542
|
+
* List all registered intent creators.
|
|
543
|
+
*/
|
|
544
|
+
list(): IntentCreator<IntentName, unknown>[];
|
|
545
|
+
/**
|
|
546
|
+
* Get all declared dependencies for a given intent.
|
|
547
|
+
*/
|
|
548
|
+
getDependencies(intentName: string): string[];
|
|
549
|
+
/**
|
|
550
|
+
* Get all intents produced / emitted by a given intent.
|
|
551
|
+
*/
|
|
552
|
+
getProductions(intentName: string): string[];
|
|
553
|
+
/**
|
|
554
|
+
* Get all declared relationships (useful for graph generation).
|
|
555
|
+
*/
|
|
556
|
+
getAllRelationships(): IntentRelationship[];
|
|
557
|
+
/**
|
|
558
|
+
* Check if an intent name has been registered.
|
|
559
|
+
*/
|
|
560
|
+
has(name: string): boolean;
|
|
561
|
+
/**
|
|
562
|
+
* Clear the registry. Primarily useful for tests.
|
|
563
|
+
*/
|
|
564
|
+
clear(): void;
|
|
242
565
|
}
|
|
243
566
|
|
|
244
567
|
type EventSchemaFieldType = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'unknown';
|
|
@@ -418,6 +741,102 @@ interface CreateProjectionRegistryOptions {
|
|
|
418
741
|
auditTrail?: AuditTrail;
|
|
419
742
|
}
|
|
420
743
|
|
|
744
|
+
/**
|
|
745
|
+
* Policy types for the Ark kernel.
|
|
746
|
+
*
|
|
747
|
+
* Policies allow declaring architectural rules that can be checked at runtime.
|
|
748
|
+
* Supports both hard policies (must never be violated) and soft policies (warnings).
|
|
749
|
+
*/
|
|
750
|
+
type PolicySeverity = 'hard' | 'soft';
|
|
751
|
+
type PolicyEnforcementMode = 'runtime' | 'static' | 'runtime-and-static' | 'advisory';
|
|
752
|
+
/**
|
|
753
|
+
* Represents a single violation of a policy.
|
|
754
|
+
*/
|
|
755
|
+
interface PolicyViolation {
|
|
756
|
+
/** Name of the policy that was violated */
|
|
757
|
+
policyName: string;
|
|
758
|
+
/** Severity level of the policy */
|
|
759
|
+
severity: PolicySeverity;
|
|
760
|
+
/** Human-readable explanation of the violation */
|
|
761
|
+
message: string;
|
|
762
|
+
/** Optional additional structured details */
|
|
763
|
+
details?: unknown;
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* A Policy defines a rule that can be evaluated against a context.
|
|
767
|
+
*
|
|
768
|
+
* @template Context - The shape of data the policy evaluates (e.g. { registry, events })
|
|
769
|
+
*/
|
|
770
|
+
interface Policy<Context = unknown> {
|
|
771
|
+
/** Unique name of the policy (used in violations and reporting) */
|
|
772
|
+
readonly name: string;
|
|
773
|
+
/** Whether this is a hard rule (enforced strictly) or soft (advisory) */
|
|
774
|
+
readonly severity: PolicySeverity;
|
|
775
|
+
/** Optional tags for policy classification (e.g. 'layer', 'naming') */
|
|
776
|
+
readonly tags?: readonly string[];
|
|
777
|
+
readonly owner?: string;
|
|
778
|
+
readonly version?: string;
|
|
779
|
+
readonly rationale?: string;
|
|
780
|
+
readonly enforcementMode?: PolicyEnforcementMode;
|
|
781
|
+
readonly deprecated?: boolean | string;
|
|
782
|
+
readonly replacedBy?: string;
|
|
783
|
+
/**
|
|
784
|
+
* Evaluates the policy against the given context.
|
|
785
|
+
* Return true / [] for pass, false / single violation / array for failure.
|
|
786
|
+
*/
|
|
787
|
+
check(context: Context): boolean | PolicyViolation | PolicyViolation[];
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* PolicyEngine
|
|
792
|
+
*
|
|
793
|
+
* Evaluates collections of policies against a context.
|
|
794
|
+
* Supports hard and soft policies.
|
|
795
|
+
* - Hard policies: violations cause enforcement to throw.
|
|
796
|
+
* - Soft policies: violations are reported as warnings but do not throw.
|
|
797
|
+
*/
|
|
798
|
+
|
|
799
|
+
interface PolicyEvaluationResult {
|
|
800
|
+
passed: boolean;
|
|
801
|
+
violations: PolicyViolation[];
|
|
802
|
+
hardViolations: PolicyViolation[];
|
|
803
|
+
softViolations: PolicyViolation[];
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
806
|
+
* The PolicyEngine is responsible for registering policies and evaluating
|
|
807
|
+
* them against a given context.
|
|
808
|
+
*/
|
|
809
|
+
declare class PolicyEngine<Context = unknown> {
|
|
810
|
+
private readonly policies;
|
|
811
|
+
constructor(initialPolicies?: Policy<Context>[]);
|
|
812
|
+
/**
|
|
813
|
+
* Adds a policy to the engine.
|
|
814
|
+
*/
|
|
815
|
+
add(policy: Policy<Context>): void;
|
|
816
|
+
/**
|
|
817
|
+
* Returns all registered policies.
|
|
818
|
+
*/
|
|
819
|
+
getPolicies(): Policy<Context>[];
|
|
820
|
+
/**
|
|
821
|
+
* Evaluates all policies against the provided context.
|
|
822
|
+
*/
|
|
823
|
+
evaluate(context: Context): PolicyEvaluationResult;
|
|
824
|
+
/**
|
|
825
|
+
* Enforces all policies.
|
|
826
|
+
*
|
|
827
|
+
* - Soft violations are collected and can be observed (returned or logged).
|
|
828
|
+
* - Hard violations cause an error to be thrown (by default).
|
|
829
|
+
*
|
|
830
|
+
* @returns Evaluation result (including any soft violations)
|
|
831
|
+
* @throws Error if any hard policy is violated
|
|
832
|
+
*/
|
|
833
|
+
enforce(context: Context): PolicyEvaluationResult;
|
|
834
|
+
/**
|
|
835
|
+
* Clears all registered policies.
|
|
836
|
+
*/
|
|
837
|
+
clear(): void;
|
|
838
|
+
}
|
|
839
|
+
|
|
421
840
|
type EventBufferStatus = 'pending' | 'dispatched' | 'failed';
|
|
422
841
|
interface EventBufferRecord {
|
|
423
842
|
id: string;
|
|
@@ -464,7 +883,7 @@ type OutboxStore = EventBufferStore;
|
|
|
464
883
|
*/
|
|
465
884
|
|
|
466
885
|
/** Standard trace record for observability and agent consumption. */
|
|
467
|
-
type TraceRecordType = 'event.published' | 'event.rawPublish' | 'event.intercepted' | 'interceptor.error' | 'policy.hardViolation' | 'policy.softViolation' | 'layer.observedViolation' | 'handler.error' | 'hook.error';
|
|
886
|
+
type TraceRecordType = 'event.published' | 'event.rawPublish' | 'event.handoffFailed' | 'event.intercepted' | 'interceptor.error' | 'policy.hardViolation' | 'policy.softViolation' | 'layer.observedViolation' | 'handler.error' | 'hook.error';
|
|
468
887
|
/**
|
|
469
888
|
* Runtime enforcement mode for observed producer→event layer flows.
|
|
470
889
|
* - 'off': flows are recorded (for drift reports) but never enforced.
|
|
@@ -510,6 +929,15 @@ interface EventBusOptions<Context = unknown> {
|
|
|
510
929
|
enforceObservedLayerFlow?: ObservedLayerFlowMode;
|
|
511
930
|
/** Optional non-atomic event buffer for dispatch handoff. */
|
|
512
931
|
eventBuffer?: EventBufferStore;
|
|
932
|
+
/**
|
|
933
|
+
* When true, the event-buffer record written for a publish is marked
|
|
934
|
+
* `dispatched` once local delivery finishes (handlers + onPublish), or `failed`
|
|
935
|
+
* when a rethrown handler error aborts it. Use only when no external relay
|
|
936
|
+
* drains the buffer. Default: false — records stay `pending` for a
|
|
937
|
+
* consumer-owned relay (`claim` / `markDispatched`). `createArkKernel` turns
|
|
938
|
+
* this on for its default in-memory buffer only.
|
|
939
|
+
*/
|
|
940
|
+
settleBufferOnLocalDelivery?: boolean;
|
|
513
941
|
/** @deprecated Use eventBuffer. */
|
|
514
942
|
outbox?: EventBufferStore;
|
|
515
943
|
/** Stable id stamped into event metadata for this kernel/event bus instance. */
|
|
@@ -604,6 +1032,14 @@ interface EventDispatchControl {
|
|
|
604
1032
|
awaitHandlers?: boolean;
|
|
605
1033
|
runOnPublish?: boolean;
|
|
606
1034
|
tx?: unknown;
|
|
1035
|
+
/**
|
|
1036
|
+
* When false, skip local-delivery settlement of the buffer record even if the
|
|
1037
|
+
* bus settles on local delivery (the caller owns the outcome, e.g. a broker
|
|
1038
|
+
* handoff). Default: the bus `settleBufferOnLocalDelivery` option.
|
|
1039
|
+
*/
|
|
1040
|
+
settleBufferOnLocalDelivery?: boolean;
|
|
1041
|
+
/** Receives the event-buffer record written for this publish, when any. */
|
|
1042
|
+
onBufferRecord?: (record: EventBufferRecord) => void;
|
|
607
1043
|
}
|
|
608
1044
|
/**
|
|
609
1045
|
* The public EventBus interface.
|
|
@@ -1353,4 +1789,4 @@ interface CreateArkKernelFromConfigOptions extends Omit<CreateArkKernelOptions,
|
|
|
1353
1789
|
}
|
|
1354
1790
|
type ArkKernelConfig = ArkCheckConfig;
|
|
1355
1791
|
|
|
1356
|
-
export {
|
|
1792
|
+
export { type OutboxRecord 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 DependencyInformationPackage as U, type ArkKernelConfig as V, type WorkflowStore as W, type CreateArkKernelFromConfigOptions as X, type TraceRecordType as Y, type TraceRecord as Z, type OutboxStatus as _, type AuditStore as a, type ArkRunInspectorSource as a$, type ObservabilityDriftReport as a0, type ArkConfig as a1, type ArkConfigLoadResult 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 };
|