opencode-swarm 7.140.6 → 7.141.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 (81) hide show
  1. package/.opencode/skills/deep-dive/SKILL.md +7 -6
  2. package/.opencode/skills/running-tests/SKILL.md +7 -0
  3. package/dist/agents/explorer.d.ts +1 -1
  4. package/dist/background/lane-delivery-store.d.ts +43 -0
  5. package/dist/background/lane-output-store.d.ts +6 -0
  6. package/dist/cli/{config-doctor-y5qeh18c.js → config-doctor-ayer8jwj.js} +2 -2
  7. package/dist/cli/{core-pwd9604e.js → core-yep18rkf.js} +1 -1
  8. package/dist/cli/{curation-policy-avvb56x2.js → curation-policy-j1fbc3ry.js} +5 -5
  9. package/dist/cli/{curator-q1nchgpg.js → curator-fkwhph34.js} +28 -28
  10. package/dist/cli/{curator-llm-factory-96pnc23w.js → curator-llm-factory-b1wtbwwv.js} +28 -28
  11. package/dist/cli/{dispatch-2s23fbcs.js → dispatch-y8rergph.js} +1 -1
  12. package/dist/cli/{evidence-summary-service-18142mr3.js → evidence-summary-service-8e6594tg.js} +9 -9
  13. package/dist/cli/{explorer-e9h66egs.js → explorer-18353rhn.js} +1 -1
  14. package/dist/cli/{gate-evidence-smn2wqft.js → gate-evidence-rt9034ft.js} +4 -4
  15. package/dist/cli/{guardrail-explain-kyd89z8z.js → guardrail-explain-fhx1kft6.js} +29 -29
  16. package/dist/cli/{guardrail-log-cahp1ews.js → guardrail-log-x94s1jh9.js} +3 -3
  17. package/dist/cli/{hive-promoter-vcbcvcsh.js → hive-promoter-3ay1hffy.js} +28 -28
  18. package/dist/cli/{index-dtqjxfw9.js → index-10zsx1x2.js} +1 -1
  19. package/dist/cli/{index-p04qrwck.js → index-1dwa96x7.js} +2 -2
  20. package/dist/cli/{index-tjqzr3jc.js → index-3d13jkzq.js} +2 -2
  21. package/dist/cli/{index-epvhf50h.js → index-9d4gck4e.js} +2 -1
  22. package/dist/cli/{index-4s7xgzbm.js → index-9snyxgtf.js} +1 -1
  23. package/dist/cli/{index-92n3d5ky.js → index-acpsb3g1.js} +40 -9
  24. package/dist/cli/{index-56rqw2hs.js → index-awwqa1f5.js} +6 -6
  25. package/dist/cli/{index-41hkt36g.js → index-ays8g6cm.js} +36 -5
  26. package/dist/cli/{index-fejfzy2j.js → index-b9mwe99e.js} +6 -6
  27. package/dist/cli/{index-p8kk34am.js → index-c2hczjhp.js} +1 -1
  28. package/dist/cli/{index-c432knmy.js → index-f1hsrgw1.js} +1 -1
  29. package/dist/cli/{index-zd4qhnr7.js → index-fckf6g01.js} +1 -1
  30. package/dist/cli/{index-z3s0a44b.js → index-fcsf8vjm.js} +3 -3
  31. package/dist/cli/{index-thp186x0.js → index-g4w73p1v.js} +1 -1
  32. package/dist/cli/{index-5qd5vt2d.js → index-h375yxj5.js} +30 -30
  33. package/dist/cli/{index-vh05t3w5.js → index-kq5p3nm3.js} +1 -1
  34. package/dist/cli/{index-p2ty3eee.js → index-m54erqap.js} +1 -1
  35. package/dist/cli/{index-nakkgkkt.js → index-nk2ma3mh.js} +1215 -917
  36. package/dist/cli/{index-2778hhh7.js → index-nkr3j0j1.js} +2 -2
  37. package/dist/cli/{index-s1v0wza5.js → index-nse60anv.js} +1 -1
  38. package/dist/cli/{index-1p72dtym.js → index-pkby67j3.js} +1 -1
  39. package/dist/cli/{index-t5pytnca.js → index-q4vaar2b.js} +2 -2
  40. package/dist/cli/{index-m9xrdjn0.js → index-qskz8j2z.js} +1 -1
  41. package/dist/cli/{index-4zxrkk1h.js → index-rx33k785.js} +3 -3
  42. package/dist/cli/{index-bjqpdr83.js → index-sd1w4pya.js} +3 -3
  43. package/dist/cli/{index-qy1nq52t.js → index-v250345n.js} +1 -1
  44. package/dist/cli/{index-y9q9f6ms.js → index-w95sxwfr.js} +4 -4
  45. package/dist/cli/{index-z0z9pe7b.js → index-x5kk9gyk.js} +5 -5
  46. package/dist/cli/{index-h01wb18g.js → index-xcqst95a.js} +2 -2
  47. package/dist/cli/{index-v2xrer41.js → index-xmzmeknp.js} +3 -1
  48. package/dist/cli/{index-e58e3v0v.js → index-ytnm84ed.js} +3 -3
  49. package/dist/cli/{index-912qz4y0.js → index-zbj3yrrd.js} +1 -1
  50. package/dist/cli/index.js +28 -28
  51. package/dist/cli/{knowledge-escalator-gj58za4g.js → knowledge-escalator-53m3sh8p.js} +10 -10
  52. package/dist/cli/{knowledge-events-3m5jnnv6.js → knowledge-events-s5pmx5h3.js} +8 -8
  53. package/dist/cli/{knowledge-link-m9p80f4r.js → knowledge-link-x86ebng8.js} +4 -4
  54. package/dist/cli/{knowledge-store-0vy8wbzd.js → knowledge-store-dv70gxxc.js} +5 -5
  55. package/dist/cli/{knowledge-validator-mvcs8wf6.js → knowledge-validator-je30smbr.js} +7 -7
  56. package/dist/cli/{pending-delegations-cxx9tezp.js → pending-delegations-7xsagjy5.js} +3 -3
  57. package/dist/cli/{pr-subscriptions-2sfnb599.js → pr-subscriptions-r6cdsa3t.js} +3 -3
  58. package/dist/cli/{runner-mky3vvht.js → runner-nm3baddf.js} +5 -5
  59. package/dist/cli/{scan-cursor-wznc7p7p.js → scan-cursor-tcdcjbp9.js} +6 -6
  60. package/dist/cli/{schema-k596bhds.js → schema-6cg2smxx.js} +1 -1
  61. package/dist/cli/{scope-persistence-0ny5fn07.js → scope-persistence-v51d74j2.js} +6 -6
  62. package/dist/cli/{skill-generator-vrks0jjj.js → skill-generator-7kp8s0ne.js} +12 -12
  63. package/dist/cli/{telemetry-0x6kszvk.js → telemetry-zex3zv3v.js} +1 -1
  64. package/dist/cli/{worktree-collision-ownership-wm5pse49.js → worktree-collision-ownership-n41qw3n8.js} +3 -3
  65. package/dist/cli/{worktree-isolation-zgk7314k.js → worktree-isolation-g6t99t0x.js} +28 -28
  66. package/dist/hooks/delegation-gate.d.ts +6 -0
  67. package/dist/hooks/knowledge-application-gate.d.ts +1 -1
  68. package/dist/hooks/knowledge-events.d.ts +5 -2
  69. package/dist/hooks/knowledge-receipt-ledger.d.ts +38 -0
  70. package/dist/hooks/knowledge-receipt-observability.d.ts +24 -1
  71. package/dist/hooks/knowledge-receipt-validator.d.ts +19 -3
  72. package/dist/hooks/knowledge-types.d.ts +9 -0
  73. package/dist/hooks/repo-graph-injection.d.ts +52 -0
  74. package/dist/index.js +223 -212
  75. package/dist/lang/backend.d.ts +7 -1
  76. package/dist/lang/default-backend.d.ts +2 -1
  77. package/dist/tools/create-tool.d.ts +5 -2
  78. package/dist/tools/dispatch-lanes.d.ts +45 -5
  79. package/dist/tools/knowledge-receipt.d.ts +40 -0
  80. package/dist/tools/test-runner.d.ts +13 -5
  81. package/package.json +1 -1
