@rulvar/core 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 +524 -532
  2. package/dist/index.js +316 -326
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -3,9 +3,7 @@
3
3
  * L0 JSON value domain.
4
4
  *
5
5
  * Everything that enters the journal (entry values, error data, artifacts)
6
- * MUST be JSON-serializable (docs/03-journal-spec.md, section "Two-phase
7
- * entries, dispatch, and the budget ledger"); `Json` is the type-level face
8
- * of that rule.
6
+ * MUST be JSON-serializable; `Json` is the type-level face of that rule.
9
7
  */
10
8
  type Json = null | boolean | number | string | Json[] | {
11
9
  [key: string]: Json;
@@ -26,16 +24,16 @@ type WireError = {
26
24
  data?: Json;
27
25
  };
28
26
  /**
29
- * The closed error-code registry (docs/02, section "Error taxonomy").
27
+ * The closed error-code registry.
30
28
  * 'agent' is carried by the AgentError value projection, not by a
31
29
  * RulvarError subclass.
32
30
  */
33
31
  type ErrorCode = "agent" | "config" | "non_serializable_value" | "script_rejected" | "journal_compat" | "invalid_resolution" | "journal_order_violation" | "plan_invariant" | "replay_plan_hash_mismatch" | "orchestrator_cap_config" | "journal_miss" | "budget_exhausted" | "admission_rejected" | "sandbox_limit" | "lease_held" | "knowledge_cas";
34
- /** docs/02 names the registry type RulvarErrorCode; both names are public. */
32
+ /** An alias for the registry type; both names are public. */
35
33
  type RulvarErrorCode = ErrorCode;
36
34
  /**
37
35
  * Base class for all engine-raised errors. "Retryable" means the engine's
38
- * own retry machinery (RetryPolicy under the journal, docs/04) MAY retry;
36
+ * own retry machinery (RetryPolicy under the journal) MAY retry;
39
37
  * it never means a provider SDK autoretry, which is disabled.
40
38
  */
41
39
  declare abstract class RulvarError extends Error {
@@ -84,12 +82,12 @@ declare class ScriptRejected extends RulvarError {
84
82
  cause?: unknown;
85
83
  });
86
84
  }
87
- /** Sub-code detail of JournalCompatibilityError (docs/03, section "hashVersion"). */
85
+ /** Sub-code detail of JournalCompatibilityError. */
88
86
  type JournalCompatSubCode = "HASH_VERSION_TOO_OLD" | "HASH_VERSION_TOO_NEW";
89
87
  /**
90
88
  * Refusal to open a journal whose hashVersion falls outside the engine's
91
- * support window (docs/03, section "hashVersion"; producers ship in M2).
92
- * The registry code is 'journal_compat'; the docs/03 sub-codes live on
89
+ * support window (producers ship in M2).
90
+ * The registry code is 'journal_compat'; the sub-codes live on
93
91
  * `subCode` and in `data`.
94
92
  */
95
93
  declare class JournalCompatibilityError extends RulvarError {
@@ -119,8 +117,7 @@ declare class JournalCompatibilityError extends RulvarError {
119
117
  }
120
118
  /**
121
119
  * A resolution attempt against an already-closed suspension, rejected under
122
- * the first-closing-wins fold; appends no entry (docs/03, section
123
- * "Suspension and resolutions"; producers ship in M2).
120
+ * the first-closing-wins fold; appends no entry (producers ship in M2).
124
121
  */
125
122
  declare class InvalidResolutionError extends RulvarError {
126
123
  readonly code = "invalid_resolution";
@@ -131,7 +128,7 @@ declare class InvalidResolutionError extends RulvarError {
131
128
  }
132
129
  /**
133
130
  * A breach of the total per-run append order: an unfenced concurrent writer
134
- * or a store violating contract A2 (docs/03, section "Storage SPI").
131
+ * or a store violating contract A2 (https://docs.rulvar.com/guide/stores).
135
132
  */
136
133
  declare class JournalOrderViolation extends RulvarError {
137
134
  readonly code = "journal_order_violation";
@@ -140,7 +137,7 @@ declare class JournalOrderViolation extends RulvarError {
140
137
  cause?: unknown;
141
138
  });
142
139
  }
143
- /** PlanRunner plan-invariant rejection (docs/07; producers ship in M7). */
140
+ /** PlanRunner plan-invariant rejection (producers ship in M7). */
144
141
  declare class PlanInvariantError extends RulvarError {
145
142
  readonly code = "plan_invariant";
146
143
  constructor(message: string, opts?: {
@@ -150,7 +147,7 @@ declare class PlanInvariantError extends RulvarError {
150
147
  }
151
148
  /**
152
149
  * Raised at resume when the refolded plan state disagrees with the
153
- * journaled planHash chain (docs/07; producers ship in M7).
150
+ * journaled planHash chain (producers ship in M7).
154
151
  */
155
152
  declare class ReplayPlanHashMismatch extends RulvarError {
156
153
  readonly code = "replay_plan_hash_mismatch";
@@ -161,8 +158,7 @@ declare class ReplayPlanHashMismatch extends RulvarError {
161
158
  }
162
159
  /**
163
160
  * Invalid orchestrator cap and finalize-reserve configuration, thrown
164
- * before the first LLM call (docs/06, section "Three-layer budget", DEF-7;
165
- * producers ship in M6/M7).
161
+ * before the first LLM call (DEF-7; producers ship in M6/M7).
166
162
  */
167
163
  declare class OrchestratorCapConfigError extends RulvarError {
168
164
  readonly code = "orchestrator_cap_config";
@@ -185,8 +181,7 @@ declare class JournalMissError extends RulvarError {
185
181
  /**
186
182
  * The run budget ceiling blocked further work. The budget guard denial is
187
183
  * a decision entry; ctx primitives throw this as AgentError kind 'budget';
188
- * the run reports outcome 'exhausted', overriding 'error' (docs/06, section
189
- * "Three-layer budget").
184
+ * the run reports outcome 'exhausted', overriding 'error'.
190
185
  */
191
186
  declare class BudgetExhaustedError extends RulvarError {
192
187
  readonly code = "budget_exhausted";
@@ -197,13 +192,12 @@ declare class BudgetExhaustedError extends RulvarError {
197
192
  }
198
193
  /**
199
194
  * A structural admission rejection (maxDepth, maxChildrenPerNode,
200
- * maxTotalSpawns) from the AdmissionController (docs/07, section
201
- * "AdmissionController"; M6-T06). The rejection verdict is embedded in
195
+ * maxTotalSpawns) from the AdmissionController (M6-T06). The rejection verdict is embedded in
202
196
  * the carrying spawn-admission decision entry and replays identically;
203
197
  * the error surfaces the embedded AdmitRejectReason in `data` to the
204
198
  * caller (a typed tool error for orchestrators) and MUST NOT tear down
205
199
  * the run. Budget-code rejections throw BudgetExhaustedError instead,
206
- * keeping the docs/06 5.7 exhaustion semantics.
200
+ * keeping the budget exhaustion semantics (https://docs.rulvar.com/guide/budgets).
207
201
  */
208
202
  declare class AdmissionRejectedError extends RulvarError {
209
203
  readonly code = "admission_rejected";
@@ -213,8 +207,8 @@ declare class AdmissionRejectedError extends RulvarError {
213
207
  });
214
208
  }
215
209
  /**
216
- * A WorkerSandboxRunner resource-limit breach (docs/06, section 8.2;
217
- * M6-T02): crossing timeoutMs or memoryMb terminates the worker and the
210
+ * A WorkerSandboxRunner resource-limit breach (M6-T02): crossing
211
+ * timeoutMs or memoryMb terminates the worker and the
218
212
  * run completes with outcome 'error' carrying this error's WireError
219
213
  * projection; `data` records { reason: 'timeout' | 'memory', limit }.
220
214
  * The class itself is never journaled as an entry of its own.
@@ -228,8 +222,7 @@ declare class SandboxError extends RulvarError {
228
222
  }
229
223
  /**
230
224
  * acquire() on a currently held lease. Retryable by contract: retry after
231
- * the lease ttl elapses or the holder releases (docs/03, section
232
- * "Storage SPI").
225
+ * the lease ttl elapses or the holder releases.
233
226
  */
234
227
  declare class LeaseHeldError extends RulvarError {
235
228
  readonly code = "lease_held";
@@ -241,8 +234,7 @@ declare class LeaseHeldError extends RulvarError {
241
234
  /**
242
235
  * commit() on a ModelKnowledgeStore against a snapshot version that is
243
236
  * no longer current. Retryable by contract: re-read current(), rebase
244
- * the ops, commit again, mirroring the lease fencing discipline
245
- * (docs/05, section "Commit discipline").
237
+ * the ops, commit again, mirroring the lease fencing discipline.
246
238
  */
247
239
  declare class KnowledgeCasError extends RulvarError {
248
240
  readonly code = "knowledge_cas";
@@ -252,8 +244,8 @@ declare class KnowledgeCasError extends RulvarError {
252
244
  });
253
245
  }
254
246
  /**
255
- * The vendored Standard Schema issue shape (docs/06, section "Canonical Ctx
256
- * interface"): validation issues carried on AgentError and surfaced to the
247
+ * The vendored Standard Schema issue shape: validation issues carried
248
+ * on AgentError and surfaced to the
257
249
  * model during bounded schema re-prompts.
258
250
  */
259
251
  type Issue$1 = {
@@ -264,8 +256,7 @@ type Issue$1 = {
264
256
  };
265
257
  /**
266
258
  * The structured error value carried on AgentResult.error and journaled
267
- * inside the agent terminal entry. Deliberately NOT a RulvarError subclass
268
- * (docs/02, section "Error taxonomy").
259
+ * inside the agent terminal entry. Deliberately NOT a RulvarError subclass.
269
260
  */
270
261
  type AgentError = {
271
262
  kind: "transport" | "rate-limit" | "schema-mismatch" | "tool" | "budget" | "terminal";
@@ -275,8 +266,8 @@ type AgentError = {
275
266
  };
276
267
  /**
277
268
  * Projects an AgentError to its WireError form: code 'agent', with kind,
278
- * retryAfterMs, and issues carried in data (docs/02, section "Error
279
- * taxonomy"). Issue paths are flattened to JSON-safe segments.
269
+ * retryAfterMs, and issues carried in data. Issue paths are flattened to
270
+ * JSON-safe segments.
280
271
  */
281
272
  declare function agentErrorToWire(error: AgentError, message: string): WireError;
282
273
  /**
@@ -290,14 +281,12 @@ type Role = "system" | "user" | "assistant" | "tool";
290
281
  /**
291
282
  * Engine-minted ULID identifying a tool call across providers. The library,
292
283
  * not the provider, mints tool-call ids; each adapter keeps a bijective map
293
- * between canonical ids and wire ids (toolu_* / call_*) in both directions
294
- * (docs/04, section "Canonical tool-call ids").
284
+ * between canonical ids and wire ids (toolu_* / call_*) in both directions.
295
285
  */
296
286
  type CanonicalId = string;
297
287
  /**
298
288
  * Returns a per-engine minter of CanonicalId values. Monotonic within the
299
- * factory instance; never a module-level singleton (docs/02, section
300
- * "Dependency rules": no module state).
289
+ * factory instance; never a module-level singleton (no module state).
301
290
  */
302
291
  declare function createCanonicalIdMinter(options?: {
303
292
  now?: () => number;
@@ -312,8 +301,7 @@ interface Msg {
312
301
  * The canonical part union. provider-raw parts carry opaque provider blocks
313
302
  * that must survive round trips (thinking blocks with signatures, reasoning
314
303
  * items including encrypted_content). Retention is unconditional; dropping
315
- * happens only in projection, never in retention (docs/04, section
316
- * "Messages and parts").
304
+ * happens only in projection, never in retention.
317
305
  */
318
306
  type Part = {
319
307
  type: "text";
@@ -340,16 +328,14 @@ type Part = {
340
328
  };
341
329
  /**
342
330
  * A JSON Schema document (draft 2020-12) as plain JSON data. Canonical
343
- * serialization and hashing rules live with the KeyDeriver (docs/03,
344
- * section "schemaHash and toolsetHash derivation").
331
+ * serialization and hashing rules live with the KeyDeriver.
345
332
  */
346
333
  type JsonSchema = {
347
334
  [key: string]: unknown;
348
335
  };
349
336
  /**
350
337
  * The identity-bearing tool contract: exactly what the model sees and
351
- * exactly what toolsetHash hashes. Never contains execute or any closure
352
- * (docs/08, section "Tool definition and toolsetHash").
338
+ * exactly what toolsetHash hashes. Never contains execute or any closure.
353
339
  */
354
340
  interface ToolContract {
355
341
  name: string;
@@ -364,7 +350,7 @@ type ToolChoice = "auto" | "none" | "required" | {
364
350
  };
365
351
  /**
366
352
  * Canonical effort: exactly five levels, a string-literal union, never a TS
367
- * enum (docs/04, section "Canonical effort"). OpenAI 'none' has no
353
+ * enum. OpenAI 'none' has no
368
354
  * canonical equivalent and is reachable only via providerOptions.
369
355
  */
370
356
  type Effort = "low" | "medium" | "high" | "xhigh" | "max";
@@ -372,7 +358,7 @@ type CacheTtl = "5m" | "1h";
372
358
  /**
373
359
  * Provider-neutral declaration of intended prompt-cache boundaries.
374
360
  * Transport-level cost optimization only: MUST NOT enter IdentityInput and
375
- * MUST NOT change response semantics (docs/04, section "cacheHint").
361
+ * MUST NOT change response semantics.
376
362
  */
377
363
  interface CacheHint {
378
364
  /** Desired cache boundaries, ordered from shallowest to deepest prefix. */
@@ -388,8 +374,7 @@ interface CacheHint {
388
374
  * top_p, top_k) are deliberately absent from the first-class surface: both
389
375
  * first-class providers reject them on current reasoning models; where a
390
376
  * target legitimately supports them they travel through the adapter's
391
- * providerOptions namespace, subject to caps scrubbing (docs/04, section
392
- * "ChatRequest").
377
+ * providerOptions namespace, subject to caps scrubbing.
393
378
  */
394
379
  interface ChatRequest {
395
380
  /** Wire model id: the segment after 'adapterId:' in ModelRef. */
@@ -410,8 +395,7 @@ interface ChatRequest {
410
395
  * adapter MUST read only its own namespace and MUST ignore unknown
411
396
  * namespaces without error. Canonical fields always win where both
412
397
  * express the same thing; a namespaced option silently contradicting a
413
- * canonical field is a typed ConfigError (docs/04, section
414
- * "providerOptions and providerMetadata namespacing").
398
+ * canonical field is a typed ConfigError.
415
399
  */
416
400
  providerOptions?: Record<string, Record<string, unknown>>;
417
401
  }
@@ -419,7 +403,7 @@ interface ChatRequest {
419
403
  * Usage under the Usage invariant: inputTokens is the FULL prompt size
420
404
  * including cache reads and cache writes. Adapters MUST normalize
421
405
  * provider-reported usage to satisfy this invariant, and the core verifies
422
- * it at the adapter boundary (docs/04, section "Usage invariant").
406
+ * it at the adapter boundary.
423
407
  */
424
408
  type Usage = {
425
409
  inputTokens: number;
@@ -441,7 +425,7 @@ interface RefusalInfo {
441
425
  /**
442
426
  * Typed finish outcomes. A refusal MUST surface as a typed finish outcome
443
427
  * carrying the provider stop details; it MUST NOT be projected to a null
444
- * output silently (docs/04, section "Finish outcomes and typed refusal").
428
+ * output silently.
445
429
  */
446
430
  type FinishInfo = {
447
431
  reason: "stop";
@@ -458,7 +442,7 @@ type FinishInfo = {
458
442
  /**
459
443
  * The single canonical stream-event vocabulary yielded by
460
444
  * ProviderAdapter.stream. Adapters MUST emit exactly one terminal event per
461
- * stream (finish or error) (docs/04, section "ChatEvent stream").
445
+ * stream (finish or error).
462
446
  */
463
447
  type ChatEvent = {
464
448
  type: "text-delta";
@@ -490,13 +474,12 @@ type ChatEvent = {
490
474
  type: "error";
491
475
  error: WireError;
492
476
  };
493
- /** Strictly 'adapterId:model', no query parameters (docs/04, section "Registry and ModelRef"). */
477
+ /** Strictly 'adapterId:model', no query parameters. */
494
478
  type ModelRef = `${string}:${string}`;
495
479
  type InvocationRole = "orchestrate" | "plan" | "loop" | "finalize" | "extract" | "summarize";
496
480
  /**
497
481
  * What authors write wherever a model is configurable: a call override, an
498
- * agent profile, a workflow default, or an engine default (docs/04, section
499
- * "Router and resolution chain").
482
+ * agent profile, a workflow default, or an engine default.
500
483
  */
501
484
  type ModelSpec = ModelRef | ModelChoice | {
502
485
  ladder: LadderSpec;
@@ -505,19 +488,18 @@ interface ModelChoice {
505
488
  model: ModelRef;
506
489
  /** Absent: resolved by the chain, including role effort defaults. */
507
490
  effort?: Effort;
508
- /** Namespaced by adapter id (docs/04, section "providerOptions and providerMetadata namespacing"). */
491
+ /** Namespaced by adapter id. */
509
492
  providerOptions?: Record<string, Record<string, unknown>>;
510
- /** Transport-failure failover list; never enters identity (docs/04, section "RetryPolicy and failover"). */
493
+ /** Transport-failure failover list; never enters identity. */
511
494
  fallbacks?: ModelRef[];
512
495
  }
513
496
  /**
514
497
  * Identity-facing canonical form of a RESOLVED model request; the value
515
- * that enters AgentIdentityInput.modelSpec (docs/03, section "Identity
516
- * model"). providerOptions and fallbacks NEVER enter this form: they are
498
+ * that enters AgentIdentityInput.modelSpec.
499
+ * providerOptions and fallbacks NEVER enter this form: they are
517
500
  * delivery options, excluded from identity exactly like label, phase,
518
501
  * onError, retry, and replay. `effort` is absent exactly when no layer of
519
- * the chain and no role effort default resolves one (docs/04, section
520
- * "Router and resolution chain").
502
+ * the chain and no role effort default resolves one.
521
503
  */
522
504
  type CanonicalModelSpec = {
523
505
  kind: "model";
@@ -530,7 +512,7 @@ type CanonicalModelSpec = {
530
512
  type TriggerClass = "error" | "limit" | "schema-exhausted" | "verify-failed" | "no-progress";
531
513
  /**
532
514
  * Ladder acceptance gates. Spot-check sibling selection is strictly via
533
- * ctx.random, never Math.random (docs/04, section "ModelLadder summary").
515
+ * ctx.random, never Math.random.
534
516
  */
535
517
  type Gate = {
536
518
  kind: "mechanical";
@@ -544,7 +526,7 @@ type Gate = {
544
526
  };
545
527
  /**
546
528
  * The author-facing ladder declaration. This is the SINGLE declaration of
547
- * the ladder family: docs/07 references it and never redeclares (runtime
529
+ * the ladder family: other layers reference it and never redeclare (runtime
548
530
  * semantics land in M7).
549
531
  */
550
532
  interface LadderSpec {
@@ -570,7 +552,7 @@ interface CanonicalLadderSpec {
570
552
  maxCostUsd?: number;
571
553
  memoizeOutcome?: boolean;
572
554
  }>;
573
- /** After clamping of any orchestrator model_hint (docs/07). */
555
+ /** After clamping of any orchestrator model_hint. */
574
556
  startTier: number;
575
557
  escalateOn: TriggerClass[];
576
558
  acceptance?: Gate[];
@@ -581,29 +563,27 @@ interface CanonicalLadderSpec {
581
563
  * Versions the ENTIRE identity and replay pipeline as one unit: canonical
582
564
  * JSON algorithm, identity field sets, hash function, schema/toolset hash
583
565
  * derivation, scope grammar and ordinal rules, replay predicate, fold
584
- * defaults, and the kind/status vocabularies (docs/03, section
585
- * "hashVersion").
566
+ * defaults, and the kind/status vocabularies.
586
567
  */
587
568
  type HashVersion = number;
588
569
  /** 1 = round 1; 2 = current. */
589
570
  declare const CURRENT_HASH_VERSION: HashVersion;
590
571
  /**
591
- * The single kinds registry v2 (docs/03, section "Kinds registry v2").
572
+ * The single kinds registry v2.
592
573
  * Readers MUST tolerate unknown kinds; stores pass them through
593
574
  * byte-for-byte (obligation A4).
594
575
  */
595
576
  type EntryKind = "agent" | "step" | "child" | "external" | "approval" | "rand" | "decision" | "plan.revision" | "plan.decision" | "ledger.op" | "resolution" | "abandon" | "node.link" | "termination.init" | "termination.denied";
596
577
  /**
597
578
  * The stored status vocabulary, exactly. 'skipped' is DELIBERATELY absent:
598
- * it is a derived fold status, never persisted (docs/03, section "Stored
599
- * status vocabulary").
579
+ * it is a derived fold status, never persisted.
600
580
  */
601
581
  type EntryStatus = "running" | "ok" | "error" | "limit" | "suspended" | "cancelled" | "escalated";
602
- /** The canonical EntryRef between entries is seq (docs/03, section "Full entry identity"). */
582
+ /** The canonical EntryRef between entries is seq. */
603
583
  type EntryRef = number;
604
- /** The journaled by-source of a resolution (docs/03, section 8.6 mapping table). */
584
+ /** The journaled by-source of a resolution. */
605
585
  type ResolutionBy = "external" | "timeout" | "class_decision" | "operator" | "quiescence" | "engine_fallback";
606
- /** Payload of resolution ref-entries (docs/03, section 8.6; DEF-4). */
586
+ /** Payload of resolution ref-entries (DEF-4). */
607
587
  type ResolutionPayload = {
608
588
  /** Duplicates ref for self-description. */target: number;
609
589
  by: ResolutionBy; /** awaitExternal resolution / EscalationDecision / WakeDigest. */
@@ -612,7 +592,7 @@ type ResolutionPayload = {
612
592
  logicalTaskId?: string; /** Only on escalation resolutions (DEF-3, M7). */
613
593
  countsAgainstLimit?: boolean;
614
594
  };
615
- /** Payload of abandon ref-entries (docs/03, section 8.6; DEF-4/DEF-5). */
595
+ /** Payload of abandon ref-entries (DEF-4/DEF-5). */
616
596
  type AbandonPayload = {
617
597
  /** Seq of the abandoned branch's spawn entry. */target: number; /** Seq of the plan.revision or decision entry sanctioning it. */
618
598
  authorizedBy: number;
@@ -623,7 +603,7 @@ type AbandonPayload = {
623
603
  retainWorktree?: boolean;
624
604
  };
625
605
  /**
626
- * Final entry form (hashVersion 2; docs/03, section "JournalEntry form").
606
+ * Final entry form (hashVersion 2).
627
607
  * All journaled values MUST be JSON-serializable; a violation raises a
628
608
  * typed NonSerializableValueError at the call site. append is serialized
629
609
  * by a per-run queue.
@@ -652,21 +632,20 @@ type JournalEntry = {
652
632
  /**
653
633
  * Terminal agent entries: the Artifact list (worktree patch refs and
654
634
  * inline values); rides the terminal payload so replay reconstructs
655
- * AgentResult.artifacts without live calls (docs/06, section 2.1).
635
+ * AgentResult.artifacts without live calls.
656
636
  */
657
637
  artifacts?: Json;
658
638
  /**
659
639
  * Terminal escalated entries ONLY: the schema-validated
660
640
  * EscalationReport with runtime-filled costToDate and salvage; replay
661
- * synthesizes the byte-identical report from here (docs/03, section
662
- * 5.4; DEF-1).
641
+ * synthesizes the byte-identical report from here (DEF-1).
663
642
  */
664
643
  escalation?: Json; /** Only when kind === 'resolution'. */
665
644
  resolution?: ResolutionPayload; /** Only when kind === 'abandon'. */
666
645
  abandon?: AbandonPayload;
667
646
  /**
668
- * Policy field on agent entries, fixed in the payload at dispatch time
669
- * (docs/03, section "Normative payload schemas"): the M2 predicate reads
647
+ * Policy field on agent entries, fixed in the payload at dispatch
648
+ * time: the M2 predicate reads
670
649
  * the flag from the ENTRY, never from current code. Excluded from
671
650
  * identity like every policy field.
672
651
  */
@@ -676,7 +655,7 @@ type JournalEntry = {
676
655
  startedAt: string;
677
656
  endedAt?: string;
678
657
  };
679
- /** Rand-entry payload (docs/03, section "Normative payload schemas"). */
658
+ /** Rand-entry payload. */
680
659
  type RandPayload = {
681
660
  subtype: "now";
682
661
  value: number;
@@ -691,8 +670,7 @@ type RandPayload = {
691
670
  /**
692
671
  * Round-1 normalization: hashVersion is taken from `hashVersion`, else
693
672
  * from the legacy `v` field, else 1. Stores are never rewritten;
694
- * normalization happens at read (docs/03, section "The single versioning
695
- * mechanism").
673
+ * normalization happens at read.
696
674
  */
697
675
  declare function normalizeEntry(raw: unknown): JournalEntry;
698
676
  //#endregion
@@ -706,8 +684,7 @@ type Lease = {
706
684
  /**
707
685
  * Run-level metadata written by the ENGINE via putMeta as a separate
708
686
  * record, so listRuns never parses payloads. The hashVersion range fields
709
- * are advisory only; the journal is authoritative (docs/03, section
710
- * "RunMeta").
687
+ * are advisory only; the journal is authoritative.
711
688
  */
712
689
  type RunMeta = {
713
690
  runId: string;
@@ -736,8 +713,7 @@ interface JournalStore {
736
713
  /**
737
714
  * Lease capability: acquire on a held lease MUST reject with a typed
738
715
  * LeaseHeldError; renew MUST run at an interval of at most ttl/3; an
739
- * append carrying a stale epoch MUST be rejected and never appear in load
740
- * (docs/03, section "LeasableStore").
716
+ * append carrying a stale epoch MUST be rejected and never appear in load.
741
717
  */
742
718
  interface LeasableStore extends JournalStore {
743
719
  acquire(runId: string, owner: string): Promise<Lease>;
@@ -928,13 +904,12 @@ type SchemaPair<T = unknown> = {
928
904
  /**
929
905
  * The L0 schema contract with exactly three accepted forms: a Standard
930
906
  * Schema (Zod, ArkType, Valibot, ...), a { jsonSchema, validate } pair, or
931
- * a bare JSON Schema literal (docs/08, section "The three forms").
907
+ * a bare JSON Schema literal.
932
908
  */
933
909
  type SchemaSpec<T = unknown> = StandardSchemaV1<unknown, T> | SchemaPair<T> | JsonSchema;
934
910
  /**
935
911
  * Inferred output type per form: the Standard Schema output type; the
936
- * type-guard target of validate(); unknown for a bare JSON Schema
937
- * (docs/08, section "Out<S> inference").
912
+ * type-guard target of validate(); unknown for a bare JSON Schema.
938
913
  */
939
914
  type Out<S> = S extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<S> : S extends {
940
915
  validate: (value: unknown) => value is infer T;
@@ -948,8 +923,7 @@ declare function isStandardSchemaSpec(spec: SchemaSpec): spec is StandardSchemaV
948
923
  /** Form-2 guard: an explicit { jsonSchema, validate } pair. */
949
924
  declare function isSchemaPairSpec(spec: SchemaSpec): spec is SchemaPair;
950
925
  /**
951
- * Derives the JSON Schema of a SchemaSpec (docs/08, section "JSON Schema
952
- * derivation and acceptance rules"). Form 1 projects via the
926
+ * Derives the JSON Schema of a SchemaSpec. Form 1 projects via the
953
927
  * StandardJSONSchemaV1 input() converter, target draft 2020-12 with
954
928
  * draft-07 fallback; a library without the projection is a typed
955
929
  * ConfigError at definition time, never at first call. Transforming
@@ -958,8 +932,7 @@ declare function isSchemaPairSpec(spec: SchemaSpec): spec is SchemaPair;
958
932
  */
959
933
  declare function projectToJsonSchema(spec: SchemaSpec): JsonSchema;
960
934
  /**
961
- * Canonical schema derivation (docs/03, section "schemaHash and
962
- * toolsetHash derivation"): local fragment-only $ref inlined (recursion is
935
+ * Canonical schema derivation: local fragment-only $ref inlined (recursion is
963
936
  * a ConfigError), remote and dynamic references forbidden, annotation
964
937
  * keywords stripped (format retained), reference infrastructure ($defs,
965
938
  * definitions, $anchor) removed once inlined. The result feeds JCS
@@ -968,8 +941,7 @@ declare function projectToJsonSchema(spec: SchemaSpec): JsonSchema;
968
941
  declare function canonicalizeSchema(schema: JsonSchema): JsonSchema;
969
942
  /**
970
943
  * The schemaHash used when no structured-output schema is declared: the
971
- * hash of the canonical `true` schema (docs/03, section "schemaHash and
972
- * toolsetHash derivation").
944
+ * hash of the canonical `true` schema.
973
945
  */
974
946
  declare const EMPTY_SCHEMA_HASH: string;
975
947
  /** The toolsetHash of an empty toolset: the hash of the canonical empty contract array. */
@@ -986,8 +958,7 @@ declare function schemaHashOfSpec(spec: SchemaSpec | undefined): string;
986
958
  * contract tuples (name, description, canonical parameters, version)
987
959
  * sorted by name. Tool description IS part of the contract; schema
988
960
  * annotations inside parameters are not. An absent version participates as
989
- * absent (docs/03, section "schemaHash and toolsetHash derivation";
990
- * docs/08, section "toolsetHash contract").
961
+ * absent.
991
962
  */
992
963
  declare function toolsetHash(contracts: ToolContract[]): string;
993
964
  /** Result of validating a value against a SchemaSpec. */
@@ -999,7 +970,7 @@ type SchemaValidationResult<T = unknown> = {
999
970
  issues: Issue$1[];
1000
971
  };
1001
972
  /**
1002
- * Runtime validation per form (docs/08, section "Runtime validation"):
973
+ * Runtime validation per form:
1003
974
  * form 1 via the Standard Schema's own validate, form 2 via the pair's
1004
975
  * type guard, form 3 via the vendored draft 2020-12 validator. The same
1005
976
  * machinery backs the structured-output tiers of the Agent Runtime.
@@ -1008,8 +979,8 @@ declare function validateSchemaSpec<S extends SchemaSpec>(spec: S, value: unknow
1008
979
  //#endregion
1009
980
  //#region src/l0/spi/provider.d.ts
1010
981
  /**
1011
- * Per-model pricing in USD per million tokens (docs/04, section
1012
- * "Pricing"). The registry's versioned price table wins over adapter-
982
+ * Per-model pricing in USD per million tokens. The registry's
983
+ * versioned price table wins over adapter-
1013
984
  * reported caps.pricing, which is a fallback only.
1014
985
  */
1015
986
  interface Pricing {
@@ -1035,8 +1006,8 @@ interface ProviderAdapter {
1035
1006
  /** Stable adapter id; the left segment of ModelRef. */
1036
1007
  id: string;
1037
1008
  /**
1038
- * Provider family for provider-raw matching and retention (docs/04,
1039
- * section 2.3; committed during M4-T02). Two adapters of the same
1009
+ * Provider family for provider-raw matching and retention (committed
1010
+ * during M4-T02). Two adapters of the same
1040
1011
  * family share retained blocks and projections; default = id.
1041
1012
  */
1042
1013
  provider?: string;
@@ -1050,7 +1021,7 @@ interface ProviderAdapter {
1050
1021
  //#region src/l0/spi/isolation.d.ts
1051
1022
  /**
1052
1023
  * The canonical identity encoding of spawn isolation: this exact value
1053
- * domain enters spawn identity (docs/03, section "Identity model").
1024
+ * domain enters spawn identity.
1054
1025
  * 'readonly' is a determinism and blast-radius declaration, not
1055
1026
  * containment.
1056
1027
  */
@@ -1076,19 +1047,18 @@ interface IsolationProvider {
1076
1047
  //#region src/l0/spi/toolsource.d.ts
1077
1048
  /**
1078
1049
  * Declarative risk metadata on the tool contract. Policy input, not
1079
- * identity: it does NOT enter toolsetHash (docs/08, section "Risk
1080
- * metadata and permission presets").
1050
+ * identity: it does NOT enter toolsetHash.
1081
1051
  */
1082
1052
  type ToolRisk = "read" | "write" | "network" | "execute" | "destructive";
1083
1053
  /**
1084
1054
  * The context handed to execute (and to permission hooks and canUseTool).
1085
1055
  * Deliberately exposes NO spawn primitives: tools are leaves of the
1086
1056
  * call-and-return tree (invariant I3); all spawning flows through Ctx
1087
- * primitives (docs/08, section "ToolContext").
1057
+ * primitives.
1088
1058
  */
1089
1059
  interface ToolContext {
1090
1060
  runId: string;
1091
- /** Tool span in the run > phase > agent > tool hierarchy (docs/09). */
1061
+ /** Tool span in the run > phase > agent > tool hierarchy. */
1092
1062
  spanId: string;
1093
1063
  agent: {
1094
1064
  agentType: string;
@@ -1106,23 +1076,21 @@ interface ToolContext {
1106
1076
  /**
1107
1077
  * Where execute runs. A declared capability consumed by dispatch and
1108
1078
  * policy; only 'inprocess' is enforced in v1, subprocess/container remain
1109
- * declared capability until the executor spec closes (docs/08, section
1110
- * "Executors"; OQ in docs/14).
1079
+ * declared capability while the executor design stays an open question.
1111
1080
  */
1112
1081
  type ToolExecutor = "inprocess" | "subprocess" | "container";
1113
1082
  /**
1114
1083
  * A defined tool. The identity projection is the ToolContract
1115
1084
  * { name, description, parameters, version }: exactly what the model sees
1116
1085
  * and exactly what toolsetHash hashes; execute and every other
1117
- * non-contract field are excluded by construction (docs/08, section
1118
- * "tool() definition and ToolDef").
1086
+ * non-contract field are excluded by construction.
1119
1087
  */
1120
1088
  interface ToolDef<S extends SchemaSpec = SchemaSpec> {
1121
1089
  readonly kind: "tool";
1122
1090
  readonly name: string;
1123
1091
  readonly description: string;
1124
1092
  readonly parameters: S;
1125
- /** Opaque contract version; part of toolsetHash (docs/08, section 1.2). */
1093
+ /** Opaque contract version; part of toolsetHash. */
1126
1094
  readonly version?: string;
1127
1095
  /** Default 'inprocess'. */
1128
1096
  readonly executor: ToolExecutor;
@@ -1139,7 +1107,7 @@ interface ToolSourceSession {
1139
1107
  * The ToolSource seam: tools() yields the source's current ToolDefs. The
1140
1108
  * toolset snapshot for a given agent spawn is captured at spawn time and
1141
1109
  * hashed into the spawn's identity via toolsetHash; a mid-run change MUST
1142
- * NOT mutate an in-flight agent's toolset (docs/08, section "MCP bus").
1110
+ * NOT mutate an in-flight agent's toolset.
1143
1111
  */
1144
1112
  interface ToolSource {
1145
1113
  id: string;
@@ -1149,7 +1117,7 @@ interface ToolSource {
1149
1117
  //#region src/l0/spi/knowledge.d.ts
1150
1118
  /**
1151
1119
  * Task-class vocabulary aligned with the role quality floors vocabulary
1152
- * (docs/04, section "Role quality floors"). Scopeless global statements
1120
+ * (https://docs.rulvar.com/guide/model-routing). Scopeless global statements
1153
1121
  * are inexpressible: every claim binds a taskClass.
1154
1122
  */
1155
1123
  type TaskClass = "code-edit" | "investigation" | "synthesis" | "extraction" | "planning" | "judging" | (string & {});
@@ -1196,7 +1164,7 @@ interface ModelClaim {
1196
1164
  confidence: "high" | "medium" | "low";
1197
1165
  /** ISO date. */
1198
1166
  observedAt: string;
1199
- /** TTL by class and polarity (docs/05, section "Grounding and decay"). */
1167
+ /** TTL by class and polarity (the grounding and decay rules). */
1200
1168
  expiresAt: string;
1201
1169
  /** Honestly best-effort drift signal. */
1202
1170
  modelEpoch?: {
@@ -1269,7 +1237,7 @@ type ClaimOp = {
1269
1237
  reason: "canary-drift";
1270
1238
  };
1271
1239
  /**
1272
- * The SPI seam (docs/05, section "Data model"). commit performs CAS on
1240
+ * The SPI seam. commit performs CAS on
1273
1241
  * the monotonic snapshot version, mirroring the fencing-epoch
1274
1242
  * discipline of LeasableStore; concurrent maintenance commits serialize
1275
1243
  * through CAS rejection and rebase. commit is UNREACHABLE from the
@@ -1282,13 +1250,42 @@ interface ModelKnowledgeStore {
1282
1250
  /**
1283
1251
  * The runtime handle: with propose() deleted from the design and
1284
1252
  * commit absent from this shape, a run has no write path into the
1285
- * cross-run medium at all (docs/05, section "Security", channel 3).
1253
+ * cross-run medium at all.
1286
1254
  */
1287
1255
  type ModelKnowledgeHandle = Pick<ModelKnowledgeStore, "current">;
1256
+ /** The closed trigger vocabulary of kb_propose (phase 3). */
1257
+ type KbProposalTrigger = "error" | "limit" | "schema-exhausted" | "verify-failed" | "no-progress" | "escalation";
1258
+ /**
1259
+ * One orchestrator model-knowledge proposal (phase 3). A proposal is a
1260
+ * run-ledger record, NOT a claim: it lives ONLY in the RunLedger
1261
+ * section modelObservations, is never rendered into any prompt of any
1262
+ * run before the human gate (absolute quarantine, the note included),
1263
+ * and reaches the gate exclusively through LedgerExport. The engine
1264
+ * assembles it from the tier-relative kb_propose payload: the subject
1265
+ * model is resolved by the engine from the referenced lineage's
1266
+ * declared ladder, never named by the orchestrator; evidence must
1267
+ * resolve into the proposing run's own decision entries.
1268
+ */
1269
+ interface KbProposal {
1270
+ subject: {
1271
+ model: ModelRef;
1272
+ effort?: Effort;
1273
+ };
1274
+ taskClass: TaskClass;
1275
+ polarity: "strength" | "weakness";
1276
+ trigger: KbProposalTrigger;
1277
+ evidence: Array<{
1278
+ kind: "journal";
1279
+ runId: string;
1280
+ entryRef: number;
1281
+ }>;
1282
+ /** <=200 chars; not rendered into any prompt before the gate. */
1283
+ note?: string;
1284
+ }
1288
1285
  //#endregion
1289
1286
  //#region src/knowledge/decay.d.ts
1290
1287
  /**
1291
- * The asymmetric TTL table (docs/05, section "Grounding and decay"):
1288
+ * The asymmetric TTL table:
1292
1289
  * a false negative is costlier through lock-in, so weaknesses expire
1293
1290
  * sooner than strengths.
1294
1291
  */
@@ -1304,37 +1301,45 @@ declare const CLAIM_TTL_DAYS: {
1304
1301
  };
1305
1302
  /** Inbox proposals expire after 14 days (reserved for M12 phase 3). */
1306
1303
  declare const INBOX_PROPOSAL_TTL_DAYS = 14;
1307
- /** The docs/05 TTL applied to an observedAt ISO date. */
1304
+ /** The asymmetric TTL applied to an observedAt ISO date. */
1308
1305
  declare function claimExpiry(claimClass: ModelClaim["class"], polarity: ModelClaim["polarity"], observedAt: string): string;
1309
- /** True when the claim steers nothing at `at` (docs/05, read-path filters). */
1306
+ /** True when the claim steers nothing at `at` (the read-path filter). */
1310
1307
  declare function claimExpired(claim: Pick<ModelClaim, "expiresAt">, at: string): boolean;
1311
1308
  /** The TTL state a maintenance view renders per claim. */
1312
1309
  type TtlState = "holds" | "expired";
1313
1310
  declare function ttlState(claim: Pick<ModelClaim, "expiresAt">, at: string): TtlState;
1314
1311
  /**
1315
- * The re-measurement queue (docs/05, section "Grounding and decay"):
1312
+ * The re-measurement queue:
1316
1313
  * expired eval-measured claims that are still ACTIVE. Just a status
1317
1314
  * filter: the next sweep re-measures these subjects; nothing archives
1318
1315
  * them (archiving would empty the queue and hide the decay).
1319
1316
  */
1320
1317
  declare function remeasureQueue(claims: readonly ModelClaim[], at: string): ModelClaim[];
1321
1318
  /**
1322
- * Deprecation maintenance (docs/05: "deprecations, which archive
1323
- * claims, never delete them, so historical runs keep their audit
1324
- * trail"): archive ops for every non-terminal claim of the deprecated
1319
+ * Deprecation maintenance (deprecations archive claims, never delete
1320
+ * them, so historical runs keep their audit trail): archive ops for
1321
+ * every non-terminal claim of the deprecated
1325
1322
  * models. The caller commits them under its own gate-free archive ops.
1326
1323
  */
1327
1324
  declare function archiveDeprecatedModelOps(claims: readonly ModelClaim[], deprecated: readonly ModelRef[]): ClaimOp[];
1328
1325
  //#endregion
1329
1326
  //#region src/knowledge/claims.d.ts
1330
- /** docs/06, Appendix A: KB active-claims cap, default 8 per (model, taskClass). */
1327
+ /**
1328
+ * The typed statement template for a proposal-born claim (phase 3):
1329
+ * assembled over the closed enum vocabulary ONLY, so tool-output text
1330
+ * is unquotable into persistence, and model-free, because a claim
1331
+ * statement renders into the knowledge card's notes layer, which never
1332
+ * leaks model names to the orchestrator.
1333
+ */
1334
+ declare function proposalStatement(proposal: Pick<KbProposal, "taskClass" | "polarity" | "trigger">): string;
1335
+ /** Appendix A: KB active-claims cap, default 8 per (model, taskClass). */
1331
1336
  declare const KB_ACTIVE_CLAIMS_CAP = 8;
1332
- /** docs/05, section "Data model": statement <= 200 chars. */
1337
+ /** The committed data model bound: statement <= 200 chars. */
1333
1338
  declare const CLAIM_STATEMENT_MAX_CHARS = 200;
1334
1339
  interface ClaimValidationOptions {
1335
1340
  /**
1336
- * True on the eval-committer path (the eval-committer gate; docs/05,
1337
- * 5.4). Editorial validation leaves it false and both eval-measured
1341
+ * True on the eval-committer path (the eval-committer gate).
1342
+ * Editorial validation leaves it false and both eval-measured
1338
1343
  * claims and metrics reject. At the op level the GATE decides this
1339
1344
  * flag; the option exists for direct claim-level validation.
1340
1345
  */
@@ -1349,7 +1354,7 @@ declare function claimIssues(claim: ModelClaim, path: string, options?: ClaimVal
1349
1354
  */
1350
1355
  declare function claimOpIssues(op: ClaimOp, index: number): string[];
1351
1356
  /**
1352
- * The commit-time cap (docs/06, Appendix A): active claims per
1357
+ * The commit-time cap (Appendix A): active claims per
1353
1358
  * (model, taskClass) after the batch applies. Supersede chains keep
1354
1359
  * only the head active by construction (applyClaimOps flips the prior
1355
1360
  * to 'superseded'), so a supersede never grows the count.
@@ -1393,9 +1398,9 @@ declare function knowledgeHash(claims: readonly ModelClaim[]): string;
1393
1398
  */
1394
1399
  declare function applyClaimOps(claims: readonly ModelClaim[], ops: readonly ClaimOp[]): ModelClaim[];
1395
1400
  interface FileModelKnowledgeStoreOptions {
1396
- /** Default './rulvar.models.json' (docs/05, section "Data model"). */
1401
+ /** Default './rulvar.models.json'. */
1397
1402
  path?: string;
1398
- /** docs/06, Appendix A: active claims per (model, taskClass); default 8. */
1403
+ /** Active claims per (model, taskClass); default 8. */
1399
1404
  activeClaimsCap?: number;
1400
1405
  }
1401
1406
  declare class FileModelKnowledgeStore implements ModelKnowledgeStore {
@@ -1414,9 +1419,9 @@ declare class FileModelKnowledgeStore implements ModelKnowledgeStore {
1414
1419
  type LogicalTaskId = string;
1415
1420
  /** The closed relation vocabulary of the minting and inheritance table. */
1416
1421
  type LineageRelation = "first" | "respawn" | "rung-retry" | "decompose-child" | "unpark-restart";
1417
- /** approachSig/approachSigCoarse derivation version (docs/03, 10.7). */
1422
+ /** approachSig/approachSigCoarse derivation version. */
1418
1423
  declare const LINEAGE_SIG_VERSION: 1;
1419
- /** Deterministic LTIDs canonized onto legacy journals (docs/03, 10.7). */
1424
+ /** Deterministic LTIDs canonized onto legacy journals. */
1420
1425
  declare const LEGACY_LTID_PREFIX = "legacy:";
1421
1426
  /** The computed lineage record of one spawn-authorizing decision entry. */
1422
1427
  interface LineageRef {
@@ -1434,14 +1439,14 @@ interface LineageRef {
1434
1439
  }
1435
1440
  /**
1436
1441
  * The value-part lineage block embedded in decision entries: the computed
1437
- * LineageRef plus the normalized tag (docs/03, 10.6: the request part
1442
+ * LineageRef plus the normalized tag (the request part
1438
1443
  * holds the RAW proposal; the value part holds what was COMPUTED and is
1439
1444
  * reused byte-exact on replay).
1440
1445
  */
1441
1446
  interface SpawnLineage extends LineageRef {
1442
1447
  approachTag: string;
1443
1448
  }
1444
- /** Attempt outcome classes entering LineageStats (docs/03, 10.3). */
1449
+ /** Attempt outcome classes entering LineageStats. */
1445
1450
  type AttemptOutcomeClass = "ok" | "escalated" | "task-error" | "transient-error" | "no-progress" | "verify-failed" | "limit" | "abandoned";
1446
1451
  /**
1447
1452
  * The pure lineage fold rendered in plan_view and WakeDigest, always
@@ -1484,13 +1489,13 @@ declare const DEFAULT_ESCALATION_LIMITS: EscalationLimits;
1484
1489
  */
1485
1490
  declare function validateEscalationLimits(raw?: Partial<EscalationLimits> | Record<string, unknown>): EscalationLimits;
1486
1491
  /**
1487
- * Approach-tag normalization (docs/03, 10.2): NFC, lowercase, runs of
1492
+ * Approach-tag normalization: NFC, lowercase, runs of
1488
1493
  * non-alphanumerics collapse into a hyphen, truncate to 32 characters; an
1489
1494
  * empty value canonicalizes to 'default'. Prompt prose never enters any
1490
1495
  * signature: rephrasings collide by construction, not by heuristic.
1491
1496
  */
1492
1497
  declare function normalizeApproachTag(raw?: string): string;
1493
- /** The isolation string entering approachSigCoarse (docs/03, 10.3). */
1498
+ /** The isolation string entering approachSigCoarse. */
1494
1499
  declare function canonicalIsolationTag(spec: IsolationSpec | undefined): string;
1495
1500
  /** The identity inputs of the coarse signature (prompt prose excluded). */
1496
1501
  interface ApproachSignatureInputs {
@@ -1502,7 +1507,7 @@ interface ApproachSignatureInputs {
1502
1507
  /**
1503
1508
  * approachSigCoarse = sha256(JCS({ sigVersion, agentType, toolsetHash,
1504
1509
  * schemaHash, isolation })). Feeds the stall detector and the oscillation
1505
- * guard, which keys ACROSS LTID boundaries (docs/07, 3.8).
1510
+ * guard, which keys ACROSS LTID boundaries.
1506
1511
  */
1507
1512
  declare function approachSigCoarse(inputs: ApproachSignatureInputs): string;
1508
1513
  /** approachSig = sha256(JCS({ sigVersion, coarse, approachTag })); keys lessons. */
@@ -1511,7 +1516,7 @@ declare function approachSigOf(coarse: string, tag?: string): string;
1511
1516
  * The deterministic signature inputs assigned to legacy spawns (journals
1512
1517
  * written before lineage existed) and to attempts whose producers did not
1513
1518
  * record signature inputs: stable constants, never wall-clock, so replay
1514
- * canonizes identically on every engine (docs/03, 10.7).
1519
+ * canonizes identically on every engine.
1515
1520
  */
1516
1521
  declare const LEGACY_SIGNATURE_INPUTS: ApproachSignatureInputs;
1517
1522
  /** Classifies one settled root terminal into its attempt outcome class. */
@@ -1520,8 +1525,7 @@ declare function classifyAttemptOutcome(terminal: JournalEntry): AttemptOutcomeC
1520
1525
  * The incremental lineage fold: attempts, escalation debits, stall
1521
1526
  * streaks, single-live-attempt, and legacy canonization, computed from
1522
1527
  * journal entries only. `absorb` is idempotent by seq cursor; every read
1523
- * accepts an optional `uptoSeq` pin so renders stay snapshot-stable
1524
- * (docs/03, 10.4; docs/07, 8.3).
1528
+ * accepts an optional `uptoSeq` pin so renders stay snapshot-stable.
1525
1529
  */
1526
1530
  declare class LineageIndex {
1527
1531
  private readonly attemptsByLtid;
@@ -1551,7 +1555,7 @@ declare class LineageIndex {
1551
1555
  * attempt whose bound key matches (an at-least-once redispatch of the
1552
1556
  * same slot after cancelled/error/limit); else a legacy attempt is
1553
1557
  * canonized with the deterministic 'legacy:' + contentHash LTID
1554
- * (docs/03, 10.7: random ULIDs on replay are forbidden).
1558
+ * (random ULIDs on replay are forbidden).
1555
1559
  */
1556
1560
  private bindRoot;
1557
1561
  private recordEscalation;
@@ -1562,12 +1566,12 @@ declare class LineageIndex {
1562
1566
  * True while the LTID has an unsettled attempt (admitted, dispatched, or
1563
1567
  * redispatched without a terminal), including admits whose decision
1564
1568
  * entries have not landed yet. Backs the single-live-attempt invariant:
1565
- * a competing admit gets `lineage_busy` (docs/03, 10.5).
1569
+ * a competing admit gets `lineage_busy`.
1566
1570
  */
1567
1571
  hasLiveAttempt(logicalTaskId: LogicalTaskId): boolean;
1568
- /** The stall streak per docs/03, 10.4 (pinnable to a snapshot seq). */
1572
+ /** The stall streak (pinnable to a snapshot seq). */
1569
1573
  stallStreak(logicalTaskId: LogicalTaskId, uptoSeq?: number): number;
1570
- /** The pinned LineageStats render (docs/03, 10.3). */
1574
+ /** The pinned LineageStats render. */
1571
1575
  statsOf(logicalTaskId: LogicalTaskId, uptoSeq?: number): LineageStats;
1572
1576
  /** Every LTID the fold has seen (diagnostics and renders). */
1573
1577
  knownLogicalTaskIds(): LogicalTaskId[];
@@ -1581,14 +1585,14 @@ interface AgentIdentityInput {
1581
1585
  /**
1582
1586
  * The REQUESTED model spec, including canonical effort where resolved;
1583
1587
  * for laddered spawns it embeds the declared ladder together with
1584
- * startTier (docs/04, section "Router and resolution chain").
1588
+ * startTier.
1585
1589
  */
1586
1590
  modelSpec: CanonicalModelSpec;
1587
1591
  /** Replaced verbatim by opts.key when opts.key is set. */
1588
1592
  prompt: string;
1589
1593
  schemaHash: string;
1590
1594
  toolsetHash: string;
1591
- /** Canonical encoding per docs/08, section "IsolationSpec". */
1595
+ /** The canonical IsolationSpec encoding (see https://docs.rulvar.com/guide/tools). */
1592
1596
  isolation: IsolationSpec;
1593
1597
  }
1594
1598
  /** Nested workflow spawns: ctx.workflow (kind 'child'). */
@@ -1630,8 +1634,8 @@ type IdentityInput = AgentIdentityInput | ChildIdentityInput | StepIdentityInput
1630
1634
  /**
1631
1635
  * The identity projection of a CanonicalModelSpec. For the plain-model
1632
1636
  * kind the projection is `{ model, effort? }` WITHOUT the kind
1633
- * discriminant, exactly as fixed by the docs/03 section 1.5 worked
1634
- * example; `effort` is omitted when unresolved. The ladder embedding lands
1637
+ * discriminant, exactly as frozen by the hashVersion 2 profile;
1638
+ * `effort` is omitted when unresolved. The ladder embedding lands
1635
1639
  * with ladder execution (M7).
1636
1640
  */
1637
1641
  declare function modelSpecIdentity(spec: CanonicalModelSpec): {
@@ -1651,7 +1655,7 @@ declare function projectIdentity(input: IdentityInput): Record<string, unknown>;
1651
1655
  /** The JCS form of an IdentityInput under the hashVersion 2 profile. */
1652
1656
  declare function identityJcs(input: IdentityInput): string;
1653
1657
  /**
1654
- * key = sha256(JCS(IdentityInput)) (docs/03, section "Content key").
1658
+ * key = sha256(JCS(IdentityInput)).
1655
1659
  */
1656
1660
  declare function deriveContentKey(input: IdentityInput): string;
1657
1661
  //#endregion
@@ -1664,8 +1668,8 @@ interface JournalOperation {
1664
1668
  /**
1665
1669
  * Versioned key derivation for matching: the live call is compared
1666
1670
  * against every unconsumed entry with the key computed UNDER THAT ENTRY'S
1667
- * VERSION; 'incomparable' is a guaranteed non-match (docs/03, section
1668
- * 4.4). M2-T05 supplies the real registry; the default ring knows only
1671
+ * VERSION; 'incomparable' is a guaranteed non-match.
1672
+ * M2-T05 supplies the real registry; the default ring knows only
1669
1673
  * the current version.
1670
1674
  */
1671
1675
  /** A derived key, or the guaranteed non-match marker. */
@@ -1717,7 +1721,7 @@ declare class JournalMatcher {
1717
1721
  private readonly keyRing;
1718
1722
  private disposition;
1719
1723
  private aliasDisposition?;
1720
- /** Scope-prefix aliases (DEF-5, docs/03 9.5): donor prefix -> target prefix. */
1724
+ /** Scope-prefix aliases (DEF-5): donor prefix -> target prefix. */
1721
1725
  private readonly aliases;
1722
1726
  private readonly keyCache;
1723
1727
  private hitsInternal;
@@ -1731,8 +1735,8 @@ declare class JournalMatcher {
1731
1735
  /** M2-T06 swaps in the full DEF-1 predicate after folds are built. */
1732
1736
  setDisposition(disposition: (op: JournalOperation) => OperationDisposition): void;
1733
1737
  /**
1734
- * The disposition applied to alias-sourced candidates (DEF-5, docs/03
1735
- * 9.5): the skipped overlay from abandon is bypassed ONLY through the
1738
+ * The disposition applied to alias-sourced candidates (DEF-5): the
1739
+ * skipped overlay from abandon is bypassed ONLY through the
1736
1740
  * alias, so entries regain their pre-abandon terminal status for
1737
1741
  * matching in the NEW scope; the standalone old scope stays skipped.
1738
1742
  */
@@ -1751,7 +1755,7 @@ declare class JournalMatcher {
1751
1755
  * Forward-matches one live call. A miss does not advance any cursor and
1752
1756
  * does not extinguish future hits: the scan always starts at the scope
1753
1757
  * head and skips consumed operations, so insertion stability holds by
1754
- * construction (docs/03, section 7.1).
1758
+ * construction.
1755
1759
  */
1756
1760
  match(scope: string, identity: IdentityInput, mode: "scoped" | "cache" | "never"): MatchResult;
1757
1761
  /** Marks an operation consumed without matching (fold-driven paths). */
@@ -1764,8 +1768,8 @@ declare class JournalMatcher {
1764
1768
  type CanonicalIdentity = Record<string, unknown>;
1765
1769
  /**
1766
1770
  * Per-effective-status disposition rules; DATA on the profile, consumed
1767
- * only by the single canonical replayDisposition function (docs/03,
1768
- * section 4.2: there is NO replayAction method).
1771
+ * only by the single canonical replayDisposition function (there is NO
1772
+ * replayAction method).
1769
1773
  */
1770
1774
  type DispositionRule = "replay" | "rerun" | "memoize-limit" | "memoize-task-error";
1771
1775
  type DispositionTable = Readonly<Partial<Record<"ok" | "escalated" | "limit" | "error" | "cancelled" | "running", DispositionRule>>>;
@@ -1794,20 +1798,19 @@ declare const deriverV1: KeyDeriver;
1794
1798
  type DeriverRegistry = ReadonlyMap<HashVersion, KeyDeriver>;
1795
1799
  /**
1796
1800
  * Builds the per-engine deriver registry: the shipped v1/v2 profiles plus
1797
- * EngineOptions.extraDerivers, the ONLY window extender (docs/03, section
1798
- * 4.5). A malformed extra deriver is a ConfigError before any run effect.
1801
+ * EngineOptions.extraDerivers, the ONLY window extender. A malformed
1802
+ * extra deriver is a ConfigError before any run effect.
1799
1803
  */
1800
1804
  declare function buildDeriverRegistry(extraDerivers?: readonly unknown[]): DeriverRegistry;
1801
1805
  /**
1802
1806
  * The one compatibility scan: immediately after load, strictly BEFORE any
1803
1807
  * live call, any append, and any admission reserve; repeated at lease
1804
- * acquire in queue mode (docs/03, section 4.5). Side-effect free.
1808
+ * acquire in queue mode. Side-effect free.
1805
1809
  */
1806
1810
  declare function scanJournalCompatibility(runId: string, entries: readonly JournalEntry[], registry: DeriverRegistry): void;
1807
1811
  /**
1808
1812
  * KeyRing over the registry: the live call is projected DOWN into the
1809
- * profile of the stored entry; there is no upward canonization (docs/03,
1810
- * section 4.7).
1813
+ * profile of the stored entry; there is no upward canonization.
1811
1814
  */
1812
1815
  declare function registryKeyRing(registry: DeriverRegistry): KeyRing;
1813
1816
  //#endregion
@@ -1820,12 +1823,12 @@ interface AbandonFold {
1820
1823
  type ErrorClass = "transport" | "task";
1821
1824
  /**
1822
1825
  * task-class: schema-mismatch, terminal, non-retryable tool. transport,
1823
- * rate-limit, and budget are never memoized (docs/03, section 6.4).
1826
+ * rate-limit, and budget are never memoized.
1824
1827
  */
1825
1828
  declare function classifyAgentError(e: AgentError): ErrorClass;
1826
1829
  /**
1827
1830
  * The child scope-prefix an abandon over `target` covers transitively.
1828
- * Agent spawns nest under agent:<seq> (docs/03, section 2.2); a child
1831
+ * Agent spawns nest under agent:<seq>; a child
1829
1832
  * workflow's subtree runs under the wf:<name>:<ordinal> scope recorded in
1830
1833
  * its dispatch payload (M6-T06). A child entry without the payload
1831
1834
  * (foreign journals) degrades to the agent:<seq> convention, which covers
@@ -1836,7 +1839,7 @@ declare function childCoveragePrefix(target: JournalEntry): string;
1836
1839
  * Builds the AbandonFold in ONE pass at load, in append order, pinned for
1837
1840
  * the entire resume (DEF-1 ordering rule 4). Coverage is the target seq
1838
1841
  * itself plus, transitively, every entry under the target's child
1839
- * scope-prefix (docs/03, sections 6.2 and 8.4). Repeated abandons over an
1842
+ * scope-prefix. Repeated abandons over an
1840
1843
  * already-covered target fold to noop.
1841
1844
  */
1842
1845
  declare function buildAbandonFold(entries: readonly JournalEntry[]): AbandonFold;
@@ -1894,7 +1897,7 @@ type SuspensionState = {
1894
1897
  state: "abandoned";
1895
1898
  by: number;
1896
1899
  };
1897
- /** Fold classification of one ref-entry; NEVER persisted (docs/03, section 8.4). */
1900
+ /** Fold classification of one ref-entry; NEVER persisted. */
1898
1901
  type RefEntryClassification = {
1899
1902
  classification: "applied";
1900
1903
  } | {
@@ -1913,7 +1916,7 @@ type RefEntryClassification = {
1913
1916
  * schema-invalid offline resolution classifies invalid and does NOT close
1914
1917
  * the target. Abandon coverage is the target seq plus the transitive
1915
1918
  * child scope-prefix; the AbandonFold consumed by the replay predicate is
1916
- * a projection of THIS fold (docs/03, section 6.2: not a separate pass).
1919
+ * a projection of THIS fold (not a separate pass).
1917
1920
  */
1918
1921
  declare class ResolutionFold {
1919
1922
  private readonly targets;
@@ -1955,8 +1958,8 @@ interface RefEntryAppender {
1955
1958
  }): Promise<JournalEntry>;
1956
1959
  }
1957
1960
  /**
1958
- * Per-run, per-target FIFO serializer of resolution/abandon attempts
1959
- * (docs/03, section 8.5): classification against the in-memory fold ->
1961
+ * Per-run, per-target FIFO serializer of resolution/abandon attempts:
1962
+ * classification against the in-memory fold ->
1960
1963
  * durable append -> settle exactly once; losing attempts are ALSO
1961
1964
  * appended and become journaled noops by fold classification. Winner
1962
1965
  * effects run strictly after the critical section (the caller's job).
@@ -1974,7 +1977,7 @@ declare class ResolutionArbiter {
1974
1977
  //#endregion
1975
1978
  //#region src/journal/replayer.d.ts
1976
1979
  type ReplayMode = "scoped" | "cache" | "never";
1977
- /** docs/06 Appendix A: large-value soft warn threshold (committed for M2). */
1980
+ /** Large-value soft warn threshold (committed for M2). */
1978
1981
  declare const LARGE_VALUE_WARN_BYTES = 262144;
1979
1982
  interface Ledger {
1980
1983
  usage: Usage;
@@ -2009,7 +2012,7 @@ interface TerminalPatch {
2009
2012
  servedBy?: ModelRef;
2010
2013
  transcriptRef?: string;
2011
2014
  checkpointRef?: string;
2012
- /** Terminal agent entries: Artifact list (docs/06, section 2.1). */
2015
+ /** Terminal agent entries: Artifact list. */
2013
2016
  artifacts?: unknown;
2014
2017
  /** Terminal escalated entries: the validated EscalationReport. */
2015
2018
  escalation?: unknown;
@@ -2017,14 +2020,14 @@ interface TerminalPatch {
2017
2020
  * Engine-decided terminal abort classes (the no-progress abort) stamp
2018
2021
  * memoizeOutcome on the TERMINAL entry so the frozen memoize rules
2019
2022
  * replay them on every resume; the running entry keeps the user's
2020
- * policy verbatim (docs/03, section 6.6, M3 amendment).
2023
+ * policy verbatim (M3 amendment).
2021
2024
  */
2022
2025
  memoizeOutcome?: boolean;
2023
2026
  site?: string;
2024
2027
  }
2025
2028
  /**
2026
2029
  * Per-run journal kernel front end. Everything is per instance: no module
2027
- * state anywhere (docs/02, section "Dependency rules").
2030
+ * state anywhere.
2028
2031
  */
2029
2032
  declare class Replayer {
2030
2033
  private readonly runId;
@@ -2047,44 +2050,44 @@ declare class Replayer {
2047
2050
  runId: string;
2048
2051
  store: JournalStore;
2049
2052
  now?: () => number;
2050
- priceUsd?: (servedBy: ModelRef | undefined, usage: Usage) => number | undefined; /** Receives large-value soft warnings (docs/03: never an error). */
2053
+ priceUsd?: (servedBy: ModelRef | undefined, usage: Usage) => number | undefined; /** Receives large-value soft warnings (never an error). */
2051
2054
  onWarn?: (msg: string) => void;
2052
- largeValueWarnBytes?: number; /** The loaded, normalized prior journal (resume; docs/03 section 7). */
2055
+ largeValueWarnBytes?: number; /** The loaded, normalized prior journal (resume). */
2053
2056
  priorEntries?: readonly JournalEntry[];
2054
2057
  keyRing?: KeyRing;
2055
2058
  disposition?: (op: JournalOperation) => OperationDisposition; /** Replay-strict: any live-class match throws JournalMissError. */
2056
2059
  strict?: boolean;
2057
2060
  /**
2058
2061
  * Queue mode: every append carries this lease so a stale holder's
2059
- * writes are rejected by the fencing epoch (docs/03, section 12.3;
2060
- * M8 entry amendment). Absent means the single-writer precondition
2062
+ * writes are rejected by the fencing epoch (M8 entry amendment).
2063
+ * Absent means the single-writer precondition
2061
2064
  * is asserted instead of fenced (the embedded default).
2062
2065
  */
2063
2066
  lease?: Lease;
2064
2067
  });
2065
2068
  /**
2066
- * Forward-matches one live call against the prior journal (docs/03,
2067
- * section 7). Fresh runs always miss; the M2-T06 predicate is injected
2069
+ * Forward-matches one live call against the prior journal. Fresh
2070
+ * runs always miss; the M2-T06 predicate is injected
2068
2071
  * through setDisposition once folds are built.
2069
2072
  */
2070
2073
  match(scope: string, identity: IdentityInput, mode: ReplayMode): MatchResult;
2071
2074
  setDisposition(disposition: (op: JournalOperation) => OperationDisposition): void;
2072
2075
  /**
2073
- * The disposition for alias-sourced candidates (DEF-5, docs/03 9.5):
2076
+ * The disposition for alias-sourced candidates (DEF-5):
2074
2077
  * bypasses the abandon overlay so donor entries regain their
2075
2078
  * pre-abandon terminal status when matched through the alias.
2076
2079
  */
2077
2080
  setAliasDisposition(disposition: (op: JournalOperation) => OperationDisposition): void;
2078
2081
  /**
2079
- * Registers a node.link scope-prefix rewrite (DEF-5, docs/03 9.5):
2082
+ * Registers a node.link scope-prefix rewrite (DEF-5):
2080
2083
  * donorPrefix forward-matches into targetPrefix at every nested level.
2081
2084
  * Idempotent; the alias map is rebuilt by fold on resume.
2082
2085
  */
2083
2086
  registerAlias(donorPrefix: string, targetPrefix: string): void;
2084
2087
  /**
2085
- * invalidate/retry (docs/03, section 6.5): explicit unpinning of a
2088
+ * invalidate/retry: explicit unpinning of a
2086
2089
  * memoized failure; the invalidated entry reruns on this resume. The
2087
- * safety boundary is an open question (docs/14).
2090
+ * safety boundary is an open question.
2088
2091
  */
2089
2092
  invalidate(seq: number): void;
2090
2093
  get invalidatedSeqs(): ReadonlySet<number>;
@@ -2101,15 +2104,15 @@ declare class Replayer {
2101
2104
  abandon?: AbandonPayload;
2102
2105
  }): Promise<JournalEntry>;
2103
2106
  /**
2104
- * Submits a resolution attempt through the per-target FIFO arbiter
2105
- * (docs/03, section 8.7). Losing attempts are journaled noops.
2107
+ * Submits a resolution attempt through the per-target FIFO arbiter.
2108
+ * Losing attempts are journaled noops.
2106
2109
  */
2107
2110
  resolveSuspended(target: number, attempt: ResolutionAttempt): Promise<ResolutionOutcome>;
2108
2111
  abandonBranch(attempt: AbandonAttempt): Promise<ResolutionOutcome>;
2109
- /** Pure fold view, snapshot-pinned (docs/03, section 8.7). */
2112
+ /** Pure fold view, snapshot-pinned. */
2110
2113
  suspensionState(target: number): SuspensionState;
2111
2114
  /**
2112
- * Value size policy (docs/03, section "Normative payload schemas"):
2115
+ * Value size policy:
2113
2116
  * there is NO automatic offload in v1; oversized values warn and
2114
2117
  * proceed. Large artifacts belong in TranscriptStore by reference.
2115
2118
  */
@@ -2120,7 +2123,7 @@ declare class Replayer {
2120
2123
  * Two-phase dispatch: the running entry (kinds agent, step, child).
2121
2124
  * `value` is legal on child dispatches only: the child payload
2122
2125
  * `{ workflow, childScope }` lets the abandon fold compute the child's
2123
- * transitive scope coverage (docs/03, section 8.4; M6-T06). Values
2126
+ * transitive scope coverage (M6-T06). Values
2124
2127
  * never enter identity.
2125
2128
  */
2126
2129
  appendRunning(input: BaseAppend & {
@@ -2137,8 +2140,7 @@ declare class Replayer {
2137
2140
  /** Suspended kinds (external, approval): appended once, closed by ref-entries (M2). */
2138
2141
  appendSuspended(input: SuspendedAppend): Promise<JournalEntry>;
2139
2142
  /**
2140
- * The budget ledger fold (docs/03, section "Budget ledger fold on
2141
- * resume"): usage sums over terminal entries exactly once; agentsSpawned
2143
+ * The budget ledger fold: usage sums over terminal entries exactly once; agentsSpawned
2142
2144
  * counts agent dispatches.
2143
2145
  */
2144
2146
  ledger(): Ledger;
@@ -2174,9 +2176,8 @@ declare const DEFAULT_RETRY_POLICY: RetryPolicy;
2174
2176
  /**
2175
2177
  * Classifies a WireError for the retry engine. Task-class failures are
2176
2178
  * never retryable by construction: adapters mark them retryable: false
2177
- * and this returns undefined. The kind travels in WireError.data.kind
2178
- * (docs/04, section 4.9); anything retryable without a specific kind is
2179
- * transport.
2179
+ * and this returns undefined. The kind travels in WireError.data.kind;
2180
+ * anything retryable without a specific kind is transport.
2180
2181
  */
2181
2182
  declare function retryClassOf(error: WireError): RetryClass | undefined;
2182
2183
  /**
@@ -2191,13 +2192,13 @@ declare function retryDelayMs(policy: RetryPolicy, retryIndex: number, retryAfte
2191
2192
  //#region src/model/failover.d.ts
2192
2193
  /** Transport-level failover triggers; budget is explicitly excluded. */
2193
2194
  type FailoverTrigger = "transport" | "rate-limit";
2194
- /** One resolved failover target (docs/04, section 11.2 rich form). */
2195
+ /** One resolved failover target (rich form). */
2195
2196
  interface FailoverTarget {
2196
2197
  model: ModelRef;
2197
2198
  /** Triggers this target serves; absent = both. */
2198
2199
  on?: FailoverTrigger[];
2199
2200
  }
2200
- /** Normalizes the author-facing ModelChoice.fallbacks list (docs/04, 8.1). */
2201
+ /** Normalizes the author-facing ModelChoice.fallbacks list. */
2201
2202
  declare function normalizeFallbacks(refs: ModelRef[] | undefined): FailoverTarget[];
2202
2203
  /**
2203
2204
  * Maps a retry class to its failover trigger once retries exhaust.
@@ -2211,7 +2212,7 @@ declare function failoverTriggerOf(retryClass: RetryClass | undefined): Failover
2211
2212
  * moves backwards (sticky failover).
2212
2213
  */
2213
2214
  declare function nextFailover(targets: Array<Pick<FailoverTarget, "on">>, trigger: FailoverTrigger, from: number): number | undefined;
2214
- /** The degenerate fallback triggers (docs/04, section 11.3). */
2215
+ /** The degenerate fallback triggers. */
2215
2216
  type FallbackTrigger = "error" | "limit" | "schema-exhausted";
2216
2217
  /** The degenerate fallback field: one agent-level second attempt. */
2217
2218
  interface FallbackField {
@@ -2219,8 +2220,8 @@ interface FallbackField {
2219
2220
  on: FallbackTrigger[];
2220
2221
  }
2221
2222
  /**
2222
- * Classifies a terminal agent outcome for the degenerate fallback
2223
- * (docs/04, 11.3 as amended): schema-mismatch errors are
2223
+ * Classifies a terminal agent outcome for the degenerate fallback:
2224
+ * schema-mismatch errors are
2224
2225
  * 'schema-exhausted'; any other error is 'error'; limit terminals (the
2225
2226
  * no-progress abort included) are 'limit'; cancelled, escalated, and
2226
2227
  * skipped never trigger.
@@ -2325,8 +2326,7 @@ declare function decodeCheckpoint(blob: Uint8Array): CheckpointState | undefined
2325
2326
  //#region src/model/router.d.ts
2326
2327
  /**
2327
2328
  * Per-engine adapter registry: strictly per engine, no global mutable
2328
- * registry exists. A duplicate adapterId is a typed ConfigError
2329
- * (docs/04, section "Registry and ModelRef").
2329
+ * registry exists. A duplicate adapterId is a typed ConfigError.
2330
2330
  */
2331
2331
  declare function buildAdapterRegistry(adapters: ProviderAdapter[]): ReadonlyMap<string, ProviderAdapter>;
2332
2332
  /**
@@ -2339,12 +2339,10 @@ declare function parseModelRef(ref: ModelRef): {
2339
2339
  model: string;
2340
2340
  };
2341
2341
  /**
2342
- * Role effort defaults (docs/04, section "Invocation roles and firing
2343
- * protocol"): orchestrate and plan default to high; summarize and extract
2342
+ * Role effort defaults: orchestrate and plan default to high; summarize and extract
2344
2343
  * default to low. loop and finalize have NO role default: when the chain
2345
2344
  * resolves nothing, the wire omits effort and identity records the spec
2346
- * with the effort member absent (docs/04, section "Router and resolution
2347
- * chain", as amended).
2345
+ * with the effort member absent.
2348
2346
  */
2349
2347
  declare const ROLE_EFFORT_DEFAULTS: Partial<Record<InvocationRole, Effort>>;
2350
2348
  /** One layer's contribution to the resolution merge. */
@@ -2374,7 +2372,7 @@ interface ResolvedInvocation {
2374
2372
  requestedEffort?: Effort;
2375
2373
  providerOptions?: Record<string, Record<string, unknown>>;
2376
2374
  fallbacks?: ModelRef[];
2377
- /** Identity-facing canonical form (docs/04, section "Router and resolution chain"). */
2375
+ /** Identity-facing canonical form. */
2378
2376
  canonical: CanonicalModelSpec;
2379
2377
  scrubs: ScrubNote[];
2380
2378
  }
@@ -2382,7 +2380,7 @@ interface ResolvedInvocation {
2382
2380
  * Resolution runs on every model invocation, not once per agent: a layered
2383
2381
  * merge of { model, effort, providerOptions, fallbacks } in the order call
2384
2382
  * override > agent profile > workflow defaults > engine defaults, with the
2385
- * invocation role attached as a tag (docs/04, section "Resolution chain").
2383
+ * invocation role attached as a tag.
2386
2384
  * After resolution the router reads ModelCaps and scrubs illegal
2387
2385
  * parameters visibly: unsupported effort is removed from the wire but
2388
2386
  * kept in identity; sampling params rejected by the model are removed
@@ -2399,7 +2397,7 @@ declare function resolveModelInvocation(options: {
2399
2397
  taskClass?: string;
2400
2398
  }): ResolvedInvocation;
2401
2399
  /**
2402
- * Canonicalizes a declared LadderSpec (docs/04, section 12): validates the
2400
+ * Canonicalizes a declared LadderSpec: validates the
2403
2401
  * shape once (FR-119 judge declaration included) and resolves every rung's
2404
2402
  * effort to an explicit value. `chainEffort` is the effort the resolution
2405
2403
  * chain would contribute at the declaring layer; a rung that resolves no
@@ -2412,16 +2410,16 @@ declare function canonicalizeLadder(spec: LadderSpec, options?: {
2412
2410
  /**
2413
2411
  * The concrete ModelChoice of one rung attempt: each attempt is an
2414
2412
  * ordinary agent scope whose CanonicalModelSpec is that rung's
2415
- * `{ kind: 'model' }` form (docs/04, section 8.2).
2413
+ * `{ kind: 'model' }` form.
2416
2414
  */
2417
2415
  declare function ladderRungChoice(ladder: CanonicalLadderSpec, index: number): ModelChoice;
2418
2416
  //#endregion
2419
2417
  //#region src/runtime/escalation.d.ts
2420
- /** Closed in v1 (docs/07, section 6.3). */
2418
+ /** Closed in v1. */
2421
2419
  type EscalationKind = "scope_bigger" | "scope_different" | "blocked_with_evidence";
2422
2420
  /**
2423
2421
  * Minimal TaskSpec stand-in: the full typed TaskSpec is owned by the
2424
- * PlanRunner surface (docs/07, section 4.1) and ships with M7; script
2422
+ * PlanRunner surface and ships with M7; script
2425
2423
  * modes carry proposals opaquely until then.
2426
2424
  */
2427
2425
  type TaskSpec = Json;
@@ -2483,15 +2481,15 @@ interface EscalationRequest {
2483
2481
  }
2484
2482
  declare const ESCALATE_TOOL_NAME = "escalate";
2485
2483
  /**
2486
- * The exact tool schema of docs/07, section 4.9. costToDate and salvage
2484
+ * The escalate tool's exact request schema. costToDate and salvage
2487
2485
  * MUST NOT appear here: additionalProperties false rejects model-authored
2488
2486
  * values for them at argument validation.
2489
2487
  */
2490
2488
  declare const ESCALATION_REQUEST_SCHEMA: JsonSchema;
2491
- /** The full-report schema applied BEFORE append (docs/03, section 5.4). */
2489
+ /** The full-report schema applied BEFORE append. */
2492
2490
  declare const ESCALATION_REPORT_SCHEMA: JsonSchema;
2493
2491
  /**
2494
- * The engine opt-in tool (docs/08, section 6.6): registered through the
2492
+ * The engine opt-in tool: registered through the
2495
2493
  * same path as any tool under escalation opt-in of EITHER flavor (the
2496
2494
  * worker's only authoring channel for a report), never available without
2497
2495
  * opt-in, and dispatched through the same permission chain. The loop
@@ -2501,7 +2499,7 @@ declare function escalateTool(): ToolDef;
2501
2499
  /** Validates the runtime-completed report BEFORE append; returns issues. */
2502
2500
  declare function validateEscalationReport(report: EscalationReport): Promise<Issue$1[]>;
2503
2501
  /**
2504
- * countsAgainstLimit derivation (docs/07, section 6.3, XF-06): true iff
2502
+ * countsAgainstLimit derivation (XF-06): true iff
2505
2503
  * scope_bigger; scope_different and blocked_with_evidence are exempt and
2506
2504
  * never debit the escalation counter.
2507
2505
  */
@@ -2513,11 +2511,11 @@ declare function countsAgainstLimit(kind: EscalationKind): boolean;
2513
2511
  * journaled as a first-class terminal abort distinct from user
2514
2512
  * cancellation (a cancelled entry always reruns; a no-progress abort
2515
2513
  * must replay, or every resume would re-pay the stuck turns). The
2516
- * interim heuristic is committed in docs/06 Appendix A: N consecutive
2514
+ * interim heuristic is committed: N consecutive
2517
2515
  * turns without tool calls or artifact deltas, N = 3; the broader
2518
- * heuristic stays OQ-15 (docs/14), revisited on dogfood traces.
2516
+ * heuristic stays OQ-15, revisited on dogfood traces.
2519
2517
  *
2520
- * Encoding (docs/03, sections 6.3 and 6.6): the abort is the agent's
2518
+ * Encoding: the abort is the agent's
2521
2519
  * terminal entry with status 'limit', an error payload carrying
2522
2520
  * abortClass 'no-progress', and memoizeOutcome stamped by the ENGINE on
2523
2521
  * the terminal entry, so the frozen memoize-limit rule replays it on
@@ -2525,7 +2523,7 @@ declare function countsAgainstLimit(kind: EscalationKind): boolean;
2525
2523
  * per-turn artifact channel, so the tool-call test subsumes artifact
2526
2524
  * deltas; per-turn artifact producers arrive with M4 compaction.
2527
2525
  */
2528
- /** docs/06 Appendix A: the committed no-progress detector N. */
2526
+ /** The committed no-progress detector N. */
2529
2527
  declare const DEFAULT_NO_PROGRESS_TURNS = 3;
2530
2528
  /** The consumer-visible dedicated class marker (FR-424). */
2531
2529
  type AbortClass = "no-progress";
@@ -2553,8 +2551,7 @@ declare class NoProgressDetector {
2553
2551
  /**
2554
2552
  * UsageLimits (M1-T06): normative limit vocabulary and the per-spawn merge.
2555
2553
  *
2556
- * Owning spec: docs/06-execution-spec.md, section "UsageLimits
2557
- * (normative)"; defaults from Appendix A. Expiry of maxTurns, maxToolCalls,
2554
+ * Full contract: https://docs.rulvar.com/guide/agents. Expiry of maxTurns, maxToolCalls,
2558
2555
  * or timeoutMs produces the terminal status 'limit' (paid partial work);
2559
2556
  * streamIdleTimeoutMs expiry is a retryable transport-class AgentError,
2560
2557
  * never 'limit'. The run-level deadline is RunOptions.deadlineAt, not a
@@ -2572,7 +2569,7 @@ interface UsageLimits {
2572
2569
  /** Gap between stream events; default 120000. */
2573
2570
  streamIdleTimeoutMs?: number;
2574
2571
  /**
2575
- * The no-progress detector N (docs/06 Appendix A, committed at 3):
2572
+ * The no-progress detector N (committed at 3):
2576
2573
  * consecutive turns without tool calls or artifact deltas before the
2577
2574
  * engine aborts with the dedicated class (M3-T08).
2578
2575
  */
@@ -2586,18 +2583,18 @@ interface EffectiveUsageLimits {
2586
2583
  maxOutputTokensPerTurn?: number;
2587
2584
  timeoutMs?: number;
2588
2585
  streamIdleTimeoutMs: number;
2589
- /** Default DEFAULT_NO_PROGRESS_TURNS (docs/06 Appendix A). */
2586
+ /** Default DEFAULT_NO_PROGRESS_TURNS. */
2590
2587
  noProgressTurns?: number;
2591
2588
  }
2592
2589
  /**
2593
2590
  * Limits merge per spawn: AgentOpts.limits over profile limits over engine
2594
- * defaults.limits (docs/06, section "UsageLimits").
2591
+ * defaults.limits.
2595
2592
  */
2596
2593
  declare function mergeUsageLimits(call?: UsageLimits, profile?: UsageLimits, engine?: UsageLimits): EffectiveUsageLimits;
2597
2594
  //#endregion
2598
2595
  //#region src/runtime/agent-loop.d.ts
2599
2596
  type AgentStatus = "ok" | "error" | "limit" | "cancelled" | "skipped" | "escalated";
2600
- /** Artifact: the normative shape of AgentResult.artifacts entries (docs/06, section 2.1). */
2597
+ /** Artifact: the normative shape of AgentResult.artifacts entries. */
2601
2598
  interface Artifact {
2602
2599
  /** Stable within the result. */
2603
2600
  id: string;
@@ -2612,15 +2609,15 @@ interface Artifact {
2612
2609
  /** Inline JSON content for small values. */
2613
2610
  data?: Json;
2614
2611
  }
2615
- /** The verdict of one mechanical acceptance gate evaluation (docs/07, section 10). */
2612
+ /** The verdict of one mechanical acceptance gate evaluation. */
2616
2613
  interface MechanicalGateVerdict {
2617
2614
  pass: boolean;
2618
2615
  detail?: string;
2619
2616
  }
2620
2617
  /**
2621
2618
  * A mechanical acceptance gate: an engine-registered NAMED pure function
2622
- * over AgentResult.artifacts (docs/04, section 12; docs/07, section 10).
2623
- * The registry is per engine like every other registry (docs/02); the
2619
+ * over AgentResult.artifacts.
2620
+ * The registry is per engine like every other registry; the
2624
2621
  * ladder driver journals each evaluation as a decision entry, so the
2625
2622
  * ladder fold consumes only journaled verdicts, never live re-evaluation.
2626
2623
  */
@@ -2641,8 +2638,8 @@ interface AgentResult<T> {
2641
2638
  error?: AgentError;
2642
2639
  /**
2643
2640
  * Human-readable detail behind `error` (provider message, first schema
2644
- * issue): feeds the journaled WireError message. Additive to the
2645
- * docs/06 sketch; never part of identity.
2641
+ * issue): feeds the journaled WireError message. An additive
2642
+ * field; never part of identity.
2646
2643
  */
2647
2644
  errorMessage?: string;
2648
2645
  /** Present if and only if status === 'escalated'. */
@@ -2671,7 +2668,7 @@ interface RuntimeEventSink {
2671
2668
  type: string;
2672
2669
  } & Record<string, unknown>): void;
2673
2670
  }
2674
- /** Budget hooks bound by the three-layer budget (docs/06, section "Three-layer budget"). */
2671
+ /** Budget hooks bound by the three-layer budget. */
2675
2672
  interface BudgetHooks {
2676
2673
  /** Layer 2: before every turn; throws BudgetExhaustedError to block dispatch. */
2677
2674
  beforeTurn(): void;
@@ -2714,7 +2711,7 @@ type PermissionGate = ({
2714
2711
  reason?: string;
2715
2712
  }>;
2716
2713
  }) & {
2717
- /** Chain audit payload ridden into tool:end telemetry (docs/08, 4.5). */audit?: GateAudit;
2714
+ /** Chain audit payload ridden into tool:end telemetry. */audit?: GateAudit;
2718
2715
  };
2719
2716
  /**
2720
2717
  * The spawn's frozen toolset plus the per-call context factory, prepared
@@ -2743,14 +2740,14 @@ interface RunAgentOptions<S extends SchemaSpec = JsonSchema> {
2743
2740
  adapter: ProviderAdapter;
2744
2741
  resolved: ResolvedInvocation;
2745
2742
  /**
2746
- * Transport failover chain for the loop phase (M4-T04; docs/04,
2747
- * section 11.2): resolved fallback targets tried in order on
2743
+ * Transport failover chain for the loop phase (M4-T04):
2744
+ * resolved fallback targets tried in order on
2748
2745
  * transport or rate-limit failures after retries exhaust. Failover is
2749
2746
  * sticky and changes only servedBy, never the content key.
2750
2747
  */
2751
2748
  fallbacks?: PhaseTarget[];
2752
2749
  /**
2753
- * Transport RetryPolicy (M4-T05; docs/04, section 11.1): lives UNDER
2750
+ * Transport RetryPolicy (M4-T05): lives UNDER
2754
2751
  * the journal, wired around every adapter.stream dispatch. sleep and
2755
2752
  * random are injectable for tests; the core owns wall-clock.
2756
2753
  */
@@ -2764,14 +2761,14 @@ interface RunAgentOptions<S extends SchemaSpec = JsonSchema> {
2764
2761
  * under the serving adapter's key; absent = unlimited (Appendix A).
2765
2762
  */
2766
2763
  providerSlot?: <T>(key: string, fn: () => Promise<T>) => Promise<T>;
2767
- /** The resolved toolset; absent = no tools declared (docs/08). */
2764
+ /** The resolved toolset; absent = no tools declared. */
2768
2765
  tools?: ToolRuntime;
2769
2766
  /**
2770
2767
  * Separate final extract invocation, present only when the role trigger
2771
2768
  * protocol demands one: schema set AND (routing directs extract to a
2772
2769
  * different model OR the loop model's caps cannot serve the required
2773
2770
  * tier OR finalize is routed). Otherwise the schema rides the last loop
2774
- * turn (docs/06, section "Agent runtime binding"; the necessity rule is
2771
+ * turn (the necessity rule is
2775
2772
  * decided by the ctx layer via model/roles.ts).
2776
2773
  */
2777
2774
  extract?: PhaseTarget & {
@@ -2792,7 +2789,7 @@ interface RunAgentOptions<S extends SchemaSpec = JsonSchema> {
2792
2789
  /**
2793
2790
  * Summarize invocation target for compaction (M4-T03): resolved
2794
2791
  * through the chain with role 'summarize', falling back to the loop
2795
- * model when routing resolves nothing (docs/06, section 7). Compaction
2792
+ * model when routing resolves nothing. Compaction
2796
2793
  * is ON by default; absence of this option disables it (direct
2797
2794
  * runAgent callers).
2798
2795
  */
@@ -2804,7 +2801,7 @@ interface RunAgentOptions<S extends SchemaSpec = JsonSchema> {
2804
2801
  threshold?: number;
2805
2802
  };
2806
2803
  /**
2807
- * Turn-boundary checkpointing (M3-T02; docs/03, section "Checkpoints").
2804
+ * Turn-boundary checkpointing (M3-T02).
2808
2805
  * load() restores the last boundary on a dangling-dispatch resume;
2809
2806
  * save() persists each boundary where the loop continues. The separate
2810
2807
  * extract invocation is not checkpointed in v1: an extract-phase crash
@@ -2826,7 +2823,7 @@ interface RunAgentOptions<S extends SchemaSpec = JsonSchema> {
2826
2823
  put(ref: string, blob: Uint8Array): Promise<void>;
2827
2824
  };
2828
2825
  priceUsd?: (servedBy: ModelRef, usage: Usage) => number | undefined;
2829
- /** Bounded schema re-prompt attempts; default 2 (docs/06, Appendix A). */
2826
+ /** Bounded schema re-prompt attempts; default 2 (Appendix A). */
2830
2827
  schemaRetryAttempts?: number;
2831
2828
  /** Bounded ModelRetry conversions per tool call chain; default 2 (Appendix A). */
2832
2829
  modelRetryAttempts?: number;
@@ -2834,7 +2831,7 @@ interface RunAgentOptions<S extends SchemaSpec = JsonSchema> {
2834
2831
  * Escalation opt-in (M3-T07): the loop intercepts accepted calls to
2835
2832
  * the escalate tool and terminates with status 'escalated'; the
2836
2833
  * in-run minSpend gate rejects early scope_bigger escalations with a
2837
- * "keep working" error tool result (M3-T09, docs/07 section 6.4).
2834
+ * "keep working" error tool result (M3-T09).
2838
2835
  */
2839
2836
  escalation?: {
2840
2837
  minSpendUsd: number;
@@ -2842,8 +2839,8 @@ interface RunAgentOptions<S extends SchemaSpec = JsonSchema> {
2842
2839
  /**
2843
2840
  * Terminal-tool interception (M6-T07): an accepted call to the named
2844
2841
  * tool ends the loop with status ok; the call's validated `result`
2845
- * argument becomes the agent output (the orchestrator finish tool,
2846
- * docs/07 4.11). The tool's execute never runs, mirroring escalate.
2842
+ * argument becomes the agent output (the orchestrator finish
2843
+ * tool). The tool's execute never runs, mirroring escalate.
2847
2844
  */
2848
2845
  terminalTool?: {
2849
2846
  name: string;
@@ -2868,9 +2865,9 @@ type PermissionHook = (toolName: string, input: unknown, ctx: ToolContext) => Ho
2868
2865
  /**
2869
2866
  * Declarative rule tables (no closures). `'undeclared'` in risk
2870
2867
  * position matches every tool WITHOUT declared risk: presets treat the
2871
- * undeclared state conservatively (docs/08, section 4.3). Argv rules
2872
- * match through the real shell matcher (section 5); domain rules are
2873
- * ADVISORY outside the first-party fetch tool (section 4.4): they never
2868
+ * undeclared state conservatively. Argv rules
2869
+ * match through the real shell matcher; domain rules are
2870
+ * ADVISORY outside the first-party fetch tool: they never
2874
2871
  * change a verdict in M5, and matches surface in audit events.
2875
2872
  */
2876
2873
  type RiskRuleValue = ToolRisk | "undeclared";
@@ -2898,7 +2895,7 @@ interface PermissionConfig {
2898
2895
  canUseTool?: CanUseTool;
2899
2896
  }
2900
2897
  /**
2901
- * Profile-level permissions (docs/08, section "Subagent inheritance").
2898
+ * Profile-level permissions.
2902
2899
  * inheritPermissions governs SUBAGENT inheritance (mode c orchestrators,
2903
2900
  * M6+): children get their own config only unless explicitly opted in.
2904
2901
  * It is carried as data here and consumed by the spawning layers.
@@ -2931,7 +2928,7 @@ type PermissionVerdict = ({
2931
2928
  input: unknown;
2932
2929
  }) & {
2933
2930
  /**
2934
- * Advisory domain-rule matches (docs/08, 4.4): reported in audit
2931
+ * Advisory domain-rule matches: reported in audit
2935
2932
  * events, never enforced outside the first-party fetch tool.
2936
2933
  */
2937
2934
  advisory?: PermissionRule[];
@@ -2939,7 +2936,7 @@ type PermissionVerdict = ({
2939
2936
  /**
2940
2937
  * Merges the engine-wide config and the profile config into one chain.
2941
2938
  * Layers concatenate engine-first; since rules only deny or ask, ordering
2942
- * within a layer cannot change the verdict (docs/08, section 4.2). The
2939
+ * within a layer cannot change the verdict. The
2943
2940
  * profile's canUseTool wins over the engine's (a single slot by
2944
2941
  * construction). A declared preset compiles INTO the same layers, after
2945
2942
  * the host-authored rules, never as a fifth layer (M5-T05).
@@ -2947,19 +2944,19 @@ type PermissionVerdict = ({
2947
2944
  declare function compilePermissionChain(engine?: PermissionConfig, profile?: AgentProfilePermissions): CompiledPermissionChain;
2948
2945
  /**
2949
2946
  * Evaluates the chain for one dispatch, or OFFLINE against a
2950
- * hypothetical call by tool name (the dry-run API of docs/08, section
2951
- * 4.5: nothing executes; shells and tests read the verdict, the
2947
+ * hypothetical call by tool name (the dry-run API: nothing executes;
2948
+ * shells and tests read the verdict, the
2952
2949
  * deciding layer, and the matched rule). Hooks run in deterministic
2953
2950
  * registration order; { modifiedInput } substitutes the input and
2954
2951
  * continues; the first decisive verdict wins. The returned input is what
2955
- * execute receives and what the approval identity hashes (docs/03,
2956
- * section 1.2: post hook modification). Advisory domain-rule matches
2957
- * ride every verdict for the audit payload (docs/08, 4.4).
2952
+ * execute receives and what the approval identity hashes (post hook
2953
+ * modification). Advisory domain-rule matches
2954
+ * ride every verdict for the audit payload.
2958
2955
  */
2959
2956
  declare function evaluatePermission(chain: CompiledPermissionChain, tool: string | Pick<ToolDef, "name" | "needsApproval" | "risk">, input: unknown, ctx?: ToolContext): Promise<PermissionVerdict>;
2960
2957
  //#endregion
2961
2958
  //#region src/tools/toolset-hash.d.ts
2962
- /** The per-spawn tools option value domain (docs/06, section "ctx.agent and AgentOpts"). */
2959
+ /** The per-spawn tools option value domain. */
2963
2960
  type ToolsOption = ReadonlyArray<ToolDef | ToolSource | string>;
2964
2961
  /** The spawn's frozen toolset snapshot plus its identity hash. */
2965
2962
  interface ResolvedToolset {
@@ -2971,13 +2968,13 @@ interface ResolvedToolset {
2971
2968
  declare function emptyToolset(): ResolvedToolset;
2972
2969
  /**
2973
2970
  * Expands sources, validates every tool name and duplicate names across
2974
- * the whole toolset (ConfigError at spawn time; docs/08 sections 1.1 and
2975
- * 6.4), and computes the toolsetHash over contracts sorted by name.
2971
+ * the whole toolset (ConfigError at spawn time), and computes the
2972
+ * toolsetHash over contracts sorted by name.
2976
2973
  */
2977
2974
  declare function resolveToolset(specs: ToolsOption | undefined, session: ToolSourceSession): Promise<ResolvedToolset>;
2978
2975
  //#endregion
2979
2976
  //#region src/journal/termination.d.ts
2980
- /** The frozen limits vector written into termination.init (docs/07, 11.2). */
2977
+ /** The frozen limits vector written into termination.init. */
2981
2978
  interface TerminationLimits {
2982
2979
  /** V0, default 32; absolute and non-replenishable. */
2983
2980
  maxRevisionsPerRun: number;
@@ -2999,7 +2996,7 @@ interface TerminationLimits {
2999
2996
  /** Appendix A committed defaults for the countable resources. */
3000
2997
  declare const DEFAULT_MAX_REVISIONS_PER_RUN = 32;
3001
2998
  declare const DEFAULT_MAX_TOTAL_SPAWNS = 128;
3002
- /** The countable resource vocabulary (docs/07, 11.5). */
2999
+ /** The countable resource vocabulary. */
3003
3000
  type TerminationResource = "revisionUnits" | "spawnUnits" | "escalationUnits" | "rungs" | "depth";
3004
3001
  interface LineageCounters {
3005
3002
  escalationUnitsRemaining: number;
@@ -3009,7 +3006,7 @@ interface TerminationAccountSnapshot {
3009
3006
  revisionUnitsRemaining: number;
3010
3007
  spawnUnitsRemaining: number;
3011
3008
  perLineage: Record<LogicalTaskId, LineageCounters>;
3012
- /** The variant function, a pure fold over the journal (docs/07, 11.4). */
3009
+ /** The variant function, a pure fold over the journal. */
3013
3010
  phi: number;
3014
3011
  }
3015
3012
  type DebitResult = {
@@ -3020,13 +3017,13 @@ type DebitResult = {
3020
3017
  deniedEntryRef: EntryRef;
3021
3018
  resource: TerminationResource;
3022
3019
  };
3023
- /** The value payload of a termination.init entry (docs/07, 11.6). */
3020
+ /** The value payload of a termination.init entry. */
3024
3021
  interface TerminationInitValue {
3025
3022
  limits: TerminationLimits;
3026
3023
  profileRegistrySnapshotHash: string;
3027
3024
  phiInitial: number;
3028
3025
  }
3029
- /** The value payload of a termination.denied entry (docs/07, 11.6). */
3026
+ /** The value payload of a termination.denied entry. */
3030
3027
  interface TerminationDeniedValue {
3031
3028
  resource: TerminationResource;
3032
3029
  logicalTaskId?: LogicalTaskId;
@@ -3038,7 +3035,7 @@ interface TerminationDeniedValue {
3038
3035
  /**
3039
3036
  * Reads the declared ladder length of one agent profile. Ladders are
3040
3037
  * declared through the profile's ModelSpec (`model: { ladder }`, or the
3041
- * loop-role routing entry; docs/04, section 12). The reader is defensive
3038
+ * loop-role routing entry). The reader is defensive
3042
3039
  * so the snapshot is total over every registry shape (an undeclared
3043
3040
  * ladder has length 1: the single implicit rung).
3044
3041
  */
@@ -3048,7 +3045,7 @@ declare function kMaxOf(profiles: Record<string, unknown> | undefined): number;
3048
3045
  /**
3049
3046
  * The deterministic profile-registry snapshot hash frozen inside
3050
3047
  * termination.init: profile names mapped to their declared ladder
3051
- * lengths, canonical JSON, sha256 (docs/07, 11.6).
3048
+ * lengths, canonical JSON, sha256.
3052
3049
  */
3053
3050
  declare function profileRegistrySnapshotHash(profiles: Record<string, unknown> | undefined): string;
3054
3051
  /**
@@ -3059,14 +3056,14 @@ declare function profileRegistrySnapshotHash(profiles: Record<string, unknown> |
3059
3056
  declare function validateTerminationLimits(raw: Partial<TerminationLimits> | Record<string, unknown>): TerminationLimits;
3060
3057
  /** C = E0 + kMax: the per-spawn weight of the variant function. */
3061
3058
  declare function lineageWeightOf(limits: TerminationLimits): number;
3062
- /** Phi0 = V0 + C * S0, finite and fixed in termination.init (docs/07, 11.4). */
3059
+ /** Phi0 = V0 + C * S0, finite and fixed in termination.init. */
3063
3060
  declare function phiInitialOf(limits: TerminationLimits): number;
3064
- /** Builds the termination.init value payload (docs/07, 11.6). */
3061
+ /** Builds the termination.init value payload. */
3065
3062
  declare function buildTerminationInitValue(limits: TerminationLimits, registrySnapshotHash: string): TerminationInitValue;
3066
3063
  /** Reads a termination.init entry's payload; undefined when malformed. */
3067
3064
  declare function readTerminationInit(entry: JournalEntry): TerminationInitValue | undefined;
3068
3065
  /**
3069
- * Config-drift detection at resume (docs/07, 11.2): the journaled vector
3066
+ * Config-drift detection at resume: the journaled vector
3070
3067
  * always wins; every differing field is reported for the
3071
3068
  * `termination:config-drift` event. Dynamic budget top-up via restart is
3072
3069
  * excluded by construction.
@@ -3079,9 +3076,9 @@ declare function terminationConfigDrift(frozen: TerminationLimits, live: Partial
3079
3076
  /** Injected appender for termination.denied entries (engine-owned I/O). */
3080
3077
  type TerminationDeniedWriter = (denied: TerminationDeniedValue) => Promise<EntryRef>;
3081
3078
  /**
3082
- * The single per-run TerminationAccount (docs/07, 11.5): debit ONLY. No
3079
+ * The single per-run TerminationAccount: debit ONLY. No
3083
3080
  * credit operation exists by construction; reclaim never replenishes
3084
- * anything (DEF-5 interaction, docs/07 7.3). Live: the engine debits the
3081
+ * anything (DEF-5 interaction). Live: the engine debits the
3085
3082
  * in-memory account, writes the carrying entry with the balance-after,
3086
3083
  * then applies effects. Resume state is rebuilt by TerminationFold from
3087
3084
  * the journal, never from live config.
@@ -3103,7 +3100,7 @@ declare class TerminationAccount {
3103
3100
  */
3104
3101
  bindDeniedWriter(writer: TerminationDeniedWriter): void;
3105
3102
  snapshot(): TerminationAccountSnapshot;
3106
- /** Phi = V + C * S + sum over live lineages (E + R) (docs/07, 11.4). */
3103
+ /** Phi = V + C * S + sum over live lineages (E + R). */
3107
3104
  phi(): number;
3108
3105
  /** The current rung index of a lineage (0 before any raise). */
3109
3106
  rungIndexOf(logicalTaskId: LogicalTaskId): number;
@@ -3111,7 +3108,7 @@ declare class TerminationAccount {
3111
3108
  get spawnUnitsExhausted(): boolean;
3112
3109
  get revisionUnitsRemaining(): number;
3113
3110
  /**
3114
- * The spawn-admission debit (docs/07, 11.3b): minus one spawnUnit for
3111
+ * The spawn-admission debit: minus one spawnUnit for
3115
3112
  * an admitted spawn of ANY origin; a NEW lineage receives E0 escalation
3116
3113
  * units and (K_l - 1) rung transitions in the same atomic step, so the
3117
3114
  * lemma's per-spawn decrease is C - (E0 + K_l - 1) = kMax - K_l + 1,
@@ -3130,7 +3127,7 @@ declare class TerminationAccount {
3130
3127
  resource: "spawnUnits";
3131
3128
  };
3132
3129
  /**
3133
- * The plan_revise debit (docs/07, 11.3a and 11.7): minus one
3130
+ * The plan_revise debit: minus one
3134
3131
  * revisionUnit on EVERY journaled plan.revision, regardless of the op
3135
3132
  * count, guard verdicts, or the auto-rebase outcome; conflict spam is
3136
3133
  * never a free retry.
@@ -3143,7 +3140,7 @@ declare class TerminationAccount {
3143
3140
  resource: "revisionUnits";
3144
3141
  };
3145
3142
  /**
3146
- * The escalation debit (docs/07, 11.3d): minus one escalationUnit of
3143
+ * The escalation debit: minus one escalationUnit of
3147
3144
  * the affected lineage, including EACH lineage of a class-level
3148
3145
  * decision and timeout defaultDecisions. Conditioned on the
3149
3146
  * countsAgainstLimit flag embedded in the decision entry by the caller.
@@ -3156,7 +3153,7 @@ declare class TerminationAccount {
3156
3153
  resource: "escalationUnits";
3157
3154
  };
3158
3155
  /**
3159
- * The ladder-raise debit (docs/07, 11.3c): minus one rung of the
3156
+ * The ladder-raise debit: minus one rung of the
3160
3157
  * lineage; rungIndex is strictly monotone, there are no demotions and
3161
3158
  * no runtime startTier promotion in v1.
3162
3159
  */
@@ -3169,7 +3166,7 @@ declare class TerminationAccount {
3169
3166
  resource: "rungs";
3170
3167
  };
3171
3168
  /**
3172
- * The docs/07 11.5 debit surface: attempts the named resource and, on
3169
+ * The unified debit surface: attempts the named resource and, on
3173
3170
  * underflow, writes `termination.denied` strictly BEFORE resolving with
3174
3171
  * the typed failure (the caller surfaces the error only after this
3175
3172
  * settles). Requires a deniedWriter; pure-fold contexts use the
@@ -3195,10 +3192,10 @@ declare class TerminationAccount {
3195
3192
  private requireLineage;
3196
3193
  private requireLineageId;
3197
3194
  }
3198
- /** The typed error code surfaced after a denied debit (docs/07, 11.3). */
3195
+ /** The typed error code surfaced after a denied debit. */
3199
3196
  declare function exhaustionCodeOf(resource: TerminationResource): string;
3200
3197
  /**
3201
- * The replay fold (docs/07, 11.6): rebuilds the account from
3198
+ * The replay fold: rebuilds the account from
3202
3199
  * termination.init and the debiting decision entries, asserting every
3203
3200
  * embedded balance-after against the recomputation. A divergence raises
3204
3201
  * the typed journal-integrity error at exactly the diverging entry;
@@ -3220,13 +3217,12 @@ type Spend = {
3220
3217
  usage: Usage;
3221
3218
  agentsSpawned: number;
3222
3219
  };
3223
- /** Last resort of the admission reserve formula (docs/06, Appendix A). */
3220
+ /** Last resort of the admission reserve formula. */
3224
3221
  declare const DEFAULT_FLAT_RESERVE_USD = .5;
3225
- /** The run-root account scope (docs/06, section 5.4 scope vocabulary). */
3222
+ /** The run-root account scope. */
3226
3223
  declare const ROOT_ACCOUNT = "run";
3227
3224
  /**
3228
- * The admission reserve for a spawn (docs/06, section "Layer 1: admission
3229
- * before spawn"): opts.estCost, else profile.estCost, else
3225
+ * The admission reserve for a spawn: opts.estCost, else profile.estCost, else
3230
3226
  * price(countTokens(input) + caps.maxOutputTokens), else the engine flat
3231
3227
  * default.
3232
3228
  */
@@ -3237,7 +3233,7 @@ declare function admissionReserveUsd(options: {
3237
3233
  caps?: ModelCaps;
3238
3234
  flatReserveUsd?: number;
3239
3235
  }): number;
3240
- /** Read-only projection of one account (docs/06, section 5.4). */
3236
+ /** Read-only projection of one account. */
3241
3237
  interface BudgetAccountView {
3242
3238
  scope: string;
3243
3239
  ceilingUsd?: number;
@@ -3268,7 +3264,7 @@ declare class RunBudget {
3268
3264
  events?: RuntimeEventSink;
3269
3265
  priceUsd?: (servedBy: ModelRef, usage: Usage) => number | undefined;
3270
3266
  /**
3271
- * The resume ledger fold (docs/03, section 13.3): spend is never
3267
+ * The resume ledger fold: spend is never
3272
3268
  * reset and never double-counted; replayed entries are already inside
3273
3269
  * this seed and add no increments.
3274
3270
  */
@@ -3282,7 +3278,7 @@ declare class RunBudget {
3282
3278
  /** The account chain from `scope` up to and including the root. */
3283
3279
  private chainOf;
3284
3280
  /**
3285
- * Opens a child sub-account under `parentScope` (docs/06, section 5.4).
3281
+ * Opens a child sub-account under `parentScope`.
3286
3282
  * Re-opening an existing scope is the resume roll-forward path: the
3287
3283
  * recorded ceiling wins once and the accumulated state is kept.
3288
3284
  */
@@ -3306,7 +3302,7 @@ declare class RunBudget {
3306
3302
  /**
3307
3303
  * Marks the run exhausted without a ceiling event: the orchestrator
3308
3304
  * finalize fallback maps to outcome 'exhausted' with the synthesized
3309
- * partial value (DEF-7, docs/07 12.4; exhaustion is never null).
3305
+ * partial value (DEF-7; exhaustion is never null).
3310
3306
  */
3311
3307
  markExhausted(): void;
3312
3308
  get committedReserveUsd(): number;
@@ -3316,17 +3312,17 @@ declare class RunBudget {
3316
3312
  * Layer 1: admission before spawn. Blocks when spent + committedReserve
3317
3313
  * has reached the ceiling on ANY account in the ancestor chain of
3318
3314
  * `accountScope`, otherwise commits the reserve along the whole chain.
3319
- * Also enforces the engine lifetime spawn cap (docs/06, "Scheduler").
3315
+ * Also enforces the engine lifetime spawn cap.
3320
3316
  */
3321
3317
  admitSpawn(reserveUsd: number, accountScope?: string): void;
3322
3318
  /**
3323
3319
  * Resume roll-forward: commits a reserve recovered from a journaled
3324
3320
  * spawn-admission decision entry without re-evaluating admission
3325
- * (docs/06, 5.1: reserves are recovered, never re-estimated).
3321
+ * (reserves are recovered, never re-estimated).
3326
3322
  */
3327
3323
  admitRecovered(reserveUsd: number, accountScope?: string): void;
3328
3324
  /**
3329
- * Registers the orchestrator finalize reserve (DEF-7, docs/07 12.2):
3325
+ * Registers the orchestrator finalize reserve (DEF-7):
3330
3326
  * absolute dollars set on the named account AND the run root, so
3331
3327
  * admission never lets any spawn eat the finalization money even
3332
3328
  * against whole-run exhaustion. Kept SEPARATE from committedReserveUsd
@@ -3355,17 +3351,17 @@ declare class RunBudget {
3355
3351
  */
3356
3352
  onUsage(usage: Usage, servedBy: ModelRef, accountScope?: string): void;
3357
3353
  spent(): Spend;
3358
- /** Null when the run has no USD ceiling (docs/06, section "Canonical Ctx interface"). */
3354
+ /** Null when the run has no USD ceiling. */
3359
3355
  remaining(): Spend | null;
3360
3356
  private emitUpdate;
3361
3357
  }
3362
3358
  //#endregion
3363
3359
  //#region src/journal/reuse.d.ts
3364
- /** Kernel contentHash of a spawn root entry (docs/03, 9.2). */
3360
+ /** Kernel contentHash of a spawn root entry. */
3365
3361
  type SpawnKey = string;
3366
- /** Plan-node identity (docs/07, 3.1). */
3362
+ /** Plan-node identity. */
3367
3363
  type NodeId$1 = string;
3368
- /** The rich donor descriptor embedded in reuse verdicts (docs/03, 9.9). */
3364
+ /** The rich donor descriptor embedded in reuse verdicts. */
3369
3365
  interface DonorRef {
3370
3366
  /** Head of the link chain. */
3371
3367
  nodeId: NodeId$1;
@@ -3374,12 +3370,12 @@ interface DonorRef {
3374
3370
  /** Transitive chain, oldest first. */
3375
3371
  chain: NodeId$1[];
3376
3372
  spawnKey: SpawnKey;
3377
- /** Lineage continues through the link (docs/03, 9.6; DEF-3). */
3373
+ /** Lineage continues through the link (DEF-3). */
3378
3374
  logicalTaskId: LogicalTaskId;
3379
3375
  /** Paid under the chain at the verdict snapshot. */
3380
3376
  paidUsd: number;
3381
3377
  }
3382
- /** Graft bootstrap payload (docs/03, 9.9). */
3378
+ /** Graft bootstrap payload. */
3383
3379
  interface GraftBoot {
3384
3380
  /** Retained by the abandon entry, when it was. */
3385
3381
  checkpointRef?: string;
@@ -3387,13 +3383,13 @@ interface GraftBoot {
3387
3383
  eligiblePaidUsd: number;
3388
3384
  worktreePinned: boolean;
3389
3385
  }
3390
- /** Telemetry for a SpawnKey match admitted fresh (docs/03, 9.9). */
3386
+ /** Telemetry for a SpawnKey match admitted fresh. */
3391
3387
  interface DedupNote {
3392
3388
  spawnKey: SpawnKey;
3393
3389
  donorNodeId: NodeId$1;
3394
3390
  reason: "donor_failed" | "no_paid_entries" | "graft_unsafe" | "donor_active";
3395
3391
  }
3396
- /** The reuse block of AdmissionConfig (docs/03, 9.9). */
3392
+ /** The reuse block of AdmissionConfig. */
3397
3393
  interface ReuseConfig {
3398
3394
  /** Default true. */
3399
3395
  enabled?: boolean;
@@ -3401,11 +3397,11 @@ interface ReuseConfig {
3401
3397
  allowGraft?: boolean;
3402
3398
  /** Default 2 (Appendix A). */
3403
3399
  maxOscillationsPerKey?: number;
3404
- /** Optional RevisionGuards trigger on netLostUsd (docs/07, 3.8). */
3400
+ /** Optional RevisionGuards trigger on netLostUsd. */
3405
3401
  maxAbandonedNetUsdFraction?: number;
3406
3402
  }
3407
3403
  declare const DEFAULT_MAX_OSCILLATIONS_PER_KEY = 2;
3408
- /** The consumer-facing reuse mark on results (docs/03, 9.9). */
3404
+ /** The consumer-facing reuse mark on results. */
3409
3405
  interface AgentResultMeta {
3410
3406
  reusedFrom?: {
3411
3407
  nodeId: NodeId$1;
@@ -3414,7 +3410,7 @@ interface AgentResultMeta {
3414
3410
  reclaimedUsd: number;
3415
3411
  };
3416
3412
  }
3417
- /** The node.link entry value (docs/03, 9.5): an ordinary content-keyed effect entry. */
3413
+ /** The node.link entry value: an ordinary content-keyed effect entry. */
3418
3414
  interface NodeLinkValue {
3419
3415
  targetNodeId: NodeId$1;
3420
3416
  /** plan/NewNodeId. */
@@ -3426,19 +3422,19 @@ interface NodeLinkValue {
3426
3422
  spawnKey: SpawnKey;
3427
3423
  logicalTaskId: LogicalTaskId;
3428
3424
  mode: "full" | "graft";
3429
- /** full is shareable, graft is exclusive (docs/03, 9.5). */
3425
+ /** full is shareable, graft is exclusive. */
3430
3426
  claim: "shared" | "exclusive";
3431
3427
  checkpointRef?: string;
3432
3428
  reclaimedUsdAtLink: number;
3433
3429
  donorRootRef: EntryRef;
3434
3430
  }
3435
3431
  /**
3436
- * node.link identity (docs/03, 9.5): sha256 of {kind, spawnKey,
3432
+ * node.link identity: sha256 of {kind, spawnKey,
3437
3433
  * donorScope, targetNodeId}; targetNodeId is deterministic on replay
3438
3434
  * because NodeIds are assigned inside plan.revision.
3439
3435
  */
3440
3436
  declare function nodeLinkKey(spawnKey: SpawnKey, donorScope: string, targetNodeId: NodeId$1): string;
3441
- /** The abandoned-spend ledger fold (docs/03, 9.7). */
3437
+ /** The abandoned-spend ledger fold. */
3442
3438
  interface AbandonedSpendView {
3443
3439
  abandonedUsd: number;
3444
3440
  reclaimedUsd: number;
@@ -3449,7 +3445,7 @@ interface AbandonedSpendView {
3449
3445
  reclaimedUsd: number;
3450
3446
  }>;
3451
3447
  }
3452
- /** One donor candidate surfaced by the DedupIndex fold (docs/03, 9.3). */
3448
+ /** One donor candidate surfaced by the DedupIndex fold. */
3453
3449
  interface DonorCandidate {
3454
3450
  rootEntryRef: EntryRef;
3455
3451
  rootScope: string;
@@ -3471,7 +3467,7 @@ interface DonorCandidate {
3471
3467
  retainedCheckpoint: boolean;
3472
3468
  /** Seq of the exclusive node.link that captured this donor, if any. */
3473
3469
  claimedBy?: EntryRef;
3474
- /** Scope chain for transitive drainage, oldest first (docs/03, 9.6). */
3470
+ /** Scope chain for transitive drainage, oldest first. */
3475
3471
  chain: string[];
3476
3472
  }
3477
3473
  /**
@@ -3493,13 +3489,13 @@ declare class DedupIndex {
3493
3489
  donorsOf(spawnKey: SpawnKey): DonorCandidate[];
3494
3490
  /** Every donor for a key including claimed ones (diagnostics). */
3495
3491
  allDonorsOf(spawnKey: SpawnKey): DonorCandidate[];
3496
- /** Link count per key: the oscillation counter (docs/03, 9.7). */
3492
+ /** Link count per key: the oscillation counter. */
3497
3493
  oscillationCountOf(spawnKey: SpawnKey): number;
3498
3494
  abandonedSpend(): AbandonedSpendView;
3499
3495
  }
3500
3496
  /**
3501
- * The four-outcome verdict evaluation on a SpawnKey match (docs/03,
3502
- * 9.4), computed once live at the fold head and embedded into the
3497
+ * The four-outcome verdict evaluation on a SpawnKey match, computed
3498
+ * once live at the fold head and embedded into the
3503
3499
  * deciding entry; replay never re-evaluates.
3504
3500
  */
3505
3501
  declare function evaluateReuse(index: DedupIndex, spawnKey: SpawnKey, config?: ReuseConfig): {
@@ -3519,7 +3515,7 @@ declare function evaluateReuse(index: DedupIndex, spawnKey: SpawnKey, config?: R
3519
3515
  };
3520
3516
  //#endregion
3521
3517
  //#region src/orchestrator/admission.d.ts
3522
- /** Plan-node identity; engine-minted ULID (docs/07, section 3.1). */
3518
+ /** Plan-node identity; engine-minted ULID. */
3523
3519
  type NodeId = string;
3524
3520
  /** Layer-1 reservation embedded in the carrying decision entry. */
3525
3521
  interface BudgetReserve {
@@ -3534,7 +3530,7 @@ interface AdmitLineage {
3534
3530
  depth: number;
3535
3531
  }
3536
3532
  /**
3537
- * The unified admission verdict (docs/07, section 7.2; XF-11). One union,
3533
+ * The unified admission verdict (XF-11). One union,
3538
3534
  * closed now; every debit is atomic with its carrying decision entry and
3539
3535
  * embeds the balance-after (DEF-2).
3540
3536
  */
@@ -3562,7 +3558,7 @@ type AdmitVerdict = {
3562
3558
  kind: "reject";
3563
3559
  reason: AdmitRejectReason;
3564
3560
  };
3565
- /** The merged reject-code set (docs/07, section 7.2). */
3561
+ /** The merged reject-code set. */
3566
3562
  type AdmitRejectReason = {
3567
3563
  code: "depth" | "quota" | "budget" | "lifetime" | "termination_exhausted" | "ladder_exceeds_frozen" | "lineage_exhausted" | "lineage_busy";
3568
3564
  } | {
@@ -3570,7 +3566,7 @@ type AdmitRejectReason = {
3570
3566
  spawnKey: SpawnKey;
3571
3567
  oscillationCount: number;
3572
3568
  };
3573
- /** Every spawn origin routed through the single admission point (docs/07, 7.1). */
3569
+ /** Every spawn origin routed through the single admission point. */
3574
3570
  type SpawnOrigin = "ctx.workflow" | "ctx.orchestrate" | "spawn_agent" | "parallel_agents" | "escalation-decomposition" | "rung-respawn" | "reuse-link";
3575
3571
  /** What the admission point needs to know about one spawn. */
3576
3572
  interface AdmitSpec {
@@ -3581,24 +3577,24 @@ interface AdmitSpec {
3581
3577
  childScope: string;
3582
3578
  /** The nearest enclosing budget account of the spawner. */
3583
3579
  parentAccountScope: string;
3584
- /** Explicit child budget; clamped by childBudgetFraction (docs/07, 4.1). */
3580
+ /** Explicit child budget; clamped by childBudgetFraction. */
3585
3581
  budgetUsd?: number;
3586
- /** Reserve hint; falls back to the flat engine default (docs/06, 5.1). */
3582
+ /** Reserve hint; falls back to the flat engine default. */
3587
3583
  estCostUsd?: number;
3588
3584
  /**
3589
3585
  * Lineage continuation (DEF-3); absence mints a fresh lineage root. A
3590
3586
  * continuation demands a causeRef: the seq of the entry that caused the
3591
- * rebirth (docs/03, 10.1, rule 2).
3587
+ * rebirth.
3592
3588
  */
3593
3589
  lineage?: SpawnLineageOpt;
3594
- /** Raw approach tag; normalized by the engine (docs/03, 10.2). */
3590
+ /** Raw approach tag; normalized by the engine. */
3595
3591
  approach?: string;
3596
3592
  /** Decomposition parent-LTID chain (relation 'decompose-child' only). */
3597
3593
  ancestry?: LogicalTaskId[];
3598
3594
  /**
3599
3595
  * Coarse-signature identity inputs; unspecified fields canonize onto
3600
3596
  * the deterministic legacy constants so signatures stay byte-stable
3601
- * (docs/03, 10.2; the toolset/schema registries land in M7-T05).
3597
+ * (the toolset/schema registries land in M7-T05).
3602
3598
  */
3603
3599
  signature?: Partial<ApproachSignatureInputs>;
3604
3600
  /**
@@ -3611,7 +3607,7 @@ interface AdmitSpec {
3611
3607
  /**
3612
3608
  * The children-quota key (maxChildrenPerNode); defaults to
3613
3609
  * parentAccountScope. Orchestrators pass their own scope so each node
3614
- * counts its own children (docs/07, 7.3).
3610
+ * counts its own children.
3615
3611
  */
3616
3612
  nodeKey?: string;
3617
3613
  }
@@ -3627,11 +3623,11 @@ interface AdmissionStatsBefore {
3627
3623
  interface AdmissionDecision {
3628
3624
  verdict: AdmitVerdict;
3629
3625
  statsBefore: AdmissionStatsBefore;
3630
- /** Node identity minted inside the decision (docs/07, section 5); absent on reject. */
3626
+ /** Node identity minted inside the decision; absent on reject. */
3631
3627
  nodeId?: NodeId;
3632
3628
  /**
3633
3629
  * The computed value-part lineage block (DEF-3): reused byte-exact on
3634
- * replay, never recomputed (docs/03, 10.6). Absent on reject.
3630
+ * replay, never recomputed. Absent on reject.
3635
3631
  */
3636
3632
  lineage?: SpawnLineage;
3637
3633
  /**
@@ -3667,7 +3663,7 @@ declare class AdmissionController {
3667
3663
  maxDepth?: number;
3668
3664
  maxChildrenPerNode?: number;
3669
3665
  childBudgetFraction?: number;
3670
- flatReserveUsd?: number; /** Per-orchestrate spawn cap (docs/06, 9.3 maxSpawns); engine lifetime cap applies regardless. */
3666
+ flatReserveUsd?: number; /** Per-orchestrate spawn cap (maxSpawns); engine lifetime cap applies regardless. */
3671
3667
  maxTotalSpawns?: number;
3672
3668
  mintId?: () => string;
3673
3669
  /**
@@ -3685,8 +3681,8 @@ declare class AdmissionController {
3685
3681
  /** The validated lineage limits this controller enforces (DEF-3). */
3686
3682
  get escalationLimits(): EscalationLimits;
3687
3683
  /**
3688
- * Binds the run's TerminationAccount (DEF-2; PlanRunner runs only,
3689
- * docs/07 section 1): from bind time on, every admitted spawn of any
3684
+ * Binds the run's TerminationAccount (DEF-2; PlanRunner runs only):
3685
+ * from bind time on, every admitted spawn of any
3690
3686
  * origin debits one spawnUnit atomically with its decision entry, and
3691
3687
  * a declared ladder longer than the frozen kMax rejects with
3692
3688
  * ladder_exceeds_frozen. Non-PlanRunner runs never bind an account and
@@ -3696,7 +3692,7 @@ declare class AdmissionController {
3696
3692
  /** The bound account, when this is a PlanRunner run (DEF-2). */
3697
3693
  get termination(): TerminationAccount | undefined;
3698
3694
  /**
3699
- * The lineage half of admission (DEF-3, docs/03 section 10.5): folds are
3695
+ * The lineage half of admission (DEF-3): folds are
3700
3696
  * computed live STRICTLY BEFORE the carrying decision entry is appended;
3701
3697
  * the caller embeds the returned block in the entry and replay reads it
3702
3698
  * back byte-exact. Enforces the single-live-attempt invariant
@@ -3750,21 +3746,21 @@ declare class AdmissionController {
3750
3746
  * Resume roll-forward for a child that already SETTLED before the
3751
3747
  * resume: re-registers the counters (maxChildrenPerNode, the lifetime
3752
3748
  * cap, statsBefore fidelity) without committing any reserve; the spend
3753
- * itself sits in the root ledger seed (docs/03, 13.3).
3749
+ * itself sits in the root ledger seed.
3754
3750
  */
3755
3751
  recoverSettled(parentAccountScope: string): void;
3756
3752
  /**
3757
3753
  * Resume roll-forward for an admission whose decision entry exists but
3758
3754
  * whose child has NOT settled: re-applies the recorded reserve and
3759
- * counters without re-evaluating any limit (docs/07, 7.1: replay never
3760
- * re-evaluates admission; docs/06, 5.1: reserves are recovered, never
3755
+ * counters without re-evaluating any limit (replay never
3756
+ * re-evaluates admission; reserves are recovered, never
3761
3757
  * re-estimated).
3762
3758
  */
3763
3759
  recoverInFlight(parentAccountScope: string, verdict: AdmitVerdict): void;
3764
3760
  }
3765
3761
  //#endregion
3766
3762
  //#region src/l0/events.d.ts
3767
- /** docs/09 section 1.4, run lifecycle and core telemetry (M1 subset). */
3763
+ /** Run lifecycle and core telemetry (M1 subset). */
3768
3764
  type CoreEvents = {
3769
3765
  type: "run:start";
3770
3766
  workflow: string;
@@ -3807,7 +3803,7 @@ type CoreEvents = {
3807
3803
  scope: string;
3808
3804
  status: string;
3809
3805
  };
3810
- /** docs/09 section 1.4, agent lifecycle. */
3806
+ /** Agent lifecycle. */
3811
3807
  type AgentEvents = {
3812
3808
  type: "agent:queued";
3813
3809
  agentType: string;
@@ -3841,7 +3837,7 @@ type AgentEvents = {
3841
3837
  type: "agent:stream";
3842
3838
  delta: string;
3843
3839
  };
3844
- /** docs/09 section 1.4, tool lifecycle (emitters arrive with the tool system, M3). */
3840
+ /** Tool lifecycle (emitters arrive with the tool system, M3). */
3845
3841
  type ToolEvents = {
3846
3842
  type: "tool:start";
3847
3843
  toolName: string;
@@ -3852,7 +3848,7 @@ type ToolEvents = {
3852
3848
  outcome: "ok" | "error" | "denied";
3853
3849
  durationMs: number;
3854
3850
  /**
3855
- * Audit fields (docs/08, section 4.5; M5-T05): the chain verdict,
3851
+ * Audit fields (M5-T05): the chain verdict,
3856
3852
  * the deciding layer, the matched rule, and advisory domain-rule
3857
3853
  * matches. Telemetry, never identity; ask verdicts additionally
3858
3854
  * journal as suspended approvals.
@@ -3863,9 +3859,10 @@ type ToolEvents = {
3863
3859
  advisory?: Json;
3864
3860
  };
3865
3861
  /**
3866
- * docs/09 section 1.4, adaptive orchestration, resolutions, and
3862
+ * Adaptive orchestration, resolutions, and
3867
3863
  * accounting: emitted only by runs where the corresponding machinery is
3868
- * active (applicability per mode: docs/07, section 1). The types land as
3864
+ * active (applicability per mode:
3865
+ * https://docs.rulvar.com/guide/adaptive-orchestration). The types land as
3869
3866
  * one closed catalog with M7-T03; emitters arrive with their tasks.
3870
3867
  */
3871
3868
  type AdaptiveEvents = {
@@ -3916,7 +3913,7 @@ type AdaptiveEvents = {
3916
3913
  countsAgainstLimit: boolean;
3917
3914
  } | {
3918
3915
  type: "spawn:admitted";
3919
- entryRef: number; /** The admitting arms of the unified AdmitVerdict union (docs/07, 7.2). */
3916
+ entryRef: number; /** The admitting arms of the unified AdmitVerdict union. */
3920
3917
  verdict: "admit" | "reuse_full" | "admit_graft";
3921
3918
  agentType: string;
3922
3919
  logicalTaskId: string;
@@ -3981,12 +3978,12 @@ type AdaptiveEvents = {
3981
3978
  };
3982
3979
  type WorkflowEventBody = CoreEvents | AgentEvents | ToolEvents | AdaptiveEvents;
3983
3980
  /**
3984
- * The envelope (docs/09 section 1.1): seq is an independent per-run
3981
+ * The envelope: seq is an independent per-run
3985
3982
  * telemetry counter, strictly increasing in emission order and DISTINCT
3986
3983
  * from JournalEntry.seq (never compare or join the two; entryRef fields
3987
3984
  * carry journal seqs explicitly). ts is wall clock, telemetry only.
3988
- * replayed is true only on re-emitted journal-backed lifecycle events
3989
- * (docs/09 section 1.5); stream deltas are never re-emitted.
3985
+ * replayed is true only on re-emitted journal-backed lifecycle events;
3986
+ * stream deltas are never re-emitted.
3990
3987
  */
3991
3988
  type WorkflowEvent = {
3992
3989
  runId: string;
@@ -4017,7 +4014,7 @@ interface PendingExternal {
4017
4014
  /** Approvals and Flavor B escalations only. */
4018
4015
  deadlineAt?: string;
4019
4016
  }
4020
- /** docs/09, section "CostReport". */
4017
+ /** Full contract: https://docs.rulvar.com/guide/observability. */
4021
4018
  interface CostReport {
4022
4019
  totalUsd: number;
4023
4020
  /** Keyed by canonical ModelRef 'adapterId:model'. */
@@ -4049,7 +4046,7 @@ type RunOutcome<R> = {
4049
4046
  usage: Usage;
4050
4047
  cost: CostReport;
4051
4048
  };
4052
- /** Adds 'running' for in-flight inspection (docs/06, section "Engine and ops API"). */
4049
+ /** Adds 'running' for in-flight inspection. */
4053
4050
  type RunStatus = RunOutcome<unknown>["status"] | "running";
4054
4051
  interface RunHandle<R> {
4055
4052
  runId: string;
@@ -4084,7 +4081,7 @@ interface CompiledWorkflow {
4084
4081
  interface ScriptRunner {
4085
4082
  execute<A, R>(wf: Workflow<A, R> | CompiledWorkflow, ctx: Ctx<never>, args: A): Promise<R>;
4086
4083
  }
4087
- /** Escalation hook (docs/06, section 2.10): decides for value-form calls. */
4084
+ /** Escalation hook: decides for value-form calls. */
4088
4085
  type OnEscalation = (result: EscalatedResult<unknown>) => EscalationDecision | Promise<EscalationDecision>;
4089
4086
  /**
4090
4087
  * The mode (a) runner for human-authored closures. Determinism is enforced
@@ -4118,17 +4115,17 @@ interface PriceTable {
4118
4115
  */
4119
4116
  declare function resolvePricing(ref: ModelRef, table: PriceTable | undefined, capsPricing: Pricing | undefined): Pricing | undefined;
4120
4117
  /**
4121
- * Dollars from normalized usage against one pricing row (docs/04,
4122
- * section 1.6: the adapter normalized the usage; inputTokens is the
4118
+ * Dollars from normalized usage against one pricing row (the adapter
4119
+ * normalized the usage; inputTokens is the
4123
4120
  * full prompt). Cache writes price at the 5m premium rate; the 1h rate
4124
4121
  * applies where a provider distinguishes it in usage, which the
4125
- * canonical Usage does not yet carry (docs/04, section 10).
4122
+ * canonical Usage does not yet carry.
4126
4123
  */
4127
4124
  declare function priceUsdOf(pricing: Pricing, usage: Usage): number;
4128
4125
  //#endregion
4129
4126
  //#region src/engine/engine.d.ts
4130
4127
  /**
4131
- * The per-engine workflow registry (docs/06, section 10.4; M5-T01): an
4128
+ * The per-engine workflow registry (M5-T01): an
4132
4129
  * explicit, first-class value; no module-level registry exists. Shells
4133
4130
  * resolve by-name runs against it; ctx.workflow's string form (M6) and
4134
4131
  * the queue worker (M8) resolve against it too. CompiledWorkflow values
@@ -4140,24 +4137,23 @@ interface EngineDefaults {
4140
4137
  profiles?: Record<string, AgentProfile>;
4141
4138
  /** The workflow registry for shells and by-name resolution (10.4). */
4142
4139
  workflows?: WorkflowRegistry;
4143
- /** Registered SchemaSpec names for outputSchemaRef (docs/08; M7-T05). */
4140
+ /** Registered SchemaSpec names for outputSchemaRef (M7-T05). */
4144
4141
  schemas?: Record<string, SchemaSpec>;
4145
- /** Registered tool profile names for toolsetRef (docs/08; M7-T05). */
4142
+ /** Registered tool profile names for toolsetRef (M7-T05). */
4146
4143
  toolsets?: Record<string, ToolsOption>;
4147
4144
  /**
4148
4145
  * Registered mechanical gate profiles: named pure functions over
4149
- * AgentResult.artifacts for ladder acceptance gates (docs/02, section
4150
- * "Registries"; docs/07, section 10; M7-T10).
4146
+ * AgentResult.artifacts for ladder acceptance gates (M7-T10).
4151
4147
  */
4152
4148
  gates?: Record<string, MechanicalGateProfile>;
4153
4149
  limits?: UsageLimits;
4154
- /** Engine-wide permission chain layers (docs/08, section 3). */
4150
+ /** Engine-wide permission chain layers. */
4155
4151
  permissions?: PermissionConfig;
4156
- /** The worktree lifecycle provider (docs/08, section 8). */
4152
+ /** The worktree lifecycle provider. */
4157
4153
  isolation?: IsolationProvider;
4158
- /** Engine-wide transport RetryPolicy (docs/04, 11.1; M4-T05). */
4154
+ /** Engine-wide transport RetryPolicy (M4-T05). */
4159
4155
  retry?: RetryPolicy;
4160
- /** Hard per-role model constraints (docs/04, section 9; M4-T09). */
4156
+ /** Hard per-role model constraints (M4-T09). */
4161
4157
  roleFloors?: QualityFloors;
4162
4158
  }
4163
4159
  interface BudgetDefaults {
@@ -4167,13 +4163,13 @@ interface BudgetDefaults {
4167
4163
  lifetimeSpawnCap?: number;
4168
4164
  /**
4169
4165
  * Fraction of the parent remainder (minus the parent finalize reserve)
4170
- * a child sub-account may take; default 0.3 (docs/06, 5.4; M6-T06).
4166
+ * a child sub-account may take; default 0.3 (M6-T06).
4171
4167
  */
4172
4168
  childBudgetFraction?: number;
4173
- /** AdmissionController nesting depth; default 1, hard ceiling 4 (docs/07, 7.3). */
4169
+ /** AdmissionController nesting depth; default 1, hard ceiling 4. */
4174
4170
  maxDepth?: number;
4175
4171
  /**
4176
- * Lineage limits (DEF-3, docs/03 section 10.5): maxEscalationsPerLogicalTask
4172
+ * Lineage limits (DEF-3): maxEscalationsPerLogicalTask
4177
4173
  * (default 2) and maxAttemptsPerLogicalTask (default 8), monotonically
4178
4174
  * consumed. The validator rejects the pre-rename knob name
4179
4175
  * maxEscalationsPerNode with a migration hint (XF-10).
@@ -4186,7 +4182,7 @@ interface CreateEngineOptions {
4186
4182
  /** Default InMemoryStore (resume disabled, loud warning). */journal?: JournalStore;
4187
4183
  transcripts?: TranscriptStore;
4188
4184
  /**
4189
- * The ModelKnowledge claim store (docs/05; M10-T03). Optional and
4185
+ * The ModelKnowledge claim store (M10-T03). Optional and
4190
4186
  * OFF by default: an engine without it writes no kb entries at
4191
4187
  * all. The runtime only ever receives the current()-only handle.
4192
4188
  */
@@ -4198,11 +4194,11 @@ interface CreateEngineOptions {
4198
4194
  perRun?: number; /** Per-adapter-id caps; unlimited unless configured (Appendix A; M4-T07). */
4199
4195
  perProvider?: Record<string, number>;
4200
4196
  };
4201
- /** Versioned price table; wins over caps.pricing (docs/04, section 10; M4-T06). */
4197
+ /** Versioned price table; wins over caps.pricing (M4-T06). */
4202
4198
  pricing?: PriceTable;
4203
4199
  /**
4204
- * Runner registrations beyond the built-in InProcessRunner (docs/06,
4205
- * sections 8 and 10.1; M6-T02). `sandbox` executes CompiledWorkflow
4200
+ * Runner registrations beyond the built-in InProcessRunner (M6-T02).
4201
+ * `sandbox` executes CompiledWorkflow
4206
4202
  * values (WorkerSandboxRunner ships in @rulvar/planner); running or
4207
4203
  * resuming a compiled workflow without one is a typed ConfigError.
4208
4204
  */
@@ -4210,28 +4206,28 @@ interface CreateEngineOptions {
4210
4206
  sandbox?: ScriptRunner;
4211
4207
  };
4212
4208
  /**
4213
- * The InProcessRunner escalation hook (docs/06, sections 2.10 and 8.1):
4209
+ * The InProcessRunner escalation hook:
4214
4210
  * receives escalated results when the call form cannot carry them; the
4215
4211
  * returned decision is journaled as the authoritative
4216
4212
  * escalation-decision entry.
4217
4213
  */
4218
4214
  onEscalation?: (result: EscalatedResult<unknown>) => EscalationDecision | Promise<EscalationDecision>;
4219
4215
  /**
4220
- * KeyDeriver registry extension (docs/03, section "hashVersion").
4216
+ * KeyDeriver registry extension (see
4217
+ * https://docs.rulvar.com/guide/journal-compatibility).
4221
4218
  * Plumbed now, consumed by the matching kernel from M2.
4222
4219
  */
4223
4220
  extraDerivers?: readonly unknown[];
4224
4221
  /**
4225
4222
  * Redact/encrypt at the append/put boundaries, symmetric on load/get
4226
- * (docs/03, section "Serialization hook"; M8-T04, OQ-22 executed).
4223
+ * (M8-T04, OQ-22 executed).
4227
4224
  * Applied by wrapping the configured stores; Engine.stores exposes
4228
4225
  * the wrapped instances, so every reader passes one policy point.
4229
4226
  */
4230
4227
  serialization?: SerializationHook;
4231
4228
  /**
4232
- * The default key-masking policy at the telemetry boundary (docs/09,
4233
- * section "Redaction and sensitive data"; docs/06 Appendix A row
4234
- * "event secret masking"). Default ON: key-shaped strings in every
4229
+ * The default key-masking policy at the telemetry boundary. Default
4230
+ * ON: key-shaped strings in every
4235
4231
  * emitted WorkflowEvent are masked; never touches the journal.
4236
4232
  */
4237
4233
  redaction?: {
@@ -4252,7 +4248,7 @@ interface RunOptions {
4252
4248
  /** Host-initiated cancellation. */
4253
4249
  signal?: AbortSignal;
4254
4250
  }
4255
- /** Resume-time hit/miss/orphan accounting (docs/03, section 11.3). */
4251
+ /** Resume-time hit/miss/orphan accounting. */
4256
4252
  interface ResumePreview extends ResumeReport {
4257
4253
  invalidResolutions: Array<{
4258
4254
  seq: number;
@@ -4262,23 +4258,23 @@ interface ResumePreview extends ResumeReport {
4262
4258
  interface ResumeOptions {
4263
4259
  /**
4264
4260
  * The run's original arguments: not journaled for in-process workflows
4265
- * in v1, so the host supplies them (resume binding residuals, docs/14).
4261
+ * in v1, so the host supplies them (resume binding residuals).
4266
4262
  */
4267
4263
  args?: unknown;
4268
4264
  /**
4269
4265
  * Dry-run: replay-strict matching; the first would-be-live call throws
4270
4266
  * JournalMissError and the run settles with that typed error, zero live
4271
- * calls performed (docs/03, section 11.3).
4267
+ * calls performed.
4272
4268
  */
4273
4269
  dryRun?: boolean;
4274
- /** invalidate/retry: entries to unpin before matching (docs/03, section 6.5). */
4270
+ /** invalidate/retry: entries to unpin before matching. */
4275
4271
  invalidate?: number[];
4276
4272
  /**
4277
4273
  * Queue mode: the worker's lease. The engine carries it on EVERY
4278
4274
  * journal append of this resume (the kernel's single append site), so
4279
4275
  * a stale worker's writes are rejected by the fencing epoch and never
4280
- * become visible (docs/06 10.2 and docs/03 12.3, M8 entry amendment;
4281
- * DEF-6; FR-703). putMeta and transcript blobs stay advisory and
4276
+ * become visible (M8 entry amendment; DEF-6; FR-703). putMeta and
4277
+ * transcript blobs stay advisory and
4282
4278
  * unfenced.
4283
4279
  */
4284
4280
  lease?: Lease;
@@ -4290,44 +4286,43 @@ interface ResumeHandle<R> extends RunHandle<R> {
4290
4286
  interface Engine {
4291
4287
  run<A, R>(wf: Workflow<A, R> | CompiledWorkflow, args: A, opts?: RunOptions): RunHandle<R>;
4292
4288
  /**
4293
- * Rebinds a journal to a workflow definition and resumes (docs/06,
4294
- * section "Engine and ops API"). Requires wf for in-process workflows;
4289
+ * Rebinds a journal to a workflow definition and resumes. Requires wf
4290
+ * for in-process workflows;
4295
4291
  * a name mismatch is a typed ConfigError; a body-hash mismatch warns
4296
4292
  * loudly and proceeds (the journal decides replay per content keys).
4297
4293
  * A compiled run resumes WITHOUT wf: the engine rehydrates the
4298
4294
  * persisted source pinned by workflowHash; supplying a compiled wf
4299
4295
  * whose source hash differs from the recorded one is a typed
4300
- * ConfigError (docs/06, 10.2; M6-T02).
4296
+ * ConfigError (M6-T02).
4301
4297
  */
4302
4298
  resume<A, R>(runId: string, wf?: Workflow<A, R> | CompiledWorkflow, options?: ResumeOptions): ResumeHandle<R>;
4303
4299
  /**
4304
4300
  * Renders the registered agent profiles into the shared vocabulary
4305
- * card (docs/06, 9.3), optionally filtered to `names`; the registry
4306
- * itself stays private to the engine (docs/06, 10.2; M6-T05
4307
- * amendment). Unknown names are ignored.
4301
+ * card, optionally filtered to `names`; the registry itself stays
4302
+ * private to the engine (M6-T05 amendment). Unknown names are ignored.
4308
4303
  */
4309
4304
  profileCard(names?: readonly string[]): string;
4310
4305
  /**
4311
4306
  * The engine's configured stores, exposed for shells and hosts
4312
- * (docs/06, 10.2, M8 entry amendment; docs/02, section "Shells
4313
- * overview": "the journal store comes from the engine"). Exactly the
4307
+ * (M8 entry amendment: the journal store comes from the engine).
4308
+ * Exactly the
4314
4309
  * instances createEngine received, or the defaults it built; no store
4315
4310
  * contract widens through this accessor. With a serialization hook
4316
4311
  * configured these are the HOOKED wrappers, so every reader passes
4317
- * the one policy point (docs/03, 12.8; M8-T04).
4312
+ * the one policy point (M8-T04).
4318
4313
  */
4319
4314
  readonly stores: {
4320
4315
  journal: JournalStore;
4321
4316
  transcripts: TranscriptStore;
4322
4317
  };
4323
4318
  /**
4324
- * Retention (docs/06, 10.2; OQ-20 executed at M8-T04): deletes every
4319
+ * Retention (OQ-20 executed at M8-T04): deletes every
4325
4320
  * blob transcripts.list(runId) returns, then the journal; no orphan
4326
4321
  * blobs survive. The caller owns the decision that the run is done.
4327
4322
  */
4328
4323
  deleteRun(runId: string): Promise<void>;
4329
4324
  /**
4330
- * Checkpoint pruning (docs/03, 12.4 note; OQ-20 executed at M8-T04):
4325
+ * Checkpoint pruning (OQ-20 executed at M8-T04):
4331
4326
  * deletes checkpoint blobs of ok-terminal attempts that no other
4332
4327
  * entry references; returns the count. Parked, cancelled, escalated,
4333
4328
  * and hanging attempts keep theirs (park/unpark, DEF-5 retention, and
@@ -4335,16 +4330,16 @@ interface Engine {
4335
4330
  */
4336
4331
  pruneRun(runId: string): Promise<number>;
4337
4332
  }
4338
- /** Content hash of an in-process workflow body (run-to-definition binding, docs/06 10.2). */
4333
+ /** Content hash of an in-process workflow body (run-to-definition binding). */
4339
4334
  declare function hashWorkflowBody(wf: Workflow<never, never> | Workflow<unknown, unknown>): string;
4340
- /** Content hash of a compiled workflow source (run-to-definition binding, docs/06 10.2). */
4335
+ /** Content hash of a compiled workflow source (run-to-definition binding). */
4341
4336
  declare function hashWorkflowSource(source: string): string;
4342
4337
  /** TranscriptStore ref of the persisted CompiledWorkflow source blob. */
4343
4338
  declare function workflowSourceRef(runId: string): string;
4344
4339
  declare function createEngine(options: CreateEngineOptions): Engine;
4345
4340
  //#endregion
4346
4341
  //#region src/orchestrator/handles.d.ts
4347
- /** docs/07 section 5: the per-child digest handed to the orchestrator. */
4342
+ /** The per-child digest handed to the orchestrator. */
4348
4343
  interface TaskDigest {
4349
4344
  nodeId: string;
4350
4345
  logicalTaskId: string;
@@ -4363,7 +4358,7 @@ interface SpawnRecord {
4363
4358
  result: Promise<AgentResult<unknown>>;
4364
4359
  settled?: AgentResult<unknown>;
4365
4360
  abort: () => void;
4366
- /** The spawn's escalation flavor, captured at dispatch (docs/07, 5). */
4361
+ /** The spawn's escalation flavor, captured at dispatch. */
4367
4362
  escalationFlavor?: "A" | "B";
4368
4363
  }
4369
4364
  /** The engine seam the spawn tools close over (never on ToolContext). */
@@ -4393,11 +4388,11 @@ interface OrchestratorRuntime {
4393
4388
  cancelled: boolean;
4394
4389
  handle: number;
4395
4390
  }>;
4396
- /** docs/07 4.8: sleep until a coalesced WakeDigest (M6-T09). */
4391
+ /** Sleep until a coalesced WakeDigest (M6-T09). */
4397
4392
  waitForEvents(triggers: unknown): Promise<unknown>;
4398
4393
  }
4399
4394
  /**
4400
- * The committed WakeDigest render budget (docs/06, Appendix A: 400
4395
+ * The committed WakeDigest render budget (Appendix A: 400
4401
4396
  * chars per outputSummary row, the character measure; committed at M10
4402
4397
  * entry by adopting the implemented distillation cap unchanged, the
4403
4398
  * value frozen into every cassette since M6). One value serves both
@@ -4407,8 +4402,8 @@ interface OrchestratorRuntime {
4407
4402
  declare const WAKE_SUMMARY_RENDER_BUDGET_CHARS = 400;
4408
4403
  /**
4409
4404
  * The M6 outputSummary: a deterministic truncation of the child's
4410
- * output (or error message), identical live and on replay (docs/07
4411
- * section 2, clause 3: distillation lives with the child, ordered by
4405
+ * output (or error message), identical live and on replay (distillation
4406
+ * lives with the child, ordered by
4412
4407
  * spawn ordinal; the LLM distillation upgrade is M7 territory).
4413
4408
  */
4414
4409
  declare function summarizeOutput(result: AgentResult<unknown>): string;
@@ -4428,10 +4423,10 @@ interface SpawnAdmissionValue {
4428
4423
  }
4429
4424
  //#endregion
4430
4425
  //#region src/orchestrator/wake.d.ts
4431
- /** docs/07 4.8: the wait_for_events parameter schema (normative). */
4426
+ /** The wait_for_events parameter schema (normative). */
4432
4427
  declare const WAIT_FOR_EVENTS_SCHEMA: SchemaSpec;
4433
4428
  declare const WAIT_FOR_EVENTS_TOOL_NAME = "wait_for_events";
4434
- /** The closed v1 trigger vocabulary (docs/07 4.8). */
4429
+ /** The closed v1 trigger vocabulary. */
4435
4430
  type WakeTrigger = {
4436
4431
  kind: "quiescence";
4437
4432
  } | {
@@ -4443,7 +4438,7 @@ type WakeTrigger = {
4443
4438
  kind: "budget_threshold";
4444
4439
  percent: 50 | 80;
4445
4440
  };
4446
- /** docs/07 section 5: the escalation block of a digest. */
4441
+ /** The escalation block of a digest. */
4447
4442
  interface EscalationDigest {
4448
4443
  nodeId: string;
4449
4444
  logicalTaskId: string;
@@ -4454,7 +4449,7 @@ interface EscalationDigest {
4454
4449
  /** Flavor B only. */
4455
4450
  deadlineAt?: string;
4456
4451
  }
4457
- /** Passive budget visibility in every digest (DEF-7; docs/07, 12.5). */
4452
+ /** Passive budget visibility in every digest (DEF-7). */
4458
4453
  interface WakeBudgetBlock {
4459
4454
  runSpentUsd: number;
4460
4455
  runCeilingUsd: number;
@@ -4467,7 +4462,7 @@ interface WakeBudgetBlock {
4467
4462
  softWarning: boolean;
4468
4463
  }
4469
4464
  /**
4470
- * The FINAL normative WakeDigest (docs/07 section 5): one coordinated
4465
+ * The FINAL normative WakeDigest: one coordinated
4471
4466
  * schema change inside the hashVersion-2 profile (XF-12). The digest
4472
4467
  * render enters the content key of orchestrator turns. In runs without
4473
4468
  * the PlanRunner extension the termination, budget, and reuse blocks are
@@ -4512,7 +4507,7 @@ declare function emptyDigestBlocks(): Pick<WakeDigest, "planHash" | "termination
4512
4507
  /** One append into an extension-owned sequential scope. */
4513
4508
  interface ExtensionAppendInput {
4514
4509
  scope: string;
4515
- /** The content key; extension kinds derive their own (docs/07, 3.3). */
4510
+ /** The content key; extension kinds derive their own. */
4516
4511
  key: string;
4517
4512
  kind: EntryKind;
4518
4513
  value: Json;
@@ -4521,9 +4516,9 @@ interface ExtensionAppendInput {
4521
4516
  interface ExtensionDispatchSpec {
4522
4517
  agentType: string;
4523
4518
  prompt: string;
4524
- /** Resolved against defaults.schemas (docs/08); unknown names are typed errors. */
4519
+ /** Resolved against defaults.schemas; unknown names are typed errors. */
4525
4520
  outputSchemaRef?: string;
4526
- /** Resolved against defaults.toolsets (docs/08); unknown names are typed errors. */
4521
+ /** Resolved against defaults.toolsets; unknown names are typed errors. */
4527
4522
  toolsetRef?: string;
4528
4523
  isolation?: IsolationSpec;
4529
4524
  budgetUsd?: number;
@@ -4533,15 +4528,15 @@ interface ExtensionDispatchSpec {
4533
4528
  taskClass?: string;
4534
4529
  /**
4535
4530
  * A retained transcript checkpoint the dispatch boots from (park and
4536
- * unpark continuation, the DEF-5 graft boot; docs/03, sections 9.5 and
4537
- * 11.2). Dangling redispatch checkpoints take precedence.
4531
+ * unpark continuation, the DEF-5 graft boot). Dangling redispatch
4532
+ * checkpoints take precedence.
4538
4533
  */
4539
4534
  bootCheckpointRef?: string;
4540
4535
  /**
4541
4536
  * The CONCRETE model of this attempt: the ladder driver resolves each
4542
4537
  * rung to its `{ model, effort }` form and dispatches with it, so the
4543
- * attempt's identity hash includes the concrete ModelRef (docs/07,
4544
- * section 10). The orchestrator itself never names models; only the
4538
+ * attempt's identity hash includes the concrete ModelRef. The
4539
+ * orchestrator itself never names models; only the
4545
4540
  * engine-side driver populates this from the declared ladder.
4546
4541
  */
4547
4542
  model?: {
@@ -4549,7 +4544,7 @@ interface ExtensionDispatchSpec {
4549
4544
  effort?: Effort;
4550
4545
  };
4551
4546
  /**
4552
- * Rung/fallback opt-in (docs/04, section 12): a memoized terminal
4547
+ * Rung/fallback opt-in: a memoized terminal
4553
4548
  * outcome replays by match instead of re-running live; the global
4554
4549
  * default errors-re-run-live is preserved (DEF-1).
4555
4550
  */
@@ -4557,7 +4552,7 @@ interface ExtensionDispatchSpec {
4557
4552
  /**
4558
4553
  * An INLINE SchemaSpec for engine-synthesized children (the ladder
4559
4554
  * judge verdict); user-authored plan specs use `outputSchemaRef`
4560
- * against the registry instead (docs/07, 4.2).
4555
+ * against the registry instead.
4561
4556
  */
4562
4557
  schema?: unknown;
4563
4558
  }
@@ -4571,7 +4566,7 @@ interface OrchestratorExtensionIO {
4571
4566
  /** Registered agent profiles advertised to this orchestrate call. */
4572
4567
  readonly profiles: Record<string, unknown>;
4573
4568
  /**
4574
- * The per-engine mechanical gate registry (docs/07, section 10):
4569
+ * The per-engine mechanical gate registry:
4575
4570
  * named pure functions over AgentResult.artifacts. Typed loose at the
4576
4571
  * seam exactly like `profiles`.
4577
4572
  */
@@ -4583,7 +4578,7 @@ interface OrchestratorExtensionIO {
4583
4578
  /**
4584
4579
  * A journaled random draw in [0, 1) under the orchestrate scope: the
4585
4580
  * ctx.random primitive, computed once live and replayed by match. The
4586
- * spot-check gate draws HERE, never Math.random (docs/04, section 12).
4581
+ * spot-check gate draws HERE, never Math.random.
4587
4582
  */
4588
4583
  random(key?: string): Promise<number>;
4589
4584
  /** Total-order append; the extension owns its scopes' content keys. */
@@ -4592,7 +4587,7 @@ interface OrchestratorExtensionIO {
4592
4587
  snapshot(): readonly JournalEntry[];
4593
4588
  /** Flushes the serialized append queue before reading back. */
4594
4589
  flush(): Promise<void>;
4595
- /** The single admission point for all spawns (docs/07, 7.1). */
4590
+ /** The single admission point for all spawns. */
4596
4591
  readonly admission: AdmissionController;
4597
4592
  /**
4598
4593
  * Dispatches one child agent under the EXPLICIT child scope through
@@ -4614,7 +4609,7 @@ interface OrchestratorExtensionIO {
4614
4609
  }>;
4615
4610
  /**
4616
4611
  * Appends the severing abandon ref-entry over a branch through the
4617
- * ResolutionArbiter (DEF-4/DEF-5; docs/03, sections 8.5 and 9.1).
4612
+ * ResolutionArbiter (DEF-4/DEF-5).
4618
4613
  */
4619
4614
  abandonBranch(attempt: {
4620
4615
  target: number;
@@ -4630,10 +4625,10 @@ interface OrchestratorExtensionIO {
4630
4625
  }>;
4631
4626
  /**
4632
4627
  * Registers a node.link scope-prefix alias for forward matching
4633
- * (DEF-5; docs/03, 9.5). Idempotent; rebuilt by fold on resume.
4628
+ * (DEF-5). Idempotent; rebuilt by fold on resume.
4634
4629
  */
4635
4630
  registerAlias(donorScope: string, targetScope: string): void;
4636
- /** The engine price fold (journal facts in, USD out; docs/04). */
4631
+ /** The engine price fold (journal facts in, USD out). */
4637
4632
  priceUsd(servedBy: string | undefined, usage: Usage): number | undefined;
4638
4633
  /** Telemetry emission into the run event stream. */
4639
4634
  emit(event: {
@@ -4648,12 +4643,12 @@ interface OrchestratorExtensionIO {
4648
4643
  interface OrchestratorExtension {
4649
4644
  readonly name: string;
4650
4645
  /**
4651
- * Runs strictly BEFORE the orchestrator agent's first entry (docs/07,
4652
- * 11.6: termination.init precedes the first scheduling entry and the
4646
+ * Runs strictly BEFORE the orchestrator agent's first entry
4647
+ * (termination.init precedes the first scheduling entry and the
4653
4648
  * budget reserve). On resume it rebuilds state from the journal.
4654
4649
  */
4655
4650
  boot?(io: OrchestratorExtensionIO): Promise<void> | void;
4656
- /** Extension tools appended to the mode (c) toolset (docs/07, section 4). */
4651
+ /** Extension tools appended to the mode (c) toolset. */
4657
4652
  tools(io: OrchestratorExtensionIO): ToolDef[];
4658
4653
  /** Extra orchestrator prompt lines describing the extension's protocol. */
4659
4654
  promptLines?(): string[];
@@ -4664,7 +4659,7 @@ interface OrchestratorExtension {
4664
4659
  */
4665
4660
  onActivity?(io: OrchestratorExtensionIO): Promise<void> | void;
4666
4661
  /**
4667
- * Quiescence participation (docs/07, 4.8): the mandatory trigger fires
4662
+ * Quiescence participation: the mandatory trigger fires
4668
4663
  * only when every dispatched child settled AND the extension reports
4669
4664
  * nothing running and nothing ready.
4670
4665
  */
@@ -4679,7 +4674,10 @@ interface OrchestratorExtension {
4679
4674
  }
4680
4675
  //#endregion
4681
4676
  //#region src/orchestrator/orchestrate.d.ts
4682
- /** docs/06 5.5; the cap machinery (reserves, freeze) completes in M7 (DEF-7). */
4677
+ /**
4678
+ * Budget contract: https://docs.rulvar.com/guide/budgets; the cap
4679
+ * machinery (reserves, freeze) completes in M7 (DEF-7).
4680
+ */
4683
4681
  interface OrchestratorBudgetSpec {
4684
4682
  capUsd?: number;
4685
4683
  /** default 0.2; effectiveCap = min of the given bounds */
@@ -4688,7 +4686,7 @@ interface OrchestratorBudgetSpec {
4688
4686
  finalizeTurns?: number;
4689
4687
  atCap?: "finish-with-partial" | "fail-run";
4690
4688
  }
4691
- /** docs/06 9.3: orchestrate(engine, goal, o?). */
4689
+ /** Options for orchestrate(engine, goal, o?). */
4692
4690
  interface OrchestrateOptions {
4693
4691
  model?: ModelSpec;
4694
4692
  /** Registered profile names to advertise; default: every profile. */
@@ -4698,17 +4696,17 @@ interface OrchestrateOptions {
4698
4696
  /** The orchestrator's own budget sub-account (cap enforcement layers only in M6). */
4699
4697
  budget?: OrchestratorBudgetSpec;
4700
4698
  /**
4701
- * Deterministic digest render bound (docs/07, section 5): each
4699
+ * Deterministic digest render bound: each
4702
4700
  * TaskDigest outputSummary is clamped to this many CHARACTERS (the
4703
4701
  * model-independent measure; OQ-04 closed at M10 entry). Default
4704
- * WAKE_SUMMARY_RENDER_BUDGET_CHARS (docs/06, Appendix A).
4702
+ * WAKE_SUMMARY_RENDER_BUDGET_CHARS.
4705
4703
  */
4706
4704
  renderBudgetChars?: number;
4707
4705
  /** UsageLimits of the orchestrator agent itself (maxTurns etc.). */
4708
4706
  limits?: UsageLimits;
4709
4707
  /**
4710
4708
  * The opt-in mode (c) extension seam (M7-T05): PlanRunner from
4711
- * @rulvar/plan attaches here (docs/07, section 1). The extension boots
4709
+ * @rulvar/plan attaches here. The extension boots
4712
4710
  * strictly before the orchestrator's first agent entry, contributes
4713
4711
  * tools, schedules ready plan nodes on every settlement, and
4714
4712
  * participates in the mandatory quiescence trigger.
@@ -4723,7 +4721,7 @@ declare const ORCHESTRATE_WORKFLOW_NAME = "rulvar-orchestrate";
4723
4721
  * orchestrator agent with the finish terminal tool.
4724
4722
  */
4725
4723
  declare function makeOrchestratorWorkflow(goal: string, opts?: OrchestrateOptions): Workflow<undefined, unknown>;
4726
- /** Top-level surface: creates a run (docs/06 9.3). */
4724
+ /** Top-level surface: creates a run. */
4727
4725
  declare function orchestrate(engine: Engine, goal: string, opts?: OrchestrateOptions): RunHandle<unknown>;
4728
4726
  //#endregion
4729
4727
  //#region src/engine/scheduler.d.ts
@@ -4731,10 +4729,10 @@ declare function orchestrate(engine: Engine, goal: string, opts?: OrchestrateOpt
4731
4729
  * Scheduler and concurrency (M1-T08): the per-run semaphore with a FIFO
4732
4730
  * queue (default 12 concurrent model calls). The engine lifetime spawn cap
4733
4731
  * is enforced by the budget layer at admission; parallel/pipeline
4734
- * composition semantics live with ctx (docs/06, section "Scheduler").
4732
+ * composition semantics live with ctx.
4735
4733
  * Per-provider concurrency keys land with M4.
4736
4734
  */
4737
- /** FIFO semaphore; default per-run width is 12 (docs/06, Appendix A). */
4735
+ /** FIFO semaphore; default per-run width is 12. */
4738
4736
  declare const DEFAULT_PER_RUN_CONCURRENCY = 12;
4739
4737
  declare class Semaphore {
4740
4738
  private readonly limit;
@@ -4766,7 +4764,7 @@ declare function toApprovalDecision(value: Json): ApprovalDecision;
4766
4764
  * Per-run registry of open external suspensions plus the run's activity
4767
4765
  * counter: when every in-flight branch is blocked on suspensions
4768
4766
  * (activity zero, waiters open), the run quiesces into outcome
4769
- * 'suspended' (docs/06, section 2.7).
4767
+ * 'suspended'.
4770
4768
  */
4771
4769
  declare class ExternalRegistry {
4772
4770
  private readonly replayer;
@@ -4798,7 +4796,7 @@ declare class ExternalRegistry {
4798
4796
  prompt?: string;
4799
4797
  }): Promise<Json>;
4800
4798
  /**
4801
- * Tool-approval suspension (M3-T03; docs/08, section 3.6): journals (or
4799
+ * Tool-approval suspension (M3-T03): journals (or
4802
4800
  * re-matches) the suspended approval entry keyed by (toolName, input)
4803
4801
  * in the agent's child scope and parks until a resolution closes it.
4804
4802
  * The ask verdict is journaled together with the turn checkpoint; on
@@ -4814,7 +4812,7 @@ declare class ExternalRegistry {
4814
4812
  onPending?: (entry: JournalEntry, replayed: boolean) => void;
4815
4813
  }): Promise<ApprovalDecision>;
4816
4814
  /**
4817
- * Flavor B escalation suspension (M3-T07; docs/07, section 6.2): the
4815
+ * Flavor B escalation suspension (M3-T07): the
4818
4816
  * escalate tool suspends the agent on the SAME machinery as approvals
4819
4817
  * (kind 'approval', toolName 'escalate') with a journaled deadlineAt so
4820
4818
  * deadlines survive resume; the resolution VALUE is the raw
@@ -4843,7 +4841,7 @@ declare class ExternalRegistry {
4843
4841
  /**
4844
4842
  * RunHandle.resolveExternal: the live path validates BEFORE append and
4845
4843
  * throws InvalidResolutionError without journaling; a winning attempt
4846
- * settles the waiting promise in place (docs/03, section 8.7).
4844
+ * settles the waiting promise in place.
4847
4845
  */
4848
4846
  resolveExternal(key: string, value: Json): Promise<ResolutionOutcome>;
4849
4847
  }
@@ -4851,9 +4849,9 @@ declare class ExternalRegistry {
4851
4849
  //#region src/engine/ctx.d.ts
4852
4850
  type ErrorPolicy = "strict" | "lenient";
4853
4851
  /**
4854
- * The canonical, complete AgentProfile shape (docs/06, section
4855
- * "AgentProfile"); M1 honors description, model, routing, effort, limits,
4856
- * and estCost. A profile never carries a prompt or a schema.
4852
+ * The canonical, complete AgentProfile shape; M1 honors description,
4853
+ * model, routing, effort, limits, and estCost. A profile never carries
4854
+ * a prompt or a schema.
4857
4855
  */
4858
4856
  interface AgentProfile {
4859
4857
  description?: string;
@@ -4862,11 +4860,11 @@ interface AgentProfile {
4862
4860
  effort?: Effort;
4863
4861
  /** Toolset default; the resolved snapshot enters identity via toolsetHash. */
4864
4862
  tools?: ToolsOption;
4865
- /** Chain layers merged over engine defaults (docs/08, section 3.7). */
4863
+ /** Chain layers merged over engine defaults. */
4866
4864
  permissions?: AgentProfilePermissions;
4867
- /** Isolation default; the RESOLVED value enters identity (docs/08). */
4865
+ /** Isolation default; the RESOLVED value enters identity. */
4868
4866
  isolation?: IsolationSpec;
4869
- /** Flavor B opt-in lives here or on the call (docs/07, section 6). */
4867
+ /** Flavor B opt-in lives here or on the call. */
4870
4868
  escalation?: EscalationOptions;
4871
4869
  limits?: UsageLimits;
4872
4870
  /** Transport RetryPolicy layer: call over profile over engine (M4-T05). */
@@ -4875,7 +4873,7 @@ interface AgentProfile {
4875
4873
  taskClass?: string;
4876
4874
  /**
4877
4875
  * Per-profile compaction threshold; default 0.8 of the loop model's
4878
- * contextWindow (docs/06, Appendix A; M4-T03). Compaction is ON by
4876
+ * contextWindow (M4-T03). Compaction is ON by
4879
4877
  * default; history-processor plumbing stays engine-internal.
4880
4878
  */
4881
4879
  compaction?: {
@@ -4885,7 +4883,7 @@ interface AgentProfile {
4885
4883
  estCost?: number;
4886
4884
  }
4887
4885
  /**
4888
- * Per-spawn options (docs/06, section "ctx.agent and AgentOpts"). The
4886
+ * Per-spawn options. The
4889
4887
  * identity split is normative: agentType, model/routing/effort (the
4890
4888
  * requested modelSpec), schema (schemaHash), and key enter the content
4891
4889
  * key; everything else is policy or telemetry and never re-keys entries.
@@ -4899,8 +4897,7 @@ interface AgentOpts<S extends SchemaSpec = SchemaSpec> {
4899
4897
  * 'loop'. The plan and orchestrate entry points set it so the
4900
4898
  * resolution chain, role effort defaults, quality floors, and cost
4901
4899
  * buckets see the right role; extract/finalize/summarize stay
4902
- * trigger-derived and are never settable here (docs/06, 2.1;
4903
- * M6-T05 amendment).
4900
+ * trigger-derived and are never settable here (M6-T05 amendment).
4904
4901
  */
4905
4902
  role?: "loop" | "plan" | "orchestrate";
4906
4903
  /** Overrides all roles at once. */
@@ -4911,29 +4908,29 @@ interface AgentOpts<S extends SchemaSpec = SchemaSpec> {
4911
4908
  effort?: Effort;
4912
4909
  /** schemaHash enters identity. */
4913
4910
  schema?: S;
4914
- /** toolsetHash enters identity; wins over profile.tools (docs/08). */
4911
+ /** toolsetHash enters identity; wins over profile.tools. */
4915
4912
  tools?: ToolsOption;
4916
- /** docs/08; the RESOLVED value enters identity; worktree needs defaults.isolation. */
4913
+ /** The RESOLVED value enters identity; worktree needs defaults.isolation. */
4917
4914
  isolation?: IsolationSpec;
4918
4915
  /** Explicit discriminator; replaces the prompt in the content key. */
4919
4916
  key?: string;
4920
4917
  onError?: "throw" | "null";
4921
- /** Transport RetryPolicy under the journal (docs/04, 11.1; M4-T05). */
4918
+ /** Transport RetryPolicy under the journal (M4-T05). */
4922
4919
  retry?: RetryPolicy;
4923
4920
  /**
4924
- * The degenerate fallback (docs/04, 11.3; M4-T04): an agent-level
4921
+ * The degenerate fallback (M4-T04): an agent-level
4925
4922
  * second attempt on `model` when the terminal matches `on`; one
4926
4923
  * journaled decision entry; the fallback attempt is a NEW content key.
4927
4924
  */
4928
4925
  fallback?: FallbackField;
4929
- /** Per-call replay mode; default scoped forward-matching (docs/03, section 7.3). */
4926
+ /** Per-call replay mode; default scoped forward-matching. */
4930
4927
  replay?: "cache" | "never";
4931
4928
  /** Journaled as a policy field from day one; consumed by the M2 predicate. */
4932
4929
  memoizeOutcome?: boolean;
4933
- /** Opt-in; without it 'escalated' is physically unproducible (docs/07 6.4). */
4930
+ /** Opt-in; without it 'escalated' is physically unproducible. */
4934
4931
  escalation?: EscalationOptions;
4935
4932
  /**
4936
- * Lineage continuation (DEF-3, docs/03 section 10.3): declares this
4933
+ * Lineage continuation (DEF-3): declares this
4937
4934
  * spawn a rebirth of an existing logical task; absence means a new
4938
4935
  * lineage root. Never enters the content key. Declaring lineage or
4939
4936
  * approach journals a spawn-admission decision entry BEFORE dispatch,
@@ -4944,7 +4941,7 @@ interface AgentOpts<S extends SchemaSpec = SchemaSpec> {
4944
4941
  approach?: string;
4945
4942
  /** Admission reserve hint (USD). */
4946
4943
  estCost?: number;
4947
- /** Merged over profile and engine limits (docs/06, section "UsageLimits"). */
4944
+ /** Merged over profile and engine limits. */
4948
4945
  limits?: UsageLimits;
4949
4946
  result?: "value" | "full";
4950
4947
  /** Telemetry only. */
@@ -4952,7 +4949,7 @@ interface AgentOpts<S extends SchemaSpec = SchemaSpec> {
4952
4949
  /** Enables agent:stream delta events. */
4953
4950
  stream?: boolean;
4954
4951
  }
4955
- /** docs/06, section "Error policy and dropped results". */
4952
+ /** One dropped result: its source, scope, entry ref, and wire error. */
4956
4953
  interface DroppedItem {
4957
4954
  source: "pipeline" | "agent-onerror-null" | "parallel-settled";
4958
4955
  /** Scope path of the failed call. */
@@ -4964,8 +4961,7 @@ interface DroppedItem {
4964
4961
  }
4965
4962
  /**
4966
4963
  * The discriminated union over AgentStatus carrying the underlying
4967
- * AgentResult where one exists (docs/06, section "ctx.parallel and
4968
- * Settled").
4964
+ * AgentResult where one exists.
4969
4965
  */
4970
4966
  type Settled<T> = {
4971
4967
  status: "ok";
@@ -4991,10 +4987,9 @@ type Settled<T> = {
4991
4987
  type Stage<I, O> = (item: I) => Promise<O>;
4992
4988
  /**
4993
4989
  * The rejection carrier of ctx.agent value-form calls: a real Error that
4994
- * structurally satisfies the typed AgentError (docs/06, section "ctx.agent
4995
- * and AgentOpts") and carries the full AgentResult for Settled mapping.
4996
- * Deliberately not a RulvarError: AgentError is not in the closed code
4997
- * registry (docs/02, section "Error taxonomy").
4990
+ * structurally satisfies the typed AgentError and carries the full
4991
+ * AgentResult for Settled mapping. Deliberately not a RulvarError:
4992
+ * AgentError is not in the closed code registry.
4998
4993
  */
4999
4994
  declare class AgentCallError extends Error implements AgentError {
5000
4995
  readonly kind: AgentError["kind"];
@@ -5011,7 +5006,7 @@ interface PipelineCollected<T> {
5011
5006
  results: T[];
5012
5007
  dropped: DroppedItem[];
5013
5008
  }
5014
- /** The canonical Ctx interface, M1 members (docs/06, section "Canonical Ctx interface"). */
5009
+ /** The canonical Ctx interface, M1 members. */
5015
5010
  interface Ctx<P extends ErrorPolicy = "strict"> {
5016
5011
  agent(prompt: string): Promise<P extends "lenient" ? string | null : string>;
5017
5012
  agent<S extends SchemaSpec>(prompt: string, o: AgentOpts<S> & {
@@ -5045,33 +5040,33 @@ interface Ctx<P extends ErrorPolicy = "strict"> {
5045
5040
  key?: string;
5046
5041
  }): Promise<T>;
5047
5042
  /**
5048
- * Runs a child workflow under the AdmissionController (docs/06, section
5049
- * 2.5; M6-T06). The child gets a nested journal scope (registered name
5043
+ * Runs a child workflow under the AdmissionController (M6-T06). The
5044
+ * child gets a nested journal scope (registered name
5050
5045
  * plus ordinal) and a hierarchical budget sub-account whose spend
5051
5046
  * propagates to every ancestor. Structural limit violations throw the
5052
5047
  * typed AdmissionRejectedError and never tear the run down; budget
5053
5048
  * rejections throw BudgetExhaustedError. The string form resolves
5054
- * against the per-engine workflow registry (section 10.4) and is the
5049
+ * against the per-engine workflow registry and is the
5055
5050
  * only form available inside the worker sandbox.
5056
5051
  */
5057
5052
  workflow<A, R>(wf: Workflow<A, R>, args: A, o?: WorkflowCallOpts): Promise<R>;
5058
5053
  workflow(name: string, args?: Json, o?: WorkflowCallOpts): Promise<unknown>;
5059
5054
  /**
5060
- * Nests a dynamic orchestrator under the AdmissionController (docs/06,
5061
- * section 2.6; M6-T07): one implementation with the top-level
5055
+ * Nests a dynamic orchestrator under the AdmissionController (M6-T07):
5056
+ * one implementation with the top-level
5062
5057
  * orchestrate(engine, goal, opts) surface, clamped by maxDepth and the
5063
5058
  * parent budget account through the ordinary ctx.workflow admission.
5064
5059
  */
5065
5060
  orchestrate(goal: string, opts?: OrchestrateOptions): Promise<unknown>;
5066
5061
  /**
5067
5062
  * A journaled summarize invocation for handing an inheritable brief to
5068
- * a child (docs/06, section 2.8; M6-T10): one agent-kind entry under
5063
+ * a child (M6-T10): one agent-kind entry under
5069
5064
  * role 'summarize', therefore free on replay.
5070
5065
  */
5071
5066
  brief(o: BriefOpts): Promise<string>;
5072
5067
  /**
5073
5068
  * Suspends this position on a journaled entry until an external
5074
- * resolution arrives (docs/06, section 2.7). NO deadline in v1.
5069
+ * resolution arrives. NO deadline in v1.
5075
5070
  */
5076
5071
  awaitExternal<T = Json>(key: string, o?: {
5077
5072
  schema?: SchemaSpec;
@@ -5093,7 +5088,7 @@ interface PipelineOpts {
5093
5088
  interface CollectOpts {
5094
5089
  onItemError: "collect";
5095
5090
  }
5096
- /** Options of ctx.workflow; `key` replaces args in the child identity (docs/03, 1.2). */
5091
+ /** Options of ctx.workflow; `key` replaces args in the child identity. */
5097
5092
  interface WorkflowCallOpts {
5098
5093
  key?: string;
5099
5094
  /** Lineage continuation (DEF-3); embedded in the admission decision entry. */
@@ -5102,8 +5097,8 @@ interface WorkflowCallOpts {
5102
5097
  approach?: string;
5103
5098
  }
5104
5099
  /**
5105
- * Options of ctx.brief (docs/06, 2.8; amended during M6-T10 with the
5106
- * concrete shape): the content to distill plus an optional instruction;
5100
+ * Options of ctx.brief (concrete shape fixed in M6-T10): the content to
5101
+ * distill plus an optional instruction;
5107
5102
  * the invocation resolves role 'summarize', so it needs
5108
5103
  * defaults.routing.summarize, a profile, or the explicit model.
5109
5104
  */
@@ -5113,7 +5108,7 @@ interface BriefOpts {
5113
5108
  model?: ModelSpec;
5114
5109
  agentType?: string;
5115
5110
  }
5116
- /** Closure-form workflow value; in-process only (docs/06, section "Execution model"). */
5111
+ /** Closure-form workflow value; in-process only. */
5117
5112
  interface Workflow<A = unknown, R = unknown> {
5118
5113
  readonly kind: "workflow";
5119
5114
  readonly name: string;
@@ -5163,7 +5158,7 @@ interface RunInternals {
5163
5158
  runId: string;
5164
5159
  replayer: Replayer;
5165
5160
  budget: RunBudget;
5166
- /** The single admission point for all spawns (docs/07, section 7; M6-T06). */
5161
+ /** The single admission point for all spawns (M6-T06). */
5167
5162
  admission?: AdmissionController;
5168
5163
  semaphore: Semaphore;
5169
5164
  events: RunEventSink;
@@ -5175,38 +5170,38 @@ interface RunInternals {
5175
5170
  defaults: {
5176
5171
  routing?: Partial<Record<InvocationRole, ModelSpec>>;
5177
5172
  profiles?: Record<string, AgentProfile>;
5178
- limits?: UsageLimits; /** Engine-wide permission chain layers (docs/08, section 3). */
5179
- permissions?: PermissionConfig; /** Engine-wide transport RetryPolicy (docs/04, 11.1; M4-T05). */
5180
- retry?: RetryPolicy; /** The per-engine workflow registry (docs/06, 10.4; consumers: M6 ctx.workflow, M8 worker). */
5181
- workflows?: Record<string, unknown>; /** Registered SchemaSpec names for outputSchemaRef (docs/08; M7-T05). */
5182
- schemas?: Record<string, SchemaSpec>; /** Registered tool profile names for toolsetRef (docs/08; M7-T05). */
5183
- toolsets?: Record<string, ToolsOption>; /** Registered mechanical gate profiles (docs/07, section 10; M7-T10). */
5173
+ limits?: UsageLimits; /** Engine-wide permission chain layers. */
5174
+ permissions?: PermissionConfig; /** Engine-wide transport RetryPolicy (M4-T05). */
5175
+ retry?: RetryPolicy; /** The per-engine workflow registry (consumers: M6 ctx.workflow, M8 worker). */
5176
+ workflows?: Record<string, unknown>; /** Registered SchemaSpec names for outputSchemaRef (M7-T05). */
5177
+ schemas?: Record<string, SchemaSpec>; /** Registered tool profile names for toolsetRef (M7-T05). */
5178
+ toolsets?: Record<string, ToolsOption>; /** Registered mechanical gate profiles (M7-T10). */
5184
5179
  gates?: Record<string, MechanicalGateProfile>;
5185
5180
  };
5186
- /** Engine-scoped per-provider keyed limiter (docs/06, section 4; M4-T07). */
5181
+ /** Engine-scoped per-provider keyed limiter (M4-T07). */
5187
5182
  providerLimiter?: KeyedLimiter;
5188
5183
  /** The configured price table's version; pinned in decision entries (M4-T06). */
5189
5184
  pricingVersion?: string;
5190
- /** budgetDefaults.flatReserveUsd; last resort of the reserve formula (docs/06, 5.1). */
5185
+ /** budgetDefaults.flatReserveUsd; last resort of the reserve formula. */
5191
5186
  flatReserveUsd?: number;
5192
- /** Hard router constraints from engine config (docs/04, section 9; M4-T09). */
5187
+ /** Hard router constraints from engine config (M4-T09). */
5193
5188
  floors?: QualityFloors;
5194
5189
  errorPolicy: ErrorPolicy;
5195
5190
  dropped: DroppedItem[];
5196
5191
  cost: CostAttribution;
5197
5192
  priceUsd: (servedBy: ModelRef, usage: Usage) => number | undefined;
5198
5193
  runSignal?: AbortSignal;
5199
- /** The worktree lifecycle provider (docs/08, section 8). */
5194
+ /** The worktree lifecycle provider. */
5200
5195
  isolation?: IsolationProvider;
5201
5196
  /**
5202
- * The ModelKnowledge runtime handle (docs/05; M10-T03): current()
5197
+ * The ModelKnowledge runtime handle (M10-T03): current()
5203
5198
  * only, commit physically absent. Present only when the engine was
5204
5199
  * given stores.modelKnowledge; absent means the feature is off and
5205
5200
  * no kb entries are ever written.
5206
5201
  */
5207
5202
  knowledge?: ModelKnowledgeHandle;
5208
5203
  /**
5209
- * The InProcessRunner escalation hook (docs/06, section 2.10): receives
5204
+ * The InProcessRunner escalation hook: receives
5210
5205
  * escalated results when the call form cannot carry them; its decision
5211
5206
  * is journaled as the authoritative escalation-decision entry.
5212
5207
  */
@@ -5237,7 +5232,7 @@ declare function createCtx(internals: RunInternals): Ctx<ErrorPolicy>;
5237
5232
  declare function executeWorkflow<A, R>(internals: RunInternals, wf: Workflow<A, R>, args: A): Promise<R>;
5238
5233
  //#endregion
5239
5234
  //#region src/knowledge/card.d.ts
5240
- /** docs/06, Appendix A: the KB card render budget (characters). */
5235
+ /** The KB card render budget (characters). */
5241
5236
  declare const KB_CARD_RENDER_BUDGET_CHARS = 4096;
5242
5237
  /** One declared ladder of the run, named by its agentType. */
5243
5238
  interface DeclaredLadder {
@@ -5250,12 +5245,12 @@ interface DeclaredLadder {
5250
5245
  }
5251
5246
  /**
5252
5247
  * The ladders a run declares: every advertised profile whose model
5253
- * spec is a ladder (docs/04, section 12). The card is tier-relative to
5248
+ * spec is a ladder. The card is tier-relative to
5254
5249
  * exactly these.
5255
5250
  */
5256
5251
  declare function collectDeclaredLadders(profiles: Record<string, AgentProfile> | undefined): DeclaredLadder[];
5257
5252
  /**
5258
- * The admission filter (docs/05, 4.1): status active, unexpired at
5253
+ * The admission filter: status active, unexpired at
5259
5254
  * `now`, and the subject reachable through the run's declared ladders
5260
5255
  * after the role-floor filter.
5261
5256
  */
@@ -5273,8 +5268,7 @@ interface VerifiedRecommendation {
5273
5268
  votes: number;
5274
5269
  }
5275
5270
  /**
5276
- * The verified-layer compiler (M11-T06; docs/05, sections "Read path"
5277
- * and "Composition with the model layer"): start-tier recommendations
5271
+ * The verified-layer compiler (M11-T06): start-tier recommendations
5278
5272
  * per (ladder, taskClass) compiled EXCLUSIVELY from eval-measured
5279
5273
  * claims. A strength on a rung below the default votes down (start
5280
5274
  * cheaper); a weakness on the default rung or below votes up. The net
@@ -5287,13 +5281,14 @@ interface VerifiedRecommendation {
5287
5281
  */
5288
5282
  declare function compileVerifiedLayer(claims: readonly ModelClaim[], ladders: readonly DeclaredLadder[]): VerifiedRecommendation[];
5289
5283
  /**
5290
- * The deterministic card render (docs/05, 4.3). Pure: same filtered
5284
+ * The deterministic card render. Pure: same filtered
5291
5285
  * claims and ladders give byte-identical text. The render budget is
5292
- * docs/06 Appendix A (4096 chars); over it, the OLDEST-observed notes
5286
+ * 4096 chars; over it, the OLDEST-observed notes
5293
5287
  * withhold first behind an explicit marker.
5294
5288
  */
5295
5289
  declare function modelKnowledgeCard(claims: readonly ModelClaim[], ladders: readonly DeclaredLadder[], options?: {
5296
5290
  budgetChars?: number;
5291
+ profiles?: Record<string, AgentProfile>;
5297
5292
  }): string;
5298
5293
  //#endregion
5299
5294
  //#region src/tools/presets.d.ts
@@ -5305,7 +5300,7 @@ declare function compilePermissionPreset(preset: PermissionPreset): {
5305
5300
  //#endregion
5306
5301
  //#region src/tools/shell-matcher.d.ts
5307
5302
  /**
5308
- * Argv-parsing shell matcher (M5-T06; docs/08, section 5): shell
5303
+ * Argv-parsing shell matcher (M5-T06): shell
5309
5304
  * allow/ask/deny is matched through a real argv parser, never a string
5310
5305
  * prefix. The composition rule is the entire point: for a compound
5311
5306
  * command the verdict is the strictest across segments, and any
@@ -5332,7 +5327,7 @@ interface ShellSegment {
5332
5327
  unmatchable: boolean;
5333
5328
  }
5334
5329
  /**
5335
- * Lexes a command into segments per the docs/08 5.2 algorithm. Quotes
5330
+ * Lexes a command into segments per the matching algorithm above. Quotes
5336
5331
  * and escapes are honored; nothing is expanded; `$(`, backticks, `<(`,
5337
5332
  * `>(`, and `<<` (outside single quotes) poison their segment.
5338
5333
  */
@@ -5358,19 +5353,19 @@ interface ShellPatternRules {
5358
5353
  declare function matchShellCommand(command: string, rules: ShellPatternRules): ShellVerdict;
5359
5354
  //#endregion
5360
5355
  //#region src/tools/tool.d.ts
5361
- /** First-party provider tool-name constraint intersection (docs/08, section 1.1). */
5356
+ /** First-party provider tool-name constraint intersection. */
5362
5357
  declare const TOOL_NAME_PATTERN: RegExp;
5363
5358
  interface ToolInit<S extends SchemaSpec> {
5364
5359
  name: string;
5365
5360
  description: string;
5366
5361
  parameters: S;
5367
- /** Contract version, part of toolsetHash (docs/08, section 1.2). */
5362
+ /** Contract version, part of toolsetHash. */
5368
5363
  version?: string;
5369
- /** Default 'inprocess' (docs/08, section "Executors"). */
5364
+ /** Default 'inprocess'. */
5370
5365
  executor?: ToolExecutor;
5371
- /** Default false (docs/08, section "Terminal default"). */
5366
+ /** Default false. */
5372
5367
  needsApproval?: boolean;
5373
- /** Policy metadata; never identity (docs/08, section "ToolRisk"). */
5368
+ /** Policy metadata; never identity. */
5374
5369
  risk?: ToolRisk;
5375
5370
  execute: (input: Out<S>, ctx: ToolContext) => Promise<unknown>;
5376
5371
  }
@@ -5378,13 +5373,12 @@ interface ToolInit<S extends SchemaSpec> {
5378
5373
  * Defines a tool. Definition-time failures are typed ConfigErrors, never
5379
5374
  * first-call surprises: an illegal name, a Standard Schema without the
5380
5375
  * JSON Schema projection, a recursive local $ref, or a remote/dynamic
5381
- * reference all fail here (docs/08, sections 1.1 and 2.3).
5376
+ * reference all fail here.
5382
5377
  */
5383
5378
  declare function tool<S extends SchemaSpec>(init: ToolInit<S>): ToolDef<S>;
5384
5379
  /**
5385
5380
  * The identity projection: the contract tuple that enters toolsetHash.
5386
- * parameters is the canonicalized derived JSON Schema (docs/03, section
5387
- * "schemaHash and toolsetHash derivation").
5381
+ * parameters is the canonicalized derived JSON Schema.
5388
5382
  */
5389
5383
  declare function toolContract(def: ToolDef): ToolContract;
5390
5384
  //#endregion
@@ -5419,11 +5413,11 @@ interface McpConfig {
5419
5413
  allow?: string[];
5420
5414
  /** Deny wins over allow (pre-prefix names). */
5421
5415
  deny?: string[];
5422
- /** Namespaces imported names as `${prefix}_${name}` (docs/08 6.4). */
5416
+ /** Namespaces imported names as `${prefix}_${name}`. */
5423
5417
  prefix?: string;
5424
5418
  /** true = every imported tool needsApproval; record form is per name. */
5425
5419
  approval?: boolean | Record<string, boolean>;
5426
- /** Host-supplied risk labels for imported tools (docs/08 6.2). */
5420
+ /** Host-supplied risk labels for imported tools. */
5427
5421
  risk?: Record<string, ToolRisk>;
5428
5422
  }
5429
5423
  /**
@@ -5431,19 +5425,19 @@ interface McpConfig {
5431
5425
  * first tools() call; tools/list is fetched with cursor pagination until
5432
5426
  * exhaustion and cached per session; a listChanged notification
5433
5427
  * invalidates the cache, affecting subsequently spawned agents only (a
5434
- * spawn's toolset snapshot is immutable by construction; docs/08 6.3).
5428
+ * spawn's toolset snapshot is immutable by construction).
5435
5429
  */
5436
5430
  declare function mcp(cfg: McpConfig): ToolSource;
5437
5431
  //#endregion
5438
5432
  //#region src/tools/isolation.d.ts
5439
- /** docs/06 Appendix A: the shared pin cap (park/unpark and retainWorktree). */
5433
+ /** Appendix A: the shared pin cap (park/unpark and retainWorktree). */
5440
5434
  declare const DEFAULT_MAX_PINNED_WORKTREES = 4;
5441
5435
  interface GitWorktreeProviderOptions {
5442
5436
  /** Host repository root; default process.cwd(). */
5443
5437
  repoRoot?: string;
5444
5438
  /**
5445
5439
  * Retain the tree of a FAILED agent for inspection when the engine
5446
- * requests keep on dispose (docs/08, section 8.3). Default false.
5440
+ * requests keep on dispose. Default false.
5447
5441
  */
5448
5442
  keepOnError?: boolean;
5449
5443
  /** Pin cap shared by park/unpark and retainWorktree (default 4). */
@@ -5453,7 +5447,7 @@ interface GitWorktreeProviderOptions {
5453
5447
  }
5454
5448
  /**
5455
5449
  * The shipped git worktree lifecycle. A non-git host is a typed
5456
- * ConfigError at acquire (docs/08, section 8.3, rule 1).
5450
+ * ConfigError at acquire.
5457
5451
  */
5458
5452
  declare class GitWorktreeProvider implements IsolationProvider {
5459
5453
  private readonly repoRoot;
@@ -5484,7 +5478,7 @@ declare class GitWorktreeProvider implements IsolationProvider {
5484
5478
  * of wall-clock (invariant I3: structure comes from call-and-return only).
5485
5479
  * The grammar is part of the hashVersion 2 profile.
5486
5480
  *
5487
- * Owning spec: docs/03-journal-spec.md, section "Scope-path grammar".
5481
+ * Full contract: https://docs.rulvar.com/guide/journal.
5488
5482
  *
5489
5483
  * Segment rules: a sequential body is ONE scope (sequential calls add no
5490
5484
  * segment; they are distinguished by key and ordinal only). ctx.phase is
@@ -5505,7 +5499,7 @@ declare function workflowScope(parent: string, name: string, ordinal: number): s
5505
5499
  declare function agentScope(parent: string, seq: number): string;
5506
5500
  /** PlanRunner node scopes: `plan/<NodeId>` (NodeIds are engine-minted ULIDs). */
5507
5501
  declare function planNodeScope(nodeId: string): string;
5508
- /** A parsed scope-path segment (docs/03, section 2.1). */
5502
+ /** A parsed scope-path segment. */
5509
5503
  type ScopeSegment = {
5510
5504
  kind: "parallel";
5511
5505
  site: number;
@@ -5611,7 +5605,7 @@ declare class JsonlFileStore implements JournalStore {
5611
5605
  /**
5612
5606
  * File-backed TranscriptStore (M6-T02): blobs (transcripts, checkpoints,
5613
5607
  * persisted CompiledWorkflow sources) as one file per ref under `dir`,
5614
- * so compiled runs resume across processes (docs/06, 10.2). Refs follow
5608
+ * so compiled runs resume across processes. Refs follow
5615
5609
  * the `<runId>/<name>` convention; each path segment is checked
5616
5610
  * filesystem-safe and nested segments become directories.
5617
5611
  */
@@ -5643,8 +5637,8 @@ interface RunProfile {
5643
5637
  maxDepth?: number;
5644
5638
  }
5645
5639
  /**
5646
- * The shipped presets (docs/06, section 11: fast / standard / deep /
5647
- * ultra "and similar"). Data only; a review-time assertion checks the
5640
+ * The shipped presets (fast / standard / deep / ultra "and similar").
5641
+ * Data only; a review-time assertion checks the
5648
5642
  * engine has zero behavioral branches keyed on these names.
5649
5643
  */
5650
5644
  declare const RUN_PROFILES: Record<string, RunProfile>;
@@ -5656,15 +5650,15 @@ type StructuredOutputTier = "native" | "forced-tool" | "prompt";
5656
5650
  /**
5657
5651
  * Strict-schema compatibility as both first-class providers define it:
5658
5652
  * every object node declares `additionalProperties: false` and lists every
5659
- * property in `required` (docs/04, section 5.2). Boolean schemas and
5653
+ * property in `required`. Boolean schemas and
5660
5654
  * non-object shapes are trivially compatible.
5661
5655
  */
5662
5656
  declare function isStrictCompatibleSchema(schema: JsonSchema | boolean): boolean;
5663
5657
  /**
5664
- * Tier selection (docs/04, section 8.4): the model's declared ceiling
5658
+ * Tier selection: the model's declared ceiling
5665
5659
  * bounds the tier; the native tier additionally requires a
5666
- * strict-compatible canonical schema (docs/04, section 5.2: relying on
5667
- * silent server-side fallback is forbidden), degrading to forced-tool.
5660
+ * strict-compatible canonical schema (relying on silent server-side
5661
+ * fallback is forbidden), degrading to forced-tool.
5668
5662
  * Prefill is not a tier.
5669
5663
  */
5670
5664
  declare function selectStructuredOutputTier(caps: ModelCaps, canonicalSchema: JsonSchema): StructuredOutputTier;
@@ -5692,7 +5686,7 @@ declare function providerOf(adapter: Pick<ProviderAdapter, "id" | "provider">):
5692
5686
  declare function projectHistory(messages: Msg[], targetProvider: string): Msg[];
5693
5687
  /**
5694
5688
  * Lifts the adapter-shipped retention payload of one finished turn into
5695
- * provider-raw parts (docs/04, section 2.3 retention transport). Reads
5689
+ * provider-raw parts (the retention transport). Reads
5696
5690
  * providerMetadata[<adapter id>].retainedParts and tags each block with
5697
5691
  * the adapter's provider family. Returns [] when the adapter shipped
5698
5692
  * nothing.
@@ -5700,17 +5694,17 @@ declare function projectHistory(messages: Msg[], targetProvider: string): Msg[];
5700
5694
  declare function liftRetainedParts(providerMetadata: Record<string, unknown> | undefined, adapter: Pick<ProviderAdapter, "id" | "provider">): Part[];
5701
5695
  //#endregion
5702
5696
  //#region src/runtime/compaction.d.ts
5703
- /** Appendix A: compaction threshold default, 0.8 of contextWindow. */
5697
+ /** Compaction threshold default, 0.8 of contextWindow. */
5704
5698
  declare const DEFAULT_COMPACTION_THRESHOLD = .8;
5705
5699
  /** Deterministic marker opening every compaction summary message. */
5706
5700
  declare const COMPACTION_SUMMARY_PREFIX = "Summary of the conversation so far:";
5707
- /** Per-profile compaction config (docs/06, section 6, AgentProfile). */
5701
+ /** Per-profile compaction config (AgentProfile). */
5708
5702
  interface CompactionConfig {
5709
5703
  /** Fraction of the loop model's contextWindow; default 0.8. */
5710
5704
  threshold?: number;
5711
5705
  }
5712
5706
  /**
5713
- * The threshold check (docs/06, M4-T03 committed semantics): the context
5707
+ * The threshold check (M4-T03 committed semantics): the context
5714
5708
  * estimate is the last loop turn's inputTokens + outputTokens; the Usage
5715
5709
  * invariant makes inputTokens the full prompt, and the turn's output
5716
5710
  * joins the next prompt.
@@ -5746,7 +5740,7 @@ declare function compactMessages(messages: Msg[], summaryText: string): Msg[];
5746
5740
  * agent with no tools every tier rides (the M1 behavior, unchanged).
5747
5741
  */
5748
5742
  declare function canRideLoopTurn(tier: StructuredOutputTier, toolsAvailable: boolean): boolean;
5749
- /** The inputs of the extract-necessity rule (docs/04, section 8.3, extract row). */
5743
+ /** The inputs of the extract-necessity rule. */
5750
5744
  interface ExtractNecessityInput {
5751
5745
  /** A schema is set on the call; without one extract never fires. */
5752
5746
  schemaSet: boolean;
@@ -5754,7 +5748,7 @@ interface ExtractNecessityInput {
5754
5748
  loopRef: ModelRef;
5755
5749
  /** The extract-resolved model (same chain, role 'extract'). */
5756
5750
  extractRef: ModelRef;
5757
- /** The required tier for the schema on the LOOP model (docs/04, section 8.4). */
5751
+ /** The required tier for the schema on the LOOP model. */
5758
5752
  loopTier: StructuredOutputTier;
5759
5753
  /** The agent's toolset is non-empty (escalate opt-in counts). */
5760
5754
  toolsAvailable: boolean;
@@ -5767,7 +5761,7 @@ interface ExtractNecessityInput {
5767
5761
  * to a different model OR the loop model's caps cannot serve the required
5768
5762
  * tier OR finalize is routed, in which case the schema never rides a loop
5769
5763
  * or synthesis turn). Otherwise the schema rides the last loop turn with
5770
- * no extra call (docs/04, sections 8.3 and 8.4 as amended in M4-T01).
5764
+ * no extra call (as amended in M4-T01).
5771
5765
  */
5772
5766
  declare function needsSeparateExtract(input: ExtractNecessityInput): boolean;
5773
5767
  /**
@@ -5775,14 +5769,14 @@ declare function needsSeparateExtract(input: ExtractNecessityInput): boolean;
5775
5769
  * map. This is the finalize TRIGGER: firing is decided by the presence of
5776
5770
  * a routing entry at any layer; the model it fires ON still resolves
5777
5771
  * through the full chain (a higher layer's all-roles `model` may override
5778
- * the routed choice per docs/04, section 8.2).
5772
+ * the routed choice).
5779
5773
  */
5780
5774
  declare function roleConfiguredInRouting(role: InvocationRole, layers: Array<ResolutionLayer | undefined>): boolean;
5781
5775
  /**
5782
5776
  * The finalize firing rule: only if configured in routing, and only after
5783
5777
  * tools stop, which presupposes a non-empty toolset. A no-tools agent's
5784
- * single loop turn is already its synthesis (docs/04, section 8.4 as
5785
- * amended in M4-T01). The caller additionally gates on the loop having
5778
+ * single loop turn is already its synthesis (as amended in M4-T01). The
5779
+ * caller additionally gates on the loop having
5786
5780
  * ended without an abort: a limit/error/cancelled/escalated loop never
5787
5781
  * reaches synthesis.
5788
5782
  */
@@ -5792,7 +5786,7 @@ declare function finalizeFires(options: {
5792
5786
  }): boolean;
5793
5787
  /**
5794
5788
  * The summarize trigger: the compaction threshold on the context window
5795
- * (docs/06, Appendix A: default 0.8). Pure predicate; the compaction
5789
+ * (default 0.8). Pure predicate; the compaction
5796
5790
  * pipeline that acts on it is M4-T03.
5797
5791
  */
5798
5792
  declare function atCompactionThreshold(usedTokens: number, contextWindow: number, threshold: number): boolean;
@@ -5804,7 +5798,7 @@ declare class ModelRetry extends Error {
5804
5798
  data?: Json;
5805
5799
  });
5806
5800
  }
5807
- /** Bounded semantic retries per tool call chain (docs/06, Appendix A). */
5801
+ /** Bounded semantic retries per tool call chain. */
5808
5802
  declare const DEFAULT_MODEL_RETRY_ATTEMPTS = 2;
5809
5803
  //#endregion
5810
5804
  //#region src/runtime/structured-output.d.ts
@@ -5838,18 +5832,18 @@ declare function extractCandidate(turn: CollectedTurn, tier: StructuredOutputTie
5838
5832
  declare function formatRePrompt(issues: Issue$1[], attempt: number, maxAttempts: number): Msg;
5839
5833
  //#endregion
5840
5834
  //#region src/orchestrator/spawn-tools.d.ts
5841
- /** docs/07 4.2: the spawn_agent parameter schema (normative). */
5835
+ /** The spawn_agent parameter schema (normative). */
5842
5836
  declare const SPAWN_AGENT_SCHEMA: SchemaSpec;
5843
- /** docs/07 4.3: parallel_agents wraps the spawn_agent params. */
5837
+ /** parallel_agents wraps the spawn_agent params. */
5844
5838
  declare const PARALLEL_AGENTS_SCHEMA: SchemaSpec;
5845
- /** docs/07 4.4: await_any and await_all share one parameter shape. */
5839
+ /** await_any and await_all share one parameter shape. */
5846
5840
  declare const AWAIT_SCHEMA: SchemaSpec;
5847
- /** docs/07 4.5: cancel_agent. */
5841
+ /** The cancel_agent parameter schema. */
5848
5842
  declare const CANCEL_AGENT_SCHEMA: SchemaSpec;
5849
- /** docs/07 4.11: finish; result validates against the declared output schema. */
5843
+ /** finish; result validates against the declared output schema. */
5850
5844
  declare const FINISH_SCHEMA: SchemaSpec;
5851
5845
  declare const FINISH_TOOL_NAME = "finish";
5852
- /** The spawn parameters as validated JSON (docs/07 4.1 TaskSpec subset). */
5846
+ /** The spawn parameters as validated JSON (a TaskSpec subset). */
5853
5847
  interface SpawnAgentParams {
5854
5848
  agentType: string;
5855
5849
  prompt: string;
@@ -5870,15 +5864,14 @@ interface SpawnAgentParams {
5870
5864
  /**
5871
5865
  * Builds the mode (c) toolset over the per-call runtime. profileCardText
5872
5866
  * rides the spawn tools' descriptions so both modes speak one agent
5873
- * vocabulary (docs/06 9.3; M6-T04).
5867
+ * vocabulary (M6-T04).
5874
5868
  */
5875
5869
  declare function buildOrchestratorTools(runtime: OrchestratorRuntime, profileCardText: string): ToolDef[];
5876
5870
  //#endregion
5877
5871
  //#region src/engine/events.d.ts
5878
5872
  /**
5879
5873
  * Spans form a tree per run; spanId values are engine-minted opaque
5880
- * strings, unique per run, pure telemetry, never identity (docs/09,
5881
- * section "Span hierarchy").
5874
+ * strings, unique per run, pure telemetry, never identity.
5882
5875
  */
5883
5876
  declare class SpanRegistry {
5884
5877
  private readonly parents;
@@ -5905,8 +5898,7 @@ declare class EventBus {
5905
5898
  spans: SpanRegistry;
5906
5899
  now?: () => number;
5907
5900
  /**
5908
- * Default true (M8-T04; docs/09, section "Redaction and sensitive
5909
- * data"): key-shaped strings in every emitted body are masked.
5901
+ * Default true (M8-T04): key-shaped strings in every emitted body are masked.
5910
5902
  * Telemetry only, never the journal: events are excluded from
5911
5903
  * identity by construction, so masking cannot perturb replay.
5912
5904
  */
@@ -5922,7 +5914,7 @@ declare class EventBus {
5922
5914
  }
5923
5915
  //#endregion
5924
5916
  //#region src/runner/sandbox-bridge.d.ts
5925
- /** Methods a sandbox script may proxy to the host ctx (docs/06, 8.2). */
5917
+ /** Methods a sandbox script may proxy to the host ctx. */
5926
5918
  type SandboxMethod = "agent" | "step" | "workflow" | "awaitExternal" | "parallel" | "pipeline" | "phase" | "budget.spent" | "budget.remaining";
5927
5919
  /** Worker-to-host protocol messages (JSON only). */
5928
5920
  type SandboxWorkerToHost = {
@@ -5985,4 +5977,4 @@ interface SandboxBridge {
5985
5977
  }
5986
5978
  declare function createSandboxBridge(ctx: Ctx<never>, options: SandboxBridgeOptions): SandboxBridge;
5987
5979
  //#endregion
5988
- export { AWAIT_SCHEMA, AbandonAttempt, AbandonFold, AbandonPayload, AbandonedSpendView, AbortClass, type AdaptiveEvents, AdmissionController, AdmissionDecision, AdmissionRejectedError, AdmissionStatsBefore, AdmitLineage, AdmitRejectReason, AdmitSpec, AdmitVerdict, AgentCallError, AgentError, type AgentEvents, AgentIdentityInput, AgentOpts, AgentProfile, AgentProfilePermissions, AgentResult, AgentResultMeta, AgentStatus, ApproachSignatureInputs, ApprovalDecision, ApprovalIdentityInput, Artifact, AttemptOutcomeClass, BUDGET_ABORT_REASON, BriefOpts, BudgetAccountView, BudgetDefaults, BudgetExhaustedError, BudgetHooks, BudgetReserve, type Bytes, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, CacheHint, CacheTtl, CanUseTool, CanonicalId, CanonicalIdentity, CanonicalLadderSpec, CanonicalModelSpec, ChatEvent, ChatRequest, CheckpointState, ChildIdentityInput, type ClaimClass, type ClaimOp, type ClaimStatus, ClaimValidationOptions, CollectOpts, CollectedTurn, CompactionConfig, CompiledPermissionChain, CompiledWorkflow, ConfigError, type CoreEvents, CostAttribution, CostReport, CreateEngineOptions, Ctx, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DebitResult, DeclaredLadder, DedupIndex, DedupNote, DerivedKey, DeriverRegistry, DispositionRule, DispositionTable, DonorCandidate, DonorRef, DroppedItem, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EffectiveUsageLimits, Effort, Engine, EngineDefaults, EntryKind, EntryRef, EntryStatus, ErrorClass, ErrorCode, ErrorPolicy, EscalatedResult, EscalationDecision, EscalationDigest, EscalationKind, EscalationLimits, EscalationOptions, EscalationReport, EscalationRequest, EventBus, type EvidenceRef, ExtensionAppendInput, ExtensionDispatchSpec, ExternalIdentityInput, ExternalRegistry, ExtractNecessityInput, FINISH_SCHEMA, FINISH_TOOL_NAME, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, FileModelKnowledgeStore, FileModelKnowledgeStoreOptions, FileTranscriptStore, FinishInfo, Gate, GateAudit, type GateRecord, GitWorktreeProvider, GitWorktreeProviderOptions, GraftBoot, HashVersion, HookVerdict, INBOX_PROPOSAL_TTL_DAYS, IdentityInput, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, InvocationRole, type IsolationProvider, type IsolationSpec, Issue$1 as Issue, JournalCompatSubCode, JournalCompatibilityError, JournalEntry, JournalMatcher, JournalMissError, JournalOperation, JournalOrderViolation, JournalSerializationHook, type JournalStore, type Json, JsonSchema, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, KeyDeriver, KeyRing, KeyedLimiter, KnowledgeCasError, type KnowledgeSnapshot, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LadderSpec, type LeasableStore, type Lease, LeaseHeldError, Ledger, LineageCounters, LineageIndex, LineageRef, LineageRelation, LineageStats, LogicalTaskId, MASKED_SECRET, MAX_DEPTH_CEILING, MatchResult, McpConfig, MechanicalGateProfile, MechanicalGateVerdict, type ModelCaps, ModelChoice, type ModelClaim, ModelEpochInputs, type ModelKnowledgeHandle, type ModelKnowledgeStore, ModelListConstraint, ModelRef, ModelRetry, ModelSpec, Msg, NoProgressDetector, NodeId, NodeLinkValue, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OnEscalation, OperationDisposition, OrchestrateOptions, OrchestratorBudgetSpec, OrchestratorCapConfigError, OrchestratorExtension, OrchestratorExtensionIO, OrchestratorRuntime, Out, PARALLEL_AGENTS_SCHEMA, ParallelSiteCounter, Part, PendingExternal, PendingToolTurn, PermissionConfig, PermissionGate, PermissionHook, PermissionPreset, PermissionRule, PermissionVerdict, PhaseTarget, PipelineCollected, PipelineOpts, PlanInvariantError, PriceTable, type Pricing, type ProviderAdapter, QualityFloors, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, RandIdentityInput, RandPayload, RefEntryAppender, RefEntryClassification, RefusalInfo, ReplayDisposition, ReplayMode, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionAttempt, ResolutionBy, ResolutionFold, ResolutionLayer, ResolutionOutcome, ResolutionPayload, ResolvedInvocation, ResolvedToolset, ResumeHandle, ResumeOptions, ResumePreview, ResumeReport, RetryClass, RetryPolicy, ReuseConfig, RiskRuleValue, Role, RulvarError, RulvarErrorCode, RunAgentOptions, RunBudget, RunEventSink, type RunFilter, RunHandle, RunInternals, type RunMeta, RunOptions, RunOutcome, RunProfile, RunStatus, RuntimeEventSink, SPAWN_AGENT_SCHEMA, SandboxBridge, SandboxBridgeOptions, SandboxError, SandboxHostToWorker, SandboxMethod, SandboxWorkerToHost, SchemaPair, SchemaSpec, SchemaValidationResult, ScopeSegment, ScriptRejected, ScriptRunner, ScrubNote, Semaphore, SerializationHook, Settled, ShellPatternRules, ShellSegment, ShellVerdict, SinglePhaseAppend, SpanMinter, SpanRegistry, SpawnAdmissionValue, SpawnAgentParams, SpawnKey, SpawnLineage, SpawnLineageOpt, SpawnOrigin, SpawnRecord, Spend, Stage, type StandardJSONSchemaV1, type StandardSchemaV1, StepIdentityInput, StructuredOutputTier, SuspendedAppend, SuspensionState, TOOL_NAME_PATTERN, type TaskClass, TaskDigest, TaskSpec, TerminalPatch, TerminationAccount, TerminationAccountSnapshot, TerminationDeniedValue, TerminationDeniedWriter, TerminationInitValue, TerminationLimits, TerminationResource, ToolCallRequest, ToolChoice, type ToolContext, ToolContextSeed, ToolContract, type ToolDef, type ToolEvents, type ToolExecutor, ToolInit, type ToolRisk, ToolRuntime, type ToolSource, type ToolSourceSession, ToolsOption, TranscriptSerializationHook, type TranscriptStore, TriggerClass, TtlState, Usage, UsageLimits, VerifiedRecommendation, WAIT_FOR_EVENTS_SCHEMA, WAIT_FOR_EVENTS_TOOL_NAME, WAKE_SUMMARY_RENDER_BUDGET_CHARS, WakeBudgetBlock, WakeDigest, WakeTrigger, WireError, Workflow, WorkflowCallOpts, type WorkflowEvent, type WorkflowEventBody, WorkflowRegistry, admissionReserveUsd, agentErrorFromWire, agentErrorToWire, agentScope, applyClaimOps, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, atCompactionThreshold, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compilePermissionChain, compilePermissionPreset, compileVerifiedLayer, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, escalateTool, evaluatePermission, evaluateReuse, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, foldTermination, formatRePrompt, formatScopePath, hashWorkflowBody, hashWorkflowSource, identityJcs, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lexShellCommand, liftRetainedParts, lineageWeightOf, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, mergeUsageLimits, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, priceUsdOf, profileCard, profileRegistrySnapshotHash, projectHistory, projectIdentity, projectToJsonSchema, providerOf, readTerminationInit, registryKeyRing, remeasureQueue, replayDisposition, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, scanJournalCompatibility, schemaHash, schemaHashOfSpec, selectStructuredOutputTier, shouldCompact, spawnDepthOf, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, validateEditorialCommit, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateSchemaSpec, validateTerminationLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
5980
+ export { AWAIT_SCHEMA, AbandonAttempt, AbandonFold, AbandonPayload, AbandonedSpendView, AbortClass, type AdaptiveEvents, AdmissionController, AdmissionDecision, AdmissionRejectedError, AdmissionStatsBefore, AdmitLineage, AdmitRejectReason, AdmitSpec, AdmitVerdict, AgentCallError, AgentError, type AgentEvents, AgentIdentityInput, AgentOpts, AgentProfile, AgentProfilePermissions, AgentResult, AgentResultMeta, AgentStatus, ApproachSignatureInputs, ApprovalDecision, ApprovalIdentityInput, Artifact, AttemptOutcomeClass, BUDGET_ABORT_REASON, BriefOpts, BudgetAccountView, BudgetDefaults, BudgetExhaustedError, BudgetHooks, BudgetReserve, type Bytes, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, CacheHint, CacheTtl, CanUseTool, CanonicalId, CanonicalIdentity, CanonicalLadderSpec, CanonicalModelSpec, ChatEvent, ChatRequest, CheckpointState, ChildIdentityInput, type ClaimClass, type ClaimOp, type ClaimStatus, ClaimValidationOptions, CollectOpts, CollectedTurn, CompactionConfig, CompiledPermissionChain, CompiledWorkflow, ConfigError, type CoreEvents, CostAttribution, CostReport, CreateEngineOptions, Ctx, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DebitResult, DeclaredLadder, DedupIndex, DedupNote, DerivedKey, DeriverRegistry, DispositionRule, DispositionTable, DonorCandidate, DonorRef, DroppedItem, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EffectiveUsageLimits, Effort, Engine, EngineDefaults, EntryKind, EntryRef, EntryStatus, ErrorClass, ErrorCode, ErrorPolicy, EscalatedResult, EscalationDecision, EscalationDigest, EscalationKind, EscalationLimits, EscalationOptions, EscalationReport, EscalationRequest, EventBus, type EvidenceRef, ExtensionAppendInput, ExtensionDispatchSpec, ExternalIdentityInput, ExternalRegistry, ExtractNecessityInput, FINISH_SCHEMA, FINISH_TOOL_NAME, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, FileModelKnowledgeStore, FileModelKnowledgeStoreOptions, FileTranscriptStore, FinishInfo, Gate, GateAudit, type GateRecord, GitWorktreeProvider, GitWorktreeProviderOptions, GraftBoot, HashVersion, HookVerdict, INBOX_PROPOSAL_TTL_DAYS, IdentityInput, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, InvocationRole, type IsolationProvider, type IsolationSpec, Issue$1 as Issue, JournalCompatSubCode, JournalCompatibilityError, JournalEntry, JournalMatcher, JournalMissError, JournalOperation, JournalOrderViolation, JournalSerializationHook, type JournalStore, type Json, JsonSchema, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, type KbProposal, type KbProposalTrigger, KeyDeriver, KeyRing, KeyedLimiter, KnowledgeCasError, type KnowledgeSnapshot, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LadderSpec, type LeasableStore, type Lease, LeaseHeldError, Ledger, LineageCounters, LineageIndex, LineageRef, LineageRelation, LineageStats, LogicalTaskId, MASKED_SECRET, MAX_DEPTH_CEILING, MatchResult, McpConfig, MechanicalGateProfile, MechanicalGateVerdict, type ModelCaps, ModelChoice, type ModelClaim, ModelEpochInputs, type ModelKnowledgeHandle, type ModelKnowledgeStore, ModelListConstraint, ModelRef, ModelRetry, ModelSpec, Msg, NoProgressDetector, NodeId, NodeLinkValue, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OnEscalation, OperationDisposition, OrchestrateOptions, OrchestratorBudgetSpec, OrchestratorCapConfigError, OrchestratorExtension, OrchestratorExtensionIO, OrchestratorRuntime, Out, PARALLEL_AGENTS_SCHEMA, ParallelSiteCounter, Part, PendingExternal, PendingToolTurn, PermissionConfig, PermissionGate, PermissionHook, PermissionPreset, PermissionRule, PermissionVerdict, PhaseTarget, PipelineCollected, PipelineOpts, PlanInvariantError, PriceTable, type Pricing, type ProviderAdapter, QualityFloors, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, RandIdentityInput, RandPayload, RefEntryAppender, RefEntryClassification, RefusalInfo, ReplayDisposition, ReplayMode, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionAttempt, ResolutionBy, ResolutionFold, ResolutionLayer, ResolutionOutcome, ResolutionPayload, ResolvedInvocation, ResolvedToolset, ResumeHandle, ResumeOptions, ResumePreview, ResumeReport, RetryClass, RetryPolicy, ReuseConfig, RiskRuleValue, Role, RulvarError, RulvarErrorCode, RunAgentOptions, RunBudget, RunEventSink, type RunFilter, RunHandle, RunInternals, type RunMeta, RunOptions, RunOutcome, RunProfile, RunStatus, RuntimeEventSink, SPAWN_AGENT_SCHEMA, SandboxBridge, SandboxBridgeOptions, SandboxError, SandboxHostToWorker, SandboxMethod, SandboxWorkerToHost, SchemaPair, SchemaSpec, SchemaValidationResult, ScopeSegment, ScriptRejected, ScriptRunner, ScrubNote, Semaphore, SerializationHook, Settled, ShellPatternRules, ShellSegment, ShellVerdict, SinglePhaseAppend, SpanMinter, SpanRegistry, SpawnAdmissionValue, SpawnAgentParams, SpawnKey, SpawnLineage, SpawnLineageOpt, SpawnOrigin, SpawnRecord, Spend, Stage, type StandardJSONSchemaV1, type StandardSchemaV1, StepIdentityInput, StructuredOutputTier, SuspendedAppend, SuspensionState, TOOL_NAME_PATTERN, type TaskClass, TaskDigest, TaskSpec, TerminalPatch, TerminationAccount, TerminationAccountSnapshot, TerminationDeniedValue, TerminationDeniedWriter, TerminationInitValue, TerminationLimits, TerminationResource, ToolCallRequest, ToolChoice, type ToolContext, ToolContextSeed, ToolContract, type ToolDef, type ToolEvents, type ToolExecutor, ToolInit, type ToolRisk, ToolRuntime, type ToolSource, type ToolSourceSession, ToolsOption, TranscriptSerializationHook, type TranscriptStore, TriggerClass, TtlState, Usage, UsageLimits, VerifiedRecommendation, WAIT_FOR_EVENTS_SCHEMA, WAIT_FOR_EVENTS_TOOL_NAME, WAKE_SUMMARY_RENDER_BUDGET_CHARS, WakeBudgetBlock, WakeDigest, WakeTrigger, WireError, Workflow, WorkflowCallOpts, type WorkflowEvent, type WorkflowEventBody, WorkflowRegistry, admissionReserveUsd, agentErrorFromWire, agentErrorToWire, agentScope, applyClaimOps, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, atCompactionThreshold, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compilePermissionChain, compilePermissionPreset, compileVerifiedLayer, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, escalateTool, evaluatePermission, evaluateReuse, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, foldTermination, formatRePrompt, formatScopePath, hashWorkflowBody, hashWorkflowSource, identityJcs, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lexShellCommand, liftRetainedParts, lineageWeightOf, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, mergeUsageLimits, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, priceUsdOf, profileCard, profileRegistrySnapshotHash, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, readTerminationInit, registryKeyRing, remeasureQueue, replayDisposition, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, scanJournalCompatibility, schemaHash, schemaHashOfSpec, selectStructuredOutputTier, shouldCompact, spawnDepthOf, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, validateEditorialCommit, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateSchemaSpec, validateTerminationLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };