@rulvar/core 1.21.0 → 1.23.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
@@ -799,6 +799,18 @@ type RunMeta = {
799
799
  * resumed run to uncapped.
800
800
  */
801
801
  budgetUsd?: number;
802
+ /**
803
+ * Count of execution segments this run has STARTED (a fresh start
804
+ * writes 1; every resume writes prior + 1, durably, BEFORE the
805
+ * segment emits its first event). The engine derives each segment's
806
+ * WorkflowEvent seq and span-id base from it, which is what keeps
807
+ * `seq` strictly increasing and `spanId` unique per run across
808
+ * suspend/resume and process recreation, even after a crash-killed
809
+ * segment (v1.22.0 review P1-2). Stores must round-trip the field
810
+ * (the conformance kit checks); a store that drops it degrades a
811
+ * resumed run's telemetry counters to per-segment, never the journal.
812
+ */
813
+ segments?: number;
802
814
  };
803
815
  type RunFilter = {
804
816
  status?: string;
@@ -917,6 +929,15 @@ declare function sanitizeUsageDelta(delta: Usage): Usage;
917
929
  */
918
930
  declare function sanitizeUsage(usage: Usage): Usage;
919
931
  //#endregion
932
+ //#region src/l0/terminal.d.ts
933
+ /**
934
+ * Neutralizes terminal control sequences and control characters in one
935
+ * untrusted string, collapsing each remaining control run to a single
936
+ * space so a value can never inject a newline, an escape sequence, or a
937
+ * hidden byte into a rendered line. Visible text is preserved.
938
+ */
939
+ declare function sanitizeTerminalText(text: string): string;
940
+ //#endregion
920
941
  //#region src/vendor/standard-schema.d.ts
921
942
  // Vendored from @standard-schema/spec@1.1.0 (MIT, Copyright (c) 2024 Colin
922
943
  // McDonnell), file dist/index.d.ts, byte-identical below this header.
@@ -4301,7 +4322,14 @@ type AdaptiveEvents = {
4301
4322
  verdict: "admit" | "reuse_full" | "admit_graft";
4302
4323
  agentType: string;
4303
4324
  logicalTaskId: string;
4304
- spawnUnitsAfter: number;
4325
+ /**
4326
+ * Spawn-unit balance after the budget-layer debit. Present on
4327
+ * budget-layer admissions (the orchestrator spawn tools and
4328
+ * ctx.workflow children); absent on lineage-layer admissions
4329
+ * (ctx.agent roots), whose spawn-unit debit rides the dispatch
4330
+ * itself (v1.22.0 review P2-5).
4331
+ */
4332
+ spawnUnitsAfter?: number;
4305
4333
  } | {
4306
4334
  type: "spawn:rejected";
4307
4335
  /**
@@ -5076,7 +5104,14 @@ interface OrchestratorExtensionIO {
5076
5104
  /** Telemetry emission into the run event stream. */
5077
5105
  emit(event: {
5078
5106
  type: string;
5079
- } & Record<string, unknown>): void;
5107
+ } & Record<string, unknown>, options?: {
5108
+ /**
5109
+ * Marks the event as the replay of a journal-recovered decision
5110
+ * (the standard envelope flag), so extension surfaces can emit
5111
+ * recovered admissions honestly (v1.22.0 review P2-5).
5112
+ */
5113
+ replayed?: boolean;
5114
+ }): void;
5080
5115
  }
5081
5116
  /**
5082
5117
  * The extension contract. PlanRunner implements it in @rulvar/plan; the
@@ -6412,12 +6447,31 @@ declare function buildOrchestratorTools(runtime: OrchestratorRuntime, profileCar
6412
6447
  //#endregion
6413
6448
  //#region src/engine/events.d.ts
6414
6449
  /**
6450
+ * The distance between the telemetry counter bases of two consecutive
6451
+ * execution segments of one run: segment k of a run starts its event
6452
+ * `seq` and span counter at `k * EVENT_SEGMENT_STRIDE`. A single
6453
+ * segment would need over four billion events to reach the next base,
6454
+ * so `seq` stays strictly increasing and `spanId` unique across
6455
+ * suspend/resume and process recreation while remaining an ordinary
6456
+ * safe-integer number (v1.22.0 review P1-2). Informational for
6457
+ * consumers: treat `seq` as ordered and `spanId` as opaque, never
6458
+ * parse segment structure out of either.
6459
+ */
6460
+ declare const EVENT_SEGMENT_STRIDE: number;
6461
+ /**
6415
6462
  * Spans form a tree per run; spanId values are engine-minted opaque
6416
6463
  * strings, unique per run, pure telemetry, never identity.
6417
6464
  */
6418
6465
  declare class SpanRegistry {
6419
6466
  private readonly parents;
6420
6467
  private counter;
6468
+ constructor(options?: {
6469
+ /**
6470
+ * First counter value (default 0): the resumed-segment base that
6471
+ * keeps span ids unique per run across segments.
6472
+ */
6473
+ first?: number;
6474
+ });
6421
6475
  mint(parentSpanId?: string): string;
6422
6476
  parentOf(spanId: string): string | undefined;
6423
6477
  }