@@ -33,32 +33,32 @@ import {
33
33
  sanitizeSlug,
34
34
  selectCandidateEntries,
35
35
  writeEvalStub
36
- } from "./index-z3s0a44b.js";
37
- import"./index-92n3d5ky.js";
36
+ } from "./index-fcsf8vjm.js";
37
+ import"./index-acpsb3g1.js";
38
38
  import"./index-k46me75h.js";
39
39
  import"./index-ee3x66a5.js";
40
- import"./index-y9q9f6ms.js";
41
- import"./index-qy1nq52t.js";
40
+ import"./index-w95sxwfr.js";
41
+ import"./index-v250345n.js";
42
42
  import"./index-rtry5xyf.js";
43
- import"./index-fejfzy2j.js";
43
+ import"./index-b9mwe99e.js";
44
44
  import"./index-ae75rja9.js";
45
- import"./index-vh05t3w5.js";
46
- import"./index-p8kk34am.js";
47
- import"./index-912qz4y0.js";
45
+ import"./index-kq5p3nm3.js";
46
+ import"./index-c2hczjhp.js";
47
+ import"./index-zbj3yrrd.js";
48
48
  import"./index-7g4c7s5r.js";
49
49
  import"./index-ed5ykebp.js";
50
50
  import"./index-4nt52yr9.js";
