@rulvar/core 1.243.0 → 1.244.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 +212 -25
  2. package/dist/index.js +265 -19
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1194,14 +1194,27 @@ type RunMeta = {
1194
1194
  workflowHash?: string; /** TranscriptStore ref of the persisted CompiledWorkflow source. */
1195
1195
  workflowSourceRef?: string;
1196
1196
  /**
1197
- * The run's immutable USD ceiling (RunOptions.budgetUsd), recorded so
1198
- * resume restores the original invocation's bound. Absent when the
1199
- * run started without a ceiling. Stores must round-trip the field
1200
- * (the conformance kit checks); a store that drops it degrades a
1201
- * resumed run to uncapped.
1197
+ * The run's segment-immutable USD ceiling (RunOptions.budgetUsd),
1198
+ * recorded so resume restores the original invocation's bound (only
1199
+ * the explicit, journaled ResumeOptions.run override changes it,
1200
+ * RV2208, by rewriting this field for the run's remaining life).
1201
+ * Absent when the run started without a ceiling. Stores must
1202
+ * round-trip the field (the conformance kit checks); a store that
1203
+ * drops it degrades a resumed run to uncapped.
1202
1204
  */
1203
1205
  budgetUsd?: number;
1204
1206
  /**
1207
+ * The ceiling-override posture (RunOptions.budgetPolicy, RV3902),
1208
+ * recorded at genesis only when 'immutable-lifetime': under it a
1209
+ * resume carrying any ResumeOptions.run override refuses typed
1210
+ * before ownership. Absent means 'segment', the historical
1211
+ * behavior. Stores must round-trip the field (the conformance kit
1212
+ * checks); a store that drops it degrades the run to the 'segment'
1213
+ * posture (the override door works again), never to an invented
1214
+ * refusal.
1215
+ */
1216
+ budgetPolicy?: "immutable-lifetime";
1217
+ /**
1205
1218
  * The opt-in in-flight exposure cap
1206
1219
  * (RunOptions.maxInFlightExposureUsd), recorded at genesis so resume
1207
1220
  * restores the original invocation's cap (RV1504): the option used
@@ -1746,6 +1759,37 @@ interface TerminalEnvelope {
1746
1759
  */
1747
1760
  provenance?: "journal";
1748
1761
  }
1762
+ /**
1763
+ * The runtime gate over the terminal envelope contract (RV3903, the
1764
+ * fourth comparison experiment). `terminalEnvelopeOf` is the ONE
1765
+ * producer, but a producer is a compile-time promise, and the envelope
1766
+ * crosses trust boundaries the type system never sees: a journal read
1767
+ * back after a restart, a plain JS caller, an HTTP body a pipeline
1768
+ * gates on. The experiment probed the built dist and the typed copy
1769
+ * accepted `status: 'green'`, NaN dollars, and negative counts without
1770
+ * a sound; a finance or compliance consumer downstream would have
1771
+ * gated a run on fiction.
1772
+ *
1773
+ * The gate validates the CONTRACT fields and refuses with a typed
1774
+ * {@link ConfigError} naming the field and the defect: enum `status`
1775
+ * and `completion`, finite nonnegative money (with `totalUsd <=
1776
+ * grossUsd`, gross being net plus abandoned by construction), usage
1777
+ * and counters, `settledReason` only beside `settled: false`, the
1778
+ * `costBasis` and `provenance` literals, boolean `usageApprox`, and
1779
+ * the `WireError` shape when an error rides along. Unknown top-level
1780
+ * fields pass through untouched: the contract evolves additively, and
1781
+ * a parser that refused tomorrow's field would turn every additive
1782
+ * release into a wire break. On success the SAME reference comes back,
1783
+ * typed: the gate is a boundary check, never a normalizer.
1784
+ *
1785
+ * Wired where external bytes actually enter: `persistedTerminalEnvelope`
1786
+ * runs every journal-rebuilt envelope through it (and refuses typed as
1787
+ * `malformed-envelope`), which also covers the server's persisted
1788
+ * serving by construction. The live settlement chokepoint stays
1789
+ * unparsed on purpose: it is the one producer inside one process, and
1790
+ * gating it would add a throw site to settlement itself.
1791
+ */
1792
+ declare function parseTerminalEnvelope(value: unknown): TerminalEnvelope;
1749
1793
  //#endregion
1750
1794
  //#region src/l0/spi/isolation.d.ts
1751
1795
  /**
@@ -6156,7 +6200,13 @@ interface TerminationLimits {
6156
6200
  maxDepth: number;
6157
6201
  /** Maximum declared ladder length per the profile-registry snapshot. */
6158
6202
  kMax: number;
6159
- /** B0; immutable after start, no API including HITL can top up. */
6203
+ /**
6204
+ * B0 as frozen at genesis; no API, HITL included, tops up a live
6205
+ * run. The vector keeps the GENESIS ceiling even when a later
6206
+ * segment's journaled ResumeOptions.run override (RV2208) moved the
6207
+ * enforced bound: the frozen dollars are the termination account's
6208
+ * record, the override decision entry is the budget's.
6209
+ */
6160
6210
  runBudgetUsdCeiling: number;
6161
6211
  /**
6162
6212
  * The resolved orchestrator cap in absolute USD (DEF-7; XF-09),
@@ -6240,8 +6290,9 @@ declare function readTerminationInit(entry: JournalEntry): TerminationInitValue
6240
6290
  /**
6241
6291
  * Config-drift detection at resume: the journaled vector
6242
6292
  * always wins; every differing field is reported for the
6243
- * `termination:config-drift` event. Dynamic budget top-up via restart is
6244
- * excluded by construction.
6293
+ * `termination:config-drift` event. Ambient config can never top up a
6294
+ * budget through a restart; the one explicit, journaled door is
6295
+ * ResumeOptions.run (RV2208), which is a decision entry, not a drift.
6245
6296
  */
