@voltro/runtime 0.84.0 → 0.86.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/CHANGELOG.md +1215 -0
  2. package/THIRD-PARTY-NOTICES.md +118 -600
  3. package/dist/aggregate.js +42 -0
  4. package/dist/aggregateExtrema.js +80 -0
  5. package/dist/aggregateIvm.js +115 -0
  6. package/dist/analyticsMirror.js +228 -0
  7. package/dist/analyticsSink.js +38 -0
  8. package/dist/apiKeyUsage.js +33 -0
  9. package/dist/apiKeys.js +223 -0
  10. package/dist/apiKeysWiring.js +114 -0
  11. package/dist/approvalBuiltins.js +10 -0
  12. package/dist/approvals.js +269 -0
  13. package/dist/authMiddlewareLayer.js +47 -0
  14. package/dist/bindEvent.js +72 -0
  15. package/dist/bootListener.js +76 -0
  16. package/dist/bootRefusal.js +7 -0
  17. package/dist/bootStoreCodec.js +70 -0
  18. package/dist/businessRules.js +67 -0
  19. package/dist/changeClaimsTable.js +12 -0
  20. package/dist/circuitBreaker.js +72 -0
  21. package/dist/columnOnUpdate.js +23 -0
  22. package/dist/composeAnalytics.js +108 -0
  23. package/dist/computedQuery.js +4 -0
  24. package/dist/connectionBuiltins.js +81 -0
  25. package/dist/connectionCredentials.js +66 -0
  26. package/dist/connectionState.js +34 -0
  27. package/dist/connectionVault.js +410 -0
  28. package/dist/connectionsFacade.js +54 -0
  29. package/dist/coordinatedSchedule.js +139 -0
  30. package/dist/crdtHistory.js +138 -0
  31. package/dist/crdtMerge.js +179 -0
  32. package/dist/crdtVersionsTable.js +25 -0
  33. package/dist/credentialBound.js +12 -0
  34. package/dist/crud.js +72 -0
  35. package/dist/dataStore.js +679 -0
  36. package/dist/dataloader.js +61 -0
  37. package/dist/declaredTablesGuard.js +48 -0
  38. package/dist/defineExecutor.js +4 -0
  39. package/dist/dependencyGraph.js +32 -0
  40. package/dist/devices.js +228 -0
  41. package/dist/devicesWiring.js +168 -0
  42. package/dist/dialectReplicationAdapter.js +29 -0
  43. package/dist/dispatcher.js +447 -0
  44. package/dist/effectStore.js +71 -0
  45. package/dist/eventBus.js +260 -0
  46. package/dist/eventPublish.js +49 -0
  47. package/dist/events.js +193 -0
  48. package/dist/expectation.js +52 -0
  49. package/dist/expectationEvaluator.js +308 -0
  50. package/dist/experiment.js +96 -0
  51. package/dist/experimentEvaluator.js +245 -0
  52. package/dist/externalizedTasks.js +25 -0
  53. package/dist/fieldCipher.js +61 -0
  54. package/dist/fingerprint.js +21 -0
  55. package/dist/finops.js +42 -0
  56. package/dist/finopsAccountant.js +216 -0
  57. package/dist/handlerBody.js +8 -0
  58. package/dist/healthProbes.js +55 -0
  59. package/dist/httpClientSsrf.js +49 -0
  60. package/dist/httpClientTracing.js +11 -0
  61. package/dist/httpCompression.js +76 -0
  62. package/dist/httpKeepAlive.js +12 -0
  63. package/dist/httpRouteMounts.js +47 -0
  64. package/dist/idempotencyStore.js +70 -0
  65. package/dist/idleDetector.js +21 -0
  66. package/dist/index.d.ts +252 -233
  67. package/dist/index.js +144 -14405
  68. package/dist/insertRequiredColumns.js +19 -0
  69. package/dist/inspectWorkflow.js +1 -0
  70. package/dist/instanceMembership.js +98 -0
  71. package/dist/ivm.js +125 -0
  72. package/dist/kvDataStore.js +86 -0
  73. package/dist/kvFacade.js +32 -0
  74. package/dist/matcher.js +304 -0
  75. package/dist/memoryColumnDefaults.js +11 -0
  76. package/dist/memoryQueryJoins.js +114 -0
  77. package/dist/metrics.js +161 -0
  78. package/dist/observability.js +123 -0
  79. package/dist/observedGraph.js +52 -0
  80. package/dist/originGuard.js +116 -0
  81. package/dist/outbox.js +352 -0
  82. package/dist/pluginRefRules.js +65 -0
  83. package/dist/policyGuardResolver.js +55 -0
  84. package/dist/preview.js +62 -0
  85. package/dist/projectedRows.js +12 -0
  86. package/dist/provenance.js +63 -0
  87. package/dist/rangeIndex.js +89 -0
  88. package/dist/rawReadScope.js +17 -0
  89. package/dist/reaction.js +85 -0
  90. package/dist/reactiveConfig.js +11 -0
  91. package/dist/readClassification.js +57 -0
  92. package/dist/readRecorder.js +66 -0
  93. package/dist/rebac.js +104 -0
  94. package/dist/rebacInterceptor.js +81 -0
  95. package/dist/registry.js +29 -0
  96. package/dist/relevantFields.js +65 -0
  97. package/dist/replicaHealth.js +42 -0
  98. package/dist/replicaLocality.js +44 -0
  99. package/dist/replicaObservations.js +121 -0
  100. package/dist/replicaSelection.js +32 -0
  101. package/dist/replicatedDataStore.js +239 -0
  102. package/dist/requestLoader.js +7 -0
  103. package/dist/resumeCensus.js +28 -0
  104. package/dist/revalidation.js +22 -0
  105. package/dist/rowFilter.js +65 -0
  106. package/dist/rowStateBytes.js +45 -0
  107. package/dist/rpcBodyCap.js +63 -0
  108. package/dist/rpcConnections.js +83 -0
  109. package/dist/rpcDefectDiagnostics.js +15 -0
  110. package/dist/rpcServer.js +992 -0
  111. package/dist/runAsSystem.js +23 -0
  112. package/dist/rywPositionStore.js +84 -0
  113. package/dist/schedule.js +23 -0
  114. package/dist/scheduleBackfillRequests.js +151 -0
  115. package/dist/scheduleClaimsTable.js +11 -0
  116. package/dist/scheduleRunsTable.js +37 -0
  117. package/dist/scheduler.js +835 -0
  118. package/dist/schemaRegistry.js +65 -0
  119. package/dist/secretsResolver.js +35 -0
  120. package/dist/securityHeaders.js +33 -0
  121. package/dist/servePipeline.js +305 -0
  122. package/dist/serverOnlyAudit.js +66 -0
  123. package/dist/serverTracer.js +15 -0
  124. package/dist/serviceCredentials.js +40 -0
  125. package/dist/singleNodeOrchestrator.js +91 -0
  126. package/dist/sourceResolution.js +42 -0
  127. package/dist/storeMiddleware.js +880 -0
  128. package/dist/storeQuery.js +204 -0
  129. package/dist/storeRead.js +10 -0
  130. package/dist/subscriber.js +7 -0
  131. package/dist/subscriptionOutbox.js +139 -0
  132. package/dist/subscriptionRegistry.js +82 -0
  133. package/dist/subscriptionResume.js +132 -0
  134. package/dist/subscriptionSocketMetrics.js +65 -0
  135. package/dist/systemSubject.js +5 -0
  136. package/dist/tenantScope.js +23 -0
  137. package/dist/tenantSelection.js +27 -0
  138. package/dist/timeline.js +105 -0
  139. package/dist/traceContext.js +5 -0
  140. package/dist/traceSink.js +63 -0
  141. package/dist/traceSpansTable.js +29 -0
  142. package/dist/traceparent.js +34 -0
  143. package/dist/transactionSubject.js +12 -0
  144. package/dist/trustedProxy.js +155 -0
  145. package/dist/undo.js +129 -0
  146. package/dist/undoBuiltins.js +69 -0
  147. package/dist/undoCapture.js +74 -0
  148. package/dist/undoLogTable.js +16 -0
  149. package/dist/upsertBinding.js +20 -0
  150. package/dist/wakeOrchestrator.js +34 -0
  151. package/dist/wakeRegistry.js +71 -0
  152. package/dist/wakeRouter.js +63 -0
  153. package/dist/wakeSupervisor.js +62 -0
  154. package/dist/wakeupsTable.js +12 -0
  155. package/dist/webSocketGatewayRuntime.js +114 -0
  156. package/dist/webhookVerification.js +18 -0
  157. package/dist/wireColumnStrip.js +84 -0
  158. package/dist/workflowReadBuiltins.js +87 -0
  159. package/dist/workflowRuntime.js +708 -0
  160. package/package.json +10 -13
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';
@@ -29,6 +30,7 @@ import { DialectReplicationAdapter } from '@voltro/database';
29
30
  import { Duplex } from 'node:stream';
30
31
  import { Duration } from 'effect';
31
32
  import { Effect } from 'effect';
33
+ import { EnqueueOptions } from '@voltro/protocol';
32
34
  import { EventDeliverySemantics } from '@voltro/protocol';
33
35
  import { EventDescriptor } from '@voltro/protocol';
34
36
  import { EventKeyInvalid } from '@voltro/protocol';
@@ -42,7 +44,7 @@ import { FieldBinding } from '@voltro/database';
42
44
  import { FieldCipher } from '@voltro/database';
43
45
  import { FieldDefinitions } from '@voltro/database';
44
46
  import * as http from 'node:http';
45
- import { HttpClient } from '@effect/platform';
47
+ import { HttpClient } from 'effect/http';
46
48
  import { HttpRequestInterceptor } from '@voltro/protocol';
47
49
  import { HttpRouteObserver } from '@voltro/protocol';
48
50
  import { IdempotencyStore } from '@voltro/protocol';
@@ -66,11 +68,13 @@ import { listRetentionConflicts } from '@voltro/database';
66
68
  import { listRetentions } from '@voltro/database';
67
69
  import { Membership } from '@voltro/protocol';
68
70
  import { Metric } from 'effect';
69
- import { MetricBoundaries } from 'effect';
70
71
  import { MetricReader } from '@opentelemetry/sdk-metrics';
71
72
  import { MutationIdempotencyScope } from '@voltro/protocol';
72
73
  import { NoRowFound } from '@voltro/protocol';
73
74
  import { NoSuchResource } from '@voltro/protocol';