51
- import"./index-p04qrwck.js";
51
+ import"./index-1dwa96x7.js";
52
52
  import"./index-gprxjmm7.js";
53
53
  import"./index-n832052r.js";
54
- import"./index-zd4qhnr7.js";
54
+ import"./index-fckf6g01.js";
55
55
  import"./index-4rhhvd1a.js";
56
56
  import"./index-zgwm4ryv.js";
57
- import"./index-thp186x0.js";
57
+ import"./index-g4w73p1v.js";
58
58
  import"./index-jqsfsqbx.js";
59
59
  import"./index-zjygnfay.js";
60
60
  import"./index-bk5tah7q.js";
61
- import"./index-epvhf50h.js";
61
+ import"./index-9d4gck4e.js";
62
62
  import"./index-bpmtbmy9.js";
63
63
  import"./index-a76rekgs.js";
64
64
  export {
@@ -13,7 +13,7 @@ import {
13
13
  startHeartbeatTracking,
14
14
  stopHeartbeatTracking,
15
15
  telemetry
16
- } from "./index-epvhf50h.js";
16
+ } from "./index-9d4gck4e.js";
17
17
  import"./index-bpmtbmy9.js";
18
18
  import"./index-a76rekgs.js";
19
19
  export {
@@ -10,10 +10,10 @@ import {
10
10
  import {
11
11
  scanDelegationFallbacksForRecovery,
12
12
  scanDelegationsForRecovery
13
- } from "./index-s1v0wza5.js";
13
+ } from "./index-nse60anv.js";
14
14
  import"./index-k46me75h.js";
15
15
  import"./index-ee3x66a5.js";
16
- import"./index-912qz4y0.js";
16
+ import"./index-zbj3yrrd.js";
17
17
  import"./index-7g4c7s5r.js";
18
18
  import"./index-ed5ykebp.js";
19
19
  import {
@@ -21,7 +21,7 @@ import {
21
21
  } from "./index-4nt52yr9.js";
22
22
  import"./index-zgwm4ryv.js";
23
23
  import"./index-zjygnfay.js";
24
- import"./index-epvhf50h.js";
24
+ import"./index-9d4gck4e.js";
25
25
  import"./index-bpmtbmy9.js";
26
26
  import"./index-a76rekgs.js";
27
27
 
@@ -20,61 +20,61 @@ import {
20
20
  sanitizeWorktreeTaskId,
21
21
  standardWorktreeByCallID,
22
22
  standardWorktreeSerializationSessions
23
- } from "./index-nakkgkkt.js";
23
+ } from "./index-nk2ma3mh.js";
24
24
  import"./index-4905hd2m.js";
25
- import"./index-41hkt36g.js";
26
- import"./index-c432knmy.js";
27
- import"./index-1p72dtym.js";
25
+ import"./index-ays8g6cm.js";
26
+ import"./index-f1hsrgw1.js";
27
+ import"./index-pkby67j3.js";
28
28
  import"./index-c8s9a3zh.js";
29
- import"./index-p2ty3eee.js";
30
- import"./index-56rqw2hs.js";
29
+ import"./index-m54erqap.js";
30
+ import"./index-awwqa1f5.js";
31
31
  import"./index-134d35c1.js";
32
- import"./index-t5pytnca.js";
32
+ import"./index-q4vaar2b.js";
33
33
  import"./index-y8552snf.js";
34
34
  import"./index-9ss2m4rs.js";
35
35
  import"./index-74hpm6sh.js";
36
- import"./index-z3s0a44b.js";
37
- import"./index-z0z9pe7b.js";
38
- import"./index-h01wb18g.js";
39
- import"./index-v2xrer41.js";
40
- import"./index-m9xrdjn0.js";
41
- import"./index-bjqpdr83.js";
36
+ import"./index-fcsf8vjm.js";
37
+ import"./index-x5kk9gyk.js";
38
+ import"./index-xcqst95a.js";
39
+ import"./index-xmzmeknp.js";
40
+ import"./index-qskz8j2z.js";
41
+ import"./index-sd1w4pya.js";
42
42
  import"./index-556ja8an.js";
43
- import"./index-4zxrkk1h.js";
43
+ import"./index-rx33k785.js";
44
44
  import"./index-zsrtt42s.js";
45
- import"./index-dtqjxfw9.js";
45
+ import"./index-10zsx1x2.js";
46
46
  import"./index-qwm6vdyv.js";
47
- import"./index-tjqzr3jc.js";
48
- import"./index-s1v0wza5.js";
47
+ import"./index-3d13jkzq.js";
48
+ import"./index-nse60anv.js";
49
49
  import"./index-8fwhhayc.js";
50
50
  import"./index-q1exe2b3.js";
51
- import"./index-92n3d5ky.js";
51
+ import"./index-acpsb3g1.js";
52
52
  import"./index-k46me75h.js";
53
53
  import"./index-ee3x66a5.js";
54
- import"./index-y9q9f6ms.js";
55
- import"./index-qy1nq52t.js";
54
+ import"./index-w95sxwfr.js";
55
+ import"./index-v250345n.js";
56
56
  import"./index-rtry5xyf.js";
57
- import"./index-fejfzy2j.js";
57
+ import"./index-b9mwe99e.js";
58
58
  import"./index-ae75rja9.js";
59
- import"./index-vh05t3w5.js";
60
- import"./index-p8kk34am.js";
61
- import"./index-912qz4y0.js";
59
+ import"./index-kq5p3nm3.js";
60
+ import"./index-c2hczjhp.js";
61
+ import"./index-zbj3yrrd.js";
62
62
  import"./index-7g4c7s5r.js";
63
63
  import"./index-ed5ykebp.js";
64
64
  import"./index-4nt52yr9.js";
65
65
  import {
66
66
  resolveWorktreeIsolationConfig
67
- } from "./index-p04qrwck.js";
67
+ } from "./index-1dwa96x7.js";
68
68
  import"./index-gprxjmm7.js";
