@rotorsoft/act 1.33.1 → 1.33.3

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 _chunkYKL44PYXcjs = require('./chunk-YKL44PYX.cjs');
43
+ var _chunkO6QIJQRNcjs = require('./chunk-O6QIJQRN.cjs');
44
44
 
45
45
 
46
46
 
@@ -70,24 +70,24 @@ var _chunkYKL44PYXcjs = require('./chunk-YKL44PYX.cjs');
70
70
 
71
71
 
72
72
 
73
- var _chunkNNWP65YMcjs = require('./chunk-NNWP65YM.cjs');
73
+ var _chunk7AHW7FCNcjs = require('./chunk-7AHW7FCN.cjs');
74
74
 
75
75
  // src/signals.ts
76
76
  process.once("SIGINT", async (arg) => {
77
- _chunkYKL44PYXcjs.log.call(void 0, ).info(arg, "SIGINT");
78
- await _chunkYKL44PYXcjs.disposeAndExit.call(void 0, "EXIT");
77
+ _chunkO6QIJQRNcjs.log.call(void 0, ).info(arg, "SIGINT");
78
+ await _chunkO6QIJQRNcjs.disposeAndExit.call(void 0, "EXIT");
79
79
  });
80
80
  process.once("SIGTERM", async (arg) => {
81
- _chunkYKL44PYXcjs.log.call(void 0, ).info(arg, "SIGTERM");
82
- await _chunkYKL44PYXcjs.disposeAndExit.call(void 0, "EXIT");
81
+ _chunkO6QIJQRNcjs.log.call(void 0, ).info(arg, "SIGTERM");
82
+ await _chunkO6QIJQRNcjs.disposeAndExit.call(void 0, "EXIT");
83
83
  });
84
84
  process.once("uncaughtException", async (arg) => {
85
- _chunkYKL44PYXcjs.log.call(void 0, ).error(arg, "Uncaught Exception");
86
- await _chunkYKL44PYXcjs.disposeAndExit.call(void 0, "ERROR");
85
+ _chunkO6QIJQRNcjs.log.call(void 0, ).error(arg, "Uncaught Exception");
86
+ await _chunkO6QIJQRNcjs.disposeAndExit.call(void 0, "ERROR");
87
87
  });
