@rotorsoft/act 1.37.8 → 2.0.1

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 (52) hide show
  1. package/README.md +16 -3
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/@types/act.d.ts +5 -4
  4. package/dist/@types/act.d.ts.map +1 -1
  5. package/dist/@types/adapters/in-memory-store.d.ts +2 -2
  6. package/dist/@types/adapters/in-memory-store.d.ts.map +1 -1
  7. package/dist/@types/builders/act-builder.d.ts.map +1 -1
  8. package/dist/@types/builders/merge.d.ts.map +1 -1
  9. package/dist/@types/builders/state-builder.d.ts +1 -1
  10. package/dist/@types/internal/classify.d.ts.map +1 -1
  11. package/dist/@types/internal/config.d.ts +11 -0
  12. package/dist/@types/internal/config.d.ts.map +1 -1
  13. package/dist/@types/internal/event-sourcing.d.ts +6 -2
  14. package/dist/@types/internal/event-sourcing.d.ts.map +1 -1
  15. package/dist/@types/internal/tracing.d.ts.map +1 -1
  16. package/dist/@types/internal/zod.d.ts +2 -2
  17. package/dist/@types/ports.d.ts.map +1 -1
  18. package/dist/@types/types/act.d.ts +0 -9
  19. package/dist/@types/types/act.d.ts.map +1 -1
  20. package/dist/@types/types/action.d.ts +36 -32
  21. package/dist/@types/types/action.d.ts.map +1 -1
  22. package/dist/@types/types/builders.d.ts +126 -47
  23. package/dist/@types/types/builders.d.ts.map +1 -1
  24. package/dist/@types/types/errors.d.ts +11 -43
  25. package/dist/@types/types/errors.d.ts.map +1 -1
  26. package/dist/@types/types/ports.d.ts +65 -50
  27. package/dist/@types/types/ports.d.ts.map +1 -1
  28. package/dist/@types/types/reaction.d.ts +3 -3
  29. package/dist/@types/utils.d.ts +19 -11
  30. package/dist/@types/utils.d.ts.map +1 -1
  31. package/dist/{chunk-TSDQDT4S.js → chunk-33D5NQNQ.js} +52 -30
  32. package/dist/chunk-33D5NQNQ.js.map +1 -0
  33. package/dist/{chunk-BCA423WP.cjs → chunk-3CQWJ4UA.cjs} +8 -22
  34. package/dist/chunk-3CQWJ4UA.cjs.map +1 -0
  35. package/dist/{chunk-4UWU5FAN.cjs → chunk-S2BEPQ5Z.cjs} +63 -41
  36. package/dist/chunk-S2BEPQ5Z.cjs.map +1 -0
  37. package/dist/{chunk-I5RF2NFR.js → chunk-UO7HNLSH.js} +7 -21
  38. package/dist/chunk-UO7HNLSH.js.map +1 -0
  39. package/dist/index.cjs +451 -291
  40. package/dist/index.cjs.map +1 -1
  41. package/dist/index.js +258 -98
  42. package/dist/index.js.map +1 -1
  43. package/dist/test/index.cjs +4 -4
  44. package/dist/test/index.js +2 -2
  45. package/dist/types/index.cjs +2 -4
  46. package/dist/types/index.cjs.map +1 -1
  47. package/dist/types/index.js +1 -3
  48. package/package.json +3 -3
  49. package/dist/chunk-4UWU5FAN.cjs.map +0 -1
  50. package/dist/chunk-BCA423WP.cjs.map +0 -1
  51. package/dist/chunk-I5RF2NFR.js.map +0 -1
  52. package/dist/chunk-TSDQDT4S.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -42,9 +42,9 @@
42
42
 
43
43
 
44
44
 
45
- var _chunk4UWU5FANcjs = require('./chunk-4UWU5FAN.cjs');
46
45
 
47
46
 
47
+ var _chunkS2BEPQ5Zcjs = require('./chunk-S2BEPQ5Z.cjs');
48
48
 
49
49
 
50
50
 
@@ -76,24 +76,25 @@ var _chunk4UWU5FANcjs = require('./chunk-4UWU5FAN.cjs');
76
76
 
77
77
 
78
78
 
79
- var _chunkBCA423WPcjs = require('./chunk-BCA423WP.cjs');
79
+
80
+ var _chunk3CQWJ4UAcjs = require('./chunk-3CQWJ4UA.cjs');
80
81
 
81
82
  // src/signals.ts
82
83
  process.once("SIGINT", async (arg) => {
83
- _chunk4UWU5FANcjs.log.call(void 0, ).info(arg, "SIGINT");
84
- await _chunk4UWU5FANcjs.disposeAndExit.call(void 0, "EXIT");
84
+ _chunkS2BEPQ5Zcjs.log.call(void 0, ).info(arg, "SIGINT");
85
+ await _chunkS2BEPQ5Zcjs.disposeAndExit.call(void 0, "EXIT");
85
86
  });
86
87
  process.once("SIGTERM", async (arg) => {
87
- _chunk4UWU5FANcjs.log.call(void 0, ).info(arg, "SIGTERM");
88
- await _chunk4UWU5FANcjs.disposeAndExit.call(void 0, "EXIT");
88
+ _chunkS2BEPQ5Zcjs.log.call(void 0, ).info(arg, "SIGTERM");
89
+ await _chunkS2BEPQ5Zcjs.disposeAndExit.call(void 0, "EXIT");
89
90
  });
90
91
  process.once("uncaughtException", async (arg) => {
91
- _chunk4UWU5FANcjs.log.call(void 0, ).error(arg, "Uncaught Exception");
92
- await _chunk4UWU5FANcjs.disposeAndExit.call(void 0, "ERROR");
92
+ _chunkS2BEPQ5Zcjs.log.call(void 0, ).error(arg, "Uncaught Exception");
93
+ await _chunkS2BEPQ5Zcjs.disposeAndExit.call(void 0, "ERROR");
93
94
  });
94
95
  process.once("unhandledRejection", async (arg) => {
95
- _chunk4UWU5FANcjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
96
- await _chunk4UWU5FANcjs.disposeAndExit.call(void 0, "ERROR");
96
+ _chunkS2BEPQ5Zcjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
97
+ await _chunkS2BEPQ5Zcjs.disposeAndExit.call(void 0, "ERROR");
97
98
  });
98
99
 
99
100
  // src/act.ts
