@secondlayer/shared 18.0.1 → 19.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/src/archive/range-digest.d.ts +8 -0
  2. package/dist/src/archive/semantic-digest-builder.d.ts +8 -0
  3. package/dist/src/coverage/index.d.ts +9 -341
  4. package/dist/src/coverage/index.js +2 -751
  5. package/dist/src/coverage/index.js.map +4 -13
  6. package/dist/src/db/index.d.ts +10 -1
  7. package/dist/src/db/index.js +2 -1
  8. package/dist/src/db/index.js.map +4 -4
  9. package/dist/src/db/queries/api-keys.d.ts +38 -0
  10. package/dist/src/db/queries/api-keys.js +89 -0
  11. package/dist/src/db/queries/api-keys.js.map +11 -0
  12. package/dist/src/db/queries/chain-reorgs.d.ts +8 -0
  13. package/dist/src/db/queries/chain-reorgs.js +2 -1
  14. package/dist/src/db/queries/chain-reorgs.js.map +4 -4
  15. package/dist/src/db/queries/contracts.d.ts +8 -0
  16. package/dist/src/db/queries/contracts.js.map +2 -2
  17. package/dist/src/db/queries/instance.d.ts +8 -0
  18. package/dist/src/db/queries/integrity.d.ts +8 -0
  19. package/dist/src/db/queries/subgraph-gaps.d.ts +8 -0
  20. package/dist/src/db/queries/subgraph-operations.d.ts +8 -0
  21. package/dist/src/db/queries/subgraphs.d.ts +8 -0
  22. package/dist/src/db/queries/sync-scope.d.ts +8 -0
  23. package/dist/src/db/queries/webhook-replays.d.ts +8 -0
  24. package/dist/src/db/queries/webhooks.d.ts +8 -0
  25. package/dist/src/db/schema.d.ts +9 -1
  26. package/dist/src/db/schema.js.map +2 -2
  27. package/dist/src/index.d.ts +10 -1
  28. package/dist/src/index.js +2 -1
  29. package/dist/src/index.js.map +4 -4
  30. package/dist/src/insights/index.d.ts +8 -0
  31. package/dist/src/leader.js +2 -1
  32. package/dist/src/leader.js.map +4 -4
  33. package/dist/src/node/local-client.d.ts +8 -0
  34. package/dist/src/queue/listener.js +2 -1
  35. package/dist/src/queue/listener.js.map +4 -4
  36. package/dist/src/runtime/index.d.ts +1 -120
  37. package/dist/src/runtime/index.js +1 -310
  38. package/dist/src/runtime/index.js.map +3 -7
  39. package/dist/src/streams-rows/index.d.ts +0 -12
  40. package/dist/src/streams-rows/index.js +2 -3
  41. package/dist/src/streams-rows/index.js.map +8 -8
  42. package/migrations/0216_events_total_baseline.ts +26 -0
  43. package/package.json +6 -2
