@rulvar/core 1.18.0 → 1.20.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
@@ -602,10 +602,20 @@ type AbandonPayload = {
602
602
  retainCheckpoint?: boolean; /** Default false; counts against the pin cap (DEF-5). */
603
603
  retainWorktree?: boolean;
604
604
  };
605
- /** One serving model's slice of a multi-model agent call's usage. */
605
+ /**
606
+ * One (invocation role, serving model) slice of an agent call's usage.
607
+ * `role` is the phase that PAID the slice (v1.19.0 review P1-2: the
608
+ * loop, extract, finalize, and summarize phases of one agent call must
609
+ * land in their own CostReport.byRole buckets even when a single model
610
+ * serves several of them). Absent on slices written before roles
611
+ * shipped: readers fall back to the entry's primary
612
+ * `costAttribution.role`, exactly like the other documented fallbacks.
613
+ * Policy, never identity.
614
+ */
606
615
  interface UsageSlice {
607
616
  servedBy: ModelRef;
608
617
  usage: Usage;
618
+ role?: InvocationRole;
609
619
  }
610
620
  /**
611
621
  * Cost-attribution facts a live run knows at settlement and a pure
@@ -2760,11 +2770,13 @@ interface AgentResult<T> {
2760
2770
  */
2761
2771
  servedBy: ModelRef;
2762
2772
  /**
2763
- * Present only when the call spanned MORE THAN ONE serving model (the
2764
- * loop, extract, finalize, and summarize roles resolve independently):
2765
- * usage split per model, so `costUsd` and every cost bucket price each
2766
- * slice at its own rate. Absent for a single-model call, which
2767
- * (usage, servedBy) already describes exactly.
2773
+ * Present only when the call spanned MORE THAN ONE (invocation role,
2774
+ * serving model) pair (the loop, extract, finalize, and summarize
2775
+ * roles resolve independently): usage split per (role, model), so
2776
+ * `costUsd` and every cost bucket price each slice at its own rate
2777
+ * and `CostReport.byRole` attributes each phase to its own bucket
2778
+ * (v1.19.0 review P1-2). Absent for a single-phase single-model call,
2779
+ * which (usage, servedBy) already describes exactly.
2768
2780
  */
2769
2781
  usageByModel?: UsageSlice[];
2770
2782
  transcriptRef: string;
