@rulvar/core 1.76.0 → 1.78.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.
Files changed (3) hide show
  1. package/dist/index.d.ts +165 -17
  2. package/dist/index.js +354 -58
  3. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -4197,6 +4197,16 @@ interface AgentResult<T> {
4197
4197
  * seeing a bare 'terminal status limit'.
4198
4198
  */
4199
4199
  partial?: ProgressReport;
4200
+ /**
4201
+ * Terminal-tool exchanges whose ARGUMENTS died at the schema gate
4202
+ * (the unparsed second chance included, when it did not recover): the
4203
+ * v1.74 experiment lost six finish payloads to exactly this class,
4204
+ * and nothing outside the transcript said so (host validation
4205
+ * rejections, by contrast, journal decision entries). Derived from
4206
+ * the message window like the repair-reserve grants, so live and
4207
+ * resumed segments count the same total; absent when zero.
4208
+ */
4209
+ schemaRejectedTerminalExchanges?: number;
4200
4210
  }
4201
4211
  /** One 429's provider-normalized limits, per (provider, model). */
4202
4212
  interface RateLimitObservation {
@@ -6317,13 +6327,47 @@ interface FinishValidator {
6317
6327
  validate(input: FinishValidationInput): FinishValidationVerdict;
6318
6328
  }
6319
6329
  /**
6330
+ * How section markers must appear in the judged text (cycle 74):
6331
+ * 'anywhere' is the historical substring test; 'line' demands the
6332
+ * marker as its own line (surrounding whitespace ignored), so a
6333
+ * mid sentence mention or a quoted marker no longer satisfies a
6334
+ * heading requirement.
6335
+ */
6336
+ type SectionMatchMode = "anywhere" | "line";
6337
+ /**
6338
+ * Whether fenced code participates in textual validation (cycle 74):
6339
+ * 'counted' is the historical behavior; 'excluded' removes fenced code
6340
+ * blocks (see {@link stripFencedBlocks}) before matching, counting, or
6341
+ * slicing, so code samples can neither satisfy a section marker nor
6342
+ * inflate word and citation counts.
6343
+ */
6344
+ type FencedCodeMode = "counted" | "excluded";
6345
+ /**
6346
+ * Removes fenced code blocks from a text, the delimiter lines
6347
+ * included, and returns the remaining lines joined by newlines. The
6348
+ * grammar is the CommonMark shape as a deliberate line heuristic: a
6349
+ * fence opens at a line starting (after at most three spaces) with
6350
+ * three or more backticks or tildes, an optional info string allowed;
6351
+ * it closes at the next line carrying only at least as many of the
6352
+ * SAME character; an unclosed fence runs to the end of the text.
6353
+ * Indented (four space) code blocks are not treated as code. This is
6354
+ * the exact exclusion the `fencedCode: 'excluded'` validator option
6355
+ * applies, exported so custom host validators can stay symmetric.
6356
+ */
6357
+ declare function stripFencedBlocks(text: string): string;
6358
+ /**
6320
6359
  * Requires every named section to appear LITERALLY in the result text
6321
6360
  * (a heading like 'FINDINGS' or any marker the goal demands). Default
6322
6361
  * name 'required-sections'; pass `name` to run several instances.
6362
+ * `match: 'line'` demands each marker as its own line and
6363
+ * `fencedCode: 'excluded'` ignores markers inside fenced code blocks
6364
+ * (cycle 74); both default to the historical byte identical behavior.
6323
6365
  */
6324
6366
  declare function requiredSectionsValidator(options: {
6325
- sections: string[];
6367
+ sections: readonly string[];
6326
6368
  name?: string;
6369
+ match?: SectionMatchMode;
6370
+ fencedCode?: FencedCodeMode;
6327
6371
  }): FinishValidator;
6328
6372
  /**
6329
6373
  * Requires the result to be a JSON object carrying every named field
@@ -6333,7 +6377,7 @@ declare function requiredSectionsValidator(options: {
6333
6377
  * validator). Default name 'required-fields'.
6334
6378
  */
6335
6379
  declare function requiredFieldsValidator(options: {
6336
- fields: string[];
6380
+ fields: readonly string[];
6337
6381
  name?: string;
6338
6382
  }): FinishValidator;
6339
6383
  /**
@@ -6342,12 +6386,16 @@ declare function requiredFieldsValidator(options: {
6342
6386
  * v1.71 experiment review, P0.7: a formal length requirement must be
6343
6387
  * code, never a natural-language plea the model may round away). At
6344
6388
  * least one bound is required; both are positive integers with
6345
- * min <= max. Default name 'word-count'.
6389
+ * min <= max. Default name 'word-count'. `fencedCode: 'excluded'`
6390
+ * counts only words outside fenced code blocks (cycle 74), so code
6391
+ * samples cannot pad a length requirement; the default counts
6392
+ * everything, byte identical to the historical behavior.
6346
6393
  */
6347
6394
  declare function wordCountValidator(options: {
6348
6395
  min?: number;
6349
6396
  max?: number;
6350
6397
  name?: string;
6398
+ fencedCode?: FencedCodeMode;
6351
6399
  }): FinishValidator;
6352
6400
  /** The default citation shape: a path with an extension, a colon, a line number. */
6353
6401
  declare const DEFAULT_CITATION_PATTERN = "[\\w./-]+\\.\\w+:\\d+";
@@ -6386,14 +6434,20 @@ declare function evidencePreservedValidator(options?: {
6386
6434
  * text is its own failure reason, because coverage of a missing
6387
6435
  * section cannot silently count as satisfied.
6388
6436
  * requiredSectionsValidator still owns plain presence. Default name
6389
- * 'section-citations'.
6437
+ * 'section-citations'. `match: 'line'` anchors each section at the
6438
+ * first line equal to its marker and `fencedCode: 'excluded'` removes
6439
+ * fenced code before anchoring, slicing, and counting (cycle 74), so a
6440
+ * marker echoed inside a code sample can neither anchor a slice nor
6441
+ * donate citations; both default to the historical behavior.
6390
6442
  */
6391
6443
  declare function sectionCitationsValidator(options: {
6392
- sections: string[];
6444
+ sections: readonly string[];
6393
6445
  pattern?: string;
6394
6446
  flags?: string;
6395
6447
  min: number;
6396
6448
  name?: string;
6449
+ match?: SectionMatchMode;
6450
+ fencedCode?: FencedCodeMode;
6397
6451
  }): FinishValidator;
6398
6452
  /**
6399
6453
  * Requires at least `min` matches of `pattern` in the result text (the
@@ -6402,12 +6456,17 @@ declare function sectionCitationsValidator(options: {
6402
6456
  * ConfigError before any run exists) and matches globally; `min` is a
6403
6457
  * positive integer. Default name 'min-matches'; pass `name` to run
6404
6458
  * several instances, because names must be unique per orchestrate call.
6459
+ * `fencedCode: 'excluded'` matches only outside fenced code blocks
6460
+ * (cycle 74), so citations quoted inside code samples do not count;
6461
+ * the default matches everything, byte identical to the historical
6462
+ * behavior.
6405
6463
  */
6406
6464
  declare function minMatchesValidator(options: {
6407
6465
  pattern: string;
6408
6466
  flags?: string;
6409
6467
  min: number;
6410
6468
  name?: string;
6469
+ fencedCode?: FencedCodeMode;
6411
6470
  }): FinishValidator;
6412
6471
  //#endregion
6413
6472
  //#region src/orchestrator/output-contract.d.ts
@@ -6441,6 +6500,16 @@ interface FinishContractCitations {
6441
6500
  interface FinishContractManifest {
6442
6501
  /** Literal section markers the result must contain. */
6443
6502
  sections?: string[];
6503
+ /**
6504
+ * How section markers must appear (cycle 74): 'anywhere' (the
6505
+ * default, a plain substring test) or 'line' (each marker must
6506
+ * stand as its own line, surrounding whitespace ignored, so a mid
6507
+ * sentence mention no longer satisfies a heading). Requires
6508
+ * `sections`. Joins the hash and the prompt statement only when
6509
+ * 'line'; an explicit 'anywhere' normalizes away, keeping the hash
6510
+ * of the plain manifest.
6511
+ */
6512
+ sectionsMatch?: SectionMatchMode;
6444
6513
  /** Word bounds over the result text (whitespace separated tokens). */
6445
6514
  words?: {
6446
6515
  min?: number;
@@ -6448,14 +6517,52 @@ interface FinishContractManifest {
6448
6517
  };
6449
6518
  /** Citation demands over the result text. */
6450
6519
  citations?: FinishContractCitations;
6520
+ /**
6521
+ * Whether fenced code blocks count (cycle 74): 'counted' (the
6522
+ * default) or 'excluded' (fenced code is removed before section
6523
+ * matching, slicing, word counting, and citation matching, so code
6524
+ * samples can neither satisfy a marker nor pad a count). Joins the
6525
+ * hash and adds a prompt statement only when 'excluded'; an explicit
6526
+ * 'counted' normalizes away. With 'excluded', a section marker or a
6527
+ * citation sample that would itself OPEN a fence is a ConfigError,
6528
+ * because the golden fixtures embed both at line starts.
6529
+ */
6530
+ fencedCode?: FencedCodeMode;
6531
+ }
6532
+ /**
6533
+ * One per validator reject golden (cycle 74): a fixture the NAMED
6534
+ * contract validator is proven to reject at construction time.
6535
+ * {@link selfTestFinishValidation} holds the CONFIGURED validator of
6536
+ * that name against it, so a same-name replacement weaker than the
6537
+ * contract's own validator (a words minimum of one standing in for
6538
+ * three thousand) is caught before any provider call instead of
6539
+ * silently accepting what the journaled contract hash forbids.
6540
+ */
6541
+ interface FinishContractGoldenReject {
6542
+ /** The contract validator this fixture targets, by name. */
6543
+ readonly validator: string;
6544
+ /** The fixture that validator must reject. */
6545
+ readonly input: FinishValidationInput;
6451
6546
  }
6452
- /** What {@link finishContract} builds from a manifest. */
6547
+ /**
6548
+ * What {@link finishContract} builds from a manifest. The whole bundle
6549
+ * is DEEPLY frozen (cycle 74): the nested manifest objects, the
6550
+ * sections array, the validators array, and each validator object, so
6551
+ * a post construction mutation throws instead of silently diverging
6552
+ * behavior from the journaled contract hash.
6553
+ */
6453
6554
  interface FinishContract {
6454
- /** The normalized manifest (defaults applied), frozen. */
6555
+ /** The normalized manifest (defaults applied), deeply frozen. */
6455
6556
  readonly manifest: FinishContractManifest;
6456
6557
  /** sha256 hex over the JCS serialization of the normalized manifest. */
6457
6558
  readonly hash: string;
6458
- /** The stock validators enforcing the manifest; names are 'contract-*'. */
6559
+ /**
6560
+ * The stock validators enforcing the manifest; names are
6561
+ * 'contract-*'. The array and each validator object are frozen at
6562
+ * runtime (the type stays mutable for source compatibility), so an
6563
+ * in-place pop or a validate() swap throws instead of silently
6564
+ * weakening what the hash promises.
6565
+ */
6459
6566
  readonly validators: FinishValidator[];
6460
6567
  /** The contract statement for the model, one demand per line. */
6461
6568
  readonly promptLines: readonly string[];
@@ -6467,6 +6574,13 @@ interface FinishContract {
6467
6574
  * empty result is then legitimately acceptable.
6468
6575
  */
6469
6576
  readonly goldenReject?: FinishValidationInput;
6577
+ /**
6578
+ * One reject golden PER contract validator (cycle 74), in validator
6579
+ * order, each verified at construction; boundary sharp where a
6580
+ * boundary is mechanically safe (the words fixture sits exactly one
6581
+ * word outside the bound), the empty text otherwise.
6582
+ */
6583
+ readonly goldenRejects: readonly FinishContractGoldenReject[];
6470
6584
  }
6471
6585
  /**
6472
6586
  * Builds a {@link FinishContract} from one manifest: validation and the
@@ -6490,7 +6604,11 @@ interface FinishSelfTestFixtures {
6490
6604
  /** One self test failure. */
6491
6605
  interface FinishSelfTestFailure {
6492
6606
  fixture: "accept" | "reject";
6493
- /** The rejecting validator on the accept side; absent on the vacuous reject side. */
6607
+ /**
6608
+ * The failing validator: the rejecting one on the accept side, the
6609
+ * named one on a per validator reject golden (cycle 74); absent
6610
+ * only on the vacuous single-fixture reject side.
6611
+ */
6494
6612
  validator?: string;
6495
6613
  reasons: string[];
6496
6614
  }
@@ -6509,12 +6627,18 @@ interface FinishSelfTestReport {
6509
6627
  * nothing). A validator that THROWS here is a host defect and the
6510
6628
  * ConfigError propagates, the same posture the live loop takes.
6511
6629
  * Deterministic and free: validators are pure synchronous host code by
6512
- * contract, so this costs zero provider calls.
6630
+ * contract, so this costs zero provider calls. `rejects` (cycle 74)
6631
+ * carries the contract's per validator reject goldens: for each one
6632
+ * the CONFIGURED validator of that name must exist and must reject
6633
+ * the fixture, so a same-name replacement weaker than the contract's
6634
+ * own validator fails here instead of silently accepting what the
6635
+ * journaled contract hash forbids.
6513
6636
  */
6514
6637
  declare function selfTestFinishValidation(options: {
6515
- validators: FinishValidator[];
6638
+ validators: readonly FinishValidator[];
6516
6639
  accept?: FinishValidationInput;
6517
6640
  reject?: FinishValidationInput;
6641
+ rejects?: readonly FinishContractGoldenReject[];
6518
6642
  }): FinishSelfTestReport;
6519
6643
  //#endregion
6520
6644
  //#region src/orchestrator/handles.d.ts
@@ -7162,8 +7286,22 @@ interface FinishValidationSpec {
7162
7286
  * hash and the validator names. A resumed segment whose live
7163
7287
  * contract hash differs appends a SUPERSEDING descriptor instead of
7164
7288
  * failing, because fixing a stale validator and resuming is the
7165
- * intended remedy, never a fault. Absent = byte identical pre 1.72
7166
- * behavior.
7289
+ * intended remedy, never a fault. The remedy is generation-scoped
7290
+ * (cycle 73): every decision entry written under a contract carries
7291
+ * `contractHash`, and only the CURRENT generation is judged, so
7292
+ * repairsUsed restarts under a fixed contract and a final rejection
7293
+ * a superseded generation left in the crash window neither rolls
7294
+ * forward at boot nor re-arms on replay (its exchange replays byte
7295
+ * identical and the loop continues to a live repair turn). Decisions
7296
+ * recorded before 1.77 carry no hash and bind to the current
7297
+ * contract only while the journal holds a single bundle descriptor;
7298
+ * once a supersession is recorded they are stale. The bundle is
7299
+ * deeply frozen and the construction self test also runs the
7300
+ * contract's per validator reject goldens against the CONFIGURED
7301
+ * set (cycle 74), so a post construction mutation throws and a
7302
+ * same-name replacement weaker than the contract's own validator is
7303
+ * a ConfigError before any provider call. Absent = byte identical
7304
+ * pre 1.72 behavior.
7167
7305
  */
7168
7306
  contract?: FinishContract;
7169
7307
  /**
@@ -8947,9 +9085,12 @@ interface PreflightInput {
8947
9085
  * review, P1.1). Programmatic only: validator functions cannot ride
8948
9086
  * a JSON config file, so the CLI never carries this. When present,
8949
9087
  * preflight runs the SAME golden self test orchestrate runs at
8950
- * construction and reports every drift as an error finding (code
8951
- * 'output-contract-validator-mismatch') instead of throwing, so a
8952
- * planner surfaces it next to the quota and budget findings.
9088
+ * construction and reports every drift as an error finding instead
9089
+ * of throwing, so a planner surfaces it next to the quota and budget
9090
+ * findings: 'output-contract-validator-mismatch' for containment and
9091
+ * accept-side drift, 'output-contract-validator-weakened' (cycle 74)
9092
+ * when a configured validator fails the contract's per validator
9093
+ * reject golden, the same-name weakened replacement.
8953
9094
  */
8954
9095
  finishValidation?: {
8955
9096
  validators: FinishValidator[];
@@ -8964,6 +9105,13 @@ interface PreflightInput {
8964
9105
  * runtime would actually grant.
8965
9106
  */
8966
9107
  repairTurnReserve?: number;
9108
+ /**
9109
+ * Mirrors FinishValidationSpec.maxRepairs (default
9110
+ * {@link DEFAULT_FINISH_MAX_REPAIRS}): with zero, the first
9111
+ * rejection is final and there is no repair exchange to fund, so
9112
+ * the repair-reserve-unfunded warning stays silent.
9113
+ */
9114
+ maxRepairs?: number;
8967
9115
  };
8968
9116
  }
8969
9117
  /** One linter verdict; `spawn` names the wave entry it is about. */
@@ -9625,4 +9773,4 @@ interface SandboxBridge {
9625
9773
  declare const SANDBOX_AGENT_OPT_KEYS: readonly string[];
9626
9774
  declare function createSandboxBridge(ctx: Ctx<never>, options: SandboxBridgeOptions): SandboxBridge;
9627
9775
  //#endregion
9628
- export { AWAIT_SCHEMA, AbandonAttempt, AbandonFold, AbandonPayload, AbandonedSpendView, AbortClass, type AdaptiveEvents, AdmissionController, AdmissionDecision, AdmissionRejectedError, AdmissionStatsBefore, AdmitLineage, AdmitRejectReason, AdmitSpec, AdmitVerdict, AgentCallError, AgentError, type AgentEvents, AgentIdentityInput, type AgentInvocationRow, AgentOpts, AgentProfile, AgentProfilePermissions, AgentProfileTemplateOptions, AgentResult, AgentResultMeta, AgentStatus, ApproachSignatureInputs, ApprovalDecision, ApprovalIdentityInput, Artifact, AttemptOutcomeClass, AuditCategory, AuditRecord, AuditRunsOptions, BUDGET_ABORT_REASON, BaseAppend, BriefOpts, BudgetAccountView, BudgetDefaults, BudgetExhaustedError, BudgetExhaustionDiagnostics, BudgetHooks, BudgetReserve, type Bytes, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, CacheHint, CacheTtl, CanUseTool, CanonicalId, CanonicalIdentity, CanonicalLadderSpec, CanonicalModelSpec, ChatEvent, ChatRequest, CheckpointState, ChildArtifactPage, ChildIdentityInput, ChildResultPage, type ClaimClass, type ClaimOp, type ClaimStatus, ClaimValidationOptions, CollectOpts, CollectedTurn, CompactionConfig, CompiledPermissionChain, CompiledWorkflow, ConfigError, type CoreEvents, CostAttribution, CostAttributionFacts, CostReport, CreateEngineOptions, type CriticalPath, Ctx, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, DEFAULT_CITATION_SAMPLE, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DEFAULT_SYNTHESIS_MAX_TURNS, DEFAULT_SYNTHESIS_NOTE_MAX_TURNS, DataKeyProvider, DebitResult, DeclaredLadder, DedupIndex, DedupNote, DedupedClaims, DerivedKey, DeriverRegistry, type DeterminismConfig, DeterminismError, type DeterminismEvents, type DeterminismMode, DispositionRule, DispositionTable, DonorCandidate, DonorRef, DroppedItem, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EVENT_SEGMENT_STRIDE, EffectiveUsageLimits, Effort, Engine, EngineDefaults, EngineQuotaConfig, EngineQuotaRuntime, EntryKind, EntryRef, EntryStatus, EnvelopeEncryption, EnvelopeEncryptionOptions, ErrorClass, ErrorCode, ErrorPolicy, EscalatedResult, EscalationDecision, EscalationDecisionAbortedError, EscalationDigest, EscalationKind, EscalationLimits, EscalationOptions, EscalationReport, EscalationRequest, EventBus, type EvidenceRef, type ExecutorRegistry, type ExplorationSummary, ExtensionAppendInput, ExtensionDispatchSpec, ExternalIdentityInput, ExternalRegistry, ExtractNecessityInput, FINALIZE_SYNTHESIS_INSTRUCTION, FINISH_SCHEMA, FINISH_TOOL_NAME, FailRunError, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, FileModelKnowledgeStore, FileModelKnowledgeStoreOptions, FileTranscriptStore, FinishContract, FinishContractCitations, 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, InvoiceReconciliation, InvoiceRow, type IsolatedExecContext, type IsolatedExecRequest, type IsolatedExecutorTag, type IsolationProvider, type IsolationSpec, Issue$1 as Issue, JOURNAL_ENVELOPE_MARKER, JournalCompatSubCode, JournalCompatibilityError, JournalEntry, JournalMatcher, JournalMissError, JournalOperation, JournalOrderViolation, JournalSerializationContext, JournalSerializationHook, type JournalStore, type Json, JsonSchema, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, type KbProposal, type KbProposalTrigger, KeyDeriver, KeyRing, KeyedLimiter, KnowledgeCasError, type KnowledgeSnapshot, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LadderSpec, type LeasableStore, type Lease, LeaseHeldError, Ledger, LineageCounters, LineageIndex, LineageRef, LineageRelation, LineageStats, LogicalTaskId, MASKED_SECRET, MAX_CHILD_RESULT_PAGE_CHARS, MAX_DEPTH_CEILING, MatchResult, McpConfig, McpToolSource, MechanicalGateProfile, MechanicalGateVerdict, MemoryQuotaLimiter, type MetaLookupStore, type ModelCaps, ModelChoice, type ModelClaim, ModelEpochInputs, type ModelKnowledgeHandle, type ModelKnowledgeStore, ModelListConstraint, ModelRef, ModelRetry, ModelSpec, Msg, NoProgressDetector, NodeId, NodeLinkValue, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OnEscalation, OperationDisposition, OrchestrateAcceptance, OrchestrateOptions, OrchestrateSynthesis, OrchestrateSynthesisSkipReason, OrchestratorBudgetSpec, OrchestratorCapConfigError, OrchestratorExtension, OrchestratorExtensionIO, OrchestratorRuntime, Out, PARALLEL_AGENTS_SCHEMA, PROGRESS_REPORT_TOOL_NAME, ParallelSiteCounter, Part, PendingExternal, PendingToolTurn, PermissionConfig, PermissionGate, PermissionHook, PermissionPreset, PermissionRule, PermissionVerdict, type PhaseRow, PhaseTarget, PipelineCollected, PipelineOpts, PlanInvariantError, PreflightAdmissionRow, PreflightFinding, PreflightInput, PreflightOrchestratorSpec, PreflightReport, PreflightSpawnReport, PreflightSpawnSpec, PreflightToolCeiling, PriceTable, PricedUsage, type Pricing, type PricingTier, ProgressReport, type ProviderAdapter, ProviderCallRecord, QUOTA_WINDOW_MS, QualityFloors, QuotaCounters, type QuotaDecision, type QuotaEstimate, type QuotaLimiter, type QuotaReservationRequest, QuotaRule, QuotaWindowSnapshot, READ_CHILD_ARTIFACT_SCHEMA, READ_CHILD_ARTIFACT_TOOL_NAME, RESEARCH_PROFILE_LIMITS, REVIEW_PROFILE_LIMITS, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, RUN_SETTLE_DECISION_TYPE, RandIdentityInput, RandPayload, 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, Semaphore, SerializationHook, Settled, SettlementError, ShellPatternRules, ShellSegment, ShellVerdict, SinglePhaseAppend, SpanMinter, SpanRegistry, SpawnAdmissionValue, SpawnAgentParams, SpawnKey, SpawnLineage, SpawnLineageOpt, SpawnOrigin, SpawnRecord, Spend, Stage, type StandardJSONSchemaV1, type StandardSchemaV1, StepIdentityInput, StructuredOutputTier, SuspendedAppend, SuspensionState, TOOL_NAME_PATTERN, type TaskClass, TaskDigest, TaskSpec, TerminalPatch, TerminationAccount, TerminationAccountSnapshot, TerminationDeniedValue, TerminationDeniedWriter, TerminationInitValue, TerminationLimits, TerminationResource, ToolCallRequest, ToolChoice, type ToolContext, ToolContextSeed, ToolContract, type ToolDef, type ToolEvents, type ToolExecutor, type ToolExecutorProvider, ToolInit, type ToolRisk, ToolRuntime, type ToolSource, type ToolSourceSession, ToolsOption, TranscriptSerializationHook, type TranscriptStore, TriggerClass, TtlState, Usage, UsageLimits, UsageSlice, VerifiedRecommendation, WAIT_FOR_EVENTS_SCHEMA, WAIT_FOR_EVENTS_TOOL_NAME, WAKE_SUMMARY_RENDER_BUDGET_CHARS, WakeBudgetBlock, WakeDigest, WakeTrigger, WireError, Workflow, WorkflowCallOpts, type WorkflowEvent, type WorkflowEventBody, WorkflowRegistry, admissionReserveUsd, affordableOutputTokens, agentErrorFromWire, agentErrorToWire, agentResultWire, agentScope, applyClaimOps, applyStructuredOutputTier, approachSigCoarse, approachSigOf, archiveDeprecatedModelOps, assertFencedWrites, atCompactionThreshold, auditRun, auditRuns, buildAbandonFold, buildAdapterRegistry, buildCostReport, buildDeriverRegistry, buildOrchestratorTools, buildTerminationInitValue, buildToolContext, canRideLoopTurn, canonicalIsolationTag, canonicalizeLadder, canonicalizeSchema, capIssues, capsHashOf, checkFloors, checkpointRefFor, childCoveragePrefix, claimExpired, claimExpiry, claimIssues, claimOpIssues, classifyAgentError, classifyAttemptOutcome, collectDeclaredLadders, compactMessages, compilePermissionChain, compilePermissionPreset, compileSecretMasker, compileVerifiedLayer, constantTimeEqual, costReportFromJournal, countsAgainstLimit, createCanonicalIdMinter, createCtx, createEngine, createEnvelopeEncryption, createSandboxBridge, currentOnlyKeyRing, decodeCheckpoint, dedupeRepeatedClaims, defineWorkflow, deriveContentKey, deriverV1, deriverV2, digestOf, dispatchProjectionReserveUsd, dispositionHook, emptyDigestBlocks, emptyToolset, encodeCheckpoint, entryUsageSlices, escalateTool, evaluatePermission, evaluateReuse, evidencePreservedValidator, executeWorkflow, exhaustionCodeOf, extractCandidate, failoverTriggerOf, fallbackTriggerOf, filterClaimsForRun, finalizeFires, finishContract, foldTermination, formatRePrompt, formatScopePath, hasFencedWrites, hasMetaLookup, hashRunArgs, hashRunOutput, hashWorkflowBody, hashWorkflowSource, identityJcs, implementationAgentProfile, invoiceFromJournal, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastRunSettle, latestProgressReport, lexShellCommand, liftRetainedParts, lineageWeightOf, localKeyProvider, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, memoryQuotaLimiter, mergeQuotaDenial, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, orchestratorAdmissionEstCostUsd, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, preflightEstimate, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleMatches, readRunMeta, readTerminationInit, reconcileRunMeta, reduceAuditTrail, reduceCriticalPath, reduceInvocationTable, registryKeyRing, remeasureQueue, replayDisposition, repositoryResearchToolset, requiredFieldsValidator, requiredSectionsValidator, researchAgentProfile, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, reviewAgentProfile, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, sectionCitationsValidator, selectStructuredOutputTier, selfTestFinishValidation, shouldCompact, snapshotUsage, spawnDepthOf, 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 };
9776
+ export { AWAIT_SCHEMA, AbandonAttempt, AbandonFold, AbandonPayload, AbandonedSpendView, AbortClass, type AdaptiveEvents, AdmissionController, AdmissionDecision, AdmissionRejectedError, AdmissionStatsBefore, AdmitLineage, AdmitRejectReason, AdmitSpec, AdmitVerdict, AgentCallError, AgentError, type AgentEvents, AgentIdentityInput, type AgentInvocationRow, AgentOpts, AgentProfile, AgentProfilePermissions, AgentProfileTemplateOptions, AgentResult, AgentResultMeta, AgentStatus, ApproachSignatureInputs, ApprovalDecision, ApprovalIdentityInput, Artifact, AttemptOutcomeClass, AuditCategory, AuditRecord, AuditRunsOptions, BUDGET_ABORT_REASON, BaseAppend, BriefOpts, BudgetAccountView, BudgetDefaults, BudgetExhaustedError, BudgetExhaustionDiagnostics, BudgetHooks, BudgetReserve, type Bytes, CANCEL_AGENT_SCHEMA, CHECKPOINT_FORMAT_V1, CLAIM_STATEMENT_MAX_CHARS, CLAIM_TTL_DAYS, COMPACTION_SUMMARY_PREFIX, CURRENT_HASH_VERSION, CacheHint, CacheTtl, CanUseTool, CanonicalId, CanonicalIdentity, CanonicalLadderSpec, CanonicalModelSpec, ChatEvent, ChatRequest, CheckpointState, ChildArtifactPage, ChildIdentityInput, ChildResultPage, type ClaimClass, type ClaimOp, type ClaimStatus, ClaimValidationOptions, CollectOpts, CollectedTurn, CompactionConfig, CompiledPermissionChain, CompiledWorkflow, ConfigError, type CoreEvents, CostAttribution, CostAttributionFacts, CostReport, CreateEngineOptions, type CriticalPath, Ctx, DEFAULT_CHILD_BUDGET_FRACTION, DEFAULT_CHILD_RESULT_PAGE_CHARS, DEFAULT_CITATION_PATTERN, DEFAULT_CITATION_SAMPLE, DEFAULT_COMPACTION_THRESHOLD, DEFAULT_ESCALATION_LIMITS, DEFAULT_EVIDENCE_MIN_SHARE, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DEFAULT_SYNTHESIS_MAX_TURNS, DEFAULT_SYNTHESIS_NOTE_MAX_TURNS, DataKeyProvider, DebitResult, DeclaredLadder, DedupIndex, DedupNote, DedupedClaims, DerivedKey, DeriverRegistry, type DeterminismConfig, DeterminismError, type DeterminismEvents, type DeterminismMode, DispositionRule, DispositionTable, DonorCandidate, DonorRef, DroppedItem, EMIT_RESULT_TOOL, EMPTY_SCHEMA_HASH, EMPTY_TOOLSET_HASH, ESCALATE_TOOL_NAME, ESCALATION_REPORT_SCHEMA, ESCALATION_REQUEST_SCHEMA, EVENT_SEGMENT_STRIDE, EffectiveUsageLimits, Effort, Engine, EngineDefaults, EngineQuotaConfig, EngineQuotaRuntime, EntryKind, EntryRef, EntryStatus, EnvelopeEncryption, EnvelopeEncryptionOptions, ErrorClass, ErrorCode, ErrorPolicy, EscalatedResult, EscalationDecision, EscalationDecisionAbortedError, EscalationDigest, EscalationKind, EscalationLimits, EscalationOptions, EscalationReport, EscalationRequest, EventBus, type EvidenceRef, type ExecutorRegistry, type ExplorationSummary, ExtensionAppendInput, ExtensionDispatchSpec, ExternalIdentityInput, ExternalRegistry, ExtractNecessityInput, FINALIZE_SYNTHESIS_INSTRUCTION, FINISH_SCHEMA, FINISH_TOOL_NAME, FailRunError, FailoverTarget, FailoverTrigger, FallbackField, FallbackTrigger, 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, InvoiceReconciliation, InvoiceRow, type IsolatedExecContext, type IsolatedExecRequest, type IsolatedExecutorTag, type IsolationProvider, type IsolationSpec, Issue$1 as Issue, JOURNAL_ENVELOPE_MARKER, JournalCompatSubCode, JournalCompatibilityError, JournalEntry, JournalMatcher, JournalMissError, JournalOperation, JournalOrderViolation, JournalSerializationContext, JournalSerializationHook, type JournalStore, type Json, JsonSchema, JsonlFileStore, KB_ACTIVE_CLAIMS_CAP, KB_CARD_RENDER_BUDGET_CHARS, type KbProposal, type KbProposalTrigger, KeyDeriver, KeyRing, KeyedLimiter, KnowledgeCasError, type KnowledgeSnapshot, LARGE_VALUE_WARN_BYTES, LEGACY_LTID_PREFIX, LEGACY_SIGNATURE_INPUTS, LINEAGE_SIG_VERSION, LadderSpec, type LeasableStore, type Lease, LeaseHeldError, Ledger, LineageCounters, LineageIndex, LineageRef, LineageRelation, LineageStats, LogicalTaskId, MASKED_SECRET, MAX_CHILD_RESULT_PAGE_CHARS, MAX_DEPTH_CEILING, MatchResult, McpConfig, McpToolSource, MechanicalGateProfile, MechanicalGateVerdict, MemoryQuotaLimiter, type MetaLookupStore, type ModelCaps, ModelChoice, type ModelClaim, ModelEpochInputs, type ModelKnowledgeHandle, type ModelKnowledgeStore, ModelListConstraint, ModelRef, ModelRetry, ModelSpec, Msg, NoProgressDetector, NodeId, NodeLinkValue, NonSerializableValueError, ORCHESTRATE_WORKFLOW_NAME, OnEscalation, OperationDisposition, OrchestrateAcceptance, OrchestrateOptions, OrchestrateSynthesis, OrchestrateSynthesisSkipReason, OrchestratorBudgetSpec, OrchestratorCapConfigError, OrchestratorExtension, OrchestratorExtensionIO, OrchestratorRuntime, Out, PARALLEL_AGENTS_SCHEMA, PROGRESS_REPORT_TOOL_NAME, ParallelSiteCounter, Part, PendingExternal, PendingToolTurn, PermissionConfig, PermissionGate, PermissionHook, PermissionPreset, PermissionRule, PermissionVerdict, type PhaseRow, PhaseTarget, PipelineCollected, PipelineOpts, PlanInvariantError, PreflightAdmissionRow, PreflightFinding, PreflightInput, PreflightOrchestratorSpec, PreflightReport, PreflightSpawnReport, PreflightSpawnSpec, PreflightToolCeiling, PriceTable, PricedUsage, type Pricing, type PricingTier, ProgressReport, type ProviderAdapter, ProviderCallRecord, QUOTA_WINDOW_MS, QualityFloors, QuotaCounters, type QuotaDecision, type QuotaEstimate, type QuotaLimiter, type QuotaReservationRequest, QuotaRule, QuotaWindowSnapshot, READ_CHILD_ARTIFACT_SCHEMA, READ_CHILD_ARTIFACT_TOOL_NAME, RESEARCH_PROFILE_LIMITS, REVIEW_PROFILE_LIMITS, ROLE_EFFORT_DEFAULTS, ROOT_ACCOUNT, ROOT_SCOPE, RUN_PROFILES, RUN_SETTLE_DECISION_TYPE, RandIdentityInput, RandPayload, 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, 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, identityJcs, implementationAgentProfile, invoiceFromJournal, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastRunSettle, latestProgressReport, lexShellCommand, liftRetainedParts, lineageWeightOf, localKeyProvider, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, memoryQuotaLimiter, mergeQuotaDenial, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, orchestratorAdmissionEstCostUsd, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, preflightEstimate, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleMatches, readRunMeta, readTerminationInit, reconcileRunMeta, reduceAuditTrail, reduceCriticalPath, reduceInvocationTable, registryKeyRing, remeasureQueue, replayDisposition, repositoryResearchToolset, requiredFieldsValidator, requiredSectionsValidator, researchAgentProfile, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, reviewAgentProfile, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, 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
@@ -10181,6 +10181,15 @@ function estimateInputTokens(messages) {
10181
10181
  return Math.ceil(chars / 4);
10182
10182
  }
10183
10183
  /**
10184
+ * The terminal tool's schema-rejection feedback line. One producer, two
10185
+ * readers: the interception writes it as the error result, and the
10186
+ * window-derived schemaRejectedTerminalExchanges counter recognizes the
10187
+ * exchange by exactly these bytes, so the two can never drift.
10188
+ */
10189
+ function terminalSchemaRejectionMessage(name) {
10190
+ return `the '${name}' call failed validation`;
10191
+ }
10192
+ /**
10184
10193
  * The serving model's declared minimum request output cap, default one.
10185
10194
  * OpenAI's Responses API rejects max_output_tokens below 16, so a
10186
10195
  * below-floor dispatch is a guaranteed provider 400: the v1.74
@@ -10870,7 +10879,7 @@ async function runAgent(options) {
10870
10879
  durationMs: now() - gateStartedAt
10871
10880
  });
10872
10881
  parts.push(errorPart(call, {
10873
- error: `the '${gatedCall.name}' call failed validation`,
10882
+ error: terminalSchemaRejectionMessage(gatedCall.name),
10874
10883
  issues: validation === void 0 ? [] : validation.issues.map((i) => i.message)
10875
10884
  }));
10876
10885
  continue;
@@ -12008,6 +12017,9 @@ async function runAgent(options) {
12008
12017
  if (errorMessage !== void 0) result.errorMessage = errorMessage;
12009
12018
  if (guard !== void 0) result.exploration = guard.summary(toolCallsUsed);
12010
12019
  if (limitPartial !== void 0) result.partial = limitPartial;
12020
+ const terminalName = options.terminalTool?.name;
12021
+ const schemaRejectedTerminalExchanges = terminalName === void 0 ? 0 : messages.reduce((count, message) => count + message.parts.filter((part) => part.type === "tool-result" && part.name === terminalName && part.isError === true && part.result?.error === terminalSchemaRejectionMessage(terminalName)).length, 0);
12022
+ if (schemaRejectedTerminalExchanges > 0) result.schemaRejectedTerminalExchanges = schemaRejectedTerminalExchanges;
12011
12023
  if (usageApprox) result.usageApprox = true;
12012
12024
  if (transportRetries > 0) result.transportRetries = transportRetries;
12013
12025
  if (rateLimitObservations.size > 0) result.rateLimitObservations = [...rateLimitObservations.values()];
@@ -15334,22 +15346,92 @@ const ok = { ok: true };
15334
15346
  function requireNonEmptyStrings(values, what) {
15335
15347
  if (!Array.isArray(values) || values.length === 0) throw new ConfigError(`${what} must be a non empty array of strings`);
15336
15348
  for (const value of values) if (typeof value !== "string" || value.length === 0) throw new ConfigError(`${what} must contain only non empty strings`);
15337
- return values;
15349
+ return [...values];
15350
+ }
15351
+ const FENCE_OPEN = /^ {0,3}(`{3,}|~{3,})/;
15352
+ const FENCE_CLOSE = /^ {0,3}(`{3,}|~{3,})[ \t]*$/;
15353
+ /**
15354
+ * Removes fenced code blocks from a text, the delimiter lines
15355
+ * included, and returns the remaining lines joined by newlines. The
15356
+ * grammar is the CommonMark shape as a deliberate line heuristic: a
15357
+ * fence opens at a line starting (after at most three spaces) with
15358
+ * three or more backticks or tildes, an optional info string allowed;
15359
+ * it closes at the next line carrying only at least as many of the
15360
+ * SAME character; an unclosed fence runs to the end of the text.
15361
+ * Indented (four space) code blocks are not treated as code. This is
15362
+ * the exact exclusion the `fencedCode: 'excluded'` validator option
15363
+ * applies, exported so custom host validators can stay symmetric.
15364
+ */
15365
+ function stripFencedBlocks(text) {
15366
+ const kept = [];
15367
+ let fence;
15368
+ for (const line of text.split("\n")) {
15369
+ if (fence === void 0) {
15370
+ const delimiter = FENCE_OPEN.exec(line)?.[1];
15371
+ if (delimiter !== void 0) {
15372
+ fence = {
15373
+ char: delimiter.charAt(0),
15374
+ length: delimiter.length
15375
+ };
15376
+ continue;
15377
+ }
15378
+ kept.push(line);
15379
+ continue;
15380
+ }
15381
+ const close = FENCE_CLOSE.exec(line)?.[1];
15382
+ if (close !== void 0 && close.charAt(0) === fence.char && close.length >= fence.length) fence = void 0;
15383
+ }
15384
+ return kept.join("\n");
15385
+ }
15386
+ function requireSectionMatchMode(value, what) {
15387
+ if (value !== "anywhere" && value !== "line") throw new ConfigError(`${what} must be 'anywhere' or 'line'; got ${String(value)}`);
15388
+ return value;
15389
+ }
15390
+ function requireFencedCodeMode(value, what) {
15391
+ if (value !== "counted" && value !== "excluded") throw new ConfigError(`${what} must be 'counted' or 'excluded'; got ${String(value)}`);
15392
+ return value;
15393
+ }
15394
+ /**
15395
+ * The first position of a section marker in the (already fence
15396
+ * filtered) scope under the configured match mode: the plain substring
15397
+ * offset for 'anywhere', the offset of the first line whose trimmed
15398
+ * content EQUALS the marker for 'line'; -1 when absent. One shared
15399
+ * primitive so presence checks and slice anchoring can never disagree.
15400
+ */
15401
+ function sectionPosition(scope, section, match) {
15402
+ if (match === "anywhere") return scope.indexOf(section);
15403
+ let offset = 0;
15404
+ for (const line of scope.split("\n")) {
15405
+ if (line.trim() === section) return offset;
15406
+ offset += line.length + 1;
15407
+ }
15408
+ return -1;
15409
+ }
15410
+ function missingSectionQualifier(match, fencedCode) {
15411
+ const demands = (match === "line" ? " as its own line" : "") + (fencedCode === "excluded" ? " outside fenced code" : "");
15412
+ return demands === "" ? "" : ` (required${demands})`;
15338
15413
  }
15339
15414
  /**
15340
15415
  * Requires every named section to appear LITERALLY in the result text
15341
15416
  * (a heading like 'FINDINGS' or any marker the goal demands). Default
15342
15417
  * name 'required-sections'; pass `name` to run several instances.
15418
+ * `match: 'line'` demands each marker as its own line and
15419
+ * `fencedCode: 'excluded'` ignores markers inside fenced code blocks
15420
+ * (cycle 74); both default to the historical byte identical behavior.
15343
15421
  */
15344
15422
  function requiredSectionsValidator(options) {
15345
15423
  const sections = requireNonEmptyStrings(options.sections, "requiredSectionsValidator sections");
15424
+ const match = options.match === void 0 ? "anywhere" : requireSectionMatchMode(options.match, "requiredSectionsValidator match");
15425
+ const fencedCode = options.fencedCode === void 0 ? "counted" : requireFencedCodeMode(options.fencedCode, "requiredSectionsValidator fencedCode");
15426
+ const qualifier = missingSectionQualifier(match, fencedCode);
15346
15427
  return {
15347
15428
  name: options.name ?? "required-sections",
15348
15429
  validate: (input) => {
15349
- const missing = sections.filter((section) => !input.text.includes(section));
15430
+ const scope = fencedCode === "excluded" ? stripFencedBlocks(input.text) : input.text;
15431
+ const missing = sections.filter((section) => sectionPosition(scope, section, match) < 0);
15350
15432
  return missing.length === 0 ? ok : {
15351
15433
  ok: false,
15352
- reasons: missing.map((section) => `required section '${section}' is missing`)
15434
+ reasons: missing.map((section) => `required section '${section}' is missing${qualifier}`)
15353
15435
  };
15354
15436
  }
15355
15437
  };
@@ -15391,21 +15473,26 @@ function requiredFieldsValidator(options) {
15391
15473
  * v1.71 experiment review, P0.7: a formal length requirement must be
15392
15474
  * code, never a natural-language plea the model may round away). At
15393
15475
  * least one bound is required; both are positive integers with
15394
- * min <= max. Default name 'word-count'.
15476
+ * min <= max. Default name 'word-count'. `fencedCode: 'excluded'`
15477
+ * counts only words outside fenced code blocks (cycle 74), so code
15478
+ * samples cannot pad a length requirement; the default counts
15479
+ * everything, byte identical to the historical behavior.
15395
15480
  */
15396
15481
  function wordCountValidator(options) {
15397
15482
  const { min, max } = options;
15398
15483
  if (min === void 0 && max === void 0) throw new ConfigError("wordCountValidator requires min, max, or both");
15399
15484
  for (const [label, value] of [["min", min], ["max", max]]) if (value !== void 0 && (!Number.isInteger(value) || value < 1)) throw new ConfigError(`wordCountValidator ${label} must be a positive integer; got ${String(value)}`);
15400
15485
  if (min !== void 0 && max !== void 0 && min > max) throw new ConfigError(`wordCountValidator min ${String(min)} exceeds max ${String(max)}`);
15486
+ const fencedCode = options.fencedCode === void 0 ? "counted" : requireFencedCodeMode(options.fencedCode, "wordCountValidator fencedCode");
15487
+ const counted = fencedCode === "excluded" ? " (fenced code excluded)" : "";
15401
15488
  return {
15402
15489
  name: options.name ?? "word-count",
15403
15490
  validate: (input) => {
15404
- const trimmed = input.text.trim();
15491
+ const trimmed = (fencedCode === "excluded" ? stripFencedBlocks(input.text) : input.text).trim();
15405
15492
  const count = trimmed.length === 0 ? 0 : trimmed.split(/\s+/).length;
15406
15493
  const reasons = [];
15407
- if (min !== void 0 && count < min) reasons.push(`result word count ${String(count)} is below the required minimum ${String(min)}`);
15408
- if (max !== void 0 && count > max) reasons.push(`result word count ${String(count)} exceeds the maximum ${String(max)}`);
15494
+ if (min !== void 0 && count < min) reasons.push(`result word count ${String(count)}${counted} is below the required minimum ${String(min)}`);
15495
+ if (max !== void 0 && count > max) reasons.push(`result word count ${String(count)}${counted} exceeds the maximum ${String(max)}`);
15409
15496
  return reasons.length === 0 ? ok : {
15410
15497
  ok: false,
15411
15498
  reasons
@@ -15483,7 +15570,11 @@ function evidencePreservedValidator(options) {
15483
15570
  * text is its own failure reason, because coverage of a missing
15484
15571
  * section cannot silently count as satisfied.
15485
15572
  * requiredSectionsValidator still owns plain presence. Default name
15486
- * 'section-citations'.
15573
+ * 'section-citations'. `match: 'line'` anchors each section at the
15574
+ * first line equal to its marker and `fencedCode: 'excluded'` removes
15575
+ * fenced code before anchoring, slicing, and counting (cycle 74), so a
15576
+ * marker echoed inside a code sample can neither anchor a slice nor
15577
+ * donate citations; both default to the historical behavior.
15487
15578
  */
15488
15579
  function sectionCitationsValidator(options) {
15489
15580
  const sections = requireNonEmptyStrings(options.sections, "sectionCitationsValidator sections");
@@ -15496,12 +15587,17 @@ function sectionCitationsValidator(options) {
15496
15587
  throw new ConfigError(`sectionCitationsValidator pattern does not compile: ${thrown instanceof Error ? thrown.message : String(thrown)}`);
15497
15588
  }
15498
15589
  if (!Number.isInteger(options.min) || options.min < 1) throw new ConfigError(`sectionCitationsValidator min must be a positive integer; got ${String(options.min)}`);
15590
+ const match = options.match === void 0 ? "anywhere" : requireSectionMatchMode(options.match, "sectionCitationsValidator match");
15591
+ const fencedCode = options.fencedCode === void 0 ? "counted" : requireFencedCodeMode(options.fencedCode, "sectionCitationsValidator fencedCode");
15592
+ const qualifier = missingSectionQualifier(match, fencedCode);
15593
+ const counted = fencedCode === "excluded" ? " (fenced code excluded)" : "";
15499
15594
  return {
15500
15595
  name: options.name ?? "section-citations",
15501
15596
  validate: (input) => {
15597
+ const scope = fencedCode === "excluded" ? stripFencedBlocks(input.text) : input.text;
15502
15598
  const positions = /* @__PURE__ */ new Map();
15503
15599
  for (const section of sections) {
15504
- const at = input.text.indexOf(section);
15600
+ const at = sectionPosition(scope, section, match);
15505
15601
  if (at >= 0) positions.set(section, at);
15506
15602
  }
15507
15603
  const ordered = [...positions.entries()].sort((a, b) => a[1] - b[1]);
@@ -15509,12 +15605,12 @@ function sectionCitationsValidator(options) {
15509
15605
  for (const section of sections) {
15510
15606
  const at = positions.get(section);
15511
15607
  if (at === void 0) {
15512
- reasons.push(`required section '${section}' is missing, so its citation coverage cannot be judged`);
15608
+ reasons.push(`required section '${section}' is missing${qualifier}, so its citation coverage cannot be judged`);
15513
15609
  continue;
15514
15610
  }
15515
15611
  const next = ordered.find(([, position]) => position > at);
15516
- const matches = input.text.slice(at, next === void 0 ? input.text.length : next[1]).match(new RegExp(pattern, globalFlags))?.length ?? 0;
15517
- if (matches < options.min) reasons.push(`section '${section}' carries ${String(matches)} citations matching /${pattern}/; at least ${String(options.min)} required`);
15612
+ const matches = scope.slice(at, next === void 0 ? scope.length : next[1]).match(new RegExp(pattern, globalFlags))?.length ?? 0;
15613
+ if (matches < options.min) reasons.push(`section '${section}' carries ${String(matches)} citations matching /${pattern}/${counted}; at least ${String(options.min)} required`);
15518
15614
  }
15519
15615
  return reasons.length === 0 ? ok : {
15520
15616
  ok: false,
@@ -15530,6 +15626,10 @@ function sectionCitationsValidator(options) {
15530
15626
  * ConfigError before any run exists) and matches globally; `min` is a
15531
15627
  * positive integer. Default name 'min-matches'; pass `name` to run
15532
15628
  * several instances, because names must be unique per orchestrate call.
15629
+ * `fencedCode: 'excluded'` matches only outside fenced code blocks
15630
+ * (cycle 74), so citations quoted inside code samples do not count;
15631
+ * the default matches everything, byte identical to the historical
15632
+ * behavior.
15533
15633
  */
15534
15634
  function minMatchesValidator(options) {
15535
15635
  const flags = options.flags ?? "";
@@ -15540,13 +15640,15 @@ function minMatchesValidator(options) {
15540
15640
  throw new ConfigError(`minMatchesValidator pattern does not compile: ${thrown instanceof Error ? thrown.message : String(thrown)}`);
15541
15641
  }
15542
15642
  if (!Number.isInteger(options.min) || options.min < 1) throw new ConfigError(`minMatchesValidator min must be a positive integer; got ${String(options.min)}`);
15643
+ const fencedCode = options.fencedCode === void 0 ? "counted" : requireFencedCodeMode(options.fencedCode, "minMatchesValidator fencedCode");
15644
+ const counted = fencedCode === "excluded" ? " (fenced code excluded)" : "";
15543
15645
  return {
15544
15646
  name: options.name ?? "min-matches",
15545
15647
  validate: (input) => {
15546
- const found = input.text.match(new RegExp(options.pattern, globalFlags))?.length ?? 0;
15648
+ const found = (fencedCode === "excluded" ? stripFencedBlocks(input.text) : input.text).match(new RegExp(options.pattern, globalFlags))?.length ?? 0;
15547
15649
  return found >= options.min ? ok : {
15548
15650
  ok: false,
15549
- reasons: [`expected at least ${String(options.min)} matches of /${options.pattern}/${flags}; found ${String(found)}`]
15651
+ reasons: [`expected at least ${String(options.min)} matches of /${options.pattern}/${flags}; found ${String(found)}${counted}`]
15550
15652
  };
15551
15653
  }
15552
15654
  };
@@ -15590,7 +15692,7 @@ function countWords(text) {
15590
15692
  */
15591
15693
  function finishContract(manifest) {
15592
15694
  if (typeof manifest !== "object" || manifest === null) throw new ConfigError("finishContract manifest must be an object");
15593
- const { sections, words, citations } = manifest;
15695
+ const { sections, sectionsMatch, words, citations, fencedCode } = manifest;
15594
15696
  if (sections === void 0 && words === void 0 && citations === void 0) throw new ConfigError("finishContract manifest must declare sections, words, or citations");
15595
15697
  let normalizedSections;
15596
15698
  if (sections !== void 0) {
@@ -15646,36 +15748,65 @@ function finishContract(manifest) {
15646
15748
  ...citations.perSection === void 0 ? {} : { perSection: citations.perSection }
15647
15749
  };
15648
15750
  }
15751
+ let normalizedSectionsMatch;
15752
+ if (sectionsMatch !== void 0) {
15753
+ if (sectionsMatch !== "anywhere" && sectionsMatch !== "line") throw new ConfigError(`finishContract sectionsMatch must be 'anywhere' or 'line'; got ${String(sectionsMatch)}`);
15754
+ if (normalizedSections === void 0) throw new ConfigError("finishContract sectionsMatch requires sections");
15755
+ if (sectionsMatch === "line") normalizedSectionsMatch = "line";
15756
+ }
15757
+ let normalizedFencedCode;
15758
+ if (fencedCode !== void 0) {
15759
+ if (fencedCode !== "counted" && fencedCode !== "excluded") throw new ConfigError(`finishContract fencedCode must be 'counted' or 'excluded'; got ${String(fencedCode)}`);
15760
+ if (fencedCode === "excluded") normalizedFencedCode = "excluded";
15761
+ }
15762
+ if (normalizedFencedCode === "excluded") {
15763
+ const opensFence = /^\s*(`{3,}|~{3,})/;
15764
+ for (const section of normalizedSections ?? []) if (opensFence.test(section)) throw new ConfigError(`finishContract section '${section}' would open a code fence under fencedCode 'excluded'`);
15765
+ if (normalizedCitations !== void 0 && opensFence.test(normalizedCitations.sample)) throw new ConfigError(`finishContract citations.sample '${normalizedCitations.sample}' would open a code fence under fencedCode 'excluded'`);
15766
+ }
15649
15767
  const normalized = {
15650
15768
  ...normalizedSections === void 0 ? {} : { sections: normalizedSections },
15769
+ ...normalizedSectionsMatch === void 0 ? {} : { sectionsMatch: normalizedSectionsMatch },
15651
15770
  ...normalizedWords === void 0 ? {} : { words: normalizedWords },
15652
- ...normalizedCitations === void 0 ? {} : { citations: normalizedCitations }
15771
+ ...normalizedCitations === void 0 ? {} : { citations: normalizedCitations },
15772
+ ...normalizedFencedCode === void 0 ? {} : { fencedCode: normalizedFencedCode }
15653
15773
  };
15654
15774
  const hash = createHash("sha256").update(jcsSerialize(normalized), "utf8").digest("hex");
15775
+ if (normalizedSections !== void 0) Object.freeze(normalizedSections);
15776
+ if (normalizedWords !== void 0) Object.freeze(normalizedWords);
15777
+ if (normalizedCitations !== void 0) Object.freeze(normalizedCitations);
15778
+ const matchOption = normalizedSectionsMatch === void 0 ? {} : { match: normalizedSectionsMatch };
15779
+ const fencedOption = normalizedFencedCode === void 0 ? {} : { fencedCode: normalizedFencedCode };
15655
15780
  const validators = [];
15656
15781
  if (normalizedSections !== void 0) validators.push(requiredSectionsValidator({
15657
15782
  sections: normalizedSections,
15658
- name: "contract-sections"
15783
+ name: "contract-sections",
15784
+ ...matchOption,
15785
+ ...fencedOption
15659
15786
  }));
15660
15787
  if (normalizedWords !== void 0) validators.push(wordCountValidator({
15661
15788
  ...normalizedWords,
15662
- name: "contract-words"
15789
+ name: "contract-words",
15790
+ ...fencedOption
15663
15791
  }));
15664
15792
  if (normalizedCitations?.min !== void 0) validators.push(minMatchesValidator({
15665
15793
  pattern: normalizedCitations.pattern,
15666
15794
  flags: normalizedCitations.flags,
15667
15795
  min: normalizedCitations.min,
15668
- name: "contract-citations"
15796
+ name: "contract-citations",
15797
+ ...fencedOption
15669
15798
  }));
15670
15799
  if (normalizedCitations?.perSection !== void 0 && normalizedSections !== void 0) validators.push(sectionCitationsValidator({
15671
15800
  sections: normalizedSections,
15672
15801
  pattern: normalizedCitations.pattern,
15673
15802
  flags: normalizedCitations.flags,
15674
15803
  min: normalizedCitations.perSection,
15675
- name: "contract-section-citations"
15804
+ name: "contract-section-citations",
15805
+ ...matchOption,
15806
+ ...fencedOption
15676
15807
  }));
15677
15808
  const promptLines = [];
15678
- if (normalizedSections !== void 0) promptLines.push("The final result must contain each of these section markers verbatim: " + normalizedSections.map((section) => `'${section}'`).join(", ") + ".");
15809
+ if (normalizedSections !== void 0) promptLines.push((normalizedSectionsMatch === "line" ? "The final result must contain each of these section markers verbatim, each on its own line: " : "The final result must contain each of these section markers verbatim: ") + normalizedSections.map((section) => `'${section}'`).join(", ") + ".");
15679
15810
  if (normalizedWords !== void 0) {
15680
15811
  const { min, max } = normalizedWords;
15681
15812
  if (min !== void 0 && max !== void 0) promptLines.push(`The final result must be between ${String(min)} and ${String(max)} words (whitespace separated).`);
@@ -15686,6 +15817,7 @@ function finishContract(manifest) {
15686
15817
  if (normalizedCitations.min !== void 0) promptLines.push(`Include at least ${String(normalizedCitations.min)} citations matching /${normalizedCitations.pattern}/ overall (for example '${normalizedCitations.sample}').`);
15687
15818
  if (normalizedCitations.perSection !== void 0) promptLines.push(`Every required section must itself contain at least ${String(normalizedCitations.perSection)} such citations.`);
15688
15819
  }
15820
+ if (normalizedFencedCode === "excluded") promptLines.push("Text inside fenced code blocks (``` or ~~~) does not count toward sections, word counts, or citations.");
15689
15821
  const lines = [];
15690
15822
  const perSection = normalizedCitations?.perSection ?? 0;
15691
15823
  for (const section of normalizedSections ?? []) {
@@ -15725,13 +15857,69 @@ function finishContract(manifest) {
15725
15857
  text: "",
15726
15858
  children: Object.freeze([])
15727
15859
  }) : void 0;
15860
+ for (const validator of validators) {
15861
+ const verdict = validator.validate(goldenAccept);
15862
+ if (!verdict.ok) throw new ConfigError(`finishContract self check failed: '${validator.name}' rejects the generated golden accept fixture: ${verdict.reasons.join("; ")}`);
15863
+ }
15864
+ const rejectInput = (text) => Object.freeze({
15865
+ result: text,
15866
+ text,
15867
+ children: Object.freeze([])
15868
+ });
15869
+ const goldenRejects = [];
15870
+ const addGoldenReject = (validator, candidate) => {
15871
+ let fixture = rejectInput(candidate);
15872
+ if (validator.validate(fixture).ok) fixture = rejectInput("");
15873
+ if (validator.validate(fixture).ok) throw new ConfigError(`finishContract cannot build a reject golden for '${validator.name}': it accepts both the boundary fixture and the empty text, so it validates nothing`);
15874
+ goldenRejects.push(Object.freeze({
15875
+ validator: validator.name,
15876
+ input: fixture
15877
+ }));
15878
+ };
15879
+ for (const validator of validators) switch (validator.name) {
15880
+ case "contract-sections": {
15881
+ if (normalizedSections === void 0) break;
15882
+ const last = normalizedSections[normalizedSections.length - 1];
15883
+ addGoldenReject(validator, goldenText.split("\n").filter((line) => line !== last).join("\n"));
15884
+ break;
15885
+ }
15886
+ case "contract-words": {
15887
+ const deficit = normalizedWords?.min !== void 0 ? normalizedWords.min - 1 : (normalizedWords?.max ?? 0) + 1;
15888
+ addGoldenReject(validator, Array.from({ length: deficit }, () => FILLER_WORD).join(" "));
15889
+ break;
15890
+ }
15891
+ case "contract-citations": {
15892
+ if (normalizedCitations === void 0) break;
15893
+ const sample = normalizedCitations.sample;
15894
+ addGoldenReject(validator, Array.from({ length: (normalizedCitations.min ?? 1) - 1 }, () => sample).join(" "));
15895
+ break;
15896
+ }
15897
+ case "contract-section-citations": {
15898
+ if (normalizedSections === void 0 || normalizedCitations === void 0) break;
15899
+ const markers = normalizedSections;
15900
+ const sample = normalizedCitations.sample;
15901
+ const per = normalizedCitations.perSection ?? 1;
15902
+ const rows = [];
15903
+ markers.forEach((section, index) => {
15904
+ rows.push(section);
15905
+ const grant = index === markers.length - 1 ? per - 1 : per;
15906
+ if (grant > 0) rows.push(Array.from({ length: grant }, () => sample).join(" "));
15907
+ });
15908
+ addGoldenReject(validator, rows.join("\n"));
15909
+ break;
15910
+ }
15911
+ default: break;
15912
+ }
15913
+ for (const validator of validators) Object.freeze(validator);
15914
+ Object.freeze(validators);
15728
15915
  return Object.freeze({
15729
15916
  manifest: Object.freeze(normalized),
15730
15917
  hash,
15731
15918
  validators,
15732
15919
  promptLines: Object.freeze(promptLines),
15733
15920
  goldenAccept,
15734
- ...goldenReject === void 0 ? {} : { goldenReject }
15921
+ ...goldenReject === void 0 ? {} : { goldenReject },
15922
+ goldenRejects: Object.freeze(goldenRejects)
15735
15923
  });
15736
15924
  }
15737
15925
  /**
@@ -15744,7 +15932,12 @@ function finishContract(manifest) {
15744
15932
  * nothing). A validator that THROWS here is a host defect and the
15745
15933
  * ConfigError propagates, the same posture the live loop takes.
15746
15934
  * Deterministic and free: validators are pure synchronous host code by
15747
- * contract, so this costs zero provider calls.
15935
+ * contract, so this costs zero provider calls. `rejects` (cycle 74)
15936
+ * carries the contract's per validator reject goldens: for each one
15937
+ * the CONFIGURED validator of that name must exist and must reject
15938
+ * the fixture, so a same-name replacement weaker than the contract's
15939
+ * own validator fails here instead of silently accepting what the
15940
+ * journaled contract hash forbids.
15748
15941
  */
15749
15942
  function selfTestFinishValidation(options) {
15750
15943
  const run = (validator, input) => {
@@ -15771,6 +15964,22 @@ function selfTestFinishValidation(options) {
15771
15964
  reasons: ["every configured validator accepts the known-bad fixture; the validation is vacuous"]
15772
15965
  });
15773
15966
  }
15967
+ for (const golden of options.rejects ?? []) {
15968
+ const named = options.validators.find((validator) => validator.name === golden.validator);
15969
+ if (named === void 0) {
15970
+ failures.push({
15971
+ fixture: "reject",
15972
+ validator: golden.validator,
15973
+ reasons: [`no configured validator is named '${golden.validator}', so its reject golden cannot run`]
15974
+ });
15975
+ continue;
15976
+ }
15977
+ if (run(named, golden.input).ok) failures.push({
15978
+ fixture: "reject",
15979
+ validator: golden.validator,
15980
+ reasons: ["the configured validator accepts the fixture the contract's own validator rejects; a same name replacement must be at least as strict"]
15981
+ });
15982
+ }
15774
15983
  return {
15775
15984
  ok: failures.length === 0,
15776
15985
  failures
@@ -15903,13 +16112,15 @@ function validateOrchestrateOptions(opts) {
15903
16112
  const acceptFixture = selfTest?.accept ?? contract?.goldenAccept;
15904
16113
  const rejectFixture = selfTest?.reject ?? contract?.goldenReject;
15905
16114
  if (selfTest !== void 0 && acceptFixture === void 0 && rejectFixture === void 0) throw new ConfigError("orchestrate finishValidation.selfTest requires an accept or reject fixture");
15906
- if (acceptFixture !== void 0 || rejectFixture !== void 0) {
16115
+ const rejectGoldens = contract?.goldenRejects;
16116
+ if (acceptFixture !== void 0 || rejectFixture !== void 0 || rejectGoldens !== void 0) {
15907
16117
  const report = selfTestFinishValidation({
15908
16118
  validators: fv.validators,
15909
16119
  ...acceptFixture === void 0 ? {} : { accept: acceptFixture },
15910
- ...rejectFixture === void 0 ? {} : { reject: rejectFixture }
16120
+ ...rejectFixture === void 0 ? {} : { reject: rejectFixture },
16121
+ ...rejectGoldens === void 0 ? {} : { rejects: rejectGoldens }
15911
16122
  });
15912
- if (!report.ok) throw new ConfigError("the finish validation self test failed BEFORE any provider call: " + report.failures.map((failure) => failure.validator === void 0 ? failure.reasons.join("; ") : `validator '${failure.validator}' rejected the accept fixture: ` + failure.reasons.join("; ")).join("; "));
16123
+ if (!report.ok) throw new ConfigError("the finish validation self test failed BEFORE any provider call: " + report.failures.map((failure) => failure.validator === void 0 ? failure.reasons.join("; ") : failure.fixture === "reject" ? `validator '${failure.validator}' failed its reject golden: ` + failure.reasons.join("; ") : `validator '${failure.validator}' rejected the accept fixture: ` + failure.reasons.join("; ")).join("; "));
15913
16124
  }
15914
16125
  }
15915
16126
  if (opts.synthesis !== void 0) {
@@ -16869,6 +17080,12 @@ function makeOrchestratorWorkflow(goal, opts) {
16869
17080
  const validationSpec = opts?.finishValidation;
16870
17081
  const validationAbort = new AbortController();
16871
17082
  let validationTermination;
17083
+ /**
17084
+ * The synthesis invocation's schema-dead finish exchanges (cycle
17085
+ * 73), captured from its full agent result so the failure
17086
+ * enrichment can fold BOTH windows into one honest counter.
17087
+ */
17088
+ let synthesisSchemaRejectedExchanges = 0;
16872
17089
  const finishValidationError = (decision) => new FailRunError(`the orchestrator finish failed host validation with all ${String(decision.maxRepairs)} repair attempts spent: ` + decision.failed.map((f) => `validator '${f.name}' rejected: ${f.reasons.join("; ")}`).join("; "), { data: {
16873
17090
  source: "orchestrator_finish_validation",
16874
17091
  callId: decision.callId,
@@ -16877,6 +17094,22 @@ function makeOrchestratorWorkflow(goal, opts) {
16877
17094
  maxRepairs: decision.maxRepairs
16878
17095
  } });
16879
17096
  const validationDecisions = () => internals.replayer.snapshot().filter((entry) => entry.kind === "decision" && entry.scope === callingState.scope && entry.value?.decisionType === "orchestrator_finish_validation").map((entry) => entry.value);
17097
+ /**
17098
+ * The contract generation membership test (cycle 73). Without a
17099
+ * contract there are no generations and every decision is current
17100
+ * (the pre 1.77 behavior, byte identical). With one, a decision
17101
+ * belongs to the current generation when its journaled hash matches
17102
+ * the live contract; a pre 1.77 decision carries no hash and counts
17103
+ * as current only while the journal has never recorded a
17104
+ * superseding bundle descriptor, because a single descriptor means
17105
+ * every decision was necessarily rendered under it.
17106
+ */
17107
+ const contractGenerationCurrent = (decision) => {
17108
+ const hash = validationSpec?.contract?.hash;
17109
+ if (hash === void 0) return true;
17110
+ if (decision.contractHash !== void 0) return decision.contractHash === hash;
17111
+ return internals.replayer.snapshot().filter((entry) => entry.kind === "decision" && entry.scope === callingState.scope && entry.value?.decisionType === "orchestrator_finish_validation_bundle").length <= 1;
17112
+ };
16880
17113
  const validateFinish = async (call) => {
16881
17114
  if (validationSpec === void 0) return { ok: true };
16882
17115
  const maxRepairs = validationSpec.maxRepairs ?? 1;
@@ -16915,14 +17148,15 @@ function makeOrchestratorWorkflow(goal, opts) {
16915
17148
  reasons: verdict.reasons
16916
17149
  });
16917
17150
  }
16918
- const repairsUsed = known.filter((candidate) => candidate.verdict !== "accepted").length;
17151
+ const repairsUsed = known.filter((candidate) => candidate.verdict !== "accepted" && contractGenerationCurrent(candidate)).length;
16919
17152
  decision = {
16920
17153
  decisionType: "orchestrator_finish_validation",
16921
17154
  callId: call.id,
16922
17155
  verdict: failed.length === 0 ? "accepted" : repairsUsed < maxRepairs ? "repair" : "rejected",
16923
17156
  failed,
16924
17157
  repairsUsed,
16925
- maxRepairs
17158
+ maxRepairs,
17159
+ ...validationSpec.contract === void 0 ? {} : { contractHash: validationSpec.contract.hash }
16926
17160
  };
16927
17161
  await internals.replayer.appendSinglePhase({
16928
17162
  scope: callingState.scope,
@@ -16936,8 +17170,10 @@ function makeOrchestratorWorkflow(goal, opts) {
16936
17170
  }
16937
17171
  if (decision.verdict === "accepted") return { ok: true };
16938
17172
  if (decision.verdict === "rejected") {
16939
- validationTermination = finishValidationError(decision);
16940
- validationAbort.abort("rulvar:finish-validation");
17173
+ if (contractGenerationCurrent(decision)) {
17174
+ validationTermination = finishValidationError(decision);
17175
+ validationAbort.abort("rulvar:finish-validation");
17176
+ }
16941
17177
  return {
16942
17178
  ok: false,
16943
17179
  feedback: {
@@ -17357,6 +17593,7 @@ function makeOrchestratorWorkflow(goal, opts) {
17357
17593
  }
17358
17594
  };
17359
17595
  const synthesized = await runtime.runInScope(synthesisState, () => ctx.agent(prompt, synthesisOpts));
17596
+ synthesisSchemaRejectedExchanges = synthesized.schemaRejectedTerminalExchanges ?? 0;
17360
17597
  if (validationTermination !== void 0) throw validationTermination;
17361
17598
  if (synthesized.status === "ok") return synthesized.output;
17362
17599
  if (validationSpec !== void 0) throw new FailRunError(`the synthesis invocation terminated with status '${synthesized.status}'` + (synthesized.errorMessage === void 0 ? "" : `: ${synthesized.errorMessage}`) + "; finish validators are configured, so the unvalidated draft cannot stand", { data: {
@@ -17419,7 +17656,10 @@ function makeOrchestratorWorkflow(goal, opts) {
17419
17656
  if (capDecisionRef !== void 0) return await settleCapOutcome();
17420
17657
  if (validationSpec !== void 0) {
17421
17658
  const priorRejection = validationDecisions().find((decision) => decision.verdict === "rejected");
17422
- if (priorRejection !== void 0) throw finishValidationError(priorRejection);
17659
+ if (priorRejection !== void 0) {
17660
+ const settle = lastRunSettle(internals.replayer.snapshot());
17661
+ if (settle !== void 0 && settle.runStatus !== "running" && settle.runStatus !== "suspended" || contractGenerationCurrent(priorRejection)) throw finishValidationError(priorRejection);
17662
+ }
17423
17663
  }
17424
17664
  const promptLines = [
17425
17665
  ...extension?.promptLines?.() ?? [],
@@ -17430,28 +17670,28 @@ function makeOrchestratorWorkflow(goal, opts) {
17430
17670
  const liveTermination = extensionTermination;
17431
17671
  if (liveTermination !== void 0) throw liveTermination;
17432
17672
  if (capDecisionRef !== void 0) return await settleCapOutcome();
17433
- if (validationTermination !== void 0) throw validationTermination;
17434
- if (orchestratorAccount !== void 0) internals.cost.orchestrator.spentUsd = internals.budget.accountView(orchestratorAccount)?.spentUsd ?? 0;
17435
- if (result.status !== "ok") throw new ConfigError(`the orchestrator agent terminated with status '${result.status}'` + (result.errorMessage === void 0 ? "" : `: ${result.errorMessage}`));
17436
17673
  /**
17437
- * The synthesis failure enrichment (the v1.71 experiment review,
17438
- * P0.8 remainder + P1.7): every typed failure a synthesis
17439
- * invocation throws gains the verdict-derived repair taxonomy read
17440
- * from the JOURNALED validation decisions (identical live and on
17441
- * replay), and, when an acceptance verdict exists, the acceptance
17442
- * snapshot the children already earned; the completion mirror then
17443
- * lifts completion and childStatusCounts onto the error outcome,
17444
- * exactly like the acceptance rejection path. The experiment's
17445
- * outcome showed completion null beside four accepted children;
17446
- * these are the fields that say "the fan-out work is complete, the
17447
- * failure is downstream". The rejection-past-the-bound error keeps
17448
- * its own repairsUsed/maxRepairs/failed untouched.
17674
+ * The finish-validation failure enrichment (the v1.71 experiment
17675
+ * review, P0.8 remainder + P1.7; widened by cycle 73): every typed
17676
+ * failure a finish rejection produces gains the verdict-derived
17677
+ * repair taxonomy read from the JOURNALED validation decisions of
17678
+ * the CURRENT contract generation (identical live and on replay),
17679
+ * the schema-dead finish exchange counter derived from the
17680
+ * coordination and synthesis windows (the class the v1.74 run lost
17681
+ * six payloads to, invisible in every other field), and, when an
17682
+ * acceptance verdict exists, the acceptance snapshot the children
17683
+ * already earned: completion and childStatusCounts, and now the
17684
+ * degradation facts beside them (degradedReasons and the salvage
17685
+ * lists), exactly what the ok envelope reports. The
17686
+ * rejection-past-the-bound error keeps its own
17687
+ * repairsUsed/maxRepairs/failed untouched.
17449
17688
  */
17450
17689
  const enrichSynthesisFailure = (thrown, snapshot) => {
17451
17690
  if (!(thrown instanceof FailRunError)) throw thrown;
17452
17691
  const base = thrown.data ?? {};
17453
- const spent = validationDecisions().filter((candidate) => candidate.verdict !== "accepted");
17692
+ const spent = validationDecisions().filter((candidate) => candidate.verdict !== "accepted" && contractGenerationCurrent(candidate));
17454
17693
  const rejectedValidators = [...new Set(spent.flatMap((candidate) => candidate.failed.map((f) => f.name)))];
17694
+ const schemaRejected = (result.schemaRejectedTerminalExchanges ?? 0) + synthesisSchemaRejectedExchanges;
17455
17695
  throw new FailRunError(thrown.message, { data: {
17456
17696
  ...base,
17457
17697
  ...snapshot ?? {},
@@ -17459,9 +17699,13 @@ function makeOrchestratorWorkflow(goal, opts) {
17459
17699
  repairsUsed: spent.length,
17460
17700
  maxRepairs: validationSpec?.maxRepairs ?? 1,
17461
17701
  rejectedValidators
17462
- }
17702
+ },
17703
+ ...schemaRejected === 0 || base.schemaRejectedFinishExchanges !== void 0 ? {} : { schemaRejectedFinishExchanges: schemaRejected }
17463
17704
  } });
17464
17705
  };
17706
+ if (validationTermination !== void 0) enrichSynthesisFailure(validationTermination);
17707
+ if (orchestratorAccount !== void 0) internals.cost.orchestrator.spentUsd = internals.budget.accountView(orchestratorAccount)?.spentUsd ?? 0;
17708
+ if (result.status !== "ok") throw new ConfigError(`the orchestrator agent terminated with status '${result.status}'` + (result.errorMessage === void 0 ? "" : `: ${result.errorMessage}`));
17465
17709
  if (opts?.acceptance === void 0) try {
17466
17710
  return await runSynthesis(result.output);
17467
17711
  } catch (thrown) {
@@ -17545,7 +17789,10 @@ function makeOrchestratorWorkflow(goal, opts) {
17545
17789
  } catch (thrown) {
17546
17790
  enrichSynthesisFailure(thrown, {
17547
17791
  completion: decision.completion,
17548
- childStatusCounts: decision.childStatusCounts
17792
+ childStatusCounts: decision.childStatusCounts,
17793
+ degradedReasons: decision.degradedReasons,
17794
+ ...decision.salvagedPartialChildren === void 0 ? {} : { salvagedPartialChildren: decision.salvagedPartialChildren },
17795
+ ...decision.salvagedTerminalOutputChildren === void 0 ? {} : { salvagedTerminalOutputChildren: decision.salvagedTerminalOutputChildren }
17549
17796
  });
17550
17797
  }
17551
17798
  return {
@@ -17677,6 +17924,39 @@ function preflightEstimate(input) {
17677
17924
  const say = (finding) => {
17678
17925
  findings.push(finding);
17679
17926
  };
17927
+ /**
17928
+ * The contract turn feasibility check (the v1.74 experiment review,
17929
+ * cycle 73), run against the invocation the validators bind. The
17930
+ * floor is the contract's own minimal accepting payload, serialized
17931
+ * exactly as the model must emit it ({ result }) and priced at the
17932
+ * loop's four-characters-per-token output heuristic: the v1.74 run's
17933
+ * conforming payloads truncated at their 9000 token turn cap, and its
17934
+ * contract's minimum alone prices above that cap. A minimum at or
17935
+ * over the bound is an error (every conforming finish truncates mid
17936
+ * payload); a minimum within double of the bound is a warning,
17937
+ * because real conforming payloads run richer than the minimum.
17938
+ */
17939
+ const contractFeasibilityFindings = (outputBound, spawn, servedBy) => {
17940
+ const contract = input.finishValidation?.contract;
17941
+ if (contract === void 0 || outputBound === void 0) return;
17942
+ const minTokens = Math.ceil(JSON.stringify({ result: contract.goldenAccept.text }).length / 4);
17943
+ const which = spawn === "synthesis" ? "the synthesis invocation" : "the coordination loop";
17944
+ if (minTokens >= outputBound) {
17945
+ say({
17946
+ severity: "error",
17947
+ code: "output-contract-turn-infeasible",
17948
+ message: `the finish contract's minimal accepting payload is about ${String(minTokens)} tokens (four characters per token over the golden accept fixture) but ${which} dispatches at most ${String(outputBound)} output tokens per turn ('${servedBy}'): every conforming finish truncates mid payload; raise maxOutputTokensPerTurn or shrink the contract`,
17949
+ spawn
17950
+ });
17951
+ return;
17952
+ }
17953
+ if (minTokens * 2 > outputBound) say({
17954
+ severity: "warning",
17955
+ code: "output-contract-turn-headroom",
17956
+ message: `the finish contract's minimal accepting payload is about ${String(minTokens)} tokens against the ${String(outputBound)} token output bound of ${which} ('${servedBy}'): real conforming payloads run richer than the minimum and the margin is under double; raise the bound or trim the contract`,
17957
+ spawn
17958
+ });
17959
+ };
17680
17960
  const adapters = new Map((engine.adapters ?? []).map((adapter) => [adapter.id, adapter]));
17681
17961
  const capsOf = (ref) => {
17682
17962
  const { adapterId, model } = parseModelRef(ref);
@@ -17922,6 +18202,7 @@ function preflightEstimate(input) {
17922
18202
  message: `the orchestrator sets maxOutputTokensPerTurn ${String(orchLimits.maxOutputTokensPerTurn)} below the ${String(caps.minOutputTokensPerTurn)} token output floor of '${servedBy}': every dispatch would be refused typed before the wire; raise the cap to at least the floor`,
17923
18203
  spawn: "orchestrator"
17924
18204
  });
18205
+ if (input.orchestrator.synthesis === void 0) contractFeasibilityFindings(outputBound, "orchestrator", servedBy);
17925
18206
  const { adapterId, model } = parseModelRef(servedBy);
17926
18207
  const unit = {
17927
18208
  label: "orchestrator",
@@ -17990,6 +18271,7 @@ function preflightEstimate(input) {
17990
18271
  message: `the synthesis invocation sets maxOutputTokensPerTurn ${String(merged.maxOutputTokensPerTurn)} below the ${String(caps.minOutputTokensPerTurn)} token output floor of '${servedBy}': every dispatch would be refused typed before the wire; raise the cap to at least the floor`,
17991
18272
  spawn: "synthesis"
17992
18273
  });
18274
+ contractFeasibilityFindings(outputBound, "synthesis", servedBy);
17993
18275
  const projected = projectedProviderTurnsOf(merged, overallExecutedCeiling(merged, toolCeilingsOf(merged))) + finishRepairReserve;
17994
18276
  if (orchestratorEcho !== void 0) orchestratorEcho.synthesis = {
17995
18277
  projectedProviderTurns: projected,
@@ -18214,6 +18496,15 @@ function preflightEstimate(input) {
18214
18496
  names.add(validator.name);
18215
18497
  }
18216
18498
  if (fv.repairTurnReserve !== void 0) requireNonNegativeInteger(fv.repairTurnReserve, "preflight finishValidation.repairTurnReserve");
18499
+ if (fv.maxRepairs !== void 0) requireNonNegativeInteger(fv.maxRepairs, "preflight finishValidation.maxRepairs");
18500
+ {
18501
+ const grantedRepairs = fv.maxRepairs ?? 1;
18502
+ if (grantedRepairs > 0 && fv.repairTurnReserve === void 0) findings.push({
18503
+ severity: "warning",
18504
+ code: "repair-reserve-unfunded",
18505
+ message: `finishValidation grants up to ${String(grantedRepairs)} repair exchange(s) but declares no repairTurnReserve: a rejected finish burns an ordinary turn and a window at maxTurns settles 'limit' with the repair unspent; set finishValidation.repairTurnReserve to fund the repair exchanges`
18506
+ });
18507
+ }
18217
18508
  if (fv.contract !== void 0) {
18218
18509
  for (const contractValidator of fv.contract.validators) if (!names.has(contractValidator.name)) findings.push({
18219
18510
  severity: "error",
@@ -18223,19 +18514,24 @@ function preflightEstimate(input) {
18223
18514
  }
18224
18515
  const acceptFixture = fv.selfTest?.accept ?? fv.contract?.goldenAccept;
18225
18516
  const rejectFixture = fv.selfTest?.reject ?? fv.contract?.goldenReject;
18517
+ const rejectGoldens = fv.contract?.goldenRejects;
18226
18518
  let selfTestOutcome = "skipped";
18227
- if (acceptFixture !== void 0 || rejectFixture !== void 0) {
18519
+ if (acceptFixture !== void 0 || rejectFixture !== void 0 || rejectGoldens !== void 0) {
18228
18520
  const report = selfTestFinishValidation({
18229
18521
  validators: fv.validators,
18230
18522
  ...acceptFixture === void 0 ? {} : { accept: acceptFixture },
18231
- ...rejectFixture === void 0 ? {} : { reject: rejectFixture }
18523
+ ...rejectFixture === void 0 ? {} : { reject: rejectFixture },
18524
+ ...rejectGoldens === void 0 ? {} : { rejects: rejectGoldens }
18232
18525
  });
18233
18526
  selfTestOutcome = report.ok ? "passed" : "failed";
18234
- for (const failure of report.failures) findings.push({
18235
- severity: "error",
18236
- code: "output-contract-validator-mismatch",
18237
- message: failure.validator === void 0 ? failure.reasons.join("; ") : `validator '${failure.validator}' rejected the golden accept fixture: ` + failure.reasons.join("; ")
18238
- });
18527
+ for (const failure of report.failures) {
18528
+ const weakened = failure.fixture === "reject" && failure.validator !== void 0;
18529
+ findings.push({
18530
+ severity: "error",
18531
+ code: weakened ? "output-contract-validator-weakened" : "output-contract-validator-mismatch",
18532
+ message: failure.validator === void 0 ? failure.reasons.join("; ") : weakened ? `validator '${failure.validator}' failed its reject golden: ` + failure.reasons.join("; ") : `validator '${failure.validator}' rejected the golden accept fixture: ` + failure.reasons.join("; ")
18533
+ });
18534
+ }
18239
18535
  }
18240
18536
  finishValidationEcho = {
18241
18537
  ...fv.contract === void 0 ? {} : { contractHash: fv.contract.hash },
@@ -20063,4 +20359,4 @@ function createSandboxBridge(ctx, options) {
20063
20359
  };
20064
20360
  }
20065
20361
  //#endregion
20066
- 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_MIN_SHARE, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DEFAULT_SYNTHESIS_MAX_TURNS, DEFAULT_SYNTHESIS_NOTE_MAX_TURNS, 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, identityJcs, implementationAgentProfile, invoiceFromJournal, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastRunSettle, latestProgressReport, lexShellCommand, liftRetainedParts, lineageWeightOf, localKeyProvider, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, memoryQuotaLimiter, mergeQuotaDenial, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, orchestratorAdmissionEstCostUsd, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, preflightEstimate, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleMatches, readRunMeta, readTerminationInit, reconcileRunMeta, reduceAuditTrail, reduceCriticalPath, reduceInvocationTable, registryKeyRing, remeasureQueue, replayDisposition, repositoryResearchToolset, requiredFieldsValidator, requiredSectionsValidator, researchAgentProfile, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, reviewAgentProfile, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, sectionCitationsValidator, selectStructuredOutputTier, selfTestFinishValidation, shouldCompact, snapshotUsage, spawnDepthOf, 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 };
20362
+ 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_MIN_SHARE, DEFAULT_FINISH_MAX_REPAIRS, DEFAULT_FLAT_RESERVE_USD, DEFAULT_MAX_CHILDREN_PER_NODE, DEFAULT_MAX_DEPTH, DEFAULT_MAX_OSCILLATIONS_PER_KEY, DEFAULT_MAX_PINNED_WORKTREES, DEFAULT_MAX_REVISIONS_PER_RUN, DEFAULT_MAX_TOTAL_SPAWNS, DEFAULT_MAX_TURNS, DEFAULT_MODEL_RETRY_ATTEMPTS, DEFAULT_NO_PROGRESS_TURNS, DEFAULT_PER_RUN_CONCURRENCY, DEFAULT_RETRY_POLICY, DEFAULT_STREAM_IDLE_TIMEOUT_MS, DEFAULT_SYNTHESIS_MAX_TURNS, DEFAULT_SYNTHESIS_NOTE_MAX_TURNS, 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, identityJcs, implementationAgentProfile, invoiceFromJournal, isEscalated, isSchemaPairSpec, isStandardSchemaSpec, isStrictCompatibleSchema, kMaxOf, knowledgeHash, ladderLengthOf, ladderRungChoice, lastRunSettle, latestProgressReport, lexShellCommand, liftRetainedParts, lineageWeightOf, localKeyProvider, makeOrchestratorWorkflow, maskSecrets, maskSecretsDeep, maskSecretsJson, matchArgvPattern, matchShellCommand, mcp, memoryQuotaLimiter, mergeQuotaDenial, mergeUsageLimits, metaMatchesFilter, minMatchesValidator, modelEpochOf, modelKnowledgeCard, modelSpecIdentity, needsSeparateExtract, nextFailover, nodeLinkKey, normalizeApproachTag, normalizeEntry, normalizeFallbacks, orchestrate, orchestratorAdmissionEstCostUsd, parallelScope, parseModelRef, parseScopePath, phiInitialOf, pipelineScope, planNodeScope, preflightEstimate, priceEntryUsage, priceUsdOf, profileCard, profileRegistrySnapshotHash, progressReportTool, projectHistory, projectIdentity, projectToJsonSchema, proposalStatement, providerOf, quotaActualTokens, quotaEstimateTokens, quotaRuleAdmission, quotaRuleMatches, readRunMeta, readTerminationInit, reconcileRunMeta, reduceAuditTrail, reduceCriticalPath, reduceInvocationTable, registryKeyRing, remeasureQueue, replayDisposition, repositoryResearchToolset, requiredFieldsValidator, requiredSectionsValidator, researchAgentProfile, resolveModelInvocation, resolvePricing, resolveToolset, retryClassOf, retryDelayMs, reviewAgentProfile, roleConfiguredInRouting, roundOneDisposition, runAgent, runProfile, sanitizeTerminalText, sanitizeTokenCount, sanitizeUsage, sanitizeUsageDelta, scanJournalCompatibility, schemaHash, schemaHashOfSpec, 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.76.0",
3
+ "version": "1.78.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",