@cleocode/contracts 2026.9.8 → 2026.9.9

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 (151) hide show
  1. package/dist/__tests__/acceptance-gate.test.js +242 -1
  2. package/dist/__tests__/acceptance-gate.test.js.map +1 -1
  3. package/dist/__tests__/evidence-atom-schema.test.js +17 -14
  4. package/dist/__tests__/evidence-atom-schema.test.js.map +1 -1
  5. package/dist/__tests__/memory-wire-shapes.test.js.map +1 -1
  6. package/dist/__tests__/operations-registry.test.js +18 -0
  7. package/dist/__tests__/operations-registry.test.js.map +1 -1
  8. package/dist/acceptance-gate-schema.d.ts +60 -2
  9. package/dist/acceptance-gate-schema.d.ts.map +1 -1
  10. package/dist/acceptance-gate-schema.js +273 -1
  11. package/dist/acceptance-gate-schema.js.map +1 -1
  12. package/dist/acceptance-gate.d.ts +122 -11
  13. package/dist/acceptance-gate.d.ts.map +1 -1
  14. package/dist/acceptance-gate.js +3 -3
  15. package/dist/audit.d.ts +71 -2
  16. package/dist/audit.d.ts.map +1 -1
  17. package/dist/backup-manifest.d.ts +80 -0
  18. package/dist/backup-manifest.d.ts.map +1 -1
  19. package/dist/caamp-markers.d.ts +20 -0
  20. package/dist/caamp-markers.d.ts.map +1 -1
  21. package/dist/capabilities.d.ts +282 -0
  22. package/dist/capabilities.d.ts.map +1 -1
  23. package/dist/changesets.d.ts +4 -4
  24. package/dist/code-symbol.d.ts +33 -0
  25. package/dist/code-symbol.d.ts.map +1 -1
  26. package/dist/daemon/health.d.ts +3 -3
  27. package/dist/data-accessor.d.ts +15 -0
  28. package/dist/data-accessor.d.ts.map +1 -1
  29. package/dist/data-accessor.js.map +1 -1
  30. package/dist/dispatch/__tests__/tasks-gateway-crud-ops.test.js +19 -1
  31. package/dist/dispatch/__tests__/tasks-gateway-crud-ops.test.js.map +1 -1
  32. package/dist/dispatch/operations-registry.d.ts.map +1 -1
  33. package/dist/dispatch/operations-registry.js +684 -3
  34. package/dist/dispatch/operations-registry.js.map +1 -1
  35. package/dist/docs-taxonomy.d.ts +25 -0
  36. package/dist/docs-taxonomy.d.ts.map +1 -1
  37. package/dist/docs-taxonomy.js.map +1 -1
  38. package/dist/evidence-atom-schema.d.ts +7 -6
  39. package/dist/evidence-atom-schema.d.ts.map +1 -1
  40. package/dist/evidence-atom-schema.js +10 -9
  41. package/dist/evidence-atom-schema.js.map +1 -1
  42. package/dist/graph.d.ts +283 -2
  43. package/dist/graph.d.ts.map +1 -1
  44. package/dist/index.d.ts +6 -5
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js.map +1 -1
  47. package/dist/invariants/adr-070-orchestration.d.ts.map +1 -1
  48. package/dist/invariants/adr-070-orchestration.js +1 -1
  49. package/dist/invariants/adr-070-orchestration.js.map +1 -1
  50. package/dist/invariants/adr-073-saga.js +2 -2
  51. package/dist/invariants/adr-073-saga.js.map +1 -1
  52. package/dist/jobs.d.ts +329 -3
  53. package/dist/jobs.d.ts.map +1 -1
  54. package/dist/knowledge-health.d.ts +695 -0
  55. package/dist/knowledge-health.d.ts.map +1 -0
  56. package/dist/knowledge-health.js +8 -0
  57. package/dist/knowledge-health.js.map +1 -0
  58. package/dist/llm/catalog-schema.d.ts +4 -4
  59. package/dist/memory/observe.d.ts +4 -2
  60. package/dist/memory/observe.d.ts.map +1 -1
  61. package/dist/memory/search.d.ts +4 -0
  62. package/dist/memory/search.d.ts.map +1 -1
  63. package/dist/nexus-living-brain-ops.d.ts +28 -3
  64. package/dist/nexus-living-brain-ops.d.ts.map +1 -1
  65. package/dist/nexus-tasks-bridge-ops.d.ts +11 -0
  66. package/dist/nexus-tasks-bridge-ops.d.ts.map +1 -1
  67. package/dist/operations/admin.d.ts +10 -4
  68. package/dist/operations/admin.d.ts.map +1 -1
  69. package/dist/operations/docs.d.ts +138 -0
  70. package/dist/operations/docs.d.ts.map +1 -1
  71. package/dist/operations/docs.js +47 -0
  72. package/dist/operations/docs.js.map +1 -1
  73. package/dist/operations/focus.d.ts +7 -0
  74. package/dist/operations/focus.d.ts.map +1 -1
  75. package/dist/operations/nexus.d.ts +7 -2
  76. package/dist/operations/nexus.d.ts.map +1 -1
  77. package/dist/operations/output-contracts-data.d.ts.map +1 -1
  78. package/dist/operations/output-contracts-data.js +31 -3
  79. package/dist/operations/output-contracts-data.js.map +1 -1
  80. package/dist/operations/research.d.ts +33 -0
  81. package/dist/operations/research.d.ts.map +1 -1
  82. package/dist/operations/tasks.d.ts +107 -4
  83. package/dist/operations/tasks.d.ts.map +1 -1
  84. package/dist/operations/tasks.js +5 -0
  85. package/dist/operations/tasks.js.map +1 -1
  86. package/dist/package-artifact.d.ts +112 -0
  87. package/dist/package-artifact.d.ts.map +1 -0
  88. package/dist/package-artifact.js +8 -0
  89. package/dist/package-artifact.js.map +1 -0
  90. package/dist/release/evidence-atoms.d.ts +10 -0
  91. package/dist/release/evidence-atoms.d.ts.map +1 -1
  92. package/dist/release/evidence-atoms.js +6 -0
  93. package/dist/release/evidence-atoms.js.map +1 -1
  94. package/dist/release/plan.d.ts +6 -6
  95. package/dist/resource-governor.d.ts +114 -0
  96. package/dist/resource-governor.d.ts.map +1 -1
  97. package/dist/resource-governor.js.map +1 -1
  98. package/dist/supervisor-ipc/messages.d.ts +6 -6
  99. package/dist/task-record.d.ts +25 -4
  100. package/dist/task-record.d.ts.map +1 -1
  101. package/dist/task.d.ts +55 -36
  102. package/dist/task.d.ts.map +1 -1
  103. package/dist/task.js.map +1 -1
  104. package/dist/tasks/archive.d.ts +3 -3
  105. package/dist/templates/manifest.d.ts +1 -1
  106. package/dist/workgraph.d.ts +5 -3
  107. package/dist/workgraph.d.ts.map +1 -1
  108. package/dist/workgraph.js +19 -0
  109. package/dist/workgraph.js.map +1 -1
  110. package/package.json +2 -2
  111. package/schemas/gate-result.schema.json +350 -1
  112. package/src/__tests__/__snapshots__/operations-registry.test.ts.snap +1 -1
  113. package/src/__tests__/acceptance-gate.test.ts +282 -1
  114. package/src/__tests__/evidence-atom-schema.test.ts +17 -14
  115. package/src/__tests__/memory-wire-shapes.test.ts +2 -0
  116. package/src/__tests__/operations-registry.test.ts +26 -0
  117. package/src/acceptance-gate-schema.ts +320 -14
  118. package/src/acceptance-gate.ts +133 -11
  119. package/src/audit.ts +72 -2
  120. package/src/backup-manifest.ts +88 -0
  121. package/src/caamp-markers.ts +22 -0
  122. package/src/capabilities.ts +311 -0
  123. package/src/code-symbol.ts +37 -0
  124. package/src/data-accessor.ts +16 -0
  125. package/src/dispatch/__tests__/tasks-gateway-crud-ops.test.ts +31 -1
  126. package/src/dispatch/operations-registry.ts +689 -3
  127. package/src/docs-taxonomy.ts +26 -0
  128. package/src/evidence-atom-schema.ts +10 -9
  129. package/src/graph.ts +326 -2
  130. package/src/index.ts +43 -1
  131. package/src/invariants/adr-070-orchestration.ts +2 -1
  132. package/src/invariants/adr-073-saga.ts +2 -2
  133. package/src/jobs.ts +382 -3
  134. package/src/knowledge-health.ts +748 -0
  135. package/src/memory/observe.ts +4 -2
  136. package/src/memory/search.ts +4 -0
  137. package/src/nexus-living-brain-ops.ts +34 -3
  138. package/src/nexus-tasks-bridge-ops.ts +12 -0
  139. package/src/operations/admin.ts +11 -4
  140. package/src/operations/docs.ts +153 -0
  141. package/src/operations/focus.ts +11 -0
  142. package/src/operations/nexus.ts +7 -1
  143. package/src/operations/output-contracts-data.ts +33 -3
  144. package/src/operations/research.ts +36 -0
  145. package/src/operations/tasks.ts +116 -4
  146. package/src/package-artifact.ts +127 -0
  147. package/src/release/evidence-atoms.ts +6 -0
  148. package/src/resource-governor.ts +132 -0
  149. package/src/task-record.ts +27 -4
  150. package/src/task.ts +58 -36
  151. package/src/workgraph.ts +19 -0