@@ -2921,8 +2933,11 @@ interface RunAgentOptions<S extends SchemaSpec = JsonSchema> {
2921
2933
  * Finalize synthesis invocation (M4-T01), present only when the role
2922
2934
  * trigger protocol fires it: configured in routing AND the toolset is
2923
2935
  * non-empty. Runs after tools stop with toolChoice 'none' over the
2924
- * full transcript; its text becomes the output for schema-less calls,
2925
- * and a schema-bearing call always pairs it with a separate extract
2936
+ * full transcript plus a deterministic synthesis instruction appended
2937
+ * to the REQUEST only (the durable transcript keeps the raw history);
2938
+ * its text becomes the output for schema-less calls, a non-truncated
2939
+ * empty synthesis falls back to the loop turn's text, and a
2940
+ * schema-bearing call always pairs it with a separate extract
2926
2941
  * (the ctx layer guarantees `extract` is present in that case). Like
2927
2942
  * extract, the finalize invocation is not checkpointed in v1.
2928
2943
  */
@@ -2995,6 +3010,24 @@ interface RunAgentOptions<S extends SchemaSpec = JsonSchema> {
2995
3010
  now?: () => number;
2996
3011
  }
2997
3012
  /**
3013
+ * The output-truncation abort message (v1.9.0 follow-up review). The
3014
+ * constraint is named neutrally as the turn's output token allowance:
3015
+ * the effective request cap can come from limits.maxOutputTokensPerTurn,
3016
+ * the budget clamp above, or the adapter's own default, and the provider
3017
+ * can also cut at its model maximum with no request cap at all.
3018
+ */
3019
+ /**
3020
+ * The deterministic synthesis instruction appended (as a user message)
3021
+ * to the finalize REQUEST only, never to the durable transcript. A
3022
+ * transcript that simply ends at an assistant message reads to a real
3023
+ * model as a fresh conversation opening, so an uninstructed synthesis
3024
+ * call can replace the loop's correct answer with a greeting (v1.18.0
3025
+ * review P1-1); the extract arm has carried its own instruction since
3026
+ * M4, and this is its finalize twin. The wording is part of the wire
3027
+ * request: keep it stable.
3028
+ */
3029
+ declare const FINALIZE_SYNTHESIS_INSTRUCTION: string;
3030
+ /**
2998
3031
  * Runs one agent to a typed AgentResult. Never throws past policy: every
2999
3032
  * failure mode becomes a typed status on the result.
3000
3033
  */
@@ -5057,8 +5090,18 @@ declare const ORCHESTRATE_WORKFLOW_NAME = "rulvar-orchestrate";
5057
5090
  * orchestrator agent with the finish terminal tool.
5058
5091
  */
5059
5092
  declare function makeOrchestratorWorkflow(goal: string, opts?: OrchestrateOptions): Workflow<undefined, unknown>;
5060
- /** Top-level surface: creates a run. */
5061
- declare function orchestrate(engine: Engine, goal: string, opts?: OrchestrateOptions): RunHandle<unknown>;
5093
+ /**
5094
+ * Top-level surface: creates a run. `runOptions` are the ordinary
5095
+ * engine {@link RunOptions} of the created run; in particular
5096
+ * `runOptions.budgetUsd` is the ROOT hard ceiling over the WHOLE tree
5097
+ * (the orchestrator and every child), immutable after start, while
5098
+ * `opts.budget` only shapes the orchestrator's own sub-account inside
5099
+ * that ceiling. The shortcut previously accepted no RunOptions at all,
5100
+ * so the canonical entry point could not set a root ceiling without
5101
+ * dropping to `engine.run(makeOrchestratorWorkflow(...))` (v1.18.0
5102
+ * review P1-5).
5103
+ */
5104
+ declare function orchestrate(engine: Engine, goal: string, opts?: OrchestrateOptions, runOptions?: RunOptions): RunHandle<unknown>;
5062
5105
  //#endregion
5063
5106
  //#region src/engine/scheduler.d.ts
5064
5107
  /**
@@ -6395,4 +6438,4 @@ interface SandboxBridge {
6395
6438
  }
6396
6439
  declare function createSandboxBridge(ctx: Ctx<never>, options: SandboxBridgeOptions): SandboxBridge;
6397
6440
  //#endregion
6398
- export { AWAIT_SCHEMA, AbandonAttempt, AbandonFold, AbandonPayload, AbandonedSpendView, AbortClass, type AdaptiveEvents, AdmissionController, AdmissionDecision, AdmissionRejectedError, AdmissionStatsBefore, AdmitLineage, AdmitRejectReason, AdmitSpec, AdmitVerdict, AgentCallError, AgentError, type AgentEvents, AgentIdentityInput, AgentOpts, AgentProfile, AgentProfilePermissions, AgentResult, AgentResultMeta, AgentStatus, ApproachSignatureInputs, ApprovalDecision, ApprovalIdentityInput, Artifact, AttemptOutcomeClass, BUDGET_ABORT_REASON, BriefOpts, BudgetAccountView, BudgetDefaults, BudgetExhaustedError, 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, ChildIdentityInput, type ClaimClass, type ClaimOp, type ClaimStatus, ClaimValidationOptions, CollectOpts, CollectedTurn, CompactionConfig, CompiledPermissionChain, CompiledWorkflow, ConfigError, type CoreEvents, CostAttribution, CostAttributionFacts, CostReport, CreateEngineOptions, Ctx, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DebitResult, DeclaredLadder, DedupIndex, DedupNote, DerivedKey, DeriverRegistry, DispositionRule, DispositionTable, DonorCandidate, DonorRef, DroppedItem, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EffectiveUsageLimits, Effort, Engine, EngineDefaults, EntryKind, EntryRef, EntryStatus, ErrorClass, ErrorCode, ErrorPolicy, EscalatedResult, EscalationDecision, EscalationDigest, EscalationKind, EscalationLimits, EscalationOptions, EscalationReport, EscalationRequest, EventBus, type EvidenceRef, ExtensionAppendInput, ExtensionDispatchSpec, ExternalIdentityInput, ExternalRegistry, ExtractNecessityInput, FINISH_SCHEMA, FINISH_TOOL_NAME, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, FileModelKnowledgeStore, FileModelKnowledgeStoreOptions, FileTranscriptStore, FinishInfo, Gate, GateAudit, type GateRecord, GitWorktreeProvider, GitWorktreeProviderOptions, GraftBoot, HashVersion, HookVerdict, INBOX_PROPOSAL_TTL_DAYS, IdentityInput, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, InvocationRole, type IsolationProvider, type IsolationSpec, Issue$1 as Issue, JournalCompatSubCode, JournalCompatibilityError, JournalEntry, JournalMatcher, JournalMissError, JournalOperation, JournalOrderViolation, JournalSerializationHook, type JournalStore, type Json, JsonSchema, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, type KbProposal, type KbProposalTrigger, KeyDeriver, KeyRing, KeyedLimiter, KnowledgeCasError, type KnowledgeSnapshot, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LadderSpec, type LeasableStore, type Lease, LeaseHeldError, Ledger, LineageCounters, LineageIndex, LineageRef, LineageRelation, LineageStats, LogicalTaskId, MASKED_SECRET, MAX_DEPTH_CEILING, MatchResult, McpConfig, MechanicalGateProfile, MechanicalGateVerdict, type ModelCaps, ModelChoice, type ModelClaim, ModelEpochInputs, type ModelKnowledgeHandle, type ModelKnowledgeStore, ModelListConstraint, ModelRef, ModelRetry, ModelSpec, Msg, NoProgressDetector, NodeId, NodeLinkValue, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OnEscalation, OperationDisposition, OrchestrateOptions, OrchestratorBudgetSpec, OrchestratorCapConfigError, OrchestratorExtension, OrchestratorExtensionIO, OrchestratorRuntime, Out, PARALLEL_AGENTS_SCHEMA, ParallelSiteCounter, Part, PendingExternal, PendingToolTurn, PermissionConfig, PermissionGate, PermissionHook, PermissionPreset, PermissionRule, PermissionVerdict, PhaseTarget, PipelineCollected, PipelineOpts, PlanInvariantError, PriceTable, PricedUsage, type Pricing, type PricingTier, type ProviderAdapter, QualityFloors, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, RandIdentityInput, RandPayload, RefEntryAppender, RefEntryClassification, RefusalInfo, ReplayDisposition, ReplayMode, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionAttempt, ResolutionBy, ResolutionFold, ResolutionLayer, ResolutionOutcome, ResolutionPayload, ResolvedInvocation, ResolvedToolset, ResumeHandle, ResumeOptions, ResumePreview, ResumeReport, RetryClass, RetryPolicy, ReuseConfig, RiskRuleValue, Role, RulvarError, RulvarErrorCode, RunAgentOptions, RunBudget, RunEventSink, type RunFilter, RunHandle, RunInternals, type RunMeta, RunOptions, RunOutcome, RunProfile, RunStatus, RuntimeEventSink, SPAWN_AGENT_SCHEMA, SandboxBridge, SandboxBridgeOptions, SandboxError, SandboxHostToWorker, SandboxMethod, SandboxWorkerToHost, SchemaPair, SchemaSpec, SchemaValidationResult, ScopeSegment, ScriptRejected, ScriptRunner, ScrubNote, Semaphore, SerializationHook, Settled, ShellPatternRules, ShellSegment, ShellVerdict, SinglePhaseAppend, SpanMinter, SpanRegistry, SpawnAdmissionValue, SpawnAgentParams, SpawnKey, SpawnLineage, SpawnLineageOpt, SpawnOrigin, SpawnRecord, Spend, Stage, type StandardJSONSchemaV1, type StandardSchemaV1, StepIdentityInput, StructuredOutputTier, SuspendedAppend, SuspensionState, TOOL_NAME_PATTERN, type TaskClass, TaskDigest, TaskSpec, TerminalPatch, TerminationAccount, TerminationAccountSnapshot, TerminationDeniedValue, TerminationDeniedWriter, TerminationInitValue, TerminationLimits, TerminationResource, ToolCallRequest, ToolChoice, type ToolContext, ToolContextSeed, ToolContract, type ToolDef, type ToolEvents, type ToolExecutor, ToolInit, type ToolRisk, ToolRuntime, type ToolSource, type ToolSourceSession, ToolsOption, TranscriptSerializationHook, type TranscriptStore, TriggerClass, TtlState, Usage, UsageLimits, 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, atCompactionThreshold, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compilePermissionChain, compilePermissionPreset, compileVerifiedLayer, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, foldTermination, formatRePrompt, formatScopePath, hashWorkflowBody, hashWorkflowSource, identityJcs, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lexShellCommand, liftRetainedParts, lineageWeightOf, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, mergeUsageLimits, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, readTerminationInit, registryKeyRing, remeasureQueue, replayDisposition, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, scanJournalCompatibility, schemaHash, schemaHashOfSpec, selectStructuredOutputTier, shouldCompact, spawnDepthOf, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, validateEditorialCommit, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateSchemaSpec, validateTerminationLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
6441
+ export { AWAIT_SCHEMA, AbandonAttempt, AbandonFold, AbandonPayload, AbandonedSpendView, AbortClass, type AdaptiveEvents, AdmissionController, AdmissionDecision, AdmissionRejectedError, AdmissionStatsBefore, AdmitLineage, AdmitRejectReason, AdmitSpec, AdmitVerdict, AgentCallError, AgentError, type AgentEvents, AgentIdentityInput, AgentOpts, AgentProfile, AgentProfilePermissions, AgentResult, AgentResultMeta, AgentStatus, ApproachSignatureInputs, ApprovalDecision, ApprovalIdentityInput, Artifact, AttemptOutcomeClass, BUDGET_ABORT_REASON, BriefOpts, BudgetAccountView, BudgetDefaults, BudgetExhaustedError, 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, ChildIdentityInput, type ClaimClass, type ClaimOp, type ClaimStatus, ClaimValidationOptions, CollectOpts, CollectedTurn, CompactionConfig, CompiledPermissionChain, CompiledWorkflow, ConfigError, type CoreEvents, CostAttribution, CostAttributionFacts, CostReport, CreateEngineOptions, Ctx, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DebitResult, DeclaredLadder, DedupIndex, DedupNote, DerivedKey, DeriverRegistry, DispositionRule, DispositionTable, DonorCandidate, DonorRef, DroppedItem, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EffectiveUsageLimits, Effort, Engine, EngineDefaults, EntryKind, EntryRef, EntryStatus, ErrorClass, ErrorCode, ErrorPolicy, EscalatedResult, EscalationDecision, EscalationDigest, EscalationKind, EscalationLimits, EscalationOptions, EscalationReport, EscalationRequest, EventBus, type EvidenceRef, ExtensionAppendInput, ExtensionDispatchSpec, ExternalIdentityInput, ExternalRegistry, ExtractNecessityInput, FINALIZE_SYNTHESIS_INSTRUCTION, FINISH_SCHEMA, FINISH_TOOL_NAME, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, FileModelKnowledgeStore, FileModelKnowledgeStoreOptions, FileTranscriptStore, FinishInfo, Gate, GateAudit, type GateRecord, GitWorktreeProvider, GitWorktreeProviderOptions, GraftBoot, HashVersion, HookVerdict, INBOX_PROPOSAL_TTL_DAYS, IdentityInput, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, InvocationRole, type IsolationProvider, type IsolationSpec, Issue$1 as Issue, JournalCompatSubCode, JournalCompatibilityError, JournalEntry, JournalMatcher, JournalMissError, JournalOperation, JournalOrderViolation, JournalSerializationHook, type JournalStore, type Json, JsonSchema, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, type KbProposal, type KbProposalTrigger, KeyDeriver, KeyRing, KeyedLimiter, KnowledgeCasError, type KnowledgeSnapshot, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LadderSpec, type LeasableStore, type Lease, LeaseHeldError, Ledger, LineageCounters, LineageIndex, LineageRef, LineageRelation, LineageStats, LogicalTaskId, MASKED_SECRET, MAX_DEPTH_CEILING, MatchResult, McpConfig, MechanicalGateProfile, MechanicalGateVerdict, type ModelCaps, ModelChoice, type ModelClaim, ModelEpochInputs, type ModelKnowledgeHandle, type ModelKnowledgeStore, ModelListConstraint, ModelRef, ModelRetry, ModelSpec, Msg, NoProgressDetector, NodeId, NodeLinkValue, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OnEscalation, OperationDisposition, OrchestrateOptions, OrchestratorBudgetSpec, OrchestratorCapConfigError, OrchestratorExtension, OrchestratorExtensionIO, OrchestratorRuntime, Out, PARALLEL_AGENTS_SCHEMA, ParallelSiteCounter, Part, PendingExternal, PendingToolTurn, PermissionConfig, PermissionGate, PermissionHook, PermissionPreset, PermissionRule, PermissionVerdict, PhaseTarget, PipelineCollected, PipelineOpts, PlanInvariantError, PriceTable, PricedUsage, type Pricing, type PricingTier, type ProviderAdapter, QualityFloors, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, RandIdentityInput, RandPayload, RefEntryAppender, RefEntryClassification, RefusalInfo, ReplayDisposition, ReplayMode, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionAttempt, ResolutionBy, ResolutionFold, ResolutionLayer, ResolutionOutcome, ResolutionPayload, ResolvedInvocation, ResolvedToolset, ResumeHandle, ResumeOptions, ResumePreview, ResumeReport, RetryClass, RetryPolicy, ReuseConfig, RiskRuleValue, Role, RulvarError, RulvarErrorCode, RunAgentOptions, RunBudget, RunEventSink, type RunFilter, RunHandle, RunInternals, type RunMeta, RunOptions, RunOutcome, RunProfile, RunStatus, RuntimeEventSink, SPAWN_AGENT_SCHEMA, SandboxBridge, SandboxBridgeOptions, SandboxError, SandboxHostToWorker, SandboxMethod, SandboxWorkerToHost, SchemaPair, SchemaSpec, SchemaValidationResult, ScopeSegment, ScriptRejected, ScriptRunner, ScrubNote, Semaphore, SerializationHook, Settled, ShellPatternRules, ShellSegment, ShellVerdict, SinglePhaseAppend, SpanMinter, SpanRegistry, SpawnAdmissionValue, SpawnAgentParams, SpawnKey, SpawnLineage, SpawnLineageOpt, SpawnOrigin, SpawnRecord, Spend, Stage, type StandardJSONSchemaV1, type StandardSchemaV1, StepIdentityInput, StructuredOutputTier, SuspendedAppend, SuspensionState, TOOL_NAME_PATTERN, type TaskClass, TaskDigest, TaskSpec, TerminalPatch, TerminationAccount, TerminationAccountSnapshot, TerminationDeniedValue, TerminationDeniedWriter, TerminationInitValue, TerminationLimits, TerminationResource, ToolCallRequest, ToolChoice, type ToolContext, ToolContextSeed, ToolContract, type ToolDef, type ToolEvents, type ToolExecutor, ToolInit, type ToolRisk, ToolRuntime, type ToolSource, type ToolSourceSession, ToolsOption, TranscriptSerializationHook, type TranscriptStore, TriggerClass, TtlState, Usage, UsageLimits, 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, atCompactionThreshold, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compilePermissionChain, compilePermissionPreset, compileVerifiedLayer, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, foldTermination, formatRePrompt, formatScopePath, hashWorkflowBody, hashWorkflowSource, identityJcs, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lexShellCommand, liftRetainedParts, lineageWeightOf, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, mergeUsageLimits, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, readTerminationInit, registryKeyRing, remeasureQueue, replayDisposition, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, scanJournalCompatibility, schemaHash, schemaHashOfSpec, selectStructuredOutputTier, shouldCompact, spawnDepthOf, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, validateEditorialCommit, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateSchemaSpec, validateTerminationLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
package/dist/index.js CHANGED
@@ -511,11 +511,16 @@ function assertValidTime(time) {
511
511
  * backwards; in both cases the previous timestamp is reused and the random
512
512
  * component is incremented.
513
513
  *
514
- * `now` and `random` are injectable for tests; defaults are `Date.now` and
515
- * `globalThis.crypto.getRandomValues`.
516
- */
514
+ * `now` and `random` are injectable for tests; defaults are the real
515
+ * wall clock and `globalThis.crypto.getRandomValues`. The clock default
516
+ * is BOUND AT MODULE LOAD, never read from the global at mint time: a
517
+ * live read inside a run's async context goes through the dev-mode
518
+ * bare-Date.now patch and false-warns on the factory's own frames when
519
+ * they live outside node_modules (v1.18.0 review P2-6).
520
+ */
521
+ const REAL_NOW = Date.now.bind(globalThis);
517
522
  function monotonicUlidFactory(options) {
518
- const now = options?.now ?? Date.now;
523
+ const now = options?.now ?? REAL_NOW;
519
524
  const random = options?.random ?? defaultRandom;
520
525
  let lastTime = -1;
521
526
  let lastRandom = null;
@@ -4694,6 +4699,22 @@ function toJournalValue(value, site) {
4694
4699
  return JSON.parse(JSON.stringify(value));
4695
4700
  }
4696
4701
  //#endregion
4702
+ //#region src/l0/real-clock.ts
4703
+ /**
4704
+ * The engine's own wall clock, captured at MODULE LOAD, which always
4705
+ * precedes the dev-mode bare-Date.now patch: the patch installs inside
4706
+ * InProcessRunner.execute, and nothing can execute before this module
4707
+ * graph has loaded. Engine internals that need real time use this
4708
+ * binding instead of reading the global later: a later read (a second
4709
+ * engine created after a run, a ULID minted mid-run) captures the
4710
+ * PATCHED wrapper, and inside a run's async context with frames outside
4711
+ * node_modules (workspace dists, monorepo consumers, this repo's own
4712
+ * tests) that produced false RULVAR_BARE_DATE_NOW warnings from the
4713
+ * engine's own code (v1.18.0 review P2-6). The dev-mode guard stays
4714
+ * exactly as sharp for workflow code, which keeps calling the global.
4715
+ */
4716
+ const realNow = Date.now.bind(globalThis);
4717
+ //#endregion
4697
4718
  //#region src/journal/kinds.ts
4698
4719
  const KNOWN_KINDS = /* @__PURE__ */ new Set([
4699
4720
  "agent",
@@ -5318,7 +5339,7 @@ var Replayer = class {
5318
5339
  this.runId = options.runId;
5319
5340
  this.store = options.store;
5320
5341
  if (options.lease !== void 0) this.lease = options.lease;
5321
- this.now = options.now ?? Date.now;
5342
+ this.now = options.now ?? realNow;
5322
5343
  if (options.priceUsd !== void 0) this.priceUsd = options.priceUsd;
5323
5344
  if (options.onWarn !== void 0) this.onWarn = options.onWarn;
5324
5345
  this.largeValueWarnBytes = options.largeValueWarnBytes ?? 262144;
@@ -6365,7 +6386,8 @@ function costReportFromJournal(entries, priceUsd) {
6365
6386
  byPhase[phase] = (byPhase[phase] ?? 0) + priced.usd;
6366
6387
  const agentType = facts?.agentType ?? "unknown";
6367
6388
  byAgentType[agentType] = (byAgentType[agentType] ?? 0) + priced.usd;
6368
- byRole[facts?.role ?? "loop"] += priced.usd;
6389
+ const primaryRole = facts?.role ?? "loop";
6390
+ for (const slice of priced.priced) byRole[slice.role ?? primaryRole] += slice.usd;
6369
6391
  if (facts?.budgetAccount !== void 0 && isOrchestratorAccount(facts.budgetAccount)) {
6370
6392
  orchestratorSpentUsd += priced.usd;
6371
6393
  if (facts.finalizeReserve === true) reserveUsedUsd += priced.usd;
@@ -7926,6 +7948,17 @@ function applyOutputBudget(req, target, budget) {
7926
7948
  * the budget clamp above, or the adapter's own default, and the provider
7927
7949
  * can also cut at its model maximum with no request cap at all.
7928
7950
  */
7951
+ /**
7952
+ * The deterministic synthesis instruction appended (as a user message)
7953
+ * to the finalize REQUEST only, never to the durable transcript. A
7954
+ * transcript that simply ends at an assistant message reads to a real
7955
+ * model as a fresh conversation opening, so an uninstructed synthesis
7956
+ * call can replace the loop's correct answer with a greeting (v1.18.0
7957
+ * review P1-1); the extract arm has carried its own instruction since
7958
+ * M4, and this is its finalize twin. The wording is part of the wire
7959
+ * request: keep it stable.
7960
+ */
7961
+ const FINALIZE_SYNTHESIS_INSTRUCTION = "Write the final answer to the original request, synthesized only from the conversation and tool results above. Do not start a new conversation and do not add greetings; respond with the final answer only.";
7929
7962
  function outputTruncatedMessage(invocation) {
7930
7963
  return `the ${invocation} ended at its output token allowance (finish reason 'max-tokens') before producing visible output; raise limits.maxOutputTokensPerTurn, reduce the reasoning effort, or free budget for the turn (https://docs.rulvar.com/guide/agents#output-truncation)`;
7931
7964
  }
@@ -8012,7 +8045,7 @@ async function executeToolCall(options) {
8012
8045
  * failure mode becomes a typed status on the result.
8013
8046
  */
8014
8047
  async function runAgent(options) {
8015
- const now = options.now ?? Date.now;
8048
+ const now = options.now ?? realNow;
8016
8049
  const startedAt = now();
8017
8050
  const limits = options.limits;
8018
8051
  const maxSchemaAttempts = (options.schemaRetryAttempts ?? 2) + 1;
@@ -8026,7 +8059,17 @@ async function runAgent(options) {
8026
8059
  }]
8027
8060
  }];
8028
8061
  let totalUsage = ZERO_USAGE$1;
8029
- const usageByModel = /* @__PURE__ */ new Map();
8062
+ const primaryRole = options.role ?? "loop";
8063
+ const usageByPhaseModel = /* @__PURE__ */ new Map();
8064
+ const addPhaseUsage = (role, ref, usage) => {
8065
+ const key = `${role}${ref}`;
8066
+ const prior = usageByPhaseModel.get(key);
8067
+ usageByPhaseModel.set(key, {
8068
+ role,
8069
+ servedBy: ref,
8070
+ usage: addUsage(prior?.usage ?? ZERO_USAGE$1, usage)
8071
+ });
8072
+ };
8030
8073
  let turns = 0;
8031
8074
  let schemaAttempts = 0;
8032
8075
  let output = null;
@@ -8061,13 +8104,14 @@ async function runAgent(options) {
8061
8104
  usage: restored.usage
8062
8105
  }];
8063
8106
  for (const slice of restoredSlices) {
8064
- usageByModel.set(slice.servedBy, addUsage(usageByModel.get(slice.servedBy) ?? ZERO_USAGE$1, slice.usage));
8107
+ addPhaseUsage(slice.role ?? primaryRole, slice.servedBy, slice.usage);
8065
8108
  options.budget?.onUsage(slice.usage, slice.servedBy);
8066
8109
  }
8067
8110
  }
8068
- const usageSlices = () => [...usageByModel].map(([sliceServedBy, usage]) => ({
8111
+ const usageSlices = () => [...usageByPhaseModel.values()].map(({ role, servedBy: sliceServedBy, usage }) => ({
8069
8112
  servedBy: sliceServedBy,
8070
- usage
8113
+ usage,
8114
+ role
8071
8115
  }));
8072
8116
  /**
8073
8117
  * Every slice priced at ITS OWN model's rate. An unpriced model
@@ -8078,7 +8122,7 @@ async function runAgent(options) {
8078
8122
  const price = options.priceUsd;
8079
8123
  if (price === void 0) return 0;
8080
8124
  let usd = 0;
8081
- for (const [sliceServedBy, usage] of usageByModel) usd += price(sliceServedBy, usage) ?? 0;
8125
+ for (const slice of usageByPhaseModel.values()) usd += price(slice.servedBy, slice.usage) ?? 0;
8082
8126
  return usd;
8083
8127
  };
8084
8128
  const saveBoundary = async (pending) => {
@@ -8311,17 +8355,17 @@ async function runAgent(options) {
8311
8355
  agentType,
8312
8356
  label: options.label,
8313
8357
  model: servedBy,
8314
- role: options.role ?? "loop"
8358
+ role: primaryRole
8315
8359
  });
8316
8360
  let invariantViolation;
8317
- const recordUsage = (usage, reported, adapterId, ref) => {
8361
+ const recordUsage = (usage, reported, adapterId, ref, role) => {
8318
8362
  try {
8319
8363
  assertUsageInvariant(usage, adapterId);
8320
8364
  } catch (thrown) {
8321
8365
  invariantViolation = thrown instanceof Error ? thrown.message : String(thrown);
8322
8366
  }
8323
8367
  totalUsage = addUsage(totalUsage, usage);
8324
- usageByModel.set(ref, addUsage(usageByModel.get(ref) ?? ZERO_USAGE$1, usage));
8368
+ addPhaseUsage(role, ref, usage);
8325
8369
  const remainder = {
8326
8370
  inputTokens: Math.max(0, usage.inputTokens - reported.inputTokens),
8327
8371
  outputTokens: Math.max(0, usage.outputTokens - reported.outputTokens),
@@ -8343,7 +8387,7 @@ async function runAgent(options) {
8343
8387
  inner: for (;;) {
8344
8388
  const dispatch = () => streamTurn(target.adapter, site.requestFor(target), site.streamOptionsFor(target));
8345
8389
  const outcome = await (options.providerSlot === void 0 ? dispatch() : options.providerSlot(target.adapter.id, dispatch));
8346
- recordUsage(outcome.usage, outcome.reported, target.adapter.id, target.resolved.ref);
8390
+ recordUsage(outcome.usage, outcome.reported, target.adapter.id, target.resolved.ref, site.role);
8347
8391
  tries += 1;
8348
8392
  const retryClass = outcome.aborted === "idle" ? "transport" : outcome.wireError === void 0 ? void 0 : retryClassOf(outcome.wireError);
8349
8393
  if (retryClass === void 0) return {
@@ -8420,6 +8464,7 @@ async function runAgent(options) {
8420
8464
  let loopDispatch;
8421
8465
  try {
8422
8466
  loopDispatch = await dispatchPhase({
8467
+ role: primaryRole,
8423
8468
  chain: loopChain,
8424
8469
  cursor: loopCursor,
8425
8470
  requestFor: (target) => {
@@ -8611,6 +8656,7 @@ async function runAgent(options) {
8611
8656
  let summaryDispatch;
8612
8657
  try {
8613
8658
  summaryDispatch = await dispatchPhase({
8659
+ role: "summarize",
8614
8660
  chain: [{
8615
8661
  adapter: options.summarize.adapter,
8616
8662
  resolved: options.summarize.resolved
@@ -8780,16 +8826,24 @@ async function runAgent(options) {
8780
8826
  }
8781
8827
  if (proceed) {
8782
8828
  turns += 1;
8829
+ const synthesisMessages = [...messages, {
8830
+ role: "user",
8831
+ parts: [{
8832
+ type: "text",
8833
+ text: FINALIZE_SYNTHESIS_INSTRUCTION
8834
+ }]
8835
+ }];
8783
8836
  let finalizeDispatch;
8784
8837
  try {
8785
8838
  finalizeDispatch = await dispatchPhase({
8839
+ role: "finalize",
8786
8840
  chain: [{
8787
8841
  adapter: options.finalize.adapter,
8788
8842
  resolved: options.finalize.resolved
8789
8843
  }, ...options.finalize.fallbacks ?? []],
8790
8844
  cursor: { index: 0 },
8791
8845
  requestFor: (target) => applyOutputBudget({
8792
- ...buildRequest(target.resolved, projectHistory(messages, providerOf(target.adapter)), limits, options.tools?.contracts),
8846
+ ...buildRequest(target.resolved, projectHistory(synthesisMessages, providerOf(target.adapter)), limits, options.tools?.contracts),
8793
8847
  toolChoice: "none"
8794
8848
  }, target, options.budget),
8795
8849
  streamOptionsFor: (target) => {
@@ -8860,7 +8914,10 @@ async function runAgent(options) {
8860
8914
  retryable: false
8861
8915
  };
8862
8916
  errorMessage = outputTruncatedMessage("finalize invocation");
8863
- } else if (options.schema === void 0) output = outcome.turn.text;
8917
+ } else if (options.schema === void 0) {
8918
+ const synthesis = outcome.turn.text;
8919
+ if (synthesis.trim() !== "") output = synthesis;
8920
+ }
8864
8921
  }
8865
8922
  }
8866
8923
  }
@@ -8902,6 +8959,7 @@ async function runAgent(options) {
8902
8959
  let extractDispatch;
8903
8960
  try {
8904
8961
  extractDispatch = await dispatchPhase({
8962
+ role: "extract",
8905
8963
  chain: extractChain,
8906
8964
  cursor: extractCursor,
8907
8965
  requestFor: (target) => {
@@ -9005,7 +9063,7 @@ async function runAgent(options) {
9005
9063
  servedBy,
9006
9064
  transcriptRef
9007
9065
  };
9008
- if (usageByModel.size > 1) result.usageByModel = usageSlices();
9066
+ if (usageByPhaseModel.size > 1) result.usageByModel = usageSlices();
9009
9067
  if (agentError !== void 0) result.error = agentError;
9010
9068
  if (escalationRequest !== void 0) result.escalationRequest = escalationRequest;
9011
9069
  if (abortClass !== void 0) result.abortClass = abortClass;
@@ -11020,10 +11078,11 @@ function createCtx(internals, rootWorkflow) {
11020
11078
  });
11021
11079
  }
11022
11080
  const usd = result.costUsd;
11023
- for (const slice of result.usageByModel ?? [{
11081
+ const attributionSlices = result.usageByModel ?? [{
11024
11082
  servedBy: result.servedBy,
11025
11083
  usage: result.usage
11026
- }]) {
11084
+ }];
11085
+ for (const slice of attributionSlices) {
11027
11086
  const priced = internals.priceUsd(slice.servedBy, slice.usage);
11028
11087
  if (priced === void 0) {
11029
11088
  internals.cost.unpriced.push({
@@ -11033,10 +11092,11 @@ function createCtx(internals, rootWorkflow) {
11033
11092
  continue;
11034
11093
  }
11035
11094
  bump(internals.cost.byModel, slice.servedBy, priced);
11095
+ const sliceRole = slice.role ?? primaryRole;
11096
+ internals.cost.byRole.set(sliceRole, (internals.cost.byRole.get(sliceRole) ?? 0) + priced);
11036
11097
  }
11037
11098
  bump(internals.cost.byPhase, state.phase ?? "", usd);
11038
11099
  bump(internals.cost.byAgentType, agentType, usd);
11039
- internals.cost.byRole.set(primaryRole, (internals.cost.byRole.get(primaryRole) ?? 0) + usd);
11040
11100
  if (result.error?.kind === "budget" || internals.budget.exhausted && result.status !== "ok") {
11041
11101
  const diagnostics = internals.budget.exhaustionDiagnostics(state.budgetScope ?? "run");
11042
11102
  const crossed = diagnostics.crossed;
@@ -12412,9 +12472,19 @@ function makeOrchestratorWorkflow(goal, opts) {
12412
12472
  return result.output;
12413
12473
  });
12414
12474
  }
12415
- /** Top-level surface: creates a run. */
12416
- function orchestrate(engine, goal, opts) {
12417
- return engine.run(makeOrchestratorWorkflow(goal, opts), void 0);
12475
+ /**
12476
+ * Top-level surface: creates a run. `runOptions` are the ordinary
12477
+ * engine {@link RunOptions} of the created run; in particular
12478
+ * `runOptions.budgetUsd` is the ROOT hard ceiling over the WHOLE tree
12479
+ * (the orchestrator and every child), immutable after start, while
12480
+ * `opts.budget` only shapes the orchestrator's own sub-account inside
12481
+ * that ceiling. The shortcut previously accepted no RunOptions at all,
12482
+ * so the canonical entry point could not set a root ceiling without
12483
+ * dropping to `engine.run(makeOrchestratorWorkflow(...))` (v1.18.0
12484
+ * review P1-5).
12485
+ */
12486
+ function orchestrate(engine, goal, opts, runOptions) {
12487
+ return engine.run(makeOrchestratorWorkflow(goal, opts), void 0, runOptions);
12418
12488
  }
12419
12489
  //#endregion
12420
12490
  //#region src/engine/events.ts
@@ -12459,7 +12529,7 @@ var EventBus = class {
12459
12529
  constructor(options) {
12460
12530
  this.runId = options.runId;
12461
12531
  this.spans = options.spans;
12462
- this.now = options.now ?? Date.now;
12532
+ this.now = options.now ?? realNow;
12463
12533
  this.maskEvents = options.maskEvents ?? true;
12464
12534
  }
12465
12535
  emit(body, spanId, replayed) {
@@ -12550,7 +12620,11 @@ let globalsPatched = false;
12550
12620
  * transport behind fetch, timers, stream internals), whose frames carry
12551
12621
  * `node:` specifiers and inherit the run's async context. The guard
12552
12622
  * exists for workflow code, which imports from both but lives in
12553
- * neither.
12623
+ * neither. Rulvar's own internals never reach this check at all: every
12624
+ * internal real-time read binds the module-load clock (l0/real-clock.ts
12625
+ * and the ULID factory default), never the live global, so frames from
12626
+ * workspace dists or this repo's sources cannot false-warn (v1.18.0
12627
+ * review P2-6).
12554
12628
  */
12555
12629
  function libraryCaller() {
12556
12630
  const caller = (/* @__PURE__ */ new Error()).stack?.split("\n")[3];
@@ -12659,7 +12733,6 @@ function createEngine(options) {
12659
12733
  const knowledge = knowledgeStore === void 0 ? void 0 : { current: () => knowledgeStore.current() };
12660
12734
  const runner = new InProcessRunner(options.onEscalation === void 0 ? void 0 : { onEscalation: options.onEscalation });
12661
12735
  const mintRunId = createCanonicalIdMinter();
12662
- const realNow = Date.now.bind(globalThis);
12663
12736
  const pricingOf = (servedBy) => {
12664
12737
  const { adapterId, model } = parseModelRef(servedBy);
12665
12738
  return resolvePricing(servedBy, options.pricing, adapters.get(adapterId)?.caps(model).pricing);
@@ -13344,4 +13417,4 @@ function createSandboxBridge(ctx, options) {
13344
13417
  };
13345
13418
  }
13346
13419
  //#endregion
13347
- 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_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DedupIndex, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EventBus, ExternalRegistry, FINISH_SCHEMA, FINISH_TOOL_NAME, FileModelKnowledgeStore, FileTranscriptStore, GitWorktreeProvider, INBOX_PROPOSAL_TTL_DAYS, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, 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_DEPTH_CEILING, ModelRetry, NoProgressDetector, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OrchestratorCapConfigError, PARALLEL_AGENTS_SCHEMA, ParallelSiteCounter, PlanInvariantError, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionFold, RulvarError, RunBudget, SPAWN_AGENT_SCHEMA, SandboxError, ScriptRejected, Semaphore, 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, atCompactionThreshold, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compilePermissionChain, compilePermissionPreset, compileVerifiedLayer, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, foldTermination, formatRePrompt, formatScopePath, hashWorkflowBody, hashWorkflowSource, identityJcs, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lexShellCommand, liftRetainedParts, lineageWeightOf, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, mergeUsageLimits, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, readTerminationInit, registryKeyRing, remeasureQueue, replayDisposition, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, scanJournalCompatibility, schemaHash, schemaHashOfSpec, selectStructuredOutputTier, shouldCompact, spawnDepthOf, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, validateEditorialCommit, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateSchemaSpec, validateTerminationLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
13420
+ 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_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DedupIndex, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EventBus, ExternalRegistry, FINALIZE_SYNTHESIS_INSTRUCTION, FINISH_SCHEMA, FINISH_TOOL_NAME, FileModelKnowledgeStore, FileTranscriptStore, GitWorktreeProvider, INBOX_PROPOSAL_TTL_DAYS, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, 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_DEPTH_CEILING, ModelRetry, NoProgressDetector, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OrchestratorCapConfigError, PARALLEL_AGENTS_SCHEMA, ParallelSiteCounter, PlanInvariantError, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionFold, RulvarError, RunBudget, SPAWN_AGENT_SCHEMA, SandboxError, ScriptRejected, Semaphore, 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, atCompactionThreshold, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compilePermissionChain, compilePermissionPreset, compileVerifiedLayer, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, foldTermination, formatRePrompt, formatScopePath, hashWorkflowBody, hashWorkflowSource, identityJcs, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lexShellCommand, liftRetainedParts, lineageWeightOf, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, mergeUsageLimits, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, readTerminationInit, registryKeyRing, remeasureQueue, replayDisposition, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, scanJournalCompatibility, schemaHash, schemaHashOfSpec, selectStructuredOutputTier, shouldCompact, spawnDepthOf, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, validateEditorialCommit, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateSchemaSpec, validateTerminationLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/core",
3
- "version": "1.18.0",
3
+ "version": "1.20.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",