@rulvar/core 1.86.0 → 1.88.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
@@ -3579,6 +3579,11 @@ interface ToolBudgetSummary {
3579
3579
  noticesFired?: number[];
3580
3580
  /** Present and true when the finalization reserve summary turn ran. */
3581
3581
  finalizationReserveUsed?: boolean;
3582
+ /**
3583
+ * Present and true when the finalization window activated at least
3584
+ * once this invocation (RV302).
3585
+ */
3586
+ finalizationWindowEntered?: boolean;
3582
3587
  /** The tool budget limiter that ended the loop, on that 'limit' only. */
3583
3588
  limiter?: "maxToolCalls" | "toolUnits";
3584
3589
  }
@@ -3710,11 +3715,12 @@ type ToolEvents = {
3710
3715
  rule?: Json;
3711
3716
  advisory?: Json;
3712
3717
  /**
3713
- * Present when an exploration guard (RV-210), not the permission
3714
- * chain, denied the call: the outcome is 'denied' and the call was
3715
- * never dispatched.
3718
+ * Present when an engine guard, not the permission chain, denied
3719
+ * the call: the exploration guards (RV-210) or the finalization
3720
+ * window (RV302). The outcome is 'denied' and the call was never
3721
+ * dispatched.
3716
3722
  */
3717
- guard?: "repeated-signature";
3723
+ guard?: "repeated-signature" | "per-tool-cap" | "finalization-window";
3718
3724
  };
3719
3725
  /**
3720
3726
  * Bare-nondeterminism detection (RV-209). Emitted LIVE by the segment
@@ -4106,6 +4112,27 @@ interface UsageLimits {
4106
4112
  minHeadroomUsd?: number; /** Default true: a grant needs new evidence since the last one. */
4107
4113
  requireNewEvidence?: boolean;
4108
4114
  };
4115
+ /**
4116
+ * The finalization window (RV302, the seventh comparison experiment):
4117
+ * once the remaining tool budget (executed calls against the effective
4118
+ * maxToolCalls, or remaining weighted units against toolUnits.max,
4119
+ * whichever is closer) drops to `reserveCalls`, only finalization
4120
+ * tools may execute. A call outside the window's allowlist receives a
4121
+ * typed error tool result naming the window (visible to the model,
4122
+ * never terminal, consuming no budget), and the model is told ONCE,
4123
+ * via a plain user message, to record its evidence and finish. The
4124
+ * allowlist defaults to the tools priced at toolUnits cost 0 (the
4125
+ * free bookkeeping tools); the engine terminal tool is always
4126
+ * admitted regardless. With toolBudgetExtension configured, remaining
4127
+ * money converts into a grant BEFORE any window refusal, so the
4128
+ * window binds only when the extension is exhausted or denied. Off by
4129
+ * default: the refusals and the notice enter the conversation, so
4130
+ * enabling it changes recorded model requests.
4131
+ */
4132
+ finalizationWindow?: {
4133
+ /** How many trailing executed calls (or units) the window reserves. */reserveCalls: number; /** Tool names allowed inside the window; default: zero-cost tools. */
4134
+ allow?: string[];
4135
+ };
4109
4136
  }
4110
4137
  declare const DEFAULT_MAX_TURNS = 32;
4111
4138
  declare const DEFAULT_STREAM_IDLE_TIMEOUT_MS = 12e4;
@@ -4135,6 +4162,10 @@ interface EffectiveUsageLimits {
4135
4162
  minHeadroomUsd?: number;
4136
4163
  requireNewEvidence?: boolean;
4137
4164
  };
4165
+ finalizationWindow?: {
4166
+ reserveCalls: number;
4167
+ allow?: string[];
4168
+ };
4138
4169
  }
4139
4170
  /**
4140
4171
  * Limits merge per spawn: AgentOpts.limits over profile limits over engine
@@ -7977,6 +8008,31 @@ interface AgentProfile {
7977
8008
  };
7978
8009
  /** Admission reserve hint in USD (budget layer 1). */
7979
8010
  estCost?: number;
8011
+ /**
8012
+ * The declared evidence contract of the profile's task (RV303, the
8013
+ * seventh comparison experiment): how many evidence entries the
8014
+ * spawned agent MUST record, and the declared call estimates behind
8015
+ * them. Purely declarative, like estCost: the runtime never enforces
8016
+ * it; {@link preflightEstimate} compares the resulting call floor
8017
+ * (`minEntries * estCallsPerEntry + overheadCalls`, defaults 3 and 8)
8018
+ * against the spawn's effective executed-call ceiling and warns
8019
+ * `tool-cap-below-evidence-floor` when the cap cannot fit the
8020
+ * contract. The experiment shape: 14 mandatory entries against an
8021
+ * 84-call cap that two workers exhausted at 10 recorded entries.
8022
+ */
8023
+ evidenceContract?: EvidenceContract;
8024
+ }
8025
+ /**
8026
+ * A declared evidence floor for preflight to judge tool caps against
8027
+ * (RV303). Declarative only; see {@link AgentProfile.evidenceContract}.
8028
+ */
8029
+ interface EvidenceContract {
8030
+ /** Evidence entries the task must record; positive integer. */
8031
+ minEntries: number;
8032
+ /** Estimated executed calls per recorded entry; default 3. */
8033
+ estCallsPerEntry?: number;
8034
+ /** Estimated non-evidence overhead calls; default 8. */
8035
+ overheadCalls?: number;
7980
8036
  }
7981
8037
  /**
7982
8038
  * Per-spawn options. The
@@ -8729,6 +8785,13 @@ interface ResearchAgentProfileOptions extends RepositoryResearchToolsetOptions {
8729
8785
  limits?: UsageLimits;
8730
8786
  /** Extra tools appended after the research toolset. */
8731
8787
  extraTools?: ToolDef[];
8788
+ /**
8789
+ * The declared evidence floor of the task (RV303), passed through to
8790
+ * {@link AgentProfile.evidenceContract} so preflight can compare it
8791
+ * against the profile's tool budget and warn
8792
+ * `tool-cap-below-evidence-floor` before any paid call.
8793
+ */
8794
+ evidenceContract?: EvidenceContract;
8732
8795
  }
8733
8796
  /** What {@link researchAgentProfile} returns: the profile plus the evidence accessor. */