@@ -1,24 +1,15 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/coverage/constraints.ts", "../src/streams-cursor.ts", "../src/coverage/evaluate.ts", "../src/coverage/runner.ts", "../src/coverage/decoder-clock.ts", "../src/coverage/adapter.ts", "../src/coverage/sealer.ts", "../src/coverage/effect-manifest.ts", "../src/coverage/subgraph-adapter.ts", "../src/coverage/sparse.ts", "../src/coverage/deep-verify.ts", "../src/coverage/queue.ts", "../src/coverage/repair.ts", "../src/archive/datasets.ts", "../src/coverage/verify-target.ts"],
3
+ "sources": ["../src/coverage/constraints.ts", "../src/streams-cursor.ts", "../src/coverage/evaluate.ts", "../src/coverage/adapter.ts", "../src/archive/datasets.ts", "../src/coverage/verify-target.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * Coverage-kernel constraints. SQL CHECKs in migration 0116 must stay\n * identical — property tests treat this file as the spec.\n */\n\nexport const STAGE_KINDS = [\"raw\", \"decode\", \"subgraph\", \"queue\"] as const;\nexport type StageKind = (typeof STAGE_KINDS)[number];\n\nexport const NATIVE_CLOCKS = [\"block\", \"cursor\", \"queue\"] as const;\nexport type NativeClock = (typeof NATIVE_CLOCKS)[number];\n\nexport const REPAIR_MODES = [\n\t\"range_safe\",\n\t\"full_reindex\",\n\t\"archive_replay\",\n\t\"none\",\n] as const;\nexport type RepairMode = (typeof REPAIR_MODES)[number];\n\nexport const RUN_STATUSES = [\n\t\"pending\",\n\t\"running\",\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\t\"halted\",\n] as const;\nexport type RunStatus = (typeof RUN_STATUSES)[number];\n\nexport const FAILURE_UNITS = [\"block\", \"range\", \"cursor\", \"queue\"] as const;\nexport type FailureUnit = (typeof FAILURE_UNITS)[number];\n\nexport const FAILURE_CLASSES = [\n\t\"omission\",\n\t\"version\",\n\t\"digest_mismatch\",\n\t\"crash\",\n\t\"reorg\",\n\t\"source_gap\",\n\t\"handler\",\n\t\"timeout\",\n\t\"unknown\",\n] as const;\nexport type FailureClass = (typeof FAILURE_CLASSES)[number];\n\nexport const RETRY_STATES = [\"open\", \"retrying\", \"halted\", \"resolved\"] as const;\nexport type RetryState = (typeof RETRY_STATES)[number];\n\n/** Default failure retention after `created_at`. */\nexport const FAILURE_RETENTION_DAYS = 30;\n\nexport type CoverageRange = {\n\tfrom_height: number;\n\tto_height: number;\n};\n\nexport type ReceiptRow = {\n\tblock_height: number;\n\tinput_count: number;\n\tfinalized: boolean;\n\tcompacted_at: Date | null;\n};\n\nexport type FailureRow = {\n\tfrom_height: number | null;\n\tto_height: number | null;\n\tretry_state: RetryState;\n\tretry_count: number;\n\tresolved_at: Date | null;\n\tcreated_at: Date;\n\tretain_until: Date;\n};\n\nfunction isMember<T extends string>(\n\tset: readonly T[],\n\tvalue: string,\n): value is T {\n\treturn (set as readonly string[]).includes(value);\n}\n\nexport function isStageKind(value: string): value is StageKind {\n\treturn isMember(STAGE_KINDS, value);\n}\n\nexport function isNativeClock(value: string): value is NativeClock {\n\treturn isMember(NATIVE_CLOCKS, value);\n}\n\nexport function isRepairMode(value: string): value is RepairMode {\n\treturn isMember(REPAIR_MODES, value);\n}\n\nexport function isRunStatus(value: string): value is RunStatus {\n\treturn isMember(RUN_STATUSES, value);\n}\n\nexport function isFailureUnit(value: string): value is FailureUnit {\n\treturn isMember(FAILURE_UNITS, value);\n}\n\nexport function isFailureClass(value: string): value is FailureClass {\n\treturn isMember(FAILURE_CLASSES, value);\n}\n\nexport function isRetryState(value: string): value is RetryState {\n\treturn isMember(RETRY_STATES, value);\n}\n\nexport function isNonNegativeInt(value: number): boolean {\n\treturn Number.isSafeInteger(value) && value >= 0;\n}\n\nexport function rangeIsOrdered(from: number, to: number): boolean {\n\treturn isNonNegativeInt(from) && isNonNegativeInt(to) && from <= to;\n}\n\n/** Compacted receipts must already be finalized. */\nexport function receiptRetentionHolds(row: ReceiptRow): boolean {\n\tif (!isNonNegativeInt(row.block_height)) return false;\n\tif (!isNonNegativeInt(row.input_count)) return false;\n\tif (row.compacted_at !== null && !row.finalized) return false;\n\treturn true;\n}\n\nexport function failureRangeHolds(row: FailureRow): boolean {\n\tif (row.from_height !== null && !isNonNegativeInt(row.from_height)) {\n\t\treturn false;\n\t}\n\tif (row.to_height !== null && !isNonNegativeInt(row.to_height)) {\n\t\treturn false;\n\t}\n\tif (\n\t\trow.from_height !== null &&\n\t\trow.to_height !== null &&\n\t\trow.from_height > row.to_height\n\t) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\n/** Resolved rows need `resolved_at`; open rows keep `retain_until` ≥ created. */\nexport function failureRetentionHolds(row: FailureRow): boolean {\n\tif (!isNonNegativeInt(row.retry_count)) return false;\n\tif (row.retain_until.getTime() < row.created_at.getTime()) return false;\n\tif (row.retry_state === \"resolved\") return row.resolved_at !== null;\n\treturn true;\n}\n\n/** Two closed ranges on the same stage must not overlap. */\nexport function segmentsOverlap(a: CoverageRange, b: CoverageRange): boolean {\n\treturn a.from_height <= b.to_height && b.from_height <= a.to_height;\n}\n\nexport function defaultRetainUntil(createdAt: Date): Date {\n\treturn new Date(\n\t\tcreatedAt.getTime() + FAILURE_RETENTION_DAYS * 24 * 60 * 60 * 1000,\n\t);\n}\n",
5
+ "/**\n * Coverage-kernel constraints. SQL CHECKs in migration 0116 must stay\n * identical — property tests treat this file as the spec.\n */\n\nexport const STAGE_KINDS = [\"raw\", \"decode\", \"subgraph\", \"queue\"] as const;\nexport type StageKind = (typeof STAGE_KINDS)[number];\n\nexport const NATIVE_CLOCKS = [\"block\", \"cursor\", \"queue\"] as const;\nexport type NativeClock = (typeof NATIVE_CLOCKS)[number];\n\nexport const REPAIR_MODES = [\n\t\"range_safe\",\n\t\"full_reindex\",\n\t\"archive_replay\",\n\t\"none\",\n] as const;\nexport type RepairMode = (typeof REPAIR_MODES)[number];\n\nexport const RUN_STATUSES = [\n\t\"pending\",\n\t\"running\",\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\t\"halted\",\n] as const;\nexport type RunStatus = (typeof RUN_STATUSES)[number];\n\nexport const FAILURE_UNITS = [\"block\", \"range\", \"cursor\", \"queue\"] as const;\nexport type FailureUnit = (typeof FAILURE_UNITS)[number];\n\nexport const FAILURE_CLASSES = [\n\t\"omission\",\n\t\"version\",\n\t\"digest_mismatch\",\n\t\"crash\",\n\t\"reorg\",\n\t\"source_gap\",\n\t\"handler\",\n\t\"timeout\",\n\t\"unknown\",\n] as const;\nexport type FailureClass = (typeof FAILURE_CLASSES)[number];\n\nexport const RETRY_STATES = [\"open\", \"retrying\", \"halted\", \"resolved\"] as const;\nexport type RetryState = (typeof RETRY_STATES)[number];\n\n/** Default failure retention after `created_at`. */\nexport const FAILURE_RETENTION_DAYS = 30;\n\nexport type CoverageRange = {\n\tfrom_height: number;\n\tto_height: number;\n};\n\nexport type FailureRow = {\n\tfrom_height: number | null;\n\tto_height: number | null;\n\tretry_state: RetryState;\n\tretry_count: number;\n\tresolved_at: Date | null;\n\tcreated_at: Date;\n\tretain_until: Date;\n};\n\nfunction isMember<T extends string>(\n\tset: readonly T[],\n\tvalue: string,\n): value is T {\n\treturn (set as readonly string[]).includes(value);\n}\n\nexport function isStageKind(value: string): value is StageKind {\n\treturn isMember(STAGE_KINDS, value);\n}\n\nexport function isNativeClock(value: string): value is NativeClock {\n\treturn isMember(NATIVE_CLOCKS, value);\n}\n\nexport function isRepairMode(value: string): value is RepairMode {\n\treturn isMember(REPAIR_MODES, value);\n}\n\nexport function isRunStatus(value: string): value is RunStatus {\n\treturn isMember(RUN_STATUSES, value);\n}\n\nexport function isFailureUnit(value: string): value is FailureUnit {\n\treturn isMember(FAILURE_UNITS, value);\n}\n\nexport function isFailureClass(value: string): value is FailureClass {\n\treturn isMember(FAILURE_CLASSES, value);\n}\n\nexport function isRetryState(value: string): value is RetryState {\n\treturn isMember(RETRY_STATES, value);\n}\n\nexport function isNonNegativeInt(value: number): boolean {\n\treturn Number.isSafeInteger(value) && value >= 0;\n}\n\nexport function rangeIsOrdered(from: number, to: number): boolean {\n\treturn isNonNegativeInt(from) && isNonNegativeInt(to) && from <= to;\n}\n\nexport function failureRangeHolds(row: FailureRow): boolean {\n\tif (row.from_height !== null && !isNonNegativeInt(row.from_height)) {\n\t\treturn false;\n\t}\n\tif (row.to_height !== null && !isNonNegativeInt(row.to_height)) {\n\t\treturn false;\n\t}\n\tif (\n\t\trow.from_height !== null &&\n\t\trow.to_height !== null &&\n\t\trow.from_height > row.to_height\n\t) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\n/** Resolved rows need `resolved_at`; open rows keep `retain_until` ≥ created. */\nexport function failureRetentionHolds(row: FailureRow): boolean {\n\tif (!isNonNegativeInt(row.retry_count)) return false;\n\tif (row.retain_until.getTime() < row.created_at.getTime()) return false;\n\tif (row.retry_state === \"resolved\") return row.resolved_at !== null;\n\treturn true;\n}\n\nexport function defaultRetainUntil(createdAt: Date): Date {\n\treturn new Date(\n\t\tcreatedAt.getTime() + FAILURE_RETENTION_DAYS * 24 * 60 * 60 * 1000,\n\t);\n}\n",
6
6
  "/**\n * Canonical Streams cursor codec, shared by every product (Streams, Index,\n * Datasets, bulk). A cursor is `\"<block_height>:<event_index>\"` — an opaque,\n * monotonic resume token. One implementation so encode/decode and the\n * empty-range sentinel can never drift between products.\n *\n * NOTE: this codec IS the shared piece worth centralizing. A broader \"shared\n * canonical reader\" across the ~10 raw-event query sites (streams-events,\n * streams-bulk/query, l2/storage) was deliberately NOT built: those sites split\n * into distinct query patterns and share only the row_number ordering *pattern*,\n * not an identical reader. The reorg-archive design (migration 0084) keeps the\n * main tables canonical-only, so each reader's `WHERE canonical` filter already\n * needs no dedup logic. Forcing one mega-reader was the wrong abstraction; this\n * codec captures the only part that actually drifts.\n */\n\nexport type StreamsCursor = {\n\tblock_height: number;\n\tevent_index: number;\n};\n\n/**\n * Event index used to advance a cursor past a fully-filtered range instead of\n * returning null. A filter that eliminates every event in a scanned range would\n * otherwise pin the consumer at the previous cursor and spin forever. Must fit\n * in Postgres int4 (the `stream_event_index` column type) — int4 max is plenty,\n * real blocks have far fewer than ~2.1B events.\n */\nexport const EMPTY_RANGE_EVENT_INDEX_SENTINEL = 2_147_483_647;\n\nexport function encodeStreamsCursor(cursor: StreamsCursor): string {\n\treturn `${cursor.block_height}:${cursor.event_index}`;\n}\n\nexport function decodeStreamsCursor(cursor: string): StreamsCursor {\n\tconst match = /^(0|[1-9]\\d*):(0|[1-9]\\d*)$/.exec(cursor);\n\tif (!match) {\n\t\tthrow new Error(\"Invalid Streams cursor\");\n\t}\n\n\tconst decoded = {\n\t\tblock_height: Number(match[1]),\n\t\tevent_index: Number(match[2]),\n\t};\n\n\tif (\n\t\t!Number.isSafeInteger(decoded.block_height) ||\n\t\t!Number.isSafeInteger(decoded.event_index)\n\t) {\n\t\tthrow new Error(\"Invalid Streams cursor\");\n\t}\n\n\treturn decoded;\n}\n\n/**\n * Which feed a cursor belongs to. Classic Stacks Streams cursors stay bare\n * `<h>:<n>` (the 1.0 contract); the Bitcoin and vm feeds are prefixed so a\n * cursor from one feed can never silently resume another.\n */\nexport type StreamsCursorFeed = \"stacks\" | \"btc\" | \"vm\";\n\nconst FEED_TAGS = [\"btc\", \"vm\"] as const;\n\n/** Raised when a cursor carries another feed's tag. */\nexport class StreamsCursorFeedMismatchError extends Error {\n\tconstructor(\n\t\treadonly expected: StreamsCursorFeed,\n\t\treadonly actual: StreamsCursorFeed,\n\t) {\n\t\tsuper(\n\t\t\t`cursor belongs to the ${actual} feed; this request reads the ${expected} feed`,\n\t\t);\n\t\tthis.name = \"StreamsCursorFeedMismatchError\";\n\t}\n}\n\n/** Encode for a feed: `btc:`/`vm:` prefix, bare for classic Stacks. */\nexport function encodeFeedCursor(\n\tfeed: StreamsCursorFeed,\n\tcursor: StreamsCursor,\n): string {\n\tconst bare = encodeStreamsCursor(cursor);\n\treturn feed === \"stacks\" ? bare : `${feed}:${bare}`;\n}\n\n/**\n * Decode a cursor, reporting its tag. Untagged reports `feed: null` (the bare\n * form every feed has always accepted). Throws on malformed input.\n */\nexport function decodeTaggedStreamsCursor(raw: string): {\n\tfeed: \"btc\" | \"vm\" | null;\n\tcursor: StreamsCursor;\n} {\n\tfor (const tag of FEED_TAGS) {\n\t\tif (raw.startsWith(`${tag}:`)) {\n\t\t\treturn {\n\t\t\t\tfeed: tag,\n\t\t\t\tcursor: decodeStreamsCursor(raw.slice(tag.length + 1)),\n\t\t\t};\n\t\t}\n\t}\n\treturn { feed: null, cursor: decodeStreamsCursor(raw) };\n}\n\n/**\n * Decode a cursor for a specific feed. Untagged is accepted by every feed (the\n * legacy spelling); a tag for another feed throws\n * {@link StreamsCursorFeedMismatchError}.\n */\nexport function decodeFeedCursor(\n\traw: string,\n\tfeed: StreamsCursorFeed,\n): StreamsCursor {\n\tconst decoded = decodeTaggedStreamsCursor(raw);\n\tif (decoded.feed !== null && decoded.feed !== feed) {\n\t\tthrow new StreamsCursorFeedMismatchError(feed, decoded.feed);\n\t}\n\treturn decoded.cursor;\n}\n\nexport function compareStreamsCursor(\n\ta: StreamsCursor,\n\tb: StreamsCursor,\n): number {\n\tif (a.block_height !== b.block_height) {\n\t\treturn a.block_height < b.block_height ? -1 : 1;\n\t}\n\tif (a.event_index !== b.event_index) {\n\t\treturn a.event_index < b.event_index ? -1 : 1;\n\t}\n\treturn 0;\n}\n\nexport function isEmptyRangeCursor(cursor: StreamsCursor): boolean {\n\treturn cursor.event_index === EMPTY_RANGE_EVENT_INDEX_SENTINEL;\n}\n\n/**\n * Highest height a cursor has fully committed. Mid-block (`H:n`, n not the\n * empty-range sentinel) means the rest of H is still in flight — the\n * committed floor is H-1. Sentinel `H:2147483647` means H is done. One\n * implementation shared by every reader of a decoder/consumer checkpoint\n * (Subgraphs' `decoderBoundTip`, the Index `/public/status` route) so the\n * rule can never drift between them.\n */\nexport function committedHeight(\n\tcursor: string | null | undefined,\n): number | null {\n\tif (!cursor) return null;\n\ttry {\n\t\tconst decoded = decodeStreamsCursor(cursor);\n\t\tif (isEmptyRangeCursor(decoded)) return decoded.block_height;\n\t\treturn Math.max(0, decoded.block_height - 1);\n\t} catch {\n\t\treturn null;\n\t}\n}\n\n/** Exclusive end of every event that can live in `height`. */\nexport function blockEndCursor(height: number): StreamsCursor {\n\treturn {\n\t\tblock_height: height,\n\t\tevent_index: EMPTY_RANGE_EVENT_INDEX_SENTINEL,\n\t};\n}\n",
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
- "/**\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
- "/**\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
8
  "/**\n * Atomic decoder adapter.\n *\n * One transaction writes decoded output, the decoder checkpoint, and an\n * optional failure. A crash after any step rolls all three back.\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\";\n\nexport const DECODER_COMMIT_STEPS = [\n\t\"output\",\n\t\"checkpoint\",\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 DecoderAdapterCommit = {\n\tstage_id: string;\n\tdecoder_name: string;\n\t/** Null = do not move the checkpoint (empty page). */\n\tcheckpoint_cursor: string | null;\n\tfailure?: DecoderAdapterFailure | null;\n\twriteOutput: (tx: Kysely<Database>) => Promise<void>;\n\t/** Rows `writeOutput` writes. When > 0 the commit stamps\n\t * `decoder_checkpoints.last_output_at`, which decoder health reads. */\n\toutput_count?: number;\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\nasync function stampLastOutput(\n\ttx: Kysely<Database>,\n\tinput: Pick<DecoderAdapterCommit, \"decoder_name\" | \"output_count\">,\n): Promise<void> {\n\tif (!input.output_count || input.output_count <= 0) return;\n\tawait tx\n\t\t.updateTable(\"decoder_checkpoints\")\n\t\t.set({ last_output_at: sql`now()` })\n\t\t.where(\"decoder_name\", \"=\", input.decoder_name)\n\t\t.execute();\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\nconst CHECKPOINT_CURSOR = /^(\\d+):(\\d+)$/;\n\n/**\n * Set a decoder's checkpoint to `cursor`, backward or forward. The one\n * unconditional checkpoint writer: reorg handlers rewind decoders to the fork\n * point through it, and reset tools reposition them. The commit path\n * (`writeCheckpoint`) only moves forward.\n */\nexport async function rewindDecoderCheckpoint(\n\tdb: Kysely<Database>,\n\tdecoderName: string,\n\tcursor: string | null,\n): Promise<void> {\n\tawait db\n\t\t.insertInto(\"decoder_checkpoints\")\n\t\t.values({ decoder_name: decoderName, last_cursor: cursor })\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\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// Forward-only: the guard compares the parsed `(height, index)`, never the\n\t// text, and only a strictly greater cursor writes. A commit built from a\n\t// stale read (a slow batch finishing after a faster one, a retry replaying\n\t// an old page) is skipped instead of moving the checkpoint backward and\n\t// making the decoder re-emit rows. Equal cursors skip too, which is the\n\t// compare-and-skip above. A reorg rewinds through `rewindDecoderCheckpoint`.\n\t// An unset or unparseable stored cursor counts as behind: `last_cursor`\n\t// starts NULL for a decoder that has never committed, and SQL's\n\t// `NULL < x` is NULL (falsy), which would drop the very first commit.\n\tconst parsed = CHECKPOINT_CURSOR.exec(cursor);\n\tif (!parsed) {\n\t\tthrow new Error(\n\t\t\t`decoder checkpoint cursor must be \"<height>:<index>\", got \"${cursor}\" (${decoderName})`,\n\t\t);\n\t}\n\tconst height = parsed[1] as string;\n\tconst index = parsed[2] as string;\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(\n\t\t\t\t\tsql<boolean>`(\n\t\t\t\t\t\tdecoder_checkpoints.last_cursor IS NULL\n\t\t\t\t\t\tOR decoder_checkpoints.last_cursor !~ '^[0-9]+:[0-9]+$'\n\t\t\t\t\t\tOR (\n\t\t\t\t\t\t\tsplit_part(decoder_checkpoints.last_cursor, ':', 1)::bigint,\n\t\t\t\t\t\t\tsplit_part(decoder_checkpoints.last_cursor, ':', 2)::bigint\n\t\t\t\t\t\t) < (${height}::bigint, ${index}::bigint)\n\t\t\t\t\t)`,\n\t\t\t\t),\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) 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 writeFailure(\n\ttx: Kysely<Database>,\n\tstageId: string,\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\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 + failure in one transaction. The registry row\n * is upserted only when a failure is written, to satisfy the\n * `stage_failures.stage_id` foreign key.\n *\n * No production caller (decoders use the batch form); kept as the exported\n * single-decoder entry point and covered by decoder-adapter-crash.test.ts.\n */\nexport async function commitDecoderAdapter(\n\tdb: Kysely<Database>,\n\tinput: DecoderAdapterCommit,\n): Promise<void> {\n\tconst failure = input.failure ?? null;\n\tawait db.transaction().execute(async (tx) => {\n\t\tawait runDecoderCommitSteps(\n\t\t\t{\n\t\t\t\toutput: () => input.writeOutput(tx),\n\t\t\t\tcheckpoint: async () => {\n\t\t\t\t\tawait writeCheckpoint(\n\t\t\t\t\t\ttx,\n\t\t\t\t\t\tinput.decoder_name,\n\t\t\t\t\t\tinput.checkpoint_cursor,\n\t\t\t\t\t);\n\t\t\t\t\tawait stampLastOutput(tx, input);\n\t\t\t\t},\n\t\t\t\tfailure: async () => {\n\t\t\t\t\tif (!failure) return;\n\t\t\t\t\tawait upsertRegistry(tx, input.stage_id);\n\t\t\t\t\tawait writeFailure(tx, input.stage_id, failure);\n\t\t\t\t},\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: 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 three PASSES across the whole batch, not step-by-step per\n * entry, so the global order stays output → checkpoint → 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 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 stampLastOutput(tx, input);\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 upsertRegistry(tx, input.stage_id);\n\t\t\t\tawait writeFailure(tx, input.stage_id, failure);\n\t\t\t}\n\t\t}\n\t});\n}\n",
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
- "/**\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
- "/**\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",
14
- "/**\n * Sparse proofs — acknowledge skipped canonical ranges without handler\n * execution. Sparse and sequential paths must agree on chain / effect /\n * final-row digests.\n */\n\nimport { createHash } from \"node:crypto\";\nimport type { CoverageRange } from \"./constraints.ts\";\nimport { type EffectMutation, hashEffectManifest } from \"./effect-manifest.ts\";\nimport { rangeDigestOf } from \"./sealer.ts\";\n\nexport type SparseSkip = CoverageRange & { reason: \"no-match\" | \"filtered\" };\n\nexport type HeightDigest = {\n\theight: number;\n\thash: string;\n\teffect_digest: string;\n\trow_digest: string;\n};\n\nexport function skipReceipt(skip: SparseSkip, chainHash: string): HeightDigest {\n\tconst empty = hashEffectManifest([]);\n\treturn {\n\t\theight: skip.from_height,\n\t\thash: chainHash,\n\t\teffect_digest: empty,\n\t\trow_digest: empty,\n\t};\n}\n\nexport function sequentialDigests(heights: readonly HeightDigest[]): {\n\tchain: string;\n\teffect: string;\n\trow: string;\n} {\n\tconst ordered = [...heights].sort((a, b) => a.height - b.height);\n\treturn {\n\t\tchain: rangeDigestOf(ordered.map((h) => `${h.height}:${h.hash}`)),\n\t\teffect: rangeDigestOf(ordered.map((h) => h.effect_digest)),\n\t\trow: rangeDigestOf(ordered.map((h) => h.row_digest)),\n\t};\n}\n\nexport function sparseDigests(\n\texecuted: readonly HeightDigest[],\n\tskips: readonly { skip: SparseSkip; hash: string }[],\n): { chain: string; effect: string; row: string } {\n\tconst skipped = skips.flatMap(({ skip, hash }) => {\n\t\tconst out: HeightDigest[] = [];\n\t\tfor (let h = skip.from_height; h <= skip.to_height; h++) {\n\t\t\tout.push(skipReceipt({ ...skip, from_height: h, to_height: h }, hash));\n\t\t}\n\t\treturn out;\n\t});\n\treturn sequentialDigests([...executed, ...skipped]);\n}\n\nexport function proofsAgree(\n\tsequential: { chain: string; effect: string; row: string },\n\tsparse: { chain: string; effect: string; row: string },\n): boolean {\n\treturn (\n\t\tsequential.chain === sparse.chain &&\n\t\tsequential.effect === sparse.effect &&\n\t\tsequential.row === sparse.row\n\t);\n}\n\nexport function emptyRowDigest(): string {\n\treturn createHash(\"sha256\").update(\"empty-row\\n\").digest(\"hex\");\n}\n\nexport type { EffectMutation };\n",
15
- "/**\n * Stateful deep verify — replay into a scratch schema and compare the\n * canonical final-row digest. A seeded historical mutation must be found.\n */\n\nimport { createHash } from \"node:crypto\";\nimport { type EffectMutation, hashEffectManifest } from \"./effect-manifest.ts\";\n\nexport type RowSnapshot = {\n\ttable: string;\n\tkey: string;\n\tvalue: string;\n};\n\nexport function finalRowDigest(rows: readonly RowSnapshot[]): string {\n\tconst ordered = [...rows].sort(\n\t\t(a, b) => a.table.localeCompare(b.table) || a.key.localeCompare(b.key),\n\t);\n\tconst hash = createHash(\"sha256\");\n\tfor (const row of ordered) {\n\t\thash.update(`${row.table}\\t${row.key}\\t${row.value}\\n`);\n\t}\n\treturn hash.digest(\"hex\");\n}\n\nexport function applyMutations(\n\trows: readonly RowSnapshot[],\n\tops: readonly EffectMutation[],\n): RowSnapshot[] {\n\tconst map = new Map(rows.map((r) => [`${r.table}:${r.key}`, { ...r }]));\n\tfor (const op of ops) {\n\t\tconst id = String(op.key.id ?? JSON.stringify(op.key));\n\t\tconst k = `${op.table}:${id}`;\n\t\tif (op.op === \"delete\") {\n\t\t\tmap.delete(k);\n\t\t\tcontinue;\n\t\t}\n\t\tmap.set(k, {\n\t\t\ttable: op.table,\n\t\t\tkey: id,\n\t\t\tvalue: JSON.stringify(op.value ?? {}),\n\t\t});\n\t}\n\treturn [...map.values()];\n}\n\nexport type DeepVerifyResult = {\n\tok: boolean;\n\tlive_digest: string;\n\tscratch_digest: string;\n\tfound_mutation: boolean;\n};\n\nexport function deepVerify(opts: {\n\tlive: readonly RowSnapshot[];\n\treplay: readonly EffectMutation[];\n\tseed?: EffectMutation;\n}): DeepVerifyResult {\n\tconst scratch = applyMutations([], opts.replay);\n\tconst liveDigest = finalRowDigest(opts.live);\n\tconst scratchDigest = finalRowDigest(scratch);\n\tlet found = false;\n\tif (opts.seed) {\n\t\tconst tainted = applyMutations(opts.live, [opts.seed]);\n\t\tfound = finalRowDigest(tainted) !== liveDigest;\n\t}\n\treturn {\n\t\tok: liveDigest === scratchDigest,\n\t\tlive_digest: liveDigest,\n\t\tscratch_digest: scratchDigest,\n\t\tfound_mutation: found,\n\t};\n}\n\nexport function emptyManifestHash(): string {\n\treturn hashEffectManifest([]);\n}\n",
16
- "/**\n * Queue coverage — webhook decision, outbox, delivery, rollback,\n * DLQ, and replay with cursor fences.\n */\n\nimport type { QueueCounters } from \"./evaluate.ts\";\n\nexport const QUEUE_STAGES = [\n\t\"decision\",\n\t\"outbox\",\n\t\"delivery\",\n\t\"rollback\",\n\t\"dlq\",\n\t\"replay\",\n] as const;\nexport type QueueStage = (typeof QUEUE_STAGES)[number];\n\nexport type QueueEvent =\n\t| { type: \"accept\" }\n\t| { type: \"decide\"; matched: boolean }\n\t| { type: \"enqueue\" }\n\t| { type: \"deliver\" }\n\t| { type: \"fail\" }\n\t| { type: \"dead\" }\n\t| { type: \"requeue\" }\n\t| { type: \"rollback\" }\n\t| { type: \"replay\"; cursor: string };\n\nexport type QueueState = QueueCounters & {\n\tstage: QueueStage;\n\tlast_cursor: string | null;\n\tdedupe: Set<string>;\n};\n\nexport function emptyQueueState(): QueueState {\n\treturn {\n\t\tstage: \"decision\",\n\t\taccepted: 0,\n\t\tdecided: 0,\n\t\tenqueued: 0,\n\t\tdelivered: 0,\n\t\tdead: 0,\n\t\tfence_cursor: null,\n\t\tlast_cursor: null,\n\t\tdedupe: new Set(),\n\t};\n}\n\nexport type QueueApply =\n\t| { ok: true; state: QueueState }\n\t| { ok: false; reason: string; state: QueueState };\n\nexport function applyQueueEvent(\n\tstate: QueueState,\n\tevent: QueueEvent,\n\tdedupeKey?: string,\n): QueueApply {\n\tif (dedupeKey && state.dedupe.has(dedupeKey)) {\n\t\treturn { ok: true, state };\n\t}\n\tconst next: QueueState = {\n\t\t...state,\n\t\tdedupe: new Set(state.dedupe),\n\t};\n\tif (dedupeKey) next.dedupe.add(dedupeKey);\n\n\tswitch (event.type) {\n\t\tcase \"accept\":\n\t\t\tnext.accepted += 1;\n\t\t\tnext.stage = \"decision\";\n\t\t\treturn { ok: true, state: next };\n\t\tcase \"decide\":\n\t\t\tif (next.decided >= next.accepted) {\n\t\t\t\treturn { ok: false, reason: \"decide without accept\", state };\n\t\t\t}\n\t\t\tnext.decided += 1;\n\t\t\tnext.stage = event.matched ? \"outbox\" : \"decision\";\n\t\t\treturn { ok: true, state: next };\n\t\tcase \"enqueue\":\n\t\t\tif (next.enqueued >= next.decided) {\n\t\t\t\treturn { ok: false, reason: \"enqueue without decide\", state };\n\t\t\t}\n\t\t\tnext.enqueued += 1;\n\t\t\tnext.stage = \"outbox\";\n\t\t\treturn { ok: true, state: next };\n\t\tcase \"deliver\":\n\t\t\tif (next.delivered + next.dead >= next.enqueued) {\n\t\t\t\treturn { ok: false, reason: \"deliver without enqueue\", state };\n\t\t\t}\n\t\t\tnext.delivered += 1;\n\t\t\tnext.stage = \"delivery\";\n\t\t\treturn { ok: true, state: next };\n\t\tcase \"fail\":\n\t\t\tnext.stage = \"delivery\";\n\t\t\treturn { ok: true, state: next };\n\t\tcase \"dead\":\n\t\t\tif (next.delivered + next.dead >= next.enqueued) {\n\t\t\t\treturn { ok: false, reason: \"dead without enqueue\", state };\n\t\t\t}\n\t\t\tnext.dead += 1;\n\t\t\tnext.stage = \"dlq\";\n\t\t\treturn { ok: true, state: next };\n\t\tcase \"requeue\":\n\t\t\tif (next.dead < 1)\n\t\t\t\treturn { ok: false, reason: \"requeue empty dlq\", state };\n\t\t\tnext.dead -= 1;\n\t\t\tnext.enqueued += 1;\n\t\t\tnext.stage = \"outbox\";\n\t\t\treturn { ok: true, state: next };\n\t\tcase \"rollback\":\n\t\t\tnext.stage = \"rollback\";\n\t\t\treturn { ok: true, state: next };\n\t\tcase \"replay\":\n\t\t\tnext.stage = \"replay\";\n\t\t\tnext.last_cursor = event.cursor;\n\t\t\tnext.fence_cursor = event.cursor;\n\t\t\treturn { ok: true, state: next };\n\t}\n}\n\nexport function queueCaughtUp(state: QueueState): boolean {\n\treturn (\n\t\tstate.accepted === state.decided &&\n\t\tstate.delivered + state.dead === state.enqueued\n\t);\n}\n",
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
9
  "/**\n * The canonical archive's datasets — the one list every exporter, loader,\n * verifier and fetch gate derives from.\n *\n * Order is load order: each dataset's foreign keys point only at datasets\n * earlier in the list, so loading in this order never violates a constraint.\n *\n * Per-dataset code branches with an exhaustive `switch` ending in\n * `assertNeverDataset`, never a trailing default: adding a dataset here must\n * fail to compile everywhere it needs its own schema, SQL or table, instead of\n * silently inheriting another dataset's.\n */\nexport const ARCHIVE_DATASETS = [\n\t\"blocks\",\n\t\"transactions\",\n\t\"events\",\n\t\"state_writes\",\n] as const;\n\n/** One archive dataset: blocks, transactions, events or state writes. */\nexport type ArchiveDataset = (typeof ARCHIVE_DATASETS)[number];\n\nexport function isArchiveDataset(value: string): value is ArchiveDataset {\n\treturn (ARCHIVE_DATASETS as readonly string[]).includes(value);\n}\n\n/**\n * Datasets a manifest may leave out. The exporter publishes `state_writes`\n * only from an instance that holds it from the start of the exported range,\n * so a manifest without it means \"not published\", never \"empty\": consumers\n * must not treat its absence as zero rows, or as rows missing locally.\n * The core datasets are always published; a manifest that lacks one of them\n * is incomplete, and consumers say so.\n */\nconst OPTIONAL_DATASET: Record<ArchiveDataset, boolean> = {\n\tblocks: false,\n\ttransactions: false,\n\tevents: false,\n\tstate_writes: true,\n};\n\nexport function isOptionalDataset(dataset: ArchiveDataset): boolean {\n\treturn OPTIONAL_DATASET[dataset];\n}\n\n/**\n * Whether a manifest publishes a dataset: always for a core dataset, and for\n * an optional one only when it names at least one partition or zero-record\n * range of it.\n */\nexport function manifestPublishes(\n\tmanifest: {\n\t\tpartitions?: ReadonlyArray<{ dataset: string }>;\n\t\tzero_record_ranges?: ReadonlyArray<{ dataset: string }>;\n\t},\n\tdataset: ArchiveDataset,\n): boolean {\n\tif (!isOptionalDataset(dataset)) return true;\n\treturn (\n\t\t(manifest.partitions ?? []).some((p) => p.dataset === dataset) ||\n\t\t(manifest.zero_record_ranges ?? []).some((z) => z.dataset === dataset)\n\t);\n}\n\n/**\n * The column a dataset's rows are placed at a height by. Each dataset is\n * stored in the table of the same name.\n */\nexport function archiveHeightColumn(\n\tdataset: ArchiveDataset,\n): \"height\" | \"block_height\" {\n\tswitch (dataset) {\n\t\tcase \"blocks\":\n\t\t\treturn \"height\";\n\t\tcase \"transactions\":\n\t\tcase \"events\":\n\t\tcase \"state_writes\":\n\t\t\treturn \"block_height\";\n\t\tdefault:\n\t\t\treturn assertNeverDataset(dataset);\n\t}\n}\n\nexport function assertNeverDataset(dataset: never): never {\n\tthrow new Error(`unhandled archive dataset: ${String(dataset)}`);\n}\n",
19
10
  "/**\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\nimport { ARCHIVE_DATASETS } from \"../archive/datasets.ts\";\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<string>(ARCHIVE_DATASETS);\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.target,\n\t\tmode,\n\t\texit: VERIFY_EXIT.CLEAN,\n\t\tstatus: \"clean\",\n\t\tdetail: opts.detail ?? `${label} ${mode} is clean`,\n\t};\n}\n"
20
11
  ],
