@lunora/do 1.0.0-alpha.34 → 1.0.0-alpha.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -2165,6 +2165,227 @@ declare const recordAuthEvent: (sql: SqlExec, input: RecordAuthEventInput) => vo
2165
2165
  * throwing. `failureRate` is derived here so the consumer needn't recompute it.
2166
2166
  */
2167
2167
  declare const readAuthMetrics: (sql: SqlExec) => AuthMetrics;
2168
+ /**
2169
+ * Shared, bundler-inlined helpers for the structured `fields` a
2170
+ * `ctx.log.<level>(message, fields)` / `ctx.log.with(fields)` call carries.
2171
+ *
2172
+ * Inlined (like {@link file://./otlp.ts}) so `@lunora/do`, `@lunora/runtime`,
2173
+ * `@lunora/config`, and `@lunora/studio` — which sit on different tiers with no
2174
+ * acceptable runtime dependency edge between them — share ONE implementation of
2175
+ * field rendering/normalization instead of the byte-identical copies they would
2176
+ * otherwise hand-mirror. Keep this genuinely zero-dependency (only built-ins) so
2177
+ * inlining into each `dist` stays sound.
2178
+ */
2179
+ /** Structured, filterable key/value fields attached to a `ctx.log` line. */
2180
+ type LogFields = Record<string, unknown>;
2181
+ /**
2182
+ * What kind of instrument produced a measurement, which decides how a collector
2183
+ * aggregates it:
2184
+ *
2185
+ * - `counter` — a monotonic delta to add up (requests, retries, bytes sent).
2186
+ * - `gauge` — a point-in-time reading that replaces the last one (queue depth,
2187
+ * cache size).
2188
+ * - `histogram` — a value whose *distribution* matters (latency, payload size),
2189
+ * giving percentiles rather than just a mean.
2190
+ */
2191
+ type MetricKind = "counter" | "gauge" | "histogram";
2192
+ /**
2193
+ * One measurement recorded from a function handler.
2194
+ *
2195
+ * Each `ctx.metrics.*` call produces exactly one of these — the runtime does no
2196
+ * pre-aggregation, so counters carry **delta** temporality and a collector sums
2197
+ * them. That keeps the sink model identical to logs and spans (one event, one
2198
+ * export) at the cost of chattiness in a hot loop, where the handler should sum
2199
+ * locally and record once.
2200
+ */
2201
+ interface MetricEvent {
2202
+ /**
2203
+ * Structured attributes the caller attached, normalized to a fresh bag of
2204
+ * JSON-safe primitives (see `shared/log-fields.ts`). These are the metric's
2205
+ * dimensions — keep them low-cardinality; an id-valued attribute creates a
2206
+ * distinct time series per id.
2207
+ *
2208
+ * Caller-controlled, so they MAY contain user input and they DO egress to
2209
+ * whatever destination the sink ships to — the same caveat as a log line's
2210
+ * `fields` and a span's `error.message`. Scrub upstream if that matters.
2211
+ */
2212
+ attributes?: LogFields;
2213
+ /** Function path that recorded the measurement, e.g. `"orders:checkout"`. */
2214
+ functionPath: string;
2215
+ /** Instrument kind; see {@link MetricKind}. */
2216
+ kind: MetricKind;
2217
+ /** Instrument name, e.g. `"orders.placed"`. */
2218
+ name: string;
2219
+ /** Shard key for single-shard calls; absent for the unnamed root DO. */
2220
+ shardKey?: string;
2221
+ /** Wall-clock millis when the measurement was recorded. */
2222
+ ts: number;
2223
+ /**
2224
+ * The measured value: the increment for a `counter`, the current reading for
2225
+ * a `gauge`, the observed sample for a `histogram`.
2226
+ */
2227
+ value: number;
2228
+ }
2229
+ /**
2230
+ * One span produced by a `ctx.trace(name, fn)` call, or the synthetic root span
2231
+ * the shard records for the dispatch itself so a waterfall has a bar to hang
2232
+ * its children under.
2233
+ *
2234
+ * Ids are the same lowercase-hex form the OTLP encoders and `traceparent` use
2235
+ * (32-hex trace, 16-hex span), so a `SpanEvent` composes into an OTLP span with
2236
+ * no reformatting.
2237
+ */
2238
+ interface SpanEvent {
2239
+ /**
2240
+ * Structured attributes the caller attached, already normalized to a fresh
2241
+ * bag of JSON-safe primitives (see `shared/log-fields.ts`) exactly like a log
2242
+ * line's `fields`. Absent when the caller passed none.
2243
+ */
2244
+ attributes?: LogFields;
2245
+ /** Wall-clock duration of the span body, in milliseconds. */
2246
+ durationMs: number;
2247
+ /**
2248
+ * Populated when the span body threw. `type` is the error's constructor name
2249
+ * (or its `LunoraError` code); `message` is the human-readable string and may
2250
+ * include user input, so sinks shipping to third parties should scrub it.
2251
+ */
2252
+ error?: {
2253
+ message: string;
2254
+ type: string;
2255
+ };
2256
+ /**
2257
+ * Function path the span was created under, e.g. `"messages:list"`. A span
2258
+ * created inside a function invoked via `ctx.runQuery`/`runMutation`/
2259
+ * `runAction` carries the OUTER entrypoint's path, since the composed call
2260
+ * reuses its context — the same attribution rule `ctx.log` follows.
2261
+ */
2262
+ functionPath: string;
2263
+ /** Caller-supplied span name, e.g. `"stripe.charge"`. */
2264
+ name: string;
2265
+ /** True when the span body returned without throwing. */
2266
+ ok: boolean;
2267
+ /**
2268
+ * Span id of the enclosing span — the parent `ctx.trace` when nested, else
2269
+ * the dispatch's own RPC span (from the inbound `traceparent`). A span with
2270
+ * no inbound trace context is parented to a locally-minted root, so this is
2271
+ * always set for a `ctx.trace` span; only the synthetic `dispatch` span below
2272
+ * carries `""`, meaning "nothing above me in this trace".
2273
+ */
2274
+ parentSpanId: string;
2275
+ /**
2276
+ * True for the synthetic span representing the **dispatch itself**, which the
2277
+ * shard records so a waterfall has a bar for the request to hang its
2278
+ * `ctx.trace` spans under.
2279
+ *
2280
+ * Named for what it is rather than "root": it is not the root of the
2281
+ * collector-side trace — the worker's own RPC span sits above it — and it is
2282
+ * never exported to a sink, because the runtime already emits that dispatch
2283
+ * via `onRpc` and a collector would otherwise show it twice. Locally it *is*
2284
+ * the outermost span, which is why the fold prefers it as a trace's anchor.
2285
+ */
2286
+ dispatch?: boolean;
2287
+ /** Shard key for single-shard calls; absent for the unnamed root DO. */
2288
+ shardKey?: string;
2289
+ /** This span's own id (16-hex). */
2290
+ spanId: string;
2291
+ /** Wall-clock millis when the span started. */
2292
+ startTs: number;
2293
+ /** Trace this span belongs to (32-hex) — shared with the dispatch's logs. */
2294
+ traceId: string;
2295
+ /** Acting userId, or absent when anonymous. */
2296
+ userId?: string;
2297
+ }
2298
+ /**
2299
+ * Structural shape of the `ctx.trace` span factory (see the server
2300
+ * `LunoraTracer`). Declared here rather than imported so `@lunora/do` takes no
2301
+ * dependency on `@lunora/server`; a cross-package assignability guard in
2302
+ * `@lunora/testing` fails the build if the two drift apart.
2303
+ */
2304
+ type ContextTracer = <T>(name: string, function_: (trace: ContextTracer) => Promise<T> | T, attributes?: LogFields) => Promise<T>;
2305
+ /** Structural shape of the `ctx.metrics` recorder (see the server `LunoraMetrics`). */
2306
+ interface ContextMetrics {
2307
+ count: (name: string, value?: number, attributes?: LogFields) => void;
2308
+ gauge: (name: string, value: number, attributes?: LogFields) => void;
2309
+ record: (name: string, value: number, attributes?: LogFields) => void;
2310
+ }
2311
+ /** The trace a ctx's spans hang off: the shared id, and the span they parent to. */
2312
+ interface TraceAnchor {
2313
+ rootSpanId: string;
2314
+ traceId: string;
2315
+ }
2316
+ /** What {@link createTracer} needs from the shard to build a span. */
2317
+ interface TracerDeps {
2318
+ /** The trace this ctx's spans belong to. */
2319
+ anchor: TraceAnchor;
2320
+ /** Function path the spans are attributed to. */
2321
+ functionPath: string;
2322
+ /** Hand a finished span to the buffer + sink. */
2323
+ record: (span: SpanEvent) => void;
2324
+ /** Shard key for single-shard calls; absent for the unnamed root DO. */
2325
+ shardKey: string | undefined;
2326
+ /** Read lazily — the acting user is resolved per span, not per ctx. */
2327
+ userId: () => string | undefined;
2328
+ }
2329
+ /** What {@link createMetrics} needs from the shard to build a measurement. */
2330
+ interface MetricsDeps {
2331
+ functionPath: string;
2332
+ record: (event: MetricEvent) => void;
2333
+ shardKey: string | undefined;
2334
+ }
2335
+ /**
2336
+ * Build the `ctx.trace` span factory for one dispatched function.
2337
+ *
2338
+ * **Nesting is explicit, not ambient.** Each span's body receives a tracer bound
2339
+ * to that span; calling it is what makes a child. An earlier design kept an
2340
+ * ambient stack of "the currently open span" and parented to its top, which
2341
+ * reads nicer but is unfixably wrong under concurrency: in
2342
+ * `Promise.all([trace("a", …), trace("b", …)])`, `b` starts while `a` is on the
2343
+ * stack and is recorded as a *child* of `a` rather than its sibling — and
2344
+ * parallel fan-out is one of the main things people reach for a tracer to
2345
+ * measure. Distinguishing "called inside a's body" from "called concurrently
2346
+ * with a" needs `AsyncLocalStorage`, which this package deliberately avoids (see
2347
+ * `dependency-tracker.ts` — shard DOs run under a slimmer compat profile than
2348
+ * `nodejs_compat`). So the parent is threaded, exactly like the dependency
2349
+ * tracker and the subscription identity: correct in every case, and visible at
2350
+ * the call site.
2351
+ *
2352
+ * The anchor is passed in for the same reason. `ShardDO.currentRequestTrace` is
2353
+ * cleared in the dispatch `finally`, and a subscription re-run builds its ctx
2354
+ * during* the writing mutation's flush — so reading that shared field at span
2355
+ * time would file the re-run's spans under the mutation's trace.
2356
+ */
2357
+ declare const createTracer: (deps: TracerDeps) => ContextTracer;
2358
+ /**
2359
+ * Build the `ctx.metrics` recorder for one dispatched function.
2360
+ *
2361
+ * Deliberately stateless: each call emits one measurement rather than
2362
+ * accumulating into a per-dispatch map. Pre-aggregating here would have to pick a
2363
+ * flush point and a merge rule per instrument kind (sum a counter, last-wins a
2364
+ * gauge, and a histogram cannot be merged at all without losing the
2365
+ * distribution) — so the runtime stays a transport and the collector, which is
2366
+ * built for exactly this, does the aggregation.
2367
+ */
2368
+ declare const createMetrics: (deps: MetricsDeps) => ContextMetrics;
2369
+ /**
2370
+ * Build the synthetic root span for a finished dispatch — the bar the studio's
2371
+ * waterfall hangs a request's `ctx.trace` spans under.
2372
+ *
2373
+ * Pure: the caller decides whether to record it (only when the dispatch actually
2374
+ * produced spans) and where to put it. It is never routed to `sink.onSpan`,
2375
+ * because the runtime already emits the dispatch to `onRpc` and a collector would
2376
+ * otherwise show it twice.
2377
+ */
2378
+ declare const dispatchRootSpan: (input: {
2379
+ anchor: TraceAnchor;
2380
+ durationMs: number;
2381
+ failure: {
2382
+ thrown: unknown;
2383
+ } | undefined;
2384
+ functionPath: string;
2385
+ shardKey: string | undefined;
2386
+ startTs: number;
2387
+ userId: string | undefined;
2388
+ }) => SpanEvent;
2168
2389
  /** Reserved table the per-shard runner tracks migration progress in. Auto-hidden from the data browser by the `__lunora` prefix. */
