arkgate 4.7.6 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +28 -3
  2. package/README.md +8 -9
  3. package/bin/lib/analysis-engine.mjs +6 -6
  4. package/bin/lib/ark-order-error.mjs +18 -0
  5. package/bin/lib/ark-order-facts.mjs +53 -0
  6. package/bin/lib/ark-order-invariants.mjs +160 -0
  7. package/bin/lib/ark-order-sensors.mjs +118 -0
  8. package/bin/lib/ark-order-types.mjs +11 -0
  9. package/bin/lib/ark-run-sensors.mjs +13 -5
  10. package/bin/lib/config-contract.mjs +16 -72
  11. package/bin/lib/config-extras.mjs +151 -0
  12. package/bin/lib/diagnostic-catalog.mjs +7 -2
  13. package/bin/lib/extra-merge-teeth.mjs +8 -2
  14. package/bin/lib/install-migrate.mjs +4 -2
  15. package/bin/lib/managed-upgrade.mjs +1 -1
  16. package/bin/lib/mcp-adoption.mjs +9 -3
  17. package/bin/lib/remediation.mjs +48 -9
  18. package/bin/lib/resolved-candidate-facts.mjs +43 -0
  19. package/bin/lib/skill-install.mjs +17 -2
  20. package/bin/lib/start-preview.mjs +1 -0
  21. package/bin/lib/status-manifest.mjs +1 -1
  22. package/bin/lib/write-path-capabilities.mjs +2 -2
  23. package/dist/{configTypes-CgJimx9o.d.ts → configTypes-BdCe_gvv.d.ts} +22 -6
  24. package/dist/diagnosticCatalog-RiKPUFRG.d.ts +2307 -0
  25. package/dist/eslint/index.cjs +7 -6
  26. package/dist/eslint/index.d.ts +33 -2
  27. package/dist/eslint/index.js +7 -6
  28. package/dist/index.cjs +35 -35
  29. package/dist/index.d.ts +271 -2554
  30. package/dist/index.js +35 -35
  31. package/dist/nestjs/index.cjs +18 -0
  32. package/dist/nestjs/index.d.ts +24 -0
  33. package/dist/nestjs/index.js +18 -0
  34. package/dist/order/index.cjs +1 -0
  35. package/dist/order/index.d.ts +79 -0
  36. package/dist/order/index.js +1 -0
  37. package/dist/runtime/index.cjs +25 -0
  38. package/dist/runtime/index.d.ts +497 -0
  39. package/dist/runtime/index.js +25 -0
  40. package/dist/types-C9KApBzX.d.ts +1237 -0
  41. package/dist/types-DCSlrRnV.d.ts +181 -0
  42. package/docs/README.md +4 -4
  43. package/docs/agent-guide.md +1 -1
  44. package/docs/ai-gates.md +9 -2
  45. package/docs/configuration.md +13 -6
  46. package/docs/develop.md +4 -3
  47. package/docs/diagnostics.md +57 -3
  48. package/docs/package-surface.md +20 -16
  49. package/docs/product-voice.md +2 -1
  50. package/package.json +21 -2
  51. package/schemas/ark.config.schema.json +54 -2
  52. package/schemas/ark.resolved-candidate-facts.schema.json +1 -1
  53. package/server.json +2 -2
  54. package/templates/agent-skills/README.md +1 -1
  55. package/templates/agent-skills/ark-adopt/SKILL.md +2 -2
  56. package/templates/agent-skills/ark-contract/SKILL.md +1 -1
  57. package/templates/agent-skills/ark-place/SKILL.md +15 -6
  58. package/templates/agent-skills/ark-runtime/SKILL.md +10 -15
  59. package/templates/skills/ark-adopt.md +2 -2
  60. package/templates/skills/ark-contract.md +1 -1
  61. package/templates/skills/ark-place.md +15 -6
  62. package/templates/skills/ark-runtime.md +10 -15
package/dist/index.d.ts CHANGED
@@ -1,411 +1,7 @@
1
- import { a as ArkConfigRule, b as ArkConfigSchemaVersion, c as ArkConfigLoadResult, d as ArkConfigLayer, A as ArkConfig, e as ArkConfigIssue, f as ArkConfigArkRun } from './configTypes-CgJimx9o.js';
2
-
3
- /** Versioned public result contract shared by every ArkGate enforcement adapter. */
4
- /**
5
- * 1.5 adds stable finding refs on every factory-emitted diagnostic (ACS06):
6
- * `findingRef`, `targetKey` (baseline-compatible), `docsCodePath`.
7
- * 1.4 added optional evidence.arkruleId + evidence.arkruleSource (ADR 0012 / AR03).
8
- */
9
- declare const ARK_ANALYSIS_RESULT_SCHEMA_VERSION: "1.5";
10
- /** Repo-relative diagnostics docs path (parity with ACS02 diagnostic catalog). */
11
- declare const ADAPTER_DIAGNOSTIC_DOCS_RELATIVE_PATH: "docs/diagnostics.md";
12
- type AdapterSeverity = 'error' | 'warning';
13
- type AnalysisCompleteness = 'complete' | 'partial' | 'unavailable';
14
- type AnalysisMode = 'lexical-compatibility' | 'resolved-candidate-facts';
15
- type AdapterCompletenessReason = {
16
- code: string;
17
- message: string;
18
- file?: string;
19
- };
20
- type AdapterViolationInput = {
21
- ruleId?: unknown;
22
- code?: unknown;
23
- message?: unknown;
24
- file?: unknown;
25
- line?: unknown;
26
- column?: unknown;
27
- target?: unknown;
28
- fromLayer?: unknown;
29
- toLayer?: unknown;
30
- typeOnly?: unknown;
31
- targetTypeOnlyExports?: unknown;
32
- sourcePureTypeModule?: unknown;
33
- namedBindingsTypeOnly?: unknown;
34
- portProofEligible?: unknown;
35
- peerIsolation?: unknown;
36
- edgeKind?: unknown;
37
- severity?: unknown;
38
- /** When false, finding is non-blocking (e.g. type-only placement debt). */
39
- failsStrict?: unknown;
40
- nextAction?: unknown;
41
- /** U04: the denied capability id on CAPABILITY_VIOLATION. */
42
- capability?: unknown;
43
- /** AR03: ArkRule identity for structure/invariant diagnostics. */
44
- arkruleId?: unknown;
45
- /** AR03: project-relative ArkRules source file that declared the rule. */
46
- arkruleSource?: unknown;
47
- };
48
- type AdapterDiagnostic = {
49
- ruleId: string;
50
- severity: AdapterSeverity;
51
- message: string;
52
- location: {
53
- file: string;
54
- line: number;
55
- column: number;
56
- };
57
- evidence: {
58
- target?: string;
59
- fromLayer?: string;
60
- toLayer?: string;
61
- typeOnly?: boolean;
62
- targetTypeOnlyExports?: boolean;
63
- sourcePureTypeModule?: boolean;
64
- namedBindingsTypeOnly?: boolean;
65
- portProofEligible?: boolean;
66
- peerIsolation?: boolean;
67
- capability?: string;
68
- edgeKind?: string;
69
- /** AR03 — ArkRule id (structure or invariant). */
70
- arkruleId?: string;
71
- /** AR03 — ArkRules source file path. */
72
- arkruleSource?: string;
73
- };
74
- /** Added in schema 1.1; optional in TypeScript so 1.0 consumer-owned values remain valid. */
75
- nextAction?: string;
76
- /**
77
- * ACS06 / schema 1.5 — compact stable id for multi-turn re-address
78
- * (`fnv1a-` + hex). Always derived from `targetKey`. Optional so 1.0–1.4
79
- * consumer-owned diagnostics remain assignable.
80
- */
81
- findingRef?: string;
82
- /**
83
- * ACS06 / schema 1.5 — baseline-compatible freeze identity
84
- * (`ruleId|file|fromLayer|toLayer|target`, with occurrence `#N` suffixes in lists).
85
- * Must match `baselineKey` / `baselineOccurrenceKeys` so refs never orphan baselines.
86
- */
87
- targetKey?: string;
88
- /**
89
- * ACS06 / schema 1.5 — package-relative docs path with rule anchor
90
- * (`docs/diagnostics.md#RULE_ID`). Optional for legacy consumer-owned values.
91
- */
92
- docsCodePath?: string;
93
- };
94
- type LegacyAdapterResult = {
95
- schemaVersion: '1.0' | '1.1';
96
- valid: boolean;
97
- diagnostics: AdapterDiagnostic[];
98
- completeness?: never;
99
- mode?: never;
100
- };
101
- type Version12AdapterResultBase = {
102
- schemaVersion: '1.2';
103
- diagnostics: AdapterDiagnostic[];
104
- mode?: never;
105
- };
106
- type Version12AdapterResult = (Version12AdapterResultBase & {
107
- completeness: 'complete';
108
- valid: boolean;
109
- }) | (Version12AdapterResultBase & {
110
- completeness: 'partial' | 'unavailable';
111
- valid: false;
112
- });
113
- type CurrentAdapterResultBase = {
114
- schemaVersion: typeof ARK_ANALYSIS_RESULT_SCHEMA_VERSION;
115
- completenessReasons: AdapterCompletenessReason[];
116
- diagnostics: AdapterDiagnostic[];
117
- };
118
- type ResolvedAdapterEvidence = {
119
- policyHash: string;
120
- resolverIdentity: string;
121
- factsHash: string;
122
- candidateTreeHash: string;
123
- };
124
- type CurrentAdapterResult = (CurrentAdapterResultBase & Partial<ResolvedAdapterEvidence> & {
125
- mode: 'lexical-compatibility';
126
- valid: boolean;
127
- completeness: 'complete';
128
- }) | (CurrentAdapterResultBase & Partial<ResolvedAdapterEvidence> & {
129
- mode: 'lexical-compatibility';
130
- valid: false;
131
- completeness: 'partial' | 'unavailable';
132
- }) | (CurrentAdapterResultBase & ResolvedAdapterEvidence & {
133
- mode: 'resolved-candidate-facts';
134
- valid: boolean;
135
- completeness: 'complete';
136
- }) | (CurrentAdapterResultBase & ResolvedAdapterEvidence & {
137
- mode: 'resolved-candidate-facts';
138
- valid: false;
139
- completeness: 'partial';
140
- }) | (CurrentAdapterResultBase & Partial<ResolvedAdapterEvidence> & {
141
- mode: 'resolved-candidate-facts';
142
- valid: false;
143
- completeness: 'unavailable';
144
- });
145
- type AdapterResult = LegacyAdapterResult | Version12AdapterResult | CurrentAdapterResult;
146
- /**
147
- * Baseline-compatible target key for a violation input.
148
- * Field order and empty-string fallbacks **must** match `baselineKey` in
149
- * `baselineKey.ts` — parity tests guard this so finding refs never orphan freezes.
150
- *
151
- * Note: uses raw ruleId/file strings (including empty) the same way baseline does;
152
- * display `ruleId` / `location.file` may still normalize to ARK_UNKNOWN / `<unknown>`.
153
- */
154
- declare function adapterFindingTargetKey(violation: AdapterViolationInput): string;
155
- /**
156
- * Occurrence-aware target keys for a violation list (parity with baselineOccurrenceKeys).
157
- * First occurrence keeps the historical base key; duplicates get `#N`.
158
- */
159
- declare function adapterFindingOccurrenceTargetKeys(violations: readonly AdapterViolationInput[]): string[];
160
- /** FNV-1a finding ref from a baseline-compatible targetKey (not a security hash). */
161
- declare function adapterFindingRefFromTargetKey(targetKey: string): string;
162
- /** Package-relative docs path with fragment for a public ruleId. */
163
- declare function adapterDocsCodePath(ruleId: string): string;
164
- declare function toAdapterDiagnostic(violation: AdapterViolationInput, fallbackSeverity?: AdapterSeverity,
165
- /**
166
- * Optional precomputed baseline-compatible targetKey (e.g. occurrence-aware from
167
- * `adapterFindingOccurrenceTargetKeys`). When omitted, uses the first-occurrence key.
168
- */
169
- targetKeyOverride?: string): AdapterDiagnostic;
170
- declare function createAdapterResult(input: {
171
- valid: boolean;
172
- completeness?: AnalysisCompleteness;
173
- mode?: AnalysisMode;
174
- policyHash?: unknown;
175
- resolverIdentity?: unknown;
176
- factsHash?: unknown;
177
- candidateTreeHash?: unknown;
178
- completenessReasons?: readonly AdapterCompletenessReason[];
179
- violations?: readonly AdapterViolationInput[];
180
- warnings?: readonly AdapterViolationInput[];
181
- }): CurrentAdapterResult;
182
- declare const ARK_ANALYSIS_RESULT_SCHEMA: {
183
- readonly $schema: "https://json-schema.org/draft/2020-12/schema";
184
- readonly $id: "https://unpkg.com/arkgate@3/schemas/ark.analysis-result.schema.json";
185
- readonly title: "ArkGate analysis result";
186
- readonly type: "object";
187
- readonly additionalProperties: false;
188
- readonly required: readonly ["schemaVersion", "mode", "valid", "completeness", "completenessReasons", "diagnostics"];
189
- readonly allOf: readonly [{
190
- readonly if: {
191
- readonly properties: {
192
- readonly completeness: {
193
- readonly enum: readonly ["partial", "unavailable"];
194
- };
195
- };
196
- readonly required: readonly ["completeness"];
197
- };
198
- readonly then: {
199
- readonly properties: {
200
- readonly valid: {
201
- readonly const: false;
202
- };
203
- };
204
- };
205
- }, {
206
- readonly if: {
207
- readonly properties: {
208
- readonly mode: {
209
- readonly const: "resolved-candidate-facts";
210
- };
211
- readonly completeness: {
212
- readonly enum: readonly ["complete", "partial"];
213
- };
214
- };
215
- readonly required: readonly ["mode", "completeness"];
216
- };
217
- readonly then: {
218
- readonly required: readonly ["policyHash", "resolverIdentity", "factsHash", "candidateTreeHash"];
219
- };
220
- }, {
221
- readonly if: {
222
- readonly properties: {
223
- readonly completeness: {
224
- readonly const: "complete";
225
- };
226
- };
227
- readonly required: readonly ["completeness"];
228
- };
229
- readonly then: {
230
- readonly properties: {
231
- readonly completenessReasons: {
232
- readonly maxItems: 0;
233
- };
234
- };
235
- };
236
- readonly else: {
237
- readonly properties: {
238
- readonly completenessReasons: {
239
- readonly minItems: 1;
240
- };
241
- };
242
- };
243
- }];
244
- readonly properties: {
245
- readonly schemaVersion: {
246
- readonly const: "1.5";
247
- };
248
- readonly mode: {
249
- readonly enum: readonly ["lexical-compatibility", "resolved-candidate-facts"];
250
- };
251
- readonly valid: {
252
- readonly type: "boolean";
253
- };
254
- readonly completeness: {
255
- readonly enum: readonly ["complete", "partial", "unavailable"];
256
- };
257
- readonly completenessReasons: {
258
- readonly type: "array";
259
- readonly items: {
260
- readonly type: "object";
261
- readonly additionalProperties: false;
262
- readonly required: readonly ["code", "message"];
263
- readonly properties: {
264
- readonly code: {
265
- readonly type: "string";
266
- readonly minLength: 1;
267
- };
268
- readonly message: {
269
- readonly type: "string";
270
- readonly minLength: 1;
271
- };
272
- readonly file: {
273
- readonly type: "string";
274
- readonly minLength: 1;
275
- };
276
- };
277
- };
278
- };
279
- readonly policyHash: {
280
- readonly type: "string";
281
- readonly minLength: 1;
282
- };
283
- readonly resolverIdentity: {
284
- readonly type: "string";
285
- readonly minLength: 1;
286
- };
287
- readonly factsHash: {
288
- readonly type: "string";
289
- readonly minLength: 1;
290
- };
291
- readonly candidateTreeHash: {
292
- readonly type: "string";
293
- readonly minLength: 1;
294
- };
295
- readonly diagnostics: {
296
- readonly type: "array";
297
- readonly items: {
298
- readonly type: "object";
299
- readonly additionalProperties: false;
300
- readonly required: readonly ["ruleId", "severity", "message", "location", "evidence"];
301
- readonly properties: {
302
- readonly ruleId: {
303
- readonly type: "string";
304
- readonly minLength: 1;
305
- };
306
- readonly severity: {
307
- readonly enum: readonly ["error", "warning"];
308
- };
309
- readonly message: {
310
- readonly type: "string";
311
- readonly minLength: 1;
312
- };
313
- readonly location: {
314
- readonly type: "object";
315
- readonly additionalProperties: false;
316
- readonly required: readonly ["file", "line", "column"];
317
- readonly properties: {
318
- readonly file: {
319
- readonly type: "string";
320
- readonly minLength: 1;
321
- };
322
- readonly line: {
323
- readonly type: "integer";
324
- readonly minimum: 1;
325
- };
326
- readonly column: {
327
- readonly type: "integer";
328
- readonly minimum: 1;
329
- };
330
- };
331
- };
332
- readonly evidence: {
333
- readonly type: "object";
334
- readonly additionalProperties: false;
335
- readonly properties: {
336
- readonly target: {
337
- readonly type: "string";
338
- };
339
- readonly fromLayer: {
340
- readonly type: "string";
341
- };
342
- readonly toLayer: {
343
- readonly type: "string";
344
- };
345
- readonly typeOnly: {
346
- readonly type: "boolean";
347
- };
348
- readonly targetTypeOnlyExports: {
349
- readonly type: "boolean";
350
- };
351
- readonly sourcePureTypeModule: {
352
- readonly type: "boolean";
353
- };
354
- readonly namedBindingsTypeOnly: {
355
- readonly type: "boolean";
356
- };
357
- readonly portProofEligible: {
358
- readonly type: "boolean";
359
- };
360
- readonly peerIsolation: {
361
- readonly type: "boolean";
362
- };
363
- readonly capability: {
364
- readonly type: "string";
365
- readonly minLength: 1;
366
- };
367
- readonly edgeKind: {
368
- readonly type: "string";
369
- readonly minLength: 1;
370
- };
371
- readonly arkruleId: {
372
- readonly type: "string";
373
- readonly minLength: 1;
374
- };
375
- readonly arkruleSource: {
376
- readonly type: "string";
377
- readonly minLength: 1;
378
- };
379
- };
380
- };
381
- readonly nextAction: {
382
- readonly type: "string";
383
- readonly minLength: 1;
384
- };
385
- /** ACS06 — compact multi-turn id; always derived from targetKey when emitted. */
386
- readonly findingRef: {
387
- readonly type: "string";
388
- readonly minLength: 1;
389
- readonly pattern: "^fnv1a-[0-9a-f]{8}$";
390
- };
391
- /**
392
- * ACS06 — baseline-compatible freeze identity
393
- * (`ruleId|file|from|to|target` with optional `#N` occurrence suffix).
394
- */
395
- readonly targetKey: {
396
- readonly type: "string";
397
- readonly minLength: 1;
398
- };
399
- /** ACS06 — package-relative diagnostics anchor path. */
400
- readonly docsCodePath: {
401
- readonly type: "string";
402
- readonly minLength: 1;
403
- };
404
- };
405
- };
406
- };
407
- };
408
- };
1
+ import { A as ArkRulesFile, E as EffectiveArkRules, R as ResolvedArkRunKernelCallKind, a as ResolvedArkRunDeclarationFact, b as ResolvedArkRunKernelCallFact, c as ResolvedArkRunManagedNewFact, d as ResolvedDependencyFact, e as ResolvedArkRunCompositionRootHitFact, f as ResolvedFactsReason, g as ResolvedArkOrderPlaneCallFact, h as ResolvedArkOrderGenericUpdateFact, i as ResolvedArkOrderRootHitFact } from './diagnosticCatalog-RiKPUFRG.js';
2
+ export { j as ADAPTER_DIAGNOSTIC_DOCS_RELATIVE_PATH, k as AICodeGate, l as AICodeGateContext, m as AICodeGateOptions, n as AICodeGateResult, o as AICodeGateViolation, p as AIGateExtension, q as ANALYSIS_IR_SCHEMA_VERSION, r as ARK_ANALYSIS_RESULT_SCHEMA, s as ARK_ANALYSIS_RESULT_SCHEMA_VERSION, t as ARK_DESIGN_DELTA_SCHEMA_VERSION, u as ARK_ENFORCEMENT_STATE_SCHEMA_VERSION, v as AdapterCompletenessReason, w as AdapterDiagnostic, x as AdapterResult, y as AdapterSeverity, z as AdapterViolationInput, B as AnalysisCapabilityUse, C as AnalysisCompilerOptions, D as AnalysisCompleteness, F as AnalysisContract, G as AnalysisEvidence, H as AnalysisFile, I as AnalysisFileChange, J as AnalysisFileInput, K as AnalysisImportEdge, L as AnalysisIr, M as AnalysisMode, N as AnalysisResult, O as AnalysisViolation, P as AnalyzeArchitectureConvergenceInput, Q as AnalyzeChangeInput, S as AnalyzePolicyDeltaInput, T as AnalyzeProjectInput, U as AnalyzeResolvedProjectInput, V as ArchitectureActualChange, W as ArchitectureChangeMap, X as ArchitectureChangeMapContract, Y as ArchitectureChangeMapDependency, Z as ArchitectureChangeMapFile, _ as ArchitectureChangeOperation, $ as ArchitectureConvergenceClassification, a0 as ArchitectureConvergenceFinding, a1 as ArchitectureConvergenceResult, a2 as ArchitectureDependency, a3 as ArchitectureEngineEdge, a4 as ArchitectureEngineResult, a5 as ArchitectureEngineViolation, a6 as ArkDesignDeltaResult, a7 as ArkEnforcementHost, a8 as ArkEnforcementState, a9 as ArkRuleSensorViolation, aa as ChangePreflightResult, ab as ClassShapeFact, ac as CollectAnalysisConfigWarningsInput, ad as DIAGNOSTIC_CATALOG, ae as DIAGNOSTIC_CATALOG_SCHEMA_VERSION, af as DIAGNOSTIC_DOCS_RELATIVE_PATH, ag as DIAGNOSTIC_RULE_IDS, ah as DesignDeltaChange, ai as DesignDeltaEnforcementScope, aj as DesignDeltaIdentity, ak as DesignSmellEvidence, al as DesignSmellFinding, am as DesignSmellId, an as DiagnosticCatalogEntry, ao as DiagnosticCategory, ap as EnforcementBoundaryState, aq as EnforcementEvidence, ar as EnforcementEvidenceField, as as EnforcementVerification, at as EvaluateArchitectureGraphInput, au as ForbiddenCapabilityUse, av as InvariantCoverageEvidence, aw as POLICY_DELTA_SCHEMA_VERSION, ax as PolicyDelta, ay as PolicyDeltaAcknowledgement, az as PolicyDeltaAnalysis, aA as PolicyDeltaClassification, aB as PolicyDeltaFinding, aC as PreflightResolvedChangeInput, aD as PreparedChangeFile, aE as RESOLVED_CANDIDATE_FACTS_SCHEMA, aF as RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION, aG as ResolvedAmbientFact, aH as ResolvedAnalysisFile, aI as ResolvedAnalysisIr, aJ as ResolvedAnalysisResult, aK as ResolvedCandidateFacts, aL as ResolvedCandidateFactsInput, aM as ResolvedCapability, aN as ResolvedCapabilityFact, aO as ResolvedChangePreflightResult, aP as ResolvedDependencyKind, aQ as ResolvedDependencyState, aR as ResolvedFactsCompleteness, aS as ResolvedFileFact, aT as ResolvedIntentReferenceFact, aU as ResolvedPublishFact, aV as ResolvedSafetyFact, aW as ResolvedSafetyKind, aX as ResolvedSafetyReport, aY as SemanticDependency, aZ as SemanticDependencyKind, a_ as adapterDocsCodePath, a$ as adapterFindingOccurrenceTargetKeys, b0 as adapterFindingRefFromTargetKey, b1 as adapterFindingTargetKey, b2 as analyzeArchitectureConvergence, b3 as analyzeChange, b4 as analyzePolicyDelta, b5 as analyzeProject, b6 as analyzeResolvedProject, b7 as buildArkRuleFileHints, b8 as canPromoteInvariant, b9 as catalogFixForRuleId, ba as catalogWhyForRuleId, bb as classifyArkPolicyDelta, bc as collectAnalysisConfigWarnings, bd as collectEmptyAppliesToFindings, be as collectForbiddenCapabilityUses, bf as createAICodeGate, bg as createAdapterResult, bh as createArchitectureProfile, bi as createArchitectureProfileFromArkConfig, bj as createElevenLayerArkConfig, bk as createResolvedCandidateFacts, bl as deriveArkRuleFileHints, bm as detectArchitectureCycles, bn as deterministicHash, bo as diagnosticDocsFragment, bp as diagnosticDocsPath, bq as elevenLayerProfile, br as evaluateArchitectureGraph, bs as evaluateArkRuleSensors, bt as evaluateInvariantCoverage, bu as explainViolation, bv as extractClassShapesFromSource, bw as extractSemanticDependencies, bx as getDiagnosticCatalogEntry, by as isCataloguedOrArkRuleFamily, bz as isKnownDiagnosticCode, bA as loadContract, bB as loadResolvedCandidateFacts, bC as policyDeltaAcknowledgementMatches, bD as preflightChange, bE as preflightResolvedChange, bF as resolvedFactsEvidenceRequirementsHash, bG as serializeDiagnosticCatalog, bH as stableSerialize, bI as toAdapterDiagnostic, bJ as version } from './diagnosticCatalog-RiKPUFRG.js';
3
+ export { A as ArchitectureLayer, a as ArchitectureLayerConfig, b as ArchitectureProfile, c as ArchitectureRule, d as ArkCheckConfig, C as CreateArchitectureProfileFromArkConfigOptions, e as CreateArchitectureProfileOptions, f as CreateElevenLayerArkConfigOptions } from './types-DCSlrRnV.js';
4
+ import { a as ArkConfigRule, b as ArkConfigSchemaVersion, c as ArkConfigLoadResult, A as ArkConfig, d as ArkConfigIssue, e as ArkConfigArkRun, f as ArkConfigLayer, g as ArkConfigArkOrder } from './configTypes-BdCe_gvv.js';
409
5
 
