@rulvar/core 1.242.0 → 1.243.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.
package/dist/index.d.ts CHANGED
@@ -6451,6 +6451,8 @@ interface BudgetAccountView {
6451
6451
  synthesisReserveUsd: number;
6452
6452
  /** The repair round's verdict hold (RV3701); zero when none is committed. */
6453
6453
  convergenceReserveUsd: number;
6454
+ /** The repair round's mechanical leg (RV3802); zero when none is committed. */
6455
+ repairReserveUsd: number;
6454
6456
  parentScope?: string;
6455
6457
  }
6456
6458
  /**
@@ -6772,6 +6774,26 @@ declare class RunBudget {
6772
6774
  commitConvergenceReserve(scope: string, reserveUsd: number): void;
6773
6775
  /** The verdict pass dispatch consumes its reserve; see commitConvergenceReserve. */
6774
6776
  releaseConvergenceReserve(scope: string): void;
6777
+ /**
6778
+ * Registers the repair round's MECHANICAL leg (RV3802), the money
6779
+ * twin of the RV3602 per-invocation pool: the round's finish
6780
+ * contract can grant one bounded mechanical repair turn, and the
6781
+ * third comparison run's round entered exactly that turn's price
6782
+ * short of certainty (the repair existed by pool and by contract,
6783
+ * but nothing guaranteed the money would still be there when the
6784
+ * candidate materialized). Held beside the verdict leg from the
6785
+ * moment the round is admitted; released EARLY, to the round's own
6786
+ * finish loop, at its first journaled verdict (a 'repair' verdict is
6787
+ * about to spend the freed money on the granted turn, an 'accepted'
6788
+ * one never needed it), where the verdict leg lives until the judge
6789
+ * dispatch. Exactly the convergence reserve mechanics otherwise:
6790
+ * joins the projected admission sum and both remainders, named in
6791
+ * the refusal clause, never joined to the severing check, idempotent
6792
+ * per account with the root adjusted by the delta.
6793
+ */
6794
+ commitRepairReserve(scope: string, reserveUsd: number): void;
6795
+ /** The round's finish loop consumes its leg; see commitRepairReserve. */
6796
+ releaseRepairReserve(scope: string): void;
6775
6797
  /** The reserve is replaced by real spend when the spawn settles. */
6776
6798
  releaseReserve(reserveUsd: number, accountScope?: string): void;
6777
6799
  /**
@@ -8376,12 +8398,42 @@ interface FinishValidationInput {
8376
8398
  */
8377
8399
  readonly runId?: string;
8378
8400
  }
8401
+ /**
8402
+ * One structured repair hint on a failed verdict (RV3801): the exact
8403
+ * edit whose application satisfies this validator, precise enough for
8404
+ * the HOST to perform without a provider wire. The third comparison
8405
+ * run died with its repair pool spent on a failure class whose remedy
8406
+ * the evidence-grade verdict already prescribed word for word (write
8407
+ * this run's id inside each offending sentence); a remedy that
8408
+ * deterministic must not cost a model turn. A hint is advisory: the
8409
+ * finish loop attempts the patch only when EVERY failure of the
8410
+ * candidate carries hints, re-runs the FULL validator set over the
8411
+ * patched document, and falls back to the ordinary model repair pool
8412
+ * when the patch does not survive re-validation.
8413
+ */
8414
+ interface FinishRepairHint {
8415
+ /** The one host-side edit the loop knows how to apply. */
8416
+ readonly mechanism: "insert-run-id";
8417
+ /** Offset of the offending sentence's first character in the judged text. */
8418
+ readonly start: number;
8419
+ /** Offset one past the offending sentence's last character. */
8420
+ readonly end: number;
8421
+ /**
8422
+ * The offending sentence verbatim (never normalized or clipped): the
8423
+ * loop refuses the patch unless `text.slice(start, end)` equals it,
8424
+ * so a stale hint can never edit the wrong bytes.
8425
+ */
8426
+ readonly sentence: string;
8427
+ /** The identifier whose insertion the verdict prescribes. */
8428
+ readonly insert: string;
8429
+ }
8379
8430
  /** The verdict of one validator over one finish attempt. */
8380
8431
  type FinishValidationVerdict = {
8381
8432
  ok: true;
8382
8433
  } | {
8383
8434
  ok: false;
8384
8435
  reasons: string[];
8436
+ repairHints?: FinishRepairHint[];
8385
8437
  };
8386
8438
  /**
8387
8439
  * A deterministic host validator of the orchestrator finish result.
@@ -8519,6 +8571,33 @@ declare const DEFAULT_CITATION_PATTERN = "[\\w./-]+\\.\\w+:\\d+";
8519
8571
  /** The default preserved share, the improvement plan's RV-202 gate. */
8520
8572
  declare const DEFAULT_EVIDENCE_MIN_SHARE = .95;
8521
8573
  /**
8574
+ * The deterministic edit behind the `insert-run-id` mechanism
8575
+ * (RV3801): the id lands INSIDE the sentence, before its trailing
8576
+ * terminator run (a `.`, `!`, or `?` with any closing quotes,
8577
+ * brackets, or markdown emphasis after it), or at the very end when
8578
+ * the sentence carries no terminator. Inside matters: appended AFTER
8579
+ * the terminator the id would belong to the NEXT sentence under the
8580
+ * shared `sentencesOf` segmentation and the re-validation would fail
8581
+ * the same sentence again. Exported so tests and hosts can reproduce
8582
+ * the loop's exact bytes.
8583
+ */
8584
+ declare function insertRunIdIntoSentence(sentence: string, insert: string): string;
8585
+ /**
8586
+ * Applies `insert-run-id` repair hints to a judged text (RV3801): each
8587
+ * `[start, end)` window is replaced by
8588
+ * {@link insertRunIdIntoSentence}(window, insert), right to left so
8589
+ * earlier offsets stay valid, every other byte identical. Fail closed:
8590
+ * `undefined` (never a partial patch) when the set is empty, any
8591
+ * window is out of bounds or empty, or two windows overlap; the caller
8592
+ * treats a refused patch exactly like an absent one and proceeds to
8593
+ * the model repair pool.
8594
+ */
8595
+ declare function applyFinishRepairHints(text: string, hints: readonly {
8596
+ start: number;
8597
+ end: number;
8598
+ insert: string;
8599
+ }[]): string | undefined;
8600
+ /**
8522
8601
  * The RV-202 evidence preservation contract: the finish result must
8523
8602
  * PRESERVE the citations the children actually produced. Distinct
8524
8603
  * matches of `pattern` are collected across the outputs of children
@@ -8683,6 +8762,13 @@ declare const DEFAULT_ARTIFACT_PATTERN = "(?:run[ -]?[0-9A-HJKMNP-TV-Z]{6,26}|[\
8683
8762
  * the repair instruction is executable rather than aspirational. An id
8684
8763
  * shorter than `MIN_RUN_ID_ARTIFACT_CHARS` (six) is ignored, and
8685
8764
  * without an id the verdict is byte identical to the historical one.
8765
+ *
8766
+ * With the id in hand the failure also carries {@link FinishRepairHint}
8767
+ * rows (RV3801), one per offending sentence, so the finish loop can
8768
+ * perform the verdict's own prescription host side without spending a
8769
+ * provider wire; the reasons stay byte identical either way, and the
8770
+ * hints are bounded (at most `MAX_REPAIR_HINTS` offenders) and fail
8771
+ * closed (an id whose bytes could split a sentence is never hinted).
8686
8772
  * Default name 'evidence-grade'.
8687
8773
  */