2169
2390
  declare const DATA_MIGRATION_STATE_TABLE = "__lunora_migrations";
2170
2391
  type MigrationDirection = "down" | "up";
@@ -2536,6 +2757,7 @@ declare const FLAGS_FUNCTION_PREFIX = "__lunora_flags__:";
2536
2757
  */
2537
2758
  declare const ADMIN_FUNCTIONS: {
2538
2759
  readonly applyCdc: "__lunora_admin__:applyCdc";
2760
+ readonly assignIssue: "__lunora_admin__:assignIssue";
2539
2761
  readonly cdcSync: "__lunora_admin__:cdcSync";
2540
2762
  readonly clearCapturedMail: "__lunora_admin__:clearCapturedMail";
2541
2763
  readonly clearQueueMessages: "__lunora_admin__:clearQueueMessages";
@@ -2553,6 +2775,7 @@ declare const ADMIN_FUNCTIONS: {
2553
2775
  readonly getFanoutMetrics: "__lunora_admin__:getFanoutMetrics";
2554
2776
  readonly getFunctionStats: "__lunora_admin__:getFunctionStats";
2555
2777
  readonly getIssues: "__lunora_admin__:getIssues";
2778
+ readonly getMetricSeries: "__lunora_admin__:getMetricSeries";
2556
2779
  readonly listSubscriptions: "__lunora_admin__:listSubscriptions";
2557
2780
  readonly listTableIndexes: "__lunora_admin__:listTableIndexes";
2558
2781
  readonly getLogs: "__lunora_admin__:getLogs";
@@ -2562,7 +2785,9 @@ declare const ADMIN_FUNCTIONS: {
2562
2785
  readonly getRequestLog: "__lunora_admin__:getRequestLog";
2563
2786
  readonly getSecurityAudit: "__lunora_admin__:getSecurityAudit";
2564
2787
  readonly getSettings: "__lunora_admin__:getSettings";
2788
+ readonly getTraces: "__lunora_admin__:getTraces";
2565
2789
  readonly getWorkflowInstanceStatus: "__lunora_admin__:getWorkflowInstanceStatus";
2790
+ readonly ignoreIssue: "__lunora_admin__:ignoreIssue";
2566
2791
  readonly importShard: "__lunora_admin__:importShard";
2567
2792
  readonly listFlags: "__lunora_admin__:listFlags";
2568
2793
  readonly listQueues: "__lunora_admin__:listQueues";
@@ -2579,12 +2804,14 @@ declare const ADMIN_FUNCTIONS: {
2579
2804
  readonly recordMail: "__lunora_admin__:recordMail";
2580
2805
  readonly recordQueueMessage: "__lunora_admin__:recordQueueMessage";
2581
2806
  readonly replayQueueMessage: "__lunora_admin__:replayQueueMessage";
2807
+ readonly resolveIssue: "__lunora_admin__:resolveIssue";
2582
2808
  readonly rlsPolicies: "__lunora_admin__:rlsPolicies";
2583
2809
  readonly runAs: "__lunora_admin__:runAs";
2584
2810
  readonly runMigration: "__lunora_admin__:runMigration";
2585
2811
  readonly runSql: "__lunora_admin__:runSql";
2586
2812
  readonly sendQueueMessage: "__lunora_admin__:sendQueueMessage";
2587
2813
  readonly sendTestMail: "__lunora_admin__:sendTestMail";
2814
+ readonly setIssueSeverity: "__lunora_admin__:setIssueSeverity";
2588
2815
  readonly storageOrphans: "__lunora_admin__:storageOrphans";
2589
2816
  readonly storageReferences: "__lunora_admin__:storageReferences";
2590
2817
  readonly storageRules: "__lunora_admin__:storageRules";
@@ -3316,8 +3543,62 @@ declare const readFunctionMetricsTotals: (sql: SqlExec) => {
3316
3543
  errors: number;
3317
3544
  requests: number;
3318
3545
  };
3319
- /** Severity of a buffered log entry, mirroring the usual console levels. */
3320
- type LogLevel = "debug" | "error" | "info" | "warn";
3546
+ /**
3547
+ * Severity of a `ctx.log.*` call. The five console method names (`log` is the
3548
+ * default level, distinct from `info`) plus `trace`/`fatal`, so the logger spans
3549
+ * the full OpenTelemetry severity ramp (`trace`→`fatal`).
3550
+ */
3551
+ type ContextLogLevel = "debug" | "error" | "fatal" | "info" | "log" | "trace" | "warn";
3552
+ /**
3553
+ * Per-event context handed to a sink alongside the event: lets a sink register
3554
+ * background work (a telemetry POST, a durable pipeline send) with the request's
3555
+ * `waitUntil` so it survives isolate teardown after the response returns. Absent
3556
+ * `waitUntil` (no request context) means the sink falls back to fire-and-forget.
3557
+ */
3558
+ interface LogSinkContext {
3559
+ /** Keep a background promise alive past the response (the request's `waitUntil`). */
3560
+ waitUntil?: (promise: Promise<unknown>) => void;
3561
+ }
3562
+ /**
3563
+ * One application log line emitted from a function handler via `ctx.log`.
3564
+ * Produced per `ctx.log.*` call (unlike a per-dispatch RPC summary).
3565
+ */
3566
+ interface LogEvent {
3567
+ /** Raw arguments passed to the `ctx.log.*` call, in order. */
3568
+ args: unknown[];
3569
+ /**
3570
+ * Structured fields the caller attached (`ctx.log.info(message, fields)` or a
3571
+ * bound `ctx.log.with(fields)` child), already normalized to a fresh bag of
3572
+ * JSON-safe primitives (see `shared/log-fields.ts`). Absent for a plain
3573
+ * console-style call.
3574
+ */
3575
+ fields?: LogFields;
3576
+ /** Function path that emitted the line, e.g. `"messages:list"`. */
3577
+ functionPath: string;
3578
+ /** Severity the line was logged at. */
3579
+ level: ContextLogLevel;
3580
+ /** Display string — the message, or the console-style args rendered and space-joined. */
3581
+ message: string;
3582
+ /** Shard key for single-shard calls; absent for the unnamed root DO. */
3583
+ shardKey?: string;
3584
+ /** Span id of the RPC this line was emitted under (trace correlation), or absent. */
3585
+ spanId?: string;
3586
+ /** Trace id this line belongs to (from the inbound `traceparent`), or absent. */
3587
+ traceId?: string;
3588
+ /** Wall-clock millis when the line was emitted. */
3589
+ ts: number;
3590
+ /** Acting userId, or absent when anonymous. */
3591
+ userId?: string;
3592
+ }
3593
+ /**
3594
+ * Severity of a buffered log entry — the full seven-tier `ctx.log` ramp
3595
+ * (`trace`→`fatal`), not a console-shaped subset. The buffer used to fold the
3596
+ * ramp onto four tiers, which made `trace` and `fatal` lines indistinguishable
3597
+ * from `debug` and `error` in the Studio Logs panel; it now stores the level the
3598
+ * caller actually logged at. Container-lifecycle entries only ever use
3599
+ * `info`/`error`, which remain part of the union.
3600
+ */
3601
+ type LogLevel = ContextLogLevel;
3321
3602
  /**
3322
3603
  * One buffered log line. `functionPath` is the RPC that produced it (when the
3323
3604
  * entry came from the RPC dispatch site); `timestamp` is `Date.now()` at the
@@ -3327,7 +3608,7 @@ type LogLevel = "debug" | "error" | "info" | "warn";
3327
3608
  */
3328
3609
  interface LogEntry {
3329
3610
  exitCode?: number;
3330
- /** Structured fields from a `ctx.log.<level>(message, fields)` / `ctx.log.with(fields)` call, when present. */
3611
+ /** Structured fields from a `ctx.log.&lt;level>(message, fields)` / `ctx.log.with(fields)` call, when present. */
3331
3612
  fields?: Record<string, unknown>;
3332
3613
  functionPath?: string;
3333
3614
  instance?: string;
@@ -3653,66 +3934,6 @@ declare const resolveRelationPredicates: (where: WhereInput | undefined, options
3653
3934
  * schema's shard modes are both in hand).
3654
3935
  */
3655
3936
  declare const assertShapeShardable: (effectiveWhere: WhereInput | undefined, schema: ResolveContext["schema"], table: string) => void;
3656
- /**
3657
- * Shared, bundler-inlined helpers for the structured `fields` a
3658
- * `ctx.log.<level>(message, fields)` / `ctx.log.with(fields)` call carries.
3659
- *
3660
- * Inlined (like {@link file://./otlp.ts}) so `@lunora/do`, `@lunora/runtime`,
3661
- * `@lunora/config`, and `@lunora/studio` — which sit on different tiers with no
3662
- * acceptable runtime dependency edge between them — share ONE implementation of
3663
- * field rendering/normalization instead of the byte-identical copies they would
3664
- * otherwise hand-mirror. Keep this genuinely zero-dependency (only built-ins) so
3665
- * inlining into each `dist` stays sound.
3666
- */
3667
- /** Structured, filterable key/value fields attached to a `ctx.log` line. */
3668
- type LogFields = Record<string, unknown>;
3669
- /**
3670
- * Severity of a `ctx.log.*` call. The five console method names (`log` is the
3671
- * default level, distinct from `info`) plus `trace`/`fatal`, so the logger spans
3672
- * the full OpenTelemetry severity ramp (`trace`→`fatal`).
3673
- */
3674
- type ContextLogLevel = "debug" | "error" | "fatal" | "info" | "log" | "trace" | "warn";
3675
- /**
3676
- * Per-event context handed to a sink alongside the event: lets a sink register
3677
- * background work (a telemetry POST, a durable pipeline send) with the request's
3678
- * `waitUntil` so it survives isolate teardown after the response returns. Absent
3679
- * `waitUntil` (no request context) means the sink falls back to fire-and-forget.
3680
- */
3681
- interface LogSinkContext {
3682
- /** Keep a background promise alive past the response (the request's `waitUntil`). */
3683
- waitUntil?: (promise: Promise<unknown>) => void;
3684
- }
3685
- /**
3686
- * One application log line emitted from a function handler via `ctx.log`.
3687
- * Produced per `ctx.log.*` call (unlike a per-dispatch RPC summary).
3688
- */
3689
- interface LogEvent {
3690
- /** Raw arguments passed to the `ctx.log.*` call, in order. */
3691
- args: unknown[];
3692
- /**
3693
- * Structured fields the caller attached (`ctx.log.info(message, fields)` or a
3694
- * bound `ctx.log.with(fields)` child), already normalized to a fresh bag of
3695
- * JSON-safe primitives (see `shared/log-fields.ts`). Absent for a plain
3696
- * console-style call.
3697
- */
3698
- fields?: LogFields;
3699
- /** Function path that emitted the line, e.g. `"messages:list"`. */
3700
- functionPath: string;
3701
- /** Severity the line was logged at. */
3702
- level: ContextLogLevel;
3703
- /** Display string — the message, or the console-style args rendered and space-joined. */
3704
- message: string;
3705
- /** Shard key for single-shard calls; absent for the unnamed root DO. */
3706
- shardKey?: string;
3707
- /** Span id of the RPC this line was emitted under (trace correlation), or absent. */
3708
- spanId?: string;
3709
- /** Trace id this line belongs to (from the inbound `traceparent`), or absent. */
3710
- traceId?: string;
3711
- /** Wall-clock millis when the line was emitted. */
3712
- ts: number;
3713
- /** Acting userId, or absent when anonymous. */
3714
- userId?: string;
3715
- }
3716
3937
  /**
3717
3938
  * The `ctx.log` event contract (shape + severity union) lives in
3718
3939
  * `shared/log-event.ts` (inlined into each `dist`) so the DO that builds these
@@ -3971,15 +4192,22 @@ declare const subscriptionListDeltas: (previousJson: string, nextResult: unknown
3971
4192
  * `@lunora/do` takes no dependency on `@lunora/runtime`; the event is the same
3972
4193
  * {@link LogEventInput} shape `emitLogEvent` consumes, built once per call.
3973
4194
  */
3974
- interface LogSink {
4195
+ /**
4196
+ * The sink surface the DO hands its three signals to: `ctx.log` lines, `ctx.trace`
4197
+ * spans, and `ctx.metrics` measurements. Structurally compatible with
4198
+ * `@lunora/runtime`'s `ObservabilitySink` without taking a dependency on it.
4199
+ */
4200
+ interface TelemetrySink {
3975
4201
  onLog?: (event: LogEventInput, context?: LogSinkContext) => void;
4202
+ onMetric?: (event: MetricEvent, context?: LogSinkContext) => void;
4203
+ onSpan?: (event: SpanEvent, context?: LogSinkContext) => void;
3976
4204
  }
3977
4205
  /**
3978
4206
  * Structural shape of the `ctx.log` logger the DO builds (see the server
3979
4207
  * `LunoraLogger`). Declared locally so `@lunora/do` takes no dependency on
3980
4208
  * `@lunora/server`; the overloaded public method type lives there.
3981
4209
  */
3982
- interface CtxLogger {
4210
+ interface ContextLogger {
3983
4211
  debug: (...args: unknown[]) => void;
3984
4212
  error: (...args: unknown[]) => void;
3985
4213
  fatal: (...args: unknown[]) => void;
@@ -3987,7 +4215,7 @@ interface CtxLogger {
3987
4215
  log: (...args: unknown[]) => void;
3988
4216
  trace: (...args: unknown[]) => void;
3989
4217
  warn: (...args: unknown[]) => void;
3990
- with: (fields: LogFields) => CtxLogger;
4218
+ with: (fields: LogFields) => ContextLogger;
3991
4219
  }
3992
4220
  /**
3993
4221
  * Minimal projection of `DurableObjectState` that the ShardDO base requires.
@@ -4396,6 +4624,14 @@ declare abstract class ShardDO {
4396
4624
  private currentRequestIp;
4397
4625
  /** W3C `traceparent` of the inbound RPC; forwarded onto outbound container fetches. */
4398
4626
  private currentRequestTraceparent;
4627
+ /**
4628
+ * Trace ids for the in-flight dispatch, resolved once at entry (see
4629
+ * {@link resolveTraceAnchor}). Shared by `ctx.trace` and by the synthetic
4630
+ * root span recorded on the way out so both agree even with no inbound
4631
+ * `traceparent`. Cleared in the same `finally` as the other per-request
4632
+ * fields.
4633
+ */
4634
+ private currentRequestTrace;
4399
4635
  /**
4400
4636
  * Client-issued idempotency key for the in-flight mutation, forwarded via the
4401
4637
  * `x-lunora-mutation-id` header. When set, the dispatch path dedups the call
@@ -4593,6 +4829,19 @@ declare abstract class ShardDO {
4593
4829
  * "recent RPC errors on this instance" feed, not a general application log.
4594
4830
  */
4595
4831
  private readonly logs;
4832
+ /**
4833
+ * Recent `ctx.trace` spans (plus the synthetic per-dispatch root), powering
4834
+ * the studio's Traces panel. In-memory and hibernation-volatile like
4835
+ * `logs` — production tracing ships to a collector via `otlpSink`.
4836
+ */
4837
+ private readonly spans;
4838
+ /**
4839
+ * Running aggregates of `ctx.metrics.*` measurements, powering the studio's
4840
+ * Metrics panel. In-memory and hibernation-volatile like `logs` and
4841
+ * `spans`, but folds samples into per-series totals rather than ringing
4842
+ * raw events — production aggregation ships to a collector via the sink.
4843
+ */
4844
+ private readonly metricSeries;
4596
4845
  /**
4597
4846
  * In-flight dependency tracker for the currently-executing query. Set by
4598
4847
  * `runCachedQuery` so the ctx-db hooks (wired via `onRead`) can
@@ -4816,6 +5065,15 @@ declare abstract class ShardDO {
4816
5065
  * container fetches carry it and the container's spans join the same trace.
4817
5066
  */
4818
5067
  protected getCurrentTraceparent(): string | undefined;
5068
+ /**
5069
+ * The in-flight dispatch's trace ids, for the generated `buildCtx` to hand to
5070
+ * {@link makeTracer}. `undefined` outside a dispatch (an alarm, a lifecycle
5071
+ * hook), where the tracer mints its own anchor.
5072
+ */
5073
+ protected getCurrentTrace(): {
5074
+ rootSpanId: string;
5075
+ traceId: string;
5076
+ } | undefined;
4819
5077
  /**
4820
5078
  * Identity claims (email, name, roles, …) forwarded by the runtime's
4821
5079
  * `resolveIdentity` hook. Returns `undefined` for anonymous requests
@@ -5469,7 +5727,7 @@ declare abstract class ShardDO {
5469
5727
  * Unlike request-log args, `ctx.log` args are NOT redacted: the developer
5470
5728
  * chose to log them, exactly like a raw `console.log`.
5471
5729
  */
5472
- protected recordUserLog(functionPath: string, level: ContextLogLevel, args: unknown[], message: string, fields: Record<string, unknown> | undefined, sink?: LogSink): void;
5730
+ protected recordUserLog(functionPath: string, level: ContextLogLevel, args: unknown[], message: string, fields: Record<string, unknown> | undefined, sink?: TelemetrySink): void;
5473
5731
  /**
5474
5732
  * Build the `ctx.log` logger for one dispatched function. Each severity method
5475
5733
  * accepts either the structured form (`(message, fields)`) or console-style
@@ -5477,7 +5735,59 @@ declare abstract class ShardDO {
5477
5735
  * stamps `fields` onto every line. The generated `buildCtx` calls this once
5478
5736
  * per dispatch and assigns the result to `ctx.log`.
5479
5737
  */
5480
- protected makeLogger(functionPath: string, sink?: LogSink, boundFields?: Record<string, unknown>): CtxLogger;
5738
+ protected makeLogger(functionPath: string, sink?: TelemetrySink, boundFields?: Record<string, unknown>): ContextLogger;
5739
+ /**
5740
+ * Build the `ctx.trace` span factory for one dispatched function. The
5741
+ * generated `buildCtx` calls this once per dispatch and assigns the result to
5742
+ * `ctx.trace`.
5743
+ *
5744
+ * Thin wiring over {@link createTracer}, which owns the span semantics (see
5745
+ * there for why nesting is explicit rather than ambient). Everything it needs
5746
+ * from the shard is passed explicitly.
5747
+ *
5748
+ * `anchor` is the trace this ctx's spans belong to; omit it for a ctx with no
5749
+ * owning dispatch (an alarm, a subscription re-run) to mint a fresh anchor, so
5750
+ * `ctx.trace` still yields a coherent self-contained trace there.
5751
+ */
5752
+ protected makeTracer(functionPath: string, sink?: TelemetrySink, anchor?: TraceAnchor): ContextTracer;
5753
+ /**
5754
+ * Build the `ctx.metrics` recorder for one dispatched function. Thin wiring
5755
+ * over {@link createMetrics}, which owns the instrument semantics.
5756
+ */
5757
+ protected makeMetrics(functionPath: string, sink?: TelemetrySink): ContextMetrics;
5758
+ /**
5759
+ * Fold one measurement into the in-memory {@link metricSeries} readout and
5760
+ * hand it to the optional `sink.onMetric`. Best-effort like
5761
+ * {@link recordUserLog} and {@link recordSpan}: recording a measurement must
5762
+ * never break the handler that recorded it.
5763
+ *
5764
+ * The buffer folds rather than rings: a measurement's value is in its
5765
+ * aggregate over a window, which a bounded ring of raw samples can't represent
5766
+ * (it evicts the oldest samples, the ones a running total needs). So the
5767
+ * buffer keeps one running aggregate per series and resets on hibernation like
5768
+ * logs and spans — a "recent metrics on this instance" dev readout. Durable,
5769
+ * cross-instance aggregation is still the sink's job.
5770
+ */
5771
+ protected recordMetric(event: MetricEvent, sink?: TelemetrySink): void;
5772
+ /**
5773
+ * Buffer the synthetic root span for a finished dispatch. The caller gates
5774
+ * this on the dispatch having actually produced spans (the `hasTrace` check at
5775
+ * the call site): every request minting a root would fill the bounded ring
5776
+ * with single-bar traces from uninstrumented handlers and evict the
5777
+ * instrumented ones the panel exists to show.
5778
+ *
5779
+ * `anchor` carries the dispatch's trace ids, captured at entry rather than
5780
+ * read from `this` here — this runs after the handler's awaits, where the
5781
+ * shared field may already belong to an interleaved dispatch.
5782
+ */
5783
+ private recordDispatchRootSpan;
5784
+ /**
5785
+ * Buffer one span for the studio Traces panel and hand it to the optional
5786
+ * `sink.onSpan`. Best-effort throughout, exactly like {@link recordUserLog}:
5787
+ * a span is recorded *after* its body already settled, so letting a telemetry
5788
+ * failure escape here would turn a succeeded operation into a failed request.
5789
+ */
5790
+ protected recordSpan(span: SpanEvent, sink?: TelemetrySink): void;
5481
5791
  /**
5482
5792
  * Assemble the per-socket {@link LifecycleDispatchInfo} from its attachment:
5483
5793
  * the verified identity to replay and the {@link LifecycleEvent} the hooks
@@ -5615,6 +5925,29 @@ declare abstract class ShardDO {
5615
5925
  * mirroring `handlePitrAdminOp`.
5616
5926
  */
5617
5927
  private handleExtraAdminOp;
5928
+ /**
5929
+ * Serve the four Issue-triage admin writes — `resolveIssue` / `ignoreIssue`
5930
+ * (a status change), `assignIssue` (set/clear an owner), `setIssueSeverity`
5931
+ * (tag/clear severity). Each upserts one row in the reserved
5932
+ * `__lunora_issue_state__` side table keyed by the Issue's fingerprint
5933
+ * `hash`, then re-derives at read time in {@link readErrorIssues}. Returns
5934
+ * `undefined` for any path it doesn't own so `handleExtraAdminOp` falls
5935
+ * through. Admin-gated by `handleAdminRpc`'s caller (the `LUNORA_ADMIN_TOKEN`
5936
+ * bearer); a bad/missing `hash` (or a bad status/severity value) is a 400.
5937
+ *
5938
+ * The write lands through raw SQL the change-tracker can't observe, so it
5939
+ * marks {@link ISSUE_STATE_TABLE} changed and flushes — the live Issues
5940
+ * subscription is an admin-wildcard memo that re-runs whenever a flush finds
5941
+ * a changed table, so the triage shows up without an unrelated write.
5942
+ */
5943
+ private handleIssueTriageOp;
5944
+ /**
5945
+ * Map an Issue-triage admin path to the `IssueStatePatch` it applies, or
5946
+ * `undefined` when the path isn't a triage write. `assignIssue`/
5947
+ * `setIssueSeverity` accept an explicit `null` to CLEAR the field (unassign /
5948
+ * untag); a missing or malformed value is a 400 rather than a silent no-op.
5949
+ */
5950
+ private parseIssueTriagePatch;
5618
5951
  /**
5619
5952
  * Record one app-level auth attempt for the auth-failure SLO (PLAN3 §2.3).
5620
5953
  * The worker calls this fire-and-forget (via `waitUntil`) after a top-level
@@ -6588,6 +6921,11 @@ declare abstract class ShardDO {
6588
6921
  private deliverWhisperLocal;
6589
6922
  private readAttachment;
6590
6923
  }
6924
+ /**
6925
+ * @deprecated Renamed to {@link TelemetrySink} — it carries spans and metrics as
6926
+ * well as logs. Kept as an alias so existing import sites keep working.
6927
+ */
6928
+ type LogSink = TelemetrySink;
6591
6929
  /** Conventional DO instance name, passed to `idFromName` to address the single registry instance. */
6592
6930
  declare const SHARD_REGISTRY_DO_NAME: string;
6593
6931
  /**
@@ -6745,4 +7083,4 @@ interface WhereSqlStrategy {
6745
7083
  * `undefined` when the input imposes no constraint (empty `where`).
6746
7084
  */
6747
7085
  declare const compileWhereSql: (where: WhereInput | undefined, strategy: WhereSqlStrategy) => SQL | undefined;
6748
- export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, AGGREGATE_SQL_FUNCTION, AUTH_METRICS_BUCKETS_TABLE, AUTH_METRICS_BUCKET_MS, AUTH_METRICS_BUCKET_RETENTION, AUTH_METRICS_TABLE, type AdvisoriesResult, type AdvisoryFinding, type AggregateIndexDefinitionLike, type AggregateOp, type AggregateOptions, type AggregateResult, type AggregateTally, type ApplyOnDeleteOptions, type AuditEntry, type AuditLogResult, type AuthMetrics, type AuthMetricsBucket, type BroadcastDelta, CDC_LOG_TABLE, type CacheEntry, type CapturedMailRow, type CdcChange, type Clock, type ColumnMeta, type ColumnMetaLike, ConflictError, type CountArgs, CountRlsUnsupportedError, type CtxDbOptions, DATA_MIGRATION_STATE_TABLE, DEFAULT_MAX_RELATION_KEYS, type DataMigrationDocument, type DataMigrationLike, type DataMigrationTransform, type DatabaseWriterLike, type DependencyTracker, type DeployInfo, type ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, FUNCTION_METRICS_BUCKETS_TABLE, FUNCTION_METRICS_BUCKET_MS, FUNCTION_METRICS_BUCKET_RETENTION, FUNCTION_METRICS_INDEX_TABLE, FUNCTION_METRICS_TABLE, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FieldOperators, type FlagEvaluation, type FlagsResult, type FunctionCallStat, type FunctionMetricBucket, type FunctionMetricIndexHit, type FunctionStatsResult, type GroupByEntry, type GroupByOptions, type HibernatableWebSocket, type IdGenerator, type ImportError, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexRangeBuilderLike, LogBuffer, type LogEntry, type LogEventInput, type LogLevel, type LogSink, MAIL_RETENTION, MAIL_TABLE, MAX_SQL_ROWS, MIN_ADMIN_TOKEN_LENGTH, MIN_AUTH_SECRET_LENGTH, type MaskColumnMetadata, type MaskPoliciesResult, type MaterializeResult, type MigrationDirection, type MigrationRunResult, type MigrationStatus, type MigrationStatusRow, type MutationDelta, type NestedWith, NotFoundError, NotUniqueError, type OnDeleteActionLike, type OrderByInput, type OrderKey, type PaginationOptions, type PitrBookmarkResult, type PitrRestoreArgs, type PitrRestoreResult, type PitrStorage, type QueryArgs, type QueryPage, type QueueMetadata, type QueuesResult, RANK_TIEBREAK, RELATION_FUNCTION_PREFIX, RLS_UNWRAP_SYMBOL, ROOT_DO_SIZE_WARN_BYTES, ROOT_SHARD_NAME, type RankDirection, type RankIndexDefinitionLike, type RankOptions, type RankPage, type RankPageOptions, type RankPageRow, type RankPageRowKey, type RankResult, type RankSortKeyLike, ReactiveCache, type ReactiveCacheOptions, type ReadHook, type ReadTablePageOptions, type RecordAuthEventInput, type RecordFunctionMetricInput, type RecordMailInput, type RelationDefinitionLike, type RenderedSql, type ResolveRelationPredicatesOptions, type ResolveWithOptions, type RestrictableQueryOptions, type RlsPoliciesResult, type RlsPolicyMetadata, RlsRequiredError, type RlsRoleMetadata, type RpcRequest, type RunDataMigrationOptions, type RunShardApplyCdcArgs, type RunShardApplyCdcResult, type RunShardBulkDeleteArgs, type RunShardBulkDeleteResult, type RunShardExportArgs, type RunShardImportArgs, type RunShardMigrationArgs, type RunShardRankBeforeArgs, type RunShardRankPageArgs, type RunShardWriteArgs, type RunShardWriteResult, type RunTriggersOptions, SCAN_DEP, SESSION_DO_TTL_DEFAULT, SHARD_REGISTRY_DO_NAME, type SchedulableWorkflowReferenceLike, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type SearchFilterBuilderLike, type SecurityAuditResult, type SecurityFinding, type SecurityFindingKind, type SecurityFindingLevel, type SelectMatchingIdsOptions, type ServerDefaultContextLike, SessionDO, type SessionRecord, type SettingEntry, type SettingKind, type SettingsResult, type ShapeSubscriptionQuery, ShardDO, type ShardDOOptions, type ShardDOState, type ShardRankPageResult, ShardRegistryDO, type SocketAttachment, type SortDirection, type SourceClientLike, type SourceCursorLike, type SourceRefresh, type SqlConsoleResult, type SqlCursor, type SqlEngine, type SqlExec, type StorageRuleMetadata, type StorageRulesResult, type StudioFeaturesResult, type SubscriptionEnvelope, type SubscriptionOutcome, type SubscriptionQuery, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemReaderOptions, type SystemReaderSchedulerLike, type SystemReaderStorageLike, type SystemTableName, type TableColumnsResult, type TableDefinitionLike, type TableIndexInfo, type TableIndexesResult, type TableInfo, type TablePage, type TableReaderLike, type TablesColumnsResult, type TransactionSqlLike, type TriggerContextLike, type TriggerDefinitionLike, type TriggerEventLike, type TriggerOpLike, type TriggerTimingLike, type ValidatorLike, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, aggregateSqlFunction, aggregateTableName, applyCdcChanges, applyOnDelete, applySelect, armRestore, assertFlatPredicate, assertReadonly, assertShapeShardable, assertValidClientId, backfillAggregateIndexes, backfillRankIndexes, buildFtsMatch, buildSecurityAudit, buildSeekWhere, clearCapturedMail, coerceAggregateNumber, compileWhereSql, containsRelationPredicate, createDependencyTracker, createShardCtxDb, createSystemReader, decodeCursor, depKey, diffExternalSource, encodeAggregateKey, encodeCursor, encodePartitionKey, ensureAuthMetricsTables, ensureFunctionMetricsTables, ensureMailTable, exportShardRows, exportShardTable, facetColumn, fanOutScalarCounts, foldAggregateTally, ftsTableName, guardWriter, hasTrigger, importShardRows, isRelationPredicate, isSoftDeleted, isSourceDue, liftSourceId, listTables, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, mergeWhere, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, parseExportShardArgs, parseImportShardArgs, planAggregateLookup, pullExternalSourceIncrementalTick, pullExternalSourceTick, rankTableName, reactiveCacheKey, readAggregateValue, readAuthMetrics, readBookmark, readCapturedMail, readCdcChanges, readExternalSourceBaseline, readFunctionMetricBuckets, readFunctionMetricIndexHits, readFunctionMetrics, readFunctionMetricsTotals, readMigrationStatus, readTablePage, recordAuthEvent, recordCapturedMail, recordFunctionMetric, renderSql, resolveRankPartition, resolveRelationPredicates, resolveWith, runDataMigration, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runTriggers, scoreDocument, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, serveRelationFanout, softDeleteScope, sortColumnName, stableStringify, stableWireKey, stringifySearchText, subscriptionListDeltas, throwingScheduler, tokenizeSearch, trimCdcChanges, validateImportRow };
7086
+ export { ADMIN_FUNCTIONS, ADMIN_FUNCTION_PREFIX, AGGREGATE_SQL_FUNCTION, AUTH_METRICS_BUCKETS_TABLE, AUTH_METRICS_BUCKET_MS, AUTH_METRICS_BUCKET_RETENTION, AUTH_METRICS_TABLE, type AdvisoriesResult, type AdvisoryFinding, type AggregateIndexDefinitionLike, type AggregateOp, type AggregateOptions, type AggregateResult, type AggregateTally, type ApplyOnDeleteOptions, type AuditEntry, type AuditLogResult, type AuthMetrics, type AuthMetricsBucket, type BroadcastDelta, CDC_LOG_TABLE, type CacheEntry, type CapturedMailRow, type CdcChange, type Clock, type ColumnMeta, type ColumnMetaLike, ConflictError, type ContextMetrics, type ContextTracer, type CountArgs, CountRlsUnsupportedError, type CtxDbOptions, DATA_MIGRATION_STATE_TABLE, DEFAULT_MAX_RELATION_KEYS, type DataMigrationDocument, type DataMigrationLike, type DataMigrationTransform, type DatabaseWriterLike, type DependencyTracker, type DeployInfo, type ExportRow, type ExportShardAdminArgs, type ExportShardArgs, type ExternalSourceDiffResult, type ExternalSourceLike, FLAGS_FUNCTION_PREFIX, FUNCTION_METRICS_BUCKETS_TABLE, FUNCTION_METRICS_BUCKET_MS, FUNCTION_METRICS_BUCKET_RETENTION, FUNCTION_METRICS_INDEX_TABLE, FUNCTION_METRICS_TABLE, type FacetColumnOptions, type FacetColumnResult, type FacetValue, type FieldOperators, type FlagEvaluation, type FlagsResult, type FunctionCallStat, type FunctionMetricBucket, type FunctionMetricIndexHit, type FunctionStatsResult, type GroupByEntry, type GroupByOptions, type HibernatableWebSocket, type IdGenerator, type ImportError, type ImportShardAdminArgs, type ImportShardArgs, type ImportShardResult, type IncrementalMaterializeResult, type IndexDefinitionLike, type IndexRangeBuilderLike, LogBuffer, type LogEntry, type LogEventInput, type LogLevel, type LogSink, MAIL_RETENTION, MAIL_TABLE, MAX_SQL_ROWS, MIN_ADMIN_TOKEN_LENGTH, MIN_AUTH_SECRET_LENGTH, type MaskColumnMetadata, type MaskPoliciesResult, type MaterializeResult, type MetricsDeps, type MigrationDirection, type MigrationRunResult, type MigrationStatus, type MigrationStatusRow, type MutationDelta, type NestedWith, NotFoundError, NotUniqueError, type OnDeleteActionLike, type OrderByInput, type OrderKey, type PaginationOptions, type PitrBookmarkResult, type PitrRestoreArgs, type PitrRestoreResult, type PitrStorage, type QueryArgs, type QueryPage, type QueueMetadata, type QueuesResult, RANK_TIEBREAK, RELATION_FUNCTION_PREFIX, RLS_UNWRAP_SYMBOL, ROOT_DO_SIZE_WARN_BYTES, ROOT_SHARD_NAME, type RankDirection, type RankIndexDefinitionLike, type RankOptions, type RankPage, type RankPageOptions, type RankPageRow, type RankPageRowKey, type RankResult, type RankSortKeyLike, ReactiveCache, type ReactiveCacheOptions, type ReadHook, type ReadTablePageOptions, type RecordAuthEventInput, type RecordFunctionMetricInput, type RecordMailInput, type RelationDefinitionLike, type RenderedSql, type ResolveRelationPredicatesOptions, type ResolveWithOptions, type RestrictableQueryOptions, type RlsPoliciesResult, type RlsPolicyMetadata, RlsRequiredError, type RlsRoleMetadata, type RpcRequest, type RunDataMigrationOptions, type RunShardApplyCdcArgs, type RunShardApplyCdcResult, type RunShardBulkDeleteArgs, type RunShardBulkDeleteResult, type RunShardExportArgs, type RunShardImportArgs, type RunShardMigrationArgs, type RunShardRankBeforeArgs, type RunShardRankPageArgs, type RunShardWriteArgs, type RunShardWriteResult, type RunTriggersOptions, SCAN_DEP, SESSION_DO_TTL_DEFAULT, SHARD_REGISTRY_DO_NAME, type SchedulableWorkflowReferenceLike, type ScheduledFunctionDoc, type SchedulerLike, type SchemaLike, type SearchFilterBuilderLike, type SecurityAuditResult, type SecurityFinding, type SecurityFindingKind, type SecurityFindingLevel, type SelectMatchingIdsOptions, type ServerDefaultContextLike, SessionDO, type SessionRecord, type SettingEntry, type SettingKind, type SettingsResult, type ShapeSubscriptionQuery, ShardDO, type ShardDOOptions, type ShardDOState, type ShardRankPageResult, ShardRegistryDO, type SocketAttachment, type SortDirection, type SourceClientLike, type SourceCursorLike, type SourceRefresh, type SqlConsoleResult, type SqlCursor, type SqlEngine, type SqlExec, type StorageRuleMetadata, type StorageRulesResult, type StudioFeaturesResult, type SubscriptionEnvelope, type SubscriptionOutcome, type SubscriptionQuery, type SystemDatabaseReader, type SystemDoc, type SystemQuery, type SystemReaderOptions, type SystemReaderSchedulerLike, type SystemReaderStorageLike, type SystemTableName, type TableColumnsResult, type TableDefinitionLike, type TableIndexInfo, type TableIndexesResult, type TableInfo, type TablePage, type TableReaderLike, type TablesColumnsResult, type TelemetrySink, type TraceAnchor, type TracerDeps, type TransactionSqlLike, type TriggerContextLike, type TriggerDefinitionLike, type TriggerEventLike, type TriggerOpLike, type TriggerTimingLike, type ValidatorLike, type WhereInput, type WhereSqlStrategy, type WithInput, type WorkflowMetadata, type WorkflowsResult, type WriteEvent, type WriteHook, aggregateSqlFunction, aggregateTableName, applyCdcChanges, applyOnDelete, applySelect, armRestore, assertFlatPredicate, assertReadonly, assertShapeShardable, assertValidClientId, backfillAggregateIndexes, backfillRankIndexes, buildFtsMatch, buildSecurityAudit, buildSeekWhere, clearCapturedMail, coerceAggregateNumber, compileWhereSql, containsRelationPredicate, createDependencyTracker, createMetrics, createShardCtxDb, createSystemReader, createTracer, decodeCursor, depKey, diffExternalSource, dispatchRootSpan, encodeAggregateKey, encodeCursor, encodePartitionKey, ensureAuthMetricsTables, ensureFunctionMetricsTables, ensureMailTable, exportShardRows, exportShardTable, facetColumn, fanOutScalarCounts, foldAggregateTally, ftsTableName, guardWriter, hasTrigger, importShardRows, isRelationPredicate, isSoftDeleted, isSourceDue, liftSourceId, listTables, matchesRankStaticWhere, matchesStaticWhere, materializeExternalRows, materializeExternalRowsIncremental, mergeWhere, normalizeCountArgument, normalizeIdStructurally, normalizeOrderKeys, parseExportShardArgs, parseImportShardArgs, planAggregateLookup, pullExternalSourceIncrementalTick, pullExternalSourceTick, rankTableName, reactiveCacheKey, readAggregateValue, readAuthMetrics, readBookmark, readCapturedMail, readCdcChanges, readExternalSourceBaseline, readFunctionMetricBuckets, readFunctionMetricIndexHits, readFunctionMetrics, readFunctionMetricsTotals, readMigrationStatus, readTablePage, recordAuthEvent, recordCapturedMail, recordFunctionMetric, renderSql, resolveRankPartition, resolveRelationPredicates, resolveWith, runDataMigration, runExternalSourceTick, runReadonlySql, runRowValidators, runShardMigrations, runTriggers, scoreDocument, selectExportTables, selectIndexForAggregate, selectIndexForCount, selectIndexForGroupBy, selectMatchingIds, serveRelationFanout, softDeleteScope, sortColumnName, stableStringify, stableWireKey, stringifySearchText, subscriptionListDeltas, throwingScheduler, tokenizeSearch, trimCdcChanges, validateImportRow };