@rulvar/core 1.96.0 → 1.98.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 +84 -20
- package/dist/index.js +171 -38
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -789,9 +789,55 @@ interface PricedUsage {
|
|
|
789
789
|
* rate. A price function returning NaN or a negative amount (a broken
|
|
790
790
|
* user-supplied rate) is treated exactly like a missing row: the slice
|
|
791
791
|
* folds as unpriced instead of poisoning or crediting the totals
|
|
792
|
-
* (v1.20.0 review follow-up).
|
|
792
|
+
* (v1.20.0 review follow-up). The optional third argument hands the
|
|
793
|
+
* price function the entry's seq, so a segment-aware snapshot can
|
|
794
|
+
* price the row under the rates of ITS segment (RV505); two-argument
|
|
795
|
+
* price functions simply ignore it.
|
|
793
796
|
*/
|
|
794
|
-
declare function priceEntryUsage(entry: JournalEntry, priceUsd: (servedBy: ModelRef, usage: Usage) => number | undefined): PricedUsage;
|
|
797
|
+
declare function priceEntryUsage(entry: JournalEntry, priceUsd: (servedBy: ModelRef, usage: Usage, seq?: number) => number | undefined): PricedUsage;
|
|
798
|
+
/** One priced unit of {@link priceEntryBilling} (RV504). */
|
|
799
|
+
interface EntryBillingUnit {
|
|
800
|
+
/**
|
|
801
|
+
* 'call' prices one provider dispatch (the per-request basis);
|
|
802
|
+
* 'slice' is the historical per-model aggregate of an entry whose
|
|
803
|
+
* records do not fully cover its usage.
|
|
804
|
+
*/
|
|
805
|
+
source: "call" | "slice";
|
|
806
|
+
servedBy: ModelRef;
|
|
807
|
+
usage: Usage;
|
|
808
|
+
role?: InvocationRole;
|
|
809
|
+
/** The dispatch record behind a 'call' unit. */
|
|
810
|
+
record?: ProviderCallRecord;
|
|
811
|
+
usd: number;
|
|
812
|
+
}
|
|
813
|
+
/** What {@link priceEntryBilling} folds one terminal entry into. */
|
|
814
|
+
interface EntryBillingFold {
|
|
815
|
+
/** Priced units in fold order; `usd` is their sum in exactly this order. */
|
|
816
|
+
units: EntryBillingUnit[];
|
|
817
|
+
usd: number;
|
|
818
|
+
/** Usage on models the price function refused; never a silent zero. */
|
|
819
|
+
unpriced: UsageSlice[];
|
|
820
|
+
/**
|
|
821
|
+
* True when the entry's providerCalls exactly cover every usage
|
|
822
|
+
* slice, counter for counter: the fold priced per call, so a
|
|
823
|
+
* nonlinear tier fired per REQUEST, the pricing contract's own
|
|
824
|
+
* semantics. False folds the aggregate slices, the historical basis.
|
|
825
|
+
*/
|
|
826
|
+
fullyAttributed: boolean;
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* The billing fold over one terminal entry (RV504), shared by the
|
|
830
|
+
* CostReport and invoice folds so the total, every breakdown, and the
|
|
831
|
+
* per-row prices can never disagree. When the entry's per-dispatch
|
|
832
|
+
* `providerCalls` exactly cover its usage, each call is priced
|
|
833
|
+
* individually, so a nonlinear long-context tier fires per REQUEST,
|
|
834
|
+
* which is the pricing contract's stated semantics; an aggregate that
|
|
835
|
+
* crossed a threshold no single request crossed no longer re-prices
|
|
836
|
+
* the whole entry (the ninth-experiment 52% overreport). An entry with
|
|
837
|
+
* no records, or records that do not cover its usage, folds exactly as
|
|
838
|
+
* before: the per-model aggregate slices of {@link priceEntryUsage}.
|
|
839
|
+
*/
|
|
840
|
+
declare function priceEntryBilling(entry: JournalEntry, priceUsd: (servedBy: ModelRef, usage: Usage, seq?: number) => number | undefined): EntryBillingFold;
|
|
795
841
|
/**
|
|
796
842
|
* Final entry form (hashVersion 2).
|
|
797
843
|
* All journaled values MUST be JSON-serializable; a violation raises a
|
|
@@ -5813,7 +5859,7 @@ declare function buildCostReport(attribution: CostAttribution, totalUsd: number,
|
|
|
5813
5859
|
* decision, so a replay-only resume reproduces the block instead of
|
|
5814
5860
|
* reading this process's live accounts (which a replay never charges).
|
|
5815
5861
|
*/
|
|
5816
|
-
declare function costReportFromJournal(entries: readonly JournalEntry[], priceUsd: (servedBy: ModelRef, usage: Usage) => number | undefined): CostReport;
|
|
5862
|
+
declare function costReportFromJournal(entries: readonly JournalEntry[], priceUsd: (servedBy: ModelRef, usage: Usage, seq?: number) => number | undefined): CostReport;
|
|
5817
5863
|
//#endregion
|
|
5818
5864
|
//#region src/engine/run-handle.d.ts
|
|
5819
5865
|
/** Suspensions still open at settle time; producers arrive with M2. */
|
|
@@ -9221,23 +9267,36 @@ interface AppliedPricingRow {
|
|
|
9221
9267
|
}
|
|
9222
9268
|
/** What `journalPricingSnapshot` rebuilds from a pinned run settle. */
|
|
9223
9269
|
interface JournalPricingSnapshot {
|
|
9224
|
-
/** The PriceTable version the
|
|
9270
|
+
/** The PriceTable version of the LAST pin; absent for caps-only rows. */
|
|
9225
9271
|
pricingVersion?: string;
|
|
9272
|
+
/** The last pin's rows: the union covering the whole settled journal. */
|
|
9226
9273
|
rows: AppliedPricingRow[];
|
|
9227
9274
|
/**
|
|
9275
|
+
* The seq of the last pinning settle: rows at or past it belong to a
|
|
9276
|
+
* segment no pin covers yet, so a caller composing with a live table
|
|
9277
|
+
* (the engine's outcome mirror) prefers the live rates there.
|
|
9278
|
+
*/
|
|
9279
|
+
pinnedThroughSeq: number;
|
|
9280
|
+
/**
|
|
9228
9281
|
* Prices usage with the PINNED rows only: a model absent from the
|
|
9229
9282
|
* snapshot folds as unpriced (surfaced, never a silent zero), exactly
|
|
9230
|
-
* the honesty contract of the live fold.
|
|
9283
|
+
* the honesty contract of the live fold. With a `seq`, the row is
|
|
9284
|
+
* priced under the pin of ITS OWN segment (RV505): the first settle
|
|
9285
|
+
* that followed it, which recorded exactly the rates its live debits
|
|
9286
|
+
* used, so a suspend/resume across a price-table rotation never
|
|
9287
|
+
* re-prices settled history. Without a `seq`, the last pin wins, the
|
|
9288
|
+
* historical behavior.
|
|
9231
9289
|
*/
|
|
9232
|
-
priceUsd: (servedBy: ModelRef, usage: Usage) => number | undefined;
|
|
9290
|
+
priceUsd: (servedBy: ModelRef, usage: Usage, seq?: number) => number | undefined;
|
|
9233
9291
|
}
|
|
9234
9292
|
/**
|
|
9235
|
-
* The read side
|
|
9236
|
-
*
|
|
9237
|
-
*
|
|
9238
|
-
*
|
|
9239
|
-
*
|
|
9240
|
-
*
|
|
9293
|
+
* The read side. Every settling segment pins the union it applied, and
|
|
9294
|
+
* each pin's settle seq bounds the rows it settled FIRST, so the pins
|
|
9295
|
+
* compose without any journal change (RV505): a seq-aware caller gets
|
|
9296
|
+
* the rates of the row's own segment, and a seq-less caller keeps the
|
|
9297
|
+
* historical last-pin behavior. Journals settled before the pin
|
|
9298
|
+
* shipped, or without any priced model, return undefined: the caller
|
|
9299
|
+
* keeps its current-table fold and its export says so.
|
|
9241
9300
|
*/
|
|
9242
9301
|
declare function journalPricingSnapshot(entries: readonly JournalEntry[]): JournalPricingSnapshot | undefined;
|
|
9243
9302
|
//#endregion
|
|
@@ -9324,12 +9383,17 @@ interface InvoiceExport {
|
|
|
9324
9383
|
*/
|
|
9325
9384
|
pricingBasis: "per-call";
|
|
9326
9385
|
/**
|
|
9327
|
-
*
|
|
9328
|
-
*
|
|
9329
|
-
*
|
|
9330
|
-
*
|
|
9331
|
-
|
|
9332
|
-
|
|
9386
|
+
* False exactly when every contributing entry's providerCalls fully
|
|
9387
|
+
* cover its usage (RV504): the totals are then the per-call fold
|
|
9388
|
+
* itself, each row's `usd` agrees with its `allocatedUsd`, and the
|
|
9389
|
+
* flat `usd` sum reproduces `totalUsd` up to IEEE association of
|
|
9390
|
+
* the last bits. True when any entry folded on the aggregate basis
|
|
9391
|
+
* (no records, or records that do not cover its usage): a nonlinear
|
|
9392
|
+
* price table then prices an aggregate differently from the sum of
|
|
9393
|
+
* its parts, so sum `allocatedUsd` instead; it exists precisely so
|
|
9394
|
+
* a column sums to the total exactly in every case.
|
|
9395
|
+
*/
|
|
9396
|
+
rowUsdNonAdditive: boolean;
|
|
9333
9397
|
/** Usage on models absent from pricing, net and abandoned alike; never a silent zero. */
|
|
9334
9398
|
unpriced: Array<{
|
|
9335
9399
|
model: string;
|
|
@@ -9353,7 +9417,7 @@ interface InvoiceExport {
|
|
|
9353
9417
|
* without a snapshot the fold prices at the current table's rates,
|
|
9354
9418
|
* exactly as before.
|
|
9355
9419
|
*/
|
|
9356
|
-
declare function invoiceFromJournal(entries: readonly JournalEntry[], priceUsd: (servedBy: ModelRef, usage: Usage) => number | undefined, options?: {
|
|
9420
|
+
declare function invoiceFromJournal(entries: readonly JournalEntry[], priceUsd: (servedBy: ModelRef, usage: Usage, seq?: number) => number | undefined, options?: {
|
|
9357
9421
|
pricing?: InvoicePricingProvenance;
|
|
9358
9422
|
}): InvoiceExport;
|
|
9359
9423
|
//#endregion
|
|
@@ -10206,4 +10270,4 @@ interface SandboxBridge {
|
|
|
10206
10270
|
declare const SANDBOX_AGENT_OPT_KEYS: readonly string[];
|
|
10207
10271
|
declare function createSandboxBridge(ctx: Ctx<never>, options: SandboxBridgeOptions): SandboxBridge;
|
|
10208
10272
|
//#endregion
|
|
10209
|
-
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, type AppliedPricingRow, 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_CITATION_SAMPLE, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_CALLS_PER_ENTRY, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_EVIDENCE_OVERHEAD_CALLS, 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, EvidenceContract, type EvidenceRef, type ExecKeyDerivation, type ExecutorRegistry, type ExplorationSummary, ExtensionAppendInput, ExtensionDispatchSpec, ExternalIdentityInput, ExternalRegistry, ExtractNecessityInput, FINALIZE_SYNTHESIS_INSTRUCTION, FINISH_SCHEMA, FINISH_TOOL_NAME, FailRunError, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, FencedCodeMode, FileModelKnowledgeStore, FileModelKnowledgeStoreOptions, FileTranscriptStore, FinishContract, FinishContractCitations, FinishContractGoldenReject, FinishContractManifest, FinishInfo, FinishSelfTestFailure, FinishSelfTestFixtures, FinishSelfTestReport, 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, InvoicePricingProvenance, 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, type JournalPricingSnapshot, 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, RateLimitObservation, 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, SectionMatchMode, 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, type ToolBudgetSummary, 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, finishContract, foldTermination, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashRunOutput, hashWorkflowBody, hashWorkflowSource, headingStructureValidator, identityJcs, implementationAgentProfile, invoiceFromJournal, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, journalPricingSnapshot, 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, sectionCitationsValidator, selectStructuredOutputTier, selfTestFinishValidation, shouldCompact, snapshotUsage, spawnDepthOf, stripFencedBlocks, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, usageViolations, validateEditorialCommit, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateUsageLimits, wordCountValidator, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
|
|
10273
|
+
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, type AppliedPricingRow, 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_CITATION_SAMPLE, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_CALLS_PER_ENTRY, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_EVIDENCE_OVERHEAD_CALLS, 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, EntryBillingFold, EntryBillingUnit, EntryKind, EntryRef, EntryStatus, EnvelopeEncryption, EnvelopeEncryptionOptions, ErrorClass, ErrorCode, ErrorPolicy, EscalatedResult, EscalationDecision, EscalationDecisionAbortedError, EscalationDigest, EscalationKind, EscalationLimits, EscalationOptions, EscalationReport, EscalationRequest, EventBus, EvidenceContract, type EvidenceRef, type ExecKeyDerivation, type ExecutorRegistry, type ExplorationSummary, ExtensionAppendInput, ExtensionDispatchSpec, ExternalIdentityInput, ExternalRegistry, ExtractNecessityInput, FINALIZE_SYNTHESIS_INSTRUCTION, FINISH_SCHEMA, FINISH_TOOL_NAME, FailRunError, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, FencedCodeMode, FileModelKnowledgeStore, FileModelKnowledgeStoreOptions, FileTranscriptStore, FinishContract, FinishContractCitations, FinishContractGoldenReject, FinishContractManifest, FinishInfo, FinishSelfTestFailure, FinishSelfTestFixtures, FinishSelfTestReport, 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, InvoicePricingProvenance, 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, type JournalPricingSnapshot, 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, RateLimitObservation, 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, SectionMatchMode, 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, type ToolBudgetSummary, 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, finishContract, foldTermination, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashRunOutput, hashWorkflowBody, hashWorkflowSource, headingStructureValidator, identityJcs, implementationAgentProfile, invoiceFromJournal, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, journalPricingSnapshot, 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, priceEntryBilling, 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, sectionCitationsValidator, selectStructuredOutputTier, selfTestFinishValidation, shouldCompact, snapshotUsage, spawnDepthOf, stripFencedBlocks, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, usageViolations, validateEditorialCommit, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateUsageLimits, wordCountValidator, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
|
package/dist/index.js
CHANGED
|
@@ -2370,7 +2370,10 @@ function entryUsageSlices(entry) {
|
|
|
2370
2370
|
* rate. A price function returning NaN or a negative amount (a broken
|
|
2371
2371
|
* user-supplied rate) is treated exactly like a missing row: the slice
|
|
2372
2372
|
* folds as unpriced instead of poisoning or crediting the totals
|
|
2373
|
-
* (v1.20.0 review follow-up).
|
|
2373
|
+
* (v1.20.0 review follow-up). The optional third argument hands the
|
|
2374
|
+
* price function the entry's seq, so a segment-aware snapshot can
|
|
2375
|
+
* price the row under the rates of ITS segment (RV505); two-argument
|
|
2376
|
+
* price functions simply ignore it.
|
|
2374
2377
|
*/
|
|
2375
2378
|
function priceEntryUsage(entry, priceUsd) {
|
|
2376
2379
|
const result = {
|
|
@@ -2379,7 +2382,7 @@ function priceEntryUsage(entry, priceUsd) {
|
|
|
2379
2382
|
unpriced: []
|
|
2380
2383
|
};
|
|
2381
2384
|
for (const slice of entryUsageSlices(entry)) {
|
|
2382
|
-
const usd = priceUsd(slice.servedBy, slice.usage);
|
|
2385
|
+
const usd = priceUsd(slice.servedBy, slice.usage, entry.seq);
|
|
2383
2386
|
if (usd === void 0 || !Number.isFinite(usd) || usd < 0) {
|
|
2384
2387
|
result.unpriced.push(slice);
|
|
2385
2388
|
continue;
|
|
@@ -2392,6 +2395,110 @@ function priceEntryUsage(entry, priceUsd) {
|
|
|
2392
2395
|
}
|
|
2393
2396
|
return result;
|
|
2394
2397
|
}
|
|
2398
|
+
const BILLING_FIELDS = [
|
|
2399
|
+
"inputTokens",
|
|
2400
|
+
"outputTokens",
|
|
2401
|
+
"cacheReadTokens",
|
|
2402
|
+
"cacheWriteTokens"
|
|
2403
|
+
];
|
|
2404
|
+
/** Exact per-model coverage: records sum to every slice, counter for counter. */
|
|
2405
|
+
function callsCoverSlices(slices, records) {
|
|
2406
|
+
if (slices.length === 0 || records.length === 0) return false;
|
|
2407
|
+
const sums = /* @__PURE__ */ new Map();
|
|
2408
|
+
for (const record of records) {
|
|
2409
|
+
let sum = sums.get(record.servedBy);
|
|
2410
|
+
if (sum === void 0) {
|
|
2411
|
+
sum = {
|
|
2412
|
+
fields: {
|
|
2413
|
+
inputTokens: 0,
|
|
2414
|
+
outputTokens: 0,
|
|
2415
|
+
cacheReadTokens: 0,
|
|
2416
|
+
cacheWriteTokens: 0
|
|
2417
|
+
},
|
|
2418
|
+
reasoning: 0
|
|
2419
|
+
};
|
|
2420
|
+
sums.set(record.servedBy, sum);
|
|
2421
|
+
}
|
|
2422
|
+
for (const field of BILLING_FIELDS) sum.fields[field] = (sum.fields[field] ?? 0) + record.usage[field];
|
|
2423
|
+
sum.reasoning += record.usage.reasoningTokens ?? 0;
|
|
2424
|
+
}
|
|
2425
|
+
for (const slice of slices) {
|
|
2426
|
+
const sum = sums.get(slice.servedBy);
|
|
2427
|
+
if (sum === void 0) return false;
|
|
2428
|
+
for (const field of BILLING_FIELDS) if (sum.fields[field] !== slice.usage[field]) return false;
|
|
2429
|
+
if (sum.reasoning !== (slice.usage.reasoningTokens ?? 0)) return false;
|
|
2430
|
+
}
|
|
2431
|
+
for (const model of sums.keys()) if (!slices.some((slice) => slice.servedBy === model)) return false;
|
|
2432
|
+
return true;
|
|
2433
|
+
}
|
|
2434
|
+
/**
|
|
2435
|
+
* The billing fold over one terminal entry (RV504), shared by the
|
|
2436
|
+
* CostReport and invoice folds so the total, every breakdown, and the
|
|
2437
|
+
* per-row prices can never disagree. When the entry's per-dispatch
|
|
2438
|
+
* `providerCalls` exactly cover its usage, each call is priced
|
|
2439
|
+
* individually, so a nonlinear long-context tier fires per REQUEST,
|
|
2440
|
+
* which is the pricing contract's stated semantics; an aggregate that
|
|
2441
|
+
* crossed a threshold no single request crossed no longer re-prices
|
|
2442
|
+
* the whole entry (the ninth-experiment 52% overreport). An entry with
|
|
2443
|
+
* no records, or records that do not cover its usage, folds exactly as
|
|
2444
|
+
* before: the per-model aggregate slices of {@link priceEntryUsage}.
|
|
2445
|
+
*/
|
|
2446
|
+
function priceEntryBilling(entry, priceUsd) {
|
|
2447
|
+
const slices = entryUsageSlices(entry);
|
|
2448
|
+
const records = entry.providerCalls ?? [];
|
|
2449
|
+
if (!callsCoverSlices(slices, records)) {
|
|
2450
|
+
const aggregate = priceEntryUsage(entry, priceUsd);
|
|
2451
|
+
return {
|
|
2452
|
+
units: aggregate.priced.map((slice) => ({
|
|
2453
|
+
source: "slice",
|
|
2454
|
+
servedBy: slice.servedBy,
|
|
2455
|
+
usage: slice.usage,
|
|
2456
|
+
...slice.role === void 0 ? {} : { role: slice.role },
|
|
2457
|
+
usd: slice.usd
|
|
2458
|
+
})),
|
|
2459
|
+
usd: aggregate.usd,
|
|
2460
|
+
unpriced: aggregate.unpriced,
|
|
2461
|
+
fullyAttributed: false
|
|
2462
|
+
};
|
|
2463
|
+
}
|
|
2464
|
+
const units = [];
|
|
2465
|
+
const unpricedByModel = /* @__PURE__ */ new Map();
|
|
2466
|
+
let usd = 0;
|
|
2467
|
+
for (const record of records) {
|
|
2468
|
+
const price = priceUsd(record.servedBy, record.usage, entry.seq);
|
|
2469
|
+
if (price === void 0 || !Number.isFinite(price) || price < 0) {
|
|
2470
|
+
const sum = unpricedByModel.get(record.servedBy) ?? {
|
|
2471
|
+
inputTokens: 0,
|
|
2472
|
+
outputTokens: 0,
|
|
2473
|
+
cacheReadTokens: 0,
|
|
2474
|
+
cacheWriteTokens: 0
|
|
2475
|
+
};
|
|
2476
|
+
for (const field of BILLING_FIELDS) sum[field] += record.usage[field];
|
|
2477
|
+
const reasoning = (sum.reasoningTokens ?? 0) + (record.usage.reasoningTokens ?? 0);
|
|
2478
|
+
if (reasoning > 0) sum.reasoningTokens = reasoning;
|
|
2479
|
+
unpricedByModel.set(record.servedBy, sum);
|
|
2480
|
+
continue;
|
|
2481
|
+
}
|
|
2482
|
+
usd += price;
|
|
2483
|
+
units.push({
|
|
2484
|
+
source: "call",
|
|
2485
|
+
servedBy: record.servedBy,
|
|
2486
|
+
usage: record.usage,
|
|
2487
|
+
role: record.role,
|
|
2488
|
+
record,
|
|
2489
|
+
usd: price
|
|
2490
|
+
});
|
|
2491
|
+
}
|
|
2492
|
+
return {
|
|
2493
|
+
units,
|
|
2494
|
+
usd,
|
|
2495
|
+
unpriced: [...unpricedByModel].map(([servedBy, usage]) => ({
|
|
2496
|
+
servedBy,
|
|
2497
|
+
usage
|
|
2498
|
+
})),
|
|
2499
|
+
fullyAttributed: true
|
|
2500
|
+
};
|
|
2501
|
+
}
|
|
2395
2502
|
/**
|
|
2396
2503
|
* Round-1 normalization: hashVersion is taken from `hashVersion`, else
|
|
2397
2504
|
* from the legacy `v` field, else 1. Stores are never rewritten;
|
|
@@ -8198,7 +8305,7 @@ function costReportFromJournal(entries, priceUsd) {
|
|
|
8198
8305
|
if (entry.kind === "external" && entry.status === "suspended" && typeof entry.value?.key === "string" && (entry.value.key.startsWith("wake:") || entry.value.key.includes(":wake:"))) wakes += 1;
|
|
8199
8306
|
if (entry.kind !== "resolution" && entry.kind !== "abandon" && abandonFold.isAbandoned(entry.ref ?? entry.seq)) {
|
|
8200
8307
|
if (entry.status !== "running" && entry.usage !== void 0) {
|
|
8201
|
-
const abandonedPriced =
|
|
8308
|
+
const abandonedPriced = priceEntryBilling(entry, priceUsd);
|
|
8202
8309
|
abandonedUsd += abandonedPriced.usd;
|
|
8203
8310
|
for (const slice of abandonedPriced.unpriced) abandonedUnpriced.push({
|
|
8204
8311
|
model: slice.servedBy,
|
|
@@ -8209,12 +8316,12 @@ function costReportFromJournal(entries, priceUsd) {
|
|
|
8209
8316
|
continue;
|
|
8210
8317
|
}
|
|
8211
8318
|
if (entry.status === "running" || entry.usage === void 0) continue;
|
|
8212
|
-
const priced =
|
|
8319
|
+
const priced = priceEntryBilling(entry, priceUsd);
|
|
8213
8320
|
for (const slice of priced.unpriced) unpriced.push({
|
|
8214
8321
|
model: slice.servedBy,
|
|
8215
8322
|
usage: slice.usage
|
|
8216
8323
|
});
|
|
8217
|
-
for (const
|
|
8324
|
+
for (const unit of priced.units) byModel[unit.servedBy] = (byModel[unit.servedBy] ?? 0) + unit.usd;
|
|
8218
8325
|
totalUsd += priced.usd;
|
|
8219
8326
|
if (entry.usageApprox === true) usageApprox = true;
|
|
8220
8327
|
const facts = entry.costAttribution;
|
|
@@ -8223,7 +8330,7 @@ function costReportFromJournal(entries, priceUsd) {
|
|
|
8223
8330
|
const agentType = facts?.agentType ?? "unknown";
|
|
8224
8331
|
byAgentType[agentType] = (byAgentType[agentType] ?? 0) + priced.usd;
|
|
8225
8332
|
const primaryRole = facts?.role ?? "loop";
|
|
8226
|
-
for (const
|
|
8333
|
+
for (const unit of priced.units) byRole[unit.role ?? primaryRole] += unit.usd;
|
|
8227
8334
|
if (facts?.budgetAccount !== void 0 && isOrchestratorAccount(facts.budgetAccount)) {
|
|
8228
8335
|
orchestratorSpentUsd += priced.usd;
|
|
8229
8336
|
if (facts.finalizeReserve === true) reserveUsedUsd += priced.usd;
|
|
@@ -8258,15 +8365,18 @@ function costReportFromJournal(entries, priceUsd) {
|
|
|
8258
8365
|
* The invoice export (P1.3): a pure fold over terminal entries that
|
|
8259
8366
|
* turns the per-dispatch reconciliation ledger (`providerCalls`) into
|
|
8260
8367
|
* one row per billable provider call, so a host can line the run up
|
|
8261
|
-
* against the provider's invoice. The totals are the SAME
|
|
8368
|
+
* against the provider's invoice. The totals are the SAME billing fold
|
|
8262
8369
|
* `costReportFromJournal` runs, so `totalUsd` here equals
|
|
8263
8370
|
* `CostReport.grossUsd` (and `netUsd` equals `CostReport.totalUsd`)
|
|
8264
|
-
* exactly, never approximately.
|
|
8265
|
-
*
|
|
8266
|
-
*
|
|
8267
|
-
*
|
|
8268
|
-
*
|
|
8269
|
-
*
|
|
8371
|
+
* exactly, never approximately. Since RV504 that fold prices a fully
|
|
8372
|
+
* attributed entry per provider call, so a nonlinear long-context tier
|
|
8373
|
+
* fires per REQUEST (the pricing contract's own semantics) and the
|
|
8374
|
+
* per-call rows ARE the total; the export is self-describing about it:
|
|
8375
|
+
* `pricingBasis` says per-row `usd` prices each call individually,
|
|
8376
|
+
* `rowUsdNonAdditive: false` says the rows sum to `totalUsd` (true
|
|
8377
|
+
* marks an aggregate-priced remainder or legacy entry in the fold),
|
|
8378
|
+
* and per-row `allocatedUsd` is the additive column whose flat sum
|
|
8379
|
+
* reproduces `totalUsd` exactly in every case.
|
|
8270
8380
|
*
|
|
8271
8381
|
* Coverage is loss-free by construction: an entry whose records do not
|
|
8272
8382
|
* cover its usage total (a resume restored from a checkpoint written
|
|
@@ -8331,9 +8441,9 @@ function allocateRows(rows, entries, priceUsd, totalUsd) {
|
|
|
8331
8441
|
const targets = /* @__PURE__ */ new Map();
|
|
8332
8442
|
for (const entry of entries) {
|
|
8333
8443
|
if (entry.status === "running" || entry.usage === void 0) continue;
|
|
8334
|
-
for (const
|
|
8335
|
-
const key = allocationKey(entry.seq,
|
|
8336
|
-
targets.set(key, (targets.get(key) ?? 0) +
|
|
8444
|
+
for (const unit of priceEntryBilling(entry, priceUsd).units) {
|
|
8445
|
+
const key = allocationKey(entry.seq, unit.servedBy);
|
|
8446
|
+
targets.set(key, (targets.get(key) ?? 0) + unit.usd);
|
|
8337
8447
|
}
|
|
8338
8448
|
}
|
|
8339
8449
|
const pools = /* @__PURE__ */ new Map();
|
|
@@ -8367,8 +8477,8 @@ function allocateRows(rows, entries, priceUsd, totalUsd) {
|
|
|
8367
8477
|
}
|
|
8368
8478
|
}
|
|
8369
8479
|
/** A single row priced at its own model's rate; broken rates fold as unpriced. */
|
|
8370
|
-
function rowUsd(priceUsd, servedBy, usage) {
|
|
8371
|
-
const usd = priceUsd(servedBy, usage);
|
|
8480
|
+
function rowUsd(priceUsd, servedBy, usage, seq) {
|
|
8481
|
+
const usd = priceUsd(servedBy, usage, seq);
|
|
8372
8482
|
return usd !== void 0 && Number.isFinite(usd) && usd >= 0 ? usd : void 0;
|
|
8373
8483
|
}
|
|
8374
8484
|
/**
|
|
@@ -8384,8 +8494,10 @@ function invoiceFromJournal(entries, priceUsd, options) {
|
|
|
8384
8494
|
const report = costReportFromJournal(entries, priceUsd);
|
|
8385
8495
|
const abandonFold = buildAbandonFold(entries);
|
|
8386
8496
|
const rows = [];
|
|
8497
|
+
let everyEntryFullyAttributed = true;
|
|
8387
8498
|
for (const entry of entries) {
|
|
8388
8499
|
if (entry.status === "running" || entry.usage === void 0) continue;
|
|
8500
|
+
if (!priceEntryBilling(entry, priceUsd).fullyAttributed) everyEntryFullyAttributed = false;
|
|
8389
8501
|
const abandoned = entry.kind !== "resolution" && entry.kind !== "abandon" && abandonFold.isAbandoned(entry.ref ?? entry.seq);
|
|
8390
8502
|
const base = {
|
|
8391
8503
|
entrySeq: entry.seq,
|
|
@@ -8395,7 +8507,7 @@ function invoiceFromJournal(entries, priceUsd, options) {
|
|
|
8395
8507
|
const mark = abandoned ? { abandoned: true } : {};
|
|
8396
8508
|
const records = entry.providerCalls ?? [];
|
|
8397
8509
|
for (const record of records) {
|
|
8398
|
-
const usd = rowUsd(priceUsd, record.servedBy, record.usage);
|
|
8510
|
+
const usd = rowUsd(priceUsd, record.servedBy, record.usage, entry.seq);
|
|
8399
8511
|
const reconciliation = record.responseId !== void 0 ? "provider-id-present" : record.outcome === "ok" ? "missing-provider-id" : "unconfirmed";
|
|
8400
8512
|
const usageUnknown = reconciliation === "unconfirmed" && USAGE_FIELDS.every((field) => record.usage[field] === 0) && (record.usage.reasoningTokens ?? 0) === 0;
|
|
8401
8513
|
rows.push({
|
|
@@ -8417,7 +8529,7 @@ function invoiceFromJournal(entries, priceUsd, options) {
|
|
|
8417
8529
|
}
|
|
8418
8530
|
if (records.length === 0) {
|
|
8419
8531
|
entryUsageSlices(entry).forEach((slice, index) => {
|
|
8420
|
-
const usd = rowUsd(priceUsd, slice.servedBy, slice.usage);
|
|
8532
|
+
const usd = rowUsd(priceUsd, slice.servedBy, slice.usage, entry.seq);
|
|
8421
8533
|
rows.push({
|
|
8422
8534
|
...base,
|
|
8423
8535
|
ordinal: index + 1,
|
|
@@ -8436,7 +8548,7 @@ function invoiceFromJournal(entries, priceUsd, options) {
|
|
|
8436
8548
|
}
|
|
8437
8549
|
const remainder = usageRemainder(entry.usage, records);
|
|
8438
8550
|
if (remainder !== void 0 && entry.servedBy !== void 0) {
|
|
8439
|
-
const usd = rowUsd(priceUsd, entry.servedBy, remainder);
|
|
8551
|
+
const usd = rowUsd(priceUsd, entry.servedBy, remainder, entry.seq);
|
|
8440
8552
|
rows.push({
|
|
8441
8553
|
...base,
|
|
8442
8554
|
ordinal: records.length + 1,
|
|
@@ -8459,7 +8571,7 @@ function invoiceFromJournal(entries, priceUsd, options) {
|
|
|
8459
8571
|
netUsd: report.totalUsd,
|
|
8460
8572
|
abandonedUsd: report.abandoned.usd,
|
|
8461
8573
|
pricingBasis: "per-call",
|
|
8462
|
-
rowUsdNonAdditive:
|
|
8574
|
+
rowUsdNonAdditive: !everyEntryFullyAttributed,
|
|
8463
8575
|
unpriced: [...report.unpriced, ...report.abandoned.unpriced],
|
|
8464
8576
|
reconciliationFailures: rows.filter((row) => row.reconciliation !== "provider-id-present").length,
|
|
8465
8577
|
...(() => {
|
|
@@ -8581,31 +8693,50 @@ function pinnedRows(value) {
|
|
|
8581
8693
|
return rows;
|
|
8582
8694
|
}
|
|
8583
8695
|
/**
|
|
8584
|
-
* The read side
|
|
8585
|
-
*
|
|
8586
|
-
*
|
|
8587
|
-
*
|
|
8588
|
-
*
|
|
8589
|
-
*
|
|
8696
|
+
* The read side. Every settling segment pins the union it applied, and
|
|
8697
|
+
* each pin's settle seq bounds the rows it settled FIRST, so the pins
|
|
8698
|
+
* compose without any journal change (RV505): a seq-aware caller gets
|
|
8699
|
+
* the rates of the row's own segment, and a seq-less caller keeps the
|
|
8700
|
+
* historical last-pin behavior. Journals settled before the pin
|
|
8701
|
+
* shipped, or without any priced model, return undefined: the caller
|
|
8702
|
+
* keeps its current-table fold and its export says so.
|
|
8590
8703
|
*/
|
|
8591
8704
|
function journalPricingSnapshot(entries) {
|
|
8592
|
-
|
|
8593
|
-
|
|
8705
|
+
const pins = [];
|
|
8706
|
+
let last;
|
|
8707
|
+
for (const entry of entries) {
|
|
8594
8708
|
if (entry?.kind !== "decision") continue;
|
|
8595
8709
|
const value = entry.value;
|
|
8596
8710
|
if (value?.decisionType !== "run_settle") continue;
|
|
8597
8711
|
const rows = pinnedRows(value);
|
|
8598
8712
|
if (rows === void 0) continue;
|
|
8599
8713
|
const byModel = new Map(rows.map((row) => [row.model, row.rates]));
|
|
8600
|
-
|
|
8601
|
-
|
|
8714
|
+
pins.push({
|
|
8715
|
+
seq: entry.seq,
|
|
8716
|
+
byModel
|
|
8717
|
+
});
|
|
8718
|
+
last = {
|
|
8602
8719
|
rows,
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
return rates === void 0 ? void 0 : priceUsdOf(rates, usage);
|
|
8606
|
-
}
|
|
8720
|
+
byModel,
|
|
8721
|
+
...typeof value.pricingVersion === "string" ? { pricingVersion: value.pricingVersion } : {}
|
|
8607
8722
|
};
|
|
8608
8723
|
}
|
|
8724
|
+
if (last === void 0) return;
|
|
8725
|
+
const lastByModel = last.byModel;
|
|
8726
|
+
const ratesFor = (servedBy, seq) => {
|
|
8727
|
+
if (seq === void 0) return lastByModel.get(servedBy);
|
|
8728
|
+
for (const pin of pins) if (pin.seq > seq) return pin.byModel.get(servedBy) ?? lastByModel.get(servedBy);
|
|
8729
|
+
return lastByModel.get(servedBy);
|
|
8730
|
+
};
|
|
8731
|
+
return {
|
|
8732
|
+
...last.pricingVersion === void 0 ? {} : { pricingVersion: last.pricingVersion },
|
|
8733
|
+
rows: last.rows,
|
|
8734
|
+
pinnedThroughSeq: pins[pins.length - 1]?.seq ?? 0,
|
|
8735
|
+
priceUsd: (servedBy, usage, seq) => {
|
|
8736
|
+
const rates = ratesFor(servedBy, seq);
|
|
8737
|
+
return rates === void 0 ? void 0 : priceUsdOf(rates, usage);
|
|
8738
|
+
}
|
|
8739
|
+
};
|
|
8609
8740
|
}
|
|
8610
8741
|
//#endregion
|
|
8611
8742
|
//#region src/model/router.ts
|
|
@@ -20575,12 +20706,14 @@ function createEngine(options) {
|
|
|
20575
20706
|
await replayer.flush().catch(() => void 0);
|
|
20576
20707
|
}
|
|
20577
20708
|
const ledger = replayer.ledger();
|
|
20709
|
+
const pinned = journalPricingSnapshot(replayer.snapshot());
|
|
20710
|
+
const mirrorPriceUsd = (servedBy, usage, seq) => pinned !== void 0 && seq !== void 0 && seq < pinned.pinnedThroughSeq ? pinned.priceUsd(servedBy, usage, seq) ?? priceUsd(servedBy, usage) : priceUsd(servedBy, usage);
|
|
20578
20711
|
const outcome = {
|
|
20579
20712
|
status,
|
|
20580
20713
|
dropped: internals.dropped,
|
|
20581
20714
|
pending,
|
|
20582
20715
|
usage: ledger.usage,
|
|
20583
|
-
cost: costReportFromJournal(replayer.snapshot(),
|
|
20716
|
+
cost: costReportFromJournal(replayer.snapshot(), mirrorPriceUsd)
|
|
20584
20717
|
};
|
|
20585
20718
|
if (value !== void 0 && (status === "ok" || status === "exhausted")) outcome.value = value;
|
|
20586
20719
|
if (wireError !== void 0) outcome.error = wireError;
|
|
@@ -21168,4 +21301,4 @@ function createSandboxBridge(ctx, options) {
|
|
|
21168
21301
|
};
|
|
21169
21302
|
}
|
|
21170
21303
|
//#endregion
|
|
21171
|
-
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_CITATION_SAMPLE, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_CALLS_PER_ENTRY, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_EVIDENCE_OVERHEAD_CALLS, 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, DedupIndex, DeterminismError, 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, IMPLEMENTATION_PROFILE_LIMITS, INBOX_PROPOSAL_TTL_DAYS, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, JOURNAL_ENVELOPE_MARKER, 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, PROGRESS_REPORT_TOOL_NAME, ParallelSiteCounter, PlanInvariantError, QUOTA_WINDOW_MS, 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, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionFold, RulvarError, RunBudget, SANDBOX_AGENT_OPT_KEYS, SPAWN_AGENT_SCHEMA, SandboxError, ScriptRejected, Semaphore, SettlementError, 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, 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, finishContract, foldTermination, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashRunOutput, hashWorkflowBody, hashWorkflowSource, headingStructureValidator, identityJcs, implementationAgentProfile, invoiceFromJournal, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, journalPricingSnapshot, 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, sectionCitationsValidator, selectStructuredOutputTier, selfTestFinishValidation, shouldCompact, snapshotUsage, spawnDepthOf, stripFencedBlocks, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, usageViolations, validateEditorialCommit, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateUsageLimits, wordCountValidator, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
|
|
21304
|
+
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_CITATION_SAMPLE, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_CALLS_PER_ENTRY, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_EVIDENCE_OVERHEAD_CALLS, 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, DedupIndex, DeterminismError, 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, IMPLEMENTATION_PROFILE_LIMITS, INBOX_PROPOSAL_TTL_DAYS, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, InvalidResolutionError, JOURNAL_ENVELOPE_MARKER, 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, PROGRESS_REPORT_TOOL_NAME, ParallelSiteCounter, PlanInvariantError, QUOTA_WINDOW_MS, 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, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionFold, RulvarError, RunBudget, SANDBOX_AGENT_OPT_KEYS, SPAWN_AGENT_SCHEMA, SandboxError, ScriptRejected, Semaphore, SettlementError, 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, 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, finishContract, foldTermination, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashRunOutput, hashWorkflowBody, hashWorkflowSource, headingStructureValidator, identityJcs, implementationAgentProfile, invoiceFromJournal, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, journalPricingSnapshot, 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, priceEntryBilling, 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, sectionCitationsValidator, selectStructuredOutputTier, selfTestFinishValidation, shouldCompact, snapshotUsage, spawnDepthOf, stripFencedBlocks, summarizeInstruction, summarizeOutput, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolsetHash, ttlState, usageViolations, validateEditorialCommit, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateUsageLimits, wordCountValidator, 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.98.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",
|