@rulvar/core 1.66.0 → 1.68.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 +54 -4
- package/dist/index.js +95 -9
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7058,6 +7058,25 @@ interface IncrementalSynthesisResult {
|
|
|
7058
7058
|
}[];
|
|
7059
7059
|
repeatedClaims?: RepeatedClaim[];
|
|
7060
7060
|
}
|
|
7061
|
+
/**
|
|
7062
|
+
* The machine-readable reason a CONFIGURED synthesis step was skipped
|
|
7063
|
+
* (the 1.65.0 experiment review, item 11.4): telemetry that shows zero
|
|
7064
|
+
* synthesize spend must say why instead of leaving the host to infer it
|
|
7065
|
+
* from the acceptance decision. 'synthesis_skipped_by_acceptance': the
|
|
7066
|
+
* acceptance policy rejected the finish, and a rejected run never pays
|
|
7067
|
+
* for the post-fan-in composing step (in 'incremental' mode the settled
|
|
7068
|
+
* notes were already paid during the run; the skipped step is the free
|
|
7069
|
+
* deterministic reconciliation). 'synthesis_skipped_by_budget_cap': the
|
|
7070
|
+
* orchestrator budget cap froze the plan, and a capped run settles
|
|
7071
|
+
* through the reserved finalizer, never synthesis. The reason is frozen
|
|
7072
|
+
* into the journaled decision that caused the skip (the acceptance
|
|
7073
|
+
* decision or the budget-cap decision), spread into the typed
|
|
7074
|
+
* FailRunError data on the failing paths, and announced by an info
|
|
7075
|
+
* 'orchestrator synthesis skipped' log event; it is absent everywhere
|
|
7076
|
+
* when synthesis is not configured or actually ran, so existing runs
|
|
7077
|
+
* stay byte identical.
|
|
7078
|
+
*/
|
|
7079
|
+
type OrchestrateSynthesisSkipReason = "synthesis_skipped_by_acceptance" | "synthesis_skipped_by_budget_cap";
|
|
7061
7080
|
declare const ORCHESTRATE_WORKFLOW_NAME = "rulvar-orchestrate";
|
|
7062
7081
|
/**
|
|
7063
7082
|
* Resolves per-spawn dispatch options against the engine registries
|
|
@@ -8416,8 +8435,17 @@ declare class FileTranscriptStore implements TranscriptStore {
|
|
|
8416
8435
|
}
|
|
8417
8436
|
//#endregion
|
|
8418
8437
|
//#region src/engine/invoice.d.ts
|
|
8419
|
-
/**
|
|
8420
|
-
|
|
8438
|
+
/**
|
|
8439
|
+
* How far a row's identity goes toward provider-side reconciliation.
|
|
8440
|
+
* `provider-id-present` asserts exactly what it names: the adapter
|
|
8441
|
+
* surfaced the provider's response id for this call, the join key a
|
|
8442
|
+
* host needs to line the row up against a provider statement. It does
|
|
8443
|
+
* NOT assert any statement, amount, or usage match: the library never
|
|
8444
|
+
* sees provider billing data, so those deeper reconciliation tiers are
|
|
8445
|
+
* host-side joins keyed on `responseId`, not verdicts this export can
|
|
8446
|
+
* make.
|
|
8447
|
+
*/
|
|
8448
|
+
type InvoiceReconciliation = "provider-id-present" | "missing-provider-id" | "unconfirmed" | "unattributed";
|
|
8421
8449
|
/** One billable provider call (or an unattributed usage remainder). */
|
|
8422
8450
|
interface InvoiceRow {
|
|
8423
8451
|
/** The terminal journal entry the row folds from. */
|
|
@@ -8436,6 +8464,15 @@ interface InvoiceRow {
|
|
|
8436
8464
|
usageApprox?: boolean;
|
|
8437
8465
|
/** This row priced at its own model's rate; absent when no price row covers it. */
|
|
8438
8466
|
usd?: number;
|
|
8467
|
+
/**
|
|
8468
|
+
* The additive FinOps column: this row's share of `totalUsd`, always
|
|
8469
|
+
* present (zero for rows on unpriced models). Shares are computed
|
|
8470
|
+
* within the row's own (entry, serving model) slice of the same
|
|
8471
|
+
* gross fold the totals run, proportional to per-row `usd`, and one
|
|
8472
|
+
* row absorbs the IEEE rounding dust, so summing `allocatedUsd` over
|
|
8473
|
+
* `rows` reproduces `totalUsd` exactly where summing `usd` does not.
|
|
8474
|
+
*/
|
|
8475
|
+
allocatedUsd: number;
|
|
8439
8476
|
/** The row lies under an abandoned subtree: in grossUsd, not in netUsd. */
|
|
8440
8477
|
abandoned?: true;
|
|
8441
8478
|
reconciliation: InvoiceReconciliation;
|
|
@@ -8449,12 +8486,25 @@ interface InvoiceExport {
|
|
|
8449
8486
|
netUsd: number;
|
|
8450
8487
|
/** The abandoned share: totalUsd - netUsd, equals CostReport.abandoned.usd. */
|
|
8451
8488
|
abandonedUsd: number;
|
|
8489
|
+
/**
|
|
8490
|
+
* How per-row `usd` was computed: each call priced individually at
|
|
8491
|
+
* the current table's rates. Always `'per-call'` today; declared so
|
|
8492
|
+
* finance tooling never has to guess the basis.
|
|
8493
|
+
*/
|
|
8494
|
+
pricingBasis: "per-call";
|
|
8495
|
+
/**
|
|
8496
|
+
* Always true: per-call `usd` values need not sum to `totalUsd`,
|
|
8497
|
+
* because a nonlinear price table prices an aggregate differently
|
|
8498
|
+
* from the sum of its parts. Sum `allocatedUsd` instead; it exists
|
|
8499
|
+
* precisely so a column sums to the total.
|
|
8500
|
+
*/
|
|
8501
|
+
rowUsdNonAdditive: true;
|
|
8452
8502
|
/** Usage on models absent from pricing, net and abandoned alike; never a silent zero. */
|
|
8453
8503
|
unpriced: Array<{
|
|
8454
8504
|
model: string;
|
|
8455
8505
|
usage: Usage;
|
|
8456
8506
|
}>;
|
|
8457
|
-
/** Rows whose reconciliation is not '
|
|
8507
|
+
/** Rows whose reconciliation is not 'provider-id-present'. */
|
|
8458
8508
|
reconciliationFailures: number;
|
|
8459
8509
|
/** Present and true when any contributing entry carried approximate usage. */
|
|
8460
8510
|
usageApprox?: boolean;
|
|
@@ -9168,4 +9218,4 @@ interface SandboxBridge {
|
|
|
9168
9218
|
declare const SANDBOX_AGENT_OPT_KEYS: readonly string[];
|
|
9169
9219
|
declare function createSandboxBridge(ctx: Ctx<never>, options: SandboxBridgeOptions): SandboxBridge;
|
|
9170
9220
|
//#endregion
|
|
9171
|
-
export { AWAIT_SCHEMA, AbandonAttempt, AbandonFold, AbandonPayload, AbandonedSpendView, AbortClass, type AdaptiveEvents, AdmissionController, AdmissionDecision, AdmissionRejectedError, AdmissionStatsBefore, AdmitLineage, AdmitRejectReason, AdmitSpec, AdmitVerdict, AgentCallError, AgentError, type AgentEvents, AgentIdentityInput, type AgentInvocationRow, AgentOpts, AgentProfile, AgentProfilePermissions, AgentProfileTemplateOptions, AgentResult, AgentResultMeta, AgentStatus, ApproachSignatureInputs, ApprovalDecision, ApprovalIdentityInput, Artifact, AttemptOutcomeClass, AuditCategory, AuditRecord, AuditRunsOptions, BUDGET_ABORT_REASON, BaseAppend, BriefOpts, BudgetAccountView, BudgetDefaults, BudgetExhaustedError, BudgetExhaustionDiagnostics, BudgetHooks, BudgetReserve, type Bytes, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, CacheHint, CacheTtl, CanUseTool, CanonicalId, CanonicalIdentity, CanonicalLadderSpec, CanonicalModelSpec, ChatEvent, ChatRequest, CheckpointState, ChildArtifactPage, ChildIdentityInput, ChildResultPage, type ClaimClass, type ClaimOp, type ClaimStatus, ClaimValidationOptions, CollectOpts, CollectedTurn, CompactionConfig, CompiledPermissionChain, CompiledWorkflow, ConfigError, type CoreEvents, CostAttribution, CostAttributionFacts, CostReport, CreateEngineOptions, type CriticalPath, 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, DEFAULT_SYNTHESIS_MAX_TURNS, DEFAULT_SYNTHESIS_NOTE_MAX_TURNS, DataKeyProvider, DebitResult, DeclaredLadder, DedupIndex, DedupNote, DedupedClaims, DerivedKey, DeriverRegistry, type DeterminismConfig, DeterminismError, type DeterminismEvents, type DeterminismMode, DispositionRule, DispositionTable, DonorCandidate, DonorRef, DroppedItem, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EVENT_SEGMENT_STRIDE, EffectiveUsageLimits, Effort, Engine, EngineDefaults, EngineQuotaConfig, EngineQuotaRuntime, EntryKind, EntryRef, EntryStatus, EnvelopeEncryption, EnvelopeEncryptionOptions, ErrorClass, ErrorCode, ErrorPolicy, EscalatedResult, EscalationDecision, EscalationDecisionAbortedError, EscalationDigest, EscalationKind, EscalationLimits, EscalationOptions, EscalationReport, EscalationRequest, EventBus, type EvidenceRef, type ExecutorRegistry, type ExplorationSummary, 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, IMPLEMENTATION_PROFILE_LIMITS, INBOX_PROPOSAL_TTL_DAYS, IdentityInput, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, IncrementalSynthesisResult, InvalidResolutionError, InvocationRole, type InvocationTable, InvoiceExport, InvoiceReconciliation, InvoiceRow, type IsolatedExecContext, type IsolatedExecRequest, type IsolatedExecutorTag, type IsolationProvider, type IsolationSpec, Issue$1 as Issue, JOURNAL_ENVELOPE_MARKER, JournalCompatSubCode, JournalCompatibilityError, JournalEntry, JournalMatcher, JournalMissError, JournalOperation, JournalOrderViolation, JournalSerializationContext, 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, MemoryQuotaLimiter, 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, OrchestrateSynthesis, OrchestratorBudgetSpec, OrchestratorCapConfigError, OrchestratorExtension, OrchestratorExtensionIO, OrchestratorRuntime, Out, PARALLEL_AGENTS_SCHEMA, PROGRESS_REPORT_TOOL_NAME, ParallelSiteCounter, Part, PendingExternal, PendingToolTurn, PermissionConfig, PermissionGate, PermissionHook, PermissionPreset, PermissionRule, PermissionVerdict, type PhaseRow, PhaseTarget, PipelineCollected, PipelineOpts, PlanInvariantError, PreflightAdmissionRow, PreflightFinding, PreflightInput, PreflightOrchestratorSpec, PreflightReport, PreflightSpawnReport, PreflightSpawnSpec, PreflightToolCeiling, PriceTable, PricedUsage, type Pricing, type PricingTier, ProgressReport, type ProviderAdapter, ProviderCallRecord, QUOTA_WINDOW_MS, QualityFloors, QuotaCounters, type QuotaDecision, type QuotaEstimate, type QuotaLimiter, type QuotaReservationRequest, QuotaRule, QuotaWindowSnapshot, READ_CHILD_ARTIFACT_SCHEMA, READ_CHILD_ARTIFACT_TOOL_NAME, RESEARCH_PROFILE_LIMITS, REVIEW_PROFILE_LIMITS, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, RUN_SETTLE_DECISION_TYPE, RandIdentityInput, RandPayload, ReconcileOptions, ReconcileResult, RefEntryAppender, RefEntryClassification, RefusalInfo, RepeatedClaim, ReplayDisposition, ReplayMode, ReplayPlanHashMismatch, Replayer, RepositoryResearchToolset, RepositoryResearchToolsetOptions, ResearchAgentProfileOptions, ResearchAgentProfileResult, ResearchEvidenceEntry, ResolutionArbiter, ResolutionAttempt, ResolutionBy, ResolutionFold, ResolutionLayer, ResolutionOutcome, ResolutionPayload, ResolvedInvocation, ResolvedToolset, ResumeHandle, ResumeOptions, ResumePreview, ResumeReport, RetryClass, RetryPolicy, ReuseConfig, RiskRuleValue, Role, RulvarError, RulvarErrorCode, RunAgentOptions, RunAuditVerdict, RunBudget, RunEventSink, RunExport, type RunFilter, RunHandle, RunInternals, type RunMeta, RunOptions, RunOutcome, RunProfile, RunStateAudit, RunStatus, RuntimeEventSink, SANDBOX_AGENT_OPT_KEYS, SPAWN_AGENT_SCHEMA, SandboxBridge, SandboxBridgeOptions, SandboxError, SandboxHostToWorker, SandboxMethod, SandboxWorkerToHost, SchemaPair, SchemaSpec, SchemaValidationResult, ScopeSegment, ScriptRejected, ScriptRunner, ScrubNote, SecretMasker, Semaphore, SerializationHook, Settled, SettlementError, 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, type ToolExecutorProvider, ToolInit, type ToolRisk, ToolRuntime, type ToolSource, type ToolSourceSession, ToolsOption, TranscriptSerializationHook, type TranscriptStore, TriggerClass, TtlState, Usage, UsageLimits, UsageSlice, VerifiedRecommendation, WAIT_FOR_EVENTS_SCHEMA, WAIT_FOR_EVENTS_TOOL_NAME, WAKE_SUMMARY_RENDER_BUDGET_CHARS, WakeBudgetBlock, WakeDigest, WakeTrigger, WireError, Workflow, WorkflowCallOpts, type WorkflowEvent, type WorkflowEventBody, WorkflowRegistry, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, assertFencedWrites, atCompactionThreshold, auditRun, auditRuns, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compilePermissionChain, compilePermissionPreset, compileSecretMasker, compileVerifiedLayer, constantTimeEqual, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createEnvelopeEncryption, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, dedupeRepeatedClaims, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispatchProjectionReserveUsd, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidencePreservedValidator, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, foldTermination, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashRunOutput, hashWorkflowBody, hashWorkflowSource, identityJcs, implementationAgentProfile, invoiceFromJournal, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastRunSettle, latestProgressReport, lexShellCommand, liftRetainedParts, lineageWeightOf, localKeyProvider, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, memoryQuotaLimiter, mergeQuotaDenial, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, orchestratorAdmissionEstCostUsd, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, preflightEstimate, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleMatches, readRunMeta, readTerminationInit, reconcileRunMeta, reduceAuditTrail, reduceCriticalPath, reduceInvocationTable, registryKeyRing, remeasureQueue, replayDisposition, repositoryResearchToolset, requiredFieldsValidator, requiredSectionsValidator, researchAgentProfile, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, reviewAgentProfile, 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, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateUsageLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
|
|
9221
|
+
export { AWAIT_SCHEMA, AbandonAttempt, AbandonFold, AbandonPayload, AbandonedSpendView, AbortClass, type AdaptiveEvents, AdmissionController, AdmissionDecision, AdmissionRejectedError, AdmissionStatsBefore, AdmitLineage, AdmitRejectReason, AdmitSpec, AdmitVerdict, AgentCallError, AgentError, type AgentEvents, AgentIdentityInput, type AgentInvocationRow, AgentOpts, AgentProfile, AgentProfilePermissions, AgentProfileTemplateOptions, AgentResult, AgentResultMeta, AgentStatus, ApproachSignatureInputs, ApprovalDecision, ApprovalIdentityInput, Artifact, AttemptOutcomeClass, AuditCategory, AuditRecord, AuditRunsOptions, BUDGET_ABORT_REASON, BaseAppend, BriefOpts, BudgetAccountView, BudgetDefaults, BudgetExhaustedError, BudgetExhaustionDiagnostics, BudgetHooks, BudgetReserve, type Bytes, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, CacheHint, CacheTtl, CanUseTool, CanonicalId, CanonicalIdentity, CanonicalLadderSpec, CanonicalModelSpec, ChatEvent, ChatRequest, CheckpointState, ChildArtifactPage, ChildIdentityInput, ChildResultPage, type ClaimClass, type ClaimOp, type ClaimStatus, ClaimValidationOptions, CollectOpts, CollectedTurn, CompactionConfig, CompiledPermissionChain, CompiledWorkflow, ConfigError, type CoreEvents, CostAttribution, CostAttributionFacts, CostReport, CreateEngineOptions, type CriticalPath, 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, DEFAULT_SYNTHESIS_MAX_TURNS, DEFAULT_SYNTHESIS_NOTE_MAX_TURNS, DataKeyProvider, DebitResult, DeclaredLadder, DedupIndex, DedupNote, DedupedClaims, DerivedKey, DeriverRegistry, type DeterminismConfig, DeterminismError, type DeterminismEvents, type DeterminismMode, DispositionRule, DispositionTable, DonorCandidate, DonorRef, DroppedItem, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EVENT_SEGMENT_STRIDE, EffectiveUsageLimits, Effort, Engine, EngineDefaults, EngineQuotaConfig, EngineQuotaRuntime, EntryKind, EntryRef, EntryStatus, EnvelopeEncryption, EnvelopeEncryptionOptions, ErrorClass, ErrorCode, ErrorPolicy, EscalatedResult, EscalationDecision, EscalationDecisionAbortedError, EscalationDigest, EscalationKind, EscalationLimits, EscalationOptions, EscalationReport, EscalationRequest, EventBus, type EvidenceRef, type ExecutorRegistry, type ExplorationSummary, 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, IMPLEMENTATION_PROFILE_LIMITS, INBOX_PROPOSAL_TTL_DAYS, IdentityInput, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, IncrementalSynthesisResult, InvalidResolutionError, InvocationRole, type InvocationTable, InvoiceExport, InvoiceReconciliation, InvoiceRow, type IsolatedExecContext, type IsolatedExecRequest, type IsolatedExecutorTag, type IsolationProvider, type IsolationSpec, Issue$1 as Issue, JOURNAL_ENVELOPE_MARKER, JournalCompatSubCode, JournalCompatibilityError, JournalEntry, JournalMatcher, JournalMissError, JournalOperation, JournalOrderViolation, JournalSerializationContext, 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, MemoryQuotaLimiter, 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, OrchestrateSynthesis, OrchestrateSynthesisSkipReason, OrchestratorBudgetSpec, OrchestratorCapConfigError, OrchestratorExtension, OrchestratorExtensionIO, OrchestratorRuntime, Out, PARALLEL_AGENTS_SCHEMA, PROGRESS_REPORT_TOOL_NAME, ParallelSiteCounter, Part, PendingExternal, PendingToolTurn, PermissionConfig, PermissionGate, PermissionHook, PermissionPreset, PermissionRule, PermissionVerdict, type PhaseRow, PhaseTarget, PipelineCollected, PipelineOpts, PlanInvariantError, PreflightAdmissionRow, PreflightFinding, PreflightInput, PreflightOrchestratorSpec, PreflightReport, PreflightSpawnReport, PreflightSpawnSpec, PreflightToolCeiling, PriceTable, PricedUsage, type Pricing, type PricingTier, ProgressReport, type ProviderAdapter, ProviderCallRecord, QUOTA_WINDOW_MS, QualityFloors, QuotaCounters, type QuotaDecision, type QuotaEstimate, type QuotaLimiter, type QuotaReservationRequest, QuotaRule, QuotaWindowSnapshot, READ_CHILD_ARTIFACT_SCHEMA, READ_CHILD_ARTIFACT_TOOL_NAME, RESEARCH_PROFILE_LIMITS, REVIEW_PROFILE_LIMITS, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, RUN_SETTLE_DECISION_TYPE, RandIdentityInput, RandPayload, ReconcileOptions, ReconcileResult, RefEntryAppender, RefEntryClassification, RefusalInfo, RepeatedClaim, ReplayDisposition, ReplayMode, ReplayPlanHashMismatch, Replayer, RepositoryResearchToolset, RepositoryResearchToolsetOptions, ResearchAgentProfileOptions, ResearchAgentProfileResult, ResearchEvidenceEntry, ResolutionArbiter, ResolutionAttempt, ResolutionBy, ResolutionFold, ResolutionLayer, ResolutionOutcome, ResolutionPayload, ResolvedInvocation, ResolvedToolset, ResumeHandle, ResumeOptions, ResumePreview, ResumeReport, RetryClass, RetryPolicy, ReuseConfig, RiskRuleValue, Role, RulvarError, RulvarErrorCode, RunAgentOptions, RunAuditVerdict, RunBudget, RunEventSink, RunExport, type RunFilter, RunHandle, RunInternals, type RunMeta, RunOptions, RunOutcome, RunProfile, RunStateAudit, RunStatus, RuntimeEventSink, SANDBOX_AGENT_OPT_KEYS, SPAWN_AGENT_SCHEMA, SandboxBridge, SandboxBridgeOptions, SandboxError, SandboxHostToWorker, SandboxMethod, SandboxWorkerToHost, SchemaPair, SchemaSpec, SchemaValidationResult, ScopeSegment, ScriptRejected, ScriptRunner, ScrubNote, SecretMasker, Semaphore, SerializationHook, Settled, SettlementError, 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, type ToolExecutorProvider, ToolInit, type ToolRisk, ToolRuntime, type ToolSource, type ToolSourceSession, ToolsOption, TranscriptSerializationHook, type TranscriptStore, TriggerClass, TtlState, Usage, UsageLimits, UsageSlice, VerifiedRecommendation, WAIT_FOR_EVENTS_SCHEMA, WAIT_FOR_EVENTS_TOOL_NAME, WAKE_SUMMARY_RENDER_BUDGET_CHARS, WakeBudgetBlock, WakeDigest, WakeTrigger, WireError, Workflow, WorkflowCallOpts, type WorkflowEvent, type WorkflowEventBody, WorkflowRegistry, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, assertFencedWrites, atCompactionThreshold, auditRun, auditRuns, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compilePermissionChain, compilePermissionPreset, compileSecretMasker, compileVerifiedLayer, constantTimeEqual, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createEnvelopeEncryption, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, dedupeRepeatedClaims, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispatchProjectionReserveUsd, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidencePreservedValidator, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, foldTermination, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashRunOutput, hashWorkflowBody, hashWorkflowSource, identityJcs, implementationAgentProfile, invoiceFromJournal, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastRunSettle, latestProgressReport, lexShellCommand, liftRetainedParts, lineageWeightOf, localKeyProvider, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, memoryQuotaLimiter, mergeQuotaDenial, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, orchestratorAdmissionEstCostUsd, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, preflightEstimate, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleMatches, readRunMeta, readTerminationInit, reconcileRunMeta, reduceAuditTrail, reduceCriticalPath, reduceInvocationTable, registryKeyRing, remeasureQueue, replayDisposition, repositoryResearchToolset, requiredFieldsValidator, requiredSectionsValidator, researchAgentProfile, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, reviewAgentProfile, 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, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateUsageLimits, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
|
package/dist/index.js
CHANGED
|
@@ -8233,9 +8233,12 @@ function costReportFromJournal(entries, priceUsd) {
|
|
|
8233
8233
|
* against the provider's invoice. The totals are the SAME slice fold
|
|
8234
8234
|
* `costReportFromJournal` runs, so `totalUsd` here equals
|
|
8235
8235
|
* `CostReport.grossUsd` (and `netUsd` equals `CostReport.totalUsd`)
|
|
8236
|
-
* exactly, never approximately
|
|
8237
|
-
*
|
|
8238
|
-
*
|
|
8236
|
+
* exactly, never approximately. The export is self-describing about
|
|
8237
|
+
* its pricing: `pricingBasis` says per-row `usd` prices each call
|
|
8238
|
+
* individually, `rowUsdNonAdditive` says those values need not sum to
|
|
8239
|
+
* `totalUsd` (a nonlinear price table, long-context tiers, prices a
|
|
8240
|
+
* split differently from its sum), and per-row `allocatedUsd` is the
|
|
8241
|
+
* additive column whose flat sum reproduces `totalUsd` exactly.
|
|
8239
8242
|
*
|
|
8240
8243
|
* Coverage is loss-free by construction: an entry whose records do not
|
|
8241
8244
|
* cover its usage total (a resume restored from a checkpoint written
|
|
@@ -8274,6 +8277,64 @@ function usageRemainder(total, records) {
|
|
|
8274
8277
|
if (reasoning > 0) remainder.reasoningTokens = reasoning;
|
|
8275
8278
|
return USAGE_FIELDS.some((field) => remainder[field] > 0) || (remainder.reasoningTokens ?? 0) > 0 ? remainder : void 0;
|
|
8276
8279
|
}
|
|
8280
|
+
/** One allocation pool per (entry, serving model) slice of the gross fold. */
|
|
8281
|
+
function allocationKey(entrySeq, servedBy) {
|
|
8282
|
+
return `${String(entrySeq)} ${servedBy}`;
|
|
8283
|
+
}
|
|
8284
|
+
/** The token-count fallback weight when every row of a pool priced to zero. */
|
|
8285
|
+
function totalTokens(usage) {
|
|
8286
|
+
return usage.inputTokens + usage.outputTokens + usage.cacheReadTokens + usage.cacheWriteTokens + (usage.reasoningTokens ?? 0);
|
|
8287
|
+
}
|
|
8288
|
+
/**
|
|
8289
|
+
* The additive allocation pass: distributes each (entry, model) slice
|
|
8290
|
+
* total of the SAME gross fold the invoice totals run across that
|
|
8291
|
+
* slice's rows, proportional to per-row `usd` (token counts when every
|
|
8292
|
+
* row priced to zero, equal shares when even those are zero), then
|
|
8293
|
+
* lets the largest row absorb the IEEE rounding dust of the fold's own
|
|
8294
|
+
* association so the flat sum over `rows` reproduces `totalUsd`
|
|
8295
|
+
* exactly. Rows on unpriced models keep zero: their spend is in
|
|
8296
|
+
* `unpriced`, not in `totalUsd`.
|
|
8297
|
+
*/
|
|
8298
|
+
function allocateRows(rows, entries, priceUsd, totalUsd) {
|
|
8299
|
+
if (rows.length === 0) return;
|
|
8300
|
+
const targets = /* @__PURE__ */ new Map();
|
|
8301
|
+
for (const entry of entries) {
|
|
8302
|
+
if (entry.status === "running" || entry.usage === void 0) continue;
|
|
8303
|
+
for (const slice of priceEntryUsage(entry, priceUsd).priced) {
|
|
8304
|
+
const key = allocationKey(entry.seq, slice.servedBy);
|
|
8305
|
+
targets.set(key, (targets.get(key) ?? 0) + slice.usd);
|
|
8306
|
+
}
|
|
8307
|
+
}
|
|
8308
|
+
const pools = /* @__PURE__ */ new Map();
|
|
8309
|
+
for (const row of rows) {
|
|
8310
|
+
const key = allocationKey(row.entrySeq, row.servedBy);
|
|
8311
|
+
const pool = pools.get(key);
|
|
8312
|
+
if (pool === void 0) pools.set(key, [row]);
|
|
8313
|
+
else pool.push(row);
|
|
8314
|
+
}
|
|
8315
|
+
for (const [key, members] of pools) {
|
|
8316
|
+
const target = targets.get(key) ?? 0;
|
|
8317
|
+
if (target === 0) continue;
|
|
8318
|
+
let weights = members.map((row) => row.usd ?? 0);
|
|
8319
|
+
let sum = weights.reduce((acc, weight) => acc + weight, 0);
|
|
8320
|
+
if (sum === 0) {
|
|
8321
|
+
weights = members.map((row) => totalTokens(row.usage));
|
|
8322
|
+
sum = weights.reduce((acc, weight) => acc + weight, 0);
|
|
8323
|
+
}
|
|
8324
|
+
members.forEach((row, index) => {
|
|
8325
|
+
const weight = weights[index] ?? 0;
|
|
8326
|
+
row.allocatedUsd = sum === 0 ? target / members.length : target * (weight / sum);
|
|
8327
|
+
});
|
|
8328
|
+
}
|
|
8329
|
+
let absorber;
|
|
8330
|
+
for (const row of rows) if (absorber === void 0 || row.allocatedUsd > absorber.allocatedUsd) absorber = row;
|
|
8331
|
+
if (absorber === void 0) return;
|
|
8332
|
+
for (let pass = 0; pass < 8; pass += 1) {
|
|
8333
|
+
const flat = rows.reduce((acc, row) => acc + row.allocatedUsd, 0);
|
|
8334
|
+
if (flat === totalUsd) break;
|
|
8335
|
+
absorber.allocatedUsd += totalUsd - flat;
|
|
8336
|
+
}
|
|
8337
|
+
}
|
|
8277
8338
|
/** A single row priced at its own model's rate; broken rates fold as unpriced. */
|
|
8278
8339
|
function rowUsd(priceUsd, servedBy, usage) {
|
|
8279
8340
|
const usd = priceUsd(servedBy, usage);
|
|
@@ -8311,8 +8372,9 @@ function invoiceFromJournal(entries, priceUsd) {
|
|
|
8311
8372
|
usage: record.usage,
|
|
8312
8373
|
...record.usageApprox === true ? { usageApprox: true } : {},
|
|
8313
8374
|
...usd === void 0 ? {} : { usd },
|
|
8375
|
+
allocatedUsd: 0,
|
|
8314
8376
|
...mark,
|
|
8315
|
-
reconciliation: record.responseId !== void 0 ? "
|
|
8377
|
+
reconciliation: record.responseId !== void 0 ? "provider-id-present" : record.outcome === "ok" ? "missing-provider-id" : "unconfirmed"
|
|
8316
8378
|
});
|
|
8317
8379
|
}
|
|
8318
8380
|
if (records.length === 0) {
|
|
@@ -8327,6 +8389,7 @@ function invoiceFromJournal(entries, priceUsd) {
|
|
|
8327
8389
|
usage: slice.usage,
|
|
8328
8390
|
...entry.usageApprox === true ? { usageApprox: true } : {},
|
|
8329
8391
|
...usd === void 0 ? {} : { usd },
|
|
8392
|
+
allocatedUsd: 0,
|
|
8330
8393
|
...mark,
|
|
8331
8394
|
reconciliation: "unattributed"
|
|
8332
8395
|
});
|
|
@@ -8344,19 +8407,23 @@ function invoiceFromJournal(entries, priceUsd) {
|
|
|
8344
8407
|
usage: remainder,
|
|
8345
8408
|
...entry.usageApprox === true ? { usageApprox: true } : {},
|
|
8346
8409
|
...usd === void 0 ? {} : { usd },
|
|
8410
|
+
allocatedUsd: 0,
|
|
8347
8411
|
...mark,
|
|
8348
8412
|
reconciliation: "unattributed"
|
|
8349
8413
|
});
|
|
8350
8414
|
}
|
|
8351
8415
|
}
|
|
8416
|
+
allocateRows(rows, entries, priceUsd, report.grossUsd);
|
|
8352
8417
|
const usageApprox = report.usageApprox === true || report.abandoned.usageApprox === true;
|
|
8353
8418
|
return {
|
|
8354
8419
|
rows,
|
|
8355
8420
|
totalUsd: report.grossUsd,
|
|
8356
8421
|
netUsd: report.totalUsd,
|
|
8357
8422
|
abandonedUsd: report.abandoned.usd,
|
|
8423
|
+
pricingBasis: "per-call",
|
|
8424
|
+
rowUsdNonAdditive: true,
|
|
8358
8425
|
unpriced: [...report.unpriced, ...report.abandoned.unpriced],
|
|
8359
|
-
reconciliationFailures: rows.filter((row) => row.reconciliation !== "
|
|
8426
|
+
reconciliationFailures: rows.filter((row) => row.reconciliation !== "provider-id-present").length,
|
|
8360
8427
|
...usageApprox ? { usageApprox: true } : {}
|
|
8361
8428
|
};
|
|
8362
8429
|
}
|
|
@@ -15657,7 +15724,8 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
15657
15724
|
"child_terminal",
|
|
15658
15725
|
"escalation",
|
|
15659
15726
|
"budget_threshold"
|
|
15660
|
-
]
|
|
15727
|
+
],
|
|
15728
|
+
...opts?.synthesis === void 0 ? {} : { synthesisSkipped: "synthesis_skipped_by_budget_cap" }
|
|
15661
15729
|
}
|
|
15662
15730
|
})).seq;
|
|
15663
15731
|
internals.events.emit({
|
|
@@ -16518,11 +16586,21 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
16518
16586
|
*/
|
|
16519
16587
|
const settleCapOutcome = async () => {
|
|
16520
16588
|
const capValue = internals.replayer.snapshot().find((entry) => entry.seq === capDecisionRef)?.value;
|
|
16589
|
+
if (capValue?.synthesisSkipped !== void 0) internals.events.emit({
|
|
16590
|
+
type: "log",
|
|
16591
|
+
level: "info",
|
|
16592
|
+
msg: "orchestrator synthesis skipped",
|
|
16593
|
+
data: {
|
|
16594
|
+
reason: capValue.synthesisSkipped,
|
|
16595
|
+
capDecisionRef: capDecisionRef ?? -1
|
|
16596
|
+
}
|
|
16597
|
+
}, callingState.spanId);
|
|
16521
16598
|
if (capValue?.fallback === "fail-run") throw new FailRunError(`the orchestrator budget cap was reached (decision entry ${String(capDecisionRef ?? -1)}) and budget.atCap is 'fail-run': the reserved finalizer is skipped and the run fails instead of returning a partial result`, { data: {
|
|
16522
16599
|
source: "orchestrator_budget_cap",
|
|
16523
16600
|
capDecisionRef: capDecisionRef ?? -1,
|
|
16524
16601
|
spentUsd: capValue.spentUsd ?? 0,
|
|
16525
|
-
capUsd: capValue.capUsd ?? 0
|
|
16602
|
+
capUsd: capValue.capUsd ?? 0,
|
|
16603
|
+
...capValue.synthesisSkipped === void 0 ? {} : { synthesisSkipped: capValue.synthesisSkipped }
|
|
16526
16604
|
} });
|
|
16527
16605
|
return await runForcedFinish();
|
|
16528
16606
|
};
|
|
@@ -16586,7 +16664,8 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
16586
16664
|
childStatusCounts,
|
|
16587
16665
|
degradedReasons,
|
|
16588
16666
|
...salvaged.length === 0 ? {} : { salvagedPartialChildren: salvaged },
|
|
16589
|
-
...salvagedOutput.length === 0 ? {} : { salvagedTerminalOutputChildren: salvagedOutput }
|
|
16667
|
+
...salvagedOutput.length === 0 ? {} : { salvagedTerminalOutputChildren: salvagedOutput },
|
|
16668
|
+
...accepted || opts.synthesis === void 0 ? {} : { synthesisSkipped: "synthesis_skipped_by_acceptance" }
|
|
16590
16669
|
};
|
|
16591
16670
|
await internals.replayer.appendSinglePhase({
|
|
16592
16671
|
scope: callingState.scope,
|
|
@@ -16599,6 +16678,12 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
16599
16678
|
});
|
|
16600
16679
|
}
|
|
16601
16680
|
if (decision.verdict === "rejected") {
|
|
16681
|
+
if (decision.synthesisSkipped !== void 0) internals.events.emit({
|
|
16682
|
+
type: "log",
|
|
16683
|
+
level: "info",
|
|
16684
|
+
msg: "orchestrator synthesis skipped",
|
|
16685
|
+
data: { reason: decision.synthesisSkipped }
|
|
16686
|
+
}, callingState.spanId);
|
|
16602
16687
|
const required = decision.childPolicy === "all-ok" ? "every child ok" : `at least ${String(decision.childPolicy.minSuccessful)} children ok`;
|
|
16603
16688
|
throw new FailRunError(`the orchestrator acceptance policy rejected the finish: ${String(decision.childStatusCounts.ok ?? 0)} children settled 'ok' but the policy requires ${required}; degraded: ${decision.degradedReasons.join("; ")}`, { data: {
|
|
16604
16689
|
source: "orchestrator_acceptance",
|
|
@@ -16607,7 +16692,8 @@ function makeOrchestratorWorkflow(goal, opts) {
|
|
|
16607
16692
|
childStatusCounts: decision.childStatusCounts,
|
|
16608
16693
|
degradedReasons: decision.degradedReasons,
|
|
16609
16694
|
...decision.salvagedPartialChildren === void 0 ? {} : { salvagedPartialChildren: decision.salvagedPartialChildren },
|
|
16610
|
-
...decision.salvagedTerminalOutputChildren === void 0 ? {} : { salvagedTerminalOutputChildren: decision.salvagedTerminalOutputChildren }
|
|
16695
|
+
...decision.salvagedTerminalOutputChildren === void 0 ? {} : { salvagedTerminalOutputChildren: decision.salvagedTerminalOutputChildren },
|
|
16696
|
+
...decision.synthesisSkipped === void 0 ? {} : { synthesisSkipped: decision.synthesisSkipped }
|
|
16611
16697
|
} });
|
|
16612
16698
|
}
|
|
16613
16699
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.68.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",
|