dexbot 1.6.12 → 1.6.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/CHANGELOG.md +65 -1
  2. package/README.md +2 -2
  3. package/analysis/README.md +9 -11
  4. package/analysis/ama_fitting/README.md +5 -3
  5. package/claw/README.md +1 -0
  6. package/claw/docs/AI_BOT_LIBRARY_API.md +3 -1
  7. package/claw/docs/DEXBOT2_TUNING_CHEAT_SHEET.md +4 -4
  8. package/claw/modules/claw_bridge.ts +0 -3
  9. package/claw/modules/claw_catalog.ts +8 -4
  10. package/claw/modules/claw_skill_md.ts +1 -0
  11. package/claw/modules/dexbot_profiles.ts +59 -15
  12. package/claw/modules/types.ts +2 -1
  13. package/claw/package.json +3 -3
  14. package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
  15. package/claw/runtimes/openclaw-plugin/package.json +1 -1
  16. package/claw/skills/margin-trading/SKILL.md +1 -1
  17. package/claw/skills/margin-trading/references/position-management.md +1 -1
  18. package/claw/tsconfig.json +2 -2
  19. package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js +1 -14
  20. package/dist/analysis/ama_fitting/fetch_lp_candles.js +51 -41
  21. package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts +1 -24
  22. package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js +36 -18
  23. package/dist/analysis/ama_fitting/optimizer_high_resolution.js +18 -66
  24. package/dist/analysis/analyze_args.d.ts +12 -0
  25. package/dist/analysis/analyze_args.js +20 -0
  26. package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts +1 -16
  27. package/dist/analysis/bot_fitting/backtest_ama_sweep.js +20 -101
  28. package/dist/analysis/bot_fitting/backtest_bot_fitting.js +26 -92
  29. package/dist/analysis/bot_fitting/backtest_lookback_drawdown.js +19 -34
  30. package/dist/analysis/bot_fitting/shared_utils.d.ts +71 -3
  31. package/dist/analysis/bot_fitting/shared_utils.js +124 -8
  32. package/dist/analysis/chart_ui.d.ts +30 -1
  33. package/dist/analysis/chart_ui.js +37 -1
  34. package/dist/analysis/fills_cache.d.ts +3 -23
  35. package/dist/analysis/fills_cache.js +3 -84
  36. package/dist/analysis/fills_source.d.ts +31 -1
  37. package/dist/analysis/fills_source.js +69 -1
  38. package/dist/analysis/grid_correction_check.d.ts +1 -23
  39. package/dist/analysis/grid_correction_check.js +15 -58
  40. package/dist/analysis/math_utils.d.ts +85 -1
  41. package/dist/analysis/math_utils.js +116 -1
  42. package/dist/analysis/price_sources.d.ts +22 -1
  43. package/dist/analysis/price_sources.js +23 -0
  44. package/dist/analysis/resolve_source.js +31 -10
  45. package/dist/analysis/trade_profitability.d.ts +6 -0
  46. package/dist/analysis/trade_profitability.js +23 -97
  47. package/dist/analysis/tradingview/analyze_tradingview.d.ts +1 -17
  48. package/dist/analysis/tradingview/analyze_tradingview.js +1 -1
  49. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +27 -40
  50. package/dist/analysis/trend_detection/backtest_ama_slope_huber.d.ts +1 -101
  51. package/dist/analysis/trend_detection/backtest_ama_slope_huber.js +22 -80
  52. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +11 -37
  53. package/dist/analysis/trend_detection/volatility_chart_generator.js +9 -10
  54. package/dist/analysis/worker_pool.d.ts +38 -0
  55. package/dist/analysis/worker_pool.js +67 -0
  56. package/dist/dexbot.js +67 -48
  57. package/dist/market_adapter/ama_signal_runner.js +21 -54
  58. package/dist/market_adapter/candle_utils.d.ts +7 -1
  59. package/dist/market_adapter/candle_utils.js +11 -1
  60. package/dist/market_adapter/cli_args.d.ts +22 -0
  61. package/dist/market_adapter/cli_args.js +30 -0
  62. package/dist/market_adapter/core/config_normalizers.js +11 -6
  63. package/dist/market_adapter/core/kibana_candles.d.ts +3 -1
  64. package/dist/market_adapter/core/kibana_candles.js +3 -2
  65. package/dist/market_adapter/core/market_adapter_service.d.ts +85 -85
  66. package/dist/market_adapter/core/market_adapter_service.js +93 -158
  67. package/dist/market_adapter/core/signals/hurst_analyzer.d.ts +1 -6
  68. package/dist/market_adapter/core/signals/hurst_analyzer.js +1 -1
  69. package/dist/market_adapter/core/signals/permutation_entropy_analyzer.d.ts +1 -11
  70. package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js +1 -1
  71. package/dist/market_adapter/inputs/fetch_book_data.js +0 -1
  72. package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +63 -107
  73. package/dist/market_adapter/inputs/fetch_lp_data.d.ts +8 -1
  74. package/dist/market_adapter/inputs/fetch_lp_data.js +25 -7
  75. package/dist/market_adapter/inputs/kibana_feed_source.js +4 -26
  76. package/dist/market_adapter/inputs/window_cache.d.ts +4 -72
  77. package/dist/market_adapter/inputs/window_cache.js +52 -177
  78. package/dist/market_adapter/interval_utils.d.ts +11 -1
  79. package/dist/market_adapter/interval_utils.js +16 -1
  80. package/dist/market_adapter/lp_chart_runner.d.ts +3 -0
  81. package/dist/market_adapter/lp_chart_runner.js +37 -19
  82. package/dist/market_adapter/market_adapter.js +27 -72
  83. package/dist/market_adapter/utils/data_discovery.d.ts +45 -1
  84. package/dist/market_adapter/utils/data_discovery.js +220 -27
  85. package/dist/market_adapter/utils/month_shards.d.ts +84 -0
  86. package/dist/market_adapter/utils/month_shards.js +237 -0
  87. package/dist/modules/account_bots.d.ts +8 -6
  88. package/dist/modules/account_bots.js +112 -131
  89. package/dist/modules/account_orders.d.ts +49 -4
  90. package/dist/modules/account_orders.js +114 -49
  91. package/dist/modules/bitshares-native/chain_client.d.ts +1 -1
  92. package/dist/modules/bitshares-native/chain_client.js +14 -13
  93. package/dist/modules/bitshares-native/crypto/ecc_core.d.ts +1 -2
  94. package/dist/modules/bitshares-native/crypto/ecc_core.js +1 -1
  95. package/dist/modules/bitshares-native/resolvers.js +22 -25
  96. package/dist/modules/bitshares-native/serial/chain_constants.d.ts +1 -2
  97. package/dist/modules/bitshares-native/serial/chain_constants.js +1 -2
  98. package/dist/modules/bitshares-native/serial/types.js +22 -50
  99. package/dist/modules/bitshares-native/signing_client.d.ts +1 -1
  100. package/dist/modules/bot_defaults.d.ts +18 -3
  101. package/dist/modules/bot_defaults.js +34 -8
  102. package/dist/modules/bot_settings.d.ts +5 -1
  103. package/dist/modules/bot_settings.js +55 -21
  104. package/dist/modules/broadcast_failure.d.ts +2 -1
  105. package/dist/modules/chain_orders.d.ts +1 -1
  106. package/dist/modules/chain_orders.js +51 -96
  107. package/dist/modules/cli_start_onboarding.d.ts +2 -1
  108. package/dist/modules/config.js +6 -1
  109. package/dist/modules/constants.d.ts +14 -6
  110. package/dist/modules/constants.js +32 -6
  111. package/dist/modules/cr_planner.d.ts +1 -1
  112. package/dist/modules/cr_planner.js +1 -5
  113. package/dist/modules/credit_pricing.d.ts +2 -1
  114. package/dist/modules/credit_pricing.js +36 -40
  115. package/dist/modules/credit_runtime.d.ts +7 -0
  116. package/dist/modules/credit_runtime.js +45 -73
  117. package/dist/modules/daemon_node_health.d.ts +4 -3
  118. package/dist/modules/dexbot_class.d.ts +33 -17
  119. package/dist/modules/dexbot_class.js +113 -61
  120. package/dist/modules/dexbot_cow_runtime.d.ts +62 -181
  121. package/dist/modules/dexbot_cow_runtime.js +380 -69
  122. package/dist/modules/dexbot_credential_client.d.ts +1 -23
  123. package/dist/modules/dexbot_credential_client.js +2 -3
  124. package/dist/modules/dexbot_fill_runtime.d.ts +2 -3
  125. package/dist/modules/dexbot_fill_runtime.js +17 -7
  126. package/dist/modules/dexbot_maintenance_runtime.d.ts +36 -81
  127. package/dist/modules/dexbot_maintenance_runtime.js +137 -133
  128. package/dist/modules/dexbot_startup_runtime.d.ts +0 -1
  129. package/dist/modules/dexbot_startup_runtime.js +25 -14
  130. package/dist/modules/dexbot_state_recovery.js +16 -0
  131. package/dist/modules/general_settings.d.ts +1 -1
  132. package/dist/modules/graceful_shutdown.js +17 -11
  133. package/dist/modules/key_store.d.ts +0 -5
  134. package/dist/modules/key_store.js +1 -2
  135. package/dist/modules/lazy_shim.d.ts +11 -0
  136. package/dist/modules/lazy_shim.js +16 -0
  137. package/dist/modules/node_connect_policy.d.ts +3 -2
  138. package/dist/modules/node_failure_ledger.d.ts +6 -5
  139. package/dist/modules/order/accounting.js +11 -11
  140. package/dist/modules/order/export.js +2 -2
  141. package/dist/modules/order/format.d.ts +26 -3
  142. package/dist/modules/order/format.js +33 -3
  143. package/dist/modules/order/genesis_policy.d.ts +4 -4
  144. package/dist/modules/order/genesis_policy.js +6 -3
  145. package/dist/modules/order/grid.d.ts +26 -12
  146. package/dist/modules/order/grid.js +468 -80
  147. package/dist/modules/order/grid_reconcile.d.ts +1 -1
  148. package/dist/modules/order/grid_reconcile.js +5 -5
  149. package/dist/modules/order/grid_reconcile_internal.js +48 -40
  150. package/dist/modules/order/index.d.ts +35 -8
  151. package/dist/modules/order/logger.d.ts +1 -8
  152. package/dist/modules/order/logger.js +2 -11
  153. package/dist/modules/order/manager.d.ts +18 -15
  154. package/dist/modules/order/manager.js +91 -74
  155. package/dist/modules/order/strategy.d.ts +2 -2
  156. package/dist/modules/order/strategy.js +51 -21
  157. package/dist/modules/order/sync_engine.js +4 -0
  158. package/dist/modules/order/utils/math.d.ts +3 -3
  159. package/dist/modules/order/utils/math.js +38 -27
  160. package/dist/modules/order/utils/order.d.ts +58 -58
  161. package/dist/modules/order/utils/order.js +158 -137
  162. package/dist/modules/order/utils/system.d.ts +202 -35
  163. package/dist/modules/order/utils/system.js +409 -31
  164. package/dist/modules/order/utils/validate.js +28 -6
  165. package/dist/modules/order/utils/withPoolRef.d.ts +2 -1
  166. package/dist/modules/paths.js +32 -34
  167. package/dist/modules/runtime_settings.d.ts +3 -5
  168. package/dist/modules/runtime_settings.js +3 -3
  169. package/dist/modules/settings_merge.d.ts +2 -2
  170. package/dist/modules/socket_json_client.d.ts +2 -1
  171. package/dist/modules/types.d.ts +89 -30
  172. package/dist/modules/utils/errors.js +1 -3
  173. package/dist/modules/version_notice.d.ts +11 -10
  174. package/dist/pm2.d.ts +0 -1
  175. package/dist/pm2.js +56 -35
  176. package/dist/scripts/analyze-git.js +2 -15
  177. package/dist/scripts/analyze-orders.d.ts +1 -1
  178. package/dist/scripts/analyze-orders.js +4 -4
  179. package/dist/scripts/chart_command.js +2 -2
  180. package/dist/scripts/check_any.d.ts +4 -0
  181. package/dist/scripts/check_any.js +53 -21
  182. package/dist/scripts/diagnose-pool-history.js +1 -6
  183. package/dist/scripts/divergence-calc.js +6 -6
  184. package/dist/scripts/run-tests.js +0 -1
  185. package/dist/scripts/sync-version.js +0 -10
  186. package/dist/scripts/validate_bots.d.ts +1 -1
  187. package/dist/scripts/validate_bots.js +3 -3
  188. package/dist/unlock.js +7 -2
  189. package/docs/BITSHARES_ONBOARDING.md +8 -12
  190. package/docs/COPY_ON_WRITE_MASTER_PLAN.md +2 -3
  191. package/docs/COW_INVARIANTS.md +6 -6
  192. package/docs/DEXBOT_COMPARISON.md +7 -7
  193. package/docs/EVOLUTION.md +10 -8
  194. package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +8 -6
  195. package/docs/GRID_PRICE_INVARIANT.md +3 -3
  196. package/docs/GRID_RECALCULATION.md +4 -1
  197. package/docs/GRID_RECONCILE.md +4 -4
  198. package/docs/LIFECYCLE.md +11 -11
  199. package/docs/LOGGING.md +14 -0
  200. package/docs/MPA_CREDIT_USAGE.md +1 -1
  201. package/docs/ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md +12 -4
  202. package/docs/README.md +3 -3
  203. package/docs/WORKFLOW.md +1 -0
  204. package/docs/architecture.md +25 -16
  205. package/docs/developer_guide.md +7 -2
  206. package/market_adapter/README.md +6 -4
  207. package/package.json +6 -9
  208. package/scripts/README.md +43 -38
  209. package/tests/README.md +26 -11
  210. package/dist/scripts/diagnose-kibana-candles.d.ts +0 -3
  211. package/dist/scripts/diagnose-kibana-candles.js +0 -82
  212. package/scripts/git-viewer.sh +0 -489
  213. package/scripts/postinstall.js +0 -16