@@ -710,6 +710,32 @@ function requireString(
710
710
  return value;
711
711
  }
712
712
 
713
+ /**
714
+ * Most specific configured ownership rule for a repository-relative document.
715
+ *
716
+ * @remarks
717
+ * Route eligibility does not prove canonical storage or publication provenance.
718
+ * A nested prohibition takes precedence over a broader permitted mirror.
719
+ *
720
+ * @example
721
+ * ```typescript
722
+ * const policy: CanonDocPathPolicy = {
723
+ * docKind: 'research', matchedPath: '.cleo/research/',
724
+ * rawMdAllowed: false, source: 'raw-path',
725
+ * };
726
+ * ```
727
+ */
728
+ export interface CanonDocPathPolicy {
729
+ /** Kind declaring the selected directory rule. */
730
+ readonly docKind: string;
731
+ /** Normalized directory prefix with final slash; empty for the project root. */
732
+ readonly matchedPath: string;
733
+ /** Whether this rule permits raw markdown at the selected location. */
734
+ readonly rawMdAllowed: boolean;
735
+ /** Explicit raw path or permitted publication mirror that owns the path. */
736
+ readonly source: 'raw-path' | 'published-mirror';
737
+ }
738
+
713
739
  /**
714
740
  * Build a best-effort example slug from a metadata entry's pattern.
715
741
  *
@@ -193,10 +193,9 @@ export const decisionAtomSchema = z.object({
193
193
  });
194
194
 
195
195
  /**
196
- * `pr:<number>` atom — references a GitHub PR by number. Satisfies BOTH
197
- * `testsPassed` and `qaPassed` simultaneously when the PR is MERGED and every
198
- * required-workflow check is green (T9764). Extended in T9838 to satisfy
199
- * `implemented` because the merge commit IS the landing artifact.
196
+ * `pr:<number>` atom — references merged PR provenance. Contextual validation
197
+ * checks task relationship and changed artifacts. Implementation also needs
198
+ * inspected file evidence; testing and review require actual result atoms.
200
199
  *
201
200
  * Format: `pr:<positive integer>` (e.g. `pr:357`).
202
201
  *
@@ -449,8 +448,10 @@ export interface GateEvidenceRequirement {
449
448
  * - `[decision, files]` — decision-only task: brain_decisions row +
450
449
  * research-note file (T1875).
451
450
  * - `[decision, note]` — decision-only task without research note.
452
- * - `[pr]` — merged-PR retroactive proof (T9838 extension
453
- * of T9764).
451
+ * - `[pr, files]` — merged-PR provenance with inspected artifacts.
452
+ *
453
+ * PR merge status and generic CI success do not prove tests or review for
454
+ * the task. Those gates require their own verified result atoms (T12254).
454
455
  *
455
456
  * ## Why is `qaPassed` listed as `['tool']` not `['tool', 'tool']`?
456
457
  *
@@ -473,11 +474,11 @@ export const GATE_EVIDENCE_REQUIREMENTS: Readonly<
473
474
  ['commit', 'note'],
474
475
  ['decision', 'files'],
475
476
  ['decision', 'note'],
476
- ['pr'],
477
+ ['pr', 'files'],
477
478
  ],
478
479
  },
479
- testsPassed: { oneOf: [['test-run'], ['tool'], ['pr']] },
480
- qaPassed: { oneOf: [['tool'], ['pr']] },
480
+ testsPassed: { oneOf: [['test-run'], ['tool']] },
481
+ qaPassed: { oneOf: [['tool']] },
481
482
  documented: { oneOf: [['files'], ['url']] },
482
483
  securityPassed: { oneOf: [['tool'], ['note']] },
483
484
  cleanupDone: { oneOf: [['note']] },
package/src/graph.ts CHANGED
@@ -362,6 +362,328 @@ export interface GraphRelation {
362
362
  reason?: string;
363
363
  }
364
364
 
365
+ /** Insert row shape for nexus_nodes. */
366
+ export interface NexusNodeInsertRow {
367
+ id: string;
368
+ kind: GraphNodeKind;
369
+ label: string;
370
+ name: string | null;
371
+ filePath: string | null;
372
+ startLine: number | null;
373
+ endLine: number | null;
374
+ language: string | null;
375
+ isExported: boolean;
376
+ parentId: string | null;
377
+ parametersJson: string | null;
378
+ returnType: string | null;
379
+ docSummary: string | null;
380
+ communityId: string | null;
381
+ metaJson: string | null;
382
+ indexedAt: string;
383
+ }
384
+
385
+ /** Insert row shape for nexus_relations. */
386
+ export interface NexusRelationInsertRow {
387
+ id: string;
388
+ sourceId: string;
389
+ targetId: string;
390
+ type: GraphRelationType;
391
+ confidence: number;
392
+ reason: string | null;
393
+ step: number | null;
394
+ indexedAt: string;
395
+ }
396
+
397
+ /**
398
+ * Role supported by a file's recorded classification evidence.
399
+ * @remarks Unknown files retain potential executable gaps. Generated data is not
400
+ * generated executable code; executable files retain their code capabilities.
401
+ * @example
402
+ * ```ts
403
+ * const role: GraphFileRole = 'documentation';
404
+ * ```
405
+ */
406
+ export type GraphFileRole =
407
+ | 'executable'
408
+ | 'sql'
409
+ | 'documentation'
410
+ | 'configuration'
411
+ | 'schema'
412
+ | 'generated-data'
413
+ | 'data'
414
+ | 'asset'
415
+ | 'unknown';
416
+
417
+ /**
418
+ * One independently requested indexing capability, not a runtime completeness claim.
419
+ * @remarks Evidence capabilities retain available file content and its positively
420
+ * identified role. They do not validate scientific authority, execute configuration,
421
+ * or establish complete symbol/reference resolution. SQL capabilities are separate.
422
+ * @example
423
+ * ```ts
424
+ * const requested: GraphAnalysisCapability[] = ['file-evidence', 'call-references'];
425
+ * ```
426
+ */
427
+ export type GraphAnalysisCapability =
428
+ | 'file-evidence'
429
+ | 'documentary-evidence'
430
+ | 'configuration-evidence'
431
+ | 'schema-evidence'
432
+ | 'data-evidence'
433
+ | 'resource-evidence'
434
+ | 'declarations'
435
+ | 'imports'
436
+ | 'call-references'
437
+ | 'access-references'
438
+ | 'type-heritage'
439
+ | 'sql-schema-objects'
440
+ | 'sql-migrations'
441
+ | 'sql-triggers'
442
+ | 'sql-constraints'
443
+ | 'sql-literal-references'
444
+ | 'sql-dynamic-references';
445
+
446
+ /**
447
+ * Provenance for assigning a file role; recognition is not authority.
448
+ * @remarks Path-only recognition cannot prove an unknown file is non-executable.
449
+ * @example
450
+ * ```ts
451
+ * const classification: GraphFileClassification = {
452
+ * basis: 'path-and-content', reason: 'PNG path and binary signature',
453
+ * };
454
+ * ```
455
+ */
456
+ export interface GraphFileClassification {
457
+ /** Inputs that positively establish the recorded role, or unknown when unclassified. */
458
+ basis: 'path' | 'content' | 'path-and-content' | 'unknown';
459
+ /** Human-readable observation; never an inferred scientific or policy authority. */
460
+ reason: string;
461
+ }
462
+
463
+ /**
464
+ * Capability-specific observations for an existing per-file index report.
465
+ * @remarks Completed is a subset of requested and records performed extraction or
466
+ * available evidence, not the absence of unresolved references. Static limitations
467
+ * and uncompleted capabilities must survive compact reporting. Legacy reports may
468
+ * lack this object and cannot retrospectively be declared capability-complete.
469
+ * @example
470
+ * ```ts
471
+ * const capabilities: GraphFileCapabilityCoverage = {
472
+ * role: 'documentation',
473
+ * classification: { basis: 'path', reason: 'Documentary Markdown extension' },
474
+ * requested: ['file-evidence', 'documentary-evidence'],
475
+ * completed: ['file-evidence', 'documentary-evidence'],
476
+ * limitations: [],
477
+ * };
478
+ * ```
479
+ */
480
+ export interface GraphFileCapabilityCoverage {
481
+ /** Actual role supported by classification provenance. */
482
+ role: GraphFileRole;
483
+ /** Evidence explaining this role and its limits. */
484
+ classification: GraphFileClassification;
485
+ /** Capabilities required for this role in the assessed scope. */
486
+ requested: GraphAnalysisCapability[];
487
+ /** Requested capabilities whose processing actually completed. */
488
+ completed: GraphAnalysisCapability[];
489
+ /** Explicit limits, including unresolved dynamic/static analysis. */
490
+ limitations: string[];
491
+ }
492
+
493
+ /** Observed outcome for one file or explicitly excluded directory during indexing. */
494
+ export interface GraphIndexFileReport {
495
+ /** Path relative to the assessed source root. */
496
+ path: string;
497
+ /**
498
+ * Processing outcome relative to requested capabilities; not a universal caller verdict.
499
+ * Unsupported or oversized executable capabilities remain gaps.
500
+ */
501
+ status: 'analyzed' | 'excluded' | 'unsupported' | 'oversized' | 'failed';
502
+ /**
503
+ * Role-specific capability evidence from current producers.
504
+ * @defaultValue undefined on legacy reports without capability provenance.
505
+ */
506
+ capabilities?: GraphFileCapabilityCoverage;
507
+ /** Explanation for skipped or failed extraction. */
508
+ reason?: string;
509
+ /** Filesystem modification time captured before parsing. */
510
+ mtimeMs?: number;
511
+ /** SHA-256 of the bytes analyzed; detects edits even when filesystem metadata is preserved. */
512
+ contentHash?: string;
513
+ /** File size captured before parsing. */
514
+ size?: number;
515
+ }
516
+
517
+ /** Original-source range; native parser indexes count UTF-16 code units, not UTF-8 bytes. */
518
+ export interface GraphSourceSpan {
519
+ /** Inclusive start offset in original source. */
520
+ startIndex: number;
521
+ /** Exclusive end offset in original source. */
522
+ endIndex: number;
523
+ /** One-based start line. */
524
+ startLine: number;
525
+ /** One-based end line. */
526
+ endLine: number;
527
+ /** Zero-based start column in UTF-16 units. */
528
+ startColumn: number;
529
+ /** Zero-based end column in UTF-16 units. */
530
+ endColumn: number;
531
+ /** Explicit index encoding prevents byte/character confusion. */
532
+ offsetEncoding: 'utf16';
533
+ }
534
+
535
+ /** A binding introduced by syntax in an explicitly supported lexical model. */
536
+ export interface GraphLexicalBinding {
537
+ /** Stable declaration identity, distinct from its visible name. */
538
+ id: string;
539
+ /** Identifier visible in the declaring scope. */
540
+ name: string;
541
+ /** Scope that owns the binding. */
542
+ scopeId: string;
543
+ /** Value binding category; type-only imports remain explicitly marked. */
544
+ kind: 'function' | 'class' | 'local' | 'parameter' | 'catch' | 'import';
545
+ /** Original declaration range. */
546
+ span: GraphSourceSpan;
547
+ /** Callable/class target established by syntax, absent for unknown local values. */
548
+ targetId?: string;
549
+ /** Literal import source, before repository resolution. */
550
+ importSource?: string;
551
+ /** Imported name; '*' identifies a namespace import. */
552
+ importedName?: string;
553
+ /** True when this declaration cannot provide a runtime value. */
554
+ typeOnly?: boolean;
555
+ }
556
+
557
+ /** One scope in a per-file lexical model, qualified by its containing scopes. */
558
+ export interface GraphLexicalScope {
559
+ /** Unique scope identity. */
560
+ id: string;
561
+ /** Lexical parent; omitted only for the module. */
562
+ parentId?: string;
563
+ /** Scope semantics used for shadowing and var hoisting. */
564
+ kind: 'module' | 'function' | 'class' | 'block' | 'catch';
565
+ /** Nearest declared callable/class identity for reference ownership. */
566
+ ownerId: string;
567
+ /** Original syntax range. */
568
+ span: GraphSourceSpan;
569
+ }
570
+
571
+ /** Lexical lookup evidence; an unknown local value is never a global-name fallback. */
572
+ export interface GraphLexicalResolution {
573
+ /** Outcome before repository import/member resolution. */
574
+ kind: 'resolved' | 'import' | 'shadowed' | 'ambiguous' | 'unbound';
575
+ /** Binding candidates in the nearest declaring scope, without arbitrary selection. */
576
+ bindings: GraphLexicalBinding[];
577
+ /** Why these bindings or their absence produced the outcome. */
578
+ reason: string;
579
+ }
580
+
581
+ /** An unresolved static reference retained with its available lexical and source evidence. */
582
+ export interface GraphIndexReferenceReport {
583
+ /** Explicit extraction limitation; this record is not a resolved graph relationship. */
584
+ kind: 'unmodeled-source' | 'ambiguous' | 'external' | 'dynamic' | 'shadowed' | 'unresolved';
585
+ /** Analyzed source file containing the reference. */
586
+ filePath: string;
587
+ /** Enclosing qualified scope identifier extracted from original syntax. */
588
+ sourceId: string;
589
+ /** Known target, absent when syntax cannot establish one. */
590
+ targetId?: string;
591
+ /** Callee or member name retained for independent source inspection. */
592
+ targetName: string;
593
+ /** The kind of static relationship omitted from the published graph. */
594
+ relationship: 'calls' | 'accesses';
595
+ /** Extraction and resolution provenance from the attempted relationship. */
596
+ reason: string;
597
+ /** Original reference range; absent on historical or unsupported-language reports. */
598
+ span?: GraphSourceSpan;
599
+ /** Candidate identities retained without asserting an authoritative target. */
600
+ candidateIds?: string[];
601
+ /** Source-content generation tying reference evidence to analyzed bytes. */
602
+ generation?: string;
603
+ /** Preallocated publication identity; absent for standalone or historical extraction. */
604
+ publicationGeneration?: string;
605
+ }
606
+
607
+ /** One explicitly selected source root, without implying complete file or caller coverage. */
608
+ export interface GraphSourceRoot {
609
+ /** Absolute normalized requested location, retained even when inaccessible. */
610
+ readonly requestedPath: string;
611
+ /** Real filesystem location; null when canonical ownership could not be observed. */
612
+ readonly canonicalPath: string | null;
613
+ /** Forward-slash prefix relative to the graph source root; empty for the root itself. */
614
+ readonly graphPrefix: string;
615
+ /** Whether the caller explicitly included this repository below the graph source root. */
616
+ readonly explicitlyIncluded: boolean;
617
+ /** Git HEAD observed at this root; null is never interpreted as a known revision. */
618
+ readonly revision: string | null;
619
+ /** Outcome of root/revision observation, distinct from file-analysis coverage. */
620
+ readonly status: 'available' | 'unversioned' | 'missing' | 'failed' | 'pending';
621
+ /** Diagnostic failures or limitations that must survive compact root rendering. */
622
+ readonly diagnostics: readonly string[];
623
+ }
624
+
625
+ /** Immutable provenance of explicitly owned roots under a stable parent project identity. */
626
+ export interface GraphSourceRootAssessment {
627
+ /** Existing project identity supplied by the caller, never derived from Git roots. */
628
+ readonly projectId: string;
629
+ /** Absolute parent project location; canonicalized when it exists. */
630
+ readonly projectRoot: string;
631
+ /** Absolute graph source location; canonicalized when it exists. */
632
+ readonly sourceRoot: string;
633
+ /** Observation start time in ISO-8601 form. */
634
+ readonly assessedAt: string;
635
+ /** Source root followed by explicitly selected repository roots; no implicit nested discovery. */
636
+ readonly roots: readonly GraphSourceRoot[];
637
+ }
638
+
639
+ /** Explicit source ownership and bounded revision-assessment input. */
640
+ export interface GraphSourceRootRequest {
641
+ /** Stable existing parent project identity. */
642
+ readonly projectId: string;
643
+ /** Parent project location; independent of repository ownership. */
644
+ readonly projectRoot: string;
645
+ /** Explicit graph source location; defaults to the parent project location. */
646
+ readonly sourceRoot?: string;
647
+ /** Repository paths relative to the source root; escaping or aliased ownership is invalid. */
648
+ readonly includedRepositories?: readonly string[];
649
+ /** Absolute epoch-millisecond deadline shared across every root; defaults to two seconds. */
650
+ readonly deadline?: number;
651
+ /** Caller cancellation; cancellation rejects instead of reporting successful observation. */
652
+ readonly signal?: AbortSignal;
653
+ }
654
+
655
+ /** Source provenance persisted with a complete published graph generation. */
656
+ export interface GraphIndexAssessment {
657
+ /** Explicit parent identity and per-root revision observations; absent on historical indexes. */
658
+ sourceRoots?: GraphSourceRootAssessment;
659
+ /** Immutable publication identity allocated before extraction; absent on historical indexes. */
660
+ generation?: string;
661
+ /** Unmodeled AST scopes remain explicit limitations instead of fabricated declarations. */
662
+ references?: GraphIndexReferenceReport[];
663
+ /** Explicit nested repository/worktree scope retained for subsequent rebuilds. */
664
+ includedRepositories?: string[];
665
+ /** Canonical root whose relative file paths this graph describes. */
666
+ sourceRoot: string;
667
+ /** Git revision captured at assessment; null when no revision is available. */
668
+ assessedRevision: string | null;
669
+ /** ISO timestamp of the assessment. */
670
+ assessedAt: string;
671
+ /** Explicit extraction/exclusion outcomes, including partial coverage. */
672
+ files: GraphIndexFileReport[];
673
+ }
674
+
675
+ /** Validated rows staged before an atomic graph publication. */
676
+ export interface GraphPublicationRows {
677
+ /** Immutable publication identity shared by anonymous symbols, rows and assessment. */
678
+ generation?: string;
679
+ /** Source provenance and coverage belonging to this generation. */
680
+ assessment?: GraphIndexAssessment;
681
+ /** Complete replacement node generation. */
682
+ nodes: NexusNodeInsertRow[];
683
+ /** Complete replacement relationship generation. */
684
+ relations: NexusRelationInsertRow[];
685
+ }
686
+
365
687
  // ---------------------------------------------------------------------------