@@ -201,7 +202,7 @@ async function* audit(deps, categories, options = {}) {
201
202
  if (need_stats) {
202
203
  const stats = await deps.store().query_stats(
203
204
  {},
204
- { count: true, names: true, exclude: [_chunkBCA423WPcjs.SNAP_EVENT] }
205
+ { count: true, names: true, exclude: [_chunk3CQWJ4UAcjs.SNAP_EVENT] }
205
206
  );
206
207
  for (const [stream, s] of stats) {
207
208
  for (const p of passes) _optionalChain([p, 'access', _4 => _4.on_stat, 'optionalCall', _5 => _5(stream, s)]);
@@ -283,7 +284,7 @@ var make_schema_pass = (deps) => {
283
284
  return;
284
285
  }
285
286
  const schema = state2.events[name];
286
- const sensitive2 = _chunkBCA423WPcjs.pii_fields.call(void 0, schema);
287
+ const sensitive2 = _chunk3CQWJ4UAcjs.pii_fields.call(void 0, schema);
287
288
  let parse_schema = schema;
288
289
  if (sensitive2.length > 0) {
289
290
  const omitter = schema.omit;
@@ -417,7 +418,7 @@ var make_restart_candidate_pass = (deps, options) => {
417
418
  {
418
419
  stream,
419
420
  stream_exact: true,
420
- names: [_chunkBCA423WPcjs.SNAP_EVENT],
421
+ names: [_chunk3CQWJ4UAcjs.SNAP_EVENT],
421
422
  with_snaps: true,
422
423
  // From the start: on its own, `with_snaps` resumes at the latest.
423
424
  after: -1
@@ -577,7 +578,7 @@ var make_correlation_gaps_pass = () => {
577
578
  seen_ids.add(e.id);
578
579
  const causation = _optionalChain([e, 'access', _31 => _31.meta, 'optionalAccess', _32 => _32.causation]);
579
580
  const parent_id = _optionalChain([causation, 'optionalAccess', _33 => _33.event, 'optionalAccess', _34 => _34.id]);
580
- if (parent_id !== void 0 && e.name !== _chunkBCA423WPcjs.TOMBSTONE_EVENT) {
581
+ if (parent_id !== void 0 && e.name !== _chunk3CQWJ4UAcjs.TOMBSTONE_EVENT) {
581
582
  checks.push({ stream: e.stream, id: e.id, parent_id });
582
583
  }
583
584
  },
@@ -752,6 +753,7 @@ var CircuitBreaker = (_class = class {
752
753
 
753
754
  // src/internal/classify.ts
754
755
  var ALL_LANES = /* @__PURE__ */ Symbol("act/all-lanes");
756
+ var describe_source = (source) => source === void 0 ? "no source (every stream)" : `"${source}"`;
755
757
  function classify_registry(registry, states) {
756
758
  const statics = /* @__PURE__ */ new Map();
757
759
  const target_lanes = /* @__PURE__ */ new Map();
@@ -778,6 +780,10 @@ function classify_registry(registry, states) {
778
780
  );
779
781
  }
780
782
  const existing = statics.get(target);
783
+ if (existing && existing.source !== source)
784
+ throw new Error(
785
+ `Target "${target}" has reactions on two sources, ${describe_source(existing.source)} and ${describe_source(source)}. A target reads one source, so the second would miss events or read too many. Give it its own target.`
786
+ );
781
787
  if (!existing) {
782
788
  statics.set(target, { stream: target, source, priority, lane });
783
789
  } else if (priority > existing.priority) {
@@ -962,7 +968,7 @@ function make_deferred(handler, schedule) {
962
968
  const call = handler;
963
969
  const deferred = async (event, stream, app) => {
964
970
  const when = typeof schedule === "function" ? schedule(event) : schedule;
965
- if (Date.now() < resolve_defer_at(when, event)) throw new (0, _chunkBCA423WPcjs.DeferSignal)(when);
971
+ if (Date.now() < resolve_defer_at(when, event)) throw new (0, _chunk3CQWJ4UAcjs.DeferSignal)(when);
966
972
  return call(event, stream, app);
967
973
  };
968
974
  Object.defineProperty(deferred, "name", { value: handler.name });
@@ -1094,7 +1100,7 @@ function compute_lag_lead_ratio(handled, lagging, leading) {
1094
1100
  function report_once(seen, key, message) {
1095
1101
  if (seen.has(key)) return;
1096
1102
  seen.add(key);
1097
- _chunk4UWU5FANcjs.log.call(void 0, ).error(new Error(message));
1103
+ _chunkS2BEPQ5Zcjs.log.call(void 0, ).error(new Error(message));
1098
1104
  }
1099
1105
 
1100
1106
  // src/internal/correlation-id.ts
@@ -1122,14 +1128,14 @@ function close_correlation(correlator, actor) {
1122
1128
  }
1123
1129
 
1124
1130
  // src/internal/drain-ops.ts
1125
- var claim = (lagging, leading, by, millis, lane) => _chunk4UWU5FANcjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane);
1131
+ var claim = (lagging, leading, by, millis, lane) => _chunkS2BEPQ5Zcjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane);
1126
1132
  async function fetch(leased, eventLimit) {
1127
1133
  return Promise.all(
1128
1134
  leased.map(async ({ stream, source, at, lagging }) => {
1129
1135
  const events = [];
1130
- const stream_exact = source !== void 0 && _chunk4UWU5FANcjs.is_literal_source.call(void 0, source, stream) ? true : void 0;
1136
+ const stream_exact = source !== void 0 && _chunkS2BEPQ5Zcjs.is_literal_source.call(void 0, source, stream) ? true : void 0;
1131
1137
  try {
1132
- await _chunk4UWU5FANcjs.store.call(void 0, ).query((e) => events.push(e), {
1138
+ await _chunkS2BEPQ5Zcjs.store.call(void 0, ).query((e) => events.push(e), {
1133
1139
  stream: source,
1134
1140
  stream_exact,
1135
1141
  after: at,
@@ -1149,9 +1155,9 @@ async function fetch(leased, eventLimit) {
1149
1155
  })
1150
1156
  );
1151
1157
  }
1152
- var ack = (leases) => _chunk4UWU5FANcjs.store.call(void 0, ).ack(leases);
1153
- var block = (leases) => _chunk4UWU5FANcjs.store.call(void 0, ).block(leases);
1154
- var subscribe = (streams, correlated_at, correlator) => _chunk4UWU5FANcjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator);
1158
+ var ack = (leases) => _chunkS2BEPQ5Zcjs.store.call(void 0, ).ack(leases);
1159
+ var block = (leases) => _chunkS2BEPQ5Zcjs.store.call(void 0, ).block(leases);
1160
+ var subscribe = (streams, correlated_at, correlator) => _chunkS2BEPQ5Zcjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator);
1155
1161
 
1156
1162
  // src/internal/event-sourcing.ts
1157
1163
  var _actpatch = require('@rotorsoft/act-patch');
@@ -1166,29 +1172,29 @@ var check_invariants = (target, state2, schema, pii_aware) => {
1166
1172
  try {
1167
1173
  result = schema.safeParse(state2);
1168
1174
  } catch (error) {
1169
- throw new (0, _chunkBCA423WPcjs.ValidationError)(target, state2, error);
1175
+ throw new (0, _chunk3CQWJ4UAcjs.ValidationError)(target, state2, error);
1170
1176
  }
1171
1177
  if (result.success) return;
1172
1178
  const issues = pii_aware ? result.error.issues.filter((issue) => {
1173
1179
  const value = value_at(state2, issue.path);
1174
- return value !== _chunkBCA423WPcjs.REDACTED && value !== _chunkBCA423WPcjs.SHREDDED;
1180
+ return value !== _chunk3CQWJ4UAcjs.REDACTED && value !== _chunk3CQWJ4UAcjs.SHREDDED;
1175
1181
  }) : result.error.issues;
1176
1182
  if (issues.length)
1177
- throw new (0, _chunkBCA423WPcjs.ValidationError)(
1183
+ throw new (0, _chunk3CQWJ4UAcjs.ValidationError)(
1178
1184
  target,
1179
1185
  state2,
1180
1186
  _zod.prettifyError.call(void 0, new (0, _zod.ZodError)(issues))
1181
1187
  );
1182
1188
  };
1183
1189
  var DEFAULT_BATCH = 500;
1184
- var cache_put = (stream, entry) => _chunk4UWU5FANcjs.cache.call(void 0, ).set(stream, entry).catch(
1185
- (err) => _chunk4UWU5FANcjs.log.call(void 0, ).warn(
1190
+ var cache_put = (stream, entry) => _chunkS2BEPQ5Zcjs.cache.call(void 0, ).set(stream, entry).catch(
1191
+ (err) => _chunkS2BEPQ5Zcjs.log.call(void 0, ).warn(
1186
1192
  err,
1187
1193
  "cache set skipped; the next load re-folds from the store"
1188
1194
  )
1189
1195
  );
1190
- var cache_drop = (stream) => _chunk4UWU5FANcjs.cache.call(void 0, ).invalidate(stream).catch(
1191
- (err) => _chunk4UWU5FANcjs.log.call(void 0, ).warn(
1196
+ var cache_drop = (stream) => _chunkS2BEPQ5Zcjs.cache.call(void 0, ).invalidate(stream).catch(
1197
+ (err) => _chunkS2BEPQ5Zcjs.log.call(void 0, ).warn(
1192
1198
  err,
1193
1199
  "cache invalidate skipped; a stale checkpoint re-folds from its event_id"
1194
1200
  )
@@ -1196,35 +1202,43 @@ var cache_drop = (stream) => _chunk4UWU5FANcjs.cache.call(void 0, ).invalidate(s
1196
1202
  async function snap(snapshot) {
1197
1203
  const { id, stream, name, meta, version } = snapshot.event;
1198
1204
  try {
1199
- const [committed] = await _chunk4UWU5FANcjs.store.call(void 0, ).commit(
1200
- stream,
1201
- [{ name: _chunkBCA423WPcjs.SNAP_EVENT, data: snapshot.state }],
1205
+ const [committed] = await _chunkS2BEPQ5Zcjs.store.call(void 0, ).commit(
1206
+ [
1207
+ {
1208
+ stream,
1209
+ msgs: [{ name: _chunk3CQWJ4UAcjs.SNAP_EVENT, data: snapshot.state }],
1210
+ // IMPORTANT! - state events are committed right after the snapshot event
1211
+ expectedVersion: version
1212
+ }
1213
+ ],
1202
1214
  {
1203
1215
  correlation: meta.correlation,
1204
1216
  causation: { event: { id, name, stream } }
1205
- },
1206
- version
1207
- // IMPORTANT! - state events are committed right after the snapshot event
1217
+ }
1208
1218
  );
1209
1219
  return committed;
1210
1220
  } catch (error) {
1211
1221
  const reason = error instanceof Error ? error.message : String(error);
1212
- _chunk4UWU5FANcjs.log.call(void 0, ).warn(
1222
+ _chunkS2BEPQ5Zcjs.log.call(void 0, ).warn(
1213
1223
  `Snapshot write failed on stream "${stream}": ${reason} \u2014 cold starts will replay full history until snapshots succeed.`
1214
1224
  );
1215
1225
  }
1216
1226
  }
1217
1227
  async function tombstone(stream, expectedVersion, correlation) {
1218
1228
  try {
1219
- const [committed] = await _chunk4UWU5FANcjs.store.call(void 0, ).commit(
1220
- stream,
1221
- [{ name: _chunkBCA423WPcjs.TOMBSTONE_EVENT, data: {} }],
1222
- { correlation, causation: {} },
1223
- expectedVersion
1229
+ const [committed] = await _chunkS2BEPQ5Zcjs.store.call(void 0, ).commit(
1230
+ [
1231
+ {
1232
+ stream,
1233
+ msgs: [{ name: _chunk3CQWJ4UAcjs.TOMBSTONE_EVENT, data: {} }],
1234
+ expectedVersion
1235
+ }
1236
+ ],
1237
+ { correlation, causation: {} }
1224
1238
  );
1225
1239
  return committed;
1226
1240
  } catch (error) {
1227
- if (error instanceof _chunkBCA423WPcjs.ConcurrencyError) return void 0;
1241
+ if (error instanceof _chunk3CQWJ4UAcjs.ConcurrencyError) return void 0;
1228
1242
  throw error;
1229
1243
  }
1230
1244
  }
@@ -1254,9 +1268,9 @@ async function scan(source, opts = {}, callback) {
1254
1268
  if (drop_closed_streams) {
1255
1269
  await source.query(
1256
1270
  (e) => {
1257
- if (e.name === _chunkBCA423WPcjs.TOMBSTONE_EVENT) closed_streams.add(e.stream);
1271
+ if (e.name === _chunk3CQWJ4UAcjs.TOMBSTONE_EVENT) closed_streams.add(e.stream);
1258
1272
  },
1259
- { names: [_chunkBCA423WPcjs.TOMBSTONE_EVENT] }
1273
+ { names: [_chunk3CQWJ4UAcjs.TOMBSTONE_EVENT] }
1260
1274
  );
1261
1275
  }
1262
1276
  let max_id;
@@ -1278,11 +1292,11 @@ async function scan(source, opts = {}, callback) {
1278
1292
  if (!is_valid(event))
1279
1293
  throw new Error(`Invalid event at index ${processed}`);
1280
1294
  if (on_progress) on_progress({ processed, id: event.id, max_id });
1281
- if (drop_snapshots && event.name === _chunkBCA423WPcjs.SNAP_EVENT) {
1295
+ if (drop_snapshots && event.name === _chunk3CQWJ4UAcjs.SNAP_EVENT) {
1282
1296
  dropped_snaps++;
1283
1297
  return;
1284
1298
  }
1285
- if (closed_streams.has(event.stream) && event.name !== _chunkBCA423WPcjs.TOMBSTONE_EVENT) {
1299
+ if (closed_streams.has(event.stream) && event.name !== _chunk3CQWJ4UAcjs.TOMBSTONE_EVENT) {
1286
1300
  dropped_closed++;
1287
1301
  return;
1288
1302
  }
@@ -1350,18 +1364,18 @@ async function load(me, target, callback, patch_fn = bare_patch) {
1350
1364
  const { stream, actor, asOf } = target;
1351
1365
  const time_travel = !!asOf && Object.values(asOf).some((v) => v !== void 0);
1352
1366
  const seeded = time_travel && asOf.limit === void 0 && !asOf.created_after;
1353
- const cached = time_travel ? void 0 : await _chunk4UWU5FANcjs.cache.call(void 0, ).get(stream);
1367
+ const cached = time_travel ? void 0 : await _chunkS2BEPQ5Zcjs.cache.call(void 0, ).get(stream);
1354
1368
  const cache_hit = !!cached;
1355
1369
  let state2 = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _58 => _58.state]), () => ( (me.init ? me.init() : {})));
1356
1370
  let patches = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _59 => _59.patches]), () => ( 0));
1357
1371
  let snaps = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _60 => _60.snaps]), () => ( 0));
1358
1372
  let replayed = 0;
1359
1373
  let event;
1360
- await _chunk4UWU5FANcjs.store.call(void 0, ).query(
1374
+ await _chunkS2BEPQ5Zcjs.store.call(void 0, ).query(
1361
1375
  (raw) => {
1362
- if (seeded && raw.name === _chunkBCA423WPcjs.SNAP_EVENT && replayed > 0) return;
1376
+ if (seeded && raw.name === _chunk3CQWJ4UAcjs.SNAP_EVENT && replayed > 0) return;
1363
1377
  event = me.view(raw, actor);
1364
- if (event.name === _chunkBCA423WPcjs.SNAP_EVENT) {
1378
+ if (event.name === _chunk3CQWJ4UAcjs.SNAP_EVENT) {
1365
1379
  state2 = event.data;
1366
1380
  snaps++;
1367
1381
  patches = 0;
@@ -1370,8 +1384,8 @@ async function load(me, target, callback, patch_fn = bare_patch) {
1370
1384
  state2 = patch_fn(me, state2, me.patch[event.name](event, state2), event);
1371
1385
  patches++;
1372
1386
  replayed++;
1373
- } else if (event.name !== _chunkBCA423WPcjs.TOMBSTONE_EVENT) {
1374
- _chunk4UWU5FANcjs.log.call(void 0, ).warn(
1387
+ } else if (event.name !== _chunk3CQWJ4UAcjs.TOMBSTONE_EVENT) {
1388
+ _chunkS2BEPQ5Zcjs.log.call(void 0, ).warn(
1375
1389
  `Skipping unknown event "${String(event.name)}" on stream "${stream}" (id=${event.id}) \u2014 no reducer in state "${me.name}"`
1376
1390
  );
1377
1391
  }
@@ -1399,7 +1413,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
1399
1413
  ) : time_travel ? asOf : { with_snaps: true }
1400
1414
  }
1401
1415
  );
1402
- const head_is_tombstone = _optionalChain([event, 'optionalAccess', _62 => _62.name]) === _chunkBCA423WPcjs.TOMBSTONE_EVENT;
1416
+ const head_is_tombstone = _optionalChain([event, 'optionalAccess', _62 => _62.name]) === _chunk3CQWJ4UAcjs.TOMBSTONE_EVENT;
1403
1417
  if (replayed > 0 && !time_travel && event && !me.pii_aware && !head_is_tombstone) {
1404
1418
  await cache_put(stream, {
1405
1419
  stream,
@@ -1422,14 +1436,47 @@ async function load(me, target, callback, patch_fn = bare_patch) {
1422
1436
  replayed
1423
1437
  };
1424
1438
  }
1439
+ async function load_others(loads, payload, own, actor, patch_fn, refuse) {
1440
+ const streams = loads.map((l) => l.target(payload, own.state));
1441
+ streams.forEach((stream, i) => {
1442
+ if (stream === void 0) return;
1443
+ if (typeof stream !== "string" || !stream)
1444
+ throw refuse(`loads "${loads[i].name}" from an empty stream name`);
1445
+ if (stream === own.stream) throw refuse(`loads its own stream "${stream}"`);
1446
+ if (streams.indexOf(stream) !== i)
1447
+ throw refuse(`loads stream "${stream}" twice`);
1448
+ });
1449
+ return Promise.all(
1450
+ loads.map(async (l, i) => {
1451
+ const stream = streams[i];
1452
+ if (stream === void 0) return void 0;
1453
+ const snapshot = await load(
1454
+ l.state,
1455
+ { stream, actor },
1456
+ void 0,
1457
+ patch_fn
1458
+ );
1459
+ if (_optionalChain([snapshot, 'access', _67 => _67.event, 'optionalAccess', _68 => _68.name]) === _chunk3CQWJ4UAcjs.TOMBSTONE_EVENT)
1460
+ throw new (0, _chunk3CQWJ4UAcjs.StreamClosedError)(stream);
1461
+ return {
1462
+ state: l.state,
1463
+ stream,
1464
+ snapshot,
1465
+ expected: snapshot.version,
1466
+ events: []
1467
+ };
1468
+ })
1469
+ );
1470
+ }
1425
1471
  async function action(me, action2, target, payload, options, patch_fn = bare_patch) {
1426
1472
  const { stream, expectedVersion, actor } = target;
1427
1473
  if (!stream) throw new Error("Missing target stream");
1428
- const reactingTo = _optionalChain([options, 'optionalAccess', _67 => _67.reactingTo]);
1429
- const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _68 => _68.correlator]), () => ( default_correlator));
1430
- const validated = _chunk4UWU5FANcjs.validate.call(void 0, action2, payload, me.actions[action2]);
1431
- const opts = _optionalChain([me, 'access', _69 => _69.options, 'optionalAccess', _70 => _70[action2]]);
1432
- const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _71 => _71.maxRetries]), () => ( 0));
1474
+ const reactingTo = _optionalChain([options, 'optionalAccess', _69 => _69.reactingTo]);
1475
+ const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _70 => _70.correlator]), () => ( default_correlator));
1476
+ const validated = _chunkS2BEPQ5Zcjs.validate.call(void 0, action2, payload, me.actions[action2]);
1477
+ const opts = _optionalChain([me, 'access', _71 => _71.options, 'optionalAccess', _72 => _72[action2]]);
1478
+ const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _73 => _73.maxRetries]), () => ( 0));
1479
+ const loads = _nullishCoalesce(_optionalChain([me, 'access', _74 => _74.loads, 'optionalAccess', _75 => _75[action2]]), () => ( []));
1433
1480
  for (let attempt = 0; ; attempt++) {
1434
1481
  try {
1435
1482
  const snapshot = await load(
@@ -1438,38 +1485,68 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1438
1485
  void 0,
1439
1486
  patch_fn
1440
1487
  );
1441
- if (_optionalChain([snapshot, 'access', _72 => _72.event, 'optionalAccess', _73 => _73.name]) === _chunkBCA423WPcjs.TOMBSTONE_EVENT)
1442
- throw new (0, _chunkBCA423WPcjs.StreamClosedError)(stream);
1443
- const expected = _nullishCoalesce(expectedVersion, () => ( snapshot.version));
1444
- for (const { valid, description } of _nullishCoalesce(_optionalChain([me, 'access', _74 => _74.given, 'optionalAccess', _75 => _75[action2]]), () => ( [])))
1445
- if (!valid(snapshot.state, actor))
1446
- throw new (0, _chunkBCA423WPcjs.InvariantError)(
1447
- action2,
1448
- validated,
1449
- target,
1450
- snapshot,
1451
- description
1452
- );
1453
- for (const { holds, description } of _nullishCoalesce(_optionalChain([me, 'access', _76 => _76.requires, 'optionalAccess', _77 => _77[action2]]), () => ( [])))
1454
- if (!holds(validated, snapshot.state, actor))
1455
- throw new (0, _chunkBCA423WPcjs.PreconditionError)(
1488
+ if (_optionalChain([snapshot, 'access', _76 => _76.event, 'optionalAccess', _77 => _77.name]) === _chunk3CQWJ4UAcjs.TOMBSTONE_EVENT)
1489
+ throw new (0, _chunk3CQWJ4UAcjs.StreamClosedError)(stream);
1490
+ const own = {
1491
+ state: me,
1492
+ stream,
1493
+ snapshot,
1494
+ expected: _nullishCoalesce(expectedVersion, () => ( snapshot.version)),
1495
+ events: []
1496
+ };
1497
+ const others = loads.length ? await load_others(
1498
+ loads,
1499
+ validated,
1500
+ { stream, state: snapshot.state },
1501
+ target.actor,
1502
+ patch_fn,
1503
+ (description) => new (0, _chunk3CQWJ4UAcjs.PreconditionError)(
1504
+ action2,
1505
+ validated,
1506
+ target,
1507
+ snapshot,
1508
+ description
1509
+ )
1510
+ ) : [];
1511
+ const loaded = Object.fromEntries(
1512
+ others.map((p, i) => [loads[i].name, _optionalChain([p, 'optionalAccess', _78 => _78.snapshot, 'access', _79 => _79.state])])
1513
+ );
1514
+ for (const { holds, description } of _nullishCoalesce(_optionalChain([me, 'access', _80 => _80.requires, 'optionalAccess', _81 => _81[action2]]), () => ( [])))
1515
+ if (!holds(validated, snapshot.state, actor, loaded))
1516
+ throw new (0, _chunk3CQWJ4UAcjs.PreconditionError)(
1456
1517
  action2,
1457
1518
  validated,
1458
1519
  target,
1459
1520
  snapshot,
1460
1521
  description
1461
1522
  );
1462
- const result = me.on[action2](validated, snapshot, target);
1523
+ const result = me.on[action2](validated, snapshot, target, loaded);
1463
1524
  if (!result || Array.isArray(result) && !result.length)
1464
1525
  return [snapshot];
1465
1526
  const tuples = Array.isArray(result[0]) ? result : [result];
1466
- const events = tuples.map(([name, data]) => ({
1467
- name,
1468
- data: _chunk4UWU5FANcjs.validate.call(void 0, name, data, me.events[name])
1469
- }));
1470
- const emitted = events.map((e) => me.message(e));
1527
+ for (const [name, data] of tuples) {
1528
+ const event = name;
1529
+ const i = loads.findIndex((l) => l.events.includes(event));
1530
+ if (i >= 0 && !others[i]) continue;
1531
+ const to = i >= 0 ? others[i] : name in me.events ? own : void 0;
1532
+ if (!to)
1533
+ throw new Error(
1534
+ `Action "${action2}" emitted "${event}", which isn't an event of "${me.name}" and isn't listed on any of its loads`
1535
+ );
1536
+ to.events.push({
1537
+ name: event,
1538
+ data: _chunkS2BEPQ5Zcjs.validate.call(void 0, event, data, to.state.events[event])
1539
+ });
1540
+ }
1541
+ if (!own.events.length)
1542
+ throw new Error(
1543
+ `Action "${action2}" appends only to the streams it loads; it must append an event to its own stream too`
1544
+ );
1545
+ const appends = [own, ...others].filter(
1546
+ (p) => !!_optionalChain([p, 'optionalAccess', _82 => _82.events, 'access', _83 => _83.length])
1547
+ );
1471
1548
  const meta = {
1472
- correlation: _optionalChain([reactingTo, 'optionalAccess', _78 => _78.meta, 'access', _79 => _79.correlation]) || correlator({
1549
+ correlation: _optionalChain([reactingTo, 'optionalAccess', _84 => _84.meta, 'access', _85 => _85.correlation]) || correlator({
1473
1550
  action: action2,
1474
1551
  state: me.name,
1475
1552
  stream,
@@ -1488,72 +1565,97 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1488
1565
  } : void 0
1489
1566
  }
1490
1567
  };
1491
- let { state: state2, patches } = snapshot;
1492
1568
  const created = /* @__PURE__ */ new Date();
1493
- const folded = events.map((e, i) => {
1494
- const event = {
1495
- ...e,
1496
- id: -1,
1497
- stream,
1498
- version: snapshot.version + i + 1,
1499
- created,
1500
- meta
1501
- };
1502
- const patch2 = me.patch[event.name](event, state2);
1503
- state2 = patch_fn(me, state2, patch2, event);
1504
- patches++;
1505
- return { state: state2, patch: patch2, patches };
1569
+ const folds = appends.map((p) => {
1570
+ let { state: state2, patches } = p.snapshot;
1571
+ const folded = p.events.map((e, i) => {
1572
+ const event = {
1573
+ ...e,
1574
+ id: -1,
1575
+ stream: p.stream,
1576
+ version: p.snapshot.version + i + 1,
1577
+ created,
1578
+ meta
1579
+ };
1580
+ const patch2 = p.state.patch[event.name](event, state2);
1581
+ state2 = patch_fn(p.state, state2, patch2, event);
1582
+ patches++;
1583
+ return { state: state2, patch: patch2, patches };
1584
+ });
1585
+ check_invariants(
1586
+ `${p.state.name}.${action2}`,
1587
+ state2,
1588
+ p.state.state,
1589
+ p.state.pii_aware
1590
+ );
1591
+ return folded;
1506
1592
  });
1507
- check_invariants(
1508
- `${me.name}.${action2}`,
1509
- state2,
1510
- me.state,
1511
- me.pii_aware
1512
- );
1513
1593
  let committed;
1514
1594
  try {
1515
- committed = await _chunk4UWU5FANcjs.store.call(void 0, ).commit(stream, emitted, meta, expected);
1595
+ committed = await _chunkS2BEPQ5Zcjs.store.call(void 0, ).commit(
1596
+ appends.map((p) => ({
1597
+ stream: p.stream,
1598
+ msgs: p.events.map((e) => p.state.message(e)),
1599
+ expectedVersion: p.expected
1600
+ })),
1601
+ meta
1602
+ );
1516
1603
  } catch (error) {
1517
- if (error instanceof _chunkBCA423WPcjs.ConcurrencyError) void cache_drop(stream);
1604
+ if (error instanceof _chunk3CQWJ4UAcjs.ConcurrencyError) void cache_drop(error.stream);
1518
1605
  throw error;
1519
1606
  }
1520
- const snapshots = committed.map((row, i) => ({
1521
- event: { ...row, data: events[i].data },
1522
- state: folded[i].state,
1523
- version: row.version,
1524
- id: row.id,
1525
- patches: folded[i].patches,
1526
- snaps: snapshot.snaps,
1527
- patch: folded[i].patch,
1528
- cache_hit: snapshot.cache_hit,
1529
- replayed: snapshot.replayed
1530
- }));
1531
- const last = snapshots.at(-1);
1532
- const snap_event = _optionalChain([me, 'access', _80 => _80.snap, 'optionalCall', _81 => _81(last)]) ? await snap(last) : void 0;
1533
- if (!me.pii_aware)
1534
- void cache_put(stream, {
1535
- stream,
1536
- state: last.state,
1537
- version: _nullishCoalesce(_optionalChain([snap_event, 'optionalAccess', _82 => _82.version]), () => ( last.event.version)),
1538
- event_id: _nullishCoalesce(_optionalChain([snap_event, 'optionalAccess', _83 => _83.id]), () => ( last.event.id)),
1539
- patches: snap_event ? 0 : last.patches,
1540
- snaps: snap_event ? last.snaps + 1 : last.snaps
1607
+ let row = 0;
1608
+ const snapshots = [];
1609
+ for (const [a, append] of appends.entries()) {
1610
+ const { snapshot: base, state: owner } = append;
1611
+ const appended = append.events.map((e, i) => {
1612
+ const stored = committed[row++];
1613
+ const fold = folds[a][i];
1614
+ return {
1615
+ event: { ...stored, data: e.data },
1616
+ state: fold.state,
1617
+ version: stored.version,
1618
+ id: stored.id,
1619
+ patches: fold.patches,
1620
+ snaps: base.snaps,
1621
+ patch: fold.patch,
1622
+ cache_hit: base.cache_hit,
1623
+ replayed: base.replayed
1624
+ };
1541
1625
  });
1626
+ const last = appended.at(-1);
1627
+ const snap_event = _optionalChain([owner, 'access', _86 => _86.snap, 'optionalCall', _87 => _87(last)]) ? await snap(last) : void 0;
1628
+ if (!owner.pii_aware)
1629
+ void cache_put(append.stream, {
1630
+ stream: append.stream,
1631
+ state: last.state,
1632
+ version: _nullishCoalesce(_optionalChain([snap_event, 'optionalAccess', _88 => _88.version]), () => ( last.event.version)),
1633
+ event_id: _nullishCoalesce(_optionalChain([snap_event, 'optionalAccess', _89 => _89.id]), () => ( last.event.id)),
1634
+ patches: snap_event ? 0 : last.patches,
1635
+ snaps: snap_event ? last.snaps + 1 : last.snaps
1636
+ });
1637
+ if (snap_event)
1638
+ appended[appended.length - 1] = {
1639
+ ...last,
1640
+ version: snap_event.version
1641
+ };
1642
+ snapshots.push(...appended);
1643
+ }
1542
1644
  return snapshots;
1543
1645
  } catch (error) {
1544
- if (!(error instanceof _chunkBCA423WPcjs.ConcurrencyError)) throw error;
1545
- if (expectedVersion !== void 0) throw error;
1646
+ if (!(error instanceof _chunk3CQWJ4UAcjs.ConcurrencyError)) throw error;
1647
+ if (expectedVersion !== void 0 && error.stream === stream) throw error;
1546
1648
  if (attempt >= max_retries) throw error;
1547
- if (_optionalChain([opts, 'optionalAccess', _84 => _84.backoff])) {
1649
+ if (_optionalChain([opts, 'optionalAccess', _90 => _90.backoff])) {
1548
1650
  const delay_ms = compute_backoff_delay(attempt, opts.backoff);
1549
- if (delay_ms > 0) await _chunk4UWU5FANcjs.sleep.call(void 0, delay_ms);
1651
+ if (delay_ms > 0) await _chunkS2BEPQ5Zcjs.sleep.call(void 0, delay_ms);
1550
1652
  }
1551
1653
  }
1552
1654
  }
1553
1655
  }
1554
1656
 
1555
1657
  // src/internal/tracing.ts
1556
- var PRETTY = _chunk4UWU5FANcjs.config.call(void 0, ).env !== "production";
1658
+ var PRETTY = _chunkS2BEPQ5Zcjs.config.call(void 0, ).env !== "production";
1557
1659
  var C_BLUE = "\x1B[38;5;39m";
1558
1660
  var C_ORANGE = "\x1B[38;5;208m";
1559
1661
  var C_GREEN = "\x1B[38;5;42m";
@@ -1599,9 +1701,9 @@ var as_of_marker = (asOf) => {
1599
1701
  return parts.length ? ` (as-of ${parts.join(" ")})` : " (as-of)";
1600
1702
  };
1601
1703
  var traced = (inner, exit, entry) => (async (...args) => {
1602
- _optionalChain([entry, 'optionalCall', _85 => _85(...args)]);
1704
+ _optionalChain([entry, 'optionalCall', _91 => _91(...args)]);
1603
1705
  const result = await inner(...args);
1604
- _optionalChain([exit, 'optionalCall', _86 => _86(result, ...args)]);
1706
+ _optionalChain([exit, 'optionalCall', _92 => _92(result, ...args)]);
1605
1707
  return result;
1606
1708
  });
1607
1709
  function build_es(logger, correlator = default_correlator, patch_fn = bare_patch) {
@@ -1610,7 +1712,7 @@ function build_es(logger, correlator = default_correlator, patch_fn = bare_patch
1610
1712
  action_name,
1611
1713
  target,
1612
1714
  payload,
1613
- { ...options, correlator: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _87 => _87.correlator]), () => ( correlator)) },
1715
+ { ...options, correlator: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _93 => _93.correlator]), () => ( correlator)) },
1614
1716
  patch_fn
1615
1717
  );
1616
1718
  const bound_load = (me, target, callback) => load(me, target, callback, patch_fn);
@@ -1649,14 +1751,14 @@ function build_es(logger, correlator = default_correlator, patch_fn = bare_patch
1649
1751
  }),
1650
1752
  action: traced(
1651
1753
  bound_action,
1652
- (snapshots, _me, _action, target) => {
1754
+ (snapshots) => {
1653
1755
  if (snapshots[0].patch)
1654
1756
  logger.trace(
1655
1757
  snapshots.map((s) => s.event.data),
1656
1758
  es_caption(
1657
1759
  "committed",
1658
1760
  C_ORANGE,
1659
- `${target.stream}.${snapshots.map((s) => s.event.name).join(", ")}`
1761
+ snapshots.map((s) => `${s.event.stream}.${s.event.name}`).join(", ")
1660
1762
  )
1661
1763
  );
1662
1764
  },
@@ -1684,7 +1786,7 @@ function build_drain(logger) {
1684
1786
  subscribe: logger.level !== "trace" ? subscribe : traced(subscribe, (result, streams) => {
1685
1787
  if (!result.subscribed) return;
1686
1788
  const lanes = new Set(streams.map((s) => _nullishCoalesce(s.lane, () => ( "default"))));
1687
- const uniform_lane = lanes.size === 1 ? _optionalChain([streams, 'access', _88 => _88[0], 'optionalAccess', _89 => _89.lane]) : void 0;
1789
+ const uniform_lane = lanes.size === 1 ? _optionalChain([streams, 'access', _94 => _94[0], 'optionalAccess', _95 => _95.lane]) : void 0;
1688
1790
  const data = streams.map(
1689
1791
  ({ stream, lane }) => uniform_lane || !lane || lane === "default" ? hue(C_STREAM, stream) : `${hue(C_STREAM, stream)}${dim(`[${lane}]`)}`
1690
1792
  ).join(" ");
@@ -1696,7 +1798,7 @@ function build_drain(logger) {
1696
1798
  }
1697
1799
  function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
1698
1800
  if (logger.level !== "trace" || !leased.length) return;
1699
- const lane = _optionalChain([leased, 'access', _90 => _90[0], 'optionalAccess', _91 => _91.lane]);
1801
+ const lane = _optionalChain([leased, 'access', _96 => _96[0], 'optionalAccess', _97 => _97.lane]);
1700
1802
  const fetch_by_stream = new Map(fetched.map((f) => [f.stream, f]));
1701
1803
  const acked_by_stream = new Map(acked.map((a) => [a.stream, a.at]));
1702
1804
  const blocked_by_stream = new Map(blocked.map((b) => [b.stream, b.error]));
@@ -1705,8 +1807,8 @@ function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
1705
1807
  );
1706
1808
  const detail = leased.map(({ stream, at, retry }) => {
1707
1809
  const f = fetch_by_stream.get(stream);
1708
- const key = _optionalChain([f, 'optionalAccess', _92 => _92.source]) ? `${hue(C_STREAM, stream)}${dim(`<-${f.source}`)}` : hue(C_STREAM, stream);
1709
- const events = _optionalChain([f, 'optionalAccess', _93 => _93.events, 'access', _94 => _94.length]) ? ` ${dim(
1810
+ const key = _optionalChain([f, 'optionalAccess', _98 => _98.source]) ? `${hue(C_STREAM, stream)}${dim(`<-${f.source}`)}` : hue(C_STREAM, stream);
1811
+ const events = _optionalChain([f, 'optionalAccess', _99 => _99.events, 'access', _100 => _100.length]) ? ` ${dim(
1710
1812
  `[${f.events.map(({ id, name }) => `#${id} ${String(name)}`).join(", ")}]`
1711
1813
  )}` : "";
1712
1814
  const acked_at = acked_by_stream.get(stream);
@@ -1734,10 +1836,10 @@ function trace_cycle(logger, leased, fetched, handled, acked, blocked) {
1734
1836
 
1735
1837
  // src/internal/drain-cycle.ts
1736
1838
  function budget_exhausted(lease, options, store_failing) {
1737
- if (store_failing || !_optionalChain([options, 'optionalAccess', _95 => _95.blockOnError]) || lease.retry <= options.maxRetries)
1839
+ if (store_failing || !_optionalChain([options, 'optionalAccess', _101 => _101.blockOnError]) || lease.retry <= options.maxRetries)
1738
1840
  return void 0;
1739
1841
  const error = `Blocking ${lease.stream} after ${lease.retry} claims with no acknowledged progress \u2014 the retry budget (${options.maxRetries}) was spent without the handler ever reporting an error. That means every attempt lost its lease before it could ack: move the reaction to a lane whose leaseMillis covers the handler, then unblock the stream.`;
1740
- _chunk4UWU5FANcjs.log.call(void 0, ).error(error);
1842
+ _chunkS2BEPQ5Zcjs.log.call(void 0, ).error(error);
1741
1843
  return { lease, handled: 0, acked_at: lease.at, error, block: true };
1742
1844
  }
1743
1845
  function fetch_failure_policy(registry) {
@@ -1753,13 +1855,13 @@ function fetch_failure_policy(registry) {
1753
1855
  function finalize(lease, handled, at, error, options, logger, failed_at) {
1754
1856
  if (!error) return { lease, handled, acked_at: at };
1755
1857
  logger.error(error);
1756
- const non_retryable = error instanceof _chunkBCA423WPcjs.NonRetryableError;
1858
+ const non_retryable = error instanceof _chunk3CQWJ4UAcjs.NonRetryableError;
1757
1859
  const block2 = options.blockOnError && (non_retryable || lease.retry >= options.maxRetries);
1758
1860
  if (block2)
1759
1861
  logger.error(
1760
1862
  non_retryable ? `Blocking ${lease.stream} on non-retryable error.` : `Blocking ${lease.stream} after ${lease.retry} retries.`
1761
1863
  );
1762
- const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunk4UWU5FANcjs.DEFAULT_BACKOFF)));
1864
+ const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkS2BEPQ5Zcjs.DEFAULT_BACKOFF)));
1763
1865
  return {
1764
1866
  lease,
1765
1867
  handled,
@@ -1798,7 +1900,7 @@ async function run_drain_cycle(deps, cycle) {
1798
1900
  const fetched = await ops.fetch(leased, eventLimit);
1799
1901
  const fetch_map = /* @__PURE__ */ new Map();
1800
1902
  const fetch_window_at = fetched.reduce(
1801
- (max, { at, events }) => Math.max(max, _optionalChain([events, 'access', _96 => _96.at, 'call', _97 => _97(-1), 'optionalAccess', _98 => _98.id]) || at),
1903
+ (max, { at, events }) => Math.max(max, _optionalChain([events, 'access', _102 => _102.at, 'call', _103 => _103(-1), 'optionalAccess', _104 => _104.id]) || at),
1802
1904
  0
1803
1905
  );
1804
1906
  for (const f of fetched) {
@@ -1862,11 +1964,11 @@ async function run_drain_cycle(deps, cycle) {
1862
1964
  deps.logger
1863
1965
  )
1864
1966
  );
1865
- const at = _optionalChain([entry, 'access', _99 => _99.fetch, 'access', _100 => _100.events, 'access', _101 => _101.at, 'call', _102 => _102(-1), 'optionalAccess', _103 => _103.id]) || fetch_window_at;
1967
+ const at = _optionalChain([entry, 'access', _105 => _105.fetch, 'access', _106 => _106.events, 'access', _107 => _107.at, 'call', _108 => _108(-1), 'optionalAccess', _109 => _109.id]) || fetch_window_at;
1866
1968
  const { payloads } = entry;
1867
1969
  const exhausted = budget_exhausted(
1868
1970
  lease,
1869
- _optionalChain([payloads, 'access', _104 => _104[0], 'optionalAccess', _105 => _105.options]),
1971
+ _optionalChain([payloads, 'access', _110 => _110[0], 'optionalAccess', _111 => _111.options]),
1870
1972
  store_failing
1871
1973
  );
1872
1974
  if (exhausted) return Promise.resolve(exhausted);
@@ -1887,7 +1989,7 @@ async function run_drain_cycle(deps, cycle) {
1887
1989
  const acked = submitted.length ? await ops.ack(submitted) : [];
1888
1990
  const expected = submitted.filter((l) => l.due === void 0).length;
1889
1991
  if (acked.length < expected)
1890
- _chunk4UWU5FANcjs.log.call(void 0, ).warn(
1992
+ _chunkS2BEPQ5Zcjs.log.call(void 0, ).warn(
1891
1993
  `drain: ${expected - acked.length} of ${expected} acks were dropped \u2014 the lease was taken by another worker mid-handler. That work will be redelivered (at-least-once), but persistent drops mean leaseMillis is too short for this handler.`
1892
1994
  );
1893
1995
  const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
@@ -1951,7 +2053,7 @@ var DrainController = (_class3 = class {
1951
2053
  }
1952
2054
  /** This lane's configured lease, or `undefined`; the shutdown grace basis. */
1953
2055
  get lease_millis() {
1954
- return _optionalChain([this, 'access', _106 => _106._deps, 'access', _107 => _107.defaults, 'optionalAccess', _108 => _108.leaseMillis]);
2056
+ return _optionalChain([this, 'access', _112 => _112._deps, 'access', _113 => _113.defaults, 'optionalAccess', _114 => _114.leaseMillis]);
1955
2057
  }
1956
2058
  get lane() {
1957
2059
  return this._deps.lane;
@@ -1983,9 +2085,9 @@ var DrainController = (_class3 = class {
1983
2085
  if (!this.armed || this._stopped || this._inflight)
1984
2086
  return EMPTY_DRAIN;
1985
2087
  const d = _nullishCoalesce(this._deps.defaults, () => ( {}));
1986
- const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunk4UWU5FANcjs.DEFAULT_STREAM_LIMIT));
1987
- const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunk4UWU5FANcjs.DEFAULT_EVENT_LIMIT));
1988
- const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunk4UWU5FANcjs.DEFAULT_LEASE_MILLIS));
2088
+ const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkS2BEPQ5Zcjs.DEFAULT_STREAM_LIMIT));
2089
+ const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkS2BEPQ5Zcjs.DEFAULT_EVENT_LIMIT));
2090
+ const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkS2BEPQ5Zcjs.DEFAULT_LEASE_MILLIS));
1989
2091
  if (this._deps.breaker.state(Date.now()) === "open")
1990
2092
  return EMPTY_DRAIN;
1991
2093
  const pass = this._pass(streamLimit, eventLimit, leaseMillis).finally(
@@ -2077,11 +2179,11 @@ var CloseSignal = class extends Error {
2077
2179
  constructor(opts) {
2078
2180
  super("reaction requested close");
2079
2181
  this.name = "CloseSignal";
2080
- this.stream = _optionalChain([opts, 'optionalAccess', _109 => _109.stream]);
2081
- this.archive = _optionalChain([opts, 'optionalAccess', _110 => _110.archive]);
2082
- this.at = _optionalChain([opts, 'optionalAccess', _111 => _111.at]);
2083
- this.before = _optionalChain([opts, 'optionalAccess', _112 => _112.before]);
2084
- this.defer = _optionalChain([opts, 'optionalAccess', _113 => _113.defer]);
2182
+ this.stream = _optionalChain([opts, 'optionalAccess', _115 => _115.stream]);
2183
+ this.archive = _optionalChain([opts, 'optionalAccess', _116 => _116.archive]);
2184
+ this.at = _optionalChain([opts, 'optionalAccess', _117 => _117.at]);
2185
+ this.before = _optionalChain([opts, 'optionalAccess', _118 => _118.before]);
2186
+ this.defer = _optionalChain([opts, 'optionalAccess', _119 => _119.defer]);
2085
2187
  }
2086
2188
  };
2087
2189
  function build_handle(deps) {
@@ -2111,7 +2213,7 @@ function build_handle(deps) {
2111
2213
  handled++;
2112
2214
  }
2113
2215
  } catch (error) {
2114
- if (error instanceof _chunkBCA423WPcjs.DeferSignal) {
2216
+ if (error instanceof _chunk3CQWJ4UAcjs.DeferSignal) {
2115
2217
  let defer;
2116
2218
  try {
2117
2219
  defer = resolve_defer_at(error.when, event);
@@ -2135,7 +2237,7 @@ function build_handle(deps) {
2135
2237
  // Advance to the live head the handler evaluated against (when
2136
2238
  // provided) so the close-cycle guard sees this reaction caught up.
2137
2239
  acked_at: _nullishCoalesce(error.at, () => ( event.id)),
2138
- defer: _optionalChain([error, 'access', _114 => _114.defer, 'optionalAccess', _115 => _115.getTime, 'call', _116 => _116()]),
2240
+ defer: _optionalChain([error, 'access', _120 => _120.defer, 'optionalAccess', _121 => _121.getTime, 'call', _122 => _122()]),
2139
2241
  // Close the signalled stream (the autoclose reaction's aggregate,
2140
2242
  // which differs from its synthetic lease stream); a self-closing
2141
2243
  // user reaction omits it and closes its own lease stream. A
@@ -2205,25 +2307,25 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
2205
2307
  // watermark would let autoclose's defer short-circuit the aggregate's
2206
2308
  // other reactions (the "a defer affects all reactions on a stream"
2207
2309
  // hazard). The close still targets the aggregate (`source`).
2208
- // A stream name with a regex metacharacter would read as a pattern, and a
2209
- // store may refuse it at subscribe, stopping every reaction. Such a stream
2210
- // has no autoclose: `app.close` still closes it.
2211
- resolver: (e) => _chunk4UWU5FANcjs.is_literal_source.call(void 0, e.stream) ? {
2310
+ // An anchored stream name would read as a pattern, and a store may refuse
2311
+ // it at subscribe, stopping every reaction. Such a stream has no
2312
+ // autoclose: `app.close` still closes it.
2313
+ resolver: (e) => _chunkS2BEPQ5Zcjs.is_literal_source.call(void 0, e.stream) ? {
2212
2314
  target: `${AUTOCLOSE_TARGET_PREFIX}${e.stream}`,
2213
2315
  source: e.stream
2214
2316
  } : void 0,
2215
2317
  // Never block on autoclose: a transient query/store error should retry,
2216
2318
  // not quarantine the synthetic stream.
2217
- options: { blockOnError: false, maxRetries: _chunk4UWU5FANcjs.DEFAULT_MAX_RETRIES },
2319
+ options: { blockOnError: false, maxRetries: _chunkS2BEPQ5Zcjs.DEFAULT_MAX_RETRIES },
2218
2320
  handler: async (event) => {
2219
2321
  const aggregate = event.stream;
2220
2322
  const window = read_window();
2221
2323
  if (!in_autoclose_window(window, /* @__PURE__ */ new Date()))
2222
- throw new (0, _chunkBCA423WPcjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
2223
- const stats = await _chunk4UWU5FANcjs.store.call(void 0, ).query_stats([aggregate], {
2324
+ throw new (0, _chunk3CQWJ4UAcjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
2325
+ const stats = await _chunkS2BEPQ5Zcjs.store.call(void 0, ).query_stats([aggregate], {
2224
2326
  count: true,
2225
2327
  tail: keep_days !== void 0 ? true : void 0,
2226
- exclude: [_chunkBCA423WPcjs.TOMBSTONE_EVENT, _chunkBCA423WPcjs.SNAP_EVENT]
2328
+ exclude: [_chunk3CQWJ4UAcjs.TOMBSTONE_EVENT, _chunk3CQWJ4UAcjs.SNAP_EVENT]
2227
2329
  });
2228
2330
  const entry = stats.get(aggregate);
2229
2331
  if (!entry) return;
@@ -2259,12 +2361,12 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
2259
2361
  dues.push(days_after(entry.tail.created, keep_days));
2260
2362
  const future = dues.map((d) => d.getTime()).filter((t) => t > Date.now());
2261
2363
  if (future.length)
2262
- throw new (0, _chunkBCA423WPcjs.DeferSignal)({ at: new Date(Math.min(...future)) });
2364
+ throw new (0, _chunk3CQWJ4UAcjs.DeferSignal)({ at: new Date(Math.min(...future)) });
2263
2365
  }
2264
2366
  };
2265
2367
  const key = `__autoclose_${st.name}`;
2266
2368
  for (const event_name of Object.keys(st.events)) {
2267
- _optionalChain([registry, 'access', _117 => _117.events, 'access', _118 => _118[event_name], 'optionalAccess', _119 => _119.reactions, 'access', _120 => _120.set, 'call', _121 => _121(
2369
+ _optionalChain([registry, 'access', _123 => _123.events, 'access', _124 => _124[event_name], 'optionalAccess', _125 => _125.reactions, 'access', _126 => _126.set, 'call', _127 => _127(
2268
2370
  key,
2269
2371
  reaction
2270
2372
  )]);
@@ -2319,8 +2421,8 @@ async function run_close_cycle(targets, deps) {
2319
2421
  deps,
2320
2422
  () => run_full_closes(full, target_map, deps, skipped)
2321
2423
  );
2322
- const retired = [...truncated.entries()].filter(([, r]) => r.committed.name === _chunkBCA423WPcjs.TOMBSTONE_EVENT).map(([stream]) => stream);
2323
- if (retired.length) _optionalChain([deps, 'access', _122 => _122.forget_subscribed, 'optionalCall', _123 => _123(retired)]);
2424
+ const retired = [...truncated.entries()].filter(([, r]) => r.committed.name === _chunk3CQWJ4UAcjs.TOMBSTONE_EVENT).map(([stream]) => stream);
2425
+ if (retired.length) _optionalChain([deps, 'access', _128 => _128.forget_subscribed, 'optionalCall', _129 => _129(retired)]);
2324
2426
  for (const [stream, entry] of windowed_result) truncated.set(stream, entry);
2325
2427
  return { truncated, skipped };
2326
2428
  }
@@ -2340,7 +2442,7 @@ async function run_full_closes(full, target_map, deps, skipped) {
2340
2442
  const info = stream_info.get(target.stream);
2341
2443
  if (!info) continue;
2342
2444
  const owner = deps.event_to_state.get(info.last_event_name);
2343
- if (_optionalChain([owner, 'optionalAccess', _124 => _124.pii_aware])) {
2445
+ if (_optionalChain([owner, 'optionalAccess', _130 => _130.pii_aware])) {
2344
2446
  deps.logger.error(
2345
2447
  `Refusing to close "${target.stream}" with restart: state "${owner.name}" carries sensitive fields, so a restart seed would persist redacted values while deleting the originals. Close it without restart to retire the stream, or leave it open.`
2346
2448
  );
@@ -2401,7 +2503,7 @@ async function run_windowed_closes(windowed, deps, skipped) {
2401
2503
  if (!await windowed_prune_pending(t.stream, t.before, max_id))
2402
2504
  return void 0;
2403
2505
  if (t.archive) await t.archive();
2404
- const result = await _chunk4UWU5FANcjs.store.call(void 0, ).truncate([
2506
+ const result = await _chunkS2BEPQ5Zcjs.store.call(void 0, ).truncate([
2405
2507
  { stream: t.stream, before: t.before, max_id }
2406
2508
  ]);
2407
2509
  return result.get(t.stream);
@@ -2414,10 +2516,10 @@ async function run_windowed_closes(windowed, deps, skipped) {
2414
2516
  async function windowed_prune_pending(stream, before, max_id) {
2415
2517
  let boundary_id;
2416
2518
  let min_id;
2417
- await _chunk4UWU5FANcjs.store.call(void 0, ).query(
2519
+ await _chunkS2BEPQ5Zcjs.store.call(void 0, ).query(
2418
2520
  (event) => {
2419
2521
  if (min_id === void 0 || event.id < min_id) min_id = event.id;
2420
- if (event.name === _chunkBCA423WPcjs.SNAP_EVENT && event.created < before && (max_id === void 0 || event.id <= max_id) && (boundary_id === void 0 || event.id > boundary_id))
2522
+ if (event.name === _chunk3CQWJ4UAcjs.SNAP_EVENT && event.created < before && (max_id === void 0 || event.id <= max_id) && (boundary_id === void 0 || event.id > boundary_id))
2421
2523
  boundary_id = event.id;
2422
2524
  },
2423
2525
  { stream, stream_exact: true, with_snaps: true, after: -1 }
@@ -2428,7 +2530,7 @@ async function probe_min_watermarks(streams, page_size, checkpoint) {
2428
2530
  const min_at = /* @__PURE__ */ new Map();
2429
2531
  const matches = source_matcher();
2430
2532
  await walk_streams(
2431
- _chunk4UWU5FANcjs.store.call(void 0, ),
2533
+ _chunkS2BEPQ5Zcjs.store.call(void 0, ),
2432
2534
  (position) => {
2433
2535
  const pending = position.correlated_at === void 0 || position.at < position.correlated_at;
2434
2536
  const cap = pending ? position.at : Math.max(position.at, checkpoint);
@@ -2447,7 +2549,7 @@ function source_matcher() {
2447
2549
  const compiled = /* @__PURE__ */ new Map();
2448
2550
  return (source, target, stream) => {
2449
2551
  if (!source) return true;
2450
- if (_chunk4UWU5FANcjs.is_literal_source.call(void 0, source, target)) return source === stream;
2552
+ if (_chunkS2BEPQ5Zcjs.is_literal_source.call(void 0, source, target)) return source === stream;
2451
2553
  let re = compiled.get(source);
2452
2554
  if (!re) {
2453
2555
  re = new RegExp(source);
@@ -2457,17 +2559,17 @@ function source_matcher() {
2457
2559
  };
2458
2560
  }
2459
2561
  async function scan_stream_heads(streams) {
2460
- const stats = await _chunk4UWU5FANcjs.store.call(void 0, ).query_stats(streams, {
2461
- exclude: [_chunkBCA423WPcjs.SNAP_EVENT]
2562
+ const stats = await _chunkS2BEPQ5Zcjs.store.call(void 0, ).query_stats(streams, {
2563
+ exclude: [_chunk3CQWJ4UAcjs.SNAP_EVENT]
2462
2564
  });
2463
- const domain_heads = await _chunk4UWU5FANcjs.store.call(void 0, ).query_stats(streams, {
2464
- exclude: [_chunkBCA423WPcjs.SNAP_EVENT, _chunkBCA423WPcjs.TOMBSTONE_EVENT]
2565
+ const domain_heads = await _chunkS2BEPQ5Zcjs.store.call(void 0, ).query_stats(streams, {
2566
+ exclude: [_chunk3CQWJ4UAcjs.SNAP_EVENT, _chunk3CQWJ4UAcjs.TOMBSTONE_EVENT]
2465
2567
  });
2466
- const true_heads = await _chunk4UWU5FANcjs.store.call(void 0, ).query_stats(streams, {});
2568
+ const true_heads = await _chunkS2BEPQ5Zcjs.store.call(void 0, ).query_stats(streams, {});
2467
2569
  const out = /* @__PURE__ */ new Map();
2468
2570
  for (const [stream, { head }] of domain_heads) {
2469
- const marker_head = _optionalChain([stats, 'access', _125 => _125.get, 'call', _126 => _126(stream), 'optionalAccess', _127 => _127.head]);
2470
- const interrupted = _optionalChain([marker_head, 'optionalAccess', _128 => _128.name]) === _chunkBCA423WPcjs.TOMBSTONE_EVENT;
2571
+ const marker_head = _optionalChain([stats, 'access', _131 => _131.get, 'call', _132 => _132(stream), 'optionalAccess', _133 => _133.head]);
2572
+ const interrupted = _optionalChain([marker_head, 'optionalAccess', _134 => _134.name]) === _chunk3CQWJ4UAcjs.TOMBSTONE_EVENT;
2471
2573
  out.set(stream, {
2472
2574
  max_id: head.id,
2473
2575
  version: true_heads.get(stream).head.version,
@@ -2490,7 +2592,7 @@ async function partition_by_safety(stream_info, reactive, skipped, page_size, ca
2490
2592
  const pending_set = /* @__PURE__ */ new Set();
2491
2593
  const matches = source_matcher();
2492
2594
  await walk_streams(
2493
- _chunk4UWU5FANcjs.store.call(void 0, ),
2595
+ _chunkS2BEPQ5Zcjs.store.call(void 0, ),
2494
2596
  (position) => {
2495
2597
  const has_work = position.correlated_at !== void 0 && position.at < position.correlated_at;
2496
2598
  if (!has_work) return;
@@ -2535,7 +2637,7 @@ async function guard_with_tombstones(safe, stream_info, correlation, tombstone2,
2535
2637
  async function load_restart_seeds(guarded, target_map, stream_info, event_to_state, load2, logger) {
2536
2638
  const seed_states = /* @__PURE__ */ new Map();
2537
2639
  await Promise.all(
2538
- guarded.filter((s) => _optionalChain([target_map, 'access', _129 => _129.get, 'call', _130 => _130(s), 'optionalAccess', _131 => _131.restart])).map(async (stream) => {
2640
+ guarded.filter((s) => _optionalChain([target_map, 'access', _135 => _135.get, 'call', _136 => _136(s), 'optionalAccess', _137 => _137.restart])).map(async (stream) => {
2539
2641
  const last_event_name = stream_info.get(stream).last_event_name;
2540
2642
  const owner_state = event_to_state.get(last_event_name);
2541
2643
  if (!owner_state) {
@@ -2552,14 +2654,14 @@ async function load_restart_seeds(guarded, target_map, stream_info, event_to_sta
2552
2654
  }
2553
2655
  async function run_archive_callbacks(guarded, target_map) {
2554
2656
  for (const stream of guarded) {
2555
- const archive_fn = _optionalChain([target_map, 'access', _132 => _132.get, 'call', _133 => _133(stream), 'optionalAccess', _134 => _134.archive]);
2657
+ const archive_fn = _optionalChain([target_map, 'access', _138 => _138.get, 'call', _139 => _139(stream), 'optionalAccess', _140 => _140.archive]);
2556
2658
  if (archive_fn) await archive_fn();
2557
2659
  }
2558
2660
  }
2559
2661
  async function heads_still_guarded(guarded, guard_events, skipped) {
2560
- const heads = await _chunk4UWU5FANcjs.store.call(void 0, ).query_stats(guarded, {});
2662
+ const heads = await _chunkS2BEPQ5Zcjs.store.call(void 0, ).query_stats(guarded, {});
2561
2663
  return guarded.filter((stream) => {
2562
- if (_optionalChain([heads, 'access', _135 => _135.get, 'call', _136 => _136(stream), 'optionalAccess', _137 => _137.head, 'access', _138 => _138.id]) === guard_events.get(stream).id)
2664
+ if (_optionalChain([heads, 'access', _141 => _141.get, 'call', _142 => _142(stream), 'optionalAccess', _143 => _143.head, 'access', _144 => _144.id]) === guard_events.get(stream).id)
2563
2665
  return true;
2564
2666
  skipped.push(stream);
2565
2667
  return false;
@@ -2575,18 +2677,18 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
2575
2677
  meta: {
2576
2678
  correlation,
2577
2679
  causation: {
2578
- event: { id: guard.id, name: _chunkBCA423WPcjs.TOMBSTONE_EVENT, stream: guard.stream }
2680
+ event: { id: guard.id, name: _chunk3CQWJ4UAcjs.TOMBSTONE_EVENT, stream: guard.stream }
2579
2681
  }
2580
2682
  }
2581
2683
  };
2582
2684
  });
2583
- const truncated = await _chunk4UWU5FANcjs.store.call(void 0, ).truncate(trunc_targets);
2685
+ const truncated = await _chunkS2BEPQ5Zcjs.store.call(void 0, ).truncate(trunc_targets);
2584
2686
  await Promise.all(
2585
2687
  guarded.map(async (stream) => {
2586
2688
  const entry = truncated.get(stream);
2587
2689
  const state2 = seed_states.get(stream);
2588
2690
  if (state2 && entry) {
2589
- await _chunk4UWU5FANcjs.cache.call(void 0, ).set(stream, {
2691
+ await _chunkS2BEPQ5Zcjs.cache.call(void 0, ).set(stream, {
2590
2692
  stream,
2591
2693
  state: state2,
2592
2694
  version: entry.committed.version,
@@ -2595,7 +2697,7 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
2595
2697
  snaps: 1
2596
2698
  });
2597
2699
  } else {
2598
- await _chunk4UWU5FANcjs.cache.call(void 0, ).invalidate(stream);
2700
+ await _chunkS2BEPQ5Zcjs.cache.call(void 0, ).invalidate(stream);
2599
2701
  }
2600
2702
  })
2601
2703
  );
@@ -2647,7 +2749,7 @@ var CorrelateCycle = (_class5 = class {
2647
2749
  // never lets a resolution re-lane them.
2648
2750
 
2649
2751
  __init18() {this._static_subscriptions = /* @__PURE__ */ new Map()}
2650
- __init19() {this._patterns = new (0, _chunk4UWU5FANcjs.LruMap)(PATTERN_CACHE_SIZE)}
2752
+ __init19() {this._patterns = new (0, _chunkS2BEPQ5Zcjs.LruMap)(PATTERN_CACHE_SIZE)}
2651
2753
 
2652
2754
 
2653
2755
 
@@ -2665,7 +2767,7 @@ var CorrelateCycle = (_class5 = class {
2665
2767
  on_init
2666
2768
  }) {;_class5.prototype.__init10.call(this);_class5.prototype.__init11.call(this);_class5.prototype.__init12.call(this);_class5.prototype.__init13.call(this);_class5.prototype.__init14.call(this);_class5.prototype.__init15.call(this);_class5.prototype.__init16.call(this);_class5.prototype.__init17.call(this);_class5.prototype.__init18.call(this);_class5.prototype.__init19.call(this);_class5.prototype.__init20.call(this);
2667
2769
  this._key = shard ? `${registry_key(registry.events)}:${[...shard].sort().join(",")}` : registry_key(registry.events);
2668
- this._dynamic_subscriptions = new (0, _chunk4UWU5FANcjs.LruMap)(max_subscribed_streams);
2770
+ this._dynamic_subscriptions = new (0, _chunkS2BEPQ5Zcjs.LruMap)(max_subscribed_streams);
2669
2771
  this._registry = registry;
2670
2772
  this._declared_lanes = declared_lanes;
2671
2773
  this._static_targets = static_targets;
@@ -2697,7 +2799,7 @@ var CorrelateCycle = (_class5 = class {
2697
2799
  lane
2698
2800
  });
2699
2801
  }
2700
- await _optionalChain([this, 'access', _139 => _139._on_init, 'optionalCall', _140 => _140()]);
2802
+ await _optionalChain([this, 'access', _145 => _145._on_init, 'optionalCall', _146 => _146()]);
2701
2803
  }
2702
2804
  /**
2703
2805
  * Replace the log with no pass in flight, then cold-start: a pass that
@@ -2723,7 +2825,7 @@ var CorrelateCycle = (_class5 = class {
2723
2825
  // Would the target's own `fetch` (filtered by `source`) return this event?
2724
2826
  _in_fetch_window(source, stream) {
2725
2827
  if (source === void 0 || source === stream) return true;
2726
- if (_chunk4UWU5FANcjs.is_literal_source.call(void 0, source)) return false;
2828
+ if (_chunkS2BEPQ5Zcjs.is_literal_source.call(void 0, source)) return false;
2727
2829
  let pattern = this._patterns.get(source);
2728
2830
  if (!pattern) {
2729
2831
  pattern = new RegExp(source);
@@ -2766,7 +2868,7 @@ var CorrelateCycle = (_class5 = class {
2766
2868
  const correlated = /* @__PURE__ */ new Map();
2767
2869
  let last_id = after;
2768
2870
  let stopped = false;
2769
- const found = await _chunk4UWU5FANcjs.store.call(void 0, ).query(
2871
+ const found = await _chunkS2BEPQ5Zcjs.store.call(void 0, ).query(
2770
2872
  (event) => {
2771
2873
  if (stopped) return;
2772
2874
  const register = this._registry.events[event.name];
@@ -2811,9 +2913,9 @@ var CorrelateCycle = (_class5 = class {
2811
2913
  correlated_at: void 0
2812
2914
  };
2813
2915
  const seen_in_scan = correlated.has(resolved.target);
2814
- const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _141 => _141.lane])), () => ( _chunkBCA423WPcjs.DEFAULT_LANE));
2815
- const held_priority = seen_in_scan ? entry.priority : _optionalChain([recorded, 'optionalAccess', _142 => _142.priority]);
2816
- const resolved_lane = _nullishCoalesce(lane, () => ( _chunkBCA423WPcjs.DEFAULT_LANE));
2916
+ const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _147 => _147.lane])), () => ( _chunk3CQWJ4UAcjs.DEFAULT_LANE));
2917
+ const held_priority = seen_in_scan ? entry.priority : _optionalChain([recorded, 'optionalAccess', _148 => _148.priority]);
2918
+ const resolved_lane = _nullishCoalesce(lane, () => ( _chunk3CQWJ4UAcjs.DEFAULT_LANE));
2817
2919
  if (held_priority === priority && held_lane !== resolved_lane)
2818
2920
  report_lane_conflict(
2819
2921
  this._reported,
@@ -2867,7 +2969,7 @@ var CorrelateCycle = (_class5 = class {
2867
2969
  ).length;
2868
2970
  this._checkpoint = last_id;
2869
2971
  for (const { stream, priority, lane } of streams) {
2870
- if (_optionalChain([correlated, 'access', _143 => _143.get, 'call', _144 => _144(stream), 'optionalAccess', _145 => _145.upgraded]))
2972
+ if (_optionalChain([correlated, 'access', _149 => _149.get, 'call', _150 => _150(stream), 'optionalAccess', _151 => _151.upgraded]))
2871
2973
  this._dynamic_subscriptions.set(stream, {
2872
2974
  priority,
2873
2975
  lane
@@ -2887,7 +2989,7 @@ var CorrelateCycle = (_class5 = class {
2887
2989
  await Promise.all(
2888
2990
  missed.map(async ([stream, entry]) => {
2889
2991
  let row;
2890
- await _chunk4UWU5FANcjs.store.call(void 0, ).query_streams(
2992
+ await _chunkS2BEPQ5Zcjs.store.call(void 0, ).query_streams(
2891
2993
  (position) => {
2892
2994
  row = position;
2893
2995
  },
@@ -2899,8 +3001,8 @@ var CorrelateCycle = (_class5 = class {
2899
3001
  lane: row.lane
2900
3002
  });
2901
3003
  if (entry.priority > row.priority) return;
2902
- const held_lane = _nullishCoalesce(row.lane, () => ( _chunkBCA423WPcjs.DEFAULT_LANE));
2903
- const resolved_lane = _nullishCoalesce(entry.lane, () => ( _chunkBCA423WPcjs.DEFAULT_LANE));
3004
+ const held_lane = _nullishCoalesce(row.lane, () => ( _chunk3CQWJ4UAcjs.DEFAULT_LANE));
3005
+ const resolved_lane = _nullishCoalesce(entry.lane, () => ( _chunk3CQWJ4UAcjs.DEFAULT_LANE));
2904
3006
  if (entry.priority === row.priority && held_lane !== resolved_lane)
2905
3007
  report_lane_conflict(
2906
3008
  this._reported,
@@ -2926,7 +3028,7 @@ var CorrelateCycle = (_class5 = class {
2926
3028
  millis: 0
2927
3029
  });
2928
3030
  } catch (error) {
2929
- _chunk4UWU5FANcjs.log.call(void 0, ).warn(
3031
+ _chunkS2BEPQ5Zcjs.log.call(void 0, ).warn(
2930
3032
  `Could not hand back the correlation lease during shutdown; it expires on its own within ${CORRELATION_LEASE_MS}ms and correlation resumes normally after that. On a single-writer store this usually means another connection holds the database. Cause: ${String(_nullishCoalesce(error.cause, () => ( error)))}`
2931
3033
  );
2932
3034
  }
@@ -2950,7 +3052,7 @@ function pii_gate(event, fields, predicate, actor) {
2950
3052
  const { pii, ...rest } = event;
2951
3053
  if (pii == null) {
2952
3054
  const shredded = { ...data };
2953
- for (const f of fields) shredded[f] = _chunkBCA423WPcjs.SHREDDED;
3055
+ for (const f of fields) shredded[f] = _chunk3CQWJ4UAcjs.SHREDDED;
2954
3056
  return { ...rest, data: shredded };
2955
3057
  }
2956
3058
  const allowed = !!actor && !!predicate && predicate(event, actor);
@@ -2961,7 +3063,7 @@ function pii_gate(event, fields, predicate, actor) {
2961
3063
  };
2962
3064
  }
2963
3065
  const redacted = { ...data };
2964
- for (const f of fields) redacted[f] = _chunkBCA423WPcjs.REDACTED;
3066
+ for (const f of fields) redacted[f] = _chunk3CQWJ4UAcjs.REDACTED;
2965
3067
  return { ...rest, data: redacted };
2966
3068
  }
2967
3069
  var IDENTITY_GATE = (event) => event;
@@ -3106,7 +3208,7 @@ var SettleLoop = (_class6 = class {
3106
3208
  this._pending = true;
3107
3209
  return;
3108
3210
  }
3109
- const delay = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _146 => _146.debounceMs]), () => ( this._default_debounce_ms));
3211
+ const delay = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _152 => _152.debounceMs]), () => ( this._default_debounce_ms));
3110
3212
  const due = Date.now() + delay;
3111
3213
  if (this._timer) {
3112
3214
  if (due >= this._due) return;
@@ -3263,7 +3365,7 @@ var Act = (_class7 = class {
3263
3365
  // Lanes to arm per event; `"all"` when a dynamic resolver hides the lane.
3264
3366
 
3265
3367
 
3266
- __init27() {this._logger = _chunk4UWU5FANcjs.log.call(void 0, )}
3368
+ __init27() {this._logger = _chunkS2BEPQ5Zcjs.log.call(void 0, )}
3267
3369
  // This Act's ports: its own bag, or the singleton adapters.
3268
3370
 
3269
3371
  // Runs a body so internal `store()`/`cache()` calls resolve to `_ports`.
@@ -3285,9 +3387,10 @@ var Act = (_class7 = class {
3285
3387
  this._lanes = lanes;
3286
3388
  this._declared_lanes = ["default", ...lanes.map((l) => l.name)];
3287
3389
  validate_only_lanes(options.onlyLanes, this._declared_lanes);
3288
- this._ports = _nullishCoalesce(options.scoped, () => ( _chunk4UWU5FANcjs.default_scope.call(void 0, )));
3390
+ if (options.scoped) _chunkS2BEPQ5Zcjs.check_store.call(void 0, options.scoped.store);
3391
+ this._ports = _nullishCoalesce(options.scoped, () => ( _chunkS2BEPQ5Zcjs.default_scope.call(void 0, )));
3289
3392
  const ports = this._ports;
3290
- this._scoped = _chunk4UWU5FANcjs.make_run_scoped.call(void 0, {
3393
+ this._scoped = _chunkS2BEPQ5Zcjs.make_run_scoped.call(void 0, {
3291
3394
  // Getters, not a spread: the singletons resolve lazily, so a later
3292
3395
  // `store(...)` / `cache(...)` still takes effect.
3293
3396
  get store() {
@@ -3297,14 +3400,14 @@ var Act = (_class7 = class {
3297
3400
  return ports.cache;
3298
3401
  },
3299
3402
  // Parsed per build, so a bad window throws on every build.
3300
- autoclose_window: _chunk4UWU5FANcjs.resolveAutocloseConfig.call(void 0, options).autocloseWindow
3403
+ autoclose_window: _chunkS2BEPQ5Zcjs.resolveAutocloseConfig.call(void 0, options).autocloseWindow
3301
3404
  });
3302
3405
  this._correlator = _nullishCoalesce(options.correlator, () => ( default_correlator));
3303
3406
  this._es = build_es(this._logger, this._correlator, patch_fn);
3304
3407
  this._cd = build_drain(this._logger);
3305
3408
  const handle = build_handle({
3306
3409
  logger: this._logger,
3307
- reaction_scope: _chunk4UWU5FANcjs.make_reaction_scope.call(void 0, {
3410
+ reaction_scope: _chunkS2BEPQ5Zcjs.make_reaction_scope.call(void 0, {
3308
3411
  do: this.do.bind(this),
3309
3412
  load: this.load.bind(this),
3310
3413
  query: this.query.bind(this),
@@ -3334,12 +3437,12 @@ var Act = (_class7 = class {
3334
3437
  this._ports.store,
3335
3438
  options.listen !== false
3336
3439
  );
3337
- _chunk4UWU5FANcjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
3440
+ _chunkS2BEPQ5Zcjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
3338
3441
  }
3339
3442
  // Shared by drain, settle and autoclose; bad knobs throw at build.
3340
3443
  _build_breaker(options) {
3341
3444
  return new CircuitBreaker(
3342
- _chunk4UWU5FANcjs.resolveCircuitBreakerConfig.call(void 0, options.circuitBreaker),
3445
+ _chunkS2BEPQ5Zcjs.resolveCircuitBreakerConfig.call(void 0, options.circuitBreaker),
3343
3446
  {
3344
3447
  on_error: (error, circuit) => this._emit_error(error, circuit),
3345
3448
  // When the cooldown elapses, settle once: its scan or claim is the
@@ -3351,7 +3454,7 @@ var Act = (_class7 = class {
3351
3454
  // Apps that declare no lanes pass no lane filter to `claim`.
3352
3455
  _build_drain_controllers(options, lanes, handle, handle_batch) {
3353
3456
  const all_lanes = this._declared_lanes;
3354
- const only_set = _optionalChain([options, 'access', _147 => _147.onlyLanes, 'optionalAccess', _148 => _148.length]) ? new Set(options.onlyLanes) : void 0;
3457
+ const only_set = _optionalChain([options, 'access', _153 => _153.onlyLanes, 'optionalAccess', _154 => _154.length]) ? new Set(options.onlyLanes) : void 0;
3355
3458
  const active_lanes = only_set ? all_lanes.filter((n) => only_set.has(n)) : all_lanes;
3356
3459
  const single_default_lane = lanes.length === 0;
3357
3460
  const controllers = /* @__PURE__ */ new Map();
@@ -3373,7 +3476,7 @@ var Act = (_class7 = class {
3373
3476
  try {
3374
3477
  await this._run_close(targets);
3375
3478
  } catch (error) {
3376
- if (error instanceof _chunkBCA423WPcjs.StoreError) throw error;
3479
+ if (error instanceof _chunk3CQWJ4UAcjs.StoreError) throw error;
3377
3480
  this._logger.error(
3378
3481
  error,
3379
3482
  `Reaction-requested close of ${targets.map((t) => `"${t.stream}"`).join(", ")} failed and was not retried; close it with app.close(...) once the cause is fixed.`
@@ -3388,7 +3491,7 @@ var Act = (_class7 = class {
3388
3491
  leaseMillis: cfg.leaseMillis
3389
3492
  }
3390
3493
  });
3391
- if (_optionalChain([cfg, 'optionalAccess', _149 => _149.cycleMs]) !== void 0 && this._drain)
3494
+ if (_optionalChain([cfg, 'optionalAccess', _155 => _155.cycleMs]) !== void 0 && this._drain)
3392
3495
  controller.start(cfg.cycleMs);
3393
3496
  controllers.set(name, controller);
3394
3497
  }
@@ -3407,7 +3510,7 @@ var Act = (_class7 = class {
3407
3510
  // Audit deps, built after the controllers so the lane set is final.
3408
3511
  _build_audit_deps() {
3409
3512
  return {
3410
- store: _chunk4UWU5FANcjs.store,
3513
+ store: _chunkS2BEPQ5Zcjs.store,
3411
3514
  event_to_state: this._event_to_state,
3412
3515
  // Declared lanes, not this process's controllers: a lane another
3413
3516
  // worker drains is not `unknown-lane`.
@@ -3420,7 +3523,7 @@ var Act = (_class7 = class {
3420
3523
  registry: this.registry,
3421
3524
  static_targets: classification.static_targets,
3422
3525
  cd: this._cd,
3423
- max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => ( _chunkBCA423WPcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS)),
3526
+ max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => ( _chunk3CQWJ4UAcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS)),
3424
3527
  // Declared lanes (not active ones): a lane another process claims is
3425
3528
  // still a valid destination.
3426
3529
  declared_lanes: new Set(this._declared_lanes),
@@ -3436,10 +3539,10 @@ var Act = (_class7 = class {
3436
3539
  // Cold start: an idle deferred stream still fires on time after a restart.
3437
3540
  async _seed_persisted_defers() {
3438
3541
  const now = Date.now();
3439
- await walk_streams(_chunk4UWU5FANcjs.store.call(void 0, ), (pos) => {
3542
+ await walk_streams(_chunkS2BEPQ5Zcjs.store.call(void 0, ), (pos) => {
3440
3543
  if (pos.deferred_at === void 0 || pos.deferred_at <= now) return;
3441
3544
  const controller = this._drain_controllers.get(_nullishCoalesce(pos.lane, () => ( "default")));
3442
- _optionalChain([controller, 'optionalAccess', _150 => _150.seed_defer, 'call', _151 => _151(pos.stream, pos.deferred_at)]);
3545
+ _optionalChain([controller, 'optionalAccess', _156 => _156.seed_defer, 'call', _157 => _157(pos.stream, pos.deferred_at)]);
3443
3546
  });
3444
3547
  }
3445
3548
  _build_settle(options) {
@@ -3452,7 +3555,7 @@ var Act = (_class7 = class {
3452
3555
  on_settled: (drain) => this.emit("settled", drain),
3453
3556
  breaker: this._breaker
3454
3557
  },
3455
- _nullishCoalesce(options.settleDebounceMs, () => ( _chunkBCA423WPcjs.DEFAULT_SETTLE_DEBOUNCE_MS))
3558
+ _nullishCoalesce(options.settleDebounceMs, () => ( _chunk3CQWJ4UAcjs.DEFAULT_SETTLE_DEBOUNCE_MS))
3456
3559
  );
3457
3560
  }
3458
3561
 
@@ -3472,7 +3575,7 @@ var Act = (_class7 = class {
3472
3575
  */
3473
3576
  shutdown(options) {
3474
3577
  if (!this._shutdown_promise) {
3475
- _chunk4UWU5FANcjs.resolveShutdownConfig.call(void 0, options);
3578
+ _chunkS2BEPQ5Zcjs.resolveShutdownConfig.call(void 0, options);
3476
3579
  this._shutdown_promise = (async () => {
3477
3580
  this.stop_correlations();
3478
3581
  this._settle.stop(true);
@@ -3480,7 +3583,7 @@ var Act = (_class7 = class {
3480
3583
  for (const c of this._drain_controllers.values()) c.stop();
3481
3584
  const disposer = await this._notify_disposer;
3482
3585
  if (disposer) await disposer();
3483
- await this._await_inflight(_optionalChain([options, 'optionalAccess', _152 => _152.graceMs]));
3586
+ await this._await_inflight(_optionalChain([options, 'optionalAccess', _158 => _158.graceMs]));
3484
3587
  await this._scoped(() => this._correlate.release_correlation());
3485
3588
  this._emitter.removeAllListeners();
3486
3589
  })();
@@ -3490,10 +3593,10 @@ var Act = (_class7 = class {
3490
3593
  // The largest `leaseMillis` among lanes with a cycle in flight (the
3491
3594
  // default for none or 0, and for a running settle), capped.
3492
3595
  _derive_grace_ms(running, settling) {
3493
- let max = settling ? _chunk4UWU5FANcjs.DEFAULT_LEASE_MILLIS : 0;
3596
+ let max = settling ? _chunkS2BEPQ5Zcjs.DEFAULT_LEASE_MILLIS : 0;
3494
3597
  for (const c of running)
3495
- max = Math.max(max, c.lease_millis || _chunk4UWU5FANcjs.DEFAULT_LEASE_MILLIS);
3496
- return Math.min(max, _chunk4UWU5FANcjs.MAX_SHUTDOWN_GRACE_MS);
3598
+ max = Math.max(max, c.lease_millis || _chunkS2BEPQ5Zcjs.DEFAULT_LEASE_MILLIS);
3599
+ return Math.min(max, _chunkS2BEPQ5Zcjs.MAX_SHUTDOWN_GRACE_MS);
3497
3600
  }
3498
3601
  async _await_inflight(grace_ms) {
3499
3602
  const running = [...this._drain_controllers.values()].filter(
@@ -3540,7 +3643,7 @@ var Act = (_class7 = class {
3540
3643
  * Executes an action: validates the payload, loads the state, checks its
3541
3644
  * preconditions, runs the handler, folds the events it emits, checks the
3542
3645
  * state's invariants (its schema) on the result, and commits them with
3543
- * optimistic concurrency on the stream. The reactions to those events
3646
+ * optimistic concurrency on every stream it appends to. The reactions to those events
3544
3647
  * settle on their own (unless `autoSettle: false`).
3545
3648
  *
3546
3649
  * @template TKey - Action name from registered actions
@@ -3550,7 +3653,8 @@ var Act = (_class7 = class {
3550
3653
  * @param options - Per-call dispatch options ({@link DoOptions}) —
3551
3654
  * `reactingTo` to thread correlation, `correlator` to override the
3552
3655
  * framework or orchestrator-level correlator for this call only.
3553
- * @returns Array of snapshots for all affected states (usually one)
3656
+ * @returns The snapshots of the action's own stream, one per event appended
3657
+ * to it; the loaded snapshot alone when the action commits nothing
3554
3658
  *
3555
3659
  * @throws {ValidationError} If the payload doesn't match the action schema,
3556
3660
  * or the state the action leaves breaks the state schema
@@ -3576,8 +3680,8 @@ var Act = (_class7 = class {
3576
3680
  * @see {@link ValidationError}, {@link PreconditionError}, {@link ConcurrencyError}
3577
3681
  */
3578
3682
  async do(action2, target, payload, options) {
3579
- const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _153 => _153.reactingTo]), () => ( _chunk4UWU5FANcjs.current_reacting.call(void 0, )));
3580
- const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _154 => _154.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
3683
+ const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _159 => _159.reactingTo]), () => ( _chunkS2BEPQ5Zcjs.current_reacting.call(void 0, )));
3684
+ const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _160 => _160.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
3581
3685
  return this._scoped(async () => {
3582
3686
  const snapshots = await this._es.action(
3583
3687
  this.registry.actions[action2],
@@ -3587,13 +3691,22 @@ var Act = (_class7 = class {
3587
3691
  do_options
3588
3692
  );
3589
3693
  if (!snapshots[0].patch) return snapshots;
3694
+ const me = this.registry.actions[action2];
3590
3695
  this._wake(snapshots.map((s) => s.event.name));
3591
- this.emit("committed", snapshots);
3592
- this._notify(
3593
- `committed:${this.registry.actions[action2].name}`,
3594
- snapshots
3595
- );
3596
- return snapshots;
3696
+ const by_stream = /* @__PURE__ */ new Map();
3697
+ for (const s of snapshots) {
3698
+ const of_stream = by_stream.get(s.event.stream);
3699
+ if (of_stream) of_stream.push(s);
3700
+ else by_stream.set(s.event.stream, [s]);
3701
+ }
3702
+ for (const [stream, of_stream] of by_stream) {
3703
+ const owner = stream === target.stream ? me : me.loads[action2].find(
3704
+ (l) => l.events.includes(of_stream[0].event.name)
3705
+ ).state;
3706
+ this.emit("committed", of_stream);
3707
+ this._notify(`committed:${owner.name}`, of_stream);
3708
+ }
3709
+ return snapshots.filter((s) => s.event.stream === target.stream);
3597
3710
  });
3598
3711
  }
3599
3712
  async load(stateOrName, streamOrTarget, callback, asOf) {
@@ -3642,11 +3755,11 @@ var Act = (_class7 = class {
3642
3755
  return this._scoped(async () => {
3643
3756
  let first;
3644
3757
  let last;
3645
- const count = await _chunk4UWU5FANcjs.store.call(void 0, ).query((e) => {
3758
+ const count = await _chunkS2BEPQ5Zcjs.store.call(void 0, ).query((e) => {
3646
3759
  const gated = this.registry.query_gate(e.name)(e);
3647
3760
  if (!first) first = gated;
3648
3761
  last = gated;
3649
- _optionalChain([callback, 'optionalCall', _155 => _155(gated)]);
3762
+ _optionalChain([callback, 'optionalCall', _161 => _161(gated)]);
3650
3763
  }, query);
3651
3764
  return { first, last, count };
3652
3765
  });
@@ -3672,7 +3785,7 @@ var Act = (_class7 = class {
3672
3785
  async query_array(query) {
3673
3786
  return this._scoped(async () => {
3674
3787
  const events = [];
3675
- await _chunk4UWU5FANcjs.store.call(void 0, ).query((e) => {
3788
+ await _chunkS2BEPQ5Zcjs.store.call(void 0, ).query((e) => {
3676
3789
  events.push(this.registry.query_gate(e.name)(e));
3677
3790
  }, query);
3678
3791
  return events;
@@ -3692,14 +3805,14 @@ var Act = (_class7 = class {
3692
3805
  */
3693
3806
  async forget(stream) {
3694
3807
  return this._scoped(async () => {
3695
- const s = _chunk4UWU5FANcjs.store.call(void 0, );
3808
+ const s = _chunkS2BEPQ5Zcjs.store.call(void 0, );
3696
3809
  if (!s.forget_pii) {
3697
3810
  throw new Error(
3698
3811
  `Store does not implement forget_pii \u2014 adapter cannot comply with sensitive-data erasure. Use an adapter that declares pii_isolation: true (e.g. @rotorsoft/act on the in-memory store).`
3699
3812
  );
3700
3813
  }
3701
3814
  const eventCount = await s.forget_pii(stream);
3702
- await _chunk4UWU5FANcjs.cache.call(void 0, ).invalidate(stream);
3815
+ await _chunkS2BEPQ5Zcjs.cache.call(void 0, ).invalidate(stream);
3703
3816
  if (eventCount > 0) {
3704
3817
  this.emit("forgotten", { stream, at: /* @__PURE__ */ new Date(), eventCount });
3705
3818
  }
@@ -3733,7 +3846,7 @@ var Act = (_class7 = class {
3733
3846
  * @see {@link correlate} for dynamic stream discovery
3734
3847
  */
3735
3848
  async drain(options = {}) {
3736
- _chunk4UWU5FANcjs.resolveDrainConfig.call(void 0, options);
3849
+ _chunkS2BEPQ5Zcjs.resolveDrainConfig.call(void 0, options);
3737
3850
  if (!this._drain)
3738
3851
  return { fetched: [], leased: [], acked: [], blocked: [] };
3739
3852
  return this._scoped(() => this._drain_all(options));
@@ -3771,7 +3884,7 @@ var Act = (_class7 = class {
3771
3884
  }
3772
3885
  if (to_arm.size === 0) return false;
3773
3886
  this._correlate.arm();
3774
- for (const lane of to_arm) _optionalChain([this, 'access', _156 => _156._drain_controllers, 'access', _157 => _157.get, 'call', _158 => _158(lane), 'optionalAccess', _159 => _159.arm, 'call', _160 => _160()]);
3887
+ for (const lane of to_arm) _optionalChain([this, 'access', _162 => _162._drain_controllers, 'access', _163 => _163.get, 'call', _164 => _164(lane), 'optionalAccess', _165 => _165.arm, 'call', _166 => _166()]);
3775
3888
  return true;
3776
3889
  }
3777
3890
  // In parallel, so a slow lane never holds up a fast one.
@@ -3913,9 +4026,9 @@ var Act = (_class7 = class {
3913
4026
  */
3914
4027
  async reset(input) {
3915
4028
  return this._scoped(async () => {
3916
- const count = await _chunk4UWU5FANcjs.store.call(void 0, ).reset(input);
4029
+ const count = await _chunkS2BEPQ5Zcjs.store.call(void 0, ).reset(input);
3917
4030
  for (const handler of this._batch_handlers.values())
3918
- _optionalChain([handler, 'access', _161 => _161[FOLD_RESET], 'optionalCall', _162 => _162()]);
4031
+ _optionalChain([handler, 'access', _167 => _167[FOLD_RESET], 'optionalCall', _168 => _168()]);
3919
4032
  if (count > 0) {
3920
4033
  this._wake();
3921
4034
  }
@@ -3949,7 +4062,7 @@ var Act = (_class7 = class {
3949
4062
  */
3950
4063
  async unblock(input) {
3951
4064
  return this._scoped(async () => {
3952
- const count = await _chunk4UWU5FANcjs.store.call(void 0, ).unblock(input);
4065
+ const count = await _chunkS2BEPQ5Zcjs.store.call(void 0, ).unblock(input);
3953
4066
  if (count > 0) {
3954
4067
  this._wake();
3955
4068
  }
@@ -4004,7 +4117,7 @@ var Act = (_class7 = class {
4004
4117
  return { ...partial, duration_ms: Date.now() - started };
4005
4118
  }
4006
4119
  const target = _nullishCoalesce(sink, () => ( (() => {
4007
- const s = _chunk4UWU5FANcjs.store.call(void 0, );
4120
+ const s = _chunkS2BEPQ5Zcjs.store.call(void 0, );
4008
4121
  if (!s.restore) throw new Error("adapter has no restore capability");
4009
4122
  return s;
4010
4123
  })()));
@@ -4050,11 +4163,11 @@ var Act = (_class7 = class {
4050
4163
  async blocked_streams(options) {
4051
4164
  return this._scoped(async () => {
4052
4165
  const positions = [];
4053
- await _chunk4UWU5FANcjs.store.call(void 0, ).query_streams(
4166
+ await _chunkS2BEPQ5Zcjs.store.call(void 0, ).query_streams(
4054
4167
  (p) => {
4055
4168
  positions.push(p);
4056
4169
  },
4057
- { blocked: true, after: _optionalChain([options, 'optionalAccess', _163 => _163.after]), limit: _optionalChain([options, 'optionalAccess', _164 => _164.limit]) }
4170
+ { blocked: true, after: _optionalChain([options, 'optionalAccess', _169 => _169.after]), limit: _optionalChain([options, 'optionalAccess', _170 => _170.limit]) }
4058
4171
  );
4059
4172
  return positions;
4060
4173
  });
@@ -4102,7 +4215,7 @@ var Act = (_class7 = class {
4102
4215
  * @see {@link Store.prioritize} for the underlying primitive
4103
4216
  */
4104
4217
  async prioritize(filter, priority) {
4105
- return this._scoped(() => _chunk4UWU5FANcjs.store.call(void 0, ).prioritize(filter, priority));
4218
+ return this._scoped(() => _chunkS2BEPQ5Zcjs.store.call(void 0, ).prioritize(filter, priority));
4106
4219
  }
4107
4220
  // Shared by `close()` and reaction-requested closes.
4108
4221
  async _run_close(targets) {
@@ -4182,19 +4295,18 @@ var Act = (_class7 = class {
4182
4295
  * @see {@link correlate} for manual correlation
4183
4296
  */
4184
4297
  settle(options) {
4185
- _chunk4UWU5FANcjs.resolveSettleConfig.call(void 0, _nullishCoalesce(options, () => ( {})));
4298
+ _chunkS2BEPQ5Zcjs.resolveSettleConfig.call(void 0, _nullishCoalesce(options, () => ( {})));
4186
4299
  this._schedule(options);
4187
4300
  }
4188
4301
  }, _class7);
4189
4302
 
4190
4303
  // src/builders/merge.ts
4191
4304
 
4192
- function base_type_name(zodType) {
4193
- let t = zodType;
4194
- while (typeof t.unwrap === "function") {
4195
- t = t.unwrap();
4196
- }
4197
- return t.constructor.name;
4305
+ function base_type_name(schema) {
4306
+ let def = _chunk3CQWJ4UAcjs.def_of.call(void 0, schema);
4307
+ for (let inner = _chunk3CQWJ4UAcjs.inner_of.call(void 0, def); inner; inner = _chunk3CQWJ4UAcjs.inner_of.call(void 0, def))
4308
+ def = _chunk3CQWJ4UAcjs.def_of.call(void 0, inner);
4309
+ return def.type === "array" ? `array of ${base_type_name(def.element)}` : def.type;
4198
4310
  }
4199
4311
  function merge_schemas(existing, incoming, state_name) {
4200
4312
  if (existing === incoming) return existing;
@@ -4286,8 +4398,8 @@ function merge_into_existing(state2, existing, states, actions, events) {
4286
4398
  actions: { ...existing.actions, ...state2.actions },
4287
4399
  patch: merged_patch,
4288
4400
  on: { ...existing.on, ...state2.on },
4289
- given: { ...existing.given, ...state2.given },
4290
4401
  requires: { ...existing.requires, ...state2.requires },
4402
+ loads: existing.loads || state2.loads ? { ...existing.loads, ...state2.loads } : void 0,
4291
4403
  snap: pick_declared(existing.snap, state2.snap, "snap strategy", state2.name),
4292
4404
  // Per-action retry policy is keyed by action name, so the two partials'
4293
4405
  // maps combine. Left `undefined` when neither declared one, so the
@@ -4380,9 +4492,9 @@ var _this_ = ({ stream }) => ({
4380
4492
 
4381
4493
  // src/builders/builder-utils.ts
4382
4494
  function register_lane(config2, lanes) {
4383
- _chunk4UWU5FANcjs.resolveLaneConfig.call(void 0, config2);
4384
- if (config2.name === _chunkBCA423WPcjs.DEFAULT_LANE)
4385
- throw new Error(`Lane "${_chunkBCA423WPcjs.DEFAULT_LANE}" is reserved`);
4495
+ _chunkS2BEPQ5Zcjs.resolveLaneConfig.call(void 0, config2);
4496
+ if (config2.name === _chunk3CQWJ4UAcjs.DEFAULT_LANE)
4497
+ throw new Error(`Lane "${_chunk3CQWJ4UAcjs.DEFAULT_LANE}" is reserved`);
4386
4498
  const existing = lanes.find((l) => l.name === config2.name);
4387
4499
  if (!existing) return void lanes.push(config2);
4388
4500
  if (existing.leaseMillis !== config2.leaseMillis || existing.streamLimit !== config2.streamLimit || existing.cycleMs !== config2.cycleMs)
@@ -4424,10 +4536,10 @@ function reaction_on(event, events, builder) {
4424
4536
  // Validate the whole bag at the declaration site so a bad
4425
4537
  // `maxRetries`/`backoff`/`blockOnError` throws ZodError at build,
4426
4538
  // not a NaN gate on the first retry.
4427
- options: _chunk4UWU5FANcjs.resolveReactionConfig.call(void 0, {
4428
- blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _165 => _165.blockOnError]), () => ( _chunk4UWU5FANcjs.DEFAULT_BLOCK_ON_ERROR)),
4429
- maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _166 => _166.maxRetries]), () => ( _chunk4UWU5FANcjs.DEFAULT_MAX_RETRIES)),
4430
- backoff: _optionalChain([options, 'optionalAccess', _167 => _167.backoff])
4539
+ options: _chunkS2BEPQ5Zcjs.resolveReactionConfig.call(void 0, {
4540
+ blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _171 => _171.blockOnError]), () => ( _chunkS2BEPQ5Zcjs.DEFAULT_BLOCK_ON_ERROR)),
4541
+ maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _172 => _172.maxRetries]), () => ( _chunkS2BEPQ5Zcjs.DEFAULT_MAX_RETRIES)),
4542
+ backoff: _optionalChain([options, 'optionalAccess', _173 => _173.backoff])
4431
4543
  })
4432
4544
  };
4433
4545
  },
@@ -4447,7 +4559,7 @@ function reaction_on(event, events, builder) {
4447
4559
  // src/internal/date-reviver.ts
4448
4560
 
4449
4561
  function variant_schema(schema, walk) {
4450
- const shape = _optionalChain([_chunkBCA423WPcjs.def_of.call(void 0, schema), 'optionalAccess', _168 => _168.shape]);
4562
+ const shape = _optionalChain([_chunk3CQWJ4UAcjs.def_of.call(void 0, schema), 'optionalAccess', _174 => _174.shape]);
4451
4563
  if (!shape) {
4452
4564
  const dates = walk(schema);
4453
4565
  return { schema: _nullishCoalesce(dates, () => ( schema)), dated: !!dates };
@@ -4484,7 +4596,7 @@ function date_reviver_schema(schema) {
4484
4596
  return first && recursive ? pass(true) : first;
4485
4597
  }
4486
4598
  function build(schema, walk) {
4487
- const def = _chunkBCA423WPcjs.def_of.call(void 0, schema);
4599
+ const def = _chunk3CQWJ4UAcjs.def_of.call(void 0, schema);
4488
4600
  if (!def) return void 0;
4489
4601
  const inner = () => walk(def.innerType);
4490
4602
  switch (def.type) {
@@ -4519,7 +4631,7 @@ function build(schema, walk) {
4519
4631
  return variants.some((v) => v.dated) ? _zod.z.union(variants.map((v) => v.schema)) : void 0;
4520
4632
  }
4521
4633
  case "nullable":
4522
- return _optionalChain([inner, 'call', _169 => _169(), 'optionalAccess', _170 => _170.nullable, 'call', _171 => _171()]);
4634
+ return _optionalChain([inner, 'call', _175 => _175(), 'optionalAccess', _176 => _176.nullable, 'call', _177 => _177()]);
4523
4635
  case "pipe":
4524
4636
  return walk(def.out);
4525
4637
  case "lazy":
@@ -4530,13 +4642,13 @@ function build(schema, walk) {
4530
4642
  return left && right ? left.pipe(right) : _nullishCoalesce(left, () => ( right));
4531
4643
  }
4532
4644
  default:
4533
- return _chunkBCA423WPcjs.inner_of.call(void 0, def) ? inner() : void 0;
4645
+ return _chunk3CQWJ4UAcjs.inner_of.call(void 0, def) ? inner() : void 0;
4534
4646
  }
4535
4647
  }
4536
4648
 
4537
4649
  // src/builders/event-builder.ts
4538
4650
  function event_tags(schema) {
4539
- const pii = _chunkBCA423WPcjs.pii_schemas.call(void 0, schema);
4651
+ const pii = _chunk3CQWJ4UAcjs.pii_schemas.call(void 0, schema);
4540
4652
  const pii_dates = {};
4541
4653
  for (const [key, field] of Object.entries(pii)) {
4542
4654
  const dates = date_reviver_schema(field);
@@ -4574,7 +4686,7 @@ function make_event_reader(tags, disclosure, predicate = null) {
4574
4686
  });
4575
4687
  }
4576
4688
  function build_events(registry, states, lanes, owners) {
4577
- const declared = /* @__PURE__ */ new Set([_chunkBCA423WPcjs.DEFAULT_LANE, ...lanes.map((l) => l.name)]);
4689
+ const declared = /* @__PURE__ */ new Set([_chunk3CQWJ4UAcjs.DEFAULT_LANE, ...lanes.map((l) => l.name)]);
4578
4690
  const lane_errors = [];
4579
4691
  const tags = /* @__PURE__ */ new Map();
4580
4692
  const sensitive2 = /* @__PURE__ */ new Map();
@@ -4649,7 +4761,7 @@ function build_events(registry, states, lanes, owners) {
4649
4761
  if (reader) readers.set(event_name, reader);
4650
4762
  }
4651
4763
  const snap2 = make_event_reader(event_tags(state2.state), "redact", null);
4652
- if (snap2) readers.set(_chunkBCA423WPcjs.SNAP_EVENT, snap2);
4764
+ if (snap2) readers.set(_chunk3CQWJ4UAcjs.SNAP_EVENT, snap2);
4653
4765
  if (readers.size === 0) continue;
4654
4766
  state2.view = (event, actor) => (_nullishCoalesce(readers.get(event.name), () => ( IDENTITY_GATE)))(event, actor);
4655
4767
  }
@@ -4657,7 +4769,7 @@ function build_events(registry, states, lanes, owners) {
4657
4769
  return { sensitive: sensitive2, advisory, query_readers, handler_readers };
4658
4770
  }
4659
4771
  function reads_as_string(schema) {
4660
- const type = _optionalChain([_chunkBCA423WPcjs.def_of.call(void 0, _chunkBCA423WPcjs.output_of.call(void 0, schema)), 'optionalAccess', _172 => _172.type]);
4772
+ const type = _optionalChain([_chunk3CQWJ4UAcjs.def_of.call(void 0, _chunk3CQWJ4UAcjs.output_of.call(void 0, schema)), 'optionalAccess', _178 => _178.type]);
4661
4773
  return type === "string" || type === "transform";
4662
4774
  }
4663
4775
 
@@ -4715,7 +4827,7 @@ function act() {
4715
4827
  let _built = false;
4716
4828
  const read_wrap = (original) => {
4717
4829
  const wrapped = async (events, stream) => {
4718
- const read = events.map((e) => _nullishCoalesce(_optionalChain([_hr, 'access', _173 => _173.get, 'call', _174 => _174(e.name), 'optionalCall', _175 => _175(e)]), () => ( e)));
4830
+ const read = events.map((e) => _nullishCoalesce(_optionalChain([_hr, 'access', _179 => _179.get, 'call', _180 => _180(e.name), 'optionalCall', _181 => _181(e)]), () => ( e)));
4719
4831
  return original(read, stream);
4720
4832
  };
4721
4833
  const reset = original[FOLD_RESET];
@@ -4756,7 +4868,7 @@ function act() {
4756
4868
  });
4757
4869
  }
4758
4870
  for (const [action_name, handler] of Object.entries(state2.on)) {
4759
- const static_target = _optionalChain([handler, 'optionalAccess', _176 => _176._static_emit]);
4871
+ const static_target = _optionalChain([handler, 'optionalAccess', _182 => _182._static_emit]);
4760
4872
  if (static_target && deprecated.has(static_target)) {
4761
4873
  const current = current_version_of(static_target, event_names);
4762
4874
  throw new Error(
@@ -4769,7 +4881,7 @@ function act() {
4769
4881
  const list = deprecation_summary.map(
4770
4882
  (d) => `"${d.deprecated}" (current: "${d.current}", state: "${d.state_name}")`
4771
4883
  ).join(", ");
4772
- _chunk4UWU5FANcjs.log.call(void 0, ).info(
4884
+ _chunkS2BEPQ5Zcjs.log.call(void 0, ).info(
4773
4885
  `Act registered ${deprecation_summary.length} deprecated event(s): ${list}. These are legacy versions kept for the read path. Consider truncating closed streams via app.close() when feasible to reduce historical event load. See docs/docs/architecture/event-schema-evolution.md.`
4774
4886
  );
4775
4887
  }
@@ -4811,7 +4923,7 @@ function act() {
4811
4923
  return reaction_on(event, registry.events, builder);
4812
4924
  },
4813
4925
  build: (options) => {
4814
- _chunk4UWU5FANcjs.resolveActConfig.call(void 0, options);
4926
+ _chunkS2BEPQ5Zcjs.resolveActConfig.call(void 0, options);
4815
4927
  if (!_built) {
4816
4928
  for (const proj of pending_projections) add_projection(proj);
4817
4929
  for (const proj of fold_projections) {
@@ -4829,7 +4941,7 @@ function act() {
4829
4941
  `State projection "${proj.target}" of "${fold.name}" is missing events ${missing.join(", ")} \u2014 pass every partial of the state to .of()`
4830
4942
  );
4831
4943
  const claimed = fold_specs.find((s) => s.target === proj.target);
4832
- if (_optionalChain([claimed, 'optionalAccess', _177 => _177.projection]) === proj) continue;
4944
+ if (_optionalChain([claimed, 'optionalAccess', _183 => _183.projection]) === proj) continue;
4833
4945
  if (batch_handlers.has(proj.target) || claimed)
4834
4946
  throw new Error(
4835
4947
  `Duplicate projection target "${proj.target}" \u2014 a target is served by one batch handler or one state projection, never both`
@@ -4851,7 +4963,39 @@ function act() {
4851
4963
  for (const [name, gate] of built.query_readers) _qg.set(name, gate);
4852
4964
  for (const [name, gate] of built.handler_readers) _hr.set(name, gate);
4853
4965
  finalize_deprecations();
4854
- if (built.advisory) _chunk4UWU5FANcjs.log.call(void 0, ).warn(built.advisory);
4966
+ if (built.advisory) _chunkS2BEPQ5Zcjs.log.call(void 0, ).warn(built.advisory);
4967
+ for (const [name, state2] of states) {
4968
+ if (!state2.loads) continue;
4969
+ const resolved = {};
4970
+ for (const [action2, loads] of Object.entries(state2.loads)) {
4971
+ resolved[action2] = loads.map((l) => {
4972
+ const registered = states.get(l.state.name);
4973
+ if (!registered)
4974
+ throw new Error(
4975
+ `Action "${action2}" loads "${l.state.name}", which is not registered \u2014 add it via withState/withSlice before build()`
4976
+ );
4977
+ const deprecated = l.events.find(
4978
+ (e) => _optionalChain([_de, 'access', _184 => _184.get, 'call', _185 => _185(registered.name), 'optionalAccess', _186 => _186.has, 'call', _187 => _187(e)])
4979
+ );
4980
+ if (deprecated)
4981
+ throw new Error(
4982
+ `Action "${action2}" lists deprecated event "${deprecated}" on its load of "${registered.name}". A newer version exists: "${current_version_of(deprecated, Object.keys(registered.events))}". List the current version instead.`
4983
+ );
4984
+ return { ...l, state: registered };
4985
+ });
4986
+ }
4987
+ for (const [action2, loads] of Object.entries(resolved)) {
4988
+ const static_target = state2.on[action2]._static_emit;
4989
+ if (static_target && loads.some((l) => l.events.includes(static_target)))
4990
+ throw new Error(
4991
+ `Action "${action2}" statically emits "${static_target}", which its load lists, so nothing goes to its own stream; emit one of its own events too`
4992
+ );
4993
+ }
4994
+ const own = { ...state2, loads: resolved };
4995
+ states.set(name, own);
4996
+ for (const action2 of Object.keys(own.actions))
4997
+ registry.actions[action2] = own;
4998
+ }
4855
4999
  for (const state2 of states.values()) {
4856
5000
  if (state2.disclose) _dp.set(state2.name, state2.disclose);
4857
5001
  if (state2.autoclose) _ac.set(state2.name, state2.autoclose);
@@ -4863,7 +5007,7 @@ function act() {
4863
5007
  synthesize_autoclose_reactions(
4864
5008
  registry,
4865
5009
  states,
4866
- _chunk4UWU5FANcjs.current_autoclose_window
5010
+ _chunkS2BEPQ5Zcjs.current_autoclose_window
4867
5011
  );
4868
5012
  Object.freeze(registry.actions);
4869
5013
  Object.freeze(registry.events);
@@ -4911,8 +5055,8 @@ function _projection(target) {
4911
5055
  handler,
4912
5056
  resolver: _nullishCoalesce(default_resolver, () => ( _this_)),
4913
5057
  options: {
4914
- blockOnError: _chunk4UWU5FANcjs.DEFAULT_BLOCK_ON_ERROR,
4915
- maxRetries: _chunk4UWU5FANcjs.DEFAULT_MAX_RETRIES
5058
+ blockOnError: _chunkS2BEPQ5Zcjs.DEFAULT_BLOCK_ON_ERROR,
5059
+ maxRetries: _chunkS2BEPQ5Zcjs.DEFAULT_MAX_RETRIES
4916
5060
  }
4917
5061
  }),
4918
5062
  widened
@@ -4953,7 +5097,7 @@ function _projection(target) {
4953
5097
  throw new Error(
4954
5098
  `Projection "${target}" .of() partials must share one state name \u2014 got "${name}" and "${partial.name}"`
4955
5099
  );
4956
- const config2 = _chunk4UWU5FANcjs.resolveFoldConfig.call(void 0, options);
5100
+ const config2 = _chunkS2BEPQ5Zcjs.resolveFoldConfig.call(void 0, options);
4957
5101
  const fold_events = {};
4958
5102
  for (const partial of partials)
4959
5103
  for (const [event_name, schema] of Object.entries(partial.events)) {
@@ -4971,8 +5115,8 @@ function _projection(target) {
4971
5115
  handler: noop,
4972
5116
  resolver: { target },
4973
5117
  options: {
4974
- blockOnError: _chunk4UWU5FANcjs.DEFAULT_BLOCK_ON_ERROR,
4975
- maxRetries: _chunk4UWU5FANcjs.DEFAULT_MAX_RETRIES
5118
+ blockOnError: _chunkS2BEPQ5Zcjs.DEFAULT_BLOCK_ON_ERROR,
5119
+ maxRetries: _chunkS2BEPQ5Zcjs.DEFAULT_MAX_RETRIES
4976
5120
  }
4977
5121
  }
4978
5122
  ]
@@ -5088,13 +5232,29 @@ function action_builder(state2) {
5088
5232
  throw new Error(`Duplicate action "${action2}"`);
5089
5233
  internal.actions[action2] = schema;
5090
5234
  if (options) {
5091
- _chunk4UWU5FANcjs.resolveActionConfig.call(void 0, options);
5235
+ _chunkS2BEPQ5Zcjs.resolveActionConfig.call(void 0, options);
5092
5236
  internal.options ??= {};
5093
5237
  internal.options[action2] = options;
5094
5238
  }
5095
- function given(rules) {
5096
- (internal.given ??= {})[action2] = rules;
5097
- return { requires, emit };
5239
+ const loads = [];
5240
+ function load2(state3, target, events = [], name = state3.name) {
5241
+ if (loads.some((l) => l.name === name))
5242
+ throw new Error(
5243
+ `Action "${action2}" loads "${name}" twice; name each load of the same state`
5244
+ );
5245
+ for (const event of events) {
5246
+ if (!(event in state3.events))
5247
+ throw new Error(
5248
+ `Action "${action2}" lists "${event}" on its load of "${state3.name}", which doesn't emit it`
5249
+ );
5250
+ if (loads.some((l) => l.events.includes(event)))
5251
+ throw new Error(
5252
+ `Action "${action2}" lists "${event}" on two loads; an event goes to one stream`
5253
+ );
5254
+ }
5255
+ loads.push({ state: state3, target, events, name });
5256
+ (internal.loads ??= {})[action2] = loads;
5257
+ return { loads: load2, requires, emit };
5098
5258
  }
5099
5259
  function requires(rules) {
5100
5260
  (internal.requires ??= {})[action2] = rules;
@@ -5115,7 +5275,7 @@ function action_builder(state2) {
5115
5275
  }
5116
5276
  return builder;
5117
5277
  }
5118
- return { given, requires, emit };
5278
+ return { loads: load2, requires, emit };
5119
5279
  },
5120
5280
  snap(snap2) {
5121
5281
  internal.snap = snap2;
@@ -5384,5 +5544,5 @@ function write_line(writer, line) {
5384
5544
 
5385
5545
 
5386
5546
 
5387
- exports.Act = Act; exports.ActorSchema = _chunkBCA423WPcjs.ActorSchema; exports.CausationEventSchema = _chunkBCA423WPcjs.CausationEventSchema; exports.CommittedMetaSchema = _chunkBCA423WPcjs.CommittedMetaSchema; exports.ConcurrencyError = _chunkBCA423WPcjs.ConcurrencyError; exports.ConsoleLogger = _chunk4UWU5FANcjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = _chunkBCA423WPcjs.DEFAULT_LANE; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = _chunkBCA423WPcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS; exports.DEFAULT_QUERY_STREAMS_LIMIT = _chunk4UWU5FANcjs.DEFAULT_QUERY_STREAMS_LIMIT; exports.DEFAULT_SETTLE_DEBOUNCE_MS = _chunkBCA423WPcjs.DEFAULT_SETTLE_DEBOUNCE_MS; exports.DeferSignal = _chunkBCA423WPcjs.DeferSignal; exports.Environments = _chunkBCA423WPcjs.Environments; exports.Errors = _chunkBCA423WPcjs.Errors; exports.EventMetaSchema = _chunkBCA423WPcjs.EventMetaSchema; exports.ExitCodes = _chunkBCA423WPcjs.ExitCodes; exports.InMemoryCache = _chunk4UWU5FANcjs.InMemoryCache; exports.InMemoryStore = _chunk4UWU5FANcjs.InMemoryStore; exports.InvariantError = _chunkBCA423WPcjs.InvariantError; exports.LogLevels = _chunkBCA423WPcjs.LogLevels; exports.NonRetryableError = _chunkBCA423WPcjs.NonRetryableError; exports.PackageSchema = _chunk4UWU5FANcjs.PackageSchema; exports.PreconditionError = _chunkBCA423WPcjs.PreconditionError; exports.QuerySchema = _chunkBCA423WPcjs.QuerySchema; exports.REDACTED = _chunkBCA423WPcjs.REDACTED; exports.SHREDDED = _chunkBCA423WPcjs.SHREDDED; exports.SNAP_EVENT = _chunkBCA423WPcjs.SNAP_EVENT; exports.StoreError = _chunkBCA423WPcjs.StoreError; exports.StreamClosedError = _chunkBCA423WPcjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunkBCA423WPcjs.TOMBSTONE_EVENT; exports.TargetSchema = _chunkBCA423WPcjs.TargetSchema; exports.ValidationError = _chunkBCA423WPcjs.ValidationError; exports.ZodEmpty = _chunkBCA423WPcjs.ZodEmpty; exports.act = act; exports.cache = _chunk4UWU5FANcjs.cache; exports.config = _chunk4UWU5FANcjs.config; exports.dateReviver = _chunk4UWU5FANcjs.dateReviver; exports.default_scope = _chunk4UWU5FANcjs.default_scope; exports.dispose = _chunk4UWU5FANcjs.dispose; exports.disposeAndExit = _chunk4UWU5FANcjs.disposeAndExit; exports.extend = _chunk4UWU5FANcjs.extend; exports.fair_slots = _chunk4UWU5FANcjs.fair_slots; exports.is_literal_source = _chunk4UWU5FANcjs.is_literal_source; exports.log = _chunk4UWU5FANcjs.log; exports.pii_fields = _chunkBCA423WPcjs.pii_fields; exports.port = _chunk4UWU5FANcjs.port; exports.projection = projection; exports.resolveAutocloseConfig = _chunk4UWU5FANcjs.resolveAutocloseConfig2; exports.sensitive = _chunkBCA423WPcjs.sensitive; exports.sleep = _chunk4UWU5FANcjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunk4UWU5FANcjs.store; exports.validate = _chunk4UWU5FANcjs.validate;
5547
+ exports.Act = Act; exports.ActorSchema = _chunk3CQWJ4UAcjs.ActorSchema; exports.CausationEventSchema = _chunk3CQWJ4UAcjs.CausationEventSchema; exports.CommittedMetaSchema = _chunk3CQWJ4UAcjs.CommittedMetaSchema; exports.ConcurrencyError = _chunk3CQWJ4UAcjs.ConcurrencyError; exports.ConsoleLogger = _chunkS2BEPQ5Zcjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = _chunk3CQWJ4UAcjs.DEFAULT_LANE; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = _chunk3CQWJ4UAcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS; exports.DEFAULT_QUERY_STREAMS_LIMIT = _chunkS2BEPQ5Zcjs.DEFAULT_QUERY_STREAMS_LIMIT; exports.DEFAULT_SETTLE_DEBOUNCE_MS = _chunk3CQWJ4UAcjs.DEFAULT_SETTLE_DEBOUNCE_MS; exports.DeferSignal = _chunk3CQWJ4UAcjs.DeferSignal; exports.Environments = _chunk3CQWJ4UAcjs.Environments; exports.Errors = _chunk3CQWJ4UAcjs.Errors; exports.EventMetaSchema = _chunk3CQWJ4UAcjs.EventMetaSchema; exports.ExitCodes = _chunk3CQWJ4UAcjs.ExitCodes; exports.InMemoryCache = _chunkS2BEPQ5Zcjs.InMemoryCache; exports.InMemoryStore = _chunkS2BEPQ5Zcjs.InMemoryStore; exports.LogLevels = _chunk3CQWJ4UAcjs.LogLevels; exports.NonRetryableError = _chunk3CQWJ4UAcjs.NonRetryableError; exports.PackageSchema = _chunkS2BEPQ5Zcjs.PackageSchema; exports.PreconditionError = _chunk3CQWJ4UAcjs.PreconditionError; exports.QuerySchema = _chunk3CQWJ4UAcjs.QuerySchema; exports.REDACTED = _chunk3CQWJ4UAcjs.REDACTED; exports.SHREDDED = _chunk3CQWJ4UAcjs.SHREDDED; exports.SNAP_EVENT = _chunk3CQWJ4UAcjs.SNAP_EVENT; exports.StoreError = _chunk3CQWJ4UAcjs.StoreError; exports.StreamClosedError = _chunk3CQWJ4UAcjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunk3CQWJ4UAcjs.TOMBSTONE_EVENT; exports.TargetSchema = _chunk3CQWJ4UAcjs.TargetSchema; exports.ValidationError = _chunk3CQWJ4UAcjs.ValidationError; exports.ZodEmpty = _chunk3CQWJ4UAcjs.ZodEmpty; exports.act = act; exports.cache = _chunkS2BEPQ5Zcjs.cache; exports.check_appends = _chunkS2BEPQ5Zcjs.check_appends; exports.config = _chunkS2BEPQ5Zcjs.config; exports.dateReviver = _chunkS2BEPQ5Zcjs.dateReviver; exports.default_scope = _chunkS2BEPQ5Zcjs.default_scope; exports.dispose = _chunkS2BEPQ5Zcjs.dispose; exports.disposeAndExit = _chunkS2BEPQ5Zcjs.disposeAndExit; exports.extend = _chunkS2BEPQ5Zcjs.extend; exports.fair_slots = _chunkS2BEPQ5Zcjs.fair_slots; exports.is_literal_source = _chunkS2BEPQ5Zcjs.is_literal_source; exports.log = _chunkS2BEPQ5Zcjs.log; exports.pii_fields = _chunk3CQWJ4UAcjs.pii_fields; exports.port = _chunkS2BEPQ5Zcjs.port; exports.projection = projection; exports.resolveAutocloseConfig = _chunkS2BEPQ5Zcjs.resolveAutocloseConfig2; exports.sensitive = _chunk3CQWJ4UAcjs.sensitive; exports.sleep = _chunkS2BEPQ5Zcjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkS2BEPQ5Zcjs.store; exports.validate = _chunkS2BEPQ5Zcjs.validate;
5388
5548
  //# sourceMappingURL=index.cjs.map