@secondlayer/shared 11.11.1 → 11.12.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.
@@ -1321,6 +1321,24 @@ declare function applyDecoderReceipts(state: RunnerState, receipts: readonly Dec
1321
1321
  * rejected ack never opens a transaction.
1322
1322
  */
1323
1323
  declare function commitDecoderAdapter(db: Kysely<Database>, input: DecoderAdapterCommit): Promise<void>;
1324
+ /**
1325
+ * Same commit as {@link commitDecoderAdapter}, for several decoders sharing
1326
+ * ONE outer transaction and ONE read of the source events they were fed
1327
+ * from — the in-process classic-decoder loop's shape (plan-066): 11
1328
+ * checkpoints + their decoded rows land together, so a crash mid-batch
1329
+ * cannot leave one type's checkpoint ahead of another's rows.
1330
+ *
1331
+ * Steps run in four PASSES across the whole batch, not step-by-step per
1332
+ * entry, so the global order stays output → checkpoint → receipt → failure
1333
+ * (matching the single-entry commit) while every entry's output — including
1334
+ * its `assertCheckpointUnmoved` FOR UPDATE check — lands before any entry's
1335
+ * new checkpoint is written. Entries are locked in the order given, which
1336
+ * callers must keep identical to `handleDecodedEventsReorg`'s decoder-name
1337
+ * order so the two paths never take checkpoint-row locks in conflicting
1338
+ * order (deadlock risk otherwise). No per-entry `crashAfter` probe — that
1339
+ * stays on the single-entry path.
1340
+ */
1341
+ declare function commitDecoderAdapterBatch(db: Kysely<Database>, inputs: readonly Omit<DecoderAdapterCommit, "crashAfter">[]): Promise<void>;
1324
1342
  type SealableReceipt = {
1325
1343
  height: number
1326
1344
  hash: string
@@ -1526,4 +1544,4 @@ declare function reportVerify(opts: {
1526
1544
  diverged?: boolean
1527
1545
  detail?: string
1528
1546
  }): VerifyReport;
1529
- export { BootstrapSource, COVERAGE_REPORT_SCHEMA_VERSION, COVERAGE_STATES, CanonicalBlock, CoverageRange, CoverageReport, CoverageState, DECODER_COMMIT_STEPS, DEFAULT_MAX_RETRIES, DecoderAdapterCommit, DecoderAdapterCrash, DecoderAdapterFailure, DecoderAdapterReceipt, DecoderClockEvent, DecoderClockInput, DecoderClockReceipt, DecoderClockResult, DecoderCommitStep, DeepVerifyResult, EffectMutation, EffectOp, EvaluatorInput, EvaluatorOptions, FAILURE_CLASSES, FAILURE_RETENTION_DAYS, FAILURE_UNITS, FailureClass, FailureRow, FailureUnit, NATIVE_CLOCKS, NativeClock, OpenFailure, QUEUE_STAGES, QueueApply, QueueCounters, QueueEvent, QueueStage, QueueState, REPAIR_MODES, RETRY_STATES, RUNNER_EVENT_TYPES, RUNNER_STATUSES, RUNNER_TRANSITION_TABLE, RUN_STATUSES, ReceiptRow, RepairDefect, RepairMode, RepairPlan, RetryState, RowSnapshot, RunStatus, RunnerEffect, RunnerEvent, RunnerEventType, RunnerFailure, RunnerResult, RunnerState, RunnerStatus, RunnerVersion, SAFE_REPAIR_MODES, STAGE_KINDS, SUBGRAPH_COMMIT_STEPS, SealResult, SealableReceipt, SealedSegment, SourceClock, StageCoverage, StageDeclaration, StageEvidence, StageKind, StageRunView, SubgraphAdapterCrash, SubgraphCommitInput, SubgraphCommitStep, SyncScope, TransitionRule, VERIFY_EXIT, VerifyExit, VerifyMode, VerifyReport, VerifyTarget, applyDecoderReceipts, applyMutations, applyQueueEvent, applyRunnerEvent, canonicalizeMutations, commitDecoderAdapter, commitSubgraphAdapter, contiguousThrough, createRunnerState, cursorHeight, cursorIsAfterBlock, cursorIsBeforeBlock, datasetMatchesTarget, deepVerify, defaultRetainUntil, emptyQueueState, evaluateCoverage, expectedAckHeight, failureRangeHolds, failureRetentionHolds, finalRowDigest, findRangeGaps, hashEffectManifest, inputDigest, isFailureClass, isFailureUnit, isNativeClock, isNonNegativeInt, isRepairMode, isRetryState, isRunStatus, isStageKind, lookupTransition, manifestsEqual, mergeRanges, parseVerifyTarget, planDecoderReceipts, planRepair, proofsAgree, queueCaughtUp, rangeDigestOf, rangeIsOrdered, receiptRetentionHolds, receiptsAfterReorg, reportVerify, runDecoderCommitSteps, runSubgraphCommitSteps, sealFinalizedRange, segmentsOverlap, segmentsSurviveReorg, sequentialDigests, sparseDigests, topoSort, versionsEqual };
1547
+ export { BootstrapSource, COVERAGE_REPORT_SCHEMA_VERSION, COVERAGE_STATES, CanonicalBlock, CoverageRange, CoverageReport, CoverageState, DECODER_COMMIT_STEPS, DEFAULT_MAX_RETRIES, DecoderAdapterCommit, DecoderAdapterCrash, DecoderAdapterFailure, DecoderAdapterReceipt, DecoderClockEvent, DecoderClockInput, DecoderClockReceipt, DecoderClockResult, DecoderCommitStep, DeepVerifyResult, EffectMutation, EffectOp, EvaluatorInput, EvaluatorOptions, FAILURE_CLASSES, FAILURE_RETENTION_DAYS, FAILURE_UNITS, FailureClass, FailureRow, FailureUnit, NATIVE_CLOCKS, NativeClock, OpenFailure, QUEUE_STAGES, QueueApply, QueueCounters, QueueEvent, QueueStage, QueueState, REPAIR_MODES, RETRY_STATES, RUNNER_EVENT_TYPES, RUNNER_STATUSES, RUNNER_TRANSITION_TABLE, RUN_STATUSES, ReceiptRow, RepairDefect, RepairMode, RepairPlan, RetryState, RowSnapshot, RunStatus, RunnerEffect, RunnerEvent, RunnerEventType, RunnerFailure, RunnerResult, RunnerState, RunnerStatus, RunnerVersion, SAFE_REPAIR_MODES, STAGE_KINDS, SUBGRAPH_COMMIT_STEPS, SealResult, SealableReceipt, SealedSegment, SourceClock, StageCoverage, StageDeclaration, StageEvidence, StageKind, StageRunView, SubgraphAdapterCrash, SubgraphCommitInput, SubgraphCommitStep, SyncScope, TransitionRule, VERIFY_EXIT, VerifyExit, VerifyMode, VerifyReport, VerifyTarget, applyDecoderReceipts, applyMutations, applyQueueEvent, applyRunnerEvent, canonicalizeMutations, commitDecoderAdapter, commitDecoderAdapterBatch, commitSubgraphAdapter, contiguousThrough, createRunnerState, cursorHeight, cursorIsAfterBlock, cursorIsBeforeBlock, datasetMatchesTarget, deepVerify, defaultRetainUntil, emptyQueueState, evaluateCoverage, expectedAckHeight, failureRangeHolds, failureRetentionHolds, finalRowDigest, findRangeGaps, hashEffectManifest, inputDigest, isFailureClass, isFailureUnit, isNativeClock, isNonNegativeInt, isRepairMode, isRetryState, isRunStatus, isStageKind, lookupTransition, manifestsEqual, mergeRanges, parseVerifyTarget, planDecoderReceipts, planRepair, proofsAgree, queueCaughtUp, rangeDigestOf, rangeIsOrdered, receiptRetentionHolds, receiptsAfterReorg, reportVerify, runDecoderCommitSteps, runSubgraphCommitSteps, sealFinalizedRange, segmentsOverlap, segmentsSurviveReorg, sequentialDigests, sparseDigests, topoSort, versionsEqual };
@@ -956,13 +956,15 @@ async function upsertRegistry(tx, stageId) {
956
956
  async function writeCheckpoint(tx, decoderName, cursor) {
957
957
  if (cursor === null)
958
958
  return;
959
- await tx.insertInto("decoder_checkpoints").values({
959
+ const written = await tx.insertInto("decoder_checkpoints").values({
960
960
  decoder_name: decoderName,
961
961
  last_cursor: cursor
962
962
  }).onConflict((oc) => oc.column("decoder_name").doUpdateSet({
963
963
  last_cursor: cursor,
964
964
  updated_at: new Date
965
- })).execute();
965
+ }).where("decoder_checkpoints.last_cursor", "is distinct from", cursor)).returning("last_cursor").execute();
966
+ if (written.length === 0)
967
+ return;
966
968
  await sql`SELECT pg_notify('index:tip', ${decoderName})`.execute(tx);
967
969
  }
968
970
  async function writeReceipts(tx, stageId, runId, receipts) {
@@ -1009,6 +1011,28 @@ async function commitDecoderAdapter(db, input) {
1009
1011
  }, input.crashAfter);
1010
1012
  });
1011
1013
  }
1014
+ async function commitDecoderAdapterBatch(db, inputs) {
1015
+ await db.transaction().execute(async (tx) => {
1016
+ for (const input of inputs) {
1017
+ await upsertRegistry(tx, input.stage_id);
1018
+ }
1019
+ for (const input of inputs) {
1020
+ await input.writeOutput(tx);
1021
+ }
1022
+ for (const input of inputs) {
1023
+ await writeCheckpoint(tx, input.decoder_name, input.checkpoint_cursor);
1024
+ }
1025
+ for (const input of inputs) {
1026
+ await writeReceipts(tx, input.stage_id, input.run_id ?? null, input.receipts);
1027
+ }
1028
+ for (const input of inputs) {
1029
+ const failure = input.failure ?? null;
1030
+ if (failure) {
1031
+ await writeFailure(tx, input.stage_id, input.run_id ?? null, failure);
1032
+ }
1033
+ }
1034
+ });
1035
+ }
1012
1036
  // src/coverage/sealer.ts
1013
1037
  import { createHash as createHash2 } from "node:crypto";
