@rulvar/core 1.49.0 → 1.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +124 -11
  2. package/dist/index.js +248 -93
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -28,7 +28,7 @@ type WireError = {
28
28
  * 'agent' is carried by the AgentError value projection, not by a
29
29
  * RulvarError subclass.
30
30
  */
31
- type ErrorCode = "agent" | "config" | "non_serializable_value" | "script_rejected" | "journal_compat" | "invalid_resolution" | "journal_order_violation" | "plan_invariant" | "replay_plan_hash_mismatch" | "orchestrator_cap_config" | "journal_miss" | "budget_exhausted" | "fail_run" | "admission_rejected" | "sandbox_limit" | "lease_held" | "knowledge_cas";
31
+ type ErrorCode = "agent" | "config" | "non_serializable_value" | "script_rejected" | "journal_compat" | "invalid_resolution" | "journal_order_violation" | "plan_invariant" | "replay_plan_hash_mismatch" | "orchestrator_cap_config" | "journal_miss" | "budget_exhausted" | "fail_run" | "admission_rejected" | "sandbox_limit" | "lease_held" | "knowledge_cas" | "determinism";
32
32
  /** An alias for the registry type; both names are public. */
33
33
  type RulvarErrorCode = ErrorCode;
34
34
  /**
@@ -264,6 +264,25 @@ declare class KnowledgeCasError extends RulvarError {
264
264
  });
265
265
  }
266
266
  /**
267
+ * A workflow-origin bare-nondeterminism violation under
268
+ * `determinism.mode: 'error'` (RV-209): bare `Date.now()` or
269
+ * `Math.random()` called from workflow code inside a run. Thrown at the
270
+ * offending call site (and re-thrown at settle if the workflow swallowed
271
+ * it), so the run rejects instead of recording a value replay cannot
272
+ * reproduce. `data` carries the structured localization: `category`,
273
+ * `frame`, and the parsed `file`/`line`/`column` when the frame names
274
+ * one. Never journaled as its own entry; the run settles 'error' with
275
+ * this wire error. Exempt provenances (installed dependencies, Node
276
+ * runtime frames, allowlisted patterns) never raise it.
277
+ */
278
+ declare class DeterminismError extends RulvarError {
279
+ readonly code = "determinism";
280
+ constructor(message: string, opts?: {
281
+ data?: Json;
282
+ cause?: unknown;
283
+ });
284
+ }
285
+ /**
267
286
  * The vendored Standard Schema issue shape: validation issues carried
268
287
  * on AgentError and surfaced to the
269
288
  * model during bounded schema re-prompts.
@@ -4531,6 +4550,34 @@ type ToolEvents = {
4531
4550
  advisory?: Json;
4532
4551
  };
4533
4552
  /**
4553
+ * Bare-nondeterminism detection (RV-209). Emitted LIVE by the segment
4554
+ * that observed the call, at most once per (category, provenance) per
4555
+ * execution segment; never journaled and never re-emitted with the
4556
+ * `replayed` flag. Because replay re-executes the workflow body, a
4557
+ * violation that survives in the code fires again on every replay of
4558
+ * the run, so the event appears organically in both live and replayed
4559
+ * streams. Exempt provenances (installed dependencies under
4560
+ * node_modules and Node runtime frames) never emit: they are
4561
+ * classified and silenced, which is what keeps an SDK's internal
4562
+ * `Math.random()` from branding the run nondeterministic.
4563
+ */
4564
+ type DeterminismEvents = {
4565
+ type: "determinism:warning"; /** Which patched global fired. */
4566
+ category: "bare-date-now" | "bare-math-random";
4567
+ /**
4568
+ * 'workflow': the caller is workflow-origin code (the violation the
4569
+ * guard exists for; rejects the run under `determinism.mode:
4570
+ * 'error'`). 'allowlisted': the caller matched a configured
4571
+ * `determinism.allowlist` pattern and is exempt by explicit host
4572
+ * decision; emitted for visibility, never rejects.
4573
+ */
4574
+ provenance: "workflow" | "allowlisted"; /** The calling stack frame, after the configured redaction hook. */
4575
+ frame: string; /** Parsed location when the frame carries one, after redaction. */
4576
+ file?: string;
4577
+ line?: number;
4578
+ column?: number;
4579
+ };
4580
+ /**
4534
4581
  * Adaptive orchestration, resolutions, and
4535
4582
  * accounting: emitted only by runs where the corresponding machinery is
4536
4583
  * active (applicability per mode:
@@ -4677,7 +4724,7 @@ type AdaptiveEvents = {
4677
4724
  found: number;
4678
4725
  window: [number, number];
4679
4726
  };
4680
- type WorkflowEventBody = CoreEvents | AgentEvents | ToolEvents | AdaptiveEvents;
4727
+ type WorkflowEventBody = CoreEvents | AgentEvents | ToolEvents | DeterminismEvents | AdaptiveEvents;
4681
4728
  /**
4682
4729
  * The envelope: seq is an independent per-run
4683
4730
  * telemetry counter, strictly increasing in emission order and DISTINCT
@@ -4810,13 +4857,15 @@ type OnEscalation = (result: EscalatedResult<unknown>) => EscalationDecision | P
4810
4857
  /**
4811
4858
  * The mode (a) runner for human-authored closures. Determinism is enforced
4812
4859
  * by convention, lint, and the ctx shims, NOT by a VM: only the sequence
4813
- * of keys must be stable. Dev mode (NODE_ENV !== 'production') detects
4814
- * bare Date.now and Math.random and emits one warning per run pointing at
4815
- * ctx.now()/ctx.random(). Detection is attributed by AsyncLocalStorage:
4816
- * only code inside the workflow body's async context can trigger it, so
4817
- * host code running concurrently, engine internals outside the body, and
4818
- * other runs never produce a false warning, and nothing is ever restored,
4819
- * so concurrent executes cannot race the patch state.
4860
+ * of keys must be stable. Bare-nondeterminism detection is ENGINE-owned
4861
+ * since RV-209: the engine wraps its `execute` call in
4862
+ * `withDeterminismDetection` (runner/determinism.ts), which classifies
4863
+ * bare Date.now/Math.random callers, emits the structured
4864
+ * `determinism:warning` event on the run's stream, and under
4865
+ * `determinism.mode: 'error'` rejects the run with a typed
4866
+ * DeterminismError. The runner itself is a pure executor, so the frozen
4867
+ * ScriptRunner seam carries no detection surface; a standalone execute
4868
+ * outside an engine runs without detection.
4820
4869
  */
4821
4870
  declare class InProcessRunner implements ScriptRunner {
4822
4871
  private readonly onEscalation?;
@@ -4828,6 +4877,39 @@ declare class InProcessRunner implements ScriptRunner {
4828
4877
  execute<A, R>(wf: Workflow<A, R> | CompiledWorkflow, ctx: Ctx<never>, args: A): Promise<R>;
4829
4878
  }
4830
4879
  //#endregion
4880
+ //#region src/runner/determinism.d.ts
4881
+ /**
4882
+ * Detection modes. 'off': never detect. 'warn' (the default, and the
4883
+ * pre-RV-209 behavior): detect outside production (NODE_ENV !==
4884
+ * 'production'), emit one `determinism:warning` event and one process
4885
+ * warning per category per segment, never reject. 'error': detect in
4886
+ * EVERY environment including production, and reject the run at the
4887
+ * first workflow-origin call with a typed DeterminismError (the strict
4888
+ * gate for replay-verified pipelines).
4889
+ */
4890
+ type DeterminismMode = "off" | "warn" | "error";
4891
+ /** Host configuration for the guard (CreateEngineOptions.determinism). */
4892
+ interface DeterminismConfig {
4893
+ mode?: DeterminismMode;
4894
+ /**
4895
+ * Caller frames matching any pattern are exempt by explicit host
4896
+ * decision: classified 'allowlisted' in the emitted event, never a
4897
+ * process warning, never a rejection. A string matches as a
4898
+ * substring of the frame; a RegExp matches by test. Patterns match
4899
+ * the RAW frame, before any redaction. Installed dependencies
4900
+ * (node_modules) and Node runtime frames (`node:` specifiers) are
4901
+ * exempt WITHOUT configuration and emit nothing at all.
4902
+ */
4903
+ allowlist?: ReadonlyArray<string | RegExp>;
4904
+ /**
4905
+ * Redaction hook for public telemetry: applied to the frame and the
4906
+ * parsed file path before they leave in events, process warnings, and
4907
+ * DeterminismError data, so absolute host paths need not reach an
4908
+ * OTel backend. Default: identity.
4909
+ */
4910
+ redact?: (frame: string) => string;
4911
+ }
4912
+ //#endregion
4831
4913
  //#region src/model/pricing.d.ts
4832
4914
  interface PriceTable {
4833
4915
  /** Monotonic version string; recorded in decision entries. */
@@ -4975,6 +5057,18 @@ interface CreateEngineOptions {
4975
5057
  redaction?: {
4976
5058
  maskEvents?: boolean;
4977
5059
  };
5060
+ /**
5061
+ * Bare-nondeterminism detection over in-process workflow bodies
5062
+ * (RV-209): mode 'off' | 'warn' (default; detects outside production)
5063
+ * | 'error' (detects everywhere and rejects the run at the first
5064
+ * workflow-origin bare Date.now/Math.random with a typed
5065
+ * DeterminismError), plus the frame `allowlist` for confirmed-safe
5066
+ * callers and the `redact` hook for public telemetry. Workflow-origin
5067
+ * violations emit the structured `determinism:warning` event with the
5068
+ * caller frame and parsed file/line; installed dependencies and Node
5069
+ * runtime frames are classified exempt and stay silent.
5070
+ */
5071
+ determinism?: DeterminismConfig;
4978
5072
  }
4979
5073
  interface RunOptions {
4980
5074
  /** Explicit id; otherwise the engine mints a ULID. */
@@ -5124,6 +5218,19 @@ declare function workflowSourceRef(runId: string): string;
5124
5218
  * `argsHash` field docs).
5125
5219
  */
5126
5220
  declare function hashRunArgs(args: unknown): string | undefined;
5221
+ /**
5222
+ * sha256 hex over the JCS canonical serialization of a run's result
5223
+ * value: the digest the engine records as `outputHash` on the journaled
5224
+ * run-settle decision when the settling segment computed a value, and
5225
+ * the value `rulvar replay --compare-output-hash` compares a replayed
5226
+ * result against (RV-209). Best-effort by design: returns undefined for
5227
+ * undefined values and for values JCS cannot serialize (functions,
5228
+ * cycles, non-finite numbers), so an unhashable result records no
5229
+ * baseline rather than failing the settle. Like `hashRunArgs`, the
5230
+ * digest is deterministic and unsalted: treat it as sensitive-derived
5231
+ * metadata for low-entropy results.
5232
+ */
5233
+ declare function hashRunOutput(value: unknown): string | undefined;
5127
5234
  declare function createEngine(options: CreateEngineOptions): Engine;
5128
5235
  //#endregion
5129
5236
  //#region src/orchestrator/finish-validators.d.ts
@@ -6904,10 +7011,16 @@ declare function assertFencedWrites(stores: {
6904
7011
  //#region src/stores/reconcile.d.ts
6905
7012
  /** The decisionType of the journaled run settle entry. */
6906
7013
  declare const RUN_SETTLE_DECISION_TYPE = "run_settle";
6907
- /** The last journaled run settle of a journal, if any. */
7014
+ /**
7015
+ * The last journaled run settle of a journal, if any. `outputHash` is
7016
+ * present when that settle recorded the result digest (RV-209; settles
7017
+ * written before it, or over undefined/non-serializable results, carry
7018
+ * none).
7019
+ */
6908
7020
  declare function lastRunSettle(entries: readonly JournalEntry[]): {
6909
7021
  runStatus: RunStatus;
6910
7022
  seq: number;
7023
+ outputHash?: string;
6911
7024
  } | undefined;
6912
7025
  type RunAuditVerdict = "consistent" | "meta-behind" | "stranded" | "suspect";
6913
7026
  interface RunStateAudit {
@@ -7483,4 +7596,4 @@ interface SandboxBridge {
7483
7596
  declare const SANDBOX_AGENT_OPT_KEYS: readonly string[];
7484
7597
  declare function createSandboxBridge(ctx: Ctx<never>, options: SandboxBridgeOptions): SandboxBridge;
7485
7598
  //#endregion
7486
- 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, AgentResult, AgentResultMeta, AgentStatus, ApproachSignatureInputs, ApprovalDecision, ApprovalIdentityInput, Artifact, AttemptOutcomeClass, 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, Ctx, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, 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, 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, EVENT_SEGMENT_STRIDE, EffectiveUsageLimits, Effort, Engine, EngineDefaults, EntryKind, EntryRef, EntryStatus, ErrorClass, ErrorCode, ErrorPolicy, EscalatedResult, EscalationDecision, EscalationDecisionAbortedError, EscalationDigest, EscalationKind, EscalationLimits, EscalationOptions, EscalationReport, EscalationRequest, EventBus, type EvidenceRef, ExtensionAppendInput, ExtensionDispatchSpec, ExternalIdentityInput, ExternalRegistry, ExtractNecessityInput, FINALIZE_SYNTHESIS_INSTRUCTION, FINISH_SCHEMA, FINISH_TOOL_NAME, FailRunError, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, FileModelKnowledgeStore, FileModelKnowledgeStoreOptions, FileTranscriptStore, FinishInfo, FinishValidationChild, FinishValidationInput, FinishValidationSpec, FinishValidationVerdict, FinishValidator, GET_CHILD_RESULT_SCHEMA, GET_CHILD_RESULT_TOOL_NAME, Gate, GateAudit, type GateRecord, GitWorktreeProvider, GitWorktreeProviderOptions, GraftBoot, HashVersion, HookVerdict, INBOX_PROPOSAL_TTL_DAYS, IdentityInput, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, InvocationRole, type InvocationTable, 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_CHILD_RESULT_PAGE_CHARS, MAX_DEPTH_CEILING, MatchResult, McpConfig, McpToolSource, MechanicalGateProfile, MechanicalGateVerdict, 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, OrchestratorBudgetSpec, OrchestratorCapConfigError, OrchestratorExtension, OrchestratorExtensionIO, OrchestratorRuntime, Out, PARALLEL_AGENTS_SCHEMA, ParallelSiteCounter, Part, PendingExternal, PendingToolTurn, PermissionConfig, PermissionGate, PermissionHook, PermissionPreset, PermissionRule, PermissionVerdict, type PhaseRow, PhaseTarget, PipelineCollected, PipelineOpts, PlanInvariantError, PriceTable, PricedUsage, type Pricing, type PricingTier, type ProviderAdapter, QualityFloors, READ_CHILD_ARTIFACT_SCHEMA, READ_CHILD_ARTIFACT_TOOL_NAME, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, RUN_SETTLE_DECISION_TYPE, RandIdentityInput, RandPayload, ReconcileOptions, ReconcileResult, 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, RunAuditVerdict, RunBudget, RunEventSink, 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, 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, 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, compileVerifiedLayer, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidencePreservedValidator, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, foldTermination, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashWorkflowBody, hashWorkflowSource, identityJcs, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastRunSettle, lexShellCommand, liftRetainedParts, lineageWeightOf, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, 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, readRunMeta, readTerminationInit, reconcileRunMeta, reduceInvocationTable, registryKeyRing, remeasureQueue, replayDisposition, requiredFieldsValidator, requiredSectionsValidator, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, selectStructuredOutputTier, shouldCompact, snapshotUsage, spawnDepthOf, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, usageViolations, validateEditorialCommit, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateUsageLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
7599
+ 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, AgentResult, AgentResultMeta, AgentStatus, ApproachSignatureInputs, ApprovalDecision, ApprovalIdentityInput, Artifact, AttemptOutcomeClass, 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, Ctx, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, 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, DebitResult, DeclaredLadder, DedupIndex, DedupNote, 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, EntryKind, EntryRef, EntryStatus, ErrorClass, ErrorCode, ErrorPolicy, EscalatedResult, EscalationDecision, EscalationDecisionAbortedError, EscalationDigest, EscalationKind, EscalationLimits, EscalationOptions, EscalationReport, EscalationRequest, EventBus, type EvidenceRef, ExtensionAppendInput, ExtensionDispatchSpec, ExternalIdentityInput, ExternalRegistry, ExtractNecessityInput, FINALIZE_SYNTHESIS_INSTRUCTION, FINISH_SCHEMA, FINISH_TOOL_NAME, FailRunError, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, FileModelKnowledgeStore, FileModelKnowledgeStoreOptions, FileTranscriptStore, FinishInfo, FinishValidationChild, FinishValidationInput, FinishValidationSpec, FinishValidationVerdict, FinishValidator, GET_CHILD_RESULT_SCHEMA, GET_CHILD_RESULT_TOOL_NAME, Gate, GateAudit, type GateRecord, GitWorktreeProvider, GitWorktreeProviderOptions, GraftBoot, HashVersion, HookVerdict, INBOX_PROPOSAL_TTL_DAYS, IdentityInput, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, InvocationRole, type InvocationTable, 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_CHILD_RESULT_PAGE_CHARS, MAX_DEPTH_CEILING, MatchResult, McpConfig, McpToolSource, MechanicalGateProfile, MechanicalGateVerdict, 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, OrchestratorBudgetSpec, OrchestratorCapConfigError, OrchestratorExtension, OrchestratorExtensionIO, OrchestratorRuntime, Out, PARALLEL_AGENTS_SCHEMA, ParallelSiteCounter, Part, PendingExternal, PendingToolTurn, PermissionConfig, PermissionGate, PermissionHook, PermissionPreset, PermissionRule, PermissionVerdict, type PhaseRow, PhaseTarget, PipelineCollected, PipelineOpts, PlanInvariantError, PriceTable, PricedUsage, type Pricing, type PricingTier, type ProviderAdapter, QualityFloors, READ_CHILD_ARTIFACT_SCHEMA, READ_CHILD_ARTIFACT_TOOL_NAME, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, RUN_SETTLE_DECISION_TYPE, RandIdentityInput, RandPayload, ReconcileOptions, ReconcileResult, 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, RunAuditVerdict, RunBudget, RunEventSink, 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, 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, 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, compileVerifiedLayer, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidencePreservedValidator, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, foldTermination, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashRunOutput, hashWorkflowBody, hashWorkflowSource, identityJcs, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastRunSettle, lexShellCommand, liftRetainedParts, lineageWeightOf, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, 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, readRunMeta, readTerminationInit, reconcileRunMeta, reduceInvocationTable, registryKeyRing, remeasureQueue, replayDisposition, requiredFieldsValidator, requiredSectionsValidator, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, selectStructuredOutputTier, shouldCompact, snapshotUsage, spawnDepthOf, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, usageViolations, validateEditorialCommit, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateUsageLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
package/dist/index.js CHANGED
@@ -289,6 +289,27 @@ var KnowledgeCasError = class extends RulvarError {
289
289
  }
290
290
  };
291
291
  /**
292
+ * A workflow-origin bare-nondeterminism violation under
293
+ * `determinism.mode: 'error'` (RV-209): bare `Date.now()` or
294
+ * `Math.random()` called from workflow code inside a run. Thrown at the
295
+ * offending call site (and re-thrown at settle if the workflow swallowed
296
+ * it), so the run rejects instead of recording a value replay cannot
297
+ * reproduce. `data` carries the structured localization: `category`,
298
+ * `frame`, and the parsed `file`/`line`/`column` when the frame names
299
+ * one. Never journaled as its own entry; the run settles 'error' with
300
+ * this wire error. Exempt provenances (installed dependencies, Node
301
+ * runtime frames, allowlisted patterns) never raise it.
302
+ */
303
+ var DeterminismError = class extends RulvarError {
304
+ code = "determinism";
305
+ constructor(message, opts) {
306
+ super(message, {
307
+ retryable: false,
308
+ ...opts
309
+ });
310
+ }
311
+ };
312
+ /**
292
313
  * Projects an AgentError to its WireError form: code 'agent', with kind,
293
314
  * retryAfterMs, and issues carried in data. Issue paths are flattened to
294
315
  * JSON-safe segments.
@@ -6580,7 +6601,12 @@ const TERMINAL = /* @__PURE__ */ new Set([
6580
6601
  "exhausted"
6581
6602
  ]);
6582
6603
  const wallClock = Date.now.bind(globalThis);
6583
- /** The last journaled run settle of a journal, if any. */
6604
+ /**
6605
+ * The last journaled run settle of a journal, if any. `outputHash` is
6606
+ * present when that settle recorded the result digest (RV-209; settles
6607
+ * written before it, or over undefined/non-serializable results, carry
6608
+ * none).
6609
+ */
6584
6610
  function lastRunSettle(entries) {
6585
6611
  for (let i = entries.length - 1; i >= 0; i -= 1) {
6586
6612
  const entry = entries[i];
@@ -6588,7 +6614,8 @@ function lastRunSettle(entries) {
6588
6614
  const value = entry.value;
6589
6615
  if (value?.decisionType === "run_settle" && typeof value.runStatus === "string" && RUN_STATUSES.has(value.runStatus)) return {
6590
6616
  runStatus: value.runStatus,
6591
- seq: entry.seq
6617
+ seq: entry.seq,
6618
+ ...typeof value.outputHash === "string" ? { outputHash: value.outputHash } : {}
6592
6619
  };
6593
6620
  }
6594
6621
  }
@@ -14538,46 +14565,172 @@ function assertSafeRunId(runId, context) {
14538
14565
  //#endregion
14539
14566
  //#region src/runner/inprocess.ts
14540
14567
  /**
14541
- * ScriptRunner SPI and InProcessRunner (M1-T11).
14568
+ * The mode (a) runner for human-authored closures. Determinism is enforced
14569
+ * by convention, lint, and the ctx shims, NOT by a VM: only the sequence
14570
+ * of keys must be stable. Bare-nondeterminism detection is ENGINE-owned
14571
+ * since RV-209: the engine wraps its `execute` call in
14572
+ * `withDeterminismDetection` (runner/determinism.ts), which classifies
14573
+ * bare Date.now/Math.random callers, emits the structured
14574
+ * `determinism:warning` event on the run's stream, and under
14575
+ * `determinism.mode: 'error'` rejects the run with a typed
14576
+ * DeterminismError. The runner itself is a pure executor, so the frozen
14577
+ * ScriptRunner seam carries no detection surface; a standalone execute
14578
+ * outside an engine runs without detection.
14579
+ */
14580
+ var InProcessRunner = class {
14581
+ onEscalation;
14582
+ constructor(o) {
14583
+ if (o?.onEscalation !== void 0) this.onEscalation = o.onEscalation;
14584
+ }
14585
+ /** The hook is read by the escalation delivery path from M3 onward. */
14586
+ get escalationHook() {
14587
+ return this.onEscalation;
14588
+ }
14589
+ async execute(wf, ctx, args) {
14590
+ if (wf.kind !== "workflow") throw new TypeError("InProcessRunner executes closure Workflow values only; CompiledWorkflow runs in the worker sandbox (@rulvar/planner, M6)");
14591
+ return await wf.body(ctx, args);
14592
+ }
14593
+ };
14594
+ //#endregion
14595
+ //#region src/runner/determinism.ts
14596
+ /**
14597
+ * Bare-nondeterminism detection (RV-209): the engine-owned guard that
14598
+ * classifies bare `Date.now()`/`Math.random()` calls observed inside a
14599
+ * run, localizes workflow-origin ones to a file and line, emits the
14600
+ * structured `determinism:warning` event, and under `mode: 'error'`
14601
+ * rejects the run with a typed DeterminismError instead of letting a
14602
+ * value replay cannot reproduce into the result.
14542
14603
  *
14543
- * Script runner contract: https://docs.rulvar.com/guide/planner
14544
- * Workflow (a closure value) runs in process only; CompiledWorkflow is the
14545
- * only form admissible to the worker sandbox and first exists at M6
14546
- * (compileScript in @rulvar/planner), so until then the engine accepts
14547
- * only in-process Workflow values. The SPI's L0 listing refers
14548
- * to its frozen-seam status; the declaration lives here with its types.
14604
+ * The machinery began life inside InProcessRunner (dev-mode process
14605
+ * warnings only); it lives here so the engine can thread the run's
14606
+ * event channel and the host's DeterminismConfig without touching the
14607
+ * frozen ScriptRunner seam: the engine wraps the in-process
14608
+ * `runner.execute(...)` call in `withDeterminismDetection`, and the
14609
+ * runner itself stays a pure executor.
14610
+ *
14611
+ * Attribution is by AsyncLocalStorage: only code inside the wrapped
14612
+ * execution inherits the detection store, so host code running
14613
+ * concurrently, engine internals outside the body, and other runs never
14614
+ * false-warn. The globals are patched ONCE per process and never
14615
+ * restored (outside a detection context the patch is a transparent
14616
+ * passthrough); the previous per-execute patch/restore pair could race
14617
+ * under concurrent runs (the false RULVAR_BARE_DATE_NOW class the 1.5.2
14618
+ * review reproduced). Rulvar's own internals never reach the check:
14619
+ * every internal real-time read binds the module-load clock
14620
+ * (l0/real-clock.ts and the ULID factory default), never the live
14621
+ * global (v1.18.0 review P2-6).
14549
14622
  */
14550
14623
  const detection = new AsyncLocalStorage();
14551
14624
  let globalsPatched = false;
14625
+ const MODES = /* @__PURE__ */ new Set([
14626
+ "off",
14627
+ "warn",
14628
+ "error"
14629
+ ]);
14552
14630
  /**
14553
- * Stack line 0 names the Error, line 1 this helper, line 2 the patched
14554
- * global, line 3 the caller whose provenance decides (the layout is
14555
- * pinned by construction: this helper is only ever called by the two
14556
- * patched globals). Two origins are exempt: installed dependencies (a
14557
- * provider SDK, any transitive package, rulvar's own published dist),
14558
- * which live under node_modules, and Node's own machinery (the undici
14559
- * transport behind fetch, timers, stream internals), whose frames carry
14560
- * `node:` specifiers and inherit the run's async context. The guard
14561
- * exists for workflow code, which imports from both but lives in
14562
- * neither. Rulvar's own internals never reach this check at all: every
14563
- * internal real-time read binds the module-load clock (l0/real-clock.ts
14564
- * and the ULID factory default), never the live global, so frames from
14565
- * workspace dists or this repo's sources cannot false-warn (v1.18.0
14566
- * review P2-6).
14631
+ * Fail-loud validation at engine construction: an invalid mode, a
14632
+ * non-function redact hook, or a malformed allowlist entry is a
14633
+ * ConfigError before any run can start under it.
14634
+ */
14635
+ function validateDeterminismConfig(config) {
14636
+ if (config === void 0) return;
14637
+ if (config.mode !== void 0 && !MODES.has(config.mode)) throw new ConfigError(`determinism.mode must be 'off', 'warn', or 'error'; got '${String(config.mode)}'`);
14638
+ if (config.allowlist !== void 0) {
14639
+ for (const pattern of config.allowlist) if (typeof pattern !== "string" && !(pattern instanceof RegExp)) throw new ConfigError("determinism.allowlist entries must be strings (substring match) or RegExp values");
14640
+ }
14641
+ if (config.redact !== void 0 && typeof config.redact !== "function") throw new ConfigError("determinism.redact must be a function (frame: string) => string");
14642
+ }
14643
+ function resolveConfig(config) {
14644
+ return {
14645
+ mode: config?.mode ?? "warn",
14646
+ allowlist: config?.allowlist ?? [],
14647
+ redact: config?.redact ?? ((frame) => frame)
14648
+ };
14649
+ }
14650
+ /**
14651
+ * The trailing `path:line:column` of a V8 stack frame, in both layouts:
14652
+ * `at fn (/abs/path.ts:12:5)` and `at file:///abs/path.ts:12:5`. Frames
14653
+ * without one (native frames, nested eval) yield undefined and the
14654
+ * event carries the frame string alone.
14567
14655
  */
14568
- function libraryCaller() {
14656
+ const FRAME_LOCATION = /(?:\(|at\s)([^()]+):(\d+):(\d+)\)?\s*$/;
14657
+ function parseFrameLocation(frame) {
14658
+ const match = FRAME_LOCATION.exec(frame);
14659
+ if (match === null) return;
14660
+ return {
14661
+ file: match[1].replace(/\?.*$/, ""),
14662
+ line: Number(match[2]),
14663
+ column: Number(match[3])
14664
+ };
14665
+ }
14666
+ function matchesAllowlist(frame, allowlist) {
14667
+ return allowlist.some((pattern) => typeof pattern === "string" ? frame.includes(pattern) : pattern.test(frame));
14668
+ }
14669
+ /**
14670
+ * Stack line 0 names the Error, line 1 this observer, line 2 the patched
14671
+ * global, line 3 the caller whose provenance decides (the layout is
14672
+ * pinned by construction: the observer is only ever called by the two
14673
+ * patched globals). Two origins are exempt without configuration:
14674
+ * installed dependencies (a provider SDK, any transitive package,
14675
+ * rulvar's own published dist), which live under node_modules, and
14676
+ * Node's own machinery (the undici transport behind fetch, timers,
14677
+ * stream internals), whose frames carry `node:` specifiers and inherit
14678
+ * the run's async context. The guard exists for workflow code, which
14679
+ * imports from both but lives in neither.
14680
+ */
14681
+ function observeBareCall(category) {
14682
+ const state = detection.getStore();
14683
+ if (state === void 0) return;
14569
14684
  const caller = (/* @__PURE__ */ new Error()).stack?.split("\n")[3];
14570
- if (caller === void 0) return false;
14571
- return caller.includes("node_modules") || /[(\s]node:/.test(caller);
14685
+ if (caller === void 0) return;
14686
+ if (caller.includes("node_modules") || /[(\s]node:/.test(caller)) return;
14687
+ const frame = caller.trim();
14688
+ const provenance = matchesAllowlist(frame, state.config.allowlist) ? "allowlisted" : "workflow";
14689
+ const location = parseFrameLocation(frame);
14690
+ const redact = state.config.redact;
14691
+ const redactedFile = location === void 0 ? void 0 : redact(location.file);
14692
+ const dedupeKey = `${category}:${provenance}`;
14693
+ if (!state.emitted.has(dedupeKey)) {
14694
+ state.emitted.add(dedupeKey);
14695
+ state.emit({
14696
+ type: "determinism:warning",
14697
+ category,
14698
+ provenance,
14699
+ frame: redact(frame),
14700
+ ...location === void 0 || redactedFile === void 0 ? {} : {
14701
+ file: redactedFile,
14702
+ line: location.line,
14703
+ column: location.column
14704
+ }
14705
+ });
14706
+ if (provenance === "workflow" && state.config.mode === "warn") {
14707
+ const globalName = category === "bare-date-now" ? "Date.now()" : "Math.random()";
14708
+ const shim = category === "bare-date-now" ? "ctx.now()" : "ctx.random()";
14709
+ const at = location === void 0 ? "" : ` at ${redactedFile}:${location.line}:${location.column}`;
14710
+ process.emitWarning(`bare ${globalName} called inside a rulvar run${at}; use ${shim} so the value is journaled and stable on replay`, {
14711
+ code: category === "bare-date-now" ? "RULVAR_BARE_DATE_NOW" : "RULVAR_BARE_MATH_RANDOM",
14712
+ type: "RulvarWarning"
14713
+ });
14714
+ }
14715
+ }
14716
+ if (provenance === "workflow" && state.config.mode === "error") {
14717
+ const error = new DeterminismError(`bare ${category === "bare-date-now" ? "Date.now()" : "Math.random()"} called inside a rulvar run${location === void 0 ? "" : ` at ${redactedFile}:${location.line}:${location.column}`} under determinism.mode 'error'; use ${category === "bare-date-now" ? "ctx.now()" : "ctx.random()"} or allowlist the frame`, { data: {
14718
+ category,
14719
+ frame: redact(frame),
14720
+ ...location === void 0 || redactedFile === void 0 ? {} : {
14721
+ file: redactedFile,
14722
+ line: location.line,
14723
+ column: location.column
14724
+ }
14725
+ } });
14726
+ state.rejection ??= error;
14727
+ throw error;
14728
+ }
14572
14729
  }
14573
14730
  /**
14574
14731
  * Patches Date.now and Math.random ONCE per process and never restores:
14575
- * outside a workflow's async context the store is absent and the patch is
14576
- * a transparent passthrough. The previous per-execute patch/restore pair
14577
- * could race under concurrent runs (one run's restore removed another's
14578
- * patch, and the second restore re-installed a stale patched function
14579
- * PERMANENTLY, which could then warn on host code outside any run: the
14580
- * false RULVAR_BARE_DATE_NOW class the 1.5.2 review reproduced).
14732
+ * outside a detection context the store is absent and the patch is a
14733
+ * transparent passthrough.
14581
14734
  */
14582
14735
  function patchGlobalsOnce() {
14583
14736
  if (globalsPatched) return;
@@ -14585,60 +14738,36 @@ function patchGlobalsOnce() {
14585
14738
  const priorNow = Date.now;
14586
14739
  const priorRandom = Math.random;
14587
14740
  Date.now = function rulvarPatchedDateNow() {
14588
- const state = detection.getStore();
14589
- if (state !== void 0 && !state.warnedNow && !libraryCaller()) {
14590
- state.warnedNow = true;
14591
- process.emitWarning("bare Date.now() called inside a rulvar run; use ctx.now() so the value is journaled and stable on replay", {
14592
- code: "RULVAR_BARE_DATE_NOW",
14593
- type: "RulvarWarning"
14594
- });
14595
- }
14741
+ observeBareCall("bare-date-now");
14596
14742
  return priorNow();
14597
14743
  };
14598
14744
  Math.random = function rulvarPatchedMathRandom() {
14599
- const state = detection.getStore();
14600
- if (state !== void 0 && !state.warnedRandom && !libraryCaller()) {
14601
- state.warnedRandom = true;
14602
- process.emitWarning("bare Math.random() called inside a rulvar run; use ctx.random() so the value is journaled and stable on replay", {
14603
- code: "RULVAR_BARE_MATH_RANDOM",
14604
- type: "RulvarWarning"
14605
- });
14606
- }
14745
+ observeBareCall("bare-math-random");
14607
14746
  return priorRandom();
14608
14747
  };
14609
14748
  }
14610
14749
  /**
14611
- * The mode (a) runner for human-authored closures. Determinism is enforced
14612
- * by convention, lint, and the ctx shims, NOT by a VM: only the sequence
14613
- * of keys must be stable. Dev mode (NODE_ENV !== 'production') detects
14614
- * bare Date.now and Math.random and emits one warning per run pointing at
14615
- * ctx.now()/ctx.random(). Detection is attributed by AsyncLocalStorage:
14616
- * only code inside the workflow body's async context can trigger it, so
14617
- * host code running concurrently, engine internals outside the body, and
14618
- * other runs never produce a false warning, and nothing is ever restored,
14619
- * so concurrent executes cannot race the patch state.
14750
+ * Runs `fn` (the in-process execution of a workflow body) under
14751
+ * bare-nondeterminism detection. Detection is active for mode 'warn'
14752
+ * outside production and for mode 'error' everywhere; otherwise `fn`
14753
+ * runs untouched with zero overhead. In error mode, a workflow-origin
14754
+ * violation swallowed by the body is re-thrown after the body settles,
14755
+ * so the segment rejects either way.
14620
14756
  */
14621
- var InProcessRunner = class {
14622
- onEscalation;
14623
- constructor(o) {
14624
- if (o?.onEscalation !== void 0) this.onEscalation = o.onEscalation;
14625
- }
14626
- /** The hook is read by the escalation delivery path from M3 onward. */
14627
- get escalationHook() {
14628
- return this.onEscalation;
14629
- }
14630
- async execute(wf, ctx, args) {
14631
- if (wf.kind !== "workflow") throw new TypeError("InProcessRunner executes closure Workflow values only; CompiledWorkflow runs in the worker sandbox (@rulvar/planner, M6)");
14632
- if (process.env.NODE_ENV !== "production") {
14633
- patchGlobalsOnce();
14634
- return detection.run({
14635
- warnedNow: false,
14636
- warnedRandom: false
14637
- }, () => wf.body(ctx, args));
14638
- }
14639
- return await wf.body(ctx, args);
14640
- }
14641
- };
14757
+ function withDeterminismDetection(config, emit, fn) {
14758
+ const resolved = resolveConfig(config);
14759
+ if (!(resolved.mode === "error" || resolved.mode === "warn" && process.env.NODE_ENV !== "production")) return fn();
14760
+ patchGlobalsOnce();
14761
+ const state = {
14762
+ config: resolved,
14763
+ emit,
14764
+ emitted: /* @__PURE__ */ new Set()
14765
+ };
14766
+ return detection.run(state, fn).then((result) => {
14767
+ if (state.rejection !== void 0) throw state.rejection;
14768
+ return result;
14769
+ });
14770
+ }
14642
14771
  //#endregion
14643
14772
  //#region src/engine/engine.ts
14644
14773
  /**
@@ -14710,6 +14839,26 @@ function hashRunArgs(args) {
14710
14839
  if (args === void 0) return;
14711
14840
  return createHash("sha256").update(jcsSerialize(args), "utf8").digest("hex");
14712
14841
  }
14842
+ /**
14843
+ * sha256 hex over the JCS canonical serialization of a run's result
14844
+ * value: the digest the engine records as `outputHash` on the journaled
14845
+ * run-settle decision when the settling segment computed a value, and
14846
+ * the value `rulvar replay --compare-output-hash` compares a replayed
14847
+ * result against (RV-209). Best-effort by design: returns undefined for
14848
+ * undefined values and for values JCS cannot serialize (functions,
14849
+ * cycles, non-finite numbers), so an unhashable result records no
14850
+ * baseline rather than failing the settle. Like `hashRunArgs`, the
14851
+ * digest is deterministic and unsalted: treat it as sensitive-derived
14852
+ * metadata for low-entropy results.
14853
+ */
14854
+ function hashRunOutput(value) {
14855
+ if (value === void 0) return;
14856
+ try {
14857
+ return createHash("sha256").update(jcsSerialize(value), "utf8").digest("hex");
14858
+ } catch {
14859
+ return;
14860
+ }
14861
+ }
14713
14862
  function createEngine(options) {
14714
14863
  const adapters = buildAdapterRegistry(options.adapters);
14715
14864
  const rawJournal = options.stores?.journal ?? new InMemoryStore();
@@ -14738,6 +14887,7 @@ function createEngine(options) {
14738
14887
  if (profile.escalation?.minSpendUsd !== void 0) requireNonNegativeNumber(profile.escalation.minSpendUsd, `createEngine defaults.profiles['${name}'].escalation.minSpendUsd`);
14739
14888
  if (profile.compaction?.threshold !== void 0) requireFraction(profile.compaction.threshold, `createEngine defaults.profiles['${name}'].compaction.threshold`);
14740
14889
  }
14890
+ validateDeterminismConfig(options.determinism);
14741
14891
  const knowledgeStore = options.stores?.modelKnowledge;
14742
14892
  const knowledge = knowledgeStore === void 0 ? void 0 : { current: () => knowledgeStore.current() };
14743
14893
  const runner = new InProcessRunner(options.onEscalation === void 0 ? void 0 : { onEscalation: options.onEscalation });
@@ -14951,7 +15101,8 @@ function createEngine(options) {
14951
15101
  if (!validation.valid) throw new ConfigError(`arguments for workflow '${wf.name}' do not validate: ` + validation.issues.map((issue) => issue.message).join("; "));
14952
15102
  }
14953
15103
  const ctx = createCtx(internals, wf.kind === "workflow" ? wf : void 0);
14954
- const bodyPromise = (compiled === void 0 ? runner : options.runners?.sandbox).execute(wf, ctx, args);
15104
+ const selectedRunner = compiled === void 0 ? runner : options.runners?.sandbox;
15105
+ const bodyPromise = compiled === void 0 ? withDeterminismDetection(options.determinism, (event) => bus.emit(event, rootSpanId), () => selectedRunner.execute(wf, ctx, args)) : selectedRunner.execute(wf, ctx, args);
14955
15106
  const raced = await Promise.race([bodyPromise.then((result) => ({
14956
15107
  kind: "done",
14957
15108
  result
@@ -15020,19 +15171,23 @@ function createEngine(options) {
15020
15171
  const priorCount = resumeCtx?.priorEntries.length ?? 0;
15021
15172
  const appendedHere = replayer.snapshot().length - priorCount;
15022
15173
  const recorded = lastRunSettle(replayer.snapshot());
15023
- if (appendedHere > 0 || recorded !== void 0 && recorded.runStatus !== status) await replayer.appendSinglePhase({
15024
- scope: "",
15025
- key: deriverV2.deriveKey({ kind: "run-settle" }),
15026
- kind: "decision",
15027
- status: "ok",
15028
- spanId: rootSpanId,
15029
- site: "run-settle",
15030
- value: {
15031
- decisionType: RUN_SETTLE_DECISION_TYPE,
15032
- runStatus: status,
15033
- segment: segmentsBefore + 1
15034
- }
15035
- }).catch(() => void 0);
15174
+ if (appendedHere > 0 || recorded !== void 0 && recorded.runStatus !== status) {
15175
+ const outputHash = hashRunOutput(outcome.value);
15176
+ await replayer.appendSinglePhase({
15177
+ scope: "",
15178
+ key: deriverV2.deriveKey({ kind: "run-settle" }),
15179
+ kind: "decision",
15180
+ status: "ok",
15181
+ spanId: rootSpanId,
15182
+ site: "run-settle",
15183
+ value: {
15184
+ decisionType: RUN_SETTLE_DECISION_TYPE,
15185
+ runStatus: status,
15186
+ segment: segmentsBefore + 1,
15187
+ ...outputHash === void 0 ? {} : { outputHash }
15188
+ }
15189
+ }).catch(() => void 0);
15190
+ }
15036
15191
  }
15037
15192
  await putMeta(status).catch(() => void 0);
15038
15193
  bus.emit({
@@ -15511,4 +15666,4 @@ function createSandboxBridge(ctx, options) {
15511
15666
  };
15512
15667
  }
15513
15668
  //#endregion
15514
- 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_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, DedupIndex, 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, 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_CHILD_RESULT_PAGE_CHARS, MAX_DEPTH_CEILING, ModelRetry, NoProgressDetector, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OrchestratorCapConfigError, PARALLEL_AGENTS_SCHEMA, ParallelSiteCounter, PlanInvariantError, READ_CHILD_ARTIFACT_SCHEMA, READ_CHILD_ARTIFACT_TOOL_NAME, 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, 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, compileVerifiedLayer, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidencePreservedValidator, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, foldTermination, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashWorkflowBody, hashWorkflowSource, identityJcs, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastRunSettle, lexShellCommand, liftRetainedParts, lineageWeightOf, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, 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, readRunMeta, readTerminationInit, reconcileRunMeta, reduceInvocationTable, registryKeyRing, remeasureQueue, replayDisposition, requiredFieldsValidator, requiredSectionsValidator, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, selectStructuredOutputTier, shouldCompact, snapshotUsage, spawnDepthOf, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, usageViolations, validateEditorialCommit, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateUsageLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
15669
+ 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_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, 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, 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_CHILD_RESULT_PAGE_CHARS, MAX_DEPTH_CEILING, ModelRetry, NoProgressDetector, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OrchestratorCapConfigError, PARALLEL_AGENTS_SCHEMA, ParallelSiteCounter, PlanInvariantError, READ_CHILD_ARTIFACT_SCHEMA, READ_CHILD_ARTIFACT_TOOL_NAME, 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, 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, compileVerifiedLayer, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidencePreservedValidator, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, foldTermination, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashRunOutput, hashWorkflowBody, hashWorkflowSource, identityJcs, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastRunSettle, lexShellCommand, liftRetainedParts, lineageWeightOf, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, 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, readRunMeta, readTerminationInit, reconcileRunMeta, reduceInvocationTable, registryKeyRing, remeasureQueue, replayDisposition, requiredFieldsValidator, requiredSectionsValidator, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, selectStructuredOutputTier, shouldCompact, snapshotUsage, spawnDepthOf, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, usageViolations, validateEditorialCommit, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateUsageLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/core",
3
- "version": "1.49.0",
3
+ "version": "1.50.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",