@rulvar/core 1.22.0 → 1.24.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 +101 -6
- package/dist/index.js +223 -59
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -799,6 +799,38 @@ 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;
|
|
814
|
+
/**
|
|
815
|
+
* Whether the run started with defined args. Engine-recorded at
|
|
816
|
+
* genesis and preserved verbatim by every later segment (a resume
|
|
817
|
+
* never rewrites it from its own re-supplied args). Args themselves
|
|
818
|
+
* are not journaled; the host re-supplies them on resume, and this
|
|
819
|
+
* marker plus `argsHash` let a host refuse a resume whose args
|
|
820
|
+
* silently diverge from the original invocation (the v1.23.0 review:
|
|
821
|
+
* a CLI resume that forgot `--args` silently changed the logical run
|
|
822
|
+
* and paid again). Absent on runs started before v1.24.0. Stores must
|
|
823
|
+
* round-trip the field (the conformance kit checks).
|
|
824
|
+
*/
|
|
825
|
+
argsProvided?: boolean;
|
|
826
|
+
/**
|
|
827
|
+
* sha256 hex over the JCS canonical serialization of the genesis args
|
|
828
|
+
* (`hashRunArgs`). Absent when the run started without args or when
|
|
829
|
+
* the args are not JCS-serializable (`argsProvided` still records
|
|
830
|
+
* presence). Never the raw args: nothing sensitive lands in meta.
|
|
831
|
+
* Stores must round-trip the field (the conformance kit checks).
|
|
832
|
+
*/
|
|
833
|
+
argsHash?: string;
|
|
802
834
|
};
|
|
803
835
|
type RunFilter = {
|
|
804
836
|
status?: string;
|
|
@@ -4310,7 +4342,14 @@ type AdaptiveEvents = {
|
|
|
4310
4342
|
verdict: "admit" | "reuse_full" | "admit_graft";
|
|
4311
4343
|
agentType: string;
|
|
4312
4344
|
logicalTaskId: string;
|
|
4313
|
-
|
|
4345
|
+
/**
|
|
4346
|
+
* Spawn-unit balance after the budget-layer debit. Present on
|
|
4347
|
+
* budget-layer admissions (the orchestrator spawn tools and
|
|
4348
|
+
* ctx.workflow children); absent on lineage-layer admissions
|
|
4349
|
+
* (ctx.agent roots), whose spawn-unit debit rides the dispatch
|
|
4350
|
+
* itself (v1.22.0 review P2-5).
|
|
4351
|
+
*/
|
|
4352
|
+
spawnUnitsAfter?: number;
|
|
4314
4353
|
} | {
|
|
4315
4354
|
type: "spawn:rejected";
|
|
4316
4355
|
/**
|
|
@@ -4778,6 +4817,17 @@ declare function hashWorkflowBody(wf: Workflow<never, never> | Workflow<unknown,
|
|
|
4778
4817
|
declare function hashWorkflowSource(source: string): string;
|
|
4779
4818
|
/** TranscriptStore ref of the persisted CompiledWorkflow source blob. */
|
|
4780
4819
|
declare function workflowSourceRef(runId: string): string;
|
|
4820
|
+
/**
|
|
4821
|
+
* sha256 hex over the JCS canonical serialization of a run's args: the
|
|
4822
|
+
* value the engine records as `RunMeta.argsHash` at genesis, exposed so
|
|
4823
|
+
* hosts can verify re-supplied resume args against the recorded hash
|
|
4824
|
+
* (the v1.23.0 review: a resume that silently drops or changes args
|
|
4825
|
+
* changes the logical run and pays again). Returns undefined for
|
|
4826
|
+
* undefined args (a run started without args records none). Throws when
|
|
4827
|
+
* JCS cannot serialize the value (functions, cycles, non-finite
|
|
4828
|
+
* numbers); the engine then records `argsProvided` without a hash.
|
|
4829
|
+
*/
|
|
4830
|
+
declare function hashRunArgs(args: unknown): string | undefined;
|
|
4781
4831
|
declare function createEngine(options: CreateEngineOptions): Engine;
|
|
4782
4832
|
//#endregion
|
|
4783
4833
|
//#region src/orchestrator/handles.d.ts
|
|
@@ -5085,7 +5135,14 @@ interface OrchestratorExtensionIO {
|
|
|
5085
5135
|
/** Telemetry emission into the run event stream. */
|
|
5086
5136
|
emit(event: {
|
|
5087
5137
|
type: string;
|
|
5088
|
-
} & Record<string, unknown
|
|
5138
|
+
} & Record<string, unknown>, options?: {
|
|
5139
|
+
/**
|
|
5140
|
+
* Marks the event as the replay of a journal-recovered decision
|
|
5141
|
+
* (the standard envelope flag), so extension surfaces can emit
|
|
5142
|
+
* recovered admissions honestly (v1.22.0 review P2-5).
|
|
5143
|
+
*/
|
|
5144
|
+
replayed?: boolean;
|
|
5145
|
+
}): void;
|
|
5089
5146
|
}
|
|
5090
5147
|
/**
|
|
5091
5148
|
* The extension contract. PlanRunner implements it in @rulvar/plan; the
|
|
@@ -6421,12 +6478,31 @@ declare function buildOrchestratorTools(runtime: OrchestratorRuntime, profileCar
|
|
|
6421
6478
|
//#endregion
|
|
6422
6479
|
//#region src/engine/events.d.ts
|
|
6423
6480
|
/**
|
|
6481
|
+
* The distance between the telemetry counter bases of two consecutive
|
|
6482
|
+
* execution segments of one run: segment k of a run starts its event
|
|
6483
|
+
* `seq` and span counter at `k * EVENT_SEGMENT_STRIDE`. A single
|
|
6484
|
+
* segment would need over four billion events to reach the next base,
|
|
6485
|
+
* so `seq` stays strictly increasing and `spanId` unique across
|
|
6486
|
+
* suspend/resume and process recreation while remaining an ordinary
|
|
6487
|
+
* safe-integer number (v1.22.0 review P1-2). Informational for
|
|
6488
|
+
* consumers: treat `seq` as ordered and `spanId` as opaque, never
|
|
6489
|
+
* parse segment structure out of either.
|
|
6490
|
+
*/
|
|
6491
|
+
declare const EVENT_SEGMENT_STRIDE: number;
|
|
6492
|
+
/**
|
|
6424
6493
|
* Spans form a tree per run; spanId values are engine-minted opaque
|
|
6425
6494
|
* strings, unique per run, pure telemetry, never identity.
|
|
6426
6495
|
*/
|
|
6427
6496
|
declare class SpanRegistry {
|
|
6428
6497
|
private readonly parents;
|
|
6429
6498
|
private counter;
|
|
6499
|
+
constructor(options?: {
|
|
6500
|
+
/**
|
|
6501
|
+
* First counter value (default 0): the resumed-segment base that
|
|
6502
|
+
* keeps span ids unique per run across segments.
|
|
6503
|
+
*/
|
|
6504
|
+
first?: number;
|
|
6505
|
+
});
|
|
6430
6506
|
mint(parentSpanId?: string): string;
|
|
6431
6507
|
parentOf(spanId: string): string | undefined;
|
|
6432
6508
|
}
|
|
@@ -6455,14 +6531,25 @@ declare class EventBus {
|
|
|
6455
6531
|
* identity by construction, so masking cannot perturb replay.
|
|
6456
6532
|
*/
|
|
6457
6533
|
maskEvents?: boolean;
|
|
6534
|
+
/**
|
|
6535
|
+
* First seq value (default 0): the resumed-segment base that keeps
|
|
6536
|
+
* seq strictly increasing per run across segments (v1.22.0 review
|
|
6537
|
+
* P1-2).
|
|
6538
|
+
*/
|
|
6539
|
+
firstSeq?: number;
|
|
6458
6540
|
});
|
|
6459
6541
|
emit(body: WorkflowEventBody, spanId: string, replayed?: boolean): WorkflowEvent;
|
|
6460
6542
|
/**
|
|
6461
6543
|
* A throwing on() listener is isolated (its work is best-effort
|
|
6462
6544
|
* telemetry), and the failure surfaces ONCE as a warn log on this bus
|
|
6463
|
-
* rather than propagating into the run. The
|
|
6464
|
-
*
|
|
6465
|
-
*
|
|
6545
|
+
* rather than propagating into the run. The warn goes through emit()
|
|
6546
|
+
* itself, AFTER the triggering event's fan-out completed: it is
|
|
6547
|
+
* masked exactly like every other event (a secret-shaped fragment of
|
|
6548
|
+
* the listener's error message never reaches observers raw), its seq
|
|
6549
|
+
* is stamped at delivery, and every surface sees [event, warn] in
|
|
6550
|
+
* that order. The guard is set before the recursive emit, so a
|
|
6551
|
+
* listener that also throws on the warn cannot re-arm the report or
|
|
6552
|
+
* recurse (v1.22.0 review P2-1).
|
|
6466
6553
|
*/
|
|
6467
6554
|
private reportListenerError;
|
|
6468
6555
|
on<T extends WorkflowEvent["type"]>(type: T, cb: (event: Extract<WorkflowEvent, {
|
|
@@ -6535,6 +6622,14 @@ interface SandboxBridge {
|
|
|
6535
6622
|
/** Releases the activity token and rejects outstanding thunks. */
|
|
6536
6623
|
close(): void;
|
|
6537
6624
|
}
|
|
6625
|
+
/**
|
|
6626
|
+
* The sanctioned JSON subset of AgentOpts a sandbox script may pass:
|
|
6627
|
+
* the planner-dialect allowlist. Exported as the single source both for
|
|
6628
|
+
* the runtime validator below and for the planner API card, so the two
|
|
6629
|
+
* can never drift (v1.22.0 review P2-4: the hand-maintained card had
|
|
6630
|
+
* silently fallen three options behind).
|
|
6631
|
+
*/
|
|
6632
|
+
declare const SANDBOX_AGENT_OPT_KEYS: readonly string[];
|
|
6538
6633
|
declare function createSandboxBridge(ctx: Ctx<never>, options: SandboxBridgeOptions): SandboxBridge;
|
|
6539
6634
|
//#endregion
|
|
6540
|
-
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, 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 };
|
|
6635
|
+
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, hashRunArgs, 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
|
@@ -5455,6 +5455,20 @@ var JournalMatcher = class {
|
|
|
5455
5455
|
* Full contract: https://docs.rulvar.com/guide/journal; architecture
|
|
5456
5456
|
* overview: https://docs.rulvar.com/guide/architecture.
|
|
5457
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
|
+
}
|
|
5458
5472
|
/** Large-value soft warn threshold (committed for M2). */
|
|
5459
5473
|
const LARGE_VALUE_WARN_BYTES = 262144;
|
|
5460
5474
|
/**
|
|
@@ -5498,9 +5512,9 @@ var Replayer = class {
|
|
|
5498
5512
|
this.entries.push(entry);
|
|
5499
5513
|
if (entry.seq >= this.seq) this.seq = entry.seq + 1;
|
|
5500
5514
|
if (entry.ref === void 0 && entry.kind !== "resolution" && entry.kind !== "abandon" && entry.hashVersion === 2) {
|
|
5501
|
-
const ordinalKey =
|
|
5502
|
-
const
|
|
5503
|
-
if (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);
|
|
5504
5518
|
}
|
|
5505
5519
|
}
|
|
5506
5520
|
}
|
|
@@ -5744,7 +5758,7 @@ var Replayer = class {
|
|
|
5744
5758
|
await this.queue;
|
|
5745
5759
|
}
|
|
5746
5760
|
mint(scope, key, kind, status) {
|
|
5747
|
-
const ordinalKey =
|
|
5761
|
+
const ordinalKey = ordinalMapKey(scope, 2, key);
|
|
5748
5762
|
const ordinal = this.ordinals.get(ordinalKey) ?? 0;
|
|
5749
5763
|
this.ordinals.set(ordinalKey, ordinal + 1);
|
|
5750
5764
|
const entry = {
|
|
@@ -5762,6 +5776,11 @@ var Replayer = class {
|
|
|
5762
5776
|
return entry;
|
|
5763
5777
|
}
|
|
5764
5778
|
async persist(entry) {
|
|
5779
|
+
if (this.strict) throw new JournalMissError(`replay-strict: refusing to append a '${entry.kind}' entry during a dry-run preview; a preview performs zero journal mutations`, { data: {
|
|
5780
|
+
scope: entry.scope,
|
|
5781
|
+
kind: entry.kind,
|
|
5782
|
+
miss: "append"
|
|
5783
|
+
} });
|
|
5765
5784
|
const shapeIssues = validateEntryShape(entry);
|
|
5766
5785
|
if (shapeIssues.length > 0) throw new ConfigError(`journal entry shape violation (kind '${entry.kind}'): ` + shapeIssues.map((i) => i.message).join("; "));
|
|
5767
5786
|
await this.store.append(this.runId, entry, this.lease);
|
|
@@ -5925,7 +5944,7 @@ var ExternalRegistry = class ExternalRegistry {
|
|
|
5925
5944
|
* until a resolution wins the first-closing-wins fold.
|
|
5926
5945
|
*/
|
|
5927
5946
|
async awaitExternal(scope, spanId, key, options) {
|
|
5928
|
-
const scopeKey = `${scope}
|
|
5947
|
+
const scopeKey = `${scope}\u0000${key}`;
|
|
5929
5948
|
if (this.keysByScope.has(scopeKey)) throw new ConfigError(`duplicate awaitExternal key '${key}' in scope '${scope}'`);
|
|
5930
5949
|
this.keysByScope.add(scopeKey);
|
|
5931
5950
|
const identity = {
|
|
@@ -8242,7 +8261,7 @@ async function runAgent(options) {
|
|
|
8242
8261
|
const primaryRole = options.role ?? "loop";
|
|
8243
8262
|
const usageByPhaseModel = /* @__PURE__ */ new Map();
|
|
8244
8263
|
const addPhaseUsage = (role, ref, usage) => {
|
|
8245
|
-
const key = `${role}
|
|
8264
|
+
const key = `${role}\u0000${ref}`;
|
|
8246
8265
|
const prior = usageByPhaseModel.get(key);
|
|
8247
8266
|
usageByPhaseModel.set(key, {
|
|
8248
8267
|
role,
|
|
@@ -10364,6 +10383,26 @@ function runtimeOf(ctx) {
|
|
|
10364
10383
|
return runtime;
|
|
10365
10384
|
}
|
|
10366
10385
|
//#endregion
|
|
10386
|
+
//#region src/engine/spawn-events.ts
|
|
10387
|
+
function emitSpawnAdmitted(events, input) {
|
|
10388
|
+
events.emit({
|
|
10389
|
+
type: "spawn:admitted",
|
|
10390
|
+
entryRef: input.entryRef,
|
|
10391
|
+
verdict: input.verdict,
|
|
10392
|
+
agentType: input.agentType,
|
|
10393
|
+
logicalTaskId: input.logicalTaskId,
|
|
10394
|
+
...input.spawnUnitsAfter === void 0 ? {} : { spawnUnitsAfter: input.spawnUnitsAfter }
|
|
10395
|
+
}, input.spanId, input.replayed);
|
|
10396
|
+
}
|
|
10397
|
+
function emitSpawnRejected(events, input) {
|
|
10398
|
+
events.emit({
|
|
10399
|
+
type: "spawn:rejected",
|
|
10400
|
+
...input.entryRef === void 0 ? {} : { entryRef: input.entryRef },
|
|
10401
|
+
code: input.code,
|
|
10402
|
+
agentType: input.agentType
|
|
10403
|
+
}, input.spanId, input.replayed);
|
|
10404
|
+
}
|
|
10405
|
+
//#endregion
|
|
10367
10406
|
//#region src/engine/ctx.ts
|
|
10368
10407
|
/**
|
|
10369
10408
|
* Ctx primitives (M1-T07) plus the parallel/pipeline composition semantics
|
|
@@ -10899,14 +10938,23 @@ function createCtx(internals, rootWorkflow) {
|
|
|
10899
10938
|
claimed.add(prior.seq);
|
|
10900
10939
|
const recorded = prior.value;
|
|
10901
10940
|
if (recorded.reject !== void 0) {
|
|
10902
|
-
internals.events
|
|
10903
|
-
type: "spawn:rejected",
|
|
10941
|
+
emitSpawnRejected(internals.events, {
|
|
10904
10942
|
entryRef: prior.seq,
|
|
10905
10943
|
code: recorded.reject.code,
|
|
10906
|
-
agentType
|
|
10907
|
-
|
|
10944
|
+
agentType,
|
|
10945
|
+
spanId: state.spanId,
|
|
10946
|
+
replayed: true
|
|
10947
|
+
});
|
|
10908
10948
|
throw new AdmissionRejectedError(`lineage admission rejected agent spawn (${recorded.reject.code}; recorded verdict)`, { data: { reason: recorded.reject } });
|
|
10909
10949
|
}
|
|
10950
|
+
emitSpawnAdmitted(internals.events, {
|
|
10951
|
+
entryRef: prior.seq,
|
|
10952
|
+
verdict: "admit",
|
|
10953
|
+
agentType,
|
|
10954
|
+
logicalTaskId: recorded.lineage?.logicalTaskId ?? "unknown",
|
|
10955
|
+
spanId: state.spanId,
|
|
10956
|
+
replayed: true
|
|
10957
|
+
});
|
|
10910
10958
|
} else {
|
|
10911
10959
|
const evaluated = admission.evaluateLineage({
|
|
10912
10960
|
name: agentType,
|
|
@@ -10938,15 +10986,22 @@ function createCtx(internals, rootWorkflow) {
|
|
|
10938
10986
|
value: decisionValue
|
|
10939
10987
|
});
|
|
10940
10988
|
if (evaluated.decision.kind === "reject") {
|
|
10941
|
-
internals.events
|
|
10942
|
-
type: "spawn:rejected",
|
|
10989
|
+
emitSpawnRejected(internals.events, {
|
|
10943
10990
|
entryRef: decisionEntry.seq,
|
|
10944
10991
|
code: evaluated.decision.reason.code,
|
|
10945
|
-
agentType
|
|
10946
|
-
|
|
10992
|
+
agentType,
|
|
10993
|
+
spanId: state.spanId
|
|
10994
|
+
});
|
|
10947
10995
|
throw new AdmissionRejectedError(`lineage admission rejected agent spawn (${evaluated.decision.reason.code})`, { data: { reason: evaluated.decision.reason } });
|
|
10948
10996
|
}
|
|
10949
10997
|
admission.registerLineageAdmit(evaluated.decision.lineage.logicalTaskId);
|
|
10998
|
+
emitSpawnAdmitted(internals.events, {
|
|
10999
|
+
entryRef: decisionEntry.seq,
|
|
11000
|
+
verdict: "admit",
|
|
11001
|
+
agentType,
|
|
11002
|
+
logicalTaskId: evaluated.decision.lineage.logicalTaskId,
|
|
11003
|
+
spanId: state.spanId
|
|
11004
|
+
});
|
|
10950
11005
|
}
|
|
10951
11006
|
}
|
|
10952
11007
|
const adapter = adapterOf(loopResolved);
|
|
@@ -11506,7 +11561,7 @@ function createCtx(internals, rootWorkflow) {
|
|
|
11506
11561
|
*/
|
|
11507
11562
|
const workflowOrdinals = /* @__PURE__ */ new Map();
|
|
11508
11563
|
const nextWorkflowOrdinal = (scope, name) => {
|
|
11509
|
-
const counterKey = `${scope}
|
|
11564
|
+
const counterKey = `${scope}\u0000${name}`;
|
|
11510
11565
|
const ordinal = workflowOrdinals.get(counterKey) ?? 0;
|
|
11511
11566
|
workflowOrdinals.set(counterKey, ordinal + 1);
|
|
11512
11567
|
return ordinal;
|
|
@@ -11587,8 +11642,12 @@ function createCtx(internals, rootWorkflow) {
|
|
|
11587
11642
|
return value?.decisionType === "spawn-admission" && value.childScope === childScope;
|
|
11588
11643
|
});
|
|
11589
11644
|
let verdict;
|
|
11645
|
+
let decisionEntrySeq;
|
|
11646
|
+
let decisionReplayed = false;
|
|
11590
11647
|
if (prior !== void 0) {
|
|
11591
11648
|
verdict = prior.value.decision.verdict;
|
|
11649
|
+
decisionEntrySeq = prior.seq;
|
|
11650
|
+
decisionReplayed = true;
|
|
11592
11651
|
if (verdict.kind !== "reject") admission.recoverInFlight(budgetAccount, verdict);
|
|
11593
11652
|
} else {
|
|
11594
11653
|
const decision = admission.admit({
|
|
@@ -11604,7 +11663,7 @@ function createCtx(internals, rootWorkflow) {
|
|
|
11604
11663
|
}
|
|
11605
11664
|
});
|
|
11606
11665
|
verdict = decision.verdict;
|
|
11607
|
-
await internals.replayer.appendSinglePhase({
|
|
11666
|
+
decisionEntrySeq = (await internals.replayer.appendSinglePhase({
|
|
11608
11667
|
scope: state.scope,
|
|
11609
11668
|
key: "",
|
|
11610
11669
|
kind: "decision",
|
|
@@ -11618,10 +11677,28 @@ function createCtx(internals, rootWorkflow) {
|
|
|
11618
11677
|
parentAccountScope: budgetAccount,
|
|
11619
11678
|
decision
|
|
11620
11679
|
}
|
|
11680
|
+
})).seq;
|
|
11681
|
+
}
|
|
11682
|
+
if (verdict.kind === "reject") {
|
|
11683
|
+
emitSpawnRejected(internals.events, {
|
|
11684
|
+
entryRef: decisionEntrySeq,
|
|
11685
|
+
code: verdict.reason.code,
|
|
11686
|
+
agentType: name,
|
|
11687
|
+
spanId,
|
|
11688
|
+
replayed: decisionReplayed ? true : void 0
|
|
11621
11689
|
});
|
|
11690
|
+
throw rejectionError(verdict.reason, name);
|
|
11622
11691
|
}
|
|
11623
|
-
if (verdict.kind === "reject") throw rejectionError(verdict.reason, name);
|
|
11624
11692
|
if (verdict.kind !== "admit") throw new ConfigError(`admission verdict '${verdict.kind}' has no producer before M7 (DEF-5)`);
|
|
11693
|
+
emitSpawnAdmitted(internals.events, {
|
|
11694
|
+
entryRef: decisionEntrySeq,
|
|
11695
|
+
verdict: verdict.kind,
|
|
11696
|
+
agentType: name,
|
|
11697
|
+
logicalTaskId: verdict.lineage.logicalTaskId,
|
|
11698
|
+
spawnUnitsAfter: verdict.spawnUnitsAfter,
|
|
11699
|
+
spanId,
|
|
11700
|
+
replayed: decisionReplayed ? true : void 0
|
|
11701
|
+
});
|
|
11625
11702
|
const reserve = verdict.reserve;
|
|
11626
11703
|
const openOptions = { parentScope: budgetAccount };
|
|
11627
11704
|
if (reserve.childCeilingUsd !== void 0) {
|
|
@@ -12152,7 +12229,7 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
12152
12229
|
},
|
|
12153
12230
|
registerAlias: (donorScope, targetScope) => internals.replayer.registerAlias(donorScope, targetScope),
|
|
12154
12231
|
priceUsd: (servedBy, usage) => servedBy === void 0 ? void 0 : internals.priceUsd(servedBy, usage),
|
|
12155
|
-
emit: (event) => internals.events.emit(event, callingState.spanId)
|
|
12232
|
+
emit: (event, options) => internals.events.emit(event, callingState.spanId, options?.replayed)
|
|
12156
12233
|
};
|
|
12157
12234
|
const cancelByHandle = async (handle, _reason) => {
|
|
12158
12235
|
const record = records.get(handle);
|
|
@@ -12196,15 +12273,31 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
12196
12273
|
if (entry.kind !== "decision" || entry.scope !== callingState.scope) return false;
|
|
12197
12274
|
const value = entry.value;
|
|
12198
12275
|
return value?.decisionType === "spawn-admission" && (value.origin === "spawn_agent" || value.origin === "parallel_agents");
|
|
12199
|
-
}).map((entry) =>
|
|
12200
|
-
|
|
12276
|
+
}).map((entry) => ({
|
|
12277
|
+
entrySeq: entry.seq,
|
|
12278
|
+
value: entry.value
|
|
12279
|
+
})).sort((a, b) => a.value.spawnOrdinal - b.value.spawnOrdinal);
|
|
12280
|
+
for (const { entrySeq, value } of admissions) {
|
|
12201
12281
|
nextOrdinal = Math.max(nextOrdinal, value.spawnOrdinal + 1);
|
|
12202
12282
|
const decision = value.decision;
|
|
12203
12283
|
recoveredSpecByOrdinal.set(value.spawnOrdinal, value.spec);
|
|
12284
|
+
const recoveredAgentType = value.spec?.agentType ?? "unknown";
|
|
12204
12285
|
if (decision.verdict.kind !== "admit") {
|
|
12205
|
-
rejectedByOrdinal.set(value.spawnOrdinal,
|
|
12286
|
+
rejectedByOrdinal.set(value.spawnOrdinal, {
|
|
12287
|
+
decision,
|
|
12288
|
+
entrySeq
|
|
12289
|
+
});
|
|
12206
12290
|
continue;
|
|
12207
12291
|
}
|
|
12292
|
+
emitSpawnAdmitted(internals.events, {
|
|
12293
|
+
entryRef: entrySeq,
|
|
12294
|
+
verdict: decision.verdict.kind,
|
|
12295
|
+
agentType: recoveredAgentType,
|
|
12296
|
+
logicalTaskId: decision.verdict.lineage.logicalTaskId,
|
|
12297
|
+
spawnUnitsAfter: decision.verdict.spawnUnitsAfter,
|
|
12298
|
+
spanId: callingState.spanId,
|
|
12299
|
+
replayed: true
|
|
12300
|
+
});
|
|
12208
12301
|
admission.recoverChild(currentScope);
|
|
12209
12302
|
const childScope = value.childScope ?? value.orchestratorScope;
|
|
12210
12303
|
const record = await dispatchChild(value.spec, value.spawnOrdinal, {
|
|
@@ -12355,7 +12448,17 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
12355
12448
|
const recovered = byOrdinal.get(spawnOrdinal);
|
|
12356
12449
|
if (recovered !== void 0 && specMatches) return { handle: recovered.handle };
|
|
12357
12450
|
const recoveredRejection = rejectedByOrdinal.get(spawnOrdinal);
|
|
12358
|
-
if (recoveredRejection !== void 0 && specMatches)
|
|
12451
|
+
if (recoveredRejection !== void 0 && specMatches) {
|
|
12452
|
+
const reason = recoveredRejection.decision.verdict;
|
|
12453
|
+
emitSpawnRejected(internals.events, {
|
|
12454
|
+
entryRef: recoveredRejection.entrySeq,
|
|
12455
|
+
code: reason.reason?.code ?? "unknown",
|
|
12456
|
+
agentType: params.agentType,
|
|
12457
|
+
spanId: callingState.spanId,
|
|
12458
|
+
replayed: true
|
|
12459
|
+
});
|
|
12460
|
+
throw new AdmissionRejectedError(`admission rejected spawn ordinal ${String(spawnOrdinal)} (recovered verdict)`, { data: { decision: recoveredRejection.decision } });
|
|
12461
|
+
}
|
|
12359
12462
|
if (opts?.maxSpawns !== void 0 && spawnOrdinal >= opts.maxSpawns) {
|
|
12360
12463
|
internals.events.emit({
|
|
12361
12464
|
type: "spawn:rejected",
|
|
@@ -12407,24 +12510,27 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
12407
12510
|
value: admissionValue
|
|
12408
12511
|
});
|
|
12409
12512
|
if (decision.verdict.kind === "reject") {
|
|
12410
|
-
rejectedByOrdinal.set(spawnOrdinal,
|
|
12411
|
-
|
|
12412
|
-
|
|
12513
|
+
rejectedByOrdinal.set(spawnOrdinal, {
|
|
12514
|
+
decision,
|
|
12515
|
+
entrySeq: decisionEntry.seq
|
|
12516
|
+
});
|
|
12517
|
+
emitSpawnRejected(internals.events, {
|
|
12413
12518
|
entryRef: decisionEntry.seq,
|
|
12414
12519
|
code: decision.verdict.reason.code,
|
|
12415
|
-
agentType: params.agentType
|
|
12416
|
-
|
|
12520
|
+
agentType: params.agentType,
|
|
12521
|
+
spanId: callingState.spanId
|
|
12522
|
+
});
|
|
12417
12523
|
throw new AdmissionRejectedError(`admission rejected spawn_agent '${params.agentType}' (${decision.verdict.reason.code})`, { data: { reason: decision.verdict.reason } });
|
|
12418
12524
|
}
|
|
12419
12525
|
if (decision.verdict.kind !== "admit") throw new ConfigError(`admission verdict '${decision.verdict.kind}' has no producer before M7 (DEF-5)`);
|
|
12420
|
-
internals.events
|
|
12421
|
-
type: "spawn:admitted",
|
|
12526
|
+
emitSpawnAdmitted(internals.events, {
|
|
12422
12527
|
entryRef: decisionEntry.seq,
|
|
12423
12528
|
verdict: decision.verdict.kind,
|
|
12424
12529
|
agentType: params.agentType,
|
|
12425
12530
|
logicalTaskId: decision.verdict.lineage.logicalTaskId,
|
|
12426
|
-
spawnUnitsAfter: decision.verdict.spawnUnitsAfter
|
|
12427
|
-
|
|
12531
|
+
spawnUnitsAfter: decision.verdict.spawnUnitsAfter,
|
|
12532
|
+
spanId: callingState.spanId
|
|
12533
|
+
});
|
|
12428
12534
|
return { handle: (await dispatchChild(params, spawnOrdinal, {
|
|
12429
12535
|
nodeId: decision.nodeId ?? "unknown",
|
|
12430
12536
|
logicalTaskId: decision.verdict.lineage.logicalTaskId
|
|
@@ -12727,12 +12833,27 @@ function orchestrate(engine, goal, opts, runOptions) {
|
|
|
12727
12833
|
* Full contract: https://docs.rulvar.com/guide/observability.
|
|
12728
12834
|
*/
|
|
12729
12835
|
/**
|
|
12836
|
+
* The distance between the telemetry counter bases of two consecutive
|
|
12837
|
+
* execution segments of one run: segment k of a run starts its event
|
|
12838
|
+
* `seq` and span counter at `k * EVENT_SEGMENT_STRIDE`. A single
|
|
12839
|
+
* segment would need over four billion events to reach the next base,
|
|
12840
|
+
* so `seq` stays strictly increasing and `spanId` unique across
|
|
12841
|
+
* suspend/resume and process recreation while remaining an ordinary
|
|
12842
|
+
* safe-integer number (v1.22.0 review P1-2). Informational for
|
|
12843
|
+
* consumers: treat `seq` as ordered and `spanId` as opaque, never
|
|
12844
|
+
* parse segment structure out of either.
|
|
12845
|
+
*/
|
|
12846
|
+
const EVENT_SEGMENT_STRIDE = 2 ** 32;
|
|
12847
|
+
/**
|
|
12730
12848
|
* Spans form a tree per run; spanId values are engine-minted opaque
|
|
12731
12849
|
* strings, unique per run, pure telemetry, never identity.
|
|
12732
12850
|
*/
|
|
12733
12851
|
var SpanRegistry = class {
|
|
12734
12852
|
parents = /* @__PURE__ */ new Map();
|
|
12735
|
-
counter
|
|
12853
|
+
counter;
|
|
12854
|
+
constructor(options) {
|
|
12855
|
+
this.counter = options?.first ?? 0;
|
|
12856
|
+
}
|
|
12736
12857
|
mint(parentSpanId) {
|
|
12737
12858
|
const spanId = `s${this.counter++}`;
|
|
12738
12859
|
if (parentSpanId !== void 0) this.parents.set(spanId, parentSpanId);
|
|
@@ -12754,7 +12875,7 @@ var EventBus = class {
|
|
|
12754
12875
|
maskEvents;
|
|
12755
12876
|
subscribers = /* @__PURE__ */ new Set();
|
|
12756
12877
|
listeners = /* @__PURE__ */ new Set();
|
|
12757
|
-
seq
|
|
12878
|
+
seq;
|
|
12758
12879
|
ended = false;
|
|
12759
12880
|
listenerErrorReported = false;
|
|
12760
12881
|
constructor(options) {
|
|
@@ -12762,6 +12883,7 @@ var EventBus = class {
|
|
|
12762
12883
|
this.spans = options.spans;
|
|
12763
12884
|
this.now = options.now ?? realNow;
|
|
12764
12885
|
this.maskEvents = options.maskEvents ?? true;
|
|
12886
|
+
this.seq = options.firstSeq ?? 0;
|
|
12765
12887
|
}
|
|
12766
12888
|
emit(body, spanId, replayed) {
|
|
12767
12889
|
const parentSpanId = this.spans.parentOf(spanId);
|
|
@@ -12775,39 +12897,40 @@ var EventBus = class {
|
|
|
12775
12897
|
...replayed === true ? { replayed: true } : {},
|
|
12776
12898
|
...safeBody
|
|
12777
12899
|
};
|
|
12900
|
+
let listenerFailure;
|
|
12901
|
+
let sawListenerFailure = false;
|
|
12778
12902
|
for (const listener of this.listeners) try {
|
|
12779
12903
|
listener(event);
|
|
12780
12904
|
} catch (thrown) {
|
|
12781
|
-
|
|
12905
|
+
if (!sawListenerFailure) {
|
|
12906
|
+
sawListenerFailure = true;
|
|
12907
|
+
listenerFailure = thrown;
|
|
12908
|
+
}
|
|
12782
12909
|
}
|
|
12783
12910
|
for (const subscriber of this.subscribers) subscriber.push(event);
|
|
12911
|
+
if (sawListenerFailure) this.reportListenerError(listenerFailure, spanId);
|
|
12784
12912
|
return event;
|
|
12785
12913
|
}
|
|
12786
12914
|
/**
|
|
12787
12915
|
* A throwing on() listener is isolated (its work is best-effort
|
|
12788
12916
|
* telemetry), and the failure surfaces ONCE as a warn log on this bus
|
|
12789
|
-
* rather than propagating into the run. The
|
|
12790
|
-
*
|
|
12791
|
-
*
|
|
12917
|
+
* rather than propagating into the run. The warn goes through emit()
|
|
12918
|
+
* itself, AFTER the triggering event's fan-out completed: it is
|
|
12919
|
+
* masked exactly like every other event (a secret-shaped fragment of
|
|
12920
|
+
* the listener's error message never reaches observers raw), its seq
|
|
12921
|
+
* is stamped at delivery, and every surface sees [event, warn] in
|
|
12922
|
+
* that order. The guard is set before the recursive emit, so a
|
|
12923
|
+
* listener that also throws on the warn cannot re-arm the report or
|
|
12924
|
+
* recurse (v1.22.0 review P2-1).
|
|
12792
12925
|
*/
|
|
12793
12926
|
reportListenerError(thrown, spanId) {
|
|
12794
12927
|
if (this.listenerErrorReported) return;
|
|
12795
12928
|
this.listenerErrorReported = true;
|
|
12796
|
-
|
|
12797
|
-
const warn = {
|
|
12798
|
-
runId: this.runId,
|
|
12799
|
-
seq: this.seq++,
|
|
12800
|
-
ts: new Date(this.now()).toISOString(),
|
|
12801
|
-
spanId,
|
|
12802
|
-
...parentSpanId === void 0 ? {} : { parentSpanId },
|
|
12929
|
+
this.emit({
|
|
12803
12930
|
type: "log",
|
|
12804
12931
|
level: "warn",
|
|
12805
12932
|
msg: "an event listener threw and was isolated so the run is unaffected: " + (thrown instanceof Error ? thrown.message : String(thrown))
|
|
12806
|
-
};
|
|
12807
|
-
for (const listener of this.listeners) try {
|
|
12808
|
-
listener(warn);
|
|
12809
|
-
} catch {}
|
|
12810
|
-
for (const subscriber of this.subscribers) subscriber.push(warn);
|
|
12933
|
+
}, spanId);
|
|
12811
12934
|
}
|
|
12812
12935
|
on(type, cb) {
|
|
12813
12936
|
const listener = (event) => {
|
|
@@ -12982,6 +13105,20 @@ function hashWorkflowSource(source) {
|
|
|
12982
13105
|
function workflowSourceRef(runId) {
|
|
12983
13106
|
return `${runId}/workflow-source`;
|
|
12984
13107
|
}
|
|
13108
|
+
/**
|
|
13109
|
+
* sha256 hex over the JCS canonical serialization of a run's args: the
|
|
13110
|
+
* value the engine records as `RunMeta.argsHash` at genesis, exposed so
|
|
13111
|
+
* hosts can verify re-supplied resume args against the recorded hash
|
|
13112
|
+
* (the v1.23.0 review: a resume that silently drops or changes args
|
|
13113
|
+
* changes the logical run and pays again). Returns undefined for
|
|
13114
|
+
* undefined args (a run started without args records none). Throws when
|
|
13115
|
+
* JCS cannot serialize the value (functions, cycles, non-finite
|
|
13116
|
+
* numbers); the engine then records `argsProvided` without a hash.
|
|
13117
|
+
*/
|
|
13118
|
+
function hashRunArgs(args) {
|
|
13119
|
+
if (args === void 0) return;
|
|
13120
|
+
return createHash("sha256").update(jcsSerialize(args), "utf8").digest("hex");
|
|
13121
|
+
}
|
|
12985
13122
|
function createEngine(options) {
|
|
12986
13123
|
const adapters = buildAdapterRegistry(options.adapters);
|
|
12987
13124
|
const rawJournal = options.stores?.journal ?? new InMemoryStore();
|
|
@@ -13012,12 +13149,15 @@ function createEngine(options) {
|
|
|
13012
13149
|
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 ");
|
|
13013
13150
|
const runId = resumeCtx?.runId ?? opts?.runId ?? mintRunId();
|
|
13014
13151
|
const registry = buildDeriverRegistry(options.extraDerivers);
|
|
13015
|
-
const
|
|
13152
|
+
const segmentsBefore = resumeCtx?.segmentsBefore ?? 0;
|
|
13153
|
+
const telemetryBase = segmentsBefore * EVENT_SEGMENT_STRIDE;
|
|
13154
|
+
const spans = new SpanRegistry({ first: telemetryBase });
|
|
13016
13155
|
const bus = new EventBus({
|
|
13017
13156
|
runId,
|
|
13018
13157
|
spans,
|
|
13019
13158
|
now: realNow,
|
|
13020
|
-
maskEvents
|
|
13159
|
+
maskEvents,
|
|
13160
|
+
firstSeq: telemetryBase
|
|
13021
13161
|
});
|
|
13022
13162
|
const rootSpanId = spans.mint();
|
|
13023
13163
|
let budgetSeed;
|
|
@@ -13096,7 +13236,7 @@ function createEngine(options) {
|
|
|
13096
13236
|
...options.budgetDefaults?.flatReserveUsd === void 0 ? {} : { flatReserveUsd: options.budgetDefaults.flatReserveUsd },
|
|
13097
13237
|
...defaults.roleFloors === void 0 ? {} : { floors: defaults.roleFloors },
|
|
13098
13238
|
...knowledge === void 0 ? {} : { knowledge },
|
|
13099
|
-
events: { emit: (body, spanId) => bus.emit(body, spanId ?? rootSpanId) },
|
|
13239
|
+
events: { emit: (body, spanId, replayed) => bus.emit(body, spanId ?? rootSpanId, replayed) },
|
|
13100
13240
|
spans,
|
|
13101
13241
|
rootSpanId,
|
|
13102
13242
|
transcripts,
|
|
@@ -13139,13 +13279,27 @@ function createEngine(options) {
|
|
|
13139
13279
|
mintTranscriptRef: () => `${runId}/t${transcriptCounter++}`,
|
|
13140
13280
|
now: realNow
|
|
13141
13281
|
};
|
|
13142
|
-
const
|
|
13282
|
+
const argsBinding = {};
|
|
13283
|
+
if (resumeCtx === void 0) {
|
|
13284
|
+
argsBinding.argsProvided = args !== void 0;
|
|
13285
|
+
try {
|
|
13286
|
+
const argsHash = hashRunArgs(args);
|
|
13287
|
+
if (argsHash !== void 0) argsBinding.argsHash = argsHash;
|
|
13288
|
+
} catch {}
|
|
13289
|
+
} else {
|
|
13290
|
+
if (resumeCtx.argsProvided !== void 0) argsBinding.argsProvided = resumeCtx.argsProvided;
|
|
13291
|
+
if (resumeCtx.argsHash !== void 0) argsBinding.argsHash = resumeCtx.argsHash;
|
|
13292
|
+
}
|
|
13293
|
+
const putMeta = (status) => resumeCtx?.strict === true ? Promise.resolve() : journal.putMeta({
|
|
13143
13294
|
runId,
|
|
13144
13295
|
status,
|
|
13296
|
+
segments: segmentsBefore + 1,
|
|
13145
13297
|
updatedAt: new Date(realNow()).toISOString(),
|
|
13146
13298
|
...opts?.name === void 0 ? {} : { name: opts.name },
|
|
13147
13299
|
...opts?.tags === void 0 ? {} : { tags: opts.tags },
|
|
13148
13300
|
...ceilingUsd === void 0 ? {} : { budgetUsd: ceilingUsd },
|
|
13301
|
+
...argsBinding.argsProvided === void 0 ? {} : { argsProvided: argsBinding.argsProvided },
|
|
13302
|
+
...argsBinding.argsHash === void 0 ? {} : { argsHash: argsBinding.argsHash },
|
|
13149
13303
|
workflowName: wf.name,
|
|
13150
13304
|
workflowHash: compiled === void 0 ? hashWorkflowBody(wf) : hashWorkflowSource(compiled.source),
|
|
13151
13305
|
...compiled === void 0 ? {} : { workflowSourceRef: workflowSourceRef(runId) }
|
|
@@ -13157,7 +13311,7 @@ function createEngine(options) {
|
|
|
13157
13311
|
let value;
|
|
13158
13312
|
let wireError;
|
|
13159
13313
|
let pending = [];
|
|
13160
|
-
if (compiled !== void 0) await transcripts.put(workflowSourceRef(runId), new TextEncoder().encode(compiled.source));
|
|
13314
|
+
if (compiled !== void 0 && resumeCtx?.strict !== true) await transcripts.put(workflowSourceRef(runId), new TextEncoder().encode(compiled.source));
|
|
13161
13315
|
await putMeta("running");
|
|
13162
13316
|
bus.emit({
|
|
13163
13317
|
type: "run:start",
|
|
@@ -13329,6 +13483,9 @@ function createEngine(options) {
|
|
|
13329
13483
|
invalidate: resumeOptions?.invalidate ?? [],
|
|
13330
13484
|
...resumeOptions?.lease === void 0 ? {} : { lease: resumeOptions.lease },
|
|
13331
13485
|
...typeof meta?.budgetUsd === "number" ? { budgetUsd: meta.budgetUsd } : {},
|
|
13486
|
+
segmentsBefore: typeof meta?.segments === "number" && meta.segments > 0 ? Math.floor(meta.segments) : 1,
|
|
13487
|
+
...typeof meta?.argsProvided === "boolean" ? { argsProvided: meta.argsProvided } : {},
|
|
13488
|
+
...typeof meta?.argsHash === "string" ? { argsHash: meta.argsHash } : {},
|
|
13332
13489
|
previewResolve
|
|
13333
13490
|
});
|
|
13334
13491
|
})();
|
|
@@ -13427,8 +13584,14 @@ function createEngine(options) {
|
|
|
13427
13584
|
* exactly like an in-process one (the token is re-acquired BEFORE any
|
|
13428
13585
|
* response is posted, closing the wake latency gap).
|
|
13429
13586
|
*/
|
|
13430
|
-
/**
|
|
13431
|
-
|
|
13587
|
+
/**
|
|
13588
|
+
* The sanctioned JSON subset of AgentOpts a sandbox script may pass:
|
|
13589
|
+
* the planner-dialect allowlist. Exported as the single source both for
|
|
13590
|
+
* the runtime validator below and for the planner API card, so the two
|
|
13591
|
+
* can never drift (v1.22.0 review P2-4: the hand-maintained card had
|
|
13592
|
+
* silently fallen three options behind).
|
|
13593
|
+
*/
|
|
13594
|
+
const SANDBOX_AGENT_OPT_KEYS = [
|
|
13432
13595
|
"agentType",
|
|
13433
13596
|
"model",
|
|
13434
13597
|
"effort",
|
|
@@ -13445,7 +13608,8 @@ const SANDBOX_AGENT_OPT_KEYS = /* @__PURE__ */ new Set([
|
|
|
13445
13608
|
"escalation",
|
|
13446
13609
|
"fallback",
|
|
13447
13610
|
"replay"
|
|
13448
|
-
]
|
|
13611
|
+
];
|
|
13612
|
+
const SANDBOX_AGENT_OPT_KEY_SET = new Set(SANDBOX_AGENT_OPT_KEYS);
|
|
13449
13613
|
function asRecord(value, what) {
|
|
13450
13614
|
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new ConfigError(`sandbox call ${what} must be a JSON object`);
|
|
13451
13615
|
return value;
|
|
@@ -13519,7 +13683,7 @@ function createSandboxBridge(ctx, options) {
|
|
|
13519
13683
|
const record = asRecord(params, "agent params");
|
|
13520
13684
|
if (typeof record.prompt !== "string") throw new ConfigError("sandbox agent call requires a string prompt");
|
|
13521
13685
|
const rawOpts = record.opts === void 0 ? {} : asRecord(record.opts, "agent options");
|
|
13522
|
-
for (const key of Object.keys(rawOpts)) if (!
|
|
13686
|
+
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(", "));
|
|
13523
13687
|
if (rawOpts.tools !== void 0) {
|
|
13524
13688
|
const tools = rawOpts.tools;
|
|
13525
13689
|
if (!(Array.isArray(tools) && tools.every((v) => typeof v === "string"))) throw new ConfigError("sandbox agent tools must be registered profile NAMES");
|
|
@@ -13682,4 +13846,4 @@ function createSandboxBridge(ctx, options) {
|
|
|
13682
13846
|
};
|
|
13683
13847
|
}
|
|
13684
13848
|
//#endregion
|
|
13685
|
-
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, 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 };
|
|
13849
|
+
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, hashRunArgs, 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.
|
|
3
|
+
"version": "1.24.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",
|