8734
8797
  interface ResearchAgentProfileResult {
@@ -9211,6 +9274,15 @@ interface PreflightSpawnSpec {
9211
9274
  estInputTokens?: number;
9212
9275
  /** How many spawns of this shape the wave declares; default 1. */
9213
9276
  count?: number;
9277
+ /**
9278
+ * The declared evidence contract this spawn must fill (RV303): wins
9279
+ * over the registered profile's declaration. The estimator compares
9280
+ * the call floor (`minEntries * estCallsPerEntry + overheadCalls`,
9281
+ * defaults 3 and 8) against the spawn's effective executed-call
9282
+ * ceiling and warns `tool-cap-below-evidence-floor` when the cap
9283
+ * cannot fit the contract.
9284
+ */
9285
+ evidenceContract?: EvidenceContract;
9214
9286
  }
9215
9287
  /** The OrchestrateOptions slice the estimator consumes. */
9216
9288
  interface PreflightOrchestratorSpec {
@@ -9234,6 +9306,19 @@ interface PreflightOrchestratorSpec {
9234
9306
  */
9235
9307
  extension?: boolean;
9236
9308
  /**
9309
+ * The OrchestrateAcceptance slice the estimator judges (RV305):
9310
+ * declaring it lets preflight relate capped children to the salvage
9311
+ * arms. Absent, the salvage findings stay silent, exactly like every
9312
+ * other undeclared input.
9313
+ */
9314
+ acceptance?: {
9315
+ childPolicy?: "all-ok" | {
9316
+ minSuccessful: number;
9317
+ };
9318
+ acceptPartialChildren?: boolean;
9319
+ acceptValidatedTerminalOutputOnLimit?: boolean;
9320
+ };
9321
+ /**
9237
9322
  * The separate synthesis invocation (RV-211), when the orchestration
9238
9323
  * configures one (the v1.71 experiment review: the run ceiling used
9239
9324
  * to stop at the coordination loop, undercounting the synthesis
@@ -9471,6 +9556,10 @@ interface PreflightReport {
9471
9556
  };
9472
9557
  findings: PreflightFinding[];
9473
9558
  }
9559
+ /** Default estimated executed calls per recorded evidence entry (RV303). */
9560
+ declare const DEFAULT_EVIDENCE_CALLS_PER_ENTRY = 3;
9561
+ /** Default estimated non-evidence overhead calls of a research spawn (RV303). */
9562
+ declare const DEFAULT_EVIDENCE_OVERHEAD_CALLS = 8;
9474
9563
  /**
9475
9564
  * Computes the preflight report: the effective merged limits per
9476
9565
  * declared spawn, the layer-1 admission projection over the declared
@@ -9987,4 +10076,4 @@ interface SandboxBridge {
9987
10076
  declare const SANDBOX_AGENT_OPT_KEYS: readonly string[];
9988
10077
  declare function createSandboxBridge(ctx: Ctx<never>, options: SandboxBridgeOptions): SandboxBridge;
9989
10078
  //#endregion
9990
- export { AWAIT_SCHEMA, AbandonAttempt, AbandonFold, AbandonPayload, AbandonedSpendView, AbortClass, type AdaptiveEvents, AdmissionController, AdmissionDecision, AdmissionRejectedError, AdmissionStatsBefore, AdmitLineage, AdmitRejectReason, AdmitSpec, AdmitVerdict, AgentCallError, AgentError, type AgentEvents, AgentIdentityInput, type AgentInvocationRow, AgentOpts, AgentProfile, AgentProfilePermissions, AgentProfileTemplateOptions, AgentResult, AgentResultMeta, AgentStatus, ApproachSignatureInputs, ApprovalDecision, ApprovalIdentityInput, Artifact, AttemptOutcomeClass, AuditCategory, AuditRecord, AuditRunsOptions, BUDGET_ABORT_REASON, BaseAppend, BriefOpts, BudgetAccountView, BudgetDefaults, BudgetExhaustedError, BudgetExhaustionDiagnostics, BudgetHooks, BudgetReserve, type Bytes, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, CacheHint, CacheTtl, CanUseTool, CanonicalId, CanonicalIdentity, CanonicalLadderSpec, CanonicalModelSpec, ChatEvent, ChatRequest, CheckpointState, ChildArtifactPage, ChildIdentityInput, ChildResultPage, type ClaimClass, type ClaimOp, type ClaimStatus, ClaimValidationOptions, CollectOpts, CollectedTurn, CompactionConfig, CompiledPermissionChain, CompiledWorkflow, ConfigError, type CoreEvents, CostAttribution, CostAttributionFacts, CostReport, CreateEngineOptions, type CriticalPath, Ctx, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, DEFAULT_CITATION_SAMPLE, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DEFAULT_SYNTHESIS_MAX_TURNS, DEFAULT_SYNTHESIS_NOTE_MAX_TURNS, DataKeyProvider, DebitResult, DeclaredLadder, DedupIndex, DedupNote, DedupedClaims, DerivedKey, DeriverRegistry, type DeterminismConfig, DeterminismError, type DeterminismEvents, type DeterminismMode, DispositionRule, DispositionTable, DonorCandidate, DonorRef, DroppedItem, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EVENT_SEGMENT_STRIDE, EffectiveUsageLimits, Effort, Engine, EngineDefaults, EngineQuotaConfig, EngineQuotaRuntime, EntryKind, EntryRef, EntryStatus, EnvelopeEncryption, EnvelopeEncryptionOptions, ErrorClass, ErrorCode, ErrorPolicy, EscalatedResult, EscalationDecision, EscalationDecisionAbortedError, EscalationDigest, EscalationKind, EscalationLimits, EscalationOptions, EscalationReport, EscalationRequest, EventBus, type EvidenceRef, type ExecutorRegistry, type ExplorationSummary, ExtensionAppendInput, ExtensionDispatchSpec, ExternalIdentityInput, ExternalRegistry, ExtractNecessityInput, FINALIZE_SYNTHESIS_INSTRUCTION, FINISH_SCHEMA, FINISH_TOOL_NAME, FailRunError, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, FencedCodeMode, FileModelKnowledgeStore, FileModelKnowledgeStoreOptions, FileTranscriptStore, FinishContract, FinishContractCitations, FinishContractGoldenReject, FinishContractManifest, FinishInfo, FinishSelfTestFailure, FinishSelfTestFixtures, FinishSelfTestReport, FinishValidationChild, FinishValidationInput, FinishValidationSpec, FinishValidationVerdict, FinishValidator, GET_CHILD_RESULT_SCHEMA, GET_CHILD_RESULT_TOOL_NAME, Gate, GateAudit, type GateRecord, GitWorktreeProvider, GitWorktreeProviderOptions, GraftBoot, HashVersion, HookVerdict, IMPLEMENTATION_PROFILE_LIMITS, INBOX_PROPOSAL_TTL_DAYS, IdentityInput, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, IncrementalSynthesisResult, InvalidResolutionError, InvocationRole, type InvocationTable, InvoiceExport, InvoiceReconciliation, InvoiceRow, type IsolatedExecContext, type IsolatedExecRequest, type IsolatedExecutorTag, type IsolationProvider, type IsolationSpec, Issue$1 as Issue, JOURNAL_ENVELOPE_MARKER, JournalCompatSubCode, JournalCompatibilityError, JournalEntry, JournalMatcher, JournalMissError, JournalOperation, JournalOrderViolation, JournalSerializationContext, JournalSerializationHook, type JournalStore, type Json, JsonSchema, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, type KbProposal, type KbProposalTrigger, KeyDeriver, KeyRing, KeyedLimiter, KnowledgeCasError, type KnowledgeSnapshot, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LadderSpec, type LeasableStore, type Lease, LeaseHeldError, Ledger, LineageCounters, LineageIndex, LineageRef, LineageRelation, LineageStats, LogicalTaskId, MASKED_SECRET, MAX_CHILD_RESULT_PAGE_CHARS, MAX_DEPTH_CEILING, 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, OrchestrateOptions, OrchestrateSynthesis, OrchestrateSynthesisSkipReason, OrchestratorBudgetSpec, OrchestratorCapConfigError, OrchestratorExtension, OrchestratorExtensionIO, OrchestratorRuntime, Out, PARALLEL_AGENTS_SCHEMA, PROGRESS_REPORT_TOOL_NAME, ParallelSiteCounter, Part, PendingExternal, PendingToolTurn, PermissionConfig, PermissionGate, PermissionHook, PermissionPreset, PermissionRule, PermissionVerdict, type PhaseRow, PhaseTarget, PipelineCollected, PipelineOpts, PlanInvariantError, PreflightAdmissionRow, PreflightFinding, PreflightInput, PreflightOrchestratorSpec, PreflightReport, PreflightSpawnReport, PreflightSpawnSpec, PreflightToolCeiling, PriceTable, PricedUsage, type Pricing, type PricingTier, ProgressReport, type ProviderAdapter, ProviderCallRecord, 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_PROFILES, RUN_SETTLE_DECISION_TYPE, RandIdentityInput, RandPayload, RateLimitObservation, ReconcileOptions, ReconcileResult, RefEntryAppender, RefEntryClassification, RefusalInfo, 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, type RunFilter, RunHandle, RunInternals, type RunMeta, RunOptions, RunOutcome, RunProfile, RunStateAudit, RunStatus, RuntimeEventSink, SANDBOX_AGENT_OPT_KEYS, SPAWN_AGENT_SCHEMA, SandboxBridge, SandboxBridgeOptions, SandboxError, SandboxHostToWorker, SandboxMethod, SandboxWorkerToHost, SchemaPair, SchemaSpec, SchemaValidationResult, ScopeSegment, ScriptRejected, ScriptRunner, ScrubNote, SecretMasker, SectionMatchMode, Semaphore, SerializationHook, Settled, SettlementError, ShellPatternRules, ShellSegment, ShellVerdict, SinglePhaseAppend, SpanMinter, SpanRegistry, SpawnAdmissionValue, SpawnAgentParams, SpawnKey, SpawnLineage, SpawnLineageOpt, SpawnOrigin, SpawnRecord, Spend, Stage, type StandardJSONSchemaV1, type StandardSchemaV1, StepIdentityInput, StructuredOutputTier, SuspendedAppend, SuspensionState, TOOL_NAME_PATTERN, type TaskClass, TaskDigest, TaskSpec, TerminalPatch, TerminationAccount, TerminationAccountSnapshot, TerminationDeniedValue, TerminationDeniedWriter, TerminationInitValue, TerminationLimits, TerminationResource, type ToolBudgetSummary, ToolCallRequest, ToolChoice, type ToolContext, ToolContextSeed, ToolContract, type ToolDef, type ToolEvents, type ToolExecutor, type ToolExecutorProvider, ToolInit, type ToolRisk, ToolRuntime, type ToolSource, type ToolSourceSession, ToolsOption, 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, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, assertFencedWrites, atCompactionThreshold, auditRun, auditRuns, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compilePermissionChain, compilePermissionPreset, compileSecretMasker, compileVerifiedLayer, constantTimeEqual, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createEnvelopeEncryption, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, dedupeRepeatedClaims, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispatchProjectionReserveUsd, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidencePreservedValidator, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, finishContract, foldTermination, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashRunOutput, hashWorkflowBody, hashWorkflowSource, headingStructureValidator, identityJcs, implementationAgentProfile, invoiceFromJournal, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastRunSettle, latestProgressReport, lexShellCommand, liftRetainedParts, lineageWeightOf, localKeyProvider, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, memoryQuotaLimiter, mergeQuotaDenial, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, orchestratorAdmissionEstCostUsd, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, preflightEstimate, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleMatches, readRunMeta, readTerminationInit, reconcileRunMeta, reduceAuditTrail, reduceCriticalPath, reduceInvocationTable, registryKeyRing, remeasureQueue, replayDisposition, repositoryResearchToolset, requiredFieldsValidator, requiredSectionsValidator, researchAgentProfile, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, reviewAgentProfile, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, sectionCitationsValidator, selectStructuredOutputTier, selfTestFinishValidation, shouldCompact, snapshotUsage, spawnDepthOf, stripFencedBlocks, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, usageViolations, validateEditorialCommit, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateUsageLimits, wordCountValidator, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
10079
+ export { AWAIT_SCHEMA, AbandonAttempt, AbandonFold, AbandonPayload, AbandonedSpendView, AbortClass, type AdaptiveEvents, AdmissionController, AdmissionDecision, AdmissionRejectedError, AdmissionStatsBefore, AdmitLineage, AdmitRejectReason, AdmitSpec, AdmitVerdict, AgentCallError, AgentError, type AgentEvents, AgentIdentityInput, type AgentInvocationRow, AgentOpts, AgentProfile, AgentProfilePermissions, AgentProfileTemplateOptions, AgentResult, AgentResultMeta, AgentStatus, ApproachSignatureInputs, ApprovalDecision, ApprovalIdentityInput, Artifact, AttemptOutcomeClass, AuditCategory, AuditRecord, AuditRunsOptions, BUDGET_ABORT_REASON, BaseAppend, BriefOpts, BudgetAccountView, BudgetDefaults, BudgetExhaustedError, BudgetExhaustionDiagnostics, BudgetHooks, BudgetReserve, type Bytes, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, CacheHint, CacheTtl, CanUseTool, CanonicalId, CanonicalIdentity, CanonicalLadderSpec, CanonicalModelSpec, ChatEvent, ChatRequest, CheckpointState, ChildArtifactPage, ChildIdentityInput, ChildResultPage, type ClaimClass, type ClaimOp, type ClaimStatus, ClaimValidationOptions, CollectOpts, CollectedTurn, CompactionConfig, CompiledPermissionChain, CompiledWorkflow, ConfigError, type CoreEvents, CostAttribution, CostAttributionFacts, CostReport, CreateEngineOptions, type CriticalPath, Ctx, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, DEFAULT_CITATION_SAMPLE, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_CALLS_PER_ENTRY, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_EVIDENCE_OVERHEAD_CALLS, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DEFAULT_SYNTHESIS_MAX_TURNS, DEFAULT_SYNTHESIS_NOTE_MAX_TURNS, DataKeyProvider, DebitResult, DeclaredLadder, DedupIndex, DedupNote, DedupedClaims, DerivedKey, DeriverRegistry, type DeterminismConfig, DeterminismError, type DeterminismEvents, type DeterminismMode, DispositionRule, DispositionTable, DonorCandidate, DonorRef, DroppedItem, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EVENT_SEGMENT_STRIDE, EffectiveUsageLimits, Effort, Engine, EngineDefaults, EngineQuotaConfig, EngineQuotaRuntime, EntryKind, EntryRef, EntryStatus, EnvelopeEncryption, EnvelopeEncryptionOptions, ErrorClass, ErrorCode, ErrorPolicy, EscalatedResult, EscalationDecision, EscalationDecisionAbortedError, EscalationDigest, EscalationKind, EscalationLimits, EscalationOptions, EscalationReport, EscalationRequest, EventBus, EvidenceContract, type EvidenceRef, type ExecutorRegistry, type ExplorationSummary, ExtensionAppendInput, ExtensionDispatchSpec, ExternalIdentityInput, ExternalRegistry, ExtractNecessityInput, FINALIZE_SYNTHESIS_INSTRUCTION, FINISH_SCHEMA, FINISH_TOOL_NAME, FailRunError, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, FencedCodeMode, FileModelKnowledgeStore, FileModelKnowledgeStoreOptions, FileTranscriptStore, FinishContract, FinishContractCitations, FinishContractGoldenReject, FinishContractManifest, FinishInfo, FinishSelfTestFailure, FinishSelfTestFixtures, FinishSelfTestReport, FinishValidationChild, FinishValidationInput, FinishValidationSpec, FinishValidationVerdict, FinishValidator, GET_CHILD_RESULT_SCHEMA, GET_CHILD_RESULT_TOOL_NAME, Gate, GateAudit, type GateRecord, GitWorktreeProvider, GitWorktreeProviderOptions, GraftBoot, HashVersion, HookVerdict, IMPLEMENTATION_PROFILE_LIMITS, INBOX_PROPOSAL_TTL_DAYS, IdentityInput, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, IncrementalSynthesisResult, InvalidResolutionError, InvocationRole, type InvocationTable, InvoiceExport, InvoiceReconciliation, InvoiceRow, type IsolatedExecContext, type IsolatedExecRequest, type IsolatedExecutorTag, type IsolationProvider, type IsolationSpec, Issue$1 as Issue, JOURNAL_ENVELOPE_MARKER, JournalCompatSubCode, JournalCompatibilityError, JournalEntry, JournalMatcher, JournalMissError, JournalOperation, JournalOrderViolation, JournalSerializationContext, JournalSerializationHook, type JournalStore, type Json, JsonSchema, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, type KbProposal, type KbProposalTrigger, KeyDeriver, KeyRing, KeyedLimiter, KnowledgeCasError, type KnowledgeSnapshot, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LadderSpec, type LeasableStore, type Lease, LeaseHeldError, Ledger, LineageCounters, LineageIndex, LineageRef, LineageRelation, LineageStats, LogicalTaskId, MASKED_SECRET, MAX_CHILD_RESULT_PAGE_CHARS, MAX_DEPTH_CEILING, 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, OrchestrateOptions, OrchestrateSynthesis, OrchestrateSynthesisSkipReason, OrchestratorBudgetSpec, OrchestratorCapConfigError, OrchestratorExtension, OrchestratorExtensionIO, OrchestratorRuntime, Out, PARALLEL_AGENTS_SCHEMA, PROGRESS_REPORT_TOOL_NAME, ParallelSiteCounter, Part, PendingExternal, PendingToolTurn, PermissionConfig, PermissionGate, PermissionHook, PermissionPreset, PermissionRule, PermissionVerdict, type PhaseRow, PhaseTarget, PipelineCollected, PipelineOpts, PlanInvariantError, PreflightAdmissionRow, PreflightFinding, PreflightInput, PreflightOrchestratorSpec, PreflightReport, PreflightSpawnReport, PreflightSpawnSpec, PreflightToolCeiling, PriceTable, PricedUsage, type Pricing, type PricingTier, ProgressReport, type ProviderAdapter, ProviderCallRecord, 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_PROFILES, RUN_SETTLE_DECISION_TYPE, RandIdentityInput, RandPayload, RateLimitObservation, ReconcileOptions, ReconcileResult, RefEntryAppender, RefEntryClassification, RefusalInfo, 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, type RunFilter, RunHandle, RunInternals, type RunMeta, RunOptions, RunOutcome, RunProfile, RunStateAudit, RunStatus, RuntimeEventSink, SANDBOX_AGENT_OPT_KEYS, SPAWN_AGENT_SCHEMA, SandboxBridge, SandboxBridgeOptions, SandboxError, SandboxHostToWorker, SandboxMethod, SandboxWorkerToHost, SchemaPair, SchemaSpec, SchemaValidationResult, ScopeSegment, ScriptRejected, ScriptRunner, ScrubNote, SecretMasker, SectionMatchMode, Semaphore, SerializationHook, Settled, SettlementError, ShellPatternRules, ShellSegment, ShellVerdict, SinglePhaseAppend, SpanMinter, SpanRegistry, SpawnAdmissionValue, SpawnAgentParams, SpawnKey, SpawnLineage, SpawnLineageOpt, SpawnOrigin, SpawnRecord, Spend, Stage, type StandardJSONSchemaV1, type StandardSchemaV1, StepIdentityInput, StructuredOutputTier, SuspendedAppend, SuspensionState, TOOL_NAME_PATTERN, type TaskClass, TaskDigest, TaskSpec, TerminalPatch, TerminationAccount, TerminationAccountSnapshot, TerminationDeniedValue, TerminationDeniedWriter, TerminationInitValue, TerminationLimits, TerminationResource, type ToolBudgetSummary, ToolCallRequest, ToolChoice, type ToolContext, ToolContextSeed, ToolContract, type ToolDef, type ToolEvents, type ToolExecutor, type ToolExecutorProvider, ToolInit, type ToolRisk, ToolRuntime, type ToolSource, type ToolSourceSession, ToolsOption, 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, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, assertFencedWrites, atCompactionThreshold, auditRun, auditRuns, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compilePermissionChain, compilePermissionPreset, compileSecretMasker, compileVerifiedLayer, constantTimeEqual, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createEnvelopeEncryption, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, dedupeRepeatedClaims, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispatchProjectionReserveUsd, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidencePreservedValidator, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, finishContract, foldTermination, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashRunOutput, hashWorkflowBody, hashWorkflowSource, headingStructureValidator, identityJcs, implementationAgentProfile, invoiceFromJournal, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastRunSettle, latestProgressReport, lexShellCommand, liftRetainedParts, lineageWeightOf, localKeyProvider, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, memoryQuotaLimiter, mergeQuotaDenial, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, orchestratorAdmissionEstCostUsd, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, preflightEstimate, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleMatches, readRunMeta, readTerminationInit, reconcileRunMeta, reduceAuditTrail, reduceCriticalPath, reduceInvocationTable, registryKeyRing, remeasureQueue, replayDisposition, repositoryResearchToolset, requiredFieldsValidator, requiredSectionsValidator, researchAgentProfile, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, reviewAgentProfile, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, sectionCitationsValidator, selectStructuredOutputTier, selfTestFinishValidation, shouldCompact, snapshotUsage, spawnDepthOf, stripFencedBlocks, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, usageViolations, validateEditorialCommit, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateUsageLimits, wordCountValidator, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
package/dist/index.js CHANGED
@@ -2673,6 +2673,19 @@ function requireFraction(value, site) {
2673
2673
  function requireTimerDelayMs(value, site) {
2674
2674
  if (typeof value !== "number" || !Number.isInteger(value) || value < 1 || value > 2147483647) refuse(site, "an integer between 1 and 2147483647 ms (the Node timer maximum)", value);
2675
2675
  }
2676
+ /**
2677
+ * A declared evidence contract (RV303): minEntries and
2678
+ * estCallsPerEntry positive integers, overheadCalls a nonnegative
2679
+ * integer. Shared by the profile intake and the preflight spawn spec so
2680
+ * both boundaries refuse the same shapes with the same wording.
2681
+ */
2682
+ function validateEvidenceContract(value, site) {
2683
+ if (typeof value !== "object" || value === null || Array.isArray(value)) throw new ConfigError(`${site} must be { minEntries, estCallsPerEntry?, overheadCalls? }; got ${typeof value}`);
2684
+ const { minEntries, estCallsPerEntry, overheadCalls } = value;
2685
+ requirePositiveInteger(minEntries, `${site}.minEntries`);
2686
+ if (estCallsPerEntry !== void 0) requirePositiveInteger(estCallsPerEntry, `${site}.estCallsPerEntry`);
2687
+ if (overheadCalls !== void 0) requireNonNegativeInteger(overheadCalls, `${site}.overheadCalls`);
2688
+ }
2676
2689
  //#endregion
2677
2690
  //#region src/knowledge/file-store.ts
2678
2691
  /**
@@ -4319,7 +4332,7 @@ function mergeLimits(template, overrides) {
4319
4332
  * `evidence()`.
4320
4333
  */
4321
4334
  function researchAgentProfile(options) {
4322
- const { description, limits, extraTools, ...toolsetOptions } = options;
4335
+ const { description, limits, extraTools, evidenceContract, ...toolsetOptions } = options;
4323
4336
  const kit = repositoryResearchToolset(toolsetOptions);
4324
4337
  return {
4325
4338
  profile: {
@@ -4329,7 +4342,8 @@ function researchAgentProfile(options) {
4329
4342
  progressReportTool(),
4330
4343
  ...extraTools ?? []
4331
4344
  ],
4332
- limits: mergeLimits(RESEARCH_PROFILE_LIMITS, limits)
4345
+ limits: mergeLimits(RESEARCH_PROFILE_LIMITS, limits),
4346
+ ...evidenceContract === void 0 ? {} : { evidenceContract }
4333
4347
  },
4334
4348
  evidence: () => kit.evidence()
4335
4349
  };
@@ -9023,6 +9037,8 @@ function mergeUsageLimits(call, profile, engine) {
9023
9037
  if (finalizationReserve !== void 0) merged.finalizationReserve = finalizationReserve;
9024
9038
  const toolBudgetExtension = pick("toolBudgetExtension");
9025
9039
  if (toolBudgetExtension !== void 0) merged.toolBudgetExtension = toolBudgetExtension;
9040
+ const finalizationWindow = pick("finalizationWindow");
9041
+ if (finalizationWindow !== void 0) merged.finalizationWindow = finalizationWindow;
9026
9042
  return merged;
9027
9043
  }
9028
9044
  /**
@@ -9077,6 +9093,16 @@ function validateUsageLimits(limits, site) {
9077
9093
  if (minHeadroomUsd !== void 0 && (typeof minHeadroomUsd !== "number" || !Number.isFinite(minHeadroomUsd) || minHeadroomUsd < 0)) throw new ConfigError(`${site}.toolBudgetExtension.minHeadroomUsd must be a finite nonnegative USD amount, got ${typeof minHeadroomUsd === "number" ? String(minHeadroomUsd) : typeof minHeadroomUsd}`);
9078
9094
  if (requireNewEvidence !== void 0 && typeof requireNewEvidence !== "boolean") throw new ConfigError(`${site}.toolBudgetExtension.requireNewEvidence must be a boolean; got ${typeof requireNewEvidence}`);
9079
9095
  }
9096
+ if (limits.finalizationWindow !== void 0) {
9097
+ const window = limits.finalizationWindow;
9098
+ if (typeof window !== "object" || window === null || Array.isArray(window)) throw new ConfigError(`${site}.finalizationWindow must be { reserveCalls, allow? }`);
9099
+ const { reserveCalls, allow } = window;
9100
+ requirePositiveInteger(reserveCalls, `${site}.finalizationWindow.reserveCalls`);
9101
+ if (allow !== void 0) {
9102
+ if (!Array.isArray(allow)) throw new ConfigError(`${site}.finalizationWindow.allow must be an array of tool names`);
9103
+ for (const [index, name] of allow.entries()) if (typeof name !== "string" || name.length === 0) throw new ConfigError(`${site}.finalizationWindow.allow[${String(index)}] must be a nonempty tool name`);
9104
+ }
9105
+ }
9080
9106
  }
9081
9107
  //#endregion
9082
9108
  //#region src/model/failover.ts
@@ -9657,6 +9683,8 @@ const DEFAULT_MODEL_RETRY_ATTEMPTS = 2;
9657
9683
  */
9658
9684
  /** The docs anchor cited by guard denials and the guard abort. */
9659
9685
  const GUARD_DOCS_URL = "https://docs.rulvar.com/guide/agents#exploration-guards";
9686
+ /** The docs anchor cited by finalization window refusals (RV302). */
9687
+ const WINDOW_DOCS_URL = "https://docs.rulvar.com/guide/agents#the-finalization-window";
9660
9688
  /**
9661
9689
  * True when any exploration guard field asks for tracking. The tool
9662
9690
  * budget extension (RV301) counts too: its requireNewEvidence admission
@@ -9791,6 +9819,15 @@ var ExplorationGuard = class {
9791
9819
  return this.config.toolUnits !== void 0 && this.unitsUsed >= this.config.toolUnits.max;
9792
9820
  }
9793
9821
  /**
9822
+ * Weighted units still spendable, floored at zero; undefined without
9823
+ * toolUnits configured. The finalization window (RV302) reads this on
9824
+ * every call evaluation, so it stays an O(1) counter, unlike the
9825
+ * allocating summary().
9826
+ */
9827
+ unitsRemaining() {
9828
+ return this.config.toolUnits === void 0 ? void 0 : Math.max(0, this.config.toolUnits.max - this.unitsUsed);
9829
+ }
9830
+ /**
9794
9831
  * Distinct successful result digests seen this invocation: the
9795
9832
  * extension's requireNewEvidence admission compares snapshots of this
9796
9833
  * count (RV301). A result JCS cannot digest never counts, so a grant
@@ -9847,6 +9884,21 @@ function toolBudgetExtensionNoticeText(grant, maxExtensions, used, cap) {
9847
9884
  const remaining = Math.max(0, cap - used);
9848
9885
  return `Tool budget extended: grant ${String(grant)} of ${String(maxExtensions)}; ${String(used)} of ${String(cap)} tool calls used, ${String(remaining)} remaining. The budget headroom permits continued work; prioritize the highest value calls.`;
9849
9886
  }
9887
+ /**
9888
+ * The one-time model-visible window notice (RV302). Deterministic for
9889
+ * given counts, like the notices above.
9890
+ */
9891
+ function finalizationWindowNoticeText(remaining, reserve, budget) {
9892
+ return `Finalization window: ${String(Math.max(0, remaining))} of the reserved final ${String(reserve)} ${budget} remain. Only finalization tools (and the terminal tool) may execute now; record your evidence and finish with what you have.`;
9893
+ }
9894
+ /**
9895
+ * The typed window refusal a non-allowlisted call receives (RV302):
9896
+ * the same posture as the guard denials above, visible to the model,
9897
+ * never terminal, consuming no budget.
9898
+ */
9899
+ function finalizationWindowRefusalText(name, reserve, budget) {
9900
+ return `finalization window: the last ${String(reserve)} ${budget} are reserved for finalization tools, and '${name}' is not in the window allowlist. Record your evidence with the allowed tools and call the terminal tool (${WINDOW_DOCS_URL}).`;
9901
+ }
9850
9902
  //#endregion
9851
9903
  //#region src/runtime/no-progress.ts
9852
9904
  /**
@@ -10730,6 +10782,77 @@ async function runAgent(options) {
10730
10782
  }]
10731
10783
  });
10732
10784
  };
10785
+ /**
10786
+ * The finalization window (RV302): once the remaining tool budget
10787
+ * drops to reserveCalls, only the allowlisted finalization tools (and
10788
+ * the always-admitted terminal tool) execute; everything else gets a
10789
+ * typed refusal that consumes nothing. The run that motivated it
10790
+ * recorded 10 of 14 evidence entries before the cap: one summary turn
10791
+ * cannot dump a backlog, a reserved tail of bookkeeping calls can.
10792
+ */
10793
+ const finalizationWindow = limits.finalizationWindow;
10794
+ let windowEntered = false;
10795
+ let windowNoticeFired = false;
10796
+ const pendingWindowNotices = [];
10797
+ /** The tightest remaining budget and which dimension provides it. */
10798
+ const windowRemaining = () => {
10799
+ let best;
10800
+ const cap = effectiveMaxToolCalls();
10801
+ if (cap !== void 0) best = {
10802
+ remaining: Math.max(0, cap - toolCallsUsed),
10803
+ budget: "tool calls"
10804
+ };
10805
+ const units = guard?.unitsRemaining();
10806
+ if (units !== void 0 && (best === void 0 || units < best.remaining)) best = {
10807
+ remaining: units,
10808
+ budget: "tool units"
10809
+ };
10810
+ return best;
10811
+ };
10812
+ const windowActive = () => {
10813
+ if (finalizationWindow === void 0) return;
10814
+ const state = windowRemaining();
10815
+ return state !== void 0 && state.remaining <= finalizationWindow.reserveCalls ? state : void 0;
10816
+ };
10817
+ /**
10818
+ * Marks the entry and queues the one-time notice. Queued, not pushed:
10819
+ * a user message may not interleave a tool batch, so the queue
10820
+ * flushes with the other notices after the batch's results join the
10821
+ * history. On resume the flags re-derive from the restored counts and
10822
+ * the notice (already in the restored messages) never re-fires.
10823
+ */
10824
+ const maybeMarkWindowEntry = () => {
10825
+ if (finalizationWindow === void 0 || windowNoticeFired) return;
10826
+ const state = windowActive();
10827
+ if (state === void 0) return;
10828
+ windowEntered = true;
10829
+ windowNoticeFired = true;
10830
+ pendingWindowNotices.push(finalizationWindowNoticeText(state.remaining, finalizationWindow.reserveCalls, state.budget));
10831
+ events?.emit({
10832
+ type: "log",
10833
+ level: "info",
10834
+ msg: `finalization window entered: ${String(state.remaining)} of the reserved final ${String(finalizationWindow.reserveCalls)} ${state.budget} remain`
10835
+ });
10836
+ };
10837
+ const flushWindowNotices = () => {
10838
+ for (const text of pendingWindowNotices.splice(0)) messages.push({
10839
+ role: "user",
10840
+ parts: [{
10841
+ type: "text",
10842
+ text
10843
+ }]
10844
+ });
10845
+ };
10846
+ /**
10847
+ * The window allowlist. The terminal and escalate tools never reach
10848
+ * this check: the dispatch walk intercepts both before the window
10849
+ * block, so the exits are structurally exempt rather than listed.
10850
+ */
10851
+ const windowAllows = (name) => {
10852
+ const allow = finalizationWindow?.allow;
10853
+ if (allow !== void 0) return allow.includes(name);
10854
+ return limits.toolUnits?.costs?.[name] === 0;
10855
+ };
10733
10856
  const modelRetryCounts = /* @__PURE__ */ new Map();
10734
10857
  let lastTurnUsage = {
10735
10858
  inputTokens: 0,
@@ -10766,6 +10889,10 @@ async function runAgent(options) {
10766
10889
  extensionGrants = Math.min(extension.maxExtensions, Math.ceil((toolCallsUsed - limits.maxToolCalls) / extension.increment));
10767
10890
  extensionEvidenceAtLastGrant = guard?.evidenceCount() ?? 0;
10768
10891
  }
10892
+ if (windowActive() !== void 0) {
10893
+ windowEntered = true;
10894
+ windowNoticeFired = true;
10895
+ }
10769
10896
  }
10770
10897
  const usageSlices = () => [...usageByPhaseModel.values()].map(({ role, servedBy: sliceServedBy, usage }) => ({
10771
10898
  servedBy: sliceServedBy,
@@ -11044,6 +11171,27 @@ async function runAgent(options) {
11044
11171
  finished: finishArgs.result ?? null
11045
11172
  };
11046
11173
  }
11174
+ if (finalizationWindow !== void 0) {
11175
+ maybeMarkWindowEntry();
11176
+ let windowState = windowActive();
11177
+ if (windowState !== void 0 && !windowAllows(gatedCall.name)) {
11178
+ if (windowState.budget === "tool calls" && extension !== void 0 && windowState.remaining + extension.increment > finalizationWindow.reserveCalls && tryToolBudgetGrant()) windowState = windowActive();
11179
+ if (windowState !== void 0 && !windowAllows(gatedCall.name)) {
11180
+ events?.emit({
11181
+ type: "tool:end",
11182
+ toolName: gatedCall.name,
11183
+ outcome: "denied",
11184
+ durationMs: now() - gateStartedAt,
11185
+ guard: "finalization-window"
11186
+ });
11187
+ parts.push(errorPart(call, {
11188
+ error: finalizationWindowRefusalText(gatedCall.name, finalizationWindow.reserveCalls, windowState.budget),
11189
+ guard: "finalization-window"
11190
+ }));
11191
+ continue;
11192
+ }
11193
+ }
11194
+ }
11047
11195
  if (guard !== void 0) {
11048
11196
  const guardVerdict = guard.beforeExecute(gatedCall.name, gatedCall.args);
11049
11197
  if (guardVerdict.deny) {
@@ -11082,6 +11230,7 @@ async function runAgent(options) {
11082
11230
  };
11083
11231
  }
11084
11232
  }
11233
+ maybeMarkWindowEntry();
11085
11234
  return {
11086
11235
  parts,
11087
11236
  limitHit: false
@@ -11133,6 +11282,7 @@ async function runAgent(options) {
11133
11282
  }
11134
11283
  } else {
11135
11284
  flushExtensionNotices();
11285
+ flushWindowNotices();
11136
11286
  maybePushBudgetNotice();
11137
11287
  await saveBoundary();
11138
11288
  }
@@ -11598,6 +11748,7 @@ async function runAgent(options) {
11598
11748
  break;
11599
11749
  }
11600
11750
  flushExtensionNotices();
11751
+ flushWindowNotices();
11601
11752
  maybePushBudgetNotice();
11602
11753
  if (options.summarize !== void 0 && !compactionDisabled && shouldCompact({
11603
11754
  lastTurnUsage,
@@ -12159,6 +12310,7 @@ async function runAgent(options) {
12159
12310
  if (extension !== void 0) toolBudget.extensionsGranted = extensionGrants;
12160
12311
  if (firedNotices.size > 0) toolBudget.noticesFired = [...firedNotices].sort((a, b) => a - b);
12161
12312
  if (reserveSummaryRan) toolBudget.finalizationReserveUsed = true;
12313
+ if (windowEntered) toolBudget.finalizationWindowEntered = true;
12162
12314
  if (limitLimiter !== void 0) toolBudget.limiter = limitLimiter;
12163
12315
  result.toolBudget = toolBudget;
12164
12316
  }
@@ -17810,6 +17962,18 @@ function makeOrchestratorWorkflow(goal, opts) {
17810
17962
  * run falls back to the draft under a journaled decision and a warn
17811
17963
  * log, never silently.
17812
17964
  */
17965
+ /**
17966
+ * The reserve lifecycle snapshot (RV304 second half, the seventh
17967
+ * comparison experiment review, P1.7): configured is the declared
17968
+ * hold, held what actually registered on the cap account (zero when
17969
+ * no cap resolved and the config was silently inert), released
17970
+ * what the synthesis dispatch freed, remainingBeforeSynthesisUsd
17971
+ * the chain headroom the invocation saw right after the release,
17972
+ * and consumedUsd its own priced spend. Frozen into a journaled
17973
+ * decision at first completion, so a resume reports the identical
17974
+ * facts; absent everywhere when no reserve is configured.
17975
+ */
17976
+ let synthesisReserveLifecycle;
17813
17977
  const runSynthesis = async (draft) => {
17814
17978
  const spec = opts?.synthesis;
17815
17979
  if (spec === void 0) return draft;
@@ -17872,11 +18036,14 @@ function makeOrchestratorWorkflow(goal, opts) {
17872
18036
  ...repeatedClaims === void 0 ? {} : { repeatedClaims: repeatedClaims.length }
17873
18037
  }
17874
18038
  }, callingState.spanId);
18039
+ const configuredReserveUsd = opts?.budget?.synthesisReserveUsd ?? 0;
18040
+ const heldReserveUsd = orchestratorAccount === void 0 ? 0 : internals.budget.accountView(orchestratorAccount)?.synthesisReserveUsd ?? 0;
17875
18041
  const synthesisState = { ...callingState };
17876
18042
  if (orchestratorAccount !== void 0) {
17877
18043
  synthesisState.budgetScope = orchestratorAccount;
17878
18044
  internals.budget.releaseSynthesisReserve(orchestratorAccount);
17879
18045
  }
18046
+ const remainingBeforeSynthesisUsd = configuredReserveUsd > 0 ? internals.budget.remainingUsd(orchestratorAccount ?? callingState.budgetScope ?? void 0) : void 0;
17880
18047
  const synthesisBreak = validationSpec === void 0 ? void 0 : validationAbort.signal;
17881
18048
  if (synthesisBreak !== void 0) synthesisState.signal = callingState.signal === void 0 ? synthesisBreak : AbortSignal.any([callingState.signal, synthesisBreak]);
17882
18049
  const synthesisOpts = {
@@ -17899,6 +18066,46 @@ function makeOrchestratorWorkflow(goal, opts) {
17899
18066
  synthesisSchemaRejectedExchanges = synthesized.schemaRejectedTerminalExchanges ?? 0;
17900
18067
  synthesisSchemaRecoveredExchanges = synthesized.schemaRecoveredTerminalExchanges ?? 0;
17901
18068
  if (validationTermination !== void 0) throw validationTermination;
18069
+ if (configuredReserveUsd > 0) {
18070
+ const reserveKey = "synthesis-reserve-lifecycle";
18071
+ const prior = internals.replayer.snapshot().find((entry) => entry.kind === "decision" && entry.scope === callingState.scope && entry.key === reserveKey);
18072
+ if (prior !== void 0) {
18073
+ const frozen = prior.value;
18074
+ synthesisReserveLifecycle = {
18075
+ configuredUsd: frozen.configuredUsd,
18076
+ heldUsd: frozen.heldUsd,
18077
+ releasedUsd: frozen.releasedUsd,
18078
+ ...frozen.remainingBeforeSynthesisUsd === void 0 ? {} : { remainingBeforeSynthesisUsd: frozen.remainingBeforeSynthesisUsd },
18079
+ ...frozen.consumedUsd === void 0 ? {} : { consumedUsd: frozen.consumedUsd }
18080
+ };
18081
+ } else {
18082
+ synthesisReserveLifecycle = {
18083
+ configuredUsd: configuredReserveUsd,
18084
+ heldUsd: heldReserveUsd,
18085
+ releasedUsd: heldReserveUsd,
18086
+ ...remainingBeforeSynthesisUsd === void 0 ? {} : { remainingBeforeSynthesisUsd },
18087
+ consumedUsd: synthesized.costUsd
18088
+ };
18089
+ await internals.replayer.appendSinglePhase({
18090
+ scope: callingState.scope,
18091
+ key: reserveKey,
18092
+ kind: "decision",
18093
+ status: "ok",
18094
+ spanId: internals.spans.mint(callingState.spanId),
18095
+ site: "orchestrator-synthesis-reserve",
18096
+ value: {
18097
+ decisionType: "orchestrator_synthesis_reserve",
18098
+ ...synthesisReserveLifecycle
18099
+ }
18100
+ });
18101
+ }
18102
+ internals.events.emit({
18103
+ type: "log",
18104
+ level: "info",
18105
+ msg: "orchestrator synthesis reserve lifecycle",
18106
+ data: { ...synthesisReserveLifecycle }
18107
+ }, callingState.spanId);
18108
+ }
17902
18109
  if (synthesized.status === "ok") return synthesized.output;
17903
18110
  if (validationSpec !== void 0) throw new FailRunError(`the synthesis invocation terminated with status '${synthesized.status}'` + (synthesized.errorMessage === void 0 ? "" : `: ${synthesized.errorMessage}`) + "; finish validators are configured, so the unvalidated draft cannot stand", { data: {
17904
18111
  source: "orchestrator_synthesis",
@@ -18109,7 +18316,8 @@ function makeOrchestratorWorkflow(goal, opts) {
18109
18316
  degradedReasons: decision.degradedReasons,
18110
18317
  ...decision.salvagedPartialChildren === void 0 ? {} : { salvagedPartialChildren: decision.salvagedPartialChildren },
18111
18318
  ...decision.salvagedTerminalOutputChildren === void 0 ? {} : { salvagedTerminalOutputChildren: decision.salvagedTerminalOutputChildren },
18112
- ...envelopeSchemaRecovered === 0 ? {} : { schemaRecoveredFinishExchanges: envelopeSchemaRecovered }
18319
+ ...envelopeSchemaRecovered === 0 ? {} : { schemaRecoveredFinishExchanges: envelopeSchemaRecovered },
18320
+ ...synthesisReserveLifecycle === void 0 ? {} : { synthesisReserve: synthesisReserveLifecycle }
18113
18321
  };
18114
18322
  });
18115
18323
  }
@@ -18165,6 +18373,10 @@ function shapeRunTokens(shape) {
18165
18373
  return shape.turns * shape.inputFloor + shape.outputBound * shape.turns * (shape.turns + 1) / 2;
18166
18374
  }
18167
18375
  const ANY_TOOL = "(any)";
18376
+ /** Default estimated executed calls per recorded evidence entry (RV303). */
18377
+ const DEFAULT_EVIDENCE_CALLS_PER_ENTRY = 3;
18378
+ /** Default estimated non-evidence overhead calls of a research spawn (RV303). */
18379
+ const DEFAULT_EVIDENCE_OVERHEAD_CALLS = 8;
18168
18380
  function resolveServing(spec) {
18169
18381
  if (spec === void 0) return;
18170
18382
  if (typeof spec === "string") return spec;
@@ -18221,6 +18433,7 @@ function toolCeilingsOf(limits) {
18221
18433
  function validateSpawnSpec(spec, index) {
18222
18434
  const site = `preflight.spawns[${index}]`;
18223
18435
  if (spec.limits !== void 0) validateUsageLimits(spec.limits, `${site}.limits`);
18436
+ if (spec.evidenceContract !== void 0) validateEvidenceContract(spec.evidenceContract, `${site}.evidenceContract`);
18224
18437
  if (spec.estCost !== void 0) requireNonNegativeNumber(spec.estCost, `${site}.estCost`);
18225
18438
  if (spec.estInputTokens !== void 0) requireNonNegativeInteger(spec.estInputTokens, `${site}.estInputTokens`);
18226
18439
  if (spec.count !== void 0) requirePositiveInteger(spec.count, `${site}.count`);
@@ -18337,6 +18550,8 @@ function preflightEstimate(input) {
18337
18550
  const waveGateInputs = [];
18338
18551
  const units = [];
18339
18552
  const shapes = [];
18553
+ /** Whether any declared spawn caps its tool budget (RV305). */
18554
+ let anyCappedSpawn = false;
18340
18555
  for (const spec of spawnSpecs) {
18341
18556
  const role = spec.role ?? "loop";
18342
18557
  const label = spec.label ?? role;
@@ -18460,6 +18675,49 @@ function preflightEstimate(input) {
18460
18675
  message: `spawn '${label}' sets toolBudgetNotices without maxToolCalls: the notices never fire`,
18461
18676
  spawn: label
18462
18677
  });
18678
+ if (limits.finalizationWindow !== void 0) if (limits.maxToolCalls === void 0 && limits.toolUnits === void 0) say({
18679
+ severity: "warning",
18680
+ code: "inert-finalization-window",
18681
+ message: `spawn '${label}' sets finalizationWindow without maxToolCalls or toolUnits: no tool budget exists for the window to reserve a tail of`,
18682
+ spawn: label
18683
+ });
18684
+ else {
18685
+ const reserve = limits.finalizationWindow.reserveCalls;
18686
+ const windowCallCap = extendedMaxToolCalls(limits);
18687
+ const unitsMax = limits.toolUnits?.max;
18688
+ if (windowCallCap !== void 0 && reserve >= windowCallCap || unitsMax !== void 0 && reserve >= unitsMax) say({
18689
+ severity: "warning",
18690
+ code: "finalization-window-covers-cap",
18691
+ message: `spawn '${label}': finalizationWindow.reserveCalls ${String(reserve)} is not below the tool budget, so the window governs from the very first call and nothing but the allowlisted finalization tools ever executes`,
18692
+ spawn: label
18693
+ });
18694
+ if (limits.finalizationWindow.allow !== void 0 && limits.finalizationWindow.allow.length === 0) say({
18695
+ severity: "warning",
18696
+ code: "finalization-window-empty-allowlist",
18697
+ message: `spawn '${label}': finalizationWindow.allow is empty, so inside the window only the engine terminal tool (when one exists) remains callable and every other call is refused`,
18698
+ spawn: label
18699
+ });
18700
+ }
18701
+ const positiveCallCap = limits.maxToolCalls !== void 0 && limits.maxToolCalls > 0;
18702
+ if ((positiveCallCap || limits.toolUnits !== void 0) && limits.toolBudgetNotices !== true && limits.finalizationReserve === void 0 && limits.toolBudgetExtension === void 0 && limits.finalizationWindow === void 0) say({
18703
+ severity: "warning",
18704
+ code: "bare-tool-cap",
18705
+ message: `spawn '${label}' caps its tool budget (${positiveCallCap ? `maxToolCalls ${String(limits.maxToolCalls)}` : `toolUnits.max ${String(limits.toolUnits?.max ?? 0)}`}) with no softener: no toolBudgetNotices, no toolBudgetExtension, no finalizationReserve, no finalizationWindow. Expiry is a silent hard 'limit' the model never saw coming; enable a notice or a reserve, or drop the cap and rely on the USD ceiling`,
18706
+ spawn: label
18707
+ });
18708
+ if (positiveCallCap || limits.toolUnits !== void 0) anyCappedSpawn = true;
18709
+ const evidenceContract = spec.evidenceContract ?? profile?.evidenceContract;
18710
+ if (evidenceContract !== void 0 && executedToolCallCeiling !== null) {
18711
+ const perEntry = evidenceContract.estCallsPerEntry ?? 3;
18712
+ const overhead = evidenceContract.overheadCalls ?? 8;
18713
+ const floor = evidenceContract.minEntries * perEntry + overhead;
18714
+ if (executedToolCallCeiling < floor) say({
18715
+ severity: "warning",
18716
+ code: "tool-cap-below-evidence-floor",
18717
+ message: `spawn '${label}' declares an evidence contract of ${String(evidenceContract.minEntries)} entries; at ${String(perEntry)} estimated calls per entry plus ${String(overhead)} overhead calls the floor is ${String(floor)} executed calls, but the effective executed-call ceiling is ${String(executedToolCallCeiling)}: the cap cannot fit the contract; raise the budget, enable the extension, or lower the contract`,
18718
+ spawn: label
18719
+ });
18720
+ }
18463
18721
  if (unpriced && ceilingUsd !== void 0) say({
18464
18722
  severity: "warning",
18465
18723
  code: "unpriced-under-ceiling",
@@ -18519,6 +18777,12 @@ function preflightEstimate(input) {
18519
18777
  }
18520
18778
  let orchestratorReserveUsd;
18521
18779
  if (input.orchestrator !== void 0) {
18780
+ const acceptance = input.orchestrator.acceptance;
18781
+ if (acceptance !== void 0 && anyCappedSpawn && acceptance.acceptPartialChildren !== true && acceptance.acceptValidatedTerminalOutputOnLimit !== true) say({
18782
+ severity: "info",
18783
+ code: "capped-children-without-salvage",
18784
+ message: "children in the declared wave cap their tool budgets and the declared acceptance policy enables no salvage arm (acceptPartialChildren, acceptValidatedTerminalOutputOnLimit): a child that expires settles limit and counts against the policy with nothing to salvage"
18785
+ });
18522
18786
  const servedBy = resolveServing(defaults.routing?.orchestrate);
18523
18787
  if (servedBy === void 0) say({
18524
18788
  severity: "error",
@@ -19820,6 +20084,7 @@ function createEngine(options) {
19820
20084
  if (profile.escalation?.deadlineMs !== void 0) requirePositiveInteger(profile.escalation.deadlineMs, `createEngine defaults.profiles['${name}'].escalation.deadlineMs`);
19821
20085
  if (profile.escalation?.minSpendUsd !== void 0) requireNonNegativeNumber(profile.escalation.minSpendUsd, `createEngine defaults.profiles['${name}'].escalation.minSpendUsd`);
19822
20086
  if (profile.compaction?.threshold !== void 0) requireFraction(profile.compaction.threshold, `createEngine defaults.profiles['${name}'].compaction.threshold`);
20087
+ if (profile.evidenceContract !== void 0) validateEvidenceContract(profile.evidenceContract, `createEngine defaults.profiles['${name}'].evidenceContract`);
19823
20088
  }
19824
20089
  validateDeterminismConfig(options.determinism);
19825
20090
  validateEngineQuotaConfig(options.quota);
@@ -20743,4 +21008,4 @@ function createSandboxBridge(ctx, options) {
20743
21008
  };
20744
21009
  }
20745
21010
  //#endregion
20746
- export { AWAIT_SCHEMA, AdmissionController, AdmissionRejectedError, AgentCallError, BUDGET_ABORT_REASON, BudgetExhaustedError, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, ConfigError, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, DEFAULT_CITATION_SAMPLE, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DEFAULT_SYNTHESIS_MAX_TURNS, DEFAULT_SYNTHESIS_NOTE_MAX_TURNS, DedupIndex, DeterminismError, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EVENT_SEGMENT_STRIDE, EscalationDecisionAbortedError, EventBus, ExternalRegistry, FINALIZE_SYNTHESIS_INSTRUCTION, FINISH_SCHEMA, FINISH_TOOL_NAME, FailRunError, FileModelKnowledgeStore, FileTranscriptStore, GET_CHILD_RESULT_SCHEMA, GET_CHILD_RESULT_TOOL_NAME, GitWorktreeProvider, IMPLEMENTATION_PROFILE_LIMITS, INBOX_PROPOSAL_TTL_DAYS, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, JOURNAL_ENVELOPE_MARKER, JournalCompatibilityError, JournalMatcher, JournalMissError, JournalOrderViolation, 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_DEPTH_CEILING, 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_PROFILES, RUN_SETTLE_DECISION_TYPE, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionFold, RulvarError, RunBudget, SANDBOX_AGENT_OPT_KEYS, SPAWN_AGENT_SCHEMA, SandboxError, ScriptRejected, Semaphore, SettlementError, SpanRegistry, TOOL_NAME_PATTERN, TerminationAccount, WAIT_FOR_EVENTS_SCHEMA, WAIT_FOR_EVENTS_TOOL_NAME, WAKE_SUMMARY_RENDER_BUDGET_CHARS, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, assertFencedWrites, atCompactionThreshold, auditRun, auditRuns, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compilePermissionChain, compilePermissionPreset, compileSecretMasker, compileVerifiedLayer, constantTimeEqual, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createEnvelopeEncryption, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, dedupeRepeatedClaims, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispatchProjectionReserveUsd, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidencePreservedValidator, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, finishContract, foldTermination, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashRunOutput, hashWorkflowBody, hashWorkflowSource, headingStructureValidator, identityJcs, implementationAgentProfile, invoiceFromJournal, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastRunSettle, latestProgressReport, lexShellCommand, liftRetainedParts, lineageWeightOf, localKeyProvider, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, memoryQuotaLimiter, mergeQuotaDenial, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, orchestratorAdmissionEstCostUsd, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, preflightEstimate, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleMatches, readRunMeta, readTerminationInit, reconcileRunMeta, reduceAuditTrail, reduceCriticalPath, reduceInvocationTable, registryKeyRing, remeasureQueue, replayDisposition, repositoryResearchToolset, requiredFieldsValidator, requiredSectionsValidator, researchAgentProfile, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, reviewAgentProfile, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, sectionCitationsValidator, selectStructuredOutputTier, selfTestFinishValidation, shouldCompact, snapshotUsage, spawnDepthOf, stripFencedBlocks, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, usageViolations, validateEditorialCommit, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateUsageLimits, wordCountValidator, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
21011
+ export { AWAIT_SCHEMA, AdmissionController, AdmissionRejectedError, AgentCallError, BUDGET_ABORT_REASON, BudgetExhaustedError, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, ConfigError, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, DEFAULT_CITATION_SAMPLE, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_CALLS_PER_ENTRY, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_EVIDENCE_OVERHEAD_CALLS, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DEFAULT_SYNTHESIS_MAX_TURNS, DEFAULT_SYNTHESIS_NOTE_MAX_TURNS, DedupIndex, DeterminismError, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EVENT_SEGMENT_STRIDE, EscalationDecisionAbortedError, EventBus, ExternalRegistry, FINALIZE_SYNTHESIS_INSTRUCTION, FINISH_SCHEMA, FINISH_TOOL_NAME, FailRunError, FileModelKnowledgeStore, FileTranscriptStore, GET_CHILD_RESULT_SCHEMA, GET_CHILD_RESULT_TOOL_NAME, GitWorktreeProvider, IMPLEMENTATION_PROFILE_LIMITS, INBOX_PROPOSAL_TTL_DAYS, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, JOURNAL_ENVELOPE_MARKER, JournalCompatibilityError, JournalMatcher, JournalMissError, JournalOrderViolation, 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_DEPTH_CEILING, 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_PROFILES, RUN_SETTLE_DECISION_TYPE, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionFold, RulvarError, RunBudget, SANDBOX_AGENT_OPT_KEYS, SPAWN_AGENT_SCHEMA, SandboxError, ScriptRejected, Semaphore, SettlementError, SpanRegistry, TOOL_NAME_PATTERN, TerminationAccount, WAIT_FOR_EVENTS_SCHEMA, WAIT_FOR_EVENTS_TOOL_NAME, WAKE_SUMMARY_RENDER_BUDGET_CHARS, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, assertFencedWrites, atCompactionThreshold, auditRun, auditRuns, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compilePermissionChain, compilePermissionPreset, compileSecretMasker, compileVerifiedLayer, constantTimeEqual, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createEnvelopeEncryption, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, dedupeRepeatedClaims, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispatchProjectionReserveUsd, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidencePreservedValidator, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, finishContract, foldTermination, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashRunOutput, hashWorkflowBody, hashWorkflowSource, headingStructureValidator, identityJcs, implementationAgentProfile, invoiceFromJournal, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastRunSettle, latestProgressReport, lexShellCommand, liftRetainedParts, lineageWeightOf, localKeyProvider, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, memoryQuotaLimiter, mergeQuotaDenial, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, orchestratorAdmissionEstCostUsd, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, preflightEstimate, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleMatches, readRunMeta, readTerminationInit, reconcileRunMeta, reduceAuditTrail, reduceCriticalPath, reduceInvocationTable, registryKeyRing, remeasureQueue, replayDisposition, repositoryResearchToolset, requiredFieldsValidator, requiredSectionsValidator, researchAgentProfile, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, reviewAgentProfile, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, sectionCitationsValidator, selectStructuredOutputTier, selfTestFinishValidation, shouldCompact, snapshotUsage, spawnDepthOf, stripFencedBlocks, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, usageViolations, validateEditorialCommit, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateUsageLimits, wordCountValidator, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/core",
3
- "version": "1.86.0",
3
+ "version": "1.88.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",