21
- "mappings": ";AAKO,IAAM,cAAc,CAAC,OAAO,UAAU,YAAY,OAAO;AAGzD,IAAM,gBAAgB,CAAC,SAAS,UAAU,OAAO;AAGjD,IAAM,eAAe;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAGO,IAAM,eAAe;AAAA,EAC3B;AAA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C,KAAK,SAAS,IAAI,OAAO,KAAK,YAAY,GAAG;AAAA,EAE/C;AAAA,EACA,OACC,SAAS,OAAO,KAAK,YAAY,KACjC,SAAS,YAAY,OAAO,KAAK,YAAY,OAC7C,KAAK,WAAW,GAAG,OAAO,KAAK,YAAY,IAAI;AAAA;AAY1C,SAAS,YAAY,CAAC,MAMZ;AAAA,EAChB,MAAM,OAAO,KAAK,QAAQ;AAAA,EAC1B,IAAI,KAAK,aAAa,OAAO;AAAA,IAC5B,OAAO;AAAA,MACN,QAAQ,KAAK;AAAA,MACb;AAAA,MACA,MAAM,YAAY;AAAA,MAClB,QAAQ;AAAA,MACR,QAAQ,KAAK,UAAU;AAAA,IACxB;AAAA,EACD;AAAA,EACA,IAAI,KAAK,UAAU;AAAA,IAClB,OAAO;AAAA,MACN,QAAQ,KAAK;AAAA,MACb;AAAA,MACA,MAAM,YAAY;AAAA,MAClB,QAAQ;AAAA,MACR,QAAQ,KAAK,UAAU;AAAA,IACxB;AAAA,EACD;AAAA,EACA,MAAM,QACL,KAAK,OAAO,SAAS,WAClB,UAAU,KAAK,OAAO,SACtB,KAAK,OAAO,SAAS,aACpB,YAAY,KAAK,OAAO,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;",
13
+ "debugId": "2F5050ACBA49472D64756E2164756E21",
23
14
  "names": []
