@rulvar/plan 1.1.0 → 1.3.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 (3) hide show
  1. package/dist/index.d.ts +184 -118
  2. package/dist/index.js +365 -131
  3. package/package.json +3 -3
package/dist/index.d.ts CHANGED
@@ -1,17 +1,20 @@
1
- import { AdmissionDecision, AgentResult, CanonicalLadderSpec, ChatRequest, Effort, Engine, EntryRef, EscalationDecision, EscalationOptions, HashVersion, IsolationSpec, JournalEntry, JournalStore, Json, KeyDeriver, LadderSpec, LeasableStore, LineageStats, LogicalTaskId, NodeId, OrchestrateOptions, OrchestratorExtension, ProviderAdapter, ReuseConfig, RunHandle, SchemaSpec, SpawnLineageOpt, TerminationAccountSnapshot, TerminationLimits, ToolDef, TriggerClass, UsageLimits, WireError } from "@rulvar/core";
1
+ import { AdmissionDecision, AgentResult, CanonicalLadderSpec, ChatRequest, Effort, Engine, EntryRef, EscalationDecision, EscalationOptions, HashVersion, IsolationSpec, JournalEntry, JournalStore, Json, KbProposalTrigger, KeyDeriver, LadderSpec, LeasableStore, LineageStats, LogicalTaskId, NodeId, OrchestrateOptions, OrchestratorExtension, ProviderAdapter, ReuseConfig, RunHandle, SchemaSpec, SpawnLineageOpt, TerminationAccountSnapshot, TerminationLimits, ToolDef, TriggerClass, UsageLimits, WireError } from "@rulvar/core";
2
2
 
3
3
  //#region src/plan-state.d.ts
4
4
  /**
5
5
  * The single sequential scope holding every plan-mutating entry, inside
6
- * the orchestrator's run scope (docs/07, 3.2): total order = ordinal
6
+ * the orchestrator's run scope: total order = ordinal
7
7
  * order = durable append order. Child node scopes are `plan/NodeId`
8
- * (core `planNodeScope`; grammar in docs/03, section 2.1).
8
+ * (core `planNodeScope`).
9
9
  */
10
10
  declare const PLAN_SCOPE = "plan";
11
- /** The closed status machine (docs/07, 3.1); `skipped` is fold-derived for entries but first-class for plan nodes. */
11
+ /**
12
+ * The closed status machine; `skipped` is fold-derived for entries but
13
+ * first-class for plan nodes.
14
+ */
12
15
  type PlanNodeStatus = "pending" | "ready" | "running" | "parked" | "escalated" | "done" | "failed" | "cancelled" | "skipped";
13
16
  /**
14
- * Canonical per-node fields entering planHash, exactly the docs/07 3.1
17
+ * Canonical per-node fields entering planHash, exactly this
15
18
  * record. `deps` are sorted in the hash (not necessarily in state);
16
19
  * `checkpointRef`/`escalationRef` participate as absent when absent.
17
20
  */
@@ -33,11 +36,11 @@ interface PlanNode {
33
36
  escalationRef?: EntryRef;
34
37
  }
35
38
  /**
36
- * TaskPlan: typed data owned by the engine, never prose in a transcript
37
- * (docs/07, 3.1). The guard fold counters ride the same record because
38
- * they enter planHash (docs/07, 3.4): `revisionCount` counts journaled
39
+ * TaskPlan: typed data owned by the engine, never prose in a transcript.
40
+ * The guard fold counters ride the same record because
41
+ * they enter planHash: `revisionCount` counts journaled
39
42
  * plan.revision entries; `droppedRevisionStreak` counts consecutive
40
- * fully-dropped revisions (RevisionGuards, docs/07, 3.8).
43
+ * fully-dropped revisions (RevisionGuards).
41
44
  */
42
45
  interface TaskPlan {
43
46
  nodes: Readonly<Record<NodeId, PlanNode>>;
@@ -50,23 +53,23 @@ declare function isTerminalPlanStatus(status: PlanNodeStatus): boolean;
50
53
  /**
51
54
  * Asserts one status transition against the closed machine. Op-level
52
55
  * legality (which ops may request which transitions in which state) is
53
- * the rebase conflict table's job (docs/07, 3.6; M7-T04); the machine
56
+ * the rebase conflict table's job (M7-T04); the machine
54
57
  * itself enforces exactly the structural rules:
55
58
  *
56
59
  * - nothing leaves a terminal status (`done` is immutable; failed,
57
60
  * cancelled, skipped are final),
58
61
  * - `running` is entered only from `ready` (the engine schedules ready
59
- * nodes; docs/07, 3.1),
62
+ * nodes),
60
63
  * - a transition never restates the current status (the engine writes no
61
64
  * no-op set_node_status).
62
65
  *
63
66
  * A violation is an engine bug and raises the typed PlanInvariantError
64
- * (docs/07, 3.4: never a silent brick).
67
+ * (never a silent brick).
65
68
  */
66
69
  declare function assertPlanTransition(node: PlanNode, to: PlanNodeStatus): void;
67
70
  /**
68
- * Dependency satisfaction, derived purely in the fold and NEVER a record
69
- * (docs/07, 3.3): a dep is satisfied when waived or when its upstream
71
+ * Dependency satisfaction, derived purely in the fold and NEVER a record:
72
+ * a dep is satisfied when waived or when its upstream
70
73
  * node is `done`. Terminally unsuccessful upstreams (cancelled, failed)
71
74
  * keep blocking: such edges "remain blocking" per the rewire_deps row of
72
75
  * the conflict table, and waive_dep exists exactly to unblock them.
@@ -82,7 +85,7 @@ declare function depsSatisfied(plan: TaskPlan, node: PlanNode): boolean;
82
85
  */
83
86
  declare function recomputePlanReadiness(plan: TaskPlan): TaskPlan;
84
87
  /**
85
- * Cycle check for rewire_deps (docs/07, 3.6: a resulting cycle drops the
88
+ * Cycle check for rewire_deps (a resulting cycle drops the
86
89
  * WHOLE op with dep_cycle; rewire_deps is atomic). Answers whether the
87
90
  * graph with `nodeId`'s deps replaced by `deps` contains a cycle
88
91
  * reachable from `nodeId`. add_task cannot create cycles (nothing depends
@@ -95,18 +98,18 @@ declare function wouldCreateDepCycle(plan: TaskPlan, nodeId: NodeId, deps: reado
95
98
  declare const PLAN_HASH_VERSION: HashVersion;
96
99
  /**
97
100
  * The canonical JSON projection of PlanState: nodes sorted by NodeId plus
98
- * the guard fold counters, nothing else (docs/07, 3.4).
101
+ * the guard fold counters, nothing else.
99
102
  */
100
103
  declare function canonicalPlanState(plan: TaskPlan): Record<string, unknown>;
101
104
  /**
102
105
  * planHash under one deriver profile (default: the current hashVersion 2
103
106
  * profile). Replay recomputes each entry's planHashAfter with the
104
- * predicate of that entry's OWN hashVersion (docs/07, 3.4), so the
107
+ * predicate of that entry's OWN hashVersion, so the
105
108
  * deriver is a parameter, not an ambient.
106
109
  */
107
110
  declare function planHash(plan: TaskPlan, deriver?: KeyDeriver): string;
108
111
  /**
109
- * The append-time head assertion (docs/07, 3.4): planHashBefore of the
112
+ * The append-time head assertion: planHashBefore of the
110
113
  * entry being appended MUST equal the current fold head. A failure is an
111
114
  * engine bug and raises the typed PlanInvariantError; the run finishes
112
115
  * with outcome error, never a silent brick.
@@ -121,11 +124,11 @@ declare function assertPlanHead(plan: TaskPlan, expectedPlanHash: string, contex
121
124
  * PlanWriteLock (M7-T01): the in-process FIFO mutex serializing live
122
125
  * appends to the sequential scope "plan".
123
126
  *
124
- * Owning spec: docs/07-adaptive-orchestration-spec.md, section 3.2
127
+ * Owning contract: https://docs.rulvar.com/guide/adaptive-orchestration
125
128
  * (DEF-8, XF-07). The lock serializes ONLY plan-scope appends (acquire,
126
129
  * read the fold head, evaluate, append, release); it MUST NOT substitute
127
130
  * for resolution arbitration, which is owned by the ResolutionArbiter
128
- * (docs/03, section "Suspension and resolutions (DEF-4)"). In queue mode
131
+ * (DEF-4). In queue mode
129
132
  * the lease fencing epoch applies on top. Wall clock influences only
130
133
  * WHICH order gets recorded live; replay reads the recorded order and
131
134
  * never takes the lock.
@@ -148,32 +151,32 @@ interface TaskSpec {
148
151
  /** Registered agent profile name; models are never named here. */
149
152
  agentType: string;
150
153
  prompt: string;
151
- /** Registered SchemaSpec name (docs/08); registry lands in M7-T05. */
154
+ /** Registered SchemaSpec name; registry lands in M7-T05. */
152
155
  outputSchemaRef?: string;
153
- /** Registered tool profile name (docs/08); registry lands in M7-T05. */
156
+ /** Registered tool profile name; registry lands in M7-T05. */
154
157
  toolsetRef?: string;
155
158
  isolation?: IsolationSpec;
156
159
  usageLimits?: Partial<UsageLimits>;
157
160
  /** Clamped by childBudgetFraction at admission. */
158
161
  budgetUsd?: number;
159
- /** The ONLY model influence the orchestrator has (docs/07, 4.1). */
162
+ /** The ONLY model influence the orchestrator has. */
160
163
  model_hint?: {
161
164
  startTier: number;
162
165
  };
163
166
  /** Slug entering approachSig, at most 32 chars after normalization. */
164
167
  approach?: string;
165
- /** Absence means a new lineage root (docs/07, 8.1). */
168
+ /** Absence means a new lineage root. */
166
169
  lineage?: SpawnLineageOpt;
167
- /** Default 'unclassified' (taskClass binding OQ, docs/14). */
170
+ /** Default 'unclassified' (taskClass binding is an open question). */
168
171
  taskClass?: string;
169
- /** Absence means the child cannot escalate (docs/07, 6.4). */
172
+ /** Absence means the child cannot escalate. */
170
173
  escalation?: EscalationOptions;
171
174
  }
