@rotorsoft/act 1.33.12 → 1.33.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -40,7 +40,7 @@
40
40
 
41
41
 
42
42
 
43
- var _chunkP3B7HVFDcjs = require('./chunk-P3B7HVFD.cjs');
43
+ var _chunkU54EW4DXcjs = require('./chunk-U54EW4DX.cjs');
44
44
 
45
45
 
46
46
 
@@ -70,24 +70,24 @@ var _chunkP3B7HVFDcjs = require('./chunk-P3B7HVFD.cjs');
70
70
 
71
71
 
72
72
 
73
- var _chunkAVXVMZ4Bcjs = require('./chunk-AVXVMZ4B.cjs');
73
+ var _chunkPMS6BMIUcjs = require('./chunk-PMS6BMIU.cjs');
74
74
 
75
75
  // src/signals.ts
76
76
  process.once("SIGINT", async (arg) => {
77
- _chunkP3B7HVFDcjs.log.call(void 0, ).info(arg, "SIGINT");
78
- await _chunkP3B7HVFDcjs.disposeAndExit.call(void 0, "EXIT");
77
+ _chunkU54EW4DXcjs.log.call(void 0, ).info(arg, "SIGINT");
78
+ await _chunkU54EW4DXcjs.disposeAndExit.call(void 0, "EXIT");
79
79
  });
80
80
  process.once("SIGTERM", async (arg) => {
81
- _chunkP3B7HVFDcjs.log.call(void 0, ).info(arg, "SIGTERM");
82
- await _chunkP3B7HVFDcjs.disposeAndExit.call(void 0, "EXIT");
81
+ _chunkU54EW4DXcjs.log.call(void 0, ).info(arg, "SIGTERM");
82
+ await _chunkU54EW4DXcjs.disposeAndExit.call(void 0, "EXIT");
83
83
  });
84
84
  process.once("uncaughtException", async (arg) => {
85
- _chunkP3B7HVFDcjs.log.call(void 0, ).error(arg, "Uncaught Exception");
86
- await _chunkP3B7HVFDcjs.disposeAndExit.call(void 0, "ERROR");
85
+ _chunkU54EW4DXcjs.log.call(void 0, ).error(arg, "Uncaught Exception");
86
+ await _chunkU54EW4DXcjs.disposeAndExit.call(void 0, "ERROR");
87
87
  });
88
88
  process.once("unhandledRejection", async (arg) => {
89
- _chunkP3B7HVFDcjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
90
- await _chunkP3B7HVFDcjs.disposeAndExit.call(void 0, "ERROR");
89
+ _chunkU54EW4DXcjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
90
+ await _chunkU54EW4DXcjs.disposeAndExit.call(void 0, "ERROR");
91
91
  });
92
92
 
93
93
  // src/act.ts