75
+ import { OutboxEnqueueFacade } from '@voltro/protocol';
76
+ import { OutboxHandlerContext } from '@voltro/protocol';
77
+ import { OutboxHandlerDefinition } from '@voltro/protocol';
74
78
  import { PendingApproval } from '@voltro/protocol';
75
79
  import { PluginHttpRoute } from '@voltro/protocol';
76
80
  import { PluginHttpRouteByteStream } from '@voltro/protocol';
@@ -82,6 +86,7 @@ import { Query } from '@voltro/database';
82
86
  import { QueryDescriptor } from '@voltro/database';
83
87
  import { Redis } from 'ioredis';
84
88
  import { registerRetention } from '@voltro/database';
89
+ import { RequestedTenantRefused } from '@voltro/protocol';
85
90
  import { ResourceMissing } from '@voltro/protocol';
86
91
  import { RestRouteDescriptor } from '@voltro/protocol/rest';
87
92
  import { RetentionConflict } from '@voltro/database';
@@ -91,8 +96,8 @@ import { retentionTtlMsFromEnv } from '@voltro/database';
91
96
  import { Row } from '@voltro/database';
92
97
  import { RowKey } from '@voltro/database';
93
98
  import { RowPatch } from '@voltro/protocol';
94
- import { Rpc } from '@effect/rpc';
95
- import { RpcGroup } from '@effect/rpc';
99
+ import { Rpc } from 'effect/rpc';
100
+ import { RpcGroup } from 'effect/rpc';
96
101
  import { RpcInterceptor } from '@voltro/protocol';
97
102
  import { RuleReadStore } from '@voltro/database';
98
103
  import { Sampler } from '@opentelemetry/sdk-trace-base';
@@ -104,7 +109,7 @@ import { ServerOnlyColumnWrite } from '@voltro/protocol';
104
109
  import { ServerResponse } from 'node:http';
105
110
  import { SpanProcessor } from '@opentelemetry/sdk-trace-base';
106
111
  import { spawn } from 'node:child_process';
107
- import { SqlClient } from '@effect/sql';
112
+ import { SqlClient } from 'effect/sql';
108
113
  import { StoredTableShape } from '@voltro/database';
109
114
  import { StoreError } from '@voltro/protocol';
110
115
  import { StoreOperationFailed } from '@voltro/protocol';
@@ -145,19 +150,18 @@ import { WorkflowRunHandle } from '@voltro/protocol';
145
150
  import { WorkflowRunSnapshot as WorkflowRunSnapshot_2 } from '@voltro/protocol';
146
151
  import { WorkflowStartResolution } from '@voltro/workflow';
147
152
  import { WorkflowUpdateResult } from '@voltro/protocol';
153
+ import { YieldableError } from 'effect/Cause';
148
154
 
149
155
  /** Typed denial — declare on an rpc `error:` union so a refusal surfaces to the
150
156
  * client typed + pattern-matchable (never a bare 500). */
151
157
  export declare class AccessDenied extends AccessDenied_base {
152
158
  }
153
159
 
154
- declare const AccessDenied_base: Schema.TaggedErrorClass<AccessDenied, "AccessDenied", {
155
- readonly _tag: Schema.tag<"AccessDenied">;
156
- } & {
157
- action: typeof Schema.String;
158
- resourceType: typeof Schema.String;
159
- resourceId: typeof Schema.String;
160
- }>;
160
+ declare const AccessDenied_base: Schema.Class<AccessDenied, Schema.TaggedStruct<"AccessDenied", {
161
+ readonly action: Schema.String;
162
+ readonly resourceType: Schema.String;
163
+ readonly resourceId: Schema.String;
164
+ }>, YieldableError>;
161
165
 
162
166
  /**
163
167
  * Exported so the rpc boundary can stamp `ChangeEvent.subjectId` with the SAME
@@ -168,6 +172,7 @@ declare const AccessDenied_base: Schema.TaggedErrorClass<AccessDenied, "AccessDe
168
172
  export declare const actingUserId: (subject: StoreMiddlewareContext["subject"]) => string | null;
169
173
 
170
174
  export declare interface ActionRunnerDeps {
175
+ readonly outcomeOutbox?: MutationRunnerDeps['outcomeOutbox'];
171
176
  /** Build the per-call `AppContext` — NO transactional tx (actions do
172
177
  * external I/O and run outside a txn deliberately). */