410
6
  /**
411
7
  * Canonical, pure contract for ark.config.json.
@@ -415,7 +11,7 @@ declare const ARK_ANALYSIS_RESULT_SCHEMA: {
415
11
  * The standalone CLI artifact is generated into bin/lib/config-contract.mjs.
416
12
  */
417
13
 
418
- /** Current published ark.config.json schema version (ADR 0020: 1.2 adds optional arkRun). */
14
+ /** Current published ark.config.json schema version (ADR 0027: 1.3 adds optional arkOrder). */
419
15
  declare const ARK_CONFIG_SCHEMA_VERSION: ArkConfigSchemaVersion;
420
16
  declare const ARK_CONFIG_SCHEMA: {
421
17
  readonly $schema: "https://json-schema.org/draft/2020-12/schema";
@@ -434,8 +30,8 @@ declare const ARK_CONFIG_SCHEMA: {
434
30
  };
435
31
  readonly schemaVersion: {
436
32
  readonly type: "string";
437
- readonly const: "1.2";
438
- readonly default: "1.2";
33
+ readonly const: "1.3";
34
+ readonly default: "1.3";
439
35
  };
440
36
  readonly name: {
441
37
  readonly type: "string";
@@ -518,6 +114,10 @@ declare const ARK_CONFIG_SCHEMA: {
518
114
  readonly arkRun: {
519
115
  readonly $ref: "#/$defs/arkRun";
520
116
  };
117
+ /** ADR 0027 — optional ArkOrder extra. Absence is silent; unknown keys fail closed. */
118
+ readonly arkOrder: {
119
+ readonly $ref: "#/$defs/arkOrder";
120
+ };
521
121
  /** Team parliament — GitHub handles or emails who may loosen the law (not part of policy hash). */
522
122
  readonly stewards: {
523
123
  readonly default: readonly [];
@@ -683,6 +283,14 @@ declare const ARK_CONFIG_SCHEMA: {
683
283
  };
684
284
  readonly uniqueItems: true;
685
285
  };
286
+ readonly kernelRoots: {
287
+ readonly type: "array";
288
+ readonly items: {
289
+ readonly type: "string";
290
+ readonly minLength: 1;
291
+ };
292
+ readonly uniqueItems: true;
293
+ };
686
294
  readonly managedLayers: {
687
295
  readonly default: readonly [];
688
296
  readonly type: "array";
@@ -696,1937 +304,224 @@ declare const ARK_CONFIG_SCHEMA: {
696
304
  readonly type: "boolean";
697
305
  readonly default: true;
698
306
  };
307
+ readonly ignoreDirectNewForErrors: {
308
+ readonly type: "boolean";
309
+ readonly default: true;
310
+ };
699
311
  };
700
312
  };
701
- };
702
- };
703
- declare function loadArkConfigContract(input: unknown, source?: string): ArkConfigLoadResult;
704
- declare function parseArkConfigJson(json: string, source?: string): ArkConfigLoadResult;
705
-
706
- /** ArkGate library version — single source of truth. */
707
- declare const version = "4.7.6";
708
-
709
- /**
710
- * Canonical, pure contract for ArkGate MCP project identity.
711
- *
712
- * Filesystem canonicalization, hashing, clocks, and runtime ids belong to the
713
- * Tooling adapter. This module owns the stable payload and published schemas so
714
- * every MCP surface speaks the same identity/binding language.
715
- */
716
- declare const ARK_PROJECT_IDENTITY_SCHEMA_VERSION: "1.0";
717
- declare const ARK_PROJECT_IDENTITY_SCHEMA_URL = "https://unpkg.com/arkgate@4/schemas/ark.project-identity.schema.json";
718
- type ProjectIdentity = {
719
- schemaVersion: typeof ARK_PROJECT_IDENTITY_SCHEMA_VERSION;
720
- projectId: string;
721
- resolvedRoot: string;
722
- resolvedConfigPath: string;
723
- arkgateVersion: string;
724
- contractHash: string;
725
- contractSource: 'project' | 'default-profile' | 'manifest';
726
- runtimeId: string;
727
- processStartedAt: string;
728
- };
729
- type ProjectExpectation = {
730
- expectedRoot?: string;
731
- expectedProjectId?: string;
732
- };
733
- type ProjectBinding = {
734
- status: 'matched' | 'unverified' | 'mismatch';
735
- authoritative: boolean;
736
- expectedRoot?: string;
737
- expectedProjectId?: string;
738
- code?: 'PROJECT_ROOT_MISMATCH' | 'PROJECT_ID_MISMATCH' | 'INVALID_PROJECT_EXPECTATION';
739
- message?: string;
740
- };
741
- declare const PROJECT_EXPECTATION_SCHEMA: {
742
- readonly type: "object";
743
- readonly additionalProperties: false;
744
- readonly properties: {
745
- readonly expectedRoot: {
746
- readonly type: "string";
747
- readonly minLength: 1;
748
- readonly description: string;
749
- };
750
- readonly expectedProjectId: {
751
- readonly type: "string";
752
- readonly pattern: "^sha256:[a-f0-9]{64}$";
753
- readonly description: "Project id previously returned by ark_identity or ark_manifest.";
313
+ readonly arkOrder: {
314
+ readonly type: "object";
315
+ readonly additionalProperties: false;
316
+ readonly properties: {
317
+ readonly mode: {
318
+ readonly type: "string";
319
+ readonly enum: readonly ["advisory", "enforced"];
320
+ readonly default: "advisory";
321
+ };
322
+ readonly planeRoots: {
323
+ readonly default: readonly [];
324
+ readonly type: "array";
325
+ readonly items: {
326
+ readonly type: "string";
327
+ readonly minLength: 1;
328
+ };
329
+ readonly uniqueItems: true;
330
+ };
331
+ readonly managedLayers: {
332
+ readonly default: readonly [];
333
+ readonly type: "array";
334
+ readonly items: {
335
+ readonly type: "string";
336
+ readonly minLength: 1;
337
+ };
338
+ readonly uniqueItems: true;
339
+ };
340
+ readonly maxXiKeys: {
341
+ readonly type: "integer";
342
+ readonly minimum: 1;
343
+ readonly default: 7;
344
+ };
345
+ };
754
346
  };
755
347
  };
756
348
  };
757
- declare const PROJECT_BINDING_SCHEMA: {
758
- readonly type: "object";
759
- readonly additionalProperties: false;
760
- readonly required: readonly ["status", "authoritative"];
761
- readonly properties: {
762
- readonly status: {
763
- readonly enum: readonly ["matched", "unverified", "mismatch"];
764
- };
765
- readonly authoritative: {
766
- readonly type: "boolean";
767
- };
768
- readonly expectedRoot: {
769
- readonly type: "string";
770
- readonly minLength: 1;
771
- };
772
- readonly expectedProjectId: {
773
- readonly type: "string";
774
- readonly pattern: "^sha256:[a-f0-9]{64}$";
775
- };
776
- readonly code: {
777
- readonly enum: readonly ["PROJECT_ROOT_MISMATCH", "PROJECT_ID_MISMATCH", "INVALID_PROJECT_EXPECTATION"];
778
- };
779
- readonly message: {
780
- readonly type: "string";
781
- readonly minLength: 1;
782
- };
783
- };
784
- };
785
- declare const ARK_PROJECT_IDENTITY_SCHEMA: {
786
- readonly $schema: "https://json-schema.org/draft/2020-12/schema";
787
- readonly $id: "https://unpkg.com/arkgate@4/schemas/ark.project-identity.schema.json";
788
- readonly title: "ArkGate MCP project identity";
789
- readonly description: "Stable project binding plus separate runtime and architecture-contract evidence.";
790
- readonly type: "object";
791
- readonly additionalProperties: false;
792
- readonly required: readonly ["schemaVersion", "projectId", "resolvedRoot", "resolvedConfigPath", "arkgateVersion", "contractHash", "contractSource", "runtimeId", "processStartedAt"];
793
- readonly properties: {
794
- readonly schemaVersion: {
795
- readonly const: "1.0";
796
- };
797
- readonly projectId: {
798
- readonly type: "string";
799
- readonly pattern: "^sha256:[a-f0-9]{64}$";
800
- };
801
- readonly resolvedRoot: {
802
- readonly type: "string";
803
- readonly minLength: 1;
804
- };
805
- readonly resolvedConfigPath: {
806
- readonly type: "string";
807
- readonly minLength: 1;
808
- };
809
- readonly arkgateVersion: {
810
- readonly type: "string";
811
- readonly minLength: 1;
812
- };
813
- readonly contractHash: {
814
- readonly type: "string";
815
- readonly pattern: "^sha256:[a-f0-9]{64}$";
816
- };
817
- readonly contractSource: {
818
- readonly enum: readonly ["project", "default-profile", "manifest"];
819
- };
820
- readonly runtimeId: {
821
- readonly type: "string";
822
- readonly minLength: 1;
823
- };
824
- readonly processStartedAt: {
825
- readonly type: "string";
826
- readonly format: "date-time";
827
- };
828
- };
829
- readonly $defs: {
830
- readonly expectation: {
831
- readonly type: "object";
832
- readonly additionalProperties: false;
833
- readonly properties: {
834
- readonly expectedRoot: {
835
- readonly type: "string";
836
- readonly minLength: 1;
837
- readonly description: string;
838
- };
839
- readonly expectedProjectId: {
840
- readonly type: "string";
841
- readonly pattern: "^sha256:[a-f0-9]{64}$";
842
- readonly description: "Project id previously returned by ark_identity or ark_manifest.";
843
- };
844
- };
845
- };
846
- readonly binding: {
847
- readonly type: "object";
848
- readonly additionalProperties: false;
849
- readonly required: readonly ["status", "authoritative"];
850
- readonly properties: {
851
- readonly status: {
852
- readonly enum: readonly ["matched", "unverified", "mismatch"];
853
- };
854
- readonly authoritative: {
855
- readonly type: "boolean";
856
- };
857
- readonly expectedRoot: {
858
- readonly type: "string";
859
- readonly minLength: 1;
860
- };
861
- readonly expectedProjectId: {
862
- readonly type: "string";
863
- readonly pattern: "^sha256:[a-f0-9]{64}$";
864
- };
865
- readonly code: {
866
- readonly enum: readonly ["PROJECT_ROOT_MISMATCH", "PROJECT_ID_MISMATCH", "INVALID_PROJECT_EXPECTATION"];
867
- };
868
- readonly message: {
869
- readonly type: "string";
870
- readonly minLength: 1;
871
- };
872
- };
873
- };
874
- };
875
- };
876
- /**
877
- * Stable identity: contract edits and MCP restarts must not change which project
878
- * this is. Callers must pass canonical real paths and a SHA-256 hex function.
879
- */
880
- declare function createProjectId(resolvedRoot: string, resolvedConfigPath: string, sha256Hex: (value: string) => string): string;
881
- declare function createProjectIdentity(input: Omit<ProjectIdentity, 'schemaVersion'>): ProjectIdentity;
882
-
883
- /**
884
- * AI Code Gate (basic).
885
- *
886
- * Allows validation of generated source code against the defined architecture.
887
- */
888
- interface AICodeGateViolation {
889
- /** Stable rule identifier for agents and CI pipelines. */
890
- ruleId: string;
891
- /** @deprecated Use ruleId — kept for backward compatibility. */
892
- code: string;
893
- message: string;
894
- line?: number;
895
- suggestion?: string;
896
- source?: string;
897
- filePath?: string;
898
- target?: string;
899
- fromLayer?: string;
900
- toLayer?: string;
901
- details?: unknown;
902
- }
903
- /** Extension point for external analyzers (AST, semantic, etc.). */
904
- interface AIGateExtension<Context = unknown> {
905
- readonly name: string;
906
- analyze(source: string, context?: Context): AICodeGateViolation[];
907
- }
908
- interface AICodeGateContext {
909
- filePath?: string;
910
- agentId?: string;
911
- layer?: string;
912
- [key: string]: unknown;
913
- }
914
- interface AICodeGateResult {
915
- /** Single-source snippets do not carry project-wide resolver evidence. */
916
- mode: 'lexical-compatibility';
917
- /** A snippet result is intentionally never an authoritative complete verdict. */
918
- completeness: 'partial';
919
- completenessReasons: string[];
920
- /** Authoritative verdict. Always false until the complete candidate is resolved. */
921
- valid: boolean;
922
- /** Compatibility signal for the bounded lexical checks performed here. */
923
- lexicalValid: boolean;
924
- violations: AICodeGateViolation[];
925
- }
926
- interface AICodeGate<Context = AICodeGateContext> {
927
- validate(source: string, context?: Context): AICodeGateResult;
928
- }
929
-
930
- /**
931
- * Policy types for the Ark kernel.
932
- *
933
- * Policies allow declaring architectural rules that can be checked at runtime.
934
- * Supports both hard policies (must never be violated) and soft policies (warnings).
935
- */
936
- type PolicySeverity = 'hard' | 'soft';
937
- type PolicyEnforcementMode = 'runtime' | 'static' | 'runtime-and-static' | 'advisory';
938
- /**
939
- * Represents a single violation of a policy.
940
- */
941
- interface PolicyViolation {
942
- /** Name of the policy that was violated */
943
- policyName: string;
944
- /** Severity level of the policy */
945
- severity: PolicySeverity;
946
- /** Human-readable explanation of the violation */
947
- message: string;
948
- /** Optional additional structured details */
949
- details?: unknown;
950
- }
951
- /**
952
- * A Policy defines a rule that can be evaluated against a context.
953
- *
954
- * @template Context - The shape of data the policy evaluates (e.g. { registry, events })
955
- */
956
- interface Policy<Context = unknown> {
957
- /** Unique name of the policy (used in violations and reporting) */
958
- readonly name: string;
959
- /** Whether this is a hard rule (enforced strictly) or soft (advisory) */
960
- readonly severity: PolicySeverity;
961
- /** Optional tags for policy classification (e.g. 'layer', 'naming') */
962
- readonly tags?: readonly string[];
963
- readonly owner?: string;
964
- readonly version?: string;
965
- readonly rationale?: string;
966
- readonly enforcementMode?: PolicyEnforcementMode;
967
- readonly deprecated?: boolean | string;
968
- readonly replacedBy?: string;
969
- /**
970
- * Evaluates the policy against the given context.
971
- * Return true / [] for pass, false / single violation / array for failure.
972
- */
973
- check(context: Context): boolean | PolicyViolation | PolicyViolation[];
974
- }
975
-
976
- /**
977
- * Core domain primitives for Ark.
978
- * These types are the foundation for all governance concepts.
979
- */
980
- /**
981
- * Semantic intent names follow a convention:
982
- * - Domain.* for domain events and entities
983
- * - Application.* for use-cases / orchestration
984
- * - Adapter.* for integration points
985
- * - Workflow.* for sagas and processes
986
- * - Job.* for background jobs and scheduling
987
- * - Presentation.* for UI/API adapters
988
- * - Reporting.* for read models and projections
989
- * - Metadata.* for extensibility contracts
990
- * - Security.* / Audit.* / Observability.* for cross-cutting kernel concerns
991
- * - Kernel.* for Ark-owned governance signals
992
- */
993
- 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}`;
994
- type CorrelationId = string;
995
- interface EventMetadata {
996
- occurredAt: string;
997
- source: string;
998
- kernelInstanceId?: string;
999
- eventVersion?: string;
1000
- schemaVersion?: string;
1001
- allowInterception?: boolean;
1002
- interceptions?: Array<{
1003
- interceptorId: string;
1004
- timestamp: string;
1005
- }>;
1006
- correlationId?: CorrelationId;
1007
- causationId?: string;
1008
- traceId?: string;
1009
- spanId?: string;
1010
- parentSpanId?: string;
1011
- [key: string]: unknown;
1012
- }
1013
- interface DomainEvent<Name extends IntentName = IntentName, Payload = unknown> {
1014
- intent: Name;
1015
- payload: Payload;
1016
- metadata: EventMetadata;
1017
- }
1018
-
1019
- /**
1020
- * Intent-specific types for the Ark kernel.
1021
- *
1022
- * Intents provide semantic naming for every important concept in the system
1023
- * (domain events, application operations, adapters, workflows).
1024
- */
1025
-
1026
- /**
1027
- * An IntentCreator is a callable that creates a strongly-typed DomainEvent
1028
- * when invoked with a payload.
1029
- *
1030
- * It also carries the semantic `name`.
1031
- *
1032
- * @example
1033
- * const OrderPlaced = defineIntent<'Domain.Order.OrderPlaced', { orderId: string }>('Domain.Order.OrderPlaced');
1034
- * const event = OrderPlaced({ orderId: 'o-1' });
1035
- */
1036
- interface IntentCreator<Name extends IntentName, Payload = unknown> {
1037
- /**
1038
- * Creates a DomainEvent for this intent.
1039
- */
1040
- (payload: Payload): DomainEvent<Name, Payload>;
1041
- /**
1042
- * The fully-qualified semantic name of the intent (e.g. "Domain.Order.OrderPlaced").
1043
- */
1044
- readonly name: Name;
1045
- }
1046
-
1047
- /**
1048
- * Architecture layer profiles.
1049
- *
1050
- * A profile turns semantic names such as `Domain.Order.Placed` into governed
1051
- * layer names and dependency rules.
1052
- */
1053
-
1054
- interface ArchitectureLayer {
1055
- name: string;
1056
- prefixes: string[];
1057
- /**
1058
- * Custom matcher for teams whose intent names don't follow prefix conventions.
1059
- * Checked before any prefix matching, in layer declaration order. A layer may
1060
- * use `match` alone (with `prefixes: []`), prefixes alone, or both.
1061
- */
1062
- match?: (name: string) => boolean;
1063
- description?: string;
1064
- order?: number;
1065
- }
1066
- type ArchitectureRule = ArkConfigRule;
1067
- interface ArchitectureProfile {
1068
- name: string;
1069
- layers: ArchitectureLayer[];
1070
- rules: ArchitectureRule[];
1071
- resolveLayer(name: string): string | undefined;
1072
- }
1073
- interface CreateArchitectureProfileOptions {
1074
- name: string;
1075
- layers: ArchitectureLayer[];
1076
- rules?: ArchitectureRule[];
1077
- }
1078
- interface CreateArchitectureProfileFromArkConfigOptions {
1079
- /** Runtime profile name. Default: config.name or "ark.config.json". */
1080
- name?: string;
1081
- }
1082
- type ArchitectureLayerConfig = ArkConfigLayer;
1083
- type ArkCheckConfig = Omit<ArkConfig, '$schema' | 'schemaVersion' | 'rules'> & {
1084
- $schema?: string;
1085
- schemaVersion?: ArkConfig['schemaVersion'];
1086
- rules?: ArchitectureRule[];
1087
- };
1088
- interface CreateElevenLayerArkConfigOptions {
1089
- /** Source root used in generated file patterns. Default: "src". */
1090
- rootDir?: string;
1091
- /** Include entries for ark-check. Default: [rootDir]. */
1092
- include?: string[];
1093
- /** Mark generated layers optional. Default: true. */
1094
- optionalLayers?: boolean;
1095
- }
1096
-
1097
- declare function createArchitectureProfile(options: CreateArchitectureProfileOptions): ArchitectureProfile;
1098
- declare function createArchitectureProfileFromArkConfig(config: ArkCheckConfig, options?: CreateArchitectureProfileFromArkConfigOptions): ArchitectureProfile;
1099
- declare const elevenLayerProfile: ArchitectureProfile;
1100
- declare function createElevenLayerArkConfig(options?: CreateElevenLayerArkConfigOptions): ArkCheckConfig;
1101
-
1102
- /**
1103
- * Basic AI Code Gate implementation.
1104
- *
1105
- * Uses simple string heuristics + registered intent names to detect obvious
1106
- * architectural violations in generated code (e.g. direct infra imports from domain).
1107
- * Not a full static analyzer — documented limitation.
1108
- */
1109
-
1110
- interface AICodeGatePolicyContext<Context = AICodeGateContext> {
1111
- source: string;
1112
- context?: Context;
1113
- }
1114
- interface AICodeGateOptions<Context = AICodeGateContext> {
1115
- policies?: Policy<AICodeGatePolicyContext<Context>>[];
1116
- intents?: Array<string | Pick<IntentCreator<IntentName, unknown>, 'name'>>;
1117
- /**
1118
- * Additional forbidden patterns (regex or strings).
1119
- */
1120
- forbiddenPatterns?: Array<string | RegExp>;
1121
- /**
1122
- * External analyzer extensions (type-only contract; plug in AST tools later).
1123
- */
1124
- extensions?: AIGateExtension<Context>[];
1125
- /**
1126
- * Optional architecture profile for layer-aware generated-code checks.
1127
- * When context.layer is provided, intent references are checked against it.
1128
- */
1129
- architectureProfile?: ArchitectureProfile;
1130
- /**
1131
- * When true, flag string literals that look like intent names but are not registered.
1132
- */
1133
- enforceIntentAllowlist?: boolean;
1134
- /**
1135
- * Optional TypeScript module object. When provided, AICodeGate adds AST-backed checks
1136
- * for publish misuse without taking a runtime dependency on TypeScript.
1137
- */
1138
- typescript?: unknown;
1139
- /**
1140
- * Ambient globals forbidden per layer (layer name → entries such as "fetch" or
1141
- * "Date.now"). Checked only when `typescript` is provided and context.layer resolves
1142
- * to a listed layer — mirrors ark-check's FORBIDDEN_GLOBAL rule.
1143
- */
1144
- forbiddenGlobals?: Record<string, string[]>;
1145
- /**
1146
- * Layer → effective capability deny set (U04 walls; ADR 0009). Enforced like
1147
- * forbiddenGlobals when the target file's layer is known. An ambient use
1148
- * already covered by the layer's forbiddenGlobals reports only
1149
- * FORBIDDEN_GLOBAL (D7 — one violation, one voice).
1150
- */
1151
- capabilityWalls?: Record<string, string[]>;
1152
- /**
1153
- * Layer names whose role is infrastructure and may therefore import infrastructure
1154
- * (a persistence adapter importing the DB is correct, not a violation). The built-in
1155
- * infra-import heuristics are suppressed for these layers and for any layer whose
1156
- * name matches the conventional infra tokens. Populate from ark.config.json layers
1157
- * flagged `mayImportInfrastructure: true`, so unconventionally-named infra layers
1158
- * opt in explicitly. User-supplied `forbiddenPatterns` still apply everywhere.
1159
- */
1160
- infrastructureLayers?: string[];
1161
- /**
1162
- * Preferred single resolve step: import specifier or absolute source file →
1163
- * `{ layer, relPath }` for contract + peerIsolation. Prefer this over the
1164
- * legacy layer-only callback.
1165
- */
1166
- resolveImportTarget?: (specifierOrFilePath: string, fromFilePath?: string) => {
1167
- layer?: string;
1168
- relPath?: string;
1169
- } | undefined;
1170
- /**
1171
- * @deprecated Prefer resolveImportTarget. Layer-only resolve for governed imports.
1172
- */
1173
- resolveImportLayer?: (specifier: string, fromFilePath?: string) => string | undefined;
1174
- /**
1175
- * Layer configs (patterns) used to infer sliceFolders when a peerIsolation rule
1176
- * omits an explicit list.
1177
- */
1178
- architectureLayers?: Array<{
1179
- name: string;
1180
- patterns?: string[];
1181
- }>;
1182
- /** Explicit file-level escape hatch for reviewed non-literal import()/require() calls. */
1183
- allowNonLiteralDynamicImport?: (filePath?: string) => boolean;
1184
- }
1185
- declare function createAICodeGate<Context = AICodeGateContext>(options?: AICodeGateOptions<Context>): AICodeGate<Context>;
1186
-
1187
- /**
1188
- * Portable identity/fingerprint primitives for pure Domain contracts.
1189
- *
1190
- * FNV-1a is intentional: no Node crypto dependency for CLI/MCP/browserless consumers.
1191
- */
1192
- /** Stable FNV-1a hash. Identity/fingerprint only — not a security primitive. */
1193
- declare function deterministicHash(value: string): string;
1194
- /** Serialize JSON-like values with sorted object keys for reproducible hashes. */
1195
- declare function stableSerialize(value: unknown): string;
1196
-
1197
- /**
1198
- * Versioned type vocabulary for resolved candidate facts (schema 1.0).
1199
- *
1200
- * Pure declarations + schema version identity. Create/load live in
1201
- * resolvedCandidateFacts.ts; JSON Schema lives in resolvedCandidateFactsSchema.ts.
1202
- */
1203
- /** 1.1 adds optional classShapes[] (ADR 0013). 1.2 adds optional ArkRun facts (ADR 0022). 1.0/1.1 remain loadable. */
1204
- declare const RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION: "1.2";
1205
- type ResolvedFactsCompleteness = 'complete' | 'partial' | 'unavailable';
1206
- type ResolvedDependencyKind = 'import' | 'export' | 'dynamic-import' | 'require';
1207
- type ResolvedDependencyState = 'resolved-project' | 'resolved-external' | 'unresolved' | 'dynamic';
1208
- type ResolvedCapability = 'network' | 'filesystem' | 'clock' | 'randomness' | 'environment' | 'process' | 'persistence';
1209
- type ResolvedFactsReason = {
1210
- code: string;
1211
- message: string;
1212
- file?: string;
1213
- };
1214
- type ResolvedFileFact = {
1215
- path: string;
1216
- contentHash: string;
1217
- parseStatus: 'parsed' | 'invalid';
1218
- parseDiagnosticCount: number;
1219
- exportsOnlyTypes: boolean;
1220
- typeOnlyExportNames: string[];
1221
- hasTopLevelSideEffects: boolean;
1222
- };
1223
- /** ADR 0022 kernel API call-site evidence. Sensors consume this in RN04. */
1224
- type ResolvedArkRunKernelCallKind = 'factory' | 'publisher' | 'publish' | 'raise' | 'send' | 'subscribe' | 'register-handler' | 'resolve' | 'resolve-singleton';
1225
- type ResolvedArkRunKernelCallFact = {
1226
- file: string;
1227
- line: number;
1228
- kind: ResolvedArkRunKernelCallKind;
1229
- callee: string;
1230
- viaImport: boolean;
1231
- receiver?: string;
1232
- nameLiteral?: string;
1233
- };
1234
- /** `new` of a class admitted for kernel creation (classShapes name or kernel import). */
1235
- type ResolvedArkRunManagedNewFact = {
1236
- file: string;
1237
- line: number;
1238
- typeName: string;
1239
- importedFrom?: string;
1240
- };
1241
- /** Governed file that matched an `arkRun.compositionRoots` glob. */
1242
- type ResolvedArkRunCompositionRootHitFact = {
1243
- file: string;
1244
- matchedRoot: string;
1245
- hasKernelFactory: boolean;
1246
- };
1247
- /** File-scoped interaction declaration lists (ADR 0023). Sensors consume this in RN04. */
1248
- type ResolvedArkRunDeclarationFact = {
1249
- file: string;
1250
- line: number;
1251
- uses: string[];
1252
- reactsTo: string[];
1253
- raises: string[];
1254
- sends: string[];
1255
- };
1256
- /** ADR 0013 class-shape evidence for ArkRules structure sensors. */
1257
- type ResolvedClassShapeFact = {
1258
- file: string;
1259
- className: string;
1260
- exported: boolean;
1261
- hasPublicMutableFields: boolean;
1262
- hasPublicSetters: boolean;
1263
- hasPublicConstructor: boolean;
1264
- hasStaticFactory: boolean;
1265
- mutatingMethods: readonly {
1266
- name: string;
1267
- referencesGuardOrPublish: boolean;
1268
- }[];
1269
- dataOnly?: boolean;
1270
- };
1271
- type ResolvedDependencyFact = {
1272
- from: string;
1273
- specifier?: string;
1274
- kind: ResolvedDependencyKind;
1275
- typeOnly: boolean;
1276
- line: number;
1277
- resolution: ResolvedDependencyState;
1278
- target?: string;
1279
- namedBindings?: string[];
1280
- targetTypeOnlyExports?: boolean;
1281
- sourcePureTypeModule?: boolean;
1282
- namedBindingsTypeOnly?: boolean;
1283
- portProofEligible?: boolean;
1284
- };
1285
- type ResolvedCapabilityFact = {
1286
- file: string;
1287
- line: number;
1288
- symbol: string;
1289
- capability: ResolvedCapability;
1290
- source: 'ambient-global' | 'import-based';
1291
- };
1292
- type ResolvedAmbientFact = {
1293
- file: string;
1294
- line: number;
1295
- symbol: string;
1296
- };
1297
- type ResolvedPublishFact = {
1298
- file: string;
1299
- line: number;
1300
- rawIntentName?: string;
1301
- objectHasIntent: boolean;
1302
- arkPublishCandidate: boolean;
1303
- hasSource: boolean;
1304
- sourceIntent?: string;
1305
- };
1306
- type ResolvedIntentReferenceFact = {
1307
- file: string;
1308
- line: number;
1309
- intent: string;
1310
- };
1311
- type ResolvedSafetyKind = 'ts-suppression' | 'any-cast' | 'dynamic-import' | 'dynamic-require' | 'in-memory-store';
1312
- /** Neutral syntax evidence for policy-controlled safety diagnostics. */
1313
- type ResolvedSafetyFact = {
1314
- file: string;
1315
- line: number;
1316
- kind: ResolvedSafetyKind;
1317
- symbol?: string;
1318
- };
1319
- type ResolvedCandidateFactsInput = {
1320
- schemaVersion: '1.0' | '1.1' | typeof RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION;
1321
- completeness: ResolvedFactsCompleteness;
1322
- completenessReasons: readonly ResolvedFactsReason[];
1323
- resolverIdentity: string;
1324
- compilerIdentity: string;
1325
- compilerOptionsHash: string;
1326
- tsconfigHash: string;
1327
- evidenceRequirementsHash: string;
1328
- projectPackageName?: string;
1329
- files: readonly ResolvedFileFact[];
1330
- dependencies: readonly ResolvedDependencyFact[];
1331
- capabilityUses: readonly ResolvedCapabilityFact[];
1332
- ambientUses: readonly ResolvedAmbientFact[];
1333
- publishCalls: readonly ResolvedPublishFact[];
1334
- intentReferences: readonly ResolvedIntentReferenceFact[];
1335
- safetyUses: readonly ResolvedSafetyFact[];
1336
- /** ADR 0013 — optional on 1.0; default [] on load. */
1337
- classShapes?: readonly ResolvedClassShapeFact[];
1338
- /** ADR 0022 / RN03 — optional on 1.0/1.1; default [] on load. */
1339
- arkRunKernelCalls?: readonly ResolvedArkRunKernelCallFact[];
1340
- arkRunManagedNews?: readonly ResolvedArkRunManagedNewFact[];
1341
- arkRunCompositionRootHits?: readonly ResolvedArkRunCompositionRootHitFact[];
1342
- arkRunDeclarations?: readonly ResolvedArkRunDeclarationFact[];
1343
- };
1344
- type ResolvedCandidateFacts = Omit<ResolvedCandidateFactsInput, 'candidateTreeHash' | 'classShapes' | 'arkRunKernelCalls' | 'arkRunManagedNews' | 'arkRunCompositionRootHits' | 'arkRunDeclarations'> & {
1345
- schemaVersion: typeof RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION;
1346
- completenessReasons: ResolvedFactsReason[];
1347
- candidateTreeHash: string;
1348
- files: ResolvedFileFact[];
1349
- dependencies: ResolvedDependencyFact[];
1350
- capabilityUses: ResolvedCapabilityFact[];
1351
- ambientUses: ResolvedAmbientFact[];
1352
- publishCalls: ResolvedPublishFact[];
1353
- intentReferences: ResolvedIntentReferenceFact[];
1354
- safetyUses: ResolvedSafetyFact[];
1355
- classShapes: ResolvedClassShapeFact[];
1356
- arkRunKernelCalls: ResolvedArkRunKernelCallFact[];
1357
- arkRunManagedNews: ResolvedArkRunManagedNewFact[];
1358
- arkRunCompositionRootHits: ResolvedArkRunCompositionRootHitFact[];
1359
- arkRunDeclarations: ResolvedArkRunDeclarationFact[];
1360
- factsHash: string;
1361
- };
1362
-
1363
- /**
1364
- * Canonical create/load for versioned resolved candidate facts.
1365
- *
1366
- * Types: resolvedCandidateFactsTypes.ts · Schema: resolvedCandidateFactsSchema.ts ·
1367
- * Hash: stableHash.ts. Plan-B god-module pilot cluster (pattern-b:god-module).
1368
- */
1369
-
1370
- /** Identity of the policy-controlled evidence a resolver must attempt to collect. */
1371
- declare function resolvedFactsEvidenceRequirementsHash(config: ArkConfig): string;
1372
- declare function createResolvedCandidateFacts(input: ResolvedCandidateFactsInput): ResolvedCandidateFacts;
1373
- declare function loadResolvedCandidateFacts(input: unknown): ResolvedCandidateFacts;
1374
-
1375
- declare const RESOLVED_CANDIDATE_FACTS_SCHEMA: {
1376
- readonly $schema: "https://json-schema.org/draft/2020-12/schema";
1377
- readonly $id: "https://unpkg.com/arkgate@3/schemas/ark.resolved-candidate-facts.schema.json";
1378
- readonly title: "ArkGate resolved candidate facts";
1379
- readonly type: "object";
1380
- readonly additionalProperties: false;
1381
- readonly required: readonly ["schemaVersion", "completeness", "completenessReasons", "resolverIdentity", "compilerIdentity", "compilerOptionsHash", "tsconfigHash", "candidateTreeHash", "evidenceRequirementsHash", "files", "dependencies", "capabilityUses", "ambientUses", "publishCalls", "intentReferences", "safetyUses", "factsHash"];
1382
- readonly properties: {
1383
- readonly schemaVersion: {
1384
- readonly enum: readonly ["1.0", "1.1", "1.2"];
1385
- };
1386
- readonly completeness: {
1387
- readonly enum: readonly ["complete", "partial", "unavailable"];
1388
- };
1389
- readonly completenessReasons: {
1390
- readonly type: "array";
1391
- readonly items: {
1392
- readonly type: "object";
1393
- readonly additionalProperties: false;
1394
- readonly required: readonly ["code", "message"];
1395
- readonly properties: {
1396
- readonly code: {
1397
- readonly type: "string";
1398
- readonly minLength: 1;
1399
- };
1400
- readonly message: {
1401
- readonly type: "string";
1402
- readonly minLength: 1;
1403
- };
1404
- readonly file: {
1405
- readonly type: "string";
1406
- readonly minLength: 1;
1407
- readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1408
- };
1409
- };
1410
- };
1411
- };
1412
- readonly resolverIdentity: {
1413
- readonly type: "string";
1414
- readonly minLength: 1;
1415
- };
1416
- readonly compilerIdentity: {
1417
- readonly type: "string";
1418
- readonly minLength: 1;
1419
- };
1420
- readonly compilerOptionsHash: {
1421
- readonly type: "string";
1422
- readonly minLength: 1;
1423
- };
1424
- readonly tsconfigHash: {
1425
- readonly type: "string";
1426
- readonly minLength: 1;
1427
- };
1428
- readonly candidateTreeHash: {
1429
- readonly type: "string";
1430
- readonly minLength: 1;
1431
- };
1432
- readonly evidenceRequirementsHash: {
1433
- readonly type: "string";
1434
- readonly minLength: 1;
1435
- };
1436
- readonly projectPackageName: {
1437
- readonly type: "string";
1438
- readonly minLength: 1;
1439
- };
1440
- readonly files: {
1441
- readonly type: "array";
1442
- readonly uniqueItems: true;
1443
- readonly items: {
1444
- readonly type: "object";
1445
- readonly additionalProperties: false;
1446
- readonly required: readonly ["path", "contentHash", "parseStatus", "parseDiagnosticCount", "exportsOnlyTypes", "typeOnlyExportNames", "hasTopLevelSideEffects"];
1447
- readonly properties: {
1448
- readonly path: {
1449
- readonly type: "string";
1450
- readonly minLength: 1;
1451
- readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1452
- };
1453
- readonly contentHash: {
1454
- readonly type: "string";
1455
- readonly minLength: 1;
1456
- };
1457
- readonly parseStatus: {
1458
- readonly enum: readonly ["parsed", "invalid"];
1459
- };
1460
- readonly parseDiagnosticCount: {
1461
- readonly type: "integer";
1462
- readonly minimum: 0;
1463
- };
1464
- readonly exportsOnlyTypes: {
1465
- readonly type: "boolean";
1466
- };
1467
- readonly typeOnlyExportNames: {
1468
- readonly type: "array";
1469
- readonly items: {
1470
- readonly type: "string";
1471
- readonly minLength: 1;
1472
- };
1473
- };
1474
- readonly hasTopLevelSideEffects: {
1475
- readonly type: "boolean";
1476
- };
1477
- };
1478
- readonly allOf: readonly [{
1479
- readonly if: {
1480
- readonly properties: {
1481
- readonly parseStatus: {
1482
- readonly const: "parsed";
1483
- };
1484
- };
1485
- };
1486
- readonly then: {
1487
- readonly properties: {
1488
- readonly parseDiagnosticCount: {
1489
- readonly const: 0;
1490
- };
1491
- };
1492
- };
1493
- }, {
1494
- readonly if: {
1495
- readonly properties: {
1496
- readonly parseStatus: {
1497
- readonly const: "invalid";
1498
- };
1499
- };
1500
- };
1501
- readonly then: {
1502
- readonly properties: {
1503
- readonly parseDiagnosticCount: {
1504
- readonly minimum: 1;
1505
- };
1506
- };
1507
- };
1508
- }];
1509
- };
1510
- };
1511
- readonly dependencies: {
1512
- readonly type: "array";
1513
- readonly items: {
1514
- readonly type: "object";
1515
- readonly additionalProperties: false;
1516
- readonly required: readonly ["from", "kind", "typeOnly", "line", "resolution"];
1517
- readonly properties: {
1518
- readonly from: {
1519
- readonly type: "string";
1520
- readonly minLength: 1;
1521
- readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1522
- };
1523
- readonly specifier: {
1524
- readonly type: "string";
1525
- readonly minLength: 1;
1526
- };
1527
- readonly kind: {
1528
- readonly enum: readonly ["import", "export", "dynamic-import", "require"];
1529
- };
1530
- readonly typeOnly: {
1531
- readonly type: "boolean";
1532
- };
1533
- readonly line: {
1534
- readonly type: "integer";
1535
- readonly minimum: 1;
1536
- };
1537
- readonly resolution: {
1538
- readonly enum: readonly ["resolved-project", "resolved-external", "unresolved", "dynamic"];
1539
- };
1540
- readonly target: {
1541
- readonly type: "string";
1542
- readonly minLength: 1;
1543
- readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1544
- };
1545
- readonly namedBindings: {
1546
- readonly type: "array";
1547
- readonly items: {
1548
- readonly type: "string";
1549
- readonly minLength: 1;
1550
- };
1551
- };
1552
- readonly targetTypeOnlyExports: {
1553
- readonly type: "boolean";
1554
- };
1555
- readonly sourcePureTypeModule: {
1556
- readonly type: "boolean";
1557
- };
1558
- readonly namedBindingsTypeOnly: {
1559
- readonly type: "boolean";
1560
- };
1561
- readonly portProofEligible: {
1562
- readonly type: "boolean";
1563
- };
1564
- };
1565
- readonly allOf: readonly [{
1566
- readonly if: {
1567
- readonly properties: {
1568
- readonly resolution: {
1569
- readonly const: "resolved-project";
1570
- };
1571
- };
1572
- };
1573
- readonly then: {
1574
- readonly required: readonly ["target"];
1575
- };
1576
- readonly else: {
1577
- readonly not: {
1578
- readonly required: readonly ["target"];
1579
- };
1580
- };
1581
- }, {
1582
- readonly if: {
1583
- readonly properties: {
1584
- readonly resolution: {
1585
- readonly const: "dynamic";
1586
- };
1587
- };
1588
- };
1589
- readonly else: {
1590
- readonly required: readonly ["specifier"];
1591
- };
1592
- }];
1593
- };
1594
- };
1595
- readonly capabilityUses: {
1596
- readonly type: "array";
1597
- readonly items: {
1598
- readonly type: "object";
1599
- readonly additionalProperties: false;
1600
- readonly required: readonly ["file", "line", "symbol", "capability", "source"];
1601
- readonly properties: {
1602
- readonly file: {
1603
- readonly type: "string";
1604
- readonly minLength: 1;
1605
- readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1606
- };
1607
- readonly line: {
1608
- readonly type: "integer";
1609
- readonly minimum: 1;
1610
- };
1611
- readonly symbol: {
1612
- readonly type: "string";
1613
- readonly minLength: 1;
1614
- };
1615
- readonly capability: {
1616
- readonly enum: readonly ["network", "filesystem", "clock", "randomness", "environment", "process", "persistence"];
1617
- };
1618
- readonly source: {
1619
- readonly enum: readonly ["ambient-global", "import-based"];
1620
- };
1621
- };
1622
- };
1623
- };
1624
- readonly ambientUses: {
1625
- readonly type: "array";
1626
- readonly items: {
1627
- readonly type: "object";
1628
- readonly additionalProperties: false;
1629
- readonly required: readonly ["file", "line", "symbol"];
1630
- readonly properties: {
1631
- readonly file: {
1632
- readonly type: "string";
1633
- readonly minLength: 1;
1634
- readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1635
- };
1636
- readonly line: {
1637
- readonly type: "integer";
1638
- readonly minimum: 1;
1639
- };
1640
- readonly symbol: {
1641
- readonly type: "string";
1642
- readonly minLength: 1;
1643
- };
1644
- };
1645
- };
1646
- };
1647
- readonly publishCalls: {
1648
- readonly type: "array";
1649
- readonly items: {
1650
- readonly type: "object";
1651
- readonly additionalProperties: false;
1652
- readonly required: readonly ["file", "line", "objectHasIntent", "arkPublishCandidate", "hasSource"];
1653
- readonly properties: {
1654
- readonly file: {
1655
- readonly type: "string";
1656
- readonly minLength: 1;
1657
- readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1658
- };
1659
- readonly line: {
1660
- readonly type: "integer";
1661
- readonly minimum: 1;
1662
- };
1663
- readonly rawIntentName: {
1664
- readonly type: "string";
1665
- readonly minLength: 1;
1666
- };
1667
- readonly objectHasIntent: {
1668
- readonly type: "boolean";
1669
- };
1670
- readonly arkPublishCandidate: {
1671
- readonly type: "boolean";
1672
- };
1673
- readonly hasSource: {
1674
- readonly type: "boolean";
1675
- };
1676
- readonly sourceIntent: {
1677
- readonly type: "string";
1678
- readonly minLength: 1;
1679
- };
1680
- };
1681
- };
1682
- };
1683
- readonly intentReferences: {
1684
- readonly type: "array";
1685
- readonly items: {
1686
- readonly type: "object";
1687
- readonly additionalProperties: false;
1688
- readonly required: readonly ["file", "line", "intent"];
1689
- readonly properties: {
1690
- readonly file: {
1691
- readonly type: "string";
1692
- readonly minLength: 1;
1693
- readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1694
- };
1695
- readonly line: {
1696
- readonly type: "integer";
1697
- readonly minimum: 1;
1698
- };
1699
- readonly intent: {
1700
- readonly type: "string";
1701
- readonly minLength: 1;
1702
- };
1703
- };
1704
- };
1705
- };
1706
- readonly safetyUses: {
1707
- readonly type: "array";
1708
- readonly items: {
1709
- readonly type: "object";
1710
- readonly additionalProperties: false;
1711
- readonly required: readonly ["file", "line", "kind"];
1712
- readonly properties: {
1713
- readonly file: {
1714
- readonly type: "string";
1715
- readonly minLength: 1;
1716
- readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1717
- };
1718
- readonly line: {
1719
- readonly type: "integer";
1720
- readonly minimum: 1;
1721
- };
1722
- readonly kind: {
1723
- readonly enum: readonly ["ts-suppression", "any-cast", "dynamic-import", "dynamic-require", "in-memory-store"];
1724
- };
1725
- readonly symbol: {
1726
- readonly type: "string";
1727
- readonly minLength: 1;
1728
- };
1729
- };
1730
- readonly allOf: readonly [{
1731
- readonly if: {
1732
- readonly properties: {
1733
- readonly kind: {
1734
- readonly const: "in-memory-store";
1735
- };
1736
- };
1737
- };
1738
- readonly then: {
1739
- readonly required: readonly ["symbol"];
1740
- };
1741
- readonly else: {
1742
- readonly not: {
1743
- readonly required: readonly ["symbol"];
1744
- };
1745
- };
1746
- }];
1747
- };
1748
- };
1749
- readonly classShapes: {
1750
- readonly type: "array";
1751
- readonly items: {
1752
- readonly type: "object";
1753
- readonly additionalProperties: false;
1754
- readonly required: readonly ["file", "className", "exported", "hasPublicMutableFields", "hasPublicSetters", "hasPublicConstructor", "hasStaticFactory", "mutatingMethods"];
1755
- readonly properties: {
1756
- readonly file: {
1757
- readonly type: "string";
1758
- readonly minLength: 1;
1759
- readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1760
- };
1761
- readonly className: {
1762
- readonly type: "string";
1763
- readonly minLength: 1;
1764
- };
1765
- readonly exported: {
1766
- readonly type: "boolean";
1767
- };
1768
- readonly hasPublicMutableFields: {
1769
- readonly type: "boolean";
1770
- };
1771
- readonly hasPublicSetters: {
1772
- readonly type: "boolean";
1773
- };
1774
- readonly hasPublicConstructor: {
1775
- readonly type: "boolean";
1776
- };
1777
- readonly hasStaticFactory: {
1778
- readonly type: "boolean";
1779
- };
1780
- readonly dataOnly: {
1781
- readonly type: "boolean";
1782
- };
1783
- readonly mutatingMethods: {
1784
- readonly type: "array";
1785
- readonly items: {
1786
- readonly type: "object";
1787
- readonly additionalProperties: false;
1788
- readonly required: readonly ["name", "referencesGuardOrPublish"];
1789
- readonly properties: {
1790
- readonly name: {
1791
- readonly type: "string";
1792
- readonly minLength: 1;
1793
- };
1794
- readonly referencesGuardOrPublish: {
1795
- readonly type: "boolean";
1796
- };
1797
- };
1798
- };
1799
- };
1800
- };
1801
- };
1802
- };
1803
- readonly arkRunKernelCalls: {
1804
- readonly type: "array";
1805
- readonly items: {
1806
- readonly type: "object";
1807
- readonly additionalProperties: false;
1808
- readonly required: readonly ["file", "line", "kind", "callee", "viaImport"];
1809
- readonly properties: {
1810
- readonly file: {
1811
- readonly type: "string";
1812
- readonly minLength: 1;
1813
- readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1814
- };
1815
- readonly line: {
1816
- readonly type: "integer";
1817
- readonly minimum: 1;
1818
- };
1819
- readonly kind: {
1820
- readonly enum: readonly ["factory", "publisher", "publish", "raise", "send", "subscribe", "register-handler", "resolve", "resolve-singleton"];
1821
- };
1822
- readonly callee: {
1823
- readonly type: "string";
1824
- readonly minLength: 1;
1825
- };
1826
- readonly viaImport: {
1827
- readonly type: "boolean";
1828
- };
1829
- readonly receiver: {
1830
- readonly type: "string";
1831
- readonly minLength: 1;
1832
- };
1833
- readonly nameLiteral: {
1834
- readonly type: "string";
1835
- readonly minLength: 1;
1836
- };
1837
- };
1838
- };
1839
- };
1840
- readonly arkRunManagedNews: {
1841
- readonly type: "array";
1842
- readonly items: {
1843
- readonly type: "object";
1844
- readonly additionalProperties: false;
1845
- readonly required: readonly ["file", "line", "typeName"];
1846
- readonly properties: {
1847
- readonly file: {
1848
- readonly type: "string";
1849
- readonly minLength: 1;
1850
- readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1851
- };
1852
- readonly line: {
1853
- readonly type: "integer";
1854
- readonly minimum: 1;
1855
- };
1856
- readonly typeName: {
1857
- readonly type: "string";
1858
- readonly minLength: 1;
1859
- };
1860
- readonly importedFrom: {
1861
- readonly type: "string";
1862
- readonly minLength: 1;
1863
- };
1864
- };
1865
- };
1866
- };
1867
- readonly arkRunCompositionRootHits: {
1868
- readonly type: "array";
1869
- readonly items: {
1870
- readonly type: "object";
1871
- readonly additionalProperties: false;
1872
- readonly required: readonly ["file", "matchedRoot", "hasKernelFactory"];
1873
- readonly properties: {
1874
- readonly file: {
1875
- readonly type: "string";
1876
- readonly minLength: 1;
1877
- readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1878
- };
1879
- readonly matchedRoot: {
1880
- readonly type: "string";
1881
- readonly minLength: 1;
1882
- };
1883
- readonly hasKernelFactory: {
1884
- readonly type: "boolean";
1885
- };
1886
- };
1887
- };
1888
- };
1889
- readonly arkRunDeclarations: {
1890
- readonly type: "array";
1891
- readonly items: {
1892
- readonly type: "object";
1893
- readonly additionalProperties: false;
1894
- readonly required: readonly ["file", "line", "uses", "reactsTo", "raises", "sends"];
1895
- readonly properties: {
1896
- readonly file: {
1897
- readonly type: "string";
1898
- readonly minLength: 1;
1899
- readonly pattern: "^(?!/)(?![A-Za-z]:/)(?!.*\\\\)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u001f\\u007f])(?!.*\\/$).+$";
1900
- };
1901
- readonly line: {
1902
- readonly type: "integer";
1903
- readonly minimum: 1;
1904
- };
1905
- readonly uses: {
1906
- readonly type: "array";
1907
- readonly items: {
1908
- readonly type: "string";
1909
- readonly minLength: 1;
1910
- };
1911
- };
1912
- readonly reactsTo: {
1913
- readonly type: "array";
1914
- readonly items: {
1915
- readonly type: "string";
1916
- readonly minLength: 1;
1917
- };
1918
- };
1919
- readonly raises: {
1920
- readonly type: "array";
1921
- readonly items: {
1922
- readonly type: "string";
1923
- readonly minLength: 1;
1924
- };
1925
- };
1926
- readonly sends: {
1927
- readonly type: "array";
1928
- readonly items: {
1929
- readonly type: "string";
1930
- readonly minLength: 1;
1931
- };
1932
- };
1933
- };
1934
- };
1935
- };
1936
- readonly factsHash: {
1937
- readonly type: "string";
1938
- readonly minLength: 1;
1939
- };
1940
- };
1941
- readonly allOf: readonly [{
1942
- readonly if: {
1943
- readonly properties: {
1944
- readonly completeness: {
1945
- readonly const: "complete";
1946
- };
1947
- };
1948
- };
1949
- readonly then: {
1950
- readonly properties: {
1951
- readonly completenessReasons: {
1952
- readonly maxItems: 0;
1953
- };
1954
- readonly files: {
1955
- readonly items: {
1956
- readonly properties: {
1957
- readonly parseStatus: {
1958
- readonly const: "parsed";
1959
- };
1960
- };
1961
- };
1962
- };
1963
- };
1964
- };
1965
- }, {
1966
- readonly if: {
1967
- readonly properties: {
1968
- readonly completeness: {
1969
- readonly enum: readonly ["partial", "unavailable"];
1970
- };
1971
- };
1972
- };
1973
- readonly then: {
1974
- readonly properties: {
1975
- readonly completenessReasons: {
1976
- readonly minItems: 1;
1977
- };
1978
- };
1979
- };
1980
- }];
1981
- };
1982
-
1983
- /**
1984
- * Stable, pure vocabulary for ArkGate's importable analysis engine.
1985
- *
1986
- * This module owns the Analysis IR types and re-exports the resolved-candidate-facts
1987
- * pilot cluster (plan-B / pattern-b:god-module). Parsing and filesystem discovery
1988
- * belong to adapters.
1989
- *
1990
- * Cluster:
1991
- * - `stableHash` — identity/fingerprint primitives
1992
- * - `resolvedCandidateFactsTypes` — versioned fact types
1993
- * - `resolvedCandidateFacts` — create/load/canonicalize
1994
- * - `resolvedCandidateFactsSchema` — published JSON Schema
1995
- *
1996
- * Consumer import paths through this facade remain stable (same pattern as Kernel
1997
- * `analysis.ts` after U02).
1998
- */
1999
-
2000
- declare const ANALYSIS_IR_SCHEMA_VERSION: "1.0";
2001
- type AnalysisFileInput = {
2002
- path: string;
2003
- content: string;
2004
- };
2005
- type AnalysisFileChange = {
2006
- path: string;
2007
- content: string;
2008
- } | {
2009
- path: string;
2010
- delete: true;
2011
- };
2012
- type AnalysisCompilerOptions = Readonly<Record<string, unknown>>;
2013
- type AnalysisFile = AnalysisFileInput & {
2014
- contentHash: string;
2015
- layer: string | null;
2016
- };
2017
- type AnalysisImportEdge = {
2018
- from: string;
2019
- specifier: string;
2020
- to: string | null;
2021
- resolution: 'resolved' | 'unresolved';
2022
- fromLayer: string | null;
2023
- toLayer: string | null;
2024
- evidence: AnalysisEvidence;
2025
- };
2026
- /** A capability use is reserved for C04's symbol-aware implementation. */
2027
- type AnalysisCapabilityUse = {
2028
- file: string;
2029
- symbol: string;
2030
- capability: string;
2031
- evidence: AnalysisEvidence;
2032
- };
2033
- type AnalysisEvidence = {
2034
- kind: 'import' | 'policy';
2035
- file: string;
2036
- line: number;
2037
- excerpt: string;
2038
- };
2039
- type AnalysisViolation = {
2040
- ruleId: string;
2041
- message: string;
2042
- edge?: AnalysisImportEdge;
2043
- /** U04 (additive): present on CAPABILITY_VIOLATION — the denied capability id. */
2044
- capability?: string;
2045
- /** U04 (additive): the matched module specifier or ambient path. */
2046
- symbol?: string;
2047
- evidence: AnalysisEvidence;
2048
- };
2049
- type AnalysisIr = {
2050
- schemaVersion: typeof ANALYSIS_IR_SCHEMA_VERSION;
2051
- policyHash: string;
2052
- compilerOptionsHash: string;
2053
- files: AnalysisFile[];
2054
- layers: string[];
2055
- edges: AnalysisImportEdge[];
2056
- capabilityUses: AnalysisCapabilityUse[];
2057
- violations: AnalysisViolation[];
2058
- };
2059
-
2060
- declare const ARK_CHANGE_MAP_SCHEMA_VERSION: "1.0";
2061
- type ArchitectureChangeOperation = 'create' | 'update' | 'delete';
2062
- type ArchitectureChangeMapFile = {
2063
- path: string;
2064
- operation: ArchitectureChangeOperation;
2065
- layer: string;
2066
- };
2067
- type ArchitectureChangeMapDependency = {
2068
- from: string;
2069
- to: string;
2070
- };
2071
- type ArchitectureChangeMap = {
2072
- $schema: string;
2073
- schemaVersion: typeof ARK_CHANGE_MAP_SCHEMA_VERSION;
2074
- files: ArchitectureChangeMapFile[];
2075
- dependencies: ArchitectureChangeMapDependency[];
2076
- };
2077
- type ArchitectureChangeMapContract = {
2078
- map: ArchitectureChangeMap;
2079
- hash: string;
2080
- };
2081
-
2082
- type ArchitectureDependency = {
2083
- from: string;
2084
- to: string;
2085
- };
2086
- type ArchitectureActualChange = {
2087
- path: string;
2088
- operation: ArchitectureChangeOperation;
2089
- };
2090
- type ArchitectureConvergenceClassification = 'satisfied' | 'missing' | 'contradictory' | 'unplanned';
2091
- type ArchitectureConvergenceFinding = {
2092
- id: string;
2093
- classification: ArchitectureConvergenceClassification;
2094
- subject: 'file' | 'dependency';
2095
- message: string;
2096
- nextAction?: string;
2097
- path?: string;
2098
- from?: string;
2099
- to?: string;
2100
- expectedOperation?: ArchitectureChangeOperation;
2101
- actualOperation?: ArchitectureChangeOperation | 'added' | 'removed';
2102
- };
2103
- type ArchitectureConvergenceResult = {
2104
- schemaVersion: '1.0';
2105
- readOnly: true;
2106
- changeMapHash: string;
2107
- structurallyConverged: boolean;
2108
- behavioralCompletion: 'not-evaluated';
2109
- summary: Record<ArchitectureConvergenceClassification, number>;
2110
- findings: ArchitectureConvergenceFinding[];
2111
- };
2112
- type AnalyzeArchitectureConvergenceInput = {
2113
- changeMap: ArchitectureChangeMapContract;
2114
- changes: readonly ArchitectureActualChange[];
2115
- baseDependencies: readonly ArchitectureDependency[];
2116
- candidateDependencies: readonly ArchitectureDependency[];
2117
- };
2118
- declare function analyzeArchitectureConvergence(input: AnalyzeArchitectureConvergenceInput): ArchitectureConvergenceResult;
2119
-
2120
- type SemanticDependencyKind = 'import' | 'export' | 'dynamic-import' | 'require';
2121
- type SemanticDependency = {
2122
- specifier?: string;
2123
- kind: SemanticDependencyKind;
2124
- line: number;
2125
- typeOnly: boolean;
2126
- unresolved: boolean;
2127
- node: unknown;
2128
- };
2129
- type ForbiddenCapabilityUse = {
2130
- name: string;
2131
- line: number;
2132
- node: unknown;
2133
- };
2134
- /** Extract every dependency form whose specifier is statically knowable, plus unresolved calls. */
2135
- declare function extractSemanticDependencies(ts: any, sourceFile: any): SemanticDependency[];
2136
- /** Resolve forbidden ambient capabilities through symbols, aliases, globalThis, and static keys. */
2137
- declare function collectForbiddenCapabilityUses(ts: any, sourceFile: any, forbidden: readonly string[]): ForbiddenCapabilityUse[];
2138
-
2139
- /**
2140
- * Type vocabulary for ArkRules files (ADR 0012).
2141
- *
2142
- * Pure declarations only — runtime validation and the published JSON Schema live in
2143
- * ./arkRulesContract.ts so generate:cli-pure can emit a self-contained artifact.
2144
- */
2145
- /** Closed sensor vocabulary (ADR 0013). Unknown sensors fail closed at load time. */
2146
- declare const ARK_RULE_SENSOR_IDS: readonly ["aggregate-private-state", "always-valid-factory", "domain-event-on-mutation", "orchestration-only", "thin-adapter", "no-anemic-model", "invariant-coverage"];
2147
- type ArkRuleSensorId = (typeof ARK_RULE_SENSOR_IDS)[number];
2148
- type ArkRuleMode = 'advisory' | 'enforced';
2149
- type ArkRuleStructureEntry = {
2150
- id: string;
2151
- sensor: ArkRuleSensorId;
2152
- mode?: ArkRuleMode;
2153
- appliesTo?: string[];
2154
- description?: string;
2155
- };
2156
- type ArkRuleInvariantCoverage = {
2157
- test?: boolean;
2158
- symbol?: string;
2159
- };
2160
- type ArkRuleInvariantEntry = {
2161
- id: string;
2162
- description: string;
2163
- aggregate?: string;
2164
- coverage?: ArkRuleInvariantCoverage;
2165
- mode?: ArkRuleMode;
2166
- appliesTo?: string[];
2167
- };
2168
- type ArkRulesFile = {
2169
- $schema?: string;
2170
- schemaVersion: '1.0';
2171
- layer: string;
2172
- structure?: ArkRuleStructureEntry[];
2173
- invariants?: ArkRuleInvariantEntry[];
2174
- };
2175
- type ArkRuleProvenance = {
2176
- sourceFile: string;
2177
- ruleId: string;
2178
- layer: string;
2179
- };
2180
- type EffectiveStructureRule = ArkRuleStructureEntry & {
2181
- mode: ArkRuleMode;
2182
- provenance: ArkRuleProvenance;
2183
- };
2184
- type EffectiveInvariantRule = ArkRuleInvariantEntry & {
2185
- mode: ArkRuleMode;
2186
- provenance: ArkRuleProvenance;
2187
- };
2188
- type EffectiveArkRules = {
2189
- schemaVersion: '1.0';
2190
- byLayer: Record<string, {
2191
- sourceFile: string;
2192
- structure: EffectiveStructureRule[];
2193
- invariants: EffectiveInvariantRule[];
2194
- }>;
2195
- structure: EffectiveStructureRule[];
2196
- invariants: EffectiveInvariantRule[];
2197
- };
2198
-
2199
- /**
2200
- * Pure invariant coverage evidence (ADR 0014 / AR09–AR10).
2201
- *
2202
- * Mines test titles and symbol presence against the Effective ArkRules catalog.
2203
- * No filesystem — Tooling supplies file contents and test globs.
2204
- */
2205
-
2206
- type InvariantCoverageEvidence = {
2207
- invariantId: string;
2208
- layer: string;
2209
- sourceFile: string;
2210
- mode: 'advisory' | 'enforced';
2211
- covered: boolean;
2212
- evidence: Array<'test-title' | 'symbol'>;
2213
- /** When no test globs were supplied, coverage cannot be proven. */
2214
- partial: boolean;
2215
- description: string;
2216
- };
2217
- type InvariantUncoveredKind = 'never-had-tests' | 'tests-disappeared';
2218
- type InvariantCoverageViolation = {
2219
- ruleId: 'INVARIANT_UNCOVERED';
2220
- message: string;
2221
- file: string;
2222
- line: number;
2223
- arkruleId: string;
2224
- arkruleSource: string;
2225
- fromLayer: string;
2226
- severity: 'error' | 'warning';
2227
- failsStrict: boolean;
2228
- /** Adopt residual (no test suite) vs regression (suite exists, coverage gone). */
2229
- kind: InvariantUncoveredKind;
2230
- };
2231
- type EvaluateInvariantCoverageInput = {
2232
- arkRules: EffectiveArkRules;
2233
- /** Project-relative path → file contents (tests + domain sources). */
2234
- fileContents: Readonly<Record<string, string>>;
2235
- /** Paths considered tests (already filtered by Tooling via globs). */
2236
- testFiles?: readonly string[];
2237
- /** When true, missing test files make coverage partial (never green covered). */
2238
- testGlobsMissing?: boolean;
2239
- };
2240
- declare function evaluateInvariantCoverage(input: EvaluateInvariantCoverageInput): {
2241
- coverage: InvariantCoverageEvidence[];
2242
- violations: InvariantCoverageViolation[];
2243
- partial: boolean;
2244
- };
2245
- /**
2246
- * Deterministic promotion gate: refuse advisory→enforced when invariant is uncovered.
2247
- */
2248
- declare function canPromoteInvariant(coverage: InvariantCoverageEvidence | undefined): {
2249
- ok: boolean;
2250
- reason: string;
2251
- };
2252
-
2253
- /**
2254
- * Pure ArkRules structure sensor evaluation (ADR 0013).
2255
- *
2256
- * Consumes closed class-shape / file facts + Effective ArkRules. Emits violations with
2257
- * arkrule provenance. No filesystem, no TypeScript compiler.
2258
- */
2259
-
2260
- type ClassShapeFact = {
2261
- file: string;
2262
- className: string;
2263
- exported: boolean;
2264
- hasPublicMutableFields: boolean;
2265
- hasPublicSetters: boolean;
2266
- hasPublicConstructor: boolean;
2267
- hasStaticFactory: boolean;
2268
- mutatingMethods: readonly {
2269
- name: string;
2270
- referencesGuardOrPublish: boolean;
2271
- }[];
2272
- /** Heuristic: data-only class (fields, no methods beyond accessors). */
2273
- dataOnly?: boolean;
2274
- };
2275
- type ArkRuleSensorViolation = {
2276
- ruleId: string;
2277
- code: string;
2278
- message: string;
2279
- file: string;
2280
- line: number;
2281
- fromLayer?: string;
2282
- arkruleId: string;
2283
- arkruleSource: string;
2284
- severity: 'error' | 'warning';
2285
- sensor: ArkRuleSensorId;
2286
- /** When true, advisory surfaces only (does not fail strict). */
2287
- failsStrict: boolean;
2288
- };
2289
- type EvaluateArkRuleSensorsInput = {
2290
- arkRules: EffectiveArkRules;
2291
- classShapes: readonly ClassShapeFact[];
2292
- /** Project-relative paths in scope for the analysis. */
2293
- files: readonly string[];
2294
- /**
2295
- * Optional layer membership: path → layer name. When omitted, structure rules
2296
- * apply by appliesTo globs only (or all files when appliesTo is absent).
2297
- */
2298
- layerForFile?: (path: string) => string | null | undefined;
2299
- /**
2300
- * Optional thin/orchestration heuristic flags per file (Tooling-supplied).
2301
- */
2302
- fileHints?: Readonly<Record<string, {
2303
- orchestrationHeavy?: boolean;
2304
- adapterThick?: boolean;
2305
- }>>;
2306
- };
2307
- /**
2308
- * Evaluate all structure sensors. Empty Effective Contract → no findings (byte-for-byte parity).
2309
- */
2310
- declare function evaluateArkRuleSensors(input: EvaluateArkRuleSensorsInput): ArkRuleSensorViolation[];
2311
- /**
2312
- * ADR 0012 D3 — a structure rule whose appliesTo matches zero governed files is
2313
- * never silent green. Advisory → warning; enforced → failsStrict.
2314
- * Rules without appliesTo (whole-layer) never emit this signal.
2315
- */
2316
- declare function collectEmptyAppliesToFindings(arkRules: EffectiveArkRules, files: readonly string[]): ArkRuleSensorViolation[];
2317
- /**
2318
- * Pure Tooling/Domain heuristic for orchestration-only / thin-adapter fileHints.
2319
- * Prefers false negatives over false positives (ADR 0013 discipline).
2320
- * Returns null when neither flag is set (callers may omit the path).
2321
- */
2322
- declare function deriveArkRuleFileHints(_file: string, content: string): {
2323
- orchestrationHeavy?: boolean;
2324
- adapterThick?: boolean;
2325
- } | null;
2326
- /**
2327
- * Build fileHints map from path→content. Omits paths with no flags (sparse map).
2328
- */
2329
- declare function buildArkRuleFileHints(fileContents: Readonly<Record<string, string>>): Record<string, {
2330
- orchestrationHeavy?: boolean;
2331
- adapterThick?: boolean;
2332
- }>;
2333
- /**
2334
- * Lightweight class-shape extraction from TypeScript source text (no compiler).
2335
- * Conservative: prefers false negatives over false positives for mutability.
2336
- * Tooling may replace with TypeScript-API facts; sensors consume the same shape.
2337
- *
2338
- * Limitation (AR05/AR06): only `export class` / `export abstract class` forms.
2339
- * `export default class`, re-exported classes, and non-exported aggregates are
2340
- * invisible — enforced structure sensors stay silent (false negative). Silence
2341
- * is never proof of compliance.
2342
- */
2343
- declare function extractClassShapesFromSource(file: string, content: string): ClassShapeFact[];
2344
-
2345
- declare const POLICY_DELTA_SCHEMA_VERSION: "1.0";
2346
- type PolicyDeltaClassification = 'strengthening' | 'neutral' | 'judgment-required' | 'weakening';
2347
- type PolicyDeltaFinding = {
2348
- id: string;
2349
- path: string;
2350
- classification: Exclude<PolicyDeltaClassification, 'neutral'>;
2351
- message: string;
2352
- nextAction?: string;
2353
- before?: unknown;
2354
- after?: unknown;
2355
- };
2356
- type PolicyDelta = {
2357
- schemaVersion: typeof POLICY_DELTA_SCHEMA_VERSION;
2358
- classification: PolicyDeltaClassification;
2359
- findings: PolicyDeltaFinding[];
2360
- };
2361
- type PolicyDeltaAcknowledgement = {
2362
- schemaVersion: typeof POLICY_DELTA_SCHEMA_VERSION;
2363
- basePolicyHash: string;
2364
- candidatePolicyHash: string;
2365
- findingIds: readonly string[];
2366
- reason: string;
2367
- };
2368
- type ClassifyArkPolicyDeltaOptions = {
2369
- baseArkRules?: EffectiveArkRules;
2370
- candidateArkRules?: EffectiveArkRules;
2371
- /**
2372
- * AR11 — coverage evidence for candidate invariants. Required to auto-allow
2373
- * advisory→enforced promotion; without it (or when uncovered), promotion is
2374
- * judgment-required / refused.
2375
- */
2376
- candidateInvariantCoverage?: readonly InvariantCoverageEvidence[];
2377
- };
2378
- declare function classifyArkPolicyDelta(base: ArkConfig, candidate: ArkConfig, options?: ClassifyArkPolicyDeltaOptions): PolicyDelta;
2379
- declare function policyDeltaAcknowledgementMatches(acknowledgement: PolicyDeltaAcknowledgement | undefined, expected: {
2380
- basePolicyHash: string;
2381
- candidatePolicyHash: string;
2382
- findingIds: readonly string[];
2383
- }): boolean;
2384
-
2385
- type AnalysisContract = ArkConfigLoadResult & {
2386
- policyHash: string;
2387
- /**
2388
- * ADR 0012 Effective ArkRules (empty when arkRules is absent).
2389
- * Included in policyHash when non-empty so arkrules edits invalidate identity.
2390
- */
2391
- arkRules?: EffectiveArkRules;
2392
- /**
2393
- * ADR 0013 class-shape facts for ArkRules sensors (Tooling-supplied).
2394
- * Empty / absent when ArkRules are not active.
2395
- */
2396
- classShapes?: ClassShapeFact[];
2397
- };
2398
- type AnalyzeProjectInput = {
2399
- contract: AnalysisContract;
2400
- files: readonly AnalysisFileInput[];
2401
- compilerOptions?: AnalysisCompilerOptions;
2402
- };
2403
- type AnalyzeChangeInput = AnalyzeProjectInput & {
2404
- changes: readonly AnalysisFileChange[];
2405
- changeMap?: ArchitectureChangeMapContract;
2406
- };
2407
- type AnalysisResult = {
2408
- mode: 'lexical-compatibility';
2409
- completeness: ResolvedFactsCompleteness;
2410
- completenessReasons: ResolvedFactsReason[];
2411
- valid: boolean;
2412
- ir: AnalysisIr;
2413
- };
2414
- type AnalyzeResolvedProjectInput = {
2415
- contract: AnalysisContract;
2416
- facts: unknown;
2417
- /**
2418
- * AR10 — Tooling-supplied contents for invariant coverage evidence.
2419
- * When omitted and the Effective Contract has invariants, coverage is partial
2420
- * (never false green covered).
2421
- */
2422
- coverageInputs?: {
2423
- fileContents: Readonly<Record<string, string>>;
2424
- testFiles?: readonly string[];
2425
- testGlobsMissing?: boolean;
2426
- };
2427
- /**
2428
- * AR07 — Tooling-supplied orchestration/thin-adapter heuristics per file.
2429
- * Prefer deriveArkRuleFileHints / buildArkRuleFileHints (Domain pure).
2430
- * When omitted, orchestration-only and thin-adapter sensors stay silent.
2431
- */
2432
- fileHints?: Readonly<Record<string, {
2433
- orchestrationHeavy?: boolean;
2434
- adapterThick?: boolean;
2435
- }>>;
2436
- };
2437
- type PreflightResolvedChangeInput = {
2438
- contract: AnalysisContract;
2439
- baseFacts: unknown;
2440
- candidateFacts: unknown;
2441
- changes: readonly AnalysisFileChange[];
2442
- changeMap?: ArchitectureChangeMapContract;
2443
- };
2444
- type ResolvedAnalysisFile = ResolvedFileFact & {
2445
- layer: string | null;
2446
- };
2447
- type ResolvedAnalysisIr = {
2448
- schemaVersion: '1.0';
2449
- policyHash: string;
2450
- compilerOptionsHash: string;
2451
- files: ResolvedAnalysisFile[];
2452
- layers: string[];
2453
- edges: ArchitectureEngineEdge[];
2454
- capabilityUses: ResolvedCapabilityFact[];
2455
- violations: ArchitectureEngineViolation[];
2456
- warnings: ArchitectureEngineViolation[];
2457
- };
2458
- type ResolvedSafetyReport = {
2459
- tsSuppressions: {
2460
- file: string;
2461
- line: number;
2462
- }[];
2463
- anyCasts: {
2464
- file: string;
2465
- line: number;
2466
- }[];
2467
- nonLiteralDynamicImports: {
2468
- file: string;
2469
- line: number;
2470
- kind: 'import' | 'require';
2471
- }[];
2472
- inMemoryProductionStores: {
2473
- file: string;
2474
- line: number;
2475
- store: string;
2476
- }[];
2477
- disabledPeerIsolationRules: {
2478
- from: string;
2479
- to: string;
2480
- }[];
2481
- thresholds: {
2482
- maxTsSuppressions: number;
2483
- maxAnyCasts: number;
2484
- };
2485
- };
2486
- type ResolvedAnalysisResult = {
2487
- mode: 'resolved-candidate-facts';
2488
- completeness: ResolvedFactsCompleteness;
2489
- completenessReasons: ResolvedFactsReason[];
2490
- valid: boolean;
2491
- strictValid: boolean;
2492
- policyHash: string;
2493
- factsHash: ResolvedCandidateFacts['factsHash'];
2494
- resolverIdentity: ResolvedCandidateFacts['resolverIdentity'];
2495
- candidateTreeHash: ResolvedCandidateFacts['candidateTreeHash'];
2496
- safety: ResolvedSafetyReport;
2497
- ir: ResolvedAnalysisIr;
2498
- };
2499
- type ResolvedChangePreflightResult = {
2500
- schemaVersion: '1.0';
2501
- mode: 'resolved-candidate-facts';
2502
- valid: boolean;
2503
- readOnly: true;
2504
- policyHash: string;
2505
- resolverIdentity: string;
2506
- compilerIdentity: string;
2507
- compilerOptionsHash: string;
2508
- tsconfigHash: string;
2509
- baseCompilerOptionsHash: string;
2510
- candidateCompilerOptionsHash: string;
2511
- baseTsconfigHash: string;
2512
- candidateTsconfigHash: string;
2513
- evidenceRequirementsHash: string;
2514
- baseFactsHash: string;
2515
- candidateFactsHash: string;
2516
- baseTreeHash: string;
2517
- candidateTreeHash: string;
2518
- baseCompleteness: ResolvedFactsCompleteness;
2519
- candidateCompleteness: ResolvedFactsCompleteness;
2520
- baseCompletenessReasons: ResolvedFactsReason[];
2521
- candidateCompletenessReasons: ResolvedFactsReason[];
2522
- changeMapHash?: string;
2523
- convergence?: ArchitectureConvergenceResult;
2524
- changes: PreparedChangeFile[];
2525
- violations: ArchitectureEngineViolation[];
2526
- warnings: ArchitectureEngineViolation[];
2527
- };
2528
- type AnalyzePolicyDeltaInput = {
2529
- baseConfig: unknown;
2530
- candidateConfig: unknown;
2531
- acknowledgement?: PolicyDeltaAcknowledgement;
2532
- baseSource?: string;
2533
- candidateSource?: string;
2534
- /** Optional pre-resolved Effective ArkRules for each side (ADR 0012 / AR02). */
2535
- baseArkRules?: EffectiveArkRules;
2536
- candidateArkRules?: EffectiveArkRules;
2537
- /**
2538
- * AR11 — optional coverage evidence for candidate invariants.
2539
- * When omitted, advisory→enforced promotion is judgment-required (refuse auto-allow).
2540
- */
2541
- candidateInvariantCoverage?: readonly InvariantCoverageEvidence[];
2542
- };
2543
- type PolicyDeltaAnalysis = {
2544
- schemaVersion: '1.0';
2545
- basePolicyHash: string;
2546
- candidatePolicyHash: string;
2547
- classification: PolicyDeltaClassification;
2548
- findings: PolicyDeltaFinding[];
2549
- blockingFindingIds: string[];
2550
- requiresAcknowledgement: boolean;
2551
- acknowledged: boolean;
2552
- valid: boolean;
2553
- };
2554
- type ArchitectureEngineViolation = {
2555
- ruleId: string;
2556
- message: string;
2557
- file?: string;
2558
- line?: number;
2559
- target?: string;
2560
- fromLayer?: string;
2561
- toLayer?: string;
2562
- nextAction?: string;
2563
- [key: string]: unknown;
2564
- };
2565
- type ArchitectureEngineEdge = {
2566
- from: string;
2567
- fromLayer: string | null;
2568
- to?: string;
2569
- toLayer?: string;
2570
- line: number;
2571
- kind: string;
2572
- typeOnly?: boolean;
2573
- targetTypeOnlyExports?: boolean;
2574
- sourcePureTypeModule?: boolean;
2575
- namedBindingsTypeOnly?: boolean;
2576
- portProofEligible?: boolean;
2577
- };
2578
- type EvaluateArchitectureGraphInput = {
2579
- config: ArkConfig;
2580
- rules: ArkConfig['rules'];
2581
- files: readonly string[];
2582
- contentViolations: readonly ArchitectureEngineViolation[];
2583
- edges: readonly ArchitectureEngineEdge[];
2584
- warnings?: readonly ArchitectureEngineViolation[];
2585
- safety?: unknown;
349
+ declare function loadArkConfigContract(input: unknown, source?: string): ArkConfigLoadResult;
350
+ declare function parseArkConfigJson(json: string, source?: string): ArkConfigLoadResult;
351
+
352
+ /**
353
+ * Canonical, pure contract for ArkGate MCP project identity.
354
+ *
355
+ * Filesystem canonicalization, hashing, clocks, and runtime ids belong to the
356
+ * Tooling adapter. This module owns the stable payload and published schemas so
357
+ * every MCP surface speaks the same identity/binding language.
358
+ */
359
+ declare const ARK_PROJECT_IDENTITY_SCHEMA_VERSION: "1.0";
360
+ declare const ARK_PROJECT_IDENTITY_SCHEMA_URL = "https://unpkg.com/arkgate@4/schemas/ark.project-identity.schema.json";
361
+ type ProjectIdentity = {
362
+ schemaVersion: typeof ARK_PROJECT_IDENTITY_SCHEMA_VERSION;
363
+ projectId: string;
364
+ resolvedRoot: string;
365
+ resolvedConfigPath: string;
366
+ arkgateVersion: string;
367
+ contractHash: string;
368
+ contractSource: 'project' | 'default-profile' | 'manifest';
369
+ runtimeId: string;
370
+ processStartedAt: string;
2586
371
  };
2587
- type ArchitectureEngineResult = {
2588
- violations: ArchitectureEngineViolation[];
2589
- warnings: ArchitectureEngineViolation[];
2590
- safety?: unknown;
372
+ type ProjectExpectation = {
373
+ expectedRoot?: string;
374
+ expectedProjectId?: string;
2591
375
  };
2592
- type PreparedChangeFile = {
2593
- path: string;
2594
- operation: 'create' | 'update' | 'delete';
2595
- beforeContentHash?: string;
2596
- candidateContentHash?: string;
376
+ type ProjectBinding = {
377
+ status: 'matched' | 'unverified' | 'mismatch';
378
+ authoritative: boolean;
379
+ expectedRoot?: string;
380
+ expectedProjectId?: string;
381
+ code?: 'PROJECT_ROOT_MISMATCH' | 'PROJECT_ID_MISMATCH' | 'INVALID_PROJECT_EXPECTATION';
382
+ message?: string;
2597
383
  };
2598
- type ChangePreflightResult = {
2599
- schemaVersion: '1.0';
2600
- mode: 'lexical-compatibility';
2601
- valid: boolean;
2602
- readOnly: true;
2603
- policyHash: string;
2604
- compilerOptionsHash: string;
2605
- baseTreeHash: string;
2606
- candidateTreeHash: string;
2607
- baseCompleteness: ResolvedFactsCompleteness;
2608
- candidateCompleteness: ResolvedFactsCompleteness;
2609
- baseCompletenessReasons: ResolvedFactsReason[];
2610
- candidateCompletenessReasons: ResolvedFactsReason[];
2611
- changeMapHash?: string;
2612
- convergence?: ArchitectureConvergenceResult;
2613
- changes: PreparedChangeFile[];
2614
- violations: ArchitectureEngineViolation[];
2615
- warnings: ArchitectureEngineViolation[];
384
+ declare const PROJECT_EXPECTATION_SCHEMA: {
385
+ readonly type: "object";
386
+ readonly additionalProperties: false;
387
+ readonly properties: {
388
+ readonly expectedRoot: {
389
+ readonly type: "string";
390
+ readonly minLength: 1;
391
+ readonly description: string;
392
+ };
393
+ readonly expectedProjectId: {
394
+ readonly type: "string";
395
+ readonly pattern: "^sha256:[a-f0-9]{64}$";
396
+ readonly description: "Project id previously returned by ark_identity or ark_manifest.";
397
+ };
398
+ };
2616
399
  };
2617
- type CollectAnalysisConfigWarningsInput = {
2618
- config: ArkConfig;
2619
- rules: ArkConfig['rules'];
2620
- files: readonly string[];
2621
- manifest?: {
2622
- architecture?: {
2623
- layers?: readonly {
2624
- name?: string;
2625
- prefixes?: readonly string[];
2626
- }[];
400
+ declare const PROJECT_BINDING_SCHEMA: {
401
+ readonly type: "object";
402
+ readonly additionalProperties: false;
403
+ readonly required: readonly ["status", "authoritative"];
404
+ readonly properties: {
405
+ readonly status: {
406
+ readonly enum: readonly ["matched", "unverified", "mismatch"];
407
+ };
408
+ readonly authoritative: {
409
+ readonly type: "boolean";
410
+ };
411
+ readonly expectedRoot: {
412
+ readonly type: "string";
413
+ readonly minLength: 1;
414
+ };
415
+ readonly expectedProjectId: {
416
+ readonly type: "string";
417
+ readonly pattern: "^sha256:[a-f0-9]{64}$";
418
+ };
419
+ readonly code: {
420
+ readonly enum: readonly ["PROJECT_ROOT_MISMATCH", "PROJECT_ID_MISMATCH", "INVALID_PROJECT_EXPECTATION"];
421
+ };
422
+ readonly message: {
423
+ readonly type: "string";
424
+ readonly minLength: 1;
425
+ };
426
+ };
427
+ };
428
+ declare const ARK_PROJECT_IDENTITY_SCHEMA: {
429
+ readonly $schema: "https://json-schema.org/draft/2020-12/schema";
430
+ readonly $id: "https://unpkg.com/arkgate@4/schemas/ark.project-identity.schema.json";
431
+ readonly title: "ArkGate MCP project identity";
432
+ readonly description: "Stable project binding plus separate runtime and architecture-contract evidence.";
433
+ readonly type: "object";
434
+ readonly additionalProperties: false;
435
+ readonly required: readonly ["schemaVersion", "projectId", "resolvedRoot", "resolvedConfigPath", "arkgateVersion", "contractHash", "contractSource", "runtimeId", "processStartedAt"];
436
+ readonly properties: {
437
+ readonly schemaVersion: {
438
+ readonly const: "1.0";
439
+ };
440
+ readonly projectId: {
441
+ readonly type: "string";
442
+ readonly pattern: "^sha256:[a-f0-9]{64}$";
443
+ };
444
+ readonly resolvedRoot: {
445
+ readonly type: "string";
446
+ readonly minLength: 1;
447
+ };
448
+ readonly resolvedConfigPath: {
449
+ readonly type: "string";
450
+ readonly minLength: 1;
451
+ };
452
+ readonly arkgateVersion: {
453
+ readonly type: "string";
454
+ readonly minLength: 1;
455
+ };
456
+ readonly contractHash: {
457
+ readonly type: "string";
458
+ readonly pattern: "^sha256:[a-f0-9]{64}$";
459
+ };
460
+ readonly contractSource: {
461
+ readonly enum: readonly ["project", "default-profile", "manifest"];
462
+ };
463
+ readonly runtimeId: {
464
+ readonly type: "string";
465
+ readonly minLength: 1;
466
+ };
467
+ readonly processStartedAt: {
468
+ readonly type: "string";
469
+ readonly format: "date-time";
470
+ };
471
+ };
472
+ readonly $defs: {
473
+ readonly expectation: {
474
+ readonly type: "object";
475
+ readonly additionalProperties: false;
476
+ readonly properties: {
477
+ readonly expectedRoot: {
478
+ readonly type: "string";
479
+ readonly minLength: 1;
480
+ readonly description: string;
481
+ };
482
+ readonly expectedProjectId: {
483
+ readonly type: "string";
484
+ readonly pattern: "^sha256:[a-f0-9]{64}$";
485
+ readonly description: "Project id previously returned by ark_identity or ark_manifest.";
486
+ };
487
+ };
488
+ };
489
+ readonly binding: {
490
+ readonly type: "object";
491
+ readonly additionalProperties: false;
492
+ readonly required: readonly ["status", "authoritative"];
493
+ readonly properties: {
494
+ readonly status: {
495
+ readonly enum: readonly ["matched", "unverified", "mismatch"];
496
+ };
497
+ readonly authoritative: {
498
+ readonly type: "boolean";
499
+ };
500
+ readonly expectedRoot: {
501
+ readonly type: "string";
502
+ readonly minLength: 1;
503
+ };
504
+ readonly expectedProjectId: {
505
+ readonly type: "string";
506
+ readonly pattern: "^sha256:[a-f0-9]{64}$";
507
+ };
508
+ readonly code: {
509
+ readonly enum: readonly ["PROJECT_ROOT_MISMATCH", "PROJECT_ID_MISMATCH", "INVALID_PROJECT_EXPECTATION"];
510
+ };
511
+ readonly message: {
512
+ readonly type: "string";
513
+ readonly minLength: 1;
514
+ };
515
+ };
2627
516
  };
2628
517
  };
2629
518
  };
519
+ /**
520
+ * Stable identity: contract edits and MCP restarts must not change which project
521
+ * this is. Callers must pass canonical real paths and a SHA-256 hex function.
522
+ */
523
+ declare function createProjectId(resolvedRoot: string, resolvedConfigPath: string, sha256Hex: (value: string) => string): string;
524
+ declare function createProjectIdentity(input: Omit<ProjectIdentity, 'schemaVersion'>): ProjectIdentity;
2630
525
 
2631
526
  /**
2632
527
  * Canonical, pure contract for arkrules/<Layer>.json (ADR 0012).
@@ -2775,54 +670,6 @@ declare function buildEffectiveArkRules(parts: ReadonlyArray<{
2775
670
  /** Empty Effective Contract used when `arkRules` is absent (byte-for-byte verdict parity). */
2776
671
  declare function emptyEffectiveArkRules(): EffectiveArkRules;
2777
672
 
2778
- /**
2779
- * Contract loading, project/change analysis, and policy-delta analysis
2780
- * (U02 pilot 2). Reached through the src/kernel/analysis.ts facade; consumer
2781
- * import paths never change.
2782
- */
2783
-
2784
- type LoadContractOptions = {
2785
- /** Pre-resolved Effective ArkRules (from resolveEffectiveContract). */
2786
- arkRules?: EffectiveArkRules;
2787
- };
2788
- declare function loadContract(input: unknown, source?: string, options?: LoadContractOptions): AnalysisContract;
2789
- declare function analyzePolicyDelta(input: AnalyzePolicyDeltaInput): PolicyDeltaAnalysis;
2790
- declare function analyzeProject(input: AnalyzeProjectInput): AnalysisResult;
2791
- declare function analyzeChange(input: AnalyzeChangeInput): AnalysisResult;
2792
- declare function explainViolation(violation: AnalysisViolation): string;
2793
-
2794
- declare function detectArchitectureCycles(graph: ReadonlyMap<string, ReadonlySet<string>>): ArchitectureEngineViolation[];
2795
- /** Canonical graph and layer-policy evaluator shared by library, CLI, and MCP adapters. */
2796
- declare function evaluateArchitectureGraph(input: EvaluateArchitectureGraphInput): ArchitectureEngineResult;
2797
-
2798
- /**
2799
- * Pure evaluation of validated, resolver-supplied candidate facts (ADR 0011).
2800
- *
2801
- * Filesystem discovery and TypeScript resolution remain Tooling concerns. This
2802
- * module only classifies canonical paths against the supplied contract and
2803
- * produces the one architecture verdict consumed by every resolved adapter.
2804
- */
2805
-
2806
- /** Validate supplied facts and evaluate their graph without host effects. */
2807
- declare function analyzeResolvedProject(input: AnalyzeResolvedProjectInput): ResolvedAnalysisResult;
2808
-
2809
- /**
2810
- * Evaluate one create/update/delete set as a single in-memory candidate.
2811
- * The function never writes and returns hashes that bind a later host commit to
2812
- * the exact base, policy, compiler options, and candidate contents it checked.
2813
- */
2814
- declare function preflightChange(input: AnalyzeChangeInput): ChangePreflightResult;
2815
-
2816
- /**
2817
- * Validate that the supplied candidate is exactly the declared in-memory
2818
- * overlay, then return its canonical resolved verdict. No project file is read
2819
- * or written here.
2820
- */
2821
- declare function preflightResolvedChange(input: PreflightResolvedChangeInput): ResolvedChangePreflightResult;
2822
-
2823
- /** Canonical config diagnostics over repo-relative file paths. */
2824
- declare function collectAnalysisConfigWarnings(input: CollectAnalysisConfigWarningsInput): ArchitectureEngineViolation[];
2825
-
2826
673
  /**
2827
674
  * Pure Effective Contract composition (ADR 0012).
2828
675
  *
@@ -2904,7 +751,7 @@ declare function extractArkRunManagedNewsFromSource(file: string, content: strin
2904
751
  declare function extractArkRunDeclarationsFromSource(file: string, content: string): ResolvedArkRunDeclarationFact[];
2905
752
 
2906
753
  /**
2907
- * Extra-plane merge teeth (ArkRules + ArkRun). Same classification floor.
754
+ * Extra-plane merge teeth (ArkRules + ArkRun + ArkOrder). Same classification floor.
2908
755
  *
2909
756
  * Unknown classification (contract-only callers) allows teeth. Known empty or
2910
757
  * under-floor trees demote extra-plane findings so they never merge-block.
@@ -2923,6 +770,7 @@ declare function classifyResolvedLayerCoverage(files: readonly {
2923
770
  layer?: string | null | undefined;
2924
771
  }[]): ExtraMergeTeethClassification;
2925
772
  declare function isArkRunRuleId(ruleId: unknown): boolean;
773
+ declare function isArkOrderRuleId(ruleId: unknown): boolean;
2926
774
  declare function isExtraPlaneFinding(violation: {
2927
775
  ruleId?: unknown;
2928
776
  arkruleId?: unknown;
@@ -2938,7 +786,7 @@ declare function demoteExtraPlaneTeethUnderClassificationFloor<T extends {
2938
786
  severity?: string;
2939
787
  }>(violations: T[], classification?: ExtraMergeTeethClassification): T[];
2940
788
  /** Stamp for extra-plane honesty: never one architecture score. */
2941
- declare const MERGE_PLANES_DUAL_STAMP = "Structure = heuristics; invariants = catalog+coverage evidence (not business runtime); ArkRun = kernel usage + declarations (not a score). Extra planes never merge into one architecture score. Advisory ArkRules \u2260 merge teeth. Advisory ArkRun \u2260 merge teeth.";
789
+ declare const MERGE_PLANES_DUAL_STAMP = "Structure = heuristics; invariants = catalog+coverage evidence (not business runtime); ArkRun = kernel usage + declarations (not a score); ArkOrder = pattern slaving (not a score). Extra planes never merge into one architecture score. Advisory ArkRules \u2260 merge teeth. Advisory ArkRun \u2260 merge teeth. Advisory ArkOrder \u2260 merge teeth.";
2942
790
  type MergePlanesArkRulesInput = {
2943
791
  active: boolean;
2944
792
  structureEnforced?: number;
@@ -3135,6 +983,48 @@ declare function evaluateArkRunEditorSensorsFromSource(input: {
3135
983
  classification?: ExtraMergeTeethClassification;
3136
984
  }): EvaluateArkRunSensorsResult;
3137
985
 
986
+ /**
987
+ * Pure ArkOrder tier-1 sensors (ADR 0027 / 0029). Absence of arkOrder emits nothing.
988
+ */
989
+
990
+ declare const ARKORDER_TIER1_SENSOR_IDS: readonly ["arkorder-missing-plane", "arkorder-kernel-in-domain", "arkorder-generic-update", "arkorder-too-many-params", "arkorder-ingest-writes-xi"];
991
+ type ArkOrderTier1SensorId = (typeof ARKORDER_TIER1_SENSOR_IDS)[number];
992
+ declare const ARKORDER_RULE_IDS: {
993
+ readonly 'arkorder-missing-plane': "ARKORDER_MISSING_PLANE";
994
+ readonly 'arkorder-kernel-in-domain': "ARKORDER_KERNEL_IN_DOMAIN";
995
+ readonly 'arkorder-generic-update': "ARKORDER_GENERIC_UPDATE";
996
+ readonly 'arkorder-too-many-params': "ARKORDER_TOO_MANY_PARAMS";
997
+ readonly 'arkorder-ingest-writes-xi': "ARKORDER_INGEST_WRITES_XI";
998
+ };
999
+ type ArkOrderRuleId = (typeof ARKORDER_RULE_IDS)[ArkOrderTier1SensorId];
1000
+ type ArkOrderSensorFinding = {
1001
+ ruleId: ArkOrderRuleId;
1002
+ sensor: ArkOrderTier1SensorId;
1003
+ message: string;
1004
+ file: string;
1005
+ line: number;
1006
+ fromLayer?: string;
1007
+ target?: string;
1008
+ severity: 'error' | 'warning';
1009
+ failsStrict: boolean;
1010
+ nextAction: string;
1011
+ };
1012
+ type EvaluateArkOrderSensorsInput = {
1013
+ arkOrder: ArkConfigArkOrder | undefined;
1014
+ layers: readonly ArkConfigLayer[];
1015
+ planeCalls: readonly ResolvedArkOrderPlaneCallFact[];
1016
+ genericUpdates: readonly ResolvedArkOrderGenericUpdateFact[];
1017
+ planeRootHits: readonly ResolvedArkOrderRootHitFact[];
1018
+ dependencies: readonly ResolvedDependencyFact[];
1019
+ layerForFile: (path: string) => string | null | undefined;
1020
+ classification?: ExtraMergeTeethClassification;
1021
+ };
1022
+ type EvaluateArkOrderSensorsResult = {
1023
+ findings: ArkOrderSensorFinding[];
1024
+ completenessReasons: ResolvedFactsReason[];
1025
+ };
1026
+ declare function evaluateArkOrderSensors(input: EvaluateArkOrderSensorsInput): EvaluateArkOrderSensorsResult;
1027
+
3138
1028
  /**
3139
1029
  * Deterministic brownfield rules inventory (AR13).
3140
1030
  *
@@ -3205,179 +1095,6 @@ declare function inventoryToExtractionCard(candidate: RulesInventoryCandidate):
3205
1095
  next: string;
3206
1096
  };
3207
1097
 
3208
- /** Public, evidence-backed enforcement state shared by doctor adapters. */
3209
- declare const ARK_ENFORCEMENT_STATE_SCHEMA_VERSION: "1.1";
3210
- type EnforcementVerification = boolean | 'unverified';
3211
- type EnforcementEvidenceField = 'configured' | 'installed' | 'active' | 'runtimeObserved' | 'operationCoverage' | 'bypassable' | 'required' | 'hard';
3212
- type EnforcementEvidence = {
3213
- field: 'configured' | 'installed' | 'runtimeObserved' | 'hard';
3214
- source: string;
3215
- value: boolean;
3216
- } | {
3217
- field: 'active' | 'operationCoverage' | 'bypassable' | 'required';
3218
- source: string;
3219
- value: EnforcementVerification;
3220
- };
3221
- /**
3222
- * State for one enforcement boundary.
3223
- *
3224
- * `configured` records valid wiring, while `installed` requires the referenced
3225
- * package or executable to resolve. Runtime/provider facts remain
3226
- * `unverified` until observed; local files never prove `required: true`.
3227
- */
3228
- type EnforcementBoundaryState = {
3229
- supported: boolean;
3230
- analyzed: boolean;
3231
- configured: boolean;
3232
- installed: boolean;
3233
- active: EnforcementVerification;
3234
- runtimeObserved: boolean;
3235
- operation: string | null;
3236
- operationCoverage: EnforcementVerification;
3237
- bypassable: EnforcementVerification;
3238
- required: EnforcementVerification;
3239
- hard: boolean;
3240
- evidence: readonly EnforcementEvidence[];
3241
- };
3242
- type ArkEnforcementHost = 'claude' | 'grok' | 'cursor' | 'codex' | 'unknown';
3243
- type ArkEnforcementState = {
3244
- schemaVersion: typeof ARK_ENFORCEMENT_STATE_SCHEMA_VERSION;
3245
- activeHost: ArkEnforcementHost;
3246
- localWrite: EnforcementBoundaryState;
3247
- advisoryMcp: EnforcementBoundaryState;
3248
- ciMerge: EnforcementBoundaryState;
3249
- };
3250
-
3251
- /** Public neutral contract for the opt-in new-code design-fitness ratchet. */
3252
- declare const ARK_DESIGN_DELTA_SCHEMA_VERSION: "1.0";
3253
- type DesignSmellId = 'io-under-application' | 'handler-in-persistence' | 'god-module' | 'domain-logic-in-ui' | 'facade-sql-in-routes' | 'mixed-pattern-cluster' | 'soft-contract';
3254
- type DesignDeltaIdentity = {
3255
- kind: 'git-tree' | 'candidate-tree';
3256
- value: string;
3257
- commit?: string;
3258
- };
3259
- type DesignSmellEvidence = {
3260
- kind: string;
3261
- path: string;
3262
- line?: number;
3263
- symbol?: string;
3264
- detail?: string;
3265
- magnitude: number;
3266
- };
3267
- type DesignSmellFinding = {
3268
- smellId: DesignSmellId;
3269
- fingerprint: string;
3270
- identity: string;
3271
- evidence: DesignSmellEvidence;
3272
- repairHint: string;
3273
- };
3274
- type DesignDeltaChange = DesignSmellFinding & {
3275
- classification: 'new' | 'worsened';
3276
- baseMagnitude: number;
3277
- candidateMagnitude: number;
3278
- };
3279
- /** Created-path merge vs full new+worsened ratchet (Z10). Omitted on older producers. */
3280
- type DesignDeltaEnforcementScope = 'created-paths' | 'touched-new-or-worsened';
3281
- type ArkDesignDeltaResult = {
3282
- schemaVersion: typeof ARK_DESIGN_DELTA_SCHEMA_VERSION;
3283
- mode: 'git-base' | 'write-candidate';
3284
- complete: boolean;
3285
- valid: boolean;
3286
- base: DesignDeltaIdentity;
3287
- candidate: DesignDeltaIdentity;
3288
- supportedSmellIds: readonly DesignSmellId[];
3289
- touchedPaths: readonly string[];
3290
- changes: readonly DesignDeltaChange[];
3291
- baseFindingCount: number;
3292
- candidateFindingCount: number;
3293
- historicalResidualCount: number;
3294
- enforcementScope?: DesignDeltaEnforcementScope;
3295
- error?: string;
3296
- };
3297
-
3298
- /**
3299
- * Public diagnostic code catalog (ACS02).
3300
- *
3301
- * Closed vocabulary of stable `ruleId` values emitted by ArkGate adapters with
3302
- * human/agent `why` / `fix` anchors and docs fragment ids. Cataloguing only —
3303
- * no new rule semantics, no LLM verdict, no enforcement from prose.
3304
- *
3305
- * **Canonical** for docs, agent projection (ACS04), and finding refs (ACS06).
3306
- * Runtime remediation remains in `remediation.ts`; parity tests bind the two.
3307
- *
3308
- * Zero Node I/O. Optional CLI surface: generated `bin/lib/diagnostic-catalog.mjs`.
3309
- *
3310
- * @see docs/diagnostics.md
3311
- * @see docs/plans/agent-contract-surface-4.3/README.md
3312
- */
3313
- /** Product-relative docs path (shipped in the npm tarball when listed in package files). */
3314
- declare const DIAGNOSTIC_DOCS_RELATIVE_PATH: "docs/diagnostics.md";
3315
- /** Schema id for serializing the catalog snapshot (agents / install projection). */
3316
- declare const DIAGNOSTIC_CATALOG_SCHEMA_VERSION: "1.0";
3317
- type DiagnosticCategory = 'layer' | 'capability' | 'publish' | 'safety' | 'arkrules' | 'arkrun' | 'preflight' | 'analysis' | 'snippet-policy' | 'config' | 'adapter' | 'meta';
3318
- type DiagnosticCatalogEntry = {
3319
- /** Stable public violation / diagnostic id. */
3320
- ruleId: string;
3321
- /** Short title for indexes and agent projection. */
3322
- title: string;
3323
- /** Why this finding exists (contract intent). */
3324
- why: string;
3325
- /**
3326
- * Canonical fix guidance (agent + human). Contextual nextAction on live
3327
- * findings may specialize this (e.g. type-only vs value layer import).
3328
- */
3329
- fix: string;
3330
- /** Markdown fragment id for docs/diagnostics.md (without leading #). */
3331
- docsAnchor: string;
3332
- category: DiagnosticCategory;
3333
- /**
3334
- * When true, finding is commonly advisory / non-blocking in default profiles
3335
- * (doctor/config warnings, type-only placement debt, empty ArkRule scope).
3336
- * Not a severity bit for the engine — documentation only.
3337
- */
3338
- oftenAdvisory?: boolean;
3339
- };
3340
- /**
3341
- * Closed public catalog. Order is stable (category groups, then ruleId) for
3342
- * deterministic serialization and docs generation.
3343
- *
3344
- * Every production-emitted `ruleId` must appear here. Remediation switch cases
3345
- * and adapter nextAction branches are parity-tested against this list.
3346
- */
3347
- declare const DIAGNOSTIC_CATALOG: readonly DiagnosticCatalogEntry[];
3348
- /** All public ruleIds in catalog order. */
3349
- declare const DIAGNOSTIC_RULE_IDS: readonly string[];
3350
- declare function isKnownDiagnosticCode(ruleId: string | null | undefined): boolean;
3351
- /**
3352
- * True when the code is catalogued or is an ArkRule-family id handled by the
3353
- * ARKRULE_* prefix fallback in remediation (structure sensors may add members later
3354
- * only via catalog + ROADMAP — prefix alone is not a license for free-form ids).
3355
- */
3356
- declare function isCataloguedOrArkRuleFamily(ruleId: string | null | undefined): boolean;
3357
- declare function getDiagnosticCatalogEntry(ruleId: string | null | undefined): DiagnosticCatalogEntry | undefined;
3358
- /** Fragment for docs links, e.g. `#LAYER_IMPORT_VIOLATION`. */
3359
- declare function diagnosticDocsFragment(ruleId: string): string;
3360
- /**
3361
- * Repo-relative docs path with fragment (for agents and JSON).
3362
- * Package consumers resolve against the installed package root or GitHub tree.
3363
- */
3364
- declare function diagnosticDocsPath(ruleId: string): string;
3365
- /** Catalog snapshot for JSON export / agent projection (stable field order). */
3366
- declare function serializeDiagnosticCatalog(): {
3367
- schemaVersion: typeof DIAGNOSTIC_CATALOG_SCHEMA_VERSION;
3368
- docsPath: typeof DIAGNOSTIC_DOCS_RELATIVE_PATH;
3369
- codes: readonly DiagnosticCatalogEntry[];
3370
- };
3371
- /**
3372
- * Static catalog fix for a ruleId when no live violation context is available.
3373
- * Live adapters should still use deterministicNextAction for specialized edges.
3374
- */
3375
- declare function catalogFixForRuleId(ruleId: string | null | undefined): string | undefined;
3376
- /**
3377
- * Static catalog why for a ruleId (agent “why” surface).
3378
- */
3379
- declare function catalogWhyForRuleId(ruleId: string | null | undefined): string | undefined;
3380
-
3381
1098
  /**
3382
1099
  * Public status manifest (ACS03 + DF02 honesty).
3383
1100
  *
@@ -4330,4 +2047,4 @@ declare function agentSkillPackageFileRelativePath(skillName: string): string;
4330
2047
  */
