@voltro/runtime 0.83.1 → 0.85.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import { AnyGuardSpec } from '@voltro/protocol';
4
4
  import { AuthMiddleware } from '@voltro/protocol';
5
5
  import { AuthStrategy } from '@voltro/protocol';
6
6
  import { CaughtUpVerdict } from '@voltro/database';
7
+ import { Cause } from 'effect';
7
8
  import { ChangeEvent } from '@voltro/database';
8
9
  import { classifyConstraintViolation } from '@voltro/database';
9
10
  import { clearRetentions } from '@voltro/database';
@@ -18,6 +19,8 @@ import { ConstraintFacts } from '@voltro/database';
18
19
  import { ConstraintKind } from '@voltro/database';
19
20
  import { ConstraintViolation } from '@voltro/protocol';
20
21
  import { Context } from 'effect';
22
+ import { CrdtBackend } from '@voltro/local-first';
23
+ import { CrdtMigration } from '@voltro/local-first';
21
24
  import { createServer } from 'node:http';
22
25
  import { Cron } from 'effect';
23
26
  import { DataStore } from '@voltro/database';
@@ -40,7 +43,7 @@ import { FieldBinding } from '@voltro/database';
40
43
  import { FieldCipher } from '@voltro/database';
41
44
  import { FieldDefinitions } from '@voltro/database';
42
45
  import * as http from 'node:http';
43
- import { HttpClient } from '@effect/platform';
46
+ import { HttpClient } from 'effect/http';
44
47
  import { HttpRequestInterceptor } from '@voltro/protocol';
45
48
  import { HttpRouteObserver } from '@voltro/protocol';
46
49
  import { IdempotencyStore } from '@voltro/protocol';
@@ -64,7 +67,6 @@ import { listRetentionConflicts } from '@voltro/database';
64
67
  import { listRetentions } from '@voltro/database';
65
68
  import { Membership } from '@voltro/protocol';
66
69
  import { Metric } from 'effect';
67
- import { MetricBoundaries } from 'effect';
68
70
  import { MetricReader } from '@opentelemetry/sdk-metrics';
69
71
  import { MutationIdempotencyScope } from '@voltro/protocol';
70
72
  import { NoRowFound } from '@voltro/protocol';
@@ -89,8 +91,8 @@ import { retentionTtlMsFromEnv } from '@voltro/database';
89
91
  import { Row } from '@voltro/database';
90
92
  import { RowKey } from '@voltro/database';
91
93
  import { RowPatch } from '@voltro/protocol';
92
- import { Rpc } from '@effect/rpc';
93
- import { RpcGroup } from '@effect/rpc';
94
+ import { Rpc } from 'effect/rpc';
95
+ import { RpcGroup } from 'effect/rpc';
94
96
  import { RpcInterceptor } from '@voltro/protocol';
95
97
  import { RuleReadStore } from '@voltro/database';
96
98
  import { Sampler } from '@opentelemetry/sdk-trace-base';
@@ -102,7 +104,7 @@ import { ServerOnlyColumnWrite } from '@voltro/protocol';
102
104
  import { ServerResponse } from 'node:http';
103
105
  import { SpanProcessor } from '@opentelemetry/sdk-trace-base';
104
106
  import { spawn } from 'node:child_process';
105
- import { SqlClient } from '@effect/sql';
107
+ import { SqlClient } from 'effect/sql';
106
108
  import { StoredTableShape } from '@voltro/database';
107
109
  import { StoreError } from '@voltro/protocol';
108
110
  import { StoreOperationFailed } from '@voltro/protocol';
@@ -143,19 +145,18 @@ import { WorkflowRunHandle } from '@voltro/protocol';
143
145
  import { WorkflowRunSnapshot as WorkflowRunSnapshot_2 } from '@voltro/protocol';
144
146
  import { WorkflowStartResolution } from '@voltro/workflow';
145
147
  import { WorkflowUpdateResult } from '@voltro/protocol';
148
+ import { YieldableError } from 'effect/Cause';
146
149
 
147
150
  /** Typed denial — declare on an rpc `error:` union so a refusal surfaces to the
148
151
  * client typed + pattern-matchable (never a bare 500). */
149
152
  export declare class AccessDenied extends AccessDenied_base {
150
153
  }
151
154
 
152
- declare const AccessDenied_base: Schema.TaggedErrorClass<AccessDenied, "AccessDenied", {
153
- readonly _tag: Schema.tag<"AccessDenied">;
154
- } & {
155
- action: typeof Schema.String;
156
- resourceType: typeof Schema.String;
157
- resourceId: typeof Schema.String;
158
- }>;
155
+ declare const AccessDenied_base: Schema.Class<AccessDenied, Schema.TaggedStruct<"AccessDenied", {
156
+ readonly action: Schema.String;
157
+ readonly resourceType: Schema.String;
158
+ readonly resourceId: Schema.String;
159
+ }>, YieldableError>;
159
160
 
160
161
  /**
161
162
  * Exported so the rpc boundary can stamp `ChangeEvent.subjectId` with the SAME
@@ -372,13 +373,11 @@ declare class AggregateError_2 extends AggregateError_base {
372
373
  }
373
374
  export { AggregateError_2 as AggregateError }
374
375
 
375
- declare const AggregateError_base: Schema.TaggedErrorClass<AggregateError_2, "AggregateError", {
376
- readonly _tag: Schema.tag<"AggregateError">;
377
- } & {
378
- name: typeof Schema.String;
379
- operation: typeof Schema.String;
380
- cause: typeof Schema.String;
381
- }>;
376
+ declare const AggregateError_base: Schema.Class<AggregateError_2, Schema.TaggedStruct<"AggregateError", {
377
+ readonly name: Schema.String;
378
+ readonly operation: Schema.String;
379
+ readonly cause: Schema.String;
380
+ }>, YieldableError>;
382
381
 
383
382
  export declare type AggregateFailure = AggregateStale | AggregateNotFound | AggregateError_2;
384
383
 
@@ -401,7 +400,10 @@ export declare interface AggregateHandle<Row> {
401
400
  export declare class AggregateMaintainer {
402
401
  private readonly shape;
403
402
  private state;
403
+ private extrema;
404
404
  private readonly groups;
405
+ private readonly positions;
406
+ private nextPosition;
405
407
  constructor(shape: AggregateShape);
406
408
  /** Seed from the full base row-set (boot / after a rescan-from-scratch). */
407
409
  seed(baseRows: ReadonlyArray<Row_4>): void;
