@rulvar/core 1.79.0 → 1.81.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
@@ -4217,6 +4217,16 @@ interface AgentResult<T> {
4217
4217
  * resumed segments count the same total; absent when zero.
4218
4218
  */
4219
4219
  schemaRejectedTerminalExchanges?: number;
4220
+ /**
4221
+ * Terminal-tool exchanges whose near-JSON ARGUMENTS the unparsed
4222
+ * second chance (v1.75.1) RECOVERED into a schema-valid call (the
4223
+ * sixth comparison experiment; the judge's P1.5): the recovery used
4224
+ * to leave only a warn log behind, invisible on the outcome. A live
4225
+ * process counter like transportRetries (pure telemetry: nothing
4226
+ * downstream feeds on it), so a resumed segment counts only its own
4227
+ * recoveries; absent when zero.
4228
+ */
4229
+ schemaRecoveredTerminalExchanges?: number;
4220
4230
  }
4221
4231
  /** One 429's provider-normalized limits, per (provider, model). */
4222
4232
  interface RateLimitObservation {
@@ -4925,6 +4935,8 @@ interface BudgetAccountView {
4925
4935
  spentUsd: number;
4926
4936
  committedReserveUsd: number;
4927
4937
  finalizeReserveUsd: number;
4938
+ /** The synthesis payload hold (cycle 76); zero when none is committed. */
4939
+ synthesisReserveUsd: number;
4928
4940
  parentScope?: string;
4929
4941
  }
4930
4942
  /**
@@ -5081,6 +5093,21 @@ declare class RunBudget {
5081
5093
  * frozen past the cap, so nothing else can take it.
5082
5094
  */
5083
5095
  releaseFinalizeReserve(scope: string): void;
5096
+ /**
5097
+ * Registers the synthesis payload reserve (the sixth comparison
5098
+ * experiment, cycle 76): absolute dollars held on the orchestrator
5099
+ * account AND the run root, so neither spawn admission nor the
5100
+ * per-turn output clamp lets the coordination prefix eat the money
5101
+ * the synthesis finish needs. Unlike the finalize reserve it is
5102
+ * released BEFORE the synthesis invocation dispatches (the held
5103
+ * money is exactly what that invocation is meant to spend), and it
5104
+ * never joins the severing check: a coordination running against the
5105
+ * hold is clamped smaller, never aborted. Idempotent per account:
5106
+ * re-registering adjusts the root by the delta.
5107
+ */
5108
+ commitSynthesisReserve(scope: string, reserveUsd: number): void;
5109
+ /** The synthesis dispatch consumes its reserve; see commitSynthesisReserve. */
5110
+ releaseSynthesisReserve(scope: string): void;
5084
5111
  /** The reserve is replaced by real spend when the spawn settles. */
5085
5112
  releaseReserve(reserveUsd: number, accountScope?: string): void;
5086
5113
  /** Layer 2: the per-turn guard. A turn that would cross any ceiling in the chain is not dispatched. */
@@ -6382,6 +6409,29 @@ type FencedCodeMode = "counted" | "excluded";
6382
6409
  */
6383
6410
  declare function stripFencedBlocks(text: string): string;
6384
6411
  /**
6412
+ * Judges the markdown HEADING STRUCTURE of the result (the sixth
6413
+ * comparison experiment; the judge's P1.3): line presence proves each
6414
+ * declared heading EXISTS, not that the document carries them in the
6415
+ * declared order without extras. The sections must all start with the
6416
+ * SAME markdown heading marker (an identical count of leading '#'
6417
+ * characters, one to six, followed by whitespace); the governed level
6418
+ * derives from that marker. Fenced code is ALWAYS stripped first,
6419
+ * because a '## ' line inside a code sample is not a heading in
6420
+ * rendered markdown, so a fenced fake can neither satisfy a declared
6421
+ * heading nor trip exclusivity. Heading lines compare trimmed, whole
6422
+ * line. With `ordered` (default true) the declared headings must
6423
+ * appear in declaration order; with `exclusive` (default true) each
6424
+ * declared heading must appear exactly once and no undeclared heading
6425
+ * of the governed level may exist (other levels stay free). Default
6426
+ * name 'heading-structure'.
6427
+ */
6428
+ declare function headingStructureValidator(options: {
6429
+ sections: readonly string[];
6430
+ name?: string;
6431
+ ordered?: boolean;
6432
+ exclusive?: boolean;
6433
+ }): FinishValidator;
6434
+ /**
6385
6435
  * Requires every named section to appear LITERALLY in the result text
6386
6436
  * (a heading like 'FINDINGS' or any marker the goal demands). Default
6387
6437
  * name 'required-sections'; pass `name` to run several instances.
@@ -7124,6 +7174,21 @@ interface OrchestratorBudgetSpec {
7124
7174
  */
7125
7175
  finalizeReserveUsd?: number;
7126
7176
  /**
7177
+ * The synthesis payload reserve (the sixth comparison experiment,
7178
+ * cycle 76): absolute USD held out of the orchestrator sub account
7179
+ * while the coordination loop runs, released to the synthesis
7180
+ * invocation just before it dispatches. Without it a pricey
7181
+ * coordination can leave the synthesis turns a remainder the budget
7182
+ * clamp shrinks below the contract's minimal accepting payload: the
7183
+ * finish is then cut at the output allowance before any tool call,
7184
+ * the invocation dies at maxTurns, and a validator-bound run fails
7185
+ * closed (the rematch run 1 lost an entire paid run exactly there).
7186
+ * Requires the `synthesis` option (single mode); must stay below the
7187
+ * effective cap. Declaring it changes budget arithmetic only; absent
7188
+ * keeps every account byte identical.
7189
+ */
7190
+ synthesisReserveUsd?: number;
7191
+ /**
7127
7192
  * A positive integer, validated before any journal entry or dispatch:
7128
7193
  * the turn limit of the reserved final wake.
7129
7194
  */
@@ -7347,7 +7412,11 @@ interface OrchestrateOptions {
7347
7412
  /**
7348
7413
  * Per-orchestrate spawn cap: a nonnegative integer (zero admits no
7349
7414
  * spawns), validated before any journal entry or dispatch. The engine
7350
- * lifetime cap applies regardless.
7415
+ * lifetime cap applies regardless. The cap counts ADMITTED children:
7416
+ * an admission-rejected spawn (budget, quota, depth) consumes no slot,
7417
+ * so the orchestrator may retry a rejected role at a viable budget
7418
+ * (v1.81; the sixth comparison experiment's run 2). Attempts stay
7419
+ * bounded regardless through the coordination turn's own tool budget.
7351
7420
  */
7352
7421
  maxSpawns?: number;
7353
7422
  /** The orchestrator's own budget sub-account (cap enforcement layers only in M6). */
@@ -9812,4 +9881,4 @@ interface SandboxBridge {
9812
9881
  declare const SANDBOX_AGENT_OPT_KEYS: readonly string[];
9813
9882
  declare function createSandboxBridge(ctx: Ctx<never>, options: SandboxBridgeOptions): SandboxBridge;
9814
9883
  //#endregion
9815
- 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, 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, 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 };
9884
+ 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, 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
@@ -10502,6 +10502,7 @@ async function runAgent(options) {
10502
10502
  const providerCalls = [];
10503
10503
  let invocationCounter = 0;
10504
10504
  let transportRetries = 0;
10505
+ let schemaRecoveredTerminalExchanges = 0;
10505
10506
  const rateLimitObservations = /* @__PURE__ */ new Map();
10506
10507
  const roleUsageSnapshot = (role) => {
10507
10508
  const snapshot = /* @__PURE__ */ new Map();
@@ -10878,6 +10879,7 @@ async function runAgent(options) {
10878
10879
  const revalidation = await validateSchemaSpec(terminalDef.parameters, recovered.value);
10879
10880
  if (revalidation.valid) {
10880
10881
  validation = revalidation;
10882
+ schemaRecoveredTerminalExchanges += 1;
10881
10883
  events?.emit(unparsedRecoveryLog(gatedCall.name, unparsedRaw.length, recovered.pass));
10882
10884
  }
10883
10885
  }
@@ -12031,6 +12033,7 @@ async function runAgent(options) {
12031
12033
  const terminalName = options.terminalTool?.name;
12032
12034
  const schemaRejectedTerminalExchanges = terminalName === void 0 ? 0 : messages.reduce((count, message) => count + message.parts.filter((part) => part.type === "tool-result" && part.name === terminalName && part.isError === true && part.result?.error === terminalSchemaRejectionMessage(terminalName)).length, 0);
12033
12035
  if (schemaRejectedTerminalExchanges > 0) result.schemaRejectedTerminalExchanges = schemaRejectedTerminalExchanges;
12036
+ if (schemaRecoveredTerminalExchanges > 0) result.schemaRecoveredTerminalExchanges = schemaRecoveredTerminalExchanges;
12034
12037
  if (usageApprox) result.usageApprox = true;
12035
12038
  if (transportRetries > 0) result.transportRetries = transportRetries;
12036
12039
  if (rateLimitObservations.size > 0) result.rateLimitObservations = [...rateLimitObservations.values()];
@@ -12141,6 +12144,7 @@ var RunBudget = class {
12141
12144
  spentUsd: 0,
12142
12145
  committedReserveUsd: 0,
12143
12146
  finalizeReserveUsd: 0,
12147
+ synthesisReserveUsd: 0,
12144
12148
  controller: new AbortController()
12145
12149
  };
12146
12150
  if (options.ceilingUsd !== void 0) root.ceilingUsd = options.ceilingUsd;
@@ -12185,6 +12189,7 @@ var RunBudget = class {
12185
12189
  spentUsd: 0,
12186
12190
  committedReserveUsd: 0,
12187
12191
  finalizeReserveUsd: options.finalizeReserveUsd ?? 0,
12192
+ synthesisReserveUsd: 0,
12188
12193
  parentScope,
12189
12194
  controller: new AbortController()
12190
12195
  };
@@ -12236,7 +12241,8 @@ var RunBudget = class {
12236
12241
  scope: account.scope,
12237
12242
  spentUsd: account.spentUsd,
12238
12243
  committedReserveUsd: account.committedReserveUsd,
12239
- finalizeReserveUsd: account.finalizeReserveUsd
12244
+ finalizeReserveUsd: account.finalizeReserveUsd,
12245
+ synthesisReserveUsd: account.synthesisReserveUsd
12240
12246
  };
12241
12247
  if (account.ceilingUsd !== void 0) view.ceilingUsd = account.ceilingUsd;
12242
12248
  if (account.parentScope !== void 0) view.parentScope = account.parentScope;
@@ -12250,7 +12256,7 @@ var RunBudget = class {
12250
12256
  remainderOf(scope) {
12251
12257
  const account = this.accounts.get(scope);
12252
12258
  if (account?.ceilingUsd === void 0) return;
12253
- return Math.max(0, account.ceilingUsd - account.spentUsd - account.committedReserveUsd - account.finalizeReserveUsd);
12259
+ return Math.max(0, account.ceilingUsd - account.spentUsd - account.committedReserveUsd - account.finalizeReserveUsd - account.synthesisReserveUsd);
12254
12260
  }
12255
12261
  /**
12256
12262
  * The tightest allowance headroom on the chain of `scope`: the minimum
@@ -12320,7 +12326,7 @@ var RunBudget = class {
12320
12326
  const chain = this.chainOf(accountScope);
12321
12327
  for (const account of chain) {
12322
12328
  if (account.ceilingUsd === void 0) continue;
12323
- const committed = account.spentUsd + account.committedReserveUsd + account.finalizeReserveUsd;
12329
+ const committed = account.spentUsd + account.committedReserveUsd + account.finalizeReserveUsd + account.synthesisReserveUsd;
12324
12330
  if (committed >= account.ceilingUsd || committed + reserveUsd > account.ceilingUsd) {
12325
12331
  if (account.scope === "run") this.exhaustedInternal = true;
12326
12332
  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 plus the proposed reserve ${reserveUsd.toFixed(4)} USD does not fit the ceiling ${account.ceilingUsd.toFixed(4)} USD`, { data: {
@@ -12375,6 +12381,34 @@ var RunBudget = class {
12375
12381
  this.root.finalizeReserveUsd = 0;
12376
12382
  this.emitUpdate();
12377
12383
  }
12384
+ /**
12385
+ * Registers the synthesis payload reserve (the sixth comparison
12386
+ * experiment, cycle 76): absolute dollars held on the orchestrator
12387
+ * account AND the run root, so neither spawn admission nor the
12388
+ * per-turn output clamp lets the coordination prefix eat the money
12389
+ * the synthesis finish needs. Unlike the finalize reserve it is
12390
+ * released BEFORE the synthesis invocation dispatches (the held
12391
+ * money is exactly what that invocation is meant to spend), and it
12392
+ * never joins the severing check: a coordination running against the
12393
+ * hold is clamped smaller, never aborted. Idempotent per account:
12394
+ * re-registering adjusts the root by the delta.
12395
+ */
12396
+ commitSynthesisReserve(scope, reserveUsd) {
12397
+ const account = this.accounts.get(scope);
12398
+ if (account === void 0) throw new ConfigError(`unknown budget account '${scope}' for the synthesis reserve`);
12399
+ const previous = account.synthesisReserveUsd;
12400
+ account.synthesisReserveUsd = reserveUsd;
12401
+ if (account.scope !== "run") this.root.synthesisReserveUsd = Math.max(0, this.root.synthesisReserveUsd + reserveUsd - previous);
12402
+ this.emitUpdate();
12403
+ }
12404
+ /** The synthesis dispatch consumes its reserve; see commitSynthesisReserve. */
12405
+ releaseSynthesisReserve(scope) {
12406
+ const account = this.accounts.get(scope);
12407
+ if (account === void 0 || account.synthesisReserveUsd === 0) return;
12408
+ if (account.scope !== "run") this.root.synthesisReserveUsd = Math.max(0, this.root.synthesisReserveUsd - account.synthesisReserveUsd);
12409
+ account.synthesisReserveUsd = 0;
12410
+ this.emitUpdate();
12411
+ }
12378
12412
  /** The reserve is replaced by real spend when the spawn settles. */
12379
12413
  releaseReserve(reserveUsd, accountScope = "run") {
12380
12414
  for (const account of this.chainOf(accountScope)) account.committedReserveUsd = Math.max(0, account.committedReserveUsd - reserveUsd);
@@ -12407,7 +12441,7 @@ var RunBudget = class {
12407
12441
  let remainingUsd;
12408
12442
  for (const account of this.chainOf(accountScope)) {
12409
12443
  if (account.ceilingUsd === void 0) continue;
12410
- const headroom = account.ceilingUsd - account.spentUsd;
12444
+ const headroom = account.ceilingUsd - account.spentUsd - account.synthesisReserveUsd;
12411
12445
  remainingUsd = remainingUsd === void 0 ? headroom : Math.min(remainingUsd, headroom);
12412
12446
  }
12413
12447
  if (remainingUsd === void 0) return;
@@ -15422,6 +15456,87 @@ function missingSectionQualifier(match, fencedCode) {
15422
15456
  const demands = (match === "line" ? " as its own line" : "") + (fencedCode === "excluded" ? " outside fenced code" : "");
15423
15457
  return demands === "" ? "" : ` (required${demands})`;
15424
15458
  }
15459
+ const MAX_LISTED_EXTRA_HEADINGS = 5;
15460
+ /**
15461
+ * Judges the markdown HEADING STRUCTURE of the result (the sixth
15462
+ * comparison experiment; the judge's P1.3): line presence proves each
15463
+ * declared heading EXISTS, not that the document carries them in the
15464
+ * declared order without extras. The sections must all start with the
15465
+ * SAME markdown heading marker (an identical count of leading '#'
15466
+ * characters, one to six, followed by whitespace); the governed level
15467
+ * derives from that marker. Fenced code is ALWAYS stripped first,
15468
+ * because a '## ' line inside a code sample is not a heading in
15469
+ * rendered markdown, so a fenced fake can neither satisfy a declared
15470
+ * heading nor trip exclusivity. Heading lines compare trimmed, whole
15471
+ * line. With `ordered` (default true) the declared headings must
15472
+ * appear in declaration order; with `exclusive` (default true) each
15473
+ * declared heading must appear exactly once and no undeclared heading
15474
+ * of the governed level may exist (other levels stay free). Default
15475
+ * name 'heading-structure'.
15476
+ */
15477
+ function headingStructureValidator(options) {
15478
+ const sections = requireNonEmptyStrings(options.sections, "headingStructureValidator sections").map((section) => section.trim());
15479
+ let level;
15480
+ for (const section of sections) {
15481
+ const marker = /^(#{1,6})\s+\S/.exec(section);
15482
+ if (marker?.[1] === void 0) throw new ConfigError(`headingStructureValidator section '${section}' is not a markdown heading (one to six '#' characters, whitespace, then content)`);
15483
+ if (level === void 0) level = marker[1].length;
15484
+ else if (marker[1].length !== level) throw new ConfigError(`headingStructureValidator sections must all start with the same markdown heading marker; got level ${String(marker[1].length)} after level ${String(level)}`);
15485
+ }
15486
+ const declaredLevel = level ?? 2;
15487
+ const declared = /* @__PURE__ */ new Set();
15488
+ for (const section of sections) {
15489
+ if (declared.has(section)) throw new ConfigError(`headingStructureValidator sections carry a duplicate: '${section}'`);
15490
+ declared.add(section);
15491
+ }
15492
+ for (const [flag, value] of [["ordered", options.ordered], ["exclusive", options.exclusive]]) if (value !== void 0 && typeof value !== "boolean") throw new ConfigError(`headingStructureValidator ${flag} must be a boolean; got ${String(value)}`);
15493
+ const ordered = options.ordered ?? true;
15494
+ const exclusive = options.exclusive ?? true;
15495
+ const headingRe = new RegExp(`^#{${String(declaredLevel)}}(?!#)\\s`);
15496
+ return {
15497
+ name: options.name ?? "heading-structure",
15498
+ validate: (input) => {
15499
+ const headings = stripFencedBlocks(input.text).split("\n").map((line) => line.trim()).filter((line) => headingRe.test(line));
15500
+ const reasons = [];
15501
+ const present = new Set(headings);
15502
+ for (const section of sections) if (!present.has(section)) reasons.push(`required heading '${section}' is missing`);
15503
+ if (exclusive) {
15504
+ const seenDeclared = /* @__PURE__ */ new Set();
15505
+ for (const heading of headings) if (declared.has(heading)) {
15506
+ if (seenDeclared.has(heading)) reasons.push(`duplicate heading '${heading}'`);
15507
+ seenDeclared.add(heading);
15508
+ }
15509
+ }
15510
+ if (ordered) {
15511
+ const firstSeen = [];
15512
+ const taken = /* @__PURE__ */ new Set();
15513
+ for (const heading of headings) if (declared.has(heading) && !taken.has(heading)) {
15514
+ taken.add(heading);
15515
+ firstSeen.push(heading);
15516
+ }
15517
+ const expected = sections.filter((section) => taken.has(section));
15518
+ for (let i = 0; i < expected.length; i++) if (firstSeen[i] !== expected[i]) {
15519
+ reasons.push(`heading order mismatch at position ${String(i + 1)}: found '${firstSeen[i] ?? ""}' where '${expected[i] ?? ""}' is declared`);
15520
+ break;
15521
+ }
15522
+ }
15523
+ if (exclusive) {
15524
+ const extras = [];
15525
+ const listed = /* @__PURE__ */ new Set();
15526
+ for (const heading of headings) if (!declared.has(heading) && !listed.has(heading)) {
15527
+ listed.add(heading);
15528
+ extras.push(heading);
15529
+ }
15530
+ for (const extra of extras.slice(0, MAX_LISTED_EXTRA_HEADINGS)) reasons.push(`undeclared level ${String(declaredLevel)} heading '${extra}'`);
15531
+ if (extras.length > MAX_LISTED_EXTRA_HEADINGS) reasons.push(`and ${String(extras.length - MAX_LISTED_EXTRA_HEADINGS)} more undeclared level ${String(declaredLevel)} headings`);
15532
+ }
15533
+ return reasons.length === 0 ? ok : {
15534
+ ok: false,
15535
+ reasons
15536
+ };
15537
+ }
15538
+ };
15539
+ }
15425
15540
  /**
15426
15541
  * Requires every named section to appear LITERALLY in the result text
15427
15542
  * (a heading like 'FINDINGS' or any marker the goal demands). Default
@@ -16159,6 +16274,11 @@ function validateOrchestrateOptions(opts) {
16159
16274
  if (spec.capUsd !== void 0) requireNonNegativeNumber(spec.capUsd, "orchestrate budget.capUsd");
16160
16275
  if (spec.capFraction !== void 0) requireFraction(spec.capFraction, "orchestrate budget.capFraction");
16161
16276
  if (spec.finalizeReserveUsd !== void 0) requireNonNegativeNumber(spec.finalizeReserveUsd, "orchestrate budget.finalizeReserveUsd");
16277
+ if (spec.synthesisReserveUsd !== void 0) {
16278
+ requireNonNegativeNumber(spec.synthesisReserveUsd, "orchestrate budget.synthesisReserveUsd");
16279
+ if (opts.synthesis === void 0) throw new ConfigError("orchestrate budget.synthesisReserveUsd requires the synthesis option: the reserve holds sub account money for the separate synthesis invocation");
16280
+ if (opts.synthesis.mode === "incremental") throw new ConfigError("orchestrate budget.synthesisReserveUsd is incompatible with synthesis.mode 'incremental': the reserve protects the single post-fan-in invocation");
16281
+ }
16162
16282
  if (spec.finalizeTurns !== void 0) requirePositiveInteger(spec.finalizeTurns, "orchestrate budget.finalizeTurns");
16163
16283
  if (spec.atCap !== void 0 && spec.atCap !== "finish-with-partial" && spec.atCap !== "fail-run") throw new ConfigError(`orchestrate budget.atCap must be 'finish-with-partial' or 'fail-run'; got ${String(spec.atCap)}`);
16164
16284
  }
@@ -16308,12 +16428,14 @@ function makeOrchestratorWorkflow(goal, opts) {
16308
16428
  liveValue: internals.pricingVersion ?? "unpriced"
16309
16429
  }] : []);
16310
16430
  orchestratorAccount = callingState.scope === "" ? "orchestrator" : `${callingState.scope}/orchestrator`;
16431
+ if (spec?.synthesisReserveUsd !== void 0 && frozen.capUsd <= spec.synthesisReserveUsd) throw new OrchestratorCapConfigError(`effectiveCap ${frozen.capUsd.toFixed(4)} USD is not above the synthesis reserve ${spec.synthesisReserveUsd.toFixed(4)} USD`);
16311
16432
  internals.budget.openAccount(orchestratorAccount, {
16312
16433
  parentScope: callingState.budgetScope ?? "run",
16313
16434
  ceilingUsd: frozen.capUsd,
16314
16435
  kind: "orchestrator-cap"
16315
16436
  });
16316
16437
  if (extension !== void 0) internals.budget.commitFinalizeReserve(orchestratorAccount, frozen.finalizeReserveUsd);
16438
+ if (spec?.synthesisReserveUsd !== void 0 && spec.synthesisReserveUsd > 0) internals.budget.commitSynthesisReserve(orchestratorAccount, spec.synthesisReserveUsd);
16317
16439
  capState = {
16318
16440
  effectiveCapUsd: frozen.capUsd,
16319
16441
  finalizeReserveUsd: frozen.finalizeReserveUsd,
@@ -16335,6 +16457,7 @@ function makeOrchestratorWorkflow(goal, opts) {
16335
16457
  level: "warn",
16336
16458
  msg: `orchestrator budget.capUsd ${spec.capUsd.toFixed(4)} USD is bounded to ${effectiveCapUsd.toFixed(4)} USD by the default capFraction 0.2 of the run ceiling (effectiveCap = min(capUsd, capFraction * ceiling)); pass capFraction: 1.0 to make capUsd the sole bound`
16337
16459
  }, callingState.spanId);
16460
+ if (spec?.synthesisReserveUsd !== void 0 && effectiveCapUsd <= spec.synthesisReserveUsd) throw new OrchestratorCapConfigError(`effectiveCap ${effectiveCapUsd.toFixed(4)} USD is not above the synthesis reserve ${spec.synthesisReserveUsd.toFixed(4)} USD: the coordination loop would have no money at all`);
16338
16461
  orchestratorAccount = callingState.scope === "" ? "orchestrator" : `${callingState.scope}/orchestrator`;
16339
16462
  internals.budget.openAccount(orchestratorAccount, {
16340
16463
  parentScope: callingState.budgetScope ?? "run",
@@ -16342,6 +16465,7 @@ function makeOrchestratorWorkflow(goal, opts) {
16342
16465
  kind: "orchestrator-cap"
16343
16466
  });
16344
16467
  if (extension !== void 0) internals.budget.commitFinalizeReserve(orchestratorAccount, finalizeReserveUsd);
16468
+ if (spec?.synthesisReserveUsd !== void 0 && spec.synthesisReserveUsd > 0) internals.budget.commitSynthesisReserve(orchestratorAccount, spec.synthesisReserveUsd);
16345
16469
  capState = {
16346
16470
  effectiveCapUsd,
16347
16471
  finalizeReserveUsd,
@@ -16365,6 +16489,15 @@ function makeOrchestratorWorkflow(goal, opts) {
16365
16489
  */
16366
16490
  const recoveredSpecByOrdinal = /* @__PURE__ */ new Map();
16367
16491
  let nextOrdinal = 0;
16492
+ /**
16493
+ * The maxSpawns ledger counts ADMITTED children, never attempt
16494
+ * ordinals: an admission-rejected spawn spends nothing, so it must
16495
+ * not consume a slot (the sixth comparison experiment's run 2, where
16496
+ * a transient budget rejection burned the fourth slot and the
16497
+ * orchestrator's viable retry was refused). Ordinals keep advancing
16498
+ * per attempt regardless: they are journal identity, not quota.
16499
+ */
16500
+ let admittedSpawnCount = 0;
16368
16501
  let orchSeq;
16369
16502
  const deliveredNodeIds = /* @__PURE__ */ new Set();
16370
16503
  const settleListeners = /* @__PURE__ */ new Set();
@@ -16520,6 +16653,7 @@ function makeOrchestratorWorkflow(goal, opts) {
16520
16653
  dispatch: async (spec, childScope, identity) => {
16521
16654
  const spawnOrdinal = nextOrdinal;
16522
16655
  nextOrdinal += 1;
16656
+ admittedSpawnCount += 1;
16523
16657
  return { handle: (await dispatchChild(spec, spawnOrdinal, identity, {
16524
16658
  childScope,
16525
16659
  ownAccount: true,
@@ -16602,6 +16736,7 @@ function makeOrchestratorWorkflow(goal, opts) {
16602
16736
  });
16603
16737
  continue;
16604
16738
  }
16739
+ admittedSpawnCount += 1;
16605
16740
  emitSpawnAdmitted(internals.events, {
16606
16741
  entryRef: entrySeq,
16607
16742
  verdict: decision.verdict.kind,
@@ -16772,7 +16907,7 @@ function makeOrchestratorWorkflow(goal, opts) {
16772
16907
  });
16773
16908
  throw new AdmissionRejectedError(`admission rejected spawn ordinal ${String(spawnOrdinal)} (recovered verdict)`, { data: { decision: recoveredRejection.decision } });
16774
16909
  }
16775
- if (opts?.maxSpawns !== void 0 && spawnOrdinal >= opts.maxSpawns) {
16910
+ if (opts?.maxSpawns !== void 0 && admittedSpawnCount >= opts.maxSpawns) {
16776
16911
  internals.events.emit({
16777
16912
  type: "spawn:rejected",
16778
16913
  code: "lifetime",
@@ -16814,6 +16949,7 @@ function makeOrchestratorWorkflow(goal, opts) {
16814
16949
  spec: params,
16815
16950
  decision
16816
16951
  };
16952
+ if (decision.verdict.kind !== "reject") admittedSpawnCount += 1;
16817
16953
  const decisionEntry = await internals.replayer.appendSinglePhase({
16818
16954
  scope: callingState.scope,
16819
16955
  key: "",
@@ -17097,6 +17233,12 @@ function makeOrchestratorWorkflow(goal, opts) {
17097
17233
  * enrichment can fold BOTH windows into one honest counter.
17098
17234
  */
17099
17235
  let synthesisSchemaRejectedExchanges = 0;
17236
+ /**
17237
+ * The recovered twin (cycle 77): near-JSON finish exchanges the
17238
+ * unparsed second chance salvaged, folded from the same two windows
17239
+ * onto the ok envelope and the failure enrichment.
17240
+ */
17241
+ let synthesisSchemaRecoveredExchanges = 0;
17100
17242
  const finishValidationError = (decision) => new FailRunError(`the orchestrator finish failed host validation with all ${String(decision.maxRepairs)} repair attempts spent: ` + decision.failed.map((f) => `validator '${f.name}' rejected: ${f.reasons.join("; ")}`).join("; "), { data: {
17101
17243
  source: "orchestrator_finish_validation",
17102
17244
  callId: decision.callId,
@@ -17268,7 +17410,7 @@ function makeOrchestratorWorkflow(goal, opts) {
17268
17410
  role: "orchestrate",
17269
17411
  result: "full",
17270
17412
  tools,
17271
- ...capState === void 0 ? {} : { estCost: orchestratorAdmissionEstCostUsd(capState.effectiveCapUsd, orchestratorAccount === void 0 ? 0 : internals.budget.accountView(orchestratorAccount)?.finalizeReserveUsd ?? 0) },
17413
+ ...capState === void 0 ? {} : { estCost: orchestratorAdmissionEstCostUsd(capState.effectiveCapUsd, orchestratorAccount === void 0 ? 0 : (internals.budget.accountView(orchestratorAccount)?.finalizeReserveUsd ?? 0) + (internals.budget.accountView(orchestratorAccount)?.synthesisReserveUsd ?? 0)) },
17272
17414
  ...opts?.model === void 0 ? {} : { model: opts.model },
17273
17415
  ...opts?.limits === void 0 ? {} : { limits: opts.limits },
17274
17416
  [kOnRunning]: (seq) => {
@@ -17584,7 +17726,10 @@ function makeOrchestratorWorkflow(goal, opts) {
17584
17726
  }
17585
17727
  }, callingState.spanId);
17586
17728
  const synthesisState = { ...callingState };
17587
- if (orchestratorAccount !== void 0) synthesisState.budgetScope = orchestratorAccount;
17729
+ if (orchestratorAccount !== void 0) {
17730
+ synthesisState.budgetScope = orchestratorAccount;
17731
+ internals.budget.releaseSynthesisReserve(orchestratorAccount);
17732
+ }
17588
17733
  const synthesisBreak = validationSpec === void 0 ? void 0 : validationAbort.signal;
17589
17734
  if (synthesisBreak !== void 0) synthesisState.signal = callingState.signal === void 0 ? synthesisBreak : AbortSignal.any([callingState.signal, synthesisBreak]);
17590
17735
  const synthesisOpts = {
@@ -17605,6 +17750,7 @@ function makeOrchestratorWorkflow(goal, opts) {
17605
17750
  };
17606
17751
  const synthesized = await runtime.runInScope(synthesisState, () => ctx.agent(prompt, synthesisOpts));
17607
17752
  synthesisSchemaRejectedExchanges = synthesized.schemaRejectedTerminalExchanges ?? 0;
17753
+ synthesisSchemaRecoveredExchanges = synthesized.schemaRecoveredTerminalExchanges ?? 0;
17608
17754
  if (validationTermination !== void 0) throw validationTermination;
17609
17755
  if (synthesized.status === "ok") return synthesized.output;
17610
17756
  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: {
@@ -17703,6 +17849,7 @@ function makeOrchestratorWorkflow(goal, opts) {
17703
17849
  const spent = validationDecisions().filter((candidate) => candidate.verdict !== "accepted" && contractGenerationCurrent(candidate));
17704
17850
  const rejectedValidators = [...new Set(spent.flatMap((candidate) => candidate.failed.map((f) => f.name)))];
17705
17851
  const schemaRejected = (result.schemaRejectedTerminalExchanges ?? 0) + synthesisSchemaRejectedExchanges;
17852
+ const schemaRecovered = (result.schemaRecoveredTerminalExchanges ?? 0) + synthesisSchemaRecoveredExchanges;
17706
17853
  throw new FailRunError(thrown.message, { data: {
17707
17854
  ...base,
17708
17855
  ...snapshot ?? {},
@@ -17711,7 +17858,8 @@ function makeOrchestratorWorkflow(goal, opts) {
17711
17858
  maxRepairs: validationSpec?.maxRepairs ?? 1,
17712
17859
  rejectedValidators
17713
17860
  },
17714
- ...schemaRejected === 0 || base.schemaRejectedFinishExchanges !== void 0 ? {} : { schemaRejectedFinishExchanges: schemaRejected }
17861
+ ...schemaRejected === 0 || base.schemaRejectedFinishExchanges !== void 0 ? {} : { schemaRejectedFinishExchanges: schemaRejected },
17862
+ ...schemaRecovered === 0 || base.schemaRecoveredFinishExchanges !== void 0 ? {} : { schemaRecoveredFinishExchanges: schemaRecovered }
17715
17863
  } });
17716
17864
  };
17717
17865
  if (validationTermination !== void 0) enrichSynthesisFailure(validationTermination);
@@ -17806,13 +17954,15 @@ function makeOrchestratorWorkflow(goal, opts) {
17806
17954
  ...decision.salvagedTerminalOutputChildren === void 0 ? {} : { salvagedTerminalOutputChildren: decision.salvagedTerminalOutputChildren }
17807
17955
  });
17808
17956
  }
17957
+ const envelopeSchemaRecovered = (result.schemaRecoveredTerminalExchanges ?? 0) + synthesisSchemaRecoveredExchanges;
17809
17958
  return {
17810
17959
  result: synthesizedFinal,
17811
17960
  completion: decision.completion,
17812
17961
  childStatusCounts: decision.childStatusCounts,
17813
17962
  degradedReasons: decision.degradedReasons,
17814
17963
  ...decision.salvagedPartialChildren === void 0 ? {} : { salvagedPartialChildren: decision.salvagedPartialChildren },
17815
- ...decision.salvagedTerminalOutputChildren === void 0 ? {} : { salvagedTerminalOutputChildren: decision.salvagedTerminalOutputChildren }
17964
+ ...decision.salvagedTerminalOutputChildren === void 0 ? {} : { salvagedTerminalOutputChildren: decision.salvagedTerminalOutputChildren },
17965
+ ...envelopeSchemaRecovered === 0 ? {} : { schemaRecoveredFinishExchanges: envelopeSchemaRecovered }
17816
17966
  };
17817
17967
  });
17818
17968
  }
@@ -18237,7 +18387,7 @@ function preflightEstimate(input) {
18237
18387
  turns: projectedProviderTurnsOf(orchLimits, overallExecutedCeiling(orchLimits, toolCeilingsOf(orchLimits))) + coordinationRepairReserve,
18238
18388
  count: 1
18239
18389
  });
18240
- if (effectiveCapUsd !== void 0) orchestratorReserveUsd = Math.max(0, orchestratorAdmissionEstCostUsd(effectiveCapUsd, reservedForFinalizationUsd));
18390
+ if (effectiveCapUsd !== void 0) orchestratorReserveUsd = Math.max(0, orchestratorAdmissionEstCostUsd(effectiveCapUsd, reservedForFinalizationUsd + (input.orchestrator.budget?.synthesisReserveUsd ?? 0)));
18241
18391
  else if (pricing === void 0) orchestratorReserveUsd = 0;
18242
18392
  else orchestratorReserveUsd = admissionReserveUsd({
18243
18393
  ...input.orchestrator.estInputTokens === void 0 ? {} : { inputTokens: input.orchestrator.estInputTokens },
@@ -18293,6 +18443,21 @@ function preflightEstimate(input) {
18293
18443
  spawn: "synthesis"
18294
18444
  });
18295
18445
  contractFeasibilityFindings(outputBound, "synthesis", servedBy);
18446
+ {
18447
+ const contract = input.finishValidation?.contract;
18448
+ const pricing = pricingOf(servedBy);
18449
+ if (contract !== void 0 && pricing !== void 0 && pricing.outputUsdPerMTok > 0) {
18450
+ const minTokens = Math.ceil(JSON.stringify({ result: contract.goldenAccept.text }).length / 4);
18451
+ const payloadUsd = minTokens / 1e6 * pricing.outputUsdPerMTok;
18452
+ const declared = input.orchestrator?.budget?.synthesisReserveUsd;
18453
+ if (declared === void 0 || declared < payloadUsd) say({
18454
+ severity: "warning",
18455
+ code: "synthesis-reserve-unfunded",
18456
+ message: `the contract's minimal accepting payload is about ${String(minTokens)} output tokens, about ${payloadUsd.toFixed(4)} USD at the output rate of '${servedBy}', and the orchestrator sub account holds ${declared === void 0 ? "no synthesis reserve" : `only ${declared.toFixed(4)} USD`} for it: a pricey coordination prefix can leave the synthesis turns a remainder the budget clamp shrinks below the payload, cutting the finish before any tool call; declare budget.synthesisReserveUsd at or above the payload price`,
18457
+ spawn: "synthesis"
18458
+ });
18459
+ }
18460
+ }
18296
18461
  const projected = projectedProviderTurnsOf(merged, overallExecutedCeiling(merged, toolCeilingsOf(merged))) + finishRepairReserve;
18297
18462
  if (orchestratorEcho !== void 0) orchestratorEcho.synthesis = {
18298
18463
  projectedProviderTurns: projected,
@@ -18315,10 +18480,12 @@ function preflightEstimate(input) {
18315
18480
  let committed = 0;
18316
18481
  let spawned = 0;
18317
18482
  let children = 0;
18318
- const admitAgainstRoot = (reserveUsd) => {
18483
+ const admitAgainstRoot = (reserveUsd, strictAtFill = false) => {
18319
18484
  if (ceilingUsd === void 0) return true;
18320
18485
  const held = committed + reservedForFinalizationUsd;
18321
- return !(held >= ceilingUsd || held + reserveUsd > ceilingUsd);
18486
+ if (held >= ceilingUsd) return false;
18487
+ const fill = held + reserveUsd;
18488
+ return strictAtFill ? fill < ceilingUsd : fill <= ceilingUsd;
18322
18489
  };
18323
18490
  if (input.orchestrator !== void 0) {
18324
18491
  const reserveUsd = orchestratorReserveUsd ?? flatReserveUsd;
@@ -18350,9 +18517,9 @@ function preflightEstimate(input) {
18350
18517
  if (orchestrateWave && ceilingUsd !== void 0) {
18351
18518
  const remainder = ceilingUsd - committed - reservedForFinalizationUsd;
18352
18519
  const projection = dispatchProjectionReserveUsd(gate, flatReserveUsd);
18353
- if (remainder <= 0 || remainder < projection) deniedBy = "budget";
18520
+ if (remainder <= 0 || remainder <= projection) deniedBy = "budget";
18354
18521
  }
18355
- if (deniedBy === void 0 && !admitAgainstRoot(reserveUsd)) deniedBy = "budget";
18522
+ if (deniedBy === void 0 && !admitAgainstRoot(reserveUsd, orchestrateWave)) deniedBy = "budget";
18356
18523
  }
18357
18524
  wave.push({
18358
18525
  label,
@@ -20401,4 +20568,4 @@ function createSandboxBridge(ctx, options) {
20401
20568
  };
20402
20569
  }
20403
20570
  //#endregion
20404
- 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, 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 };
20571
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/core",
3
- "version": "1.79.0",
3
+ "version": "1.81.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",