@rulvar/core 1.173.0 → 1.175.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 CHANGED
@@ -12707,8 +12707,27 @@ interface CriticalPath {
12707
12707
  runWallMs?: number;
12708
12708
  /** Last non-coordination agent:end to run:end; absent without both. */
12709
12709
  postFanInMs?: number;
12710
- /** Summed wall of completed 'synthesize' spans (0 when none). */
12710
+ /**
12711
+ * Summed wall of completed 'synthesize' spans (0 when none). Since
12712
+ * RV1604 this is exactly `finalCompositionMs + semanticJudgeMs`,
12713
+ * kept whole for existing consumers: the name predates the claim
12714
+ * judge riding the same role, and the eighteenth comparison
12715
+ * benchmark read a 54-second `synthesisMs` as a second final
12716
+ * composition when the run had SKIPPED synthesis and the bucket was
12717
+ * entirely the judge and its extract. Read the split fields.
12718
+ */
12711
12719
  synthesisMs: number;
12720
+ /**
12721
+ * Completed 'synthesize' spans that ARE final composition (every
12722
+ * synthesize span not labeled as the claim judge), summed (RV1604).
12723
+ */
12724
+ finalCompositionMs: number;
12725
+ /**
12726
+ * Completed 'synthesize' spans that are the claim-consistency judge
12727
+ * (agent:start label {@link CLAIM_JUDGE_LABEL}), its extract phase
12728
+ * included, summed (RV1604).
12729
+ */
12730
+ semanticJudgeMs: number;
12712
12731
  /** postFanInMs / runWallMs when both are defined and the wall is > 0. */
12713
12732
  postFanInShare?: number;
12714
12733
  /** synthesisMs / runWallMs under the same conditions. */
@@ -12785,6 +12804,10 @@ interface PostFanInBreakdown {
12785
12804
  coordinationToolCallsByName: Record<string, number>;
12786
12805
  /** Completed 'synthesize' span wall clipped to the window. */
12787
12806
  synthesisMs: number;
12807
+ /** The final-composition half of `synthesisMs`, clipped (RV1604). */
12808
+ finalCompositionMs: number;
12809
+ /** The claim-judge half of `synthesisMs`, clipped (RV1604). */
12810
+ semanticJudgeMs: number;
12788
12811
  /** Union length of every covered interval above. */
12789
12812
  coveredMs: number;
12790
12813
  /** postFanInMs minus coveredMs, floored at zero. */
@@ -12792,6 +12815,14 @@ interface PostFanInBreakdown {
12792
12815
  /** residueMs / postFanInMs when the window is longer than zero. */
12793
12816
  residueShare?: number;
12794
12817
  }
12818
+ /**
12819
+ * The label the claim-consistency judge invocation dispatches under
12820
+ * (RV1502; named here since RV1604 so the critical-path reducer and the
12821
+ * orchestrator share one constant): the judge rides role 'synthesize',
12822
+ * and this label is what tells its wall apart from a real final
12823
+ * composition in {@link reduceCriticalPath}.
12824
+ */
12825
+ declare const CLAIM_JUDGE_LABEL = "claim-consistency-judge";
12795
12826
  declare function reduceCriticalPath(events: Iterable<WorkflowEvent>): CriticalPath;
12796
12827
  //#endregion
12797
12828
  //#region src/runner/sandbox-bridge.d.ts
@@ -12866,4 +12897,4 @@ interface SandboxBridge {
12866
12897
  declare const SANDBOX_AGENT_OPT_KEYS: readonly string[];
12867
12898
  declare function createSandboxBridge(ctx: Ctx<never>, options: SandboxBridgeOptions): SandboxBridge;
12868
12899
  //#endregion
12869
- export { AWAIT_SCHEMA, AbandonAttempt, AbandonFold, AbandonPayload, AbandonedSpendView, AbortClass, AcceptanceChildSummary, 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, ChildExecutionFacts, ChildIdentityInput, ChildResultPage, CitationTarget, type ClaimClass, ClaimContradictionFinding, type ClaimOp, ClaimPair, ClaimPairOptions, ClaimPairsFold, ClaimPoolReading, type ClaimStatus, ClaimValidationOptions, CollectOpts, CollectedTurn, CompactionConfig, CompiledPermissionChain, CompiledWorkflow, ConfigError, Contradiction, ContradictionClaim, ContradictionOptions, ContradictionSource, type CoreEvents, CostAttribution, CostAttributionFacts, type CostBasis, CostReport, CreateEngineOptions, type CriticalPath, Ctx, DEFAULT_ANCHOR_PATTERN, DEFAULT_ARTIFACT_PATTERN, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, DEFAULT_CITATION_SAMPLE, DEFAULT_CLAIM_JUDGE_MAX_TURNS, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_CALLS_PER_ENTRY, DEFAULT_EVIDENCE_GRADE_PHRASES, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_EVIDENCE_OVERHEAD_CALLS, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_CLAIM_PAIRS, DEFAULT_MAX_CONTRADICTIONS, DEFAULT_MAX_DEPTH, DEFAULT_MAX_EXCERPT_CHARS, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PAIR_EXCERPT_CHARS, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_POOL_PER_PAIR, DEFAULT_MAX_QUOTA_DENIALS, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_RUN_FACT_PAIRS, 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, DocumentedRates, 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_SECTIONAL_SCHEMA, FINISH_TOOL_NAME, FailRunError, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, FencedCodeMode, FileModelKnowledgeStore, FileModelKnowledgeStoreOptions, FileTranscriptStore, type FinalizationWindowBudget, 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, IN_FLIGHT_EXPOSURE_REFUSAL_PREFIX, IdentityInput, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, IncrementalSynthesisResult, InvalidResolutionError, InvocationRole, type InvocationTable, InvoiceCardinality, 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_CRITICAL_UNCOVERED, MAX_DEPTH_CEILING, MAX_RUN_FACTS_SHEET_CHARS, MAX_RUN_ID_LENGTH, MAX_TIMER_DELAY_MS, 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, OrchestrateClaimConsistency, OrchestrateClaimConsistencyMeta, OrchestrateContradictions, OrchestrateContradictionsMeta, 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, PersistedTerminalRefusal, PersistedTerminalResult, type PhaseRow, PhaseTarget, type PinnedPricingSegment, PipelineCollected, PipelineOpts, PlanInvariantError, type PostFanInBreakdown, PreflightAdmissionRow, PreflightFinding, PreflightInput, PreflightOrchestratorSpec, PreflightReport, PreflightSpawnReport, PreflightSpawnSpec, PreflightToolCeiling, PriceTable, PricedComponent, PricedComponents, 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_FACTS_ANCHOR, 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, RunFactPairOptions, RunFactPairsFold, RunFactsSheet, 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, type StreamHooks, StructuredOutputTier, SupersededError, SuspendedAppend, SuspensionState, TOOL_NAME_PATTERN, type TaskClass, TaskDigest, TaskSpec, type TerminalEnvelope, TerminalOutcomeFacts, 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, ToolsetAttestation, 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, accountSpendFromJournal, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, assertFencedWrites, assertSafeRunId, atCompactionThreshold, attestToolset, auditRun, auditRuns, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, citationTargetsValidator, citedValueValidator, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compareRates, 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, enforceToolsetAttestation, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidenceGradeValidator, evidencePreservedValidator, executeWorkflow, executionFactsOf, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, findContradictions, finishContract, foldLedger, foldTermination, formatCharacterValidator, 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, pairDraftClaims, pairRunFactClaims, parallelScope, parseModelRef, parseScopePath, persistedTerminalEnvelope, phiInitialOf, pipelineScope, planNodeScope, preflightEstimate, priceComponentsOf, priceEntryBilling, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualRequestsDelta, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleKey, 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, snapshotQuotaRules, snapshotUsage, spawnDepthOf, spliceSections, stripFencedBlocks, sumUsage, summarizeInstruction, summarizeOutput, terminalEnvelopeOf, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolContractHash, toolsetHash, ttlState, usageViolations, validateDetachedResolution, validateEditorialCommit, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateToolsetAttestation, validateUsageLimits, wordCountValidator, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
12900
+ export { AWAIT_SCHEMA, AbandonAttempt, AbandonFold, AbandonPayload, AbandonedSpendView, AbortClass, AcceptanceChildSummary, 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_JUDGE_LABEL, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, CacheHint, CacheTtl, CanUseTool, CanonicalId, CanonicalIdentity, CanonicalLadderSpec, CanonicalModelSpec, ChatEvent, ChatRequest, CheckpointState, ChildArtifactPage, ChildExecutionFacts, ChildIdentityInput, ChildResultPage, CitationTarget, type ClaimClass, ClaimContradictionFinding, type ClaimOp, ClaimPair, ClaimPairOptions, ClaimPairsFold, ClaimPoolReading, type ClaimStatus, ClaimValidationOptions, CollectOpts, CollectedTurn, CompactionConfig, CompiledPermissionChain, CompiledWorkflow, ConfigError, Contradiction, ContradictionClaim, ContradictionOptions, ContradictionSource, type CoreEvents, CostAttribution, CostAttributionFacts, type CostBasis, CostReport, CreateEngineOptions, type CriticalPath, Ctx, DEFAULT_ANCHOR_PATTERN, DEFAULT_ARTIFACT_PATTERN, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, DEFAULT_CITATION_SAMPLE, DEFAULT_CLAIM_JUDGE_MAX_TURNS, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_CALLS_PER_ENTRY, DEFAULT_EVIDENCE_GRADE_PHRASES, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_EVIDENCE_OVERHEAD_CALLS, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_CLAIM_PAIRS, DEFAULT_MAX_CONTRADICTIONS, DEFAULT_MAX_DEPTH, DEFAULT_MAX_EXCERPT_CHARS, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PAIR_EXCERPT_CHARS, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_POOL_PER_PAIR, DEFAULT_MAX_QUOTA_DENIALS, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_RUN_FACT_PAIRS, 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, DocumentedRates, 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_SECTIONAL_SCHEMA, FINISH_TOOL_NAME, FailRunError, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, FencedCodeMode, FileModelKnowledgeStore, FileModelKnowledgeStoreOptions, FileTranscriptStore, type FinalizationWindowBudget, 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, IN_FLIGHT_EXPOSURE_REFUSAL_PREFIX, IdentityInput, InMemoryStore, InMemoryTranscriptStore, InProcessRunner, IncrementalSynthesisResult, InvalidResolutionError, InvocationRole, type InvocationTable, InvoiceCardinality, 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_CRITICAL_UNCOVERED, MAX_DEPTH_CEILING, MAX_RUN_FACTS_SHEET_CHARS, MAX_RUN_ID_LENGTH, MAX_TIMER_DELAY_MS, 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, OrchestrateClaimConsistency, OrchestrateClaimConsistencyMeta, OrchestrateContradictions, OrchestrateContradictionsMeta, 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, PersistedTerminalRefusal, PersistedTerminalResult, type PhaseRow, PhaseTarget, type PinnedPricingSegment, PipelineCollected, PipelineOpts, PlanInvariantError, type PostFanInBreakdown, PreflightAdmissionRow, PreflightFinding, PreflightInput, PreflightOrchestratorSpec, PreflightReport, PreflightSpawnReport, PreflightSpawnSpec, PreflightToolCeiling, PriceTable, PricedComponent, PricedComponents, 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_FACTS_ANCHOR, 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, RunFactPairOptions, RunFactPairsFold, RunFactsSheet, 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, type StreamHooks, StructuredOutputTier, SupersededError, SuspendedAppend, SuspensionState, TOOL_NAME_PATTERN, type TaskClass, TaskDigest, TaskSpec, type TerminalEnvelope, TerminalOutcomeFacts, 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, ToolsetAttestation, 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, accountSpendFromJournal, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, assertFencedWrites, assertSafeRunId, atCompactionThreshold, attestToolset, auditRun, auditRuns, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, citationTargetsValidator, citedValueValidator, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compareRates, 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, enforceToolsetAttestation, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidenceGradeValidator, evidencePreservedValidator, executeWorkflow, executionFactsOf, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, findContradictions, finishContract, foldLedger, foldTermination, formatCharacterValidator, 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, pairDraftClaims, pairRunFactClaims, parallelScope, parseModelRef, parseScopePath, persistedTerminalEnvelope, phiInitialOf, pipelineScope, planNodeScope, preflightEstimate, priceComponentsOf, priceEntryBilling, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualRequestsDelta, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleKey, 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, snapshotQuotaRules, snapshotUsage, spawnDepthOf, spliceSections, stripFencedBlocks, sumUsage, summarizeInstruction, summarizeOutput, terminalEnvelopeOf, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolContractHash, toolsetHash, ttlState, usageViolations, validateDetachedResolution, validateEditorialCommit, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateToolsetAttestation, validateUsageLimits, wordCountValidator, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
package/dist/index.js CHANGED
@@ -15175,6 +15175,294 @@ var AdmissionController = class {
15175
15175
  }
15176
15176
  };
15177
15177
  //#endregion
15178
+ //#region src/l0/telemetry-reduce.ts
15179
+ const ZERO = {
15180
+ inputTokens: 0,
15181
+ outputTokens: 0,
15182
+ cacheReadTokens: 0,
15183
+ cacheWriteTokens: 0
15184
+ };
15185
+ /**
15186
+ * Reduces one run's event stream (or any slice of it) to the invocation
15187
+ * table. Feed it the events in emission order; both a live stream and a
15188
+ * replayed one produce the same usage and cost columns.
15189
+ */
15190
+ function reduceInvocationTable(events) {
15191
+ const rows = /* @__PURE__ */ new Map();
15192
+ const order = [];
15193
+ const openPhases = /* @__PURE__ */ new Map();
15194
+ const byRole = {};
15195
+ let totalCostUsd = 0;
15196
+ const rowFor = (event) => {
15197
+ let row = rows.get(event.spanId);
15198
+ if (row === void 0) {
15199
+ row = {
15200
+ spanId: event.spanId,
15201
+ agentType: event.agentType,
15202
+ ...event.label === void 0 ? {} : { label: event.label },
15203
+ usage: ZERO,
15204
+ costUsd: 0,
15205
+ costBasis: "aggregate-estimate",
15206
+ usageApprox: false,
15207
+ retryCount: 0,
15208
+ replayed: event.replayed === true,
15209
+ open: true,
15210
+ phases: []
15211
+ };
15212
+ rows.set(event.spanId, row);
15213
+ order.push(row);
15214
+ }
15215
+ return row;
15216
+ };
15217
+ for (const event of events) switch (event.type) {
15218
+ case "agent:start": {
15219
+ const row = rowFor(event);
15220
+ row.role = event.role;
15221
+ break;
15222
+ }
15223
+ case "agent:phase:start": {
15224
+ const row = rowFor(event);
15225
+ const phase = {
15226
+ invocation: event.invocation,
15227
+ role: event.role,
15228
+ model: event.model,
15229
+ durationMs: 0,
15230
+ usage: ZERO,
15231
+ costUsd: 0,
15232
+ costBasis: "aggregate-estimate",
15233
+ retries: 0,
15234
+ replayed: event.replayed === true,
15235
+ open: true
15236
+ };
15237
+ row.phases.push(phase);
15238
+ openPhases.set(`${event.spanId}#${event.invocation}`, phase);
15239
+ break;
15240
+ }
15241
+ case "agent:phase:end": {
15242
+ const key = `${event.spanId}#${event.invocation}`;
15243
+ let phase = openPhases.get(key);
15244
+ if (phase === void 0) {
15245
+ phase = {
15246
+ invocation: event.invocation,
15247
+ role: event.role,
15248
+ model: event.model,
15249
+ durationMs: 0,
15250
+ usage: ZERO,
15251
+ costUsd: 0,
15252
+ costBasis: "aggregate-estimate",
15253
+ retries: 0,
15254
+ replayed: event.replayed === true,
15255
+ open: true
15256
+ };
15257
+ rowFor(event).phases.push(phase);
15258
+ }
15259
+ openPhases.delete(key);
15260
+ phase.open = false;
15261
+ phase.role = event.role;
15262
+ phase.model = event.model;
15263
+ phase.durationMs = event.durationMs;
15264
+ phase.usage = event.usage;
15265
+ phase.costUsd = event.costUsd;
15266
+ phase.costBasis = event.costBasis ?? "aggregate-estimate";
15267
+ phase.outcome = event.outcome;
15268
+ phase.retries = event.retries ?? 0;
15269
+ const bucket = byRole[event.role] ??= {
15270
+ usage: ZERO,
15271
+ costUsd: 0,
15272
+ costBasis: "per-call"
15273
+ };
15274
+ bucket.usage = sumUsage(bucket.usage, event.usage);
15275
+ bucket.costUsd += event.costUsd;
15276
+ if (phase.costBasis === "aggregate-estimate") bucket.costBasis = "aggregate-estimate";
15277
+ break;
15278
+ }
15279
+ case "agent:end": {
15280
+ const row = rowFor(event);
15281
+ row.open = false;
15282
+ row.status = event.status;
15283
+ row.usage = event.usage;
15284
+ row.costUsd = event.costUsd;
15285
+ row.costBasis = event.costBasis ?? "aggregate-estimate";
15286
+ row.usageApprox = event.usageApprox === true;
15287
+ row.retryCount = event.retryCount ?? 0;
15288
+ if (event.toolBudget !== void 0) row.toolBudget = event.toolBudget;
15289
+ totalCostUsd += event.costUsd;
15290
+ break;
15291
+ }
15292
+ default: break;
15293
+ }
15294
+ return {
15295
+ agents: order,
15296
+ byRole,
15297
+ totalCostUsd
15298
+ };
15299
+ }
15300
+ /**
15301
+ * The label the claim-consistency judge invocation dispatches under
15302
+ * (RV1502; named here since RV1604 so the critical-path reducer and the
15303
+ * orchestrator share one constant): the judge rides role 'synthesize',
15304
+ * and this label is what tells its wall apart from a real final
15305
+ * composition in {@link reduceCriticalPath}.
15306
+ */
15307
+ const CLAIM_JUDGE_LABEL = "claim-consistency-judge";
15308
+ /** Total length of the union of possibly overlapping intervals. */
15309
+ function unionLength(intervals) {
15310
+ const positive = intervals.filter((interval) => interval.to > interval.from);
15311
+ if (positive.length === 0) return 0;
15312
+ const sorted = [...positive].sort((a, b) => a.from - b.from);
15313
+ let total = 0;
15314
+ let from = sorted[0]?.from ?? 0;
15315
+ let to = sorted[0]?.to ?? 0;
15316
+ for (const interval of sorted.slice(1)) if (interval.from > to) {
15317
+ total += to - from;
15318
+ from = interval.from;
15319
+ to = interval.to;
15320
+ } else if (interval.to > to) to = interval.to;
15321
+ return total + (to - from);
15322
+ }
15323
+ function reduceCriticalPath(events) {
15324
+ let runStart;
15325
+ let runEnd;
15326
+ const startBySpan = /* @__PURE__ */ new Map();
15327
+ let lastWorkerEnd;
15328
+ let workerSpans = 0;
15329
+ let synthesisMs = 0;
15330
+ let finalCompositionMs = 0;
15331
+ let semanticJudgeMs = 0;
15332
+ const coordinationModel = [];
15333
+ const coordinationTools = [];
15334
+ const synthesisSpans = [];
15335
+ const spanOf = (durationMs) => Number.isFinite(durationMs) && durationMs > 0 ? durationMs : 0;
15336
+ for (const event of events) {
15337
+ const at = Date.parse(event.ts);
15338
+ if (!Number.isFinite(at)) continue;
15339
+ switch (event.type) {
15340
+ case "run:start":
15341
+ runStart ??= at;
15342
+ break;
15343
+ case "run:end":
15344
+ runEnd = at;
15345
+ break;
15346
+ case "agent:start":
15347
+ startBySpan.set(event.spanId, {
15348
+ role: event.role,
15349
+ at,
15350
+ ...event.label === void 0 ? {} : { label: event.label }
15351
+ });
15352
+ break;
15353
+ case "agent:phase:end":
15354
+ if (startBySpan.get(event.spanId)?.role === "orchestrate") coordinationModel.push({
15355
+ phase: event.role,
15356
+ from: at - spanOf(event.durationMs),
15357
+ to: at
15358
+ });
15359
+ break;
15360
+ case "tool:end":
15361
+ if (startBySpan.get(event.spanId)?.role === "orchestrate") coordinationTools.push({
15362
+ name: event.toolName,
15363
+ from: at - spanOf(event.durationMs),
15364
+ to: at
15365
+ });
15366
+ break;
15367
+ case "agent:end": {
15368
+ const started = startBySpan.get(event.spanId);
15369
+ if (started === void 0) break;
15370
+ if (started.role === "synthesize") {
15371
+ const wall = Math.max(0, at - started.at);
15372
+ const judge = started.label === CLAIM_JUDGE_LABEL;
15373
+ synthesisMs += wall;
15374
+ if (judge) semanticJudgeMs += wall;
15375
+ else finalCompositionMs += wall;
15376
+ synthesisSpans.push({
15377
+ from: started.at,
15378
+ to: at,
15379
+ judge
15380
+ });
15381
+ } else if (started.role !== "orchestrate") {
15382
+ workerSpans += 1;
15383
+ lastWorkerEnd = lastWorkerEnd === void 0 ? at : Math.max(lastWorkerEnd, at);
15384
+ }
15385
+ break;
15386
+ }
15387
+ default: break;
15388
+ }
15389
+ }
15390
+ const path = {
15391
+ synthesisMs,
15392
+ finalCompositionMs,
15393
+ semanticJudgeMs,
15394
+ workerSpans
15395
+ };
15396
+ if (runStart !== void 0 && runEnd !== void 0) path.runWallMs = Math.max(0, runEnd - runStart);
15397
+ if (runEnd !== void 0 && lastWorkerEnd !== void 0) {
15398
+ path.postFanInMs = Math.max(0, runEnd - lastWorkerEnd);
15399
+ const windowFrom = Math.min(lastWorkerEnd, runEnd);
15400
+ const windowTo = runEnd;
15401
+ const clip = (interval) => {
15402
+ if (interval.to < windowFrom || interval.from > windowTo) return;
15403
+ return {
15404
+ from: Math.max(interval.from, windowFrom),
15405
+ to: Math.min(interval.to, windowTo)
15406
+ };
15407
+ };
15408
+ const byPhase = {};
15409
+ const modelClipped = [];
15410
+ for (const interval of coordinationModel) {
15411
+ const clipped = clip(interval);
15412
+ if (clipped === void 0) continue;
15413
+ byPhase[interval.phase] = (byPhase[interval.phase] ?? 0) + (clipped.to - clipped.from);
15414
+ modelClipped.push(clipped);
15415
+ }
15416
+ const synthesisClipped = [];
15417
+ let judgeClippedMs = 0;
15418
+ let compositionClippedMs = 0;
15419
+ for (const span of synthesisSpans) {
15420
+ const clipped = clip(span);
15421
+ if (clipped === void 0) continue;
15422
+ synthesisClipped.push(clipped);
15423
+ if (span.judge) judgeClippedMs += clipped.to - clipped.from;
15424
+ else compositionClippedMs += clipped.to - clipped.from;
15425
+ }
15426
+ const byName = {};
15427
+ const callsByName = {};
15428
+ const toolsClipped = [];
15429
+ for (const interval of coordinationTools) {
15430
+ const clipped = clip(interval);
15431
+ if (clipped === void 0) continue;
15432
+ byName[interval.name] = (byName[interval.name] ?? 0) + (clipped.to - clipped.from);
15433
+ callsByName[interval.name] = (callsByName[interval.name] ?? 0) + 1;
15434
+ toolsClipped.push(clipped);
15435
+ }
15436
+ const lengthOf = (intervals) => intervals.reduce((sum, interval) => sum + (interval.to - interval.from), 0);
15437
+ const coveredMs = unionLength([
15438
+ ...modelClipped,
15439
+ ...toolsClipped,
15440
+ ...synthesisClipped
15441
+ ]);
15442
+ const modelOnlyMs = unionLength([...modelClipped, ...toolsClipped]) - unionLength(toolsClipped);
15443
+ const breakdown = {
15444
+ coordinationModelMs: lengthOf(modelClipped),
15445
+ coordinationModelMsByPhase: byPhase,
15446
+ coordinationModelOnlyMs: modelOnlyMs,
15447
+ coordinationToolMs: lengthOf(toolsClipped),
15448
+ coordinationToolMsByName: byName,
15449
+ coordinationToolCallsByName: callsByName,
15450
+ synthesisMs: lengthOf(synthesisClipped),
15451
+ finalCompositionMs: compositionClippedMs,
15452
+ semanticJudgeMs: judgeClippedMs,
15453
+ coveredMs,
15454
+ residueMs: Math.max(0, path.postFanInMs - coveredMs)
15455
+ };
15456
+ if (path.postFanInMs > 0) breakdown.residueShare = breakdown.residueMs / path.postFanInMs;
15457
+ path.postFanIn = breakdown;
15458
+ }
15459
+ if (path.runWallMs !== void 0 && path.runWallMs > 0) {
15460
+ if (path.postFanInMs !== void 0) path.postFanInShare = path.postFanInMs / path.runWallMs;
15461
+ path.synthesisShare = synthesisMs / path.runWallMs;
15462
+ }
15463
+ return path;
15464
+ }
15465
+ //#endregion
15178
15466
  //#region src/model/profile-card.ts
15179
15467
  function toolNamesOf(profile) {
15180
15468
  return (profile.tools ?? []).map((entry) => {
@@ -19988,7 +20276,7 @@ function makeOrchestratorWorkflow(goal, opts) {
19988
20276
  * handing it the prior ordinal's handle would bind the transcript
19989
20277
  * to a stranger's child.
19990
20278
  */
19991
- const recoveredSpecByOrdinal = /* @__PURE__ */ new Map();
20279
+ const unclaimedRecoveredBySpec = /* @__PURE__ */ new Map();
19992
20280
  let nextOrdinal = 0;
19993
20281
  /**
19994
20282
  * The maxSpawns ledger counts ADMITTED children, never attempt
@@ -20229,7 +20517,12 @@ function makeOrchestratorWorkflow(goal, opts) {
20229
20517
  for (const { entrySeq, value } of admissions) {
20230
20518
  nextOrdinal = Math.max(nextOrdinal, value.spawnOrdinal + 1);
20231
20519
  const decision = value.decision;
20232
- recoveredSpecByOrdinal.set(value.spawnOrdinal, value.spec);
20520
+ {
20521
+ const specKey = jcsSerialize(value.spec);
20522
+ const queue = unclaimedRecoveredBySpec.get(specKey);
20523
+ if (queue === void 0) unclaimedRecoveredBySpec.set(specKey, [value.spawnOrdinal]);
20524
+ else queue.push(value.spawnOrdinal);
20525
+ }
20233
20526
  const recoveredAgentType = value.spec?.agentType ?? "unknown";
20234
20527
  if (decision.verdict.kind !== "admit") {
20235
20528
  rejectedByOrdinal.set(value.spawnOrdinal, {
@@ -20392,24 +20685,26 @@ function makeOrchestratorWorkflow(goal, opts) {
20392
20685
  const orchestratorRuntime = {
20393
20686
  async spawn(params) {
20394
20687
  await recoveryDone;
20395
- const spawnOrdinal = nextOrdinal;
20396
- nextOrdinal += 1;
20397
- const priorSpec = recoveredSpecByOrdinal.get(spawnOrdinal);
20398
- const specMatches = priorSpec === void 0 || priorSpec.agentType === params.agentType && priorSpec.prompt === params.prompt;
20399
- const recovered = byOrdinal.get(spawnOrdinal);
20400
- if (recovered !== void 0 && specMatches) return { handle: recovered.handle };
20401
- const recoveredRejection = rejectedByOrdinal.get(spawnOrdinal);
20402
- if (recoveredRejection !== void 0 && specMatches) {
20403
- const reason = recoveredRejection.decision.verdict;
20404
- emitSpawnRejected(internals.events, {
20405
- entryRef: recoveredRejection.entrySeq,
20406
- code: reason.reason?.code ?? "unknown",
20407
- agentType: params.agentType,
20408
- spanId: callingState.spanId,
20409
- replayed: true
20410
- });
20411
- throw new AdmissionRejectedError(`admission rejected spawn ordinal ${String(spawnOrdinal)} (recovered verdict)`, { data: { decision: recoveredRejection.decision } });
20688
+ const specKey = jcsSerialize(params);
20689
+ const recoveredOrdinal = unclaimedRecoveredBySpec.get(specKey)?.shift();
20690
+ if (recoveredOrdinal !== void 0) {
20691
+ const recovered = byOrdinal.get(recoveredOrdinal);
20692
+ if (recovered !== void 0) return { handle: recovered.handle };
20693
+ const recoveredRejection = rejectedByOrdinal.get(recoveredOrdinal);
20694
+ if (recoveredRejection !== void 0) {
20695
+ const reason = recoveredRejection.decision.verdict;
20696
+ emitSpawnRejected(internals.events, {
20697
+ entryRef: recoveredRejection.entrySeq,
20698
+ code: reason.reason?.code ?? "unknown",
20699
+ agentType: params.agentType,
20700
+ spanId: callingState.spanId,
20701
+ replayed: true
20702
+ });
20703
+ throw new AdmissionRejectedError(`admission rejected spawn ordinal ${String(recoveredOrdinal)} (recovered verdict)`, { data: { decision: recoveredRejection.decision } });
20704
+ }
20412
20705
  }
20706
+ const spawnOrdinal = nextOrdinal;
20707
+ nextOrdinal += 1;
20413
20708
  if (opts?.maxSpawns !== void 0 && admittedSpawnCount >= opts.maxSpawns) {
20414
20709
  internals.events.emit({
20415
20710
  type: "spawn:rejected",
@@ -21659,7 +21954,7 @@ function makeOrchestratorWorkflow(goal, opts) {
21659
21954
  const judgeOpts = {
21660
21955
  role: "synthesize",
21661
21956
  result: "full",
21662
- label: "claim-consistency-judge",
21957
+ label: CLAIM_JUDGE_LABEL,
21663
21958
  schema: CLAIM_JUDGE_SCHEMA,
21664
21959
  limits: spec.judge?.limits ?? { maxTurns: 3 },
21665
21960
  ...spec.judge?.model === void 0 ? {} : { model: spec.judge.model },
@@ -23617,265 +23912,6 @@ var EventBus = class {
23617
23912
  }
23618
23913
  };
23619
23914
  //#endregion
23620
- //#region src/l0/telemetry-reduce.ts
23621
- const ZERO = {
23622
- inputTokens: 0,
23623
- outputTokens: 0,
23624
- cacheReadTokens: 0,
23625
- cacheWriteTokens: 0
23626
- };
23627
- /**
23628
- * Reduces one run's event stream (or any slice of it) to the invocation
23629
- * table. Feed it the events in emission order; both a live stream and a
23630
- * replayed one produce the same usage and cost columns.
23631
- */
23632
- function reduceInvocationTable(events) {
23633
- const rows = /* @__PURE__ */ new Map();
23634
- const order = [];
23635
- const openPhases = /* @__PURE__ */ new Map();
23636
- const byRole = {};
23637
- let totalCostUsd = 0;
23638
- const rowFor = (event) => {
23639
- let row = rows.get(event.spanId);
23640
- if (row === void 0) {
23641
- row = {
23642
- spanId: event.spanId,
23643
- agentType: event.agentType,
23644
- ...event.label === void 0 ? {} : { label: event.label },
23645
- usage: ZERO,
23646
- costUsd: 0,
23647
- costBasis: "aggregate-estimate",
23648
- usageApprox: false,
23649
- retryCount: 0,
23650
- replayed: event.replayed === true,
23651
- open: true,
23652
- phases: []
23653
- };
23654
- rows.set(event.spanId, row);
23655
- order.push(row);
23656
- }
23657
- return row;
23658
- };
23659
- for (const event of events) switch (event.type) {
23660
- case "agent:start": {
23661
- const row = rowFor(event);
23662
- row.role = event.role;
23663
- break;
23664
- }
23665
- case "agent:phase:start": {
23666
- const row = rowFor(event);
23667
- const phase = {
23668
- invocation: event.invocation,
23669
- role: event.role,
23670
- model: event.model,
23671
- durationMs: 0,
23672
- usage: ZERO,
23673
- costUsd: 0,
23674
- costBasis: "aggregate-estimate",
23675
- retries: 0,
23676
- replayed: event.replayed === true,
23677
- open: true
23678
- };
23679
- row.phases.push(phase);
23680
- openPhases.set(`${event.spanId}#${event.invocation}`, phase);
23681
- break;
23682
- }
23683
- case "agent:phase:end": {
23684
- const key = `${event.spanId}#${event.invocation}`;
23685
- let phase = openPhases.get(key);
23686
- if (phase === void 0) {
23687
- phase = {
23688
- invocation: event.invocation,
23689
- role: event.role,
23690
- model: event.model,
23691
- durationMs: 0,
23692
- usage: ZERO,
23693
- costUsd: 0,
23694
- costBasis: "aggregate-estimate",
23695
- retries: 0,
23696
- replayed: event.replayed === true,
23697
- open: true
23698
- };
23699
- rowFor(event).phases.push(phase);
23700
- }
23701
- openPhases.delete(key);
23702
- phase.open = false;
23703
- phase.role = event.role;
23704
- phase.model = event.model;
23705
- phase.durationMs = event.durationMs;
23706
- phase.usage = event.usage;
23707
- phase.costUsd = event.costUsd;
23708
- phase.costBasis = event.costBasis ?? "aggregate-estimate";
23709
- phase.outcome = event.outcome;
23710
- phase.retries = event.retries ?? 0;
23711
- const bucket = byRole[event.role] ??= {
23712
- usage: ZERO,
23713
- costUsd: 0,
23714
- costBasis: "per-call"
23715
- };
23716
- bucket.usage = sumUsage(bucket.usage, event.usage);
23717
- bucket.costUsd += event.costUsd;
23718
- if (phase.costBasis === "aggregate-estimate") bucket.costBasis = "aggregate-estimate";
23719
- break;
23720
- }
23721
- case "agent:end": {
23722
- const row = rowFor(event);
23723
- row.open = false;
23724
- row.status = event.status;
23725
- row.usage = event.usage;
23726
- row.costUsd = event.costUsd;
23727
- row.costBasis = event.costBasis ?? "aggregate-estimate";
23728
- row.usageApprox = event.usageApprox === true;
23729
- row.retryCount = event.retryCount ?? 0;
23730
- if (event.toolBudget !== void 0) row.toolBudget = event.toolBudget;
23731
- totalCostUsd += event.costUsd;
23732
- break;
23733
- }
23734
- default: break;
23735
- }
23736
- return {
23737
- agents: order,
23738
- byRole,
23739
- totalCostUsd
23740
- };
23741
- }
23742
- /** Total length of the union of possibly overlapping intervals. */
23743
- function unionLength(intervals) {
23744
- const positive = intervals.filter((interval) => interval.to > interval.from);
23745
- if (positive.length === 0) return 0;
23746
- const sorted = [...positive].sort((a, b) => a.from - b.from);
23747
- let total = 0;
23748
- let from = sorted[0]?.from ?? 0;
23749
- let to = sorted[0]?.to ?? 0;
23750
- for (const interval of sorted.slice(1)) if (interval.from > to) {
23751
- total += to - from;
23752
- from = interval.from;
23753
- to = interval.to;
23754
- } else if (interval.to > to) to = interval.to;
23755
- return total + (to - from);
23756
- }
23757
- function reduceCriticalPath(events) {
23758
- let runStart;
23759
- let runEnd;
23760
- const startBySpan = /* @__PURE__ */ new Map();
23761
- let lastWorkerEnd;
23762
- let workerSpans = 0;
23763
- let synthesisMs = 0;
23764
- const coordinationModel = [];
23765
- const coordinationTools = [];
23766
- const synthesisSpans = [];
23767
- const spanOf = (durationMs) => Number.isFinite(durationMs) && durationMs > 0 ? durationMs : 0;
23768
- for (const event of events) {
23769
- const at = Date.parse(event.ts);
23770
- if (!Number.isFinite(at)) continue;
23771
- switch (event.type) {
23772
- case "run:start":
23773
- runStart ??= at;
23774
- break;
23775
- case "run:end":
23776
- runEnd = at;
23777
- break;
23778
- case "agent:start":
23779
- startBySpan.set(event.spanId, {
23780
- role: event.role,
23781
- at
23782
- });
23783
- break;
23784
- case "agent:phase:end":
23785
- if (startBySpan.get(event.spanId)?.role === "orchestrate") coordinationModel.push({
23786
- phase: event.role,
23787
- from: at - spanOf(event.durationMs),
23788
- to: at
23789
- });
23790
- break;
23791
- case "tool:end":
23792
- if (startBySpan.get(event.spanId)?.role === "orchestrate") coordinationTools.push({
23793
- name: event.toolName,
23794
- from: at - spanOf(event.durationMs),
23795
- to: at
23796
- });
23797
- break;
23798
- case "agent:end": {
23799
- const started = startBySpan.get(event.spanId);
23800
- if (started === void 0) break;
23801
- if (started.role === "synthesize") {
23802
- synthesisMs += Math.max(0, at - started.at);
23803
- synthesisSpans.push({
23804
- from: started.at,
23805
- to: at
23806
- });
23807
- } else if (started.role !== "orchestrate") {
23808
- workerSpans += 1;
23809
- lastWorkerEnd = lastWorkerEnd === void 0 ? at : Math.max(lastWorkerEnd, at);
23810
- }
23811
- break;
23812
- }
23813
- default: break;
23814
- }
23815
- }
23816
- const path = {
23817
- synthesisMs,
23818
- workerSpans
23819
- };
23820
- if (runStart !== void 0 && runEnd !== void 0) path.runWallMs = Math.max(0, runEnd - runStart);
23821
- if (runEnd !== void 0 && lastWorkerEnd !== void 0) {
23822
- path.postFanInMs = Math.max(0, runEnd - lastWorkerEnd);
23823
- const windowFrom = Math.min(lastWorkerEnd, runEnd);
23824
- const windowTo = runEnd;
23825
- const clip = (interval) => {
23826
- if (interval.to < windowFrom || interval.from > windowTo) return;
23827
- return {
23828
- from: Math.max(interval.from, windowFrom),
23829
- to: Math.min(interval.to, windowTo)
23830
- };
23831
- };
23832
- const byPhase = {};
23833
- const modelClipped = [];
23834
- for (const interval of coordinationModel) {
23835
- const clipped = clip(interval);
23836
- if (clipped === void 0) continue;
23837
- byPhase[interval.phase] = (byPhase[interval.phase] ?? 0) + (clipped.to - clipped.from);
23838
- modelClipped.push(clipped);
23839
- }
23840
- const synthesisClipped = synthesisSpans.map(clip).filter((interval) => interval !== void 0);
23841
- const byName = {};
23842
- const callsByName = {};
23843
- const toolsClipped = [];
23844
- for (const interval of coordinationTools) {
23845
- const clipped = clip(interval);
23846
- if (clipped === void 0) continue;
23847
- byName[interval.name] = (byName[interval.name] ?? 0) + (clipped.to - clipped.from);
23848
- callsByName[interval.name] = (callsByName[interval.name] ?? 0) + 1;
23849
- toolsClipped.push(clipped);
23850
- }
23851
- const lengthOf = (intervals) => intervals.reduce((sum, interval) => sum + (interval.to - interval.from), 0);
23852
- const coveredMs = unionLength([
23853
- ...modelClipped,
23854
- ...toolsClipped,
23855
- ...synthesisClipped
23856
- ]);
23857
- const modelOnlyMs = unionLength([...modelClipped, ...toolsClipped]) - unionLength(toolsClipped);
23858
- const breakdown = {
23859
- coordinationModelMs: lengthOf(modelClipped),
23860
- coordinationModelMsByPhase: byPhase,
23861
- coordinationModelOnlyMs: modelOnlyMs,
23862
- coordinationToolMs: lengthOf(toolsClipped),
23863
- coordinationToolMsByName: byName,
23864
- coordinationToolCallsByName: callsByName,
23865
- synthesisMs: lengthOf(synthesisClipped),
23866
- coveredMs,
23867
- residueMs: Math.max(0, path.postFanInMs - coveredMs)
23868
- };
23869
- if (path.postFanInMs > 0) breakdown.residueShare = breakdown.residueMs / path.postFanInMs;
23870
- path.postFanIn = breakdown;
23871
- }
23872
- if (path.runWallMs !== void 0 && path.runWallMs > 0) {
23873
- if (path.postFanInMs !== void 0) path.postFanInShare = path.postFanInMs / path.runWallMs;
23874
- path.synthesisShare = synthesisMs / path.runWallMs;
23875
- }
23876
- return path;
23877
- }
23878
- //#endregion
23879
23915
  //#region src/runner/inprocess.ts
23880
23916
  /**
23881
23917
  * The mode (a) runner for human-authored closures. Determinism is enforced
@@ -25324,4 +25360,4 @@ function createSandboxBridge(ctx, options) {
25324
25360
  };
25325
25361
  }
25326
25362
  //#endregion
25327
- 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_ANCHOR_PATTERN, DEFAULT_ARTIFACT_PATTERN, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, DEFAULT_CITATION_SAMPLE, DEFAULT_CLAIM_JUDGE_MAX_TURNS, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_CALLS_PER_ENTRY, DEFAULT_EVIDENCE_GRADE_PHRASES, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_EVIDENCE_OVERHEAD_CALLS, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_CLAIM_PAIRS, DEFAULT_MAX_CONTRADICTIONS, DEFAULT_MAX_DEPTH, DEFAULT_MAX_EXCERPT_CHARS, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PAIR_EXCERPT_CHARS, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_POOL_PER_PAIR, DEFAULT_MAX_QUOTA_DENIALS, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_RUN_FACT_PAIRS, 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_SECTIONAL_SCHEMA, FINISH_TOOL_NAME, FailRunError, FileModelKnowledgeStore, FileTranscriptStore, GET_CHILD_RESULT_SCHEMA, GET_CHILD_RESULT_TOOL_NAME, GitWorktreeProvider, IMPLEMENTATION_PROFILE_LIMITS, INBOX_PROPOSAL_TTL_DAYS, IN_FLIGHT_EXPOSURE_REFUSAL_PREFIX, 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_CRITICAL_UNCOVERED, MAX_DEPTH_CEILING, MAX_RUN_FACTS_SHEET_CHARS, MAX_RUN_ID_LENGTH, MAX_TIMER_DELAY_MS, 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_FACTS_ANCHOR, RUN_PROFILES, RUN_SETTLE_DECISION_TYPE, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionFold, RulvarError, RunBudget, SANDBOX_AGENT_OPT_KEYS, SPAWN_AGENT_SCHEMA, SandboxError, ScriptRejected, Semaphore, SettlementError, SpanRegistry, SupersededError, TOOL_NAME_PATTERN, TerminationAccount, WAIT_FOR_EVENTS_SCHEMA, WAIT_FOR_EVENTS_TOOL_NAME, WAKE_SUMMARY_RENDER_BUDGET_CHARS, accountSpendFromJournal, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, assertFencedWrites, assertSafeRunId, atCompactionThreshold, attestToolset, auditRun, auditRuns, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, citationTargetsValidator, citedValueValidator, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compareRates, 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, enforceToolsetAttestation, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidenceGradeValidator, evidencePreservedValidator, executeWorkflow, executionFactsOf, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, findContradictions, finishContract, foldLedger, foldTermination, formatCharacterValidator, 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, pairDraftClaims, pairRunFactClaims, parallelScope, parseModelRef, parseScopePath, persistedTerminalEnvelope, phiInitialOf, pipelineScope, planNodeScope, preflightEstimate, priceComponentsOf, priceEntryBilling, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualRequestsDelta, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleKey, 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, snapshotQuotaRules, snapshotUsage, spawnDepthOf, spliceSections, stripFencedBlocks, sumUsage, summarizeInstruction, summarizeOutput, terminalEnvelopeOf, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolContractHash, toolsetHash, ttlState, usageViolations, validateDetachedResolution, validateEditorialCommit, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateToolsetAttestation, validateUsageLimits, wordCountValidator, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
25363
+ export { AWAIT_SCHEMA, AdmissionController, AdmissionRejectedError, AgentCallError, BUDGET_ABORT_REASON, BudgetExhaustedError, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_JUDGE_LABEL, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, ConfigError, DEFAULT_ANCHOR_PATTERN, DEFAULT_ARTIFACT_PATTERN, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, DEFAULT_CITATION_SAMPLE, DEFAULT_CLAIM_JUDGE_MAX_TURNS, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_CALLS_PER_ENTRY, DEFAULT_EVIDENCE_GRADE_PHRASES, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_EVIDENCE_OVERHEAD_CALLS, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_CLAIM_PAIRS, DEFAULT_MAX_CONTRADICTIONS, DEFAULT_MAX_DEPTH, DEFAULT_MAX_EXCERPT_CHARS, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PAIR_EXCERPT_CHARS, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_POOL_PER_PAIR, DEFAULT_MAX_QUOTA_DENIALS, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_RUN_FACT_PAIRS, 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_SECTIONAL_SCHEMA, FINISH_TOOL_NAME, FailRunError, FileModelKnowledgeStore, FileTranscriptStore, GET_CHILD_RESULT_SCHEMA, GET_CHILD_RESULT_TOOL_NAME, GitWorktreeProvider, IMPLEMENTATION_PROFILE_LIMITS, INBOX_PROPOSAL_TTL_DAYS, IN_FLIGHT_EXPOSURE_REFUSAL_PREFIX, 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_CRITICAL_UNCOVERED, MAX_DEPTH_CEILING, MAX_RUN_FACTS_SHEET_CHARS, MAX_RUN_ID_LENGTH, MAX_TIMER_DELAY_MS, 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_FACTS_ANCHOR, RUN_PROFILES, RUN_SETTLE_DECISION_TYPE, ReplayPlanHashMismatch, Replayer, ResolutionArbiter, ResolutionFold, RulvarError, RunBudget, SANDBOX_AGENT_OPT_KEYS, SPAWN_AGENT_SCHEMA, SandboxError, ScriptRejected, Semaphore, SettlementError, SpanRegistry, SupersededError, TOOL_NAME_PATTERN, TerminationAccount, WAIT_FOR_EVENTS_SCHEMA, WAIT_FOR_EVENTS_TOOL_NAME, WAKE_SUMMARY_RENDER_BUDGET_CHARS, accountSpendFromJournal, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, assertFencedWrites, assertSafeRunId, atCompactionThreshold, attestToolset, auditRun, auditRuns, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, citationTargetsValidator, citedValueValidator, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compareRates, 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, enforceToolsetAttestation, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidenceGradeValidator, evidencePreservedValidator, executeWorkflow, executionFactsOf, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, findContradictions, finishContract, foldLedger, foldTermination, formatCharacterValidator, 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, pairDraftClaims, pairRunFactClaims, parallelScope, parseModelRef, parseScopePath, persistedTerminalEnvelope, phiInitialOf, pipelineScope, planNodeScope, preflightEstimate, priceComponentsOf, priceEntryBilling, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualRequestsDelta, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleKey, 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, snapshotQuotaRules, snapshotUsage, spawnDepthOf, spliceSections, stripFencedBlocks, sumUsage, summarizeInstruction, summarizeOutput, terminalEnvelopeOf, terminationConfigDrift, tierWithinCaps, toApprovalDecision, toJournalValue, tool, toolContract, toolContractHash, toolsetHash, ttlState, usageViolations, validateDetachedResolution, validateEditorialCommit, validateEngineQuotaConfig, validateEntryShape, validateEscalationLimits, validateEscalationReport, validateQuotaRules, validateRetryPolicy, validateSchemaSpec, validateTerminationLimits, validateToolsetAttestation, validateUsageLimits, wordCountValidator, workflowScope, workflowSourceRef, wrapJournalStore, wrapTranscriptStore };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/core",
3
- "version": "1.173.0",
3
+ "version": "1.175.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",