88
88
  process.once("unhandledRejection", async (arg) => {
89
- _chunkYKL44PYXcjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
90
- await _chunkYKL44PYXcjs.disposeAndExit.call(void 0, "ERROR");
89
+ _chunkO6QIJQRNcjs.log.call(void 0, ).error(arg, "Unhandled Rejection");
90
+ await _chunkO6QIJQRNcjs.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: [_chunkNNWP65YMcjs.SNAP_EVENT] }
198
+ { count: true, names: true, exclude: [_chunk7AHW7FCNcjs.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 = _chunkNNWP65YMcjs.pii_fields.call(void 0, schema);
280
+ const sensitive2 = _chunk7AHW7FCNcjs.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: [_chunkNNWP65YMcjs.SNAP_EVENT],
414
+ names: [_chunk7AHW7FCNcjs.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 === _chunkNNWP65YMcjs.TOMBSTONE_EVENT).map(([stream]) => stream);
843
+ const retired = [...truncated.entries()].filter(([, r]) => r.committed.name === _chunk7AHW7FCNcjs.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 _chunkYKL44PYXcjs.store.call(void 0, ).truncate([
925
+ const result = await _chunkO6QIJQRNcjs.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 _chunkYKL44PYXcjs.store.call(void 0, ).query(
938
+ await _chunkO6QIJQRNcjs.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 === _chunkNNWP65YMcjs.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 === _chunk7AHW7FCNcjs.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
- _chunkYKL44PYXcjs.store.call(void 0, ),
952
+ _chunkO6QIJQRNcjs.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 _chunkYKL44PYXcjs.store.call(void 0, ).query_stats(streams, {
981
- exclude: [_chunkNNWP65YMcjs.SNAP_EVENT]
980
+ const stats = await _chunkO6QIJQRNcjs.store.call(void 0, ).query_stats(streams, {
981
+ exclude: [_chunk7AHW7FCNcjs.SNAP_EVENT]
982
982
  });
983
- const domain_heads = await _chunkYKL44PYXcjs.store.call(void 0, ).query_stats(streams, {
984
- exclude: [_chunkNNWP65YMcjs.SNAP_EVENT, _chunkNNWP65YMcjs.TOMBSTONE_EVENT]
983
+ const domain_heads = await _chunkO6QIJQRNcjs.store.call(void 0, ).query_stats(streams, {
984
+ exclude: [_chunk7AHW7FCNcjs.SNAP_EVENT, _chunk7AHW7FCNcjs.TOMBSTONE_EVENT]
985
985
  });
986
- const true_heads = await _chunkYKL44PYXcjs.store.call(void 0, ).query_stats(streams, {});
986
+ const true_heads = await _chunkO6QIJQRNcjs.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]) === _chunkNNWP65YMcjs.TOMBSTONE_EVENT;
990
+ const interrupted = _optionalChain([marker_head, 'optionalAccess', _48 => _48.name]) === _chunk7AHW7FCNcjs.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
- _chunkYKL44PYXcjs.store.call(void 0, ),
1014
+ _chunkO6QIJQRNcjs.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 _chunkYKL44PYXcjs.store.call(void 0, ).query_stats(guarded, {});
1080
+ const heads = await _chunkO6QIJQRNcjs.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: _chunkNNWP65YMcjs.TOMBSTONE_EVENT, stream: guard.stream }
1098
+ event: { id: guard.id, name: _chunk7AHW7FCNcjs.TOMBSTONE_EVENT, stream: guard.stream }
1099
1099
  }
1100
1100
  }
1101
1101
  };
1102
1102
  });
1103
- const truncated = await _chunkYKL44PYXcjs.store.call(void 0, ).truncate(trunc_targets);
1103
+ const truncated = await _chunkO6QIJQRNcjs.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 _chunkYKL44PYXcjs.cache.call(void 0, ).set(stream, {
1109
+ await _chunkO6QIJQRNcjs.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 _chunkYKL44PYXcjs.cache.call(void 0, ).invalidate(stream);
1118
+ await _chunkO6QIJQRNcjs.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
- _chunkYKL44PYXcjs.log.call(void 0, ).error(new Error(message));
1132
+ _chunkO6QIJQRNcjs.log.call(void 0, ).error(new Error(message));
1133
1133
  }
1134
1134
 
1135
1135
  // src/internal/correlate-cycle.ts
@@ -1169,7 +1169,7 @@ var CorrelateCycle = (_class3 = class {
1169
1169
  // never drops their +Infinity floor.
1170
1170
 
1171
1171
  __init8() {this._static_subscriptions = /* @__PURE__ */ new Map()}
1172
- __init9() {this._patterns = new (0, _chunkYKL44PYXcjs.LruMap)(PATTERN_CACHE_SIZE)}
1172
+ __init9() {this._patterns = new (0, _chunkO6QIJQRNcjs.LruMap)(PATTERN_CACHE_SIZE)}
1173
1173
 
1174
1174
 
1175
1175
 
@@ -1190,7 +1190,7 @@ var CorrelateCycle = (_class3 = class {
1190
1190
  on_init_async
1191
1191
  }) {;_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);
1192
1192
  this._key = shard ? `${registry_key(registry.events)}:${[...shard].sort().join(",")}` : registry_key(registry.events);
1193
- this._dynamic_subscriptions = new (0, _chunkYKL44PYXcjs.LruMap)(max_subscribed_streams);
1193
+ this._dynamic_subscriptions = new (0, _chunkO6QIJQRNcjs.LruMap)(max_subscribed_streams);
1194
1194
  this._registry = registry;
1195
1195
  this._declared_lanes = declared_lanes;
1196
1196
  this._static_targets = static_targets;
@@ -1247,7 +1247,7 @@ var CorrelateCycle = (_class3 = class {
1247
1247
  /** Would the target's own `fetch` (filtered by `source`) return this event? */
1248
1248
  _in_fetch_window(source, stream) {
1249
1249
  if (source === void 0 || source === stream) return true;
1250
- if (_chunkYKL44PYXcjs.is_literal_source.call(void 0, source)) return false;
1250
+ if (_chunkO6QIJQRNcjs.is_literal_source.call(void 0, source)) return false;
1251
1251
  let pattern = this._patterns.get(source);
1252
1252
  if (!pattern) {
1253
1253
  pattern = new RegExp(source);
@@ -1285,7 +1285,7 @@ var CorrelateCycle = (_class3 = class {
1285
1285
  const correlated = /* @__PURE__ */ new Map();
1286
1286
  let last_id = after;
1287
1287
  let stopped = false;
1288
- const found = await _chunkYKL44PYXcjs.store.call(void 0, ).query(
1288
+ const found = await _chunkO6QIJQRNcjs.store.call(void 0, ).query(
1289
1289
  (event) => {
1290
1290
  if (stopped) return;
1291
1291
  const register = this._registry.events[event.name];
@@ -1329,9 +1329,9 @@ var CorrelateCycle = (_class3 = class {
1329
1329
  correlated_at: void 0
1330
1330
  };
1331
1331
  const seen_in_scan = correlated.has(resolved.target);
1332
- const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _63 => _63.lane])), () => ( _chunkNNWP65YMcjs.DEFAULT_LANE));
1332
+ const held_lane = _nullishCoalesce((seen_in_scan ? entry.lane : _optionalChain([recorded, 'optionalAccess', _63 => _63.lane])), () => ( _chunk7AHW7FCNcjs.DEFAULT_LANE));
1333
1333
  const held_priority = seen_in_scan ? entry.priority : _optionalChain([recorded, 'optionalAccess', _64 => _64.priority]);
1334
- const resolved_lane = _nullishCoalesce(lane, () => ( _chunkNNWP65YMcjs.DEFAULT_LANE));
1334
+ const resolved_lane = _nullishCoalesce(lane, () => ( _chunk7AHW7FCNcjs.DEFAULT_LANE));
1335
1335
  if (held_priority === priority && held_lane !== resolved_lane)
1336
1336
  report_lane_conflict(
1337
1337
  this._reported,
@@ -1406,7 +1406,7 @@ var CorrelateCycle = (_class3 = class {
1406
1406
  await Promise.all(
1407
1407
  missed.map(async ([stream, entry]) => {
1408
1408
  let row;
1409
- await _chunkYKL44PYXcjs.store.call(void 0, ).query_streams(
1409
+ await _chunkO6QIJQRNcjs.store.call(void 0, ).query_streams(
1410
1410
  (position) => {
1411
1411
  row = position;
1412
1412
  },
@@ -1419,8 +1419,8 @@ var CorrelateCycle = (_class3 = class {
1419
1419
  lane: row.lane
1420
1420
  });
1421
1421
  if (entry.priority > row.priority) return;
1422
- const held_lane = _nullishCoalesce(row.lane, () => ( _chunkNNWP65YMcjs.DEFAULT_LANE));
1423
- const resolved_lane = _nullishCoalesce(entry.lane, () => ( _chunkNNWP65YMcjs.DEFAULT_LANE));
1422
+ const held_lane = _nullishCoalesce(row.lane, () => ( _chunk7AHW7FCNcjs.DEFAULT_LANE));
1423
+ const resolved_lane = _nullishCoalesce(entry.lane, () => ( _chunk7AHW7FCNcjs.DEFAULT_LANE));
1424
1424
  if (entry.priority === row.priority && held_lane !== resolved_lane)
1425
1425
  report_lane_conflict(
1426
1426
  this._reported,
@@ -1445,7 +1445,7 @@ var CorrelateCycle = (_class3 = class {
1445
1445
  millis: 0
1446
1446
  });
1447
1447
  } catch (error) {
1448
- _chunkYKL44PYXcjs.log.call(void 0, ).warn(
1448
+ _chunkO6QIJQRNcjs.log.call(void 0, ).warn(
1449
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)}`
1450
1450
  );
1451
1451
  }
@@ -1598,14 +1598,14 @@ function compute_lag_lead_ratio(handled, lagging, leading) {
1598
1598
  }
1599
1599
 
1600
1600
  // src/internal/drain-ops.ts
1601
- var claim = (lagging, leading, by, millis, lane) => _chunkYKL44PYXcjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane);
1601
+ var claim = (lagging, leading, by, millis, lane) => _chunkO6QIJQRNcjs.store.call(void 0, ).claim(lagging, leading, by, millis, lane);
1602
1602
  async function fetch(leased, eventLimit) {
1603
1603
  return Promise.all(
1604
1604
  leased.map(async ({ stream, source, at, lagging }) => {
1605
1605
  const events = [];
1606
- const stream_exact = source !== void 0 && _chunkYKL44PYXcjs.is_literal_source.call(void 0, source) ? true : void 0;
1606
+ const stream_exact = source !== void 0 && _chunkO6QIJQRNcjs.is_literal_source.call(void 0, source) ? true : void 0;
1607
1607
  try {
1608
- await _chunkYKL44PYXcjs.store.call(void 0, ).query((e) => events.push(e), {
1608
+ await _chunkO6QIJQRNcjs.store.call(void 0, ).query((e) => events.push(e), {
1609
1609
  stream: source,
1610
1610
  stream_exact,
1611
1611
  after: at,
@@ -1625,30 +1625,30 @@ async function fetch(leased, eventLimit) {
1625
1625
  })
1626
1626
  );
1627
1627
  }
1628
- var ack = (leases) => _chunkYKL44PYXcjs.store.call(void 0, ).ack(leases);
1629
- var block = (leases) => _chunkYKL44PYXcjs.store.call(void 0, ).block(leases);
1630
- var subscribe = (streams, correlated_at, correlator) => _chunkYKL44PYXcjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator);
1628
+ var ack = (leases) => _chunkO6QIJQRNcjs.store.call(void 0, ).ack(leases);
1629
+ var block = (leases) => _chunkO6QIJQRNcjs.store.call(void 0, ).block(leases);
1630
+ var subscribe = (streams, correlated_at, correlator) => _chunkO6QIJQRNcjs.store.call(void 0, ).subscribe(streams, correlated_at, correlator);
1631
1631
 
1632
1632
  // src/internal/event-sourcing.ts
1633
1633
  var _actpatch = require('@rotorsoft/act-patch');
1634
1634
  var bare_patch = (_me, state2, partial) => _actpatch.patch.call(void 0, state2, partial);
1635
1635
  var validating_patch = (me, state2, partial, event) => {
1636
1636
  const next = _actpatch.patch.call(void 0, state2, partial);
1637
- return _chunkYKL44PYXcjs.validate.call(void 0,
1637
+ return _chunkO6QIJQRNcjs.validate.call(void 0,
1638
1638
  `${me.name}.${String(event.name)}#${event.id}`,
1639
1639
  next,
1640
1640
  me.state
1641
1641
  );
1642
1642
  };
1643
1643
  var DEFAULT_BATCH = 500;
1644
- var cache_put = (stream, entry) => _chunkYKL44PYXcjs.cache.call(void 0, ).set(stream, entry).catch(
1645
- (err) => _chunkYKL44PYXcjs.log.call(void 0, ).warn(
1644
+ var cache_put = (stream, entry) => _chunkO6QIJQRNcjs.cache.call(void 0, ).set(stream, entry).catch(
1645
+ (err) => _chunkO6QIJQRNcjs.log.call(void 0, ).warn(
1646
1646
  err,
1647
1647
  "cache set skipped; the next load re-folds from the store"
1648
1648
  )
1649
1649
  );
1650
- var cache_drop = (stream) => _chunkYKL44PYXcjs.cache.call(void 0, ).invalidate(stream).catch(
1651
- (err) => _chunkYKL44PYXcjs.log.call(void 0, ).warn(
1650
+ var cache_drop = (stream) => _chunkO6QIJQRNcjs.cache.call(void 0, ).invalidate(stream).catch(
1651
+ (err) => _chunkO6QIJQRNcjs.log.call(void 0, ).warn(
1652
1652
  err,
1653
1653
  "cache invalidate skipped; a stale checkpoint re-folds from its event_id"
1654
1654
  )
@@ -1656,9 +1656,9 @@ var cache_drop = (stream) => _chunkYKL44PYXcjs.cache.call(void 0, ).invalidate(s
1656
1656
  async function snap(snapshot) {
1657
1657
  const { id, stream, name, meta, version } = snapshot.event;
1658
1658
  try {
1659
- const [committed] = await _chunkYKL44PYXcjs.store.call(void 0, ).commit(
1659
+ const [committed] = await _chunkO6QIJQRNcjs.store.call(void 0, ).commit(
1660
1660
  stream,
1661
- [{ name: _chunkNNWP65YMcjs.SNAP_EVENT, data: snapshot.state }],
1661
+ [{ name: _chunk7AHW7FCNcjs.SNAP_EVENT, data: snapshot.state }],
1662
1662
  {
1663
1663
  correlation: meta.correlation,
1664
1664
  causation: { event: { id, name, stream } }
@@ -1669,22 +1669,22 @@ async function snap(snapshot) {
1669
1669
  return committed;
1670
1670
  } catch (error) {
1671
1671
  const reason = error instanceof Error ? error.message : String(error);
1672
- _chunkYKL44PYXcjs.log.call(void 0, ).warn(
1672
+ _chunkO6QIJQRNcjs.log.call(void 0, ).warn(
1673
1673
  `Snapshot write failed on stream "${stream}": ${reason} \u2014 cold starts will replay full history until snapshots succeed.`
1674
1674
  );
1675
1675
  }
1676
1676
  }
1677
1677
  async function tombstone(stream, expectedVersion, correlation) {
1678
1678
  try {
1679
- const [committed] = await _chunkYKL44PYXcjs.store.call(void 0, ).commit(
1679
+ const [committed] = await _chunkO6QIJQRNcjs.store.call(void 0, ).commit(
1680
1680
  stream,
1681
- [{ name: _chunkNNWP65YMcjs.TOMBSTONE_EVENT, data: {} }],
1681
+ [{ name: _chunk7AHW7FCNcjs.TOMBSTONE_EVENT, data: {} }],
1682
1682
  { correlation, causation: {} },
1683
1683
  expectedVersion
1684
1684
  );
1685
1685
  return committed;
1686
1686
  } catch (error) {
1687
- if (error instanceof _chunkNNWP65YMcjs.ConcurrencyError) return void 0;
1687
+ if (error instanceof _chunk7AHW7FCNcjs.ConcurrencyError) return void 0;
1688
1688
  throw error;
1689
1689
  }
1690
1690
  }
@@ -1714,9 +1714,9 @@ async function scan(source, opts = {}, callback) {
1714
1714
  if (drop_closed_streams) {
1715
1715
  await source.query(
1716
1716
  (e) => {
1717
- if (e.name === _chunkNNWP65YMcjs.TOMBSTONE_EVENT) closed_streams.add(e.stream);
1717
+ if (e.name === _chunk7AHW7FCNcjs.TOMBSTONE_EVENT) closed_streams.add(e.stream);
1718
1718
  },
1719
- { names: [_chunkNNWP65YMcjs.TOMBSTONE_EVENT] }
1719
+ { names: [_chunk7AHW7FCNcjs.TOMBSTONE_EVENT] }
1720
1720
  );
1721
1721
  }
1722
1722
  let max_id;
@@ -1738,11 +1738,11 @@ async function scan(source, opts = {}, callback) {
1738
1738
  if (!is_valid(event))
1739
1739
  throw new Error(`Invalid event at index ${processed}`);
1740
1740
  if (on_progress) on_progress({ processed, id: event.id, max_id });
1741
- if (drop_snapshots && event.name === _chunkNNWP65YMcjs.SNAP_EVENT) {
1741
+ if (drop_snapshots && event.name === _chunk7AHW7FCNcjs.SNAP_EVENT) {
1742
1742
  dropped_snaps++;
1743
1743
  return;
1744
1744
  }
1745
- if (closed_streams.has(event.stream) && event.name !== _chunkNNWP65YMcjs.TOMBSTONE_EVENT) {
1745
+ if (closed_streams.has(event.stream) && event.name !== _chunk7AHW7FCNcjs.TOMBSTONE_EVENT) {
1746
1746
  dropped_closed++;
1747
1747
  return;
1748
1748
  }
@@ -1809,17 +1809,17 @@ async function scan(source, opts = {}, callback) {
1809
1809
  async function load(me, target, callback, patch_fn = bare_patch) {
1810
1810
  const { stream, actor, asOf } = target;
1811
1811
  const time_travel = !!asOf && Object.values(asOf).some((v) => v !== void 0);
1812
- const cached = time_travel ? void 0 : await _chunkYKL44PYXcjs.cache.call(void 0, ).get(stream);
1812
+ const cached = time_travel ? void 0 : await _chunkO6QIJQRNcjs.cache.call(void 0, ).get(stream);
1813
1813
  const cache_hit = !!cached;
1814
1814
  let state2 = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _74 => _74.state]), () => ( (me.init ? me.init() : {})));
1815
1815
  let patches = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _75 => _75.patches]), () => ( 0));
1816
1816
  let snaps = _nullishCoalesce(_optionalChain([cached, 'optionalAccess', _76 => _76.snaps]), () => ( 0));
1817
1817
  let replayed = 0;
1818
1818
  let event;
1819
- await _chunkYKL44PYXcjs.store.call(void 0, ).query(
1819
+ await _chunkO6QIJQRNcjs.store.call(void 0, ).query(
1820
1820
  (raw) => {
1821
1821
  event = me.view(raw, actor);
1822
- if (event.name === _chunkNNWP65YMcjs.SNAP_EVENT) {
1822
+ if (event.name === _chunk7AHW7FCNcjs.SNAP_EVENT) {
1823
1823
  state2 = event.data;
1824
1824
  snaps++;
1825
1825
  patches = 0;
@@ -1828,8 +1828,8 @@ async function load(me, target, callback, patch_fn = bare_patch) {
1828
1828
  state2 = patch_fn(me, state2, me.patch[event.name](event, state2), event);
1829
1829
  patches++;
1830
1830
  replayed++;
1831
- } else if (event.name !== _chunkNNWP65YMcjs.TOMBSTONE_EVENT) {
1832
- _chunkYKL44PYXcjs.log.call(void 0, ).warn(
1831
+ } else if (event.name !== _chunk7AHW7FCNcjs.TOMBSTONE_EVENT) {
1832
+ _chunkO6QIJQRNcjs.log.call(void 0, ).warn(
1833
1833
  `Skipping unknown event "${String(event.name)}" on stream "${stream}" (id=${event.id}) \u2014 no reducer in state "${me.name}"`
1834
1834
  );
1835
1835
  }
@@ -1853,7 +1853,7 @@ async function load(me, target, callback, patch_fn = bare_patch) {
1853
1853
  ...cached ? { after: cached.event_id, with_snaps: true } : { ...time_travel ? {} : { with_snaps: true }, ...asOf }
1854
1854
  }
1855
1855
  );
1856
- const head_is_tombstone = _optionalChain([event, 'optionalAccess', _78 => _78.name]) === _chunkNNWP65YMcjs.TOMBSTONE_EVENT;
1856
+ const head_is_tombstone = _optionalChain([event, 'optionalAccess', _78 => _78.name]) === _chunk7AHW7FCNcjs.TOMBSTONE_EVENT;
1857
1857
  if (replayed > 0 && !time_travel && event && !me.pii_aware && !head_is_tombstone) {
1858
1858
  await cache_put(stream, {
1859
1859
  stream,
@@ -1881,7 +1881,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1881
1881
  if (!stream) throw new Error("Missing target stream");
1882
1882
  const reactingTo = _optionalChain([options, 'optionalAccess', _83 => _83.reactingTo]);
1883
1883
  const correlator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _84 => _84.correlator]), () => ( default_correlator));
1884
- const validated = _chunkYKL44PYXcjs.validate.call(void 0, action2, payload, me.actions[action2]);
1884
+ const validated = _chunkO6QIJQRNcjs.validate.call(void 0, action2, payload, me.actions[action2]);
1885
1885
  const opts = _optionalChain([me, 'access', _85 => _85.options, 'optionalAccess', _86 => _86[action2]]);
1886
1886
  const max_retries = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _87 => _87.maxRetries]), () => ( 0));
1887
1887
  for (let attempt = 0; ; attempt++) {
@@ -1892,14 +1892,14 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1892
1892
  void 0,
1893
1893
  patch_fn
1894
1894
  );
1895
- if (_optionalChain([snapshot, 'access', _88 => _88.event, 'optionalAccess', _89 => _89.name]) === _chunkNNWP65YMcjs.TOMBSTONE_EVENT)
1896
- throw new (0, _chunkNNWP65YMcjs.StreamClosedError)(stream);
1895
+ if (_optionalChain([snapshot, 'access', _88 => _88.event, 'optionalAccess', _89 => _89.name]) === _chunk7AHW7FCNcjs.TOMBSTONE_EVENT)
1896
+ throw new (0, _chunk7AHW7FCNcjs.StreamClosedError)(stream);
1897
1897
  const expected = _nullishCoalesce(expectedVersion, () => ( (snapshot.version >= 0 ? snapshot.version : void 0)));
1898
1898
  if (me.given) {
1899
1899
  const invariants = me.given[action2] || [];
1900
1900
  invariants.forEach(({ valid: valid2, description }) => {
1901
1901
  if (!valid2(snapshot.state, actor))
1902
- throw new (0, _chunkNNWP65YMcjs.InvariantError)(
1902
+ throw new (0, _chunk7AHW7FCNcjs.InvariantError)(
1903
1903
  action2,
1904
1904
  validated,
1905
1905
  target,
@@ -1916,7 +1916,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1916
1916
  const tuples = Array.isArray(result[0]) ? result : [result];
1917
1917
  const valid = tuples.map(([name, data]) => ({
1918
1918
  name,
1919
- data: _chunkYKL44PYXcjs.validate.call(void 0, name, data, me.events[name])
1919
+ data: _chunkO6QIJQRNcjs.validate.call(void 0, name, data, me.events[name])
1920
1920
  }));
1921
1921
  const emitted = valid.map((e) => me.message(e));
1922
1922
  const meta = {
@@ -1941,7 +1941,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1941
1941
  };
1942
1942
  let committed;
1943
1943
  try {
1944
- committed = await _chunkYKL44PYXcjs.store.call(void 0, ).commit(
1944
+ committed = await _chunkO6QIJQRNcjs.store.call(void 0, ).commit(
1945
1945
  stream,
1946
1946
  emitted,
1947
1947
  meta,
@@ -1950,7 +1950,7 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1950
1950
  reactingTo ? expectedVersion : expected
1951
1951
  );
1952
1952
  } catch (error) {
1953
- if (error instanceof _chunkNNWP65YMcjs.ConcurrencyError) void cache_drop(stream);
1953
+ if (error instanceof _chunk7AHW7FCNcjs.ConcurrencyError) void cache_drop(stream);
1954
1954
  throw error;
1955
1955
  }
1956
1956
  let { state: state2, patches } = snapshot;
@@ -1989,19 +1989,19 @@ async function action(me, action2, target, payload, options, patch_fn = bare_pat
1989
1989
  }
1990
1990
  return snapshots;
1991
1991
  } catch (error) {
1992
- if (!(error instanceof _chunkNNWP65YMcjs.ConcurrencyError)) throw error;
1992
+ if (!(error instanceof _chunk7AHW7FCNcjs.ConcurrencyError)) throw error;
1993
1993
  if (expectedVersion !== void 0) throw error;
1994
1994
  if (attempt >= max_retries) throw error;
1995
1995
  if (_optionalChain([opts, 'optionalAccess', _96 => _96.backoff])) {
1996
1996
  const delay_ms = compute_backoff_delay(attempt, opts.backoff);
1997
- if (delay_ms > 0) await _chunkYKL44PYXcjs.sleep.call(void 0, delay_ms);
1997
+ if (delay_ms > 0) await _chunkO6QIJQRNcjs.sleep.call(void 0, delay_ms);
1998
1998
  }
1999
1999
  }
2000
2000
  }
2001
2001
  }
2002
2002
 
2003
2003
  // src/internal/tracing.ts
2004
- var PRETTY = _chunkYKL44PYXcjs.config.call(void 0, ).env !== "production";
2004
+ var PRETTY = _chunkO6QIJQRNcjs.config.call(void 0, ).env !== "production";
2005
2005
  var C_BLUE = "\x1B[38;5;39m";
2006
2006
  var C_ORANGE = "\x1B[38;5;208m";
2007
2007
  var C_GREEN = "\x1B[38;5;42m";
@@ -2187,7 +2187,7 @@ function budget_exhausted(lease, options, store_failing) {
2187
2187
  if (store_failing || !_optionalChain([options, 'optionalAccess', _106 => _106.blockOnError]) || lease.retry <= options.maxRetries)
2188
2188
  return void 0;
2189
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.`;
2190
- _chunkYKL44PYXcjs.log.call(void 0, ).error(error);
2190
+ _chunkO6QIJQRNcjs.log.call(void 0, ).error(error);
2191
2191
  return { lease, handled: 0, acked_at: lease.at, error, block: true };
2192
2192
  }
2193
2193
  function fetch_failure_policy(registry) {
@@ -2203,13 +2203,13 @@ function fetch_failure_policy(registry) {
2203
2203
  function finalize(lease, handled, at, error, options, logger, failed_at) {
2204
2204
  if (!error) return { lease, handled, acked_at: at };
2205
2205
  logger.error(error);
2206
- const non_retryable = error instanceof _chunkNNWP65YMcjs.NonRetryableError;
2206
+ const non_retryable = error instanceof _chunk7AHW7FCNcjs.NonRetryableError;
2207
2207
  const block2 = options.blockOnError && (non_retryable || lease.retry >= options.maxRetries);
2208
2208
  if (block2)
2209
2209
  logger.error(
2210
2210
  non_retryable ? `Blocking ${lease.stream} on non-retryable error.` : `Blocking ${lease.stream} after ${lease.retry} retries.`
2211
2211
  );
2212
- const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkYKL44PYXcjs.DEFAULT_BACKOFF)));
2212
+ const next_attempt_at = block2 ? void 0 : Date.now() + compute_backoff_delay(lease.retry, _nullishCoalesce(options.backoff, () => ( _chunkO6QIJQRNcjs.DEFAULT_BACKOFF)));
2213
2213
  return {
2214
2214
  lease,
2215
2215
  handled,
@@ -2338,7 +2338,7 @@ async function run_drain_cycle(deps, cycle) {
2338
2338
  const acked = await ops.ack(submitted);
2339
2339
  const expected = submitted.filter((l) => l.due === void 0).length;
2340
2340
  if (acked.length < expected)
2341
- _chunkYKL44PYXcjs.log.call(void 0, ).warn(
2341
+ _chunkO6QIJQRNcjs.log.call(void 0, ).warn(
2342
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.`
2343
2343
  );
2344
2344
  const closeable = handled.filter((h) => h.close !== void 0).map((h) => h.close);
@@ -2424,9 +2424,9 @@ var DrainController = (_class5 = class {
2424
2424
  if (!this._armed) return EMPTY_DRAIN;
2425
2425
  if (this._locked) return EMPTY_DRAIN;
2426
2426
  const d = _nullishCoalesce(this._deps.defaults, () => ( {}));
2427
- const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkYKL44PYXcjs.DEFAULT_STREAM_LIMIT));
2428
- const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkYKL44PYXcjs.DEFAULT_EVENT_LIMIT));
2429
- const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkYKL44PYXcjs.DEFAULT_LEASE_MILLIS));
2427
+ const streamLimit = _nullishCoalesce(_nullishCoalesce(d.streamLimit, () => ( options.streamLimit)), () => ( _chunkO6QIJQRNcjs.DEFAULT_STREAM_LIMIT));
2428
+ const eventLimit = _nullishCoalesce(options.eventLimit, () => ( _chunkO6QIJQRNcjs.DEFAULT_EVENT_LIMIT));
2429
+ const leaseMillis = _nullishCoalesce(_nullishCoalesce(d.leaseMillis, () => ( options.leaseMillis)), () => ( _chunkO6QIJQRNcjs.DEFAULT_LEASE_MILLIS));
2430
2430
  if (this._deps.breaker.state(Date.now()) === "open")
2431
2431
  return EMPTY_DRAIN;
2432
2432
  try {
@@ -2498,7 +2498,7 @@ function pii_gate(event, fields, predicate, actor) {
2498
2498
  const { pii, ...rest } = event;
2499
2499
  if (pii == null) {
2500
2500
  const shredded = { ...data };
2501
- for (const f of fields) shredded[f] = _chunkNNWP65YMcjs.SHREDDED;
2501
+ for (const f of fields) shredded[f] = _chunk7AHW7FCNcjs.SHREDDED;
2502
2502
  return { ...rest, data: shredded };
2503
2503
  }
2504
2504
  const allowed = !!actor && !!predicate && predicate(event, actor);
@@ -2509,7 +2509,7 @@ function pii_gate(event, fields, predicate, actor) {
2509
2509
  };
2510
2510
  }
2511
2511
  const redacted = { ...data };
2512
- for (const f of fields) redacted[f] = _chunkNNWP65YMcjs.REDACTED;
2512
+ for (const f of fields) redacted[f] = _chunk7AHW7FCNcjs.REDACTED;
2513
2513
  return { ...rest, data: redacted };
2514
2514
  }
2515
2515
  var IDENTITY_GATE = (event) => event;
@@ -2646,7 +2646,7 @@ function make_deferred(handler, schedule) {
2646
2646
  const call = handler;
2647
2647
  const deferred = async (event, stream, app) => {
2648
2648
  const when = typeof schedule === "function" ? schedule(event) : schedule;
2649
- if (Date.now() < resolve_defer_at(when, event)) throw new (0, _chunkNNWP65YMcjs.DeferSignal)(when);
2649
+ if (Date.now() < resolve_defer_at(when, event)) throw new (0, _chunk7AHW7FCNcjs.DeferSignal)(when);
2650
2650
  return call(event, stream, app);
2651
2651
  };
2652
2652
  Object.defineProperty(deferred, "name", { value: handler.name });
@@ -2715,7 +2715,7 @@ function build_handle(deps) {
2715
2715
  handled++;
2716
2716
  }
2717
2717
  } catch (error) {
2718
- if (error instanceof _chunkNNWP65YMcjs.DeferSignal)
2718
+ if (error instanceof _chunk7AHW7FCNcjs.DeferSignal)
2719
2719
  return {
2720
2720
  lease,
2721
2721
  handled,
@@ -2785,24 +2785,23 @@ function build_handle_batch(logger) {
2785
2785
  // src/internal/settle.ts
2786
2786
  var SettleLoop = (_class6 = class {
2787
2787
  __init18() {this._timer = void 0}
2788
- __init19() {this._running = false}
2789
2788
  /**
2790
- * Resolves when the cycle in flight finishes, so shutdown can wait for
2791
- * it (`stop()` cancels scheduling only). Never rejects.
2789
+ * The cycle in flight, set while one runs. Shutdown waits for it
2790
+ * (`stop()` cancels scheduling only). Never rejects.
2792
2791
  */
2793
2792
 
2794
2793
  /** A wake-up arrived while a cycle ran: run one more pass after it. */
2795
- __init20() {this._pending = false}
2794
+ __init19() {this._pending = false}
2796
2795
  /** The last caller's options, used by the next pass. */
2797
- __init21() {this._next = void 0}
2796
+ __init20() {this._next = void 0}
2798
2797
  /** When the scheduled pass fires (epoch ms). */
2799
- __init22() {this._due = 0}
2798
+ __init21() {this._due = 0}
2800
2799
  /** Set at shutdown: nothing schedules again. */
2801
- __init23() {this._stopped = false}
2800
+ __init22() {this._stopped = false}
2802
2801
 
2803
2802
  /** Debounce window applied when the caller doesn't override via `SettleOptions.debounceMs`. */
2804
2803
 
2805
- constructor(deps, default_debounce_ms) {;_class6.prototype.__init18.call(this);_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);
2804
+ constructor(deps, default_debounce_ms) {;_class6.prototype.__init18.call(this);_class6.prototype.__init19.call(this);_class6.prototype.__init20.call(this);_class6.prototype.__init21.call(this);_class6.prototype.__init22.call(this);
2806
2805
  this._deps = deps;
2807
2806
  this._default_debounce_ms = default_debounce_ms;
2808
2807
  }
@@ -2820,7 +2819,7 @@ var SettleLoop = (_class6 = class {
2820
2819
  schedule(options) {
2821
2820
  if (this._stopped) return;
2822
2821
  if (options) this._next = options;
2823
- if (this._running) {
2822
+ if (this._inflight) {
2824
2823
  this._pending = true;
2825
2824
  return;
2826
2825
  }
@@ -2840,15 +2839,10 @@ var SettleLoop = (_class6 = class {
2840
2839
  ...drain_options
2841
2840
  } = _nullishCoalesce(this._next, () => ( {}));
2842
2841
  this._next = void 0;
2843
- this._running = true;
2844
- let settle_done;
2845
- this._inflight = new Promise((done) => {
2846
- settle_done = done;
2847
- });
2848
- (async () => {
2842
+ this._inflight = (async () => {
2849
2843
  await this._deps.init();
2850
2844
  let settled_drain;
2851
- for (let i = 0; i < maxPasses; i++) {
2845
+ for (let i = 0; i < maxPasses && !this._stopped; i++) {
2852
2846
  const after_before = this._deps.checkpoint();
2853
2847
  const { subscribed, last_id, scanned } = await this._deps.correlate({
2854
2848
  ...correlate_query,
@@ -2869,9 +2863,7 @@ var SettleLoop = (_class6 = class {
2869
2863
  })().catch((err) => {
2870
2864
  this._deps.breaker.failed(Date.now(), err);
2871
2865
  }).finally(() => {
2872
- this._running = false;
2873
2866
  this._inflight = void 0;
2874
- settle_done();
2875
2867
  if (this._pending) {
2876
2868
  this._pending = false;
2877
2869
  this.schedule(this._next);
@@ -2913,7 +2905,7 @@ function validate_only_lanes(options, lanes) {
2913
2905
  );
2914
2906
  }
2915
2907
  var Act = (_class7 = class {
2916
- __init24() {this._emitter = new (0, _events2.default)()}
2908
+ __init23() {this._emitter = new (0, _events2.default)()}
2917
2909
 
2918
2910
 
2919
2911
 
@@ -2990,22 +2982,22 @@ var Act = (_class7 = class {
2990
2982
  /** Lanes to arm per event; `"all"` when a dynamic resolver hides the lane. */
2991
2983
 
2992
2984
 
2993
- __init25() {this._logger = _chunkYKL44PYXcjs.log.call(void 0, )}
2985
+ __init24() {this._logger = _chunkO6QIJQRNcjs.log.call(void 0, )}
2994
2986
  /** This Act's ports: its own bag, or the singleton adapters. */
2995
2987
 
2996
2988
  /** Runs a body so internal `store()`/`cache()` calls resolve to `_ports`. */
2997
2989
 
2998
2990
 
2999
2991
  // Bound once, reused by every reaction payload.
3000
- __init26() {this._bound_do = this.do.bind(this)}
3001
- __init27() {this._bound_load = this.load.bind(this)}
3002
- __init28() {this._bound_query = this.query.bind(this)}
3003
- __init29() {this._bound_query_array = this.query_array.bind(this)}
3004
- __init30() {this._bound_forget = this.forget.bind(this)}
2992
+ __init25() {this._bound_do = this.do.bind(this)}
2993
+ __init26() {this._bound_load = this.load.bind(this)}
2994
+ __init27() {this._bound_query = this.query.bind(this)}
2995
+ __init28() {this._bound_query_array = this.query_array.bind(this)}
2996
+ __init29() {this._bound_forget = this.forget.bind(this)}
3005
2997
 
3006
2998
 
3007
2999
 
3008
- __init31() {this._close_lock = new CloseLock()}
3000
+ __init30() {this._close_lock = new CloseLock()}
3009
3001
  /** Every lane a controller can exist for: `"default"` plus each declared one. */
3010
3002
 
3011
3003
  /** Drain lanes declared via `.withLane(...)`. Implicit default not included. */
@@ -3013,16 +3005,16 @@ var Act = (_class7 = class {
3013
3005
  return this._lanes;
3014
3006
  }
3015
3007
  /** Use the {@link act} builder rather than constructing directly. */
3016
- 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);_class7.prototype.__init27.call(this);_class7.prototype.__init28.call(this);_class7.prototype.__init29.call(this);_class7.prototype.__init30.call(this);_class7.prototype.__init31.call(this);
3008
+ constructor(registry, states = /* @__PURE__ */ new Map(), batch_handlers = /* @__PURE__ */ new Map(), options = {}, lanes = [], patch_fn = bare_patch) {;_class7.prototype.__init23.call(this);_class7.prototype.__init24.call(this);_class7.prototype.__init25.call(this);_class7.prototype.__init26.call(this);_class7.prototype.__init27.call(this);_class7.prototype.__init28.call(this);_class7.prototype.__init29.call(this);_class7.prototype.__init30.call(this);
3017
3009
  this.registry = registry;
3018
3010
  this._states = states;
3019
3011
  this._batch_handlers = batch_handlers;
3020
3012
  this._lanes = lanes;
3021
3013
  this._declared_lanes = ["default", ...lanes.map((l) => l.name)];
3022
3014
  validate_only_lanes(options, lanes);
3023
- this._ports = _nullishCoalesce(options.scoped, () => ( _chunkYKL44PYXcjs.default_scope.call(void 0, )));
3015
+ this._ports = _nullishCoalesce(options.scoped, () => ( _chunkO6QIJQRNcjs.default_scope.call(void 0, )));
3024
3016
  const ports = this._ports;
3025
- this._scoped = _chunkYKL44PYXcjs.make_run_scoped.call(void 0, {
3017
+ this._scoped = _chunkO6QIJQRNcjs.make_run_scoped.call(void 0, {
3026
3018
  // Getters, not a spread: the singletons resolve lazily, so a later
3027
3019
  // `store(...)` / `cache(...)` still takes effect.
3028
3020
  get store() {
@@ -3032,14 +3024,14 @@ var Act = (_class7 = class {
3032
3024
  return ports.cache;
3033
3025
  },
3034
3026
  // Parsed per build, so a bad window throws on every build.
3035
- autoclose_window: _chunkYKL44PYXcjs.resolveAutocloseConfig.call(void 0, options).autocloseWindow
3027
+ autoclose_window: _chunkO6QIJQRNcjs.resolveAutocloseConfig.call(void 0, options).autocloseWindow
3036
3028
  });
3037
3029
  this._correlator = _nullishCoalesce(options.correlator, () => ( default_correlator));
3038
3030
  this._es = build_es(this._logger, this._correlator, patch_fn);
3039
3031
  this._cd = build_drain(this._logger);
3040
3032
  this._handle = build_handle({
3041
3033
  logger: this._logger,
3042
- reaction_scope: _chunkYKL44PYXcjs.make_reaction_scope.call(void 0, {
3034
+ reaction_scope: _chunkO6QIJQRNcjs.make_reaction_scope.call(void 0, {
3043
3035
  do: this._bound_do,
3044
3036
  load: this._bound_load,
3045
3037
  query: this._bound_query,
@@ -3062,12 +3054,12 @@ var Act = (_class7 = class {
3062
3054
  this._correlate = this._build_correlate(options, classification);
3063
3055
  this._settle = this._build_settle(options);
3064
3056
  this._notify_disposer = this._wire_notify(this._ports.store);
3065
- _chunkYKL44PYXcjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
3057
+ _chunkO6QIJQRNcjs.register_weak_disposer.call(void 0, new WeakRef(this), (self) => self.shutdown());
3066
3058
  }
3067
3059
  /** Shared by drain, settle and autoclose; bad knobs throw at build. */
3068
3060
  _build_breaker(options) {
3069
3061
  return new CircuitBreaker(
3070
- _chunkYKL44PYXcjs.resolveCircuitBreakerConfig.call(void 0, options.circuitBreaker),
3062
+ _chunkO6QIJQRNcjs.resolveCircuitBreakerConfig.call(void 0, options.circuitBreaker),
3071
3063
  {
3072
3064
  on_error: (error, circuit) => this._emit_error(error, circuit),
3073
3065
  // When the cooldown elapses, settle once: its scan or claim is the
@@ -3101,7 +3093,7 @@ var Act = (_class7 = class {
3101
3093
  try {
3102
3094
  await this._run_close(targets);
3103
3095
  } catch (error) {
3104
- if (error instanceof _chunkNNWP65YMcjs.StoreError) throw error;
3096
+ if (error instanceof _chunk7AHW7FCNcjs.StoreError) throw error;
3105
3097
  this._logger.error(
3106
3098
  error,
3107
3099
  `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.`
@@ -3136,7 +3128,7 @@ var Act = (_class7 = class {
3136
3128
  /** Audit deps, built after the controllers so the lane set is final. */
3137
3129
  _build_audit_deps() {
3138
3130
  return {
3139
- store: _chunkYKL44PYXcjs.store,
3131
+ store: _chunkO6QIJQRNcjs.store,
3140
3132
  event_to_state: this._event_to_state,
3141
3133
  // Declared lanes, not this process's controllers: a lane another
3142
3134
  // worker drains is not `unknown-lane`.
@@ -3149,7 +3141,7 @@ var Act = (_class7 = class {
3149
3141
  registry: this.registry,
3150
3142
  static_targets: classification.static_targets,
3151
3143
  cd: this._cd,
3152
- max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => ( _chunkNNWP65YMcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS)),
3144
+ max_subscribed_streams: _nullishCoalesce(options.maxSubscribedStreams, () => ( _chunk7AHW7FCNcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS)),
3153
3145
  // Declared lanes (not active ones): a lane another process claims is
3154
3146
  // still a valid destination.
3155
3147
  declared_lanes: new Set(this._declared_lanes),
@@ -3163,7 +3155,7 @@ var Act = (_class7 = class {
3163
3155
  /** Cold start: an idle deferred stream still fires on time after a restart. */
3164
3156
  async _seed_persisted_defers() {
3165
3157
  const now = Date.now();
3166
- await walk_streams(_chunkYKL44PYXcjs.store.call(void 0, ), (pos) => {
3158
+ await walk_streams(_chunkO6QIJQRNcjs.store.call(void 0, ), (pos) => {
3167
3159
  if (pos.deferred_at === void 0 || pos.deferred_at <= now) return;
3168
3160
  const controller = this._drain_controllers.get(_nullishCoalesce(pos.lane, () => ( "default")));
3169
3161
  _optionalChain([controller, 'optionalAccess', _128 => _128.seed_defer, 'call', _129 => _129(pos.stream, pos.deferred_at)]);
@@ -3178,11 +3170,13 @@ var Act = (_class7 = class {
3178
3170
  { ...q, limit: _nullishCoalesce(_nullishCoalesce(q.limit, () => ( this._poll_limit)), () => ( 100)) },
3179
3171
  true
3180
3172
  ),
3181
- drain: (o) => this.drain(o),
3173
+ // `settle()` validated the options, and `_schedule` skips writer-only
3174
+ // instances, so the loop drains through the internal path.
3175
+ drain: (o) => this._scoped(() => this._drain_all(o)),
3182
3176
  on_settled: (drain) => this.emit("settled", drain),
3183
3177
  breaker: this._breaker
3184
3178
  },
3185
- _nullishCoalesce(options.settleDebounceMs, () => ( _chunkNNWP65YMcjs.DEFAULT_SETTLE_DEBOUNCE_MS))
3179
+ _nullishCoalesce(options.settleDebounceMs, () => ( _chunk7AHW7FCNcjs.DEFAULT_SETTLE_DEBOUNCE_MS))
3186
3180
  );
3187
3181
  }
3188
3182
 
@@ -3201,7 +3195,7 @@ var Act = (_class7 = class {
3201
3195
  */
3202
3196
  shutdown(options) {
3203
3197
  if (!this._shutdown_promise) {
3204
- _chunkYKL44PYXcjs.resolveShutdownConfig.call(void 0, options);
3198
+ _chunkO6QIJQRNcjs.resolveShutdownConfig.call(void 0, options);
3205
3199
  this._shutdown_promise = (async () => {
3206
3200
  this.stop_correlations();
3207
3201
  const disposer = await this._notify_disposer;
@@ -3221,10 +3215,10 @@ var Act = (_class7 = class {
3221
3215
  * default for none or 0, and for a running settle), capped.
3222
3216
  */
3223
3217
  _derive_grace_ms(running, settling) {
3224
- let max = settling ? _chunkYKL44PYXcjs.DEFAULT_LEASE_MILLIS : 0;
3218
+ let max = settling ? _chunkO6QIJQRNcjs.DEFAULT_LEASE_MILLIS : 0;
3225
3219
  for (const c of running)
3226
- max = Math.max(max, c.lease_millis || _chunkYKL44PYXcjs.DEFAULT_LEASE_MILLIS);
3227
- return Math.min(max, _chunkYKL44PYXcjs.MAX_SHUTDOWN_GRACE_MS);
3220
+ max = Math.max(max, c.lease_millis || _chunkO6QIJQRNcjs.DEFAULT_LEASE_MILLIS);
3221
+ return Math.min(max, _chunkO6QIJQRNcjs.MAX_SHUTDOWN_GRACE_MS);
3228
3222
  }
3229
3223
  async _await_inflight(grace_ms) {
3230
3224
  const running = [...this._drain_controllers.values()].filter(
@@ -3256,12 +3250,7 @@ var Act = (_class7 = class {
3256
3250
  return await s.notify((notification) => {
3257
3251
  try {
3258
3252
  this.emit("notified", notification);
3259
- if (this._drain) {
3260
- const armed = this._arm_for_event_names(
3261
- notification.events.map((e) => e.name)
3262
- );
3263
- this._settle_armed(armed);
3264
- }
3253
+ this._wake(notification.events.map((e) => e.name));
3265
3254
  } catch (err) {
3266
3255
  this._logger.error(err, "notified handler threw");
3267
3256
  }
@@ -3309,7 +3298,7 @@ var Act = (_class7 = class {
3309
3298
  * @see {@link ValidationError}, {@link InvariantError}, {@link ConcurrencyError}
3310
3299
  */
3311
3300
  async do(action2, target, payload, options) {
3312
- const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _131 => _131.reactingTo]), () => ( _chunkYKL44PYXcjs.current_reacting.call(void 0, )));
3301
+ const reacting_to = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _131 => _131.reactingTo]), () => ( _chunkO6QIJQRNcjs.current_reacting.call(void 0, )));
3313
3302
  const do_options = reacting_to === _optionalChain([options, 'optionalAccess', _132 => _132.reactingTo]) ? options : { ...options, reactingTo: reacting_to };
3314
3303
  return this._scoped(async () => {
3315
3304
  const snapshots = await this._es.action(
@@ -3319,10 +3308,7 @@ var Act = (_class7 = class {
3319
3308
  payload,
3320
3309
  do_options
3321
3310
  );
3322
- const armed = this._arm_for_event_names(
3323
- snapshots.map((s) => s.event.name)
3324
- );
3325
- this._settle_armed(armed);
3311
+ this._wake(snapshots.map((s) => s.event.name));
3326
3312
  this.emit("committed", snapshots);
3327
3313
  return snapshots;
3328
3314
  });
@@ -3373,7 +3359,7 @@ var Act = (_class7 = class {
3373
3359
  return this._scoped(async () => {
3374
3360
  let first;
3375
3361
  let last;
3376
- const count = await _chunkYKL44PYXcjs.store.call(void 0, ).query((e) => {
3362
+ const count = await _chunkO6QIJQRNcjs.store.call(void 0, ).query((e) => {
3377
3363
  const gated = this.registry.query_gate(e.name)(e);
3378
3364
  if (!first) first = gated;
3379
3365
  last = gated;
@@ -3403,7 +3389,7 @@ var Act = (_class7 = class {
3403
3389
  async query_array(query) {
3404
3390
  return this._scoped(async () => {
3405
3391
  const events = [];
3406
- await _chunkYKL44PYXcjs.store.call(void 0, ).query((e) => {
3392
+ await _chunkO6QIJQRNcjs.store.call(void 0, ).query((e) => {
3407
3393
  events.push(this.registry.query_gate(e.name)(e));
3408
3394
  }, query);
3409
3395
  return events;
@@ -3423,14 +3409,14 @@ var Act = (_class7 = class {
3423
3409
  */
3424
3410
  async forget(stream) {
3425
3411
  return this._scoped(async () => {
3426
- const s = _chunkYKL44PYXcjs.store.call(void 0, );
3412
+ const s = _chunkO6QIJQRNcjs.store.call(void 0, );
3427
3413
  if (!s.forget_pii) {
3428
3414
  throw new Error(
3429
3415
  `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).`
3430
3416
  );
3431
3417
  }
3432
3418
  const eventCount = await s.forget_pii(stream);
3433
- await _chunkYKL44PYXcjs.cache.call(void 0, ).invalidate(stream);
3419
+ await _chunkO6QIJQRNcjs.cache.call(void 0, ).invalidate(stream);
3434
3420
  if (eventCount > 0) {
3435
3421
  this.emit("forgotten", { stream, at: /* @__PURE__ */ new Date(), eventCount });
3436
3422
  }
@@ -3464,22 +3450,26 @@ var Act = (_class7 = class {
3464
3450
  * @see {@link correlate} for dynamic stream discovery
3465
3451
  */
3466
3452
  async drain(options = {}) {
3467
- _chunkYKL44PYXcjs.resolveDrainConfig.call(void 0, options);
3453
+ _chunkO6QIJQRNcjs.resolveDrainConfig.call(void 0, options);
3468
3454
  if (!this._drain)
3469
3455
  return { fetched: [], leased: [], acked: [], blocked: [] };
3470
3456
  return this._scoped(() => this._drain_all(options));
3471
3457
  }
3458
+ /** Arms correlate and every lane; false on an app with no reactions. */
3472
3459
  _arm_all() {
3473
- if (!this._reactive) return;
3460
+ if (!this._reactive) return false;
3474
3461
  this._correlate.arm();
3475
3462
  for (const c of this._drain_controllers.values()) c.arm();
3463
+ return true;
3476
3464
  }
3477
3465
  /**
3478
- * Settles what a change armed (a commit, a reset, an unblock, a restore,
3479
- * a notification from another process), unless the app walks the
3480
- * pipeline itself (`autoSettle: false`).
3466
+ * Wakes what a change freed (a commit, a reset, an unblock, a restore,
3467
+ * a notification from another process): arms the lanes these events
3468
+ * react on, or every lane without names, and settles them unless the app
3469
+ * walks the pipeline itself (`autoSettle: false`).
3481
3470
  */
3482
- _settle_armed(armed) {
3471
+ _wake(names) {
3472
+ const armed = names ? this._arm_for_event_names(names) : this._arm_all();
3483
3473
  if (armed && this._auto_settle) this._schedule();
3484
3474
  }
3485
3475
  /** Schedules a settle pass; writer-only instances (`drain: false`) skip it. */
@@ -3559,7 +3549,7 @@ var Act = (_class7 = class {
3559
3549
  /**
3560
3550
  * Starts a background poll that settles on a timer: each tick looks for
3561
3551
  * new events, subscribes the streams their reactions target, and drains
3562
- * them.
3552
+ * them, along with any stream whose lease a dead worker let expire.
3563
3553
  *
3564
3554
  * Use it when this process can miss commits — another process writes to a
3565
3555
  * store without `notify`, or a notification is lost. It is the safety net
@@ -3588,7 +3578,7 @@ var Act = (_class7 = class {
3588
3578
  if (this._poll) return false;
3589
3579
  this._poll_limit = query.limit || void 0;
3590
3580
  this._poll = setInterval(() => {
3591
- this._correlate.arm();
3581
+ this._arm_all();
3592
3582
  this._schedule();
3593
3583
  }, frequency);
3594
3584
  return true;
@@ -3643,12 +3633,11 @@ var Act = (_class7 = class {
3643
3633
  */
3644
3634
  async reset(input) {
3645
3635
  return this._scoped(async () => {
3646
- const count = await _chunkYKL44PYXcjs.store.call(void 0, ).reset(input);
3636
+ const count = await _chunkO6QIJQRNcjs.store.call(void 0, ).reset(input);
3647
3637
  for (const handler of this._batch_handlers.values())
3648
3638
  _optionalChain([handler, 'access', _139 => _139[FOLD_RESET], 'optionalCall', _140 => _140()]);
3649
3639
  if (count > 0) {
3650
- this._arm_all();
3651
- this._settle_armed(this._reactive);
3640
+ this._wake();
3652
3641
  }
3653
3642
  return count;
3654
3643
  });
@@ -3680,10 +3669,9 @@ var Act = (_class7 = class {
3680
3669
  */
3681
3670
  async unblock(input) {
3682
3671
  return this._scoped(async () => {
3683
- const count = await _chunkYKL44PYXcjs.store.call(void 0, ).unblock(input);
3672
+ const count = await _chunkO6QIJQRNcjs.store.call(void 0, ).unblock(input);
3684
3673
  if (count > 0) {
3685
- this._arm_all();
3686
- this._settle_armed(this._reactive);
3674
+ this._wake();
3687
3675
  }
3688
3676
  return count;
3689
3677
  });
@@ -3730,7 +3718,7 @@ var Act = (_class7 = class {
3730
3718
  return { ...partial, duration_ms: Date.now() - started };
3731
3719
  }
3732
3720
  const target = _nullishCoalesce(sink, () => ( (() => {
3733
- const s = _chunkYKL44PYXcjs.store.call(void 0, );
3721
+ const s = _chunkO6QIJQRNcjs.store.call(void 0, );
3734
3722
  if (!s.restore) throw new Error("adapter has no restore capability");
3735
3723
  return s;
3736
3724
  })()));
@@ -3745,8 +3733,7 @@ var Act = (_class7 = class {
3745
3733
  });
3746
3734
  if (!sink) {
3747
3735
  this._correlate.restart();
3748
- this._arm_all();
3749
- this._settle_armed(this._reactive);
3736
+ this._wake();
3750
3737
  }
3751
3738
  return { kept, migrated, dropped, duration_ms: Date.now() - started };
3752
3739
  });
@@ -3776,7 +3763,7 @@ var Act = (_class7 = class {
3776
3763
  async blocked_streams(options) {
3777
3764
  return this._scoped(async () => {
3778
3765
  const positions = [];
3779
- await _chunkYKL44PYXcjs.store.call(void 0, ).query_streams(
3766
+ await _chunkO6QIJQRNcjs.store.call(void 0, ).query_streams(
3780
3767
  (p) => {
3781
3768
  positions.push(p);
3782
3769
  },
@@ -3828,7 +3815,7 @@ var Act = (_class7 = class {
3828
3815
  * @see {@link Store.prioritize} for the underlying primitive
3829
3816
  */
3830
3817
  async prioritize(filter, priority) {
3831
- return this._scoped(() => _chunkYKL44PYXcjs.store.call(void 0, ).prioritize(filter, priority));
3818
+ return this._scoped(() => _chunkO6QIJQRNcjs.store.call(void 0, ).prioritize(filter, priority));
3832
3819
  }
3833
3820
  /** Shared by `close()` and reaction-requested closes. */
3834
3821
  async _run_close(targets) {
@@ -3892,7 +3879,8 @@ var Act = (_class7 = class {
3892
3879
  * `debounceMs` (default 10), `correlate.limit` (default 100, or the
3893
3880
  * poll's limit while `start_correlations` runs; `after` is always the
3894
3881
  * checkpoint),
3895
- * `maxPasses` (default `Infinity` — kill-switch for runaway loops),
3882
+ * `maxPasses` (default `Infinity`; caps this settle's passes, not the
3883
+ * passes a reaction chain's own commits schedule),
3896
3884
  * `streamLimit` (default 10), `eventLimit` (default 10),
3897
3885
  * `leaseMillis` (default 10000).
3898
3886
  *
@@ -3909,7 +3897,7 @@ var Act = (_class7 = class {
3909
3897
  * @see {@link correlate} for manual correlation
3910
3898
  */
3911
3899
  settle(options) {
3912
- _chunkYKL44PYXcjs.resolveSettleConfig.call(void 0, _nullishCoalesce(options, () => ( {})));
3900
+ _chunkO6QIJQRNcjs.resolveSettleConfig.call(void 0, _nullishCoalesce(options, () => ( {})));
3913
3901
  this._schedule(options);
3914
3902
  }
3915
3903
  }, _class7);
@@ -4065,16 +4053,16 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
4065
4053
  }),
4066
4054
  // Never block on autoclose: a transient query/store error should retry,
4067
4055
  // not quarantine the synthetic stream.
4068
- options: { blockOnError: false, maxRetries: _chunkYKL44PYXcjs.DEFAULT_MAX_RETRIES },
4056
+ options: { blockOnError: false, maxRetries: _chunkO6QIJQRNcjs.DEFAULT_MAX_RETRIES },
4069
4057
  handler: async (event) => {
4070
4058
  const aggregate = event.stream;
4071
4059
  const window = read_window();
4072
4060
  if (!in_autoclose_window(window, /* @__PURE__ */ new Date()))
4073
- throw new (0, _chunkNNWP65YMcjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
4074
- const stats = await _chunkYKL44PYXcjs.store.call(void 0, ).query_stats([aggregate], {
4061
+ throw new (0, _chunk7AHW7FCNcjs.DeferSignal)({ at: next_window_open(window, /* @__PURE__ */ new Date()) });
4062
+ const stats = await _chunkO6QIJQRNcjs.store.call(void 0, ).query_stats([aggregate], {
4075
4063
  count: true,
4076
4064
  tail: keep_days !== void 0 ? true : void 0,
4077
- exclude: [_chunkNNWP65YMcjs.TOMBSTONE_EVENT, _chunkNNWP65YMcjs.SNAP_EVENT]
4065
+ exclude: [_chunk7AHW7FCNcjs.TOMBSTONE_EVENT, _chunk7AHW7FCNcjs.SNAP_EVENT]
4078
4066
  });
4079
4067
  const entry = stats.get(aggregate);
4080
4068
  if (!entry) return;
@@ -4105,7 +4093,7 @@ function synthesize_autoclose_reactions(registry, states, read_window) {
4105
4093
  dues.push(days_after(entry.tail.created, keep_days));
4106
4094
  const future = dues.map((d) => d.getTime()).filter((t) => t > Date.now());
4107
4095
  if (future.length)
4108
- throw new (0, _chunkNNWP65YMcjs.DeferSignal)({ at: new Date(Math.min(...future)) });
4096
+ throw new (0, _chunk7AHW7FCNcjs.DeferSignal)({ at: new Date(Math.min(...future)) });
4109
4097
  }
4110
4098
  };
4111
4099
  const key = `__autoclose_${st.name}`;
@@ -4309,8 +4297,8 @@ var _this_ = ({ stream }) => ({
4309
4297
 
4310
4298
  // src/builders/builder-utils.ts
4311
4299
  function register_lane(config2, lanes) {
4312
- if (config2.name === _chunkNNWP65YMcjs.DEFAULT_LANE)
4313
- throw new Error(`Lane "${_chunkNNWP65YMcjs.DEFAULT_LANE}" is reserved`);
4300
+ if (config2.name === _chunk7AHW7FCNcjs.DEFAULT_LANE)
4301
+ throw new Error(`Lane "${_chunk7AHW7FCNcjs.DEFAULT_LANE}" is reserved`);
4314
4302
  if (lanes.some((l) => l.name === config2.name))
4315
4303
  throw new Error(`Lane "${config2.name}" was already declared`);
4316
4304
  lanes.push(config2);
@@ -4332,9 +4320,9 @@ function reaction_on(event, events, builder) {
4332
4320
  // Validate the whole bag at the declaration site so a bad
4333
4321
  // `maxRetries`/`backoff`/`blockOnError` throws ZodError at build,
4334
4322
  // not a NaN gate on the first retry.
4335
- options: _chunkYKL44PYXcjs.resolveReactionConfig.call(void 0, {
4336
- blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _155 => _155.blockOnError]), () => ( _chunkYKL44PYXcjs.DEFAULT_BLOCK_ON_ERROR)),
4337
- maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _156 => _156.maxRetries]), () => ( _chunkYKL44PYXcjs.DEFAULT_MAX_RETRIES)),
4323
+ options: _chunkO6QIJQRNcjs.resolveReactionConfig.call(void 0, {
4324
+ blockOnError: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _155 => _155.blockOnError]), () => ( _chunkO6QIJQRNcjs.DEFAULT_BLOCK_ON_ERROR)),
4325
+ maxRetries: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _156 => _156.maxRetries]), () => ( _chunkO6QIJQRNcjs.DEFAULT_MAX_RETRIES)),
4338
4326
  backoff: _optionalChain([options, 'optionalAccess', _157 => _157.backoff])
4339
4327
  })
4340
4328
  };
@@ -4424,7 +4412,7 @@ function date_reviver_schema(schema) {
4424
4412
 
4425
4413
  // src/builders/event-builder.ts
4426
4414
  function event_tags(schema) {
4427
- const pii = _chunkNNWP65YMcjs.pii_schemas.call(void 0, schema);
4415
+ const pii = _chunk7AHW7FCNcjs.pii_schemas.call(void 0, schema);
4428
4416
  const pii_dates = {};
4429
4417
  for (const [key, field] of Object.entries(pii)) {
4430
4418
  const dates = date_reviver_schema(field);
@@ -4461,7 +4449,7 @@ function make_event_reader(tags, disclosure, predicate = null) {
4461
4449
  });
4462
4450
  }
4463
4451
  function build_events(registry, states, lanes, owners) {
4464
- const declared = /* @__PURE__ */ new Set([_chunkNNWP65YMcjs.DEFAULT_LANE, ...lanes.map((l) => l.name)]);
4452
+ const declared = /* @__PURE__ */ new Set([_chunk7AHW7FCNcjs.DEFAULT_LANE, ...lanes.map((l) => l.name)]);
4465
4453
  const lane_errors = [];
4466
4454
  const tags = /* @__PURE__ */ new Map();
4467
4455
  const sensitive2 = /* @__PURE__ */ new Map();
@@ -4525,7 +4513,7 @@ function build_events(registry, states, lanes, owners) {
4525
4513
  if (reader) readers.set(event_name, reader);
4526
4514
  }
4527
4515
  const snap2 = make_event_reader(event_tags(state2.state), "redact", null);
4528
- if (snap2) readers.set(_chunkNNWP65YMcjs.SNAP_EVENT, snap2);
4516
+ if (snap2) readers.set(_chunk7AHW7FCNcjs.SNAP_EVENT, snap2);
4529
4517
  if (readers.size === 0) continue;
4530
4518
  state2.view = (event, actor) => (_nullishCoalesce(readers.get(event.name), () => ( IDENTITY_GATE)))(event, actor);
4531
4519
  }
@@ -4641,7 +4629,7 @@ function act() {
4641
4629
  const list = deprecation_summary.map(
4642
4630
  (d) => `"${d.deprecated}" (current: "${d.current}", state: "${d.state_name}")`
4643
4631
  ).join(", ");
4644
- _chunkYKL44PYXcjs.log.call(void 0, ).info(
4632
+ _chunkO6QIJQRNcjs.log.call(void 0, ).info(
4645
4633
  `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.`
4646
4634
  );
4647
4635
  }
@@ -4686,7 +4674,7 @@ function act() {
4686
4674
  withActor: () => builder,
4687
4675
  withLane: (config2) => {
4688
4676
  if (_built) closed("withLane");
4689
- register_lane(_chunkYKL44PYXcjs.resolveLaneConfig.call(void 0, config2), lanes);
4677
+ register_lane(_chunkO6QIJQRNcjs.resolveLaneConfig.call(void 0, config2), lanes);
4690
4678
  return builder;
4691
4679
  },
4692
4680
  on: (event) => {
@@ -4694,7 +4682,7 @@ function act() {
4694
4682
  return reaction_on(event, registry.events, builder);
4695
4683
  },
4696
4684
  build: (options) => {
4697
- _chunkYKL44PYXcjs.resolveActConfig.call(void 0, options);
4685
+ _chunkO6QIJQRNcjs.resolveActConfig.call(void 0, options);
4698
4686
  const patch_fn = _optionalChain([options, 'optionalAccess', _169 => _169.validateFoldedState]) === true ? validating_patch : bare_patch;
4699
4687
  if (!_built) {
4700
4688
  for (const proj of pending_projections) add_projection(proj);
@@ -4746,7 +4734,7 @@ function act() {
4746
4734
  synthesize_autoclose_reactions(
4747
4735
  registry,
4748
4736
  states,
4749
- _chunkYKL44PYXcjs.current_autoclose_window
4737
+ _chunkO6QIJQRNcjs.current_autoclose_window
4750
4738
  );
4751
4739
  Object.freeze(registry.actions);
4752
4740
  Object.freeze(registry.events);
@@ -4789,8 +4777,8 @@ function _projection(target) {
4789
4777
  handler,
4790
4778
  resolver: _nullishCoalesce(default_resolver, () => ( _this_)),
4791
4779
  options: {
4792
- blockOnError: _chunkYKL44PYXcjs.DEFAULT_BLOCK_ON_ERROR,
4793
- maxRetries: _chunkYKL44PYXcjs.DEFAULT_MAX_RETRIES
4780
+ blockOnError: _chunkO6QIJQRNcjs.DEFAULT_BLOCK_ON_ERROR,
4781
+ maxRetries: _chunkO6QIJQRNcjs.DEFAULT_MAX_RETRIES
4794
4782
  }
4795
4783
  };
4796
4784
  const register = events[event];
@@ -4846,7 +4834,7 @@ function _projection(target) {
4846
4834
  throw new Error(
4847
4835
  `Projection "${target}" .of() partials must share one state name \u2014 got "${name}" and "${partial.name}"`
4848
4836
  );
4849
- const config2 = _chunkYKL44PYXcjs.resolveFoldConfig.call(void 0, options);
4837
+ const config2 = _chunkO6QIJQRNcjs.resolveFoldConfig.call(void 0, options);
4850
4838
  const fold_events = {};
4851
4839
  for (const partial of partials)
4852
4840
  for (const [event_name, schema] of Object.entries(partial.events)) {
@@ -4864,8 +4852,8 @@ function _projection(target) {
4864
4852
  handler: noop,
4865
4853
  resolver: { target },
4866
4854
  options: {
4867
- blockOnError: _chunkYKL44PYXcjs.DEFAULT_BLOCK_ON_ERROR,
4868
- maxRetries: _chunkYKL44PYXcjs.DEFAULT_MAX_RETRIES
4855
+ blockOnError: _chunkO6QIJQRNcjs.DEFAULT_BLOCK_ON_ERROR,
4856
+ maxRetries: _chunkO6QIJQRNcjs.DEFAULT_MAX_RETRIES
4869
4857
  }
4870
4858
  }
4871
4859
  ]
@@ -4908,7 +4896,7 @@ function slice() {
4908
4896
  return builder;
4909
4897
  },
4910
4898
  withLane: (config2) => {
4911
- register_lane(_chunkYKL44PYXcjs.resolveLaneConfig.call(void 0, config2), lanes);
4899
+ register_lane(_chunkO6QIJQRNcjs.resolveLaneConfig.call(void 0, config2), lanes);
4912
4900
  return builder;
4913
4901
  },
4914
4902
  on: (event) => reaction_on(event, events, builder),
@@ -4981,7 +4969,7 @@ function action_builder(state2) {
4981
4969
  throw new Error(`Duplicate action "${action2}"`);
4982
4970
  internal.actions[action2] = schema;
4983
4971
  if (options) {
4984
- _chunkYKL44PYXcjs.resolveActionConfig.call(void 0, options);
4972
+ _chunkO6QIJQRNcjs.resolveActionConfig.call(void 0, options);
4985
4973
  internal.options ??= {};
4986
4974
  internal.options[action2] = options;
4987
4975
  }
@@ -5270,5 +5258,5 @@ function write_line(writer, line) {
5270
5258
 
5271
5259
 
5272
5260
 
5273
- exports.Act = Act; exports.ActorSchema = _chunkNNWP65YMcjs.ActorSchema; exports.CausationEventSchema = _chunkNNWP65YMcjs.CausationEventSchema; exports.CommittedMetaSchema = _chunkNNWP65YMcjs.CommittedMetaSchema; exports.ConcurrencyError = _chunkNNWP65YMcjs.ConcurrencyError; exports.ConsoleLogger = _chunkYKL44PYXcjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = _chunkNNWP65YMcjs.DEFAULT_LANE; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = _chunkNNWP65YMcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS; exports.DEFAULT_SETTLE_DEBOUNCE_MS = _chunkNNWP65YMcjs.DEFAULT_SETTLE_DEBOUNCE_MS; exports.DeferSignal = _chunkNNWP65YMcjs.DeferSignal; exports.Environments = _chunkNNWP65YMcjs.Environments; exports.Errors = _chunkNNWP65YMcjs.Errors; exports.EventMetaSchema = _chunkNNWP65YMcjs.EventMetaSchema; exports.ExitCodes = _chunkNNWP65YMcjs.ExitCodes; exports.InMemoryCache = _chunkYKL44PYXcjs.InMemoryCache; exports.InMemoryStore = _chunkYKL44PYXcjs.InMemoryStore; exports.InvariantError = _chunkNNWP65YMcjs.InvariantError; exports.LogLevels = _chunkNNWP65YMcjs.LogLevels; exports.NonRetryableError = _chunkNNWP65YMcjs.NonRetryableError; exports.PackageSchema = _chunkYKL44PYXcjs.PackageSchema; exports.QuerySchema = _chunkNNWP65YMcjs.QuerySchema; exports.REDACTED = _chunkNNWP65YMcjs.REDACTED; exports.SHREDDED = _chunkNNWP65YMcjs.SHREDDED; exports.SNAP_EVENT = _chunkNNWP65YMcjs.SNAP_EVENT; exports.StoreError = _chunkNNWP65YMcjs.StoreError; exports.StreamClosedError = _chunkNNWP65YMcjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunkNNWP65YMcjs.TOMBSTONE_EVENT; exports.TargetSchema = _chunkNNWP65YMcjs.TargetSchema; exports.ValidationError = _chunkNNWP65YMcjs.ValidationError; exports.ZodEmpty = _chunkNNWP65YMcjs.ZodEmpty; exports.act = act; exports.cache = _chunkYKL44PYXcjs.cache; exports.config = _chunkYKL44PYXcjs.config; exports.dateReviver = _chunkYKL44PYXcjs.dateReviver; exports.default_scope = _chunkYKL44PYXcjs.default_scope; exports.dispose = _chunkYKL44PYXcjs.dispose; exports.disposeAndExit = _chunkYKL44PYXcjs.disposeAndExit; exports.extend = _chunkYKL44PYXcjs.extend; exports.is_literal_source = _chunkYKL44PYXcjs.is_literal_source; exports.log = _chunkYKL44PYXcjs.log; exports.pii_fields = _chunkNNWP65YMcjs.pii_fields; exports.port = _chunkYKL44PYXcjs.port; exports.projection = projection; exports.resolveAutocloseConfig = _chunkYKL44PYXcjs.resolveAutocloseConfig2; exports.sensitive = _chunkNNWP65YMcjs.sensitive; exports.sleep = _chunkYKL44PYXcjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkYKL44PYXcjs.store; exports.validate = _chunkYKL44PYXcjs.validate;
5261
+ exports.Act = Act; exports.ActorSchema = _chunk7AHW7FCNcjs.ActorSchema; exports.CausationEventSchema = _chunk7AHW7FCNcjs.CausationEventSchema; exports.CommittedMetaSchema = _chunk7AHW7FCNcjs.CommittedMetaSchema; exports.ConcurrencyError = _chunk7AHW7FCNcjs.ConcurrencyError; exports.ConsoleLogger = _chunkO6QIJQRNcjs.ConsoleLogger; exports.CsvFile = CsvFile; exports.DEFAULT_LANE = _chunk7AHW7FCNcjs.DEFAULT_LANE; exports.DEFAULT_MAX_SUBSCRIBED_STREAMS = _chunk7AHW7FCNcjs.DEFAULT_MAX_SUBSCRIBED_STREAMS; exports.DEFAULT_SETTLE_DEBOUNCE_MS = _chunk7AHW7FCNcjs.DEFAULT_SETTLE_DEBOUNCE_MS; exports.DeferSignal = _chunk7AHW7FCNcjs.DeferSignal; exports.Environments = _chunk7AHW7FCNcjs.Environments; exports.Errors = _chunk7AHW7FCNcjs.Errors; exports.EventMetaSchema = _chunk7AHW7FCNcjs.EventMetaSchema; exports.ExitCodes = _chunk7AHW7FCNcjs.ExitCodes; exports.InMemoryCache = _chunkO6QIJQRNcjs.InMemoryCache; exports.InMemoryStore = _chunkO6QIJQRNcjs.InMemoryStore; exports.InvariantError = _chunk7AHW7FCNcjs.InvariantError; exports.LogLevels = _chunk7AHW7FCNcjs.LogLevels; exports.NonRetryableError = _chunk7AHW7FCNcjs.NonRetryableError; exports.PackageSchema = _chunkO6QIJQRNcjs.PackageSchema; exports.QuerySchema = _chunk7AHW7FCNcjs.QuerySchema; exports.REDACTED = _chunk7AHW7FCNcjs.REDACTED; exports.SHREDDED = _chunk7AHW7FCNcjs.SHREDDED; exports.SNAP_EVENT = _chunk7AHW7FCNcjs.SNAP_EVENT; exports.StoreError = _chunk7AHW7FCNcjs.StoreError; exports.StreamClosedError = _chunk7AHW7FCNcjs.StreamClosedError; exports.TOMBSTONE_EVENT = _chunk7AHW7FCNcjs.TOMBSTONE_EVENT; exports.TargetSchema = _chunk7AHW7FCNcjs.TargetSchema; exports.ValidationError = _chunk7AHW7FCNcjs.ValidationError; exports.ZodEmpty = _chunk7AHW7FCNcjs.ZodEmpty; exports.act = act; exports.cache = _chunkO6QIJQRNcjs.cache; exports.config = _chunkO6QIJQRNcjs.config; exports.dateReviver = _chunkO6QIJQRNcjs.dateReviver; exports.default_scope = _chunkO6QIJQRNcjs.default_scope; exports.dispose = _chunkO6QIJQRNcjs.dispose; exports.disposeAndExit = _chunkO6QIJQRNcjs.disposeAndExit; exports.extend = _chunkO6QIJQRNcjs.extend; exports.is_literal_source = _chunkO6QIJQRNcjs.is_literal_source; exports.log = _chunkO6QIJQRNcjs.log; exports.pii_fields = _chunk7AHW7FCNcjs.pii_fields; exports.port = _chunkO6QIJQRNcjs.port; exports.projection = projection; exports.resolveAutocloseConfig = _chunkO6QIJQRNcjs.resolveAutocloseConfig2; exports.sensitive = _chunk7AHW7FCNcjs.sensitive; exports.sleep = _chunkO6QIJQRNcjs.sleep; exports.slice = slice; exports.state = state; exports.store = _chunkO6QIJQRNcjs.store; exports.validate = _chunkO6QIJQRNcjs.validate;
5274
5262
  //# sourceMappingURL=index.cjs.map