@@ -6435,6 +6489,7 @@ declare class EventBus {
6435
6489
  private readonly listeners;
6436
6490
  private seq;
6437
6491
  private ended;
6492
+ private listenerErrorReported;
6438
6493
  constructor(options: {
6439
6494
  runId: string;
6440
6495
  spans: SpanRegistry;
@@ -6445,8 +6500,27 @@ declare class EventBus {
6445
6500
  * identity by construction, so masking cannot perturb replay.
6446
6501
  */
6447
6502
  maskEvents?: boolean;
6503
+ /**
6504
+ * First seq value (default 0): the resumed-segment base that keeps
6505
+ * seq strictly increasing per run across segments (v1.22.0 review
6506
+ * P1-2).
6507
+ */
6508
+ firstSeq?: number;
6448
6509
  });
6449
6510
  emit(body: WorkflowEventBody, spanId: string, replayed?: boolean): WorkflowEvent;
6511
+ /**
6512
+ * A throwing on() listener is isolated (its work is best-effort
6513
+ * telemetry), and the failure surfaces ONCE as a warn log on this bus
6514
+ * rather than propagating into the run. The warn goes through emit()
6515
+ * itself, AFTER the triggering event's fan-out completed: it is
6516
+ * masked exactly like every other event (a secret-shaped fragment of
6517
+ * the listener's error message never reaches observers raw), its seq
6518
+ * is stamped at delivery, and every surface sees [event, warn] in
6519
+ * that order. The guard is set before the recursive emit, so a
6520
+ * listener that also throws on the warn cannot re-arm the report or
6521
+ * recurse (v1.22.0 review P2-1).
6522
+ */
6523
+ private reportListenerError;
6450
6524
  on<T extends WorkflowEvent["type"]>(type: T, cb: (event: Extract<WorkflowEvent, {
6451
6525
  type: T;
6452
6526
  }>) => void): () => void;
@@ -6517,6 +6591,14 @@ interface SandboxBridge {
6517
6591
  /** Releases the activity token and rejects outstanding thunks. */
6518
6592
  close(): void;
6519
6593
  }
6594
+ /**
6595
+ * The sanctioned JSON subset of AgentOpts a sandbox script may pass:
6596
+ * the planner-dialect allowlist. Exported as the single source both for
6597
+ * the runtime validator below and for the planner API card, so the two
6598
+ * can never drift (v1.22.0 review P2-4: the hand-maintained card had
6599
+ * silently fallen three options behind).
6600
+ */
6601
+ declare const SANDBOX_AGENT_OPT_KEYS: readonly string[];
6520
6602
  declare function createSandboxBridge(ctx: Ctx<never>, options: SandboxBridgeOptions): SandboxBridge;
6521
6603
  //#endregion
6522
- 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, 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, validateSchemaSpec, validateTerminationLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
6604
+ 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, EVENT_SEGMENT_STRIDE, 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, 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, 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, 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, validateSchemaSpec, validateTerminationLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
package/dist/index.js CHANGED
@@ -646,6 +646,47 @@ function sanitizeUsage(usage) {
646
646
  return out;
647
647
  }
648
648
  //#endregion
649
+ //#region src/l0/terminal.ts
650
+ /**
651
+ * Terminal output hygiene (v1.21.0 review P2-1): the rendering-boundary
652
+ * counterpart to maskSecrets. Any UNTRUSTED string a terminal renderer
653
+ * interpolates into a line, provider error messages, tool names, model
654
+ * ids, workflow and label metadata, and log text, can carry control
655
+ * characters and escape sequences that rewrite the screen, recolor to
656
+ * hide forged text, set the window title, drive the clipboard on some
657
+ * terminals, or inject fresh newlines that forge CI log structure.
658
+ * Secret masking does not address this: it targets credential SHAPES,
659
+ * not control bytes.
660
+ *
661
+ * Every line-oriented renderer passes each dynamic value through
662
+ * `sanitizeTerminalText` BEFORE interpolation, and adds its own SGR
663
+ * styling only afterward, so the renderer's own colors survive while
664
+ * nothing an adapter or tool emitted can reach the terminal as a control
665
+ * sequence. The guarantee after sanitization: the result contains no
666
+ * byte in `U+0000..U+001F`, `U+007F..U+009F` (C0, DEL, and the C1 range
667
+ * including every 8-bit sequence introducer), and no ESC-initiated
668
+ * CSI/OSC/DCS/SOS/PM/APC sequence.
669
+ *
670
+ * The patterns are built from escaped codepoints (never literal control
671
+ * bytes in the source) and applied in order: string sequences first (so
672
+ * their printable payload leaves with them), then CSI, then any
673
+ * remaining control run collapses to one space. An unterminated or
674
+ * partial sequence loses its introducer in the final pass, which
675
+ * de-fangs it.
676
+ */
677
+ const ESC_STRING_SEQUENCE = /* @__PURE__ */ new RegExp("(?:\\u001B[\\]PX^_]|[\\u009D\\u0090\\u0098\\u009E\\u009F])[\\s\\S]*?(?:\\u0007|\\u001B\\\\|\\u009C)", "gu");
678
+ const ESC_CSI_SEQUENCE = /* @__PURE__ */ new RegExp("(?:\\u001B\\[|\\u009B)[\\u0030-\\u003F]*[\\u0020-\\u002F]*[\\u0040-\\u007E]", "gu");
679
+ const CONTROL_RUN = /* @__PURE__ */ new RegExp("[\\u0000-\\u001F\\u007F-\\u009F]+", "gu");
680
+ /**
681
+ * Neutralizes terminal control sequences and control characters in one
682
+ * untrusted string, collapsing each remaining control run to a single
683
+ * space so a value can never inject a newline, an escape sequence, or a
684
+ * hidden byte into a rendered line. Visible text is preserved.
685
+ */
686
+ function sanitizeTerminalText(text) {
687
+ return text.replace(ESC_STRING_SEQUENCE, "").replace(ESC_CSI_SEQUENCE, "").replace(CONTROL_RUN, " ");
688
+ }
689
+ //#endregion
649
690
  //#region src/vendor/json-schema/deep-compare-strict.ts
650
691
  function deepCompareStrict(a, b) {
651
692
  const typeofa = typeof a;
@@ -5414,6 +5455,20 @@ var JournalMatcher = class {
5414
5455
  * Full contract: https://docs.rulvar.com/guide/journal; architecture
5415
5456
  * overview: https://docs.rulvar.com/guide/architecture.
5416
5457
  */
5458
+ /**
5459
+ * The ordinal-space map key: one composite per (scope, hashVersion, key).
5460
+ * `U+0000` separators built from escape sequences (never literal control
5461
+ * bytes in source), because scopes and keys are free-form strings and a
5462
+ * printable separator could alias two different pairs. Prior seeding and
5463
+ * mint() MUST both go through this helper: v1.22.0 shipped with two
5464
+ * hand-built variants whose separators differed (an invisible literal
5465
+ * NUL against a space), so resume seeding filled a bucket mint() never
5466
+ * read and every identical live operation after a resume re-minted
5467
+ * ordinal 0, duplicating the identity triple (v1.22.0 review P1-1).
5468
+ */
5469
+ function ordinalMapKey(scope, hashVersion, key) {
5470
+ return `${scope}\u0000${String(hashVersion)}\u0000${key}`;
5471
+ }
5417
5472
  /** Large-value soft warn threshold (committed for M2). */
5418
5473
  const LARGE_VALUE_WARN_BYTES = 262144;
5419
5474
  /**
@@ -5457,9 +5512,9 @@ var Replayer = class {
5457
5512
  this.entries.push(entry);
5458
5513
  if (entry.seq >= this.seq) this.seq = entry.seq + 1;
5459
5514
  if (entry.ref === void 0 && entry.kind !== "resolution" && entry.kind !== "abandon" && entry.hashVersion === 2) {
5460
- const ordinalKey = `${entry.scope} ${entry.hashVersion} ${entry.key}`;
5461
- const next = (this.ordinals.get(ordinalKey) ?? 0) + 1;
5462
- if (entry.ordinal + 1 > next - 1) this.ordinals.set(ordinalKey, entry.ordinal + 1);
5515
+ const ordinalKey = ordinalMapKey(entry.scope, entry.hashVersion, entry.key);
5516
+ const current = this.ordinals.get(ordinalKey) ?? 0;
5517
+ if (entry.ordinal + 1 > current) this.ordinals.set(ordinalKey, entry.ordinal + 1);
5463
5518
  }
5464
5519
  }
5465
5520
  }
@@ -5703,7 +5758,7 @@ var Replayer = class {
5703
5758
  await this.queue;
5704
5759
  }
5705
5760
  mint(scope, key, kind, status) {
5706
- const ordinalKey = `${scope}2${key}`;
5761
+ const ordinalKey = ordinalMapKey(scope, 2, key);
5707
5762
  const ordinal = this.ordinals.get(ordinalKey) ?? 0;
5708
5763
  this.ordinals.set(ordinalKey, ordinal + 1);
5709
5764
  const entry = {
@@ -5884,7 +5939,7 @@ var ExternalRegistry = class ExternalRegistry {
5884
5939
  * until a resolution wins the first-closing-wins fold.
5885
5940
  */
5886
5941
  async awaitExternal(scope, spanId, key, options) {
5887
- const scopeKey = `${scope}${key}`;
5942
+ const scopeKey = `${scope}\u0000${key}`;
5888
5943
  if (this.keysByScope.has(scopeKey)) throw new ConfigError(`duplicate awaitExternal key '${key}' in scope '${scope}'`);
5889
5944
  this.keysByScope.add(scopeKey);
5890
5945
  const identity = {
@@ -8201,7 +8256,7 @@ async function runAgent(options) {
8201
8256
  const primaryRole = options.role ?? "loop";
8202
8257
  const usageByPhaseModel = /* @__PURE__ */ new Map();
8203
8258
  const addPhaseUsage = (role, ref, usage) => {
8204
- const key = `${role}${ref}`;
8259
+ const key = `${role}\u0000${ref}`;
8205
8260
  const prior = usageByPhaseModel.get(key);
8206
8261
  usageByPhaseModel.set(key, {
8207
8262
  role,
@@ -10323,6 +10378,26 @@ function runtimeOf(ctx) {
10323
10378
  return runtime;
10324
10379
  }
10325
10380
  //#endregion
10381
+ //#region src/engine/spawn-events.ts
10382
+ function emitSpawnAdmitted(events, input) {
10383
+ events.emit({
10384
+ type: "spawn:admitted",
10385
+ entryRef: input.entryRef,
10386
+ verdict: input.verdict,
10387
+ agentType: input.agentType,
10388
+ logicalTaskId: input.logicalTaskId,
10389
+ ...input.spawnUnitsAfter === void 0 ? {} : { spawnUnitsAfter: input.spawnUnitsAfter }
10390
+ }, input.spanId, input.replayed);
10391
+ }
10392
+ function emitSpawnRejected(events, input) {
10393
+ events.emit({
10394
+ type: "spawn:rejected",
10395
+ ...input.entryRef === void 0 ? {} : { entryRef: input.entryRef },
10396
+ code: input.code,
10397
+ agentType: input.agentType
10398
+ }, input.spanId, input.replayed);
10399
+ }
10400
+ //#endregion
10326
10401
  //#region src/engine/ctx.ts
10327
10402
  /**
10328
10403
  * Ctx primitives (M1-T07) plus the parallel/pipeline composition semantics
@@ -10858,14 +10933,23 @@ function createCtx(internals, rootWorkflow) {
10858
10933
  claimed.add(prior.seq);
10859
10934
  const recorded = prior.value;
10860
10935
  if (recorded.reject !== void 0) {
10861
- internals.events.emit({
10862
- type: "spawn:rejected",
10936
+ emitSpawnRejected(internals.events, {
10863
10937
  entryRef: prior.seq,
10864
10938
  code: recorded.reject.code,
10865
- agentType
10866
- }, state.spanId, true);
10939
+ agentType,
10940
+ spanId: state.spanId,
10941
+ replayed: true
10942
+ });
10867
10943
  throw new AdmissionRejectedError(`lineage admission rejected agent spawn (${recorded.reject.code}; recorded verdict)`, { data: { reason: recorded.reject } });
10868
10944
  }
10945
+ emitSpawnAdmitted(internals.events, {
10946
+ entryRef: prior.seq,
10947
+ verdict: "admit",
10948
+ agentType,
10949
+ logicalTaskId: recorded.lineage?.logicalTaskId ?? "unknown",
10950
+ spanId: state.spanId,
10951
+ replayed: true
10952
+ });
10869
10953
  } else {
10870
10954
  const evaluated = admission.evaluateLineage({
10871
10955
  name: agentType,
@@ -10897,15 +10981,22 @@ function createCtx(internals, rootWorkflow) {
10897
10981
  value: decisionValue
10898
10982
  });
10899
10983
  if (evaluated.decision.kind === "reject") {
10900
- internals.events.emit({
10901
- type: "spawn:rejected",
10984
+ emitSpawnRejected(internals.events, {
10902
10985
  entryRef: decisionEntry.seq,
10903
10986
  code: evaluated.decision.reason.code,
10904
- agentType
10905
- }, state.spanId);
10987
+ agentType,
10988
+ spanId: state.spanId
10989
+ });
10906
10990
  throw new AdmissionRejectedError(`lineage admission rejected agent spawn (${evaluated.decision.reason.code})`, { data: { reason: evaluated.decision.reason } });
10907
10991
  }
10908
10992
  admission.registerLineageAdmit(evaluated.decision.lineage.logicalTaskId);
10993
+ emitSpawnAdmitted(internals.events, {
10994
+ entryRef: decisionEntry.seq,
10995
+ verdict: "admit",
10996
+ agentType,
10997
+ logicalTaskId: evaluated.decision.lineage.logicalTaskId,
10998
+ spanId: state.spanId
10999
+ });
10909
11000
  }
10910
11001
  }
10911
11002
  const adapter = adapterOf(loopResolved);
@@ -11465,7 +11556,7 @@ function createCtx(internals, rootWorkflow) {
11465
11556
  */
11466
11557
  const workflowOrdinals = /* @__PURE__ */ new Map();
11467
11558
  const nextWorkflowOrdinal = (scope, name) => {
11468
- const counterKey = `${scope}${name}`;
11559
+ const counterKey = `${scope}\u0000${name}`;
11469
11560
  const ordinal = workflowOrdinals.get(counterKey) ?? 0;
11470
11561
  workflowOrdinals.set(counterKey, ordinal + 1);
11471
11562
  return ordinal;
@@ -11546,8 +11637,12 @@ function createCtx(internals, rootWorkflow) {
11546
11637
  return value?.decisionType === "spawn-admission" && value.childScope === childScope;
11547
11638
  });
11548
11639
  let verdict;
11640
+ let decisionEntrySeq;
11641
+ let decisionReplayed = false;
11549
11642
  if (prior !== void 0) {
11550
11643
  verdict = prior.value.decision.verdict;
11644
+ decisionEntrySeq = prior.seq;
11645
+ decisionReplayed = true;
11551
11646
  if (verdict.kind !== "reject") admission.recoverInFlight(budgetAccount, verdict);
11552
11647
  } else {
11553
11648
  const decision = admission.admit({
@@ -11563,7 +11658,7 @@ function createCtx(internals, rootWorkflow) {
11563
11658
  }
11564
11659
  });
11565
11660
  verdict = decision.verdict;
11566
- await internals.replayer.appendSinglePhase({
11661
+ decisionEntrySeq = (await internals.replayer.appendSinglePhase({
11567
11662
  scope: state.scope,
11568
11663
  key: "",
11569
11664
  kind: "decision",
@@ -11577,10 +11672,28 @@ function createCtx(internals, rootWorkflow) {
11577
11672
  parentAccountScope: budgetAccount,
11578
11673
  decision
11579
11674
  }
11675
+ })).seq;
11676
+ }
11677
+ if (verdict.kind === "reject") {
11678
+ emitSpawnRejected(internals.events, {
11679
+ entryRef: decisionEntrySeq,
11680
+ code: verdict.reason.code,
11681
+ agentType: name,
11682
+ spanId,
11683
+ replayed: decisionReplayed ? true : void 0
11580
11684
  });
11685
+ throw rejectionError(verdict.reason, name);
11581
11686
  }
11582
- if (verdict.kind === "reject") throw rejectionError(verdict.reason, name);
11583
11687
  if (verdict.kind !== "admit") throw new ConfigError(`admission verdict '${verdict.kind}' has no producer before M7 (DEF-5)`);
11688
+ emitSpawnAdmitted(internals.events, {
11689
+ entryRef: decisionEntrySeq,
11690
+ verdict: verdict.kind,
11691
+ agentType: name,
11692
+ logicalTaskId: verdict.lineage.logicalTaskId,
11693
+ spawnUnitsAfter: verdict.spawnUnitsAfter,
11694
+ spanId,
11695
+ replayed: decisionReplayed ? true : void 0
11696
+ });
11584
11697
  const reserve = verdict.reserve;
11585
11698
  const openOptions = { parentScope: budgetAccount };
11586
11699
  if (reserve.childCeilingUsd !== void 0) {
@@ -12111,7 +12224,7 @@ function makeOrchestratorWorkflow(goal, opts) {
12111
12224
  },
12112
12225
  registerAlias: (donorScope, targetScope) => internals.replayer.registerAlias(donorScope, targetScope),
12113
12226
  priceUsd: (servedBy, usage) => servedBy === void 0 ? void 0 : internals.priceUsd(servedBy, usage),
12114
- emit: (event) => internals.events.emit(event, callingState.spanId)
12227
+ emit: (event, options) => internals.events.emit(event, callingState.spanId, options?.replayed)
12115
12228
  };
12116
12229
  const cancelByHandle = async (handle, _reason) => {
12117
12230
  const record = records.get(handle);
@@ -12155,15 +12268,31 @@ function makeOrchestratorWorkflow(goal, opts) {
12155
12268
  if (entry.kind !== "decision" || entry.scope !== callingState.scope) return false;
12156
12269
  const value = entry.value;
12157
12270
  return value?.decisionType === "spawn-admission" && (value.origin === "spawn_agent" || value.origin === "parallel_agents");
12158
- }).map((entry) => entry.value).sort((a, b) => a.spawnOrdinal - b.spawnOrdinal);
12159
- for (const value of admissions) {
12271
+ }).map((entry) => ({
12272
+ entrySeq: entry.seq,
12273
+ value: entry.value
12274
+ })).sort((a, b) => a.value.spawnOrdinal - b.value.spawnOrdinal);
12275
+ for (const { entrySeq, value } of admissions) {
12160
12276
  nextOrdinal = Math.max(nextOrdinal, value.spawnOrdinal + 1);
12161
12277
  const decision = value.decision;
12162
12278
  recoveredSpecByOrdinal.set(value.spawnOrdinal, value.spec);
12279
+ const recoveredAgentType = value.spec?.agentType ?? "unknown";
12163
12280
  if (decision.verdict.kind !== "admit") {
12164
- rejectedByOrdinal.set(value.spawnOrdinal, decision);
12281
+ rejectedByOrdinal.set(value.spawnOrdinal, {
12282
+ decision,
12283
+ entrySeq
12284
+ });
12165
12285
  continue;
12166
12286
  }
12287
+ emitSpawnAdmitted(internals.events, {
12288
+ entryRef: entrySeq,
12289
+ verdict: decision.verdict.kind,
12290
+ agentType: recoveredAgentType,
12291
+ logicalTaskId: decision.verdict.lineage.logicalTaskId,
12292
+ spawnUnitsAfter: decision.verdict.spawnUnitsAfter,
12293
+ spanId: callingState.spanId,
12294
+ replayed: true
12295
+ });
12167
12296
  admission.recoverChild(currentScope);
12168
12297
  const childScope = value.childScope ?? value.orchestratorScope;
12169
12298
  const record = await dispatchChild(value.spec, value.spawnOrdinal, {
@@ -12314,7 +12443,17 @@ function makeOrchestratorWorkflow(goal, opts) {
12314
12443
  const recovered = byOrdinal.get(spawnOrdinal);
12315
12444
  if (recovered !== void 0 && specMatches) return { handle: recovered.handle };
12316
12445
  const recoveredRejection = rejectedByOrdinal.get(spawnOrdinal);
12317
- if (recoveredRejection !== void 0 && specMatches) throw new AdmissionRejectedError(`admission rejected spawn ordinal ${String(spawnOrdinal)} (recovered verdict)`, { data: { decision: recoveredRejection } });
12446
+ if (recoveredRejection !== void 0 && specMatches) {
12447
+ const reason = recoveredRejection.decision.verdict;
12448
+ emitSpawnRejected(internals.events, {
12449
+ entryRef: recoveredRejection.entrySeq,
12450
+ code: reason.reason?.code ?? "unknown",
12451
+ agentType: params.agentType,
12452
+ spanId: callingState.spanId,
12453
+ replayed: true
12454
+ });
12455
+ throw new AdmissionRejectedError(`admission rejected spawn ordinal ${String(spawnOrdinal)} (recovered verdict)`, { data: { decision: recoveredRejection.decision } });
12456
+ }
12318
12457
  if (opts?.maxSpawns !== void 0 && spawnOrdinal >= opts.maxSpawns) {
12319
12458
  internals.events.emit({
12320
12459
  type: "spawn:rejected",
@@ -12366,24 +12505,27 @@ function makeOrchestratorWorkflow(goal, opts) {
12366
12505
  value: admissionValue
12367
12506
  });
12368
12507
  if (decision.verdict.kind === "reject") {
12369
- rejectedByOrdinal.set(spawnOrdinal, decision);
12370
- internals.events.emit({
12371
- type: "spawn:rejected",
12508
+ rejectedByOrdinal.set(spawnOrdinal, {
12509
+ decision,
12510
+ entrySeq: decisionEntry.seq
12511
+ });
12512
+ emitSpawnRejected(internals.events, {
12372
12513
  entryRef: decisionEntry.seq,
12373
12514
  code: decision.verdict.reason.code,
12374
- agentType: params.agentType
12375
- }, callingState.spanId);
12515
+ agentType: params.agentType,
12516
+ spanId: callingState.spanId
12517
+ });
12376
12518
  throw new AdmissionRejectedError(`admission rejected spawn_agent '${params.agentType}' (${decision.verdict.reason.code})`, { data: { reason: decision.verdict.reason } });
12377
12519
  }
12378
12520
  if (decision.verdict.kind !== "admit") throw new ConfigError(`admission verdict '${decision.verdict.kind}' has no producer before M7 (DEF-5)`);
12379
- internals.events.emit({
12380
- type: "spawn:admitted",
12521
+ emitSpawnAdmitted(internals.events, {
12381
12522
  entryRef: decisionEntry.seq,
12382
12523
  verdict: decision.verdict.kind,
12383
12524
  agentType: params.agentType,
12384
12525
  logicalTaskId: decision.verdict.lineage.logicalTaskId,
12385
- spawnUnitsAfter: decision.verdict.spawnUnitsAfter
12386
- }, callingState.spanId);
12526
+ spawnUnitsAfter: decision.verdict.spawnUnitsAfter,
12527
+ spanId: callingState.spanId
12528
+ });
12387
12529
  return { handle: (await dispatchChild(params, spawnOrdinal, {
12388
12530
  nodeId: decision.nodeId ?? "unknown",
12389
12531
  logicalTaskId: decision.verdict.lineage.logicalTaskId
@@ -12686,12 +12828,27 @@ function orchestrate(engine, goal, opts, runOptions) {
12686
12828
  * Full contract: https://docs.rulvar.com/guide/observability.
12687
12829
  */
12688
12830
  /**
12831
+ * The distance between the telemetry counter bases of two consecutive
12832
+ * execution segments of one run: segment k of a run starts its event
12833
+ * `seq` and span counter at `k * EVENT_SEGMENT_STRIDE`. A single
12834
+ * segment would need over four billion events to reach the next base,
12835
+ * so `seq` stays strictly increasing and `spanId` unique across
12836
+ * suspend/resume and process recreation while remaining an ordinary
12837
+ * safe-integer number (v1.22.0 review P1-2). Informational for
12838
+ * consumers: treat `seq` as ordered and `spanId` as opaque, never
12839
+ * parse segment structure out of either.
12840
+ */
12841
+ const EVENT_SEGMENT_STRIDE = 2 ** 32;
12842
+ /**
12689
12843
  * Spans form a tree per run; spanId values are engine-minted opaque
12690
12844
  * strings, unique per run, pure telemetry, never identity.
12691
12845
  */
12692
12846
  var SpanRegistry = class {
12693
12847
  parents = /* @__PURE__ */ new Map();
12694
- counter = 0;
12848
+ counter;
12849
+ constructor(options) {
12850
+ this.counter = options?.first ?? 0;
12851
+ }
12695
12852
  mint(parentSpanId) {
12696
12853
  const spanId = `s${this.counter++}`;
12697
12854
  if (parentSpanId !== void 0) this.parents.set(spanId, parentSpanId);
@@ -12713,13 +12870,15 @@ var EventBus = class {
12713
12870
  maskEvents;
12714
12871
  subscribers = /* @__PURE__ */ new Set();
12715
12872
  listeners = /* @__PURE__ */ new Set();
12716
- seq = 0;
12873
+ seq;
12717
12874
  ended = false;
12875
+ listenerErrorReported = false;
12718
12876
  constructor(options) {
12719
12877
  this.runId = options.runId;
12720
12878
  this.spans = options.spans;
12721
12879
  this.now = options.now ?? realNow;
12722
12880
  this.maskEvents = options.maskEvents ?? true;
12881
+ this.seq = options.firstSeq ?? 0;
12723
12882
  }
12724
12883
  emit(body, spanId, replayed) {
12725
12884
  const parentSpanId = this.spans.parentOf(spanId);
@@ -12733,10 +12892,41 @@ var EventBus = class {
12733
12892
  ...replayed === true ? { replayed: true } : {},
12734
12893
  ...safeBody
12735
12894
  };
12736
- for (const listener of this.listeners) listener(event);
12895
+ let listenerFailure;
12896
+ let sawListenerFailure = false;
12897
+ for (const listener of this.listeners) try {
12898
+ listener(event);
12899
+ } catch (thrown) {
12900
+ if (!sawListenerFailure) {
12901
+ sawListenerFailure = true;
12902
+ listenerFailure = thrown;
12903
+ }
12904
+ }
12737
12905
  for (const subscriber of this.subscribers) subscriber.push(event);
12906
+ if (sawListenerFailure) this.reportListenerError(listenerFailure, spanId);
12738
12907
  return event;
12739
12908
  }
12909
+ /**
12910
+ * A throwing on() listener is isolated (its work is best-effort
12911
+ * telemetry), and the failure surfaces ONCE as a warn log on this bus
12912
+ * rather than propagating into the run. The warn goes through emit()
12913
+ * itself, AFTER the triggering event's fan-out completed: it is
12914
+ * masked exactly like every other event (a secret-shaped fragment of
12915
+ * the listener's error message never reaches observers raw), its seq
12916
+ * is stamped at delivery, and every surface sees [event, warn] in
12917
+ * that order. The guard is set before the recursive emit, so a
12918
+ * listener that also throws on the warn cannot re-arm the report or
12919
+ * recurse (v1.22.0 review P2-1).
12920
+ */
12921
+ reportListenerError(thrown, spanId) {
12922
+ if (this.listenerErrorReported) return;
12923
+ this.listenerErrorReported = true;
12924
+ this.emit({
12925
+ type: "log",
12926
+ level: "warn",
12927
+ msg: "an event listener threw and was isolated so the run is unaffected: " + (thrown instanceof Error ? thrown.message : String(thrown))
12928
+ }, spanId);
12929
+ }
12740
12930
  on(type, cb) {
12741
12931
  const listener = (event) => {
12742
12932
  if (event.type === type) cb(event);
@@ -12940,12 +13130,15 @@ function createEngine(options) {
12940
13130
  if (compiled !== void 0 && options.runners?.sandbox === void 0) throw new ConfigError("running a CompiledWorkflow requires a sandbox runner: pass createEngine({ runners: { sandbox: new WorkerSandboxRunner() } }) from @rulvar/planner ");
12941
13131
  const runId = resumeCtx?.runId ?? opts?.runId ?? mintRunId();
12942
13132
  const registry = buildDeriverRegistry(options.extraDerivers);
12943
- const spans = new SpanRegistry();
13133
+ const segmentsBefore = resumeCtx?.segmentsBefore ?? 0;
13134
+ const telemetryBase = segmentsBefore * EVENT_SEGMENT_STRIDE;
13135
+ const spans = new SpanRegistry({ first: telemetryBase });
12944
13136
  const bus = new EventBus({
12945
13137
  runId,
12946
13138
  spans,
12947
13139
  now: realNow,
12948
- maskEvents
13140
+ maskEvents,
13141
+ firstSeq: telemetryBase
12949
13142
  });
12950
13143
  const rootSpanId = spans.mint();
12951
13144
  let budgetSeed;
@@ -13024,7 +13217,7 @@ function createEngine(options) {
13024
13217
  ...options.budgetDefaults?.flatReserveUsd === void 0 ? {} : { flatReserveUsd: options.budgetDefaults.flatReserveUsd },
13025
13218
  ...defaults.roleFloors === void 0 ? {} : { floors: defaults.roleFloors },
13026
13219
  ...knowledge === void 0 ? {} : { knowledge },
13027
- events: { emit: (body, spanId) => bus.emit(body, spanId ?? rootSpanId) },
13220
+ events: { emit: (body, spanId, replayed) => bus.emit(body, spanId ?? rootSpanId, replayed) },
13028
13221
  spans,
13029
13222
  rootSpanId,
13030
13223
  transcripts,
@@ -13070,6 +13263,7 @@ function createEngine(options) {
13070
13263
  const putMeta = (status) => journal.putMeta({
13071
13264
  runId,
13072
13265
  status,
13266
+ segments: segmentsBefore + 1,
13073
13267
  updatedAt: new Date(realNow()).toISOString(),
13074
13268
  ...opts?.name === void 0 ? {} : { name: opts.name },
13075
13269
  ...opts?.tags === void 0 ? {} : { tags: opts.tags },
@@ -13257,6 +13451,7 @@ function createEngine(options) {
13257
13451
  invalidate: resumeOptions?.invalidate ?? [],
13258
13452
  ...resumeOptions?.lease === void 0 ? {} : { lease: resumeOptions.lease },
13259
13453
  ...typeof meta?.budgetUsd === "number" ? { budgetUsd: meta.budgetUsd } : {},
13454
+ segmentsBefore: typeof meta?.segments === "number" && meta.segments > 0 ? Math.floor(meta.segments) : 1,
13260
13455
  previewResolve
13261
13456
  });
13262
13457
  })();
@@ -13355,8 +13550,14 @@ function createEngine(options) {
13355
13550
  * exactly like an in-process one (the token is re-acquired BEFORE any
13356
13551
  * response is posted, closing the wake latency gap).
13357
13552
  */
13358
- /** The sanctioned JSON subset of AgentOpts a sandbox script may pass. */
13359
- const SANDBOX_AGENT_OPT_KEYS = /* @__PURE__ */ new Set([
13553
+ /**
13554
+ * The sanctioned JSON subset of AgentOpts a sandbox script may pass:
13555
+ * the planner-dialect allowlist. Exported as the single source both for
13556
+ * the runtime validator below and for the planner API card, so the two
13557
+ * can never drift (v1.22.0 review P2-4: the hand-maintained card had
13558
+ * silently fallen three options behind).
13559
+ */
13560
+ const SANDBOX_AGENT_OPT_KEYS = [
13360
13561
  "agentType",
13361
13562
  "model",
13362
13563
  "effort",
@@ -13373,7 +13574,8 @@ const SANDBOX_AGENT_OPT_KEYS = /* @__PURE__ */ new Set([
13373
13574
  "escalation",
13374
13575
  "fallback",
13375
13576
  "replay"
13376
- ]);
13577
+ ];
13578
+ const SANDBOX_AGENT_OPT_KEY_SET = new Set(SANDBOX_AGENT_OPT_KEYS);
13377
13579
  function asRecord(value, what) {
13378
13580
  if (typeof value !== "object" || value === null || Array.isArray(value)) throw new ConfigError(`sandbox call ${what} must be a JSON object`);
13379
13581
  return value;
@@ -13447,7 +13649,7 @@ function createSandboxBridge(ctx, options) {
13447
13649
  const record = asRecord(params, "agent params");
13448
13650
  if (typeof record.prompt !== "string") throw new ConfigError("sandbox agent call requires a string prompt");
13449
13651
  const rawOpts = record.opts === void 0 ? {} : asRecord(record.opts, "agent options");
13450
- for (const key of Object.keys(rawOpts)) if (!SANDBOX_AGENT_OPT_KEYS.has(key)) throw new ConfigError(`sandbox agent option '${key}' is outside the sanctioned dialect; allowed: ` + [...SANDBOX_AGENT_OPT_KEYS].sort().join(", "));
13652
+ for (const key of Object.keys(rawOpts)) if (!SANDBOX_AGENT_OPT_KEY_SET.has(key)) throw new ConfigError(`sandbox agent option '${key}' is outside the sanctioned dialect; allowed: ` + [...SANDBOX_AGENT_OPT_KEYS].sort().join(", "));
13451
13653
  if (rawOpts.tools !== void 0) {
13452
13654
  const tools = rawOpts.tools;
13453
13655
  if (!(Array.isArray(tools) && tools.every((v) => typeof v === "string"))) throw new ConfigError("sandbox agent tools must be registered profile NAMES");
@@ -13610,4 +13812,4 @@ function createSandboxBridge(ctx, options) {
13610
13812
  };
13611
13813
  }
13612
13814
  //#endregion
13613
- 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, 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, validateSchemaSpec, validateTerminationLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
13815
+ 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, EVENT_SEGMENT_STRIDE, 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, 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, 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, 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, validateSchemaSpec, validateTerminationLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/core",
3
- "version": "1.21.0",
3
+ "version": "1.23.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",