@@ -195,7 +195,7 @@ async function* audit(deps, categories, options = {}) {
195
195
  if (need_stats) {
196
196
  const stats = await deps.store().query_stats(
197
197
  {},
198
- { count: true, names: true, exclude: [_chunkAVXVMZ4Bcjs.SNAP_EVENT] }
198
+ { count: true, names: true, exclude: [_chunkPMS6BMIUcjs.SNAP_EVENT] }
199
199
  );
200
200
  for (const [stream, s] of stats) {
201
201
  for (const p of passes) _optionalChain([p, 'access', _4 => _4.on_stat, 'optionalCall', _5 => _5(stream, s)]);
@@ -277,7 +277,7 @@ var make_schema_pass = (deps) => {
277
277
  return;
278
278
  }
279
279
  const schema = state2.events[name];
280
- const sensitive2 = _chunkAVXVMZ4Bcjs.pii_fields.call(void 0, schema);
280
+ const sensitive2 = _chunkPMS6BMIUcjs.pii_fields.call(void 0, schema);
281
281
  let parse_schema = schema;
282
282
  if (sensitive2.length > 0) {
283
283
  const omitter = schema.omit;
@@ -411,7 +411,7 @@ var make_restart_candidate_pass = (deps, options) => {
411
411
  {
412
412
  stream,
413
413
  stream_exact: true,
414
- names: [_chunkAVXVMZ4Bcjs.SNAP_EVENT],
414
+ names: [_chunkPMS6BMIUcjs.SNAP_EVENT],
415
415
  with_snaps: true
416
416
  }
417
417
  );
@@ -840,7 +840,7 @@ async function run_close_cycle(targets, deps) {
840
840
  deps,
841
841
  () => run_full_closes(full, target_map, deps, skipped)
842
842
  );
843
- const retired = [...truncated.entries()].filter(([, r]) => r.committed.name === _chunkAVXVMZ4Bcjs.TOMBSTONE_EVENT).map(([stream]) => stream);
843
+ const retired = [...truncated.entries()].filter(([, r]) => r.committed.name === _chunkPMS6BMIUcjs.TOMBSTONE_EVENT).map(([stream]) => stream);
844
844
  if (retired.length) _optionalChain([deps, 'access', _42 => _42.forget_subscribed, 'optionalCall', _43 => _43(retired)]);
845
845
  for (const [stream, entry] of windowed_result) truncated.set(stream, entry);
846
846
  return { truncated, skipped };
@@ -922,7 +922,7 @@ async function run_windowed_closes(windowed, deps, skipped) {
922
922
  if (!await windowed_prune_pending(t.stream, t.before, max_id))
923
923
  return void 0;
924
924
  if (t.archive) await t.archive();
925
- const result = await _chunkP3B7HVFDcjs.store.call(void 0, ).truncate([
925
+ const result = await _chunkU54EW4DXcjs.store.call(void 0, ).truncate([
926
926
  { stream: t.stream, before: t.before, max_id }
927
927
  ]);
928
928
  return result.get(t.stream);
@@ -935,10 +935,10 @@ async function run_windowed_closes(windowed, deps, skipped) {
935
935
  async function windowed_prune_pending(stream, before, max_id) {
936
936
  let boundary_id;
937
937
  let min_id;
938
- await _chunkP3B7HVFDcjs.store.call(void 0, ).query(
938
+ await _chunkU54EW4DXcjs.store.call(void 0, ).query(
939
939
  (event) => {
940
940
  if (min_id === void 0 || event.id < min_id) min_id = event.id;
941
- if (event.name === _chunkAVXVMZ4Bcjs.SNAP_EVENT && event.created < before && (max_id === void 0 || event.id <= max_id) && (boundary_id === void 0 || event.id > boundary_id))
941
+ if (event.name === _chunkPMS6BMIUcjs.SNAP_EVENT && event.created < before && (max_id === void 0 || event.id <= max_id) && (boundary_id === void 0 || event.id > boundary_id))
942
942
  boundary_id = event.id;
943
943
  },
944
944
  { stream, stream_exact: true, with_snaps: true, after: -1 }
@@ -949,7 +949,7 @@ async function probe_min_watermarks(streams, page_size, checkpoint) {
949
949
  const min_at = /* @__PURE__ */ new Map();
950
950
  const matches = source_matcher();
951
951
  await walk_streams(
952
- _chunkP3B7HVFDcjs.store.call(void 0, ),
952
+ _chunkU54EW4DXcjs.store.call(void 0, ),
953
953
  (position) => {
954
954
  const pending = position.correlated_at === void 0 || position.at < position.correlated_at;
955
955
  const cap = pending ? position.at : Math.max(position.at, checkpoint);
@@ -977,17 +977,17 @@ function source_matcher() {
977
977
  };
978
978
  }
979
979
  async function scan_stream_heads(streams) {
980
- const stats = await _chunkP3B7HVFDcjs.store.call(void 0, ).query_stats(streams, {
981
- exclude: [_chunkAVXVMZ4Bcjs.SNAP_EVENT]
980
+ const stats = await _chunkU54EW4DXcjs.store.call(void 0, ).query_stats(streams, {
981
+ exclude: [_chunkPMS6BMIUcjs.SNAP_EVENT]
982
982
  });
983
- const domain_heads = await _chunkP3B7HVFDcjs.store.call(void 0, ).query_stats(streams, {
984
- exclude: [_chunkAVXVMZ4Bcjs.SNAP_EVENT, _chunkAVXVMZ4Bcjs.TOMBSTONE_EVENT]
983
+ const domain_heads = await _chunkU54EW4DXcjs.store.call(void 0, ).query_stats(streams, {
984
+ exclude: [_chunkPMS6BMIUcjs.SNAP_EVENT, _chunkPMS6BMIUcjs.TOMBSTONE_EVENT]
985
985
  });
986
- const true_heads = await _chunkP3B7HVFDcjs.store.call(void 0, ).query_stats(streams, {});
986
+ const true_heads = await _chunkU54EW4DXcjs.store.call(void 0, ).query_stats(streams, {});
987
987
  const out = /* @__PURE__ */ new Map();
988
988
  for (const [stream, { head }] of domain_heads) {
989
989
  const marker_head = _optionalChain([stats, 'access', _45 => _45.get, 'call', _46 => _46(stream), 'optionalAccess', _47 => _47.head]);
990
- const interrupted = _optionalChain([marker_head, 'optionalAccess', _48 => _48.name]) === _chunkAVXVMZ4Bcjs.TOMBSTONE_EVENT;
990
+ const interrupted = _optionalChain([marker_head, 'optionalAccess', _48 => _48.name]) === _chunkPMS6BMIUcjs.TOMBSTONE_EVENT;
991
991
  out.set(stream, {
992
992
  max_id: head.id,
993
993
  version: true_heads.get(stream).head.version,
@@ -1011,7 +1011,7 @@ async function partition_by_safety(stream_info, reactive, skipped, page_size, ca
1011
1011
  const matches = source_matcher();
1012
1012
  const targets = [...stream_info.keys()];
1013
1013
  await walk_streams(
1014
- _chunkP3B7HVFDcjs.store.call(void 0, ),
1014
+ _chunkU54EW4DXcjs.store.call(void 0, ),
1015
1015
  (position) => {
1016
1016
  const has_work = position.correlated_at !== void 0 && position.at < position.correlated_at;
1017
1017
  if (!has_work) return;
@@ -1077,7 +1077,7 @@ async function run_archive_callbacks(guarded, target_map) {
1077
1077
  }
1078
1078
  }
1079
1079
  async function heads_still_guarded(guarded, guard_events, skipped) {
1080
- const heads = await _chunkP3B7HVFDcjs.store.call(void 0, ).query_stats(guarded, {});
1080
+ const heads = await _chunkU54EW4DXcjs.store.call(void 0, ).query_stats(guarded, {});
1081
1081
  return guarded.filter((stream) => {
1082
1082
  if (_optionalChain([heads, 'access', _55 => _55.get, 'call', _56 => _56(stream), 'optionalAccess', _57 => _57.head, 'access', _58 => _58.id]) === guard_events.get(stream).id)
1083
1083
  return true;
@@ -1095,18 +1095,18 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
1095
1095
  meta: {
1096
1096
  correlation,
1097
1097
  causation: {
1098
- event: { id: guard.id, name: _chunkAVXVMZ4Bcjs.TOMBSTONE_EVENT, stream: guard.stream }
1098
+ event: { id: guard.id, name: _chunkPMS6BMIUcjs.TOMBSTONE_EVENT, stream: guard.stream }
1099
1099
  }
1100
1100
  }
1101
1101
  };
1102
1102
  });
1103
- const truncated = await _chunkP3B7HVFDcjs.store.call(void 0, ).truncate(trunc_targets);
1103
+ const truncated = await _chunkU54EW4DXcjs.store.call(void 0, ).truncate(trunc_targets);
1104
1104
  await Promise.all(
1105
1105
  guarded.map(async (stream) => {
1106
1106
  const entry = truncated.get(stream);
1107
1107
  const state2 = seed_states.get(stream);
1108
1108
  if (state2 && entry) {
1109
- await _chunkP3B7HVFDcjs.cache.call(void 0, ).set(stream, {
1109
+ await _chunkU54EW4DXcjs.cache.call(void 0, ).set(stream, {
1110
1110
  stream,
1111
1111
  state: state2,
1112
1112
  version: entry.committed.version,
@@ -1115,7 +1115,7 @@ async function truncate_and_warm_cache(guarded, seed_states, guard_events, corre
1115
1115
  snaps: 1
1116
1116
  });
1117
1117
  } else {
1118
- await _chunkP3B7HVFDcjs.cache.call(void 0, ).invalidate(stream);
1118
+ await _chunkU54EW4DXcjs.cache.call(void 0, ).invalidate(stream);
1119
1119
  }
1120
1120
  })
1121
1121
  );
@@ -1129,7 +1129,7 @@ var _crypto = require('crypto');
1129
1129
  function report_once(seen, key, message) {
1130
1130
  if (seen.has(key)) return;
1131
1131
  seen.add(key);
1132
- _chunkP3B7HVFDcjs.log.call(void 0, ).error(new Error(message));
1132
+ _chunkU54EW4DXcjs.log.call(void 0, ).error(new Error(message));
1133
1133
  }
1134
1134
 
1135
1135
  // src/internal/correlate-cycle.ts
@@ -1156,36 +1156,35 @@ function report_lane_conflict(seen, handler, target, kept, dropped) {
1156
1156
  }
1157
1157
  var CorrelateCycle = (_class3 = class {
1158
1158
  __init3() {this._checkpoint = -1}
1159
- __init4() {this._initialized = false}
1160
1159
  /** Lease holder id; per instance, so a restart never inherits a stale claim. */
1161
- __init5() {this._by = _crypto.randomUUID.call(void 0, )}
1160
+ __init4() {this._by = _crypto.randomUUID.call(void 0, )}
1162
1161
 
1163
1162
  /** Local expiry of the held lease (0 = none); stale only costs a duplicate scan. */
1164
- __init6() {this._lease_until = 0}
1163
+ __init5() {this._lease_until = 0}
1165
1164
  /**
1166
1165
  * Armed while `_raised` (bumped by a commit or notification) is ahead of
1167
1166
  * `_lowered` (the raise count the last short page saw). Starts armed.
1168
1167
  */
1169
- __init7() {this._raised = 1}
1170
- __init8() {this._lowered = 0}
1168
+ __init6() {this._raised = 1}
1169
+ __init7() {this._lowered = 0}
1171
1170
  /**
1172
1171
  * Bumped by a release (shutdown) and a restart (restore), so a scan or
1173
1172
  * lease reply that was out across one writes nothing.
1174
1173
  */
1175
- __init9() {this._epoch = 0}
1174
+ __init8() {this._epoch = 0}
1176
1175
 
1177
1176
  // Bounded by `maxSubscribedStreams`; static records live apart so eviction
1178
1177
  // never drops their +Infinity floor.
1179
1178
 
1180
- __init10() {this._static_subscriptions = /* @__PURE__ */ new Map()}
1181
- __init11() {this._patterns = new (0, _chunkP3B7HVFDcjs.LruMap)(PATTERN_CACHE_SIZE)}
1179
+ __init9() {this._static_subscriptions = /* @__PURE__ */ new Map()}
1180
+ __init10() {this._patterns = new (0, _chunkU54EW4DXcjs.LruMap)(PATTERN_CACHE_SIZE)}
1182
1181
 
1183
1182
 
1184
1183
 
1185
1184
 
1186
1185
 
1187
1186
  /** Report-once keys; per instance because `internal/` holds no module state. */
1188
- __init12() {this._reported = /* @__PURE__ */ new Set()}
1187
+ __init11() {this._reported = /* @__PURE__ */ new Set()}
1189
1188
  constructor({
1190
1189
  registry,
1191
1190
  static_targets,
@@ -1194,9 +1193,9 @@ var CorrelateCycle = (_class3 = class {
1194
1193
  declared_lanes,
1195
1194
  shard,
1196
1195
  on_init
1197
- }) {;_class3.prototype.__init3.call(this);_class3.prototype.__init4.call(this);_class3.prototype.__init5.call(this);_class3.prototype.__init6.call(this);_class3.prototype.__init7.call(this);_class3.prototype.__init8.call(this);_class3.prototype.__init9.call(this);_class3.prototype.__init10.call(this);_class3.prototype.__init11.call(this);_class3.prototype.__init12.call(this);
1196
+ }) {;_class3.prototype.__init3.call(this);_class3.prototype.__init4.call(this);_class3.prototype.__init5.call(this);_class3.prototype.__init6.call(this);_class3.prototype.__init7.call(this);_class3.prototype.__init8.call(this);_class3.prototype.__init9.call(this);_class3.prototype.__init10.call(this);_class3.prototype.__init11.call(this);
1198
1197
  this._key = shard ? `${registry_key(registry.events)}:${[...shard].sort().join(",")}` : registry_key(registry.events);
1199
- this._dynamic_subscriptions = new (0, _chunkP3B7HVFDcjs.LruMap)(max_subscribed_streams);
1198
+ this._dynamic_subscriptions = new (0, _chunkU54EW4DXcjs.LruMap)(max_subscribed_streams);
1200
1199
  this._registry = registry;
1201
1200
  this._declared_lanes = declared_lanes;
1202
1201
  this._static_targets = static_targets;
@@ -1210,16 +1209,12 @@ var CorrelateCycle = (_class3 = class {
1210
1209
  arm() {
1211
1210
  this._raised++;
1212
1211
  }
1213
- async init() {
1214
- if (this._initialized) return;
1215
- if (!this._init_promise) {
1216
- this._init_promise = this._run_init().catch((error) => {
1217
- this._init_promise = void 0;
1218
- throw error;
1219
- });
1220
- }
1212
+ async _init() {
1213
+ this._init_promise ??= this._run_init().catch((error) => {
1214
+ this._init_promise = void 0;
1215
+ throw error;
1216
+ });
1221
1217
  await this._init_promise;
1222
- this._initialized = true;
1223
1218
  }
1224
1219
  async _run_init() {
1225
1220
  const { watermark, correlated_at } = await this._cd.subscribe([
@@ -1237,7 +1232,6 @@ var CorrelateCycle = (_class3 = class {
1237
1232
  }
1238
1233
  /** After `restore` replaced the log: forget everything and cold-start again. */
1239
1234
  restart() {
1240
- this._initialized = false;
1241
1235
  this._init_promise = void 0;
1242
1236
  this._checkpoint = -1;
1243
1237
  this._dynamic_subscriptions.clear();
@@ -1252,7 +1246,7 @@ var CorrelateCycle = (_class3 = class {
1252
1246
  /** Would the target's own `fetch` (filtered by `source`) return this event? */
1253
1247
  _in_fetch_window(source, stream) {
1254
1248
  if (source === void 0 || source === stream) return true;
1255
- if (_chunkP3B7HVFDcjs.is_literal_source.call(void 0, source)) return false;
1249
+ if (_chunkU54EW4DXcjs.is_literal_source.call(void 0, source)) return false;
1256
1250
  let pattern = this._patterns.get(source);
1257
1251
  if (!pattern) {
1258
1252
  pattern = new RegExp(source);
@@ -1261,12 +1255,13 @@ var CorrelateCycle = (_class3 = class {
1261
1255
  return pattern.test(stream);
1262
1256
  }
1263
1257
  /** Scan past the checkpoint, subscribe new targets and raise their work marks. */
1264
- async correlate(query = { after: -1, limit: 10 }, lease = false) {
1265
- await this.init();
1258
+ async correlate(query, lease = false) {
1259
+ await this._init();
1266
1260
  const epoch = this._epoch;
1267
1261
  const idle = () => ({
1268
1262
  subscribed: 0,
1269
1263
  last_id: this._checkpoint,
1264
+ read: false,
1270
1265
  marked: 0,
1271
1266
  scanned: false
1272
1267
  });
@@ -1287,7 +1282,7 @@ var CorrelateCycle = (_class3 = class {
1287
1282
  const correlated = /* @__PURE__ */ new Map();
1288
1283
  let last_id = after;
1289
1284
  let stopped = false;
1290
- const found = await _chunkP3B7HVFDcjs.store.call(void 0, ).query(
1285
+ const found = await _chunkU54EW4DXcjs.store.call(void 0, ).query(
1291
1286
  (event) => {
1292
1287
  if (stopped) return;
1293
1288
  const register = this._registry.events[event.name];
@@ -1331,9 +1326,9 @@ var CorrelateCycle = (_class3 = class {
1331
1326
  correlated_at: void 0
1332
1327
  };
1333
1328
  const seen_in_scan = correlated.has(resolved.target);
1334
- const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _61 => _61.lane])), () => ( _chunkAVXVMZ4Bcjs.DEFAULT_LANE));
1329
+ const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _61 => _61.lane])), () => ( _chunkPMS6BMIUcjs.DEFAULT_LANE));
1335
1330
  const held_priority = seen_in_scan ? entry.priority : _optionalChain([recorded, 'optionalAccess', _62 => _62.priority]);
1336
- const resolved_lane = _nullishCoalesce(lane, () => ( _chunkAVXVMZ4Bcjs.DEFAULT_LANE));
1331
+ const resolved_lane = _nullishCoalesce(lane, () => ( _chunkPMS6BMIUcjs.DEFAULT_LANE));
1337
1332
  if (held_priority === priority && held_lane !== resolved_lane)
1338
1333
  report_lane_conflict(
1339
1334
  this._reported,
@@ -1360,6 +1355,7 @@ var CorrelateCycle = (_class3 = class {
1360
1355
  { ...query, after, with_pii: false }
1361
1356
  );
1362
1357
  if (this._declared_lanes.size > 1) await this._recall(correlated);
1358
+ const read = last_id > after;
1363
1359
  if (this._epoch !== epoch) return idle();
1364
1360
  const streams = [];
1365
1361
  for (const [stream, entry] of correlated) {
@@ -1393,11 +1389,11 @@ var CorrelateCycle = (_class3 = class {
1393
1389
  lane
1394
1390
  });
1395
1391
  }
1396
- return { subscribed, last_id, marked, scanned: true };
1392
+ return { subscribed, last_id, read, marked, scanned: true };
1397
1393
  }
1398
1394
  this._checkpoint = last_id;
1399
1395
  if (!stopped && found !== query.limit) this._lowered = raised;
1400
- return { subscribed: 0, last_id, marked: 0, scanned: true };
1396
+ return { subscribed: 0, last_id, read, marked: 0, scanned: true };
1401
1397
  }
1402
1398
  /**
1403
1399
  * Read the row of each target this scan had no record of (new or evicted),
@@ -1409,7 +1405,7 @@ var CorrelateCycle = (_class3 = class {
1409
1405
  await Promise.all(
1410
1406
  missed.map(async ([stream, entry]) => {
1411
1407
  let row;
1412
- await _chunkP3B7HVFDcjs.store.call(void 0, ).query_streams(
1408
+ await _chunkU54EW4DXcjs.store.call(void 0, ).query_streams(
1413
1409
  (position) => {
1414
1410
  row = position;
1415
1411
  },
@@ -1422,8 +1418,8 @@ var CorrelateCycle = (_class3 = class {
1422
1418
  lane: row.lane
1423
1419
  });
1424
1420
  if (entry.priority > row.priority) return;
1425
- const held_lane = _nullishCoalesce(row.lane, () => ( _chunkAVXVMZ4Bcjs.DEFAULT_LANE));
1426
- const resolved_lane = _nullishCoalesce(entry.lane, () => ( _chunkAVXVMZ4Bcjs.DEFAULT_LANE));
1421
+ const held_lane = _nullishCoalesce(row.lane, () => ( _chunkPMS6BMIUcjs.DEFAULT_LANE));
1422
+ const resolved_lane = _nullishCoalesce(entry.lane, () => ( _chunkPMS6BMIUcjs.DEFAULT_LANE));
1427
1423
  if (entry.priority === row.priority && held_lane !== resolved_lane)
1428
1424
  report_lane_conflict(
1429
1425
  this._reported,
@@ -1449,7 +1445,7 @@ var CorrelateCycle = (_class3 = class {
1449
1445
  millis: 0
1450
1446
  });
1451
1447
  } catch (error) {
1452
- _chunkP3B7HVFDcjs.log.call(void 0, ).warn(
1448
+ _chunkU54EW4DXcjs.log.call(void 0, ).warn(
1453
1449
  `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(error)}`
1454
1450
  );
1455
1451
  }
@@ -1511,14 +1507,14 @@ function compute_backoff_delay(retry, opts) {
1511
1507
  // src/internal/defer-timer.ts
1512
1508
  var MAX_TIMER_DELAY_MS = 2147483647;
1513
1509
  var DeferTimer = (_class4 = class {
1514
- __init13() {this._due = /* @__PURE__ */ new Map()}
1510
+ __init12() {this._due = /* @__PURE__ */ new Map()}
1515
1511
 
1516
1512
 
1517
1513
  /**
1518
1514
  * @param on_wake - invoked once each time the earliest due-time elapses.
1519
1515
  * The consumer re-schedules for whatever is still parked.
1520
1516
  */
1521
- constructor(on_wake) {;_class4.prototype.__init13.call(this);
1517
+ constructor(on_wake) {;_class4.prototype.__init12.call(this);
1522
1518
  this._on_wake = on_wake;
1523
1519
  }
1524
1520
  /** Number of currently parked streams. */
@@ -1602,14 +1598,14 @@ function compute_lag_lead_ratio(handled, lagging, leading) {
1602
1598
  }
1603
1599
 
1604
1600
  // src/internal/drain-ops.ts
1605
- var claim = (lagging, leading, by, millis, lane) => _chunkP3B7HVFDcjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane);
1601
+ var claim = (lagging, leading, by, millis, lane) => _chunkU54EW4DXcjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane);
1606
1602
  async function fetch(leased, eventLimit) {
1607
1603
  return Promise.all(
1608
1604
  leased.map(async ({ stream, source, at, lagging }) => {
1609
1605
  const events = [];
1610
- const stream_exact = source !== void 0 && _chunkP3B7HVFDcjs.is_literal_source.call(void 0, source) ? true : void 0;
1606
+ const stream_exact = source !== void 0 && _chunkU54EW4DXcjs.is_literal_source.call(void 0, source) ? true : void 0;
1611
1607
  try {
1612
- await _chunkP3B7HVFDcjs.store.call(void 0, ).query((e) => events.push(e), {
1608
+ await _chunkU54EW4DXcjs.store.call(void 0, ).query((e) => events.push(e), {
1613
1609
  stream: source,
1614
1610
  stream_exact,
1615
1611
  after: at,
@@ -1629,30 +1625,30 @@ async function fetch(leased, eventLimit) {
1629
1625
  })
1630
1626
  );
1631
1627
  }
1632
- var ack = (leases) => _chunkP3B7HVFDcjs.store.call(void 0, ).ack(leases);
1633
- var block = (leases) => _chunkP3B7HVFDcjs.store.call(void 0, ).block(leases);
1634
- var subscribe = (streams, correlated_at, correlator) => _chunkP3B7HVFDcjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator);
1628
+ var ack = (leases) => _chunkU54EW4DXcjs.store.call(void 0, ).ack(leases);
1629
+ var block = (leases) => _chunkU54EW4DXcjs.store.call(void 0, ).block(leases);
1630
+ var subscribe = (streams, correlated_at, correlator) => _chunkU54EW4DXcjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator);
1635
1631
 
1636
1632
  // src/internal/event-sourcing.ts
1637
1633
  var _actpatch = require('@rotorsoft/act-patch');
1638
1634
  var bare_patch = (_me, state2, partial) => _actpatch.patch.call(void 0, state2, partial);
1639
1635
  var validating_patch = (me, state2, partial, event) => {
1640
1636
  const next = _actpatch.patch.call(void 0, state2, partial);
1641
- return _chunkP3B7HVFDcjs.validate.call(void 0,
1637
+ return _chunkU54EW4DXcjs.validate.call(void 0,
1642
1638
  `${me.name}.${String(event.name)}#${event.id}`,
1643
1639
  next,
1644
1640
  me.state
1645
1641
  );
1646
1642
  };
1647
1643
  var DEFAULT_BATCH = 500;
1648
- var cache_put = (stream, entry) => _chunkP3B7HVFDcjs.cache.call(void 0, ).set(stream, entry).catch(
1649
- (err) => _chunkP3B7HVFDcjs.log.call(void 0, ).warn(
1644
+ var cache_put = (stream, entry) => _chunkU54EW4DXcjs.cache.call(void 0, ).set(stream, entry).catch(
1645
+ (err) => _chunkU54EW4DXcjs.log.call(void 0, ).warn(
1650
1646
  err,
1651
1647
  "cache set skipped; the next load re-folds from the store"
1652
1648
  )
1653
1649
  );
1654
- var cache_drop = (stream) => _chunkP3B7HVFDcjs.cache.call(void 0, ).invalidate(stream).catch(
1655
- (err) => _chunkP3B7HVFDcjs.log.call(void 0, ).warn(
1650
+ var cache_drop = (stream) => _chunkU54EW4DXcjs.cache.call(void 0, ).invalidate(stream).catch(
1651
+ (err) => _chunkU54EW4DXcjs.log.call(void 0, ).warn(
1656
1652
  err,
1657
1653
  "cache invalidate skipped; a stale checkpoint re-folds from its event_id"
1658
1654
  )
@@ -1660,9 +1656,9 @@ var cache_drop = (stream) => _chunkP3B7HVFDcjs.cache.call(void 0, ).invalidate(s
1660
1656
  async function snap(snapshot) {
1661
1657
  const { id, stream, name, meta, version } = snapshot.event;
1662
1658
  try {
1663
- const [committed] = await _chunkP3B7HVFDcjs.store.call(void 0, ).commit(
1659
+ const [committed] = await _chunkU54EW4DXcjs.store.call(void 0, ).commit(
1664
1660
  stream,
1665
- [{ name: _chunkAVXVMZ4Bcjs.SNAP_EVENT, data: snapshot.state }],
1661
+ [{ name: _chunkPMS6BMIUcjs.SNAP_EVENT, data: snapshot.state }],
1666
1662
  {
1667
1663
  correlation: meta.correlation,
1668
1664
  causation: { event: { id, name, stream } }
@@ -1673,22 +1669,22 @@ async function snap(snapshot) {
1673
1669
  return committed;
1674
1670
  } catch (error) {
1675
1671
  const reason = error instanceof Error ? error.message : String(error);
1676
- _chunkP3B7HVFDcjs.log.call(void 0, ).warn(
1672
+ _chunkU54EW4DXcjs.log.call(void 0, ).warn(
1677
1673
  `Snapshot write failed on stream "${stream}": ${reason} \u2014 cold starts will replay full history until snapshots succeed.`
1678
1674
  );
1679
1675
  }
1680
1676
  }
1681
1677
  async function tombstone(stream, expectedVersion, correlation) {
1682
1678
  try {
1683
- const [committed] = await _chunkP3B7HVFDcjs.store.call(void 0, ).commit(
1679
+ const [committed] = await _chunkU54EW4DXcjs.store.call(void 0, ).commit(
1684
1680
  stream,
1685
- [{ name: _chunkAVXVMZ4Bcjs.TOMBSTONE_EVENT, data: {} }],
1681
+ [{ name: _chunkPMS6BMIUcjs.TOMBSTONE_EVENT, data: {} }],
1686
1682
  { correlation, causation: {} },
1687
1683
  expectedVersion
1688
1684
  );
1689
1685
  return committed;
1690
1686
  } catch (error) {
1691
- if (error instanceof _chunkAVXVMZ4Bcjs.ConcurrencyError) return void 0;
1687
+ if (error instanceof _chunkPMS6BMIUcjs.ConcurrencyError) return void 0;
1692
1688
  throw error;
1693
1689
  }
1694
1690
  }
@@ -1718,9 +1714,9 @@ async function scan(source, opts = {}, callback) {
1718
1714
  if (drop_closed_streams) {
1719
1715
  await source.query(
1720
1716
  (e) => {
1721
- if (e.name === _chunkAVXVMZ4Bcjs.TOMBSTONE_EVENT) closed_streams.add(e.stream);
1717
+ if (e.name === _chunkPMS6BMIUcjs.TOMBSTONE_EVENT) closed_streams.add(e.stream);
1722
1718
  },
1723
- { names: [_chunkAVXVMZ4Bcjs.TOMBSTONE_EVENT] }
1719
+ { names: [_chunkPMS6BMIUcjs.TOMBSTONE_EVENT] }
1724
1720
  );
1725
1721
  }
1726
1722
  let max_id;
@@ -1742,11 +1738,11 @@ async function scan(source, opts = {}, callback) {
1742
1738
  if (!is_valid(event))
1743
1739
  throw new Error(`Invalid event at index ${processed}`);
1744
1740
  if (on_progress) on_progress({ processed, id: event.id, max_id });
1745
- if (drop_snapshots && event.name === _chunkAVXVMZ4Bcjs.SNAP_EVENT) {
1741
+ if (drop_snapshots && event.name === _chunkPMS6BMIUcjs.SNAP_EVENT) {
1746
1742
  dropped_snaps++;
1747
1743
  return;
1748
1744
  }
1749
- if (closed_streams.has(event.stream) && event.name !== _chunkAVXVMZ4Bcjs.TOMBSTONE_EVENT) {
1745
+ if (closed_streams.has(event.stream) && event.name !== _chunkPMS6BMIUcjs.TOMBSTONE_EVENT) {
1750
1746
  dropped_closed++;
1751
1747
  return;
1752
1748
  }
@@ -1813,17 +1809,17 @@ async function scan(source, opts = {}, callback) {
1813
1809
  async function load(me, target, callback, patch_fn = bare_patch) {
1814
1810
  const { stream, actor, asOf } = target;
1815
1811
  const time_travel = !!asOf && Object.values(asOf).some((v) => v !== void 0);
1816
- const cached = time_travel ? void 0 : await _chunkP3B7HVFDcjs.cache.call(void 0, ).get(stream);
1812
+ const cached = time_travel ? void 0 : await _chunkU54EW4DXcjs.cache.call(void 0, ).get(stream);
1817
1813
  const cache_hit = !!cached;
1818
1814
  let state2 = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _72 => _72.state]), () => ( (me.init ? me.init() : {})));
1819
1815
  let patches = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _73 => _73.patches]), () => ( 0));
1820
1816
  let snaps = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _74 => _74.snaps]), () => ( 0));
1821
1817
  let replayed = 0;
1822
1818
  let event;
1823
- await _chunkP3B7HVFDcjs.store.call(void 0, ).query(
1819
+ await _chunkU54EW4DXcjs.store.call(void 0, ).query(
1824
1820
  (raw) => {
1825
1821
  event = me.view(raw, actor);
1826
- if (event.name === _chunkAVXVMZ4Bcjs.SNAP_EVENT) {
1822
+ if (event.name === _chunkPMS6BMIUcjs.SNAP_EVENT) {
1827
1823
  state2 = event.data;
1828
1824
  snaps++;
1829
1825
  patches = 0;
@@ -1832,8 +1828,8 @@ async function load(me, target, callback, patch_fn = bare_patch) {
1832
1828
  state2 = patch_fn(me, state2, me.patch[event.name](event, state2), event);
1833
1829
  patches++;
1834
1830
  replayed++;
1835
- } else if (event.name !== _chunkAVXVMZ4Bcjs.TOMBSTONE_EVENT) {
1836
- _chunkP3B7HVFDcjs.log.call(void 0, ).warn(
1831
+ } else if (event.name !== _chunkPMS6BMIUcjs.TOMBSTONE_EVENT) {
1832
+ _chunkU54EW4DXcjs.log.call(void 0, ).warn(
1837
1833
  `Skipping unknown event "${String(event.name)}" on stream "${stream}" (id=${event.id}) \u2014 no reducer in state "${me.name}"`
1838
1834
  );
1839
1835
  }
@@ -1857,7 +1853,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
1857
1853
  ...cached ? { after: cached.event_id, with_snaps: true } : { ...time_travel ? {} : { with_snaps: true }, ...asOf }
1858
1854
  }
1859
1855
  );
1860
- const head_is_tombstone = _optionalChain([event, 'optionalAccess', _76 => _76.name]) === _chunkAVXVMZ4Bcjs.TOMBSTONE_EVENT;
1856
+ const head_is_tombstone = _optionalChain([event, 'optionalAccess', _76 => _76.name]) === _chunkPMS6BMIUcjs.TOMBSTONE_EVENT;
1861
1857
  if (replayed > 0 && !time_travel && event && !me.pii_aware && !head_is_tombstone) {
1862
1858
  await cache_put(stream, {
1863
1859
  stream,
@@ -1885,7 +1881,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1885
1881
  if (!stream) throw new Error("Missing target stream");
1886
1882
  const reactingTo = _optionalChain([options, 'optionalAccess', _81 => _81.reactingTo]);
1887
1883
  const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _82 => _82.correlator]), () => ( default_correlator));
1888
- const validated = _chunkP3B7HVFDcjs.validate.call(void 0, action2, payload, me.actions[action2]);
1884
+ const validated = _chunkU54EW4DXcjs.validate.call(void 0, action2, payload, me.actions[action2]);
1889
1885
  const opts = _optionalChain([me, 'access', _83 => _83.options, 'optionalAccess', _84 => _84[action2]]);
1890
1886
  const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _85 => _85.maxRetries]), () => ( 0));
1891
1887
  for (let attempt = 0; ; attempt++) {
@@ -1896,14 +1892,14 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1896
1892
  void 0,
1897
1893
  patch_fn
1898
1894
  );
1899
- if (_optionalChain([snapshot, 'access', _86 => _86.event, 'optionalAccess', _87 => _87.name]) === _chunkAVXVMZ4Bcjs.TOMBSTONE_EVENT)
1900
- throw new (0, _chunkAVXVMZ4Bcjs.StreamClosedError)(stream);
1895
+ if (_optionalChain([snapshot, 'access', _86 => _86.event, 'optionalAccess', _87 => _87.name]) === _chunkPMS6BMIUcjs.TOMBSTONE_EVENT)
1896
+ throw new (0, _chunkPMS6BMIUcjs.StreamClosedError)(stream);
1901
1897
  const expected = _nullishCoalesce(expectedVersion, () => ( (snapshot.version >= 0 ? snapshot.version : void 0)));
1902
1898
  if (me.given) {
1903
1899
  const invariants = me.given[action2] || [];
1904
1900
  invariants.forEach(({ valid: valid2, description }) => {
1905
1901
  if (!valid2(snapshot.state, actor))
1906
- throw new (0, _chunkAVXVMZ4Bcjs.InvariantError)(
1902
+ throw new (0, _chunkPMS6BMIUcjs.InvariantError)(
1907
1903
  action2,
1908
1904
  validated,
1909
1905
  target,
@@ -1920,7 +1916,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1920
1916
  const tuples = Array.isArray(result[0]) ? result : [result];
1921
1917
  const valid = tuples.map(([name, data]) => ({
1922
1918
  name,
1923
- data: _chunkP3B7HVFDcjs.validate.call(void 0, name, data, me.events[name])
1919
+ data: _chunkU54EW4DXcjs.validate.call(void 0, name, data, me.events[name])
1924
1920
  }));
1925
1921
  const emitted = valid.map((e) => me.message(e));
1926
1922
  const meta = {
@@ -1945,7 +1941,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1945
1941
  };
1946
1942
  let committed;
1947
1943
  try {
1948
- committed = await _chunkP3B7HVFDcjs.store.call(void 0, ).commit(
1944
+ committed = await _chunkU54EW4DXcjs.store.call(void 0, ).commit(
1949
1945
  stream,
1950
1946
  emitted,
1951
1947
  meta,
@@ -1954,7 +1950,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1954
1950
  reactingTo ? expectedVersion : expected
1955
1951
  );
1956
1952
  } catch (error) {
1957
- if (error instanceof _chunkAVXVMZ4Bcjs.ConcurrencyError) void cache_drop(stream);
1953
+ if (error instanceof _chunkPMS6BMIUcjs.ConcurrencyError) void cache_drop(stream);
1958
1954
  throw error;
1959
1955
  }
1960
1956
  let { state: state2, patches } = snapshot;
@@ -1993,19 +1989,19 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1993
1989
  }
1994
1990
  return snapshots;
1995
1991
  } catch (error) {
1996
- if (!(error instanceof _chunkAVXVMZ4Bcjs.ConcurrencyError)) throw error;
1992
+ if (!(error instanceof _chunkPMS6BMIUcjs.ConcurrencyError)) throw error;
1997
1993
  if (expectedVersion !== void 0) throw error;
1998
1994
  if (attempt >= max_retries) throw error;
1999
1995
  if (_optionalChain([opts, 'optionalAccess', _94 => _94.backoff])) {
2000
1996
  const delay_ms = compute_backoff_delay(attempt, opts.backoff);
2001
- if (delay_ms > 0) await _chunkP3B7HVFDcjs.sleep.call(void 0, delay_ms);
1997
+ if (delay_ms > 0) await _chunkU54EW4DXcjs.sleep.call(void 0, delay_ms);
2002
1998
  }
2003
1999
  }
2004
2000
  }
2005
2001
  }
2006
2002
 
2007
2003
  // src/internal/tracing.ts
2008
- var PRETTY = _chunkP3B7HVFDcjs.config.call(void 0, ).env !== "production";
2004
+ var PRETTY = _chunkU54EW4DXcjs.config.call(void 0, ).env !== "production";
2009
2005
  var C_BLUE = "\x1B[38;5;39m";
2010
2006
  var C_ORANGE = "\x1B[38;5;208m";
2011
2007
  var C_GREEN = "\x1B[38;5;42m";
@@ -2191,7 +2187,7 @@ function budget_exhausted(lease, options, store_failing) {
2191
2187
  if (store_failing || !_optionalChain([options, 'optionalAccess', _104 => _104.blockOnError]) || lease.retry <= options.maxRetries)
2192
2188
  return void 0;
2193
2189
  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.`;
2194
- _chunkP3B7HVFDcjs.log.call(void 0, ).error(error);
2190
+ _chunkU54EW4DXcjs.log.call(void 0, ).error(error);
2195
2191
  return { lease, handled: 0, acked_at: lease.at, error, block: true };
2196
2192
  }
2197
2193
  function fetch_failure_policy(registry) {
@@ -2207,13 +2203,13 @@ function fetch_failure_policy(registry) {
2207
2203
  function finalize(lease, handled, at, error, options, logger, failed_at) {
2208
2204
  if (!error) return { lease, handled, acked_at: at };
2209
2205
  logger.error(error);
2210
- const non_retryable = error instanceof _chunkAVXVMZ4Bcjs.NonRetryableError;
2206
+ const non_retryable = error instanceof _chunkPMS6BMIUcjs.NonRetryableError;
2211
2207
  const block2 = options.blockOnError && (non_retryable || lease.retry >= options.maxRetries);
2212
2208
  if (block2)
2213
2209
  logger.error(
2214
2210
  non_retryable ? `Blocking ${lease.stream} on non-retryable error.` : `Blocking ${lease.stream} after ${lease.retry} retries.`
2215
2211
  );
2216
- const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkP3B7HVFDcjs.DEFAULT_BACKOFF)));
2212
+ const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkU54EW4DXcjs.DEFAULT_BACKOFF)));
2217
2213
  return {
2218
2214
  lease,
2219
2215
  handled,
@@ -2342,7 +2338,7 @@ async function run_drain_cycle(deps, cycle) {
2342
2338
  const acked = await ops.ack(submitted);
2343
2339
  const expected = submitted.filter((l) => l.due === void 0).length;
2344
2340
  if (acked.length < expected)
2345
- _chunkP3B7HVFDcjs.log.call(void 0, ).warn(
2341
+ _chunkU54EW4DXcjs.log.call(void 0, ).warn(
2346
2342
  `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.`
2347
2343
  );
2348
2344
  const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
@@ -2354,6 +2350,14 @@ var EMPTY_DRAIN = {
2354
2350
  acked: [],
2355
2351
  blocked: []
2356
2352
  };
2353
+ function merge_drains(drains) {
2354
+ return {
2355
+ fetched: drains.flatMap((d) => d.fetched),
2356
+ leased: drains.flatMap((d) => d.leased),
2357
+ acked: drains.flatMap((d) => d.acked),
2358
+ blocked: drains.flatMap((d) => d.blocked)
2359
+ };
2360
+ }
2357
2361
  var RETRY = "";
2358
2362
  var DrainController = (_class5 = class {
2359
2363
  /**
@@ -2361,9 +2365,9 @@ var DrainController = (_class5 = class {
2361
2365
  * empty claim saw), so a claim never lowers over a raise that landed
2362
2366
  * during it.
2363
2367
  */
2364
- __init14() {this._raised = 0}
2365
- __init15() {this._lowered = 0}
2366
- __init16() {this._ratio = 0.5}
2368
+ __init13() {this._raised = 0}
2369
+ __init14() {this._lowered = 0}
2370
+ __init15() {this._ratio = 0.5}
2367
2371
  /**
2368
2372
  * Local wake at the earliest parked (backoff or defer) visit, or at the
2369
2373
  * lease expiry after a failed pass (the {@link RETRY} key); the schedule
@@ -2371,20 +2375,19 @@ var DrainController = (_class5 = class {
2371
2375
  * drains until a pass leases nothing or the controller stops, and an entry
2372
2376
  * stays until handled or until a later pass claims nothing.
2373
2377
  */
2374
- __init17() {this._defer = new DeferTimer(() => {
2378
+ __init16() {this._defer = new DeferTimer(() => {
2375
2379
  this.arm();
2376
2380
  void this._deps.run_scoped(async () => {
2377
2381
  while ((await this.drain()).leased.length > 0) ;
2378
2382
  });
2379
2383
  })}
2380
2384
 
2381
- __init18() {this._misrouted = /* @__PURE__ */ new Set()}
2382
- __init19() {this._stopped = false}
2383
- /** Never rejects; graceful shutdown waits on it. */
2384
-
2385
+ __init17() {this._misrouted = /* @__PURE__ */ new Set()}
2386
+ __init18() {this._stopped = false}
2387
+ /** The pass in flight. Never rejects; graceful shutdown waits on it. */
2385
2388
 
2386
2389
 
2387
- constructor(deps) {;_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);
2390
+ constructor(deps) {;_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);
2388
2391
  this._deps = deps;
2389
2392
  }
2390
2393
  arm() {
@@ -2433,15 +2436,22 @@ var DrainController = (_class5 = class {
2433
2436
  if (!this.armed || this._stopped || this._inflight)
2434
2437
  return EMPTY_DRAIN;
2435
2438
  const d = _nullishCoalesce(this._deps.defaults, () => ( {}));
2436
- const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkP3B7HVFDcjs.DEFAULT_STREAM_LIMIT));
2437
- const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkP3B7HVFDcjs.DEFAULT_EVENT_LIMIT));
2438
- const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkP3B7HVFDcjs.DEFAULT_LEASE_MILLIS));
2439
+ const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkU54EW4DXcjs.DEFAULT_STREAM_LIMIT));
2440
+ const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkU54EW4DXcjs.DEFAULT_EVENT_LIMIT));
2441
+ const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkU54EW4DXcjs.DEFAULT_LEASE_MILLIS));
2439
2442
  if (this._deps.breaker.state(Date.now()) === "open")
2440
2443
  return EMPTY_DRAIN;
2444
+ const pass = this._pass(streamLimit, eventLimit, leaseMillis).finally(
2445
+ () => {
2446
+ this._inflight = void 0;
2447
+ }
2448
+ );
2449
+ this._inflight = pass;
2450
+ return pass;
2451
+ }
2452
+ /** One claim → fetch → handle → ack pass. Never throws. */
2453
+ async _pass(streamLimit, eventLimit, leaseMillis) {
2441
2454
  try {
2442
- this._inflight = new Promise((done) => {
2443
- this._inflight_done = done;
2444
- });
2445
2455
  const lagging = Math.ceil(streamLimit * this._ratio);
2446
2456
  const leading = streamLimit - lagging;
2447
2457
  const started = Date.now();
@@ -2482,9 +2492,6 @@ var DrainController = (_class5 = class {
2482
2492
  return EMPTY_DRAIN;
2483
2493
  } finally {
2484
2494
  if (!this._stopped) this._defer.schedule();
2485
- this._inflight = void 0;
2486
- _optionalChain([this, 'access', _118 => _118._inflight_done, 'optionalCall', _119 => _119()]);
2487
- this._inflight_done = void 0;
2488
2495
  }
2489
2496
  }
2490
2497
  }, _class5);
@@ -2506,7 +2513,7 @@ function pii_gate(event, fields, predicate, actor) {
2506
2513
  const { pii, ...rest } = event;
2507
2514
  if (pii == null) {
2508
2515
  const shredded = { ...data };
2509
- for (const f of fields) shredded[f] = _chunkAVXVMZ4Bcjs.SHREDDED;
2516
+ for (const f of fields) shredded[f] = _chunkPMS6BMIUcjs.SHREDDED;
2510
2517
  return { ...rest, data: shredded };
2511
2518
  }
2512
2519
  const allowed = !!actor && !!predicate && predicate(event, actor);
@@ -2517,7 +2524,7 @@ function pii_gate(event, fields, predicate, actor) {
2517
2524
  };
2518
2525
  }
2519
2526
  const redacted = { ...data };
2520
- for (const f of fields) redacted[f] = _chunkAVXVMZ4Bcjs.REDACTED;
2527
+ for (const f of fields) redacted[f] = _chunkPMS6BMIUcjs.REDACTED;
2521
2528
  return { ...rest, data: redacted };
2522
2529
  }
2523
2530
  var IDENTITY_GATE = (event) => event;
@@ -2654,7 +2661,7 @@ function make_deferred(handler, schedule) {
2654
2661
  const call = handler;
2655
2662
  const deferred = async (event, stream, app) => {
2656
2663
  const when = typeof schedule === "function" ? schedule(event) : schedule;
2657
- if (Date.now() < resolve_defer_at(when, event)) throw new (0, _chunkAVXVMZ4Bcjs.DeferSignal)(when);
2664
+ if (Date.now() < resolve_defer_at(when, event)) throw new (0, _chunkPMS6BMIUcjs.DeferSignal)(when);
2658
2665
  return call(event, stream, app);
2659
2666
  };
2660
2667
  Object.defineProperty(deferred, "name", { value: handler.name });
@@ -2690,10 +2697,10 @@ var CloseSignal = class extends Error {
2690
2697
  constructor(opts) {
2691
2698
  super("reaction requested close");
2692
2699
  this.name = "CloseSignal";
2693
- this.stream = _optionalChain([opts, 'optionalAccess', _120 => _120.stream]);
2694
- this.archive = _optionalChain([opts, 'optionalAccess', _121 => _121.archive]);
2695
- this.at = _optionalChain([opts, 'optionalAccess', _122 => _122.at]);
2696
- this.before = _optionalChain([opts, 'optionalAccess', _123 => _123.before]);
2700
+ this.stream = _optionalChain([opts, 'optionalAccess', _118 => _118.stream]);
2701
+ this.archive = _optionalChain([opts, 'optionalAccess', _119 => _119.archive]);
2702
+ this.at = _optionalChain([opts, 'optionalAccess', _120 => _120.at]);
2703
+ this.before = _optionalChain([opts, 'optionalAccess', _121 => _121.before]);
2697
2704
  }
2698
2705
  };
2699
2706
  function build_handle(deps) {
@@ -2723,7 +2730,7 @@ function build_handle(deps) {
2723
2730
  handled++;
2724
2731
  }
2725
2732
  } catch (error) {
2726
- if (error instanceof _chunkAVXVMZ4Bcjs.DeferSignal) {
2733
+ if (error instanceof _chunkPMS6BMIUcjs.DeferSignal) {
2727
2734
  let defer;
2728
2735
  try {
2729
2736
  defer = resolve_defer_at(error.when, event);
@@ -2802,24 +2809,24 @@ function build_handle_batch(logger) {
2802
2809
 
2803
2810
  // src/internal/settle.ts
2804
2811
  var SettleLoop = (_class6 = class {
2805
- __init20() {this._timer = void 0}
2812
+ __init19() {this._timer = void 0}
2806
2813
  /**
2807
2814
  * The cycle in flight, set while one runs. Shutdown waits for it
2808
2815
  * (`stop()` cancels scheduling only). Never rejects.
2809
2816
  */
2810
2817
 
2811
2818
  /** A wake-up arrived while a cycle ran: run one more pass after it. */
2812
- __init21() {this._pending = false}
2819
+ __init20() {this._pending = false}
2813
2820
  /** The last caller's options, used by the next pass. */
2814
- __init22() {this._next = void 0}
2821
+ __init21() {this._next = void 0}
2815
2822
  /** When the scheduled pass fires (epoch ms). */
2816
- __init23() {this._due = 0}
2823
+ __init22() {this._due = 0}
2817
2824
  /** Set at shutdown: nothing schedules again. */
2818
- __init24() {this._stopped = false}
2825
+ __init23() {this._stopped = false}
2819
2826
 
2820
2827
  /** Debounce window applied when the caller doesn't override via `SettleOptions.debounceMs`. */
2821
2828
 
2822
- constructor(deps, default_debounce_ms) {;_class6.prototype.__init20.call(this);_class6.prototype.__init21.call(this);_class6.prototype.__init22.call(this);_class6.prototype.__init23.call(this);_class6.prototype.__init24.call(this);
2829
+ constructor(deps, default_debounce_ms) {;_class6.prototype.__init19.call(this);_class6.prototype.__init20.call(this);_class6.prototype.__init21.call(this);_class6.prototype.__init22.call(this);_class6.prototype.__init23.call(this);
2823
2830
  this._deps = deps;
2824
2831
  this._default_debounce_ms = default_debounce_ms;
2825
2832
  }
@@ -2841,7 +2848,7 @@ var SettleLoop = (_class6 = class {
2841
2848
  this._pending = true;
2842
2849
  return;
2843
2850
  }
2844
- const delay = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _124 => _124.debounceMs]), () => ( this._default_debounce_ms));
2851
+ const delay = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _122 => _122.debounceMs]), () => ( this._default_debounce_ms));
2845
2852
  const due = Date.now() + delay;
2846
2853
  if (this._timer) {
2847
2854
  if (due >= this._due) return;
@@ -2852,32 +2859,23 @@ var SettleLoop = (_class6 = class {
2852
2859
  this._timer = void 0;
2853
2860
  const {
2854
2861
  debounceMs: _,
2855
- correlate: correlate_query = {},
2862
+ // Every pass scans from correlation's own checkpoint.
2863
+ correlate: { after: _after, ...correlate_query } = {},
2856
2864
  maxPasses = Infinity,
2857
2865
  ...drain_options
2858
2866
  } = _nullishCoalesce(this._next, () => ( {}));
2859
2867
  this._next = void 0;
2860
2868
  this._inflight = (async () => {
2861
- await this._deps.init();
2862
- let settled_drain;
2869
+ const passes = [];
2863
2870
  for (let i = 0; i < maxPasses && !this._stopped; i++) {
2864
- const after_before = this._deps.checkpoint();
2865
- const { subscribed, last_id, scanned } = await this._deps.correlate({
2866
- ...correlate_query,
2867
- after: after_before
2868
- });
2871
+ const { subscribed, read, scanned } = await this._deps.correlate(correlate_query);
2869
2872
  if (scanned) this._deps.breaker.passed();
2870
2873
  const drain = await this._deps.drain(drain_options);
2871
- settled_drain = settled_drain ? {
2872
- fetched: [...settled_drain.fetched, ...drain.fetched],
2873
- leased: [...settled_drain.leased, ...drain.leased],
2874
- acked: [...settled_drain.acked, ...drain.acked],
2875
- blocked: [...settled_drain.blocked, ...drain.blocked]
2876
- } : drain;
2877
- const made_progress = subscribed > 0 || drain.leased.length > 0 || last_id > after_before;
2874
+ passes.push(drain);
2875
+ const made_progress = subscribed > 0 || drain.leased.length > 0 || read;
2878
2876
  if (!made_progress) break;
2879
2877
  }
2880
- if (settled_drain) this._deps.on_settled(settled_drain);
2878
+ if (passes.length) this._deps.on_settled(merge_drains(passes));
2881
2879
  })().catch((err) => {
2882
2880
  this._deps.breaker.failed(Date.now(), err);
2883
2881
  }).finally(() => {
@@ -2923,7 +2921,7 @@ function validate_only_lanes(options, lanes) {
2923
2921
  );
2924
2922
  }
2925
2923
  var Act = (_class7 = class {
2926
- __init25() {this._emitter = new (0, _events2.default)()}
2924
+ __init24() {this._emitter = new (0, _events2.default)()}
2927
2925
 
2928
2926
 
2929
2927
 
@@ -2999,14 +2997,14 @@ var Act = (_class7 = class {
2999
2997
  /** Lanes to arm per event; `"all"` when a dynamic resolver hides the lane. */
3000
2998
 
3001
2999
 
3002
- __init26() {this._logger = _chunkP3B7HVFDcjs.log.call(void 0, )}
3000
+ __init25() {this._logger = _chunkU54EW4DXcjs.log.call(void 0, )}
3003
3001
  /** This Act's ports: its own bag, or the singleton adapters. */
3004
3002
 
3005
3003
  /** Runs a body so internal `store()`/`cache()` calls resolve to `_ports`. */
3006
3004
 
3007
3005
 
3008
3006
 
3009
- __init27() {this._close_lock = new CloseLock()}
3007
+ __init26() {this._close_lock = new CloseLock()}
3010
3008
  /** Every lane a controller can exist for: `"default"` plus each declared one. */
3011
3009
 
3012
3010
  /** Drain lanes declared via `.withLane(...)`. Implicit default not included. */
@@ -3014,16 +3012,16 @@ var Act = (_class7 = class {
3014
3012
  return this._lanes;
3015
3013
  }
3016
3014
  /** Use the {@link act} builder rather than constructing directly. */
3017
- constructor(registry, states = /* @__PURE__ */ new Map(), batch_handlers = /* @__PURE__ */ new Map(), options = {}, lanes = [], patch_fn = bare_patch) {;_class7.prototype.__init25.call(this);_class7.prototype.__init26.call(this);_class7.prototype.__init27.call(this);
3015
+ constructor(registry, states = /* @__PURE__ */ new Map(), batch_handlers = /* @__PURE__ */ new Map(), options = {}, lanes = [], patch_fn = bare_patch) {;_class7.prototype.__init24.call(this);_class7.prototype.__init25.call(this);_class7.prototype.__init26.call(this);
3018
3016
  this.registry = registry;
3019
3017
  this._states = states;
3020
3018
  this._batch_handlers = batch_handlers;
3021
3019
  this._lanes = lanes;
3022
3020
  this._declared_lanes = ["default", ...lanes.map((l) => l.name)];
3023
3021
  validate_only_lanes(options, lanes);
3024
- this._ports = _nullishCoalesce(options.scoped, () => ( _chunkP3B7HVFDcjs.default_scope.call(void 0, )));
3022
+ this._ports = _nullishCoalesce(options.scoped, () => ( _chunkU54EW4DXcjs.default_scope.call(void 0, )));
3025
3023
  const ports = this._ports;
3026
- this._scoped = _chunkP3B7HVFDcjs.make_run_scoped.call(void 0, {
3024
+ this._scoped = _chunkU54EW4DXcjs.make_run_scoped.call(void 0, {
3027
3025
  // Getters, not a spread: the singletons resolve lazily, so a later
3028
3026
  // `store(...)` / `cache(...)` still takes effect.
3029
3027
  get store() {
@@ -3033,14 +3031,14 @@ var Act = (_class7 = class {
3033
3031
  return ports.cache;
3034
3032
  },
3035
3033
  // Parsed per build, so a bad window throws on every build.
3036
- autoclose_window: _chunkP3B7HVFDcjs.resolveAutocloseConfig.call(void 0, options).autocloseWindow
3034
+ autoclose_window: _chunkU54EW4DXcjs.resolveAutocloseConfig.call(void 0, options).autocloseWindow
3037
3035
  });
3038
3036
  this._correlator = _nullishCoalesce(options.correlator, () => ( default_correlator));
3039
3037
  this._es = build_es(this._logger, this._correlator, patch_fn);
3040
3038
  this._cd = build_drain(this._logger);
3041
3039
  const handle = build_handle({
3042
3040
  logger: this._logger,
3043
- reaction_scope: _chunkP3B7HVFDcjs.make_reaction_scope.call(void 0, {
3041
+ reaction_scope: _chunkU54EW4DXcjs.make_reaction_scope.call(void 0, {
3044
3042
  do: this.do.bind(this),
3045
3043
  load: this.load.bind(this),
3046
3044
  query: this.query.bind(this),
@@ -3070,12 +3068,12 @@ var Act = (_class7 = class {
3070
3068
  this._ports.store,
3071
3069
  options.listen !== false
3072
3070
  );
3073
- _chunkP3B7HVFDcjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
3071
+ _chunkU54EW4DXcjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
3074
3072
  }
3075
3073
  /** Shared by drain, settle and autoclose; bad knobs throw at build. */
3076
3074
  _build_breaker(options) {
3077
3075
  return new CircuitBreaker(
3078
- _chunkP3B7HVFDcjs.resolveCircuitBreakerConfig.call(void 0, options.circuitBreaker),
3076
+ _chunkU54EW4DXcjs.resolveCircuitBreakerConfig.call(void 0, options.circuitBreaker),
3079
3077
  {
3080
3078
  on_error: (error, circuit) => this._emit_error(error, circuit),
3081
3079
  // When the cooldown elapses, settle once: its scan or claim is the
@@ -3109,7 +3107,7 @@ var Act = (_class7 = class {
3109
3107
  try {
3110
3108
  await this._run_close(targets);
3111
3109
  } catch (error) {
3112
- if (error instanceof _chunkAVXVMZ4Bcjs.StoreError) throw error;
3110
+ if (error instanceof _chunkPMS6BMIUcjs.StoreError) throw error;
3113
3111
  this._logger.error(
3114
3112
  error,
3115
3113
  `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.`
@@ -3124,7 +3122,7 @@ var Act = (_class7 = class {
3124
3122
  leaseMillis: cfg.leaseMillis
3125
3123
  }
3126
3124
  });
3127
- if (_optionalChain([cfg, 'optionalAccess', _125 => _125.cycleMs]) !== void 0 && options.drain !== false)
3125
+ if (_optionalChain([cfg, 'optionalAccess', _123 => _123.cycleMs]) !== void 0 && options.drain !== false)
3128
3126
  controller.start(cfg.cycleMs);
3129
3127
  controllers.set(name, controller);
3130
3128
  }
@@ -3144,7 +3142,7 @@ var Act = (_class7 = class {
3144
3142
  /** Audit deps, built after the controllers so the lane set is final. */
3145
3143
  _build_audit_deps() {
3146
3144
  return {
3147
- store: _chunkP3B7HVFDcjs.store,
3145
+ store: _chunkU54EW4DXcjs.store,
3148
3146
  event_to_state: this._event_to_state,
3149
3147
  // Declared lanes, not this process's controllers: a lane another
3150
3148
  // worker drains is not `unknown-lane`.
@@ -3157,7 +3155,7 @@ var Act = (_class7 = class {
3157
3155
  registry: this.registry,
3158
3156
  static_targets: classification.static_targets,
3159
3157
  cd: this._cd,
3160
- max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => ( _chunkAVXVMZ4Bcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS)),
3158
+ max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => ( _chunkPMS6BMIUcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS)),
3161
3159
  // Declared lanes (not active ones): a lane another process claims is
3162
3160
  // still a valid destination.
3163
3161
  declared_lanes: new Set(this._declared_lanes),
@@ -3173,17 +3171,15 @@ var Act = (_class7 = class {
3173
3171
  /** Cold start: an idle deferred stream still fires on time after a restart. */
3174
3172
  async _seed_persisted_defers() {
3175
3173
  const now = Date.now();
3176
- await walk_streams(_chunkP3B7HVFDcjs.store.call(void 0, ), (pos) => {
3174
+ await walk_streams(_chunkU54EW4DXcjs.store.call(void 0, ), (pos) => {
3177
3175
  if (pos.deferred_at === void 0 || pos.deferred_at <= now) return;
3178
3176
  const controller = this._drain_controllers.get(_nullishCoalesce(pos.lane, () => ( "default")));
3179
- _optionalChain([controller, 'optionalAccess', _126 => _126.seed_defer, 'call', _127 => _127(pos.stream, pos.deferred_at)]);
3177
+ _optionalChain([controller, 'optionalAccess', _124 => _124.seed_defer, 'call', _125 => _125(pos.stream, pos.deferred_at)]);
3180
3178
  });
3181
3179
  }
3182
3180
  _build_settle(options) {
3183
3181
  return new SettleLoop(
3184
3182
  {
3185
- init: () => this._scoped(() => this._correlate.init()),
3186
- checkpoint: () => this._correlate.checkpoint,
3187
3183
  correlate: (q) => this._correlate_scanned(
3188
3184
  { ...q, limit: _nullishCoalesce(_nullishCoalesce(q.limit, () => ( this._poll_limit)), () => ( 100)) },
3189
3185
  true
@@ -3194,7 +3190,7 @@ var Act = (_class7 = class {
3194
3190
  on_settled: (drain) => this.emit("settled", drain),
3195
3191
  breaker: this._breaker
3196
3192
  },
3197
- _nullishCoalesce(options.settleDebounceMs, () => ( _chunkAVXVMZ4Bcjs.DEFAULT_SETTLE_DEBOUNCE_MS))
3193
+ _nullishCoalesce(options.settleDebounceMs, () => ( _chunkPMS6BMIUcjs.DEFAULT_SETTLE_DEBOUNCE_MS))
3198
3194
  );
3199
3195
  }
3200
3196
 
@@ -3214,7 +3210,7 @@ var Act = (_class7 = class {
3214
3210
  */
3215
3211
  shutdown(options) {
3216
3212
  if (!this._shutdown_promise) {
3217
- _chunkP3B7HVFDcjs.resolveShutdownConfig.call(void 0, options);
3213
+ _chunkU54EW4DXcjs.resolveShutdownConfig.call(void 0, options);
3218
3214
  this._shutdown_promise = (async () => {
3219
3215
  this.stop_correlations();
3220
3216
  this._settle.stop(true);
@@ -3222,7 +3218,7 @@ var Act = (_class7 = class {
3222
3218
  for (const c of this._drain_controllers.values()) c.stop();
3223
3219
  const disposer = await this._notify_disposer;
3224
3220
  if (disposer) await disposer();
3225
- await this._await_inflight(_optionalChain([options, 'optionalAccess', _128 => _128.graceMs]));
3221
+ await this._await_inflight(_optionalChain([options, 'optionalAccess', _126 => _126.graceMs]));
3226
3222
  await this._scoped(() => this._correlate.release_correlation());
3227
3223
  this._emitter.removeAllListeners();
3228
3224
  })();
@@ -3234,10 +3230,10 @@ var Act = (_class7 = class {
3234
3230
  * default for none or 0, and for a running settle), capped.
3235
3231
  */
3236
3232
  _derive_grace_ms(running, settling) {
3237
- let max = settling ? _chunkP3B7HVFDcjs.DEFAULT_LEASE_MILLIS : 0;
3233
+ let max = settling ? _chunkU54EW4DXcjs.DEFAULT_LEASE_MILLIS : 0;
3238
3234
  for (const c of running)
3239
- max = Math.max(max, c.lease_millis || _chunkP3B7HVFDcjs.DEFAULT_LEASE_MILLIS);
3240
- return Math.min(max, _chunkP3B7HVFDcjs.MAX_SHUTDOWN_GRACE_MS);
3235
+ max = Math.max(max, c.lease_millis || _chunkU54EW4DXcjs.DEFAULT_LEASE_MILLIS);
3236
+ return Math.min(max, _chunkU54EW4DXcjs.MAX_SHUTDOWN_GRACE_MS);
3241
3237
  }
3242
3238
  async _await_inflight(grace_ms) {
3243
3239
  const running = [...this._drain_controllers.values()].filter(
@@ -3317,8 +3313,8 @@ var Act = (_class7 = class {
3317
3313
  * @see {@link ValidationError}, {@link InvariantError}, {@link ConcurrencyError}
3318
3314
  */
3319
3315
  async do(action2, target, payload, options) {
3320
- const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _129 => _129.reactingTo]), () => ( _chunkP3B7HVFDcjs.current_reacting.call(void 0, )));
3321
- const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _130 => _130.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
3316
+ const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _127 => _127.reactingTo]), () => ( _chunkU54EW4DXcjs.current_reacting.call(void 0, )));
3317
+ const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _128 => _128.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
3322
3318
  return this._scoped(async () => {
3323
3319
  const snapshots = await this._es.action(
3324
3320
  this.registry.actions[action2],
@@ -3378,11 +3374,11 @@ var Act = (_class7 = class {
3378
3374
  return this._scoped(async () => {
3379
3375
  let first;
3380
3376
  let last;
3381
- const count = await _chunkP3B7HVFDcjs.store.call(void 0, ).query((e) => {
3377
+ const count = await _chunkU54EW4DXcjs.store.call(void 0, ).query((e) => {
3382
3378
  const gated = this.registry.query_gate(e.name)(e);
3383
3379
  if (!first) first = gated;
3384
3380
  last = gated;
3385
- _optionalChain([callback, 'optionalCall', _131 => _131(gated)]);
3381
+ _optionalChain([callback, 'optionalCall', _129 => _129(gated)]);
3386
3382
  }, query);
3387
3383
  return { first, last, count };
3388
3384
  });
@@ -3408,7 +3404,7 @@ var Act = (_class7 = class {
3408
3404
  async query_array(query) {
3409
3405
  return this._scoped(async () => {
3410
3406
  const events = [];
3411
- await _chunkP3B7HVFDcjs.store.call(void 0, ).query((e) => {
3407
+ await _chunkU54EW4DXcjs.store.call(void 0, ).query((e) => {
3412
3408
  events.push(this.registry.query_gate(e.name)(e));
3413
3409
  }, query);
3414
3410
  return events;
@@ -3428,14 +3424,14 @@ var Act = (_class7 = class {
3428
3424
  */
3429
3425
  async forget(stream) {
3430
3426
  return this._scoped(async () => {
3431
- const s = _chunkP3B7HVFDcjs.store.call(void 0, );
3427
+ const s = _chunkU54EW4DXcjs.store.call(void 0, );
3432
3428
  if (!s.forget_pii) {
3433
3429
  throw new Error(
3434
3430
  `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).`
3435
3431
  );
3436
3432
  }
3437
3433
  const eventCount = await s.forget_pii(stream);
3438
- await _chunkP3B7HVFDcjs.cache.call(void 0, ).invalidate(stream);
3434
+ await _chunkU54EW4DXcjs.cache.call(void 0, ).invalidate(stream);
3439
3435
  if (eventCount > 0) {
3440
3436
  this.emit("forgotten", { stream, at: /* @__PURE__ */ new Date(), eventCount });
3441
3437
  }
@@ -3469,7 +3465,7 @@ var Act = (_class7 = class {
3469
3465
  * @see {@link correlate} for dynamic stream discovery
3470
3466
  */
3471
3467
  async drain(options = {}) {
3472
- _chunkP3B7HVFDcjs.resolveDrainConfig.call(void 0, options);
3468
+ _chunkU54EW4DXcjs.resolveDrainConfig.call(void 0, options);
3473
3469
  if (!this._drain)
3474
3470
  return { fetched: [], leased: [], acked: [], blocked: [] };
3475
3471
  return this._scoped(() => this._drain_all(options));
@@ -3509,32 +3505,25 @@ var Act = (_class7 = class {
3509
3505
  }
3510
3506
  if (to_arm.size === 0) return false;
3511
3507
  this._correlate.arm();
3512
- for (const lane of to_arm) _optionalChain([this, 'access', _132 => _132._drain_controllers, 'access', _133 => _133.get, 'call', _134 => _134(lane), 'optionalAccess', _135 => _135.arm, 'call', _136 => _136()]);
3508
+ for (const lane of to_arm) _optionalChain([this, 'access', _130 => _130._drain_controllers, 'access', _131 => _131.get, 'call', _132 => _132(lane), 'optionalAccess', _133 => _133.arm, 'call', _134 => _134()]);
3513
3509
  return true;
3514
3510
  }
3515
3511
  /** In parallel, so a slow lane never holds up a fast one. */
3516
3512
  async _drain_all(options) {
3517
- const results = await Promise.all(
3518
- [...this._drain_controllers.values()].map((c) => c.drain(options))
3513
+ const merged = merge_drains(
3514
+ await Promise.all(
3515
+ [...this._drain_controllers.values()].map((c) => c.drain(options))
3516
+ )
3519
3517
  );
3520
- const fetched = [];
3521
- const leased = [];
3522
- const acked = [];
3523
- const blocked = [];
3524
- for (const r of results) {
3525
- fetched.push(
3526
- ...r.fetched.map((f) => ({
3527
- ...f,
3528
- events: f.events.map(
3529
- (e) => this.registry.query_gate(e.name)(e)
3530
- )
3531
- }))
3532
- );
3533
- leased.push(...r.leased);
3534
- acked.push(...r.acked);
3535
- blocked.push(...r.blocked);
3536
- }
3537
- return { fetched, leased, acked, blocked };
3518
+ return {
3519
+ ...merged,
3520
+ fetched: merged.fetched.map((f) => ({
3521
+ ...f,
3522
+ events: f.events.map(
3523
+ (e) => this.registry.query_gate(e.name)(e)
3524
+ )
3525
+ }))
3526
+ };
3538
3527
  }
3539
3528
  /**
3540
3529
  * Scans committed events from the correlation checkpoint, subscribes the
@@ -3558,11 +3547,12 @@ var Act = (_class7 = class {
3558
3547
  }
3559
3548
  /** `correlate` plus `scanned`, which settle needs for the breaker. */
3560
3549
  async _correlate_scanned(query, lease = false) {
3561
- if (!this._drain) return { subscribed: 0, last_id: -1, scanned: false };
3550
+ if (!this._drain)
3551
+ return { subscribed: 0, last_id: -1, read: false, scanned: false };
3562
3552
  return this._scoped(async () => {
3563
- const { subscribed, last_id, marked, scanned } = await this._correlate.correlate(query, lease);
3553
+ const { subscribed, last_id, read, marked, scanned } = await this._correlate.correlate(query, lease);
3564
3554
  if (subscribed > 0 || marked > 0) this._arm_all();
3565
- return { subscribed, last_id, scanned };
3555
+ return { subscribed, last_id, read, scanned };
3566
3556
  });
3567
3557
  }
3568
3558
  /**
@@ -3652,9 +3642,9 @@ var Act = (_class7 = class {
3652
3642
  */
3653
3643
  async reset(input) {
3654
3644
  return this._scoped(async () => {
3655
- const count = await _chunkP3B7HVFDcjs.store.call(void 0, ).reset(input);
3645
+ const count = await _chunkU54EW4DXcjs.store.call(void 0, ).reset(input);
3656
3646
  for (const handler of this._batch_handlers.values())
3657
- _optionalChain([handler, 'access', _137 => _137[FOLD_RESET], 'optionalCall', _138 => _138()]);
3647
+ _optionalChain([handler, 'access', _135 => _135[FOLD_RESET], 'optionalCall', _136 => _136()]);
3658
3648
  if (count > 0) {
3659
3649
  this._wake();
3660
3650
  }
@@ -3688,7 +3678,7 @@ var Act = (_class7 = class {
3688
3678
  */
3689
3679
  async unblock(input) {
3690
3680
  return this._scoped(async () => {
3691
- const count = await _chunkP3B7HVFDcjs.store.call(void 0, ).unblock(input);
3681
+ const count = await _chunkU54EW4DXcjs.store.call(void 0, ).unblock(input);
3692
3682
  if (count > 0) {
3693
3683
  this._wake();
3694
3684
  }
@@ -3737,7 +3727,7 @@ var Act = (_class7 = class {
3737
3727
  return { ...partial, duration_ms: Date.now() - started };
3738
3728
  }
3739
3729
  const target = _nullishCoalesce(sink, () => ( (() => {
3740
- const s = _chunkP3B7HVFDcjs.store.call(void 0, );
3730
+ const s = _chunkU54EW4DXcjs.store.call(void 0, );
3741
3731
  if (!s.restore) throw new Error("adapter has no restore capability");
3742
3732
  return s;
3743
3733
  })()));
@@ -3782,11 +3772,11 @@ var Act = (_class7 = class {
3782
3772
  async blocked_streams(options) {
3783
3773
  return this._scoped(async () => {
3784
3774
  const positions = [];
3785
- await _chunkP3B7HVFDcjs.store.call(void 0, ).query_streams(
3775
+ await _chunkU54EW4DXcjs.store.call(void 0, ).query_streams(
3786
3776
  (p) => {
3787
3777
  positions.push(p);
3788
3778
  },
3789
- { blocked: true, after: _optionalChain([options, 'optionalAccess', _139 => _139.after]), limit: _optionalChain([options, 'optionalAccess', _140 => _140.limit]) }
3779
+ { blocked: true, after: _optionalChain([options, 'optionalAccess', _137 => _137.after]), limit: _optionalChain([options, 'optionalAccess', _138 => _138.limit]) }
3790
3780
  );
3791
3781
  return positions;
3792
3782
  });
@@ -3834,7 +3824,7 @@ var Act = (_class7 = class {
3834
3824
  * @see {@link Store.prioritize} for the underlying primitive
3835
3825
  */
3836
3826
  async prioritize(filter, priority) {
3837
- return this._scoped(() => _chunkP3B7HVFDcjs.store.call(void 0, ).prioritize(filter, priority));
3827
+ return this._scoped(() => _chunkU54EW4DXcjs.store.call(void 0, ).prioritize(filter, priority));
3838
3828
  }
3839
3829
  /** Shared by `close()` and reaction-requested closes. */
3840
3830
  async _run_close(targets) {
@@ -3914,7 +3904,7 @@ var Act = (_class7 = class {
3914
3904
  * @see {@link correlate} for manual correlation
3915
3905
  */
3916
3906
  settle(options) {
3917
- _chunkP3B7HVFDcjs.resolveSettleConfig.call(void 0, _nullishCoalesce(options, () => ( {})));
3907
+ _chunkU54EW4DXcjs.resolveSettleConfig.call(void 0, _nullishCoalesce(options, () => ( {})));
3918
3908
  this._schedule(options);
3919
3909
  }
3920
3910
  }, _class7);
@@ -3980,12 +3970,12 @@ function policy_min_after_days(options) {
3980
3970
  const parsed = AutoclosePolicySchema.parse(options);
3981
3971
  const windows = [];
3982
3972
  if (parsed.after) windows.push(parsed.after.days);
3983
- if (_optionalChain([parsed, 'access', _141 => _141.or, 'optionalAccess', _142 => _142.after])) windows.push(parsed.or.after.days);
3973
+ if (_optionalChain([parsed, 'access', _139 => _139.or, 'optionalAccess', _140 => _140.after])) windows.push(parsed.or.after.days);
3984
3974
  return windows.length ? Math.min(...windows) : void 0;
3985
3975
  }
3986
3976
  function policy_keep_days(options) {
3987
3977
  const parsed = AutoclosePolicySchema.parse(options);
3988
- return _optionalChain([parsed, 'access', _143 => _143.keep, 'optionalAccess', _144 => _144.days]);
3978
+ return _optionalChain([parsed, 'access', _141 => _141.keep, 'optionalAccess', _142 => _142.days]);
3989
3979
  }
3990
3980
  function compile_autoclose_policy(options) {
3991
3981
  const parsed = AutoclosePolicySchema.parse(options);
@@ -4017,7 +4007,7 @@ function hour_in_zone(now, timeZone) {
4017
4007
  hour: "2-digit",
4018
4008
  hourCycle: "h23"
4019
4009
  }).formatToParts(now);
4020
- return Number(_optionalChain([parts, 'access', _145 => _145.find, 'call', _146 => _146((p) => p.type === "hour"), 'optionalAccess', _147 => _147.value]));
4010
+ return Number(_optionalChain([parts, 'access', _143 => _143.find, 'call', _144 => _144((p) => p.type === "hour"), 'optionalAccess', _145 => _145.value]));
4021
4011
  }
4022
4012
  function hour_in_range(hour, start, end) {
4023
4013
  return start < end ? hour >= start && hour < end : hour >= start || hour < end;
@@ -4070,16 +4060,16 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
4070
4060
  }),
4071
4061
  // Never block on autoclose: a transient query/store error should retry,
4072
4062
  // not quarantine the synthetic stream.
4073
- options: { blockOnError: false, maxRetries: _chunkP3B7HVFDcjs.DEFAULT_MAX_RETRIES },
4063
+ options: { blockOnError: false, maxRetries: _chunkU54EW4DXcjs.DEFAULT_MAX_RETRIES },
4074
4064
  handler: async (event) => {
4075
4065
  const aggregate = event.stream;
4076
4066
  const window = read_window();
4077
4067
  if (!in_autoclose_window(window, /* @__PURE__ */ new Date()))
4078
- throw new (0, _chunkAVXVMZ4Bcjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
4079
- const stats = await _chunkP3B7HVFDcjs.store.call(void 0, ).query_stats([aggregate], {
4068
+ throw new (0, _chunkPMS6BMIUcjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
4069
+ const stats = await _chunkU54EW4DXcjs.store.call(void 0, ).query_stats([aggregate], {
4080
4070
  count: true,
4081
4071
  tail: keep_days !== void 0 ? true : void 0,
4082
- exclude: [_chunkAVXVMZ4Bcjs.TOMBSTONE_EVENT, _chunkAVXVMZ4Bcjs.SNAP_EVENT]
4072
+ exclude: [_chunkPMS6BMIUcjs.TOMBSTONE_EVENT, _chunkPMS6BMIUcjs.SNAP_EVENT]
4083
4073
  });
4084
4074
  const entry = stats.get(aggregate);
4085
4075
  if (!entry) return;
@@ -4110,12 +4100,12 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
4110
4100
  dues.push(days_after(entry.tail.created, keep_days));
4111
4101
  const future = dues.map((d) => d.getTime()).filter((t) => t > Date.now());
4112
4102
  if (future.length)
4113
- throw new (0, _chunkAVXVMZ4Bcjs.DeferSignal)({ at: new Date(Math.min(...future)) });
4103
+ throw new (0, _chunkPMS6BMIUcjs.DeferSignal)({ at: new Date(Math.min(...future)) });
4114
4104
  }
4115
4105
  };
4116
4106
  const key = `__autoclose_${st.name}`;
4117
4107
  for (const event_name of Object.keys(st.events)) {
4118
- _optionalChain([registry, 'access', _148 => _148.events, 'access', _149 => _149[event_name], 'optionalAccess', _150 => _150.reactions, 'access', _151 => _151.set, 'call', _152 => _152(
4108
+ _optionalChain([registry, 'access', _146 => _146.events, 'access', _147 => _147[event_name], 'optionalAccess', _148 => _148.reactions, 'access', _149 => _149.set, 'call', _150 => _150(
4119
4109
  key,
4120
4110
  reaction
4121
4111
  )]);
@@ -4314,9 +4304,9 @@ var _this_ = ({ stream }) => ({
4314
4304
 
4315
4305
  // src/builders/builder-utils.ts
4316
4306
  function register_lane(config2, lanes) {
4317
- _chunkP3B7HVFDcjs.resolveLaneConfig.call(void 0, config2);
4318
- if (config2.name === _chunkAVXVMZ4Bcjs.DEFAULT_LANE)
4319
- throw new Error(`Lane "${_chunkAVXVMZ4Bcjs.DEFAULT_LANE}" is reserved`);
4307
+ _chunkU54EW4DXcjs.resolveLaneConfig.call(void 0, config2);
4308
+ if (config2.name === _chunkPMS6BMIUcjs.DEFAULT_LANE)
4309
+ throw new Error(`Lane "${_chunkPMS6BMIUcjs.DEFAULT_LANE}" is reserved`);
4320
4310
  const existing = lanes.find((l) => l.name === config2.name);
4321
4311
  if (!existing) return void lanes.push(config2);
4322
4312
  if (existing.leaseMillis !== config2.leaseMillis || existing.streamLimit !== config2.streamLimit || existing.cycleMs !== config2.cycleMs)
@@ -4358,10 +4348,10 @@ function reaction_on(event, events, builder) {
4358
4348
  // Validate the whole bag at the declaration site so a bad
4359
4349
  // `maxRetries`/`backoff`/`blockOnError` throws ZodError at build,
4360
4350
  // not a NaN gate on the first retry.
4361
- options: _chunkP3B7HVFDcjs.resolveReactionConfig.call(void 0, {
4362
- blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _153 => _153.blockOnError]), () => ( _chunkP3B7HVFDcjs.DEFAULT_BLOCK_ON_ERROR)),
4363
- maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _154 => _154.maxRetries]), () => ( _chunkP3B7HVFDcjs.DEFAULT_MAX_RETRIES)),
4364
- backoff: _optionalChain([options, 'optionalAccess', _155 => _155.backoff])
4351
+ options: _chunkU54EW4DXcjs.resolveReactionConfig.call(void 0, {
4352
+ blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _151 => _151.blockOnError]), () => ( _chunkU54EW4DXcjs.DEFAULT_BLOCK_ON_ERROR)),
4353
+ maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _152 => _152.maxRetries]), () => ( _chunkU54EW4DXcjs.DEFAULT_MAX_RETRIES)),
4354
+ backoff: _optionalChain([options, 'optionalAccess', _153 => _153.backoff])
4365
4355
  })
4366
4356
  };
4367
4357
  },
@@ -4380,9 +4370,9 @@ function reaction_on(event, events, builder) {
4380
4370
 
4381
4371
  // src/internal/date-reviver.ts
4382
4372
 
4383
- var def_of = (schema) => _nullishCoalesce(_optionalChain([schema, 'access', _156 => _156._zod, 'optionalAccess', _157 => _157.def]), () => ( schema.def));
4373
+ var def_of = (schema) => _nullishCoalesce(_optionalChain([schema, 'access', _154 => _154._zod, 'optionalAccess', _155 => _155.def]), () => ( schema.def));
4384
4374
  function variant_schema(schema) {
4385
- const shape = _optionalChain([def_of, 'call', _158 => _158(schema), 'optionalAccess', _159 => _159.shape]);
4375
+ const shape = _optionalChain([def_of, 'call', _156 => _156(schema), 'optionalAccess', _157 => _157.shape]);
4386
4376
  if (!shape) {
4387
4377
  const dates = date_reviver_schema(schema);
4388
4378
  return { schema: _nullishCoalesce(dates, () => ( schema)), dated: !!dates };
@@ -4430,7 +4420,7 @@ function date_reviver_schema(schema) {
4430
4420
  return variants.some((v) => v.dated) ? _zod2.z.union(variants.map((v) => v.schema)) : void 0;
4431
4421
  }
4432
4422
  case "nullable":
4433
- return _optionalChain([inner, 'call', _160 => _160(), 'optionalAccess', _161 => _161.nullable, 'call', _162 => _162()]);
4423
+ return _optionalChain([inner, 'call', _158 => _158(), 'optionalAccess', _159 => _159.nullable, 'call', _160 => _160()]);
4434
4424
  case "optional":
4435
4425
  case "nonoptional":
4436
4426
  case "readonly":
@@ -4445,7 +4435,7 @@ function date_reviver_schema(schema) {
4445
4435
 
4446
4436
  // src/builders/event-builder.ts
4447
4437
  function event_tags(schema) {
4448
- const pii = _chunkAVXVMZ4Bcjs.pii_schemas.call(void 0, schema);
4438
+ const pii = _chunkPMS6BMIUcjs.pii_schemas.call(void 0, schema);
4449
4439
  const pii_dates = {};
4450
4440
  for (const [key, field] of Object.entries(pii)) {
4451
4441
  const dates = date_reviver_schema(field);
@@ -4482,7 +4472,7 @@ function make_event_reader(tags, disclosure, predicate = null) {
4482
4472
  });
4483
4473
  }
4484
4474
  function build_events(registry, states, lanes, owners) {
4485
- const declared = /* @__PURE__ */ new Set([_chunkAVXVMZ4Bcjs.DEFAULT_LANE, ...lanes.map((l) => l.name)]);
4475
+ const declared = /* @__PURE__ */ new Set([_chunkPMS6BMIUcjs.DEFAULT_LANE, ...lanes.map((l) => l.name)]);
4486
4476
  const lane_errors = [];
4487
4477
  const tags = /* @__PURE__ */ new Map();
4488
4478
  const sensitive2 = /* @__PURE__ */ new Map();
@@ -4546,7 +4536,7 @@ function build_events(registry, states, lanes, owners) {
4546
4536
  if (reader) readers.set(event_name, reader);
4547
4537
  }
4548
4538
  const snap2 = make_event_reader(event_tags(state2.state), "redact", null);
4549
- if (snap2) readers.set(_chunkAVXVMZ4Bcjs.SNAP_EVENT, snap2);
4539
+ if (snap2) readers.set(_chunkPMS6BMIUcjs.SNAP_EVENT, snap2);
4550
4540
  if (readers.size === 0) continue;
4551
4541
  state2.view = (event, actor) => (_nullishCoalesce(readers.get(event.name), () => ( IDENTITY_GATE)))(event, actor);
4552
4542
  }
@@ -4607,7 +4597,7 @@ function act() {
4607
4597
  let _built = false;
4608
4598
  const read_wrap = (original) => {
4609
4599
  const wrapped = async (events, stream) => {
4610
- const read = events.map((e) => _nullishCoalesce(_optionalChain([_hr, 'access', _163 => _163.get, 'call', _164 => _164(e.name), 'optionalCall', _165 => _165(e)]), () => ( e)));
4600
+ const read = events.map((e) => _nullishCoalesce(_optionalChain([_hr, 'access', _161 => _161.get, 'call', _162 => _162(e.name), 'optionalCall', _163 => _163(e)]), () => ( e)));
4611
4601
  return original(read, stream);
4612
4602
  };
4613
4603
  const reset = original[FOLD_RESET];
@@ -4649,7 +4639,7 @@ function act() {
4649
4639
  });
4650
4640
  }
4651
4641
  for (const [action_name, handler] of Object.entries(state2.on)) {
4652
- const static_target = _optionalChain([handler, 'optionalAccess', _166 => _166._static_emit]);
4642
+ const static_target = _optionalChain([handler, 'optionalAccess', _164 => _164._static_emit]);
4653
4643
  if (static_target && deprecated.has(static_target)) {
4654
4644
  const current = current_version_of(static_target, event_names);
4655
4645
  throw new Error(
@@ -4662,7 +4652,7 @@ function act() {
4662
4652
  const list = deprecation_summary.map(
4663
4653
  (d) => `"${d.deprecated}" (current: "${d.current}", state: "${d.state_name}")`
4664
4654
  ).join(", ");
4665
- _chunkP3B7HVFDcjs.log.call(void 0, ).info(
4655
+ _chunkU54EW4DXcjs.log.call(void 0, ).info(
4666
4656
  `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.`
4667
4657
  );
4668
4658
  }
@@ -4704,8 +4694,8 @@ function act() {
4704
4694
  return reaction_on(event, registry.events, builder);
4705
4695
  },
4706
4696
  build: (options) => {
4707
- _chunkP3B7HVFDcjs.resolveActConfig.call(void 0, options);
4708
- const patch_fn = _optionalChain([options, 'optionalAccess', _167 => _167.validateFoldedState]) === true ? validating_patch : bare_patch;
4697
+ _chunkU54EW4DXcjs.resolveActConfig.call(void 0, options);
4698
+ const patch_fn = _optionalChain([options, 'optionalAccess', _165 => _165.validateFoldedState]) === true ? validating_patch : bare_patch;
4709
4699
  if (!_built) {
4710
4700
  for (const proj of pending_projections) add_projection(proj);
4711
4701
  for (const proj of fold_projections) {
@@ -4723,7 +4713,7 @@ function act() {
4723
4713
  `State projection "${proj.target}" of "${fold.name}" is missing events ${missing.join(", ")} \u2014 pass every partial of the state to .of()`
4724
4714
  );
4725
4715
  const claimed = fold_specs.find((s) => s.target === proj.target);
4726
- if (_optionalChain([claimed, 'optionalAccess', _168 => _168.projection]) === proj) continue;
4716
+ if (_optionalChain([claimed, 'optionalAccess', _166 => _166.projection]) === proj) continue;
4727
4717
  if (batch_handlers.has(proj.target) || claimed)
4728
4718
  throw new Error(
4729
4719
  `Duplicate projection target "${proj.target}" \u2014 a target is served by one batch handler or one state projection, never both`
@@ -4756,7 +4746,7 @@ function act() {
4756
4746
  synthesize_autoclose_reactions(
4757
4747
  registry,
4758
4748
  states,
4759
- _chunkP3B7HVFDcjs.current_autoclose_window
4749
+ _chunkU54EW4DXcjs.current_autoclose_window
4760
4750
  );
4761
4751
  Object.freeze(registry.actions);
4762
4752
  Object.freeze(registry.events);
@@ -4805,8 +4795,8 @@ function _projection(target) {
4805
4795
  handler,
4806
4796
  resolver: _nullishCoalesce(default_resolver, () => ( _this_)),
4807
4797
  options: {
4808
- blockOnError: _chunkP3B7HVFDcjs.DEFAULT_BLOCK_ON_ERROR,
4809
- maxRetries: _chunkP3B7HVFDcjs.DEFAULT_MAX_RETRIES
4798
+ blockOnError: _chunkU54EW4DXcjs.DEFAULT_BLOCK_ON_ERROR,
4799
+ maxRetries: _chunkU54EW4DXcjs.DEFAULT_MAX_RETRIES
4810
4800
  }
4811
4801
  }),
4812
4802
  widened
@@ -4847,7 +4837,7 @@ function _projection(target) {
4847
4837
  throw new Error(
4848
4838
  `Projection "${target}" .of() partials must share one state name \u2014 got "${name}" and "${partial.name}"`
4849
4839
  );
4850
- const config2 = _chunkP3B7HVFDcjs.resolveFoldConfig.call(void 0, options);
4840
+ const config2 = _chunkU54EW4DXcjs.resolveFoldConfig.call(void 0, options);
4851
4841
  const fold_events = {};
4852
4842
  for (const partial of partials)
4853
4843
  for (const [event_name, schema] of Object.entries(partial.events)) {
@@ -4865,8 +4855,8 @@ function _projection(target) {
4865
4855
  handler: noop,
4866
4856
  resolver: { target },
4867
4857
  options: {
4868
- blockOnError: _chunkP3B7HVFDcjs.DEFAULT_BLOCK_ON_ERROR,
4869
- maxRetries: _chunkP3B7HVFDcjs.DEFAULT_MAX_RETRIES
4858
+ blockOnError: _chunkU54EW4DXcjs.DEFAULT_BLOCK_ON_ERROR,
4859
+ maxRetries: _chunkU54EW4DXcjs.DEFAULT_MAX_RETRIES
4870
4860
  }
4871
4861
  }
4872
4862
  ]
@@ -4982,7 +4972,7 @@ function action_builder(state2) {
4982
4972
  throw new Error(`Duplicate action "${action2}"`);
4983
4973
  internal.actions[action2] = schema;
4984
4974
  if (options) {
4985
- _chunkP3B7HVFDcjs.resolveActionConfig.call(void 0, options);
4975
+ _chunkU54EW4DXcjs.resolveActionConfig.call(void 0, options);
4986
4976
  internal.options ??= {};
4987
4977
  internal.options[action2] = options;
4988
4978
  }
@@ -5271,5 +5261,5 @@ function write_line(writer, line) {
5271
5261
 
5272
5262
 
5273
5263
 
5274
- exports.Act = Act; exports.ActorSchema = _chunkAVXVMZ4Bcjs.ActorSchema; exports.CausationEventSchema = _chunkAVXVMZ4Bcjs.CausationEventSchema; exports.CommittedMetaSchema = _chunkAVXVMZ4Bcjs.CommittedMetaSchema; exports.ConcurrencyError = _chunkAVXVMZ4Bcjs.ConcurrencyError; exports.ConsoleLogger = _chunkP3B7HVFDcjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = _chunkAVXVMZ4Bcjs.DEFAULT_LANE; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = _chunkAVXVMZ4Bcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS; exports.DEFAULT_SETTLE_DEBOUNCE_MS = _chunkAVXVMZ4Bcjs.DEFAULT_SETTLE_DEBOUNCE_MS; exports.DeferSignal = _chunkAVXVMZ4Bcjs.DeferSignal; exports.Environments = _chunkAVXVMZ4Bcjs.Environments; exports.Errors = _chunkAVXVMZ4Bcjs.Errors; exports.EventMetaSchema = _chunkAVXVMZ4Bcjs.EventMetaSchema; exports.ExitCodes = _chunkAVXVMZ4Bcjs.ExitCodes; exports.InMemoryCache = _chunkP3B7HVFDcjs.InMemoryCache; exports.InMemoryStore = _chunkP3B7HVFDcjs.InMemoryStore; exports.InvariantError = _chunkAVXVMZ4Bcjs.InvariantError; exports.LogLevels = _chunkAVXVMZ4Bcjs.LogLevels; exports.NonRetryableError = _chunkAVXVMZ4Bcjs.NonRetryableError; exports.PackageSchema = _chunkP3B7HVFDcjs.PackageSchema; exports.QuerySchema = _chunkAVXVMZ4Bcjs.QuerySchema; exports.REDACTED = _chunkAVXVMZ4Bcjs.REDACTED; exports.SHREDDED = _chunkAVXVMZ4Bcjs.SHREDDED; exports.SNAP_EVENT = _chunkAVXVMZ4Bcjs.SNAP_EVENT; exports.StoreError = _chunkAVXVMZ4Bcjs.StoreError; exports.StreamClosedError = _chunkAVXVMZ4Bcjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunkAVXVMZ4Bcjs.TOMBSTONE_EVENT; exports.TargetSchema = _chunkAVXVMZ4Bcjs.TargetSchema; exports.ValidationError = _chunkAVXVMZ4Bcjs.ValidationError; exports.ZodEmpty = _chunkAVXVMZ4Bcjs.ZodEmpty; exports.act = act; exports.cache = _chunkP3B7HVFDcjs.cache; exports.config = _chunkP3B7HVFDcjs.config; exports.dateReviver = _chunkP3B7HVFDcjs.dateReviver; exports.default_scope = _chunkP3B7HVFDcjs.default_scope; exports.dispose = _chunkP3B7HVFDcjs.dispose; exports.disposeAndExit = _chunkP3B7HVFDcjs.disposeAndExit; exports.extend = _chunkP3B7HVFDcjs.extend; exports.is_literal_source = _chunkP3B7HVFDcjs.is_literal_source; exports.log = _chunkP3B7HVFDcjs.log; exports.pii_fields = _chunkAVXVMZ4Bcjs.pii_fields; exports.port = _chunkP3B7HVFDcjs.port; exports.projection = projection; exports.resolveAutocloseConfig = _chunkP3B7HVFDcjs.resolveAutocloseConfig2; exports.sensitive = _chunkAVXVMZ4Bcjs.sensitive; exports.sleep = _chunkP3B7HVFDcjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkP3B7HVFDcjs.store; exports.validate = _chunkP3B7HVFDcjs.validate;
5264
+ exports.Act = Act; exports.ActorSchema = _chunkPMS6BMIUcjs.ActorSchema; exports.CausationEventSchema = _chunkPMS6BMIUcjs.CausationEventSchema; exports.CommittedMetaSchema = _chunkPMS6BMIUcjs.CommittedMetaSchema; exports.ConcurrencyError = _chunkPMS6BMIUcjs.ConcurrencyError; exports.ConsoleLogger = _chunkU54EW4DXcjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = _chunkPMS6BMIUcjs.DEFAULT_LANE; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = _chunkPMS6BMIUcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS; exports.DEFAULT_SETTLE_DEBOUNCE_MS = _chunkPMS6BMIUcjs.DEFAULT_SETTLE_DEBOUNCE_MS; exports.DeferSignal = _chunkPMS6BMIUcjs.DeferSignal; exports.Environments = _chunkPMS6BMIUcjs.Environments; exports.Errors = _chunkPMS6BMIUcjs.Errors; exports.EventMetaSchema = _chunkPMS6BMIUcjs.EventMetaSchema; exports.ExitCodes = _chunkPMS6BMIUcjs.ExitCodes; exports.InMemoryCache = _chunkU54EW4DXcjs.InMemoryCache; exports.InMemoryStore = _chunkU54EW4DXcjs.InMemoryStore; exports.InvariantError = _chunkPMS6BMIUcjs.InvariantError; exports.LogLevels = _chunkPMS6BMIUcjs.LogLevels; exports.NonRetryableError = _chunkPMS6BMIUcjs.NonRetryableError; exports.PackageSchema = _chunkU54EW4DXcjs.PackageSchema; exports.QuerySchema = _chunkPMS6BMIUcjs.QuerySchema; exports.REDACTED = _chunkPMS6BMIUcjs.REDACTED; exports.SHREDDED = _chunkPMS6BMIUcjs.SHREDDED; exports.SNAP_EVENT = _chunkPMS6BMIUcjs.SNAP_EVENT; exports.StoreError = _chunkPMS6BMIUcjs.StoreError; exports.StreamClosedError = _chunkPMS6BMIUcjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunkPMS6BMIUcjs.TOMBSTONE_EVENT; exports.TargetSchema = _chunkPMS6BMIUcjs.TargetSchema; exports.ValidationError = _chunkPMS6BMIUcjs.ValidationError; exports.ZodEmpty = _chunkPMS6BMIUcjs.ZodEmpty; exports.act = act; exports.cache = _chunkU54EW4DXcjs.cache; exports.config = _chunkU54EW4DXcjs.config; exports.dateReviver = _chunkU54EW4DXcjs.dateReviver; exports.default_scope = _chunkU54EW4DXcjs.default_scope; exports.dispose = _chunkU54EW4DXcjs.dispose; exports.disposeAndExit = _chunkU54EW4DXcjs.disposeAndExit; exports.extend = _chunkU54EW4DXcjs.extend; exports.is_literal_source = _chunkU54EW4DXcjs.is_literal_source; exports.log = _chunkU54EW4DXcjs.log; exports.pii_fields = _chunkPMS6BMIUcjs.pii_fields; exports.port = _chunkU54EW4DXcjs.port; exports.projection = projection; exports.resolveAutocloseConfig = _chunkU54EW4DXcjs.resolveAutocloseConfig2; exports.sensitive = _chunkPMS6BMIUcjs.sensitive; exports.sleep = _chunkU54EW4DXcjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkU54EW4DXcjs.store; exports.validate = _chunkU54EW4DXcjs.validate;
5275
5265
  //# sourceMappingURL=index.cjs.map