@@ -70,7 +70,7 @@ export declare function decideStartupGridAction({ persistedGrid, chainOpenOrders
70
70
  * - Then create missing orders if chain has fewer than target.
71
71
  * - Then cancel excess orders if chain has more than target.
72
72
  *
73
- * Targets are derived from config.activeOrders.{buy,sell} and chain counts are computed
73
+ * Targets are derived from config.coreOrders.{buy,sell} and chain counts are computed
74
74
  * from current on-chain open orders.
75
75
  * @param {Object} params - Destructured parameters
76
76
  * @param {Object} params.manager - OrderManager instance
@@ -4,7 +4,7 @@ import { _countActiveOnGrid, _cancelChainOrder, _recoverStartupSyncFailure, _ref
4
4
  import { ORDER_TYPES, ORDER_STATES, TIMING } from '../constants.js';
5
5
  import { readOpenOrdersGuarded } from '../chain_orders.js';
6
6
  import { getAssetFeesSafe, priceSlotEqual } from './utils/math.js';
7
- import { isOrderPlaced, parseChainOrder, isOrderOnChain, findLiveOrderOwnerByChainId, chainOrderMatchesSlotWithTolerance, duplicateOrphanLogInfo, resolveReserveCount, } from './utils/order.js';
7
+ import { isOrderPlaced, parseChainOrder, isOrderOnChain, findLiveOrderOwnerByChainId, chainOrderMatchesSlotWithTolerance, duplicateOrphanLogInfo, resolveEdgeCount, } from './utils/order.js';
8
8
  import * as Format from './format.js';
9
9
  import { getErrorMessage } from '../utils/errors.js';
10
10
  function _startupChainSnapshotSignature(orders, manager) {
@@ -142,7 +142,7 @@ export async function decideStartupGridAction({ persistedGrid, chainOpenOrders,
142
142
  * - Then create missing orders if chain has fewer than target.
143
143
  * - Then cancel excess orders if chain has more than target.
144
144
  *
145
- * Targets are derived from config.activeOrders.{buy,sell} and chain counts are computed
145
+ * Targets are derived from config.coreOrders.{buy,sell} and chain counts are computed
146
146
  * from current on-chain open orders.
147
147
  * @param {Object} params - Destructured parameters
148
148
  * @param {Object} params.manager - OrderManager instance
@@ -180,11 +180,11 @@ export async function reconcileGridOrders({ manager, config, account, privateKey
180
180
  const parsedChain = (chainOpenOrders || [])
181
181
  .map((co) => ({ chain: co, parsed: parseChainOrder(co, manager.assets) }))
182
182
  .filter((x) => x.parsed !== null);
183
- const activeCfg = (config && config.activeOrders) ? config.activeOrders : {};
183
+ const activeCfg = (config && config.coreOrders) ? config.coreOrders : {};
184
184
  let targetBuy = Math.max(0, Number.isFinite(Number(activeCfg.buy)) ? Number(activeCfg.buy) : 1)
185
- + resolveReserveCount(config, 'buy');
185
+ + resolveEdgeCount(config, 'buy');
186
186
  let targetSell = Math.max(0, Number.isFinite(Number(activeCfg.sell)) ? Number(activeCfg.sell) : 1)
187
- + resolveReserveCount(config, 'sell');
187
+ + resolveEdgeCount(config, 'sell');
188
188
  const chainBuys = parsedChain.filter((x) => x.parsed.type === ORDER_TYPES.BUY).map((x) => x.chain);
189
189
  const chainSells = parsedChain.filter((x) => x.parsed.type === ORDER_TYPES.SELL).map((x) => x.chain);
190
190
  // PHASE 1: In-memory reconciliation under lock — pure planning, no blockchain I/O.
@@ -7,7 +7,7 @@
7
7
  import { ORDER_TYPES, ORDER_STATES, TIMING, BTS_PRECISION } from '../constants.js';
8
8
  import { readOpenOrdersGuarded } from '../chain_orders.js';
9
9
  import { getMinOrderSize, getAssetFees, getAssetFeesSafe, blockchainToFloat, findCrossedOrder, resolveGapBand, isSlotInRail, priceSlotEqual } from './utils/math.js';
10
- import { isOrderPlaced, parseChainOrder, buildCreateOrderArgs, buildOutsideInPairGroups, extractBatchOperationResults, chainOrderMatchesSlotWithTolerance, buildCrossingCheckCandidates, isCrossingCheckCandidate, getSideBudget, calculateBudgetedSizes, getActiveOrdersTotal, convertToSpreadPlaceholder, isOrderGoneErrorMessage, clearDuplicateOrphanDetection, resolveReserveCount, resolveLiveReserveEdgeAnchorPrice, reserveEdgeIdSet, compareReserveEdge, parseSlotIndex, reportGridPriceInvariant, liveWindowIdSet } from './utils/order.js';
10
+ import { isOrderPlaced, parseChainOrder, buildCreateOrderArgs, buildOutsideInPairGroups, extractBatchOperationResults, chainOrderMatchesSlotWithTolerance, buildCrossingCheckCandidates, isCrossingCheckCandidate, getSideBudget, calculateBudgetedSizes, getCoreOrdersTotal, convertToSpreadPlaceholder, isOrderGoneErrorMessage, clearDuplicateOrphanDetection, resolveEdgeCount, resolveLiveEdgeAnchorPrice, edgeOrderIdSet, compareEdge, parseSlotIndex, reportGridPriceInvariant, liveWindowIdSet } from './utils/order.js';
11
11
  import { resolveAccountRef } from './utils/system.js';
12
12
  import * as Format from './format.js';
13
13
  import { getErrorMessage, getErrorCode, getErrorName } from '../utils/errors.js';
@@ -58,7 +58,7 @@ function computePlacementCrossing(manager, gridOrder, excludeChainOrderId = null
58
58
  */
59
59
  function _countActiveOnGrid(manager, type) {
60
60
  // Slot-N gated: fork-kept shelf/manual orders (non-slot-N ids, e.g.
61
- // deep-*) sit outside window accounting — same gate as reserve
61
+ // deep-*) sit outside window accounting — same gate as edge
62
62
  // classification and matched-excess candidates (issue #27 follow-up).
63
63
  // Without this, a live shelf inflates matchedOnGrid, suppresses
64
64
  // neededSlots/creates, and its chain-count surplus cancels real window
@@ -107,7 +107,7 @@ function _deriveBudgetedSideSizes(manager, type) {
107
107
  if (!funds)
108
108
  return derived;
109
109
  const side = type === ORDER_TYPES.BUY ? 'buy' : 'sell';
110
- const totalTarget = getActiveOrdersTotal(manager.config);
110
+ const totalTarget = getCoreOrdersTotal(manager.config);
111
111
  const budget = getSideBudget(side, funds, manager.config, totalTarget);
112
112
  if (!(budget > 0))
113
113
  return derived;
@@ -182,7 +182,7 @@ function _pickVirtualSlotsToActivate(manager, type, count) {
182
182
  .filter(typeFilter)
183
183
  .filter(inRail)
184
184
  // Slot-N gated: fork-kept shelf/manual slots (non-slot-N ids, e.g.
185
- // deep-*) must never activate as window orders — same gate as reserve
185
+ // deep-*) must never activate as window orders — same gate as edge
186
186
  // classification and startup cancel candidates (issue #27 follow-up).
187
187
  // A VIRTUAL shelf passes the type + fail-open geometry filters above;
188
188
  // without this it would consume window activation budget at an
@@ -235,10 +235,10 @@ function _pickVirtualSlotsToActivate(manager, type, count) {
235
235
  return valid;
236
236
  }
237
237
  /**
238
- * Pick edge-pinned reserve slots (floor for BUY, ceiling for SELL).
238
+ * Pick edge-pinned edge slots (floor for BUY, ceiling for SELL).
239
239
  * Same rail membership gate as _pickVirtualSlotsToActivate, opposite end:
240
- * the reserve ladder rests at the grid edge instead of the market window.
241
- * Size gate is STRICTER than that picker's — reserves activate only with
240
+ * the edge ladder rests at the grid edge instead of the market window.
241
+ * Size gate is STRICTER than that picker's — edge orders activate only with
242
242
  * their own stored size (>= min order size), never a locally derived one,
243
243
  * so an unsized edge slot waits for the target-grid sizing pipeline.
244
244
  * @param {Object} manager - OrderManager instance.
@@ -248,7 +248,7 @@ function _pickVirtualSlotsToActivate(manager, type, count) {
248
248
  * @returns {Array<Object>} Array of picked edge slots (edge first).
249
249
  * @private
250
250
  */
251
- function _pickEdgeReserveSlots(manager, orderType, count, excludeIds = null) {
251
+ function _pickEdgeSlots(manager, orderType, count, excludeIds = null) {
252
252
  if (count <= 0)
253
253
  return [];
254
254
  const type = orderType;
@@ -259,20 +259,20 @@ function _pickEdgeReserveSlots(manager, orderType, count, excludeIds = null) {
259
259
  const typeFilter = boundaryKnown
260
260
  ? (slot) => slot && (slot.type === type || slot.type === ORDER_TYPES.SPREAD)
261
261
  : (slot) => slot && slot.type === type;
262
- // Reserve classification (reserveEdgeIdSet / countLiveReserveOrders) is
262
+ // Edge classification (edgeOrderIdSet / countLiveEdgeOrders) is
263
263
  // slot-N gated; keep placement in agreement so a kept virtual non-grid
264
- // shelf is never activated as a reserve it would then never be counted
264
+ // shelf is never activated as an edge order it would then never be counted
265
265
  // as (issue #27 follow-up). No-op upstream (grids only mint slot-N).
266
266
  const gridSlot = (slot) => parseSlotIndex(slot?.id) !== null;
267
267
  // Both edges anchor at the live grid's own edge (ladder/rail extreme):
268
268
  // floor — nearest at/above the live floor first; ceiling — nearest
269
269
  // at/below the live ceiling first. Stale out-of-grid slots sort last.
270
- const edgeAnchor = resolveLiveReserveEdgeAnchorPrice(manager, edgeDesc ? 'sell' : 'buy');
270
+ const edgeAnchor = resolveLiveEdgeAnchorPrice(manager, edgeDesc ? 'sell' : 'buy');
271
271
  const edgeFirst = Array.from(manager.orders.values())
272
272
  .filter(typeFilter)
273
273
  .filter(gridSlot)
274
274
  .filter(inRail)
275
- .sort((a, b) => compareReserveEdge(a, b, edgeDesc ? 'ceiling' : 'floor', edgeAnchor));
275
+ .sort((a, b) => compareEdge(a, b, edgeDesc ? 'ceiling' : 'floor', edgeAnchor));
276
276
  let effectiveMin = 0;
277
277
  try {
278
278
  effectiveMin = getMinOrderSize(type, manager.assets);
@@ -287,10 +287,10 @@ function _pickEdgeReserveSlots(manager, orderType, count, excludeIds = null) {
287
287
  if (excludeIds && excludeIds.has(slot.id))
288
288
  continue;
289
289
  if (!slot.orderId && slot.state === ORDER_STATES.VIRTUAL) {
290
- // Exact sizes only: a reserve is activated solely with the size the
290
+ // Exact sizes only: an edge order is activated solely with the size the
291
291
  // grid already carries (written by the target-grid sizing pipeline
292
292
  // and persisted with the slot). No local re-derivation — a second
293
- // sizing rule here could place the reserve with a size the target
293
+ // sizing rule here could place the edge with a size the target
294
294
  // grid then has to correct on the next cycle. An unsized slot
295
295
  // simply waits for the sizing pipeline instead of being guessed.
296
296
  const storedSize = Number(slot.size) || 0;
@@ -1401,32 +1401,32 @@ async function _reconcileStartupSide({ orderType, targetCount, chainSideOrders,
1401
1401
  const matchedOnGrid = _countActiveOnGrid(manager, orderType);
1402
1402
  const neededSlots = Math.max(0, targetCount - matchedOnGrid);
1403
1403
  let desiredSlots = _pickVirtualSlotsToActivate(manager, orderType, neededSlots);
1404
- // Reserve ladder: the closest-first picker above backfills the middle. Swap
1404
+ // Edge ladder: the closest-first picker above backfills the middle. Swap
1405
1405
  // its farthest tail for edge-pinned slots (floor for BUY, ceiling for SELL)
1406
1406
  // so startup converges to window + edge instead of one contiguous block.
1407
- let reserveEdgeIds = null;
1408
- const reserveSide = orderType === ORDER_TYPES.SELL ? 'sell' : 'buy';
1409
- const reserveCount = resolveReserveCount(manager.config, reserveSide);
1410
- if (reserveCount > 0) {
1407
+ let edgeOrderIds = null;
1408
+ const edgeSide = orderType === ORDER_TYPES.SELL ? 'sell' : 'buy';
1409
+ const edgeCount = resolveEdgeCount(manager.config, edgeSide);
1410
+ if (edgeCount > 0) {
1411
1411
  const pickedIds = new Set(desiredSlots.map((s) => s?.id).filter(Boolean));
1412
- const freshEdge = _pickEdgeReserveSlots(manager, orderType, reserveCount, pickedIds);
1413
- const reserveAnchor = resolveLiveReserveEdgeAnchorPrice(manager, reserveSide);
1414
- reserveEdgeIds = reserveEdgeIdSet(Array.from(manager.orders.values()), manager.config, orderType, reserveAnchor, liveWindowIdSet(manager, orderType));
1415
- // Window first, then the ready edge reserves. Only the reserve share
1416
- // still MISSING on-chain is held back for the edge (a live reserve is
1412
+ const freshEdge = _pickEdgeSlots(manager, orderType, edgeCount, pickedIds);
1413
+ const edgeAnchor = resolveLiveEdgeAnchorPrice(manager, edgeSide);
1414
+ edgeOrderIds = edgeOrderIdSet(Array.from(manager.orders.values()), manager.config, orderType, edgeAnchor, liveWindowIdSet(manager, orderType));
1415
+ // Window first, then the ready edge orders. Only the edge share
1416
+ // still MISSING on-chain is held back for the edge (a live edge order is
1417
1417
  // already part of matchedOnGrid and must not shrink the window plan), so
1418
1418
  // an edge pick that is not activatable yet (exact-size rule) leaves its
1419
1419
  // slot unplanned: the target-grid pipeline then creates it at the edge
1420
1420
  // with its own sizes, instead of the plan filling it with a middle
1421
1421
  // window slot that the next cycle would have to rotate out.
1422
- // Note: if the window picker itself took an edge/reserve slot (only
1422
+ // Note: if the window picker itself took an edge/edge slot (only
1423
1423
  // when the rail is too short to fill the window closer to market),
1424
- // that slot is not a placed reserve, so the plan comes out one short
1424
+ // that slot is not a placed edge order, so the plan comes out one short
1425
1425
  // here and the target grid settles it on the next cycle.
1426
- const liveReserves = reserveEdgeIds
1427
- ? [...reserveEdgeIds].filter((id) => isOrderPlaced(manager.orders.get(id))).length
1426
+ const liveEdges = edgeOrderIds
1427
+ ? [...edgeOrderIds].filter((id) => isOrderPlaced(manager.orders.get(id))).length
1428
1428
  : 0;
1429
- const missingReserves = Math.max(0, reserveCount - liveReserves);
1429
+ const missingReserves = Math.max(0, edgeCount - liveEdges);
1430
1430
  const keepCount = Math.max(0, neededSlots - missingReserves);
1431
1431
  desiredSlots = [...desiredSlots.slice(0, keepCount), ...freshEdge];
1432
1432
  }
@@ -1449,6 +1449,14 @@ async function _reconcileStartupSide({ orderType, targetCount, chainSideOrders,
1449
1449
  const planVacatedRailRefill = (chainOrder, parsedChain) => {
1450
1450
  const boundary = manager.boundaryIdx;
1451
1451
  const gapSlots = manager._gapSlots;
1452
+ // Explicit null/undefined/'' guard BEFORE Number(): Number(null) === 0
1453
+ // is finite and would defeat this bail-out, running the refill scan on
1454
+ // a bogus boundary 0 (and a null gapSlots would default to 0 through
1455
+ // getSellStartIdx).
1456
+ if (boundary === null || boundary === undefined || boundary === '')
1457
+ return;
1458
+ if (gapSlots === null || gapSlots === undefined || gapSlots === '')
1459
+ return;
1452
1460
  if (!Number.isFinite(Number(boundary)) || !Number.isFinite(Number(gapSlots)))
1453
1461
  return;
1454
1462
  const chainPrice = parsedChain?.price;
@@ -1627,14 +1635,14 @@ async function _reconcileStartupSide({ orderType, targetCount, chainSideOrders,
1627
1635
  .map((co) => ({ chain: co, parsed: parseChainOrder(co, manager.assets) }))
1628
1636
  .filter((x) => x.parsed !== null)
1629
1637
  .sort(sortExcessCancelComparator);
1630
- // Reserve ladder: edge-priced orphans cancel last (they are adoption
1631
- // candidates at reserve prices, not first-to-cut).
1632
- if (reserveEdgeIds && reserveEdgeIds.size > 0) {
1638
+ // Edge ladder: edge-priced orphans cancel last (they are adoption
1639
+ // candidates at edge prices, not first-to-cut).
1640
+ if (edgeOrderIds && edgeOrderIds.size > 0) {
1633
1641
  const sidePrecision = orderType === ORDER_TYPES.SELL
1634
1642
  ? manager.assets?.assetA?.precision
1635
1643
  : manager.assets?.assetB?.precision;
1636
1644
  const edgePrices = [];
1637
- for (const eid of reserveEdgeIds) {
1645
+ for (const eid of edgeOrderIds) {
1638
1646
  const slot = manager.orders.get(eid);
1639
1647
  if (slot && Number.isFinite(Number(slot.price)))
1640
1648
  edgePrices.push(Number(slot.price));
@@ -1666,9 +1674,9 @@ async function _reconcileStartupSide({ orderType, targetCount, chainSideOrders,
1666
1674
  // matched (grid-known) slots. Computed once and shared by both the
1667
1675
  // planOnly and execute branches so planning can never drift from
1668
1676
  // execution: unmatched orphans cancel first, matched surplus after,
1669
- // reserve edge slots last (static insurance). Slot-N gated: fork-kept
1677
+ // edge order slots last (static insurance). Slot-N gated: fork-kept
1670
1678
  // shelf/manual orders (non-slot-N ids, e.g. deep-*) are never excess
1671
- // candidates — reserveEdgeIdSet already excludes them, so without this
1679
+ // candidates — edgeOrderIdSet already excludes them, so without this
1672
1680
  // gate a live shelf heads the cheapest-first sort and is wiped on the
1673
1681
  // next boot (issue #27 follow-up). No-op upstream (grids only mint
1674
1682
  // slot-N).
@@ -1676,11 +1684,11 @@ async function _reconcileStartupSide({ orderType, targetCount, chainSideOrders,
1676
1684
  .filter((o) => o && o.orderId)
1677
1685
  .filter((o) => parseSlotIndex(o?.id) !== null)
1678
1686
  .sort(sortMatchedCancelComparator);
1679
- // Reserve ladder: matched edge slots cancel last (static insurance).
1680
- if (reserveEdgeIds && reserveEdgeIds.size > 0) {
1687
+ // Edge ladder: matched edge slots cancel last (static insurance).
1688
+ if (edgeOrderIds && edgeOrderIds.size > 0) {
1681
1689
  matchedExcess.sort((a, b) => {
1682
- const fa = reserveEdgeIds.has(a.id) ? 1 : 0;
1683
- const fb = reserveEdgeIds.has(b.id) ? 1 : 0;
1690
+ const fa = edgeOrderIds.has(a.id) ? 1 : 0;
1691
+ const fb = edgeOrderIds.has(b.id) ? 1 : 0;
1684
1692
  return fa - fb;
1685
1693
  });
1686
1694
  }
@@ -1712,7 +1720,7 @@ async function _reconcileStartupSide({ orderType, targetCount, chainSideOrders,
1712
1720
  // could never converge to its additive window+edge target (live
1713
1721
  // 12 vs target 8 sat static across every restart). Same priority
1714
1722
  // as the execute branch: unmatched first (above), matched after,
1715
- // reserve edge last (matchedExcess ordering).
1723
+ // edge order last (matchedExcess ordering).
1716
1724
  for (const o of matchedExcess) {
1717
1725
  if (cancelCount <= 0)
1718
1726
  break;
@@ -72,12 +72,38 @@ declare const utils: {
72
72
  accountTotals: import("../types.js").AccountTotals | null;
73
73
  }): Promise<boolean>;
74
74
  restoreGapEvacStreaks(manager: import("../types.js").OrderManagerLike, persisted: unknown): number;
75
+ resolveSpreadFreshnessMs(manager: import("../types.js").OrderManagerLike): number;
76
+ resolveSpreadCrossingFloor(manager: import("../types.js").OrderManagerLike): number | null;
77
+ refreshLiveMarketPrice(manager: import("../types.js").OrderManagerLike, BitShares: unknown): Promise<number | null>;
78
+ maybeRefreshLiveMarketPrice(manager: import("../types.js").OrderManagerLike, BitShares: unknown, options?: {
79
+ now?: number;
80
+ }): Promise<number | null>;
81
+ evaluateSpreadCorrectionReadiness(manager: import("../types.js").OrderManagerLike, options?: {
82
+ now?: number;
83
+ onChainOrders?: {
84
+ buys: unknown[];
85
+ sells: unknown[];
86
+ } | null;
87
+ }): system.SpreadCorrectionReadiness;
88
+ resolveSpreadMarketReference(manager: import("../types.js").OrderManagerLike): number | null;
89
+ resolveLastFillGuardReference(manager: import("../types.js").OrderManagerLike): {
90
+ price: number | null;
91
+ type: string | null;
92
+ };
93
+ restoreLastMarketFill(manager: import("../types.js").OrderManagerLike, persisted: unknown, options?: {
94
+ now?: number;
95
+ }): boolean;
75
96
  normalizeLastFillPivot(row: unknown): {
76
97
  price: number;
77
98
  type: string;
78
99
  fillsAt: number;
79
100
  genesisHash: string;
80
101
  } | null;
102
+ normalizeLastMarketFill(row: unknown): {
103
+ price: number;
104
+ type: string;
105
+ fillsAt: number;
106
+ } | null;
81
107
  setLastFillPivot(manager: import("../types.js").OrderManagerLike, type: string, price: unknown, provenance: "fill" | "book", atMs?: number): boolean;
82
108
  resetLastFillPivot(manager: import("../types.js").OrderManagerLike, reason?: string): boolean;
83
109
  restoreLastFillPivot(manager: import("../types.js").OrderManagerLike, persisted: unknown, options?: {
@@ -122,6 +148,7 @@ declare const utils: {
122
148
  resolveAccountRef(manager: import("../types.js").OrderManagerLike, account: string): string | null;
123
149
  deepFreeze<T>(obj: T): T;
124
150
  cloneMap<K, V>(map: Map<K, V>): Map<K, V>;
151
+ fireStructuralResync(bot: import("../types.js").BotLike, reason: string, details: Record<string, unknown>, errorLabel: string, level?: string): void;
125
152
  parseJsonWithComments(raw: string): Record<string, unknown>;
126
153
  applyPersistedPendingCrawls(bot: import("../types.js").BotLike, options?: {
127
154
  log?: (message: string, level?: string) => void;
@@ -199,10 +226,10 @@ declare const utils: {
199
226
  buildDelta: typeof order.buildDelta;
200
227
  deriveTargetBoundary: typeof order.deriveTargetBoundary;
201
228
  isShiftEligibleFill: typeof order.isShiftEligibleFill;
202
- resolveReserveCount: typeof order.resolveReserveCount;
203
- resolveReserveOrders: typeof order.resolveReserveOrders;
204
- selectReserveEdgeSlots: typeof order.selectReserveEdgeSlots;
205
- getActiveOrdersTotal: typeof order.getActiveOrdersTotal;
229
+ resolveEdgeCount: typeof order.resolveEdgeCount;
230
+ resolveEdgeOrders: typeof order.resolveEdgeOrders;
231
+ selectEdgeSlots: typeof order.selectEdgeSlots;
232
+ getCoreOrdersTotal: typeof order.getCoreOrdersTotal;
206
233
  getSideBudget: typeof order.getSideBudget;
207
234
  calculateBudgetedSizes: typeof order.calculateBudgetedSizes;
208
235
  buildCreateOpFingerprint: typeof order.buildCreateOpFingerprint;
@@ -213,13 +240,13 @@ declare const utils: {
213
240
  chainOrderUnchangedFromCache: typeof order.chainOrderUnchangedFromCache;
214
241
  detectCrossedBookPlan: typeof order.detectCrossedBookPlan;
215
242
  collectKnownOnChainOrderIds: typeof order.collectKnownOnChainOrderIds;
216
- reserveEdgeIdSet: typeof order.reserveEdgeIdSet;
243
+ edgeOrderIdSet: typeof order.edgeOrderIdSet;
217
244
  liveWindowIdSet: typeof order.liveWindowIdSet;
218
245
  checkGridPriceInvariant: typeof order.checkGridPriceInvariant;
219
246
  reportGridPriceInvariant: typeof order.reportGridPriceInvariant;
220
- resolveReserveEdgeAnchorPrice: typeof order.resolveReserveEdgeAnchorPrice;
221
- resolveLiveReserveEdgeAnchorPrice: typeof order.resolveLiveReserveEdgeAnchorPrice;
222
- compareReserveEdge: typeof order.compareReserveEdge;
247
+ resolveEdgeAnchorPrice: typeof order.resolveEdgeAnchorPrice;
248
+ resolveLiveEdgeAnchorPrice: typeof order.resolveLiveEdgeAnchorPrice;
249
+ compareEdge: typeof order.compareEdge;
223
250
  collectRefillSlotIds: typeof order.collectRefillSlotIds;
224
251
  recordOrderPlacement: typeof order.recordOrderPlacement;
225
252
  isFreshlyPlacedOrder: typeof order.isFreshlyPlacedOrder;
@@ -83,10 +83,6 @@ declare class Logger {
83
83
  * @param {string} [category='DEXBot'] - Logger category/prefix
84
84
  * @param {Object} [options]
85
85
  * @param {boolean} [options.quiet] - Suppress console output
86
- * @param {boolean} [options.quietUnderPm2=false] - Legacy opt-in to suppress
87
- * console output under PM2. Keep this false in normal operation: under
88
- * PM2 stdout is the only sink (direct file writes are suppressed), so
89
- * auto-quieting drops every log line.
90
86
  * @param {string} [options.logFile] - Optional path to log file
91
87
  * @param {string} [options.level='info'] - Log level
92
88
  * @param {Object} [options.configOverride] - Override LOGGING_CONFIG
@@ -94,7 +90,6 @@ declare class Logger {
94
90
  */
95
91
  constructor(category?: string, options?: {
96
92
  quiet?: boolean;
97
- quietUnderPm2?: boolean;
98
93
  logFile?: string;
99
94
  level?: string;
100
95
  configOverride?: LoggerConfig;
@@ -179,9 +174,7 @@ declare function isPm2Runtime(): boolean;
179
174
  * PM2-managed file.
180
175
  */
181
176
  declare function isPm2LogCaptureActive(): boolean;
182
- declare function createPm2AwareLogger(category: string, options?: {
183
- quietUnderPm2?: boolean;
184
- }): Logger;
177
+ declare function createPm2AwareLogger(category: string, options?: ConstructorParameters<typeof Logger>[1]): Logger;
185
178
  export { createPm2AwareLogger, isPm2Runtime, isPm2LogCaptureActive, setGlobalConsoleLevel, getGlobalConsoleLevel };
186
179
  export default Logger;
187
180
  //# sourceMappingURL=logger.d.ts.map
@@ -105,10 +105,6 @@ class Logger {
105
105
  * @param {string} [category='DEXBot'] - Logger category/prefix
106
106
  * @param {Object} [options]
107
107
  * @param {boolean} [options.quiet] - Suppress console output
108
- * @param {boolean} [options.quietUnderPm2=false] - Legacy opt-in to suppress
109
- * console output under PM2. Keep this false in normal operation: under
110
- * PM2 stdout is the only sink (direct file writes are suppressed), so
111
- * auto-quieting drops every log line.
112
108
  * @param {string} [options.logFile] - Optional path to log file
113
109
  * @param {string} [options.level='info'] - Log level
114
110
  * @param {Object} [options.configOverride] - Override LOGGING_CONFIG
@@ -116,15 +112,10 @@ class Logger {
116
112
  */
117
113
  constructor(category = 'DEXBot', options = {}) {
118
114
  this.category = category;
119
- const isUnderPm2 = !!Config.pm_exec_path;
120
115
  this.logFile = options.logFile || null;
121
116
  if (options.quiet !== undefined) {
122
117
  this.quiet = options.quiet;
123
118
  }
124
- else if (options.quietUnderPm2 === true && isUnderPm2) {
125
- // Legacy escape hatch: explicit opt-in to the old silent behaviour.
126
- this.quiet = true;
127
- }
128
119
  else {
129
120
  // Non-PM2 runs with a logFile write to the file only, so console is
130
121
  // quiet to avoid duplication. Under PM2 the file sink is suppressed
@@ -553,7 +544,7 @@ class Logger {
553
544
  if (!this.config.display?.statusSummary?.enabled && !forceOutput)
554
545
  return;
555
546
  const market = manager.marketName || manager.config?.market || 'unknown';
556
- const activeOrders = manager.getOrdersByTypeAndState?.(null, ORDER_STATES.ACTIVE) || [];
547
+ const liveOrders = manager.getOrdersByTypeAndState?.(null, ORDER_STATES.ACTIVE) || [];
557
548
  const partialOrders = manager.getOrdersByTypeAndState?.(null, ORDER_STATES.PARTIAL) || [];
558
549
  const virtualOrders = manager.getOrdersByTypeAndState?.(null, ORDER_STATES.VIRTUAL) || [];
559
550
  const buyName = manager.config?.assetB?.symbol || manager.config?.assetB || 'quote';
@@ -579,7 +570,7 @@ class Logger {
579
570
  `virtual.grid: ${buy}Buy ${Format.formatAmountByPrecision(virtualBuy, buyPrecision)}${reset} ${buyName} | ${sell}Sell ${Format.formatAmountByPrecision(virtualSell, sellPrecision)}${reset} ${sellName}`,
580
571
  `committed.grid: ${buy}Buy ${Format.formatAmountByPrecision(committedGridBuy, buyPrecision)}${reset} ${buyName} | ${sell}Sell ${Format.formatAmountByPrecision(committedGridSell, sellPrecision)}${reset} ${sellName}`,
581
572
  `committed.chain: ${buy}Buy ${Format.formatAmountByPrecision(committedChainBuy, buyPrecision)}${reset} ${buyName} | ${sell}Sell ${Format.formatAmountByPrecision(committedChainSell, sellPrecision)}${reset} ${sellName}`,
582
- `Orders: Virtual ${virtualOrders.length} | Active ${activeOrders.length} | Partial ${partialOrders.length}`,
573
+ `Orders: Virtual ${virtualOrders.length} | Active ${liveOrders.length} | Partial ${partialOrders.length}`,
583
574
  `Spreads: ${manager.initialSpreadCount > 0 ? `${manager.currentSpreadCount}/${manager.initialSpreadCount} (gap)` : 'n/a (gap)'}`,
584
575
  ];
585
576
  if (typeof manager.calculateCurrentSpread === 'function') {
@@ -77,7 +77,7 @@ interface COWExecuteParams {
77
77
  excludeIds?: Set<string>;
78
78
  gapSlots?: number | null;
79
79
  evacStreaks?: Map<string, number> | null;
80
- reserveEdgeAnchors?: {
80
+ edgeAnchors?: {
81
81
  buy?: number | null;
82
82
  sell?: number | null;
83
83
  } | null;
@@ -93,7 +93,7 @@ declare class COWRebalanceEngine {
93
93
  assets: AssetPair | null;
94
94
  config: GridConfig;
95
95
  });
96
- execute({ masterGrid, gridVersion, boundaryIdx, funds, manager, fills, excludeIds, gapSlots, evacStreaks, reserveEdgeAnchors }: COWExecuteParams): Promise<RebalanceResult>;
96
+ execute({ masterGrid, gridVersion, boundaryIdx, funds, manager, fills, excludeIds, gapSlots, evacStreaks, edgeAnchors }: COWExecuteParams): Promise<RebalanceResult>;
97
97
  }
98
98
  declare class OrderManager implements OrderManagerLike {
99
99
  config: GridConfig;
@@ -131,10 +131,7 @@ declare class OrderManager implements OrderManagerLike {
131
131
  lastTriggeredAt: number;
132
132
  };
133
133
  };
134
- private _ordersByTypeCache;
135
- private _ordersByStateCache;
136
- private _ordersByTypeCacheVersion;
137
- private _ordersByStateCacheVersion;
134
+ private _orderIdIndexes;
138
135
  /**
139
136
  * Lazy-compute order-IDs grouped by type.
140
137
  *
@@ -156,6 +153,8 @@ declare class OrderManager implements OrderManagerLike {
156
153
  */
157
154
  get _ordersByState(): Record<string, Set<string>>;
158
155
  set _ordersByState(val: Record<string, Set<string>>);
156
+ /** Rebuild an order-id index for `field` over `keys`, memoized per `_gridVersion`. */
157
+ private _getOrderIdIndex;
159
158
  initialSpreadCount: number;
160
159
  currentSpreadCount: number;
161
160
  outOfSpread: number;
@@ -221,6 +220,13 @@ declare class OrderManager implements OrderManagerLike {
221
220
  _lastFilledType: string | null;
222
221
  _lastFilledAt: number;
223
222
  lastFillPivotSource: 'fill' | 'book' | null;
223
+ _lastMarketFillPrice: number | null;
224
+ _lastMarketFillType: string | null;
225
+ _lastMarketFillAt: number;
226
+ _liveMarketPrice: number | null;
227
+ _liveMarketPriceAt: number;
228
+ _liveMarketPriceAttemptedAt: number;
229
+ _lastSyncAt: number;
224
230
  _deferredRebalanceAt: number;
225
231
  _lastHeldPlanSignature: {
226
232
  boundaryIdx: number | null;
@@ -228,7 +234,6 @@ declare class OrderManager implements OrderManagerLike {
228
234
  fillsAt: number | null;
229
235
  } | null;
230
236
  _heldPlanSuppressionCount: number;
231
- _onBroadcastRegionEnd?: () => void;
232
237
  _onBroadcastRegionEndListeners: Array<() => void>;
233
238
  _lastBoundaryHoldResyncAt: number;
234
239
  _gapEvacStreaks: Map<string, number>;
@@ -339,17 +344,15 @@ declare class OrderManager implements OrderManagerLike {
339
344
  * without rescheduling, so this is the only wake-up for fills enqueued
340
345
  * during a region; the watchdog path must fire it too or a hung broadcast's
341
346
  * queued fills wait for the next fill event.
342
- * Fans out to the legacy single listener plus every registered listener
343
- * (see addBroadcastRegionEndListener): a second wirer must never silently
344
- * displace the fill-queue drain. Guarded so a listener error never escapes
345
- * into a finally/watchdog frame.
347
+ * Fans out to every listener registered via addBroadcastRegionEndListener:
348
+ * a second wirer must never silently displace the fill-queue drain.
349
+ * Guarded so a listener error never escapes into a finally/watchdog frame.
346
350
  * @returns {void}
347
351
  */
348
352
  _fireBroadcastRegionEnd(): void;
349
353
  /**
350
- * Register an additional broadcast-region-end listener without displacing
351
- * the legacy single listener or previously registered ones. Duplicate
352
- * registrations of the same function reference are ignored.
354
+ * Register a broadcast-region-end listener. Duplicate registrations of the
355
+ * same function reference are ignored.
353
356
  * @param {() => void} listener
354
357
  * @returns {void}
355
358
  */
@@ -764,7 +767,7 @@ declare class OrderManager implements OrderManagerLike {
764
767
  }>) | null): Promise<{
765
768
  ordersPlaced: number;
766
769
  partialsMoved: number;
767
- fundsExhausted?: boolean;
770
+ stall?: import("../types.js").SpreadCorrectionStall;
768
771
  }>;
769
772
  /**
770
773
  * @param {Function} batchCb - Batch callback