4331
2048
  declare function flatSkillTemplateFileRelativePath(skillName: string): string;
4332
2049
 
4333
- export { ADAPTER_DIAGNOSTIC_DOCS_RELATIVE_PATH, AGENT_PROJECTION_BEGIN_MARKER, AGENT_PROJECTION_END_MARKER, AGENT_PROJECTION_ENFORCEMENT_SURFACES, AGENT_PROJECTION_NON_ENFORCEMENT_LABEL, AGENT_SKILLS_PACKAGE_RELATIVE_ROOT, AGENT_SKILL_ENTRY_FILENAME, type AICodeGate, type AICodeGateContext, type AICodeGateOptions, type AICodeGateResult, type AICodeGateViolation, type AIGateExtension, ANALYSIS_IR_SCHEMA_VERSION, ARKRUN_INTERACTION_NAME_INCOMPLETE, ARKRUN_KERNEL_FACTORY_CALLEES, ARKRUN_KERNEL_INTERACTION_CALLEES, ARKRUN_RULE_IDS, ARKRUN_TIER1_SENSOR_IDS, ARKRUN_TRANSPORT_BYPASS_SPECIFIERS, ARK_AGENT_PROJECTION_SCHEMA_VERSION, ARK_AGENT_SKILLS_PACKAGE_SCHEMA_VERSION, ARK_ANALYSIS_RESULT_SCHEMA, ARK_ANALYSIS_RESULT_SCHEMA_VERSION, ARK_CONFIG_SCHEMA, ARK_CONFIG_SCHEMA_VERSION, ARK_DESIGN_DELTA_SCHEMA_VERSION, ARK_ENFORCEMENT_STATE_SCHEMA_VERSION, ARK_IMPROVEMENT_COMPASS_SCHEMA_VERSION, ARK_PROJECT_IDENTITY_SCHEMA, ARK_PROJECT_IDENTITY_SCHEMA_URL, ARK_PROJECT_IDENTITY_SCHEMA_VERSION, ARK_RULES_SCHEMA, ARK_RULES_SCHEMA_VERSION, ARK_RULE_SENSORS, ARK_RUN_DOCTOR_SCHEMA_VERSION, ARK_SKILL_DESCRIPTION_VERSION_PATTERN, ARK_SKILL_NAMES, ARK_SKILL_NAME_COUNT, ARK_STATUS_MANIFEST_SCHEMA, ARK_STATUS_MANIFEST_SCHEMA_URL, ARK_STATUS_MANIFEST_SCHEMA_VERSION, type AdapterCompletenessReason, type AdapterDiagnostic, type AdapterResult, type AdapterSeverity, type AdapterViolationInput, type AgentProjectionCatalogEntry, type AgentProjectionFacts, type AgentProjectionLayerSummary, type AgentProjectionMergeAction, type AgentProjectionMergeResult, type AgentProjectionMeta, type AgentProjectionProfile, type AgentSkillPackageEntry, type AgentSkillValidationIssue, type AnalysisCapabilityUse, type AnalysisCompilerOptions, type AnalysisCompleteness, type AnalysisContract, type AnalysisEvidence, type AnalysisFile, type AnalysisFileChange, type AnalysisFileInput, type AnalysisImportEdge, type AnalysisIr, type AnalysisMode, type AnalysisResult, type AnalysisViolation, type AnalyzeArchitectureConvergenceInput, type AnalyzeChangeInput, type AnalyzePolicyDeltaInput, type AnalyzeProjectInput, type AnalyzeResolvedProjectInput, type ArchitectureActualChange, type ArchitectureChangeMap, type ArchitectureChangeMapContract, type ArchitectureChangeMapDependency, type ArchitectureChangeMapFile, type ArchitectureChangeOperation, type ArchitectureConvergenceClassification, type ArchitectureConvergenceFinding, type ArchitectureConvergenceResult, type ArchitectureDependency, type ArchitectureEngineEdge, type ArchitectureEngineResult, type ArchitectureEngineViolation, type ArchitectureLayer, type ArchitectureLayerConfig, type ArchitectureProfile, type ArchitectureRule, type ArkCheckConfig, ArkConfig, ArkConfigLoadResult, type ArkDesignDeltaResult, type ArkEnforcementHost, type ArkEnforcementState, type ArkRuleSensorViolation, type ArkRulesFile, type ArkRunDoctorSection, type ArkRunRuleId, type ArkRunSensorFinding, type ArkRunStatusSlice, type ArkRunTier1SensorId, type ArkSkillName, type ChangePreflightResult, type ClassShapeFact, type CollectAnalysisConfigWarningsInput, type CreateArchitectureProfileFromArkConfigOptions, type CreateArchitectureProfileOptions, type CreateElevenLayerArkConfigOptions, DEFAULT_AGENT_PROJECTION_RULE_IDS, DIAGNOSTIC_CATALOG, DIAGNOSTIC_CATALOG_SCHEMA_VERSION, DIAGNOSTIC_DOCS_RELATIVE_PATH, DIAGNOSTIC_RULE_IDS, type DesignDeltaChange, type DesignDeltaEnforcementScope, type DesignDeltaIdentity, type DesignSmellEvidence, type DesignSmellFinding, type DesignSmellId, type DiagnosticCatalogEntry, type DiagnosticCategory, EXTRA_MERGE_TEETH_GOVERNED_FLOOR, type EffectiveArkRules, type EffectiveContract, EffectiveContractError, type EffectiveContractWarning, type EnforcementBoundaryState, type EnforcementEvidence, type EnforcementEvidenceField, type EnforcementVerification, type EvaluateArchitectureGraphInput, type EvaluateArkRunSensorsInput, type EvaluateArkRunSensorsResult, type ExtraMergeTeethClassification, FLAT_SKILL_TEMPLATES_RELATIVE_ROOT, type ForbiddenCapabilityUse, IMPROVEMENT_COMPASS_OUT_OF_SCOPE_LENSES, IMPROVEMENT_COMPASS_TOP_RESIDUAL_CAP, IMPROVEMENT_LENS_IDS, type ImprovementCompass, type ImprovementCompassEvidence, type ImprovementCompassFacts, type ImprovementCompassNextAction, type ImprovementCompassSmellFact, type ImprovementCompassViolationFact, type ImprovementLens, type ImprovementLensId, type ImprovementLensStatus, type InvariantCoverageEvidence, MERGE_PLANES_DUAL_STAMP, type MergePlanesHonesty, POLICY_DELTA_SCHEMA_VERSION, PROJECT_BINDING_SCHEMA, PROJECT_EXPECTATION_SCHEMA, type ParseSkillDocumentResult, type ParsedSkillFrontmatter, type PolicyDelta, type PolicyDeltaAcknowledgement, type PolicyDeltaAnalysis, type PolicyDeltaClassification, type PolicyDeltaFinding, type PreflightResolvedChangeInput, type PreparedChangeFile, type ProjectBinding, type ProjectExpectation, type ProjectIdentity, RESOLVED_CANDIDATE_FACTS_SCHEMA, RESOLVED_CANDIDATE_FACTS_SCHEMA_VERSION, type ResolvedAmbientFact, type ResolvedAnalysisFile, type ResolvedAnalysisIr, type ResolvedAnalysisResult, type ResolvedArkRunCompositionRootHitFact, type ResolvedArkRunDeclarationFact, type ResolvedArkRunKernelCallFact, type ResolvedArkRunKernelCallKind, type ResolvedArkRunManagedNewFact, type ResolvedCandidateFacts, type ResolvedCandidateFactsInput, type ResolvedCapability, type ResolvedCapabilityFact, type ResolvedChangePreflightResult, type ResolvedDependencyFact, type ResolvedDependencyKind, type ResolvedDependencyState, type ResolvedFactsCompleteness, type ResolvedFactsReason, type ResolvedFileFact, type ResolvedIntentReferenceFact, type ResolvedPublishFact, type ResolvedSafetyFact, type ResolvedSafetyKind, type ResolvedSafetyReport, type RulesInventoryCandidate, type RulesInventoryResult, STATUS_COMPASS_FACTS_SOURCES, STATUS_COMPASS_MODES, STATUS_COMPASS_REASON_CODES, type SemanticDependency, type SemanticDependencyKind, type StatusActivationSlice, type StatusCheckVerdict, type StatusCompassFactsSource, type StatusCompassMode, type StatusCompassReasonCode, type StatusImprovementCompassSlice, type StatusLastCheckSlice, type StatusManifest, type StatusManifestFacts, type StatusNextAction, type StatusProjectIdentitySlice, type StatusRulesSlice, type StatusWritePathClass, type ValidateAgentSkillDocumentInput, type ValidateAgentSkillsPackageResult, adapterDocsCodePath, adapterFindingOccurrenceTargetKeys, adapterFindingRefFromTargetKey, adapterFindingTargetKey, agentProjectionContentIdentity, agentSkillEntryRelativePath, agentSkillPackageFileRelativePath, analyzeArchitectureConvergence, analyzeChange, analyzePolicyDelta, analyzeProject, analyzeResolvedProject, arkRunKernelCallKind, buildAgentProjectionBeginMarker, buildAgentProjectionBlock, buildAgentProjectionBody, buildAgentProjectionMeta, buildArkRuleFileHints, buildEffectiveArkRules, buildImprovementCompass, buildRulesInventory, buildStatusManifest, canPromoteInvariant, catalogFixForRuleId, catalogWhyForRuleId, classifyArkPolicyDelta, classifyResolvedLayerCoverage, classifyStatusWritePath, collectAnalysisConfigWarnings, collectEmptyAppliesToFindings, collectForbiddenCapabilityUses, composeMergePlanesHonesty, createAICodeGate, createAdapterResult, createArchitectureProfile, createArchitectureProfileFromArkConfig, createElevenLayerArkConfig, createProjectId, createProjectIdentity, createResolvedCandidateFacts, defaultHonestLabel, demoteExtraPlaneTeethUnderClassificationFloor, deriveArkRuleFileHints, detectArchitectureCycles, deterministicHash, diagnosticDocsFragment, diagnosticDocsPath, effectiveContractPolicyPayload, elevenLayerProfile, emptyEffectiveArkRules, evaluateArchitectureGraph, evaluateArkRuleSensors, evaluateArkRunEditorSensors, evaluateArkRunEditorSensorsFromSource, evaluateArkRunSensors, evaluateInvariantCoverage, evaluateStatusBinding, explainViolation, extraMergeTeethAllowed, extractAgentProjectionBlock, extractArkRunDeclarationsFromSource, extractArkRunImportedConstructorNamesFromSource, extractArkRunKernelCallsFromSource, extractArkRunManagedNewsFromSource, extractArkRunValueImportDependenciesFromSource, extractClassShapesFromSource, extractSemanticDependencies, flatSkillTemplateFileRelativePath, formatAgentProjectionCatalogShortList, formatAgentProjectionLayers, formatArkRunDoctorLines, formatImprovementCompassDoctorLines, formatImprovementCompassResidualLabels, getDiagnosticCatalogEntry, inventoryToExtractionCard, isArkRunKernelModuleSpecifier, isArkRunRuleId, isArkRunTransportBypassSpecifier, isArkSkillName, isCataloguedOrArkRuleFamily, isExtraPlaneFinding, isKnownDiagnosticCode, isValidAgentSkillName, loadArkConfigContract, loadArkRulesContract, loadContract, loadResolvedCandidateFacts, mergeAgentProjectionDocument, normalizeExtraMergeTeethClassification, normalizeSkillContent, normalizeStatusImprovementCompass, parseAgentProjectionStamp, parseArkConfigJson, parseArkRulesJson, parseSkillDescriptionVersion, parseSkillDocument, policyDeltaAcknowledgementMatches, preflightChange, preflightResolvedChange, primaryImprovementCompassNextAction, projectStatusArkRun, projectStatusImprovementCompass, projectionHasNonEnforcementLabel, projectionMatchesPackageVersion, resolveEffectiveContract, resolveStatusNextAction, resolvedFactsEvidenceRequirementsHash, serializeDiagnosticCatalog, skillDescriptionVersionPrefix, stableSerialize, stampSkillDescription, statusCompassResidualIsSubsetOfDoctor, stripSkillDescriptionVersion, summarizeArkRunSection, toAdapterDiagnostic, unavailableStatusImprovementCompass, validateAgentSkillDocument, validateAgentSkillsPackage, version };
2050
+ export { AGENT_PROJECTION_BEGIN_MARKER, AGENT_PROJECTION_END_MARKER, AGENT_PROJECTION_ENFORCEMENT_SURFACES, AGENT_PROJECTION_NON_ENFORCEMENT_LABEL, AGENT_SKILLS_PACKAGE_RELATIVE_ROOT, AGENT_SKILL_ENTRY_FILENAME, ARKORDER_RULE_IDS, ARKORDER_TIER1_SENSOR_IDS, ARKRUN_INTERACTION_NAME_INCOMPLETE, ARKRUN_KERNEL_FACTORY_CALLEES, ARKRUN_KERNEL_INTERACTION_CALLEES, ARKRUN_RULE_IDS, ARKRUN_TIER1_SENSOR_IDS, ARKRUN_TRANSPORT_BYPASS_SPECIFIERS, ARK_AGENT_PROJECTION_SCHEMA_VERSION, ARK_AGENT_SKILLS_PACKAGE_SCHEMA_VERSION, ARK_CONFIG_SCHEMA, ARK_CONFIG_SCHEMA_VERSION, ARK_IMPROVEMENT_COMPASS_SCHEMA_VERSION, ARK_PROJECT_IDENTITY_SCHEMA, ARK_PROJECT_IDENTITY_SCHEMA_URL, ARK_PROJECT_IDENTITY_SCHEMA_VERSION, ARK_RULES_SCHEMA, ARK_RULES_SCHEMA_VERSION, ARK_RULE_SENSORS, ARK_RUN_DOCTOR_SCHEMA_VERSION, ARK_SKILL_DESCRIPTION_VERSION_PATTERN, ARK_SKILL_NAMES, ARK_SKILL_NAME_COUNT, ARK_STATUS_MANIFEST_SCHEMA, ARK_STATUS_MANIFEST_SCHEMA_URL, ARK_STATUS_MANIFEST_SCHEMA_VERSION, type AgentProjectionCatalogEntry, type AgentProjectionFacts, type AgentProjectionLayerSummary, type AgentProjectionMergeAction, type AgentProjectionMergeResult, type AgentProjectionMeta, type AgentProjectionProfile, type AgentSkillPackageEntry, type AgentSkillValidationIssue, ArkConfig, ArkConfigLoadResult, type ArkOrderRuleId, type ArkOrderSensorFinding, ArkRulesFile, type ArkRunDoctorSection, type ArkRunRuleId, type ArkRunSensorFinding, type ArkRunStatusSlice, type ArkRunTier1SensorId, type ArkSkillName, DEFAULT_AGENT_PROJECTION_RULE_IDS, EXTRA_MERGE_TEETH_GOVERNED_FLOOR, EffectiveArkRules, type EffectiveContract, EffectiveContractError, type EffectiveContractWarning, type EvaluateArkRunSensorsInput, type EvaluateArkRunSensorsResult, type ExtraMergeTeethClassification, FLAT_SKILL_TEMPLATES_RELATIVE_ROOT, IMPROVEMENT_COMPASS_OUT_OF_SCOPE_LENSES, IMPROVEMENT_COMPASS_TOP_RESIDUAL_CAP, IMPROVEMENT_LENS_IDS, type ImprovementCompass, type ImprovementCompassEvidence, type ImprovementCompassFacts, type ImprovementCompassNextAction, type ImprovementCompassSmellFact, type ImprovementCompassViolationFact, type ImprovementLens, type ImprovementLensId, type ImprovementLensStatus, MERGE_PLANES_DUAL_STAMP, type MergePlanesHonesty, PROJECT_BINDING_SCHEMA, PROJECT_EXPECTATION_SCHEMA, type ParseSkillDocumentResult, type ParsedSkillFrontmatter, type ProjectBinding, type ProjectExpectation, type ProjectIdentity, ResolvedArkRunCompositionRootHitFact, ResolvedArkRunDeclarationFact, ResolvedArkRunKernelCallFact, ResolvedArkRunKernelCallKind, ResolvedArkRunManagedNewFact, ResolvedDependencyFact, ResolvedFactsReason, type RulesInventoryCandidate, type RulesInventoryResult, STATUS_COMPASS_FACTS_SOURCES, STATUS_COMPASS_MODES, STATUS_COMPASS_REASON_CODES, type StatusActivationSlice, type StatusCheckVerdict, type StatusCompassFactsSource, type StatusCompassMode, type StatusCompassReasonCode, type StatusImprovementCompassSlice, type StatusLastCheckSlice, type StatusManifest, type StatusManifestFacts, type StatusNextAction, type StatusProjectIdentitySlice, type StatusRulesSlice, type StatusWritePathClass, type ValidateAgentSkillDocumentInput, type ValidateAgentSkillsPackageResult, agentProjectionContentIdentity, agentSkillEntryRelativePath, agentSkillPackageFileRelativePath, arkRunKernelCallKind, buildAgentProjectionBeginMarker, buildAgentProjectionBlock, buildAgentProjectionBody, buildAgentProjectionMeta, buildEffectiveArkRules, buildImprovementCompass, buildRulesInventory, buildStatusManifest, classifyResolvedLayerCoverage, classifyStatusWritePath, composeMergePlanesHonesty, createProjectId, createProjectIdentity, defaultHonestLabel, demoteExtraPlaneTeethUnderClassificationFloor, effectiveContractPolicyPayload, emptyEffectiveArkRules, evaluateArkOrderSensors, evaluateArkRunEditorSensors, evaluateArkRunEditorSensorsFromSource, evaluateArkRunSensors, evaluateStatusBinding, extraMergeTeethAllowed, extractAgentProjectionBlock, extractArkRunDeclarationsFromSource, extractArkRunImportedConstructorNamesFromSource, extractArkRunKernelCallsFromSource, extractArkRunManagedNewsFromSource, extractArkRunValueImportDependenciesFromSource, flatSkillTemplateFileRelativePath, formatAgentProjectionCatalogShortList, formatAgentProjectionLayers, formatArkRunDoctorLines, formatImprovementCompassDoctorLines, formatImprovementCompassResidualLabels, inventoryToExtractionCard, isArkOrderRuleId, isArkRunKernelModuleSpecifier, isArkRunRuleId, isArkRunTransportBypassSpecifier, isArkSkillName, isExtraPlaneFinding, isValidAgentSkillName, loadArkConfigContract, loadArkRulesContract, mergeAgentProjectionDocument, normalizeExtraMergeTeethClassification, normalizeSkillContent, normalizeStatusImprovementCompass, parseAgentProjectionStamp, parseArkConfigJson, parseArkRulesJson, parseSkillDescriptionVersion, parseSkillDocument, primaryImprovementCompassNextAction, projectStatusArkRun, projectStatusImprovementCompass, projectionHasNonEnforcementLabel, projectionMatchesPackageVersion, resolveEffectiveContract, resolveStatusNextAction, skillDescriptionVersionPrefix, stampSkillDescription, statusCompassResidualIsSubsetOfDoctor, stripSkillDescriptionVersion, summarizeArkRunSection, unavailableStatusImprovementCompass, validateAgentSkillDocument, validateAgentSkillsPackage };