366
688
  // Impact analysis result
367
689
  // ---------------------------------------------------------------------------
@@ -385,12 +707,14 @@ export interface ImpactResult {
385
707
  /**
386
708
  * Overall risk classification based on the number and type of affected nodes.
387
709
  *
388
- * - `low`: 0–3 direct dependants, no cross-module spread
710
+ * - `unknown`: target missing or evidence insufficient
711
+ * - `none`: assessed target with no detected static dependants
712
+ * - `low`: 1–3 direct dependants, no cross-module spread
389
713
  * - `medium`: 4–9 direct dependants, or limited cross-module spread
390
714
  * - `high`: 10+ direct dependants, or significant cross-module spread
391
715
  * - `critical`: Exported symbol with high cross-module usage
392
716
  */
393
- riskLevel: 'low' | 'medium' | 'high' | 'critical';
717
+ riskLevel: 'unknown' | 'none' | 'low' | 'medium' | 'high' | 'critical';
394
718
  /** Human-readable summary of the impact analysis outcome. */
395
719
  summary: string;
396
720
  /** Nodes affected at each traversal depth. */
package/src/index.ts CHANGED
@@ -212,6 +212,9 @@ export type {
212
212
  CodeSymbol,
213
213
  CodeSymbolKind,
214
214
  ParseResult,
215
+ ParserExecutionLimits,
216
+ ParserExecutionPort,
217
+ ParserProcessHandle,
215
218
  } from './code-symbol.js';
216
219
  // === Conduit Protocol (agent-to-agent communication) ===
217
220
  export type {
@@ -343,6 +346,7 @@ export type {
343
346
  TaskAuditLogQuery,
344
347
  TaskAuditLogRow,
345
348
  TaskFieldUpdates,
349
+ TaskPopulation,
346
350
  TaskQueryFilters,
347
351
  TransactionAccessor,
348
352
  } from './data-accessor.js';
@@ -689,13 +693,19 @@ export type {
689
693
  ConfidenceProvenance,
690
694
  ExtractedProvenance,
691
695
  GraphEdgeConfidenceLabel,
696
+ GraphIndexAssessment,
697
+ GraphIndexFileReport,
698
+ GraphIndexReferenceReport,
692
699
  GraphNode,
693
700
  GraphNodeKind,
701
+ GraphPublicationRows,
694
702
  GraphRelation,
695
703
  GraphRelationType,
696
704
  ImpactResult,
697
705
  InferredProvenance,
698
706
  KnowledgeGraph,
707
+ NexusNodeInsertRow,
708
+ NexusRelationInsertRow,
699
709
  ProcessNode,
700
710
  SymbolIndex,
701
711
  } from './graph.js';
@@ -723,6 +733,34 @@ export {
723
733
  } from './invariants/index.js';
724
734
  // === Background Job Status (T9955 — promoted from core/store/tasks-schema.ts) ===
725
735
  export type { BackgroundJobStatus } from './jobs.js';
736
+ // === Living Brain SDK Types (T1068 — 5-substrate traversal primitives) ===
737
+ export type {
738
+ DecisionCodeEvidenceLink,
739
+ DecisionCodeEvidenceOptions,
740
+ DecisionCodeEvidenceResult,
741
+ KnowledgeAuthority,
742
+ KnowledgeAuthorityStatus,
743
+ KnowledgeBackfillOptions,
744
+ KnowledgeCoverage,
745
+ KnowledgeCoverageStatus,
746
+ KnowledgeDiagnostic,
747
+ KnowledgeDiagnosticStatus,
748
+ KnowledgeDoctorOptions,
749
+ KnowledgeDoctorResult,
750
+ KnowledgeEvidenceRef,
751
+ KnowledgeFileEvidence,
752
+ KnowledgeHealth,
753
+ KnowledgeRepairAction,
754
+ KnowledgeRepairClass,
755
+ KnowledgeRepairFinding,
756
+ KnowledgeRepairProposal,
757
+ KnowledgeRepairReceipt,
758
+ KnowledgeRepairRecovery,
759
+ KnowledgeRepairState,
760
+ KnowledgeReplacement,
761
+ KnowledgeSymbolCandidate,
762
+ TaskKnowledgeEvidence,
763
+ } from './knowledge-health.js';
726
764
  export type {
727
765
  CleoResponse,
728
766
  ConformanceReport,
@@ -1047,7 +1085,6 @@ export type {
1047
1085
  HttpContract,
1048
1086
  TopicContract,
1049
1087
  } from './nexus-contract-ops.js';
1050
- // === Living Brain SDK Types (T1068 — 5-substrate traversal primitives) ===
1051
1088
  // === Extended Code Reasoning Types (T1069 — reasonWhySymbol + reasonImpactOfChange) ===
1052
1089
  export type {
1053
1090
  BlastRadiusSummary,
@@ -2289,8 +2326,10 @@ export type {
2289
2326
  AcceptanceItem,
2290
2327
  CancelledTask,
2291
2328
  CompletedTask,
2329
+ CriterionEvidenceLink,
2292
2330
  EpicLifecycle,
2293
2331
  EvidenceAtom,
2332
+ EvidenceValidationContext,
2294
2333
  FileMeta,
2295
2334
  GateEvidence,
2296
2335
  Phase,
@@ -2302,6 +2341,7 @@ export type {
2302
2341
  SessionNote,
2303
2342
  // T9071 — system-wide severity attestation primitive
2304
2343
  SeverityAttestation,
2344
+ SignedSeverityAttestation,
2305
2345
  Task,
2306
2346
  TaskCreate,
2307
2347
  // T944 new axes (T9072: renamed TaskRole → TaskKind)
@@ -2343,6 +2383,8 @@ export {
2343
2383
  // === TaskRecord Types (string-widened for dispatch/LAFS) ===
2344
2384
  export type {
2345
2385
  MinimalTaskRecord,
2386
+ RecordProjectionDisclosure,
2387
+ TaskMatch,
2346
2388
  TaskRecord,
2347
2389
  TaskRecordRelation,
2348
2390
  TaskRecordRelationCounts,
@@ -79,7 +79,8 @@ const VALIDATE_SPAWN_MODULE = 'packages/core/src/orchestration/validate-spawn.ts
79
79
  /**
80
80
  * Skill-validator test that exercises ORC-004 / ORC-005 manifest checks.
81
81
  */
82
- const SKILL_VALIDATOR_TESTS = 'packages/core/src/skills/orchestrator/__tests__/validator.test.ts';
82
+ const SKILL_VALIDATOR_TESTS =
83
+ 'packages/core/src/skills/orchestrator/__tests__/validator.orchestrator.test.ts';
83
84
 
84
85
  /**
85
86
  * ADR-070 ORC-### invariants in declaration order.
@@ -138,9 +138,9 @@ export const ADR_073_INVARIANTS: readonly RegisteredInvariant[] = Object.freeze(
138
138
  {
139
139
  adr: 'ADR-073',
140
140
  code: 'I7',
141
- name: 'Maximum parent depth is 3',
141
+ name: 'No nested sagas',
142
142
  description:
143
- 'The parent ladder Subtask → Task → Epic is fixed at depth 3 (hierarchy.maxDepth=3). Sagas do NOT consume depth — they attach via groups relations, not parent edges. Enforced at runtime by assertSagaInvariantI7.',
143
+ 'A saga-member candidate MUST NOT itself be saga-shaped. Enforced at runtime by assertSagaInvariantI7, which checks exactly this and nothing else. The depth clause this invariant used to carry — "the parent ladder Subtask → Task → Epic is fixed at depth 3; sagas do NOT consume depth, they attach via groups relations, not parent edges" — is SUPERSEDED BY ADR-088: member epics now attach via tasks.parent_id containment and task_relations.groups is non-containment provenance only, so a saga DOES consume a level. The canonical spine is saga(0) → epic(1) → task(2) → subtask(3) at hierarchy.maxDepth=3, inclusive; the depth rule lives in exceedsMaxDepth (core tasks/hierarchy.ts), never here. The stale clause outlived its premise by long enough for the write-path guards calibrated on it to make the subtask tier unreachable.',
144
144
  severity: 'error',
145
145
  runtimeGate: {
146
146
  module: SAGA_ENFORCEMENT_MODULE,