6246
6297
  declare function terminationConfigDrift(frozen: TerminationLimits, live: Partial<TerminationLimits>): Array<{
6247
6298
  field: keyof TerminationLimits;
@@ -6482,7 +6533,12 @@ interface BudgetExhaustionDiagnostics {
6482
6533
  * spawn-admission decision entries, M6).
6483
6534
  */
6484
6535
  declare class RunBudget {
6485
- /** B0; immutable after start. Undefined means no USD ceiling. */
6536
+ /**
6537
+ * B0; immutable within a segment (RV2511): only the explicit,
6538
+ * journaled ResumeOptions.run override (RV2208) changes it, by
6539
+ * opening a new segment, and budgetPolicy 'immutable-lifetime'
6540
+ * (RV3902) refuses even that. Undefined means no USD ceiling.
6541
+ */
6486
6542
  readonly ceilingUsd?: number;
6487
6543
  /**
6488
6544
  * The opt-in in-flight exposure cap (RV711). Undefined means the
@@ -7935,15 +7991,38 @@ interface RunOptions {
7935
7991
  */
7936
7992
  configFingerprint?: string;
7937
7993
  /**
7938
- * Run ceiling B0; immutable after start. Enforced by projected
7939
- * admission (a spawn whose reserve does not fit is denied before any
7940
- * dispatch), the per-turn guard with a budget-derived maxOutputTokens
7941
- * clamp, and live stream cuts on crossing; the residual
7942
- * provider-dependent overshoot is bounded by one in-flight turn per
7943
- * concurrent agent. Contract: https://docs.rulvar.com/guide/budgets.
7994
+ * Run ceiling B0; immutable within a segment (RV2511): no API tops
7995
+ * up a live run's ceiling, and the ONE explicit door after genesis
7996
+ * is the validated, journaled `ResumeOptions.run` override (RV2208),
7997
+ * which takes effect only by opening a new segment. Enforced by
7998
+ * projected admission (a spawn whose reserve does not fit is denied
7999
+ * before any dispatch), the per-turn guard with a budget-derived
8000
+ * maxOutputTokens clamp, and live stream cuts on crossing; the
8001
+ * residual provider-dependent overshoot is bounded by one in-flight
8002
+ * turn per concurrent agent. Under {@link RunOptions.budgetPolicy}
8003
+ * 'immutable-lifetime' even the override door refuses typed.
8004
+ * Contract: https://docs.rulvar.com/guide/budgets.
7944
8005
  */
7945
8006
  budgetUsd?: number;
7946
8007
  /**
8008
+ * The ceiling-override posture of the run's whole life (RV3902, the
8009
+ * fourth comparison experiment). Default 'segment', today's behavior
8010
+ * byte for byte: B0 and the exposure cap are immutable WITHIN a
8011
+ * segment, and the explicit, validated, journaled
8012
+ * `ResumeOptions.run` override (RV2208) may change them by opening a
8013
+ * new segment. 'immutable-lifetime' welds that one door shut: the
8014
+ * posture is recorded in RunMeta at genesis and restored on every
8015
+ * resume, and a resume carrying ANY `ResumeOptions.run` value
8016
+ * refuses with a typed ConfigError BEFORE ownership, meta writes, or
8017
+ * any append, raise and lower alike; no journaled override exists in
8018
+ * this mode, and the emergency lever for a run that must stop
8019
+ * spending is cancel, not a ceiling edit. Degradation is honest: a
8020
+ * store that drops the optional RunMeta field resumes as 'segment'
8021
+ * (the override door works again), never as an invented refusal.
8022
+ * Declared at genesis only; the policy itself has no override.
8023
+ */
8024
+ budgetPolicy?: "segment" | "immutable-lifetime";
8025
+ /**
7947
8026
  * The opt-in in-flight exposure cap (RV711): bounds spent money plus
7948
8027
  * the summed worst-case estimates of live dispatches. The per-turn
7949
8028
  * guard checks money already SPENT, so under `budgetUsd` alone N
@@ -8128,7 +8207,11 @@ interface ResumeOptions {
8128
8207
  * meta, or any append: such a ceiling would exhaust the segment
8129
8208
  * before its first turn and read like a fresh money death. Absent
8130
8209
  * fields keep the recorded values; an absent object keeps the
8131
- * historical behavior byte for byte.
8210
+ * historical behavior byte for byte. Under a recorded
8211
+ * {@link RunOptions.budgetPolicy} 'immutable-lifetime' (RV3902) any
8212
+ * applying override refuses typed before ownership, raise and lower
8213
+ * alike: the door this field is exists only under the 'segment'
8214
+ * posture.
8132
8215
  */
8133
8216
  run?: {
8134
8217
  budgetUsd?: number;
@@ -8153,7 +8236,9 @@ interface Engine {
8153
8236
  * whose source hash differs from the recorded one is a typed
8154
8237
  * ConfigError (M6-T02). ResumeOptions.run (RV2208) overrides the
8155
8238
  * recorded budget ceilings for the run's remaining life, with a
8156
- * journaled decision and a typed floor at the settled spend.
8239
+ * journaled decision and a typed floor at the settled spend; under
8240
+ * a recorded budgetPolicy 'immutable-lifetime' (RV3902) any applying
8241
+ * override refuses typed before ownership instead.
8157
8242
  */
8158
8243
  resume<A, R>(runId: string, wf?: Workflow<A, R> | CompiledWorkflow, options?: ResumeOptions): ResumeHandle<R>;
8159
8244
  /**
@@ -10005,6 +10090,27 @@ interface OrchestratorBudgetSpec {
10005
10090
  */
10006
10091
  synthesisReserveUsd?: number;
10007
10092
  /**
10093
+ * The admission posture of the acceptance path (RV3907, the fourth
10094
+ * comparison experiment). Preflight has long PRICED the tail and
10095
+ * warned (`reserve-line-headroom`, `orchestrator-working-room`), and
10096
+ * the experiment's run started anyway, with the warnings on record
10097
+ * and the acceptance machinery funded by luck. 'warn' (default)
10098
+ * keeps exactly that: findings in preflight, nothing at runtime.
10099
+ * 'require' turns the arithmetic into a boot refusal BEFORE the
10100
+ * first wire: the effective cap must cover, at exact fill or
10101
+ * better, the DECLARED acceptance tail (the held
10102
+ * `synthesisReserveUsd`, the claim judge's `judge.estCost` times
10103
+ * one plus the armed semantic repair round, the declared
10104
+ * `finishValidation.estRepairCostUsd`, and the armed round's
10105
+ * declared `synthesis.estCost` composition floor) plus one
10106
+ * coordination turn floor of working room. Undeclared estimates
10107
+ * contribute zero, so the gate binds exactly what the host
10108
+ * declared; the refusal journals an `acceptance_reserve_refused`
10109
+ * decision naming every term and throws the typed
10110
+ * OrchestratorCapConfigError with the same arithmetic.
10111
+ */
10112
+ acceptanceReserve?: "warn" | "require";
10113
+ /**
10008
10114
  * A positive integer, validated before any journal entry or dispatch:
10009
10115
  * the turn limit of the reserved final wake.
10010
10116
  */
@@ -10936,6 +11042,35 @@ interface OrchestrateClaimConsistencyMeta {
10936
11042
  * the synthesis rewrote what the judge cleared.
10937
11043
  */
10938
11044
  judgedHash: string;
11045
+ /**
11046
+ * How many judge passes this stage's verdict lineage ran (RV3904,
11047
+ * the fourth comparison experiment): present exactly when the
11048
+ * bounded claim repair round is armed (`onFound: 'repair'`), so a
11049
+ * consumer reading `findings: 0` can tell a clean FIRST verdict
11050
+ * (`passes: 1`) from a verdict earned through a repair
11051
+ * (`passes: 2`, the meta above always describing the LAST pass).
11052
+ * The experiment's terminal read findings 0 over a lineage whose
11053
+ * first pass had caught a real contradiction, and only the journal
11054
+ * could say so. Absent on journals and configs from before the
11055
+ * field, and absent when no repair round is armed: NOT RECORDED,
11056
+ * never a claim of a single pass.
11057
+ */
11058
+ passes?: number;
11059
+ /**
11060
+ * The findings count of the FIRST pass of this stage (RV3904),
11061
+ * present exactly when `passes` exceeds 1: what the repair round
11062
+ * consumed, so "zero findings after one round over one first-pass
11063
+ * finding" reads off the envelope instead of the journal.
11064
+ */
11065
+ firstPassFindings?: number;
11066
+ /**
11067
+ * Bounded semantic repair rounds actually dispatched at this stage
11068
+ * (RV3904); today 0 or 1, the evidence-grade precedent. Distinct
11069
+ * from the finish validation's mechanical `repairsUsed`, which
11070
+ * counts model repair turns INSIDE one invocation and keeps its
11071
+ * byte contract untouched.
11072
+ */
11073
+ semanticRepairRounds?: number;
10939
11074
  }
10940
11075
  /**
10941
11076
  * How the shipped artifact relates to the draft the run composed it
@@ -10956,6 +11091,26 @@ interface OrchestrateDraftToFinal {
10956
11091
  claimsJudgedOn?: "draft" | "final" | "both";
10957
11092
  }
10958
11093
  /**
11094
+ * The deterministic-repair aggregate of the shipped run (RV3904, the
11095
+ * fourth comparison experiment): the patches themselves stay on the
11096
+ * journaled finish-validation decisions (RV3801, byte-exact with
11097
+ * before/after hashes per decision); the acceptance envelope carries
11098
+ * the aggregate, so "was the shipped document machine-patched, and
11099
+ * from what bytes" is an envelope read instead of a journal walk.
11100
+ * Present exactly when at least one ACCEPTED deterministic repair
11101
+ * exists; every other envelope stays byte identical.
11102
+ */
11103
+ interface OrchestrateDeterministicPatches {
11104
+ /** Finish decisions whose deterministic repair was accepted. */
11105
+ decisions: number;
11106
+ /** Total individual patches across those decisions. */
11107
+ patches: number;
11108
+ /** The LAST accepted repair's canonical pre-patch hash. */
11109
+ lastBeforeHash: string;
11110
+ /** The LAST accepted repair's canonical post-patch hash; the judge rules on these bytes. */
11111
+ lastAfterHash: string;
11112
+ }
11113
+ /**
10959
11114
  * The synthesis invocation's own knobs (RV-211). Everything else about
10960
11115
  * the invocation is deterministic: the prompt derives from the journaled
10961
11116
  * draft and the settled child digest, the toolset is the single finish
@@ -11280,9 +11435,9 @@ declare function makeOrchestratorWorkflow(goal: string, opts?: OrchestrateOption
11280
11435
  * Top-level surface: creates a run. `runOptions` are the ordinary
11281
11436
  * engine {@link RunOptions} of the created run; in particular
11282
11437
  * `runOptions.budgetUsd` is the ROOT hard ceiling over the WHOLE tree
11283
- * (the orchestrator and every child), immutable after start, while
11284
- * `opts.budget` only shapes the orchestrator's own sub-account inside
11285
- * that ceiling. The shortcut previously accepted no RunOptions at all,
11438
+ * (the orchestrator and every child), immutable within a segment,
11439
+ * while `opts.budget` only shapes the orchestrator's own sub-account
11440
+ * inside that ceiling. The shortcut previously accepted no RunOptions at all,
11286
11441
  * so the canonical entry point could not set a root ceiling without
11287
11442
  * dropping to `engine.run(makeOrchestratorWorkflow(...))` (v1.18.0
11288
11443
  * review P1-5).
@@ -12209,7 +12364,14 @@ interface CostReport {
12209
12364
  * phase, or an EMPTY phase, folds under the named 'unknown' bucket
12210
12365
  * (RV3604): a '' key is unaddressable in every downstream table,
12211
12366
  * and the third comparison run's report read `byPhase {"": 5.58}`
12212
- * for the whole run.
12367
+ * for the whole run. In dynamic runs the orchestrator's own stages
12368
+ * name their dispatches since RV3905 ('fan-out' children,
12369
+ * 'coordination' loop turns and the forced-finish wake,
12370
+ * 'composition' synthesis and incremental notes, 'judge' claim
12371
+ * passes, 'repair' the bounded claim repair round), filling only
12372
+ * the vacuum: an explicit host ctx.phase around the orchestration
12373
+ * keeps its own bucket. The fourth comparison run's report read
12374
+ * byPhase 100% 'unknown' over stages the journal held apart.
12213
12375
  */
12214
12376
  byPhase: Record<string, number>;
12215
12377
  /** Spawn agentType names; absent and empty fold under 'unknown' (RV3604). */
@@ -14258,6 +14420,25 @@ interface InvoiceRow {
14258
14420
  entrySeq: number;
14259
14421
  scope: string;
14260
14422
  key: string;
14423
+ /**
14424
+ * The spawn's agent type from the terminal's cost attribution
14425
+ * (RV3906, the fourth comparison experiment): in dynamic runs the
14426
+ * scope grammar nests every orchestrator spawn under one
14427
+ * `agent:<seq>` bucket, so per-child money used to require a join
14428
+ * through the journal; the row now names the profile directly.
14429
+ * Additive and policy, never identity: absent on entries journaled
14430
+ * before cost attribution shipped, on empty attributions, and on
14431
+ * every pre-RV3906 export byte, so old journals and old consumers
14432
+ * read exactly what they always read.
14433
+ */
14434
+ agentType?: string;
14435
+ /**
14436
+ * The dispatch label from the same attribution (RV2803 journaled
14437
+ * it; RV3906 lifts it onto the row), what tells two spans of one
14438
+ * role apart without a journal join. Absent on unlabelled
14439
+ * dispatches, additive exactly like `agentType`.
14440
+ */
14441
+ label?: string;
14261
14442
  /** The call's dispatch ordinal within its invocation; remainder and slice rows continue past it. */
14262
14443
  ordinal: number;
14263
14444
  servedBy: ModelRef;
@@ -14816,9 +14997,15 @@ declare function statementRowsFromDelimited(text: string, options?: DelimitedSta
14816
14997
  * a stale settle), which is exactly the evidence `auditRun` derives a
14817
14998
  * non-terminal status from. `unknown-workflow`: nothing names the
14818
14999
  * workflow the terminal belongs to, and an envelope that invented one
14819
- * would be a lie on its most-read field.
14820
- */
14821
- type PersistedTerminalRefusal = "unsettled" | "not-terminal" | "unknown-workflow";
15000
+ * would be a lie on its most-read field. `malformed-envelope` (RV3903):
15001
+ * the rebuilt envelope failed the runtime contract gate
15002
+ * (`parseTerminalEnvelope`), which means the journal bytes this fold
15003
+ * read produced values the terminal contract forbids (NaN money, a
15004
+ * negative counter, an unknown status literal); the reconstruction is
15005
+ * withheld typed instead of served green, and the message names the
15006
+ * field and the defect.
15007
+ */
15008
+ type PersistedTerminalRefusal = "unsettled" | "not-terminal" | "unknown-workflow" | "malformed-envelope";
14822
15009
  /** The reconstruction verdict: an envelope, or a typed refusal. */
14823
15010
  type PersistedTerminalResult = {
14824
15011
  available: true;
@@ -16165,4 +16352,4 @@ interface SandboxBridge {
16165
16352
  declare const SANDBOX_AGENT_OPT_KEYS: readonly string[];
16166
16353
  declare function createSandboxBridge(ctx: Ctx<never>, options: SandboxBridgeOptions): SandboxBridge;
16167
16354
  //#endregion
16168
- export { AWAIT_SCHEMA, AbandonAttempt, AbandonFold, AbandonPayload, AbandonedSpendView, AbortClass, AcceptanceChildSummary, type AdaptiveEvents, AdmissionController, AdmissionDecision, AdmissionRejectedError, AdmissionStatsBefore, AdmitLineage, AdmitRejectReason, AdmitSpec, AdmitVerdict, AgentCallError, AgentError, type AgentEvents, AgentIdentityInput, type AgentInvocationRow, AgentOpts, AgentProfile, AgentProfilePermissions, AgentProfileTemplateOptions, AgentResult, AgentResultMeta, AgentStatus, type AppliedPricingRow, ApproachSignatureInputs, ApprovalDecision, ApprovalIdentityInput, Artifact, AttemptOutcomeClass, AuditCategory, AuditRecord, AuditRunsOptions, BUDGET_ABORT_REASON, BaseAppend, BillingComponent, BriefOpts, BudgetAccountView, BudgetDefaults, BudgetExhaustedError, BudgetExhaustionDiagnostics, BudgetHooks, BudgetReserve, type Bytes, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_JUDGE_LABEL, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, CacheHint, CachePolicy, CacheTtl, CanUseTool, CanonicalId, CanonicalIdentity, CanonicalLadderSpec, CanonicalModelSpec, ChatEvent, ChatRequest, CheckpointState, ChildArtifactPage, ChildExecutionFacts, ChildIdentityInput, ChildResultPage, ChildrenAtFailure, CitationTarget, type ClaimClass, ClaimContradictionFinding, ClaimCoverageGrade, ClaimCoverageInput, type ClaimOp, ClaimPair, ClaimPairOptions, ClaimPairsFold, ClaimPoolReading, type ClaimStatus, ClaimValidationOptions, CollectOpts, CollectedTurn, CompactionConfig, CompiledPermissionChain, CompiledWorkflow, ComponentDelta, ConfigError, Contradiction, ContradictionClaim, ContradictionOptions, ContradictionSource, type CoreEvents, CostAttribution, CostAttributionFacts, type CostBasis, CostReport, CreateEngineOptions, type CriticalPath, Ctx, DECISION_CHAIN_KINDS, DEFAULT_ANCHOR_PATTERN, DEFAULT_ARTIFACT_PATTERN, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, DEFAULT_CITATION_SAMPLE, DEFAULT_CLAIM_JUDGE_MAX_TURNS, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_CALLS_PER_ENTRY, DEFAULT_EVIDENCE_GRADE_PHRASES, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_EVIDENCE_OVERHEAD_CALLS, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_CLAIM_PAIRS, DEFAULT_MAX_CONTRADICTIONS, DEFAULT_MAX_DEPTH, DEFAULT_MAX_EXCERPT_CHARS, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PAIR_EXCERPT_CHARS, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_POOL_PER_PAIR, DEFAULT_MAX_QUOTA_DENIALS, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_RUN_FACT_PAIRS, 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, DEFAULT_SYNTHESIS_MAX_TURNS, DEFAULT_SYNTHESIS_NOTE_MAX_TURNS, DataKeyProvider, DebitResult, DecisionChainRow, DeclaredLadder, DedupIndex, DedupNote, DedupedClaims, DelimitedStatementOptions, DerivedKey, DeriverRegistry, type DeterminismConfig, DeterminismError, type DeterminismEvents, type DeterminismMode, DispositionRule, DispositionTable, DocumentedRates, DonorCandidate, DonorRef, DroppedItem, EMIT_RESULT_TOOL, EMPTY_AUTHORITY_HASH, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EVENT_SEGMENT_STRIDE, EXPOSURE_WAIT_SWEEP_MS, EffectiveUsageLimits, Effort, Engine, EngineDefaults, EngineQuotaConfig, EngineQuotaRuntime, EntryBillingFold, EntryBillingUnit, EntryKind, EntryRef, EntryStatus, EnvelopeEncryption, EnvelopeEncryptionOptions, ErrorClass, ErrorCode, ErrorPolicy, EscalatedResult, EscalationDecision, EscalationDecisionAbortedError, EscalationDigest, EscalationKind, EscalationLimits, EscalationOptions, EscalationReport, EscalationRequest, EventBus, EvidenceContract, type EvidenceRef, type ExecKeyDerivation, type ExecutorRegistry, type ExplorationSummary, ExtensionAppendInput, ExtensionDispatchSpec, ExternalIdentityInput, ExternalRegistry, ExtractNecessityInput, FINALIZE_SYNTHESIS_INSTRUCTION, FINAL_COMPOSITION_LABEL, FINISH_LESSON_CAP_CHARS, FINISH_SCHEMA, FINISH_SECTIONAL_SCHEMA, FINISH_TOOL_NAME, FUTURE_RATES_TOLERANCE_MS, FailRunError, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, FencedCodeMode, FileModelKnowledgeStore, FileModelKnowledgeStoreOptions, FileTranscriptStore, type FinalizationWindowBudget, FinishContract, FinishContractCitations, FinishContractGoldenReject, FinishContractManifest, FinishContractSectionPattern, FinishInfo, FinishRepairHint, FinishSelfTestFailure, FinishSelfTestFixtures, FinishSelfTestReport, FinishValidationChild, FinishValidationInput, FinishValidationSpec, FinishValidationVerdict, FinishValidator, GET_CHILD_RESULT_SCHEMA, GET_CHILD_RESULT_TOOL_NAME, GET_SETTLED_CHILD_RESULTS_SCHEMA, GET_SETTLED_CHILD_RESULTS_TOOL_NAME, Gate, GateAudit, type GateRecord, GitWorktreeProvider, GitWorktreeProviderOptions, GraftBoot, HashVersion, HookVerdict, IMPLEMENTATION_PROFILE_LIMITS, INBOX_PROPOSAL_TTL_DAYS, IN_FLIGHT_EXPOSURE_REFUSAL_PREFIX, IdentityInput, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, IncrementalSynthesisResult, InvalidResolutionError, InvocationRole, type InvocationTable, InvoiceCardinality, InvoiceExport, InvoicePricingProvenance, InvoiceReconciliation, InvoiceRow, type IsolatedExecContext, type IsolatedExecRequest, type IsolatedExecutorTag, type IsolationProvider, type IsolationSpec, Issue$1 as Issue, JOURNAL_ENVELOPE_MARKER, JournalCompatSubCode, JournalCompatibilityError, JournalEntry, JournalIntegrityError, JournalMatcher, JournalMissError, JournalOperation, JournalOrderViolation, type JournalPricingSnapshot, JournalSealedError, JournalSerializationContext, JournalSerializationHook, type JournalStore, JournaledChild, JournaledChildRoster, JournaledCriticalPath, JournaledPostFanIn, JournaledSynthesisCandidate, JournaledSynthesisCandidateReport, 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, LogicalRunTelemetry, LogicalTaskId, MASKED_SECRET, MAX_CHILD_RESULT_PAGE_CHARS, MAX_CRITICAL_UNCOVERED, MAX_DEPTH_CEILING, MAX_RUN_FACTS_SHEET_CHARS, MAX_RUN_ID_LENGTH, MAX_TIMER_DELAY_MS, MatchResult, McpConfig, McpToolSource, MechanicalGateProfile, MechanicalGateVerdict, MemoryQuotaLimiter, type MetaLookupStore, type ModelCaps, ModelChoice, type ModelClaim, ModelEpochInputs, type ModelKnowledgeHandle, type ModelKnowledgeStore, ModelListConstraint, ModelRef, ModelRetry, ModelSpec, Msg, NoProgressDetector, NodeId, NodeLinkValue, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OnEscalation, OperationDisposition, OrchestrateAcceptance, OrchestrateClaimConsistency, OrchestrateClaimConsistencyMeta, OrchestrateContradictions, OrchestrateContradictionsMeta, OrchestrateDraftToFinal, OrchestrateOptions, OrchestrateSynthesis, OrchestrateSynthesisSkipReason, OrchestratorBudgetSpec, OrchestratorCapConfigError, OrchestratorExtension, OrchestratorExtensionIO, OrchestratorRuntime, Out, OutputContractManifest, PARALLEL_AGENTS_SCHEMA, PROGRESS_REPORT_TOOL_NAME, ParallelSiteCounter, Part, PendingExternal, PendingToolTurn, PermissionConfig, PermissionGate, PermissionHook, PermissionPreset, PermissionRule, PermissionVerdict, PersistedTerminalRefusal, PersistedTerminalResult, type PhaseRow, PhaseTarget, PilotAgentProfileOptions, PilotAgentProfileResult, type PinnedPricingSegment, PipelineCollected, PipelineOpts, PlanInvariantError, type PostFanInBreakdown, PreflightAdmissionRow, PreflightFinding, PreflightInput, PreflightOrchestratorSpec, PreflightReport, PreflightSpawnReport, PreflightSpawnSpec, PreflightToolCeiling, PriceTable, PricedComponent, PricedComponents, PricedUsage, type Pricing, type PricingTier, ProgressReport, type ProviderAdapter, ProviderCallRecord, ProviderStatement, QUOTA_WINDOW_MS, QualityFloors, QuotaCounters, type QuotaDecision, type QuotaEstimate, type QuotaLimiter, type QuotaReservationRequest, QuotaRule, QuotaWindowSnapshot, READ_CHILD_ARTIFACT_SCHEMA, READ_CHILD_ARTIFACT_TOOL_NAME, RESEARCH_PROFILE_LIMITS, REVIEW_PROFILE_LIMITS, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_FACTS_ANCHOR, RUN_PROFILES, RUN_SETTLE_DECISION_TYPE, RandIdentityInput, RandPayload, RateLimitObservation, ReconcileOptions, ReconcileResult, ReconcileStatementOptions, RefEntryAppender, RefEntryClassification, RefusalInfo, RejectedFinishCandidate, RepeatedClaim, ReplayDisposition, ReplayMode, ReplayPlanHashMismatch, Replayer, RepositoryResearchToolset, RepositoryResearchToolsetOptions, ResearchAgentProfileOptions, ResearchAgentProfileResult, ResearchEvidenceEntry, ResolutionArbiter, ResolutionAttempt, ResolutionBy, ResolutionFold, ResolutionLayer, ResolutionOutcome, ResolutionPayload, ResolvedInvocation, ResolvedToolset, ResumeHandle, ResumeOptions, ResumePreview, ResumeReport, RetryClass, RetryPolicy, ReuseConfig, RiskRuleValue, Role, RulvarError, RulvarErrorCode, RunAgentOptions, RunAuditVerdict, RunBudget, RunEventSink, RunExport, RunFactPairOptions, RunFactPairsFold, RunFactsSheet, type RunFilter, RunHandle, RunInternals, type RunMeta, RunOptions, RunOutcome, RunProfile, RunStateAudit, RunStatus, RuntimeEventSink, SANDBOX_AGENT_OPT_KEYS, SPAWN_ADMISSION_DECISION_TYPE, SPAWN_AGENT_SCHEMA, SYNTHESIS_NOTE_LABEL, SandboxBridge, SandboxBridgeOptions, SandboxError, SandboxHostToWorker, SandboxMethod, SandboxWorkerToHost, SchemaPair, SchemaSpec, SchemaValidationResult, ScopeSegment, ScriptRejected, ScriptRunner, ScrubNote, SecretMasker, SectionMatchMode, SectionPatternEntry, SectionalRoundPlan, SemanticPassSummary, SemanticPassesSummary, Semaphore, SerializationHook, Settled, SettlementError, ShellPatternRules, ShellSegment, ShellVerdict, SinglePhaseAppend, SpanMinter, SpanRegistry, SpawnAdmissionValue, SpawnAgentParams, SpawnKey, SpawnLineage, SpawnLineageOpt, SpawnOrigin, SpawnRecord, Spend, Stage, type StandardJSONSchemaV1, type StandardSchemaV1, StatementCategoryRow, StatementColumnMap, StatementCoverage, StatementReconciliation, StatementRequestRow, StepIdentityInput, type StreamHooks, StructuredOutputTier, SupersededError, SuspendedAppend, SuspensionState, SynthesisCandidateFailure, TERMINAL_TELEMETRY_SCOPE, TOOL_NAME_PATTERN, type TaskClass, TaskDigest, TaskSpec, TelemetryScope, type TerminalEnvelope, TerminalOutcomeFacts, TerminalPatch, TerminalTelemetryScopes, TerminationAccount, TerminationAccountSnapshot, TerminationDeniedValue, TerminationDeniedWriter, TerminationInitValue, TerminationLimits, TerminationResource, ToolAuthority, type ToolBudgetSummary, ToolCalibrationExclusion, ToolCalibrationReport, ToolCalibrationRow, ToolCallRequest, ToolChoice, type ToolContext, ToolContextSeed, ToolContract, type ToolDef, type ToolEvents, type ToolExecutor, type ToolExecutorProvider, ToolInit, type ToolRisk, ToolRuntime, type ToolSource, type ToolSourceSession, ToolsOption, ToolsetAttestation, TranscriptSerializationHook, type TranscriptStore, TriggerClass, TtlState, Usage, UsageLimits, UsageSlice, 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, accountSpendFromJournal, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyFinishRepairHints, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, assertFencedWrites, assertSafeRunId, atCompactionThreshold, attestToolset, attributionBucket, auditRun, auditRuns, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, childRostersFromJournal, citationTargetsValidator, citedValueValidator, claimCoverageOf, claimExpired, claimExpiry, claimIssues, claimJudgeStageOf, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compareRates, compilePermissionChain, compilePermissionPreset, compileSecretMasker, compileVerifiedLayer, constantTimeEqual, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createEnvelopeEncryption, createSandboxBridge, criticalPathFromJournal, currentOnlyKeyRing, decodeCheckpoint, dedupeRepeatedClaims, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispatchProjectionReserveUsd, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, enforceToolsetAttestation, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidenceGradeValidator, evidencePreservedValidator, executeWorkflow, executionFactsOf, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, findContradictions, finishContract, foldLedger, foldTermination, formatCharacterValidator, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashRunOutput, hashWorkflowBody, hashWorkflowSource, headingStructureValidator, identityJcs, implementationAgentProfile, insertRunIdIntoSentence, invoiceFromJournal, isClaimJudgeLabel, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, journalPricingSnapshot, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastMechanicalRepairCostUsd, lastRunSettle, latestProgressReport, lexShellCommand, liftRetainedParts, lineageWeightOf, localKeyProvider, logicalRunTelemetry, makeOrchestratorWorkflow, manifestValidators, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, memoryQuotaLimiter, mergeQuotaDenial, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, orchestratorAdmissionEstCostUsd, pairDraftClaims, pairRunFactClaims, parallelScope, parseModelRef, parseScopePath, persistedTerminalEnvelope, phiInitialOf, pilotAgentProfile, pipelineScope, planNodeScope, preflightEstimate, priceComponentsOf, priceEntryBilling, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualRequestsDelta, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleKey, quotaRuleMatches, readRunMeta, readTerminationInit, reconcileRunMeta, reconcileStatement, reduceAuditTrail, reduceCriticalPath, reduceDecisionChain, reduceInvocationTable, registryKeyRing, remeasureQueue, renderContractRequirements, replayDisposition, repositoryResearchToolset, requiredFieldsValidator, requiredMentionsValidator, requiredSectionsValidator, researchAgentProfile, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, reviewAgentProfile, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, scopeBucket, sectionCitationsValidator, sectionPatternCountValidator, sectionalRoundPlan, selectStructuredOutputTier, selfTestFinishValidation, shouldCompact, snapshotQuotaRules, snapshotUsage, spawnDepthOf, spliceSections, statementFromRows, statementRowsFromDelimited, stripFencedBlocks, sumUsage, summarizeInstruction, summarizeOutput, synthesisCandidatesFromJournal, terminalEnvelopeOf, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolAuthority, toolCalibrationFromJournal, toolContract, toolContractHash, toolsetAuthorityHash, toolsetHash, ttlState, unionOfIntervalsMs, usageViolations, validateDetachedResolution, validateEditorialCommit, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateToolsetAttestation, validateUsageLimits, wordCountValidator, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
16355
+ export { AWAIT_SCHEMA, AbandonAttempt, AbandonFold, AbandonPayload, AbandonedSpendView, AbortClass, AcceptanceChildSummary, type AdaptiveEvents, AdmissionController, AdmissionDecision, AdmissionRejectedError, AdmissionStatsBefore, AdmitLineage, AdmitRejectReason, AdmitSpec, AdmitVerdict, AgentCallError, AgentError, type AgentEvents, AgentIdentityInput, type AgentInvocationRow, AgentOpts, AgentProfile, AgentProfilePermissions, AgentProfileTemplateOptions, AgentResult, AgentResultMeta, AgentStatus, type AppliedPricingRow, ApproachSignatureInputs, ApprovalDecision, ApprovalIdentityInput, Artifact, AttemptOutcomeClass, AuditCategory, AuditRecord, AuditRunsOptions, BUDGET_ABORT_REASON, BaseAppend, BillingComponent, BriefOpts, BudgetAccountView, BudgetDefaults, BudgetExhaustedError, BudgetExhaustionDiagnostics, BudgetHooks, BudgetReserve, type Bytes, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_JUDGE_LABEL, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, CacheHint, CachePolicy, CacheTtl, CanUseTool, CanonicalId, CanonicalIdentity, CanonicalLadderSpec, CanonicalModelSpec, ChatEvent, ChatRequest, CheckpointState, ChildArtifactPage, ChildExecutionFacts, ChildIdentityInput, ChildResultPage, ChildrenAtFailure, CitationTarget, type ClaimClass, ClaimContradictionFinding, ClaimCoverageGrade, ClaimCoverageInput, type ClaimOp, ClaimPair, ClaimPairOptions, ClaimPairsFold, ClaimPoolReading, type ClaimStatus, ClaimValidationOptions, CollectOpts, CollectedTurn, CompactionConfig, CompiledPermissionChain, CompiledWorkflow, ComponentDelta, ConfigError, Contradiction, ContradictionClaim, ContradictionOptions, ContradictionSource, type CoreEvents, CostAttribution, CostAttributionFacts, type CostBasis, CostReport, CreateEngineOptions, type CriticalPath, Ctx, DECISION_CHAIN_KINDS, DEFAULT_ANCHOR_PATTERN, DEFAULT_ARTIFACT_PATTERN, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, DEFAULT_CITATION_SAMPLE, DEFAULT_CLAIM_JUDGE_MAX_TURNS, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_CALLS_PER_ENTRY, DEFAULT_EVIDENCE_GRADE_PHRASES, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_EVIDENCE_OVERHEAD_CALLS, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_CLAIM_PAIRS, DEFAULT_MAX_CONTRADICTIONS, DEFAULT_MAX_DEPTH, DEFAULT_MAX_EXCERPT_CHARS, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PAIR_EXCERPT_CHARS, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_POOL_PER_PAIR, DEFAULT_MAX_QUOTA_DENIALS, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_RUN_FACT_PAIRS, 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, DEFAULT_SYNTHESIS_MAX_TURNS, DEFAULT_SYNTHESIS_NOTE_MAX_TURNS, DataKeyProvider, DebitResult, DecisionChainRow, DeclaredLadder, DedupIndex, DedupNote, DedupedClaims, DelimitedStatementOptions, DerivedKey, DeriverRegistry, type DeterminismConfig, DeterminismError, type DeterminismEvents, type DeterminismMode, DispositionRule, DispositionTable, DocumentedRates, DonorCandidate, DonorRef, DroppedItem, EMIT_RESULT_TOOL, EMPTY_AUTHORITY_HASH, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EVENT_SEGMENT_STRIDE, EXPOSURE_WAIT_SWEEP_MS, EffectiveUsageLimits, Effort, Engine, EngineDefaults, EngineQuotaConfig, EngineQuotaRuntime, EntryBillingFold, EntryBillingUnit, EntryKind, EntryRef, EntryStatus, EnvelopeEncryption, EnvelopeEncryptionOptions, ErrorClass, ErrorCode, ErrorPolicy, EscalatedResult, EscalationDecision, EscalationDecisionAbortedError, EscalationDigest, EscalationKind, EscalationLimits, EscalationOptions, EscalationReport, EscalationRequest, EventBus, EvidenceContract, type EvidenceRef, type ExecKeyDerivation, type ExecutorRegistry, type ExplorationSummary, ExtensionAppendInput, ExtensionDispatchSpec, ExternalIdentityInput, ExternalRegistry, ExtractNecessityInput, FINALIZE_SYNTHESIS_INSTRUCTION, FINAL_COMPOSITION_LABEL, FINISH_LESSON_CAP_CHARS, FINISH_SCHEMA, FINISH_SECTIONAL_SCHEMA, FINISH_TOOL_NAME, FUTURE_RATES_TOLERANCE_MS, FailRunError, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, FencedCodeMode, FileModelKnowledgeStore, FileModelKnowledgeStoreOptions, FileTranscriptStore, type FinalizationWindowBudget, FinishContract, FinishContractCitations, FinishContractGoldenReject, FinishContractManifest, FinishContractSectionPattern, FinishInfo, FinishRepairHint, FinishSelfTestFailure, FinishSelfTestFixtures, FinishSelfTestReport, FinishValidationChild, FinishValidationInput, FinishValidationSpec, FinishValidationVerdict, FinishValidator, GET_CHILD_RESULT_SCHEMA, GET_CHILD_RESULT_TOOL_NAME, GET_SETTLED_CHILD_RESULTS_SCHEMA, GET_SETTLED_CHILD_RESULTS_TOOL_NAME, Gate, GateAudit, type GateRecord, GitWorktreeProvider, GitWorktreeProviderOptions, GraftBoot, HashVersion, HookVerdict, IMPLEMENTATION_PROFILE_LIMITS, INBOX_PROPOSAL_TTL_DAYS, IN_FLIGHT_EXPOSURE_REFUSAL_PREFIX, IdentityInput, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, IncrementalSynthesisResult, InvalidResolutionError, InvocationRole, type InvocationTable, InvoiceCardinality, InvoiceExport, InvoicePricingProvenance, InvoiceReconciliation, InvoiceRow, type IsolatedExecContext, type IsolatedExecRequest, type IsolatedExecutorTag, type IsolationProvider, type IsolationSpec, Issue$1 as Issue, JOURNAL_ENVELOPE_MARKER, JournalCompatSubCode, JournalCompatibilityError, JournalEntry, JournalIntegrityError, JournalMatcher, JournalMissError, JournalOperation, JournalOrderViolation, type JournalPricingSnapshot, JournalSealedError, JournalSerializationContext, JournalSerializationHook, type JournalStore, JournaledChild, JournaledChildRoster, JournaledCriticalPath, JournaledPostFanIn, JournaledSynthesisCandidate, JournaledSynthesisCandidateReport, 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, LogicalRunTelemetry, LogicalTaskId, MASKED_SECRET, MAX_CHILD_RESULT_PAGE_CHARS, MAX_CRITICAL_UNCOVERED, MAX_DEPTH_CEILING, MAX_RUN_FACTS_SHEET_CHARS, MAX_RUN_ID_LENGTH, MAX_TIMER_DELAY_MS, MatchResult, McpConfig, McpToolSource, MechanicalGateProfile, MechanicalGateVerdict, MemoryQuotaLimiter, type MetaLookupStore, type ModelCaps, ModelChoice, type ModelClaim, ModelEpochInputs, type ModelKnowledgeHandle, type ModelKnowledgeStore, ModelListConstraint, ModelRef, ModelRetry, ModelSpec, Msg, NoProgressDetector, NodeId, NodeLinkValue, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OnEscalation, OperationDisposition, OrchestrateAcceptance, OrchestrateClaimConsistency, OrchestrateClaimConsistencyMeta, OrchestrateContradictions, OrchestrateContradictionsMeta, OrchestrateDeterministicPatches, OrchestrateDraftToFinal, OrchestrateOptions, OrchestrateSynthesis, OrchestrateSynthesisSkipReason, OrchestratorBudgetSpec, OrchestratorCapConfigError, OrchestratorExtension, OrchestratorExtensionIO, OrchestratorRuntime, Out, OutputContractManifest, PARALLEL_AGENTS_SCHEMA, PROGRESS_REPORT_TOOL_NAME, ParallelSiteCounter, Part, PendingExternal, PendingToolTurn, PermissionConfig, PermissionGate, PermissionHook, PermissionPreset, PermissionRule, PermissionVerdict, PersistedTerminalRefusal, PersistedTerminalResult, type PhaseRow, PhaseTarget, PilotAgentProfileOptions, PilotAgentProfileResult, type PinnedPricingSegment, PipelineCollected, PipelineOpts, PlanInvariantError, type PostFanInBreakdown, PreflightAdmissionRow, PreflightFinding, PreflightInput, PreflightOrchestratorSpec, PreflightReport, PreflightSpawnReport, PreflightSpawnSpec, PreflightToolCeiling, PriceTable, PricedComponent, PricedComponents, PricedUsage, type Pricing, type PricingTier, ProgressReport, type ProviderAdapter, ProviderCallRecord, ProviderStatement, QUOTA_WINDOW_MS, QualityFloors, QuotaCounters, type QuotaDecision, type QuotaEstimate, type QuotaLimiter, type QuotaReservationRequest, QuotaRule, QuotaWindowSnapshot, READ_CHILD_ARTIFACT_SCHEMA, READ_CHILD_ARTIFACT_TOOL_NAME, RESEARCH_PROFILE_LIMITS, REVIEW_PROFILE_LIMITS, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_FACTS_ANCHOR, RUN_PROFILES, RUN_SETTLE_DECISION_TYPE, RandIdentityInput, RandPayload, RateLimitObservation, ReconcileOptions, ReconcileResult, ReconcileStatementOptions, RefEntryAppender, RefEntryClassification, RefusalInfo, RejectedFinishCandidate, RepeatedClaim, ReplayDisposition, ReplayMode, ReplayPlanHashMismatch, Replayer, RepositoryResearchToolset, RepositoryResearchToolsetOptions, ResearchAgentProfileOptions, ResearchAgentProfileResult, ResearchEvidenceEntry, ResolutionArbiter, ResolutionAttempt, ResolutionBy, ResolutionFold, ResolutionLayer, ResolutionOutcome, ResolutionPayload, ResolvedInvocation, ResolvedToolset, ResumeHandle, ResumeOptions, ResumePreview, ResumeReport, RetryClass, RetryPolicy, ReuseConfig, RiskRuleValue, Role, RulvarError, RulvarErrorCode, RunAgentOptions, RunAuditVerdict, RunBudget, RunEventSink, RunExport, RunFactPairOptions, RunFactPairsFold, RunFactsSheet, type RunFilter, RunHandle, RunInternals, type RunMeta, RunOptions, RunOutcome, RunProfile, RunStateAudit, RunStatus, RuntimeEventSink, SANDBOX_AGENT_OPT_KEYS, SPAWN_ADMISSION_DECISION_TYPE, SPAWN_AGENT_SCHEMA, SYNTHESIS_NOTE_LABEL, SandboxBridge, SandboxBridgeOptions, SandboxError, SandboxHostToWorker, SandboxMethod, SandboxWorkerToHost, SchemaPair, SchemaSpec, SchemaValidationResult, ScopeSegment, ScriptRejected, ScriptRunner, ScrubNote, SecretMasker, SectionMatchMode, SectionPatternEntry, SectionalRoundPlan, SemanticPassSummary, SemanticPassesSummary, Semaphore, SerializationHook, Settled, SettlementError, ShellPatternRules, ShellSegment, ShellVerdict, SinglePhaseAppend, SpanMinter, SpanRegistry, SpawnAdmissionValue, SpawnAgentParams, SpawnKey, SpawnLineage, SpawnLineageOpt, SpawnOrigin, SpawnRecord, Spend, Stage, type StandardJSONSchemaV1, type StandardSchemaV1, StatementCategoryRow, StatementColumnMap, StatementCoverage, StatementReconciliation, StatementRequestRow, StepIdentityInput, type StreamHooks, StructuredOutputTier, SupersededError, SuspendedAppend, SuspensionState, SynthesisCandidateFailure, TERMINAL_TELEMETRY_SCOPE, TOOL_NAME_PATTERN, type TaskClass, TaskDigest, TaskSpec, TelemetryScope, type TerminalEnvelope, TerminalOutcomeFacts, TerminalPatch, TerminalTelemetryScopes, TerminationAccount, TerminationAccountSnapshot, TerminationDeniedValue, TerminationDeniedWriter, TerminationInitValue, TerminationLimits, TerminationResource, ToolAuthority, type ToolBudgetSummary, ToolCalibrationExclusion, ToolCalibrationReport, ToolCalibrationRow, ToolCallRequest, ToolChoice, type ToolContext, ToolContextSeed, ToolContract, type ToolDef, type ToolEvents, type ToolExecutor, type ToolExecutorProvider, ToolInit, type ToolRisk, ToolRuntime, type ToolSource, type ToolSourceSession, ToolsOption, ToolsetAttestation, TranscriptSerializationHook, type TranscriptStore, TriggerClass, TtlState, Usage, UsageLimits, UsageSlice, 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, accountSpendFromJournal, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyFinishRepairHints, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, assertFencedWrites, assertSafeRunId, atCompactionThreshold, attestToolset, attributionBucket, auditRun, auditRuns, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, childRostersFromJournal, citationTargetsValidator, citedValueValidator, claimCoverageOf, claimExpired, claimExpiry, claimIssues, claimJudgeStageOf, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compareRates, compilePermissionChain, compilePermissionPreset, compileSecretMasker, compileVerifiedLayer, constantTimeEqual, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createEnvelopeEncryption, createSandboxBridge, criticalPathFromJournal, currentOnlyKeyRing, decodeCheckpoint, dedupeRepeatedClaims, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispatchProjectionReserveUsd, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, enforceToolsetAttestation, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidenceGradeValidator, evidencePreservedValidator, executeWorkflow, executionFactsOf, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, findContradictions, finishContract, foldLedger, foldTermination, formatCharacterValidator, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashRunOutput, hashWorkflowBody, hashWorkflowSource, headingStructureValidator, identityJcs, implementationAgentProfile, insertRunIdIntoSentence, invoiceFromJournal, isClaimJudgeLabel, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, journalPricingSnapshot, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastMechanicalRepairCostUsd, lastRunSettle, latestProgressReport, lexShellCommand, liftRetainedParts, lineageWeightOf, localKeyProvider, logicalRunTelemetry, makeOrchestratorWorkflow, manifestValidators, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, memoryQuotaLimiter, mergeQuotaDenial, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, orchestratorAdmissionEstCostUsd, pairDraftClaims, pairRunFactClaims, parallelScope, parseModelRef, parseScopePath, parseTerminalEnvelope, persistedTerminalEnvelope, phiInitialOf, pilotAgentProfile, pipelineScope, planNodeScope, preflightEstimate, priceComponentsOf, priceEntryBilling, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualRequestsDelta, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleKey, quotaRuleMatches, readRunMeta, readTerminationInit, reconcileRunMeta, reconcileStatement, reduceAuditTrail, reduceCriticalPath, reduceDecisionChain, reduceInvocationTable, registryKeyRing, remeasureQueue, renderContractRequirements, replayDisposition, repositoryResearchToolset, requiredFieldsValidator, requiredMentionsValidator, requiredSectionsValidator, researchAgentProfile, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, reviewAgentProfile, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, scopeBucket, sectionCitationsValidator, sectionPatternCountValidator, sectionalRoundPlan, selectStructuredOutputTier, selfTestFinishValidation, shouldCompact, snapshotQuotaRules, snapshotUsage, spawnDepthOf, spliceSections, statementFromRows, statementRowsFromDelimited, stripFencedBlocks, sumUsage, summarizeInstruction, summarizeOutput, synthesisCandidatesFromJournal, terminalEnvelopeOf, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolAuthority, toolCalibrationFromJournal, toolContract, toolContractHash, toolsetAuthorityHash, toolsetHash, ttlState, unionOfIntervalsMs, usageViolations, validateDetachedResolution, validateEditorialCommit, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateToolsetAttestation, validateUsageLimits, wordCountValidator, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
package/dist/index.js CHANGED
@@ -1310,6 +1310,146 @@ function sanitizeTerminalText(text) {
1310
1310
  return text.replace(ESC_STRING_SEQUENCE, "").replace(ESC_CSI_SEQUENCE, "").replace(CONTROL_RUN, " ");
1311
1311
  }
1312
1312
  //#endregion
1313
+ //#region src/l0/terminal-envelope.ts
1314
+ /**
1315
+ * The unified terminal envelope (RV1105, the P1-5 arc): ONE shape
1316
+ * carrying every fact of a run's terminal, assembled once at the
1317
+ * engine's settlement chokepoint and mirrored verbatim onto the
1318
+ * resolved outcome (`outcome.envelope`), the `run:end` event
1319
+ * (`event.envelope`), and through them the HTTP outcome response and
1320
+ * the OTel run attributes. An SDK consumer, an event-only consumer,
1321
+ * and an HTTP consumer read the SAME set of facts without assembling
1322
+ * pieces from surface-specific fields; nothing pre-existing was
1323
+ * renamed or removed, the envelope is an assembly over it.
1324
+ *
1325
+ * Doctrine notes:
1326
+ * - `status` is the computation's verdict; `settled` says whether
1327
+ * anything durable records it (RV907). A resolved outcome always
1328
+ * carries `settled: true`, because an unsettled terminal REJECTS
1329
+ * `handle.result` typed instead of resolving; the `settled: false`
1330
+ * envelopes exist only on the event stream, where `settledReason:
1331
+ * 'superseded'` distinguishes the fenced-out segment (RV1009) from
1332
+ * a settlement write fault.
1333
+ * - `usageApprox` is normalized to a boolean here (the run:end field
1334
+ * keeps its absent-means-exact byte contract): `true` means some
1335
+ * priced usage was approximate, so `totalUsd` is a lower bound.
1336
+ * - `costByModel` is a detached copy of the settled fold's per-model
1337
+ * split; mutating it never touches the cost report. Since RV1213
1338
+ * `error` is detached the same way, `data` nesting included, so the
1339
+ * whole envelope is a reading a consumer may annotate freely.
1340
+ *
1341
+ * Docs: https://docs.rulvar.com/guide/observability
1342
+ */
1343
+ const ENVELOPE_STATUSES = /* @__PURE__ */ new Set([
1344
+ "ok",
1345
+ "error",
1346
+ "cancelled",
1347
+ "exhausted",
1348
+ "suspended"
1349
+ ]);
1350
+ const ENVELOPE_COMPLETIONS = /* @__PURE__ */ new Set([
1351
+ "complete",
1352
+ "partial",
1353
+ "rejected"
1354
+ ]);
1355
+ function refuseEnvelope(field, requirement, got) {
1356
+ throw new ConfigError(`terminal envelope ${field} must be ${requirement}; got ${typeof got === "number" ? String(got) : JSON.stringify(got) ?? String(got)}`);
1357
+ }
1358
+ function isPlainObject(value) {
1359
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1360
+ }
1361
+ function requireMoney(value, field) {
1362
+ if (typeof value !== "number" || !Number.isFinite(value) || value < 0) refuseEnvelope(field, "a finite nonnegative number", value);
1363
+ return value;
1364
+ }
1365
+ function requireCount$1(value, field) {
1366
+ if (typeof value !== "number" || !Number.isInteger(value) || value < 0) refuseEnvelope(field, "a nonnegative integer", value);
1367
+ }
1368
+ function requireBoolean(value, field) {
1369
+ if (typeof value !== "boolean") refuseEnvelope(field, "a boolean", value);
1370
+ }
1371
+ function requireNonEmptyString(value, field) {
1372
+ if (typeof value !== "string" || value.length === 0) refuseEnvelope(field, "a non-empty string", value);
1373
+ }
1374
+ /** Every numeric leaf of the usage subtree: finite and nonnegative. */
1375
+ function requireUsageNumbers(node, path) {
1376
+ if (typeof node === "number") {
1377
+ if (!Number.isFinite(node) || node < 0) refuseEnvelope(path, "a finite nonnegative number", node);
1378
+ return;
1379
+ }
1380
+ if (isPlainObject(node)) {
1381
+ for (const [key, item] of Object.entries(node)) requireUsageNumbers(item, `${path}.${key}`);
1382
+ return;
1383
+ }
1384
+ refuseEnvelope(path, "a number or a nested usage object", node);
1385
+ }
1386
+ /**
1387
+ * The runtime gate over the terminal envelope contract (RV3903, the
1388
+ * fourth comparison experiment). `terminalEnvelopeOf` is the ONE
1389
+ * producer, but a producer is a compile-time promise, and the envelope
1390
+ * crosses trust boundaries the type system never sees: a journal read
1391
+ * back after a restart, a plain JS caller, an HTTP body a pipeline
1392
+ * gates on. The experiment probed the built dist and the typed copy
1393
+ * accepted `status: 'green'`, NaN dollars, and negative counts without
1394
+ * a sound; a finance or compliance consumer downstream would have
1395
+ * gated a run on fiction.
1396
+ *
1397
+ * The gate validates the CONTRACT fields and refuses with a typed
1398
+ * {@link ConfigError} naming the field and the defect: enum `status`
1399
+ * and `completion`, finite nonnegative money (with `totalUsd <=
1400
+ * grossUsd`, gross being net plus abandoned by construction), usage
1401
+ * and counters, `settledReason` only beside `settled: false`, the
1402
+ * `costBasis` and `provenance` literals, boolean `usageApprox`, and
1403
+ * the `WireError` shape when an error rides along. Unknown top-level
1404
+ * fields pass through untouched: the contract evolves additively, and
1405
+ * a parser that refused tomorrow's field would turn every additive
1406
+ * release into a wire break. On success the SAME reference comes back,
1407
+ * typed: the gate is a boundary check, never a normalizer.
1408
+ *
1409
+ * Wired where external bytes actually enter: `persistedTerminalEnvelope`
1410
+ * runs every journal-rebuilt envelope through it (and refuses typed as
1411
+ * `malformed-envelope`), which also covers the server's persisted
1412
+ * serving by construction. The live settlement chokepoint stays
1413
+ * unparsed on purpose: it is the one producer inside one process, and
1414
+ * gating it would add a throw site to settlement itself.
1415
+ */
1416
+ function parseTerminalEnvelope(value) {
1417
+ if (!isPlainObject(value)) refuseEnvelope("value", "an object", value);
1418
+ requireNonEmptyString(value.runId, "runId");
1419
+ requireNonEmptyString(value.workflow, "workflow");
1420
+ if (typeof value.status !== "string" || !ENVELOPE_STATUSES.has(value.status)) refuseEnvelope("status", "one of 'ok' | 'error' | 'cancelled' | 'exhausted' | 'suspended'", value.status);
1421
+ requireBoolean(value.settled, "settled");
1422
+ if (value.settledReason !== void 0) {
1423
+ if (value.settledReason !== "superseded") refuseEnvelope("settledReason", "the literal 'superseded' when present", value.settledReason);
1424
+ if (value.settled !== false) refuseEnvelope("settledReason", "present only beside settled: false (a settled terminal has no supersession to explain)", value.settledReason);
1425
+ }
1426
+ const totalUsd = requireMoney(value.totalUsd, "totalUsd");
1427
+ const grossUsd = requireMoney(value.grossUsd, "grossUsd");
1428
+ if (totalUsd > grossUsd) refuseEnvelope("totalUsd", `at most grossUsd (${String(grossUsd)}): gross is the net fold plus abandoned spend`, totalUsd);
1429
+ if (value.costBasis !== "locally-estimated") refuseEnvelope("costBasis", "the literal 'locally-estimated'", value.costBasis);
1430
+ if (!isPlainObject(value.costByModel)) refuseEnvelope("costByModel", "an object of per-model dollars", value.costByModel);
1431
+ for (const [model, usd] of Object.entries(value.costByModel)) requireMoney(usd, `costByModel['${model}']`);
1432
+ if (value.wireRequests !== void 0) requireCount$1(value.wireRequests, "wireRequests");
1433
+ if (!isPlainObject(value.usage)) refuseEnvelope("usage", "a usage object", value.usage);
1434
+ requireUsageNumbers(value.usage, "usage");
1435
+ requireBoolean(value.usageApprox, "usageApprox");
1436
+ requireCount$1(value.agentsSpawned, "agentsSpawned");
1437
+ if (value.completion !== void 0 && (typeof value.completion !== "string" || !ENVELOPE_COMPLETIONS.has(value.completion))) refuseEnvelope("completion", "one of 'complete' | 'partial' | 'rejected' when present", value.completion);
1438
+ if (value.error !== void 0) {
1439
+ if (!isPlainObject(value.error)) refuseEnvelope("error", "a typed wire error object when present", value.error);
1440
+ requireNonEmptyString(value.error.code, "error.code");
1441
+ if (typeof value.error.message !== "string") refuseEnvelope("error.message", "a string", value.error.message);
1442
+ requireBoolean(value.error.retryable, "error.retryable");
1443
+ }
1444
+ if (value.deliverableAccepted !== void 0) requireBoolean(value.deliverableAccepted, "deliverableAccepted");
1445
+ if (value.resultAvailable !== void 0) requireBoolean(value.resultAvailable, "resultAvailable");
1446
+ if (value.acceptedArtifactRef !== void 0) requireCount$1(value.acceptedArtifactRef, "acceptedArtifactRef");
1447
+ if (value.claimConsistencyMeta !== void 0 && !isPlainObject(value.claimConsistencyMeta)) refuseEnvelope("claimConsistencyMeta", "an object when present", value.claimConsistencyMeta);
1448
+ if (value.configFingerprint !== void 0) requireNonEmptyString(value.configFingerprint, "configFingerprint");
1449
+ if (value.provenance !== void 0 && value.provenance !== "journal") refuseEnvelope("provenance", "the literal 'journal' when present", value.provenance);
1450
+ return value;
1451
+ }
1452
+ //#endregion
1313
1453
  //#region src/engine/terminal-envelope.ts
1314
1454
  /**
1315
1455
  * A total copy of one typed error (RV1213). `data` is `Json` by the
@@ -6198,8 +6338,12 @@ var LineageIndex = class {
6198
6338
  * exclusively DEBIT-ONLY API and a limits vector frozen at start in the
6199
6339
  * `termination.init` entry, plus the variant function Phi. No credit
6200
6340
  * operation exists anywhere by construction; no journal entry kind
6201
- * carries credit; B0 is immutable after start and no API, including
6202
- * HITL, can top it up. Every debit is atomic with the append of its
6341
+ * carries credit; B0 is immutable within a segment and no API,
6342
+ * including HITL, tops up a live run (the one explicit door is the
6343
+ * journaled ResumeOptions.run override at resume, RV2208, refused
6344
+ * outright under budgetPolicy 'immutable-lifetime', RV3902; the
6345
+ * frozen vector below keeps the GENESIS ceiling either way). Every
6346
+ * debit is atomic with the append of its
6203
6347
  * carrying decision entry and embeds the balance-after; an underflow
6204
6348
  * writes `termination.denied` strictly BEFORE the typed error surfaces.
6205
6349
  *
@@ -6303,8 +6447,9 @@ function readTerminationInit(entry) {
6303
6447
  /**
6304
6448
  * Config-drift detection at resume: the journaled vector
6305
6449
  * always wins; every differing field is reported for the
6306
- * `termination:config-drift` event. Dynamic budget top-up via restart is
6307
- * excluded by construction.
6450
+ * `termination:config-drift` event. Ambient config can never top up a
6451
+ * budget through a restart; the one explicit, journaled door is
6452
+ * ResumeOptions.run (RV2208), which is a decision entry, not a drift.
6308
6453
  */
6309
6454
  function terminationConfigDrift(frozen, live) {
6310
6455
  const drift = [];
@@ -14207,7 +14352,17 @@ async function runAgent(options) {
14207
14352
  output = outcome.turn.text;
14208
14353
  break;
14209
14354
  }
14210
- if (separateExtract) break;
14355
+ if (separateExtract) {
14356
+ const rideAlong = extractCandidate(outcome.turn, rideTierFor(servedTarget));
14357
+ if (rideAlong !== void 0) {
14358
+ const validation = await validateSchemaSpec(options.schema, rideAlong.raw);
14359
+ if (validation.valid) {
14360
+ output = validation.value;
14361
+ break;
14362
+ }
14363
+ }
14364
+ break;
14365
+ }
14211
14366
  const candidate = extractCandidate(outcome.turn, rideTierFor(servedTarget));
14212
14367
  const issues = [];
14213
14368
  if (candidate !== void 0) {
@@ -14496,7 +14651,7 @@ async function runAgent(options) {
14496
14651
  }
14497
14652
  endPhase(finalizePhase, phaseOutcome(), finalizeServed);
14498
14653
  }
14499
- if (status === "ok" && !finishedViaTool && separateExtract && options.extract !== void 0 && options.schema !== void 0) {
14654
+ if (status === "ok" && !finishedViaTool && separateExtract && output === null && options.extract !== void 0 && options.schema !== void 0) {
14500
14655
  const extractResolved = options.extract.resolved;
14501
14656
  const extractPhase = beginPhase("extract", extractResolved.ref);
14502
14657
  let extractServed;
@@ -14541,6 +14696,7 @@ async function runAgent(options) {
14541
14696
  toolChoice: "none"
14542
14697
  };
14543
14698
  req = applyStructuredOutputTier(req, targetTier, options.canonicalSchema ?? {});
14699
+ req = applyCachePolicy(req, target, options.cache);
14544
14700
  return applyOutputBudget(req, target, options.budget);
14545
14701
  },
14546
14702
  streamOptionsFor: (target) => {
@@ -14723,7 +14879,10 @@ async function runAgent(options) {
14723
14879
  * false). The one thing that can change it is `ResumeOptions.run`, an
14724
14880
  * explicit host decision journaled as its own decision entry, and it
14725
14881
  * takes effect only by opening a NEW segment: a live run can never
14726
- * raise the bound it is already being measured against.
14882
+ * raise the bound it is already being measured against. Under
14883
+ * RunOptions.budgetPolicy 'immutable-lifetime' (RV3902) even that door
14884
+ * refuses typed before ownership, and the recorded ceilings hold for
14885
+ * the run's whole life.
14727
14886
  *
14728
14887
  * The account tree: the run root plus one
14729
14888
  * sub-account per admitted child workflow (and, from M7, the orchestrator
@@ -14821,7 +14980,12 @@ function admissionReserveUsd(options) {
14821
14980
  * spawn-admission decision entries, M6).
14822
14981
  */
14823
14982
  var RunBudget = class {
14824
- /** B0; immutable after start. Undefined means no USD ceiling. */
14983
+ /**
14984
+ * B0; immutable within a segment (RV2511): only the explicit,
14985
+ * journaled ResumeOptions.run override (RV2208) changes it, by
14986
+ * opening a new segment, and budgetPolicy 'immutable-lifetime'
14987
+ * (RV3902) refuses even that. Undefined means no USD ceiling.
14988
+ */
14825
14989
  ceilingUsd;
14826
14990
  /**
14827
14991
  * The opt-in in-flight exposure cap (RV711). Undefined means the
@@ -16215,10 +16379,13 @@ function invoiceFromJournal(entries, priceUsd, options) {
16215
16379
  const billing = priceEntryBilling(entry, priceUsd);
16216
16380
  if (!billing.fullyAttributed) everyEntryFullyAttributed = false;
16217
16381
  const abandoned = entry.kind !== "resolution" && entry.kind !== "abandon" && abandonFold.isAbandoned(entry.ref ?? entry.seq);
16382
+ const attribution = entry.costAttribution;
16218
16383
  const base = {
16219
16384
  entrySeq: entry.seq,
16220
16385
  scope: entry.scope,
16221
- key: entry.key
16386
+ key: entry.key,
16387
+ ...attribution?.agentType === void 0 || attribution.agentType === "" ? {} : { agentType: attribution.agentType },
16388
+ ...attribution?.label === void 0 ? {} : { label: attribution.label }
16222
16389
  };
16223
16390
  const mark = abandoned ? { abandoned: true } : {};
16224
16391
  const records = entry.providerCalls ?? [];
@@ -16956,7 +17123,8 @@ function statementRowsFromDelimited(text, options) {
16956
17123
  const REFUSAL_MESSAGES = {
16957
17124
  unsettled: "no run settle is journaled for this run: nothing durable records a terminal",
16958
17125
  "not-terminal": "the journaled run settle records a running segment, not a terminal",
16959
- "unknown-workflow": "no stored metadata names the workflow this run belongs to"
17126
+ "unknown-workflow": "no stored metadata names the workflow this run belongs to",
17127
+ "malformed-envelope": "the rebuilt envelope failed the runtime terminal contract gate: the journal bytes produced values the contract forbids"
16960
17128
  };
16961
17129
  /** Every envelope status; a settle may also record the non-terminal 'running'. */
16962
17130
  const TERMINAL_STATUSES = /* @__PURE__ */ new Set([
@@ -16988,10 +17156,18 @@ function persistedTerminalEnvelope(input) {
16988
17156
  if (tail > 0) return refuse("not-terminal", `the journal continued ${String(tail)} entr${tail === 1 ? "y" : "ies"} past the settle at seq ${String(settle.seq)}: the latest segment is not settled`);
16989
17157
  const workflow = input.meta?.workflowName;
16990
17158
  if (workflow === void 0) return refuse("unknown-workflow");
17159
+ try {
17160
+ return assemble(input, workflow, settle);
17161
+ } catch (error) {
17162
+ const detail = error instanceof Error ? error.message : String(error);
17163
+ return refuse("malformed-envelope", `${REFUSAL_MESSAGES["malformed-envelope"]}: ${detail}`);
17164
+ }
17165
+ }
17166
+ function assemble(input, workflow, settle) {
16991
17167
  const ledger = foldLedger(input.entries, buildAbandonFold(input.entries));
16992
17168
  return {
16993
17169
  available: true,
16994
- envelope: terminalEnvelopeOf({
17170
+ envelope: parseTerminalEnvelope(terminalEnvelopeOf({
16995
17171
  runId: input.runId,
16996
17172
  workflow,
16997
17173
  outcome: {
@@ -17007,7 +17183,7 @@ function persistedTerminalEnvelope(input) {
17007
17183
  agentsSpawned: ledger.agentsSpawned,
17008
17184
  ...input.meta?.configFingerprint === void 0 ? {} : { configFingerprint: input.meta.configFingerprint },
17009
17185
  provenance: "journal"
17010
- })
17186
+ }))
17011
17187
  };
17012
17188
  }
17013
17189
  //#endregion
@@ -23337,6 +23513,7 @@ function validateOrchestrateOptions(opts) {
23337
23513
  if (opts.synthesis.mode === "incremental") throw new ConfigError("orchestrate budget.synthesisReserveUsd is incompatible with synthesis.mode 'incremental': the reserve protects the single post-fan-in invocation");
23338
23514
  }
23339
23515
  if (spec.finalizeTurns !== void 0) requirePositiveInteger$2(spec.finalizeTurns, "orchestrate budget.finalizeTurns");
23516
+ if (spec.acceptanceReserve !== void 0 && spec.acceptanceReserve !== "warn" && spec.acceptanceReserve !== "require") throw new ConfigError(`orchestrate budget.acceptanceReserve must be 'warn' or 'require'; got ${String(spec.acceptanceReserve)}`);
23340
23517
  if (spec.atCap !== void 0 && spec.atCap !== "finish-with-partial" && spec.atCap !== "fail-run") throw new ConfigError(`orchestrate budget.atCap must be 'finish-with-partial' or 'fail-run'; got ${String(spec.atCap)}`);
23341
23518
  }
23342
23519
  function orchestratorPrompt(goal, maxSpawns, extensionLines) {
@@ -23534,6 +23711,42 @@ function makeOrchestratorWorkflow(goal, opts) {
23534
23711
  };
23535
23712
  }
23536
23713
  }
23714
+ if (opts?.budget?.acceptanceReserve === "require") {
23715
+ const synthesisHoldUsd = opts.budget.synthesisReserveUsd ?? 0;
23716
+ const judgeEstUsd = opts?.claimConsistency?.judge?.estCost ?? 0;
23717
+ const bootClaimStage = opts?.claimConsistency?.stage ?? "draft";
23718
+ const roundArmed = (opts?.claimConsistency?.onFound ?? "report") === "repair" && bootClaimStage !== "draft";
23719
+ const judgePasses = 1 + (roundArmed ? 1 : 0);
23720
+ const judgeTailUsd = judgeEstUsd * judgePasses;
23721
+ const mechanicalRepairUsd = opts?.finishValidation?.estRepairCostUsd ?? 0;
23722
+ const roundCompositionUsd = roundArmed ? opts?.synthesis?.estCost ?? 0 : 0;
23723
+ const workingRoomUsd = capState?.turnEstimateUsd ?? internals.flatReserveUsd ?? .5;
23724
+ const requiredUsd = synthesisHoldUsd + judgeTailUsd + mechanicalRepairUsd + roundCompositionUsd + workingRoomUsd;
23725
+ const capUsd = capState?.effectiveCapUsd;
23726
+ if (capUsd === void 0 || capUsd < requiredUsd) {
23727
+ const terms = `synthesisReserveUsd ${synthesisHoldUsd.toFixed(4)} + judge ${judgeEstUsd.toFixed(4)} x ${String(judgePasses)} pass(es) + estRepairCostUsd ${mechanicalRepairUsd.toFixed(4)} + round composition ${roundCompositionUsd.toFixed(4)} + working room ${workingRoomUsd.toFixed(4)} = ${requiredUsd.toFixed(4)} USD`;
23728
+ await internals.replayer.appendSinglePhase({
23729
+ scope: callingState.scope,
23730
+ key: deriverV2.deriveKey({ kind: "acceptance-reserve-refused" }),
23731
+ kind: "decision",
23732
+ status: "ok",
23733
+ spanId: internals.spans.mint(callingState.spanId),
23734
+ site: "orchestrator-budget",
23735
+ value: {
23736
+ decisionType: "acceptance_reserve_refused",
23737
+ requiredUsd,
23738
+ effectiveCapUsd: capUsd ?? null,
23739
+ synthesisReserveUsd: synthesisHoldUsd,
23740
+ judgeEstUsd,
23741
+ judgePasses,
23742
+ estRepairCostUsd: mechanicalRepairUsd,
23743
+ roundCompositionUsd,
23744
+ workingRoomUsd
23745
+ }
23746
+ });
23747
+ throw new OrchestratorCapConfigError(capUsd === void 0 ? `budget.acceptanceReserve 'require' needs a resolved effective cap to hold the declared acceptance tail against (${terms}); declare budget.capUsd or a run ceiling` : `budget.acceptanceReserve 'require': the declared acceptance tail does not fit the effective cap ${capUsd.toFixed(4)} USD (${terms}); raise the cap or lower the declared tail`);
23748
+ }
23749
+ }
23537
23750
  const records = /* @__PURE__ */ new Map();
23538
23751
  const byOrdinal = /* @__PURE__ */ new Map();
23539
23752
  const rejectedByOrdinal = /* @__PURE__ */ new Map();
@@ -23684,6 +23897,7 @@ function makeOrchestratorWorkflow(goal, opts) {
23684
23897
  const childState = {
23685
23898
  scope,
23686
23899
  spanId: internals.spans.mint(callingState.spanId),
23900
+ phase: callingState.phase ?? "fan-out",
23687
23901
  signal: upstream === void 0 ? controller.signal : AbortSignal.any([upstream, controller.signal]),
23688
23902
  budgetScope: placement?.ownAccount === true ? scope : callingState.budgetScope ?? "run"
23689
23903
  };
@@ -25071,6 +25285,7 @@ function makeOrchestratorWorkflow(goal, opts) {
25071
25285
  };
25072
25286
  const orchestratorState = { ...callingState };
25073
25287
  if (orchestratorAccount !== void 0) orchestratorState.budgetScope = orchestratorAccount;
25288
+ orchestratorState.phase = orchestratorState.phase ?? "coordination";
25074
25289
  const loopBreakSignal = validationSpec === void 0 ? forcedFinishController.signal : AbortSignal.any([forcedFinishController.signal, validationAbort.signal]);
25075
25290
  orchestratorState.signal = callingState.signal === void 0 ? loopBreakSignal : AbortSignal.any([callingState.signal, loopBreakSignal]);
25076
25291
  /**
@@ -25126,6 +25341,7 @@ function makeOrchestratorWorkflow(goal, opts) {
25126
25341
  if (orchestratorAccount !== void 0) internals.budget.releaseFinalizeReserve(orchestratorAccount);
25127
25342
  const finalState = { ...callingState };
25128
25343
  if (orchestratorAccount !== void 0) finalState.budgetScope = orchestratorAccount;
25344
+ finalState.phase = finalState.phase ?? "coordination";
25129
25345
  const digest = buildDigest(wakeOrdinal);
25130
25346
  const reserveBaseline = orchestratorAccount === void 0 ? 0 : internals.budget.accountView(orchestratorAccount)?.spentUsd ?? 0;
25131
25347
  const dispatched = await runtime.runInScope(finalState, () => ctx.agent([
@@ -25199,6 +25415,7 @@ function makeOrchestratorWorkflow(goal, opts) {
25199
25415
  ].join("\n");
25200
25416
  const noteState = { ...callingState };
25201
25417
  if (orchestratorAccount !== void 0) noteState.budgetScope = orchestratorAccount;
25418
+ noteState.phase = noteState.phase ?? "composition";
25202
25419
  const noteOpts = {
25203
25420
  role: "synthesize",
25204
25421
  result: "full",
@@ -25693,6 +25910,7 @@ function makeOrchestratorWorkflow(goal, opts) {
25693
25910
  ].join("\n");
25694
25911
  const judgeState = { ...callingState };
25695
25912
  if (orchestratorAccount !== void 0) judgeState.budgetScope = orchestratorAccount;
25913
+ judgeState.phase = judgeState.phase ?? "judge";
25696
25914
  const judgeOpts = {
25697
25915
  role: "synthesize",
25698
25916
  result: "full",
@@ -25788,7 +26006,7 @@ function makeOrchestratorWorkflow(goal, opts) {
25788
26006
  ...snapshot ?? {}
25789
26007
  } });
25790
26008
  };
25791
- const runSynthesis = async (draft) => {
26009
+ const runSynthesis = async (draft, stagePhase = "composition") => {
25792
26010
  const spec = opts?.synthesis;
25793
26011
  if (spec === void 0) return draft;
25794
26012
  await recoveryDone;
@@ -26040,7 +26258,11 @@ function makeOrchestratorWorkflow(goal, opts) {
26040
26258
  ...opts?.contradictions?.onFound !== "carry" || contradictionsFound === void 0 || contradictionsFound.length === 0 ? [] : ["CHILD CONTRADICTIONS: the settled children read these cited locations differently; resolve each one EXPLICITLY in the final result (say which reading holds and why it does) instead of silently picking one. " + JSON.stringify(contradictionsFound)],
26041
26259
  ...opts?.claimConsistency?.onFound !== "carry" && opts?.claimConsistency?.onFound !== "repair" || claimFindingsFound === void 0 || claimFindingsFound.length === 0 ? [] : ["CLAIM CONTRADICTIONS: the composed draft contradicts the settled child pool at these cited locations; resolve each one EXPLICITLY in the final result (say which reading holds and why) instead of keeping the inverted claim. " + JSON.stringify(claimFindingsFound)],
26042
26260
  ...opts?.claimConsistency?.onFound !== "carry" && opts?.claimConsistency?.onFound !== "repair" || claimFindingsFound === void 0 || claimFindingsFound.length === 0 ? [] : hostValidationLessons(),
26043
- ...sectionalRoundContext === void 0 ? [] : [`RETAINED FINAL: ${JSON.stringify(sectionalRoundContext.base)}`, "SECTIONAL ROUND: the accepted document above is RETAINED; repair ONLY the sections owning the contradicted claims by calling finish({ sections: { \"<marker>\": \"<new section body>\" } }). Unchanged sections are spliced from the retained document byte for byte and the spliced whole is validated and judged. Target sections: " + JSON.stringify(sectionalRoundContext.targets) + ". Declared markers: " + JSON.stringify(sectionalRoundContext.sections) + ". Resubmit the full document as result only when a targeted repair is impossible."],
26261
+ ...sectionalRoundContext === void 0 ? [] : [
26262
+ `RETAINED FINAL: ${JSON.stringify(sectionalRoundContext.base)}`,
26263
+ "SECTIONAL ROUND: the accepted document above is RETAINED; repair ONLY the sections owning the contradicted claims by calling finish({ sections: { \"<marker>\": \"<new section body>\" } }). Unchanged sections are spliced from the retained document byte for byte and the spliced whole is validated and judged. Target sections: " + JSON.stringify(sectionalRoundContext.targets) + ". Declared markers: " + JSON.stringify(sectionalRoundContext.sections) + ". Resubmit the full document as result only when a targeted repair is impossible.",
26264
+ "Rewritten sections must keep the retained evidence discipline: a sentence making a verified or confirmed grade claim carries the run id or a file:line citation INSIDE the sentence, exactly like the retained sections do; a rewritten sentence that drops it fails the finish contract mechanically."
26265
+ ],
26044
26266
  ...spec.policyFacts === true ? [(() => {
26045
26267
  const byStatus = {};
26046
26268
  let extensionsGranted = 0;
@@ -26141,6 +26363,7 @@ function makeOrchestratorWorkflow(goal, opts) {
26141
26363
  const configuredReserveUsd = opts?.budget?.synthesisReserveUsd ?? 0;
26142
26364
  const heldReserveUsd = orchestratorAccount === void 0 ? 0 : internals.budget.accountView(orchestratorAccount)?.synthesisReserveUsd ?? 0;
26143
26365
  const synthesisState = { ...callingState };
26366
+ synthesisState.phase = synthesisState.phase ?? stagePhase;
26144
26367
  if (orchestratorAccount !== void 0) {
26145
26368
  synthesisState.budgetScope = orchestratorAccount;
26146
26369
  internals.budget.releaseSynthesisReserve(orchestratorAccount);
@@ -26888,6 +27111,10 @@ function makeOrchestratorWorkflow(goal, opts) {
26888
27111
  if (claimStage !== "draft") {
26889
27112
  claimConsistencyDraftMeta = claimStage === "both" ? claimConsistencyMeta : void 0;
26890
27113
  await runClaimConsistencyPass(synthesizedFinal, acceptanceSnapshot, "final");
27114
+ if ((opts?.claimConsistency?.onFound ?? "report") === "repair" && claimConsistencyMeta !== void 0) {
27115
+ claimConsistencyMeta.passes = 1;
27116
+ claimConsistencyMeta.semanticRepairRounds = 0;
27117
+ }
26891
27118
  if ((opts?.claimConsistency?.onFound ?? "report") === "repair" && claimFindingsFound !== void 0 && claimFindingsFound.length > 0) {
26892
27119
  const hashOfDocument = (value) => createHash("sha256").update(jcsSerialize(value ?? null), "utf8").digest("hex");
26893
27120
  const preRepairHash = hashOfDocument(synthesizedFinal);
@@ -26920,7 +27147,7 @@ function makeOrchestratorWorkflow(goal, opts) {
26920
27147
  }, callingState.spanId);
26921
27148
  }
26922
27149
  try {
26923
- synthesizedFinal = await runSynthesis(result.output);
27150
+ synthesizedFinal = await runSynthesis(result.output, "repair");
26924
27151
  } catch (thrown) {
26925
27152
  await journalSynthesisAdmissionDecline(thrown);
26926
27153
  const hostRejection = thrown instanceof FailRunError && typeof thrown.data === "object" && thrown.data !== null && !Array.isArray(thrown.data) && thrown.data.source === "orchestrator_finish_validation" ? thrown.data : void 0;
@@ -26958,6 +27185,11 @@ function makeOrchestratorWorkflow(goal, opts) {
26958
27185
  }
26959
27186
  try {
26960
27187
  await runClaimConsistencyPass(synthesizedFinal, acceptanceSnapshot, "final");
27188
+ if (claimConsistencyMeta !== void 0) {
27189
+ claimConsistencyMeta.passes = 2;
27190
+ claimConsistencyMeta.firstPassFindings = carried.length;
27191
+ claimConsistencyMeta.semanticRepairRounds = 1;
27192
+ }
26961
27193
  } catch (thrown) {
26962
27194
  if (thrown instanceof FailRunError && typeof thrown.data === "object" && thrown.data !== null && !Array.isArray(thrown.data) && thrown.data.source === "orchestrator_claim_consistency") throw new FailRunError(thrown.message, { data: {
26963
27195
  ...thrown.data,
@@ -26993,6 +27225,14 @@ function makeOrchestratorWorkflow(goal, opts) {
26993
27225
  };
26994
27226
  })();
26995
27227
  const envelopeRejectedCandidates = rejectedFinishCandidates();
27228
+ const acceptedRepairs = validationDecisions().map((verdict) => verdict.deterministicRepair).filter((repair) => repair !== void 0 && repair.outcome === "accepted");
27229
+ const lastAcceptedRepair = acceptedRepairs.at(-1);
27230
+ const deterministicPatches = lastAcceptedRepair === void 0 ? void 0 : {
27231
+ decisions: acceptedRepairs.length,
27232
+ patches: acceptedRepairs.reduce((sum, repair) => sum + repair.patches.length, 0),
27233
+ lastBeforeHash: lastAcceptedRepair.beforeHash,
27234
+ lastAfterHash: lastAcceptedRepair.afterHash
27235
+ };
26996
27236
  return {
26997
27237
  result: synthesizedFinal,
26998
27238
  completion: decision.completion,
@@ -27000,6 +27240,7 @@ function makeOrchestratorWorkflow(goal, opts) {
27000
27240
  ...deliverable.deliverableAccepted === void 0 ? {} : { deliverableAccepted: deliverable.deliverableAccepted },
27001
27241
  ...deliverable.acceptedArtifactRef === void 0 ? {} : { acceptedArtifactRef: deliverable.acceptedArtifactRef },
27002
27242
  ...envelopeRejectedCandidates.length === 0 ? {} : { rejectedFinishCandidates: envelopeRejectedCandidates },
27243
+ ...deterministicPatches === void 0 ? {} : { deterministicPatches },
27003
27244
  childStatusCounts: decision.childStatusCounts,
27004
27245
  degradedReasons: decision.degradedReasons,
27005
27246
  ...decision.salvagedPartialChildren === void 0 ? {} : { salvagedPartialChildren: decision.salvagedPartialChildren },
@@ -27053,9 +27294,9 @@ function makeOrchestratorWorkflow(goal, opts) {
27053
27294
  * Top-level surface: creates a run. `runOptions` are the ordinary
27054
27295
  * engine {@link RunOptions} of the created run; in particular
27055
27296
  * `runOptions.budgetUsd` is the ROOT hard ceiling over the WHOLE tree
27056
- * (the orchestrator and every child), immutable after start, while
27057
- * `opts.budget` only shapes the orchestrator's own sub-account inside
27058
- * that ceiling. The shortcut previously accepted no RunOptions at all,
27297
+ * (the orchestrator and every child), immutable within a segment,
27298
+ * while `opts.budget` only shapes the orchestrator's own sub-account
27299
+ * inside that ceiling. The shortcut previously accepted no RunOptions at all,
27059
27300
  * so the canonical entry point could not set a root ceiling without
27060
27301
  * dropping to `engine.run(makeOrchestratorWorkflow(...))` (v1.18.0
27061
27302
  * review P1-5).
@@ -28986,6 +29227,7 @@ function createEngine(options) {
28986
29227
  if (opts?.configFingerprint !== void 0) requireConfigFingerprint(opts.configFingerprint, "RunOptions.configFingerprint");
28987
29228
  if (opts?.clampTurnToExposure !== void 0 && typeof opts.clampTurnToExposure !== "boolean") throw new ConfigError("RunOptions.clampTurnToExposure must be a boolean; got " + JSON.stringify(opts.clampTurnToExposure));
28988
29229
  if (opts?.strictPricing !== void 0 && typeof opts.strictPricing !== "boolean" && (typeof opts.strictPricing !== "object" || opts.strictPricing === null || Array.isArray(opts.strictPricing))) throw new ConfigError("RunOptions.strictPricing must be a boolean or an options object; got " + JSON.stringify(opts.strictPricing));
29230
+ if (opts?.budgetPolicy !== void 0 && opts.budgetPolicy !== "segment" && opts.budgetPolicy !== "immutable-lifetime") throw new ConfigError("RunOptions.budgetPolicy must be 'segment' or 'immutable-lifetime'; got " + JSON.stringify(opts.budgetPolicy));
28989
29231
  if (opts?.limits !== void 0) validateUsageLimits(opts.limits, "RunOptions.limits");
28990
29232
  const deadlineAtMs = opts?.deadlineAt === void 0 ? void 0 : parseDeadlineAt(opts.deadlineAt);
28991
29233
  const compiled = wf.kind === "compiled-workflow" ? wf : void 0;
@@ -29020,6 +29262,7 @@ function createEngine(options) {
29020
29262
  ...opts.strictPricing.allowUnpriced === void 0 ? {} : { allowUnpriced: [...opts.strictPricing.allowUnpriced] }
29021
29263
  };
29022
29264
  const configFingerprint = opts?.configFingerprint ?? resumeCtx?.configFingerprint;
29265
+ const budgetPolicy = opts?.budgetPolicy ?? resumeCtx?.budgetPolicy;
29023
29266
  const makeBudget = () => new RunBudget({
29024
29267
  ...ceilingUsd === void 0 ? {} : { ceilingUsd },
29025
29268
  ...exposureCapUsd === void 0 ? {} : { maxInFlightExposureUsd: exposureCapUsd },
@@ -29202,6 +29445,7 @@ function createEngine(options) {
29202
29445
  ...ceilingUsd === void 0 ? {} : { budgetUsd: ceilingUsd },
29203
29446
  ...exposureCapUsd === void 0 ? {} : { maxInFlightExposureUsd: exposureCapUsd },
29204
29447
  ...strictPricing === void 0 ? {} : { strictPricing },
29448
+ ...budgetPolicy === "immutable-lifetime" ? { budgetPolicy } : {},
29205
29449
  ...configFingerprint === void 0 ? {} : { configFingerprint },
29206
29450
  ...argsBinding.argsProvided === void 0 ? {} : { argsProvided: argsBinding.argsProvided },
29207
29451
  ...argsBinding.argsHash === void 0 ? {} : { argsHash: argsBinding.argsHash },
@@ -29629,6 +29873,7 @@ function createEngine(options) {
29629
29873
  ...runOverride.budgetUsd === void 0 ? {} : { budgetUsd: runOverride.budgetUsd },
29630
29874
  ...runOverride.maxInFlightExposureUsd === void 0 ? {} : { maxInFlightExposureUsd: runOverride.maxInFlightExposureUsd }
29631
29875
  };
29876
+ if (budgetOverride !== void 0 && meta?.budgetPolicy === "immutable-lifetime") throw new ConfigError(`run '${runId}' was started with budgetPolicy 'immutable-lifetime': the recorded ceilings are immutable for the whole life of the run and ResumeOptions.run is refused, raising and lowering alike; cancel the run (or start a new one) instead of editing its ceilings`);
29632
29877
  return run(bound, resumeOptions?.args, void 0, {
29633
29878
  runId,
29634
29879
  priorEntries,
@@ -29639,6 +29884,7 @@ function createEngine(options) {
29639
29884
  ...typeof meta?.budgetUsd === "number" ? { budgetUsd: meta.budgetUsd } : {},
29640
29885
  ...typeof meta?.maxInFlightExposureUsd === "number" ? { maxInFlightExposureUsd: meta.maxInFlightExposureUsd } : {},
29641
29886
  ...typeof meta?.strictPricing === "object" && meta.strictPricing !== null ? { strictPricing: meta.strictPricing } : {},
29887
+ ...meta?.budgetPolicy === "immutable-lifetime" ? { budgetPolicy: meta.budgetPolicy } : {},
29642
29888
  segmentsBefore: typeof meta?.segments === "number" && meta.segments > 0 ? Math.floor(meta.segments) : 1,
29643
29889
  ...typeof meta?.argsProvided === "boolean" ? { argsProvided: meta.argsProvided } : {},
29644
29890
  ...typeof meta?.argsHash === "string" ? { argsHash: meta.argsHash } : {},
@@ -30115,4 +30361,4 @@ function createSandboxBridge(ctx, options) {
30115
30361
  };
30116
30362
  }
30117
30363
  //#endregion
30118
- export { AWAIT_SCHEMA, AdmissionController, AdmissionRejectedError, AgentCallError, BUDGET_ABORT_REASON, BudgetExhaustedError, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_JUDGE_LABEL, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, ConfigError, DECISION_CHAIN_KINDS, DEFAULT_ANCHOR_PATTERN, DEFAULT_ARTIFACT_PATTERN, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, DEFAULT_CITATION_SAMPLE, DEFAULT_CLAIM_JUDGE_MAX_TURNS, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_CALLS_PER_ENTRY, DEFAULT_EVIDENCE_GRADE_PHRASES, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_EVIDENCE_OVERHEAD_CALLS, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_CLAIM_PAIRS, DEFAULT_MAX_CONTRADICTIONS, DEFAULT_MAX_DEPTH, DEFAULT_MAX_EXCERPT_CHARS, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PAIR_EXCERPT_CHARS, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_POOL_PER_PAIR, DEFAULT_MAX_QUOTA_DENIALS, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_RUN_FACT_PAIRS, 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, DEFAULT_SYNTHESIS_MAX_TURNS, DEFAULT_SYNTHESIS_NOTE_MAX_TURNS, DedupIndex, DeterminismError, EMIT_RESULT_TOOL, EMPTY_AUTHORITY_HASH, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EVENT_SEGMENT_STRIDE, EXPOSURE_WAIT_SWEEP_MS, EscalationDecisionAbortedError, EventBus, ExternalRegistry, FINALIZE_SYNTHESIS_INSTRUCTION, FINAL_COMPOSITION_LABEL, FINISH_LESSON_CAP_CHARS, FINISH_SCHEMA, FINISH_SECTIONAL_SCHEMA, FINISH_TOOL_NAME, FUTURE_RATES_TOLERANCE_MS, FailRunError, FileModelKnowledgeStore, FileTranscriptStore, GET_CHILD_RESULT_SCHEMA, GET_CHILD_RESULT_TOOL_NAME, GET_SETTLED_CHILD_RESULTS_SCHEMA, GET_SETTLED_CHILD_RESULTS_TOOL_NAME, GitWorktreeProvider, IMPLEMENTATION_PROFILE_LIMITS, INBOX_PROPOSAL_TTL_DAYS, IN_FLIGHT_EXPOSURE_REFUSAL_PREFIX, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, JOURNAL_ENVELOPE_MARKER, JournalCompatibilityError, JournalIntegrityError, JournalMatcher, JournalMissError, JournalOrderViolation, JournalSealedError, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, KeyedLimiter, KnowledgeCasError, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LeaseHeldError, LineageIndex, MASKED_SECRET, MAX_CHILD_RESULT_PAGE_CHARS, MAX_CRITICAL_UNCOVERED, MAX_DEPTH_CEILING, MAX_RUN_FACTS_SHEET_CHARS, MAX_RUN_ID_LENGTH, MAX_TIMER_DELAY_MS, ModelRetry, NoProgressDetector, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OrchestratorCapConfigError, PARALLEL_AGENTS_SCHEMA, PROGRESS_REPORT_TOOL_NAME, ParallelSiteCounter, PlanInvariantError, QUOTA_WINDOW_MS, READ_CHILD_ARTIFACT_SCHEMA, READ_CHILD_ARTIFACT_TOOL_NAME, RESEARCH_PROFILE_LIMITS, REVIEW_PROFILE_LIMITS, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_FACTS_ANCHOR, RUN_PROFILES, RUN_SETTLE_DECISION_TYPE, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionFold, RulvarError, RunBudget, SANDBOX_AGENT_OPT_KEYS, SPAWN_ADMISSION_DECISION_TYPE, SPAWN_AGENT_SCHEMA, SYNTHESIS_NOTE_LABEL, SandboxError, ScriptRejected, Semaphore, SettlementError, SpanRegistry, SupersededError, TERMINAL_TELEMETRY_SCOPE, TOOL_NAME_PATTERN, TerminationAccount, WAIT_FOR_EVENTS_SCHEMA, WAIT_FOR_EVENTS_TOOL_NAME, WAKE_SUMMARY_RENDER_BUDGET_CHARS, accountSpendFromJournal, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyFinishRepairHints, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, assertFencedWrites, assertSafeRunId, atCompactionThreshold, attestToolset, attributionBucket, auditRun, auditRuns, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, childRostersFromJournal, citationTargetsValidator, citedValueValidator, claimCoverageOf, claimExpired, claimExpiry, claimIssues, claimJudgeStageOf, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compareRates, compilePermissionChain, compilePermissionPreset, compileSecretMasker, compileVerifiedLayer, constantTimeEqual, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createEnvelopeEncryption, createSandboxBridge, criticalPathFromJournal, currentOnlyKeyRing, decodeCheckpoint, dedupeRepeatedClaims, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispatchProjectionReserveUsd, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, enforceToolsetAttestation, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidenceGradeValidator, evidencePreservedValidator, executeWorkflow, executionFactsOf, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, findContradictions, finishContract, foldLedger, foldTermination, formatCharacterValidator, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashRunOutput, hashWorkflowBody, hashWorkflowSource, headingStructureValidator, identityJcs, implementationAgentProfile, insertRunIdIntoSentence, invoiceFromJournal, isClaimJudgeLabel, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, journalPricingSnapshot, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastMechanicalRepairCostUsd, lastRunSettle, latestProgressReport, lexShellCommand, liftRetainedParts, lineageWeightOf, localKeyProvider, logicalRunTelemetry, makeOrchestratorWorkflow, manifestValidators, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, memoryQuotaLimiter, mergeQuotaDenial, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, orchestratorAdmissionEstCostUsd, pairDraftClaims, pairRunFactClaims, parallelScope, parseModelRef, parseScopePath, persistedTerminalEnvelope, phiInitialOf, pilotAgentProfile, pipelineScope, planNodeScope, preflightEstimate, priceComponentsOf, priceEntryBilling, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualRequestsDelta, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleKey, quotaRuleMatches, readRunMeta, readTerminationInit, reconcileRunMeta, reconcileStatement, reduceAuditTrail, reduceCriticalPath, reduceDecisionChain, reduceInvocationTable, registryKeyRing, remeasureQueue, renderContractRequirements, replayDisposition, repositoryResearchToolset, requiredFieldsValidator, requiredMentionsValidator, requiredSectionsValidator, researchAgentProfile, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, reviewAgentProfile, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, scopeBucket, sectionCitationsValidator, sectionPatternCountValidator, sectionalRoundPlan, selectStructuredOutputTier, selfTestFinishValidation, shouldCompact, snapshotQuotaRules, snapshotUsage, spawnDepthOf, spliceSections, statementFromRows, statementRowsFromDelimited, stripFencedBlocks, sumUsage, summarizeInstruction, summarizeOutput, synthesisCandidatesFromJournal, terminalEnvelopeOf, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolAuthority, toolCalibrationFromJournal, toolContract, toolContractHash, toolsetAuthorityHash, toolsetHash, ttlState, unionOfIntervalsMs, usageViolations, validateDetachedResolution, validateEditorialCommit, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateToolsetAttestation, validateUsageLimits, wordCountValidator, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
30364
+ export { AWAIT_SCHEMA, AdmissionController, AdmissionRejectedError, AgentCallError, BUDGET_ABORT_REASON, BudgetExhaustedError, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_JUDGE_LABEL, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, ConfigError, DECISION_CHAIN_KINDS, DEFAULT_ANCHOR_PATTERN, DEFAULT_ARTIFACT_PATTERN, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, DEFAULT_CITATION_SAMPLE, DEFAULT_CLAIM_JUDGE_MAX_TURNS, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_CALLS_PER_ENTRY, DEFAULT_EVIDENCE_GRADE_PHRASES, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_EVIDENCE_OVERHEAD_CALLS, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_CLAIM_PAIRS, DEFAULT_MAX_CONTRADICTIONS, DEFAULT_MAX_DEPTH, DEFAULT_MAX_EXCERPT_CHARS, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PAIR_EXCERPT_CHARS, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_POOL_PER_PAIR, DEFAULT_MAX_QUOTA_DENIALS, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_RUN_FACT_PAIRS, 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, DEFAULT_SYNTHESIS_MAX_TURNS, DEFAULT_SYNTHESIS_NOTE_MAX_TURNS, DedupIndex, DeterminismError, EMIT_RESULT_TOOL, EMPTY_AUTHORITY_HASH, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EVENT_SEGMENT_STRIDE, EXPOSURE_WAIT_SWEEP_MS, EscalationDecisionAbortedError, EventBus, ExternalRegistry, FINALIZE_SYNTHESIS_INSTRUCTION, FINAL_COMPOSITION_LABEL, FINISH_LESSON_CAP_CHARS, FINISH_SCHEMA, FINISH_SECTIONAL_SCHEMA, FINISH_TOOL_NAME, FUTURE_RATES_TOLERANCE_MS, FailRunError, FileModelKnowledgeStore, FileTranscriptStore, GET_CHILD_RESULT_SCHEMA, GET_CHILD_RESULT_TOOL_NAME, GET_SETTLED_CHILD_RESULTS_SCHEMA, GET_SETTLED_CHILD_RESULTS_TOOL_NAME, GitWorktreeProvider, IMPLEMENTATION_PROFILE_LIMITS, INBOX_PROPOSAL_TTL_DAYS, IN_FLIGHT_EXPOSURE_REFUSAL_PREFIX, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, JOURNAL_ENVELOPE_MARKER, JournalCompatibilityError, JournalIntegrityError, JournalMatcher, JournalMissError, JournalOrderViolation, JournalSealedError, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, KeyedLimiter, KnowledgeCasError, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LeaseHeldError, LineageIndex, MASKED_SECRET, MAX_CHILD_RESULT_PAGE_CHARS, MAX_CRITICAL_UNCOVERED, MAX_DEPTH_CEILING, MAX_RUN_FACTS_SHEET_CHARS, MAX_RUN_ID_LENGTH, MAX_TIMER_DELAY_MS, ModelRetry, NoProgressDetector, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OrchestratorCapConfigError, PARALLEL_AGENTS_SCHEMA, PROGRESS_REPORT_TOOL_NAME, ParallelSiteCounter, PlanInvariantError, QUOTA_WINDOW_MS, READ_CHILD_ARTIFACT_SCHEMA, READ_CHILD_ARTIFACT_TOOL_NAME, RESEARCH_PROFILE_LIMITS, REVIEW_PROFILE_LIMITS, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_FACTS_ANCHOR, RUN_PROFILES, RUN_SETTLE_DECISION_TYPE, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionFold, RulvarError, RunBudget, SANDBOX_AGENT_OPT_KEYS, SPAWN_ADMISSION_DECISION_TYPE, SPAWN_AGENT_SCHEMA, SYNTHESIS_NOTE_LABEL, SandboxError, ScriptRejected, Semaphore, SettlementError, SpanRegistry, SupersededError, TERMINAL_TELEMETRY_SCOPE, TOOL_NAME_PATTERN, TerminationAccount, WAIT_FOR_EVENTS_SCHEMA, WAIT_FOR_EVENTS_TOOL_NAME, WAKE_SUMMARY_RENDER_BUDGET_CHARS, accountSpendFromJournal, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyFinishRepairHints, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, assertFencedWrites, assertSafeRunId, atCompactionThreshold, attestToolset, attributionBucket, auditRun, auditRuns, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, childRostersFromJournal, citationTargetsValidator, citedValueValidator, claimCoverageOf, claimExpired, claimExpiry, claimIssues, claimJudgeStageOf, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compareRates, compilePermissionChain, compilePermissionPreset, compileSecretMasker, compileVerifiedLayer, constantTimeEqual, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createEnvelopeEncryption, createSandboxBridge, criticalPathFromJournal, currentOnlyKeyRing, decodeCheckpoint, dedupeRepeatedClaims, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispatchProjectionReserveUsd, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, enforceToolsetAttestation, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidenceGradeValidator, evidencePreservedValidator, executeWorkflow, executionFactsOf, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, findContradictions, finishContract, foldLedger, foldTermination, formatCharacterValidator, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashRunOutput, hashWorkflowBody, hashWorkflowSource, headingStructureValidator, identityJcs, implementationAgentProfile, insertRunIdIntoSentence, invoiceFromJournal, isClaimJudgeLabel, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, journalPricingSnapshot, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastMechanicalRepairCostUsd, lastRunSettle, latestProgressReport, lexShellCommand, liftRetainedParts, lineageWeightOf, localKeyProvider, logicalRunTelemetry, makeOrchestratorWorkflow, manifestValidators, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, memoryQuotaLimiter, mergeQuotaDenial, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, orchestratorAdmissionEstCostUsd, pairDraftClaims, pairRunFactClaims, parallelScope, parseModelRef, parseScopePath, parseTerminalEnvelope, persistedTerminalEnvelope, phiInitialOf, pilotAgentProfile, pipelineScope, planNodeScope, preflightEstimate, priceComponentsOf, priceEntryBilling, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualRequestsDelta, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleKey, quotaRuleMatches, readRunMeta, readTerminationInit, reconcileRunMeta, reconcileStatement, reduceAuditTrail, reduceCriticalPath, reduceDecisionChain, reduceInvocationTable, registryKeyRing, remeasureQueue, renderContractRequirements, replayDisposition, repositoryResearchToolset, requiredFieldsValidator, requiredMentionsValidator, requiredSectionsValidator, researchAgentProfile, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, reviewAgentProfile, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, scopeBucket, sectionCitationsValidator, sectionPatternCountValidator, sectionalRoundPlan, selectStructuredOutputTier, selfTestFinishValidation, shouldCompact, snapshotQuotaRules, snapshotUsage, spawnDepthOf, spliceSections, statementFromRows, statementRowsFromDelimited, stripFencedBlocks, sumUsage, summarizeInstruction, summarizeOutput, synthesisCandidatesFromJournal, terminalEnvelopeOf, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolAuthority, toolCalibrationFromJournal, toolContract, toolContractHash, toolsetAuthorityHash, toolsetHash, ttlState, unionOfIntervalsMs, usageViolations, validateDetachedResolution, validateEditorialCommit, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateToolsetAttestation, validateUsageLimits, wordCountValidator, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/core",
3
- "version": "1.243.0",
3
+ "version": "1.244.0",
4
4
  "description": "Rulvar core: L0 contracts, journal kernel, ctx primitives, agent runtime, model router, tool system, dynamic orchestrator, InMemory and JSONL stores, event stream.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",