8688
8774
  declare function evidenceGradeValidator(options?: {
@@ -10060,6 +10146,28 @@ interface OrchestrateAcceptance {
10060
10146
  }
10061
10147
  /** How many rejected finishes are repaired by default: the plan's repair once. */
10062
10148
  declare const DEFAULT_FINISH_MAX_REPAIRS = 1;
10149
+ /** The sectional round's owning sections and marker roster (RV3803). */
10150
+ interface SectionalRoundPlan {
10151
+ /** Every H2 marker of the retained document, in document order. */
10152
+ sections: string[];
10153
+ /** The markers owning at least one finding excerpt, document order. */
10154
+ targets: string[];
10155
+ }
10156
+ /**
10157
+ * Plans the sectional claim repair round (RV3803): which H2 sections
10158
+ * of the accepted pre-repair document own the judged findings. The
10159
+ * third comparison run's round regenerated the WHOLE 43k character
10160
+ * document to consume findings that lived in a handful of sentences,
10161
+ * and the tail after fan-in was 80.1 percent of the run's wall. Each
10162
+ * finding's `draftExcerpt` (whitespace collapsed by the pairing fold)
10163
+ * is located in the document through a collapse-aware scan, and its
10164
+ * owning section is the nearest H2 line above it. Fail closed to the
10165
+ * FULL regeneration (undefined, the historical round byte for byte)
10166
+ * whenever the plan cannot be exact: no excerpts, a document without
10167
+ * H2 headings, duplicated markers (the splice grammar needs unique
10168
+ * lines), or any excerpt the scan cannot locate.
10169
+ */
10170
+ declare function sectionalRoundPlan(document: string, excerpts: readonly string[]): SectionalRoundPlan | undefined;
10063
10171
  /**
10064
10172
  * Character cap of the HOST VALIDATION LESSONS prompt block (RV3603):
10065
10173
  * the bounded repair round's prompt folds the run's journaled finish
@@ -10174,6 +10282,21 @@ interface FinishValidationSpec {
10174
10282
  */
10175
10283
  repairTurnReserve?: number;
10176
10284
  /**
10285
+ * The declared price of ONE mechanical repair turn in USD (RV3802),
10286
+ * the money twin of `repairTurnReserve`'s turn grant: the bounded
10287
+ * claim repair round (`claimConsistency.onFound: 'repair'`) holds
10288
+ * this beside the verdict money (RV3701) from the moment the round
10289
+ * is admitted, so the one repair turn the round's own finish
10290
+ * contract can grant is funded when the candidate materializes; the
10291
+ * leg releases to the round's finish loop at its first journaled
10292
+ * verdict. Undeclared, the hold falls back to the run's own observed
10293
+ * last mechanical repair price (`lastMechanicalRepairCostUsd` over
10294
+ * the journal, absent when no priced repair window exists), else
10295
+ * zero, which keeps every pre-RV3802 admission byte identical. A
10296
+ * nonnegative finite number; refused typed otherwise.
10297
+ */
10298
+ estRepairCostUsd?: number;
10299
+ /**
10177
10300
  * The coordination draft gate (the v1.74 experiment review, P0.3),
10178
10301
  * meaningful ONLY with `synthesis` configured: with validators bound
10179
10302
  * to the synthesis finish, the coordination finish is an unvalidated
@@ -11796,6 +11919,8 @@ interface CostAttribution {
11796
11919
  byModel: Map<string, number>;
11797
11920
  byPhase: Map<string, number>;
11798
11921
  byAgentType: Map<string, number>;
11922
+ /** Keyed by the raw journal scope (RV3805); '' is the root's own scope. */
11923
+ byScope: Map<string, number>;
11799
11924
  byRole: Map<InvocationRole, number>;
11800
11925
  unpriced: Array<{
11801
11926
  model: string;
@@ -11959,6 +12084,16 @@ declare function executeWorkflow<A, R>(internals: RunInternals, wf: Workflow<A,
11959
12084
  */
11960
12085
  declare function attributionBucket(value: string | undefined): string;
11961
12086
  /**
12087
+ * The scope key rule of the byScope rollup (RV3805). The root's OWN
12088
+ * scope is the empty string BY CONSTRUCTION: present data whose string
12089
+ * happens to be empty, not an absence, so it folds under the
12090
+ * addressable name 'root' instead of the RV3604 'unknown' fallback,
12091
+ * which stays reserved for a scope that is truly missing. Children
12092
+ * keep their scope strings verbatim. One rule for both builders, so
12093
+ * the live report and the journal fold cannot disagree on the key.
12094
+ */
12095
+ declare function scopeBucket(scope: string | undefined): string;
12096
+ /**
11962
12097
  * Folds the per-run attribution buckets into the normative CostReport.
11963
12098
  * Live attribution buckets never see abandoned subtrees, so a host
11964
12099
  * that tracked abandoned spend itself passes it as `abandoned`;
@@ -12081,6 +12216,18 @@ interface CostReport {
12081
12216
  byAgentType: Record<string, number>;
12082
12217
  byRole: Record<InvocationRole, number>;
12083
12218
  /**
12219
+ * Spend per journal scope (RV3805): the root and every child are
12220
+ * addressable rows whose sum equals `totalUsd`, so the children
12221
+ * versus whole-workflow cut (the third comparison analysis had to
12222
+ * hand-aggregate it from invoice rows) reads off the report
12223
+ * directly. The root's OWN scope is the empty string BY
12224
+ * CONSTRUCTION, present data rather than an absence, so it folds
12225
+ * under the named 'root' bucket; children keep their scope strings
12226
+ * verbatim, and only a truly absent scope folds under 'unknown',
12227
+ * the RV3604 fallback.
12228
+ */
12229
+ byScope: Record<string, number>;
12230
+ /**
12084
12231
  * All-zero with forcedFinish false in runs without a dynamic
12085
12232
  * orchestrator (or when no cap resolved, so no sub-account opened).
12086
12233
  * Folded purely from the journal: spentUsd is the priced usage of
@@ -13767,6 +13914,13 @@ interface JournaledSynthesisCandidate {
13767
13914
  /** The hosting span's dispatch label (RV2901), when journaled. */
13768
13915
  spanLabel?: string;
13769
13916
  /**
13917
+ * The hosting span's running entry seq (RV3802): the span's identity
13918
+ * within the run, so two candidates can be read as neighbors of ONE
13919
+ * composition invocation (the repair-turn pairing below) instead of
13920
+ * accidental neighbors across spans. Absent exactly when unhosted.
13921
+ */
13922
+ spanSeq?: number;
13923
+ /**
13770
13924
  * Wall from the previous boundary (the span's start, or the prior
13771
13925
  * verdict) to this verdict's stamp. Absent when the candidate is not
13772
13926
  * hosted by a settled synthesize span or a stamp is missing.
@@ -13825,6 +13979,20 @@ interface JournaledSynthesisCandidateReport {
13825
13979
  * same shape `invoiceFromJournal` takes; omit to fold without money
13826
13980
  */
13827
13981
  declare function synthesisCandidatesFromJournal(entries: readonly JournalEntry[], priceUsd?: (servedBy: ModelRef, usage: Usage) => number | undefined): JournaledSynthesisCandidateReport;
13982
+ /**
13983
+ * The observed price of the run's LAST mechanical repair turn
13984
+ * (RV3802): the window of the candidate that FOLLOWED a 'repair'
13985
+ * verdict inside the same settled synthesize span, priced by the same
13986
+ * per-call fold every candidate window uses. This is the fallback the
13987
+ * repair round's mechanical money leg sizes itself from when the host
13988
+ * declared no estimate: by the time the round is admitted the initial
13989
+ * composition has settled, so a mechanical repair it performed is a
13990
+ * priced window in the journal. Fail closed under RV1209: no such
13991
+ * pairing, an unattributed span, or an unpriceable window all return
13992
+ * undefined (never a guessed number), and the caller treats undefined
13993
+ * as an inert zero-size leg.
13994
+ */
13995
+ declare function lastMechanicalRepairCostUsd(entries: readonly JournalEntry[], priceUsd?: (servedBy: ModelRef, usage: Usage) => number | undefined): number | undefined;
13828
13996
  //#endregion
13829
13997
  //#region src/stores/tool-calibration.d.ts
13830
13998
  /** One dispatch carrying BOTH sides of the calibration pair (RV3003). */
@@ -14830,7 +14998,12 @@ interface PreflightOrchestratorSpec {
14830
14998
  * (this same `judge.estCost` first, else the run's own observed
14831
14999
  * post draft judge price) until that pass admits, so the
14832
15000
  * declared estimate is not only judged before the run but enforced
14833
- * inside it.
15001
+ * inside it. The mechanical leg has the same twin (RV3802): the
15002
+ * one repair turn the round's finish contract can grant is held as
15003
+ * `finishValidation.estRepairCostUsd` (else the run's observed
15004
+ * last mechanical repair price) beside the verdict money, released
15005
+ * to the round's finish loop at its first verdict; the runtime
15006
+ * enforcement of the `repairTurnReserve` turn grant's price.
14834
15007
  */
14835
15008
  onFound?: "report" | "carry" | "fail" | "repair";
14836
15009
  /**
@@ -15992,4 +16165,4 @@ interface SandboxBridge {
15992
16165
  declare const SANDBOX_AGENT_OPT_KEYS: readonly string[];
15993
16166
  declare function createSandboxBridge(ctx: Ctx<never>, options: SandboxBridgeOptions): SandboxBridge;
15994
16167
  //#endregion
15995
- 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, 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, 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, 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, invoiceFromJournal, isClaimJudgeLabel, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, journalPricingSnapshot, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, 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, sectionCitationsValidator, sectionPatternCountValidator, 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 };
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 };
package/dist/index.js CHANGED
@@ -9878,7 +9878,8 @@ function synthesisCandidatesFromJournal(entries, priceUsd) {
9878
9878
  name: failure.name,
9879
9879
  reasons: Array.isArray(failure.reasons) ? failure.reasons.filter((reason) => typeof reason === "string") : []
9880
9880
  })) : [],
9881
- ...span.label === void 0 ? {} : { spanLabel: span.label }
9881
+ ...span.label === void 0 ? {} : { spanLabel: span.label },
9882
+ spanSeq: span.runningSeq
9882
9883
  };
9883
9884
  if (boundary.at !== void 0 && verdictAtMs !== void 0) candidate.windowMs = Math.max(0, verdictAtMs - boundary.at);
9884
9885
  if (attributable.has(span)) {
@@ -9911,6 +9912,29 @@ function synthesisCandidatesFromJournal(entries, priceUsd) {
9911
9912
  tailWires
9912
9913
  };
9913
9914
  }
9915
+ /**
9916
+ * The observed price of the run's LAST mechanical repair turn
9917
+ * (RV3802): the window of the candidate that FOLLOWED a 'repair'
9918
+ * verdict inside the same settled synthesize span, priced by the same
9919
+ * per-call fold every candidate window uses. This is the fallback the
9920
+ * repair round's mechanical money leg sizes itself from when the host
9921
+ * declared no estimate: by the time the round is admitted the initial
9922
+ * composition has settled, so a mechanical repair it performed is a
9923
+ * priced window in the journal. Fail closed under RV1209: no such
9924
+ * pairing, an unattributed span, or an unpriceable window all return
9925
+ * undefined (never a guessed number), and the caller treats undefined
9926
+ * as an inert zero-size leg.
9927
+ */
9928
+ function lastMechanicalRepairCostUsd(entries, priceUsd) {
9929
+ const { candidates } = synthesisCandidatesFromJournal(entries, priceUsd);
9930
+ let observed;
9931
+ for (let index = 1; index < candidates.length; index += 1) {
9932
+ const previous = candidates[index - 1];
9933
+ const row = candidates[index];
9934
+ if (previous?.verdict === "repair" && row?.spanSeq !== void 0 && row.spanSeq === previous.spanSeq && row.costUsd !== void 0) observed = row.costUsd;
9935
+ }
9936
+ return observed;
9937
+ }
9914
9938
  //#endregion
9915
9939
  //#region src/stores/tool-calibration.ts
9916
9940
  /**
@@ -14898,6 +14922,7 @@ var RunBudget = class {
14898
14922
  finalizeReserveUsd: 0,
14899
14923
  synthesisReserveUsd: 0,
14900
14924
  convergenceReserveUsd: 0,
14925
+ repairReserveUsd: 0,
14901
14926
  controller: new AbortController()
14902
14927
  };
14903
14928
  if (options.ceilingUsd !== void 0) root.ceilingUsd = options.ceilingUsd;
@@ -14949,6 +14974,7 @@ var RunBudget = class {
14949
14974
  finalizeReserveUsd: options.finalizeReserveUsd ?? 0,
14950
14975
  synthesisReserveUsd: 0,
14951
14976
  convergenceReserveUsd: 0,
14977
+ repairReserveUsd: 0,
14952
14978
  parentScope,
14953
14979
  controller: new AbortController()
14954
14980
  };
@@ -15050,7 +15076,8 @@ var RunBudget = class {
15050
15076
  committedReserveUsd: account.committedReserveUsd,
15051
15077
  finalizeReserveUsd: account.finalizeReserveUsd,
15052
15078
  synthesisReserveUsd: account.synthesisReserveUsd,
15053
- convergenceReserveUsd: account.convergenceReserveUsd
15079
+ convergenceReserveUsd: account.convergenceReserveUsd,
15080
+ repairReserveUsd: account.repairReserveUsd
15054
15081
  };
15055
15082
  if (account.ceilingUsd !== void 0) view.ceilingUsd = account.ceilingUsd;
15056
15083
  if (account.parentScope !== void 0) view.parentScope = account.parentScope;
@@ -15064,7 +15091,7 @@ var RunBudget = class {
15064
15091
  remainderOf(scope) {
15065
15092
  const account = this.accounts.get(scope);
15066
15093
  if (account?.ceilingUsd === void 0) return;
15067
- return Math.max(0, account.ceilingUsd - account.spentUsd - account.committedReserveUsd - account.finalizeReserveUsd - account.synthesisReserveUsd - account.convergenceReserveUsd);
15094
+ return Math.max(0, account.ceilingUsd - account.spentUsd - account.committedReserveUsd - account.finalizeReserveUsd - account.synthesisReserveUsd - account.convergenceReserveUsd - account.repairReserveUsd);
15068
15095
  }
15069
15096
  /**
15070
15097
  * The tightest allowance headroom on the chain of `scope`: the minimum
@@ -15144,16 +15171,17 @@ var RunBudget = class {
15144
15171
  }
15145
15172
  for (const account of this.chainOf(accountScope)) {
15146
15173
  if (account.ceilingUsd === void 0) continue;
15147
- const committed = account.spentUsd + account.committedReserveUsd + account.finalizeReserveUsd + account.synthesisReserveUsd + account.convergenceReserveUsd;
15174
+ const committed = account.spentUsd + account.committedReserveUsd + account.finalizeReserveUsd + account.synthesisReserveUsd + account.convergenceReserveUsd + account.repairReserveUsd;
15148
15175
  if (committed >= account.ceilingUsd || committed + reserveUsd > account.ceilingUsd) {
15149
15176
  if (account.scope === "run") this.exhaustedInternal = true;
15150
- throw new BudgetExhaustedError(`budget ceiling reached on account '${account.scope}': spent ${account.spentUsd.toFixed(4)} USD plus committed reserves ${(account.committedReserveUsd + account.finalizeReserveUsd).toFixed(4)} USD ` + (account.synthesisReserveUsd > 0 ? `plus the held synthesis reserve ${account.synthesisReserveUsd.toFixed(4)} USD ` : "") + (account.convergenceReserveUsd > 0 ? `plus the held convergence reserve ${account.convergenceReserveUsd.toFixed(4)} USD ` : "") + `plus the proposed reserve ${reserveUsd.toFixed(4)} USD does not fit the ceiling ${account.ceilingUsd.toFixed(4)} USD`, { data: {
15177
+ throw new BudgetExhaustedError(`budget ceiling reached on account '${account.scope}': spent ${account.spentUsd.toFixed(4)} USD plus committed reserves ${(account.committedReserveUsd + account.finalizeReserveUsd).toFixed(4)} USD ` + (account.synthesisReserveUsd > 0 ? `plus the held synthesis reserve ${account.synthesisReserveUsd.toFixed(4)} USD ` : "") + (account.convergenceReserveUsd > 0 ? `plus the held convergence reserve ${account.convergenceReserveUsd.toFixed(4)} USD ` : "") + (account.repairReserveUsd > 0 ? `plus the held repair reserve ${account.repairReserveUsd.toFixed(4)} USD ` : "") + `plus the proposed reserve ${reserveUsd.toFixed(4)} USD does not fit the ceiling ${account.ceilingUsd.toFixed(4)} USD`, { data: {
15151
15178
  account: account.scope,
15152
15179
  spentUsd: account.spentUsd,
15153
15180
  committedReserveUsd: account.committedReserveUsd,
15154
15181
  finalizeReserveUsd: account.finalizeReserveUsd,
15155
15182
  synthesisReserveUsd: account.synthesisReserveUsd,
15156
15183
  convergenceReserveUsd: account.convergenceReserveUsd,
15184
+ repairReserveUsd: account.repairReserveUsd,
15157
15185
  proposedReserveUsd: reserveUsd,
15158
15186
  ceilingUsd: account.ceilingUsd
15159
15187
  } });
@@ -15280,6 +15308,39 @@ var RunBudget = class {
15280
15308
  account.convergenceReserveUsd = 0;
15281
15309
  this.emitUpdate();
15282
15310
  }
15311
+ /**
15312
+ * Registers the repair round's MECHANICAL leg (RV3802), the money
15313
+ * twin of the RV3602 per-invocation pool: the round's finish
15314
+ * contract can grant one bounded mechanical repair turn, and the
15315
+ * third comparison run's round entered exactly that turn's price
15316
+ * short of certainty (the repair existed by pool and by contract,
15317
+ * but nothing guaranteed the money would still be there when the
15318
+ * candidate materialized). Held beside the verdict leg from the
15319
+ * moment the round is admitted; released EARLY, to the round's own
15320
+ * finish loop, at its first journaled verdict (a 'repair' verdict is
15321
+ * about to spend the freed money on the granted turn, an 'accepted'
15322
+ * one never needed it), where the verdict leg lives until the judge
15323
+ * dispatch. Exactly the convergence reserve mechanics otherwise:
15324
+ * joins the projected admission sum and both remainders, named in
15325
+ * the refusal clause, never joined to the severing check, idempotent
15326
+ * per account with the root adjusted by the delta.
15327
+ */
15328
+ commitRepairReserve(scope, reserveUsd) {
15329
+ const account = this.accounts.get(scope);
15330
+ if (account === void 0) throw new ConfigError(`unknown budget account '${scope}' for the repair reserve`);
15331
+ const previous = account.repairReserveUsd;
15332
+ account.repairReserveUsd = reserveUsd;
15333
+ if (account.scope !== "run") this.root.repairReserveUsd = Math.max(0, this.root.repairReserveUsd + reserveUsd - previous);
15334
+ this.emitUpdate();
15335
+ }
15336
+ /** The round's finish loop consumes its leg; see commitRepairReserve. */
15337
+ releaseRepairReserve(scope) {
15338
+ const account = this.accounts.get(scope);
15339
+ if (account === void 0 || account.repairReserveUsd === 0) return;
15340
+ if (account.scope !== "run") this.root.repairReserveUsd = Math.max(0, this.root.repairReserveUsd - account.repairReserveUsd);
15341
+ account.repairReserveUsd = 0;
15342
+ this.emitUpdate();
15343
+ }
15283
15344
  /** The reserve is replaced by real spend when the spawn settles. */
15284
15345
  releaseReserve(reserveUsd, accountScope = "run") {
15285
15346
  for (const account of this.chainOf(accountScope)) account.committedReserveUsd = Math.max(0, account.committedReserveUsd - reserveUsd);
@@ -15487,7 +15548,7 @@ var RunBudget = class {
15487
15548
  let remaining;
15488
15549
  for (const account of this.chainOf(accountScope)) {
15489
15550
  if (account.ceilingUsd === void 0) continue;
15490
- const headroom = account.ceilingUsd - account.spentUsd - account.synthesisReserveUsd - account.convergenceReserveUsd;
15551
+ const headroom = account.ceilingUsd - account.spentUsd - account.synthesisReserveUsd - account.convergenceReserveUsd - account.repairReserveUsd;
15491
15552
  remaining = remaining === void 0 ? headroom : Math.min(remaining, headroom);
15492
15553
  }
15493
15554
  return remaining === void 0 ? void 0 : Math.max(0, remaining);
@@ -15730,6 +15791,27 @@ function foldBuckets(source) {
15730
15791
  return folded;
15731
15792
  }
15732
15793
  /**
15794
+ * The scope key rule of the byScope rollup (RV3805). The root's OWN
15795
+ * scope is the empty string BY CONSTRUCTION: present data whose string
15796
+ * happens to be empty, not an absence, so it folds under the
15797
+ * addressable name 'root' instead of the RV3604 'unknown' fallback,
15798
+ * which stays reserved for a scope that is truly missing. Children
15799
+ * keep their scope strings verbatim. One rule for both builders, so
15800
+ * the live report and the journal fold cannot disagree on the key.
15801
+ */
15802
+ function scopeBucket(scope) {
15803
+ return scope === void 0 ? "unknown" : scope === "" ? "root" : scope;
15804
+ }
15805
+ /** {@link scopeBucket} over a whole live map, merging folded keys. */
15806
+ function foldScopeBuckets(source) {
15807
+ const folded = {};
15808
+ for (const [key, usd] of source) {
15809
+ const bucket = scopeBucket(key);
15810
+ folded[bucket] = (folded[bucket] ?? 0) + usd;
15811
+ }
15812
+ return folded;
15813
+ }
15814
+ /**
15733
15815
  * Folds the per-run attribution buckets into the normative CostReport.
15734
15816
  * Live attribution buckets never see abandoned subtrees, so a host
15735
15817
  * that tracked abandoned spend itself passes it as `abandoned`;
@@ -15760,6 +15842,7 @@ function buildCostReport(attribution, totalUsd, abandoned = {
15760
15842
  byPhase: foldBuckets(attribution.byPhase),
15761
15843
  byAgentType: foldBuckets(attribution.byAgentType),
15762
15844
  byRole,
15845
+ byScope: foldScopeBuckets(attribution.byScope),
15763
15846
  orchestrator: {
15764
15847
  ...orchestrator,
15765
15848
  share: orchestrator.spentUsd / Math.max(totalUsd, .01)
@@ -15785,6 +15868,7 @@ function costReportFromJournal(entries, priceUsd) {
15785
15868
  const byModel = {};
15786
15869
  const byPhase = {};
15787
15870
  const byAgentType = {};
15871
+ const byScope = {};
15788
15872
  const byRole = emptyByRole();
15789
15873
  const unpriced = [];
15790
15874
  let totalUsd = 0;
@@ -15827,6 +15911,8 @@ function costReportFromJournal(entries, priceUsd) {
15827
15911
  byPhase[phase] = (byPhase[phase] ?? 0) + priced.usd;
15828
15912
  const agentType = attributionBucket(facts?.agentType);
15829
15913
  byAgentType[agentType] = (byAgentType[agentType] ?? 0) + priced.usd;
15914
+ const scope = scopeBucket(entry.scope);
15915
+ byScope[scope] = (byScope[scope] ?? 0) + priced.usd;
15830
15916
  const primaryRole = facts?.role ?? "loop";
15831
15917
  for (const unit of priced.units) byRole[unit.role ?? primaryRole] += unit.usd;
15832
15918
  if (facts?.budgetAccount !== void 0 && isOrchestratorAccount(facts.budgetAccount)) {
@@ -15848,6 +15934,7 @@ function costReportFromJournal(entries, priceUsd) {
15848
15934
  byPhase,
15849
15935
  byAgentType,
15850
15936
  byRole,
15937
+ byScope,
15851
15938
  orchestrator: {
15852
15939
  spentUsd: orchestratorSpentUsd,
15853
15940
  share: orchestratorSpentUsd / Math.max(totalUsd, .01),
@@ -18953,6 +19040,7 @@ function createCtx(internals, rootWorkflow) {
18953
19040
  });
18954
19041
  bump(internals.cost.byPhase, state.phase ?? "", costUsd);
18955
19042
  bump(internals.cost.byAgentType, agentType, costUsd);
19043
+ bump(internals.cost.byScope, state.scope, costUsd);
18956
19044
  internals.cost.byRole.set(primaryRole, (internals.cost.byRole.get(primaryRole) ?? 0) + costUsd);
18957
19045
  if (result.status === "escalated" && result.escalation !== void 0) {
18958
19046
  if (internals.replayer.snapshot().find((entry) => entry.kind === "decision" && entry.value?.targetRef === matched.running.seq) === void 0 && opts.result !== "full" && internals.onEscalation !== void 0) {
@@ -19728,6 +19816,7 @@ function createCtx(internals, rootWorkflow) {
19728
19816
  }
19729
19817
  bump(internals.cost.byPhase, state.phase ?? "", usd);
19730
19818
  bump(internals.cost.byAgentType, agentType, usd);
19819
+ bump(internals.cost.byScope, state.scope, usd);
19731
19820
  if (result.error?.kind === "budget" || internals.budget.exhausted && result.status !== "ok") {
19732
19821
  if (!internals.budget.exhausted && result.errorMessage !== void 0 && result.errorMessage.startsWith("in flight exposure cap reached")) throw new BudgetExhaustedError(result.errorMessage, { data: {
19733
19822
  scope: state.scope,
@@ -21166,6 +21255,50 @@ const MAX_LISTED_CITATIONS = 20;
21166
21255
  const MAX_NAMED_OFFENDING_SENTENCES = 5;
21167
21256
  const MAX_OFFENDING_SENTENCE_CHARS = 240;
21168
21257
  /**
21258
+ * The most offending sentences a verdict will hint (RV3801). A
21259
+ * document broken in more places than this needs a model repair
21260
+ * anyway, and an unbounded hint set would carry unbounded sentence
21261
+ * bytes through the live verdict.
21262
+ */
21263
+ const MAX_REPAIR_HINTS = 20;
21264
+ /**
21265
+ * The deterministic edit behind the `insert-run-id` mechanism
21266
+ * (RV3801): the id lands INSIDE the sentence, before its trailing
21267
+ * terminator run (a `.`, `!`, or `?` with any closing quotes,
21268
+ * brackets, or markdown emphasis after it), or at the very end when
21269
+ * the sentence carries no terminator. Inside matters: appended AFTER
21270
+ * the terminator the id would belong to the NEXT sentence under the
21271
+ * shared `sentencesOf` segmentation and the re-validation would fail
21272
+ * the same sentence again. Exported so tests and hosts can reproduce
21273
+ * the loop's exact bytes.
21274
+ */
21275
+ function insertRunIdIntoSentence(sentence, insert) {
21276
+ const at = /[.!?]['")\]*_`]*\s*$/u.exec(sentence)?.index ?? sentence.length;
21277
+ return `${sentence.slice(0, at)} (run ${insert})${sentence.slice(at)}`;
21278
+ }
21279
+ /**
21280
+ * Applies `insert-run-id` repair hints to a judged text (RV3801): each
21281
+ * `[start, end)` window is replaced by
21282
+ * {@link insertRunIdIntoSentence}(window, insert), right to left so
21283
+ * earlier offsets stay valid, every other byte identical. Fail closed:
21284
+ * `undefined` (never a partial patch) when the set is empty, any
21285
+ * window is out of bounds or empty, or two windows overlap; the caller
21286
+ * treats a refused patch exactly like an absent one and proceeds to
21287
+ * the model repair pool.
21288
+ */
21289
+ function applyFinishRepairHints(text, hints) {
21290
+ if (hints.length === 0) return;
21291
+ const ordered = [...hints].sort((a, b) => a.start - b.start);
21292
+ let previousEnd = 0;
21293
+ for (const hint of ordered) {
21294
+ if (!Number.isInteger(hint.start) || !Number.isInteger(hint.end) || hint.start < previousEnd || hint.end <= hint.start || hint.end > text.length) return;
21295
+ previousEnd = hint.end;
21296
+ }
21297
+ let patched = text;
21298
+ for (const hint of [...ordered].reverse()) patched = patched.slice(0, hint.start) + insertRunIdIntoSentence(patched.slice(hint.start, hint.end), hint.insert) + patched.slice(hint.end);
21299
+ return patched;
21300
+ }
21301
+ /**
21169
21302
  * The shortest run id {@link evidenceGradeValidator} will accept as an
21170
21303
  * artifact (RV2501). The floor mirrors the id half of
21171
21304
  * {@link DEFAULT_ARTIFACT_PATTERN}: a two character id would satisfy
@@ -21477,6 +21610,13 @@ const DEFAULT_ARTIFACT_PATTERN = "(?:run[ -]?[0-9A-HJKMNP-TV-Z]{6,26}|[\\w./-]+\
21477
21610
  * the repair instruction is executable rather than aspirational. An id
21478
21611
  * shorter than `MIN_RUN_ID_ARTIFACT_CHARS` (six) is ignored, and
21479
21612
  * without an id the verdict is byte identical to the historical one.
21613
+ *
21614
+ * With the id in hand the failure also carries {@link FinishRepairHint}
21615
+ * rows (RV3801), one per offending sentence, so the finish loop can
21616
+ * perform the verdict's own prescription host side without spending a
21617
+ * provider wire; the reasons stay byte identical either way, and the
21618
+ * hints are bounded (at most `MAX_REPAIR_HINTS` offenders) and fail
21619
+ * closed (an id whose bytes could split a sentence is never hinted).
21480
21620
  * Default name 'evidence-grade'.
21481
21621
  */
21482
21622
  function evidenceGradeValidator(options) {
@@ -21496,18 +21636,32 @@ function evidenceGradeValidator(options) {
21496
21636
  const unsupported = [];
21497
21637
  const offenders = [];
21498
21638
  const runId = typeof input.runId === "string" && input.runId.trim().length >= MIN_RUN_ID_ARTIFACT_CHARS ? input.runId.trim() : void 0;
21639
+ let cursor = 0;
21499
21640
  for (const sentence of sentencesOf(input.text)) {
21641
+ const start = input.text.indexOf(sentence, cursor);
21642
+ cursor = start + sentence.length;
21500
21643
  const haystack = sentence.toLowerCase();
21501
21644
  const found = lowered.filter((phrase) => haystack.includes(phrase));
21502
21645
  if (found.length === 0 || new RegExp(artifactPattern, "").test(sentence) || runId !== void 0 && containsIdentifier(sentence, runId)) continue;
21503
- offenders.push(sentence);
21646
+ offenders.push({
21647
+ sentence,
21648
+ start,
21649
+ end: start + sentence.length
21650
+ });
21504
21651
  for (const phrase of found) if (!unsupported.includes(phrase)) unsupported.push(phrase);
21505
21652
  }
21506
21653
  if (unsupported.length === 0) return ok;
21507
- const named = offenders.slice(0, MAX_NAMED_OFFENDING_SENTENCES).map((sentence) => {
21654
+ const named = offenders.slice(0, MAX_NAMED_OFFENDING_SENTENCES).map(({ sentence }) => {
21508
21655
  const flat = sentence.replace(/\s+/gu, " ").trim();
21509
21656
  return `offending sentence: "${flat.length <= MAX_OFFENDING_SENTENCE_CHARS ? flat : `${flat.slice(0, MAX_OFFENDING_SENTENCE_CHARS)}...`}"`;
21510
21657
  });
21658
+ const hints = runId !== void 0 && offenders.length <= MAX_REPAIR_HINTS && !/[.!?]\s|[\r\n]/u.test(runId) && offenders.every((offender) => offender.start >= 0) ? offenders.map(({ sentence, start, end }) => ({
21659
+ mechanism: "insert-run-id",
21660
+ start,
21661
+ end,
21662
+ sentence,
21663
+ insert: runId
21664
+ })) : void 0;
21511
21665
  const overflow = offenders.length - named.length;
21512
21666
  return {
21513
21667
  ok: false,
@@ -21515,7 +21669,8 @@ function evidenceGradeValidator(options) {
21515
21669
  runId === void 0 ? `evidence-grade claims cite no run or repro artifact in their own sentence: ${listCitations(unsupported)}; give each such claim a file:line citation in its own sentence, or state its run id in a SEPARATE sentence carrying no source citation (a run id written beside a path:line citation is not in the cited window and trades this failure for a cited-value one)` : `evidence-grade claims cite no run or repro artifact in their own sentence: ${listCitations(unsupported)}; write this run's id ${runId} inside each such sentence, or give the claim a file:line citation instead (the id may share a sentence with a source citation: cited-value reads a run id as identity, not as a value asserted about the cited line)`,
21516
21670
  ...named,
21517
21671
  ...overflow > 0 ? [`and ${String(overflow)} more offending sentences`] : []
21518
- ]
21672
+ ],
21673
+ ...hints === void 0 ? {} : { repairHints: hints }
21519
21674
  };
21520
21675
  }
21521
21676
  };
@@ -22763,6 +22918,72 @@ function selfTestFinishValidation(options) {
22763
22918
  /** How many rejected finishes are repaired by default: the plan's repair once. */
22764
22919
  const DEFAULT_FINISH_MAX_REPAIRS = 1;
22765
22920
  /**
22921
+ * The most hinted edits one deterministic repair attempt will apply
22922
+ * (RV3801): a validator caps its own hints well below this, so the
22923
+ * bound only guards against a custom validator flooding the journal
22924
+ * with patch rows; past it the candidate goes to the model pool.
22925
+ */
22926
+ const MAX_DETERMINISTIC_PATCHES = 64;
22927
+ /**
22928
+ * Plans the sectional claim repair round (RV3803): which H2 sections
22929
+ * of the accepted pre-repair document own the judged findings. The
22930
+ * third comparison run's round regenerated the WHOLE 43k character
22931
+ * document to consume findings that lived in a handful of sentences,
22932
+ * and the tail after fan-in was 80.1 percent of the run's wall. Each
22933
+ * finding's `draftExcerpt` (whitespace collapsed by the pairing fold)
22934
+ * is located in the document through a collapse-aware scan, and its
22935
+ * owning section is the nearest H2 line above it. Fail closed to the
22936
+ * FULL regeneration (undefined, the historical round byte for byte)
22937
+ * whenever the plan cannot be exact: no excerpts, a document without
22938
+ * H2 headings, duplicated markers (the splice grammar needs unique
22939
+ * lines), or any excerpt the scan cannot locate.
22940
+ */
22941
+ function sectionalRoundPlan(document, excerpts) {
22942
+ if (excerpts.length === 0) return;
22943
+ const markers = [];
22944
+ let offset = 0;
22945
+ for (const line of document.split("\n")) {
22946
+ if (line.trim().startsWith("## ")) markers.push({
22947
+ marker: line.trim(),
22948
+ start: offset
22949
+ });
22950
+ offset += line.length + 1;
22951
+ }
22952
+ if (markers.length === 0 || new Set(markers.map((m) => m.marker)).size !== markers.length) return;
22953
+ const collapsed = [];
22954
+ const rawAt = [];
22955
+ let pendingSpace = false;
22956
+ for (let index = 0; index < document.length; index += 1) {
22957
+ const char = document[index] ?? "";
22958
+ if (/\s/u.test(char)) {
22959
+ pendingSpace = collapsed.length > 0;
22960
+ continue;
22961
+ }
22962
+ if (pendingSpace) {
22963
+ collapsed.push(" ");
22964
+ rawAt.push(index);
22965
+ pendingSpace = false;
22966
+ }
22967
+ collapsed.push(char);
22968
+ rawAt.push(index);
22969
+ }
22970
+ const haystack = collapsed.join("");
22971
+ const targets = [];
22972
+ for (const excerpt of excerpts) {
22973
+ const at = haystack.indexOf(excerpt.trim());
22974
+ if (at < 0) return;
22975
+ const raw = rawAt[at] ?? -1;
22976
+ const owner = [...markers].reverse().find((m) => m.start <= raw);
22977
+ if (owner === void 0) return;
22978
+ if (!targets.includes(owner.marker)) targets.push(owner.marker);
22979
+ }
22980
+ targets.sort((a, b) => markers.findIndex((m) => m.marker === a) - markers.findIndex((m) => m.marker === b));
22981
+ return {
22982
+ sections: markers.map((m) => m.marker),
22983
+ targets
22984
+ };
22985
+ }
22986
+ /**
22766
22987
  * Character cap of the HOST VALIDATION LESSONS prompt block (RV3603):
22767
22988
  * the bounded repair round's prompt folds the run's journaled finish
22768
22989
  * validation failures so the round does not relearn a lesson the run
@@ -22895,6 +23116,8 @@ function validateOrchestrateOptions(opts) {
22895
23116
  }
22896
23117
  if (fv.maxRepairs !== void 0) requireNonNegativeInteger(fv.maxRepairs, "orchestrate finishValidation.maxRepairs");
22897
23118
  if (fv.repairTurnReserve !== void 0) requireNonNegativeInteger(fv.repairTurnReserve, "orchestrate finishValidation.repairTurnReserve");
23119
+ const estRepair = fv.estRepairCostUsd;
23120
+ if (estRepair !== void 0 && (typeof estRepair !== "number" || !Number.isFinite(estRepair) || estRepair < 0)) throw new ConfigError(`orchestrate finishValidation.estRepairCostUsd must be a nonnegative finite number; got ${JSON.stringify(estRepair)}`);
22898
23121
  const retain = fv.retainRejectedCandidates;
22899
23122
  if (retain !== void 0 && typeof retain !== "boolean") throw new ConfigError("orchestrate finishValidation.retainRejectedCandidates must be a boolean");
22900
23123
  const draftPolicy = fv.draftPolicy;
@@ -24263,6 +24486,31 @@ function makeOrchestratorWorkflow(goal, opts) {
24263
24486
  */
24264
24487
  let validationInvocationStart = 0;
24265
24488
  /**
24489
+ * The staged release of the round's mechanical money leg (RV3802),
24490
+ * armed by the bounded claim repair round right before its
24491
+ * composition dispatches and fired at the round invocation's FIRST
24492
+ * journaled finish verdict: a 'repair' verdict is about to spend
24493
+ * the freed money on the granted turn, an 'accepted' one never
24494
+ * needed it, and a 'rejected' one dies into the round's own
24495
+ * finally, which releases whatever is still armed. Live-only state
24496
+ * on the RV808b doctrine: the hold itself is re-committed by the
24497
+ * re-executed round code on a resume, and full replay never runs
24498
+ * validateFinish at all.
24499
+ */
24500
+ let releaseRepairLeg;
24501
+ /**
24502
+ * The sectional round context (RV3803), armed by the bounded claim
24503
+ * repair round exactly when {@link sectionalRoundPlan} is exact
24504
+ * over the accepted pre-repair document and the judged findings:
24505
+ * the retained base, its full H2 marker roster, and the target
24506
+ * sections owning the findings. Live state cleared in the round's
24507
+ * finally; a resume re-derives it from replayed material (the
24508
+ * judged findings and the accepted document both replay verbatim),
24509
+ * so the round's prompt bytes stay identical without journaling
24510
+ * anything new.
24511
+ */
24512
+ let sectionalRoundContext;
24513
+ /**
24266
24514
  * The contract generation membership test (cycle 73). Without a
24267
24515
  * contract there are no generations and every decision is current
24268
24516
  * (the pre 1.77 behavior, byte identical). With one, a decision
@@ -24295,8 +24543,9 @@ function makeOrchestratorWorkflow(goal, opts) {
24295
24543
  const rows = [];
24296
24544
  const seen = /* @__PURE__ */ new Set();
24297
24545
  for (const decision of validationDecisions()) {
24298
- if (decision.failed.length === 0 || !contractGenerationCurrent(decision)) continue;
24299
- for (const failure of decision.failed) {
24546
+ const taught = [...decision.failed, ...decision.deterministicRepair?.healed ?? []];
24547
+ if (taught.length === 0 || !contractGenerationCurrent(decision)) continue;
24548
+ for (const failure of taught) {
24300
24549
  const key = JSON.stringify([failure.name, failure.reasons]);
24301
24550
  if (seen.has(key)) continue;
24302
24551
  seen.add(key);
@@ -24435,7 +24684,45 @@ function makeOrchestratorWorkflow(goal, opts) {
24435
24684
  if (validationSpec === void 0) return { ok: true };
24436
24685
  let effective = call.result ?? null;
24437
24686
  let spliced = false;
24438
- if (finishSectional !== void 0) {
24687
+ if (sectionalRoundContext !== void 0) {
24688
+ const round = sectionalRoundContext;
24689
+ const args = call.args ?? {};
24690
+ const hasSections = Object.hasOwn(args, "sections");
24691
+ const hasResult = Object.hasOwn(args, "result");
24692
+ const guidance = () => ({
24693
+ declaredSections: round.sections,
24694
+ targetSections: round.targets,
24695
+ instruction: "repair ONLY the target sections: call finish({ sections: { \"<marker>\": \"<new section body>\" } }); unchanged sections are spliced from the retained accepted document byte for byte and the spliced whole is validated and judged. Resubmit the full document as result only when a targeted repair is impossible."
24696
+ });
24697
+ if (hasSections && hasResult) return {
24698
+ ok: false,
24699
+ feedback: {
24700
+ error: "pass either result (the full document) or sections (a sectional repair of the retained accepted document), never both",
24701
+ ...guidance()
24702
+ }
24703
+ };
24704
+ if (hasSections) {
24705
+ const patch = args.sections;
24706
+ const markers = Object.keys(patch);
24707
+ if (markers.length === 0) return {
24708
+ ok: false,
24709
+ feedback: {
24710
+ error: "sections must name at least one declared section marker",
24711
+ ...guidance()
24712
+ }
24713
+ };
24714
+ const unknown = markers.filter((marker) => !round.sections.includes(marker));
24715
+ if (unknown.length > 0) return {
24716
+ ok: false,
24717
+ feedback: {
24718
+ error: `sections names an undeclared section ${unknown.map((marker) => `'${marker}'`).join(", ")}; only the retained document's own markers splice`,
24719
+ ...guidance()
24720
+ }
24721
+ };
24722
+ effective = spliceSections(round.base, round.sections, patch);
24723
+ spliced = true;
24724
+ }
24725
+ } else if (finishSectional !== void 0) {
24439
24726
  const resolution = finishSectional.resolve(call);
24440
24727
  if (resolution.kind === "refused") return {
24441
24728
  ok: false,
@@ -24446,6 +24733,7 @@ function makeOrchestratorWorkflow(goal, opts) {
24446
24733
  }
24447
24734
  const maxRepairs = validationSpec.maxRepairs ?? 1;
24448
24735
  const known = validationDecisions();
24736
+ let patchedResult;
24449
24737
  let decision = known.find((candidate) => candidate.callId === call.id);
24450
24738
  if (decision === void 0) {
24451
24739
  const result = effective;
@@ -24456,6 +24744,7 @@ function makeOrchestratorWorkflow(goal, opts) {
24456
24744
  runId: internals.runId
24457
24745
  };
24458
24746
  const failed = [];
24747
+ const failureHints = [];
24459
24748
  for (const validator of validationSpec.validators) {
24460
24749
  let verdict;
24461
24750
  try {
@@ -24468,13 +24757,66 @@ function makeOrchestratorWorkflow(goal, opts) {
24468
24757
  feedback: { error: `finish validator '${validator.name}' is defective; the run fails` }
24469
24758
  };
24470
24759
  }
24471
- if (!verdict.ok) failed.push({
24472
- name: validator.name,
24473
- reasons: verdict.reasons
24474
- });
24760
+ if (!verdict.ok) {
24761
+ failed.push({
24762
+ name: validator.name,
24763
+ reasons: verdict.reasons
24764
+ });
24765
+ failureHints.push(verdict.repairHints);
24766
+ }
24767
+ }
24768
+ let deterministicRepair;
24769
+ if (failed.length > 0 && typeof result === "string" && failureHints.every((hints) => hints !== void 0 && hints.length > 0)) {
24770
+ const merged = [];
24771
+ const seenHints = /* @__PURE__ */ new Set();
24772
+ for (const hints of failureHints) for (const hint of hints ?? []) {
24773
+ const key = `${String(hint.start)}:${String(hint.end)}:${hint.insert}`;
24774
+ if (!seenHints.has(key)) {
24775
+ seenHints.add(key);
24776
+ merged.push(hint);
24777
+ }
24778
+ }
24779
+ const patched = merged.length <= MAX_DETERMINISTIC_PATCHES && merged.every((hint) => hint.mechanism === "insert-run-id" && result.slice(hint.start, hint.end) === hint.sentence) ? applyFinishRepairHints(result, merged) : void 0;
24780
+ if (patched !== void 0) {
24781
+ const patchedInput = {
24782
+ result: patched,
24783
+ text: patched,
24784
+ children: input.children,
24785
+ runId: internals.runId
24786
+ };
24787
+ const residual = [];
24788
+ for (const validator of validationSpec.validators) {
24789
+ let verdict;
24790
+ try {
24791
+ verdict = validator.validate(patchedInput);
24792
+ } catch (thrown) {
24793
+ validationTermination = new ConfigError(`finish validator '${validator.name}' threw instead of returning a verdict: ` + (thrown instanceof Error ? thrown.message : String(thrown)));
24794
+ validationAbort.abort("rulvar:finish-validation-defect");
24795
+ return {
24796
+ ok: false,
24797
+ feedback: { error: `finish validator '${validator.name}' is defective; the run fails` }
24798
+ };
24799
+ }
24800
+ if (!verdict.ok) residual.push(validator.name);
24801
+ }
24802
+ const patchSurvived = residual.length === 0;
24803
+ deterministicRepair = {
24804
+ mechanism: "insert-run-id",
24805
+ patches: merged.map(({ start, end, insert }) => ({
24806
+ start,
24807
+ end,
24808
+ insert
24809
+ })),
24810
+ beforeHash: createHash("sha256").update(jcsSerialize(result), "utf8").digest("hex"),
24811
+ afterHash: createHash("sha256").update(jcsSerialize(patched), "utf8").digest("hex"),
24812
+ outcome: patchSurvived ? "accepted" : "failed",
24813
+ ...patchSurvived ? { healed: failed } : { residual }
24814
+ };
24815
+ if (patchSurvived) patchedResult = patched;
24816
+ }
24475
24817
  }
24476
24818
  const repairsUsed = known.filter((candidate, index) => index >= validationInvocationStart && candidate.verdict !== "accepted" && contractGenerationCurrent(candidate)).length;
24477
- const rejectedCandidate = failed.length > 0;
24819
+ const rejectedCandidate = failed.length > 0 && deterministicRepair?.outcome !== "accepted";
24478
24820
  let candidateRef;
24479
24821
  if (rejectedCandidate && validationSpec.retainRejectedCandidates === true) {
24480
24822
  const ref = `${internals.runId}/finish-rejected/${call.id}`;
@@ -24496,10 +24838,11 @@ function makeOrchestratorWorkflow(goal, opts) {
24496
24838
  decision = {
24497
24839
  decisionType: "orchestrator_finish_validation",
24498
24840
  callId: call.id,
24499
- verdict: failed.length === 0 ? "accepted" : repairsUsed < maxRepairs ? "repair" : "rejected",
24500
- failed,
24841
+ verdict: failed.length === 0 || deterministicRepair?.outcome === "accepted" ? "accepted" : repairsUsed < maxRepairs ? "repair" : "rejected",
24842
+ failed: deterministicRepair?.outcome === "accepted" ? [] : failed,
24501
24843
  repairsUsed,
24502
24844
  maxRepairs,
24845
+ ...deterministicRepair === void 0 ? {} : { deterministicRepair },
24503
24846
  ...validationSpec.contract === void 0 ? {} : { contractHash: validationSpec.contract.hash },
24504
24847
  ...rejectedCandidate ? {
24505
24848
  candidateHash: createHash("sha256").update(jcsSerialize(result), "utf8").digest("hex"),
@@ -24516,11 +24859,18 @@ function makeOrchestratorWorkflow(goal, opts) {
24516
24859
  site: "orchestrator-finish-validation",
24517
24860
  value: decision
24518
24861
  });
24862
+ releaseRepairLeg?.();
24863
+ }
24864
+ if (decision.verdict === "accepted") {
24865
+ if (patchedResult !== void 0) return {
24866
+ ok: true,
24867
+ resolved: { result: patchedResult }
24868
+ };
24869
+ return spliced ? {
24870
+ ok: true,
24871
+ resolved: { result: effective }
24872
+ } : { ok: true };
24519
24873
  }
24520
- if (decision.verdict === "accepted") return spliced ? {
24521
- ok: true,
24522
- resolved: { result: effective }
24523
- } : { ok: true };
24524
24874
  finishSectional?.retain(effective);
24525
24875
  if (decision.verdict === "rejected") {
24526
24876
  if (contractGenerationCurrent(decision)) {
@@ -24541,7 +24891,11 @@ function makeOrchestratorWorkflow(goal, opts) {
24541
24891
  error: "the finish result failed host validation; repair the result and call finish again",
24542
24892
  failed: decision.failed,
24543
24893
  repairsRemaining: decision.maxRepairs - decision.repairsUsed - 1,
24544
- ...finishSectional === void 0 ? {} : { sectionalRepair: finishSectional.guidance() }
24894
+ ...sectionalRoundContext !== void 0 ? { sectionalRepair: {
24895
+ declaredSections: sectionalRoundContext.sections,
24896
+ targetSections: sectionalRoundContext.targets,
24897
+ instruction: "repair ONLY the target sections: call finish({ sections: { \"<marker>\": \"<new section body>\" } }); unchanged sections are spliced from the retained accepted document byte for byte and the spliced whole is validated and judged. Resubmit the full document as result only when a targeted repair is impossible."
24898
+ } } : finishSectional === void 0 ? {} : { sectionalRepair: finishSectional.guidance() }
24545
24899
  }
24546
24900
  };
24547
24901
  };
@@ -25608,7 +25962,7 @@ function makeOrchestratorWorkflow(goal, opts) {
25608
25962
  const synthesisToolNames = /* @__PURE__ */ new Set([FINISH_TOOL_NAME, ...exposeTools ? [GET_CHILD_RESULT_TOOL_NAME, READ_CHILD_ARTIFACT_TOOL_NAME] : []]);
25609
25963
  const synthesisTools = buildOrchestratorTools(orchestratorRuntime, fullCardText, {
25610
25964
  childResultTools: exposeTools,
25611
- sectionalFinish: synthSectionalFinish
25965
+ sectionalFinish: synthSectionalFinish || sectionalRoundContext !== void 0
25612
25966
  }).filter((tool) => synthesisToolNames.has(tool.name));
25613
25967
  if (finishSectional !== void 0 && synthSectionalFinish) finishSectional.retain(draft);
25614
25968
  const settledEntries = [...byOrdinal.values()].filter((record) => record.settled !== void 0).sort((a, b) => a.spawnOrdinal - b.spawnOrdinal).map((record) => [record.handle, record]);
@@ -25686,6 +26040,7 @@ function makeOrchestratorWorkflow(goal, opts) {
25686
26040
  ...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)],
25687
26041
  ...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)],
25688
26042
  ...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."],
25689
26044
  ...spec.policyFacts === true ? [(() => {
25690
26045
  const byStatus = {};
25691
26046
  let extensionsGranted = 0;
@@ -26540,6 +26895,30 @@ function makeOrchestratorWorkflow(goal, opts) {
26540
26895
  const convergenceHoldUsd = opts?.claimConsistency?.judge?.estCost ?? observedFinalJudgeCostUsd ?? 0;
26541
26896
  const convergenceScope = orchestratorAccount ?? "run";
26542
26897
  if (convergenceHoldUsd > 0) internals.budget.commitConvergenceReserve(convergenceScope, convergenceHoldUsd);
26898
+ const repairHoldUsd = validationSpec === void 0 ? 0 : validationSpec.estRepairCostUsd ?? lastMechanicalRepairCostUsd(internals.replayer.snapshot(), (servedBy, usage) => internals.priceUsd(servedBy, usage)) ?? 0;
26899
+ if (repairHoldUsd > 0) {
26900
+ internals.budget.commitRepairReserve(convergenceScope, repairHoldUsd);
26901
+ releaseRepairLeg = () => {
26902
+ releaseRepairLeg = void 0;
26903
+ internals.budget.releaseRepairReserve(convergenceScope);
26904
+ };
26905
+ }
26906
+ const roundPlan = validationSpec !== void 0 && typeof synthesizedFinal === "string" ? sectionalRoundPlan(synthesizedFinal, carried.map((finding) => finding.draftExcerpt)) : void 0;
26907
+ if (roundPlan !== void 0) {
26908
+ sectionalRoundContext = {
26909
+ base: synthesizedFinal,
26910
+ ...roundPlan
26911
+ };
26912
+ internals.events.emit({
26913
+ type: "log",
26914
+ level: "debug",
26915
+ msg: "orchestrator sectional round armed",
26916
+ data: {
26917
+ targets: roundPlan.targets,
26918
+ sections: roundPlan.sections.length
26919
+ }
26920
+ }, callingState.spanId);
26921
+ }
26543
26922
  try {
26544
26923
  synthesizedFinal = await runSynthesis(result.output);
26545
26924
  } catch (thrown) {
@@ -26572,6 +26951,9 @@ function makeOrchestratorWorkflow(goal, opts) {
26572
26951
  ...acceptanceSnapshot
26573
26952
  } });
26574
26953
  } finally {
26954
+ sectionalRoundContext = void 0;
26955
+ releaseRepairLeg = void 0;
26956
+ if (repairHoldUsd > 0) internals.budget.releaseRepairReserve(convergenceScope);
26575
26957
  if (convergenceHoldUsd > 0) internals.budget.releaseConvergenceReserve(convergenceScope);
26576
26958
  }
26577
26959
  try {
@@ -28775,6 +29157,7 @@ function createEngine(options) {
28775
29157
  byModel: /* @__PURE__ */ new Map(),
28776
29158
  byPhase: /* @__PURE__ */ new Map(),
28777
29159
  byAgentType: /* @__PURE__ */ new Map(),
29160
+ byScope: /* @__PURE__ */ new Map(),
28778
29161
  byRole: /* @__PURE__ */ new Map(),
28779
29162
  unpriced: [],
28780
29163
  orchestrator: {
@@ -29732,4 +30115,4 @@ function createSandboxBridge(ctx, options) {
29732
30115
  };
29733
30116
  }
29734
30117
  //#endregion
29735
- 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, 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, invoiceFromJournal, isClaimJudgeLabel, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, journalPricingSnapshot, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, 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, sectionCitationsValidator, sectionPatternCountValidator, 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 };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/core",
3
- "version": "1.242.0",
3
+ "version": "1.243.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",