69
69
  import"./index-n832052r.js";
70
- import"./index-zd4qhnr7.js";
70
+ import"./index-fckf6g01.js";
71
71
  import"./index-4rhhvd1a.js";
72
72
  import"./index-zgwm4ryv.js";
73
- import"./index-thp186x0.js";
73
+ import"./index-g4w73p1v.js";
74
74
  import"./index-jqsfsqbx.js";
75
75
  import"./index-zjygnfay.js";
76
76
  import"./index-bk5tah7q.js";
77
- import"./index-epvhf50h.js";
77
+ import"./index-9d4gck4e.js";
78
78
  import"./index-bpmtbmy9.js";
79
79
  import"./index-a76rekgs.js";
80
80
  export {
@@ -346,6 +346,11 @@ export declare function resolveDelegatedPlanTaskId(args: Record<string, unknown>
346
346
  * rejected by the membership gate in prepareCoderScope with their own message).
347
347
  */
348
348
  declare function describeCoderScopeFailure(args: Record<string, unknown>, planTaskIds: ReadonlySet<string>): string;
349
+ type FileDirectiveExtractionMode = 'enforce' | 'observe';
350
+ declare function extractTaskFileDirectives(args: Record<string, unknown>, mode?: FileDirectiveExtractionMode): {
351
+ present: boolean;
352
+ files: string[] | null;
353
+ };
349
354
  /**
350
355
  * Parses structured per-task verdict lines from agent dispatch output.
351
356
  *
@@ -396,6 +401,7 @@ export declare const _internals: {
396
401
  describeCoderScopeFailure: typeof describeCoderScopeFailure;
397
402
  parsePerTaskVerdicts: typeof parsePerTaskVerdicts;
398
403
  buildParallelExecutionGuidance: typeof buildParallelExecutionGuidance;
404
+ extractTaskFileDirectives: typeof extractTaskFileDirectives;
399
405
  loadPlanJsonOnly: typeof loadPlanJsonOnly;
400
406
  recordPendingDelegationForBackground: typeof import("../background/pending-delegations.js").recordPendingDelegationDetailed;
401
407
  writeDelegationFallbackForBackground: typeof import("../background/pending-delegations.js").writeDelegationFallback;
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * 1. `experimental.chat.messages.transform` — scans the latest
7
7
  * architect-authored message for
8
- * `KNOWLEDGE_APPLIED|IGNORED|CONTRADICTED|VIOLATED`
8
+ * `KNOWLEDGE_APPLIED|IGNORED|N_A|CONTRADICTED|VIOLATED`
9
9
  * markers and records them via `recordAcknowledgmentDeduped`. This
10
10
  * runs BEFORE the architect's next tool call so the toolBefore gate
11
11
  * sees the ack.
@@ -22,7 +22,7 @@
22
22
  * from the process working directory.
23
23
  */
24
24
  import { resolveHiveEventsPath as resolveHiveEventsPathImpl } from '../knowledge/hive-paths.js';
25
- import { queryHistoricalOutcomes } from './knowledge-receipt-ledger.js';
25
+ import { queryHistoricalOutcomes, type ReceiptSourceCode } from './knowledge-receipt-ledger.js';
26
26
  import type { ConfidenceFloorOptions } from './knowledge-store.js';
27
27
  import type { KnowledgeApplicationRecord, RetrievalOutcome } from './knowledge-types.js';
28
28
  /** Current event-log record schema version. Bump when the on-disk shape changes. */
@@ -111,8 +111,11 @@ export interface ReceiptEvent {
111
111
  * (`'reviewer'`) from delegate self-acks (`'delegate'`) without changing the
112
112
  * `type`, so existing counter rollups (which switch on `type`) stay intact.
113
113
  * A reviewer VERIFIED maps to type:'applied' with source:'reviewer'.
114
+ * Canonical closed set: `ReceiptSourceCode` (issue #2032); the `| string`
115
+ * tail keeps legacy records with unrecognized source values loadable, and
116
+ * a MISSING legacy source is never inferred — it stays absent/`'unknown'`.
114
117
  */
115
- source?: 'delegate' | 'reviewer' | string;
118
+ source?: ReceiptSourceCode | (string & {});
116
119
  /** Result of executing a directive's verification_predicate (Change 2). */
117
120
  predicate_check?: {
118
121
  predicate: string;
@@ -1,6 +1,44 @@
1
1
  import { atomicWriteFsynced, type ReceiptLedgerPaths, type ReceiptStoreErrorCode } from './knowledge-receipt-ledger-storage.js';
2
2
  import { type KnowledgeReceiptTransitionObservation } from './knowledge-receipt-observability.js';
3
+ /**
4
+ * Canonical terminal-outcome vocabulary for the authoritative receipt ledger
5
+ * (issue #2032). This is the single declaration the outcome-aware consumers
6
+ * import and derive from: the shared validator (`VALID_OUTCOMES`), the
7
+ * collectors, the application and phase gates, the counter rollups, the
8
+ * scoring signal, and the diagnostics. (The curator consumes outcomes only
9
+ * through the derived signal and counter rollups — it does not switch on
10
+ * this set directly.) Semantics: `applied` = followed (positive signal;
11
+ * reviewer VERIFIED maps here); `ignored` = judged relevant but deliberately
12
+ * not followed (negative signal, policy consequences retained);
13
+ * `contradicted` = current authority disproves (negative); `violated` =
14
+ * runtime violation (negative, blocks phase completion until remediated);
15
+ * `n_a` = not applicable to the current action (neutral — clears only the
16
+ * acknowledgement/applicability obligation, never proves application, never
17
+ * feeds promotion evidence).
18
+ */
3
19
  export type ReceiptOutcome = 'applied' | 'ignored' | 'contradicted' | 'violated' | 'n_a';
20
+ /** Runtime set form of {@link ReceiptOutcome} — derive, never redeclare. */
21
+ export declare const RECEIPT_TERMINAL_OUTCOMES: ReadonlySet<ReceiptOutcome>;
22
+ /**
23
+ * Canonical terminal-source taxonomy (issue #2032). `source` answers WHO
24
+ * produced the terminal as a provenance class, while the separate `agent`
25
+ * field records the agent identity. Storage stays permissive (`string`) for
26
+ * legacy tolerance: a legacy record with an absent or ambiguous source is
27
+ * preserved as `'unknown'` and is never coerced to delegate, ignored, or any
28
+ * other class. New producers must stamp one of the closed values below.
29
+ */
30
+ export type ReceiptSourceCode = 'delegate' | 'reviewer' | 'architect' | 'architect_marker' | 'test_engineer' | 'phase_override' | 'application_gate_staleness_clear' | 'application_gate_denial_limit_clear' | 'manual' | 'migration' | 'unknown';
31
+ /** Closed set form of {@link ReceiptSourceCode}. */
32
+ export declare const CANONICAL_RECEIPT_SOURCES: ReadonlySet<string>;
33
+ /**
34
+ * Normalize a would-be terminal source to the canonical taxonomy (issue
35
+ * #2032 review F-001): a canonical value passes through verbatim; anything
36
+ * else (absent, whitespace, out-of-taxonomy string such as a legacy agent
37
+ * name) becomes the honest `'unknown'` class. Deliberately NOT a hard
38
+ * reject — storage stays permissive for legacy tolerance, and reads of the
39
+ * historical journal remain unchanged; only NEW commit boundaries normalize.
40
+ */
41
+ export declare function normalizeReceiptSource(value: unknown): string;
4
42
  export interface ReceiptPredicateCheck {
5
43
  predicate: string;
6
44
  result: 'pass' | 'fail' | 'error';
@@ -4,6 +4,23 @@
4
4
  */
5
5
  import { emit } from '../telemetry.js';
6
6
  import type { ReceiptOutcome } from './knowledge-receipt-validator.js';
7
+ /**
8
+ * Semantic version of the outcome/source MEANING contract (issue #2032).
9
+ * 1 = pre-#2032 producer semantics (outcome words meant different things per
10
+ * producer; delegate terminals carried no source). 2 = the #2032 atomic
11
+ * semantics: one typed outcome/source vocabulary, delegate terminals stamped
12
+ * `source: 'delegate'`, `n_a` neutral everywhere, legacy ambiguity `unknown`.
13
+ * Distinct from the journal `RECEIPT_SCHEMA_VERSION` (a hard format gate).
14
+ * Bump this whenever a producer or consumer changes what an outcome or source
15
+ * MEANS, so health/reports consumers can distinguish producer behavior and
16
+ * migration uncertainty.
17
+ */
18
+ export declare const RECEIPT_SEMANTICS_VERSION = 2;
19
+ /**
20
+ * Outcomes observable on a transition. Terminal outcomes plus the trace-level
21
+ * `no_relevant` tombstone that closes an empty retrieval (not a terminal).
22
+ */
23
+ export type ReceiptObservationOutcome = ReceiptOutcome | 'no_relevant';
7
24
  export type KnowledgeReceiptObservedTransition = 'membership_committed' | 'empty_retrieval_committed' | 'terminal_committed' | 'terminal_attempt_rejected' | 'terminal_attempt_idempotent' | 'authorized_transition_committed' | 'application_marker_committed' | 'phase_close_intent' | 'phase_closed' | 'legacy_imported' | 'legacy_unverifiable' | 'cutover_completed' | 'checkpoint';
8
25
  export type KnowledgeReceiptObservationReasonCode = 'committed' | 'idempotent' | 'trace_not_found' | 'id_not_in_trace' | 'wrong_session' | 'wrong_phase' | 'wrong_task' | 'duplicate_conflicting_terminal' | 'event_id_conflict' | 'invalid_outcome' | 'empty_receipt' | 'lock_timeout' | 'store_unavailable' | 'store_corrupt' | 'legacy_unverifiable' | 'unauthorized_transition';
9
26
  export interface KnowledgeReceiptTransitionObservation {
@@ -16,9 +33,15 @@ export interface KnowledgeReceiptTransitionObservation {
16
33
  taskId?: string;
17
34
  phase?: string;
18
35
  /** Domain value only; never projected to the generic observability outcome. */
19
- receiptOutcome?: ReceiptOutcome;
36
+ receiptOutcome?: ReceiptObservationOutcome;
20
37
  /** Bounded domain code only; arbitrary prose is deliberately rejected. */
21
38
  receiptSource?: string;
39
+ /**
40
+ * Outcome/source semantics contract version. Optional so existing ledger
41
+ * observation constructors need no churn; the emitter defaults it to
42
+ * {@link RECEIPT_SEMANTICS_VERSION}.
43
+ */
44
+ receiptSemantics?: number;
22
45
  }
23
46
  /** Emit bounded diagnostics fail-open after an authoritative transition. */
24
47
  export declare function emitKnowledgeReceiptTransition(observation: KnowledgeReceiptTransitionObservation): void;
@@ -7,10 +7,17 @@
7
7
  * diagnostic or promotion projection is written.
8
8
  */
9
9
  import type { KnowledgeEvent, RetrievedEvent } from './knowledge-events.js';
10
- export type ReceiptOutcome = 'applied' | 'ignored' | 'contradicted' | 'violated' | 'n_a' | 'no_relevant';
10
+ import { type ReceiptOutcome } from './knowledge-receipt-ledger.js';
11
+ /**
12
+ * Canonical terminal outcome — single declaration lives in the authoritative
13
+ * ledger (issue #2032). Re-exported here for existing import sites; do NOT
14
+ * redeclare. The trace-level `no_relevant` tombstone is NOT a terminal
15
+ * outcome and never appears on a `ReceiptItem`.
16
+ */
17
+ export type { ReceiptOutcome };
11
18
  export interface ReceiptItem {
12
19
  id: string;
13
- outcome: Exclude<ReceiptOutcome, 'no_relevant'>;
20
+ outcome: ReceiptOutcome;
14
21
  reason?: string;
15
22
  }
16
23
  export interface ReceiptValidationContext {
@@ -20,6 +27,16 @@ export interface ReceiptValidationContext {
20
27
  task_id?: string;
21
28
  phase?: string;
22
29
  agent: string;
30
+ /**
31
+ * Provenance class for the committed terminals (issue #2032): who is
32
+ * reporting, e.g. 'delegate' for the delegate-ack collector or the
33
+ * agent-class value for the knowledge_receipt tool. This is deliberately
34
+ * NOT derived from `agent` — agent identity and source are different
35
+ * facts, and conflating them is how delegate terminals lost their
36
+ * provenance. Type-required, but fail-open at runtime: a falsy value
37
+ * stamps the honest 'unknown' class rather than rejecting the receipt.
38
+ */
39
+ source: string;
23
40
  cohort_id?: string;
24
41
  source_link_id?: string;
25
42
  grace_days?: number;
@@ -58,4 +75,3 @@ export declare const _internals: {
58
75
  isTerminalReceipt: typeof isTerminalReceipt;
59
76
  VALID_OUTCOMES: ReadonlySet<string>;
60
77
  };
61
- export {};
@@ -352,6 +352,15 @@ export interface PromotionEvidenceRecord {
352
352
  retrieval_trace_id: string;
353
353
  /** Terminal receipt outcome. */
354
354
  receipt_outcome: 'applied' | 'violated' | 'contradicted';
355
+ /**
356
+ * Provenance class of the terminal this evidence was derived from
357
+ * (#2032 review F-003). `'delegate'` evidence is a self-report and stays
358
+ * non-independent: the promotion gate only counts evidence whose source is
359
+ * present and not `'delegate'` toward `promotion_min_terminal_applications`.
360
+ * Absent on records written before #2032 — such records fail closed (they
361
+ * do not count as independent).
362
+ */
363
+ receipt_source?: string;
355
364
  /** Id of the ReceiptEvent this evidence was derived from. */
356
365
  receipt_event_id: string;
357
366
  phase?: string;
@@ -17,6 +17,7 @@
17
17
  * complete drift above the configured refresh cap are suppressed;
18
18
  * inconclusive probes remain usable as freshness-unknown, without mutation.
19
19
  */
20
+ import { loadPluginConfigWithMetaAsync } from '../config/loader';
20
21
  import { type FreshnessOptions, probeFreshness, type RepoGraph } from '../tools/repo-graph';
21
22
  export interface RepoGraphInjectionOptions extends FreshnessOptions {
22
23
  enabled?: boolean;
@@ -25,6 +26,9 @@ export interface RepoGraphInjectionOptions extends FreshnessOptions {
25
26
  export declare const _internals: {
26
27
  probeFreshness: typeof probeFreshness;
27
28
  cacheSize: () => number;
29
+ renderLaneOrientationBlock: typeof renderLaneOrientationBlock;
30
+ orientationFreshnessLine: typeof orientationFreshnessLine;
31
+ loadPluginConfigWithMetaAsync: typeof loadPluginConfigWithMetaAsync;
28
32
  };
29
33
  /**
30
34
  * Load the repo graph for `directory`, using a bounded per-directory cache that
@@ -54,3 +58,51 @@ export declare function buildCoderLocalizationBlock(directory: string, targetFil
54
58
  * the per-block context budget.
55
59
  */
56
60
  export declare function buildReviewerBlastRadiusBlock(directory: string, changedFiles: string[], options?: RepoGraphInjectionOptions): Promise<string | null>;
61
+ /**
62
+ * Options for {@link buildLaneOrientationBlock}.
63
+ *
64
+ * `sessionID` scopes the novelty dedupe so two controller sessions never
65
+ * suppress each other's orientation blocks (invariant 8).
66
+ */
67
+ export interface LaneOrientationOptions extends RepoGraphInjectionOptions {
68
+ sessionID?: string;
69
+ }
70
+ /** Test-only: clear the per-session orientation dedupe state. */
71
+ export declare function resetLaneOrientationDedupe(): void;
72
+ interface OrientationAskFile {
73
+ file: string;
74
+ score: number;
75
+ exports: string[];
76
+ }
77
+ /**
78
+ * Pure render for the lane orientation block. Deterministic: a pure function
79
+ * of its arguments — no timestamps, no randomness, no probe timing fields.
80
+ * Exported only through {@link _internals} for tests.
81
+ */
82
+ declare function renderLaneOrientationBlock(askFiles: OrientationAskFile[], hubFiles: string[], freshnessLine: string): string;
83
+ /**
84
+ * Deterministic freshness statement for the orientation block. Only probe
85
+ * state and drift counts feed the text — never elapsedMs, probedFiles, or
86
+ * truncated, which would break the block's determinism contract.
87
+ */
88
+ declare function orientationFreshnessLine(state: string, changedCount: number, removedCount: number): string;
89
+ /**
90
+ * Build a bounded, relevance-gated repo-graph orientation block for a lane
91
+ * dispatch batch (issue #1988 C2/C6). The block is appended to the shared
92
+ * `common_prompt` prefix by the dispatch caller.
93
+ *
94
+ * Gating policy — the block is emitted only when ALL hold:
95
+ * - a usable graph exists (fresh, or drifted within the refresh cap);
96
+ * - the top `ask` hit for the concatenated mission texts clears
97
+ * LANE_ORIENTATION_SCORE_FLOOR;
98
+ * - at least one file pointer is novel for this session (per-session
99
+ * novelty dedupe, bounded FIFO — suppressed repeats emit NOTHING);
100
+ * - the rendered block fits LANE_ORIENTATION_MAX_TOKENS.
101
+ *
102
+ * Determinism contract: a pure function of (graph state, mission texts,
103
+ * empty dedupe state) — the same dispatch replayed from a reset dedupe
104
+ * state produces a byte-identical block. Returns null on every gate
105
+ * failure or error; never throws into the dispatch path.
106
+ */
107
+ export declare function buildLaneOrientationBlock(directory: string, lanePrompts: string[], options?: LaneOrientationOptions): Promise<string | null>;
108
+ export {};