@rulvar/core 1.17.0 → 1.19.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 +48 -11
- package/dist/index.js +116 -33
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2921,8 +2921,11 @@ interface RunAgentOptions<S extends SchemaSpec = JsonSchema> {
|
|
|
2921
2921
|
* Finalize synthesis invocation (M4-T01), present only when the role
|
|
2922
2922
|
* trigger protocol fires it: configured in routing AND the toolset is
|
|
2923
2923
|
* non-empty. Runs after tools stop with toolChoice 'none' over the
|
|
2924
|
-
* full transcript
|
|
2925
|
-
*
|
|
2924
|
+
* full transcript plus a deterministic synthesis instruction appended
|
|
2925
|
+
* to the REQUEST only (the durable transcript keeps the raw history);
|
|
2926
|
+
* its text becomes the output for schema-less calls, a non-truncated
|
|
2927
|
+
* empty synthesis falls back to the loop turn's text, and a
|
|
2928
|
+
* schema-bearing call always pairs it with a separate extract
|
|
2926
2929
|
* (the ctx layer guarantees `extract` is present in that case). Like
|
|
2927
2930
|
* extract, the finalize invocation is not checkpointed in v1.
|
|
2928
2931
|
*/
|
|
@@ -2995,6 +2998,24 @@ interface RunAgentOptions<S extends SchemaSpec = JsonSchema> {
|
|
|
2995
2998
|
now?: () => number;
|
|
2996
2999
|
}
|
|
2997
3000
|
/**
|
|
3001
|
+
* The output-truncation abort message (v1.9.0 follow-up review). The
|
|
3002
|
+
* constraint is named neutrally as the turn's output token allowance:
|
|
3003
|
+
* the effective request cap can come from limits.maxOutputTokensPerTurn,
|
|
3004
|
+
* the budget clamp above, or the adapter's own default, and the provider
|
|
3005
|
+
* can also cut at its model maximum with no request cap at all.
|
|
3006
|
+
*/
|
|
3007
|
+
/**
|
|
3008
|
+
* The deterministic synthesis instruction appended (as a user message)
|
|
3009
|
+
* to the finalize REQUEST only, never to the durable transcript. A
|
|
3010
|
+
* transcript that simply ends at an assistant message reads to a real
|
|
3011
|
+
* model as a fresh conversation opening, so an uninstructed synthesis
|
|
3012
|
+
* call can replace the loop's correct answer with a greeting (v1.18.0
|
|
3013
|
+
* review P1-1); the extract arm has carried its own instruction since
|
|
3014
|
+
* M4, and this is its finalize twin. The wording is part of the wire
|
|
3015
|
+
* request: keep it stable.
|
|
3016
|
+
*/
|
|
3017
|
+
declare const FINALIZE_SYNTHESIS_INSTRUCTION: string;
|
|
3018
|
+
/**
|
|
2998
3019
|
* Runs one agent to a typed AgentResult. Never throws past policy: every
|
|
2999
3020
|
* failure mode becomes a typed status on the result.
|
|
3000
3021
|
*/
|
|
@@ -3112,11 +3133,14 @@ interface ResolvedToolset {
|
|
|
3112
3133
|
/** The empty toolset (no tools declared anywhere). */
|
|
3113
3134
|
declare function emptyToolset(): ResolvedToolset;
|
|
3114
3135
|
/**
|
|
3115
|
-
* Expands sources, validates every tool name and
|
|
3116
|
-
* the whole toolset (ConfigError at spawn time),
|
|
3117
|
-
* toolsetHash over contracts sorted by name.
|
|
3136
|
+
* Expands registered names and sources, validates every tool name and
|
|
3137
|
+
* duplicate names across the whole toolset (ConfigError at spawn time),
|
|
3138
|
+
* and computes the toolsetHash over contracts sorted by name. The
|
|
3139
|
+
* `toolsets` registry is the engine's `defaults.toolsets` snapshot;
|
|
3140
|
+
* without one, string entries fail with the same unknown-name error as
|
|
3141
|
+
* a miss, so nothing outside the declared registry is ever reachable.
|
|
3118
3142
|
*/
|
|
3119
|
-
declare function resolveToolset(specs: ToolsOption | undefined, session: ToolSourceSession): Promise<ResolvedToolset>;
|
|
3143
|
+
declare function resolveToolset(specs: ToolsOption | undefined, session: ToolSourceSession, toolsets?: Record<string, ToolsOption>): Promise<ResolvedToolset>;
|
|
3120
3144
|
//#endregion
|
|
3121
3145
|
//#region src/journal/termination.d.ts
|
|
3122
3146
|
/** The frozen limits vector written into termination.init. */
|
|
@@ -5054,8 +5078,18 @@ declare const ORCHESTRATE_WORKFLOW_NAME = "rulvar-orchestrate";
|
|
|
5054
5078
|
* orchestrator agent with the finish terminal tool.
|
|
5055
5079
|
*/
|
|
5056
5080
|
declare function makeOrchestratorWorkflow(goal: string, opts?: OrchestrateOptions): Workflow<undefined, unknown>;
|
|
5057
|
-
/**
|
|
5058
|
-
|
|
5081
|
+
/**
|
|
5082
|
+
* Top-level surface: creates a run. `runOptions` are the ordinary
|
|
5083
|
+
* engine {@link RunOptions} of the created run; in particular
|
|
5084
|
+
* `runOptions.budgetUsd` is the ROOT hard ceiling over the WHOLE tree
|
|
5085
|
+
* (the orchestrator and every child), immutable after start, while
|
|
5086
|
+
* `opts.budget` only shapes the orchestrator's own sub-account inside
|
|
5087
|
+
* that ceiling. The shortcut previously accepted no RunOptions at all,
|
|
5088
|
+
* so the canonical entry point could not set a root ceiling without
|
|
5089
|
+
* dropping to `engine.run(makeOrchestratorWorkflow(...))` (v1.18.0
|
|
5090
|
+
* review P1-5).
|
|
5091
|
+
*/
|
|
5092
|
+
declare function orchestrate(engine: Engine, goal: string, opts?: OrchestrateOptions, runOptions?: RunOptions): RunHandle<unknown>;
|
|
5059
5093
|
//#endregion
|
|
5060
5094
|
//#region src/engine/scheduler.d.ts
|
|
5061
5095
|
/**
|
|
@@ -6081,9 +6115,12 @@ declare function tierWithinCaps(tier: StructuredOutputTier, caps: ModelCaps): bo
|
|
|
6081
6115
|
/**
|
|
6082
6116
|
* Renders the registry into the shared agent vocabulary card. Sorted,
|
|
6083
6117
|
* deterministic, byte-stable; an empty registry renders explicitly so
|
|
6084
|
-
* the planner never guesses at unregistered agentTypes.
|
|
6118
|
+
* the planner never guesses at unregistered agentTypes. When the engine
|
|
6119
|
+
* registers toolsets, their names render as a closing line (v1.17.0
|
|
6120
|
+
* review P1-3): those are the ONLY values valid as string entries of a
|
|
6121
|
+
* tools option, so the planner never invents a registry name.
|
|
6085
6122
|
*/
|
|
6086
|
-
declare function profileCard(profiles: Record<string, AgentProfile> | undefined): string;
|
|
6123
|
+
declare function profileCard(profiles: Record<string, AgentProfile> | undefined, toolsets?: Record<string, ToolsOption>): string;
|
|
6087
6124
|
//#endregion
|
|
6088
6125
|
//#region src/model/projector.d.ts
|
|
6089
6126
|
/** The provider family of an adapter: `provider` when set, else `id`. */
|
|
@@ -6389,4 +6426,4 @@ interface SandboxBridge {
|
|
|
6389
6426
|
}
|
|
6390
6427
|
declare function createSandboxBridge(ctx: Ctx<never>, options: SandboxBridgeOptions): SandboxBridge;
|
|
6391
6428
|
//#endregion
|
|
6392
|
-
export { AWAIT_SCHEMA, AbandonAttempt, AbandonFold, AbandonPayload, AbandonedSpendView, AbortClass, type AdaptiveEvents, AdmissionController, AdmissionDecision, AdmissionRejectedError, AdmissionStatsBefore, AdmitLineage, AdmitRejectReason, AdmitSpec, AdmitVerdict, AgentCallError, AgentError, type AgentEvents, AgentIdentityInput, AgentOpts, AgentProfile, AgentProfilePermissions, AgentResult, AgentResultMeta, AgentStatus, ApproachSignatureInputs, ApprovalDecision, ApprovalIdentityInput, Artifact, AttemptOutcomeClass, BUDGET_ABORT_REASON, BriefOpts, BudgetAccountView, BudgetDefaults, BudgetExhaustedError, BudgetExhaustionDiagnostics, BudgetHooks, BudgetReserve, type Bytes, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, CacheHint, CacheTtl, CanUseTool, CanonicalId, CanonicalIdentity, CanonicalLadderSpec, CanonicalModelSpec, ChatEvent, ChatRequest, CheckpointState, ChildIdentityInput, type ClaimClass, type ClaimOp, type ClaimStatus, ClaimValidationOptions, CollectOpts, CollectedTurn, CompactionConfig, CompiledPermissionChain, CompiledWorkflow, ConfigError, type CoreEvents, CostAttribution, CostAttributionFacts, CostReport, CreateEngineOptions, Ctx, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DebitResult, DeclaredLadder, DedupIndex, DedupNote, DerivedKey, DeriverRegistry, DispositionRule, DispositionTable, DonorCandidate, DonorRef, DroppedItem, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EffectiveUsageLimits, Effort, Engine, EngineDefaults, EntryKind, EntryRef, EntryStatus, ErrorClass, ErrorCode, ErrorPolicy, EscalatedResult, EscalationDecision, EscalationDigest, EscalationKind, EscalationLimits, EscalationOptions, EscalationReport, EscalationRequest, EventBus, type EvidenceRef, ExtensionAppendInput, ExtensionDispatchSpec, ExternalIdentityInput, ExternalRegistry, ExtractNecessityInput, FINISH_SCHEMA, FINISH_TOOL_NAME, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, FileModelKnowledgeStore, FileModelKnowledgeStoreOptions, FileTranscriptStore, FinishInfo, Gate, GateAudit, type GateRecord, GitWorktreeProvider, GitWorktreeProviderOptions, GraftBoot, HashVersion, HookVerdict, INBOX_PROPOSAL_TTL_DAYS, IdentityInput, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, InvocationRole, type IsolationProvider, type IsolationSpec, Issue$1 as Issue, JournalCompatSubCode, JournalCompatibilityError, JournalEntry, JournalMatcher, JournalMissError, JournalOperation, JournalOrderViolation, JournalSerializationHook, type JournalStore, type Json, JsonSchema, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, type KbProposal, type KbProposalTrigger, KeyDeriver, KeyRing, KeyedLimiter, KnowledgeCasError, type KnowledgeSnapshot, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LadderSpec, type LeasableStore, type Lease, LeaseHeldError, Ledger, LineageCounters, LineageIndex, LineageRef, LineageRelation, LineageStats, LogicalTaskId, MASKED_SECRET, MAX_DEPTH_CEILING, MatchResult, McpConfig, MechanicalGateProfile, MechanicalGateVerdict, type ModelCaps, ModelChoice, type ModelClaim, ModelEpochInputs, type ModelKnowledgeHandle, type ModelKnowledgeStore, ModelListConstraint, ModelRef, ModelRetry, ModelSpec, Msg, NoProgressDetector, NodeId, NodeLinkValue, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OnEscalation, OperationDisposition, OrchestrateOptions, OrchestratorBudgetSpec, OrchestratorCapConfigError, OrchestratorExtension, OrchestratorExtensionIO, OrchestratorRuntime, Out, PARALLEL_AGENTS_SCHEMA, ParallelSiteCounter, Part, PendingExternal, PendingToolTurn, PermissionConfig, PermissionGate, PermissionHook, PermissionPreset, PermissionRule, PermissionVerdict, PhaseTarget, PipelineCollected, PipelineOpts, PlanInvariantError, PriceTable, PricedUsage, type Pricing, type PricingTier, type ProviderAdapter, QualityFloors, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, RandIdentityInput, RandPayload, RefEntryAppender, RefEntryClassification, RefusalInfo, ReplayDisposition, ReplayMode, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionAttempt, ResolutionBy, ResolutionFold, ResolutionLayer, ResolutionOutcome, ResolutionPayload, ResolvedInvocation, ResolvedToolset, ResumeHandle, ResumeOptions, ResumePreview, ResumeReport, RetryClass, RetryPolicy, ReuseConfig, RiskRuleValue, Role, RulvarError, RulvarErrorCode, RunAgentOptions, RunBudget, RunEventSink, type RunFilter, RunHandle, RunInternals, type RunMeta, RunOptions, RunOutcome, RunProfile, RunStatus, RuntimeEventSink, SPAWN_AGENT_SCHEMA, SandboxBridge, SandboxBridgeOptions, SandboxError, SandboxHostToWorker, SandboxMethod, SandboxWorkerToHost, SchemaPair, SchemaSpec, SchemaValidationResult, ScopeSegment, ScriptRejected, ScriptRunner, ScrubNote, Semaphore, SerializationHook, Settled, ShellPatternRules, ShellSegment, ShellVerdict, SinglePhaseAppend, SpanMinter, SpanRegistry, SpawnAdmissionValue, SpawnAgentParams, SpawnKey, SpawnLineage, SpawnLineageOpt, SpawnOrigin, SpawnRecord, Spend, Stage, type StandardJSONSchemaV1, type StandardSchemaV1, StepIdentityInput, StructuredOutputTier, SuspendedAppend, SuspensionState, TOOL_NAME_PATTERN, type TaskClass, TaskDigest, TaskSpec, TerminalPatch, TerminationAccount, TerminationAccountSnapshot, TerminationDeniedValue, TerminationDeniedWriter, TerminationInitValue, TerminationLimits, TerminationResource, ToolCallRequest, ToolChoice, type ToolContext, ToolContextSeed, ToolContract, type ToolDef, type ToolEvents, type ToolExecutor, ToolInit, type ToolRisk, ToolRuntime, type ToolSource, type ToolSourceSession, ToolsOption, TranscriptSerializationHook, type TranscriptStore, TriggerClass, TtlState, Usage, UsageLimits, UsageSlice, VerifiedRecommendation, WAIT_FOR_EVENTS_SCHEMA, WAIT_FOR_EVENTS_TOOL_NAME, WAKE_SUMMARY_RENDER_BUDGET_CHARS, WakeBudgetBlock, WakeDigest, WakeTrigger, WireError, Workflow, WorkflowCallOpts, type WorkflowEvent, type WorkflowEventBody, WorkflowRegistry, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, atCompactionThreshold, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compilePermissionChain, compilePermissionPreset, compileVerifiedLayer, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, foldTermination, formatRePrompt, formatScopePath, hashWorkflowBody, hashWorkflowSource, identityJcs, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lexShellCommand, liftRetainedParts, lineageWeightOf, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, mergeUsageLimits, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, readTerminationInit, registryKeyRing, remeasureQueue, replayDisposition, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, scanJournalCompatibility, schemaHash, schemaHashOfSpec, selectStructuredOutputTier, shouldCompact, spawnDepthOf, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, validateEditorialCommit, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateSchemaSpec, validateTerminationLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
|
|
6429
|
+
export { AWAIT_SCHEMA, AbandonAttempt, AbandonFold, AbandonPayload, AbandonedSpendView, AbortClass, type AdaptiveEvents, AdmissionController, AdmissionDecision, AdmissionRejectedError, AdmissionStatsBefore, AdmitLineage, AdmitRejectReason, AdmitSpec, AdmitVerdict, AgentCallError, AgentError, type AgentEvents, AgentIdentityInput, AgentOpts, AgentProfile, AgentProfilePermissions, AgentResult, AgentResultMeta, AgentStatus, ApproachSignatureInputs, ApprovalDecision, ApprovalIdentityInput, Artifact, AttemptOutcomeClass, BUDGET_ABORT_REASON, BriefOpts, BudgetAccountView, BudgetDefaults, BudgetExhaustedError, BudgetExhaustionDiagnostics, BudgetHooks, BudgetReserve, type Bytes, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, CacheHint, CacheTtl, CanUseTool, CanonicalId, CanonicalIdentity, CanonicalLadderSpec, CanonicalModelSpec, ChatEvent, ChatRequest, CheckpointState, ChildIdentityInput, type ClaimClass, type ClaimOp, type ClaimStatus, ClaimValidationOptions, CollectOpts, CollectedTurn, CompactionConfig, CompiledPermissionChain, CompiledWorkflow, ConfigError, type CoreEvents, CostAttribution, CostAttributionFacts, CostReport, CreateEngineOptions, Ctx, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DebitResult, DeclaredLadder, DedupIndex, DedupNote, DerivedKey, DeriverRegistry, DispositionRule, DispositionTable, DonorCandidate, DonorRef, DroppedItem, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EffectiveUsageLimits, Effort, Engine, EngineDefaults, EntryKind, EntryRef, EntryStatus, ErrorClass, ErrorCode, ErrorPolicy, EscalatedResult, EscalationDecision, EscalationDigest, EscalationKind, EscalationLimits, EscalationOptions, EscalationReport, EscalationRequest, EventBus, type EvidenceRef, ExtensionAppendInput, ExtensionDispatchSpec, ExternalIdentityInput, ExternalRegistry, ExtractNecessityInput, FINALIZE_SYNTHESIS_INSTRUCTION, FINISH_SCHEMA, FINISH_TOOL_NAME, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, FileModelKnowledgeStore, FileModelKnowledgeStoreOptions, FileTranscriptStore, FinishInfo, Gate, GateAudit, type GateRecord, GitWorktreeProvider, GitWorktreeProviderOptions, GraftBoot, HashVersion, HookVerdict, INBOX_PROPOSAL_TTL_DAYS, IdentityInput, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, InvocationRole, type IsolationProvider, type IsolationSpec, Issue$1 as Issue, JournalCompatSubCode, JournalCompatibilityError, JournalEntry, JournalMatcher, JournalMissError, JournalOperation, JournalOrderViolation, JournalSerializationHook, type JournalStore, type Json, JsonSchema, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, type KbProposal, type KbProposalTrigger, KeyDeriver, KeyRing, KeyedLimiter, KnowledgeCasError, type KnowledgeSnapshot, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LadderSpec, type LeasableStore, type Lease, LeaseHeldError, Ledger, LineageCounters, LineageIndex, LineageRef, LineageRelation, LineageStats, LogicalTaskId, MASKED_SECRET, MAX_DEPTH_CEILING, MatchResult, McpConfig, MechanicalGateProfile, MechanicalGateVerdict, type ModelCaps, ModelChoice, type ModelClaim, ModelEpochInputs, type ModelKnowledgeHandle, type ModelKnowledgeStore, ModelListConstraint, ModelRef, ModelRetry, ModelSpec, Msg, NoProgressDetector, NodeId, NodeLinkValue, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OnEscalation, OperationDisposition, OrchestrateOptions, OrchestratorBudgetSpec, OrchestratorCapConfigError, OrchestratorExtension, OrchestratorExtensionIO, OrchestratorRuntime, Out, PARALLEL_AGENTS_SCHEMA, ParallelSiteCounter, Part, PendingExternal, PendingToolTurn, PermissionConfig, PermissionGate, PermissionHook, PermissionPreset, PermissionRule, PermissionVerdict, PhaseTarget, PipelineCollected, PipelineOpts, PlanInvariantError, PriceTable, PricedUsage, type Pricing, type PricingTier, type ProviderAdapter, QualityFloors, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, RandIdentityInput, RandPayload, RefEntryAppender, RefEntryClassification, RefusalInfo, ReplayDisposition, ReplayMode, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionAttempt, ResolutionBy, ResolutionFold, ResolutionLayer, ResolutionOutcome, ResolutionPayload, ResolvedInvocation, ResolvedToolset, ResumeHandle, ResumeOptions, ResumePreview, ResumeReport, RetryClass, RetryPolicy, ReuseConfig, RiskRuleValue, Role, RulvarError, RulvarErrorCode, RunAgentOptions, RunBudget, RunEventSink, type RunFilter, RunHandle, RunInternals, type RunMeta, RunOptions, RunOutcome, RunProfile, RunStatus, RuntimeEventSink, SPAWN_AGENT_SCHEMA, SandboxBridge, SandboxBridgeOptions, SandboxError, SandboxHostToWorker, SandboxMethod, SandboxWorkerToHost, SchemaPair, SchemaSpec, SchemaValidationResult, ScopeSegment, ScriptRejected, ScriptRunner, ScrubNote, Semaphore, SerializationHook, Settled, ShellPatternRules, ShellSegment, ShellVerdict, SinglePhaseAppend, SpanMinter, SpanRegistry, SpawnAdmissionValue, SpawnAgentParams, SpawnKey, SpawnLineage, SpawnLineageOpt, SpawnOrigin, SpawnRecord, Spend, Stage, type StandardJSONSchemaV1, type StandardSchemaV1, StepIdentityInput, StructuredOutputTier, SuspendedAppend, SuspensionState, TOOL_NAME_PATTERN, type TaskClass, TaskDigest, TaskSpec, TerminalPatch, TerminationAccount, TerminationAccountSnapshot, TerminationDeniedValue, TerminationDeniedWriter, TerminationInitValue, TerminationLimits, TerminationResource, ToolCallRequest, ToolChoice, type ToolContext, ToolContextSeed, ToolContract, type ToolDef, type ToolEvents, type ToolExecutor, ToolInit, type ToolRisk, ToolRuntime, type ToolSource, type ToolSourceSession, ToolsOption, TranscriptSerializationHook, type TranscriptStore, TriggerClass, TtlState, Usage, UsageLimits, UsageSlice, VerifiedRecommendation, WAIT_FOR_EVENTS_SCHEMA, WAIT_FOR_EVENTS_TOOL_NAME, WAKE_SUMMARY_RENDER_BUDGET_CHARS, WakeBudgetBlock, WakeDigest, WakeTrigger, WireError, Workflow, WorkflowCallOpts, type WorkflowEvent, type WorkflowEventBody, WorkflowRegistry, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, atCompactionThreshold, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compilePermissionChain, compilePermissionPreset, compileVerifiedLayer, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, foldTermination, formatRePrompt, formatScopePath, hashWorkflowBody, hashWorkflowSource, identityJcs, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lexShellCommand, liftRetainedParts, lineageWeightOf, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, mergeUsageLimits, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, readTerminationInit, registryKeyRing, remeasureQueue, replayDisposition, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, scanJournalCompatibility, schemaHash, schemaHashOfSpec, selectStructuredOutputTier, shouldCompact, spawnDepthOf, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, validateEditorialCommit, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateSchemaSpec, validateTerminationLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
|
package/dist/index.js
CHANGED
|
@@ -511,11 +511,16 @@ function assertValidTime(time) {
|
|
|
511
511
|
* backwards; in both cases the previous timestamp is reused and the random
|
|
512
512
|
* component is incremented.
|
|
513
513
|
*
|
|
514
|
-
* `now` and `random` are injectable for tests; defaults are
|
|
515
|
-
* `globalThis.crypto.getRandomValues`.
|
|
516
|
-
|
|
514
|
+
* `now` and `random` are injectable for tests; defaults are the real
|
|
515
|
+
* wall clock and `globalThis.crypto.getRandomValues`. The clock default
|
|
516
|
+
* is BOUND AT MODULE LOAD, never read from the global at mint time: a
|
|
517
|
+
* live read inside a run's async context goes through the dev-mode
|
|
518
|
+
* bare-Date.now patch and false-warns on the factory's own frames when
|
|
519
|
+
* they live outside node_modules (v1.18.0 review P2-6).
|
|
520
|
+
*/
|
|
521
|
+
const REAL_NOW = Date.now.bind(globalThis);
|
|
517
522
|
function monotonicUlidFactory(options) {
|
|
518
|
-
const now = options?.now ??
|
|
523
|
+
const now = options?.now ?? REAL_NOW;
|
|
519
524
|
const random = options?.random ?? defaultRandom;
|
|
520
525
|
let lastTime = -1;
|
|
521
526
|
let lastRandom = null;
|
|
@@ -2597,9 +2602,14 @@ function toolContract(def) {
|
|
|
2597
2602
|
* Toolset resolution and hashing (M3-T01): expands the per-spawn tools
|
|
2598
2603
|
* array (ToolDef | ToolSource | string) into the spawn's toolset snapshot,
|
|
2599
2604
|
* validates names and collisions, and derives toolsetHash from the
|
|
2600
|
-
* contracts only.
|
|
2601
|
-
*
|
|
2602
|
-
*
|
|
2605
|
+
* contracts only. A string entry names a registered toolset from
|
|
2606
|
+
* `createEngine({ defaults: { toolsets } })` (v1.17.0 review P1-3): the
|
|
2607
|
+
* registry snapshot belongs to the engine configuration, so the same
|
|
2608
|
+
* name expands identically for direct calls, agent profiles, and the
|
|
2609
|
+
* sandbox dialect, and an unknown name is a typed ConfigError at spawn
|
|
2610
|
+
* time, before any provider call. The snapshot is captured at spawn
|
|
2611
|
+
* time and stays stable for the agent's lifetime; provider-side drift
|
|
2612
|
+
* of a source's tools changes the content key of NEW spawns only.
|
|
2603
2613
|
*
|
|
2604
2614
|
* Docs: https://docs.rulvar.com/guide/tools.
|
|
2605
2615
|
*/
|
|
@@ -2615,21 +2625,35 @@ function isToolDef(spec) {
|
|
|
2615
2625
|
return typeof spec !== "string" && spec.kind === "tool";
|
|
2616
2626
|
}
|
|
2617
2627
|
/**
|
|
2618
|
-
* Expands sources, validates every tool name and
|
|
2619
|
-
* the whole toolset (ConfigError at spawn time),
|
|
2620
|
-
* toolsetHash over contracts sorted by name.
|
|
2628
|
+
* Expands registered names and sources, validates every tool name and
|
|
2629
|
+
* duplicate names across the whole toolset (ConfigError at spawn time),
|
|
2630
|
+
* and computes the toolsetHash over contracts sorted by name. The
|
|
2631
|
+
* `toolsets` registry is the engine's `defaults.toolsets` snapshot;
|
|
2632
|
+
* without one, string entries fail with the same unknown-name error as
|
|
2633
|
+
* a miss, so nothing outside the declared registry is ever reachable.
|
|
2621
2634
|
*/
|
|
2622
|
-
async function resolveToolset(specs, session) {
|
|
2635
|
+
async function resolveToolset(specs, session, toolsets) {
|
|
2623
2636
|
if (specs === void 0 || specs.length === 0) return emptyToolset();
|
|
2624
2637
|
const tools = [];
|
|
2625
2638
|
for (const spec of specs) {
|
|
2626
|
-
if (typeof spec === "string")
|
|
2639
|
+
if (typeof spec === "string") {
|
|
2640
|
+
const named = toolsets?.[spec];
|
|
2641
|
+
if (named === void 0) throw new ConfigError(`unknown registered toolset '${spec}': register it under defaults.toolsets (https://docs.rulvar.com/guide/tools)`);
|
|
2642
|
+
for (const entry of named) {
|
|
2643
|
+
if (typeof entry === "string") throw new ConfigError(`registered toolset '${spec}' contains the name '${entry}': registry values hold ToolDef or ToolSource entries, never other registered names`);
|
|
2644
|
+
if (isToolDef(entry)) {
|
|
2645
|
+
tools.push(entry);
|
|
2646
|
+
continue;
|
|
2647
|
+
}
|
|
2648
|
+
tools.push(...await entry.tools(session));
|
|
2649
|
+
}
|
|
2650
|
+
continue;
|
|
2651
|
+
}
|
|
2627
2652
|
if (isToolDef(spec)) {
|
|
2628
2653
|
tools.push(spec);
|
|
2629
2654
|
continue;
|
|
2630
2655
|
}
|
|
2631
|
-
|
|
2632
|
-
tools.push(...imported);
|
|
2656
|
+
tools.push(...await spec.tools(session));
|
|
2633
2657
|
}
|
|
2634
2658
|
const seen = /* @__PURE__ */ new Map();
|
|
2635
2659
|
for (const def of tools) {
|
|
@@ -4675,6 +4699,22 @@ function toJournalValue(value, site) {
|
|
|
4675
4699
|
return JSON.parse(JSON.stringify(value));
|
|
4676
4700
|
}
|
|
4677
4701
|
//#endregion
|
|
4702
|
+
//#region src/l0/real-clock.ts
|
|
4703
|
+
/**
|
|
4704
|
+
* The engine's own wall clock, captured at MODULE LOAD, which always
|
|
4705
|
+
* precedes the dev-mode bare-Date.now patch: the patch installs inside
|
|
4706
|
+
* InProcessRunner.execute, and nothing can execute before this module
|
|
4707
|
+
* graph has loaded. Engine internals that need real time use this
|
|
4708
|
+
* binding instead of reading the global later: a later read (a second
|
|
4709
|
+
* engine created after a run, a ULID minted mid-run) captures the
|
|
4710
|
+
* PATCHED wrapper, and inside a run's async context with frames outside
|
|
4711
|
+
* node_modules (workspace dists, monorepo consumers, this repo's own
|
|
4712
|
+
* tests) that produced false RULVAR_BARE_DATE_NOW warnings from the
|
|
4713
|
+
* engine's own code (v1.18.0 review P2-6). The dev-mode guard stays
|
|
4714
|
+
* exactly as sharp for workflow code, which keeps calling the global.
|
|
4715
|
+
*/
|
|
4716
|
+
const realNow = Date.now.bind(globalThis);
|
|
4717
|
+
//#endregion
|
|
4678
4718
|
//#region src/journal/kinds.ts
|
|
4679
4719
|
const KNOWN_KINDS = /* @__PURE__ */ new Set([
|
|
4680
4720
|
"agent",
|
|
@@ -5299,7 +5339,7 @@ var Replayer = class {
|
|
|
5299
5339
|
this.runId = options.runId;
|
|
5300
5340
|
this.store = options.store;
|
|
5301
5341
|
if (options.lease !== void 0) this.lease = options.lease;
|
|
5302
|
-
this.now = options.now ??
|
|
5342
|
+
this.now = options.now ?? realNow;
|
|
5303
5343
|
if (options.priceUsd !== void 0) this.priceUsd = options.priceUsd;
|
|
5304
5344
|
if (options.onWarn !== void 0) this.onWarn = options.onWarn;
|
|
5305
5345
|
this.largeValueWarnBytes = options.largeValueWarnBytes ?? 262144;
|
|
@@ -6676,7 +6716,7 @@ function affordableOutputTokens(pricing, remainingUsd, estimatedInputTokens) {
|
|
|
6676
6716
|
//#region src/model/profile-card.ts
|
|
6677
6717
|
function toolNamesOf(profile) {
|
|
6678
6718
|
return (profile.tools ?? []).map((entry) => {
|
|
6679
|
-
if (typeof entry === "string") return `${entry} (
|
|
6719
|
+
if (typeof entry === "string") return `${entry} (registered toolset)`;
|
|
6680
6720
|
if ("kind" in entry && entry.kind === "tool") return entry.name;
|
|
6681
6721
|
return `${entry.id}:* (tool source)`;
|
|
6682
6722
|
});
|
|
@@ -6684,11 +6724,19 @@ function toolNamesOf(profile) {
|
|
|
6684
6724
|
/**
|
|
6685
6725
|
* Renders the registry into the shared agent vocabulary card. Sorted,
|
|
6686
6726
|
* deterministic, byte-stable; an empty registry renders explicitly so
|
|
6687
|
-
* the planner never guesses at unregistered agentTypes.
|
|
6688
|
-
|
|
6689
|
-
|
|
6727
|
+
* the planner never guesses at unregistered agentTypes. When the engine
|
|
6728
|
+
* registers toolsets, their names render as a closing line (v1.17.0
|
|
6729
|
+
* review P1-3): those are the ONLY values valid as string entries of a
|
|
6730
|
+
* tools option, so the planner never invents a registry name.
|
|
6731
|
+
*/
|
|
6732
|
+
function profileCard(profiles, toolsets) {
|
|
6733
|
+
const toolsetNames = Object.keys(toolsets ?? {}).sort();
|
|
6734
|
+
const toolsetsLine = toolsetNames.length === 0 ? void 0 : `Registered toolsets (valid string entries of a tools option): ${toolsetNames.join(", ")}.`;
|
|
6690
6735
|
const names = Object.keys(profiles ?? {}).sort();
|
|
6691
|
-
if (profiles === void 0 || names.length === 0)
|
|
6736
|
+
if (profiles === void 0 || names.length === 0) {
|
|
6737
|
+
const empty = "Agent profiles: none registered. Calls take no agentType.";
|
|
6738
|
+
return toolsetsLine === void 0 ? empty : `${empty}\n${toolsetsLine}`;
|
|
6739
|
+
}
|
|
6692
6740
|
const lines = ["Agent profiles (agentType values):"];
|
|
6693
6741
|
for (const name of names) {
|
|
6694
6742
|
const profile = profiles[name];
|
|
@@ -6700,6 +6748,7 @@ function profileCard(profiles) {
|
|
|
6700
6748
|
if (profile.estCost !== void 0) lines.push(` estCost: ${profile.estCost.toFixed(2)} USD`);
|
|
6701
6749
|
if (profile.escalation !== void 0) lines.push(` escalation: flavor ${profile.escalation.flavor ?? "A"} (opt-in)`);
|
|
6702
6750
|
}
|
|
6751
|
+
if (toolsetsLine !== void 0) lines.push(toolsetsLine);
|
|
6703
6752
|
return lines.join("\n");
|
|
6704
6753
|
}
|
|
6705
6754
|
//#endregion
|
|
@@ -7898,6 +7947,17 @@ function applyOutputBudget(req, target, budget) {
|
|
|
7898
7947
|
* the budget clamp above, or the adapter's own default, and the provider
|
|
7899
7948
|
* can also cut at its model maximum with no request cap at all.
|
|
7900
7949
|
*/
|
|
7950
|
+
/**
|
|
7951
|
+
* The deterministic synthesis instruction appended (as a user message)
|
|
7952
|
+
* to the finalize REQUEST only, never to the durable transcript. A
|
|
7953
|
+
* transcript that simply ends at an assistant message reads to a real
|
|
7954
|
+
* model as a fresh conversation opening, so an uninstructed synthesis
|
|
7955
|
+
* call can replace the loop's correct answer with a greeting (v1.18.0
|
|
7956
|
+
* review P1-1); the extract arm has carried its own instruction since
|
|
7957
|
+
* M4, and this is its finalize twin. The wording is part of the wire
|
|
7958
|
+
* request: keep it stable.
|
|
7959
|
+
*/
|
|
7960
|
+
const FINALIZE_SYNTHESIS_INSTRUCTION = "Write the final answer to the original request, synthesized only from the conversation and tool results above. Do not start a new conversation and do not add greetings; respond with the final answer only.";
|
|
7901
7961
|
function outputTruncatedMessage(invocation) {
|
|
7902
7962
|
return `the ${invocation} ended at its output token allowance (finish reason 'max-tokens') before producing visible output; raise limits.maxOutputTokensPerTurn, reduce the reasoning effort, or free budget for the turn (https://docs.rulvar.com/guide/agents#output-truncation)`;
|
|
7903
7963
|
}
|
|
@@ -7984,7 +8044,7 @@ async function executeToolCall(options) {
|
|
|
7984
8044
|
* failure mode becomes a typed status on the result.
|
|
7985
8045
|
*/
|
|
7986
8046
|
async function runAgent(options) {
|
|
7987
|
-
const now = options.now ??
|
|
8047
|
+
const now = options.now ?? realNow;
|
|
7988
8048
|
const startedAt = now();
|
|
7989
8049
|
const limits = options.limits;
|
|
7990
8050
|
const maxSchemaAttempts = (options.schemaRetryAttempts ?? 2) + 1;
|
|
@@ -8752,6 +8812,13 @@ async function runAgent(options) {
|
|
|
8752
8812
|
}
|
|
8753
8813
|
if (proceed) {
|
|
8754
8814
|
turns += 1;
|
|
8815
|
+
const synthesisMessages = [...messages, {
|
|
8816
|
+
role: "user",
|
|
8817
|
+
parts: [{
|
|
8818
|
+
type: "text",
|
|
8819
|
+
text: FINALIZE_SYNTHESIS_INSTRUCTION
|
|
8820
|
+
}]
|
|
8821
|
+
}];
|
|
8755
8822
|
let finalizeDispatch;
|
|
8756
8823
|
try {
|
|
8757
8824
|
finalizeDispatch = await dispatchPhase({
|
|
@@ -8761,7 +8828,7 @@ async function runAgent(options) {
|
|
|
8761
8828
|
}, ...options.finalize.fallbacks ?? []],
|
|
8762
8829
|
cursor: { index: 0 },
|
|
8763
8830
|
requestFor: (target) => applyOutputBudget({
|
|
8764
|
-
...buildRequest(target.resolved, projectHistory(
|
|
8831
|
+
...buildRequest(target.resolved, projectHistory(synthesisMessages, providerOf(target.adapter)), limits, options.tools?.contracts),
|
|
8765
8832
|
toolChoice: "none"
|
|
8766
8833
|
}, target, options.budget),
|
|
8767
8834
|
streamOptionsFor: (target) => {
|
|
@@ -8832,7 +8899,10 @@ async function runAgent(options) {
|
|
|
8832
8899
|
retryable: false
|
|
8833
8900
|
};
|
|
8834
8901
|
errorMessage = outputTruncatedMessage("finalize invocation");
|
|
8835
|
-
} else if (options.schema === void 0)
|
|
8902
|
+
} else if (options.schema === void 0) {
|
|
8903
|
+
const synthesis = outcome.turn.text;
|
|
8904
|
+
if (synthesis.trim() !== "") output = synthesis;
|
|
8905
|
+
}
|
|
8836
8906
|
}
|
|
8837
8907
|
}
|
|
8838
8908
|
}
|
|
@@ -10325,7 +10395,7 @@ function createCtx(internals, rootWorkflow) {
|
|
|
10325
10395
|
if (escalation.flavor === "B" && escalation.deadlineMs === void 0) throw new ConfigError("escalation flavor 'B' requires an explicit deadlineMs");
|
|
10326
10396
|
}
|
|
10327
10397
|
const declaredTools = opts.tools ?? profile?.tools ?? [];
|
|
10328
|
-
const toolset = await resolveToolset(escalation === void 0 ? declaredTools : [...declaredTools, escalateTool()], { runId: internals.runId });
|
|
10398
|
+
const toolset = await resolveToolset(escalation === void 0 ? declaredTools : [...declaredTools, escalateTool()], { runId: internals.runId }, internals.defaults.toolsets);
|
|
10329
10399
|
const layers = [
|
|
10330
10400
|
callLayer,
|
|
10331
10401
|
profileLayer,
|
|
@@ -12384,9 +12454,19 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
12384
12454
|
return result.output;
|
|
12385
12455
|
});
|
|
12386
12456
|
}
|
|
12387
|
-
/**
|
|
12388
|
-
|
|
12389
|
-
|
|
12457
|
+
/**
|
|
12458
|
+
* Top-level surface: creates a run. `runOptions` are the ordinary
|
|
12459
|
+
* engine {@link RunOptions} of the created run; in particular
|
|
12460
|
+
* `runOptions.budgetUsd` is the ROOT hard ceiling over the WHOLE tree
|
|
12461
|
+
* (the orchestrator and every child), immutable after start, while
|
|
12462
|
+
* `opts.budget` only shapes the orchestrator's own sub-account inside
|
|
12463
|
+
* that ceiling. The shortcut previously accepted no RunOptions at all,
|
|
12464
|
+
* so the canonical entry point could not set a root ceiling without
|
|
12465
|
+
* dropping to `engine.run(makeOrchestratorWorkflow(...))` (v1.18.0
|
|
12466
|
+
* review P1-5).
|
|
12467
|
+
*/
|
|
12468
|
+
function orchestrate(engine, goal, opts, runOptions) {
|
|
12469
|
+
return engine.run(makeOrchestratorWorkflow(goal, opts), void 0, runOptions);
|
|
12390
12470
|
}
|
|
12391
12471
|
//#endregion
|
|
12392
12472
|
//#region src/engine/events.ts
|
|
@@ -12431,7 +12511,7 @@ var EventBus = class {
|
|
|
12431
12511
|
constructor(options) {
|
|
12432
12512
|
this.runId = options.runId;
|
|
12433
12513
|
this.spans = options.spans;
|
|
12434
|
-
this.now = options.now ??
|
|
12514
|
+
this.now = options.now ?? realNow;
|
|
12435
12515
|
this.maskEvents = options.maskEvents ?? true;
|
|
12436
12516
|
}
|
|
12437
12517
|
emit(body, spanId, replayed) {
|
|
@@ -12522,7 +12602,11 @@ let globalsPatched = false;
|
|
|
12522
12602
|
* transport behind fetch, timers, stream internals), whose frames carry
|
|
12523
12603
|
* `node:` specifiers and inherit the run's async context. The guard
|
|
12524
12604
|
* exists for workflow code, which imports from both but lives in
|
|
12525
|
-
* neither.
|
|
12605
|
+
* neither. Rulvar's own internals never reach this check at all: every
|
|
12606
|
+
* internal real-time read binds the module-load clock (l0/real-clock.ts
|
|
12607
|
+
* and the ULID factory default), never the live global, so frames from
|
|
12608
|
+
* workspace dists or this repo's sources cannot false-warn (v1.18.0
|
|
12609
|
+
* review P2-6).
|
|
12526
12610
|
*/
|
|
12527
12611
|
function libraryCaller() {
|
|
12528
12612
|
const caller = (/* @__PURE__ */ new Error()).stack?.split("\n")[3];
|
|
@@ -12631,7 +12715,6 @@ function createEngine(options) {
|
|
|
12631
12715
|
const knowledge = knowledgeStore === void 0 ? void 0 : { current: () => knowledgeStore.current() };
|
|
12632
12716
|
const runner = new InProcessRunner(options.onEscalation === void 0 ? void 0 : { onEscalation: options.onEscalation });
|
|
12633
12717
|
const mintRunId = createCanonicalIdMinter();
|
|
12634
|
-
const realNow = Date.now.bind(globalThis);
|
|
12635
12718
|
const pricingOf = (servedBy) => {
|
|
12636
12719
|
const { adapterId, model } = parseModelRef(servedBy);
|
|
12637
12720
|
return resolvePricing(servedBy, options.pricing, adapters.get(adapterId)?.caps(model).pricing);
|
|
@@ -13028,10 +13111,10 @@ function createEngine(options) {
|
|
|
13028
13111
|
pruneRun,
|
|
13029
13112
|
profileCard: (names) => {
|
|
13030
13113
|
const registered = defaults.profiles ?? {};
|
|
13031
|
-
if (names === void 0) return profileCard(registered);
|
|
13114
|
+
if (names === void 0) return profileCard(registered, defaults.toolsets);
|
|
13032
13115
|
const filtered = {};
|
|
13033
13116
|
for (const name of names) if (registered[name] !== void 0) filtered[name] = registered[name];
|
|
13034
|
-
return profileCard(filtered);
|
|
13117
|
+
return profileCard(filtered, defaults.toolsets);
|
|
13035
13118
|
}
|
|
13036
13119
|
};
|
|
13037
13120
|
}
|
|
@@ -13316,4 +13399,4 @@ function createSandboxBridge(ctx, options) {
|
|
|
13316
13399
|
};
|
|
13317
13400
|
}
|
|
13318
13401
|
//#endregion
|
|
13319
|
-
export { AWAIT_SCHEMA, AdmissionController, AdmissionRejectedError, AgentCallError, BUDGET_ABORT_REASON, BudgetExhaustedError, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, ConfigError, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DedupIndex, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EventBus, ExternalRegistry, FINISH_SCHEMA, FINISH_TOOL_NAME, FileModelKnowledgeStore, FileTranscriptStore, GitWorktreeProvider, INBOX_PROPOSAL_TTL_DAYS, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, JournalCompatibilityError, JournalMatcher, JournalMissError, JournalOrderViolation, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, KeyedLimiter, KnowledgeCasError, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LeaseHeldError, LineageIndex, MASKED_SECRET, MAX_DEPTH_CEILING, ModelRetry, NoProgressDetector, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OrchestratorCapConfigError, PARALLEL_AGENTS_SCHEMA, ParallelSiteCounter, PlanInvariantError, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionFold, RulvarError, RunBudget, SPAWN_AGENT_SCHEMA, SandboxError, ScriptRejected, Semaphore, SpanRegistry, TOOL_NAME_PATTERN, TerminationAccount, WAIT_FOR_EVENTS_SCHEMA, WAIT_FOR_EVENTS_TOOL_NAME, WAKE_SUMMARY_RENDER_BUDGET_CHARS, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, atCompactionThreshold, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compilePermissionChain, compilePermissionPreset, compileVerifiedLayer, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, foldTermination, formatRePrompt, formatScopePath, hashWorkflowBody, hashWorkflowSource, identityJcs, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lexShellCommand, liftRetainedParts, lineageWeightOf, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, mergeUsageLimits, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, readTerminationInit, registryKeyRing, remeasureQueue, replayDisposition, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, scanJournalCompatibility, schemaHash, schemaHashOfSpec, selectStructuredOutputTier, shouldCompact, spawnDepthOf, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, validateEditorialCommit, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateSchemaSpec, validateTerminationLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
|
|
13402
|
+
export { AWAIT_SCHEMA, AdmissionController, AdmissionRejectedError, AgentCallError, BUDGET_ABORT_REASON, BudgetExhaustedError, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, ConfigError, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DedupIndex, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EventBus, ExternalRegistry, FINALIZE_SYNTHESIS_INSTRUCTION, FINISH_SCHEMA, FINISH_TOOL_NAME, FileModelKnowledgeStore, FileTranscriptStore, GitWorktreeProvider, INBOX_PROPOSAL_TTL_DAYS, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, JournalCompatibilityError, JournalMatcher, JournalMissError, JournalOrderViolation, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, KeyedLimiter, KnowledgeCasError, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LeaseHeldError, LineageIndex, MASKED_SECRET, MAX_DEPTH_CEILING, ModelRetry, NoProgressDetector, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OrchestratorCapConfigError, PARALLEL_AGENTS_SCHEMA, ParallelSiteCounter, PlanInvariantError, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionFold, RulvarError, RunBudget, SPAWN_AGENT_SCHEMA, SandboxError, ScriptRejected, Semaphore, SpanRegistry, TOOL_NAME_PATTERN, TerminationAccount, WAIT_FOR_EVENTS_SCHEMA, WAIT_FOR_EVENTS_TOOL_NAME, WAKE_SUMMARY_RENDER_BUDGET_CHARS, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, atCompactionThreshold, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compilePermissionChain, compilePermissionPreset, compileVerifiedLayer, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, foldTermination, formatRePrompt, formatScopePath, hashWorkflowBody, hashWorkflowSource, identityJcs, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lexShellCommand, liftRetainedParts, lineageWeightOf, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, mergeUsageLimits, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, readTerminationInit, registryKeyRing, remeasureQueue, replayDisposition, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, scanJournalCompatibility, schemaHash, schemaHashOfSpec, selectStructuredOutputTier, shouldCompact, spawnDepthOf, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, validateEditorialCommit, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateSchemaSpec, validateTerminationLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.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",
|