1014
1038
  function rangeDigestOf(parts) {
@@ -1417,6 +1441,7 @@ export {
1417
1441
  applyRunnerEvent,
1418
1442
  canonicalizeMutations,
1419
1443
  commitDecoderAdapter,
1444
+ commitDecoderAdapterBatch,
1420
1445
  commitSubgraphAdapter,
1421
1446
  contiguousThrough,
1422
1447
  createRunnerState,
@@ -1467,5 +1492,5 @@ export {
1467
1492
  versionsEqual
1468
1493
  };
1469
1494
 
1470
- //# debugId=E07B1E2F14B6478664756E2164756E21
1495
+ //# debugId=0D226DB359FAEB5064756E2164756E21
1471
1496
  //# sourceMappingURL=index.js.map
@@ -7,7 +7,7 @@
7
7
  "/**\n * Coverage evaluator — one library for stage state.\n *\n * Pure. Callers assemble evidence; this file does not touch the database.\n * `complete` is coverage through the recorded target, not currency.\n * `caught_up` additionally requires a fresh source tip and coverage through\n * the finalized boundary. `complete_through` is never conflated with\n * `source_tip`.\n */\n\nimport { decodeStreamsCursor } from \"../streams-cursor.ts\";\nimport {\n\ttype CoverageRange,\n\ttype FailureClass,\n\ttype FailureUnit,\n\ttype NativeClock,\n\ttype RepairMode,\n\ttype RetryState,\n\ttype RunStatus,\n\ttype StageKind,\n\trangeIsOrdered,\n} from \"./constraints.ts\";\n\nexport const COVERAGE_REPORT_SCHEMA_VERSION = 1 as const;\n\nexport const COVERAGE_STATES = [\n\t\"complete\",\n\t\"syncing\",\n\t\"lagging\",\n\t\"gap\",\n\t\"stale\",\n\t\"failed\",\n\t\"unverified_import\",\n\t\"unanchored\",\n\t\"source_unavailable\",\n\t\"out_of_scope\",\n\t\"disabled\",\n] as const;\nexport type CoverageState = (typeof COVERAGE_STATES)[number];\n\nconst HARD_DEP_STATES = new Set<CoverageState>([\n\t\"disabled\",\n\t\"failed\",\n\t\"source_unavailable\",\n\t\"out_of_scope\",\n\t\"unverified_import\",\n\t\"unanchored\",\n\t\"gap\",\n]);\n\nconst DEFAULT_MAX_BLOCKS_BEHIND_FINALIZED = 256;\nconst DEFAULT_MAX_SOURCE_AGE_SECONDS = 300;\n\nexport type BootstrapSource = \"archive\" | \"genesis\" | \"import\";\n\nexport type SyncScope = {\n\tnetwork: string;\n\tstart_height: number;\n\ttarget_height: number | null;\n\tbootstrap: {\n\t\tsource: BootstrapSource;\n\t\tmanifest_digest: string | null;\n\t\tgenesis_hash: string | null;\n\t};\n};\n\nexport type StageDeclaration = {\n\tid: string;\n\tkind: StageKind;\n\tdepends_on: string | null;\n\tnative_clock: NativeClock;\n\tproducer_version: string;\n\trepair_mode: RepairMode;\n\tenabled: boolean;\n};\n\nexport type StageRunView = {\n\tstage_id: string;\n\tcode_hash: string;\n\tconfig_hash: string;\n\thandler_hash: string | null;\n\ttarget_height: number | null;\n\ttarget_cursor: string | null;\n\tstatus: RunStatus;\n\tcomplete_through: number | null;\n};\n\nexport type OpenFailure = {\n\tunit_kind: FailureUnit;\n\tclass: FailureClass;\n\tretry_state: Exclude<RetryState, \"resolved\">;\n\tfrom_height: number | null;\n\tto_height: number | null;\n};\n\nexport type QueueCounters = {\n\taccepted: number;\n\tdecided: number;\n\tenqueued: number;\n\tdelivered: number;\n\tdead: number;\n\tfence_cursor: string | null;\n};\n\nexport type StageEvidence = {\n\tstage_id: string;\n\tranges: CoverageRange[];\n\topen_failures: OpenFailure[];\n\tcursor: string | null;\n\tqueue: QueueCounters | null;\n\tunanchored: boolean;\n\tunverified_import: boolean;\n\t/** False when this stage's native source (node, bitcoin RPC, …) is down. */\n\tsource_available: boolean;\n};\n\nexport type SourceClock = {\n\ttip_height: number | null;\n\tfinalized_height: number | null;\n\tobserved_at: string | null;\n};\n\nexport type EvaluatorOptions = {\n\tnow: Date;\n\tmaxBlocksBehindFinalized?: number;\n\tmaxSourceAgeSeconds?: number;\n};\n\nexport type EvaluatorInput = {\n\tscope: SyncScope;\n\tstages: StageDeclaration[];\n\truns: StageRunView[];\n\tevidence: StageEvidence[];\n\tsource: SourceClock;\n\toptions: EvaluatorOptions;\n};\n\nexport type StageCoverage = {\n\tstage_id: string;\n\tkind: StageKind;\n\tnative_clock: NativeClock;\n\tdepends_on: string | null;\n\tstate: CoverageState;\n\tdetail: string;\n\tcomplete_through: number | null;\n\tsource_tip: number | null;\n\tfinalized_height: number | null;\n\trecorded_target: number | null;\n\tdeclared_range: { from_height: number; to_height: number } | null;\n\tgaps: CoverageRange[];\n\tcaught_up: boolean;\n\tblocked_by: string | null;\n};\n\nexport type CoverageReport = {\n\tschema_version: typeof COVERAGE_REPORT_SCHEMA_VERSION;\n\tnetwork: string;\n\tgenerated_at: string;\n\tsource_tip: number | null;\n\tfinalized_height: number | null;\n\tstages: StageCoverage[];\n\tevaluation_order: string[];\n\tcycles: string[][];\n};\n\nexport function mergeRanges(ranges: readonly CoverageRange[]): CoverageRange[] {\n\tconst sorted = ranges\n\t\t.filter((r) => rangeIsOrdered(r.from_height, r.to_height))\n\t\t.map((r) => ({ from_height: r.from_height, to_height: r.to_height }))\n\t\t.sort((a, b) => a.from_height - b.from_height || a.to_height - b.to_height);\n\tconst out: CoverageRange[] = [];\n\tfor (const range of sorted) {\n\t\tconst last = out[out.length - 1];\n\t\tif (last && range.from_height <= last.to_height + 1) {\n\t\t\tlast.to_height = Math.max(last.to_height, range.to_height);\n\t\t} else {\n\t\t\tout.push(range);\n\t\t}\n\t}\n\treturn out;\n}\n\n/** Highest height reachable from `start` without a hole. */\nexport function contiguousThrough(\n\tranges: readonly CoverageRange[],\n\tstart: number,\n): number | null {\n\tconst merged = mergeRanges(ranges);\n\tlet through: number | null = null;\n\tlet need = start;\n\tfor (const range of merged) {\n\t\tif (range.to_height < need) continue;\n\t\tif (range.from_height > need) break;\n\t\tthrough = range.to_height;\n\t\tneed = range.to_height + 1;\n\t}\n\treturn through;\n}\n\nexport function findRangeGaps(\n\tranges: readonly CoverageRange[],\n\tfrom: number,\n\tto: number,\n): CoverageRange[] {\n\tif (to < from) return [];\n\tconst merged = mergeRanges(ranges);\n\tconst gaps: CoverageRange[] = [];\n\tlet cursor = from;\n\tfor (const range of merged) {\n\t\tif (range.to_height < from) continue;\n\t\tif (range.from_height > to) break;\n\t\tif (range.from_height > cursor) {\n\t\t\tgaps.push({\n\t\t\t\tfrom_height: cursor,\n\t\t\t\tto_height: Math.min(range.from_height - 1, to),\n\t\t\t});\n\t\t}\n\t\tcursor = Math.max(cursor, range.to_height + 1);\n\t\tif (cursor > to) break;\n\t}\n\tif (cursor <= to) {\n\t\tgaps.push({ from_height: cursor, to_height: to });\n\t}\n\treturn gaps;\n}\n\nexport function cursorHeight(cursor: string | null): number | null {\n\tif (!cursor) return null;\n\ttry {\n\t\treturn decodeStreamsCursor(cursor).block_height;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function topoSort(stages: readonly StageDeclaration[]): {\n\torder: string[];\n\tcycles: string[][];\n} {\n\tconst ids = new Set(stages.map((s) => s.id));\n\tconst incoming = new Map<string, number>();\n\tconst outgoing = new Map<string, string[]>();\n\tfor (const stage of stages) {\n\t\tincoming.set(stage.id, 0);\n\t\toutgoing.set(stage.id, []);\n\t}\n\tfor (const stage of stages) {\n\t\tif (!stage.depends_on || !ids.has(stage.depends_on)) continue;\n\t\toutgoing.get(stage.depends_on)?.push(stage.id);\n\t\tincoming.set(stage.id, (incoming.get(stage.id) ?? 0) + 1);\n\t}\n\tconst queue = [...incoming.entries()]\n\t\t.filter(([, n]) => n === 0)\n\t\t.map(([id]) => id)\n\t\t.sort();\n\tconst order: string[] = [];\n\twhile (queue.length > 0) {\n\t\tconst id = queue.shift();\n\t\tif (!id) break;\n\t\torder.push(id);\n\t\tfor (const next of outgoing.get(id) ?? []) {\n\t\t\tconst left = (incoming.get(next) ?? 1) - 1;\n\t\t\tincoming.set(next, left);\n\t\t\tif (left === 0) queue.push(next);\n\t\t\tqueue.sort();\n\t\t}\n\t}\n\tconst leftover = stages.map((s) => s.id).filter((id) => !order.includes(id));\n\treturn { order, cycles: leftover.length > 0 ? [leftover.sort()] : [] };\n}\n\nfunction lastByStage<T extends { stage_id: string }>(\n\trows: readonly T[],\n): Map<string, T> {\n\tconst map = new Map<string, T>();\n\tfor (const row of rows) map.set(row.stage_id, row);\n\treturn map;\n}\n\nfunction emptyEvidence(stageId: string): StageEvidence {\n\treturn {\n\t\tstage_id: stageId,\n\t\tranges: [],\n\t\topen_failures: [],\n\t\tcursor: null,\n\t\tqueue: null,\n\t\tunanchored: false,\n\t\tunverified_import: false,\n\t\tsource_available: true,\n\t};\n}\n\nfunction declaredEnd(args: {\n\trun: StageRunView | undefined;\n\tscope: SyncScope;\n\tsource: SourceClock;\n}): number | null {\n\treturn (\n\t\targs.run?.target_height ??\n\t\targs.scope.target_height ??\n\t\targs.source.finalized_height ??\n\t\targs.source.tip_height\n\t);\n}\n\nfunction clockRanges(\n\tstage: StageDeclaration,\n\tevidence: StageEvidence,\n): {\n\tranges: CoverageRange[];\n\tinvalidCursor: boolean;\n} {\n\tif (stage.native_clock === \"block\") {\n\t\treturn { ranges: evidence.ranges, invalidCursor: false };\n\t}\n\tconst cursor =\n\t\tstage.native_clock === \"cursor\"\n\t\t\t? evidence.cursor\n\t\t\t: (evidence.queue?.fence_cursor ?? null);\n\tif (!cursor) return { ranges: evidence.ranges, invalidCursor: false };\n\tconst height = cursorHeight(cursor);\n\tif (height === null) return { ranges: evidence.ranges, invalidCursor: true };\n\treturn {\n\t\tranges: mergeRanges([\n\t\t\t...evidence.ranges,\n\t\t\t{ from_height: 0, to_height: height },\n\t\t]),\n\t\tinvalidCursor: false,\n\t};\n}\n\nfunction queueCaught(queue: QueueCounters | null): boolean {\n\tif (!queue) return false;\n\treturn (\n\t\tqueue.accepted === queue.decided &&\n\t\tqueue.delivered + queue.dead === queue.accepted\n\t);\n}\n\nfunction sourceAgeSeconds(source: SourceClock, now: Date): number | null {\n\tif (!source.observed_at) return source.tip_height === null ? null : 0;\n\tconst observed = Date.parse(source.observed_at);\n\tif (Number.isNaN(observed)) return null;\n\treturn Math.max(0, Math.round((now.getTime() - observed) / 1000));\n}\n\nfunction evaluateOne(\n\tstage: StageDeclaration,\n\tinput: EvaluatorInput,\n\trun: StageRunView | undefined,\n\tevidence: StageEvidence,\n\tdep: StageCoverage | null,\n\tmissingDep: boolean,\n\tinCycle: boolean,\n): StageCoverage {\n\tconst sourceTip = input.source.tip_height;\n\tconst finalized = input.source.finalized_height;\n\tconst recordedTarget = run?.target_height ?? input.scope.target_height;\n\tconst maxBehind =\n\t\tinput.options.maxBlocksBehindFinalized ??\n\t\tDEFAULT_MAX_BLOCKS_BEHIND_FINALIZED;\n\tconst maxAge =\n\t\tinput.options.maxSourceAgeSeconds ?? DEFAULT_MAX_SOURCE_AGE_SECONDS;\n\tconst age = sourceAgeSeconds(input.source, input.options.now);\n\tconst sourceFresh =\n\t\tsourceTip !== null && finalized !== null && (age === null || age <= maxAge);\n\n\tconst base = {\n\t\tstage_id: stage.id,\n\t\tkind: stage.kind,\n\t\tnative_clock: stage.native_clock,\n\t\tdepends_on: stage.depends_on,\n\t\tsource_tip: sourceTip,\n\t\tfinalized_height: finalized,\n\t\trecorded_target: recordedTarget,\n\t};\n\n\tconst done = (\n\t\tstate: CoverageState,\n\t\tdetail: string,\n\t\textra: Partial<StageCoverage> = {},\n\t): StageCoverage => {\n\t\tconst completeThrough = extra.complete_through ?? null;\n\t\tconst caughtUp =\n\t\t\textra.caught_up ??\n\t\t\t(state !== \"disabled\" &&\n\t\t\t\tstate !== \"failed\" &&\n\t\t\t\tstate !== \"gap\" &&\n\t\t\t\tstate !== \"out_of_scope\" &&\n\t\t\t\tstate !== \"unverified_import\" &&\n\t\t\t\tstate !== \"unanchored\" &&\n\t\t\t\tstate !== \"source_unavailable\" &&\n\t\t\t\tcompleteThrough !== null &&\n\t\t\t\tfinalized !== null &&\n\t\t\t\tcompleteThrough >= finalized &&\n\t\t\t\tsourceFresh);\n\t\treturn {\n\t\t\t...base,\n\t\t\tstate,\n\t\t\tdetail,\n\t\t\tcomplete_through: completeThrough,\n\t\t\tdeclared_range: extra.declared_range ?? null,\n\t\t\tgaps: extra.gaps ?? [],\n\t\t\tcaught_up: caughtUp,\n\t\t\tblocked_by: extra.blocked_by ?? null,\n\t\t};\n\t};\n\n\tif (!stage.enabled) {\n\t\treturn done(\"disabled\", \"stage is disabled\");\n\t}\n\tif (inCycle) {\n\t\treturn done(\"failed\", \"dependency cycle\");\n\t}\n\tif (missingDep) {\n\t\treturn done(\"failed\", `depends on unknown stage ${stage.depends_on}`);\n\t}\n\tif (dep && HARD_DEP_STATES.has(dep.state)) {\n\t\treturn done(dep.state, `blocked by ${dep.stage_id}: ${dep.detail}`, {\n\t\t\tcomplete_through: dep.complete_through,\n\t\t\tblocked_by: dep.stage_id,\n\t\t\tdeclared_range: dep.declared_range,\n\t\t\tgaps: dep.gaps,\n\t\t\tcaught_up: false,\n\t\t});\n\t}\n\n\tif (evidence.open_failures.length > 0 || run?.status === \"failed\") {\n\t\tconst first = evidence.open_failures[0];\n\t\treturn done(\n\t\t\t\"failed\",\n\t\t\tfirst\n\t\t\t\t? `open ${first.class} failure (${first.retry_state})`\n\t\t\t\t: \"run marked failed\",\n\t\t);\n\t}\n\tif (evidence.unverified_import || run?.status === \"unverified_import\") {\n\t\treturn done(\"unverified_import\", \"imported data has not been audited\");\n\t}\n\tif (evidence.unanchored || run?.status === \"unanchored\") {\n\t\treturn done(\n\t\t\t\"unanchored\",\n\t\t\t\"receipts are missing a block hash or node anchor\",\n\t\t);\n\t}\n\tif (!evidence.source_available) {\n\t\treturn done(\"source_unavailable\", \"native source is unavailable\");\n\t}\n\n\tconst { ranges, invalidCursor } = clockRanges(stage, evidence);\n\tif (invalidCursor) {\n\t\treturn done(\"failed\", \"native clock cursor is not a valid streams cursor\");\n\t}\n\n\tconst end = declaredEnd({ run, scope: input.scope, source: input.source });\n\tif (end !== null && end < input.scope.start_height) {\n\t\treturn done(\"out_of_scope\", \"recorded target is below the instance start\");\n\t}\n\n\tconst sourceSilent =\n\t\tsourceTip === null && finalized === null && recordedTarget === null;\n\tif (sourceSilent) {\n\t\treturn done(\n\t\t\t\"source_unavailable\",\n\t\t\t\"the chain source could not be reached, so the declared range is unknown\",\n\t\t);\n\t}\n\n\tif (end === null) {\n\t\treturn done(\n\t\t\t\"source_unavailable\",\n\t\t\t\"no recorded target and the source tip is unknown\",\n\t\t);\n\t}\n\n\tconst declaredRange = {\n\t\tfrom_height: input.scope.start_height,\n\t\tto_height: end,\n\t};\n\tlet completeThrough = contiguousThrough(ranges, input.scope.start_height);\n\tif (dep?.complete_through !== null && dep?.complete_through !== undefined) {\n\t\tif (completeThrough === null) {\n\t\t\t// stay null\n\t\t} else {\n\t\t\tcompleteThrough = Math.min(completeThrough, dep.complete_through);\n\t\t}\n\t} else if (dep && dep.complete_through === null) {\n\t\tcompleteThrough = null;\n\t}\n\n\tconst gaps = findRangeGaps(\n\t\tranges,\n\t\tdeclaredRange.from_height,\n\t\tdeclaredRange.to_height,\n\t);\n\tconst tiled =\n\t\tgaps.length === 0 &&\n\t\tcompleteThrough !== null &&\n\t\tcompleteThrough >= declaredRange.to_height;\n\t// A single suffix still ahead of the prefix is unfinished work, not a hole.\n\tconst trailingGap =\n\t\tgaps.length === 1 &&\n\t\tgaps[0].to_height === declaredRange.to_height &&\n\t\t(completeThrough === null\n\t\t\t? gaps[0].from_height === declaredRange.from_height\n\t\t\t: gaps[0].from_height === completeThrough + 1);\n\n\tconst queueIncomplete =\n\t\tstage.native_clock === \"queue\" && !queueCaught(evidence.queue);\n\n\tif (gaps.length > 0 && !trailingGap) {\n\t\tconst first = gaps[0];\n\t\treturn done(\"gap\", `missing ${first.from_height}–${first.to_height}`, {\n\t\t\tcomplete_through: completeThrough,\n\t\t\tdeclared_range: declaredRange,\n\t\t\tgaps,\n\t\t\tcaught_up: false,\n\t\t});\n\t}\n\n\tif (queueIncomplete || !tiled) {\n\t\treturn done(\n\t\t\t\"syncing\",\n\t\t\t\"contiguous from start, not yet through the recorded target\",\n\t\t\t{\n\t\t\t\tcomplete_through: completeThrough,\n\t\t\t\tdeclared_range: declaredRange,\n\t\t\t\tgaps,\n\t\t\t\tcaught_up: false,\n\t\t\t},\n\t\t);\n\t}\n\n\tconst sourceStale = age !== null && age > maxAge;\n\tconst behindFinalized =\n\t\tfinalized !== null && completeThrough !== null\n\t\t\t? Math.max(0, finalized - completeThrough)\n\t\t\t: null;\n\tconst behindTip =\n\t\tsourceTip !== null && completeThrough !== null\n\t\t\t? Math.max(0, sourceTip - completeThrough)\n\t\t\t: null;\n\t// A target below the current finalized height is a pin, not a live follow.\n\t// That instance is complete through what it asked for — not lagging.\n\tconst pinned =\n\t\trecordedTarget !== null && finalized !== null && recordedTarget < finalized;\n\n\tif (sourceStale) {\n\t\treturn done(\n\t\t\t\"stale\",\n\t\t\t`source observation is ${age}s old, beyond the ${maxAge}s freshness objective`,\n\t\t\t{\n\t\t\t\tcomplete_through: completeThrough,\n\t\t\t\tdeclared_range: declaredRange,\n\t\t\t\tgaps,\n\t\t\t\tcaught_up: false,\n\t\t\t},\n\t\t);\n\t}\n\n\tif (behindFinalized !== null && behindFinalized > maxBehind) {\n\t\treturn done(\n\t\t\t\"stale\",\n\t\t\t`${behindFinalized} blocks behind the finalized height, beyond the ${maxBehind} threshold`,\n\t\t\t{\n\t\t\t\tcomplete_through: completeThrough,\n\t\t\t\tdeclared_range: declaredRange,\n\t\t\t\tgaps,\n\t\t\t\tcaught_up: false,\n\t\t\t},\n\t\t);\n\t}\n\n\tif (!pinned && behindFinalized !== null && behindFinalized > 0) {\n\t\treturn done(\n\t\t\t\"lagging\",\n\t\t\t`${behindFinalized} blocks behind the finalized height`,\n\t\t\t{\n\t\t\t\tcomplete_through: completeThrough,\n\t\t\t\tdeclared_range: declaredRange,\n\t\t\t\tgaps,\n\t\t\t\tcaught_up: false,\n\t\t\t},\n\t\t);\n\t}\n\n\tif (!pinned && behindTip !== null && behindTip > 0) {\n\t\treturn done(\"lagging\", `${behindTip} blocks behind the chain tip`, {\n\t\t\tcomplete_through: completeThrough,\n\t\t\tdeclared_range: declaredRange,\n\t\t\tgaps,\n\t\t});\n\t}\n\n\treturn done(\"complete\", \"processed every unit through the recorded target\", {\n\t\tcomplete_through: completeThrough,\n\t\tdeclared_range: declaredRange,\n\t\tgaps,\n\t});\n}\n\nexport function evaluateCoverage(input: EvaluatorInput): CoverageReport {\n\tconst { order, cycles } = topoSort(input.stages);\n\tconst cyclic = new Set(cycles.flat());\n\tconst known = new Set(input.stages.map((s) => s.id));\n\tconst runs = lastByStage(input.runs);\n\tconst evidence = lastByStage(input.evidence);\n\tconst byId = new Map(input.stages.map((s) => [s.id, s]));\n\tconst evaluated = new Map<string, StageCoverage>();\n\n\tconst visit = (id: string): void => {\n\t\tconst stage = byId.get(id);\n\t\tif (!stage || evaluated.has(id)) return;\n\t\tconst depId = stage.depends_on;\n\t\tconst missingDep = Boolean(depId && !known.has(depId));\n\t\tconst dep = depId && !missingDep ? (evaluated.get(depId) ?? null) : null;\n\t\tevaluated.set(\n\t\t\tid,\n\t\t\tevaluateOne(\n\t\t\t\tstage,\n\t\t\t\tinput,\n\t\t\t\truns.get(id),\n\t\t\t\tevidence.get(id) ?? emptyEvidence(id),\n\t\t\t\tdep,\n\t\t\t\tmissingDep,\n\t\t\t\tcyclic.has(id),\n\t\t\t),\n\t\t);\n\t};\n\n\tfor (const id of order) visit(id);\n\tfor (const id of cyclic) visit(id);\n\n\tconst stages = [...evaluated.values()].sort((a, b) =>\n\t\ta.stage_id.localeCompare(b.stage_id),\n\t);\n\n\treturn {\n\t\tschema_version: COVERAGE_REPORT_SCHEMA_VERSION,\n\t\tnetwork: input.scope.network,\n\t\tgenerated_at: input.options.now.toISOString(),\n\t\tsource_tip: input.source.tip_height,\n\t\tfinalized_height: input.source.finalized_height,\n\t\tstages,\n\t\tevaluation_order: order,\n\t\tcycles,\n\t};\n}\n",
8
8
  "/**\n * Stage runner state machine.\n *\n * Pure. Adapters (P4.5+) persist the returned state and effects.\n * Acknowledgements are ordered; a reorg invalidates overlapping receipts\n * before any replacement ack is accepted. A version change cannot continue\n * the current run — it seals or halts and asks for a new one.\n */\n\nimport type { FailureClass, FailureUnit, RetryState } from \"./constraints.ts\";\nimport type { CoverageRange } from \"./constraints.ts\";\n\nexport const RUNNER_STATUSES = [\n\t\"pending\",\n\t\"running\",\n\t\"complete\",\n\t\"failed\",\n\t\"halted\",\n] as const;\nexport type RunnerStatus = (typeof RUNNER_STATUSES)[number];\n\nexport const RUNNER_EVENT_TYPES = [\n\t\"start\",\n\t\"ack\",\n\t\"fail\",\n\t\"retry\",\n\t\"halt\",\n\t\"resume\",\n\t\"reorg\",\n\t\"version\",\n\t\"finish\",\n] as const;\nexport type RunnerEventType = (typeof RUNNER_EVENT_TYPES)[number];\n\nexport const DEFAULT_MAX_RETRIES = 3;\n\nexport type RunnerVersion = {\n\tcode_hash: string;\n\tconfig_hash: string;\n\thandler_hash: string | null;\n};\n\nexport type RunnerFailure = {\n\tunit_kind: FailureUnit;\n\tclass: FailureClass;\n\tretry_state: Exclude<RetryState, \"resolved\">;\n\tfrom_height: number | null;\n\tto_height: number | null;\n\terror: string | null;\n};\n\nexport type RunnerState = {\n\tstage_id: string;\n\tstatus: RunnerStatus;\n\tversion: RunnerVersion;\n\tstart_height: number;\n\ttarget_height: number | null;\n\tcomplete_through: number | null;\n\tlast_acked_hash: string | null;\n\tretry_count: number;\n\topen_failure: RunnerFailure | null;\n};\n\nexport type RunnerEvent =\n\t| { type: \"start\" }\n\t| {\n\t\t\ttype: \"ack\";\n\t\t\theight: number;\n\t\t\thash: string;\n\t\t\tinput_count: number;\n\t\t\tinput_digest: string;\n\t\t\teffect_digest: string;\n\t }\n\t| {\n\t\t\ttype: \"fail\";\n\t\t\tunit_kind: FailureUnit;\n\t\t\tclass: FailureClass;\n\t\t\tfrom_height: number | null;\n\t\t\tto_height: number | null;\n\t\t\terror: string | null;\n\t }\n\t| { type: \"retry\" }\n\t| { type: \"halt\" }\n\t| { type: \"resume\" }\n\t| { type: \"reorg\"; fork_point: number }\n\t| { type: \"version\"; version: RunnerVersion }\n\t| { type: \"finish\" };\n\nexport type RunnerEffect =\n\t| { type: \"invalidate_receipts\"; range: CoverageRange }\n\t| { type: \"spawn_run\"; version: RunnerVersion }\n\t| { type: \"open_failure\"; failure: RunnerFailure }\n\t| { type: \"resolve_failure\" };\n\nexport type RunnerResult =\n\t| { ok: true; state: RunnerState; effects: RunnerEffect[] }\n\t| { ok: false; reason: string; state: RunnerState };\n\nexport type TransitionRule = {\n\tfrom: RunnerStatus;\n\tevent: RunnerEventType;\n\tto: RunnerStatus | \"reject\";\n};\n\n/**\n * Structural transition table. Guards (order, retry budget, version\n * equality, reorg overlap) are applied on top in `applyRunnerEvent`.\n */\nexport const RUNNER_TRANSITION_TABLE: readonly TransitionRule[] = [\n\t{ from: \"pending\", event: \"start\", to: \"running\" },\n\t{ from: \"pending\", event: \"ack\", to: \"reject\" },\n\t{ from: \"pending\", event: \"fail\", to: \"reject\" },\n\t{ from: \"pending\", event: \"retry\", to: \"reject\" },\n\t{ from: \"pending\", event: \"halt\", to: \"reject\" },\n\t{ from: \"pending\", event: \"resume\", to: \"reject\" },\n\t{ from: \"pending\", event: \"reorg\", to: \"reject\" },\n\t{ from: \"pending\", event: \"version\", to: \"pending\" },\n\t{ from: \"pending\", event: \"finish\", to: \"reject\" },\n\n\t{ from: \"running\", event: \"start\", to: \"reject\" },\n\t{ from: \"running\", event: \"ack\", to: \"running\" },\n\t{ from: \"running\", event: \"fail\", to: \"failed\" },\n\t{ from: \"running\", event: \"retry\", to: \"reject\" },\n\t{ from: \"running\", event: \"halt\", to: \"halted\" },\n\t{ from: \"running\", event: \"resume\", to: \"running\" },\n\t{ from: \"running\", event: \"reorg\", to: \"running\" },\n\t{ from: \"running\", event: \"version\", to: \"halted\" },\n\t{ from: \"running\", event: \"finish\", to: \"complete\" },\n\n\t{ from: \"complete\", event: \"start\", to: \"reject\" },\n\t{ from: \"complete\", event: \"ack\", to: \"reject\" },\n\t{ from: \"complete\", event: \"fail\", to: \"reject\" },\n\t{ from: \"complete\", event: \"retry\", to: \"reject\" },\n\t{ from: \"complete\", event: \"halt\", to: \"reject\" },\n\t{ from: \"complete\", event: \"resume\", to: \"reject\" },\n\t{ from: \"complete\", event: \"reorg\", to: \"running\" },\n\t{ from: \"complete\", event: \"version\", to: \"complete\" },\n\t{ from: \"complete\", event: \"finish\", to: \"complete\" },\n\n\t{ from: \"failed\", event: \"start\", to: \"reject\" },\n\t{ from: \"failed\", event: \"ack\", to: \"reject\" },\n\t{ from: \"failed\", event: \"fail\", to: \"reject\" },\n\t{ from: \"failed\", event: \"retry\", to: \"running\" },\n\t{ from: \"failed\", event: \"halt\", to: \"halted\" },\n\t{ from: \"failed\", event: \"resume\", to: \"running\" },\n\t{ from: \"failed\", event: \"reorg\", to: \"failed\" },\n\t{ from: \"failed\", event: \"version\", to: \"halted\" },\n\t{ from: \"failed\", event: \"finish\", to: \"reject\" },\n\n\t{ from: \"halted\", event: \"start\", to: \"reject\" },\n\t{ from: \"halted\", event: \"ack\", to: \"reject\" },\n\t{ from: \"halted\", event: \"fail\", to: \"reject\" },\n\t{ from: \"halted\", event: \"retry\", to: \"running\" },\n\t{ from: \"halted\", event: \"halt\", to: \"halted\" },\n\t{ from: \"halted\", event: \"resume\", to: \"running\" },\n\t{ from: \"halted\", event: \"reorg\", to: \"halted\" },\n\t{ from: \"halted\", event: \"version\", to: \"halted\" },\n\t{ from: \"halted\", event: \"finish\", to: \"reject\" },\n];\n\nconst RULE_INDEX = new Map<string, TransitionRule>(\n\tRUNNER_TRANSITION_TABLE.map((rule) => [`${rule.from}:${rule.event}`, rule]),\n);\n\nexport function lookupTransition(\n\tfrom: RunnerStatus,\n\tevent: RunnerEventType,\n): TransitionRule {\n\tconst rule = RULE_INDEX.get(`${from}:${event}`);\n\tif (!rule) {\n\t\tthrow new Error(`missing transition ${from} + ${event}`);\n\t}\n\treturn rule;\n}\n\nexport function versionsEqual(a: RunnerVersion, b: RunnerVersion): boolean {\n\treturn (\n\t\ta.code_hash === b.code_hash &&\n\t\ta.config_hash === b.config_hash &&\n\t\ta.handler_hash === b.handler_hash\n\t);\n}\n\n/** Next height this run must acknowledge. */\nexport function expectedAckHeight(state: RunnerState): number {\n\treturn state.complete_through === null\n\t\t? state.start_height\n\t\t: state.complete_through + 1;\n}\n\nexport function createRunnerState(init: {\n\tstage_id: string;\n\tstart_height: number;\n\ttarget_height?: number | null;\n\tversion: RunnerVersion;\n}): RunnerState {\n\treturn {\n\t\tstage_id: init.stage_id,\n\t\tstatus: \"pending\",\n\t\tversion: init.version,\n\t\tstart_height: init.start_height,\n\t\ttarget_height: init.target_height ?? null,\n\t\tcomplete_through: null,\n\t\tlast_acked_hash: null,\n\t\tretry_count: 0,\n\t\topen_failure: null,\n\t};\n}\n\nfunction ok(state: RunnerState, effects: RunnerEffect[] = []): RunnerResult {\n\treturn { ok: true, state, effects };\n}\n\nfunction reject(state: RunnerState, reason: string): RunnerResult {\n\treturn { ok: false, reason, state };\n}\n\nfunction clone(state: RunnerState, patch: Partial<RunnerState>): RunnerState {\n\treturn { ...state, ...patch };\n}\n\nfunction rewind(\n\tstate: RunnerState,\n\tforkPoint: number,\n): { next: RunnerState; effects: RunnerEffect[] } {\n\tconst from = Math.max(forkPoint, state.start_height);\n\tconst through = state.complete_through;\n\tif (through === null || through < from) {\n\t\treturn { next: state, effects: [] };\n\t}\n\tconst completeThrough = from <= state.start_height ? null : from - 1;\n\treturn {\n\t\tnext: clone(state, {\n\t\t\tcomplete_through: completeThrough,\n\t\t\tlast_acked_hash: null,\n\t\t}),\n\t\teffects: [\n\t\t\t{\n\t\t\t\ttype: \"invalidate_receipts\",\n\t\t\t\trange: { from_height: from, to_height: through },\n\t\t\t},\n\t\t],\n\t};\n}\n\nfunction applyRetry(state: RunnerState, maxRetries: number): RunnerResult {\n\tif (state.retry_count >= maxRetries) {\n\t\tconst failure = state.open_failure\n\t\t\t? { ...state.open_failure, retry_state: \"halted\" as const }\n\t\t\t: null;\n\t\treturn ok(clone(state, { status: \"halted\", open_failure: failure }));\n\t}\n\tconst failure = state.open_failure\n\t\t? { ...state.open_failure, retry_state: \"retrying\" as const }\n\t\t: null;\n\treturn ok(\n\t\tclone(state, {\n\t\t\tstatus: \"running\",\n\t\t\tretry_count: state.retry_count + 1,\n\t\t\topen_failure: failure,\n\t\t}),\n\t);\n}\n\nexport function applyRunnerEvent(\n\tstate: RunnerState,\n\tevent: RunnerEvent,\n\topts?: { maxRetries?: number },\n): RunnerResult {\n\tconst maxRetries = opts?.maxRetries ?? DEFAULT_MAX_RETRIES;\n\tconst rule = lookupTransition(state.status, event.type);\n\tif (rule.to === \"reject\") {\n\t\treturn reject(state, `${state.status} cannot ${event.type}`);\n\t}\n\tconst nextStatus = rule.to;\n\n\tswitch (event.type) {\n\t\tcase \"start\":\n\t\t\treturn ok(clone(state, { status: \"running\" }));\n\n\t\tcase \"ack\": {\n\t\t\tif (event.height === state.complete_through) {\n\t\t\t\tif (event.hash === state.last_acked_hash) return ok(state);\n\t\t\t\treturn reject(\n\t\t\t\t\tstate,\n\t\t\t\t\t`ack at ${event.height} has a different hash; reorg first`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst expected = expectedAckHeight(state);\n\t\t\tif (event.height !== expected) {\n\t\t\t\treturn reject(\n\t\t\t\t\tstate,\n\t\t\t\t\t`ack at ${event.height} skips ${expected}; acknowledgements must be ordered`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst effects: RunnerEffect[] = [];\n\t\t\tconst failure = state.open_failure;\n\t\t\tconst coversFailure =\n\t\t\t\tfailure &&\n\t\t\t\tfailure.from_height !== null &&\n\t\t\t\tevent.height >= failure.from_height &&\n\t\t\t\t(failure.to_height === null || event.height <= failure.to_height);\n\t\t\tif (coversFailure) effects.push({ type: \"resolve_failure\" });\n\t\t\treturn ok(\n\t\t\t\tclone(state, {\n\t\t\t\t\tstatus: \"running\",\n\t\t\t\t\tcomplete_through: event.height,\n\t\t\t\t\tlast_acked_hash: event.hash,\n\t\t\t\t\topen_failure: coversFailure ? null : failure,\n\t\t\t\t}),\n\t\t\t\teffects,\n\t\t\t);\n\t\t}\n\n\t\tcase \"fail\": {\n\t\t\tconst failure: RunnerFailure = {\n\t\t\t\tunit_kind: event.unit_kind,\n\t\t\t\tclass: event.class,\n\t\t\t\tretry_state: \"open\",\n\t\t\t\tfrom_height: event.from_height,\n\t\t\t\tto_height: event.to_height,\n\t\t\t\terror: event.error,\n\t\t\t};\n\t\t\treturn ok(clone(state, { status: \"failed\", open_failure: failure }), [\n\t\t\t\t{ type: \"open_failure\", failure },\n\t\t\t]);\n\t\t}\n\n\t\tcase \"retry\":\n\t\t\treturn applyRetry(state, maxRetries);\n\n\t\tcase \"halt\": {\n\t\t\tconst failure = state.open_failure\n\t\t\t\t? { ...state.open_failure, retry_state: \"halted\" as const }\n\t\t\t\t: state.open_failure;\n\t\t\treturn ok(clone(state, { status: \"halted\", open_failure: failure }));\n\t\t}\n\n\t\tcase \"resume\":\n\t\t\tif (state.status === \"running\") return ok(state);\n\t\t\tif (state.open_failure) return applyRetry(state, maxRetries);\n\t\t\treturn ok(clone(state, { status: \"running\" }));\n\n\t\tcase \"reorg\": {\n\t\t\tif (event.fork_point < state.start_height) {\n\t\t\t\treturn reject(\n\t\t\t\t\tstate,\n\t\t\t\t\t`reorg fork ${event.fork_point} is below start ${state.start_height}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst { next, effects } = rewind(state, event.fork_point);\n\t\t\tif (effects.length === 0) return ok(state);\n\t\t\treturn ok(clone(next, { status: nextStatus }), effects);\n\t\t}\n\n\t\tcase \"version\": {\n\t\t\tif (versionsEqual(state.version, event.version)) return ok(state);\n\t\t\tif (state.status === \"pending\") {\n\t\t\t\treturn ok(clone(state, { version: event.version }));\n\t\t\t}\n\t\t\tconst sealed: RunnerStatus =\n\t\t\t\tstate.status === \"complete\" ? \"complete\" : \"halted\";\n\t\t\treturn ok(clone(state, { status: sealed }), [\n\t\t\t\t{ type: \"spawn_run\", version: event.version },\n\t\t\t]);\n\t\t}\n\n\t\tcase \"finish\": {\n\t\t\tif (state.status === \"complete\") return ok(state);\n\t\t\tif (state.target_height === null) {\n\t\t\t\treturn reject(state, \"cannot finish a follow-the-chain run\");\n\t\t\t}\n\t\t\tif (\n\t\t\t\tstate.complete_through === null ||\n\t\t\t\tstate.complete_through < state.target_height\n\t\t\t) {\n\t\t\t\treturn reject(\n\t\t\t\t\tstate,\n\t\t\t\t\t`cannot finish: complete_through ${state.complete_through} is short of target ${state.target_height}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn ok(clone(state, { status: \"complete\" }));\n\t\t}\n\t}\n}\n",
9
9
  "/**\n * Decoder clock — pair Streams cursor order with per-block receipts.\n *\n * A filtered firehose can jump from `100:5` to `105:0` and never mention\n * 101–104. Coverage still needs a receipt for every canonical height,\n * including no-match blocks. This library is that seam: cursors stay\n * monotonic, receipts stay one-per-height, empty blocks still ack.\n *\n * Only fully closed blocks in `(from_cursor, to_cursor]` emit receipts.\n * Mid-block resumes wait until the cursor is past the block.\n */\n\nimport { createHash } from \"node:crypto\";\nimport {\n\ttype StreamsCursor,\n\tblockEndCursor,\n\tcompareStreamsCursor,\n\tdecodeStreamsCursor,\n\tencodeStreamsCursor,\n\tisEmptyRangeCursor,\n} from \"../streams-cursor.ts\";\n\nexport type CanonicalBlock = {\n\theight: number;\n\thash: string;\n};\n\nexport type DecoderClockEvent = {\n\tcursor: string;\n\tblock_hash: string;\n\tmatched: boolean;\n};\n\nexport type DecoderClockInput = {\n\tstart_height: number;\n\t/** Exclusive. Null = before `start_height`. */\n\tfrom_cursor: string | null;\n\t/** Exclusive high-water after this batch. */\n\tto_cursor: string;\n\tblocks: readonly CanonicalBlock[];\n\tevents: readonly DecoderClockEvent[];\n};\n\nexport type DecoderClockReceipt = {\n\theight: number;\n\thash: string;\n\tinput_count: number;\n\tinput_cursors: string[];\n\tinput_digest: string;\n\tthrough_cursor: string;\n\tno_match: boolean;\n};\n\nexport type DecoderClockResult =\n\t| { ok: true; receipts: DecoderClockReceipt[]; through_cursor: string }\n\t| { ok: false; reason: string; receipts: DecoderClockReceipt[] };\n\nexport function inputDigest(cursors: readonly string[]): string {\n\tif (cursors.length === 0) {\n\t\treturn createHash(\"sha256\").update(\"no-match\\n\").digest(\"hex\");\n\t}\n\tconst hash = createHash(\"sha256\");\n\tfor (const cursor of cursors) hash.update(`${cursor}\\n`);\n\treturn hash.digest(\"hex\");\n}\n\nexport function cursorIsAfterBlock(\n\tcursor: StreamsCursor,\n\theight: number,\n): boolean {\n\treturn compareStreamsCursor(cursor, blockEndCursor(height)) >= 0;\n}\n\n/** True when `from` is strictly before the first event that can live in `height`. */\nexport function cursorIsBeforeBlock(\n\tcursor: StreamsCursor,\n\theight: number,\n): boolean {\n\treturn cursor.block_height < height;\n}\n\nfunction parseCursor(\n\tvalue: string,\n\tlabel: string,\n): { ok: true; cursor: StreamsCursor } | { ok: false; reason: string } {\n\ttry {\n\t\treturn { ok: true, cursor: decodeStreamsCursor(value) };\n\t} catch {\n\t\treturn { ok: false, reason: `${label} is not a valid streams cursor` };\n\t}\n}\n\nexport function planDecoderReceipts(\n\tinput: DecoderClockInput,\n): DecoderClockResult {\n\tconst to = parseCursor(input.to_cursor, \"to_cursor\");\n\tif (!to.ok) return { ok: false, reason: to.reason, receipts: [] };\n\n\tlet from: StreamsCursor | null = null;\n\tif (input.from_cursor !== null) {\n\t\tconst parsed = parseCursor(input.from_cursor, \"from_cursor\");\n\t\tif (!parsed.ok) return { ok: false, reason: parsed.reason, receipts: [] };\n\t\tfrom = parsed.cursor;\n\t\tif (compareStreamsCursor(from, to.cursor) >= 0) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\treason: \"to_cursor must be after from_cursor\",\n\t\t\t\treceipts: [],\n\t\t\t};\n\t\t}\n\t}\n\n\t// A mid-block from_cursor (100:2) or a closed one (100:SENTINEL) both\n\t// mean the next fully-visible block is 101. Receipts are whole blocks.\n\tconst startFull = from === null ? input.start_height : from.block_height + 1;\n\tconst lastFull = isEmptyRangeCursor(to.cursor)\n\t\t? to.cursor.block_height\n\t\t: to.cursor.block_height - 1;\n\n\tif (lastFull < startFull) {\n\t\treturn { ok: true, receipts: [], through_cursor: input.to_cursor };\n\t}\n\n\tif (startFull < input.start_height) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\treason: `window starts at ${startFull}, below start_height ${input.start_height}`,\n\t\t\treceipts: [],\n\t\t};\n\t}\n\n\tconst byHeight = new Map<number, CanonicalBlock>();\n\tlet prevHeight: number | null = null;\n\tfor (const block of input.blocks) {\n\t\tif (prevHeight !== null && block.height !== prevHeight + 1) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\treason: `blocks are not contiguous (${prevHeight} → ${block.height})`,\n\t\t\t\treceipts: [],\n\t\t\t};\n\t\t}\n\t\tif (byHeight.has(block.height)) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\treason: `duplicate canonical height ${block.height}`,\n\t\t\t\treceipts: [],\n\t\t\t};\n\t\t}\n\t\tbyHeight.set(block.height, block);\n\t\tprevHeight = block.height;\n\t}\n\n\tfor (let height = startFull; height <= lastFull; height++) {\n\t\tif (!byHeight.has(height)) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\treason: `missing canonical block ${height}`,\n\t\t\t\treceipts: [],\n\t\t\t};\n\t\t}\n\t}\n\n\tconst decoded: {\n\t\tcursor: StreamsCursor;\n\t\tencoded: string;\n\t\tblock_hash: string;\n\t\tmatched: boolean;\n\t}[] = [];\n\tlet previous: StreamsCursor | null = from;\n\tfor (const event of input.events) {\n\t\tconst parsed = parseCursor(event.cursor, \"event.cursor\");\n\t\tif (!parsed.ok) return { ok: false, reason: parsed.reason, receipts: [] };\n\t\tif (previous && compareStreamsCursor(parsed.cursor, previous) <= 0) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\treason: `event cursor ${event.cursor} is not after ${encodeStreamsCursor(previous)}`,\n\t\t\t\treceipts: [],\n\t\t\t};\n\t\t}\n\t\tif (compareStreamsCursor(parsed.cursor, to.cursor) >= 0) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\treason: `event cursor ${event.cursor} is not before to_cursor`,\n\t\t\t\treceipts: [],\n\t\t\t};\n\t\t}\n\t\tif (from && compareStreamsCursor(parsed.cursor, from) <= 0) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\treason: `event cursor ${event.cursor} is not after from_cursor`,\n\t\t\t\treceipts: [],\n\t\t\t};\n\t\t}\n\t\tconst block = byHeight.get(parsed.cursor.block_height);\n\t\tif (!block) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\treason: `event ${event.cursor} has no canonical block`,\n\t\t\t\treceipts: [],\n\t\t\t};\n\t\t}\n\t\tif (block.hash !== event.block_hash) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\treason: `event ${event.cursor} hash ${event.block_hash} does not match canonical ${block.hash}`,\n\t\t\t\treceipts: [],\n\t\t\t};\n\t\t}\n\t\tdecoded.push({\n\t\t\tcursor: parsed.cursor,\n\t\t\tencoded: event.cursor,\n\t\t\tblock_hash: event.block_hash,\n\t\t\tmatched: event.matched,\n\t\t});\n\t\tprevious = parsed.cursor;\n\t}\n\n\tconst receipts: DecoderClockReceipt[] = [];\n\tfor (let height = startFull; height <= lastFull; height++) {\n\t\tconst block = byHeight.get(height);\n\t\tif (!block) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\treason: `missing canonical block ${height}`,\n\t\t\t\treceipts,\n\t\t\t};\n\t\t}\n\t\tconst inBlock = decoded.filter((e) => e.cursor.block_height === height);\n\t\tconst matched = inBlock.filter((e) => e.matched);\n\t\tconst last = inBlock[inBlock.length - 1];\n\t\tconst through = last\n\t\t\t? last.encoded\n\t\t\t: encodeStreamsCursor(blockEndCursor(height));\n\t\treceipts.push({\n\t\t\theight,\n\t\t\thash: block.hash,\n\t\t\tinput_count: matched.length,\n\t\t\tinput_cursors: matched.map((e) => e.encoded),\n\t\t\tinput_digest: inputDigest(matched.map((e) => e.encoded)),\n\t\t\tthrough_cursor: through,\n\t\t\tno_match: matched.length === 0,\n\t\t});\n\t}\n\n\treturn { ok: true, receipts, through_cursor: input.to_cursor };\n}\n",
10
- "/**\n * Atomic decoder adapter.\n *\n * One transaction writes decoded output, the decoder checkpoint, block\n * receipts, and an optional failure. A crash after any step rolls all\n * four back — the property `commitDecodedBatch` already had for rows+\n * checkpoint, now covering the coverage kernel too.\n *\n * `crashAfter` is a test probe. It throws inside the transaction so the\n * matrix can abort after each step without simulating a real process kill.\n */\n\nimport { sql } from \"kysely\";\nimport type { Kysely } from \"kysely\";\nimport type { Database } from \"../db/types.ts\";\nimport type { FailureClass, FailureUnit, RetryState } from \"./constraints.ts\";\nimport type { DecoderClockReceipt } from \"./decoder-clock.ts\";\nimport {\n\ttype RunnerEvent,\n\ttype RunnerResult,\n\ttype RunnerState,\n\tapplyRunnerEvent,\n} from \"./runner.ts\";\n\nexport const DECODER_COMMIT_STEPS = [\n\t\"output\",\n\t\"checkpoint\",\n\t\"receipt\",\n\t\"failure\",\n] as const;\nexport type DecoderCommitStep = (typeof DECODER_COMMIT_STEPS)[number];\n\nexport class DecoderAdapterCrash extends Error {\n\treadonly name = \"DecoderAdapterCrash\";\n\tconstructor(readonly step: DecoderCommitStep) {\n\t\tsuper(`decoder adapter crash after ${step}`);\n\t}\n}\n\nexport type DecoderAdapterFailure = {\n\tunit_kind: FailureUnit;\n\tclass: FailureClass;\n\tretry_state: Exclude<RetryState, \"resolved\">;\n\tfrom_height: number | null;\n\tto_height: number | null;\n\terror: string | null;\n\tretry_count?: number;\n};\n\nexport type DecoderAdapterReceipt = DecoderClockReceipt & {\n\teffect_digest: string;\n};\n\nexport type DecoderAdapterCommit = {\n\tstage_id: string;\n\trun_id?: string | null;\n\tdecoder_name: string;\n\t/** Null = do not move the checkpoint (empty page). */\n\tcheckpoint_cursor: string | null;\n\treceipts: readonly DecoderAdapterReceipt[];\n\tfailure?: DecoderAdapterFailure | null;\n\twriteOutput: (tx: Kysely<Database>) => Promise<void>;\n\tcrashAfter?: DecoderCommitStep;\n};\n\nexport async function runDecoderCommitSteps(\n\tsteps: Record<DecoderCommitStep, () => Promise<void>>,\n\tcrashAfter?: DecoderCommitStep,\n): Promise<void> {\n\tfor (const step of DECODER_COMMIT_STEPS) {\n\t\tawait steps[step]();\n\t\tif (crashAfter === step) throw new DecoderAdapterCrash(step);\n\t}\n}\n\nexport function applyDecoderReceipts(\n\tstate: RunnerState,\n\treceipts: readonly DecoderAdapterReceipt[],\n): RunnerResult {\n\tlet current = state;\n\tif (current.status === \"pending\") {\n\t\tconst started = applyRunnerEvent(current, { type: \"start\" });\n\t\tif (!started.ok) return started;\n\t\tcurrent = started.state;\n\t}\n\tfor (const receipt of receipts) {\n\t\tconst event: RunnerEvent = {\n\t\t\ttype: \"ack\",\n\t\t\theight: receipt.height,\n\t\t\thash: receipt.hash,\n\t\t\tinput_count: receipt.input_count,\n\t\t\tinput_digest: receipt.input_digest,\n\t\t\teffect_digest: receipt.effect_digest,\n\t\t};\n\t\tconst next = applyRunnerEvent(current, event);\n\t\tif (!next.ok) return next;\n\t\tcurrent = next.state;\n\t}\n\treturn { ok: true, state: current, effects: [] };\n}\n\nasync function upsertRegistry(\n\ttx: Kysely<Database>,\n\tstageId: string,\n): Promise<void> {\n\tawait tx\n\t\t.insertInto(\"stage_registry\")\n\t\t.values({\n\t\t\tid: stageId,\n\t\t\tkind: \"decode\",\n\t\t\tdepends_on: null,\n\t\t\tnative_clock: \"block\",\n\t\t\tproducer_version: \"v1\",\n\t\t\trepair_mode: \"full_reindex\",\n\t\t})\n\t\t.onConflict((oc) => oc.column(\"id\").doNothing())\n\t\t.execute();\n}\n\nasync function writeCheckpoint(\n\ttx: Kysely<Database>,\n\tdecoderName: string,\n\tcursor: string | null,\n): Promise<void> {\n\tif (cursor === null) return;\n\tawait tx\n\t\t.insertInto(\"decoder_checkpoints\")\n\t\t.values({\n\t\t\tdecoder_name: decoderName,\n\t\t\tlast_cursor: cursor,\n\t\t})\n\t\t.onConflict((oc) =>\n\t\t\toc.column(\"decoder_name\").doUpdateSet({\n\t\t\t\tlast_cursor: cursor,\n\t\t\t\tupdated_at: new Date(),\n\t\t\t}),\n\t\t)\n\t\t.execute();\n\n\t// Every decoder (classic + protocol) funnels its checkpoint write through\n\t// here, so this is the one place a `index:tip` NOTIFY can cover the whole\n\t// decoder set. Postgres defers delivery until the transaction commits,\n\t// so a rewound/rolled-back commit never fires it. A caller (the Index\n\t// API's long-poll wake, plan-063) only needs to know \"something committed,\n\t// go recheck\" — it re-reads the real committed height itself, so the\n\t// payload doesn't need to be more specific than the decoder name.\n\tawait sql`SELECT pg_notify('index:tip', ${decoderName})`.execute(tx);\n}\n\nasync function writeReceipts(\n\ttx: Kysely<Database>,\n\tstageId: string,\n\trunId: string | null,\n\treceipts: readonly DecoderAdapterReceipt[],\n): Promise<void> {\n\tif (receipts.length === 0) return;\n\tawait tx\n\t\t.insertInto(\"stage_block_receipts\")\n\t\t.values(\n\t\t\treceipts.map((receipt) => ({\n\t\t\t\tstage_id: stageId,\n\t\t\t\trun_id: runId,\n\t\t\t\tblock_height: receipt.height,\n\t\t\t\tblock_hash: receipt.hash,\n\t\t\t\tinput_count: receipt.input_count,\n\t\t\t\tinput_digest: receipt.input_digest,\n\t\t\t\teffect_digest: receipt.effect_digest,\n\t\t\t})),\n\t\t)\n\t\t.onConflict((oc) =>\n\t\t\toc\n\t\t\t\t.columns([\"stage_id\", \"block_height\", \"block_hash\"])\n\t\t\t\t.doUpdateSet((eb) => ({\n\t\t\t\t\tinput_count: eb.ref(\"excluded.input_count\"),\n\t\t\t\t\tinput_digest: eb.ref(\"excluded.input_digest\"),\n\t\t\t\t\teffect_digest: eb.ref(\"excluded.effect_digest\"),\n\t\t\t\t\trun_id: eb.ref(\"excluded.run_id\"),\n\t\t\t\t})),\n\t\t)\n\t\t.execute();\n}\n\nasync function writeFailure(\n\ttx: Kysely<Database>,\n\tstageId: string,\n\trunId: string | null,\n\tfailure: DecoderAdapterFailure,\n): Promise<void> {\n\tawait tx\n\t\t.insertInto(\"stage_failures\")\n\t\t.values({\n\t\t\tstage_id: stageId,\n\t\t\trun_id: runId,\n\t\t\tunit_kind: failure.unit_kind,\n\t\t\tfrom_height: failure.from_height,\n\t\t\tto_height: failure.to_height,\n\t\t\tclass: failure.class,\n\t\t\tretry_state: failure.retry_state,\n\t\t\tretry_count: failure.retry_count ?? 0,\n\t\t\tlast_error: failure.error,\n\t\t})\n\t\t.execute();\n}\n\n/**\n * Persist output + checkpoint + receipts + failure in one transaction.\n * Runner validation is the caller's job (`applyDecoderReceipts`) so a\n * rejected ack never opens a transaction.\n */\nexport async function commitDecoderAdapter(\n\tdb: Kysely<Database>,\n\tinput: DecoderAdapterCommit,\n): Promise<void> {\n\tconst runId = input.run_id ?? null;\n\tconst failure = input.failure ?? null;\n\tawait db.transaction().execute(async (tx) => {\n\t\tawait upsertRegistry(tx, input.stage_id);\n\t\tawait runDecoderCommitSteps(\n\t\t\t{\n\t\t\t\toutput: () => input.writeOutput(tx),\n\t\t\t\tcheckpoint: () =>\n\t\t\t\t\twriteCheckpoint(tx, input.decoder_name, input.checkpoint_cursor),\n\t\t\t\treceipt: () => writeReceipts(tx, input.stage_id, runId, input.receipts),\n\t\t\t\tfailure: () =>\n\t\t\t\t\tfailure\n\t\t\t\t\t\t? writeFailure(tx, input.stage_id, runId, failure)\n\t\t\t\t\t\t: Promise.resolve(),\n\t\t\t},\n\t\t\tinput.crashAfter,\n\t\t);\n\t});\n}\n",
10
+ "/**\n * Atomic decoder adapter.\n *\n * One transaction writes decoded output, the decoder checkpoint, block\n * receipts, and an optional failure. A crash after any step rolls all\n * four back — the property `commitDecodedBatch` already had for rows+\n * checkpoint, now covering the coverage kernel too.\n *\n * `crashAfter` is a test probe. It throws inside the transaction so the\n * matrix can abort after each step without simulating a real process kill.\n */\n\nimport { sql } from \"kysely\";\nimport type { Kysely } from \"kysely\";\nimport type { Database } from \"../db/types.ts\";\nimport type { FailureClass, FailureUnit, RetryState } from \"./constraints.ts\";\nimport type { DecoderClockReceipt } from \"./decoder-clock.ts\";\nimport {\n\ttype RunnerEvent,\n\ttype RunnerResult,\n\ttype RunnerState,\n\tapplyRunnerEvent,\n} from \"./runner.ts\";\n\nexport const DECODER_COMMIT_STEPS = [\n\t\"output\",\n\t\"checkpoint\",\n\t\"receipt\",\n\t\"failure\",\n] as const;\nexport type DecoderCommitStep = (typeof DECODER_COMMIT_STEPS)[number];\n\nexport class DecoderAdapterCrash extends Error {\n\treadonly name = \"DecoderAdapterCrash\";\n\tconstructor(readonly step: DecoderCommitStep) {\n\t\tsuper(`decoder adapter crash after ${step}`);\n\t}\n}\n\nexport type DecoderAdapterFailure = {\n\tunit_kind: FailureUnit;\n\tclass: FailureClass;\n\tretry_state: Exclude<RetryState, \"resolved\">;\n\tfrom_height: number | null;\n\tto_height: number | null;\n\terror: string | null;\n\tretry_count?: number;\n};\n\nexport type DecoderAdapterReceipt = DecoderClockReceipt & {\n\teffect_digest: string;\n};\n\nexport type DecoderAdapterCommit = {\n\tstage_id: string;\n\trun_id?: string | null;\n\tdecoder_name: string;\n\t/** Null = do not move the checkpoint (empty page). */\n\tcheckpoint_cursor: string | null;\n\treceipts: readonly DecoderAdapterReceipt[];\n\tfailure?: DecoderAdapterFailure | null;\n\twriteOutput: (tx: Kysely<Database>) => Promise<void>;\n\tcrashAfter?: DecoderCommitStep;\n};\n\nexport async function runDecoderCommitSteps(\n\tsteps: Record<DecoderCommitStep, () => Promise<void>>,\n\tcrashAfter?: DecoderCommitStep,\n): Promise<void> {\n\tfor (const step of DECODER_COMMIT_STEPS) {\n\t\tawait steps[step]();\n\t\tif (crashAfter === step) throw new DecoderAdapterCrash(step);\n\t}\n}\n\nexport function applyDecoderReceipts(\n\tstate: RunnerState,\n\treceipts: readonly DecoderAdapterReceipt[],\n): RunnerResult {\n\tlet current = state;\n\tif (current.status === \"pending\") {\n\t\tconst started = applyRunnerEvent(current, { type: \"start\" });\n\t\tif (!started.ok) return started;\n\t\tcurrent = started.state;\n\t}\n\tfor (const receipt of receipts) {\n\t\tconst event: RunnerEvent = {\n\t\t\ttype: \"ack\",\n\t\t\theight: receipt.height,\n\t\t\thash: receipt.hash,\n\t\t\tinput_count: receipt.input_count,\n\t\t\tinput_digest: receipt.input_digest,\n\t\t\teffect_digest: receipt.effect_digest,\n\t\t};\n\t\tconst next = applyRunnerEvent(current, event);\n\t\tif (!next.ok) return next;\n\t\tcurrent = next.state;\n\t}\n\treturn { ok: true, state: current, effects: [] };\n}\n\nasync function upsertRegistry(\n\ttx: Kysely<Database>,\n\tstageId: string,\n): Promise<void> {\n\tawait tx\n\t\t.insertInto(\"stage_registry\")\n\t\t.values({\n\t\t\tid: stageId,\n\t\t\tkind: \"decode\",\n\t\t\tdepends_on: null,\n\t\t\tnative_clock: \"block\",\n\t\t\tproducer_version: \"v1\",\n\t\t\trepair_mode: \"full_reindex\",\n\t\t})\n\t\t.onConflict((oc) => oc.column(\"id\").doNothing())\n\t\t.execute();\n}\n\nasync function writeCheckpoint(\n\ttx: Kysely<Database>,\n\tdecoderName: string,\n\tcursor: string | null,\n): Promise<void> {\n\tif (cursor === null) return;\n\t// An idle decoder still calls onBatch on every empty poll (the SDK's\n\t// no-sink consume loop, packages/sdk/src/streams/consumer.ts, invokes it\n\t// unconditionally — see `onBatch` in the no-sink branch), which re-commits\n\t// the SAME cursor every `DECODER_EMPTY_BACKOFF_MS`. With ~15 decoders\n\t// idling on ~1s backoff, an unconditional write+NOTIFY here fired\n\t// `index:tip` up to ~15x/sec with ZERO actual progress, waking every\n\t// pending Index long-poll to recheck for nothing. The `WHERE` makes \"did\n\t// this actually change\" an atomic compare-and-skip at the database: the\n\t// conflicting row is left untouched (and `RETURNING` yields nothing)\n\t// whenever the incoming cursor matches what's already stored, so a\n\t// no-op poll costs one INSERT attempt, not a write + a NOTIFY fan-out.\n\t// `IS DISTINCT FROM`, not `!=`: `last_cursor` starts out NULL for a\n\t// decoder that has never committed, and SQL's `NULL != x` evaluates to\n\t// NULL (falsy in a WHERE) — a plain `!=` silently treated \"still unset\"\n\t// as \"unchanged\" and dropped a decoder's very first commit entirely.\n\tconst written = await tx\n\t\t.insertInto(\"decoder_checkpoints\")\n\t\t.values({\n\t\t\tdecoder_name: decoderName,\n\t\t\tlast_cursor: cursor,\n\t\t})\n\t\t.onConflict((oc) =>\n\t\t\toc\n\t\t\t\t.column(\"decoder_name\")\n\t\t\t\t.doUpdateSet({\n\t\t\t\t\tlast_cursor: cursor,\n\t\t\t\t\tupdated_at: new Date(),\n\t\t\t\t})\n\t\t\t\t.where(\"decoder_checkpoints.last_cursor\", \"is distinct from\", cursor),\n\t\t)\n\t\t.returning(\"last_cursor\")\n\t\t.execute();\n\tif (written.length === 0) return;\n\n\t// Every decoder (classic + protocol) funnels its checkpoint write through\n\t// here, so this is the one place a `index:tip` NOTIFY can cover the whole\n\t// decoder set. Postgres defers delivery until the transaction commits,\n\t// so a rewound/rolled-back commit never fires it. A caller (the Index\n\t// API's long-poll wake, plan-063) only needs to know \"something committed,\n\t// go recheck\" — it re-reads the real committed height itself, so the\n\t// payload doesn't need to be more specific than the decoder name.\n\tawait sql`SELECT pg_notify('index:tip', ${decoderName})`.execute(tx);\n}\n\nasync function writeReceipts(\n\ttx: Kysely<Database>,\n\tstageId: string,\n\trunId: string | null,\n\treceipts: readonly DecoderAdapterReceipt[],\n): Promise<void> {\n\tif (receipts.length === 0) return;\n\tawait tx\n\t\t.insertInto(\"stage_block_receipts\")\n\t\t.values(\n\t\t\treceipts.map((receipt) => ({\n\t\t\t\tstage_id: stageId,\n\t\t\t\trun_id: runId,\n\t\t\t\tblock_height: receipt.height,\n\t\t\t\tblock_hash: receipt.hash,\n\t\t\t\tinput_count: receipt.input_count,\n\t\t\t\tinput_digest: receipt.input_digest,\n\t\t\t\teffect_digest: receipt.effect_digest,\n\t\t\t})),\n\t\t)\n\t\t.onConflict((oc) =>\n\t\t\toc\n\t\t\t\t.columns([\"stage_id\", \"block_height\", \"block_hash\"])\n\t\t\t\t.doUpdateSet((eb) => ({\n\t\t\t\t\tinput_count: eb.ref(\"excluded.input_count\"),\n\t\t\t\t\tinput_digest: eb.ref(\"excluded.input_digest\"),\n\t\t\t\t\teffect_digest: eb.ref(\"excluded.effect_digest\"),\n\t\t\t\t\trun_id: eb.ref(\"excluded.run_id\"),\n\t\t\t\t})),\n\t\t)\n\t\t.execute();\n}\n\nasync function writeFailure(\n\ttx: Kysely<Database>,\n\tstageId: string,\n\trunId: string | null,\n\tfailure: DecoderAdapterFailure,\n): Promise<void> {\n\tawait tx\n\t\t.insertInto(\"stage_failures\")\n\t\t.values({\n\t\t\tstage_id: stageId,\n\t\t\trun_id: runId,\n\t\t\tunit_kind: failure.unit_kind,\n\t\t\tfrom_height: failure.from_height,\n\t\t\tto_height: failure.to_height,\n\t\t\tclass: failure.class,\n\t\t\tretry_state: failure.retry_state,\n\t\t\tretry_count: failure.retry_count ?? 0,\n\t\t\tlast_error: failure.error,\n\t\t})\n\t\t.execute();\n}\n\n/**\n * Persist output + checkpoint + receipts + failure in one transaction.\n * Runner validation is the caller's job (`applyDecoderReceipts`) so a\n * rejected ack never opens a transaction.\n */\nexport async function commitDecoderAdapter(\n\tdb: Kysely<Database>,\n\tinput: DecoderAdapterCommit,\n): Promise<void> {\n\tconst runId = input.run_id ?? null;\n\tconst failure = input.failure ?? null;\n\tawait db.transaction().execute(async (tx) => {\n\t\tawait upsertRegistry(tx, input.stage_id);\n\t\tawait runDecoderCommitSteps(\n\t\t\t{\n\t\t\t\toutput: () => input.writeOutput(tx),\n\t\t\t\tcheckpoint: () =>\n\t\t\t\t\twriteCheckpoint(tx, input.decoder_name, input.checkpoint_cursor),\n\t\t\t\treceipt: () => writeReceipts(tx, input.stage_id, runId, input.receipts),\n\t\t\t\tfailure: () =>\n\t\t\t\t\tfailure\n\t\t\t\t\t\t? writeFailure(tx, input.stage_id, runId, failure)\n\t\t\t\t\t\t: Promise.resolve(),\n\t\t\t},\n\t\t\tinput.crashAfter,\n\t\t);\n\t});\n}\n\n/**\n * Same commit as {@link commitDecoderAdapter}, for several decoders sharing\n * ONE outer transaction and ONE read of the source events they were fed\n * from — the in-process classic-decoder loop's shape (plan-066): 11\n * checkpoints + their decoded rows land together, so a crash mid-batch\n * cannot leave one type's checkpoint ahead of another's rows.\n *\n * Steps run in four PASSES across the whole batch, not step-by-step per\n * entry, so the global order stays output → checkpoint → receipt → failure\n * (matching the single-entry commit) while every entry's output — including\n * its `assertCheckpointUnmoved` FOR UPDATE check — lands before any entry's\n * new checkpoint is written. Entries are locked in the order given, which\n * callers must keep identical to `handleDecodedEventsReorg`'s decoder-name\n * order so the two paths never take checkpoint-row locks in conflicting\n * order (deadlock risk otherwise). No per-entry `crashAfter` probe — that\n * stays on the single-entry path.\n */\nexport async function commitDecoderAdapterBatch(\n\tdb: Kysely<Database>,\n\tinputs: readonly Omit<DecoderAdapterCommit, \"crashAfter\">[],\n): Promise<void> {\n\tawait db.transaction().execute(async (tx) => {\n\t\tfor (const input of inputs) {\n\t\t\tawait upsertRegistry(tx, input.stage_id);\n\t\t}\n\t\tfor (const input of inputs) {\n\t\t\tawait input.writeOutput(tx);\n\t\t}\n\t\tfor (const input of inputs) {\n\t\t\tawait writeCheckpoint(tx, input.decoder_name, input.checkpoint_cursor);\n\t\t}\n\t\tfor (const input of inputs) {\n\t\t\tawait writeReceipts(\n\t\t\t\ttx,\n\t\t\t\tinput.stage_id,\n\t\t\t\tinput.run_id ?? null,\n\t\t\t\tinput.receipts,\n\t\t\t);\n\t\t}\n\t\tfor (const input of inputs) {\n\t\t\tconst failure = input.failure ?? null;\n\t\t\tif (failure) {\n\t\t\t\tawait writeFailure(tx, input.stage_id, input.run_id ?? null, failure);\n\t\t\t}\n\t\t}\n\t});\n}\n",
11
11
  "/**\n * Segment sealer — compact only finalized receipts after recomputing\n * range digests. A crash or deep reorg must not leave a sealed green\n * range over unfinalized or invalidated receipts.\n */\n\nimport { createHash } from \"node:crypto\";\nimport type { CoverageRange } from \"./constraints.ts\";\nimport type { DecoderClockReceipt } from \"./decoder-clock.ts\";\n\nexport type SealableReceipt = {\n\theight: number;\n\thash: string;\n\tinput_digest: string;\n\teffect_digest: string;\n\tfinalized: boolean;\n};\n\nexport type SealedSegment = {\n\tfrom_height: number;\n\tto_height: number;\n\tchain_digest: string;\n\tinput_digest: string;\n\toutput_digest: string;\n};\n\nexport type SealResult =\n\t| { ok: true; segment: SealedSegment; compacted: number }\n\t| { ok: false; reason: string };\n\nexport function rangeDigestOf(parts: readonly string[]): string {\n\tconst hash = createHash(\"sha256\");\n\tfor (const part of parts) hash.update(`${part}\\n`);\n\treturn hash.digest(\"hex\");\n}\n\nexport function sealFinalizedRange(\n\treceipts: readonly SealableReceipt[],\n\trange: CoverageRange,\n): SealResult {\n\tconst inRange = receipts\n\t\t.filter((r) => r.height >= range.from_height && r.height <= range.to_height)\n\t\t.sort((a, b) => a.height - b.height);\n\tif (inRange.length === 0) {\n\t\treturn { ok: false, reason: \"no receipts in range\" };\n\t}\n\tlet expected = range.from_height;\n\tfor (const receipt of inRange) {\n\t\tif (!receipt.finalized) {\n\t\t\treturn { ok: false, reason: `unfinalized receipt at ${receipt.height}` };\n\t\t}\n\t\tif (receipt.height !== expected) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\treason: `gap at ${expected} before ${receipt.height}`,\n\t\t\t};\n\t\t}\n\t\texpected += 1;\n\t}\n\tif (inRange[inRange.length - 1]?.height !== range.to_height) {\n\t\treturn { ok: false, reason: \"range is not fully covered\" };\n\t}\n\treturn {\n\t\tok: true,\n\t\tcompacted: inRange.length,\n\t\tsegment: {\n\t\t\tfrom_height: range.from_height,\n\t\t\tto_height: range.to_height,\n\t\t\tchain_digest: rangeDigestOf(inRange.map((r) => `${r.height}:${r.hash}`)),\n\t\t\tinput_digest: rangeDigestOf(inRange.map((r) => r.input_digest)),\n\t\t\toutput_digest: rangeDigestOf(inRange.map((r) => r.effect_digest)),\n\t\t},\n\t};\n}\n\n/** After a reorg at `fork`, any sealed segment that overlaps cannot stay green. */\nexport function segmentsSurviveReorg(\n\tsegments: readonly SealedSegment[],\n\tfork: number,\n): SealedSegment[] {\n\treturn segments.filter((s) => s.to_height < fork);\n}\n\nexport function receiptsAfterReorg(\n\treceipts: readonly SealableReceipt[],\n\tfork: number,\n): SealableReceipt[] {\n\treturn receipts.filter((r) => r.height < fork);\n}\n\nexport type ClockReceipt = DecoderClockReceipt;\n",
12
12
  "/**\n * Effect manifests — canonical hash of ordered subgraph mutations per block.\n * Retry and equivalent reorderings of the same ops are stable; a historical\n * defect (different op, table, key, or value) differs.\n */\n\nimport { createHash } from \"node:crypto\";\n\nexport type EffectOp = \"insert\" | \"update\" | \"delete\" | \"increment\";\n\nexport type EffectMutation = {\n\top: EffectOp;\n\ttable: string;\n\tkey: Record<string, string | number | boolean | null>;\n\tvalue?: Record<string, string | number | boolean | null>;\n};\n\nexport function canonicalizeMutations(\n\tops: readonly EffectMutation[],\n): EffectMutation[] {\n\treturn ops.map((op) => ({\n\t\top: op.op,\n\t\ttable: op.table,\n\t\tkey: sortRecord(op.key),\n\t\tvalue: op.value ? sortRecord(op.value) : undefined,\n\t}));\n}\n\nfunction sortRecord(\n\trecord: Record<string, string | number | boolean | null>,\n): Record<string, string | number | boolean | null> {\n\tconst out: Record<string, string | number | boolean | null> = {};\n\tfor (const key of Object.keys(record).sort()) out[key] = record[key] ?? null;\n\treturn out;\n}\n\nexport function hashEffectManifest(ops: readonly EffectMutation[]): string {\n\tconst canonical = canonicalizeMutations(ops);\n\tconst hash = createHash(\"sha256\");\n\thash.update(JSON.stringify(canonical));\n\treturn hash.digest(\"hex\");\n}\n\nexport function manifestsEqual(\n\ta: readonly EffectMutation[],\n\tb: readonly EffectMutation[],\n): boolean {\n\treturn hashEffectManifest(a) === hashEffectManifest(b);\n}\n",
13
13
  "/**\n * Atomic subgraph adapter — commit effects, rows, journal, cursor,\n * receipt, and failure in one transaction.\n */\n\nimport type { DecoderAdapterFailure } from \"./adapter.ts\";\nimport type { DecoderClockReceipt } from \"./decoder-clock.ts\";\nimport type { EffectMutation } from \"./effect-manifest.ts\";\n\nexport const SUBGRAPH_COMMIT_STEPS = [\n\t\"effects\",\n\t\"rows\",\n\t\"journal\",\n\t\"cursor\",\n\t\"receipt\",\n\t\"failure\",\n] as const;\nexport type SubgraphCommitStep = (typeof SUBGRAPH_COMMIT_STEPS)[number];\n\nexport class SubgraphAdapterCrash extends Error {\n\treadonly name = \"SubgraphAdapterCrash\";\n\tconstructor(readonly step: SubgraphCommitStep) {\n\t\tsuper(`subgraph adapter crash after ${step}`);\n\t}\n}\n\nexport type SubgraphCommitInput = {\n\tstage_id: string;\n\teffects: readonly EffectMutation[];\n\treceipts: readonly (DecoderClockReceipt & { effect_digest: string })[];\n\tfailure?: DecoderAdapterFailure | null;\n\twriteEffects: () => Promise<void>;\n\twriteRows: () => Promise<void>;\n\twriteJournal: () => Promise<void>;\n\twriteCursor: () => Promise<void>;\n\twriteReceipts: () => Promise<void>;\n\twriteFailure: () => Promise<void>;\n\tcrashAfter?: SubgraphCommitStep;\n};\n\nexport async function runSubgraphCommitSteps(\n\tsteps: Record<SubgraphCommitStep, () => Promise<void>>,\n\tcrashAfter?: SubgraphCommitStep,\n): Promise<void> {\n\tfor (const step of SUBGRAPH_COMMIT_STEPS) {\n\t\tawait steps[step]();\n\t\tif (crashAfter === step) throw new SubgraphAdapterCrash(step);\n\t}\n}\n\nexport async function commitSubgraphAdapter(\n\tinput: SubgraphCommitInput,\n\twrap: (fn: () => Promise<void>) => Promise<void> = (fn) => fn(),\n): Promise<void> {\n\tawait wrap(() =>\n\t\trunSubgraphCommitSteps(\n\t\t\t{\n\t\t\t\teffects: input.writeEffects,\n\t\t\t\trows: input.writeRows,\n\t\t\t\tjournal: input.writeJournal,\n\t\t\t\tcursor: input.writeCursor,\n\t\t\t\treceipt: input.writeReceipts,\n\t\t\t\tfailure: input.writeFailure,\n\t\t\t},\n\t\t\tinput.crashAfter,\n\t\t),\n\t);\n}\n",
@@ -17,7 +17,7 @@
17
17
  "/**\n * Repair SAFETY GATE — decides whether a proposed repair is allowed to run.\n * Only registered safe modes pass; unsafe ranges and mode/defect mismatches are\n * refused.\n *\n * This file plans and refuses. It does not repair. The executor that actually\n * writes is `secondlayer repair --apply` (packages/cli/src/commands/repair.ts),\n * which rewrites blocks from a signed archive inside a transaction.\n *\n * There used to be an `applyRepair` here that returned `{applied: true}`\n * without touching anything. It was removed in 2026-08 rather than\n * implemented: a second executor would have been a fake one, and drills that\n * \"recovered\" through it would have proven nothing.\n */\n\nimport type { RepairMode } from \"./constraints.ts\";\nimport type { CoverageRange } from \"./constraints.ts\";\n\nexport const SAFE_REPAIR_MODES: readonly RepairMode[] = [\n\t\"range_safe\",\n\t\"full_reindex\",\n\t\"archive_replay\",\n];\n\nexport type RepairDefect =\n\t| \"gap\"\n\t| \"digest_mismatch\"\n\t| \"omission\"\n\t| \"version\"\n\t| \"reorg\"\n\t| \"source_gap\";\n\nexport type RepairPlan = {\n\tstage_id: string;\n\trange: CoverageRange;\n\tmode: RepairMode;\n\tdefect: RepairDefect;\n\tsafe: boolean;\n\treason: string;\n};\n\nexport function planRepair(input: {\n\tstage_id: string;\n\trange: CoverageRange;\n\tmode: RepairMode;\n\tdefect: RepairDefect;\n\trange_safe_proven?: boolean;\n}): RepairPlan {\n\tif (input.range.from_height > input.range.to_height) {\n\t\treturn {\n\t\t\t...input,\n\t\t\tsafe: false,\n\t\t\treason: \"inverted range\",\n\t\t};\n\t}\n\tif (!(SAFE_REPAIR_MODES as readonly string[]).includes(input.mode)) {\n\t\treturn {\n\t\t\t...input,\n\t\t\tsafe: false,\n\t\t\treason: `mode ${input.mode} is not registered`,\n\t\t};\n\t}\n\tif (input.mode === \"range_safe\" && !input.range_safe_proven) {\n\t\treturn {\n\t\t\t...input,\n\t\t\tsafe: false,\n\t\t\treason: \"range_safe requires a proven range\",\n\t\t};\n\t}\n\tif (input.defect === \"source_gap\" && input.mode !== \"archive_replay\") {\n\t\treturn {\n\t\t\t...input,\n\t\t\tsafe: false,\n\t\t\treason: \"raw/source gaps require archive_replay\",\n\t\t};\n\t}\n\treturn {\n\t\t...input,\n\t\tsafe: true,\n\t\treason: `dry-run ${input.mode} for ${input.defect}`,\n\t};\n}\n",
18
18
  "/**\n * Unified verify targets — library used by CLI (and REST later).\n * Exit codes match `sl verify`: 0 clean, 1 diverged, 2 unanchored.\n */\n\nexport const VERIFY_EXIT = {\n\tCLEAN: 0,\n\tDIVERGED: 1,\n\tUNANCHORED: 2,\n} as const;\nexport type VerifyExit = (typeof VERIFY_EXIT)[keyof typeof VERIFY_EXIT];\n\nexport type VerifyTarget =\n\t| { kind: \"all\" }\n\t| { kind: \"raw\" }\n\t| { kind: \"decode\"; name: string }\n\t| { kind: \"subgraph\"; name: string };\n\nexport type VerifyMode = \"quick\" | \"deep\" | \"anchor\";\n\nexport function parseVerifyTarget(value: string | undefined): VerifyTarget {\n\tconst raw = (value ?? \"raw\").trim();\n\tif (raw === \"all\") return { kind: \"all\" };\n\tif (raw === \"raw\" || raw === \"\") return { kind: \"raw\" };\n\tif (raw.startsWith(\"decode:\")) {\n\t\tconst name = raw.slice(\"decode:\".length).trim();\n\t\tif (!name) throw new Error(\"decode: target needs a decoder name\");\n\t\treturn { kind: \"decode\", name };\n\t}\n\tif (raw.startsWith(\"subgraph:\")) {\n\t\tconst name = raw.slice(\"subgraph:\".length).trim();\n\t\tif (!name) throw new Error(\"subgraph: target needs a subgraph name\");\n\t\treturn { kind: \"subgraph\", name };\n\t}\n\tthrow new Error(\n\t\t`verify target must be all | raw | decode:<name> | subgraph:<name> (got ${value})`,\n\t);\n}\n\nconst RAW_DATASETS = new Set([\"blocks\", \"transactions\", \"events\"]);\n\n/** Whether an archive/coverage dataset belongs to this verify target. */\nexport function datasetMatchesTarget(\n\tdataset: string,\n\ttarget: VerifyTarget,\n): boolean {\n\tif (target.kind === \"all\") return true;\n\tconst name = dataset.toLowerCase();\n\tif (target.kind === \"raw\") return RAW_DATASETS.has(name);\n\tif (target.kind === \"decode\") {\n\t\treturn (\n\t\t\tname === target.name.toLowerCase() ||\n\t\t\tname === `decode:${target.name.toLowerCase()}` ||\n\t\t\tname.endsWith(`_${target.name.toLowerCase()}`)\n\t\t);\n\t}\n\treturn (\n\t\tname === target.name.toLowerCase() ||\n\t\tname === `subgraph:${target.name.toLowerCase()}` ||\n\t\tname.startsWith(`${target.name.toLowerCase()}_`)\n\t);\n}\n\nexport type VerifyReport = {\n\ttarget: VerifyTarget;\n\tmode: VerifyMode;\n\texit: VerifyExit;\n\tstatus: \"clean\" | \"diverged\" | \"unanchored\";\n\tdetail: string;\n};\n\nexport function reportVerify(opts: {\n\ttarget: VerifyTarget;\n\tmode?: VerifyMode;\n\tanchored?: boolean;\n\tdiverged?: boolean;\n\tdetail?: string;\n}): VerifyReport {\n\tconst mode = opts.mode ?? \"quick\";\n\tif (opts.anchored === false) {\n\t\treturn {\n\t\t\ttarget: opts.target,\n\t\t\tmode,\n\t\t\texit: VERIFY_EXIT.UNANCHORED,\n\t\t\tstatus: \"unanchored\",\n\t\t\tdetail: opts.detail ?? \"reference unavailable or unverifiable\",\n\t\t};\n\t}\n\tif (opts.diverged) {\n\t\treturn {\n\t\t\ttarget: opts.target,\n\t\t\tmode,\n\t\t\texit: VERIFY_EXIT.DIVERGED,\n\t\t\tstatus: \"diverged\",\n\t\t\tdetail: opts.detail ?? \"coverage or archive diverged\",\n\t\t};\n\t}\n\tconst label =\n\t\topts.target.kind === \"decode\"\n\t\t\t? `decode:${opts.target.name}`\n\t\t\t: opts.target.kind === \"subgraph\"\n\t\t\t\t? `subgraph:${opts.target.name}`\n\t\t\t\t: opts.target.kind;\n\treturn {\n\t\ttarget: opts.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AO,SACxB,KAAK,OAAO;AAAA,EACjB,OAAO;AAAA,IACN,QAAQ,KAAK;AAAA,IACb;AAAA,IACA,MAAM,YAAY;AAAA,IAClB,QAAQ;AAAA,IACR,QAAQ,KAAK,UAAU,GAAG,SAAS;AAAA,EACpC;AAAA;",
21
+ "debugId": "0D226DB359FAEB5064756E2164756E21",
22
22
  "names": []
23
23
  }
@@ -203,6 +203,18 @@ declare class IndexHttpClient {
203
203
  getIndexTip(opts?: {
204
204
  wait?: number
205
205
  knownHeight?: number
206
+ /**
207
+ * Event types this caller actually reads (e.g. a chain evaluator's
208
+ * `referencedEventTypes`). Narrows the returned tip — and, together with
209
+ * `wait`, what counts as "nothing new" — to the MIN committed height
210
+ * over just these types, instead of the global floor over EVERY classic
211
+ * decoder. Without it, an unrelated decoder committing (any of ~15,
212
+ * several times a block) moves the global floor and makes an unrelated
213
+ * `wait` return early — the exact busy-idle pattern this fixes. Omit
214
+ * when there's no meaningful subset (falls back to the global floor,
215
+ * unchanged from before this option existed).
216
+ */
217
+ eventTypes?: readonly string[]
206
218
  }): Promise<number>;
207
219
  /** Ingest tip. VM rows land with the block; decoded `block_height` can lag.
208
220
  * Same `wait`/`knownHeight` long-poll contract as {@link getIndexTip}. */
@@ -160,7 +160,11 @@ class IndexHttpClient {
160
160
  return Number(tip.block_height) || 0;
161
161
  }
162
162
  async getIndexTip(opts) {
163
- const env = await this.getIndexTipEnvelope({ ...opts, tipOnly: true });
163
+ const env = await this.getIndexTipEnvelope({
164
+ ...opts,
165
+ tipOnly: true,
166
+ eventTypes: opts?.eventTypes
167
+ });
164
168
  return Number(env.tip?.block_height) || 0;
165
169
  }
166
170
  async getIndexSourceTip(opts) {
@@ -176,9 +180,13 @@ class IndexHttpClient {
176
180
  async getIndexTipEnvelope(opts) {
177
181
  const wantsWait = this.waitSupported && (opts?.wait ?? 0) > 0;
178
182
  const wantsTipOnly = this.waitSupported && Boolean(opts?.tipOnly);
183
+ const wantsEventTypes = this.waitSupported && wantsTipOnly && Boolean(opts?.eventTypes?.length);
179
184
  const params = new URLSearchParams({ limit: "1" });
180
185
  if (wantsTipOnly)
181
186
  params.set("tip_only", "true");
187
+ if (wantsEventTypes && opts?.eventTypes) {
188
+ params.set("event_types", opts.eventTypes.join(","));
189
+ }
182
190
  if (wantsWait) {
183
191
  params.set("wait", String(Math.min(MAX_INDEX_WAIT_SECONDS, Math.max(0, opts?.wait ?? 0))));
184
192
  if (opts?.knownHeight !== undefined) {
@@ -218,5 +226,5 @@ export {
218
226
  createInternalIndexHttpClient
219
227
  };
220
228
 
221
- //# debugId=86DE9405EBDF6BE664756E2164756E21
229
+ //# debugId=A19AED9BB36ED65564756E2164756E21
222
230
  //# sourceMappingURL=index-http.js.map
@@ -3,9 +3,9 @@
3
3
  "sources": ["../src/index-internal-auth.ts", "../src/index-http.ts"],
4
4
  "sourcesContent": [
5
5
  "// Internal service credentials for first-party consumers of /v1/index and\n// /v1/streams over HTTP (decoder, subgraph processor PublicApiBlockSource).\n// Seeded as internal tenants with NO account_id, so these reads are\n// unmetered (metering gates on account_id). Lives in shared so the API (seed)\n// and the consumers import it without a cycle.\n//\n// Resolution: STREAMS_INTERNAL_API_KEY / INDEX_INTERNAL_API_KEY, then\n// INSTANCE_TOKEN (OSS). No committed fallback. Empty-string env values fall\n// through (`trim()`, then empty): compose interpolates\n// `${STREAMS_INTERNAL_API_KEY:-}` which is \"\" when unset.\n//\n// Archive keys must not use the `sk-sl_` prefix; generate with `sl-int_`.\n// OSS compose should omit the internal env and send INSTANCE_TOKEN.\nexport const INDEX_INTERNAL_TENANT_ID = \"tenant_index_internal\";\nexport const INTERNAL_STREAMS_TENANT_ID = \"tenant_streams_decode_internal\";\n\nconst DEFAULT_INTERNAL_INDEX_BASE_URL = \"http://api:3800\";\n\nconst MISSING_INTERNAL_STREAMS_API_KEY =\n\t\"Set STREAMS_INTERNAL_API_KEY (archive; prefix sl-int_) or INSTANCE_TOKEN (OSS). Empty env no longer falls back to a committed secret.\";\n\nconst MISSING_INTERNAL_INDEX_API_KEY =\n\t\"Set INDEX_INTERNAL_API_KEY (archive; prefix sl-int_) or INSTANCE_TOKEN (OSS). Without one, Index reads carry no credential and platform mode 401s every one of them.\";\n\nexport function defaultInternalIndexApiKey(\n\tenv: NodeJS.ProcessEnv = process.env,\n): string | undefined {\n\tconst internal = env.INDEX_INTERNAL_API_KEY?.trim();\n\tif (internal) return internal;\n\tconst instance = env.INSTANCE_TOKEN?.trim();\n\tif (instance) return instance;\n\treturn undefined;\n}\n\nexport function defaultInternalStreamsApiKey(\n\tenv: NodeJS.ProcessEnv = process.env,\n): string | undefined {\n\tconst internal = env.STREAMS_INTERNAL_API_KEY?.trim();\n\tif (internal) return internal;\n\tconst instance = env.INSTANCE_TOKEN?.trim();\n\tif (instance) return instance;\n\treturn undefined;\n}\n\n/**\n * Platform-mode Index consumer: refuse to run with neither credential.\n *\n * Platform mode requires a credential on every Index read (a keyless read\n * 401s, `api/src/index/auth.ts`) — a first-party consumer with no internal\n * key would fail every request at call time. Fail here at startup instead.\n *\n * Self-hosted (oss/dedicated) instances are not gated, so they must NOT call\n * this — `defaultInternalIndexApiKey()` returning undefined is correct there.\n */\nexport function requireInternalIndexApiKey(\n\tenv: NodeJS.ProcessEnv = process.env,\n): string {\n\tconst key = defaultInternalIndexApiKey(env);\n\tif (!key) throw new Error(MISSING_INTERNAL_INDEX_API_KEY);\n\treturn key;\n}\n\n/** Decoder startup: refuse to run with neither credential. */\nexport function requireInternalStreamsApiKey(\n\tenv: NodeJS.ProcessEnv = process.env,\n): string {\n\tconst key = defaultInternalStreamsApiKey(env);\n\tif (!key) throw new Error(MISSING_INTERNAL_STREAMS_API_KEY);\n\treturn key;\n}\n\n/** Shared env contract for decoder + subgraph HTTP dogfood. */\nexport function defaultInternalIndexBaseUrl(): string {\n\treturn (\n\t\tprocess.env.SUBGRAPH_INDEX_API_URL ||\n\t\tprocess.env.STREAMS_API_URL ||\n\t\tDEFAULT_INTERNAL_INDEX_BASE_URL\n\t);\n}\n",
6
- "import {\n\tdefaultInternalIndexApiKey,\n\tdefaultInternalIndexBaseUrl,\n\tdefaultInternalStreamsApiKey,\n} from \"./index-internal-auth.ts\";\n\n/**\n * Low-level transport for the public Index (`/v1/index`) + Streams clock\n * (`/v1/streams`) HTTP APIs: cursor-paginated reads, tip, reorgs. Lives in\n * `shared` (a leaf both the SDK and the subgraph runtime depend on) so the wire\n * format has one home and no package cycle. The SDK's ergonomic client should\n * eventually consume these row types too (see the plan's convergence task).\n *\n * This is intentionally minimal — just the GETs the subgraph runtime's\n * PublicApiBlockSource needs. It is NOT the SDK's full client (walk/consume/\n * retries/auth resolution).\n */\n\nconst PAGE_LIMIT = 1000;\n\n/** Ceiling on the Index long-poll `wait` param (seconds), shared by client and\n * server so neither drifts from the other. Kept comfortably under app-server\n * Caddy's `reverse_proxy` (no read/write timeout override, so this is a\n * self-imposed ceiling, not one it's protecting against) and Bun's own\n * 90s idleTimeout on the api listener. */\nexport const MAX_INDEX_WAIT_SECONDS = 25;\n\n// Transport resilience for the streams-index data plane. The api runs N>1\n// replicas behind Caddy; during a rolling deploy one replica is briefly\n// unreachable, surfacing as a thrown fetch (connection refused/reset) or a\n// Caddy 502/503/504 while it fails over. Retrying a few times with backoff\n// makes a single-replica recreate transparent to the subgraph-processor /\n// decoder — closing the processors-depend-on-api coupling.\nconst MAX_ATTEMPTS = 4;\nconst RETRY_BASE_MS = 150;\nconst RETRYABLE_STATUS = new Set([502, 503, 504]);\n\nconst delay = (ms: number): Promise<void> =>\n\tnew Promise((resolve) => setTimeout(resolve, ms));\n\n/** A non-2xx Index/Streams response, carrying the status so a caller can\n * distinguish \"the server rejected this request\" (e.g. a `wait`/`from_height`\n * param an older server's `validateQueryParams` doesn't recognize, HTTP 400)\n * from a transient outage — see `getIndexTipEnvelope`'s wait fallback. */\nexport class IndexHttpStatusError extends Error {\n\tconstructor(\n\t\treadonly status: number,\n\t\tmessage: string,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = \"IndexHttpStatusError\";\n\t}\n}\n\ntype Envelope<K extends string, T> = {\n\t[P in K]: T[];\n} & { next_cursor: string | null };\n\n// ── Index API wire shapes (single source of truth) ─────────────────────────\nexport type IndexBlockRow = {\n\tblock_height: number;\n\tblock_hash: string;\n\tparent_hash: string;\n\tburn_block_height: number;\n\tburn_block_hash: string | null;\n\t/** Nakamoto StacksBlockId. Absent from pre-2026-07 API deployments. */\n\tindex_block_hash?: string | null;\n\tblock_time: string | null;\n};\n\ntype IndexEventCommon = {\n\tblock_height: number;\n\ttx_id: string;\n\ttx_index?: number;\n\tevent_index: number;\n\tcontract_id: string | null;\n\t/** Submitting-tx context — present only when the read passed `tx_context=true`.\n\t * Lets a consumer build the tx for `ctx.tx` without a separate\n\t * walkTransactions (the ~37x reindex over-fetch; see indexing-speed plan). */\n\ttx_sender?: string | null;\n\ttx_type?: string | null;\n\ttx_status?: string | null;\n\ttx_contract_id?: string | null;\n\ttx_function_name?: string | null;\n};\n\nexport type IndexEventRow = IndexEventCommon &\n\t(\n\t\t| {\n\t\t\t\tevent_type: \"ft_transfer\" | \"ft_mint\" | \"ft_burn\";\n\t\t\t\tasset_identifier: string;\n\t\t\t\tsender?: string;\n\t\t\t\trecipient?: string;\n\t\t\t\tamount: string;\n\t\t }\n\t\t| {\n\t\t\t\tevent_type: \"nft_transfer\" | \"nft_mint\" | \"nft_burn\";\n\t\t\t\tasset_identifier: string;\n\t\t\t\tsender?: string;\n\t\t\t\trecipient?: string;\n\t\t\t\tvalue: string;\n\t\t }\n\t\t| {\n\t\t\t\tevent_type: \"stx_transfer\" | \"stx_mint\" | \"stx_burn\";\n\t\t\t\tsender?: string;\n\t\t\t\trecipient?: string;\n\t\t\t\tamount: string;\n\t\t\t\tmemo?: string | null;\n\t\t }\n\t\t| {\n\t\t\t\tevent_type: \"stx_lock\";\n\t\t\t\tsender: string;\n\t\t\t\tamount: string;\n\t\t\t\tpayload: { unlock_height: string | null };\n\t\t }\n\t\t| {\n\t\t\t\tevent_type: \"print\";\n\t\t\t\tpayload: {\n\t\t\t\t\ttopic: string | null;\n\t\t\t\t\tvalue: unknown;\n\t\t\t\t\traw_value: string | null;\n\t\t\t\t};\n\t\t }\n\t\t| {\n\t\t\t\tevent_type: \"nested_contract_call\";\n\t\t\t\tsender?: string | null;\n\t\t\t\tcaller: string;\n\t\t\t\tfunction_name: string;\n\t\t\t\tfunction_args?: unknown;\n\t\t\t\traw_result?: string | null;\n\t\t }\n\t\t| {\n\t\t\t\tevent_type: \"var_set\";\n\t\t\t\tvar_name: string;\n\t\t\t\traw_value?: string | null;\n\t\t }\n\t\t| {\n\t\t\t\tevent_type: \"map_set\" | \"map_insert\";\n\t\t\t\tmap: string;\n\t\t\t\traw_key?: string | null;\n\t\t\t\traw_value?: string | null;\n\t\t }\n\t\t| {\n\t\t\t\tevent_type: \"map_delete\";\n\t\t\t\tmap: string;\n\t\t\t\traw_key?: string | null;\n\t\t }\n\t);\n\nexport type IndexTransactionRow = {\n\ttx_id: string;\n\tblock_height: number;\n\tblock_time?: string | null;\n\tburn_block_height?: number | null;\n\ttx_index: number;\n\ttx_type: string;\n\tsender: string;\n\tstatus: string;\n\tcontract_call?: {\n\t\tcontract_id: string;\n\t\tfunction_name: string;\n\t\tfunction_args_hex?: string[] | null;\n\t\tresult_hex?: string | null;\n\t} | null;\n\tsmart_contract?: { contract_id: string | null } | null;\n};\n\nexport type StreamsReorgRow = {\n\tid: string;\n\tdetected_at: string;\n\tfork_point_height: number;\n\torphaned_range: { from: string; to: string };\n\tnew_canonical_tip: string;\n};\n\nexport type IndexHttpOptions = {\n\t/** Base URL for /v1/index (the decoded data plane). */\n\tindexBaseUrl: string;\n\t/** Bearer for /v1/index. Empty/unset omits the header. */\n\tindexApiKey?: string;\n\t/** Base URL for /v1/streams (the canonical clock). */\n\tstreamsBaseUrl: string;\n\t/** Bearer for /v1/streams. Empty/unset omits the header. */\n\tstreamsApiKey?: string;\n};\n\n/** `/v1/index/blocks?limit=1`'s envelope — read for its `tip`, not its rows. */\nexport type IndexTipEnvelope = {\n\ttip: {\n\t\tblock_height: number;\n\t\tsource_block_height?: number;\n\t\t/**\n\t\t * Committed height per classic decoded event_type (plan-063), e.g.\n\t\t * `{ ft_transfer: 950, stx_transfer: 940 }`. `null` means that decoder\n\t\t * has no checkpoint yet (fail-closed for a caller that references it,\n\t\t * not \"committed to height 0\"); a missing key means an older server\n\t\t * that doesn't send this field at all. Absent on an instance built\n\t\t * before plan-063 shipped it.\n\t\t */\n\t\tdecoded_heights?: Record<string, number | null>;\n\t};\n};\n\nexport class IndexHttpClient {\n\tprivate readonly indexBaseUrl: string;\n\tprivate readonly indexApiKey: string | undefined;\n\tprivate readonly streamsBaseUrl: string;\n\tprivate readonly streamsApiKey: string | undefined;\n\t/** Populated by the last `getIndexTipEnvelope()` call (via `getIndexTip`/\n\t * `getIndexSourceTip`) so `getDecodedHeights()` can read the SAME response\n\t * synchronously instead of making a second request. */\n\tprivate lastTipEnvelope: IndexTipEnvelope | undefined;\n\t/** Flips false the first time a `wait` request 400s — see\n\t * `getIndexTipEnvelope`'s catch. Per-instance, not global: a fresh client\n\t * (e.g. against a different/upgraded server) always tries wait again. */\n\tprivate waitSupported = true;\n\n\tconstructor(opts: IndexHttpOptions) {\n\t\tthis.indexBaseUrl = opts.indexBaseUrl.replace(/\\/+$/, \"\");\n\t\tthis.indexApiKey = opts.indexApiKey ?? defaultInternalIndexApiKey();\n\t\tthis.streamsBaseUrl = opts.streamsBaseUrl.replace(/\\/+$/, \"\");\n\t\tthis.streamsApiKey = opts.streamsApiKey;\n\t}\n\n\tprivate async get<T>(url: string, apiKey: string | undefined): Promise<T> {\n\t\t// Index reads are anon — omit the header entirely when no key is set, so\n\t\t// an empty key reads anonymously rather than 401-ing as an invalid bearer.\n\t\tconst headers: Record<string, string> = apiKey\n\t\t\t? { authorization: `Bearer ${apiKey}` }\n\t\t\t: {};\n\t\tlet lastErr: unknown;\n\t\tfor (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {\n\t\t\tlet res: Response;\n\t\t\ttry {\n\t\t\t\tres = await fetch(url, { headers });\n\t\t\t} catch (err) {\n\t\t\t\t// An explicit abort/cancel is intentional — surface it immediately\n\t\t\t\t// rather than burning the retry budget masking it as transient.\n\t\t\t\tif (err instanceof Error && err.name === \"AbortError\") throw err;\n\t\t\t\t// Otherwise a transport-level failure (connection refused/reset) —\n\t\t\t\t// e.g. an api replica mid-recreate. Retry; the next attempt\n\t\t\t\t// round-robins to a healthy replica.\n\t\t\t\tlastErr = err;\n\t\t\t\tif (attempt >= MAX_ATTEMPTS) break;\n\t\t\t\tawait delay(RETRY_BASE_MS * 2 ** (attempt - 1));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!res.ok) {\n\t\t\t\tif (RETRYABLE_STATUS.has(res.status) && attempt < MAX_ATTEMPTS) {\n\t\t\t\t\t// Drain the body so the connection can be reused, then back off.\n\t\t\t\t\tawait res.text().catch(() => {});\n\t\t\t\t\tawait delay(RETRY_BASE_MS * 2 ** (attempt - 1));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tthrow new IndexHttpStatusError(\n\t\t\t\t\tres.status,\n\t\t\t\t\t`GET ${url} → ${res.status} ${await res.text()}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn (await res.json()) as T;\n\t\t}\n\t\tthrow (\n\t\t\tlastErr ?? new Error(`GET ${url} failed after ${MAX_ATTEMPTS} attempts`)\n\t\t);\n\t}\n\n\t/** Fetch a single cursor page of an Index collection. */\n\tprivate async getPage<K extends string, T>(\n\t\tpath: string,\n\t\tkey: K,\n\t\tparams: URLSearchParams,\n\t): Promise<{ items: T[]; next_cursor: string | null }> {\n\t\tconst env: Envelope<K, T> = await this.get(\n\t\t\t`${this.indexBaseUrl}${path}?${params}`,\n\t\t\tthis.indexApiKey,\n\t\t);\n\t\treturn { items: env[key], next_cursor: env.next_cursor };\n\t}\n\n\t/** Drain a cursor-paginated Index collection over [fromHeight, toHeight]. */\n\tprivate async walk<K extends string, T>(\n\t\tpath: string,\n\t\tkey: K,\n\t\tfromHeight: number,\n\t\ttoHeight: number,\n\t\textraParams: Record<string, string> = {},\n\t): Promise<T[]> {\n\t\tconst out: T[] = [];\n\t\tlet cursor: string | null = null;\n\t\tdo {\n\t\t\tconst params = new URLSearchParams({\n\t\t\t\tto_height: String(toHeight),\n\t\t\t\tlimit: String(PAGE_LIMIT),\n\t\t\t\t...extraParams,\n\t\t\t});\n\t\t\t// from_height and cursor are mutually exclusive — anchor the first page\n\t\t\t// by height, then page forward by cursor only.\n\t\t\tif (cursor) params.set(\"cursor\", cursor);\n\t\t\telse params.set(\"from_height\", String(fromHeight));\n\t\t\tconst { items, next_cursor } = await this.getPage<K, T>(\n\t\t\t\tpath,\n\t\t\t\tkey,\n\t\t\t\tparams,\n\t\t\t);\n\t\t\tout.push(...items);\n\t\t\tcursor = next_cursor;\n\t\t} while (cursor);\n\t\treturn out;\n\t}\n\n\t/**\n\t * Fetch ONE page of contract-call transactions filtered to `contractId`.\n\t * Unlike walk(), this does NOT drain — the caller pages by feeding back\n\t * next_cursor — so a sparse high-volume filter (e.g. a single contract over\n\t * all history) costs one request per batch, not O(all-history) per tick.\n\t * `cursor` is exclusive (rows strictly after it); on the first call pass\n\t * `fromHeight` to anchor the backfill start instead.\n\t */\n\tasync fetchContractCalls(\n\t\tcontractId: string,\n\t\topts: {\n\t\t\ttoHeight: number;\n\t\t\tcursor?: string | null;\n\t\t\tfromHeight?: number;\n\t\t\tlimit?: number;\n\t\t},\n\t): Promise<{\n\t\ttransactions: IndexTransactionRow[];\n\t\tnext_cursor: string | null;\n\t}> {\n\t\tconst params = new URLSearchParams({\n\t\t\tto_height: String(opts.toHeight),\n\t\t\tlimit: String(opts.limit ?? PAGE_LIMIT),\n\t\t\tcontract_id: contractId,\n\t\t});\n\t\tif (opts.cursor) params.set(\"cursor\", opts.cursor);\n\t\telse params.set(\"from_height\", String(opts.fromHeight ?? 0));\n\t\tconst { items, next_cursor } = await this.getPage<\n\t\t\t\"transactions\",\n\t\t\tIndexTransactionRow\n\t\t>(\"/v1/index/transactions\", \"transactions\", params);\n\t\treturn { transactions: items, next_cursor };\n\t}\n\n\twalkBlocks(fromHeight: number, toHeight: number): Promise<IndexBlockRow[]> {\n\t\treturn this.walk<\"blocks\", IndexBlockRow>(\n\t\t\t\"/v1/index/blocks\",\n\t\t\t\"blocks\",\n\t\t\tfromHeight,\n\t\t\ttoHeight,\n\t\t);\n\t}\n\n\t/** Lowest block height in [fromHeight, toHeight] with a matching event, or\n\t * null. One page, limit 1 — built for sparse-scan probes. */\n\tasync firstEventHeight(\n\t\teventType: string,\n\t\tfromHeight: number,\n\t\ttoHeight: number,\n\t\tcontractId?: string,\n\t): Promise<number | null> {\n\t\tconst params = new URLSearchParams({\n\t\t\tevent_type: eventType,\n\t\t\tfrom_height: String(fromHeight),\n\t\t\tto_height: String(toHeight),\n\t\t\tlimit: \"1\",\n\t\t\t...(contractId ? { contract_id: contractId } : {}),\n\t\t});\n\t\tconst { items } = await this.getPage<\"events\", IndexEventRow>(\n\t\t\t\"/v1/index/events\",\n\t\t\t\"events\",\n\t\t\tparams,\n\t\t);\n\t\treturn items[0]?.block_height ?? null;\n\t}\n\n\twalkEvents(\n\t\teventType: string,\n\t\tfromHeight: number,\n\t\ttoHeight: number,\n\t\t/** Join the submitting tx so each row carries `tx_*` — lets an event-only\n\t\t * subgraph skip walkTransactions and build `ctx.tx` from the event. */\n\t\twithTx = false,\n\t): Promise<IndexEventRow[]> {\n\t\treturn this.walk<\"events\", IndexEventRow>(\n\t\t\t\"/v1/index/events\",\n\t\t\t\"events\",\n\t\t\tfromHeight,\n\t\t\ttoHeight,\n\t\t\t{\n\t\t\t\tevent_type: eventType,\n\t\t\t\t...(withTx ? { tx_context: \"true\" } : {}),\n\t\t\t},\n\t\t);\n\t}\n\n\twalkTransactions(\n\t\tfromHeight: number,\n\t\ttoHeight: number,\n\t): Promise<IndexTransactionRow[]> {\n\t\treturn this.walk<\"transactions\", IndexTransactionRow>(\n\t\t\t\"/v1/index/transactions\",\n\t\t\t\"transactions\",\n\t\t\tfromHeight,\n\t\t\ttoHeight,\n\t\t);\n\t}\n\n\t/** Canonical tip height from the Streams clock. */\n\tasync getStreamsTip(): Promise<number> {\n\t\tconst tip = await this.get<{ block_height: number }>(\n\t\t\t`${this.streamsBaseUrl}/v1/streams/tip`,\n\t\t\tthis.streamsApiKey,\n\t\t);\n\t\treturn Number(tip.block_height) || 0;\n\t}\n\n\t/**\n\t * Highest block height the Index data plane can serve (tip is inline in every\n\t * envelope). This is the data-availability bound — a consumer must not\n\t * process past it, even if the Streams clock is ahead.\n\t *\n\t * `opts.wait` (seconds, clamped to `MAX_INDEX_WAIT_SECONDS`) long-polls:\n\t * the server holds the request until a fresher tip than `opts.knownHeight`\n\t * is available or `wait` elapses (plan-063 3.4/3.5). Pass `knownHeight` —\n\t * the last tip THIS caller observed — or `wait` is a no-op (nothing to\n\t * compare against). A caller that only wants the plain tip omits both.\n\t */\n\tasync getIndexTip(opts?: {\n\t\twait?: number;\n\t\tknownHeight?: number;\n\t}): Promise<number> {\n\t\t// `tip_only`: this method never reads `blocks[]`, only `tip`, so the\n\t\t// server can skip the row query. It ALSO fixes what `tip_only` exists\n\t\t// for: `blocks.length` is governed by the SOURCE tip (`/blocks` windows\n\t\t// to it), but `knownHeight` here is the DECODED tip this method itself\n\t\t// returns — comparing against raw rows made an idle `wait` return\n\t\t// almost instantly whenever ingest ran even slightly ahead of decode\n\t\t// (routes/index.ts's /blocks handler judges emptiness against\n\t\t// `tip.block_height` directly when `tip_only` is set, sidestepping the\n\t\t// mismatch). Do NOT set this on `getIndexSourceTip` below — its\n\t\t// `knownHeight` baseline is the source tip already, so the row-based\n\t\t// check is the CORRECT one there, not a bug to route around.\n\t\tconst env = await this.getIndexTipEnvelope({ ...opts, tipOnly: true });\n\t\treturn Number(env.tip?.block_height) || 0;\n\t}\n\n\t/** Ingest tip. VM rows land with the block; decoded `block_height` can lag.\n\t * Same `wait`/`knownHeight` long-poll contract as {@link getIndexTip}. */\n\tasync getIndexSourceTip(opts?: {\n\t\twait?: number;\n\t\tknownHeight?: number;\n\t}): Promise<number> {\n\t\tconst env = await this.getIndexTipEnvelope(opts);\n\t\treturn Number(env.tip?.source_block_height ?? env.tip?.block_height) || 0;\n\t}\n\n\t/**\n\t * Per-decoder committed heights from the last tip envelope fetched by\n\t * `getIndexTip()`/`getIndexSourceTip()` — reads the cached response, no\n\t * extra request. `undefined` before either has been called, or against an\n\t * older server that doesn't send the field. A caller (the chain evaluator)\n\t * uses this to bound itself by the decoders it actually reads instead of\n\t * the conservative cross-decoder floor `block_height` itself carries.\n\t */\n\tgetDecodedHeights(): Record<string, number | null> | undefined {\n\t\treturn this.lastTipEnvelope?.tip.decoded_heights;\n\t}\n\n\t/** False once a `wait`/`tip_only` request has 400'd on THIS client instance\n\t * (see the catch in `getIndexTipEnvelope`) — an older server that doesn't\n\t * recognize these params. A caller that reuses one client across many\n\t * calls (the chain evaluator, plan-063 3.5) uses this to stop scheduling\n\t * itself as if `wait` actually blocked, instead of re-discovering the 400\n\t * on every single call. */\n\twaitIsSupported(): boolean {\n\t\treturn this.waitSupported;\n\t}\n\n\tprivate async getIndexTipEnvelope(opts?: {\n\t\twait?: number;\n\t\tknownHeight?: number;\n\t\ttipOnly?: boolean;\n\t}): Promise<IndexTipEnvelope> {\n\t\tconst wantsWait = this.waitSupported && (opts?.wait ?? 0) > 0;\n\t\tconst wantsTipOnly = this.waitSupported && Boolean(opts?.tipOnly);\n\t\tconst params = new URLSearchParams({ limit: \"1\" });\n\t\tif (wantsTipOnly) params.set(\"tip_only\", \"true\");\n\t\tif (wantsWait) {\n\t\t\tparams.set(\n\t\t\t\t\"wait\",\n\t\t\t\tString(Math.min(MAX_INDEX_WAIT_SECONDS, Math.max(0, opts?.wait ?? 0))),\n\t\t\t);\n\t\t\t// `from_height` is what makes the wait meaningful here: with no cursor,\n\t\t\t// `/v1/index/blocks?limit=1` always returns a row (the default window's\n\t\t\t// oldest block), so the server would never see \"nothing new\" to wait\n\t\t\t// on. Anchoring one past the last height THIS caller saw makes the page\n\t\t\t// empty until a fresher block lands — the same signal the endpoint\n\t\t\t// already uses for a normal forward walk.\n\t\t\tif (opts?.knownHeight !== undefined) {\n\t\t\t\tparams.set(\"from_height\", String(opts.knownHeight + 1));\n\t\t\t}\n\t\t}\n\t\ttry {\n\t\t\tconst env = await this.get<IndexTipEnvelope>(\n\t\t\t\t`${this.indexBaseUrl}/v1/index/blocks?${params}`,\n\t\t\t\tthis.indexApiKey,\n\t\t\t);\n\t\t\tthis.lastTipEnvelope = env;\n\t\t\treturn env;\n\t\t} catch (err) {\n\t\t\t// An older server's `validateQueryParams` 400s on `wait`/`from_height`/\n\t\t\t// `tip_only` it doesn't recognize. Treat that ONE status as \"this\n\t\t\t// server predates long-poll\", not an outage: disable BOTH extensions\n\t\t\t// for the rest of this client's life and retry plainly, so\n\t\t\t// `FallbackBlockSource` never mistakes a version-skew 400 for the api\n\t\t\t// being down and routes to the DB tap. Gating retry on `wantsWait ||\n\t\t\t// wantsTipOnly` (not `wantsWait` alone) matters mid-rollout: a server\n\t\t\t// already upgraded for `wait` but not yet for `tip_only` (or vice\n\t\t\t// versa) still 400s on the one it doesn't know, even on a plain,\n\t\t\t// non-waiting `getIndexTip()` call.\n\t\t\tif (\n\t\t\t\t(wantsWait || wantsTipOnly) &&\n\t\t\t\terr instanceof IndexHttpStatusError &&\n\t\t\t\terr.status === 400\n\t\t\t) {\n\t\t\t\tthis.waitSupported = false;\n\t\t\t\treturn this.getIndexTipEnvelope(opts);\n\t\t\t}\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\t/** Reorgs since a resume token (wall-clock `detected_at`-keyed). */\n\tasync listReorgs(\n\t\tsince: string,\n\t): Promise<{ reorgs: StreamsReorgRow[]; next_since: string | null }> {\n\t\tconst params = new URLSearchParams({ since });\n\t\treturn this.get(\n\t\t\t`${this.streamsBaseUrl}/v1/streams/reorgs?${params}`,\n\t\t\tthis.streamsApiKey,\n\t\t);\n\t}\n}\n\n/** Decoder + subgraph processor client. One env contract; omits bearer when no key. */\nexport function createInternalIndexHttpClient(): IndexHttpClient {\n\tconst baseUrl = defaultInternalIndexBaseUrl();\n\treturn new IndexHttpClient({\n\t\tindexBaseUrl: baseUrl,\n\t\tstreamsBaseUrl: baseUrl,\n\t\tindexApiKey: defaultInternalIndexApiKey(),\n\t\tstreamsApiKey: defaultInternalStreamsApiKey(),\n\t});\n}\n"
6
+ "import {\n\tdefaultInternalIndexApiKey,\n\tdefaultInternalIndexBaseUrl,\n\tdefaultInternalStreamsApiKey,\n} from \"./index-internal-auth.ts\";\n\n/**\n * Low-level transport for the public Index (`/v1/index`) + Streams clock\n * (`/v1/streams`) HTTP APIs: cursor-paginated reads, tip, reorgs. Lives in\n * `shared` (a leaf both the SDK and the subgraph runtime depend on) so the wire\n * format has one home and no package cycle. The SDK's ergonomic client should\n * eventually consume these row types too (see the plan's convergence task).\n *\n * This is intentionally minimal — just the GETs the subgraph runtime's\n * PublicApiBlockSource needs. It is NOT the SDK's full client (walk/consume/\n * retries/auth resolution).\n */\n\nconst PAGE_LIMIT = 1000;\n\n/** Ceiling on the Index long-poll `wait` param (seconds), shared by client and\n * server so neither drifts from the other. Kept comfortably under app-server\n * Caddy's `reverse_proxy` (no read/write timeout override, so this is a\n * self-imposed ceiling, not one it's protecting against) and Bun's own\n * 90s idleTimeout on the api listener. */\nexport const MAX_INDEX_WAIT_SECONDS = 25;\n\n// Transport resilience for the streams-index data plane. The api runs N>1\n// replicas behind Caddy; during a rolling deploy one replica is briefly\n// unreachable, surfacing as a thrown fetch (connection refused/reset) or a\n// Caddy 502/503/504 while it fails over. Retrying a few times with backoff\n// makes a single-replica recreate transparent to the subgraph-processor /\n// decoder — closing the processors-depend-on-api coupling.\nconst MAX_ATTEMPTS = 4;\nconst RETRY_BASE_MS = 150;\nconst RETRYABLE_STATUS = new Set([502, 503, 504]);\n\nconst delay = (ms: number): Promise<void> =>\n\tnew Promise((resolve) => setTimeout(resolve, ms));\n\n/** A non-2xx Index/Streams response, carrying the status so a caller can\n * distinguish \"the server rejected this request\" (e.g. a `wait`/`from_height`\n * param an older server's `validateQueryParams` doesn't recognize, HTTP 400)\n * from a transient outage — see `getIndexTipEnvelope`'s wait fallback. */\nexport class IndexHttpStatusError extends Error {\n\tconstructor(\n\t\treadonly status: number,\n\t\tmessage: string,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = \"IndexHttpStatusError\";\n\t}\n}\n\ntype Envelope<K extends string, T> = {\n\t[P in K]: T[];\n} & { next_cursor: string | null };\n\n// ── Index API wire shapes (single source of truth) ─────────────────────────\nexport type IndexBlockRow = {\n\tblock_height: number;\n\tblock_hash: string;\n\tparent_hash: string;\n\tburn_block_height: number;\n\tburn_block_hash: string | null;\n\t/** Nakamoto StacksBlockId. Absent from pre-2026-07 API deployments. */\n\tindex_block_hash?: string | null;\n\tblock_time: string | null;\n};\n\ntype IndexEventCommon = {\n\tblock_height: number;\n\ttx_id: string;\n\ttx_index?: number;\n\tevent_index: number;\n\tcontract_id: string | null;\n\t/** Submitting-tx context — present only when the read passed `tx_context=true`.\n\t * Lets a consumer build the tx for `ctx.tx` without a separate\n\t * walkTransactions (the ~37x reindex over-fetch; see indexing-speed plan). */\n\ttx_sender?: string | null;\n\ttx_type?: string | null;\n\ttx_status?: string | null;\n\ttx_contract_id?: string | null;\n\ttx_function_name?: string | null;\n};\n\nexport type IndexEventRow = IndexEventCommon &\n\t(\n\t\t| {\n\t\t\t\tevent_type: \"ft_transfer\" | \"ft_mint\" | \"ft_burn\";\n\t\t\t\tasset_identifier: string;\n\t\t\t\tsender?: string;\n\t\t\t\trecipient?: string;\n\t\t\t\tamount: string;\n\t\t }\n\t\t| {\n\t\t\t\tevent_type: \"nft_transfer\" | \"nft_mint\" | \"nft_burn\";\n\t\t\t\tasset_identifier: string;\n\t\t\t\tsender?: string;\n\t\t\t\trecipient?: string;\n\t\t\t\tvalue: string;\n\t\t }\n\t\t| {\n\t\t\t\tevent_type: \"stx_transfer\" | \"stx_mint\" | \"stx_burn\";\n\t\t\t\tsender?: string;\n\t\t\t\trecipient?: string;\n\t\t\t\tamount: string;\n\t\t\t\tmemo?: string | null;\n\t\t }\n\t\t| {\n\t\t\t\tevent_type: \"stx_lock\";\n\t\t\t\tsender: string;\n\t\t\t\tamount: string;\n\t\t\t\tpayload: { unlock_height: string | null };\n\t\t }\n\t\t| {\n\t\t\t\tevent_type: \"print\";\n\t\t\t\tpayload: {\n\t\t\t\t\ttopic: string | null;\n\t\t\t\t\tvalue: unknown;\n\t\t\t\t\traw_value: string | null;\n\t\t\t\t};\n\t\t }\n\t\t| {\n\t\t\t\tevent_type: \"nested_contract_call\";\n\t\t\t\tsender?: string | null;\n\t\t\t\tcaller: string;\n\t\t\t\tfunction_name: string;\n\t\t\t\tfunction_args?: unknown;\n\t\t\t\traw_result?: string | null;\n\t\t }\n\t\t| {\n\t\t\t\tevent_type: \"var_set\";\n\t\t\t\tvar_name: string;\n\t\t\t\traw_value?: string | null;\n\t\t }\n\t\t| {\n\t\t\t\tevent_type: \"map_set\" | \"map_insert\";\n\t\t\t\tmap: string;\n\t\t\t\traw_key?: string | null;\n\t\t\t\traw_value?: string | null;\n\t\t }\n\t\t| {\n\t\t\t\tevent_type: \"map_delete\";\n\t\t\t\tmap: string;\n\t\t\t\traw_key?: string | null;\n\t\t }\n\t);\n\nexport type IndexTransactionRow = {\n\ttx_id: string;\n\tblock_height: number;\n\tblock_time?: string | null;\n\tburn_block_height?: number | null;\n\ttx_index: number;\n\ttx_type: string;\n\tsender: string;\n\tstatus: string;\n\tcontract_call?: {\n\t\tcontract_id: string;\n\t\tfunction_name: string;\n\t\tfunction_args_hex?: string[] | null;\n\t\tresult_hex?: string | null;\n\t} | null;\n\tsmart_contract?: { contract_id: string | null } | null;\n};\n\nexport type StreamsReorgRow = {\n\tid: string;\n\tdetected_at: string;\n\tfork_point_height: number;\n\torphaned_range: { from: string; to: string };\n\tnew_canonical_tip: string;\n};\n\nexport type IndexHttpOptions = {\n\t/** Base URL for /v1/index (the decoded data plane). */\n\tindexBaseUrl: string;\n\t/** Bearer for /v1/index. Empty/unset omits the header. */\n\tindexApiKey?: string;\n\t/** Base URL for /v1/streams (the canonical clock). */\n\tstreamsBaseUrl: string;\n\t/** Bearer for /v1/streams. Empty/unset omits the header. */\n\tstreamsApiKey?: string;\n};\n\n/** `/v1/index/blocks?limit=1`'s envelope — read for its `tip`, not its rows. */\nexport type IndexTipEnvelope = {\n\ttip: {\n\t\tblock_height: number;\n\t\tsource_block_height?: number;\n\t\t/**\n\t\t * Committed height per classic decoded event_type (plan-063), e.g.\n\t\t * `{ ft_transfer: 950, stx_transfer: 940 }`. `null` means that decoder\n\t\t * has no checkpoint yet (fail-closed for a caller that references it,\n\t\t * not \"committed to height 0\"); a missing key means an older server\n\t\t * that doesn't send this field at all. Absent on an instance built\n\t\t * before plan-063 shipped it.\n\t\t */\n\t\tdecoded_heights?: Record<string, number | null>;\n\t};\n};\n\nexport class IndexHttpClient {\n\tprivate readonly indexBaseUrl: string;\n\tprivate readonly indexApiKey: string | undefined;\n\tprivate readonly streamsBaseUrl: string;\n\tprivate readonly streamsApiKey: string | undefined;\n\t/** Populated by the last `getIndexTipEnvelope()` call (via `getIndexTip`/\n\t * `getIndexSourceTip`) so `getDecodedHeights()` can read the SAME response\n\t * synchronously instead of making a second request. */\n\tprivate lastTipEnvelope: IndexTipEnvelope | undefined;\n\t/** Flips false the first time a `wait` request 400s — see\n\t * `getIndexTipEnvelope`'s catch. Per-instance, not global: a fresh client\n\t * (e.g. against a different/upgraded server) always tries wait again. */\n\tprivate waitSupported = true;\n\n\tconstructor(opts: IndexHttpOptions) {\n\t\tthis.indexBaseUrl = opts.indexBaseUrl.replace(/\\/+$/, \"\");\n\t\tthis.indexApiKey = opts.indexApiKey ?? defaultInternalIndexApiKey();\n\t\tthis.streamsBaseUrl = opts.streamsBaseUrl.replace(/\\/+$/, \"\");\n\t\tthis.streamsApiKey = opts.streamsApiKey;\n\t}\n\n\tprivate async get<T>(url: string, apiKey: string | undefined): Promise<T> {\n\t\t// Index reads are anon — omit the header entirely when no key is set, so\n\t\t// an empty key reads anonymously rather than 401-ing as an invalid bearer.\n\t\tconst headers: Record<string, string> = apiKey\n\t\t\t? { authorization: `Bearer ${apiKey}` }\n\t\t\t: {};\n\t\tlet lastErr: unknown;\n\t\tfor (let attempt = 1; attempt <= MAX_ATTEMPTS; attempt++) {\n\t\t\tlet res: Response;\n\t\t\ttry {\n\t\t\t\tres = await fetch(url, { headers });\n\t\t\t} catch (err) {\n\t\t\t\t// An explicit abort/cancel is intentional — surface it immediately\n\t\t\t\t// rather than burning the retry budget masking it as transient.\n\t\t\t\tif (err instanceof Error && err.name === \"AbortError\") throw err;\n\t\t\t\t// Otherwise a transport-level failure (connection refused/reset) —\n\t\t\t\t// e.g. an api replica mid-recreate. Retry; the next attempt\n\t\t\t\t// round-robins to a healthy replica.\n\t\t\t\tlastErr = err;\n\t\t\t\tif (attempt >= MAX_ATTEMPTS) break;\n\t\t\t\tawait delay(RETRY_BASE_MS * 2 ** (attempt - 1));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!res.ok) {\n\t\t\t\tif (RETRYABLE_STATUS.has(res.status) && attempt < MAX_ATTEMPTS) {\n\t\t\t\t\t// Drain the body so the connection can be reused, then back off.\n\t\t\t\t\tawait res.text().catch(() => {});\n\t\t\t\t\tawait delay(RETRY_BASE_MS * 2 ** (attempt - 1));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tthrow new IndexHttpStatusError(\n\t\t\t\t\tres.status,\n\t\t\t\t\t`GET ${url} → ${res.status} ${await res.text()}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn (await res.json()) as T;\n\t\t}\n\t\tthrow (\n\t\t\tlastErr ?? new Error(`GET ${url} failed after ${MAX_ATTEMPTS} attempts`)\n\t\t);\n\t}\n\n\t/** Fetch a single cursor page of an Index collection. */\n\tprivate async getPage<K extends string, T>(\n\t\tpath: string,\n\t\tkey: K,\n\t\tparams: URLSearchParams,\n\t): Promise<{ items: T[]; next_cursor: string | null }> {\n\t\tconst env: Envelope<K, T> = await this.get(\n\t\t\t`${this.indexBaseUrl}${path}?${params}`,\n\t\t\tthis.indexApiKey,\n\t\t);\n\t\treturn { items: env[key], next_cursor: env.next_cursor };\n\t}\n\n\t/** Drain a cursor-paginated Index collection over [fromHeight, toHeight]. */\n\tprivate async walk<K extends string, T>(\n\t\tpath: string,\n\t\tkey: K,\n\t\tfromHeight: number,\n\t\ttoHeight: number,\n\t\textraParams: Record<string, string> = {},\n\t): Promise<T[]> {\n\t\tconst out: T[] = [];\n\t\tlet cursor: string | null = null;\n\t\tdo {\n\t\t\tconst params = new URLSearchParams({\n\t\t\t\tto_height: String(toHeight),\n\t\t\t\tlimit: String(PAGE_LIMIT),\n\t\t\t\t...extraParams,\n\t\t\t});\n\t\t\t// from_height and cursor are mutually exclusive — anchor the first page\n\t\t\t// by height, then page forward by cursor only.\n\t\t\tif (cursor) params.set(\"cursor\", cursor);\n\t\t\telse params.set(\"from_height\", String(fromHeight));\n\t\t\tconst { items, next_cursor } = await this.getPage<K, T>(\n\t\t\t\tpath,\n\t\t\t\tkey,\n\t\t\t\tparams,\n\t\t\t);\n\t\t\tout.push(...items);\n\t\t\tcursor = next_cursor;\n\t\t} while (cursor);\n\t\treturn out;\n\t}\n\n\t/**\n\t * Fetch ONE page of contract-call transactions filtered to `contractId`.\n\t * Unlike walk(), this does NOT drain — the caller pages by feeding back\n\t * next_cursor — so a sparse high-volume filter (e.g. a single contract over\n\t * all history) costs one request per batch, not O(all-history) per tick.\n\t * `cursor` is exclusive (rows strictly after it); on the first call pass\n\t * `fromHeight` to anchor the backfill start instead.\n\t */\n\tasync fetchContractCalls(\n\t\tcontractId: string,\n\t\topts: {\n\t\t\ttoHeight: number;\n\t\t\tcursor?: string | null;\n\t\t\tfromHeight?: number;\n\t\t\tlimit?: number;\n\t\t},\n\t): Promise<{\n\t\ttransactions: IndexTransactionRow[];\n\t\tnext_cursor: string | null;\n\t}> {\n\t\tconst params = new URLSearchParams({\n\t\t\tto_height: String(opts.toHeight),\n\t\t\tlimit: String(opts.limit ?? PAGE_LIMIT),\n\t\t\tcontract_id: contractId,\n\t\t});\n\t\tif (opts.cursor) params.set(\"cursor\", opts.cursor);\n\t\telse params.set(\"from_height\", String(opts.fromHeight ?? 0));\n\t\tconst { items, next_cursor } = await this.getPage<\n\t\t\t\"transactions\",\n\t\t\tIndexTransactionRow\n\t\t>(\"/v1/index/transactions\", \"transactions\", params);\n\t\treturn { transactions: items, next_cursor };\n\t}\n\n\twalkBlocks(fromHeight: number, toHeight: number): Promise<IndexBlockRow[]> {\n\t\treturn this.walk<\"blocks\", IndexBlockRow>(\n\t\t\t\"/v1/index/blocks\",\n\t\t\t\"blocks\",\n\t\t\tfromHeight,\n\t\t\ttoHeight,\n\t\t);\n\t}\n\n\t/** Lowest block height in [fromHeight, toHeight] with a matching event, or\n\t * null. One page, limit 1 — built for sparse-scan probes. */\n\tasync firstEventHeight(\n\t\teventType: string,\n\t\tfromHeight: number,\n\t\ttoHeight: number,\n\t\tcontractId?: string,\n\t): Promise<number | null> {\n\t\tconst params = new URLSearchParams({\n\t\t\tevent_type: eventType,\n\t\t\tfrom_height: String(fromHeight),\n\t\t\tto_height: String(toHeight),\n\t\t\tlimit: \"1\",\n\t\t\t...(contractId ? { contract_id: contractId } : {}),\n\t\t});\n\t\tconst { items } = await this.getPage<\"events\", IndexEventRow>(\n\t\t\t\"/v1/index/events\",\n\t\t\t\"events\",\n\t\t\tparams,\n\t\t);\n\t\treturn items[0]?.block_height ?? null;\n\t}\n\n\twalkEvents(\n\t\teventType: string,\n\t\tfromHeight: number,\n\t\ttoHeight: number,\n\t\t/** Join the submitting tx so each row carries `tx_*` — lets an event-only\n\t\t * subgraph skip walkTransactions and build `ctx.tx` from the event. */\n\t\twithTx = false,\n\t): Promise<IndexEventRow[]> {\n\t\treturn this.walk<\"events\", IndexEventRow>(\n\t\t\t\"/v1/index/events\",\n\t\t\t\"events\",\n\t\t\tfromHeight,\n\t\t\ttoHeight,\n\t\t\t{\n\t\t\t\tevent_type: eventType,\n\t\t\t\t...(withTx ? { tx_context: \"true\" } : {}),\n\t\t\t},\n\t\t);\n\t}\n\n\twalkTransactions(\n\t\tfromHeight: number,\n\t\ttoHeight: number,\n\t): Promise<IndexTransactionRow[]> {\n\t\treturn this.walk<\"transactions\", IndexTransactionRow>(\n\t\t\t\"/v1/index/transactions\",\n\t\t\t\"transactions\",\n\t\t\tfromHeight,\n\t\t\ttoHeight,\n\t\t);\n\t}\n\n\t/** Canonical tip height from the Streams clock. */\n\tasync getStreamsTip(): Promise<number> {\n\t\tconst tip = await this.get<{ block_height: number }>(\n\t\t\t`${this.streamsBaseUrl}/v1/streams/tip`,\n\t\t\tthis.streamsApiKey,\n\t\t);\n\t\treturn Number(tip.block_height) || 0;\n\t}\n\n\t/**\n\t * Highest block height the Index data plane can serve (tip is inline in every\n\t * envelope). This is the data-availability bound — a consumer must not\n\t * process past it, even if the Streams clock is ahead.\n\t *\n\t * `opts.wait` (seconds, clamped to `MAX_INDEX_WAIT_SECONDS`) long-polls:\n\t * the server holds the request until a fresher tip than `opts.knownHeight`\n\t * is available or `wait` elapses (plan-063 3.4/3.5). Pass `knownHeight` —\n\t * the last tip THIS caller observed — or `wait` is a no-op (nothing to\n\t * compare against). A caller that only wants the plain tip omits both.\n\t */\n\tasync getIndexTip(opts?: {\n\t\twait?: number;\n\t\tknownHeight?: number;\n\t\t/**\n\t\t * Event types this caller actually reads (e.g. a chain evaluator's\n\t\t * `referencedEventTypes`). Narrows the returned tip — and, together with\n\t\t * `wait`, what counts as \"nothing new\" — to the MIN committed height\n\t\t * over just these types, instead of the global floor over EVERY classic\n\t\t * decoder. Without it, an unrelated decoder committing (any of ~15,\n\t\t * several times a block) moves the global floor and makes an unrelated\n\t\t * `wait` return early — the exact busy-idle pattern this fixes. Omit\n\t\t * when there's no meaningful subset (falls back to the global floor,\n\t\t * unchanged from before this option existed).\n\t\t */\n\t\teventTypes?: readonly string[];\n\t}): Promise<number> {\n\t\t// `tip_only`: this method never reads `blocks[]`, only `tip`, so the\n\t\t// server can skip the row query. It ALSO fixes what `tip_only` exists\n\t\t// for: `blocks.length` is governed by the SOURCE tip (`/blocks` windows\n\t\t// to it), but `knownHeight` here is the DECODED tip this method itself\n\t\t// returns — comparing against raw rows made an idle `wait` return\n\t\t// almost instantly whenever ingest ran even slightly ahead of decode\n\t\t// (routes/index.ts's /blocks handler judges emptiness against\n\t\t// `tip.block_height` directly when `tip_only` is set, sidestepping the\n\t\t// mismatch). Do NOT set this on `getIndexSourceTip` below — its\n\t\t// `knownHeight` baseline is the source tip already, so the row-based\n\t\t// check is the CORRECT one there, not a bug to route around.\n\t\tconst env = await this.getIndexTipEnvelope({\n\t\t\t...opts,\n\t\t\ttipOnly: true,\n\t\t\teventTypes: opts?.eventTypes,\n\t\t});\n\t\treturn Number(env.tip?.block_height) || 0;\n\t}\n\n\t/** Ingest tip. VM rows land with the block; decoded `block_height` can lag.\n\t * Same `wait`/`knownHeight` long-poll contract as {@link getIndexTip}. */\n\tasync getIndexSourceTip(opts?: {\n\t\twait?: number;\n\t\tknownHeight?: number;\n\t}): Promise<number> {\n\t\tconst env = await this.getIndexTipEnvelope(opts);\n\t\treturn Number(env.tip?.source_block_height ?? env.tip?.block_height) || 0;\n\t}\n\n\t/**\n\t * Per-decoder committed heights from the last tip envelope fetched by\n\t * `getIndexTip()`/`getIndexSourceTip()` — reads the cached response, no\n\t * extra request. `undefined` before either has been called, or against an\n\t * older server that doesn't send the field. A caller (the chain evaluator)\n\t * uses this to bound itself by the decoders it actually reads instead of\n\t * the conservative cross-decoder floor `block_height` itself carries.\n\t */\n\tgetDecodedHeights(): Record<string, number | null> | undefined {\n\t\treturn this.lastTipEnvelope?.tip.decoded_heights;\n\t}\n\n\t/** False once a `wait`/`tip_only` request has 400'd on THIS client instance\n\t * (see the catch in `getIndexTipEnvelope`) — an older server that doesn't\n\t * recognize these params. A caller that reuses one client across many\n\t * calls (the chain evaluator, plan-063 3.5) uses this to stop scheduling\n\t * itself as if `wait` actually blocked, instead of re-discovering the 400\n\t * on every single call. */\n\twaitIsSupported(): boolean {\n\t\treturn this.waitSupported;\n\t}\n\n\tprivate async getIndexTipEnvelope(opts?: {\n\t\twait?: number;\n\t\tknownHeight?: number;\n\t\ttipOnly?: boolean;\n\t\teventTypes?: readonly string[];\n\t}): Promise<IndexTipEnvelope> {\n\t\tconst wantsWait = this.waitSupported && (opts?.wait ?? 0) > 0;\n\t\tconst wantsTipOnly = this.waitSupported && Boolean(opts?.tipOnly);\n\t\tconst wantsEventTypes =\n\t\t\tthis.waitSupported && wantsTipOnly && Boolean(opts?.eventTypes?.length);\n\t\tconst params = new URLSearchParams({ limit: \"1\" });\n\t\tif (wantsTipOnly) params.set(\"tip_only\", \"true\");\n\t\t// Only meaningful alongside tip_only — it narrows what the returned\n\t\t// (and wait-compared) tip means, and tip_only is what makes the server\n\t\t// return a tip at all instead of a page of rows.\n\t\tif (wantsEventTypes && opts?.eventTypes) {\n\t\t\tparams.set(\"event_types\", opts.eventTypes.join(\",\"));\n\t\t}\n\t\tif (wantsWait) {\n\t\t\tparams.set(\n\t\t\t\t\"wait\",\n\t\t\t\tString(Math.min(MAX_INDEX_WAIT_SECONDS, Math.max(0, opts?.wait ?? 0))),\n\t\t\t);\n\t\t\t// `from_height` is what makes the wait meaningful here: with no cursor,\n\t\t\t// `/v1/index/blocks?limit=1` always returns a row (the default window's\n\t\t\t// oldest block), so the server would never see \"nothing new\" to wait\n\t\t\t// on. Anchoring one past the last height THIS caller saw makes the page\n\t\t\t// empty until a fresher block lands — the same signal the endpoint\n\t\t\t// already uses for a normal forward walk.\n\t\t\tif (opts?.knownHeight !== undefined) {\n\t\t\t\tparams.set(\"from_height\", String(opts.knownHeight + 1));\n\t\t\t}\n\t\t}\n\t\ttry {\n\t\t\tconst env = await this.get<IndexTipEnvelope>(\n\t\t\t\t`${this.indexBaseUrl}/v1/index/blocks?${params}`,\n\t\t\t\tthis.indexApiKey,\n\t\t\t);\n\t\t\tthis.lastTipEnvelope = env;\n\t\t\treturn env;\n\t\t} catch (err) {\n\t\t\t// An older server's `validateQueryParams` 400s on `wait`/`from_height`/\n\t\t\t// `tip_only`/`event_types` it doesn't recognize. Treat that ONE status\n\t\t\t// as \"this server predates long-poll\", not an outage: disable every\n\t\t\t// extension for the rest of this client's life (event_types is only\n\t\t\t// ever sent alongside tip_only, so gating on `wantsTipOnly` already\n\t\t\t// covers a server that knows `wait`/`tip_only` but not `event_types`\n\t\t\t// yet) and retry plainly, so `FallbackBlockSource` never mistakes a\n\t\t\t// version-skew 400 for the api being down and routes to the DB tap.\n\t\t\t// Gating on `wantsWait || wantsTipOnly` (not `wantsWait` alone)\n\t\t\t// matters mid-rollout: a server already upgraded for `wait` but not\n\t\t\t// yet for `tip_only` still 400s on the one it doesn't know, even on a\n\t\t\t// plain, non-waiting `getIndexTip()` call.\n\t\t\tif (\n\t\t\t\t(wantsWait || wantsTipOnly) &&\n\t\t\t\terr instanceof IndexHttpStatusError &&\n\t\t\t\terr.status === 400\n\t\t\t) {\n\t\t\t\tthis.waitSupported = false;\n\t\t\t\treturn this.getIndexTipEnvelope(opts);\n\t\t\t}\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\t/** Reorgs since a resume token (wall-clock `detected_at`-keyed). */\n\tasync listReorgs(\n\t\tsince: string,\n\t): Promise<{ reorgs: StreamsReorgRow[]; next_since: string | null }> {\n\t\tconst params = new URLSearchParams({ since });\n\t\treturn this.get(\n\t\t\t`${this.streamsBaseUrl}/v1/streams/reorgs?${params}`,\n\t\t\tthis.streamsApiKey,\n\t\t);\n\t}\n}\n\n/** Decoder + subgraph processor client. One env contract; omits bearer when no key. */\nexport function createInternalIndexHttpClient(): IndexHttpClient {\n\tconst baseUrl = defaultInternalIndexBaseUrl();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I,MAAM,gBAAgB,WAAW;AAAA,QACpC,OAAO,IAAI,eAAe,OAAO,KAAK,cAAc,CAAC,CAAC;AAAA,MACvD;AAAA,IACD;AAAA,IACA,IAAI;AAAA,MACH,MAAM,MAAM,MAAM,KAAK,IACtB,GAAG,KAAK,gCAAgC,UACxC,KAAK,WACN;AAAA,MACA,KAAK,kBAAkB;AAAA,MACvB,OAAO;AAAA,MACN,OAAO,KAAK;AAAA,MAab,KACE,aAAa,iBACd,eAAe,wBACf,IAAI,WAAW,KACd;AAAA,QACD,KAAK,gBAAgB;AAAA,QACrB,OAAO,KAAK,oBAAoB,IAAI;AAAA,MACrC;AAAA,MACA,MAAM;AAAA;AAAA;AAAA,OAKF,WAAU,CACf,OACoE;AAAA,IACpE,MAAM,SAAS,IAAI,gBAAgB,EAAE,MAAM,CAAC;AAAA,IAC5C,OAAO,KAAK,IACX,GAAG,KAAK,oCAAoC,UAC5C,KAAK,aACN;AAAA;AAEF;AAGO,SAAS,6BAA6B,GAAoB;AAAA,EAChE,MAAM,UAAU,4BAA4B;AAAA,EAC5C,OAAO,IAAI,gBAAgB;AAAA,IAC1B,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,aAAa,2BAA2B;AAAA,IACxC,eAAe,6BAA6B;AAAA,EAC7C,CAAC;AAAA;",
9
+ "debugId": "A19AED9BB36ED65564756E2164756E21",
10
10
  "names": []
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@secondlayer/shared",
3
- "version": "11.11.1",
3
+ "version": "11.12.0",
4
4
  "description": "Internal building blocks shared across Secondlayer packages.",
5
5
  "license": "MIT",
6
6
  "repository": {