@@ -412,6 +414,11 @@ export declare class AggregateMaintainer {
412
414
  applyChange(delta: CdcDelta): ReadonlyArray<string>;
413
415
  /** Rebuild the flagged groups from the current base rows (min/max recovery). */
414
416
  resolveRescan(rescanGroups: ReadonlyArray<string>, baseRows: ReadonlyArray<Row_4>): void;
417
+ /** Read only the requested live groups, with insertion-order identities.
418
+ * A group deleted and reinserted receives a new position, matching materialize. */
419
+ materializeGroups(keys: ReadonlyArray<string>): ReadonlyArray<MaintainedGroup & {
420
+ readonly rowIndex: number;
421
+ }>;
415
422
  /** The current materialized result — one entry per non-empty group. */
416
423
  materialize(): ReadonlyArray<MaintainedGroup>;
417
424
  private groupValues;
@@ -438,11 +445,9 @@ export declare interface AggregateMeta {
438
445
  export declare class AggregateNotFound extends AggregateNotFound_base {
439
446
  }
440
447
 
441
- declare const AggregateNotFound_base: Schema.TaggedErrorClass<AggregateNotFound, "AggregateNotFound", {
442
- readonly _tag: Schema.tag<"AggregateNotFound">;
443
- } & {
444
- name: typeof Schema.String;
445
- }>;
448
+ declare const AggregateNotFound_base: Schema.Class<AggregateNotFound, Schema.TaggedStruct<"AggregateNotFound", {
449
+ readonly name: Schema.String;
450
+ }>, YieldableError>;
446
451
 
447
452
  export declare interface AggregateQuery {
448
453
  readonly event: string;
@@ -520,7 +525,7 @@ export declare type AggregateRefreshPolicy = string | {
520
525
  export declare class AggregateRegistry extends AggregateRegistry_base {
521
526
  }
522
527
 
523
- declare const AggregateRegistry_base: Context.TagClass<AggregateRegistry, "@voltro/AggregateRegistry", {
528
+ declare const AggregateRegistry_base: Context.ServiceClass<AggregateRegistry, "@voltro/AggregateRegistry", {
524
529
  /** Resolve a typed handle from the definition. The cli registers
525
530
  * every discovered aggregate at boot; calling this with an unknown
526
531
  * def returns a handle whose methods all fail with
@@ -546,13 +551,11 @@ export declare interface AggregateShape {
546
551
  export declare class AggregateStale extends AggregateStale_base {
547
552
  }
548
553
 
549
- declare const AggregateStale_base: Schema.TaggedErrorClass<AggregateStale, "AggregateStale", {
550
- readonly _tag: Schema.tag<"AggregateStale">;
551
- } & {
552
- name: typeof Schema.String;
553
- ageMs: typeof Schema.Number;
554
- maxAgeMs: typeof Schema.Number;
555
- }>;
554
+ declare const AggregateStale_base: Schema.Class<AggregateStale, Schema.TaggedStruct<"AggregateStale", {
555
+ readonly name: Schema.String;
556
+ readonly ageMs: Schema.Number;
557
+ readonly maxAgeMs: Schema.Number;
558
+ }>, YieldableError>;
556
559
 
557
560
  export declare interface AnalyticsBucket {
558
561
  readonly bucketStart: Date;
@@ -568,12 +571,10 @@ export declare interface AnalyticsBucket {
568
571
  export declare class AnalyticsCapabilityNotSupported extends AnalyticsCapabilityNotSupported_base {
569
572
  }
570
573
 
571
- declare const AnalyticsCapabilityNotSupported_base: Schema.TaggedErrorClass<AnalyticsCapabilityNotSupported, "AnalyticsCapabilityNotSupported", {
572
- readonly _tag: Schema.tag<"AnalyticsCapabilityNotSupported">;
573
- } & {
574
- provider: typeof Schema.String;
575
- capability: typeof Schema.String;
576
- }>;
574
+ declare const AnalyticsCapabilityNotSupported_base: Schema.Class<AnalyticsCapabilityNotSupported, Schema.TaggedStruct<"AnalyticsCapabilityNotSupported", {
575
+ readonly provider: Schema.String;
576
+ readonly capability: Schema.String;
577
+ }>, YieldableError>;
577
578
 
578
579
  /**
579
580
  * The underlying sink raised an error. `cause` is stringified for
@@ -582,13 +583,11 @@ declare const AnalyticsCapabilityNotSupported_base: Schema.TaggedErrorClass<Anal
582
583
  export declare class AnalyticsError extends AnalyticsError_base {
583
584
  }
584
585
 
585
- declare const AnalyticsError_base: Schema.TaggedErrorClass<AnalyticsError, "AnalyticsError", {
586
- readonly _tag: Schema.tag<"AnalyticsError">;
587
- } & {
588
- provider: typeof Schema.String;
589
- operation: typeof Schema.String;
590
- cause: typeof Schema.String;
591
- }>;
586
+ declare const AnalyticsError_base: Schema.Class<AnalyticsError, Schema.TaggedStruct<"AnalyticsError", {
587
+ readonly provider: Schema.String;
588
+ readonly operation: Schema.String;
589
+ readonly cause: Schema.String;
590
+ }>, YieldableError>;
592
591
 
593
592
  /**
594
593
  * One analytics event. `properties` must be JSON-serialisable —
@@ -786,7 +785,7 @@ export declare interface AnalyticsMirrorUpsert {
786
785
  export declare class AnalyticsSink extends AnalyticsSink_base {
787
786
  }
788
787
 
789
- declare const AnalyticsSink_base: Context.TagClass<AnalyticsSink, "@voltro/AnalyticsSink", AnalyticsSinkImpl>;
788
+ declare const AnalyticsSink_base: Context.ServiceClass<AnalyticsSink, "@voltro/AnalyticsSink", AnalyticsSinkImpl>;
790
789
 
791
790
  /**
792
791
  * The runtime contract every analytics provider implements. Plugins
@@ -1674,7 +1673,7 @@ export declare interface AttachFinopsOptions {
1674
1673
  /** The descriptor shape the audit needs — a `defineQuery` result carries it. */
1675
1674
  export declare interface AuditableQuery {
1676
1675
  readonly name: string;
1677
- readonly output: Schema.Schema.Any;
1676
+ readonly output: Schema.Top;
1678
1677
  /** Declared source table(s) — the tables whose serverOnly columns must not leak. */
1679
1678
  readonly source?: string | ReadonlyArray<string> | undefined;
1680
1679
  }
@@ -1844,7 +1843,7 @@ export declare const bindMutation: <Input, Output, E = never>(execute: (input: I
1844
1843
  * schema keeps exactly the old behaviour rather than collapsing errors it
1845
1844
  * cannot classify.
1846
1845
  */
1847
- declaredError?: Schema.Schema.All, idempotencyScope?: MutationIdempotencyScope) => Effect.Effect<Output, E, SubjectService | ConnectionInfo>;
1846
+ declaredError?: Schema.Top, idempotencyScope?: MutationIdempotencyScope) => Effect.Effect<Output, E, SubjectService | ConnectionInfo>;
1848
1847
 
1849
1848
  /**
1850
1849
  * Bind a non-reactive server→client stream (A3). The executor builds a
@@ -1876,7 +1875,7 @@ guards?: ReadonlyArray<unknown> | undefined,
1876
1875
  guardInput?: unknown) => Stream.Stream<Element, Err, SubjectService | ConnectionInfo>;
1877
1876
 
1878
1877
  /**
1879
- * Build a `Stream<SubscriptionEvent<T>>` that an @effect/rpc streaming
1878
+ * Build a `Stream<SubscriptionEvent<T>>` that an effect/rpc streaming
1880
1879
  * handler can return directly. The descriptor is built by the route's
1881
1880
  * executor from the input + the per-call `RuntimeContext` (subject +
1882
1881
  * traceId) we derive from the auth-middleware's resolved subject.
@@ -2185,7 +2184,7 @@ export declare interface CircuitBreakerOptions {
2185
2184
  /** Consecutive failures before the breaker opens. */
2186
2185
  readonly failureThreshold: number;
2187
2186
  /** Wait before transitioning open → half-open (Duration or string). */
2188
- readonly resetTimeout: Duration.DurationInput;
2187
+ readonly resetTimeout: Duration.Input;
2189
2188
  /** Successes required in half-open before closing again. Default 1. */
2190
2189
  readonly halfOpenSuccessThreshold?: number;
2191
2190
  /** Predicate: does this error count toward the threshold? Default: all
@@ -2203,14 +2202,12 @@ export declare interface CircuitBreakerOptions {
2203
2202
  export declare class CircuitOpen extends CircuitOpen_base {
2204
2203
  }
2205
2204
 
2206
- declare const CircuitOpen_base: Schema.TaggedErrorClass<CircuitOpen, "CircuitOpen", {
2207
- readonly _tag: Schema.tag<"CircuitOpen">;
2208
- } & {
2205
+ declare const CircuitOpen_base: Schema.Class<CircuitOpen, Schema.TaggedStruct<"CircuitOpen", {
2209
2206
  /** Breaker name (the `name` option, or `'circuit'` when unnamed). */
2210
- name: typeof Schema.String;
2207
+ readonly name: Schema.String;
2211
2208
  /** Best-effort ms until the breaker next admits a probe call. */
2212
- retryAfterMs: typeof Schema.Number;
2213
- }>;
2209
+ readonly retryAfterMs: Schema.Number;
2210
+ }>, Cause.YieldableError>;
2214
2211
 
2215
2212
  export declare type CircuitState = 'closed' | 'open' | 'half-open';
2216
2213
 
@@ -2744,7 +2741,7 @@ export declare type CoordinationOutcome = 'single' | 'wonLock' | 'lostLock' | 'e
2744
2741
  * instance should run the firing. Implementations:
2745
2742
  * - SingleCoordinator → always true (one process)
2746
2743
  * - AdvisoryLockCoordinator → postgres advisory lock (wired in CLI)
2747
- * - ClusterCoordinator → @effect/cluster shard (future)
2744
+ * - ClusterCoordinator → effect/cluster shard (future)
2748
2745
  */
2749
2746
  export declare interface Coordinator {
2750
2747
  readonly kind: 'single' | 'advisoryLock' | 'cluster';
@@ -2983,7 +2980,7 @@ export declare interface CostEvent {
2983
2980
  export declare class CostRegistry extends CostRegistry_base {
2984
2981
  }
2985
2982
 
2986
- declare const CostRegistry_base: Context.TagClass<CostRegistry, "@voltro/CostRegistry", CostRegistryApi>;
2983
+ declare const CostRegistry_base: Context.ServiceClass<CostRegistry, "@voltro/CostRegistry", CostRegistryApi>;
2987
2984
 
2988
2985
  export declare interface CostRegistryApi {
2989
2986
  /** Per-tenant compute-cost attribution — the chargeback feed. */
@@ -3000,8 +2997,8 @@ export declare interface CostRegistryApi {
3000
2997
  readonly subscribe: (listener: (s: CostBudgetSignal) => void) => () => void;
3001
2998
  }
3002
2999
 
3003
- /** Define a cumulative counter. Increment with `incrementMetric` / `Metric.increment`. */
3004
- export declare const counter: (name: string, description?: string) => Metric.Metric.Counter<number>;
3000
+ /** Define a cumulative counter. Increment with `incrementMetric` / `Metric.update(metric, 1)`. */
3001
+ export declare const counter: (name: string, description?: string) => Metric.Counter<number>;
3005
3002
 
3006
3003
  /**
3007
3004
  * Count workflows actively EXECUTING (`_voltro_workflow_runs.status =
@@ -3011,8 +3008,98 @@ export declare const counter: (name: string, description?: string) => Metric.Met
3011
3008
  */
3012
3009
  export declare const countRunningWorkflows: (store: DataStore) => Promise<number>;
3013
3010
 
3011
+ export declare const CRDT_VERSIONS_TABLE = "_voltro_crdt_versions";
3012
+
3013
+ export declare interface CrdtAdmission {
3014
+ readonly maxUpdateBytes?: number | null;
3015
+ readonly maxDocumentBytes?: number | null;
3016
+ readonly rebaseMaxBytes?: number | null;
3017
+ /** Content migrations per table and column — see `crdt.migrations`. */
3018
+ readonly migrations?: Readonly<Record<string, Readonly<Record<string, ReadonlyArray<CrdtMigration>>>>> | null;
3019
+ readonly validate?: CrdtValidator | null;
3020
+ }
3021
+
3022
+ /** A CRDT backend the server can be configured with (`crdt.backend`). */
3023
+ export declare type CrdtBackendChoice = CrdtBackend;
3024
+
3025
+ /** A CRDT cell: table + row id + column. */
3026
+ export declare interface CrdtCellRef {
3027
+ readonly table: string;
3028
+ readonly id: string;
3029
+ readonly column: string;
3030
+ }
3031
+
3032
+ /** What a CRDT cell looks like from the inside — the data an inspector panel
3033
+ * or an alert reads to see a document approaching its limits. */
3034
+ export declare interface CrdtCellStats {
3035
+ /** Stored bytes of the encoded state. */
3036
+ readonly bytes: number;
3037
+ /** The epoch it was last rebased into (`null`: never). */
3038
+ readonly epoch: string | null;
3039
+ /** How many writer sessions its history holds — what grows it. */
3040
+ readonly authors: number;
3041
+ /** Archived versions (snapshots, restores, rebases). */
3042
+ readonly versions: number;
3043
+ /** The limits the write path applies to it. */
3044
+ readonly limits: {
3045
+ readonly compactMaxBytes: number;
3046
+ readonly rebaseMaxBytes: number;
3047
+ readonly maxDocumentBytes: number;
3048
+ readonly maxUpdateBytes: number;
3049
+ };
3050
+ }
3051
+
3052
+ /** The cell's size, epoch, author count and history length, through the
3053
+ * caller's scope. `undefined` when the row is not visible. */
3054
+ export declare const crdtCellStats: (store: CrdtHistoryStore, cell: CrdtCellRef) => Promise<CrdtCellStats | undefined>;
3055
+
3014
3056
  export declare const crdtCompactMaxBytes: () => number;
3015
3057
 
3058
+ /** The slice of a store these functions use — `ctx.store` satisfies it. */
3059
+ export declare interface CrdtHistoryStore {
3060
+ readonly query: (descriptor: never) => Promise<ReadonlyArray<unknown>>;
3061
+ readonly insert: (table: never, row: never) => Promise<unknown>;
3062
+ readonly update: (table: never, id: never, patch: never) => Promise<unknown>;
3063
+ }
3064
+
3065
+ /** The effective per-document limit in bytes (`0` = unlimited). */
3066
+ export declare const crdtMaxDocumentBytes: () => number;
3067
+
3068
+ /** The effective per-update limit in bytes (`0` = unlimited). */
3069
+ export declare const crdtMaxUpdateBytes: () => number;
3070
+
3071
+ /** The content migrations declared for a CRDT column (`crdt.migrations`). */
3072
+ export declare const crdtMigrationsFor: (table: string, column: string) => ReadonlyArray<CrdtMigration>;
3073
+
3074
+ /** The effective hard-compaction threshold in bytes (`0` = never). */
3075
+ export declare const crdtRebaseMaxBytes: () => number;
3076
+
3077
+ /** Refuse a write by returning a message key (`'doc.tooLong'`); accept with
3078
+ * `undefined`. Runs on the server, synchronously, on the write path. */
3079
+ export declare type CrdtValidator = (write: CrdtWriteToValidate) => string | undefined;
3080
+
3081
+ /** One version as a history list shows it — never the bytes. */
3082
+ export declare interface CrdtVersion {
3083
+ readonly id: string;
3084
+ readonly reason: 'snapshot' | 'restore' | 'rebase';
3085
+ readonly label: string | null;
3086
+ readonly epoch: string | null;
3087
+ readonly createdBy: string | null;
3088
+ readonly createdAt: Date;
3089
+ }
3090
+
3091
+ /** What `crdt.validate` is handed for every merged CRDT write. */
3092
+ export declare interface CrdtWriteToValidate {
3093
+ readonly table: string;
3094
+ readonly column: string;
3095
+ /** The merged state about to be stored. */
3096
+ readonly state: Uint8Array;
3097
+ /** The stored state before this write, `undefined` on the first. */
3098
+ readonly previous: Uint8Array | undefined;
3099
+ /** The client's incoming update. */
3100
+ readonly update: Uint8Array;
3101
+ }
3102
+
3016
3103
  /**
3017
3104
  * The cron expression that fires `intervalMs` apart, or `undefined` when no
3018
3105
  * five-field expression does.
@@ -3332,6 +3419,15 @@ export declare const DEFAULT_COMPRESSION_MIN_BYTES = 1024;
3332
3419
 
3333
3420
  export declare const DEFAULT_CRDT_COMPACT_MAX_BYTES: number;
3334
3421
 
3422
+ export declare const DEFAULT_CRDT_MAX_DOCUMENT_BYTES: number;
3423
+
3424
+ export declare const DEFAULT_CRDT_MAX_UPDATE_BYTES: number;
3425
+
3426
+ /** Above this, a merged document is HARD-compacted into a new epoch (its old
3427
+ * lineage archived first). Soft compaction keeps every struct of a document
3428
+ * edited by many sessions; this is what bounds it. */
3429
+ export declare const DEFAULT_CRDT_REBASE_MAX_BYTES: number;
3430
+
3335
3431
  /**
3336
3432
  * How many subscribers one change event is delivered to CONCURRENTLY.
3337
3433
  *
@@ -3684,6 +3780,14 @@ export declare const deliveredRowCount: (value: unknown) => number;
3684
3780
  */
3685
3781
  export declare const deriveKey: (passphrase: string) => Buffer;
3686
3782
 
3783
+ /** Size-only facts about a stored CRDT state — its epoch and how many writer
3784
+ * sessions its history carries. For inspection; `undefined` when the bytes
3785
+ * do not decode (an `.encrypted()` column stores ciphertext). */
3786
+ export declare const describeCrdtState: (state: Uint8Array) => {
3787
+ readonly epoch: string | null;
3788
+ readonly authors: number;
3789
+ } | undefined;
3790
+
3687
3791
  export declare const describeOtelReasons: (why: OtelNeededBecause) => ReadonlyArray<string>;
3688
3792
 
3689
3793
  /**
@@ -3876,6 +3980,8 @@ export declare class Dispatcher {
3876
3980
  /** Query labels already warned about for an undeclared raw read, so a hot
3877
3981
  * subscription logs once rather than once per subscriber. */
3878
3982
  private readonly rawReadWarned;
3983
+ private changeEpoch;
3984
+ private readonly committedReads;
3879
3985
  /** The CRDT-managed columns of `table` (empty when it has none) — what a
3880
3986
  * subscription's backpressure outbox folds incrementally. */
3881
3987
  crdtColumnsFor(table: string): ReadonlySet<string>;
@@ -4106,7 +4212,7 @@ export declare interface DrainDeps<R = never> {
4106
4212
  * inject `exit` and drive a finalizer that genuinely never finishes.
4107
4213
  */
4108
4214
  export declare const drainForShutdown: (options: {
4109
- readonly fibers: ReadonlyArray<Fiber.RuntimeFiber<void, unknown>>;
4215
+ readonly fibers: ReadonlyArray<Fiber.Fiber<void, unknown>>;
4110
4216
  readonly hooks: ReadonlyArray<() => void | Promise<void>>;
4111
4217
  readonly deadlineMs: number;
4112
4218
  readonly exit: () => void;
@@ -4196,7 +4302,7 @@ export declare const effectiveRelations: (subject: RebacSubject, resource: Rebac
4196
4302
  export declare class EffectStore extends EffectStore_base {
4197
4303
  }
4198
4304
 
4199
- declare const EffectStore_base: Context.TagClass<EffectStore, "@voltro/EffectStore", EffectStoreOps>;
4305
+ declare const EffectStore_base: Context.ServiceClass<EffectStore, "@voltro/EffectStore", EffectStoreOps>;
4200
4306
 
4201
4307
  export declare interface EffectStoreOps {
4202
4308
  /** Typed the same way `FluentStore.query` is — the row type rides in on the
@@ -4450,6 +4556,8 @@ export declare class EventBus {
4450
4556
  * sacrificed under pressure, never delivery.
4451
4557
  */
4452
4558
  private evictIfOverCapacity;
4559
+ /** Select a bounded batch, preserving insertion order for equal timestamps. */
4560
+ private coldestIdleRoutes;
4453
4561
  /**
4454
4562
  * Drop what the ring may no longer replay.
4455
4563
  *
@@ -4655,7 +4763,7 @@ export declare interface EventPublishContext {
4655
4763
  }
4656
4764
 
4657
4765
  export declare interface EventPublisher {
4658
- publish<Name extends string, Key extends Schema.Schema.Any, Payload extends Schema.Schema.Any>(descriptor: EventDescriptor<Name, Key, Payload>, key: Schema.Schema.Type<Key>, payload: Schema.Schema.Type<Payload>): AwaitableEffect<EventPublishResult, EventPublishError>;
4766
+ publish<Name extends string, Key extends Schema.Top, Payload extends Schema.Top>(descriptor: EventDescriptor<Name, Key, Payload>, key: Schema.Schema.Type<Key>, payload: Schema.Schema.Type<Payload>): AwaitableEffect<EventPublishResult, EventPublishError>;
4659
4767
  }
4660
4768
 
4661
4769
  export declare type EventPublishError = EventPayloadInvalid | EventKeyInvalid | EventPayloadTooLarge;
@@ -4740,9 +4848,9 @@ export declare const exchangeAuthorizationCode: (definition: OAuth2ConnectionDef
4740
4848
  * `defineMutation` / `defineAction` result carries all of it. */
4741
4849
  export declare interface ExecutorDescriptor {
4742
4850
  readonly kind: 'query' | 'mutation' | 'action';
4743
- readonly input: Schema.Schema.Any;
4744
- readonly output: Schema.Schema.Any;
4745
- readonly error: Schema.Schema.All;
4851
+ readonly input: Schema.Top;
4852
+ readonly output: Schema.Top;
4853
+ readonly error: Schema.Top;
4746
4854
  }
4747
4855
 
4748
4856
  /** The failure type of an executor's return, when it returns an Effect. A
@@ -4910,7 +5018,7 @@ export declare type ExpectationInvariant = {
4910
5018
  export declare class ExpectationRegistry extends ExpectationRegistry_base {
4911
5019
  }
4912
5020
 
4913
- declare const ExpectationRegistry_base: Context.TagClass<ExpectationRegistry, "@voltro/ExpectationRegistry", ExpectationRegistryApi>;
5021
+ declare const ExpectationRegistry_base: Context.ServiceClass<ExpectationRegistry, "@voltro/ExpectationRegistry", ExpectationRegistryApi>;
4914
5022
 
4915
5023
  export declare interface ExpectationRegistryApi {
4916
5024
  /** Snapshot every registered expectation's current state — the inspect feed. */
@@ -5174,7 +5282,7 @@ export declare type ExperimentMetricKind = ExperimentMetric['kind'];
5174
5282
  export declare class ExperimentRegistry extends ExperimentRegistry_base {
5175
5283
  }
5176
5284
 
5177
- declare const ExperimentRegistry_base: Context.TagClass<ExperimentRegistry, "@voltro/ExperimentRegistry", ExperimentRegistryApi>;
5285
+ declare const ExperimentRegistry_base: Context.ServiceClass<ExperimentRegistry, "@voltro/ExperimentRegistry", ExperimentRegistryApi>;
5178
5286
 
5179
5287
  export declare interface ExperimentRegistryApi {
5180
5288
  /** Snapshot every registered experiment's current result — the inspect feed. */
@@ -5264,6 +5372,12 @@ export declare interface ExperimentVariantSpec {
5264
5372
  readonly weight?: number;
5265
5373
  }
5266
5374
 
5375
+ export declare const exponentialBoundaries: (options: {
5376
+ readonly start: number;
5377
+ readonly factor: number;
5378
+ readonly count: number;
5379
+ }) => ReadonlyArray<number>;
5380
+
5267
5381
  /**
5268
5382
  * How far AHEAD of now an external trigger's stated instant may be.
5269
5383
  *
@@ -5352,12 +5466,12 @@ export declare type ExternalTriggerOutcome =
5352
5466
  export { extractDbCause }
5353
5467
 
5354
5468
  /** The literal `_tag`s of a failure type. `any` contributes none (nothing can
5355
- * be proven about it); `UnknownException` — Effect's wrapper for a failure it
5469
+ * be proven about it); `UnknownError` — Effect's wrapper for a failure it
5356
5470
  * could not type, e.g. `Effect.tryPromise` without `catch` — counts as
5357
5471
  * untagged, which is what it means. */
5358
5472
  declare type FailureTag<E> = 0 extends (1 & E) ? never : E extends {
5359
5473
  readonly _tag: infer T;
5360
- } ? T extends 'UnknownException' ? never : T extends string ? T : never : never;
5474
+ } ? T extends 'UnknownError' ? never : T extends string ? T : never : never;
5361
5475
 
5362
5476
  export declare interface FieldChange {
5363
5477
  readonly from: unknown;
@@ -5558,14 +5672,9 @@ export declare interface FluentStoreBackend {
5558
5672
  * rbac role-derived scopes) via `hasEffectiveScope` — so `admin:full` sees every
5559
5673
  * such column, exactly as it satisfies every guard.
5560
5674
  *
5561
- * SUBJECT-INDEPENDENCE is deliberate and load-bearing: when the table declares
5562
- * NO `.readableBy(...)` column, this returns exactly `serverOnlyColumnNames` —
5563
- * the same set for every subject — so the Dispatcher's per-subscriber strip
5564
- * collapses to Part A's behaviour and its read/diff memo still shares one array
5565
- * across all subscribers of a change. Only a table that actually carries a
5566
- * `.readableBy(...)` column pays the per-subject cost (different subjects get
5567
- * different stripped arrays, the same accepted cost `.serverOnly()` already has
5568
- * whenever it strips anything).
5675
+ * With no `.readableBy(...)` metadata every subject resolves the same column
5676
+ * list. The dispatch-local strip memo can then share ordinary stripped rows;
5677
+ * this helper itself neither clones rows nor caches mutable metadata or scopes.
5569
5678
  *
5570
5679
  * An unknown / unregistered table forbids nothing (returns `[]`) rather than
5571
5680
  * throwing — same posture as `serverOnlyColumnNames`.
@@ -5635,7 +5744,7 @@ export declare const frameworkDeviceStrategy: (service: DeviceServiceShape, opts
5635
5744
  }) => AuthStrategy;
5636
5745
 
5637
5746
  /** Define a gauge (set with `setMetric`). */
5638
- export declare const gauge: (name: string, description?: string) => Metric.Metric.Gauge<number>;
5747
+ export declare const gauge: (name: string, description?: string) => Metric.Gauge<number>;
5639
5748
 
5640
5749
  /** Generate a fresh token `<prefix><40-char-base64url>`. */
5641
5750
  export declare const generateApiKeyToken: (prefix?: string) => string;
@@ -5746,7 +5855,7 @@ export declare interface HealthConfigInput {
5746
5855
  }
5747
5856
 
5748
5857
  /** Define a histogram. `boundaries` default to the framework duration buckets. */
5749
- export declare const histogramMetric: (name: string, boundaries?: MetricBoundaries.MetricBoundaries, description?: string) => Metric.Metric.Histogram<number>;
5858
+ export declare const histogramMetric: (name: string, boundaries?: ReadonlyArray<number>, description?: string) => Metric.Histogram<number>;
5750
5859
 
5751
5860
  /**
5752
5861
  * Full-lineage provenance from versioning history rows (oldest-first input).
@@ -5783,7 +5892,7 @@ export declare interface HttpSecretsOptions {
5783
5892
 
5784
5893
  /**
5785
5894
  * WS-rpc idempotency store + TTL, passed to `bindMutation` as a closure param by
5786
- * the boot path (`serveApi`/`dev`) — NOT a service. @effect/rpc runs a handler in
5895
+ * the boot path (`serveApi`/`dev`) — NOT a service. effect/rpc runs a handler in
5787
5896
  * a NARROWED context (only the middleware `provides` + declared deps), so a plain
5788
5897
  * merged service is invisible to `Effect.serviceOption` inside the handler; the
5789
5898
  * store+ttl are boot-time constants the bind site already holds, so a closure is
@@ -5843,6 +5952,7 @@ export declare class IndexedMatcher implements Matcher {
5843
5952
  private readonly columnByTable;
5844
5953
  private readonly rangeByTable;
5845
5954
  private readonly tupleByTable;
5955
+ private readonly compositeByTable;
5846
5956
  private readonly unindexedByTable;
5847
5957
  private readonly subscriptions;
5848
5958
  register(sub: SubscriptionRecord): void;
@@ -6351,7 +6461,7 @@ export declare interface KvFacade {
6351
6461
  * the backend `KvStore` (R = never), so both boot paths hand it to handlers
6352
6462
  * as `Layer.succeed(Kv, service)` — enabling `yield* Kv` in Effect handlers
6353
6463
  * exactly like `Layer.succeed(Cache, cacheService)` does for the cache. */
6354
- readonly service: Kv;
6464
+ readonly service: Effect.Success<typeof Kv>;
6355
6465
  /** The resolved backend kind — for boot logging. */
6356
6466
  readonly backend: 'database' | 'redis' | 'memory';
6357
6467
  /** Tear down the managed runtime (closes a pooled redis connection). */
@@ -6405,6 +6515,12 @@ export declare interface LevelReactionDefinition extends ReactionBase {
6405
6515
  readonly guards?: Omit<ReactionGuards, 'dedupeKey'>;
6406
6516
  }
6407
6517
 
6518
+ export declare const linearBoundaries: (options: {
6519
+ readonly start: number;
6520
+ readonly width: number;
6521
+ readonly count: number;
6522
+ }) => ReadonlyArray<number>;
6523
+
6408
6524
  export declare class LinearScanMatcher implements Matcher {
6409
6525
  private readonly byTable;
6410
6526
  register(sub: SubscriptionRecord): void;
@@ -6417,6 +6533,10 @@ export declare class LinearScanMatcher implements Matcher {
6417
6533
  /** Every connection the app declares, projected for ONE subject. */
6418
6534
  export declare const listConnectionStates: (store: VaultStore, registry: ConnectionRegistry, subjectId: string) => Promise<ReadonlyArray<ConnectionState_2>>;
6419
6535
 
6536
+ /** The cell's versions, newest first — without their bytes. Empty when the
6537
+ * row is not visible to the caller. */
6538
+ export declare const listCrdtVersions: (store: CrdtHistoryStore, cell: CrdtCellRef) => Promise<ReadonlyArray<CrdtVersion>>;
6539
+
6420
6540
  export declare const listResourcePolicies: () => ReadonlyArray<ResourcePolicy>;
6421
6541
 
6422
6542
  export { listRetentionConflicts }
@@ -6755,7 +6875,7 @@ export declare const makeListConnectionsExecutor: (deps: ConnectionBuiltinDeps)
6755
6875
  * round-trip it — a guard for exotic schemas; for a value the handler actually
6756
6876
  * produced, `encodeUnknownSync` never throws. `undefined` schema → no codec.
6757
6877
  */
6758
- export declare const makeMutationOutputCodec: (outputSchema: Schema.Schema.AnyNoContext | undefined) => MutationOutputCodec<unknown> | undefined;
6878
+ export declare const makeMutationOutputCodec: (outputSchema: Schema.Top | undefined) => MutationOutputCodec<unknown> | undefined;
6759
6879
 
6760
6880
  /**
6761
6881
  * Build the shared mutation runner. Used by BOTH the rpc WS handler and
@@ -7208,10 +7328,9 @@ export declare const mergeCookieHeader: (existing: string | undefined, patch: Re
7208
7328
  */
7209
7329
  export declare const mergeFleetObservations: <T>(rows: ReadonlyArray<ReplicaObservationRow>, members: ReadonlyArray<FleetMember>, staleAfterMs?: number) => FleetMergeResult<T>;
7210
7330
 
7211
- export { MetricBoundaries }
7212
-
7213
7331
  export declare interface MetricBucketPoint {
7214
- /** Upper bound (Prometheus `le`); `Infinity` for the catch-all bucket. */
7332
+ /** Upper bound (Prometheus `le`). Effect 4 reports the declared boundaries only;
7333
+ * the catch-all is the sample's `count` (the Prometheus exporter writes `+Inf` from it). */
7215
7334
  readonly le: number;
7216
7335
  /** Cumulative count ≤ le. */
7217
7336
  readonly count: number;
@@ -7245,6 +7364,25 @@ export declare type MetricSampleType = 'counter' | 'gauge' | 'histogram' | 'summ
7245
7364
  * into the OTel MeterProvider when a `metricReader` is configured. */
7246
7365
  export declare type MetricsMode = 'off' | 'console' | 'otlp' | 'memory';
7247
7366
 
7367
+ /**
7368
+ * Bring every stored document of a CRDT column to the latest content schema
7369
+ * (`crdt.migrations`) — the batch half of a migration. Documents are migrated
7370
+ * on their next write anyway; this does it now, so readers that never write
7371
+ * see the new shape too. Each row is touched with an EMPTY update, which runs
7372
+ * the write path's fold — and with it the migrations, under the same
7373
+ * compare-and-swap, so running this from two replicas at once migrates each
7374
+ * document once. Rows are read through the store it is given, so tenant scope
7375
+ * applies; run it with a system store to cover every tenant.
7376
+ */
7377
+ export declare const migrateCrdtColumn: (store: CrdtHistoryStore, options: {
7378
+ readonly table: string;
7379
+ readonly column: string;
7380
+ readonly batchSize?: number;
7381
+ }) => Promise<{
7382
+ readonly scanned: number;
7383
+ readonly migrated: number;
7384
+ }>;
7385
+
7248
7386
  /** The lowest cadence any platform scheduler can express. */
7249
7387
  export declare const MIN_EXTERNALIZABLE_INTERVAL_MS = 60000;
7250
7388
 
@@ -7686,12 +7824,10 @@ export declare class OptimisticLockError extends OptimisticLockError_base {
7686
7824
  get message(): string;
7687
7825
  }
7688
7826
 
7689
- declare const OptimisticLockError_base: Schema.TaggedErrorClass<OptimisticLockError, "OptimisticLockError", {
7690
- readonly _tag: Schema.tag<"OptimisticLockError">;
7691
- } & {
7692
- table: typeof Schema.String;
7693
- expected: typeof Schema.Number;
7694
- }>;
7827
+ declare const OptimisticLockError_base: Schema.Class<OptimisticLockError, Schema.TaggedStruct<"OptimisticLockError", {
7828
+ readonly table: Schema.String;
7829
+ readonly expected: Schema.Number;
7830
+ }>, YieldableError>;
7695
7831
 
7696
7832
  export declare interface OrchestratorTickDeps {
7697
7833
  readonly store: DataStore;
@@ -7761,7 +7897,7 @@ export declare interface OriginGuardConfig {
7761
7897
  export declare type OriginGuardMode = 'off' | 'same-origin';
7762
7898
 
7763
7899
  /**
7764
- * Map an `import('@effect/opentelemetry')` rejection to what the reader needs.
7900
+ * Map an `import('@effect/opentelemetry/NodeSdk')` rejection to what the reader needs.
7765
7901
  *
7766
7902
  * Exported so the branch is testable without uninstalling the package. Only a
7767
7903
  * module-NOT-FOUND becomes the install instruction: anything else is a real
@@ -8023,7 +8159,7 @@ export declare interface PatConnectionDefinition extends ConnectionDefinitionCom
8023
8159
  * validity — but `voltro doctor`'s static `workflows.start` audit calls the same
8024
8160
  * function, so the two cannot disagree about what a payload requires.
8025
8161
  */
8026
- export declare const payloadPropertyNames: (schema: Schema.Schema.Any) => {
8162
+ export declare const payloadPropertyNames: (schema: Schema.Top) => {
8027
8163
  readonly required: ReadonlyArray<string>;
8028
8164
  readonly optional: ReadonlyArray<string>;
8029
8165
  };
@@ -8117,17 +8253,31 @@ export declare interface PluginRefRule {
8117
8253
  }
8118
8254
 
8119
8255
  /** The store surface the enforcement needs. */
8120
- export declare interface PluginRefStore {
8121
- query: (descriptor: unknown) => Promise<ReadonlyArray<Record<string, unknown>>>;
8122
- update: (table: string, id: string, patch: Record<string, unknown>) => Promise<unknown>;
8123
- delete: (table: string, id: string) => Promise<unknown>;
8124
- }
8256
+ export declare type PluginRefStore = Pick<DataStore, 'updateMany' | 'deleteMany'>;
8125
8257
 
8126
8258
  /** The signature a plugin sees on its bind-ctx. */
8127
8259
  export declare type PluginScheduleCoordinated = (name: string, intervalMs: number, effect: CoordinatedEffect, options?: CoordinatedTaskOptions) => CoordinatedScheduleHandle;
8128
8260
 
8129
8261
  export declare const powerOfTwoSelector: (options?: P2COptions) => ReplicaSelector;
8130
8262
 
8263
+ /**
8264
+ * The server's half of restoring a SEALED (`crdtSealed()`) cell. The server
8265
+ * cannot read the content, so it cannot compute the restore — it archives the
8266
+ * current log as a `restore` version (the restore stays undoable) and hands
8267
+ * out the version's ciphertext. The client opens it with `openSealedLog` and
8268
+ * calls the hook's `restore(target)`, which writes the change as an ordinary
8269
+ * sealed edit. The cell's row is read through the caller's store first, as
8270
+ * for every history read. An open column is refused — `restoreCrdtVersion`
8271
+ * restores it on the server, and its history bytes stay `serverOnly()`.
8272
+ */
8273
+ export declare const prepareSealedCrdtRestore: (store: CrdtHistoryStore, input: {
8274
+ readonly versionId: string;
8275
+ readonly createdBy?: string;
8276
+ }) => Promise<{
8277
+ readonly undoPoint: CrdtVersion;
8278
+ readonly versionLog: Uint8Array;
8279
+ } | undefined>;
8280
+
8131
8281
  /**
8132
8282
  * Whether a `Referrer-Policy` value leaves the `Origin` header intact on a
8133
8283
  * same-origin state-changing request.
@@ -8293,7 +8443,7 @@ export declare interface PublicDevice {
8293
8443
  * Returns the assigned serial so a caller (and the tests) can observe ordering
8294
8444
  * without reaching into the bus.
8295
8445
  */
8296
- export declare const publishEvent: <Name extends string, Key extends Schema.Schema.Any, Payload extends Schema.Schema.Any>(ctx: EventPublishContext, descriptor: EventDescriptor<Name, Key, Payload>, key: Schema.Schema.Type<Key>, payload: Schema.Schema.Type<Payload>) => Effect.Effect<{
8446
+ export declare const publishEvent: <Name extends string, Key extends Schema.Top, Payload extends Schema.Top>(ctx: EventPublishContext, descriptor: EventDescriptor<Name, Key, Payload>, key: Schema.Schema.Type<Key>, payload: Schema.Schema.Type<Payload>) => Effect.Effect<{
8297
8447
  readonly n: number;
8298
8448
  readonly deferred: boolean;
8299
8449
  }, EventPublishError>;
@@ -8324,7 +8474,7 @@ export declare interface PumpOptions {
8324
8474
  * computed). The three used to carry the same loop inline; a diagnostic added
8325
8475
  * to one of them would have been absent from the other two.
8326
8476
  *
8327
- * **The stall diagnostic.** `@effect/rpc` delivers a stream as `Chunk`
8477
+ * **The stall diagnostic.** `effect/rpc` delivers a stream as `Chunk`
8328
8478
  * messages and waits for the client's `Ack` of each before writing the next.
8329
8479
  * The typed client acknowledges by itself; a hand-rolled socket client that
8330
8480
  * only listens receives exactly one Chunk per subscription — the snapshot — and
@@ -8553,6 +8703,17 @@ export declare type ReactionOp = 'insert' | 'update' | 'delete';
8553
8703
 
8554
8704
  export declare type ReactionOutcome = 'acted' | 'skipped-op' | 'skipped-when' | 'skipped-dedupe' | 'skipped-ratelimit' | 'skipped-budget';
8555
8705
 
8706
+ /**
8707
+ * The DURABLE rate key for one firing: reaction, partition, and time bucket.
8708
+ *
8709
+ * A fixed window keeps one durable bucket cursor and unique slot claims,
8710
+ * rather than retaining every event timestamp. The transaction-owned cursor
8711
+ * avoids probing every previously occupied slot; the UNIQUE remains the final
8712
+ * arbiter. JSON encoding preserves arbitrary names/partitions without NUL in
8713
+ * SQL text. Up to 2× the limit may fire across a bucket boundary.
8714
+ */
8715
+ export declare const reactionRateBucketKey: (reactionName: string, partition: string, windowMs: number, now: number) => string;
8716
+
8556
8717
  /**
8557
8718
  * A per-key sliding-window rate limiter — IN-MEMORY, PER PROCESS.
8558
8719
  *
@@ -8562,10 +8723,11 @@ export declare type ReactionOutcome = 'acted' | 'skipped-op' | 'skipped-when' |
8562
8723
  * the runner logs once when it falls back, because "my limit is 3× what I
8563
8724
  * declared" is not something anyone discovers by reading config.
8564
8725
  *
8565
- * Prefer {@link ReactionRunDeps.claimRateSlot}.
8726
+ * Prefer {@link ReactionRunDeps.claimRate}.
8566
8727
  */
8567
8728
  export declare class ReactionRateLimiter {
8568
8729
  private readonly hits;
8730
+ private sweep;
8569
8731
  allow(key: string, limit: number, windowMs: number, now: number): boolean;
8570
8732
  }
8571
8733
 
@@ -8596,13 +8758,13 @@ export declare interface ReactionRunDeps {
8596
8758
  * requireAiBudget). Only consulted when `guards.costBudgetUsd` is set. */
8597
8759
  readonly checkBudget?: (tenantId: string | null, budgetUsd: number) => boolean | Promise<boolean>;
8598
8760
  /**
8599
- * Atomically claim ONE rate slot. `true` = we got it and may fire.
8761
+ * Atomically reserve ONE slot in a rate bucket. `true` = we may fire.
8600
8762
  *
8601
8763
  * Injected by the serve layer over the shared store, so the cap holds across
8602
8764
  * replicas. Absent → the runner falls back to {@link ReactionRateLimiter},
8603
8765
  * which is per-process and therefore N× on N replicas.
8604
8766
  */
8605
- readonly claimRateSlot?: (key: string) => Promise<boolean>;
8767
+ readonly claimRate?: (key: string, limit: number, expiresAt: Date) => Promise<boolean>;
8606
8768
  readonly rateLimiter?: ReactionRateLimiter;
8607
8769
  readonly now?: () => number;
8608
8770
  }
@@ -8649,7 +8811,7 @@ export declare interface ReactiveConfigInput {
8649
8811
  readonly oversizedEventBytes?: number;
8650
8812
  /** How long a delivery may sit unaccepted by the transport before the
8651
8813
  * server says so — a WARN naming the subscription and the missing
8652
- * `@effect/rpc` `Ack`, plus `voltro_subscription_stalled_total`.
8814
+ * `effect/rpc` `Ack`, plus `voltro_subscription_stalled_total`.
8653
8815
  * Default 5_000 ms. */
8654
8816
  readonly stallWarnAfterMs?: number;
8655
8817
  };
@@ -9133,6 +9295,8 @@ export declare interface RegistryTableLike {
9133
9295
  };
9134
9296
  /** `crdtText()` column — server-merged on write (see crdtColumns above). */
9135
9297
  readonly crdtManaged?: boolean;
9298
+ /** `crdtSealed()` column — an append-only log of encrypted frames. */
9299
+ readonly crdtSealed?: boolean;
9136
9300
  }>;
9137
9301
  readonly appliedMixins?: ReadonlyArray<{
9138
9302
  readonly id?: string;
@@ -9162,13 +9326,13 @@ export declare interface RegistryTableLike {
9162
9326
  * registry indexes this so the MutationStore can look it up in
9163
9327
  * O(1) per write without touching the original Table object.
9164
9328
  */
9165
- readonly insertSchema?: Schema.Schema.Any;
9329
+ readonly insertSchema?: Schema.Top;
9166
9330
  /**
9167
9331
  * Optional `effect/Schema` the framework decodes a patch against
9168
9332
  * BEFORE every UPDATE. Set via `table().validatePatch(schema)`
9169
9333
  * (already `Schema.partial`-wrapped by the table builder).
9170
9334
  */
9171
- readonly validatePatchSchema?: Schema.Schema.Any;
9335
+ readonly validatePatchSchema?: Schema.Top;
9172
9336
  }
9173
9337
 
9174
9338
  /** Rebuild checkable guards from the row. The stored resource id becomes a
@@ -9385,22 +9549,22 @@ export declare interface ReplicatedDataStoreOptions {
9385
9549
  }
9386
9550
 
9387
9551
  declare const Request_2: Schema.Struct<{
9388
- id: Schema.filter<Schema.filter<typeof Schema.String>>;
9389
- name: Schema.filter<Schema.filter<typeof Schema.String>>;
9390
- from: typeof Schema.DateFromSelf;
9391
- to: typeof Schema.DateFromSelf;
9392
- occurrences: Schema.Array$<Schema.filter<typeof Schema.Number>>;
9393
- status: Schema.Literal<["queued", "running", "completed", "interrupted"]>;
9394
- owner: Schema.NullOr<Schema.filter<Schema.filter<typeof Schema.String>>>;
9395
- createdAt: typeof Schema.DateFromSelf;
9396
- updatedAt: typeof Schema.DateFromSelf;
9397
- cursor: Schema.filter<Schema.filter<typeof Schema.Number>>;
9398
- activeIndex: Schema.NullOr<Schema.filter<Schema.filter<typeof Schema.Number>>>;
9399
- results: Schema.Array$<Schema.Struct<{
9400
- runId: Schema.filter<Schema.filter<typeof Schema.String>>;
9401
- status: Schema.Literal<["succeeded", "failed", "skipped", "missed"]>;
9552
+ readonly id: Schema.String;
9553
+ readonly name: Schema.String;
9554
+ readonly from: Schema.Date;
9555
+ readonly to: Schema.Date;
9556
+ readonly occurrences: Schema.$Array<Schema.Number>;
9557
+ readonly status: Schema.Literals<readonly ["queued", "running", "completed", "interrupted"]>;
9558
+ readonly owner: Schema.NullOr<Schema.String>;
9559
+ readonly createdAt: Schema.Date;
9560
+ readonly updatedAt: Schema.Date;
9561
+ readonly cursor: Schema.Number;
9562
+ readonly activeIndex: Schema.NullOr<Schema.Number>;
9563
+ readonly results: Schema.$Array<Schema.Struct<{
9564
+ readonly runId: Schema.String;
9565
+ readonly status: Schema.Literals<readonly ["succeeded", "failed", "skipped", "missed"]>;
9402
9566
  }>>;
9403
- error: Schema.NullOr<typeof Schema.String>;
9567
+ readonly error: Schema.NullOr<Schema.String>;
9404
9568
  }>;
9405
9569
 
9406
9570
  export declare interface ResendOptions {
@@ -9760,6 +9924,17 @@ export declare interface ResourcePolicy {
9760
9924
  readonly implies?: Readonly<Record<string, ReadonlyArray<string>>>;
9761
9925
  }
9762
9926
 
9927
+ /**
9928
+ * Bring a version back: the cell's content becomes the version's, written as
9929
+ * an ordinary CRDT edit (concurrent edits still merge), after archiving the
9930
+ * state it replaces as a `restore` version. `undefined` when the version or
9931
+ * its row is not visible to the caller.
9932
+ */
9933
+ export declare const restoreCrdtVersion: (store: CrdtHistoryStore, input: {
9934
+ readonly versionId: string;
9935
+ readonly createdBy?: string;
9936
+ }) => Promise<CrdtVersion | undefined>;
9937
+
9763
9938
  /**
9764
9939
  * Mark everything read inside `fn` as RESTRICTING.
9765
9940
  *
@@ -9931,13 +10106,6 @@ export declare interface RevalidationMessage {
9931
10106
 
9932
10107
  export declare type RevalidationPublisher = (message: RevalidationMessage) => Promise<void>;
9933
10108
 
9934
- /**
9935
- * Reverse ONE recorded event over an in-memory row-set (to step BACK across it):
9936
- * - insert → the row was added, so remove it (by new.id).
9937
- * - update → restore the row to its `old` image (by id).
9938
- * - delete → the row was removed, so add `old` back.
9939
- * Pure. Applied newest-first to walk from "now" to a past point.
9940
- */
9941
10109
  export declare const reverseEventOverRows: (rows: ReadonlyArray<Row_2>, e: TimelineEvent) => ReadonlyArray<Row_2>;
9942
10110
 
9943
10111
  /** The ids that were visible before but are not now — what a live-revocation
@@ -10105,16 +10273,15 @@ export declare interface RowFilter<Ctx = unknown> {
10105
10273
  * the fix, rather than degrading to an unfiltered or empty answer.
10106
10274
  */
10107
10275
  export declare class RowFilterDeclarationViolated extends RowFilterDeclarationViolated_base {
10276
+ get message(): string;
10108
10277
  }
10109
10278
 
10110
- declare const RowFilterDeclarationViolated_base: Schema.TaggedErrorClass<RowFilterDeclarationViolated, "RowFilterDeclarationViolated", {
10111
- readonly _tag: Schema.tag<"RowFilterDeclarationViolated">;
10112
- } & {
10279
+ declare const RowFilterDeclarationViolated_base: Schema.Class<RowFilterDeclarationViolated, Schema.TaggedStruct<"RowFilterDeclarationViolated", {
10113
10280
  /** The table the predicate narrowed. */
10114
- table: typeof Schema.String;
10281
+ readonly table: Schema.String;
10115
10282
  /** The declared set, for the message. */
10116
- declared: Schema.Array$<typeof Schema.String>;
10117
- }>;
10283
+ readonly declared: Schema.$Array<Schema.String>;
10284
+ }>, YieldableError>;
10118
10285
 
10119
10286
  /**
10120
10287
  * Could the registered filter narrow ANY of `tables`?
@@ -10162,12 +10329,10 @@ export declare type RowFilterScope = (table: string) => Predicate | undefined;
10162
10329
  export declare class RowFilterUnavailable extends RowFilterUnavailable_base {
10163
10330
  }
10164
10331
 
10165
- declare const RowFilterUnavailable_base: Schema.TaggedErrorClass<RowFilterUnavailable, "RowFilterUnavailable", {
10166
- readonly _tag: Schema.tag<"RowFilterUnavailable">;
10167
- } & {
10332
+ declare const RowFilterUnavailable_base: Schema.Class<RowFilterUnavailable, Schema.TaggedStruct<"RowFilterUnavailable", {
10168
10333
  /** `String(originalError)` — the last failure after retries were exhausted. */
10169
- cause: typeof Schema.String;
10170
- }>;
10334
+ readonly cause: Schema.String;
10335
+ }>, YieldableError>;
10171
10336
 
10172
10337
  /** One `_voltro_row_history` row, structurally (from @voltro/plugin-row-history). */
10173
10338
  export declare interface RowHistoryEntry {
@@ -10202,7 +10367,7 @@ export declare interface RpcServerOptions<Rpcs extends Rpc.Any> {
10202
10367
  readonly handlersLayer: Layer.Layer<Rpc.ToHandler<Rpcs>>;
10203
10368
  /** Optional handlers layer dedicated to the one-shot HTTP rpc surface
10204
10369
  * (`POST /rpc`, used by SSR web-router loaders). The HTTP JSON protocol
10205
- * BUFFERS the whole response (the @effect/rpc client `await`s `r.json()`),
10370
+ * BUFFERS the whole response (the effect/rpc client `await`s `r.json()`),
10206
10371
  * so a reactive query's never-ending stream would hang the request. The
10207
10372
  * caller supplies a variant here whose query handlers complete after the
10208
10373
  * FIRST snapshot (`Stream.take(1)`); the WS `handlersLayer` keeps the live
@@ -10445,11 +10610,11 @@ export declare const runOrchestratorTick: (deps: OrchestratorTickDeps) => Promis
10445
10610
 
10446
10611
  /**
10447
10612
  * Run a fully-provided handler Effect to a Promise, REJECTING WITH THE RAW
10448
- * typed failure value — NOT Effect's opaque `FiberFailure` wrapper.
10613
+ * typed failure value — the value itself, never a runtime envelope.
10449
10614
  *
10450
10615
  * Why this exists: the rpc encoder matches a rejected handler's thrown value
10451
- * against the descriptor's `error:` schema. `Effect.runPromise` rejects with a
10452
- * `FiberFailure` that wraps the cause, so a typed `Effect.fail(MyTaggedError)`
10616
+ * against the descriptor's `error:` schema. a runtime that rejected with
10617
+ * an envelope around the cause made a typed `Effect.fail(MyTaggedError)`
10453
10618
  * from an Effect-form mutation/action NEVER matches the schema and dumps on the
10454
10619
  * wire as a `Die`/`ExitEncoded` defect instead of the declared tagged error
10455
10620
  * (the async-handler path already throws the raw value, so it worked there —
@@ -10482,7 +10647,7 @@ export declare interface RuntimeContext {
10482
10647
  readonly subject: Subject;
10483
10648
  /** Trace identifier — the active span's W3C trace id (32 hex) when
10484
10649
  * tracing is active; a per-call uuid otherwise. Shared across the
10485
- * whole frontend→api→api chain via `@effect/rpc` + `traceparent`. */
10650
+ * whole frontend→api→api chain via `effect/rpc` + `traceparent`. */
10486
10651
  readonly traceId: string;
10487
10652
  /** The active span's id (16 hex), when tracing is active. Used to
10488
10653
  * build the outbound `traceparent` header for cross-api hops. */
@@ -10848,7 +11013,7 @@ export declare interface SchedulerDeps {
10848
11013
  readonly onRunEvent?: (op: 'insert' | 'update', row: Record<string, unknown>) => void;
10849
11014
  /** When `false`, the engine registers schedules (so `fireNow` +
10850
11015
  * `fireFromCluster` work) but does NOT arm in-app timers. Used by
10851
- * `cluster` coordination, where `@effect/cluster`'s `ClusterCron`
11016
+ * `cluster` coordination, where `effect/cluster`'s `ClusterCron`
10852
11017
  * drives the clock + guarantees once-only — the in-app timer would
10853
11018
  * double-fire. Default `true`. */
10854
11019
  readonly armSelf?: boolean;
@@ -10924,7 +11089,7 @@ export declare interface SchedulerHandle {
10924
11089
  /** One run's terminal-or-not state, for a caller polling an accepted trigger
10925
11090
  * to completion. `undefined` when no such run exists. */
10926
11091
  runStatus(runId: string): Promise<ScheduleRunStatus | undefined>;
10927
- /** Fire from a cluster-cron tick. `@effect/cluster` has already
11092
+ /** Fire from a cluster-cron tick. `effect/cluster` has already
10928
11093
  * guaranteed exactly-once across the fleet (this runner owns the
10929
11094
  * shard), so we bypass the in-app coordinator + record the run
10930
11095
  * with `coordinationOutcome: 'cluster'`. Overlap policy still
@@ -11050,6 +11215,8 @@ export declare interface SchemaInfo {
11050
11215
  * so concurrent clients converge. Empty set for the common non-CRDT table.
11051
11216
  */
11052
11217
  readonly crdtColumns: ReadonlySet<string>;
11218
+ /** End-to-end-sealed CRDT columns (`crdtSealed()`): appended, never merged. */
11219
+ readonly sealedColumns: ReadonlySet<string>;
11053
11220
  /**
11054
11221
  * Columns that a query predicate can hit and benefit from an index:
11055
11222
  * - column-level `.index()`-flagged columns
@@ -11067,9 +11234,9 @@ export declare interface SchemaInfo {
11067
11234
  readonly fields: ReadonlyArray<string>;
11068
11235
  }>;
11069
11236
  /** Optional pre-INSERT row decoder (from `table().validate(...)`). */
11070
- readonly insertSchema?: Schema.Schema.Any;
11237
+ readonly insertSchema?: Schema.Top;
11071
11238
  /** Optional pre-UPDATE partial-patch decoder (from `table().validatePatch(...)`). */
11072
- readonly validatePatchSchema?: Schema.Schema.Any;
11239
+ readonly validatePatchSchema?: Schema.Top;
11073
11240
  /**
11074
11241
  * Resolved id-scheme for the table's primary-key column. `undefined`
11075
11242
  * for tables that have no `id`-typed column — a natural or composite
@@ -11097,7 +11264,7 @@ export declare interface SchemaInfo {
11097
11264
  * the common composition nodes so a column nested under `{ refs: [{ … }] }` or
11098
11265
  * behind a `NullOr` is still seen. Cycle-guarded via a seen-set on Suspend.
11099
11266
  */
11100
- export declare const schemaPropertyNames: (schema: Schema.Schema.Any) => ReadonlySet<string>;
11267
+ export declare const schemaPropertyNames: (schema: Schema.Top) => ReadonlySet<string>;
11101
11268
 
11102
11269
  export declare interface SchemaRegistry {
11103
11270
  readonly tables: ReadonlyMap<string, SchemaInfo>;
@@ -11167,6 +11334,8 @@ export declare interface SchemaRegistry {
11167
11334
  * CRDT merge (`mergeCrdtStates`) before an INSERT/UPDATE persists.
11168
11335
  */
11169
11336
  crdtColumns(table: string): ReadonlySet<string>;
11337
+ /** `crdtSealed()` columns of a table — see `SchemaInfo.sealedColumns`. */
11338
+ sealedColumns(table: string): ReadonlySet<string>;
11170
11339
  /**
11171
11340
  * Optional pre-INSERT schema decoder for a table. `undefined` when
11172
11341
  * the table didn't ship `.validate(schema)`. The MutationStore runs
@@ -11174,7 +11343,7 @@ export declare interface SchemaRegistry {
11174
11343
  * INSERT — a decode failure becomes a `TableValidationFailed`
11175
11344
  * typed error on the mutation's error channel.
11176
11345
  */
11177
- insertSchema(table: string): Schema.Schema.Any | undefined;
11346
+ insertSchema(table: string): Schema.Top | undefined;
11178
11347
  /**
11179
11348
  * Optional pre-UPDATE partial-patch decoder for a table. `undefined`
11180
11349
  * when the table didn't ship `.validatePatch(schema)`. The
@@ -11182,7 +11351,7 @@ export declare interface SchemaRegistry {
11182
11351
  * the underlying UPDATE — a decode failure becomes a
11183
11352
  * `TableValidationFailed` typed error on the mutation's error channel.
11184
11353
  */
11185
- validatePatchSchema(table: string): Schema.Schema.Any | undefined;
11354
+ validatePatchSchema(table: string): Schema.Top | undefined;
11186
11355
  }
11187
11356
 
11188
11357
  declare interface ScopeCtx {
@@ -11477,6 +11646,14 @@ export declare const setBufferedBytes: (label: string, bytes: number) => void;
11477
11646
  * Called by the CLI at boot; tests call it directly. */
11478
11647
  export declare const setConnectionResolver: (resolver: ConnectionResolver | undefined) => void;
11479
11648
 
11649
+ /** Boot/test override — the slot `wireCrdtTunables` writes. Fields left out
11650
+ * keep env/default resolution. */
11651
+ export declare const setCrdtAdmission: (admission: CrdtAdmission | null) => void;
11652
+
11653
+ /** Boot wiring for `crdt.backend` — every default call site (the merge, the
11654
+ * history, the inspection) follows it. `null` restores Yjs. */
11655
+ export declare const setCrdtBackend: (backend: CrdtBackendChoice | null) => void;
11656
+
11480
11657
  /** Boot/test override — the slot `wireCrdtTunables` writes. `null` restores
11481
11658
  * env/default resolution. */
11482
11659
  export declare const setCrdtCompactMaxBytes: (maxBytes: number | null) => void;
@@ -11623,6 +11800,15 @@ export declare interface SnapshotCacheBinding {
11623
11800
  readonly swrMs: number | undefined;
11624
11801
  }
11625
11802
 
11803
+ /**
11804
+ * Archive the cell's current state as a named version. `undefined` when the
11805
+ * row is not visible to the caller.
11806
+ */
11807
+ export declare const snapshotCrdt: (store: CrdtHistoryStore, cell: CrdtCellRef & {
11808
+ readonly label?: string;
11809
+ readonly createdBy?: string;
11810
+ }) => Promise<CrdtVersion | undefined>;
11811
+
11626
11812
  /** Snapshot the whole registry, normalized to `MetricSample[]` — plus the
11627
11813
  * socket-backpressure counters (`subscriptionSocketMetrics.ts`), appended
11628
11814
  * HERE so every reader (Prometheus exporter, inspect Metrics panel) sees
@@ -12984,6 +13170,8 @@ export declare const _voltroConnectionGrantsTable: TableLike;
12984
13170
  */
12985
13171
  export declare const _voltroConnectionsTable: TableLike;
12986
13172
 
13173
+ export declare const _voltroCrdtVersionsTable: TableLike;
13174
+
12987
13175
  /** `_voltro_rebac_tuples` — the relationship tuples `can()` reads. One row =
12988
13176
  * "`subjectId` has `relation` on `<resourceType>:<resourceId>`". Grant by
12989
13177
  * inserting; revoke by deleting (a delete is the live-revocation trigger). */
@@ -13255,9 +13443,9 @@ export declare interface WorkflowControlTarget extends WorkflowControlOptions {
13255
13443
 
13256
13444
  export declare interface WorkflowDefinitionLike {
13257
13445
  readonly name: string;
13258
- readonly payloadSchema: Schema.Schema.Any;
13259
- readonly successSchema: Schema.Schema.Any;
13260
- readonly errorSchema: Schema.Schema.All;
13446
+ readonly payloadSchema: Schema.Top;
13447
+ readonly successSchema: Schema.Top;
13448
+ readonly errorSchema: Schema.Top;
13261
13449
  execute(payload: never, options?: {
13262
13450
  readonly discard?: boolean;
13263
13451
  }): Effect.Effect<unknown, unknown, unknown>;
@@ -13782,15 +13970,13 @@ export declare interface WorkflowStartLike {
13782
13970
  export declare class WorkflowStartNotExecuted extends WorkflowStartNotExecuted_base {
13783
13971
  }
13784
13972
 
13785
- declare const WorkflowStartNotExecuted_base: Schema.TaggedErrorClass<WorkflowStartNotExecuted, "WorkflowStartNotExecuted", {
13786
- readonly _tag: Schema.tag<"WorkflowStartNotExecuted">;
13787
- } & {
13788
- workflowName: typeof Schema.String;
13789
- handleId: typeof Schema.String;
13790
- reason: Schema.Literal<["dropped", "skipped", "superseded", "cancelled", "abandoned", "rejected"]>;
13791
- failureId: Schema.NullOr<typeof Schema.String>;
13792
- incumbentExecutionId: Schema.NullOr<typeof Schema.String>;
13793
- }>;
13973
+ declare const WorkflowStartNotExecuted_base: Schema.Class<WorkflowStartNotExecuted, Schema.TaggedStruct<"WorkflowStartNotExecuted", {
13974
+ readonly workflowName: Schema.String;
13975
+ readonly handleId: Schema.String;
13976
+ readonly reason: Schema.Literals<readonly ["dropped", "skipped", "superseded", "cancelled", "abandoned", "rejected"]>;
13977
+ readonly failureId: Schema.NullOr<Schema.String>;
13978
+ readonly incumbentExecutionId: Schema.NullOr<Schema.String>;
13979
+ }>, Cause.YieldableError>;
13794
13980
 
13795
13981
  /**
13796
13982
  * What a start handle has become, read once and without waiting.