173
178
  readonly buildContext: (request: ServeRequestContext) => {
@@ -374,13 +379,11 @@ declare class AggregateError_2 extends AggregateError_base {
374
379
  }
375
380
  export { AggregateError_2 as AggregateError }
376
381
 
377
- declare const AggregateError_base: Schema.TaggedErrorClass<AggregateError_2, "AggregateError", {
378
- readonly _tag: Schema.tag<"AggregateError">;
379
- } & {
380
- name: typeof Schema.String;
381
- operation: typeof Schema.String;
382
- cause: typeof Schema.String;
383
- }>;
382
+ declare const AggregateError_base: Schema.Class<AggregateError_2, Schema.TaggedStruct<"AggregateError", {
383
+ readonly name: Schema.String;
384
+ readonly operation: Schema.String;
385
+ readonly cause: Schema.String;
386
+ }>, YieldableError>;
384
387
 
385
388
  export declare type AggregateFailure = AggregateStale | AggregateNotFound | AggregateError_2;
386
389
 
@@ -403,7 +406,10 @@ export declare interface AggregateHandle<Row> {
403
406
  export declare class AggregateMaintainer {
404
407
  private readonly shape;
405
408
  private state;
409
+ private extrema;
406
410
  private readonly groups;
411
+ private readonly positions;
412
+ private nextPosition;
407
413
  constructor(shape: AggregateShape);
408
414
  /** Seed from the full base row-set (boot / after a rescan-from-scratch). */
409
415
  seed(baseRows: ReadonlyArray<Row_4>): void;
@@ -414,6 +420,11 @@ export declare class AggregateMaintainer {
414
420
  applyChange(delta: CdcDelta): ReadonlyArray<string>;
415
421
  /** Rebuild the flagged groups from the current base rows (min/max recovery). */
416
422
  resolveRescan(rescanGroups: ReadonlyArray<string>, baseRows: ReadonlyArray<Row_4>): void;
423
+ /** Read only the requested live groups, with insertion-order identities.
424
+ * A group deleted and reinserted receives a new position, matching materialize. */
425
+ materializeGroups(keys: ReadonlyArray<string>): ReadonlyArray<MaintainedGroup & {
426
+ readonly rowIndex: number;
427
+ }>;
417
428
  /** The current materialized result — one entry per non-empty group. */
418
429
  materialize(): ReadonlyArray<MaintainedGroup>;
419
430
  private groupValues;
@@ -440,11 +451,9 @@ export declare interface AggregateMeta {
440
451
  export declare class AggregateNotFound extends AggregateNotFound_base {
441
452
  }
442
453
 
443
- declare const AggregateNotFound_base: Schema.TaggedErrorClass<AggregateNotFound, "AggregateNotFound", {
444
- readonly _tag: Schema.tag<"AggregateNotFound">;
445
- } & {
446
- name: typeof Schema.String;
447
- }>;
454
+ declare const AggregateNotFound_base: Schema.Class<AggregateNotFound, Schema.TaggedStruct<"AggregateNotFound", {
455
+ readonly name: Schema.String;
456
+ }>, YieldableError>;
448
457
 
449
458
  export declare interface AggregateQuery {
450
459
  readonly event: string;
@@ -497,15 +506,9 @@ export declare interface AggregateReadOptions {
497
506
  * - Interval string (`'5m'`, `'1h'`, `'24h'`): the canonical
498
507
  * simple case.
499
508
  * - Cron expression `{ cron: '0 2 * * *', timezone: 'UTC' }`: for
500
- * business-hours / off-peak refresh windows. **Defer to v2** —
501
- * emitted from the spec but not yet honoured by the runner.
509
+ * business-hours / off-peak refresh windows, in the specified timezone.
502
510
  * - On-change debounced `{ interval: '1h', onChange: ['matches'],
503
- * debounceMs: 30_000 }`: near-realtime, source-table-driven. **Defer
504
- * to v2** — same status.
505
- *
506
- * v1 supports interval only. The other shapes are accepted so consumers
507
- * can declare them today + see them honoured when v2 lands without
508
- * touching the spec.
511
+ * debounceMs: 30_000 }`: near-realtime, source-table-driven.
509
512
  */
510
513
  export declare type AggregateRefreshPolicy = string | {
511
514
  readonly interval?: string;
@@ -522,7 +525,7 @@ export declare type AggregateRefreshPolicy = string | {
522
525
  export declare class AggregateRegistry extends AggregateRegistry_base {
523
526
  }
524
527
 
525
- declare const AggregateRegistry_base: Context.TagClass<AggregateRegistry, "@voltro/AggregateRegistry", {
528
+ declare const AggregateRegistry_base: Context.ServiceClass<AggregateRegistry, "@voltro/AggregateRegistry", {
526
529
  /** Resolve a typed handle from the definition. The cli registers
527
530
  * every discovered aggregate at boot; calling this with an unknown
528
531
  * def returns a handle whose methods all fail with
@@ -548,13 +551,11 @@ export declare interface AggregateShape {
548
551
  export declare class AggregateStale extends AggregateStale_base {
549
552
  }
550
553
 
551
- declare const AggregateStale_base: Schema.TaggedErrorClass<AggregateStale, "AggregateStale", {
552
- readonly _tag: Schema.tag<"AggregateStale">;
553
- } & {
554
- name: typeof Schema.String;
555
- ageMs: typeof Schema.Number;
556
- maxAgeMs: typeof Schema.Number;
557
- }>;
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>;
558
559
 
559
560
  export declare interface AnalyticsBucket {
560
561
  readonly bucketStart: Date;
@@ -570,12 +571,10 @@ export declare interface AnalyticsBucket {
570
571
  export declare class AnalyticsCapabilityNotSupported extends AnalyticsCapabilityNotSupported_base {
571
572
  }
572
573
 
573
- declare const AnalyticsCapabilityNotSupported_base: Schema.TaggedErrorClass<AnalyticsCapabilityNotSupported, "AnalyticsCapabilityNotSupported", {
574
- readonly _tag: Schema.tag<"AnalyticsCapabilityNotSupported">;
575
- } & {
576
- provider: typeof Schema.String;
577
- capability: typeof Schema.String;
578
- }>;
574
+ declare const AnalyticsCapabilityNotSupported_base: Schema.Class<AnalyticsCapabilityNotSupported, Schema.TaggedStruct<"AnalyticsCapabilityNotSupported", {
575
+ readonly provider: Schema.String;
576
+ readonly capability: Schema.String;
577
+ }>, YieldableError>;
579
578
 
580
579
  /**
581
580
  * The underlying sink raised an error. `cause` is stringified for
@@ -584,13 +583,11 @@ declare const AnalyticsCapabilityNotSupported_base: Schema.TaggedErrorClass<Anal
584
583
  export declare class AnalyticsError extends AnalyticsError_base {
585
584
  }
586
585
 
587
- declare const AnalyticsError_base: Schema.TaggedErrorClass<AnalyticsError, "AnalyticsError", {
588
- readonly _tag: Schema.tag<"AnalyticsError">;
589
- } & {
590
- provider: typeof Schema.String;
591
- operation: typeof Schema.String;
592
- cause: typeof Schema.String;
593
- }>;
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>;
594
591
 
595
592
  /**
596
593
  * One analytics event. `properties` must be JSON-serialisable —
@@ -788,7 +785,7 @@ export declare interface AnalyticsMirrorUpsert {
788
785
  export declare class AnalyticsSink extends AnalyticsSink_base {
789
786
  }
790
787
 
791
- declare const AnalyticsSink_base: Context.TagClass<AnalyticsSink, "@voltro/AnalyticsSink", AnalyticsSinkImpl>;
788
+ declare const AnalyticsSink_base: Context.ServiceClass<AnalyticsSink, "@voltro/AnalyticsSink", AnalyticsSinkImpl>;
792
789
 
793
790
  /**
794
791
  * The runtime contract every analytics provider implements. Plugins
@@ -1115,7 +1112,9 @@ export declare interface AppAccess {
1115
1112
  readonly hasAny: (scopes: ReadonlyArray<string>) => boolean;
1116
1113
  /** Effect guard — fails with a typed `ScopeError` when the caller lacks
1117
1114
  * `scope`. `yield* ctx.access.require('notes:write')` at the top of a
1118
- * handler mirrors a descriptor `guards:` entry for in-body branching. */
1115
+ * handler mirrors a descriptor `guards:` entry for in-body branching.
1116
+ * Reauthenticates bound authority when the Effect executes. Authentication
1117
+ * or authority-source failures abort rather than becoming scope decisions. */
1119
1118
  readonly require: (scope: string) => Effect.Effect<void, ScopeError>;
1120
1119
  /** The caller's effective scope set (live — reflects rbac resolution). */
1121
1120
  readonly scopes: ReadonlyArray<string>;
@@ -1676,7 +1675,7 @@ export declare interface AttachFinopsOptions {
1676
1675
  /** The descriptor shape the audit needs — a `defineQuery` result carries it. */
1677
1676
  export declare interface AuditableQuery {
1678
1677
  readonly name: string;
1679
- readonly output: Schema.Schema.Any;
1678
+ readonly output: Schema.Top;
1680
1679
  /** Declared source table(s) — the tables whose serverOnly columns must not leak. */
1681
1680
  readonly source?: string | ReadonlyArray<string> | undefined;
1682
1681
  }
@@ -1801,7 +1800,7 @@ export declare const bindConnectionCredential: (clientId: number, credential: Co
1801
1800
  * interrupt registry subscriptions use — so one reconnect policy, one devtools
1802
1801
  * view, one connection lifecycle for both primitives.
1803
1802
  */
1804
- export declare const bindEvent: (input: BindEventInput) => Stream.Stream<EventStreamEvent<unknown>, ScopeError | Unauthenticated | NoSuchResource, SubjectService | ConnectionInfo>;
1803
+ export declare const bindEvent: (input: BindEventInput) => Stream.Stream<EventStreamEvent<unknown>, ScopeError | Unauthenticated | RequestedTenantRefused | NoSuchResource, SubjectService | ConnectionInfo>;
1805
1804
 
1806
1805
  export declare interface BindEventInput {
1807
1806
  readonly bus: EventBus;
@@ -1846,7 +1845,7 @@ export declare const bindMutation: <Input, Output, E = never>(execute: (input: I
1846
1845
  * schema keeps exactly the old behaviour rather than collapsing errors it
1847
1846
  * cannot classify.
1848
1847
  */
1849
- declaredError?: Schema.Schema.All, idempotencyScope?: MutationIdempotencyScope) => Effect.Effect<Output, E, SubjectService | ConnectionInfo>;
1848
+ declaredError?: Schema.Top, idempotencyScope?: MutationIdempotencyScope) => Effect.Effect<Output, E, SubjectService | ConnectionInfo>;
1850
1849
 
1851
1850
  /**
1852
1851
  * Bind a non-reactive server→client stream (A3). The executor builds a
@@ -1878,7 +1877,7 @@ guards?: ReadonlyArray<unknown> | undefined,
1878
1877
  guardInput?: unknown) => Stream.Stream<Element, Err, SubjectService | ConnectionInfo>;
1879
1878
 
1880
1879
  /**
1881
- * Build a `Stream<SubscriptionEvent<T>>` that an @effect/rpc streaming
1880
+ * Build a `Stream<SubscriptionEvent<T>>` that an effect/rpc streaming
1882
1881
  * handler can return directly. The descriptor is built by the route's
1883
1882
  * executor from the input + the per-call `RuntimeContext` (subject +
1884
1883
  * traceId) we derive from the auth-middleware's resolved subject.
@@ -2133,6 +2132,8 @@ export declare const canonicalInputKey: (input: unknown) => string;
2133
2132
  * Canonical JSON — object keys sorted recursively, so two structurally equal
2134
2133
  * inputs that differ only in key order digest identically. A retry from a
2135
2134
  * different client build must not mint a second approval.
2135
+ * Preserve own JSON fields such as `__proto__`; a prototype setter must never
2136
+ * discard part of the content that an approval identity binds.
2136
2137
  */
2137
2138
  export declare const canonicalJson: (value: unknown) => string;
2138
2139
 
@@ -2187,7 +2188,7 @@ export declare interface CircuitBreakerOptions {
2187
2188
  /** Consecutive failures before the breaker opens. */
2188
2189
  readonly failureThreshold: number;
2189
2190
  /** Wait before transitioning open → half-open (Duration or string). */
2190
- readonly resetTimeout: Duration.DurationInput;
2191
+ readonly resetTimeout: Duration.Input;
2191
2192
  /** Successes required in half-open before closing again. Default 1. */
2192
2193
  readonly halfOpenSuccessThreshold?: number;
2193
2194
  /** Predicate: does this error count toward the threshold? Default: all
@@ -2205,14 +2206,12 @@ export declare interface CircuitBreakerOptions {
2205
2206
  export declare class CircuitOpen extends CircuitOpen_base {
2206
2207
  }
2207
2208
 
2208
- declare const CircuitOpen_base: Schema.TaggedErrorClass<CircuitOpen, "CircuitOpen", {
2209
- readonly _tag: Schema.tag<"CircuitOpen">;
2210
- } & {
2209
+ declare const CircuitOpen_base: Schema.Class<CircuitOpen, Schema.TaggedStruct<"CircuitOpen", {
2211
2210
  /** Breaker name (the `name` option, or `'circuit'` when unnamed). */
2212
- name: typeof Schema.String;
2211
+ readonly name: Schema.String;
2213
2212
  /** Best-effort ms until the breaker next admits a probe call. */
2214
- retryAfterMs: typeof Schema.Number;
2215
- }>;
2213
+ readonly retryAfterMs: Schema.Number;
2214
+ }>, Cause.YieldableError>;
2216
2215
 
2217
2216
  export declare type CircuitState = 'closed' | 'open' | 'half-open';
2218
2217
 
@@ -2746,7 +2745,7 @@ export declare type CoordinationOutcome = 'single' | 'wonLock' | 'lostLock' | 'e
2746
2745
  * instance should run the firing. Implementations:
2747
2746
  * - SingleCoordinator → always true (one process)
2748
2747
  * - AdvisoryLockCoordinator → postgres advisory lock (wired in CLI)
2749
- * - ClusterCoordinator → @effect/cluster shard (future)
2748
+ * - ClusterCoordinator → effect/cluster shard (future)
2750
2749
  */
2751
2750
  export declare interface Coordinator {
2752
2751
  readonly kind: 'single' | 'advisoryLock' | 'cluster';
@@ -2985,7 +2984,7 @@ export declare interface CostEvent {
2985
2984
  export declare class CostRegistry extends CostRegistry_base {
2986
2985
  }
2987
2986
 
2988
- declare const CostRegistry_base: Context.TagClass<CostRegistry, "@voltro/CostRegistry", CostRegistryApi>;
2987
+ declare const CostRegistry_base: Context.ServiceClass<CostRegistry, "@voltro/CostRegistry", CostRegistryApi>;
2989
2988
 
2990
2989
  export declare interface CostRegistryApi {
2991
2990
  /** Per-tenant compute-cost attribution — the chargeback feed. */
@@ -3002,8 +3001,8 @@ export declare interface CostRegistryApi {
3002
3001
  readonly subscribe: (listener: (s: CostBudgetSignal) => void) => () => void;
3003
3002
  }
3004
3003
 
3005
- /** Define a cumulative counter. Increment with `incrementMetric` / `Metric.increment`. */
3006
- export declare const counter: (name: string, description?: string) => Metric.Metric.Counter<number>;
3004
+ /** Define a cumulative counter. Increment with `incrementMetric` / `Metric.update(metric, 1)`. */
3005
+ export declare const counter: (name: string, description?: string) => Metric.Counter<number>;
3007
3006
 
3008
3007
  /**
3009
3008
  * Count workflows actively EXECUTING (`_voltro_workflow_runs.status =
@@ -3985,6 +3984,8 @@ export declare class Dispatcher {
3985
3984
  /** Query labels already warned about for an undeclared raw read, so a hot
3986
3985
  * subscription logs once rather than once per subscriber. */
3987
3986
  private readonly rawReadWarned;
3987
+ private changeEpoch;
3988
+ private readonly committedReads;
3988
3989
  /** The CRDT-managed columns of `table` (empty when it has none) — what a
3989
3990
  * subscription's backpressure outbox folds incrementally. */
3990
3991
  crdtColumnsFor(table: string): ReadonlySet<string>;
@@ -4059,6 +4060,9 @@ export declare class Dispatcher {
4059
4060
  * grant comes back.
4060
4061
  */
4061
4062
  private revokeSubscription;
4063
+ /** Remove once, including a pending retry and its active metric. In-flight
4064
+ * async reads check identity again before emitting or scheduling anything. */
4065
+ private removeComputed;
4062
4066
  /** `revokeSubscription` for the computed path. Same reasoning. */
4063
4067
  private revokeComputed;
4064
4068
  /**
@@ -4069,13 +4073,10 @@ export declare class Dispatcher {
4069
4073
  * Returns an `unsubscribe` the caller MUST invoke on teardown.
4070
4074
  */
4071
4075
  subscribeComputed(computed: ComputedQuery, emit: (event: SubscriptionEvent<unknown>) => void, context: RuntimeContext, label?: string): Promise<() => void>;
4072
- /** Re-run a computed subscription's handler; emit a fresh snapshot iff
4073
- * the value changed. A computed value is an arbitrary payload (a scalar,
4074
- * an aggregate object, a non-id-keyed array) — it has no id-keyed row
4075
- * set to diff, so an update ships the full value as a `snapshot`, which
4076
- * the client materialises as a wholesale base replacement. Best-effort:
4077
- * a recompute throw is logged, not propagated, so one failing query
4078
- * can't wedge the change stream. */
4076
+ /** Serialize computed reads. A source change during a pending read asks for
4077
+ * one more read before delivery; an older result cannot overtake newer data.
4078
+ * Ordinary failures are visible in-band and retry independently of changes.
4079
+ * Access withdrawal stays terminal and never enters the retry lane. */
4079
4080
  private recomputeComputed;
4080
4081
  /** Live snapshot of all fingerprinted subscriptions — used by the
4081
4082
  * `/_voltro/inspect/subscriptions` endpoint and DevTools. */
@@ -4215,7 +4216,7 @@ export declare interface DrainDeps<R = never> {
4215
4216
  * inject `exit` and drive a finalizer that genuinely never finishes.
4216
4217
  */
4217
4218
  export declare const drainForShutdown: (options: {
4218
- readonly fibers: ReadonlyArray<Fiber.RuntimeFiber<void, unknown>>;
4219
+ readonly fibers: ReadonlyArray<Fiber.Fiber<void, unknown>>;
4219
4220
  readonly hooks: ReadonlyArray<() => void | Promise<void>>;
4220
4221
  readonly deadlineMs: number;
4221
4222
  readonly exit: () => void;
@@ -4238,7 +4239,7 @@ export declare interface DrainResult {
4238
4239
  readonly dead: number;
4239
4240
  readonly skipped: number;
4240
4241
  /**
4241
- * How many rows this pass had to look at. `0` means the queue is EMPTY, which
4242
+ * How many rows this pass had to look at. `0` means the eligible queue is EMPTY, which
4242
4243
  * a caller cannot otherwise tell from "everything delivered" — both leave
4243
4244
  * `delivered` at whatever it was, and only one of them means the poll has
4244
4245
  * nothing left to do.
@@ -4305,7 +4306,7 @@ export declare const effectiveRelations: (subject: RebacSubject, resource: Rebac
4305
4306
  export declare class EffectStore extends EffectStore_base {
4306
4307
  }
4307
4308
 
4308
- declare const EffectStore_base: Context.TagClass<EffectStore, "@voltro/EffectStore", EffectStoreOps>;
4309
+ declare const EffectStore_base: Context.ServiceClass<EffectStore, "@voltro/EffectStore", EffectStoreOps>;
4309
4310
 
4310
4311
  export declare interface EffectStoreOps {
4311
4312
  /** Typed the same way `FluentStore.query` is — the row type rides in on the
@@ -4432,14 +4433,7 @@ export declare const enforceApproval: (input: {
4432
4433
  readonly traceId?: string | undefined;
4433
4434
  }) => Promise<void>;
4434
4435
 
4435
- export declare interface EnqueueOptions {
4436
- /** Drop this enqueue if an undelivered row already carries the same key. */
4437
- readonly idempotencyKey?: string;
4438
- /** Override the handler's `maxAttempts` for this one effect. */
4439
- readonly maxAttempts?: number;
4440
- /** Delay the first attempt (ms from now). */
4441
- readonly delayMs?: number;
4442
- }
4436
+ export { EnqueueOptions }
4443
4437
 
4444
4438
  /**
4445
4439
  * Attribute the reads that FOLLOW, in this execution context, to `procedure`.
@@ -4559,6 +4553,8 @@ export declare class EventBus {
4559
4553
  * sacrificed under pressure, never delivery.
4560
4554
  */
4561
4555
  private evictIfOverCapacity;
4556
+ /** Select a bounded batch, preserving insertion order for equal timestamps. */
4557
+ private coldestIdleRoutes;
4562
4558
  /**
4563
4559
  * Drop what the ring may no longer replay.
4564
4560
  *
@@ -4764,7 +4760,7 @@ export declare interface EventPublishContext {
4764
4760
  }
4765
4761
 
4766
4762
  export declare interface EventPublisher {
4767
- 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>;
4763
+ 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>;
4768
4764
  }
4769
4765
 
4770
4766
  export declare type EventPublishError = EventPayloadInvalid | EventKeyInvalid | EventPayloadTooLarge;
@@ -4849,9 +4845,9 @@ export declare const exchangeAuthorizationCode: (definition: OAuth2ConnectionDef
4849
4845
  * `defineMutation` / `defineAction` result carries all of it. */
4850
4846
  export declare interface ExecutorDescriptor {
4851
4847
  readonly kind: 'query' | 'mutation' | 'action';
4852
- readonly input: Schema.Schema.Any;
4853
- readonly output: Schema.Schema.Any;
4854
- readonly error: Schema.Schema.All;
4848
+ readonly input: Schema.Top;
4849
+ readonly output: Schema.Top;
4850
+ readonly error: Schema.Top;
4855
4851
  }
4856
4852
 
4857
4853
  /** The failure type of an executor's return, when it returns an Effect. A
@@ -5019,7 +5015,7 @@ export declare type ExpectationInvariant = {
5019
5015
  export declare class ExpectationRegistry extends ExpectationRegistry_base {
5020
5016
  }
5021
5017
 
5022
- declare const ExpectationRegistry_base: Context.TagClass<ExpectationRegistry, "@voltro/ExpectationRegistry", ExpectationRegistryApi>;
5018
+ declare const ExpectationRegistry_base: Context.ServiceClass<ExpectationRegistry, "@voltro/ExpectationRegistry", ExpectationRegistryApi>;
5023
5019
 
5024
5020
  export declare interface ExpectationRegistryApi {
5025
5021
  /** Snapshot every registered expectation's current state — the inspect feed. */
@@ -5283,7 +5279,7 @@ export declare type ExperimentMetricKind = ExperimentMetric['kind'];
5283
5279
  export declare class ExperimentRegistry extends ExperimentRegistry_base {
5284
5280
  }
5285
5281
 
5286
- declare const ExperimentRegistry_base: Context.TagClass<ExperimentRegistry, "@voltro/ExperimentRegistry", ExperimentRegistryApi>;
5282
+ declare const ExperimentRegistry_base: Context.ServiceClass<ExperimentRegistry, "@voltro/ExperimentRegistry", ExperimentRegistryApi>;
5287
5283
 
5288
5284
  export declare interface ExperimentRegistryApi {
5289
5285
  /** Snapshot every registered experiment's current result — the inspect feed. */
@@ -5373,6 +5369,12 @@ export declare interface ExperimentVariantSpec {
5373
5369
  readonly weight?: number;
5374
5370
  }
5375
5371
 
5372
+ export declare const exponentialBoundaries: (options: {
5373
+ readonly start: number;
5374
+ readonly factor: number;
5375
+ readonly count: number;
5376
+ }) => ReadonlyArray<number>;
5377
+
5376
5378
  /**
5377
5379
  * How far AHEAD of now an external trigger's stated instant may be.
5378
5380
  *
@@ -5461,12 +5463,12 @@ export declare type ExternalTriggerOutcome =
5461
5463
  export { extractDbCause }
5462
5464
 
5463
5465
  /** The literal `_tag`s of a failure type. `any` contributes none (nothing can
5464
- * be proven about it); `UnknownException` — Effect's wrapper for a failure it
5466
+ * be proven about it); `UnknownError` — Effect's wrapper for a failure it
5465
5467
  * could not type, e.g. `Effect.tryPromise` without `catch` — counts as
5466
5468
  * untagged, which is what it means. */
5467
5469
  declare type FailureTag<E> = 0 extends (1 & E) ? never : E extends {
5468
5470
  readonly _tag: infer T;
5469
- } ? T extends 'UnknownException' ? never : T extends string ? T : never : never;
5471
+ } ? T extends 'UnknownError' ? never : T extends string ? T : never : never;
5470
5472
 
5471
5473
  export declare interface FieldChange {
5472
5474
  readonly from: unknown;
@@ -5667,14 +5669,9 @@ export declare interface FluentStoreBackend {
5667
5669
  * rbac role-derived scopes) via `hasEffectiveScope` — so `admin:full` sees every
5668
5670
  * such column, exactly as it satisfies every guard.
5669
5671
  *
5670
- * SUBJECT-INDEPENDENCE is deliberate and load-bearing: when the table declares
5671
- * NO `.readableBy(...)` column, this returns exactly `serverOnlyColumnNames` —
5672
- * the same set for every subject — so the Dispatcher's per-subscriber strip
5673
- * collapses to Part A's behaviour and its read/diff memo still shares one array
5674
- * across all subscribers of a change. Only a table that actually carries a
5675
- * `.readableBy(...)` column pays the per-subject cost (different subjects get
5676
- * different stripped arrays, the same accepted cost `.serverOnly()` already has
5677
- * whenever it strips anything).
5672
+ * With no `.readableBy(...)` metadata every subject resolves the same column
5673
+ * list. The dispatch-local strip memo can then share ordinary stripped rows;
5674
+ * this helper itself neither clones rows nor caches mutable metadata or scopes.
5678
5675
  *
5679
5676
  * An unknown / unregistered table forbids nothing (returns `[]`) rather than
5680
5677
  * throwing — same posture as `serverOnlyColumnNames`.
@@ -5744,7 +5741,7 @@ export declare const frameworkDeviceStrategy: (service: DeviceServiceShape, opts
5744
5741
  }) => AuthStrategy;
5745
5742
 
5746
5743
  /** Define a gauge (set with `setMetric`). */
5747
- export declare const gauge: (name: string, description?: string) => Metric.Metric.Gauge<number>;
5744
+ export declare const gauge: (name: string, description?: string) => Metric.Gauge<number>;
5748
5745
 
5749
5746
  /** Generate a fresh token `<prefix><40-char-base64url>`. */
5750
5747
  export declare const generateApiKeyToken: (prefix?: string) => string;
@@ -5855,7 +5852,7 @@ export declare interface HealthConfigInput {
5855
5852
  }
5856
5853
 
5857
5854
  /** Define a histogram. `boundaries` default to the framework duration buckets. */
5858
- export declare const histogramMetric: (name: string, boundaries?: MetricBoundaries.MetricBoundaries, description?: string) => Metric.Metric.Histogram<number>;
5855
+ export declare const histogramMetric: (name: string, boundaries?: ReadonlyArray<number>, description?: string) => Metric.Histogram<number>;
5859
5856
 
5860
5857
  /**
5861
5858
  * Full-lineage provenance from versioning history rows (oldest-first input).
@@ -5892,7 +5889,7 @@ export declare interface HttpSecretsOptions {
5892
5889
 
5893
5890
  /**
5894
5891
  * WS-rpc idempotency store + TTL, passed to `bindMutation` as a closure param by
5895
- * the boot path (`serveApi`/`dev`) — NOT a service. @effect/rpc runs a handler in
5892
+ * the boot path (`serveApi`/`dev`) — NOT a service. effect/rpc runs a handler in
5896
5893
  * a NARROWED context (only the middleware `provides` + declared deps), so a plain
5897
5894
  * merged service is invisible to `Effect.serviceOption` inside the handler; the
5898
5895
  * store+ttl are boot-time constants the bind site already holds, so a closure is
@@ -5952,6 +5949,7 @@ export declare class IndexedMatcher implements Matcher {
5952
5949
  private readonly columnByTable;
5953
5950
  private readonly rangeByTable;
5954
5951
  private readonly tupleByTable;
5952
+ private readonly compositeByTable;
5955
5953
  private readonly unindexedByTable;
5956
5954
  private readonly subscriptions;
5957
5955
  register(sub: SubscriptionRecord): void;
@@ -6460,7 +6458,7 @@ export declare interface KvFacade {
6460
6458
  * the backend `KvStore` (R = never), so both boot paths hand it to handlers
6461
6459
  * as `Layer.succeed(Kv, service)` — enabling `yield* Kv` in Effect handlers
6462
6460
  * exactly like `Layer.succeed(Cache, cacheService)` does for the cache. */
6463
- readonly service: Kv;
6461
+ readonly service: Effect.Success<typeof Kv>;
6464
6462
  /** The resolved backend kind — for boot logging. */
6465
6463
  readonly backend: 'database' | 'redis' | 'memory';
6466
6464
  /** Tear down the managed runtime (closes a pooled redis connection). */
@@ -6514,6 +6512,12 @@ export declare interface LevelReactionDefinition extends ReactionBase {
6514
6512
  readonly guards?: Omit<ReactionGuards, 'dedupeKey'>;
6515
6513
  }
6516
6514
 
6515
+ export declare const linearBoundaries: (options: {
6516
+ readonly start: number;
6517
+ readonly width: number;
6518
+ readonly count: number;
6519
+ }) => ReadonlyArray<number>;
6520
+
6517
6521
  export declare class LinearScanMatcher implements Matcher {
6518
6522
  private readonly byTable;
6519
6523
  register(sub: SubscriptionRecord): void;
@@ -6721,9 +6725,9 @@ export declare const makeAsyncKv: ({ store, env }: KvFacadeOptions) => Promise<K
6721
6725
  * (a no-op for a connection that never re-authenticated);
6722
6726
  * 2. run the FULL chain on the result — strategies, session revocation,
6723
6727
  * `resolveScopes`, the scope cache;
6724
- * 3. record what the strategy verified about the credential's lifetime, so
6725
- * `ConnectionInfo.credentialExpiresAt` reports the token's own `exp` rather
6726
- * than a cookie derivation that only ever saw one auth shape.
6728
+ * 3. pass the verified lifetime through call-local Effect context, so parallel
6729
+ * calls and explicitly unbounded credentials cannot inherit another call's
6730
+ * expiry. Compose the group's pair with `withRpcAuthMiddleware`.
6727
6731
  *
6728
6732
  * Step 1 is the only thing a re-authenticated connection gets. It changes WHICH
6729
6733
  * credential is presented and nothing about how it is judged.
@@ -6868,7 +6872,7 @@ export declare const makeListConnectionsExecutor: (deps: ConnectionBuiltinDeps)
6868
6872
  * round-trip it — a guard for exotic schemas; for a value the handler actually
6869
6873
  * produced, `encodeUnknownSync` never throws. `undefined` schema → no codec.
6870
6874
  */
6871
- export declare const makeMutationOutputCodec: (outputSchema: Schema.Schema.AnyNoContext | undefined) => MutationOutputCodec<unknown> | undefined;
6875
+ export declare const makeMutationOutputCodec: (outputSchema: Schema.Top | undefined) => MutationOutputCodec<unknown> | undefined;
6872
6876
 
6873
6877
  /**
6874
6878
  * Build the shared mutation runner. Used by BOTH the rpc WS handler and
@@ -6958,16 +6962,13 @@ export declare const makeQueryFinalizer: (options: QueryFinalizeOptions) => ((de
6958
6962
  * the socket keeps delivering rows the subject may no longer read until
6959
6963
  * the client happens to disconnect.
6960
6964
  *
6961
- * So every delivery re-runs the same `checkGuardsEffect` the subscribe-time
6962
- * gate ran — including the async resource-scope resolver, which is where a
6963
- * per-row/per-team revocation actually shows up. Returns `null` when the
6964
- * subject still passes, or the typed `ScopeError` that denied it.
6965
- *
6966
- * Returns a closure that always resolves `null` when the descriptor carries
6967
- * no guards AND default-deny is off, so the caller needs no branch and an
6968
- * unguarded query pays only a resolved promise. Under `defaultDeny` an
6969
- * UNDECIDED descriptor resolves the same typed refusal on every delivery —
6970
- * fail closed on the re-check too, not only at subscribe.
6965
+ * Each delivery refreshes the original authentication chain, subject guards,
6966
+ * dynamic role grants, and resource guards before emitting data. Configured
6967
+ * authentication/scope caches retain their documented invalidation windows.
6968
+ * A revoked credential or grant ends the subscription with a typed refusal.
6969
+ * The original principal and tenant remain fixed; changing either requires a
6970
+ * new subscription. Even unguarded descriptors refresh authentication, while
6971
+ * default-deny keeps rejecting descriptors without a declared access policy.
6971
6972
  */
6972
6973
  export declare const makeQueryReauthorizer: (query: MutationLike, input: unknown, defaultDeny?: boolean) => (subject: Subject) => () => Promise<unknown>;
6973
6974
 
@@ -7321,10 +7322,9 @@ export declare const mergeCookieHeader: (existing: string | undefined, patch: Re
7321
7322
  */
7322
7323
  export declare const mergeFleetObservations: <T>(rows: ReadonlyArray<ReplicaObservationRow>, members: ReadonlyArray<FleetMember>, staleAfterMs?: number) => FleetMergeResult<T>;
7323
7324
 
7324
- export { MetricBoundaries }
7325
-
7326
7325
  export declare interface MetricBucketPoint {
7327
- /** Upper bound (Prometheus `le`); `Infinity` for the catch-all bucket. */
7326
+ /** Upper bound (Prometheus `le`). Effect 4 reports the declared boundaries only;
7327
+ * the catch-all is the sample's `count` (the Prometheus exporter writes `+Inf` from it). */
7328
7328
  readonly le: number;
7329
7329
  /** Cumulative count ≤ le. */
7330
7330
  readonly count: number;
@@ -7456,6 +7456,10 @@ export declare interface MutationOutputCodec<Output> {
7456
7456
  }
7457
7457
 
7458
7458
  export declare interface MutationRunnerDeps {
7459
+ readonly outcomeOutbox?: (request: ServeRequestContext) => OutboxEnqueueFacade | undefined;
7460
+ /** A failure aborts the business transaction; transient contention replays
7461
+ * executor and hook together. Never perform external I/O here. */
7462
+ readonly beforeMutationCommit?: ServeMutationCommitHook | undefined;
7459
7463
  readonly store: TransactionalStore;
7460
7464
  /** Select and provision the request's physical store before opening its
7461
7465
  * transaction. Resolved once, including across retries and post-commit folds. */
@@ -7478,6 +7482,7 @@ export declare interface MutationRunnerDeps {
7478
7482
  /** Build the per-call `AppContext` bound to the transactional `tx`. */
7479
7483
  readonly buildContext: (request: ServeRequestContext, tx: unknown, lifecycle?: MutationLifecycle) => {
7480
7484
  readonly store: unknown;
7485
+ readonly outbox?: OutboxEnqueueFacade;
7481
7486
  };
7482
7487
  /** Run an Effect-returning executor with the per-request store layer. */
7483
7488
  readonly runEffect: (effect: Effect.Effect<unknown, unknown, never>, store: unknown) => Promise<unknown>;
@@ -7818,12 +7823,10 @@ export declare class OptimisticLockError extends OptimisticLockError_base {
7818
7823
  get message(): string;
7819
7824
  }
7820
7825
 
7821
- declare const OptimisticLockError_base: Schema.TaggedErrorClass<OptimisticLockError, "OptimisticLockError", {
7822
- readonly _tag: Schema.tag<"OptimisticLockError">;
7823
- } & {
7824
- table: typeof Schema.String;
7825
- expected: typeof Schema.Number;
7826
- }>;
7826
+ declare const OptimisticLockError_base: Schema.Class<OptimisticLockError, Schema.TaggedStruct<"OptimisticLockError", {
7827
+ readonly table: Schema.String;
7828
+ readonly expected: Schema.Number;
7829
+ }>, YieldableError>;
7827
7830
 
7828
7831
  export declare interface OrchestratorTickDeps {
7829
7832
  readonly store: DataStore;
@@ -7893,7 +7896,7 @@ export declare interface OriginGuardConfig {
7893
7896
  export declare type OriginGuardMode = 'off' | 'same-origin';
7894
7897
 
7895
7898
  /**
7896
- * Map an `import('@effect/opentelemetry')` rejection to what the reader needs.
7899
+ * Map an `import('@effect/opentelemetry/NodeSdk')` rejection to what the reader needs.
7897
7900
  *
7898
7901
  * Exported so the branch is testable without uninstalling the package. Only a
7899
7902
  * module-NOT-FOUND becomes the install instruction: anything else is a real
@@ -8009,14 +8012,14 @@ export declare const outboxAttemptsTable: TableLike;
8009
8012
  * twice because of us or because of them" becomes unanswerable. */
8010
8013
  export declare type OutboxAttemptTrigger = 'automatic' | 'manual';
8011
8014
 
8012
- export declare interface OutboxFacade {
8013
- /**
8014
- * Persist the intent to run `effect` after this transaction commits.
8015
- *
8016
- * Returns the outbox row id, which doubles as the delivery id a client can
8017
- * watch to render external-side-effect progress ("saving… syncing… synced").
8018
- */
8019
- enqueue(effect: string, payload: Record<string, unknown>, options?: EnqueueOptions): Promise<string>;
8015
+ /** Declared-event publication for an outbox attempt, scoped to its queued tenant.
8016
+ * This service provides no request subject or store access. */
8017
+ export declare class OutboxEventPublisher extends OutboxEventPublisher_base {
8018
+ }
8019
+
8020
+ declare const OutboxEventPublisher_base: Context.ServiceClass<OutboxEventPublisher, "@voltro/OutboxEventPublisher", EventPublisher>;
8021
+
8022
+ export declare interface OutboxFacade extends OutboxEnqueueFacade {
8020
8023
  /**
8021
8024
  * Re-arm one entry for delivery NOW, on purpose, attributed to the caller.
8022
8025
  *
@@ -8061,25 +8064,9 @@ export declare interface OutboxFacadeDeps {
8061
8064
  readonly now?: () => Date;
8062
8065
  }
8063
8066
 
8064
- export declare interface OutboxHandlerContext {
8065
- /** Stable identity of this delivery intent, preserved across retries. */
8066
- readonly outboxId: string;
8067
- /** Caller-supplied enqueue key, or null. Unlike outboxId this can be reused
8068
- * for a distinct intent after an earlier intent has been delivered. */
8069
- readonly idempotencyKey: string | null;
8070
- readonly payload: Record<string, unknown>;
8071
- readonly attempt: number;
8072
- readonly subjectId: string | null;
8073
- readonly tenantId: string | null;
8074
- readonly traceId: string | null;
8075
- }
8067
+ export { OutboxHandlerContext }
8076
8068
 
8077
- export declare interface OutboxHandlerDefinition<R = never> {
8078
- readonly effect: string;
8079
- readonly handler: (ctx: OutboxHandlerContext) => Promise<unknown> | Effect.Effect<unknown, unknown, R>;
8080
- /** Give up after this many attempts, then dead-letter. Default 8. */
8081
- readonly maxAttempts?: number;
8082
- }
8069
+ export { OutboxHandlerDefinition }
8083
8070
 
8084
8071
  /** What the pump hands events to — the `emit` of a `Stream.asyncScoped`. */
8085
8072
  export declare interface OutboxSink<T> {
@@ -8155,7 +8142,7 @@ export declare interface PatConnectionDefinition extends ConnectionDefinitionCom
8155
8142
  * validity — but `voltro doctor`'s static `workflows.start` audit calls the same
8156
8143
  * function, so the two cannot disagree about what a payload requires.
8157
8144
  */
8158
- export declare const payloadPropertyNames: (schema: Schema.Schema.Any) => {
8145
+ export declare const payloadPropertyNames: (schema: Schema.Top) => {
8159
8146
  readonly required: ReadonlyArray<string>;
8160
8147
  readonly optional: ReadonlyArray<string>;
8161
8148
  };
@@ -8249,11 +8236,7 @@ export declare interface PluginRefRule {
8249
8236
  }
8250
8237
 
8251
8238
  /** The store surface the enforcement needs. */
8252
- export declare interface PluginRefStore {
8253
- query: (descriptor: unknown) => Promise<ReadonlyArray<Record<string, unknown>>>;
8254
- update: (table: string, id: string, patch: Record<string, unknown>) => Promise<unknown>;
8255
- delete: (table: string, id: string) => Promise<unknown>;
8256
- }
8239
+ export declare type PluginRefStore = Pick<DataStore, 'updateMany' | 'deleteMany'>;
8257
8240
 
8258
8241
  /** The signature a plugin sees on its bind-ctx. */
8259
8242
  export declare type PluginScheduleCoordinated = (name: string, intervalMs: number, effect: CoordinatedEffect, options?: CoordinatedTaskOptions) => CoordinatedScheduleHandle;
@@ -8443,7 +8426,7 @@ export declare interface PublicDevice {
8443
8426
  * Returns the assigned serial so a caller (and the tests) can observe ordering
8444
8427
  * without reaching into the bus.
8445
8428
  */
8446
- 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<{
8429
+ 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<{
8447
8430
  readonly n: number;
8448
8431
  readonly deferred: boolean;
8449
8432
  }, EventPublishError>;
@@ -8474,7 +8457,7 @@ export declare interface PumpOptions {
8474
8457
  * computed). The three used to carry the same loop inline; a diagnostic added
8475
8458
  * to one of them would have been absent from the other two.
8476
8459
  *
8477
- * **The stall diagnostic.** `@effect/rpc` delivers a stream as `Chunk`
8460
+ * **The stall diagnostic.** `effect/rpc` delivers a stream as `Chunk`
8478
8461
  * messages and waits for the client's `Ack` of each before writing the next.
8479
8462
  * The typed client acknowledges by itself; a hand-rolled socket client that
8480
8463
  * only listens receives exactly one Chunk per subscription — the snapshot — and
@@ -8703,6 +8686,17 @@ export declare type ReactionOp = 'insert' | 'update' | 'delete';
8703
8686
 
8704
8687
  export declare type ReactionOutcome = 'acted' | 'skipped-op' | 'skipped-when' | 'skipped-dedupe' | 'skipped-ratelimit' | 'skipped-budget';
8705
8688
 
8689
+ /**
8690
+ * The DURABLE rate key for one firing: reaction, partition, and time bucket.
8691
+ *
8692
+ * A fixed window keeps one durable bucket cursor and unique slot claims,
8693
+ * rather than retaining every event timestamp. The transaction-owned cursor
8694
+ * avoids probing every previously occupied slot; the UNIQUE remains the final
8695
+ * arbiter. JSON encoding preserves arbitrary names/partitions without NUL in
8696
+ * SQL text. Up to 2× the limit may fire across a bucket boundary.
8697
+ */
8698
+ export declare const reactionRateBucketKey: (reactionName: string, partition: string, windowMs: number, now: number) => string;
8699
+
8706
8700
  /**
8707
8701
  * A per-key sliding-window rate limiter — IN-MEMORY, PER PROCESS.
8708
8702
  *
@@ -8712,10 +8706,11 @@ export declare type ReactionOutcome = 'acted' | 'skipped-op' | 'skipped-when' |
8712
8706
  * the runner logs once when it falls back, because "my limit is 3× what I
8713
8707
  * declared" is not something anyone discovers by reading config.
8714
8708
  *
8715
- * Prefer {@link ReactionRunDeps.claimRateSlot}.
8709
+ * Prefer {@link ReactionRunDeps.claimRate}.
8716
8710
  */
8717
8711
  export declare class ReactionRateLimiter {
8718
8712
  private readonly hits;
8713
+ private sweep;
8719
8714
  allow(key: string, limit: number, windowMs: number, now: number): boolean;
8720
8715
  }
8721
8716
 
@@ -8746,13 +8741,13 @@ export declare interface ReactionRunDeps {
8746
8741
  * requireAiBudget). Only consulted when `guards.costBudgetUsd` is set. */
8747
8742
  readonly checkBudget?: (tenantId: string | null, budgetUsd: number) => boolean | Promise<boolean>;
8748
8743
  /**
8749
- * Atomically claim ONE rate slot. `true` = we got it and may fire.
8744
+ * Atomically reserve ONE slot in a rate bucket. `true` = we may fire.
8750
8745
  *
8751
8746
  * Injected by the serve layer over the shared store, so the cap holds across
8752
8747
  * replicas. Absent → the runner falls back to {@link ReactionRateLimiter},
8753
8748
  * which is per-process and therefore N× on N replicas.
8754
8749
  */
8755
- readonly claimRateSlot?: (key: string) => Promise<boolean>;
8750
+ readonly claimRate?: (key: string, limit: number, expiresAt: Date) => Promise<boolean>;
8756
8751
  readonly rateLimiter?: ReactionRateLimiter;
8757
8752
  readonly now?: () => number;
8758
8753
  }
@@ -8799,7 +8794,7 @@ export declare interface ReactiveConfigInput {
8799
8794
  readonly oversizedEventBytes?: number;
8800
8795
  /** How long a delivery may sit unaccepted by the transport before the
8801
8796
  * server says so — a WARN naming the subscription and the missing
8802
- * `@effect/rpc` `Ack`, plus `voltro_subscription_stalled_total`.
8797
+ * `effect/rpc` `Ack`, plus `voltro_subscription_stalled_total`.
8803
8798
  * Default 5_000 ms. */
8804
8799
  readonly stallWarnAfterMs?: number;
8805
8800
  };
@@ -9314,13 +9309,13 @@ export declare interface RegistryTableLike {
9314
9309
  * registry indexes this so the MutationStore can look it up in
9315
9310
  * O(1) per write without touching the original Table object.
9316
9311
  */
9317
- readonly insertSchema?: Schema.Schema.Any;
9312
+ readonly insertSchema?: Schema.Top;
9318
9313
  /**
9319
9314
  * Optional `effect/Schema` the framework decodes a patch against
9320
9315
  * BEFORE every UPDATE. Set via `table().validatePatch(schema)`
9321
9316
  * (already `Schema.partial`-wrapped by the table builder).
9322
9317
  */
9323
- readonly validatePatchSchema?: Schema.Schema.Any;
9318
+ readonly validatePatchSchema?: Schema.Top;
9324
9319
  }
9325
9320
 
9326
9321
  /** Rebuild checkable guards from the row. The stored resource id becomes a
@@ -9537,22 +9532,22 @@ export declare interface ReplicatedDataStoreOptions {
9537
9532
  }
9538
9533
 
9539
9534
  declare const Request_2: Schema.Struct<{
9540
- id: Schema.filter<Schema.filter<typeof Schema.String>>;
9541
- name: Schema.filter<Schema.filter<typeof Schema.String>>;
9542
- from: typeof Schema.DateFromSelf;
9543
- to: typeof Schema.DateFromSelf;
9544
- occurrences: Schema.Array$<Schema.filter<typeof Schema.Number>>;
9545
- status: Schema.Literal<["queued", "running", "completed", "interrupted"]>;
9546
- owner: Schema.NullOr<Schema.filter<Schema.filter<typeof Schema.String>>>;
9547
- createdAt: typeof Schema.DateFromSelf;
9548
- updatedAt: typeof Schema.DateFromSelf;
9549
- cursor: Schema.filter<Schema.filter<typeof Schema.Number>>;
9550
- activeIndex: Schema.NullOr<Schema.filter<Schema.filter<typeof Schema.Number>>>;
9551
- results: Schema.Array$<Schema.Struct<{
9552
- runId: Schema.filter<Schema.filter<typeof Schema.String>>;
9553
- status: Schema.Literal<["succeeded", "failed", "skipped", "missed"]>;
9535
+ readonly id: Schema.String;
9536
+ readonly name: Schema.String;
9537
+ readonly from: Schema.Date;
9538
+ readonly to: Schema.Date;
9539
+ readonly occurrences: Schema.$Array<Schema.Number>;
9540
+ readonly status: Schema.Literals<readonly ["queued", "running", "completed", "interrupted"]>;
9541
+ readonly owner: Schema.NullOr<Schema.String>;
9542
+ readonly createdAt: Schema.Date;
9543
+ readonly updatedAt: Schema.Date;
9544
+ readonly cursor: Schema.Number;
9545
+ readonly activeIndex: Schema.NullOr<Schema.Number>;
9546
+ readonly results: Schema.$Array<Schema.Struct<{
9547
+ readonly runId: Schema.String;
9548
+ readonly status: Schema.Literals<readonly ["succeeded", "failed", "skipped", "missed"]>;
9554
9549
  }>>;
9555
- error: Schema.NullOr<typeof Schema.String>;
9550
+ readonly error: Schema.NullOr<Schema.String>;
9556
9551
  }>;
9557
9552
 
9558
9553
  export declare interface ResendOptions {
@@ -9708,7 +9703,9 @@ export declare interface ResolvedDevice {
9708
9703
  * Walk a query descriptor's eager-load tree and return the FULL set
9709
9704
  * of tables whose changes could affect the resolved snapshot.
9710
9705
  *
9711
- * - For a query without `eager`, returns just `{ descriptor.table }`.
9706
+ * - Includes explicitly declared invalidation sources (`dependentTables`),
9707
+ * independently of SQL predicates and projections.
9708
+ * - A plain query with no additional sources returns `{ descriptor.table }`.
9712
9709
  * - For each one()/many() relation, adds the target table.
9713
9710
  * - For each manyToMany() relation, adds the through-table AND the
9714
9711
  * target table (writes to either can shift the resolved set).
@@ -10094,13 +10091,6 @@ export declare interface RevalidationMessage {
10094
10091
 
10095
10092
  export declare type RevalidationPublisher = (message: RevalidationMessage) => Promise<void>;
10096
10093
 
10097
- /**
10098
- * Reverse ONE recorded event over an in-memory row-set (to step BACK across it):
10099
- * - insert → the row was added, so remove it (by new.id).
10100
- * - update → restore the row to its `old` image (by id).
10101
- * - delete → the row was removed, so add `old` back.
10102
- * Pure. Applied newest-first to walk from "now" to a past point.
10103
- */
10104
10094
  export declare const reverseEventOverRows: (rows: ReadonlyArray<Row_2>, e: TimelineEvent) => ReadonlyArray<Row_2>;
10105
10095
 
10106
10096
  /** The ids that were visible before but are not now — what a live-revocation
@@ -10268,16 +10258,15 @@ export declare interface RowFilter<Ctx = unknown> {
10268
10258
  * the fix, rather than degrading to an unfiltered or empty answer.
10269
10259
  */
10270
10260
  export declare class RowFilterDeclarationViolated extends RowFilterDeclarationViolated_base {
10261
+ get message(): string;
10271
10262
  }
10272
10263
 
10273
- declare const RowFilterDeclarationViolated_base: Schema.TaggedErrorClass<RowFilterDeclarationViolated, "RowFilterDeclarationViolated", {
10274
- readonly _tag: Schema.tag<"RowFilterDeclarationViolated">;
10275
- } & {
10264
+ declare const RowFilterDeclarationViolated_base: Schema.Class<RowFilterDeclarationViolated, Schema.TaggedStruct<"RowFilterDeclarationViolated", {
10276
10265
  /** The table the predicate narrowed. */
10277
- table: typeof Schema.String;
10266
+ readonly table: Schema.String;
10278
10267
  /** The declared set, for the message. */
10279
- declared: Schema.Array$<typeof Schema.String>;
10280
- }>;
10268
+ readonly declared: Schema.$Array<Schema.String>;
10269
+ }>, YieldableError>;
10281
10270
 
10282
10271
  /**
10283
10272
  * Could the registered filter narrow ANY of `tables`?
@@ -10325,12 +10314,10 @@ export declare type RowFilterScope = (table: string) => Predicate | undefined;
10325
10314
  export declare class RowFilterUnavailable extends RowFilterUnavailable_base {
10326
10315
  }
10327
10316
 
10328
- declare const RowFilterUnavailable_base: Schema.TaggedErrorClass<RowFilterUnavailable, "RowFilterUnavailable", {
10329
- readonly _tag: Schema.tag<"RowFilterUnavailable">;
10330
- } & {
10317
+ declare const RowFilterUnavailable_base: Schema.Class<RowFilterUnavailable, Schema.TaggedStruct<"RowFilterUnavailable", {
10331
10318
  /** `String(originalError)` — the last failure after retries were exhausted. */
10332
- cause: typeof Schema.String;
10333
- }>;
10319
+ readonly cause: Schema.String;
10320
+ }>, YieldableError>;
10334
10321
 
10335
10322
  /** One `_voltro_row_history` row, structurally (from @voltro/plugin-row-history). */
10336
10323
  export declare interface RowHistoryEntry {
@@ -10365,7 +10352,7 @@ export declare interface RpcServerOptions<Rpcs extends Rpc.Any> {
10365
10352
  readonly handlersLayer: Layer.Layer<Rpc.ToHandler<Rpcs>>;
10366
10353
  /** Optional handlers layer dedicated to the one-shot HTTP rpc surface
10367
10354
  * (`POST /rpc`, used by SSR web-router loaders). The HTTP JSON protocol
10368
- * BUFFERS the whole response (the @effect/rpc client `await`s `r.json()`),
10355
+ * BUFFERS the whole response (the effect/rpc client `await`s `r.json()`),
10369
10356
  * so a reactive query's never-ending stream would hang the request. The
10370
10357
  * caller supplies a variant here whose query handlers complete after the
10371
10358
  * FIRST snapshot (`Stream.take(1)`); the WS `handlersLayer` keeps the live
@@ -10608,11 +10595,11 @@ export declare const runOrchestratorTick: (deps: OrchestratorTickDeps) => Promis
10608
10595
 
10609
10596
  /**
10610
10597
  * Run a fully-provided handler Effect to a Promise, REJECTING WITH THE RAW
10611
- * typed failure value — NOT Effect's opaque `FiberFailure` wrapper.
10598
+ * typed failure value — the value itself, never a runtime envelope.
10612
10599
  *
10613
10600
  * Why this exists: the rpc encoder matches a rejected handler's thrown value
10614
- * against the descriptor's `error:` schema. `Effect.runPromise` rejects with a
10615
- * `FiberFailure` that wraps the cause, so a typed `Effect.fail(MyTaggedError)`
10601
+ * against the descriptor's `error:` schema. a runtime that rejected with
10602
+ * an envelope around the cause made a typed `Effect.fail(MyTaggedError)`
10616
10603
  * from an Effect-form mutation/action NEVER matches the schema and dumps on the
10617
10604
  * wire as a `Die`/`ExitEncoded` defect instead of the declared tagged error
10618
10605
  * (the async-handler path already throws the raw value, so it worked there —
@@ -10645,7 +10632,7 @@ export declare interface RuntimeContext {
10645
10632
  readonly subject: Subject;
10646
10633
  /** Trace identifier — the active span's W3C trace id (32 hex) when
10647
10634
  * tracing is active; a per-call uuid otherwise. Shared across the
10648
- * whole frontend→api→api chain via `@effect/rpc` + `traceparent`. */
10635
+ * whole frontend→api→api chain via `effect/rpc` + `traceparent`. */
10649
10636
  readonly traceId: string;
10650
10637
  /** The active span's id (16 hex), when tracing is active. Used to
10651
10638
  * build the outbound `traceparent` header for cross-api hops. */
@@ -11011,7 +10998,7 @@ export declare interface SchedulerDeps {
11011
10998
  readonly onRunEvent?: (op: 'insert' | 'update', row: Record<string, unknown>) => void;
11012
10999
  /** When `false`, the engine registers schedules (so `fireNow` +
11013
11000
  * `fireFromCluster` work) but does NOT arm in-app timers. Used by
11014
- * `cluster` coordination, where `@effect/cluster`'s `ClusterCron`
11001
+ * `cluster` coordination, where `effect/cluster`'s `ClusterCron`
11015
11002
  * drives the clock + guarantees once-only — the in-app timer would
11016
11003
  * double-fire. Default `true`. */
11017
11004
  readonly armSelf?: boolean;
@@ -11087,7 +11074,7 @@ export declare interface SchedulerHandle {
11087
11074
  /** One run's terminal-or-not state, for a caller polling an accepted trigger
11088
11075
  * to completion. `undefined` when no such run exists. */
11089
11076
  runStatus(runId: string): Promise<ScheduleRunStatus | undefined>;
11090
- /** Fire from a cluster-cron tick. `@effect/cluster` has already
11077
+ /** Fire from a cluster-cron tick. `effect/cluster` has already
11091
11078
  * guaranteed exactly-once across the fleet (this runner owns the
11092
11079
  * shard), so we bypass the in-app coordinator + record the run
11093
11080
  * with `coordinationOutcome: 'cluster'`. Overlap policy still
@@ -11232,9 +11219,9 @@ export declare interface SchemaInfo {
11232
11219
  readonly fields: ReadonlyArray<string>;
11233
11220
  }>;
11234
11221
  /** Optional pre-INSERT row decoder (from `table().validate(...)`). */
11235
- readonly insertSchema?: Schema.Schema.Any;
11222
+ readonly insertSchema?: Schema.Top;
11236
11223
  /** Optional pre-UPDATE partial-patch decoder (from `table().validatePatch(...)`). */
11237
- readonly validatePatchSchema?: Schema.Schema.Any;
11224
+ readonly validatePatchSchema?: Schema.Top;
11238
11225
  /**
11239
11226
  * Resolved id-scheme for the table's primary-key column. `undefined`
11240
11227
  * for tables that have no `id`-typed column — a natural or composite
@@ -11262,7 +11249,7 @@ export declare interface SchemaInfo {
11262
11249
  * the common composition nodes so a column nested under `{ refs: [{ … }] }` or
11263
11250
  * behind a `NullOr` is still seen. Cycle-guarded via a seen-set on Suspend.
11264
11251
  */
11265
- export declare const schemaPropertyNames: (schema: Schema.Schema.Any) => ReadonlySet<string>;
11252
+ export declare const schemaPropertyNames: (schema: Schema.Top) => ReadonlySet<string>;
11266
11253
 
11267
11254
  export declare interface SchemaRegistry {
11268
11255
  readonly tables: ReadonlyMap<string, SchemaInfo>;
@@ -11341,7 +11328,7 @@ export declare interface SchemaRegistry {
11341
11328
  * INSERT — a decode failure becomes a `TableValidationFailed`
11342
11329
  * typed error on the mutation's error channel.
11343
11330
  */
11344
- insertSchema(table: string): Schema.Schema.Any | undefined;
11331
+ insertSchema(table: string): Schema.Top | undefined;
11345
11332
  /**
11346
11333
  * Optional pre-UPDATE partial-patch decoder for a table. `undefined`
11347
11334
  * when the table didn't ship `.validatePatch(schema)`. The
@@ -11349,7 +11336,7 @@ export declare interface SchemaRegistry {
11349
11336
  * the underlying UPDATE — a decode failure becomes a
11350
11337
  * `TableValidationFailed` typed error on the mutation's error channel.
11351
11338
  */
11352
- validatePatchSchema(table: string): Schema.Schema.Any | undefined;
11339
+ validatePatchSchema(table: string): Schema.Top | undefined;
11353
11340
  }
11354
11341
 
11355
11342
  declare interface ScopeCtx {
@@ -11509,6 +11496,16 @@ export declare type SerializedGuard = {
11509
11496
  */
11510
11497
  export declare const serializeGuards: (guards: ReadonlyArray<AnyGuardSpec>, input: unknown) => ReadonlyArray<SerializedGuard>;
11511
11498
 
11499
+ /** Required plugin work executed on the actual transaction connection. */
11500
+ export declare type ServeMutationCommitHook = (context: Parameters<ServeRpcInterceptor>[1] & {
11501
+ readonly kind: 'mutation';
11502
+ readonly store: DataStore;
11503
+ readonly output: unknown;
11504
+ readonly outbox?: OutboxEnqueueFacade;
11505
+ readonly startedAt?: number;
11506
+ readonly durationMs?: number;
11507
+ }) => Effect.Effect<void, unknown>;
11508
+
11512
11509
  export declare interface ServeRequestContext {
11513
11510
  readonly subject: unknown;
11514
11511
  readonly traceId: string;
@@ -11572,6 +11569,7 @@ export declare type ServeRpcInterceptor = (base: Effect.Effect<unknown, unknown,
11572
11569
  readonly input: unknown;
11573
11570
  readonly subject: unknown;
11574
11571
  readonly traceId: string;
11572
+ readonly enqueueOutcome?: OutboxEnqueueFacade['enqueue'];
11575
11573
  readonly spanId?: string;
11576
11574
  /**
11577
11575
  * The declared write-target TABLE names of this mutation/action, derived
@@ -13339,6 +13337,14 @@ export declare type WhereOp = '=' | '!=' | '<>' | '>' | '>=' | '<' | '<=' | 'in'
13339
13337
 
13340
13338
  export declare const withRowFilter: <R extends ServeRequestContext>(request: R) => Promise<R>;
13341
13339
 
13340
+ /**
13341
+ * Add the shared RPC auth pair once to an undecorated group. Authentication
13342
+ * runs before ConnectionInfo captures this call's verified credential lifetime.
13343
+ * Groups already carrying either middleware are refused: Effect preserves Set
13344
+ * insertion order, so appending a duplicate cannot repair an existing order.
13345
+ */
13346
+ export declare const withRpcAuthMiddleware: <R extends Rpc.Any>(group: RpcGroup.RpcGroup<R>) => RpcGroup.RpcGroup<Rpc.AddMiddleware<Rpc.AddMiddleware<R, typeof ConnectionInfoMiddleware>, typeof AuthMiddleware>>;
13347
+
13342
13348
  /**
13343
13349
  * Run `body` against a request that carries a resolved row-filter scope.
13344
13350
  *
@@ -13441,9 +13447,9 @@ export declare interface WorkflowControlTarget extends WorkflowControlOptions {
13441
13447
 
13442
13448
  export declare interface WorkflowDefinitionLike {
13443
13449
  readonly name: string;
13444
- readonly payloadSchema: Schema.Schema.Any;
13445
- readonly successSchema: Schema.Schema.Any;
13446
- readonly errorSchema: Schema.Schema.All;
13450
+ readonly payloadSchema: Schema.Top;
13451
+ readonly successSchema: Schema.Top;
13452
+ readonly errorSchema: Schema.Top;
13447
13453
  execute(payload: never, options?: {
13448
13454
  readonly discard?: boolean;
13449
13455
  }): Effect.Effect<unknown, unknown, unknown>;
@@ -13509,6 +13515,15 @@ export declare interface WorkflowEventTriggerResult {
13509
13515
  readonly reason?: string;
13510
13516
  }
13511
13517
 
13518
+ export declare interface WorkflowExecutionRefusal {
13519
+ readonly workflowName: string;
13520
+ readonly executionId: string;
13521
+ readonly payload: unknown;
13522
+ readonly cause: Cause.Cause<unknown>;
13523
+ /** Restored identity and host-owned placement; no resolved permissions. */
13524
+ readonly callerContext: WorkflowCallerContext;
13525
+ }
13526
+
13512
13527
  export declare interface WorkflowFacadeOptions {
13513
13528
  readonly cancelQueued?: (input: WorkflowQueuedControlTarget & {
13514
13529
  readonly callerContext: WorkflowCallerContext | undefined;
@@ -13650,13 +13665,18 @@ export declare interface WorkflowLayerOptions<Context> {
13650
13665
  * whose business logic said no.
13651
13666
  */
13652
13667
  readonly resolveAuthority?: (identity: unknown) => Promise<unknown>;
13668
+ /** Record a known caller's refusal through the host's ordinary resident run
13669
+ * recorder. Called before application context/body construction. The failed
13670
+ * attempt stays failed, even if this hook completes successfully. Missing
13671
+ * caller identity cannot fabricate a tenant or a first-run record. */
13672
+ readonly onExecutionRefusal?: (refusal: WorkflowExecutionRefusal) => Effect.Effect<unknown, unknown, unknown>;
13653
13673
  /**
13654
13674
  * Told when an execution is refused BEFORE its body — the start context
13655
13675
  * could not be resolved, the identity was missing, the authority or row
13656
13676
  * filter resolver rejected. The engine already fails the attempt; what a
13657
- * discarded start does NOT do is tell anyone, and a run refused here has no
13658
- * row yet, so nothing else can. Measured: an acknowledged start whose
13659
- * resident context was filed under another id died with a debug-level
13677
+ * discarded start does NOT do is tell anyone. A first start may have no
13678
+ * row yet; a resumed run may still have a running row. Measured: an
13679
+ * acknowledged start whose resident context was filed under another id died with a debug-level
13660
13680
  * "Fiber terminated" and nothing else. Hosts wire this to an error log.
13661
13681
  */
13662
13682
  readonly reportExecutionRefusal?: (refusal: {
@@ -13968,15 +13988,13 @@ export declare interface WorkflowStartLike {
13968
13988
  export declare class WorkflowStartNotExecuted extends WorkflowStartNotExecuted_base {
13969
13989
  }
13970
13990
 
13971
- declare const WorkflowStartNotExecuted_base: Schema.TaggedErrorClass<WorkflowStartNotExecuted, "WorkflowStartNotExecuted", {
13972
- readonly _tag: Schema.tag<"WorkflowStartNotExecuted">;
13973
- } & {
13974
- workflowName: typeof Schema.String;
13975
- handleId: typeof Schema.String;
13976
- reason: Schema.Literal<["dropped", "skipped", "superseded", "cancelled", "abandoned", "rejected"]>;
13977
- failureId: Schema.NullOr<typeof Schema.String>;
13978
- incumbentExecutionId: Schema.NullOr<typeof Schema.String>;
13979
- }>;
13991
+ declare const WorkflowStartNotExecuted_base: Schema.Class<WorkflowStartNotExecuted, Schema.TaggedStruct<"WorkflowStartNotExecuted", {
13992
+ readonly workflowName: Schema.String;
13993
+ readonly handleId: Schema.String;
13994
+ readonly reason: Schema.Literals<readonly ["dropped", "skipped", "superseded", "cancelled", "abandoned", "rejected"]>;
13995
+ readonly failureId: Schema.NullOr<Schema.String>;
13996
+ readonly incumbentExecutionId: Schema.NullOr<Schema.String>;
13997
+ }>, Cause.YieldableError>;
13980
13998
 
13981
13999
  /**
13982
14000
  * What a start handle has become, read once and without waiting.
@@ -14037,6 +14055,7 @@ export declare interface WorkflowStartOptions {
14037
14055
  }
14038
14056
 
14039
14057
  export declare interface WorkflowStartRunnerDeps {
14058
+ readonly outcomeOutbox?: MutationRunnerDeps['outcomeOutbox'];
14040
14059
  /** Composed plugin workflow-interceptor (`interceptWorkflow`). */
14041
14060
  readonly interceptor?: ServeRpcInterceptor;
14042
14061
  readonly recordMetric?: MutationRunnerDeps['recordMetric'];