24
15
  }
@@ -718,6 +718,13 @@ interface BnsNamespacesTable {
718
718
  * `index_block_hash` marks a caller-declared contract-constant value, cached
719
719
  * once per contract+args instead of once per block.
720
720
  */
721
+ interface EventsTotalBaselineTable {
722
+ id: Generated<boolean>;
723
+ through: ColumnType<number | null, number | null | undefined, number | null>;
724
+ count: ColumnType<string | null, string | number | null | undefined, string | number | null>;
725
+ taken_at: Date | null;
726
+ claimed_at: Date | null;
727
+ }
721
728
  interface ChainReadCacheTable {
722
729
  id: Generated<number>;
723
730
  contract_id: string;
@@ -861,6 +868,7 @@ interface Database {
861
868
  bns_namespaces: BnsNamespacesTable;
862
869
  service_heartbeats: ServiceHeartbeatsTable;
863
870
  chain_read_cache: ChainReadCacheTable;
871
+ events_total_baseline: EventsTotalBaselineTable;
864
872
  pending_fork_blocks: PendingForkBlocksTable;
865
873
  observer_journal: ObserverJournalTable;
866
874
  sync_scopes: SyncScopesTable;
@@ -2238,6 +2246,7 @@ declare const TABLE_TO_DB: {
2238
2246
  contracts: string
2239
2247
  chain_reorgs: string
2240
2248
  chain_read_cache: string
2249
+ events_total_baseline: string
2241
2250
  pending_fork_blocks: string
2242
2251
  observer_journal: string
2243
2252
  sync_scopes: string
@@ -2403,4 +2412,4 @@ declare function closeDb(): Promise<void>;
2403
2412
  * actual work is done.
2404
2413
  */
2405
2414
  declare function closeDbOrTimeout(timeoutMs?: number, closeFn?: () => Promise<void>): Promise<void>;
2406
- export { ABI_STATUSES, AbiStatus, Account, AccountBalanceAlerts, AccountBalanceAlertsTable, AccountCredits, AccountCreditsTable, AccountSpendCap, AccountSpendCapsTable, AccountsTable, ApiFailedRequest, ApiFailedRequestsTable, ApiKey, ApiKeyStatus, ApiKeysTable, ApiRequestLogRow, ApiRequestLogTable, ArchiveFetch, ArchiveFetchesTable, Block, BlocksTable, BnsMarketplaceAction, BnsMarketplaceEventsTable, BnsNameEventTopic, BnsNameEventsTable, BnsNamesTable, BnsNamespaceEventStatus, BnsNamespaceEventsTable, BnsNamespacesTable, BurnBlockRewardSlotsTable, BurnBlockRewardsTable, ChainReadCacheTable, ChainReorgsTable, CliDeviceLogin, CliDeviceLoginStatus, CliDeviceLoginsTable, CliDeviceProduct, ContactRequest, ContactRequestsTable, Contract, ContractsTable, Database, DbPlane, DbReadRow, DbSplitStatus, DeadLetterEventsTable, DeadReason, DecodedEventsTable, DecoderCheckpointsTable, Event, EventsArchiveTable, EventsTable, FailureClass, FailureUnit, FeedbackTicket, FeedbackTicketsTable, GapReason, HostedStackStateTable, IndexColumn, IndexColumnType, IndexPrimaryKey, IndexProgress, IndexProgressTable, InsertAccount, InsertAccountBalanceAlerts, InsertAccountCredits, InsertAccountSpendCap, InsertApiFailedRequest, InsertApiKey, InsertApiRequestLogRow, InsertArchiveFetch, InsertBlock, InsertContactRequest, InsertContract, InsertEvent, InsertFeedbackTicket, InsertIndexProgress, InsertMagicLink, InsertMempoolTransaction, InsertSession, InsertStateWrite, InsertSubgraph, InsertSubgraphGap, InsertSubgraphHealthSnapshot, InsertSubgraphOperation, InsertTransaction, InsertUpdateSubscriber, InsertUsageLedgerRow, InsertVmEvent, InsertWaitlistSignup, InsertWebhook, InsertWebhookDelivery, InsertWebhookOutbox, InsightMutesTable, InsightsTable, InstancesTable, MagicLink, MagicLinksTable, MempoolTransaction, MempoolTransactionsTable, MigrationRole, NativeClock, NumericAsText, OBSERVER_JOURNAL_STATUSES, OauthClient, OauthClientsTable, OauthCodesTable, OauthGrant, OauthGrantsTable, OauthRefreshRetiredTable, OauthRequestStatus, OauthRequestsTable, OauthTokenKind, OauthTokensTable, ObserverJournalStatus, ObserverJournalTable, OutboxStatus, PendingForkBlocksTable, Pox5CycleSignersTable, Pox5CyclesTable, Pox5EventTopic, Pox5EventsTable, ProcessedStripeEventsTable, PushPrefs, PushPrefsTable, PushSentTable, PushSubscription, PushSubscriptionsTable, RepairMode, RetryState, RunStatus, SOURCE_READ_COLUMNS, SOURCE_READ_PKS, SOURCE_READ_TYPES, SbtcEventTopic, SbtcEventsTable, SbtcSettlementsTable, SentinelAccount, SentinelAccountsTable, ServiceHeartbeatsTable, Session, SessionsTable, StageFailuresTable, StageKind, StageRegistryTable, StateWrite, StateWritesArchiveTable, StateWritesTable, Subgraph, SubgraphErrorGroupsTable, SubgraphGap, SubgraphGapsTable, SubgraphHealthSnapshot, SubgraphHealthSnapshotsTable, SubgraphOperation, SubgraphOperationKind, SubgraphOperationStatus, SubgraphOperationsTable, SubgraphProcessingStatsTable, SubgraphViolationsTable, SubgraphsTable, SyncScopesTable, TABLE_TO_DB, Transaction, TransactionsArchiveTable, TransactionsTable, TriggerEvaluatorState, TriggerEvaluatorStateTable, UpdateAccountBalanceAlerts, UpdateAccountCredits, UpdateAccountSpendCap, UpdateApiKey, UpdateArchiveFetch, UpdateBlock, UpdateContract, UpdateEvent, UpdateIndexProgress, UpdateSendsTable, UpdateSubgraph, UpdateSubgraphOperation, UpdateSubscriber, UpdateSubscribersTable, UpdateTransaction, UpdateUsageLedgerRow, UpdateVmEvent, UpdateWebhook, UpdateWebhookOutbox, UsageLedgerRow, UsageLedgerTable, VmEvent, VmEventsArchiveTable, VmEventsTable, Waitlist, WaitlistSignup, WaitlistSignupsTable, WaitlistsTable, Webhook, WebhookDeliveriesTable, WebhookDelivery, WebhookDeliveryHoursTable, WebhookFormat, WebhookIncidentAlert, WebhookIncidentAlertsTable, WebhookKind, WebhookOutbox, WebhookOutboxTable, WebhookPauseReason, WebhookReplay, WebhookReplayStatus, WebhookReplaysTable, WebhookStatus, WebhooksTable, applicationDatabaseUrl, assertDbSplit, closeDb, closeDbOrTimeout, configuredSourceUrl, configuredTargetUrl, describeDbUrl, getDb, getDbSplitStatus, getMigrationRole, getRawClient, getSourceDb, getTargetDb, jsonb, onChainPlane, onControlPlane, parseJsonb, resolveSourceUrl, resolveTargetUrl, setMigrationRole, sql };
2415
+ export { ABI_STATUSES, AbiStatus, Account, AccountBalanceAlerts, AccountBalanceAlertsTable, AccountCredits, AccountCreditsTable, AccountSpendCap, AccountSpendCapsTable, AccountsTable, ApiFailedRequest, ApiFailedRequestsTable, ApiKey, ApiKeyStatus, ApiKeysTable, ApiRequestLogRow, ApiRequestLogTable, ArchiveFetch, ArchiveFetchesTable, Block, BlocksTable, BnsMarketplaceAction, BnsMarketplaceEventsTable, BnsNameEventTopic, BnsNameEventsTable, BnsNamesTable, BnsNamespaceEventStatus, BnsNamespaceEventsTable, BnsNamespacesTable, BurnBlockRewardSlotsTable, BurnBlockRewardsTable, ChainReadCacheTable, ChainReorgsTable, CliDeviceLogin, CliDeviceLoginStatus, CliDeviceLoginsTable, CliDeviceProduct, ContactRequest, ContactRequestsTable, Contract, ContractsTable, Database, DbPlane, DbReadRow, DbSplitStatus, DeadLetterEventsTable, DeadReason, DecodedEventsTable, DecoderCheckpointsTable, Event, EventsArchiveTable, EventsTable, EventsTotalBaselineTable, FailureClass, FailureUnit, FeedbackTicket, FeedbackTicketsTable, GapReason, HostedStackStateTable, IndexColumn, IndexColumnType, IndexPrimaryKey, IndexProgress, IndexProgressTable, InsertAccount, InsertAccountBalanceAlerts, InsertAccountCredits, InsertAccountSpendCap, InsertApiFailedRequest, InsertApiKey, InsertApiRequestLogRow, InsertArchiveFetch, InsertBlock, InsertContactRequest, InsertContract, InsertEvent, InsertFeedbackTicket, InsertIndexProgress, InsertMagicLink, InsertMempoolTransaction, InsertSession, InsertStateWrite, InsertSubgraph, InsertSubgraphGap, InsertSubgraphHealthSnapshot, InsertSubgraphOperation, InsertTransaction, InsertUpdateSubscriber, InsertUsageLedgerRow, InsertVmEvent, InsertWaitlistSignup, InsertWebhook, InsertWebhookDelivery, InsertWebhookOutbox, InsightMutesTable, InsightsTable, InstancesTable, MagicLink, MagicLinksTable, MempoolTransaction, MempoolTransactionsTable, MigrationRole, NativeClock, NumericAsText, OBSERVER_JOURNAL_STATUSES, OauthClient, OauthClientsTable, OauthCodesTable, OauthGrant, OauthGrantsTable, OauthRefreshRetiredTable, OauthRequestStatus, OauthRequestsTable, OauthTokenKind, OauthTokensTable, ObserverJournalStatus, ObserverJournalTable, OutboxStatus, PendingForkBlocksTable, Pox5CycleSignersTable, Pox5CyclesTable, Pox5EventTopic, Pox5EventsTable, ProcessedStripeEventsTable, PushPrefs, PushPrefsTable, PushSentTable, PushSubscription, PushSubscriptionsTable, RepairMode, RetryState, RunStatus, SOURCE_READ_COLUMNS, SOURCE_READ_PKS, SOURCE_READ_TYPES, SbtcEventTopic, SbtcEventsTable, SbtcSettlementsTable, SentinelAccount, SentinelAccountsTable, ServiceHeartbeatsTable, Session, SessionsTable, StageFailuresTable, StageKind, StageRegistryTable, StateWrite, StateWritesArchiveTable, StateWritesTable, Subgraph, SubgraphErrorGroupsTable, SubgraphGap, SubgraphGapsTable, SubgraphHealthSnapshot, SubgraphHealthSnapshotsTable, SubgraphOperation, SubgraphOperationKind, SubgraphOperationStatus, SubgraphOperationsTable, SubgraphProcessingStatsTable, SubgraphViolationsTable, SubgraphsTable, SyncScopesTable, TABLE_TO_DB, Transaction, TransactionsArchiveTable, TransactionsTable, TriggerEvaluatorState, TriggerEvaluatorStateTable, UpdateAccountBalanceAlerts, UpdateAccountCredits, UpdateAccountSpendCap, UpdateApiKey, UpdateArchiveFetch, UpdateBlock, UpdateContract, UpdateEvent, UpdateIndexProgress, UpdateSendsTable, UpdateSubgraph, UpdateSubgraphOperation, UpdateSubscriber, UpdateSubscribersTable, UpdateTransaction, UpdateUsageLedgerRow, UpdateVmEvent, UpdateWebhook, UpdateWebhookOutbox, UsageLedgerRow, UsageLedgerTable, VmEvent, VmEventsArchiveTable, VmEventsTable, Waitlist, WaitlistSignup, WaitlistSignupsTable, WaitlistsTable, Webhook, WebhookDeliveriesTable, WebhookDelivery, WebhookDeliveryHoursTable, WebhookFormat, WebhookIncidentAlert, WebhookIncidentAlertsTable, WebhookKind, WebhookOutbox, WebhookOutboxTable, WebhookPauseReason, WebhookReplay, WebhookReplayStatus, WebhookReplaysTable, WebhookStatus, WebhooksTable, applicationDatabaseUrl, assertDbSplit, closeDb, closeDbOrTimeout, configuredSourceUrl, configuredTargetUrl, describeDbUrl, getDb, getDbSplitStatus, getMigrationRole, getRawClient, getSourceDb, getTargetDb, jsonb, onChainPlane, onControlPlane, parseJsonb, resolveSourceUrl, resolveTargetUrl, setMigrationRole, sql };
@@ -694,6 +694,7 @@ var TABLE_TO_DB = {
694
694
  contracts: "source",
695
695
  chain_reorgs: "source",
696
696
  chain_read_cache: "source",
697
+ events_total_baseline: "source",
697
698
  pending_fork_blocks: "source",
698
699
  observer_journal: "source",
699
700
  sync_scopes: "source",
@@ -969,5 +970,5 @@ export {
969
970
  sql2 as sql
970
971
  };
971
972
 
972
- //# debugId=68B5688D8451878F64756E2164756E21
973
+ //# debugId=376ED2B815C4DEF464756E2164756E21
973
974
  //# sourceMappingURL=index.js.map