@rulvar/core 1.42.0 → 1.44.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 +186 -1
- package/dist/index.js +324 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3242,9 +3242,24 @@ interface RunAgentOptions<S extends SchemaSpec = JsonSchema> {
|
|
|
3242
3242
|
* tool ends the loop with status ok; the call's validated `result`
|
|
3243
3243
|
* argument becomes the agent output (the orchestrator finish
|
|
3244
3244
|
* tool). The tool's execute never runs, mirroring escalate.
|
|
3245
|
+
* `validate` is the optional host judgment over a schema valid call
|
|
3246
|
+
* (the RV-204 finish validators): ok finishes as before; a rejection
|
|
3247
|
+
* becomes the call's error tool result and the turn continues, so the
|
|
3248
|
+
* model can repair and call the terminal tool again. The hook owns
|
|
3249
|
+
* bounding and journaling; the loop stays policy only and never
|
|
3250
|
+
* throws.
|
|
3245
3251
|
*/
|
|
3246
3252
|
terminalTool?: {
|
|
3247
3253
|
name: string;
|
|
3254
|
+
validate?: (call: {
|
|
3255
|
+
id: string;
|
|
3256
|
+
result: unknown;
|
|
3257
|
+
}) => Promise<{
|
|
3258
|
+
ok: true;
|
|
3259
|
+
} | {
|
|
3260
|
+
ok: false;
|
|
3261
|
+
feedback: Record<string, unknown>;
|
|
3262
|
+
}>;
|
|
3248
3263
|
};
|
|
3249
3264
|
agentType?: string;
|
|
3250
3265
|
/** The primary invocation role of the tool loop; default 'loop' (M6-T05). */
|
|
@@ -4995,6 +5010,130 @@ declare function workflowSourceRef(runId: string): string;
|
|
|
4995
5010
|
declare function hashRunArgs(args: unknown): string | undefined;
|
|
4996
5011
|
declare function createEngine(options: CreateEngineOptions): Engine;
|
|
4997
5012
|
//#endregion
|
|
5013
|
+
//#region src/orchestrator/finish-validators.d.ts
|
|
5014
|
+
/**
|
|
5015
|
+
* One child as the finish validators see it (the RV-202 provenance
|
|
5016
|
+
* contract): a pure read of the durable state the orchestrator already
|
|
5017
|
+
* tracks, identical live and on replay.
|
|
5018
|
+
*/
|
|
5019
|
+
interface FinishValidationChild {
|
|
5020
|
+
/** The spawn handle (the journal seq, stable across resume). */
|
|
5021
|
+
readonly handle: number;
|
|
5022
|
+
/** The child's node identity, the same one acceptance reasons use. */
|
|
5023
|
+
readonly nodeId: string;
|
|
5024
|
+
/** The terminal status, or 'running' for a child unsettled at finish time. */
|
|
5025
|
+
readonly status: string;
|
|
5026
|
+
/**
|
|
5027
|
+
* The child's full output serialized (a raw string verbatim, anything
|
|
5028
|
+
* else JSON; a failed child's errorMessage), '' while unsettled. The
|
|
5029
|
+
* same serialization the child result evidence tools page.
|
|
5030
|
+
*/
|
|
5031
|
+
readonly text: string;
|
|
5032
|
+
}
|
|
5033
|
+
/** What a {@link FinishValidator} judges. */
|
|
5034
|
+
interface FinishValidationInput {
|
|
5035
|
+
/** The finish call's `result` argument exactly as the model passed it. */
|
|
5036
|
+
readonly result: Json | null;
|
|
5037
|
+
/**
|
|
5038
|
+
* The result as text: a string result verbatim, anything else its JSON
|
|
5039
|
+
* serialization (the same convention the child result evidence tools
|
|
5040
|
+
* use), so textual validators never re-implement serialization.
|
|
5041
|
+
*/
|
|
5042
|
+
readonly text: string;
|
|
5043
|
+
/**
|
|
5044
|
+
* Every spawned child at finish time, in spawn order (the RV-202
|
|
5045
|
+
* provenance contract). Optional in the TYPE only so hand built
|
|
5046
|
+
* inputs stay source compatible; the orchestrator runtime always
|
|
5047
|
+
* supplies it, so validators can hold the finish result against the
|
|
5048
|
+
* evidence the children actually produced.
|
|
5049
|
+
*/
|
|
5050
|
+
readonly children?: readonly FinishValidationChild[];
|
|
5051
|
+
}
|
|
5052
|
+
/** The verdict of one validator over one finish attempt. */
|
|
5053
|
+
type FinishValidationVerdict = {
|
|
5054
|
+
ok: true;
|
|
5055
|
+
} | {
|
|
5056
|
+
ok: false;
|
|
5057
|
+
reasons: string[];
|
|
5058
|
+
};
|
|
5059
|
+
/**
|
|
5060
|
+
* A deterministic host validator of the orchestrator finish result.
|
|
5061
|
+
* `validate` must be pure, synchronous host code: no model calls, no
|
|
5062
|
+
* clock, no filesystem, because a verdict must reproduce on replay and a
|
|
5063
|
+
* throwing validator is a host defect that fails the run as ConfigError
|
|
5064
|
+
* (never journaled, never granted a repair turn).
|
|
5065
|
+
*/
|
|
5066
|
+
interface FinishValidator {
|
|
5067
|
+
/**
|
|
5068
|
+
* Unique within one orchestrate call; appears in the journaled
|
|
5069
|
+
* verdicts, the repair feedback, and the orchestrator prompt.
|
|
5070
|
+
*/
|
|
5071
|
+
readonly name: string;
|
|
5072
|
+
validate(input: FinishValidationInput): FinishValidationVerdict;
|
|
5073
|
+
}
|
|
5074
|
+
/**
|
|
5075
|
+
* Requires every named section to appear LITERALLY in the result text
|
|
5076
|
+
* (a heading like 'FINDINGS' or any marker the goal demands). Default
|
|
5077
|
+
* name 'required-sections'; pass `name` to run several instances.
|
|
5078
|
+
*/
|
|
5079
|
+
declare function requiredSectionsValidator(options: {
|
|
5080
|
+
sections: string[];
|
|
5081
|
+
name?: string;
|
|
5082
|
+
}): FinishValidator;
|
|
5083
|
+
/**
|
|
5084
|
+
* Requires the result to be a JSON object carrying every named field
|
|
5085
|
+
* with a substantial value: present, not null, and not an empty or
|
|
5086
|
+
* whitespace only string (empty arrays, zero, and false COUNT as
|
|
5087
|
+
* present; emptiness rules beyond strings belong to a custom
|
|
5088
|
+
* validator). Default name 'required-fields'.
|
|
5089
|
+
*/
|
|
5090
|
+
declare function requiredFieldsValidator(options: {
|
|
5091
|
+
fields: string[];
|
|
5092
|
+
name?: string;
|
|
5093
|
+
}): FinishValidator;
|
|
5094
|
+
/** The default citation shape: a path with an extension, a colon, a line number. */
|
|
5095
|
+
declare const DEFAULT_CITATION_PATTERN = "[\\w./-]+\\.\\w+:\\d+";
|
|
5096
|
+
/** The default preserved share, the improvement plan's RV-202 gate. */
|
|
5097
|
+
declare const DEFAULT_EVIDENCE_MIN_SHARE = .95;
|
|
5098
|
+
/**
|
|
5099
|
+
* The RV-202 evidence preservation contract: the finish result must
|
|
5100
|
+
* PRESERVE the citations the children actually produced. Distinct
|
|
5101
|
+
* matches of `pattern` are collected across the outputs of children
|
|
5102
|
+
* settled 'ok' (spawn order); at least `minShare` of them (default
|
|
5103
|
+
* {@link DEFAULT_EVIDENCE_MIN_SHARE}, the plan's 95 percent gate,
|
|
5104
|
+
* compared as a ceiling on the required count so an exact boundary like
|
|
5105
|
+
* 19 of 20 passes) must appear literally in the result text. Zero child
|
|
5106
|
+
* citations pass vacuously. With `requireKnown: true` the contract also
|
|
5107
|
+
* runs in reverse: every citation in the RESULT must appear in some
|
|
5108
|
+
* child's output, so a fabricated but pattern valid citation is
|
|
5109
|
+
* rejected instead of silently counting as evidence. Rejection reasons
|
|
5110
|
+
* list the missing (and unknown) citations, capped at 20, so the repair
|
|
5111
|
+
* turn can restore them. Purely textual and deterministic; checking
|
|
5112
|
+
* that cited targets EXIST on disk is host territory (a custom
|
|
5113
|
+
* validator), not this contract. Default name 'evidence-preserved'.
|
|
5114
|
+
*/
|
|
5115
|
+
declare function evidencePreservedValidator(options?: {
|
|
5116
|
+
pattern?: string;
|
|
5117
|
+
flags?: string;
|
|
5118
|
+
minShare?: number;
|
|
5119
|
+
requireKnown?: boolean;
|
|
5120
|
+
name?: string;
|
|
5121
|
+
}): FinishValidator;
|
|
5122
|
+
/**
|
|
5123
|
+
* Requires at least `min` matches of `pattern` in the result text (the
|
|
5124
|
+
* plan's citation and source count checks: a file:line pattern, a URL
|
|
5125
|
+
* pattern). The pattern compiles at construction (invalid patterns are a
|
|
5126
|
+
* ConfigError before any run exists) and matches globally; `min` is a
|
|
5127
|
+
* positive integer. Default name 'min-matches'; pass `name` to run
|
|
5128
|
+
* several instances, because names must be unique per orchestrate call.
|
|
5129
|
+
*/
|
|
5130
|
+
declare function minMatchesValidator(options: {
|
|
5131
|
+
pattern: string;
|
|
5132
|
+
flags?: string;
|
|
5133
|
+
min: number;
|
|
5134
|
+
name?: string;
|
|
5135
|
+
}): FinishValidator;
|
|
5136
|
+
//#endregion
|
|
4998
5137
|
//#region src/orchestrator/handles.d.ts
|
|
4999
5138
|
/** The per-child digest handed to the orchestrator. */
|
|
5000
5139
|
interface TaskDigest {
|
|
@@ -5495,6 +5634,47 @@ interface OrchestrateAcceptance {
|
|
|
5495
5634
|
minSuccessful: number;
|
|
5496
5635
|
};
|
|
5497
5636
|
}
|
|
5637
|
+
/** How many rejected finishes are repaired by default: the plan's repair once. */
|
|
5638
|
+
declare const DEFAULT_FINISH_MAX_REPAIRS = 1;
|
|
5639
|
+
/**
|
|
5640
|
+
* The opt in deterministic validation of the orchestrator finish result
|
|
5641
|
+
* (the v1.40.0 improvement plan's RV-204 slice). Every SCHEMA valid
|
|
5642
|
+
* finish({ result }) call first passes the configured host validators;
|
|
5643
|
+
* a rejection returns the failure reasons to the model as the call's
|
|
5644
|
+
* error tool result and the turn continues (a repair turn: the model
|
|
5645
|
+
* fixes the result and calls finish again), bounded by maxRepairs. A
|
|
5646
|
+
* rejection past the bound fails the run with the typed FailRunError
|
|
5647
|
+
* (code 'fail_run', data.source 'orchestrator_finish_validation'),
|
|
5648
|
+
* BEFORE the acceptance settle, so acceptance never judges a finish the
|
|
5649
|
+
* validators rejected. Every verdict journals as ONE decision entry
|
|
5650
|
+
* keyed by the finish call id (decisionType
|
|
5651
|
+
* 'orchestrator_finish_validation'), so a resume rolls the SAME
|
|
5652
|
+
* verdicts forward without re-running validator code, and the whole
|
|
5653
|
+
* exchange replays without new paid calls. The toolset never changes
|
|
5654
|
+
* (the contract rides the orchestrator prompt), zero configuration adds
|
|
5655
|
+
* zero journal entries, and the budget cap paths keep their posture:
|
|
5656
|
+
* the reserved finalize dispatch is never validated, exactly as
|
|
5657
|
+
* acceptance never judges it. Repair turns spend from the
|
|
5658
|
+
* orchestrator's ordinary limits and ceilings (maxTurns, budget caps,
|
|
5659
|
+
* the root budgetUsd); maxRepairs is the explicit bound, and a
|
|
5660
|
+
* dedicated repair budget reserve is deliberately out of scope here.
|
|
5661
|
+
*/
|
|
5662
|
+
interface FinishValidationSpec {
|
|
5663
|
+
/**
|
|
5664
|
+
* Run in configuration order on every schema valid finish call; names
|
|
5665
|
+
* must be unique (pass `name` to a factory to run several instances).
|
|
5666
|
+
* A validator that THROWS is a host defect: the run fails as
|
|
5667
|
+
* ConfigError, nothing journals, and no repair turn is granted.
|
|
5668
|
+
*/
|
|
5669
|
+
validators: FinishValidator[];
|
|
5670
|
+
/**
|
|
5671
|
+
* How many rejected finishes are returned to the model for repair
|
|
5672
|
+
* before the run fails; a nonnegative integer, default
|
|
5673
|
+
* {@link DEFAULT_FINISH_MAX_REPAIRS}. Zero means the first rejected
|
|
5674
|
+
* finish fails the run.
|
|
5675
|
+
*/
|
|
5676
|
+
maxRepairs?: number;
|
|
5677
|
+
}
|
|
5498
5678
|
interface OrchestrateOptions {
|
|
5499
5679
|
model?: ModelSpec;
|
|
5500
5680
|
/** Registered profile names to advertise; default: every profile. */
|
|
@@ -5529,6 +5709,11 @@ interface OrchestrateOptions {
|
|
|
5529
5709
|
/** The opt in child completion policy; see {@link OrchestrateAcceptance}. */
|
|
5530
5710
|
acceptance?: OrchestrateAcceptance;
|
|
5531
5711
|
/**
|
|
5712
|
+
* The opt in deterministic host validation of the finish result, with
|
|
5713
|
+
* bounded repair; see {@link FinishValidationSpec}.
|
|
5714
|
+
*/
|
|
5715
|
+
finishValidation?: FinishValidationSpec;
|
|
5716
|
+
/**
|
|
5532
5717
|
* Opt in to the evidence tools `get_child_result` and
|
|
5533
5718
|
* `read_child_artifact` (the v1.40.0 improvement plan's narrow RV-201
|
|
5534
5719
|
* slice). The digest an await returns is a wake signal truncated to 400
|
|
@@ -7039,4 +7224,4 @@ interface SandboxBridge {
|
|
|
7039
7224
|
declare const SANDBOX_AGENT_OPT_KEYS: readonly string[];
|
|
7040
7225
|
declare function createSandboxBridge(ctx: Ctx<never>, options: SandboxBridgeOptions): SandboxBridge;
|
|
7041
7226
|
//#endregion
|
|
7042
|
-
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, BaseAppend, BriefOpts, BudgetAccountView, BudgetDefaults, BudgetExhaustedError, BudgetExhaustionDiagnostics, BudgetHooks, BudgetReserve, type Bytes, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, CacheHint, CacheTtl, CanUseTool, CanonicalId, CanonicalIdentity, CanonicalLadderSpec, CanonicalModelSpec, ChatEvent, ChatRequest, CheckpointState, ChildArtifactPage, ChildIdentityInput, ChildResultPage, type ClaimClass, type ClaimOp, type ClaimStatus, ClaimValidationOptions, CollectOpts, CollectedTurn, CompactionConfig, CompiledPermissionChain, CompiledWorkflow, ConfigError, type CoreEvents, CostAttribution, CostAttributionFacts, CostReport, CreateEngineOptions, Ctx, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_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, EscalationDecisionAbortedError, EscalationDigest, EscalationKind, EscalationLimits, EscalationOptions, EscalationReport, EscalationRequest, EventBus, type EvidenceRef, ExtensionAppendInput, ExtensionDispatchSpec, ExternalIdentityInput, ExternalRegistry, ExtractNecessityInput, FINALIZE_SYNTHESIS_INSTRUCTION, FINISH_SCHEMA, FINISH_TOOL_NAME, FailRunError, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, FileModelKnowledgeStore, FileModelKnowledgeStoreOptions, FileTranscriptStore, FinishInfo, GET_CHILD_RESULT_SCHEMA, GET_CHILD_RESULT_TOOL_NAME, Gate, GateAudit, type GateRecord, GitWorktreeProvider, GitWorktreeProviderOptions, GraftBoot, HashVersion, HookVerdict, INBOX_PROPOSAL_TTL_DAYS, IdentityInput, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, InvocationRole, type IsolationProvider, type IsolationSpec, Issue$1 as Issue, JournalCompatSubCode, JournalCompatibilityError, JournalEntry, JournalMatcher, JournalMissError, JournalOperation, JournalOrderViolation, JournalSerializationHook, type JournalStore, type Json, JsonSchema, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, type KbProposal, type KbProposalTrigger, KeyDeriver, KeyRing, KeyedLimiter, KnowledgeCasError, type KnowledgeSnapshot, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LadderSpec, type LeasableStore, type Lease, LeaseHeldError, Ledger, LineageCounters, LineageIndex, LineageRef, LineageRelation, LineageStats, LogicalTaskId, MASKED_SECRET, MAX_CHILD_RESULT_PAGE_CHARS, MAX_DEPTH_CEILING, MatchResult, McpConfig, McpToolSource, MechanicalGateProfile, MechanicalGateVerdict, type MetaLookupStore, type ModelCaps, ModelChoice, type ModelClaim, ModelEpochInputs, type ModelKnowledgeHandle, type ModelKnowledgeStore, ModelListConstraint, ModelRef, ModelRetry, ModelSpec, Msg, NoProgressDetector, NodeId, NodeLinkValue, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OnEscalation, OperationDisposition, OrchestrateAcceptance, OrchestrateOptions, OrchestratorBudgetSpec, OrchestratorCapConfigError, OrchestratorExtension, OrchestratorExtensionIO, OrchestratorRuntime, Out, PARALLEL_AGENTS_SCHEMA, ParallelSiteCounter, Part, PendingExternal, PendingToolTurn, PermissionConfig, PermissionGate, PermissionHook, PermissionPreset, PermissionRule, PermissionVerdict, PhaseTarget, PipelineCollected, PipelineOpts, PlanInvariantError, PriceTable, PricedUsage, type Pricing, type PricingTier, type ProviderAdapter, QualityFloors, READ_CHILD_ARTIFACT_SCHEMA, READ_CHILD_ARTIFACT_TOOL_NAME, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, 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, hasMetaLookup, hashRunArgs, hashWorkflowBody, hashWorkflowSource, identityJcs, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lexShellCommand, liftRetainedParts, lineageWeightOf, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, mergeUsageLimits, metaMatchesFilter, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, readRunMeta, readTerminationInit, 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, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateUsageLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
|
|
7227
|
+
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, BaseAppend, BriefOpts, BudgetAccountView, BudgetDefaults, BudgetExhaustedError, BudgetExhaustionDiagnostics, BudgetHooks, BudgetReserve, type Bytes, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, CacheHint, CacheTtl, CanUseTool, CanonicalId, CanonicalIdentity, CanonicalLadderSpec, CanonicalModelSpec, ChatEvent, ChatRequest, CheckpointState, ChildArtifactPage, ChildIdentityInput, ChildResultPage, type ClaimClass, type ClaimOp, type ClaimStatus, ClaimValidationOptions, CollectOpts, CollectedTurn, CompactionConfig, CompiledPermissionChain, CompiledWorkflow, ConfigError, type CoreEvents, CostAttribution, CostAttributionFacts, CostReport, CreateEngineOptions, Ctx, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DebitResult, DeclaredLadder, DedupIndex, DedupNote, DerivedKey, DeriverRegistry, DispositionRule, DispositionTable, DonorCandidate, DonorRef, DroppedItem, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EVENT_SEGMENT_STRIDE, EffectiveUsageLimits, Effort, Engine, EngineDefaults, EntryKind, EntryRef, EntryStatus, ErrorClass, ErrorCode, ErrorPolicy, EscalatedResult, EscalationDecision, EscalationDecisionAbortedError, EscalationDigest, EscalationKind, EscalationLimits, EscalationOptions, EscalationReport, EscalationRequest, EventBus, type EvidenceRef, ExtensionAppendInput, ExtensionDispatchSpec, ExternalIdentityInput, ExternalRegistry, ExtractNecessityInput, FINALIZE_SYNTHESIS_INSTRUCTION, FINISH_SCHEMA, FINISH_TOOL_NAME, FailRunError, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, FileModelKnowledgeStore, FileModelKnowledgeStoreOptions, FileTranscriptStore, FinishInfo, FinishValidationChild, FinishValidationInput, FinishValidationSpec, FinishValidationVerdict, FinishValidator, GET_CHILD_RESULT_SCHEMA, GET_CHILD_RESULT_TOOL_NAME, Gate, GateAudit, type GateRecord, GitWorktreeProvider, GitWorktreeProviderOptions, GraftBoot, HashVersion, HookVerdict, INBOX_PROPOSAL_TTL_DAYS, IdentityInput, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, InvocationRole, type IsolationProvider, type IsolationSpec, Issue$1 as Issue, JournalCompatSubCode, JournalCompatibilityError, JournalEntry, JournalMatcher, JournalMissError, JournalOperation, JournalOrderViolation, JournalSerializationHook, type JournalStore, type Json, JsonSchema, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, type KbProposal, type KbProposalTrigger, KeyDeriver, KeyRing, KeyedLimiter, KnowledgeCasError, type KnowledgeSnapshot, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LadderSpec, type LeasableStore, type Lease, LeaseHeldError, Ledger, LineageCounters, LineageIndex, LineageRef, LineageRelation, LineageStats, LogicalTaskId, MASKED_SECRET, MAX_CHILD_RESULT_PAGE_CHARS, MAX_DEPTH_CEILING, MatchResult, McpConfig, McpToolSource, MechanicalGateProfile, MechanicalGateVerdict, type MetaLookupStore, type ModelCaps, ModelChoice, type ModelClaim, ModelEpochInputs, type ModelKnowledgeHandle, type ModelKnowledgeStore, ModelListConstraint, ModelRef, ModelRetry, ModelSpec, Msg, NoProgressDetector, NodeId, NodeLinkValue, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OnEscalation, OperationDisposition, OrchestrateAcceptance, OrchestrateOptions, OrchestratorBudgetSpec, OrchestratorCapConfigError, OrchestratorExtension, OrchestratorExtensionIO, OrchestratorRuntime, Out, PARALLEL_AGENTS_SCHEMA, ParallelSiteCounter, Part, PendingExternal, PendingToolTurn, PermissionConfig, PermissionGate, PermissionHook, PermissionPreset, PermissionRule, PermissionVerdict, PhaseTarget, PipelineCollected, PipelineOpts, PlanInvariantError, PriceTable, PricedUsage, type Pricing, type PricingTier, type ProviderAdapter, QualityFloors, READ_CHILD_ARTIFACT_SCHEMA, READ_CHILD_ARTIFACT_TOOL_NAME, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, 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, evidencePreservedValidator, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, foldTermination, formatRePrompt, formatScopePath, hasMetaLookup, hashRunArgs, hashWorkflowBody, hashWorkflowSource, identityJcs, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lexShellCommand, liftRetainedParts, lineageWeightOf, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, readRunMeta, readTerminationInit, registryKeyRing, remeasureQueue, replayDisposition, requiredFieldsValidator, requiredSectionsValidator, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, selectStructuredOutputTier, shouldCompact, snapshotUsage, spawnDepthOf, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, usageViolations, validateEditorialCommit, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateUsageLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
|
package/dist/index.js
CHANGED
|
@@ -8920,6 +8920,21 @@ async function runAgent(options) {
|
|
|
8920
8920
|
}));
|
|
8921
8921
|
continue;
|
|
8922
8922
|
}
|
|
8923
|
+
const finishArgs = validation.value;
|
|
8924
|
+
const hostVerdict = options.terminalTool.validate === void 0 ? void 0 : await options.terminalTool.validate({
|
|
8925
|
+
id: call.id,
|
|
8926
|
+
result: finishArgs.result ?? null
|
|
8927
|
+
});
|
|
8928
|
+
if (hostVerdict !== void 0 && !hostVerdict.ok) {
|
|
8929
|
+
events?.emit({
|
|
8930
|
+
type: "tool:end",
|
|
8931
|
+
toolName: gatedCall.name,
|
|
8932
|
+
outcome: "error",
|
|
8933
|
+
durationMs: now() - gateStartedAt
|
|
8934
|
+
});
|
|
8935
|
+
parts.push(errorPart(call, hostVerdict.feedback));
|
|
8936
|
+
continue;
|
|
8937
|
+
}
|
|
8923
8938
|
events?.emit({
|
|
8924
8939
|
type: "tool:end",
|
|
8925
8940
|
toolName: gatedCall.name,
|
|
@@ -8935,7 +8950,7 @@ async function runAgent(options) {
|
|
|
8935
8950
|
return {
|
|
8936
8951
|
parts,
|
|
8937
8952
|
limitHit: false,
|
|
8938
|
-
finished:
|
|
8953
|
+
finished: finishArgs.result ?? null
|
|
8939
8954
|
};
|
|
8940
8955
|
}
|
|
8941
8956
|
toolCallsUsed += 1;
|
|
@@ -10569,6 +10584,163 @@ var AdmissionController = class {
|
|
|
10569
10584
|
}
|
|
10570
10585
|
};
|
|
10571
10586
|
//#endregion
|
|
10587
|
+
//#region src/orchestrator/finish-validators.ts
|
|
10588
|
+
/**
|
|
10589
|
+
* Deterministic host validation of the orchestrator finish result (the
|
|
10590
|
+
* v1.40.0 improvement plan's RV-204 slice). A validator is plain
|
|
10591
|
+
* synchronous host code judging the finish({ result }) argument; the
|
|
10592
|
+
* orchestrator runtime runs the configured set on every schema valid
|
|
10593
|
+
* finish call, returns the failure reasons to the model as the call's
|
|
10594
|
+
* error tool result (a bounded repair turn), and fails the run with a
|
|
10595
|
+
* typed error when the repair bound is exhausted. Verdicts journal as
|
|
10596
|
+
* decision entries, so a resume rolls the SAME verdicts forward without
|
|
10597
|
+
* re-running validator code.
|
|
10598
|
+
*/
|
|
10599
|
+
const ok = { ok: true };
|
|
10600
|
+
function requireNonEmptyStrings(values, what) {
|
|
10601
|
+
if (!Array.isArray(values) || values.length === 0) throw new ConfigError(`${what} must be a non empty array of strings`);
|
|
10602
|
+
for (const value of values) if (typeof value !== "string" || value.length === 0) throw new ConfigError(`${what} must contain only non empty strings`);
|
|
10603
|
+
return values;
|
|
10604
|
+
}
|
|
10605
|
+
/**
|
|
10606
|
+
* Requires every named section to appear LITERALLY in the result text
|
|
10607
|
+
* (a heading like 'FINDINGS' or any marker the goal demands). Default
|
|
10608
|
+
* name 'required-sections'; pass `name` to run several instances.
|
|
10609
|
+
*/
|
|
10610
|
+
function requiredSectionsValidator(options) {
|
|
10611
|
+
const sections = requireNonEmptyStrings(options.sections, "requiredSectionsValidator sections");
|
|
10612
|
+
return {
|
|
10613
|
+
name: options.name ?? "required-sections",
|
|
10614
|
+
validate: (input) => {
|
|
10615
|
+
const missing = sections.filter((section) => !input.text.includes(section));
|
|
10616
|
+
return missing.length === 0 ? ok : {
|
|
10617
|
+
ok: false,
|
|
10618
|
+
reasons: missing.map((section) => `required section '${section}' is missing`)
|
|
10619
|
+
};
|
|
10620
|
+
}
|
|
10621
|
+
};
|
|
10622
|
+
}
|
|
10623
|
+
/**
|
|
10624
|
+
* Requires the result to be a JSON object carrying every named field
|
|
10625
|
+
* with a substantial value: present, not null, and not an empty or
|
|
10626
|
+
* whitespace only string (empty arrays, zero, and false COUNT as
|
|
10627
|
+
* present; emptiness rules beyond strings belong to a custom
|
|
10628
|
+
* validator). Default name 'required-fields'.
|
|
10629
|
+
*/
|
|
10630
|
+
function requiredFieldsValidator(options) {
|
|
10631
|
+
const fields = requireNonEmptyStrings(options.fields, "requiredFieldsValidator fields");
|
|
10632
|
+
return {
|
|
10633
|
+
name: options.name ?? "required-fields",
|
|
10634
|
+
validate: (input) => {
|
|
10635
|
+
const result = input.result;
|
|
10636
|
+
if (typeof result !== "object" || result === null || Array.isArray(result)) return {
|
|
10637
|
+
ok: false,
|
|
10638
|
+
reasons: ["the finish result is not a JSON object"]
|
|
10639
|
+
};
|
|
10640
|
+
const record = result;
|
|
10641
|
+
const reasons = [];
|
|
10642
|
+
for (const field of fields) {
|
|
10643
|
+
const value = record[field];
|
|
10644
|
+
if (value === void 0 || value === null) reasons.push(`required field '${field}' is missing`);
|
|
10645
|
+
else if (typeof value === "string" && value.trim().length === 0) reasons.push(`required field '${field}' is empty`);
|
|
10646
|
+
}
|
|
10647
|
+
return reasons.length === 0 ? ok : {
|
|
10648
|
+
ok: false,
|
|
10649
|
+
reasons
|
|
10650
|
+
};
|
|
10651
|
+
}
|
|
10652
|
+
};
|
|
10653
|
+
}
|
|
10654
|
+
/** The default citation shape: a path with an extension, a colon, a line number. */
|
|
10655
|
+
const DEFAULT_CITATION_PATTERN = "[\\w./-]+\\.\\w+:\\d+";
|
|
10656
|
+
/** The default preserved share, the improvement plan's RV-202 gate. */
|
|
10657
|
+
const DEFAULT_EVIDENCE_MIN_SHARE = .95;
|
|
10658
|
+
const MAX_LISTED_CITATIONS = 20;
|
|
10659
|
+
function listCitations(values) {
|
|
10660
|
+
return values.length <= MAX_LISTED_CITATIONS ? values.join(", ") : `${values.slice(0, MAX_LISTED_CITATIONS).join(", ")} and ${String(values.length - MAX_LISTED_CITATIONS)} more`;
|
|
10661
|
+
}
|
|
10662
|
+
/**
|
|
10663
|
+
* The RV-202 evidence preservation contract: the finish result must
|
|
10664
|
+
* PRESERVE the citations the children actually produced. Distinct
|
|
10665
|
+
* matches of `pattern` are collected across the outputs of children
|
|
10666
|
+
* settled 'ok' (spawn order); at least `minShare` of them (default
|
|
10667
|
+
* {@link DEFAULT_EVIDENCE_MIN_SHARE}, the plan's 95 percent gate,
|
|
10668
|
+
* compared as a ceiling on the required count so an exact boundary like
|
|
10669
|
+
* 19 of 20 passes) must appear literally in the result text. Zero child
|
|
10670
|
+
* citations pass vacuously. With `requireKnown: true` the contract also
|
|
10671
|
+
* runs in reverse: every citation in the RESULT must appear in some
|
|
10672
|
+
* child's output, so a fabricated but pattern valid citation is
|
|
10673
|
+
* rejected instead of silently counting as evidence. Rejection reasons
|
|
10674
|
+
* list the missing (and unknown) citations, capped at 20, so the repair
|
|
10675
|
+
* turn can restore them. Purely textual and deterministic; checking
|
|
10676
|
+
* that cited targets EXIST on disk is host territory (a custom
|
|
10677
|
+
* validator), not this contract. Default name 'evidence-preserved'.
|
|
10678
|
+
*/
|
|
10679
|
+
function evidencePreservedValidator(options) {
|
|
10680
|
+
const pattern = options?.pattern ?? "[\\w./-]+\\.\\w+:\\d+";
|
|
10681
|
+
const flags = options?.flags ?? "";
|
|
10682
|
+
const globalFlags = flags.includes("g") ? flags : `${flags}g`;
|
|
10683
|
+
try {
|
|
10684
|
+
new RegExp(pattern, globalFlags);
|
|
10685
|
+
} catch (thrown) {
|
|
10686
|
+
throw new ConfigError(`evidencePreservedValidator pattern does not compile: ${thrown instanceof Error ? thrown.message : String(thrown)}`);
|
|
10687
|
+
}
|
|
10688
|
+
const minShare = options?.minShare ?? .95;
|
|
10689
|
+
if (typeof minShare !== "number" || !Number.isFinite(minShare) || minShare <= 0 || minShare > 1) throw new ConfigError(`evidencePreservedValidator minShare must be a number in (0, 1]; got ${String(minShare)}`);
|
|
10690
|
+
return {
|
|
10691
|
+
name: options?.name ?? "evidence-preserved",
|
|
10692
|
+
validate: (input) => {
|
|
10693
|
+
const cited = /* @__PURE__ */ new Set();
|
|
10694
|
+
for (const child of input.children ?? []) {
|
|
10695
|
+
if (child.status !== "ok") continue;
|
|
10696
|
+
for (const match of child.text.match(new RegExp(pattern, globalFlags)) ?? []) cited.add(match);
|
|
10697
|
+
}
|
|
10698
|
+
const reasons = [];
|
|
10699
|
+
if (cited.size > 0) {
|
|
10700
|
+
const missing = [...cited].filter((citation) => !input.text.includes(citation));
|
|
10701
|
+
const preserved = cited.size - missing.length;
|
|
10702
|
+
if (preserved < Math.ceil(minShare * cited.size - 1e-9)) reasons.push(`evidence preservation ${String(preserved)} of ${String(cited.size)} child citations is below the required share ${String(minShare)}; missing: ${listCitations(missing)}`);
|
|
10703
|
+
}
|
|
10704
|
+
if (options?.requireKnown === true) {
|
|
10705
|
+
const fabricated = [...new Set(input.text.match(new RegExp(pattern, globalFlags)) ?? [])].filter((citation) => !cited.has(citation));
|
|
10706
|
+
if (fabricated.length > 0) reasons.push(`unknown citations not present in any child report: ${listCitations(fabricated)}`);
|
|
10707
|
+
}
|
|
10708
|
+
return reasons.length === 0 ? ok : {
|
|
10709
|
+
ok: false,
|
|
10710
|
+
reasons
|
|
10711
|
+
};
|
|
10712
|
+
}
|
|
10713
|
+
};
|
|
10714
|
+
}
|
|
10715
|
+
/**
|
|
10716
|
+
* Requires at least `min` matches of `pattern` in the result text (the
|
|
10717
|
+
* plan's citation and source count checks: a file:line pattern, a URL
|
|
10718
|
+
* pattern). The pattern compiles at construction (invalid patterns are a
|
|
10719
|
+
* ConfigError before any run exists) and matches globally; `min` is a
|
|
10720
|
+
* positive integer. Default name 'min-matches'; pass `name` to run
|
|
10721
|
+
* several instances, because names must be unique per orchestrate call.
|
|
10722
|
+
*/
|
|
10723
|
+
function minMatchesValidator(options) {
|
|
10724
|
+
const flags = options.flags ?? "";
|
|
10725
|
+
const globalFlags = flags.includes("g") ? flags : `${flags}g`;
|
|
10726
|
+
try {
|
|
10727
|
+
new RegExp(options.pattern, globalFlags);
|
|
10728
|
+
} catch (thrown) {
|
|
10729
|
+
throw new ConfigError(`minMatchesValidator pattern does not compile: ${thrown instanceof Error ? thrown.message : String(thrown)}`);
|
|
10730
|
+
}
|
|
10731
|
+
if (!Number.isInteger(options.min) || options.min < 1) throw new ConfigError(`minMatchesValidator min must be a positive integer; got ${String(options.min)}`);
|
|
10732
|
+
return {
|
|
10733
|
+
name: options.name ?? "min-matches",
|
|
10734
|
+
validate: (input) => {
|
|
10735
|
+
const found = input.text.match(new RegExp(options.pattern, globalFlags))?.length ?? 0;
|
|
10736
|
+
return found >= options.min ? ok : {
|
|
10737
|
+
ok: false,
|
|
10738
|
+
reasons: [`expected at least ${String(options.min)} matches of /${options.pattern}/${flags}; found ${String(found)}`]
|
|
10739
|
+
};
|
|
10740
|
+
}
|
|
10741
|
+
};
|
|
10742
|
+
}
|
|
10743
|
+
//#endregion
|
|
10572
10744
|
//#region src/orchestrator/handles.ts
|
|
10573
10745
|
/**
|
|
10574
10746
|
* The committed WakeDigest render budget (Appendix A: 400
|
|
@@ -10929,7 +11101,9 @@ const kOnRunning = Symbol("rulvar.onRunning");
|
|
|
10929
11101
|
/**
|
|
10930
11102
|
* Internal AgentOpts channel (M6-T07): names the terminal tool whose
|
|
10931
11103
|
* accepted call ends the loop with status ok (the orchestrator finish
|
|
10932
|
-
* tool)
|
|
11104
|
+
* tool), plus the optional host validation hook over the accepted call
|
|
11105
|
+
* (the RV-204 finish validators). Never part of the public AgentOpts
|
|
11106
|
+
* surface.
|
|
10933
11107
|
*/
|
|
10934
11108
|
const kTerminalTool = Symbol("rulvar.terminalTool");
|
|
10935
11109
|
/**
|
|
@@ -12549,6 +12723,8 @@ async function executeWorkflow(internals, wf, args) {
|
|
|
12549
12723
|
* cap, maxDepth, and the budget layers apply; no termination.init is
|
|
12550
12724
|
* written; escalated children simply settle into their digests.
|
|
12551
12725
|
*/
|
|
12726
|
+
/** How many rejected finishes are repaired by default: the plan's repair once. */
|
|
12727
|
+
const DEFAULT_FINISH_MAX_REPAIRS = 1;
|
|
12552
12728
|
const ORCHESTRATE_WORKFLOW_NAME = "rulvar-orchestrate";
|
|
12553
12729
|
/**
|
|
12554
12730
|
* One page of a string, for the child result evidence tools: maxChars is
|
|
@@ -12593,6 +12769,19 @@ function validateOrchestrateOptions(opts) {
|
|
|
12593
12769
|
if (policy !== "all-ok" && minSuccessful === void 0) throw new ConfigError(`orchestrate acceptance.childPolicy must be 'all-ok' or { minSuccessful: N }; got ${JSON.stringify(policy)}`);
|
|
12594
12770
|
if (policy !== "all-ok") requirePositiveInteger(minSuccessful, "orchestrate acceptance.childPolicy.minSuccessful");
|
|
12595
12771
|
}
|
|
12772
|
+
if (opts.finishValidation !== void 0) {
|
|
12773
|
+
const fv = opts.finishValidation;
|
|
12774
|
+
if (!Array.isArray(fv.validators) || fv.validators.length === 0) throw new ConfigError("orchestrate finishValidation.validators must be a non empty array of validators");
|
|
12775
|
+
const seen = /* @__PURE__ */ new Set();
|
|
12776
|
+
for (const candidate of fv.validators) {
|
|
12777
|
+
const validator = candidate;
|
|
12778
|
+
if (typeof validator.name !== "string" || validator.name.length === 0) throw new ConfigError("every orchestrate finish validator must carry a non empty string name");
|
|
12779
|
+
if (typeof validator.validate !== "function") throw new ConfigError(`orchestrate finish validator '${validator.name}' has no validate function`);
|
|
12780
|
+
if (seen.has(validator.name)) throw new ConfigError(`orchestrate finishValidation.validators names must be unique; '${validator.name}' repeats (pass name to the factory to run several instances)`);
|
|
12781
|
+
seen.add(validator.name);
|
|
12782
|
+
}
|
|
12783
|
+
if (fv.maxRepairs !== void 0) requireNonNegativeInteger(fv.maxRepairs, "orchestrate finishValidation.maxRepairs");
|
|
12784
|
+
}
|
|
12596
12785
|
const spec = opts.budget;
|
|
12597
12786
|
if (spec === void 0) return;
|
|
12598
12787
|
if (spec.capUsd !== void 0) requireNonNegativeNumber(spec.capUsd, "orchestrate budget.capUsd");
|
|
@@ -12614,6 +12803,18 @@ function orchestratorPrompt(goal, maxSpawns, extensionLines) {
|
|
|
12614
12803
|
].join("\n");
|
|
12615
12804
|
}
|
|
12616
12805
|
/**
|
|
12806
|
+
* The finish validation contract rides the PROMPT, never the toolset:
|
|
12807
|
+
* the finish tool definition stays byte identical in every
|
|
12808
|
+
* configuration, so the orchestrator toolset hash never moves (stricter
|
|
12809
|
+
* than the evidence tools opt in, which changes it by design).
|
|
12810
|
+
*/
|
|
12811
|
+
function finishValidationPromptLines(spec) {
|
|
12812
|
+
if (spec === void 0) return [];
|
|
12813
|
+
const names = spec.validators.map((validator) => validator.name).join(", ");
|
|
12814
|
+
const repairs = spec.maxRepairs ?? 1;
|
|
12815
|
+
return [`The host validates every finish({ result }) with deterministic validators: ${names}.`, "A rejected finish returns the failure reasons as the tool error result; repair the result and call finish again. " + (repairs === 0 ? "No repair attempt is granted: the first rejected finish fails the run." : repairs === 1 ? "At most one repair attempt is granted before the run fails." : `At most ${String(repairs)} repair attempts are granted before the run fails.`)];
|
|
12816
|
+
}
|
|
12817
|
+
/**
|
|
12617
12818
|
* Resolves per-spawn dispatch options against the engine registries
|
|
12618
12819
|
* (registered SchemaSpec and tool profile names; M7-T05). An
|
|
12619
12820
|
* unknown ref is a typed ConfigError, surfaced as a tool error to the
|
|
@@ -13448,10 +13649,116 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
13448
13649
|
}
|
|
13449
13650
|
});
|
|
13450
13651
|
}
|
|
13652
|
+
const tools = [...buildOrchestratorTools(orchestratorRuntime, fullCardText, { childResultTools: opts?.exposeChildResultTools === true }), ...extension?.tools(io) ?? []];
|
|
13653
|
+
/**
|
|
13654
|
+
* The RV-204 finish validation hook, installed on the terminal tool
|
|
13655
|
+
* channel only when validators are configured (zero configuration =
|
|
13656
|
+
* zero new journal entries and byte identical loop behavior; the
|
|
13657
|
+
* toolset never changes either way). Verdicts are decision entries
|
|
13658
|
+
* keyed by the finish call id: a replayed call returns the JOURNALED
|
|
13659
|
+
* verdict without re-running validator code, so the accepted result,
|
|
13660
|
+
* every repair exchange, and the final rejection reproduce on resume
|
|
13661
|
+
* even when the live validators drifted (the acceptance precedent).
|
|
13662
|
+
* The final rejection journals verdict 'rejected', arms the typed
|
|
13663
|
+
* FailRunError, and aborts the loop; the settle path throws it
|
|
13664
|
+
* BEFORE the acceptance settle (and the boot scan covers the crash
|
|
13665
|
+
* window between the entry and the run terminal), so acceptance
|
|
13666
|
+
* never judges a finish the validators rejected. A THROWING
|
|
13667
|
+
* validator is a host defect: the run fails as ConfigError, nothing
|
|
13668
|
+
* journals, and no repair turn is granted, so a fixed validator
|
|
13669
|
+
* re-runs live on the next resume.
|
|
13670
|
+
*/
|
|
13671
|
+
const validationSpec = opts?.finishValidation;
|
|
13672
|
+
const validationAbort = new AbortController();
|
|
13673
|
+
let validationTermination;
|
|
13674
|
+
const finishValidationError = (decision) => new FailRunError(`the orchestrator finish failed host validation with all ${String(decision.maxRepairs)} repair attempts spent: ` + decision.failed.map((f) => `validator '${f.name}' rejected: ${f.reasons.join("; ")}`).join("; "), { data: {
|
|
13675
|
+
source: "orchestrator_finish_validation",
|
|
13676
|
+
callId: decision.callId,
|
|
13677
|
+
failed: decision.failed,
|
|
13678
|
+
repairsUsed: decision.repairsUsed,
|
|
13679
|
+
maxRepairs: decision.maxRepairs
|
|
13680
|
+
} });
|
|
13681
|
+
const validationDecisions = () => internals.replayer.snapshot().filter((entry) => entry.kind === "decision" && entry.scope === callingState.scope && entry.value?.decisionType === "orchestrator_finish_validation").map((entry) => entry.value);
|
|
13682
|
+
const validateFinish = async (call) => {
|
|
13683
|
+
if (validationSpec === void 0) return { ok: true };
|
|
13684
|
+
const maxRepairs = validationSpec.maxRepairs ?? 1;
|
|
13685
|
+
const known = validationDecisions();
|
|
13686
|
+
let decision = known.find((candidate) => candidate.callId === call.id);
|
|
13687
|
+
if (decision === void 0) {
|
|
13688
|
+
const result = call.result ?? null;
|
|
13689
|
+
const children = [...records.values()].sort((a, b) => a.spawnOrdinal - b.spawnOrdinal).map((record) => ({
|
|
13690
|
+
handle: record.handle,
|
|
13691
|
+
nodeId: record.nodeId,
|
|
13692
|
+
status: record.settled?.status ?? "running",
|
|
13693
|
+
text: record.settled === void 0 ? "" : serializeChildOutput(record.settled)
|
|
13694
|
+
}));
|
|
13695
|
+
const input = {
|
|
13696
|
+
result,
|
|
13697
|
+
text: typeof result === "string" ? result : JSON.stringify(result),
|
|
13698
|
+
children
|
|
13699
|
+
};
|
|
13700
|
+
const failed = [];
|
|
13701
|
+
for (const validator of validationSpec.validators) {
|
|
13702
|
+
let verdict;
|
|
13703
|
+
try {
|
|
13704
|
+
verdict = validator.validate(input);
|
|
13705
|
+
} catch (thrown) {
|
|
13706
|
+
validationTermination = new ConfigError(`finish validator '${validator.name}' threw instead of returning a verdict: ` + (thrown instanceof Error ? thrown.message : String(thrown)));
|
|
13707
|
+
validationAbort.abort("rulvar:finish-validation");
|
|
13708
|
+
return {
|
|
13709
|
+
ok: false,
|
|
13710
|
+
feedback: { error: `finish validator '${validator.name}' is defective; the run fails` }
|
|
13711
|
+
};
|
|
13712
|
+
}
|
|
13713
|
+
if (!verdict.ok) failed.push({
|
|
13714
|
+
name: validator.name,
|
|
13715
|
+
reasons: verdict.reasons
|
|
13716
|
+
});
|
|
13717
|
+
}
|
|
13718
|
+
const repairsUsed = known.filter((candidate) => candidate.verdict !== "accepted").length;
|
|
13719
|
+
decision = {
|
|
13720
|
+
decisionType: "orchestrator_finish_validation",
|
|
13721
|
+
callId: call.id,
|
|
13722
|
+
verdict: failed.length === 0 ? "accepted" : repairsUsed < maxRepairs ? "repair" : "rejected",
|
|
13723
|
+
failed,
|
|
13724
|
+
repairsUsed,
|
|
13725
|
+
maxRepairs
|
|
13726
|
+
};
|
|
13727
|
+
await internals.replayer.appendSinglePhase({
|
|
13728
|
+
scope: callingState.scope,
|
|
13729
|
+
key: `finish-validation:${call.id}`,
|
|
13730
|
+
kind: "decision",
|
|
13731
|
+
status: "ok",
|
|
13732
|
+
spanId: internals.spans.mint(callingState.spanId),
|
|
13733
|
+
site: "orchestrator-finish-validation",
|
|
13734
|
+
value: decision
|
|
13735
|
+
});
|
|
13736
|
+
}
|
|
13737
|
+
if (decision.verdict === "accepted") return { ok: true };
|
|
13738
|
+
if (decision.verdict === "rejected") {
|
|
13739
|
+
validationTermination = finishValidationError(decision);
|
|
13740
|
+
validationAbort.abort("rulvar:finish-validation");
|
|
13741
|
+
return {
|
|
13742
|
+
ok: false,
|
|
13743
|
+
feedback: {
|
|
13744
|
+
error: "the finish result failed host validation and the repair bound is exhausted; the run fails",
|
|
13745
|
+
failed: decision.failed
|
|
13746
|
+
}
|
|
13747
|
+
};
|
|
13748
|
+
}
|
|
13749
|
+
return {
|
|
13750
|
+
ok: false,
|
|
13751
|
+
feedback: {
|
|
13752
|
+
error: "the finish result failed host validation; repair the result and call finish again",
|
|
13753
|
+
failed: decision.failed,
|
|
13754
|
+
repairsRemaining: decision.maxRepairs - decision.repairsUsed - 1
|
|
13755
|
+
}
|
|
13756
|
+
};
|
|
13757
|
+
};
|
|
13451
13758
|
const agentOpts = {
|
|
13452
13759
|
role: "orchestrate",
|
|
13453
13760
|
result: "full",
|
|
13454
|
-
tools
|
|
13761
|
+
tools,
|
|
13455
13762
|
...capState === void 0 ? {} : { estCost: capState.effectiveCapUsd - (orchestratorAccount === void 0 ? 0 : internals.budget.accountView(orchestratorAccount)?.finalizeReserveUsd ?? 0) },
|
|
13456
13763
|
...opts?.model === void 0 ? {} : { model: opts.model },
|
|
13457
13764
|
...opts?.limits === void 0 ? {} : { limits: opts.limits },
|
|
@@ -13460,7 +13767,10 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
13460
13767
|
orchSeq = seq;
|
|
13461
13768
|
recover().then(releaseRecovery, releaseRecovery);
|
|
13462
13769
|
},
|
|
13463
|
-
[kTerminalTool]: {
|
|
13770
|
+
[kTerminalTool]: {
|
|
13771
|
+
name: FINISH_TOOL_NAME,
|
|
13772
|
+
...validationSpec === void 0 ? {} : { validate: validateFinish }
|
|
13773
|
+
},
|
|
13464
13774
|
...(() => {
|
|
13465
13775
|
const priorCancelledRoot = internals.replayer.snapshot().filter((entry) => entry.kind === "agent" && entry.scope === callingState.scope && entry.status === "cancelled" && entry.checkpointRef !== void 0).at(-1);
|
|
13466
13776
|
return priorCancelledRoot?.checkpointRef === void 0 ? {} : { [kBootCheckpoint]: priorCancelledRoot.checkpointRef };
|
|
@@ -13468,7 +13778,8 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
13468
13778
|
};
|
|
13469
13779
|
const orchestratorState = { ...callingState };
|
|
13470
13780
|
if (orchestratorAccount !== void 0) orchestratorState.budgetScope = orchestratorAccount;
|
|
13471
|
-
|
|
13781
|
+
const loopBreakSignal = validationSpec === void 0 ? forcedFinishController.signal : AbortSignal.any([forcedFinishController.signal, validationAbort.signal]);
|
|
13782
|
+
orchestratorState.signal = callingState.signal === void 0 ? loopBreakSignal : AbortSignal.any([callingState.signal, loopBreakSignal]);
|
|
13472
13783
|
/**
|
|
13473
13784
|
* The reserved final wake: a FRESH agent entry on
|
|
13474
13785
|
* the restricted single-tool toolset (a different toolsetHash), a
|
|
@@ -13556,10 +13867,16 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
13556
13867
|
const bootTermination = extensionTermination;
|
|
13557
13868
|
if (bootTermination !== void 0) throw bootTermination;
|
|
13558
13869
|
if (capDecisionRef !== void 0) return await settleCapOutcome();
|
|
13559
|
-
|
|
13870
|
+
if (validationSpec !== void 0) {
|
|
13871
|
+
const priorRejection = validationDecisions().find((decision) => decision.verdict === "rejected");
|
|
13872
|
+
if (priorRejection !== void 0) throw finishValidationError(priorRejection);
|
|
13873
|
+
}
|
|
13874
|
+
const promptLines = [...extension?.promptLines?.() ?? [], ...finishValidationPromptLines(validationSpec)];
|
|
13875
|
+
const result = await runtime.runInScope(orchestratorState, () => ctx.agent(orchestratorPrompt(goal, opts?.maxSpawns, promptLines.length === 0 ? void 0 : promptLines), agentOpts));
|
|
13560
13876
|
const liveTermination = extensionTermination;
|
|
13561
13877
|
if (liveTermination !== void 0) throw liveTermination;
|
|
13562
13878
|
if (capDecisionRef !== void 0) return await settleCapOutcome();
|
|
13879
|
+
if (validationTermination !== void 0) throw validationTermination;
|
|
13563
13880
|
if (orchestratorAccount !== void 0) internals.cost.orchestrator.spentUsd = internals.budget.accountView(orchestratorAccount)?.spentUsd ?? 0;
|
|
13564
13881
|
if (result.status !== "ok") throw new ConfigError(`the orchestrator agent terminated with status '${result.status}'` + (result.errorMessage === void 0 ? "" : `: ${result.errorMessage}`));
|
|
13565
13882
|
if (opts?.acceptance === void 0) return result.output;
|
|
@@ -14782,4 +15099,4 @@ function createSandboxBridge(ctx, options) {
|
|
|
14782
15099
|
};
|
|
14783
15100
|
}
|
|
14784
15101
|
//#endregion
|
|
14785
|
-
export { AWAIT_SCHEMA, AdmissionController, AdmissionRejectedError, AgentCallError, BUDGET_ABORT_REASON, BudgetExhaustedError, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, ConfigError, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_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, EscalationDecisionAbortedError, EventBus, ExternalRegistry, FINALIZE_SYNTHESIS_INSTRUCTION, FINISH_SCHEMA, FINISH_TOOL_NAME, FailRunError, FileModelKnowledgeStore, FileTranscriptStore, GET_CHILD_RESULT_SCHEMA, GET_CHILD_RESULT_TOOL_NAME, GitWorktreeProvider, INBOX_PROPOSAL_TTL_DAYS, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, JournalCompatibilityError, JournalMatcher, JournalMissError, JournalOrderViolation, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, KeyedLimiter, KnowledgeCasError, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LeaseHeldError, LineageIndex, MASKED_SECRET, MAX_CHILD_RESULT_PAGE_CHARS, MAX_DEPTH_CEILING, ModelRetry, NoProgressDetector, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OrchestratorCapConfigError, PARALLEL_AGENTS_SCHEMA, ParallelSiteCounter, PlanInvariantError, READ_CHILD_ARTIFACT_SCHEMA, READ_CHILD_ARTIFACT_TOOL_NAME, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, 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, hasMetaLookup, hashRunArgs, hashWorkflowBody, hashWorkflowSource, identityJcs, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lexShellCommand, liftRetainedParts, lineageWeightOf, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, mergeUsageLimits, metaMatchesFilter, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, readRunMeta, readTerminationInit, 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, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateUsageLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
|
|
15102
|
+
export { AWAIT_SCHEMA, AdmissionController, AdmissionRejectedError, AgentCallError, BUDGET_ABORT_REASON, BudgetExhaustedError, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, ConfigError, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DedupIndex, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EVENT_SEGMENT_STRIDE, EscalationDecisionAbortedError, EventBus, ExternalRegistry, FINALIZE_SYNTHESIS_INSTRUCTION, FINISH_SCHEMA, FINISH_TOOL_NAME, FailRunError, FileModelKnowledgeStore, FileTranscriptStore, GET_CHILD_RESULT_SCHEMA, GET_CHILD_RESULT_TOOL_NAME, GitWorktreeProvider, INBOX_PROPOSAL_TTL_DAYS, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, JournalCompatibilityError, JournalMatcher, JournalMissError, JournalOrderViolation, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, KeyedLimiter, KnowledgeCasError, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LeaseHeldError, LineageIndex, MASKED_SECRET, MAX_CHILD_RESULT_PAGE_CHARS, MAX_DEPTH_CEILING, ModelRetry, NoProgressDetector, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OrchestratorCapConfigError, PARALLEL_AGENTS_SCHEMA, ParallelSiteCounter, PlanInvariantError, READ_CHILD_ARTIFACT_SCHEMA, READ_CHILD_ARTIFACT_TOOL_NAME, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, 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, evidencePreservedValidator, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, foldTermination, formatRePrompt, formatScopePath, hasMetaLookup, hashRunArgs, hashWorkflowBody, hashWorkflowSource, identityJcs, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lexShellCommand, liftRetainedParts, lineageWeightOf, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, readRunMeta, readTerminationInit, registryKeyRing, remeasureQueue, replayDisposition, requiredFieldsValidator, requiredSectionsValidator, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, selectStructuredOutputTier, shouldCompact, snapshotUsage, spawnDepthOf, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, usageViolations, validateEditorialCommit, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateUsageLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.44.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",
|