172
- /** The amend_task patch form: every field optional (docs/07, 4.7). */
175
+ /** The amend_task patch form: every field optional. */
173
176
  type TaskSpecPatch = Partial<TaskSpec>;
174
177
  /**
175
- * The deterministic spec digest entering PlanNode.promptSpecHash
176
- * (docs/07, 3.1): the canonical JSON of the full TaskSpec through the
178
+ * The deterministic spec digest entering PlanNode.promptSpecHash:
179
+ * the canonical JSON of the full TaskSpec through the
177
180
  * frozen hashVersion 2 canonicalization. A plan-internal digest, not a
178
181
  * kernel content key: the paid-call identity stays with the child's own
179
182
  * spawn entry.
@@ -183,7 +186,7 @@ declare function promptSpecHashOf(spec: TaskSpec): string;
183
186
  declare function applyTaskSpecPatch(spec: TaskSpec, patch: TaskSpecPatch): TaskSpec;
184
187
  //#endregion
185
188
  //#region src/plan-entries.d.ts
186
- /** The orchestrator-facing PlanOp union (docs/07, 4.7). */
189
+ /** The orchestrator-facing PlanOp union. */
187
190
  type PlanOp = {
188
191
  op: "add_task";
189
192
  spec: TaskSpec;
@@ -221,7 +224,7 @@ type PlanOp = {
221
224
  };
222
225
  /**
223
226
  * Applied forms the fold consumes. cancel_task gains the engine-computed
224
- * cascade (docs/07, 3.6: computed at apply time, never a parameter);
227
+ * cascade (computed at apply time, never a parameter);
225
228
  * park/cancel against running nodes apply as flag requests landing later
226
229
  * via plan.decision (park-landed, cancel-landed).
227
230
  */
@@ -254,7 +257,7 @@ type AppliedPlanOp = (Extract<PlanOp, {
254
257
  } | Extract<PlanOp, {
255
258
  op: "waive_dep";
256
259
  }>;
257
- /** The complete machine reason vocabulary, normative and closed (docs/07, 3.5). */
260
+ /** The complete machine reason vocabulary, normative and closed. */
258
261
  type RebaseReasonCode = "admission_denied" | "node_already_done" | "dep_already_resolved" | "node_escalated" | "node_running" | "terminal_status" | "dep_cycle" | "already_parked" | "not_parked" | "no_such_dep" | "already_waived" | "bad_base" | "lineage_exhausted" | "lineage_busy" | "plan_frozen" | "checkpoint_discarded" | "reuse_by_reference" | "resolved_escalation" | "immediate_satisfaction";
259
262
  type RebaseOutcome = {
260
263
  kind: "applied";
@@ -277,7 +280,7 @@ interface PlanSnapshotRef {
277
280
  planHash: string;
278
281
  }
279
282
  interface PlanReviseRequest {
280
- /** Mandatory; the call is rejected without it (docs/07, 3.5). */
283
+ /** Mandatory; the call is rejected without it. */
281
284
  base: PlanSnapshotRef;
282
285
  ops: PlanOp[];
283
286
  rationale: string;
@@ -291,7 +294,7 @@ interface PlanReviseResult {
291
294
  revisionUnitsRemaining: number;
292
295
  }
293
296
  type PlanReviseErrorCode = "revision_budget_exhausted" | RebaseReasonCode;
294
- /** One embedded admission beside its op (docs/07, 3.3; DEF-2/DEF-3 folds read it). */
297
+ /** One embedded admission beside its op (DEF-2/DEF-3 folds read it). */
295
298
  interface PlanRevisionAdmission {
296
299
  opIndex: number;
297
300
  nodeId?: NodeId;
@@ -302,7 +305,7 @@ interface PlanRevisionAdmission {
302
305
  chain: string[];
303
306
  };
304
307
  }
305
- /** The value payload of a plan.revision entry (docs/07, 3.3; XF-11). */
308
+ /** The value payload of a plan.revision entry (XF-11). */
306
309
  interface PlanRevisionValue {
307
310
  base: PlanSnapshotRef;
308
311
  requestedOps: PlanOp[];
@@ -323,9 +326,9 @@ interface PlanRevisionValue {
323
326
  balanceAfter: number;
324
327
  }>;
325
328
  }
326
- /** Engine authorship origins of plan.decision entries (docs/07, 3.3). */
329
+ /** Engine authorship origins of plan.decision entries. */
327
330
  type PlanDecisionOrigin = "escalation-default" | "escalation-class" | "escalation-live" | "no-progress" | "child-result" | "park-landed" | "cancel-landed";
328
- /** The closed EnginePlanOp set (docs/07, 3.3). */
331
+ /** The closed EnginePlanOp set. */
329
332
  type EnginePlanOp = {
330
333
  kind: "set_node_status";
331
334
  nodeId: NodeId;
@@ -349,7 +352,7 @@ type EnginePlanOp = {
349
352
  }>;
350
353
  admission: AdmissionDecision;
351
354
  };
352
- /** The value payload of a plan.decision entry (docs/07, 3.3). */
355
+ /** The value payload of a plan.decision entry. */
353
356
  interface PlanDecisionValue {
354
357
  origin: PlanDecisionOrigin;
355
358
  ops: EnginePlanOp[];
@@ -359,7 +362,7 @@ interface PlanDecisionValue {
359
362
  hashVersion: HashVersion;
360
363
  }
361
364
  /**
362
- * Content keys (docs/07, 3.3): plan.revision keys over {kind, base,
365
+ * Content keys: plan.revision keys over {kind, base,
363
366
  * requestedOps}; plan.decision over {kind, origin, ops, causeRef}.
364
367
  * Cosmetics (rationale) never enter a key; ordinal within scope "plan"
365
368
  * distinguishes repeats, so forward-matching works without kernel
@@ -370,7 +373,7 @@ declare function planDecisionKey(origin: PlanDecisionOrigin, ops: readonly Engin
370
373
  /**
371
374
  * The working state the applier threads: the hashed TaskPlan plus the
372
375
  * resolved spec table. Specs stay OUT of planHash by construction (the
373
- * hashed projection is promptSpecHash per node, docs/07 3.1) but are
376
+ * hashed projection is promptSpecHash per node) but are
374
377
  * themselves a pure fold of add_task specs, amend patches, and
375
378
  * decomposition specs, so live and replay converge byte-identically.
376
379
  */
@@ -382,8 +385,8 @@ interface PlanWorking {
382
385
  * The plan fold state: the working state plus fold-side records that
383
386
  * deliberately stay OUT of planHash. `badBaseStreak` reconciles two
384
387
  * normative clauses: a bad_base revision leaves the hashed state
385
- * byte-identical (docs/07, 3.5 step 2: planHashAfter == planHashBefore)
386
- * yet still lengthens the guard streak (docs/07, 3.6 last row): the
388
+ * byte-identical (planHashAfter == planHashBefore)
389
+ * yet still lengthens the guard streak: the
387
390
  * guards therefore consume `effectiveDroppedStreak`, the hashed counter
388
391
  * plus the trailing bad_base entries. `doneRefs` remembers which entry
389
392
  * resolved each done node so waive_dep drops can point blockingRef at
@@ -394,14 +397,14 @@ interface PlanFoldState extends PlanWorking {
394
397
  doneRefs: Record<NodeId, EntryRef>;
395
398
  }
396
399
  declare function emptyPlanFold(plan: TaskPlan): PlanFoldState;
397
- /** The streak RevisionGuards consume (docs/07, 3.8). */
400
+ /** The streak RevisionGuards consume. */
398
401
  declare function effectiveDroppedStreak(state: PlanFoldState): number;
399
402
  /**
400
403
  * Applies ONE applied op to the working state. The applier consumes
401
404
  * recorded outcomes; op-level legality was decided at rebase time and is
402
405
  * never re-evaluated here. Exported for the rebase engine, which applies
403
406
  * each op of a revision against the state already changed by the earlier
404
- * applied ops of the same revision (docs/07, 3.5, step 3).
407
+ * applied ops of the same revision.
405
408
  */
406
409
  declare function applyAppliedOp(working: PlanWorking, op: AppliedPlanOp, context: {
407
410
  seq: number;
@@ -413,7 +416,7 @@ declare function readPlanRevision(entry: JournalEntry): PlanRevisionValue | unde
413
416
  /** Reads a plan.decision entry's payload. */
414
417
  declare function readPlanDecision(entry: JournalEntry): PlanDecisionValue | undefined;
415
418
  /**
416
- * THE single applier (docs/07, 3.2): folds one plan-scope entry into the
419
+ * THE single applier: folds one plan-scope entry into the
417
420
  * state. Replay consumes recorded outcomes (the APPLIED diff), never
418
421
  * re-runs rebase, and timers do not run; hash verification runs under
419
422
  * the entry's own hashVersion profile.
@@ -423,7 +426,7 @@ declare function applyPlanEntry(state: PlanFoldState, entry: JournalEntry, optio
423
426
  }): PlanFoldState;
424
427
  /**
425
428
  * The shared plan.decision applier core: engine authorship happens at
426
- * the fold head under PlanWriteLock (docs/07, 3.3), so the producer can
429
+ * the fold head under PlanWriteLock, so the producer can
427
430
  * PREVIEW the resulting state (and its planHashAfter) before appending,
428
431
  * and the fold re-applies the recorded ops identically on replay.
429
432
  */
@@ -439,14 +442,14 @@ interface ReuseTransform {
439
442
  applied: AppliedPlanOp;
440
443
  admission: AdmissionDecision;
441
444
  nodeId: NodeId;
442
- /** Donor placement recorded beside the verdict (docs/03, 9.5). */
445
+ /** Donor placement recorded beside the verdict. */
443
446
  reuse: {
444
447
  donorScope: string;
445
448
  chain: string[];
446
449
  };
447
450
  }
448
451
  interface RebaseContext {
449
- /** The fold head (docs/07, 3.5 step 3). */
452
+ /** The fold head. */
450
453
  state: PlanFoldState;
451
454
  /** The plan hash recorded in the WakeDigest the base references. */
452
455
  digestPlanHashFor: (digestSeq: number) => string | undefined;
@@ -454,11 +457,11 @@ interface RebaseContext {
454
457
  mintNodeId: () => NodeId;
455
458
  /** The plan is frozen for adaptation by orchestrator_budget_cap (DEF-7). */
456
459
  frozen?: boolean;
457
- /** Embedded admission for add_task (docs/07, 3.6); absent admits nothing. */
460
+ /** Embedded admission for add_task; absent admits nothing. */
458
461
  admitAdd?: (op: Extract<PlanOp, {
459
462
  op: "add_task";
460
463
  }>, nodeId: NodeId, opIndex: number) => AdmissionDecision;
461
- /** Embedded admission reserve for unpark_task (docs/07, 3.6). */
464
+ /** Embedded admission reserve for unpark_task. */
462
465
  admitUnpark?: (op: Extract<PlanOp, {
463
466
  op: "unpark_task";
464
467
  }>, node: PlanNode, opIndex: number) => AdmissionDecision;
@@ -481,7 +484,7 @@ interface RebaseEvaluation {
481
484
  working: PlanWorking;
482
485
  }
483
486
  /**
484
- * Steps 2-4 of the committed algorithm (docs/07, 3.5): base validation,
487
+ * Steps 2-4 of the committed algorithm: base validation,
485
488
  * sequential per-op conflict resolution against the mutating head, and
486
489
  * the post-revision counter update. Pure: the caller owns the lock, the
487
490
  * append, and every effect.
@@ -489,7 +492,7 @@ interface RebaseEvaluation {
489
492
  declare function rebasePlanRevision(request: PlanReviseRequest, context: RebaseContext): RebaseEvaluation;
490
493
  //#endregion
491
494
  //#region src/guards.d.ts
492
- /** RevisionGuards configuration (docs/07, 3.8). */
495
+ /** RevisionGuards configuration. */
493
496
  interface RevisionGuardsOptions {
494
497
  /** Default 'finish-with-partial'; the chain is non-HITL and terminating. */
495
498
  fallback?: "reject-revision" | "finish-with-partial" | "fail-run";
@@ -515,7 +518,7 @@ interface GuardVerdictValue {
515
518
  }
516
519
  /** Appendix A: osc_guard reject threshold per key (shared default). */
517
520
  declare const DEFAULT_MAX_OSCILLATIONS_PER_KEY = 2;
518
- /** The hard per-run stall replan bound (docs/07, 9.3). */
521
+ /** The hard per-run stall replan bound. */
519
522
  declare const DEFAULT_STALL_REPLAN_CAP = 4;
520
523
  declare const DEFAULT_DROPPED_REVISION_LIMIT = 3;
521
524
  interface GuardsState {
@@ -586,7 +589,7 @@ declare const DEFAULT_MAX_PINNED_WORKTREES = 4;
586
589
  /**
587
590
  * The worktree pin ledger: a pure fold counting live pins from abandon
588
591
  * entries carrying `retainWorktree: true` (park pinning and DEF-5
589
- * retention share the cap by construction; docs/08).
592
+ * retention share the cap by construction).
590
593
  */
591
594
  declare class PinLedger {
592
595
  private readonly pinnedTargets;
@@ -596,7 +599,7 @@ declare class PinLedger {
596
599
  hasCapacity(maxPinnedWorktrees?: number): boolean;
597
600
  isPinnedNode(nodeId: string): boolean;
598
601
  }
599
- /** The park disposition computed at landing time (docs/03, 11.2). */
602
+ /** The park disposition computed at landing time. */
600
603
  interface ParkDisposition {
601
604
  /** Checkpoints are always retained on park. */
602
605
  retainCheckpoint: true;
@@ -604,7 +607,7 @@ interface ParkDisposition {
604
607
  retainWorktree: boolean;
605
608
  }
606
609
  declare function parkDispositionOf(isolation: IsolationSpec | undefined, pins: PinLedger, maxPinnedWorktrees?: number): ParkDisposition;
607
- /** The unpark placement (docs/03, 11.2): continuation or restart. */
610
+ /** The unpark placement: continuation or restart. */
608
611
  interface UnparkPlacement {
609
612
  /** True when the agent must restart (no checkpoint, or tree dropped). */
610
613
  restart: boolean;
@@ -619,7 +622,7 @@ declare function unparkPlacementOf(input: {
619
622
  }): UnparkPlacement;
620
623
  //#endregion
621
624
  //#region src/ledger.d.ts
622
- /** The CLOSED authored op vocabulary (docs/07, 9.2). */
625
+ /** The CLOSED authored op vocabulary. */
623
626
  type LedgerOp = {
624
627
  op: "brief_set";
625
628
  text: string;
@@ -651,6 +654,20 @@ type LedgerOp = {
651
654
  outcomeClass?: string;
652
655
  note: string;
653
656
  evidenceRefs: EntryRef[];
657
+ /**
658
+ * ENGINE-resolved kb_propose payload (phase 3): present exactly
659
+ * when the op was born from the kb_propose tool, whose handler
660
+ * resolves the tier-relative subject against the lineage's
661
+ * declared ladder. The model-facing ledger_append vocabulary
662
+ * never exposes these fields, so an orchestrator cannot forge a
663
+ * subject model name.
664
+ */
665
+ subject?: {
666
+ model: string;
667
+ effort?: Effort;
668
+ };
669
+ polarity?: "strength" | "weakness";
670
+ trigger?: KbProposalTrigger;
654
671
  };
655
672
  /** Appendix A per-section caps. */
656
673
  declare const LEDGER_SECTION_CAPS: {
@@ -683,6 +700,13 @@ interface LedgerObservation {
683
700
  outcomeClass?: string;
684
701
  note: string;
685
702
  evidenceRefs: EntryRef[];
703
+ /** Present exactly on kb_propose-born observations (phase 3). */
704
+ subject?: {
705
+ model: string;
706
+ effort?: Effort;
707
+ };
708
+ polarity?: "strength" | "weakness";
709
+ trigger?: KbProposalTrigger;
686
710
  entryRef: EntryRef;
687
711
  }
688
712
  /** One auto-derived revision history row (fold join, never authored). */
@@ -692,7 +716,7 @@ interface LedgerRevisionRow {
692
716
  applied: number;
693
717
  dropped: number;
694
718
  }
695
- /** The pure ledger fold (docs/07, 9.3). */
719
+ /** The pure ledger fold. */
696
720
  interface LedgerView {
697
721
  brief?: {
698
722
  text: string;
@@ -726,30 +750,30 @@ declare function foldLedger(entries: readonly JournalEntry[], options?: {
726
750
  uptoSeq?: number;
727
751
  }): LedgerView;
728
752
  /**
729
- * The committed ledger_read render budget (docs/06, Appendix A: 65536
753
+ * The committed ledger_read render budget (Appendix A: 65536
730
754
  * chars over the serialized view, the character measure; OQ-04 closed
731
755
  * at M10 entry). The section caps stay the primary bound; under the
732
756
  * default termination limits this belt never engages.
733
757
  */
734
758
  declare const LEDGER_RENDER_BUDGET_CHARS = 65536;
735
759
  /**
736
- * Deterministic render bound (docs/07, 9.3): over budget, rows drop
760
+ * Deterministic render bound: over budget, rows drop
737
761
  * oldest-first, auto-derived joins before authored sections, and the
738
762
  * mission brief slices last; every drop is a FLAGGED discrepancy line.
739
763
  * A pure function of (view, budget): a re-executed wake turn renders
740
764
  * byte-identical bounded bytes from the same pinned fold.
741
765
  */
742
766
  declare function boundLedgerRender(view: LedgerView, budgetChars?: number): LedgerView;
743
- /** Section-cap check for one authored op (docs/06, Appendix A). */
767
+ /** Section-cap check for one authored op (Appendix A). */
744
768
  declare function ledgerCapViolation(view: LedgerView, op: LedgerOp): string | undefined;
745
769
  /**
746
- * Compaction sufficiency (docs/07, 9.3): the orchestrate role may
770
+ * Compaction sufficiency: the orchestrate role may
747
771
  * compact aggressively only when the ledger measurably suffices (at
748
772
  * least one authored revision recorded and a minimum fact count);
749
773
  * otherwise the engine falls back to conservative summarize.
750
774
  */
751
775
  declare function ledgerSufficiency(view: LedgerView, minimumFacts?: number): boolean;
752
- /** The draft-versioned outward seam (docs/07, 9.3; OQ in docs/14). */
776
+ /** The draft-versioned outward seam; the final shape stays an open question. */
753
777
  interface LedgerExport {
754
778
  ledgerExportVersion: "draft-1";
755
779
  brief?: string;
@@ -763,8 +787,8 @@ declare function exportLedger(view: LedgerView): LedgerExport;
763
787
  //#region src/ladder.d.ts
764
788
  /**
765
789
  * Extracts the declared ladder from an agent profile: the ModelSpec union
766
- * carries it (`model: { ladder }`), or the loop-role routing entry
767
- * (docs/04, section 12). The same declaration points feed ladderLengthOf
790
+ * carries it (`model: { ladder }`), or the loop-role routing entry.
791
+ * The same declaration points feed ladderLengthOf
768
792
  * and the frozen kMax, so admission and execution can never disagree on
769
793
  * the ladder length.
770
794
  */
@@ -774,20 +798,20 @@ declare function chainEffortOf(profile: unknown): Effort | undefined;
774
798
  /** Canonicalizes the profile's declared ladder once per dispatch site. */
775
799
  declare function canonicalLadderOf(profile: unknown): CanonicalLadderSpec | undefined;
776
800
  /**
777
- * Clamps the orchestrator's `model_hint.startTier` to the declared ladder
778
- * (docs/07, section 4.2): the hint is the ONLY model influence the
801
+ * Clamps the orchestrator's `model_hint.startTier` to the declared ladder:
802
+ * the hint is the ONLY model influence the
779
803
  * orchestrator has, and it never names a model.
780
804
  */
781
805
  declare function clampStartTier(ladder: CanonicalLadderSpec, hint?: number): number;
782
806
  /**
783
807
  * The rung an attempt executes on: the clamped start tier plus the
784
808
  * journaled raise count, hard-clamped at the top rung. `rungIndex` per
785
- * lineage is strictly monotone; there are no demotions (docs/07, 10).
809
+ * lineage is strictly monotone; there are no demotions.
786
810
  */
787
811
  declare function executingRungOf(ladder: CanonicalLadderSpec, startTier: number, raises: number): number;
788
812
  /**
789
- * Classifies a settled attempt into the typed transition trigger
790
- * (docs/04, section 12): schema-mismatch errors are 'schema-exhausted';
813
+ * Classifies a settled attempt into the typed transition trigger:
814
+ * schema-mismatch errors are 'schema-exhausted';
791
815
  * the engine's no-progress abort is first-class 'no-progress' (it rides
792
816
  * status 'limit' with the dedicated abort class, distinct from user
793
817
  * cancellation by construction); cancelled, escalated, and skipped never
@@ -800,7 +824,7 @@ declare function ladderTriggerOf(settled: Pick<AgentResult<unknown>, "status"> &
800
824
  };
801
825
  abortClass?: string;
802
826
  }): Exclude<TriggerClass, "verify-failed"> | undefined;
803
- /** One journaled acceptance-gate evaluation (docs/07, section 10). */
827
+ /** One journaled acceptance-gate evaluation. */
804
828
  interface GateVerdictValue {
805
829
  decisionType: "gate-verdict";
806
830
  logicalTaskId: LogicalTaskId;
@@ -824,12 +848,12 @@ interface GateVerdictValue {
824
848
  /** Content key of one gate verdict: attempt plus gate position. */
825
849
  declare function gateVerdictKey(attemptRef: EntryRef, gateIndex: number): string;
826
850
  /**
827
- * The ladder verdict decision entry (docs/07, sections 10 and 11.3): the
851
+ * The ladder verdict decision entry: the
828
852
  * producer contract both folds already consume. A RAISING verdict debits
829
853
  * one rung unit (rungIndexAfter/rungsRemainingAfter embedded, checked by
830
854
  * foldTermination) and carries the rung RESPAWN's embedded admission
831
855
  * (spawn debit) plus `nextAttempt` (the lineage registration: relation
832
- * 'rung-retry', docs/03 10.1 row 4). A non-raising verdict records the
856
+ * 'rung-retry'). A non-raising verdict records the
833
857
  * ladder's end (exhausted rungs, top rung, or a denied respawn) and
834
858
  * authorizes nothing.
835
859
  */
@@ -849,14 +873,14 @@ interface LadderVerdictValue {
849
873
  lineage: Json; /** The concrete rung the next attempt executes on. */
850
874
  rungIndex: number;
851
875
  };
852
- /** The embedded respawn admission (the spawn debit; docs/07, 11.3 b). */
876
+ /** The embedded respawn admission (the spawn debit). */
853
877
  admissions?: Json[];
854
878
  /** Non-raising verdicts: why the ladder ended here. */
855
879
  reason?: "rungs_exhausted" | "top_rung" | "respawn_denied" | "trigger_not_declared";
856
880
  }
857
881
  /** Content key of one ladder verdict: the judged attempt is unique. */
858
882
  declare function ladderVerdictKey(attemptRef: EntryRef): string;
859
- /** The forced verdict schema of the judge gate (docs/07, section 10). */
883
+ /** The forced verdict schema of the judge gate. */
860
884
  declare const JUDGE_VERDICT_SCHEMA: {
861
885
  readonly type: "object";
862
886
  readonly properties: {
@@ -882,13 +906,13 @@ declare function judgePrompt(input: {
882
906
  }): string;
883
907
  //#endregion
884
908
  //#region src/escalation.d.ts
885
- /** One per-lineage debit row of a class-level decision (docs/07, 6.5). */
909
+ /** One per-lineage debit row of a class-level decision. */
886
910
  interface EscalationDebitRow {
887
911
  logicalTaskId: LogicalTaskId;
888
912
  escalationUnitsAfter: number;
889
913
  }
890
914
  /**
891
- * The authoritative escalation-decision entry value (docs/07, 6.5; the
915
+ * The authoritative escalation-decision entry value (the
892
916
  * producer contract of LineageIndex and foldTermination). Exactly one
893
917
  * such entry per report; the debit is atomic with the append and the
894
918
  * balance-after is embedded (DEF-2). A decision whose counting debit was
@@ -907,37 +931,44 @@ interface EscalationDecisionValue {
907
931
  countsAgainstLimit: boolean;
908
932
  /** Present exactly when a counting debit executed (fold-asserted). */
909
933
  escalationUnitsAfter?: number;
910
- /** How the decision was reached (docs/07, 3.3 plan.decision origins). */
934
+ /** How the decision was reached (the plan.decision origins). */
911
935
  resolvedBy: "default" | "class" | "live" | "revision-transform";
912
936
  /** Class-level form: one entry, an array of per-lineage debits. */
913
937
  debits?: EscalationDebitRow[];
914
938
  /** Decomposition admissions (spawn debits ride this entry; 11.3 b). */
915
939
  admissions?: Json[];
916
- /** The counting debit was denied: the cap is the message (docs/07, 6.5). */
940
+ /** The counting debit was denied: the cap is the message. */
917
941
  capExceeded?: boolean;
918
942
  }
919
943
  /** Content key: one authoritative decision per report (decide-once). */
920
944
  declare function escalationDecisionKey(reportRef: EntryRef): string;
921
945
  /** Maps a resolution `by` value onto the decision's resolvedBy field. */
922
946
  declare function resolvedByOf(by: string): "default" | "class" | "live";
923
- /** The plan.decision origin of one resolvedBy value (docs/07, 3.3). */
947
+ /** The plan.decision origin of one resolvedBy value. */
924
948
  declare function decisionOriginOf(resolvedBy: "default" | "class" | "live" | "revision-transform"): "escalation-default" | "escalation-class" | "escalation-live";
925
949
  //#endregion
926
950
  //#region src/plan-runner.d.ts
927
- /** docs/07, 3.8. */
951
+ /** Configuration knobs of the PlanRunner extension. */
928
952
  interface PlanRunnerOptions {
929
953
  /** Absolute, non-replenishable; default 32 (DEF-2). */
930
954
  maxRevisionsPerRun?: number;
931
955
  guards?: RevisionGuardsOptions;
932
956
  /** Out-of-vocabulary tags get a typed tool error with bounded re-prompt (DEF-3). */
933
957
  approachVocabulary?: string[];
934
- /** Reuse-by-reference configuration (DEF-5; docs/03, 9.9). */
958
+ /** Reuse-by-reference configuration (DEF-5). */
935
959
  reuse?: ReuseConfig;
936
960
  /** Frozen termination knobs beyond the revision budget (DEF-2). */
937
961
  limits?: Partial<Pick<TerminationLimits, "maxTotalSpawns" | "maxEscalationsPerLogicalTask" | "maxDepth">>;
962
+ /**
963
+ * ModelKnowledge phase 3 opt-in: registers the kb_propose tool, which
964
+ * journals quarantined model observations into the RunLedger's
965
+ * modelObservations section. Registered like any opt-in tool, so
966
+ * enabling it changes toolsetHash by design. Default false.
967
+ */
968
+ kbPropose?: boolean;
938
969
  }
939
970
  /**
940
- * Builds the PlanRunner orchestrator extension (docs/07, section 3).
971
+ * Builds the PlanRunner orchestrator extension.
941
972
  * Attach via `orchestrate(engine, goal, { extension: planRunner(o) })` or
942
973
  * the `orchestratePlanned` convenience surface.
943
974
  */
@@ -982,7 +1013,7 @@ declare const EMPTY_PLAN_HASH: string;
982
1013
  declare function engineWith(adapter: ProviderAdapter, store: JournalStore, profiles: Record<string, unknown>, extras?: {
983
1014
  schemas?: Record<string, unknown>;
984
1015
  lineage?: Record<string, number>;
985
- isolation?: unknown; /** ModelKnowledge store for the M10 kb cassettes (docs/05). */
1016
+ isolation?: unknown; /** ModelKnowledge store for the M10 kb cassettes. */
986
1017
  knowledge?: unknown;
987
1018
  }): Engine;
988
1019
  declare const BUDGET: {
@@ -992,26 +1023,26 @@ declare const BUDGET: {
992
1023
  declare function settled(handle: RunHandle<unknown>): Promise<void>;
993
1024
  /**
994
1025
  * revise-mid-run: a plan revision arrives while a worker subtree is
995
- * mid-flight (docs/09 round-2). The first worker HANGS until the
1026
+ * mid-flight. The first worker HANGS until the
996
1027
  * revision cancels it; the added replacement completes.
997
1028
  */
998
1029
  declare function runReviseMidRun(): Promise<JournalEntry[]>;
999
1030
  /**
1000
1031
  * crash-during-revision: process death INSIDE the revision window, at
1001
- * the pre-append kill point (docs/09 round-2): life 1 is truncated
1032
+ * the pre-append kill point: life 1 is truncated
1002
1033
  * strictly BEFORE the second plan.revision entry; life 2 re-issues the
1003
1034
  * revision live and rolls its effects forward.
1004
1035
  */
1005
1036
  declare function runCrashDuringRevision(): Promise<JournalEntry[]>;
1006
1037
  /**
1007
1038
  * oscillation-freeze: the coarse-signature oscillation detector freezes
1008
- * further re-adds under hysteresis (docs/09 round-2; distinct from the
1039
+ * further re-adds under hysteresis (distinct from the
1009
1040
  * per-key osc_guard reject).
1010
1041
  */
1011
1042
  declare function runOscillationFreeze(options?: PlanRunnerOptions): Promise<JournalEntry[]>;
1012
1043
  /**
1013
1044
  * park-unpark: park of a running node with checkpoint retention, later
1014
- * unpark and continuation (docs/09 round-2; docs/03 11.2). The worker
1045
+ * unpark and continuation. The worker
1015
1046
  * pays one tool turn, hangs in its second, parks at the boundary, and
1016
1047
  * the unparked continuation resumes from the retained checkpoint (the
1017
1048
  * booted history carries the paid turn).
@@ -1020,20 +1051,20 @@ declare function runParkUnpark(): Promise<JournalEntry[]>;
1020
1051
  /**
1021
1052
  * half-escalated-ladder: some rungs terminal, the active rung dangling
1022
1053
  * mid-attempt at the crash; resume continues the ladder without
1023
- * repaying completed rungs (docs/09 round-2).
1054
+ * repaying completed rungs.
1024
1055
  */
1025
1056
  declare function runHalfEscalatedLadder(): Promise<JournalEntry[]>;
1026
1057
  /**
1027
1058
  * budget-denied-rung: the budget guard denies the rung respawn; the
1028
1059
  * denial journals as termination.denied strictly before the verdict and
1029
- * the ladder takes its declared fallback path (docs/09 round-2).
1060
+ * the ladder takes its declared fallback path.
1030
1061
  */
1031
1062
  declare function runBudgetDeniedRung(): Promise<JournalEntry[]>;
1032
1063
  /**
1033
1064
  * cap-freeze-then-finish (DEF-7): the soft boundary crossed with live
1034
1065
  * children; the cap decision precedes its effects; admitted nodes run to
1035
1066
  * completion; the final quiescence wake gets the finish-only toolset;
1036
- * outcome ok with forcedFinish (docs/09).
1067
+ * outcome ok with forcedFinish.
1037
1068
  */
1038
1069
  declare function runCapFreezeThenFinish(): Promise<JournalEntry[]>;
1039
1070
  /**
@@ -1072,20 +1103,20 @@ declare function runRungRetryLineage(): Promise<JournalEntry[]>;
1072
1103
  /**
1073
1104
  * decompose-mints-children (DEF-3): an escalation decomposition mints
1074
1105
  * FRESH logical tasks inside the decision entry; the spawn debits ride
1075
- * the same entry (docs/07, 8.1 rule 6, 11.3 b).
1106
+ * the same entry.
1076
1107
  */
1077
1108
  declare function runDecomposeMintsChildren(): Promise<JournalEntry[]>;
1078
1109
  /**
1079
1110
  * queue-failover-during-forced-finish (the DEF-7 final cassette;
1080
- * docs/09, section 6.9; M8-T03): worker A loses its lease strictly
1111
+ * M8-T03): worker A loses its lease strictly
1081
1112
  * between the cap decision and the final wake; worker B reclaims with a
1082
1113
  * bumped fencing epoch and rolls the forced finish forward. The stale
1083
1114
  * writer's appends are rejected and invisible, exactly one cap decision
1084
1115
  * exists, and finalization is paid once.
1085
1116
  *
1086
1117
  * The LeasableStore is INJECTED so this package stays core-only: the
1087
- * replay test and the record script supply the reference SqliteStore
1088
- * (docs/03, 12.6). One deterministic clock drives lease expiry.
1118
+ * replay test and the record script supply the reference SqliteStore.
1119
+ * One deterministic clock drives lease expiry.
1089
1120
  */
1090
1121
  interface QueueFailoverDeps {
1091
1122
  /** A fresh LeasableStore over the injected clock (SqliteStore ':memory:' in the suite). */
@@ -1094,18 +1125,38 @@ interface QueueFailoverDeps {
1094
1125
  declare function runQueueFailoverDuringForcedFinish(deps: QueueFailoverDeps): Promise<JournalEntry[]>;
1095
1126
  //#endregion
1096
1127
  //#region src/tools.d.ts
1097
- /** docs/07, 4.6: plan_view takes no parameters. */
1128
+ /** plan_view takes no parameters. */
1098
1129
  declare const PLAN_VIEW_SCHEMA: SchemaSpec;
1099
- /** docs/07, 4.7: the plan_revise parameter schema (normative). */
1130
+ /** The plan_revise parameter schema (normative). */
1100
1131
  declare const PLAN_REVISE_SCHEMA: SchemaSpec;
1101
1132
  declare const PLAN_VIEW_TOOL_NAME = "plan_view";
1102
1133
  declare const PLAN_REVISE_TOOL_NAME = "plan_revise";
1103
1134
  declare const LEDGER_APPEND_TOOL_NAME = "ledger_append";
1104
1135
  declare const LEDGER_READ_TOOL_NAME = "ledger_read";
1105
- /** The closed authored op vocabulary as JSON Schema (docs/07, 9.2). */
1136
+ /** The closed authored op vocabulary as JSON Schema. */
1106
1137
  declare const LEDGER_APPEND_SCHEMA: SchemaSpec;
1107
- /** docs/07: ledger_read takes no parameters and pins to the turn snapshot. */
1138
+ /** ledger_read takes no parameters and pins to the turn snapshot. */
1108
1139
  declare const LEDGER_READ_SCHEMA: SchemaSpec;
1140
+ declare const KB_PROPOSE_TOOL_NAME = "kb_propose";
1141
+ /**
1142
+ * The normative kb_propose schema (phase 3). The subject is
1143
+ * tier-relative: the orchestrator never sees model names, so the
1144
+ * handler resolves the rung index against the declared ladder of the
1145
+ * referenced lineage into the concrete KbProposal subject.
1146
+ */
1147
+ declare const KB_PROPOSE_SCHEMA: SchemaSpec;
1148
+ /** The model-facing kb_propose payload (tier-relative subject). */
1149
+ interface KbProposeInput {
1150
+ subject: {
1151
+ tier: number;
1152
+ };
1153
+ taskClass: string;
1154
+ polarity: "strength" | "weakness";
1155
+ trigger: "error" | "limit" | "schema-exhausted" | "verify-failed" | "no-progress" | "escalation";
1156
+ logicalTaskId?: string;
1157
+ note?: string;
1158
+ evidenceRefs?: number[];
1159
+ }
1109
1160
  /** One rendered node of the pinned plan_view fold. */
1110
1161
  interface PlanViewNode {
1111
1162
  nodeId: NodeId;
@@ -1116,7 +1167,7 @@ interface PlanViewNode {
1116
1167
  priority: number;
1117
1168
  lineage?: LineageStats;
1118
1169
  }
1119
- /** The plan_view render (docs/07, 4.6): plan state, lineage, termination, reuse. */
1170
+ /** The plan_view render: plan state, lineage, termination, reuse. */
1120
1171
  interface PlanViewRender {
1121
1172
  planHash: string;
1122
1173
  revisionCount: number;
@@ -1129,7 +1180,7 @@ interface PlanViewRender {
1129
1180
  reclaimedUsd: number;
1130
1181
  netLostUsd: number;
1131
1182
  };
1132
- /** RevisionGuards state (docs/07, 3.8; M7-T06). */
1183
+ /** RevisionGuards state (M7-T06). */
1133
1184
  guards?: {
1134
1185
  engaged?: "reject-revision" | "finish-with-partial" | "fail-run";
1135
1186
  frozenSignatures: string[];
@@ -1144,6 +1195,14 @@ interface PlanToolRuntime {
1144
1195
  entryRef: number;
1145
1196
  }>;
1146
1197
  ledgerRead(): LedgerView;
1198
+ /**
1199
+ * Phase 3 opt-in: resolves the tier-relative payload into a concrete
1200
+ * KbProposal and journals it as the observation_add ledger.op. Absent
1201
+ * unless the run opted into kb_propose.
1202
+ */
1203
+ kbPropose?(input: KbProposeInput): Promise<{
1204
+ entryRef: number;
1205
+ }>;
1147
1206
  }
1148
1207
  /** Builds the PlanRunner tools (appended to the mode (c) toolset). */
1149
1208
  declare function buildPlanTools(runtime: PlanToolRuntime): ToolDef[];
@@ -1229,7 +1288,7 @@ declare function runLegacyJournalResume(): Promise<JournalEntry[]>;
1229
1288
  * reuse_full: the verdict is embedded in the plan.revision, the
1230
1289
  * node.link (mode full, claim shared) and the by-ref root are present,
1231
1290
  * the reused subtree costs zero live calls, and reclaimedUsdAtLink
1232
- * equals the donor spend (docs/03, 9.4/9.5).
1291
+ * equals the donor spend.
1233
1292
  */
1234
1293
  declare function runOscillationFullReuse(): Promise<JournalEntry[]>;
1235
1294
  /**
@@ -1237,29 +1296,29 @@ declare function runOscillationFullReuse(): Promise<JournalEntry[]>;
1237
1296
  * mid-top-rung after two completed rung attempts; the byte-identical
1238
1297
  * re-add grafts (exclusive link), the completed rung attempts
1239
1298
  * forward-match through the scope alias, and only the interrupted rung
1240
- * reruns live, exactly once (docs/03, 9.5).
1299
+ * reruns live, exactly once.
1241
1300
  */
1242
1301
  declare function runGraftPartialSubtree(): Promise<JournalEntry[]>;
1243
1302
  /**
1244
1303
  * crash-between-link-and-root (DEF-5): the full-reuse scenario is cut
1245
1304
  * strictly AFTER the durable node.link and BEFORE the by-ref root; the
1246
1305
  * resume rolls forward: the link forward-matches, the root is re-issued,
1247
- * and nothing is paid twice (docs/03, 9.10).
1306
+ * and nothing is paid twice.
1248
1307
  */
1249
1308
  declare function runCrashBetweenLinkAndRoot(): Promise<JournalEntry[]>;
1250
1309
  /**
1251
1310
  * oscillation-guard-trip (DEF-5): the third re-add of one SpawnKey at
1252
1311
  * maxOscillationsPerKey 2 rejects osc_guard as a typed plan_revise
1253
1312
  * error; the run closes through the non-HITL path and the embedded
1254
- * verdicts replay identically (docs/03, 9.4).
1313
+ * verdicts replay identically.
1255
1314
  */
1256
1315
  declare function runOscillationGuardTrip(): Promise<JournalEntry[]>;
1257
1316
  /**
1258
1317
  * worktree-disposed-degrade (DEF-5): a worktree-isolated graft donor
1259
1318
  * whose tree was NOT retained degrades to a fresh admit with the
1260
1319
  * embedded DedupNote graft_unsafe; a second section verifies reuse_full
1261
- * stays allowed for a worktree donor whose root is terminal (docs/03,
1262
- * 9.4: the pin condition applies to grafts only).
1320
+ * stays allowed for a worktree donor whose root is terminal (the pin
1321
+ * condition applies to grafts only).
1263
1322
  */
1264
1323
  declare function runWorktreeDisposedDegrade(): Promise<JournalEntry[]>;
1265
1324
  /**
@@ -1267,7 +1326,7 @@ declare function runWorktreeDisposedDegrade(): Promise<JournalEntry[]>;
1267
1326
  * tasks; the first grafts (exclusive claim), the second admits fresh;
1268
1327
  * the grafted node is severed and the key added a third time: the link
1269
1328
  * points at the chain head and the drain is transitive, oldest first;
1270
- * oscillationCount for the key reaches 2 (docs/03, 9.6).
1329
+ * oscillationCount for the key reaches 2.
1271
1330
  */
1272
1331
  declare function runClaimExclusivityAndChain(): Promise<JournalEntry[]>;
1273
1332
  /**
@@ -1276,63 +1335,70 @@ declare function runClaimExclusivityAndChain(): Promise<JournalEntry[]>;
1276
1335
  * done, a second node escalates, and a third completes; the wake
1277
1336
  * submits ONE stale-based revision {waive_dep, park_task, cancel_task}
1278
1337
  * whose trio drops with the exact reasons and the blockingRef pointing
1279
- * at the defaultDecision resolution (docs/07, 3.5; docs/09, 6.8).
1338
+ * at the defaultDecision resolution.
1280
1339
  */
1281
1340
  declare function runReviseRacingDefaultDecision(): Promise<JournalEntry[]>;
1282
1341
  /**
1283
1342
  * crash-after-append-before-effects (DEF-8): the kill lands immediately
1284
1343
  * after the durable plan.revision carrying add_task x2 plus cancel_task
1285
1344
  * on a running node; the resume re-issues the effects: both children
1286
- * spawn live exactly once and the cancel lands (docs/07, 3.9).
1345
+ * spawn live exactly once and the cancel lands.
1287
1346
  */
1288
1347
  declare function runCrashAfterAppendBeforeEffects(): Promise<JournalEntry[]>;
1289
1348
  /**
1290
1349
  * amend-vs-running-then-cancel-add (DEF-8): amend_task on a running node
1291
1350
  * drops node_running; the next revision cancels it and adds the amended
1292
1351
  * prompt as a NEW node continuing the SAME logical task; the abandon
1293
- * covers the old branch and replay repays neither (docs/07, 4.7).
1352
+ * covers the old branch and replay repays neither.
1294
1353
  */
1295
1354
  declare function runAmendVsRunningThenCancelAdd(): Promise<JournalEntry[]>;
1296
1355
  /**
1297
1356
  * intra-revision-self-conflict (DEF-8): one revision {cancel_task X,
1298
1357
  * amend_task X, rewire_deps with an edge onto X} resolves strictly in
1299
1358
  * submission order per the sequential intra-revision application
1300
- * semantics (docs/07, 4.7 conflict table).
1359
+ * semantics.
1301
1360
  */
1302
1361
  declare function runIntraRevisionSelfConflict(): Promise<JournalEntry[]>;
1303
1362
  /**
1304
1363
  * bad-base-streak-terminates (DEF-8): three consecutive revisions with a
1305
1364
  * fabricated base.planHash land as all-dropped bad-base entries; the
1306
1365
  * dropped streak reaches its limit and the non-HITL RevisionGuards
1307
- * fallback (finish-with-partial) closes the run (docs/07, 3.5/3.8).
1366
+ * fallback (finish-with-partial) closes the run.
1308
1367
  */
1309
1368
  declare function runBadBaseStreakTerminates(): Promise<JournalEntry[]>;
1310
1369
  /**
1311
1370
  * park-races-child-completion (DEF-8): park_task lands on a running node
1312
1371
  * whose terminal appends moments later; parkRequested is extinguished by
1313
1372
  * the child-result transition, no checkpoint is written, and the node is
1314
- * done (docs/07, 3.6).
1373
+ * done.
1315
1374
  */
1316
1375
  declare function runParkRacesChildCompletion(): Promise<JournalEntry[]>;
1317
1376
  /**
1318
1377
  * reserve-survives-run-exhaustion (DEF-7): cheap workers eat the run
1319
1378
  * ceiling until admission rejects the spawn that would invade the
1320
1379
  * committed finalize reserve; the final wake executes from the reserve
1321
- * and the rejections forward-match on replay (docs/07, 12.4).
1380
+ * and the rejections forward-match on replay.
1322
1381
  */
1323
1382
  declare function runReserveSurvivesRunExhaustion(): Promise<JournalEntry[]>;
1324
1383
  //#endregion
1325
1384
  //#region src/m10-cassettes.d.ts
1326
1385
  /**
1327
- * kb-pin-replay (docs/09, 6.11): the pin at admission and the repin at
1386
+ * kb-pin-replay: the pin at admission and the repin at
1328
1387
  * the wake, card bytes embedded, model names withheld.
1329
1388
  */
1330
1389
  declare function runKbPinReplay(): Promise<JournalEntry[]>;
1331
1390
  /**
1332
- * kb-repin-expiry (docs/09, 6.11): the repin re-applies the docs/05
1391
+ * kb-repin-expiry: the repin re-applies the claim
1333
1392
  * filters against a FRESH read; a claim the store dropped between the
1334
1393
  * pin and the wake stops steering, while the boot pin's bytes stand.
1335
1394
  */
1336
1395
  declare function runKbRepinExpiry(): Promise<JournalEntry[]>;
1337
1396
  //#endregion
1338
- export { AppliedPlanOp, BUDGET, CassetteTurn, DEFAULT_DROPPED_REVISION_LIMIT, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_STALL_REPLAN_CAP, EMPTY_PLAN_HASH, EnginePlanOp, EscalationDebitRow, EscalationDecisionValue, GateVerdictValue, GuardFallback, GuardVerdictValue, GuardsState, JUDGE_VERDICT_SCHEMA, LEDGER_APPEND_SCHEMA, LEDGER_APPEND_TOOL_NAME, LEDGER_READ_SCHEMA, LEDGER_READ_TOOL_NAME, LEDGER_RENDER_BUDGET_CHARS, LEDGER_SECTION_CAPS, LadderVerdictValue, LedgerExport, LedgerFact, LedgerLesson, LedgerObservation, LedgerOp, LedgerRevisionRow, LedgerView, M7CassetteFixture, PLAN_HASH_VERSION, PLAN_REVISE_SCHEMA, PLAN_REVISE_TOOL_NAME, PLAN_SCOPE, PLAN_VIEW_SCHEMA, PLAN_VIEW_TOOL_NAME, ParkDisposition, PinLedger, PlanDecisionOrigin, PlanDecisionValue, PlanFoldState, PlanNode, PlanNodeStatus, PlanOp, PlanReviseErrorCode, PlanReviseRequest, PlanReviseResult, PlanRevisionAdmission, PlanRevisionValue, PlanRunnerOptions, PlanSnapshotRef, PlanToolRuntime, PlanViewNode, PlanViewRender, PlanWorking, PlanWriteLock, QueueFailoverDeps, RebaseContext, RebaseEvaluation, RebaseOutcome, RebaseReasonCode, ReuseTransform, RevisionGuards, RevisionGuardsOptions, TaskPlan, TaskSpec, TaskSpecPatch, UnparkPlacement, agentTypeOfRequest, applyAppliedOp, applyDecisionOps, applyPlanEntry, applyTaskSpecPatch, assertPlanHead, assertPlanTransition, boundLedgerRender, buildPlanTools, canonicalLadderOf, canonicalPlanState, cassetteAdapter, chainEffortOf, clampStartTier, decisionOriginOf, depsSatisfied, effectiveDroppedStreak, emptyPlan, emptyPlanFold, engineWith, escalationDecisionKey, executingRungOf, exportLedger, foldLedger, gateVerdictKey, isTerminalPlanStatus, judgePrompt, ladderOfProfile, ladderTriggerOf, ladderVerdictKey, ledgerCapViolation, ledgerOpKey, ledgerSufficiency, normalizeAdaptiveJournal, orchestratePlanned, parkDispositionOf, planDecisionKey, planHash, planRevisionKey, planRunner, promptSpecHashOf, readPlanDecision, readPlanRevision, rebasePlanRevision, recomputePlanReadiness, resolvedByOf, runAmendVsRunningThenCancelAdd, runBadBaseStreakTerminates, runBudgetDeniedRung, runCapFreezeThenFinish, runClaimExclusivityAndChain, runClassStormSingleTurn, runCombinedLoopDescent, runConfigDriftResume, runCrashAfterAppendBeforeEffects, runCrashBetweenCapAndEffects, runCrashBetweenLinkAndRoot, runCrashDuringRevision, runDecomposeMintsChildren, runEscalationStormFrozen, runFinalizeFallbackSynthesized, runGraftPartialSubtree, runHalfEscalatedLadder, runIntraRevisionSelfConflict, runKbPinReplay, runKbRepinExpiry, runLegacyJournalResume, runOscillationBounded, runOscillationFreeze, runOscillationFullReuse, runOscillationGuardTrip, runParkRacesChildCompletion, runParkUnpark, runQueueFailoverDuringForcedFinish, runRaceTimeoutVsLive, runReserveSurvivesRunExhaustion, runRespawnPreservesCounter, runReviseMidRun, runReviseRacingDefaultDecision, runRevisionExhaustion, runRewordedLessonsCollide, runRungRetryLineage, runStallStreakClassesAndPinning, runWorktreeDisposedDegrade, settled, unparkPlacementOf, wouldCreateDepCycle };
1397
+ //#region src/m12-cassettes.d.ts
1398
+ /**
1399
+ * kb-propose-quarantine: injected garbage in a proposal is inert, and
1400
+ * nothing commits during the run.
1401
+ */
1402
+ declare function runKbProposeQuarantine(): Promise<JournalEntry[]>;
1403
+ //#endregion
1404
+ export { AppliedPlanOp, BUDGET, CassetteTurn, DEFAULT_DROPPED_REVISION_LIMIT, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_STALL_REPLAN_CAP, EMPTY_PLAN_HASH, EnginePlanOp, EscalationDebitRow, EscalationDecisionValue, GateVerdictValue, GuardFallback, GuardVerdictValue, GuardsState, JUDGE_VERDICT_SCHEMA, KB_PROPOSE_SCHEMA, KB_PROPOSE_TOOL_NAME, KbProposeInput, LEDGER_APPEND_SCHEMA, LEDGER_APPEND_TOOL_NAME, LEDGER_READ_SCHEMA, LEDGER_READ_TOOL_NAME, LEDGER_RENDER_BUDGET_CHARS, LEDGER_SECTION_CAPS, LadderVerdictValue, LedgerExport, LedgerFact, LedgerLesson, LedgerObservation, LedgerOp, LedgerRevisionRow, LedgerView, M7CassetteFixture, PLAN_HASH_VERSION, PLAN_REVISE_SCHEMA, PLAN_REVISE_TOOL_NAME, PLAN_SCOPE, PLAN_VIEW_SCHEMA, PLAN_VIEW_TOOL_NAME, ParkDisposition, PinLedger, PlanDecisionOrigin, PlanDecisionValue, PlanFoldState, PlanNode, PlanNodeStatus, PlanOp, PlanReviseErrorCode, PlanReviseRequest, PlanReviseResult, PlanRevisionAdmission, PlanRevisionValue, PlanRunnerOptions, PlanSnapshotRef, PlanToolRuntime, PlanViewNode, PlanViewRender, PlanWorking, PlanWriteLock, QueueFailoverDeps, RebaseContext, RebaseEvaluation, RebaseOutcome, RebaseReasonCode, ReuseTransform, RevisionGuards, RevisionGuardsOptions, TaskPlan, TaskSpec, TaskSpecPatch, UnparkPlacement, agentTypeOfRequest, applyAppliedOp, applyDecisionOps, applyPlanEntry, applyTaskSpecPatch, assertPlanHead, assertPlanTransition, boundLedgerRender, buildPlanTools, canonicalLadderOf, canonicalPlanState, cassetteAdapter, chainEffortOf, clampStartTier, decisionOriginOf, depsSatisfied, effectiveDroppedStreak, emptyPlan, emptyPlanFold, engineWith, escalationDecisionKey, executingRungOf, exportLedger, foldLedger, gateVerdictKey, isTerminalPlanStatus, judgePrompt, ladderOfProfile, ladderTriggerOf, ladderVerdictKey, ledgerCapViolation, ledgerOpKey, ledgerSufficiency, normalizeAdaptiveJournal, orchestratePlanned, parkDispositionOf, planDecisionKey, planHash, planRevisionKey, planRunner, promptSpecHashOf, readPlanDecision, readPlanRevision, rebasePlanRevision, recomputePlanReadiness, resolvedByOf, runAmendVsRunningThenCancelAdd, runBadBaseStreakTerminates, runBudgetDeniedRung, runCapFreezeThenFinish, runClaimExclusivityAndChain, runClassStormSingleTurn, runCombinedLoopDescent, runConfigDriftResume, runCrashAfterAppendBeforeEffects, runCrashBetweenCapAndEffects, runCrashBetweenLinkAndRoot, runCrashDuringRevision, runDecomposeMintsChildren, runEscalationStormFrozen, runFinalizeFallbackSynthesized, runGraftPartialSubtree, runHalfEscalatedLadder, runIntraRevisionSelfConflict, runKbPinReplay, runKbProposeQuarantine, runKbRepinExpiry, runLegacyJournalResume, runOscillationBounded, runOscillationFreeze, runOscillationFullReuse, runOscillationGuardTrip, runParkRacesChildCompletion, runParkUnpark, runQueueFailoverDuringForcedFinish, runRaceTimeoutVsLive, runReserveSurvivesRunExhaustion, runRespawnPreservesCounter, runReviseMidRun, runReviseRacingDefaultDecision, runRevisionExhaustion, runRewordedLessonsCollide, runRungRetryLineage, runStallStreakClassesAndPinning, runWorktreeDisposedDegrade, settled, unparkPlacementOf, wouldCreateDepCycle };