dexbot 1.6.6 → 1.6.8

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 (632) hide show
  1. package/CHANGELOG.md +89 -1
  2. package/README.md +8 -5
  3. package/analysis/README.md +2 -3
  4. package/analysis/tradingview/README.md +78 -1
  5. package/analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md +1 -1
  6. package/claw/package.json +1 -1
  7. package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
  8. package/claw/runtimes/openclaw-plugin/package.json +1 -1
  9. package/dist/analysis/tradingview/analyze_tradingview.d.ts +4 -0
  10. package/dist/analysis/tradingview/analyze_tradingview.js +55 -0
  11. package/dist/analysis/tradingview/grid_reset_config.d.ts +61 -0
  12. package/dist/analysis/tradingview/grid_reset_config.js +235 -0
  13. package/dist/analysis/tradingview/grid_reset_sim.d.ts +67 -0
  14. package/dist/analysis/tradingview/grid_reset_sim.js +307 -0
  15. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +419 -3
  16. package/dist/dexbot.js +44 -15
  17. package/dist/market_adapter/core/market_adapter_service.js +14 -2
  18. package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts +8 -1
  19. package/dist/market_adapter/core/strategies/dynamic_weight_series.js +5 -1
  20. package/dist/market_adapter/inputs/window_cache.d.ts +97 -19
  21. package/dist/market_adapter/inputs/window_cache.js +302 -48
  22. package/dist/market_adapter/market_adapter.d.ts +8 -1
  23. package/dist/market_adapter/market_adapter.js +22 -4
  24. package/dist/modules/account_bots.js +20 -9
  25. package/dist/modules/account_orders.d.ts +44 -4
  26. package/dist/modules/account_orders.js +104 -7
  27. package/dist/modules/bitshares-native/chain_client.d.ts +10 -0
  28. package/dist/modules/bitshares-native/chain_client.js +197 -28
  29. package/dist/modules/bitshares-native/subscriptions.js +312 -10
  30. package/dist/modules/bitshares-native/transport.d.ts +1 -0
  31. package/dist/modules/bitshares-native/transport.js +97 -3
  32. package/dist/modules/bitshares_client.d.ts +20 -0
  33. package/dist/modules/bitshares_client.js +29 -0
  34. package/dist/modules/bot_settings.js +10 -1
  35. package/dist/modules/chain_keys.d.ts +37 -22
  36. package/dist/modules/chain_keys.js +145 -44
  37. package/dist/modules/cli_start_onboarding.d.ts +10 -0
  38. package/dist/modules/cli_start_onboarding.js +15 -0
  39. package/dist/modules/cli_start_output.d.ts +6 -0
  40. package/dist/modules/cli_start_output.js +8 -0
  41. package/dist/modules/config.d.ts +1 -0
  42. package/dist/modules/config.js +1 -0
  43. package/dist/modules/constants.d.ts +23 -2
  44. package/dist/modules/constants.js +196 -15
  45. package/dist/modules/dexbot_class.d.ts +6 -76
  46. package/dist/modules/dexbot_class.js +0 -32
  47. package/dist/modules/dexbot_cow_runtime.d.ts +3 -58
  48. package/dist/modules/dexbot_cow_runtime.js +53 -96
  49. package/dist/modules/dexbot_fill_runtime.d.ts +6 -1
  50. package/dist/modules/dexbot_fill_runtime.js +22 -3
  51. package/dist/modules/dexbot_maintenance_runtime.d.ts +38 -1
  52. package/dist/modules/dexbot_maintenance_runtime.js +103 -11
  53. package/dist/modules/dexbot_startup_runtime.js +73 -20
  54. package/dist/modules/dexbot_state_recovery.d.ts +6 -0
  55. package/dist/modules/dexbot_state_recovery.js +34 -1
  56. package/dist/modules/order/async_lock.d.ts +8 -0
  57. package/dist/modules/order/async_lock.js +15 -0
  58. package/dist/modules/order/genesis_policy.d.ts +162 -0
  59. package/dist/modules/order/genesis_policy.js +267 -0
  60. package/dist/modules/order/grid.js +109 -135
  61. package/dist/modules/order/grid_reconcile.d.ts +9 -0
  62. package/dist/modules/order/grid_reconcile.js +13 -4
  63. package/dist/modules/order/grid_reconcile_internal.js +13 -2
  64. package/dist/modules/order/logger.d.ts +12 -2
  65. package/dist/modules/order/logger.js +29 -7
  66. package/dist/modules/order/manager.d.ts +53 -0
  67. package/dist/modules/order/manager.js +86 -25
  68. package/dist/modules/order/sync_engine.d.ts +19 -0
  69. package/dist/modules/order/sync_engine.js +284 -344
  70. package/dist/modules/order/utils/math.d.ts +22 -1
  71. package/dist/modules/order/utils/math.js +64 -1
  72. package/dist/modules/order/utils/order.d.ts +43 -58
  73. package/dist/modules/order/utils/order.js +302 -194
  74. package/dist/modules/order/utils/system.d.ts +97 -0
  75. package/dist/modules/order/utils/system.js +282 -3
  76. package/dist/modules/paths.d.ts +8 -1
  77. package/dist/modules/paths.js +11 -3
  78. package/dist/modules/utils/text_width.d.ts +19 -0
  79. package/dist/modules/utils/text_width.js +97 -0
  80. package/dist/modules/version_notice.d.ts +165 -0
  81. package/dist/modules/version_notice.js +364 -0
  82. package/dist/pm2.js +104 -18
  83. package/dist/scripts/update.js +62 -13
  84. package/dist/unlock.d.ts +14 -2
  85. package/dist/unlock.js +101 -4
  86. package/docs/BITSHARES_ONBOARDING.md +8 -1
  87. package/docs/COW_INVARIANTS.md +11 -2
  88. package/docs/CREDENTIAL_SECURITY.md +26 -0
  89. package/docs/DEXBOT_COMPARISON.md +4 -4
  90. package/docs/EVOLUTION.md +20 -18
  91. package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +1 -1
  92. package/docs/GRID_PRICE_INVARIANT.md +204 -31
  93. package/docs/GRID_RECALCULATION.md +12 -0
  94. package/docs/LOGGING.md +17 -2
  95. package/docs/ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md +6 -7
  96. package/docs/README.md +3 -1
  97. package/docs/WORKFLOW.md +16 -5
  98. package/market_adapter/README.md +1 -1
  99. package/modules/README.md +18 -1
  100. package/package.json +14 -6
  101. package/scripts/README.md +28 -2
  102. package/scripts/clear-all.sh +13 -4
  103. package/scripts/clear-logs.sh +13 -4
  104. package/scripts/clear-market-adapter.sh +6 -0
  105. package/scripts/clear-orders.sh +5 -0
  106. package/scripts/lib/dexbot-paths.sh +108 -0
  107. package/tests/README.md +11 -3
  108. package/analysis/account_resolver.ts +0 -161
  109. package/analysis/ama_fitting/analyze_ama_price_changes.ts +0 -155
  110. package/analysis/ama_fitting/analyze_lambda_vs_slow.ts +0 -404
  111. package/analysis/ama_fitting/calibrate_convergence_er.ts +0 -201
  112. package/analysis/ama_fitting/fetch_lp_candles.ts +0 -184
  113. package/analysis/ama_fitting/generate_unified_comparison_chart.ts +0 -232
  114. package/analysis/ama_fitting/optimizer_high_resolution.ts +0 -802
  115. package/analysis/analyze_dynamic_weight.ts +0 -243
  116. package/analysis/analyze_kalman.ts +0 -157
  117. package/analysis/analyze_regime.ts +0 -158
  118. package/analysis/analyze_regime_windows.ts +0 -470
  119. package/analysis/analyze_risk_profile.ts +0 -199
  120. package/analysis/analyze_trade_heatmap.ts +0 -362
  121. package/analysis/analyze_volatility.ts +0 -182
  122. package/analysis/bot_fitting/backtest_ama_sweep.ts +0 -934
  123. package/analysis/bot_fitting/backtest_bot_fitting.ts +0 -861
  124. package/analysis/bot_fitting/shared_utils.ts +0 -52
  125. package/analysis/bot_key_utils.ts +0 -426
  126. package/analysis/bot_usage/discover_bot_accounts.ts +0 -635
  127. package/analysis/bot_usage/kibana_bot_queries.ts +0 -211
  128. package/analysis/chain_pool.ts +0 -47
  129. package/analysis/chart_css.ts +0 -62
  130. package/analysis/chart_ui.ts +0 -105
  131. package/analysis/chart_utils.ts +0 -210
  132. package/analysis/fills_source.ts +0 -228
  133. package/analysis/grid_correction_check.ts +0 -786
  134. package/analysis/math_utils.ts +0 -53
  135. package/analysis/price_sources.ts +0 -136
  136. package/analysis/resolve_bot_accounts.ts +0 -199
  137. package/analysis/resolve_source.ts +0 -99
  138. package/analysis/results/ama_sweep_results_lp_pool_133_1h.json +0 -2455
  139. package/analysis/results/bot_fitting_results_lp_pool_133_1h.json +0 -218
  140. package/analysis/trade_profitability.ts +0 -1335
  141. package/analysis/tradingview/analyze_tradingview.ts +0 -280
  142. package/analysis/tradingview/h-bts_tradingview.html +0 -1570
  143. package/analysis/tradingview/t-bts_tradingview.html +0 -1570
  144. package/analysis/tradingview/tradingview_uplot_chart_generator.ts +0 -3268
  145. package/analysis/trend_detection/dynamic_weight_chart_generator.ts +0 -1481
  146. package/analysis/trend_detection/hurst_analyzer.ts +0 -7
  147. package/analysis/trend_detection/kalman_chart_generator.ts +0 -398
  148. package/analysis/trend_detection/kalman_trend_analyzer.ts +0 -9
  149. package/analysis/trend_detection/kalman_velocity_smoothing.ts +0 -7
  150. package/analysis/trend_detection/package.json +0 -23
  151. package/analysis/trend_detection/permutation_entropy_analyzer.ts +0 -7
  152. package/analysis/trend_detection/regime_chart_generator.ts +0 -338
  153. package/analysis/trend_detection/tests/test_kalman_trend.ts +0 -153
  154. package/analysis/trend_detection/tests/test_kalman_velocity_smoothing.ts +0 -64
  155. package/analysis/trend_detection/volatility_chart_generator.ts +0 -654
  156. package/analysis/tsconfig.json +0 -29
  157. package/claw/tests/package.json +0 -3
  158. package/claw/tests/test_claw_bridge.ts +0 -570
  159. package/claw/tests/test_claw_catalog_and_credentials.ts +0 -156
  160. package/claw/tests/test_claw_chain_layer.ts +0 -739
  161. package/claw/tests/test_claw_data_flow.ts +0 -525
  162. package/claw/tests/test_claw_domain_logic.ts +0 -471
  163. package/claw/tests/test_claw_manifest_and_matrix.ts +0 -222
  164. package/claw/tests/test_claw_mcp_transport.ts +0 -243
  165. package/claw/tests/test_claw_regressions.ts +0 -711
  166. package/claw/tests/test_claw_skill_generation.ts +0 -103
  167. package/claw/tests/test_claw_state_store.ts +0 -44
  168. package/claw/tests/test_dexbot_profiles.ts +0 -654
  169. package/claw/tests/test_memu_bridge.ts +0 -189
  170. package/claw/tests/test_nullclaw_tmp_integration.ts +0 -57
  171. package/claw/tests/test_position_health.ts +0 -343
  172. package/claw/tests/test_position_manager.ts +0 -429
  173. package/claw/tests/test_position_manager_watch_health.ts +0 -100
  174. package/claw/tests/test_short_mpa_strategy.ts +0 -232
  175. package/dist/analysis/account_resolver.d.ts.map +0 -1
  176. package/dist/analysis/account_resolver.js.map +0 -1
  177. package/dist/analysis/ama_fitting/analyze_ama_price_changes.d.ts.map +0 -1
  178. package/dist/analysis/ama_fitting/analyze_ama_price_changes.js.map +0 -1
  179. package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts.map +0 -1
  180. package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js.map +0 -1
  181. package/dist/analysis/ama_fitting/calibrate_convergence_er.d.ts.map +0 -1
  182. package/dist/analysis/ama_fitting/calibrate_convergence_er.js.map +0 -1
  183. package/dist/analysis/ama_fitting/fetch_lp_candles.d.ts.map +0 -1
  184. package/dist/analysis/ama_fitting/fetch_lp_candles.js.map +0 -1
  185. package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts.map +0 -1
  186. package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js.map +0 -1
  187. package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts.map +0 -1
  188. package/dist/analysis/ama_fitting/optimizer_high_resolution.js.map +0 -1
  189. package/dist/analysis/analyze_dynamic_weight.d.ts.map +0 -1
  190. package/dist/analysis/analyze_dynamic_weight.js.map +0 -1
  191. package/dist/analysis/analyze_kalman.d.ts.map +0 -1
  192. package/dist/analysis/analyze_kalman.js.map +0 -1
  193. package/dist/analysis/analyze_regime.d.ts.map +0 -1
  194. package/dist/analysis/analyze_regime.js.map +0 -1
  195. package/dist/analysis/analyze_regime_windows.d.ts.map +0 -1
  196. package/dist/analysis/analyze_regime_windows.js.map +0 -1
  197. package/dist/analysis/analyze_risk_profile.d.ts.map +0 -1
  198. package/dist/analysis/analyze_risk_profile.js.map +0 -1
  199. package/dist/analysis/analyze_trade_heatmap.d.ts.map +0 -1
  200. package/dist/analysis/analyze_trade_heatmap.js.map +0 -1
  201. package/dist/analysis/analyze_volatility.d.ts.map +0 -1
  202. package/dist/analysis/analyze_volatility.js.map +0 -1
  203. package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts.map +0 -1
  204. package/dist/analysis/bot_fitting/backtest_ama_sweep.js.map +0 -1
  205. package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts.map +0 -1
  206. package/dist/analysis/bot_fitting/backtest_bot_fitting.js.map +0 -1
  207. package/dist/analysis/bot_fitting/shared_utils.d.ts.map +0 -1
  208. package/dist/analysis/bot_fitting/shared_utils.js.map +0 -1
  209. package/dist/analysis/bot_key_utils.d.ts.map +0 -1
  210. package/dist/analysis/bot_key_utils.js.map +0 -1
  211. package/dist/analysis/bot_usage/discover_bot_accounts.d.ts.map +0 -1
  212. package/dist/analysis/bot_usage/discover_bot_accounts.js.map +0 -1
  213. package/dist/analysis/bot_usage/kibana_bot_queries.d.ts.map +0 -1
  214. package/dist/analysis/bot_usage/kibana_bot_queries.js.map +0 -1
  215. package/dist/analysis/chain_pool.d.ts.map +0 -1
  216. package/dist/analysis/chain_pool.js.map +0 -1
  217. package/dist/analysis/chart_css.d.ts.map +0 -1
  218. package/dist/analysis/chart_css.js.map +0 -1
  219. package/dist/analysis/chart_ui.d.ts.map +0 -1
  220. package/dist/analysis/chart_ui.js.map +0 -1
  221. package/dist/analysis/chart_utils.d.ts.map +0 -1
  222. package/dist/analysis/chart_utils.js.map +0 -1
  223. package/dist/analysis/fills_source.d.ts.map +0 -1
  224. package/dist/analysis/fills_source.js.map +0 -1
  225. package/dist/analysis/grid_correction_check.d.ts.map +0 -1
  226. package/dist/analysis/grid_correction_check.js.map +0 -1
  227. package/dist/analysis/math_utils.d.ts.map +0 -1
  228. package/dist/analysis/math_utils.js.map +0 -1
  229. package/dist/analysis/price_sources.d.ts.map +0 -1
  230. package/dist/analysis/price_sources.js.map +0 -1
  231. package/dist/analysis/resolve_bot_accounts.d.ts.map +0 -1
  232. package/dist/analysis/resolve_bot_accounts.js.map +0 -1
  233. package/dist/analysis/resolve_source.d.ts.map +0 -1
  234. package/dist/analysis/resolve_source.js.map +0 -1
  235. package/dist/analysis/trade_profitability.d.ts.map +0 -1
  236. package/dist/analysis/trade_profitability.js.map +0 -1
  237. package/dist/analysis/tradingview/analyze_tradingview.d.ts.map +0 -1
  238. package/dist/analysis/tradingview/analyze_tradingview.js.map +0 -1
  239. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +0 -1
  240. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +0 -1
  241. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts.map +0 -1
  242. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js.map +0 -1
  243. package/dist/analysis/trend_detection/hurst_analyzer.d.ts.map +0 -1
  244. package/dist/analysis/trend_detection/hurst_analyzer.js.map +0 -1
  245. package/dist/analysis/trend_detection/kalman_chart_generator.d.ts.map +0 -1
  246. package/dist/analysis/trend_detection/kalman_chart_generator.js.map +0 -1
  247. package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts.map +0 -1
  248. package/dist/analysis/trend_detection/kalman_trend_analyzer.js.map +0 -1
  249. package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts.map +0 -1
  250. package/dist/analysis/trend_detection/kalman_velocity_smoothing.js.map +0 -1
  251. package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts.map +0 -1
  252. package/dist/analysis/trend_detection/permutation_entropy_analyzer.js.map +0 -1
  253. package/dist/analysis/trend_detection/regime_chart_generator.d.ts.map +0 -1
  254. package/dist/analysis/trend_detection/regime_chart_generator.js.map +0 -1
  255. package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts +0 -2
  256. package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts.map +0 -1
  257. package/dist/analysis/trend_detection/tests/test_kalman_trend.js +0 -128
  258. package/dist/analysis/trend_detection/tests/test_kalman_trend.js.map +0 -1
  259. package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts +0 -2
  260. package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts.map +0 -1
  261. package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js +0 -37
  262. package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js.map +0 -1
  263. package/dist/analysis/trend_detection/volatility_chart_generator.d.ts.map +0 -1
  264. package/dist/analysis/trend_detection/volatility_chart_generator.js.map +0 -1
  265. package/dist/bot.d.ts.map +0 -1
  266. package/dist/bot.js.map +0 -1
  267. package/dist/credential-daemon.d.ts.map +0 -1
  268. package/dist/credential-daemon.js.map +0 -1
  269. package/dist/dexbot.d.ts.map +0 -1
  270. package/dist/dexbot.js.map +0 -1
  271. package/dist/market_adapter/ama_signal_runner.d.ts.map +0 -1
  272. package/dist/market_adapter/ama_signal_runner.js.map +0 -1
  273. package/dist/market_adapter/candle_utils.d.ts.map +0 -1
  274. package/dist/market_adapter/candle_utils.js.map +0 -1
  275. package/dist/market_adapter/core/asymmetric_bounds.d.ts.map +0 -1
  276. package/dist/market_adapter/core/asymmetric_bounds.js.map +0 -1
  277. package/dist/market_adapter/core/config_normalizers.d.ts.map +0 -1
  278. package/dist/market_adapter/core/config_normalizers.js.map +0 -1
  279. package/dist/market_adapter/core/kibana_candles.d.ts.map +0 -1
  280. package/dist/market_adapter/core/kibana_candles.js.map +0 -1
  281. package/dist/market_adapter/core/kibana_client.d.ts.map +0 -1
  282. package/dist/market_adapter/core/kibana_client.js.map +0 -1
  283. package/dist/market_adapter/core/kibana_market_candles.d.ts.map +0 -1
  284. package/dist/market_adapter/core/kibana_market_candles.js.map +0 -1
  285. package/dist/market_adapter/core/market_adapter_service.d.ts.map +0 -1
  286. package/dist/market_adapter/core/market_adapter_service.js.map +0 -1
  287. package/dist/market_adapter/core/signals/hurst_analyzer.d.ts.map +0 -1
  288. package/dist/market_adapter/core/signals/hurst_analyzer.js.map +0 -1
  289. package/dist/market_adapter/core/signals/kalman_trend_analyzer.d.ts.map +0 -1
  290. package/dist/market_adapter/core/signals/kalman_trend_analyzer.js.map +0 -1
  291. package/dist/market_adapter/core/signals/kalman_velocity_smoothing.d.ts.map +0 -1
  292. package/dist/market_adapter/core/signals/kalman_velocity_smoothing.js.map +0 -1
  293. package/dist/market_adapter/core/signals/permutation_entropy_analyzer.d.ts.map +0 -1
  294. package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js.map +0 -1
  295. package/dist/market_adapter/core/strategies/ama.d.ts.map +0 -1
  296. package/dist/market_adapter/core/strategies/ama.js.map +0 -1
  297. package/dist/market_adapter/core/strategies/ama_slope_model.d.ts.map +0 -1
  298. package/dist/market_adapter/core/strategies/ama_slope_model.js.map +0 -1
  299. package/dist/market_adapter/core/strategies/atr/calculator.d.ts.map +0 -1
  300. package/dist/market_adapter/core/strategies/atr/calculator.js.map +0 -1
  301. package/dist/market_adapter/core/strategies/collateral_manager.d.ts.map +0 -1
  302. package/dist/market_adapter/core/strategies/collateral_manager.js.map +0 -1
  303. package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts.map +0 -1
  304. package/dist/market_adapter/core/strategies/dynamic_weight_series.js.map +0 -1
  305. package/dist/market_adapter/core/strategies/regime_gate.d.ts.map +0 -1
  306. package/dist/market_adapter/core/strategies/regime_gate.js.map +0 -1
  307. package/dist/market_adapter/core/strategies/regime_interp.d.ts.map +0 -1
  308. package/dist/market_adapter/core/strategies/regime_interp.js.map +0 -1
  309. package/dist/market_adapter/core/strategies/volatility_shift.d.ts.map +0 -1
  310. package/dist/market_adapter/core/strategies/volatility_shift.js.map +0 -1
  311. package/dist/market_adapter/inputs/fetch_book_data.d.ts.map +0 -1
  312. package/dist/market_adapter/inputs/fetch_book_data.js.map +0 -1
  313. package/dist/market_adapter/inputs/fetch_cex_synthetic_data.d.ts.map +0 -1
  314. package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +0 -1
  315. package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +0 -1
  316. package/dist/market_adapter/inputs/fetch_lp_data.js.map +0 -1
  317. package/dist/market_adapter/inputs/kibana_feed_source.d.ts.map +0 -1
  318. package/dist/market_adapter/inputs/kibana_feed_source.js.map +0 -1
  319. package/dist/market_adapter/inputs/kibana_source.d.ts.map +0 -1
  320. package/dist/market_adapter/inputs/kibana_source.js.map +0 -1
  321. package/dist/market_adapter/inputs/window_cache.d.ts.map +0 -1
  322. package/dist/market_adapter/inputs/window_cache.js.map +0 -1
  323. package/dist/market_adapter/interval_utils.d.ts.map +0 -1
  324. package/dist/market_adapter/interval_utils.js.map +0 -1
  325. package/dist/market_adapter/log_format.d.ts.map +0 -1
  326. package/dist/market_adapter/log_format.js.map +0 -1
  327. package/dist/market_adapter/lp_chart_core.d.ts.map +0 -1
  328. package/dist/market_adapter/lp_chart_core.js.map +0 -1
  329. package/dist/market_adapter/lp_chart_runner.d.ts.map +0 -1
  330. package/dist/market_adapter/lp_chart_runner.js.map +0 -1
  331. package/dist/market_adapter/lp_chart_strategy_loader.d.ts.map +0 -1
  332. package/dist/market_adapter/lp_chart_strategy_loader.js.map +0 -1
  333. package/dist/market_adapter/market_adapter.d.ts.map +0 -1
  334. package/dist/market_adapter/market_adapter.js.map +0 -1
  335. package/dist/market_adapter/test_helpers.d.ts.map +0 -1
  336. package/dist/market_adapter/test_helpers.js.map +0 -1
  337. package/dist/market_adapter/utils/adapter_client.d.ts.map +0 -1
  338. package/dist/market_adapter/utils/adapter_client.js.map +0 -1
  339. package/dist/market_adapter/utils/atomic_write.d.ts.map +0 -1
  340. package/dist/market_adapter/utils/atomic_write.js.map +0 -1
  341. package/dist/market_adapter/utils/chain.d.ts.map +0 -1
  342. package/dist/market_adapter/utils/chain.js.map +0 -1
  343. package/dist/market_adapter/utils/data_discovery.d.ts.map +0 -1
  344. package/dist/market_adapter/utils/data_discovery.js.map +0 -1
  345. package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +0 -1
  346. package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +0 -1
  347. package/dist/market_adapter/utils/file_lock.d.ts.map +0 -1
  348. package/dist/market_adapter/utils/file_lock.js.map +0 -1
  349. package/dist/market_adapter/utils/native_history.d.ts.map +0 -1
  350. package/dist/market_adapter/utils/native_history.js.map +0 -1
  351. package/dist/modules/account_bots.d.ts.map +0 -1
  352. package/dist/modules/account_bots.js.map +0 -1
  353. package/dist/modules/account_orders.d.ts.map +0 -1
  354. package/dist/modules/account_orders.js.map +0 -1
  355. package/dist/modules/authority_resolver.d.ts.map +0 -1
  356. package/dist/modules/authority_resolver.js.map +0 -1
  357. package/dist/modules/bitshares-native/chain_client.d.ts.map +0 -1
  358. package/dist/modules/bitshares-native/chain_client.js.map +0 -1
  359. package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts.map +0 -1
  360. package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +0 -1
  361. package/dist/modules/bitshares-native/crypto/ecc.d.ts.map +0 -1
  362. package/dist/modules/bitshares-native/crypto/ecc.js.map +0 -1
  363. package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts.map +0 -1
  364. package/dist/modules/bitshares-native/crypto/ecc_selector.js.map +0 -1
  365. package/dist/modules/bitshares-native/index.d.ts.map +0 -1
  366. package/dist/modules/bitshares-native/index.js.map +0 -1
  367. package/dist/modules/bitshares-native/lru_cache.d.ts.map +0 -1
  368. package/dist/modules/bitshares-native/lru_cache.js.map +0 -1
  369. package/dist/modules/bitshares-native/resolvers.d.ts.map +0 -1
  370. package/dist/modules/bitshares-native/resolvers.js.map +0 -1
  371. package/dist/modules/bitshares-native/serial/chain_constants.d.ts.map +0 -1
  372. package/dist/modules/bitshares-native/serial/chain_constants.js.map +0 -1
  373. package/dist/modules/bitshares-native/serial/index.d.ts.map +0 -1
  374. package/dist/modules/bitshares-native/serial/index.js.map +0 -1
  375. package/dist/modules/bitshares-native/serial/operations.d.ts.map +0 -1
  376. package/dist/modules/bitshares-native/serial/operations.js.map +0 -1
  377. package/dist/modules/bitshares-native/serial/serializer.d.ts.map +0 -1
  378. package/dist/modules/bitshares-native/serial/serializer.js.map +0 -1
  379. package/dist/modules/bitshares-native/serial/types.d.ts.map +0 -1
  380. package/dist/modules/bitshares-native/serial/types.js.map +0 -1
  381. package/dist/modules/bitshares-native/signing_client.d.ts.map +0 -1
  382. package/dist/modules/bitshares-native/signing_client.js.map +0 -1
  383. package/dist/modules/bitshares-native/subscriptions.d.ts.map +0 -1
  384. package/dist/modules/bitshares-native/subscriptions.js.map +0 -1
  385. package/dist/modules/bitshares-native/transport.d.ts.map +0 -1
  386. package/dist/modules/bitshares-native/transport.js.map +0 -1
  387. package/dist/modules/bitshares-native/tx/builder.d.ts.map +0 -1
  388. package/dist/modules/bitshares-native/tx/builder.js.map +0 -1
  389. package/dist/modules/bitshares-native/tx/tx_cache.d.ts.map +0 -1
  390. package/dist/modules/bitshares-native/tx/tx_cache.js.map +0 -1
  391. package/dist/modules/bitshares_client.d.ts.map +0 -1
  392. package/dist/modules/bitshares_client.js.map +0 -1
  393. package/dist/modules/bot_defaults.d.ts.map +0 -1
  394. package/dist/modules/bot_defaults.js.map +0 -1
  395. package/dist/modules/bot_settings.d.ts.map +0 -1
  396. package/dist/modules/bot_settings.js.map +0 -1
  397. package/dist/modules/bots_file_lock.d.ts.map +0 -1
  398. package/dist/modules/bots_file_lock.js.map +0 -1
  399. package/dist/modules/broadcast_failure.d.ts.map +0 -1
  400. package/dist/modules/broadcast_failure.js.map +0 -1
  401. package/dist/modules/chain_keys.d.ts.map +0 -1
  402. package/dist/modules/chain_keys.js.map +0 -1
  403. package/dist/modules/chain_orders.d.ts.map +0 -1
  404. package/dist/modules/chain_orders.js.map +0 -1
  405. package/dist/modules/cli_colors.d.ts.map +0 -1
  406. package/dist/modules/cli_colors.js.map +0 -1
  407. package/dist/modules/config.d.ts.map +0 -1
  408. package/dist/modules/config.js.map +0 -1
  409. package/dist/modules/constants.d.ts.map +0 -1
  410. package/dist/modules/constants.js.map +0 -1
  411. package/dist/modules/cr_planner.d.ts.map +0 -1
  412. package/dist/modules/cr_planner.js.map +0 -1
  413. package/dist/modules/credential_policy.d.ts.map +0 -1
  414. package/dist/modules/credential_policy.js.map +0 -1
  415. package/dist/modules/credential_runtime.d.ts.map +0 -1
  416. package/dist/modules/credential_runtime.js.map +0 -1
  417. package/dist/modules/credential_session_cache.d.ts.map +0 -1
  418. package/dist/modules/credential_session_cache.js.map +0 -1
  419. package/dist/modules/credit_pricing.d.ts.map +0 -1
  420. package/dist/modules/credit_pricing.js.map +0 -1
  421. package/dist/modules/credit_runtime.d.ts.map +0 -1
  422. package/dist/modules/credit_runtime.js.map +0 -1
  423. package/dist/modules/crypto/browser_provider.d.ts.map +0 -1
  424. package/dist/modules/crypto/browser_provider.js.map +0 -1
  425. package/dist/modules/crypto/index.d.ts.map +0 -1
  426. package/dist/modules/crypto/index.js.map +0 -1
  427. package/dist/modules/crypto/node_provider.d.ts.map +0 -1
  428. package/dist/modules/crypto/node_provider.js.map +0 -1
  429. package/dist/modules/crypto/provider.d.ts.map +0 -1
  430. package/dist/modules/crypto/provider.js.map +0 -1
  431. package/dist/modules/crypto/pure_ripemd160.d.ts.map +0 -1
  432. package/dist/modules/crypto/pure_ripemd160.js.map +0 -1
  433. package/dist/modules/crypto/pure_scrypt.d.ts.map +0 -1
  434. package/dist/modules/crypto/pure_scrypt.js.map +0 -1
  435. package/dist/modules/crypto/pure_secp256k1.d.ts.map +0 -1
  436. package/dist/modules/crypto/pure_secp256k1.js.map +0 -1
  437. package/dist/modules/crypto/sync.d.ts.map +0 -1
  438. package/dist/modules/crypto/sync.js.map +0 -1
  439. package/dist/modules/daemon_node_health.d.ts.map +0 -1
  440. package/dist/modules/daemon_node_health.js.map +0 -1
  441. package/dist/modules/dexbot_class.d.ts.map +0 -1
  442. package/dist/modules/dexbot_class.js.map +0 -1
  443. package/dist/modules/dexbot_cow_runtime.d.ts.map +0 -1
  444. package/dist/modules/dexbot_cow_runtime.js.map +0 -1
  445. package/dist/modules/dexbot_credential_client.d.ts.map +0 -1
  446. package/dist/modules/dexbot_credential_client.js.map +0 -1
  447. package/dist/modules/dexbot_fill_runtime.d.ts.map +0 -1
  448. package/dist/modules/dexbot_fill_runtime.js.map +0 -1
  449. package/dist/modules/dexbot_maintenance_runtime.d.ts.map +0 -1
  450. package/dist/modules/dexbot_maintenance_runtime.js.map +0 -1
  451. package/dist/modules/dexbot_startup_runtime.d.ts.map +0 -1
  452. package/dist/modules/dexbot_startup_runtime.js.map +0 -1
  453. package/dist/modules/dexbot_state_recovery.d.ts.map +0 -1
  454. package/dist/modules/dexbot_state_recovery.js.map +0 -1
  455. package/dist/modules/env.d.ts.map +0 -1
  456. package/dist/modules/env.js.map +0 -1
  457. package/dist/modules/fund_registry.d.ts.map +0 -1
  458. package/dist/modules/fund_registry.js.map +0 -1
  459. package/dist/modules/general_settings.d.ts.map +0 -1
  460. package/dist/modules/general_settings.js.map +0 -1
  461. package/dist/modules/graceful_shutdown.d.ts.map +0 -1
  462. package/dist/modules/graceful_shutdown.js.map +0 -1
  463. package/dist/modules/grid_price_source.d.ts.map +0 -1
  464. package/dist/modules/grid_price_source.js.map +0 -1
  465. package/dist/modules/key_store.d.ts.map +0 -1
  466. package/dist/modules/key_store.js.map +0 -1
  467. package/dist/modules/launcher/adapter_requirement.d.ts.map +0 -1
  468. package/dist/modules/launcher/adapter_requirement.js.map +0 -1
  469. package/dist/modules/launcher/bot_supervisor.d.ts.map +0 -1
  470. package/dist/modules/launcher/bot_supervisor.js.map +0 -1
  471. package/dist/modules/launcher/child_env.d.ts.map +0 -1
  472. package/dist/modules/launcher/child_env.js.map +0 -1
  473. package/dist/modules/launcher/credential_bootstrap.d.ts.map +0 -1
  474. package/dist/modules/launcher/credential_bootstrap.js.map +0 -1
  475. package/dist/modules/launcher/credential_daemon.d.ts.map +0 -1
  476. package/dist/modules/launcher/credential_daemon.js.map +0 -1
  477. package/dist/modules/launcher/credential_secret.d.ts.map +0 -1
  478. package/dist/modules/launcher/credential_secret.js.map +0 -1
  479. package/dist/modules/launcher/foreign_cred_daemon.d.ts.map +0 -1
  480. package/dist/modules/launcher/foreign_cred_daemon.js.map +0 -1
  481. package/dist/modules/launcher/headless_password.d.ts.map +0 -1
  482. package/dist/modules/launcher/headless_password.js.map +0 -1
  483. package/dist/modules/launcher/launch_modes.d.ts.map +0 -1
  484. package/dist/modules/launcher/launch_modes.js.map +0 -1
  485. package/dist/modules/launcher/market_adapter_runtime.d.ts.map +0 -1
  486. package/dist/modules/launcher/market_adapter_runtime.js.map +0 -1
  487. package/dist/modules/launcher/market_adapter_watchdog.d.ts.map +0 -1
  488. package/dist/modules/launcher/market_adapter_watchdog.js.map +0 -1
  489. package/dist/modules/launcher/monolithic_runtime.d.ts.map +0 -1
  490. package/dist/modules/launcher/monolithic_runtime.js.map +0 -1
  491. package/dist/modules/launcher/runtime_entry.d.ts.map +0 -1
  492. package/dist/modules/launcher/runtime_entry.js.map +0 -1
  493. package/dist/modules/launcher/status_reporting.d.ts.map +0 -1
  494. package/dist/modules/launcher/status_reporting.js.map +0 -1
  495. package/dist/modules/launcher/supervisor_control.d.ts.map +0 -1
  496. package/dist/modules/launcher/supervisor_control.js.map +0 -1
  497. package/dist/modules/market_adapter_whitelist.d.ts.map +0 -1
  498. package/dist/modules/market_adapter_whitelist.js.map +0 -1
  499. package/dist/modules/node_connect_policy.d.ts.map +0 -1
  500. package/dist/modules/node_connect_policy.js.map +0 -1
  501. package/dist/modules/node_failure_ledger.d.ts.map +0 -1
  502. package/dist/modules/node_failure_ledger.js.map +0 -1
  503. package/dist/modules/node_health_cache.d.ts.map +0 -1
  504. package/dist/modules/node_health_cache.js.map +0 -1
  505. package/dist/modules/node_manager.d.ts.map +0 -1
  506. package/dist/modules/node_manager.js.map +0 -1
  507. package/dist/modules/order/accounting.d.ts.map +0 -1
  508. package/dist/modules/order/accounting.js.map +0 -1
  509. package/dist/modules/order/async_lock.d.ts.map +0 -1
  510. package/dist/modules/order/async_lock.js.map +0 -1
  511. package/dist/modules/order/export.d.ts.map +0 -1
  512. package/dist/modules/order/export.js.map +0 -1
  513. package/dist/modules/order/format.d.ts.map +0 -1
  514. package/dist/modules/order/format.js.map +0 -1
  515. package/dist/modules/order/grid.d.ts.map +0 -1
  516. package/dist/modules/order/grid.js.map +0 -1
  517. package/dist/modules/order/grid_reconcile.d.ts.map +0 -1
  518. package/dist/modules/order/grid_reconcile.js.map +0 -1
  519. package/dist/modules/order/grid_reconcile_internal.d.ts.map +0 -1
  520. package/dist/modules/order/grid_reconcile_internal.js.map +0 -1
  521. package/dist/modules/order/index.d.ts.map +0 -1
  522. package/dist/modules/order/index.js.map +0 -1
  523. package/dist/modules/order/logger.d.ts.map +0 -1
  524. package/dist/modules/order/logger.js.map +0 -1
  525. package/dist/modules/order/logger_state.d.ts.map +0 -1
  526. package/dist/modules/order/logger_state.js.map +0 -1
  527. package/dist/modules/order/manager.d.ts.map +0 -1
  528. package/dist/modules/order/manager.js.map +0 -1
  529. package/dist/modules/order/processed_fill_store.d.ts.map +0 -1
  530. package/dist/modules/order/processed_fill_store.js.map +0 -1
  531. package/dist/modules/order/strategy.d.ts.map +0 -1
  532. package/dist/modules/order/strategy.js.map +0 -1
  533. package/dist/modules/order/sync_engine.d.ts.map +0 -1
  534. package/dist/modules/order/sync_engine.js.map +0 -1
  535. package/dist/modules/order/utils/math.d.ts.map +0 -1
  536. package/dist/modules/order/utils/math.js.map +0 -1
  537. package/dist/modules/order/utils/order.d.ts.map +0 -1
  538. package/dist/modules/order/utils/order.js.map +0 -1
  539. package/dist/modules/order/utils/slot.d.ts.map +0 -1
  540. package/dist/modules/order/utils/slot.js.map +0 -1
  541. package/dist/modules/order/utils/system.d.ts.map +0 -1
  542. package/dist/modules/order/utils/system.js.map +0 -1
  543. package/dist/modules/order/utils/timeout.d.ts.map +0 -1
  544. package/dist/modules/order/utils/timeout.js.map +0 -1
  545. package/dist/modules/order/utils/validate.d.ts.map +0 -1
  546. package/dist/modules/order/utils/validate.js.map +0 -1
  547. package/dist/modules/order/utils/withPoolRef.d.ts.map +0 -1
  548. package/dist/modules/order/utils/withPoolRef.js.map +0 -1
  549. package/dist/modules/order/working_grid.d.ts.map +0 -1
  550. package/dist/modules/order/working_grid.js.map +0 -1
  551. package/dist/modules/path_api.d.ts.map +0 -1
  552. package/dist/modules/path_api.js.map +0 -1
  553. package/dist/modules/paths.d.ts.map +0 -1
  554. package/dist/modules/paths.js.map +0 -1
  555. package/dist/modules/process_discovery.d.ts.map +0 -1
  556. package/dist/modules/process_discovery.js.map +0 -1
  557. package/dist/modules/runtime.d.ts.map +0 -1
  558. package/dist/modules/runtime.js.map +0 -1
  559. package/dist/modules/runtime_settings.d.ts.map +0 -1
  560. package/dist/modules/runtime_settings.js.map +0 -1
  561. package/dist/modules/settings_merge.d.ts.map +0 -1
  562. package/dist/modules/settings_merge.js.map +0 -1
  563. package/dist/modules/socket_json_client.d.ts.map +0 -1
  564. package/dist/modules/socket_json_client.js.map +0 -1
  565. package/dist/modules/storage/browser_adapter.d.ts.map +0 -1
  566. package/dist/modules/storage/browser_adapter.js.map +0 -1
  567. package/dist/modules/storage/index.d.ts.map +0 -1
  568. package/dist/modules/storage/index.js.map +0 -1
  569. package/dist/modules/storage/node_adapter.d.ts.map +0 -1
  570. package/dist/modules/storage/node_adapter.js.map +0 -1
  571. package/dist/modules/storage/types.d.ts.map +0 -1
  572. package/dist/modules/storage/types.js.map +0 -1
  573. package/dist/modules/types.d.ts.map +0 -1
  574. package/dist/modules/types.js.map +0 -1
  575. package/dist/modules/utils/base58check.d.ts.map +0 -1
  576. package/dist/modules/utils/base58check.js.map +0 -1
  577. package/dist/modules/utils/build_dir.d.ts.map +0 -1
  578. package/dist/modules/utils/build_dir.js.map +0 -1
  579. package/dist/modules/utils/chain_logs.d.ts.map +0 -1
  580. package/dist/modules/utils/chain_logs.js.map +0 -1
  581. package/dist/modules/utils/errors.d.ts.map +0 -1
  582. package/dist/modules/utils/errors.js.map +0 -1
  583. package/dist/modules/utils/sanitize_key.d.ts.map +0 -1
  584. package/dist/modules/utils/sanitize_key.js.map +0 -1
  585. package/dist/modules/validate_profiles.d.ts.map +0 -1
  586. package/dist/modules/validate_profiles.js.map +0 -1
  587. package/dist/pm2.d.ts.map +0 -1
  588. package/dist/pm2.js.map +0 -1
  589. package/dist/scripts/analyze-credit.d.ts.map +0 -1
  590. package/dist/scripts/analyze-credit.js.map +0 -1
  591. package/dist/scripts/analyze-git.d.ts.map +0 -1
  592. package/dist/scripts/analyze-git.js.map +0 -1
  593. package/dist/scripts/analyze-orders.d.ts.map +0 -1
  594. package/dist/scripts/analyze-orders.js.map +0 -1
  595. package/dist/scripts/chart_command.d.ts.map +0 -1
  596. package/dist/scripts/chart_command.js.map +0 -1
  597. package/dist/scripts/diagnose-kibana-candles.d.ts.map +0 -1
  598. package/dist/scripts/diagnose-kibana-candles.js.map +0 -1
  599. package/dist/scripts/diagnose-pool-history.d.ts.map +0 -1
  600. package/dist/scripts/diagnose-pool-history.js.map +0 -1
  601. package/dist/scripts/divergence-calc.d.ts.map +0 -1
  602. package/dist/scripts/divergence-calc.js.map +0 -1
  603. package/dist/scripts/dw.d.ts.map +0 -1
  604. package/dist/scripts/dw.js.map +0 -1
  605. package/dist/scripts/generate_lp_chart.d.ts.map +0 -1
  606. package/dist/scripts/generate_lp_chart.js.map +0 -1
  607. package/dist/scripts/generate_mainnet_corpus_report.d.ts.map +0 -1
  608. package/dist/scripts/generate_mainnet_corpus_report.js.map +0 -1
  609. package/dist/scripts/native_release_gates.d.ts.map +0 -1
  610. package/dist/scripts/native_release_gates.js.map +0 -1
  611. package/dist/scripts/print_grid.d.ts.map +0 -1
  612. package/dist/scripts/print_grid.js.map +0 -1
  613. package/dist/scripts/run-tests.d.ts.map +0 -1
  614. package/dist/scripts/run-tests.js.map +0 -1
  615. package/dist/scripts/runner.d.ts.map +0 -1
  616. package/dist/scripts/runner.js.map +0 -1
  617. package/dist/scripts/sync-version.d.ts.map +0 -1
  618. package/dist/scripts/sync-version.js.map +0 -1
  619. package/dist/scripts/test-credit-renewal.d.ts.map +0 -1
  620. package/dist/scripts/test-credit-renewal.js.map +0 -1
  621. package/dist/scripts/tv.d.ts.map +0 -1
  622. package/dist/scripts/tv.js.map +0 -1
  623. package/dist/scripts/update.d.ts.map +0 -1
  624. package/dist/scripts/update.js.map +0 -1
  625. package/dist/scripts/update_dist_freshness.d.ts.map +0 -1
  626. package/dist/scripts/update_dist_freshness.js.map +0 -1
  627. package/dist/scripts/validate_bots.d.ts.map +0 -1
  628. package/dist/scripts/validate_bots.js.map +0 -1
  629. package/dist/scripts/verify-browser-bundle.d.ts.map +0 -1
  630. package/dist/scripts/verify-browser-bundle.js.map +0 -1
  631. package/dist/unlock.d.ts.map +0 -1
  632. package/dist/unlock.js.map +0 -1
@@ -212,6 +212,8 @@ declare let TIMING: {
212
212
  CHECK_INTERVAL_MS: number;
213
213
  DUST_HEALTH_CHECK_INTERVAL_MS: number;
214
214
  DUST_CANCEL_TIMEOUT_MS: number;
215
+ BROADCAST_STALE_CLEAR_MS: number;
216
+ BROADCAST_DEFER_SAFETY_MARGIN_MS: number;
215
217
  FILL_BROADCAST_DEFER_MAX_MS: number;
216
218
  FILL_TOTALS_RETRY_BASE_MS: number;
217
219
  FILL_TOTALS_RETRY_MAX_MS: number;
@@ -241,6 +243,7 @@ declare let TIMING: {
241
243
  TARGETED_DRIFT_SYNC_COOLDOWN_MS: number;
242
244
  LIGHTWEIGHT_SYNC_CHECK_INTERVAL_MS: number;
243
245
  SYNC_LOCK_FORCE_RELEASE_AGE_MS: number;
246
+ GRID_LOCK_HOLD_WARN_MS: number;
244
247
  GRID_BLOAT_RESYNC_GRACE_MS: number;
245
248
  MAX_ACCOUNT_TOTALS_AGE_MS: number;
246
249
  STALE_TOTALS_WARN_RATE_LIMIT_MS: number;
@@ -254,11 +257,12 @@ declare let TIMING: {
254
257
  CREDIT_RATE_MAX_AGE_MS: number;
255
258
  };
256
259
  declare let GRID_LIMITS: {
260
+ MISSING_GENESIS_POLICY: string;
261
+ MISSING_GENESIS_MISMATCH_RATIO: number;
257
262
  MIN_SPREAD_FACTOR: number;
258
263
  MIN_ORDER_SIZE_FACTOR: number;
259
264
  PRICE_TOLERANCE_MAX_PERCENT: number;
260
265
  PRICE_TOLERANCE_MIN_ABSOLUTE: number;
261
- ORPHAN_ADOPTION_TOLERANCE_MULTIPLIER: number;
262
266
  GRID_REGENERATION_PERCENTAGE: number;
263
267
  PARTIAL_DUST_THRESHOLD_PERCENTAGE: number;
264
268
  FUND_INVARIANT_PERCENT_TOLERANCE: number;
@@ -269,11 +273,11 @@ declare let GRID_LIMITS: {
269
273
  MIN_SPREAD_ORDERS: number;
270
274
  GAP_EVACUATION_STREAK_THRESHOLD: number;
271
275
  GAP_EVACUATION_CANCEL_THRESHOLD: number;
276
+ LAST_FILL_PIVOT_TTL_MS: number;
272
277
  GRID_COMPARISON: {
273
278
  RMS_PERCENTAGE: number;
274
279
  };
275
280
  RELATIVE_ORDER_UPDATE_THRESHOLD_PERCENT: number;
276
- PRICE_DRIFT_TOLERANCE_MULTIPLIER: number;
277
281
  };
278
282
  declare let INCREMENT_BOUNDS: {
279
283
  MIN_PERCENT: number;
@@ -325,6 +329,10 @@ declare let FILL_PROCESSING: {
325
329
  MAX_CONSECUTIVE_CONSUMER_FAILURES: number;
326
330
  CONSUMER_BACKOFF_INITIAL_MS: number;
327
331
  CONSUMER_BACKOFF_MAX_MS: number;
332
+ CORRECTION_LOCK_HOLD_BUDGET_MS: number;
333
+ CORRECTION_MAX_UPDATES_PER_CYCLE: null;
334
+ CORRECTION_QUEUE_WARN_THRESHOLD: number;
335
+ CORRECTION_QUEUE_WARN_RATE_LIMIT_MS: number;
328
336
  };
329
337
  declare let MAINTENANCE: {
330
338
  CLEANUP_PROBABILITY: number;
@@ -564,6 +572,11 @@ declare let UPDATER: {
564
572
  REPOSITORY_URL: string;
565
573
  BRANCH: string;
566
574
  SCHEDULE: string;
575
+ NOTICE_ENABLED: boolean;
576
+ NOTICE_INTERVAL_MS: number;
577
+ NOTICE_TIMEOUT_MS: number;
578
+ NOTICE_STATUS_TIMEOUT_MS: number;
579
+ REGISTRY_URL: string;
567
580
  };
568
581
  declare let LAUNCHER: {
569
582
  MONOLITHIC: {
@@ -652,6 +665,9 @@ declare let NATIVE_CLIENT: {
652
665
  RPC_TIMEOUT_MS: number;
653
666
  KEEPALIVE_INTERVAL_MS: number;
654
667
  CLOSE_COALESCE_MS: number;
668
+ STALE_API_FORCE_RECONNECT_AFTER: number;
669
+ STALE_API_WINDOW_MS: number;
670
+ FORCED_RECONNECT_COOLDOWN_MS: number;
655
671
  BENIGN_CLOSE_CODES: number[];
656
672
  RECONNECT_BASE_MS: number;
657
673
  RECONNECT_MAX_MS: number;
@@ -668,6 +684,11 @@ declare let NATIVE_CLIENT: {
668
684
  MAX_INCOMING_FILL_QUEUE: number;
669
685
  NOTICE_COALESCE_MS: number;
670
686
  FILL_POLL_INTERVAL_MS: number;
687
+ CHANNEL_DEGRADED_FAILURE_THRESHOLD: number;
688
+ CHANNEL_ERROR_LOG_INTERVAL_MS: number;
689
+ CHANNEL_RETRY_LADDER_MS: number[];
690
+ CHANNEL_RETRY_MAX_REFILLS: number;
691
+ CHANNEL_RECOVERY_ALERT_AFTER: number;
671
692
  };
672
693
  ORDER_EVENTS: {
673
694
  RECENT_OWN_CANCEL_TTL_MS: number;
@@ -190,12 +190,12 @@ let DEFAULT_CONFIG = {
190
190
  };
191
191
  // Range quality zones for price bounds (minPrice/maxPrice multipliers).
192
192
  // Used for pre-entry legend in the bot editor (mountain-style).
193
- // Thresholds per user spec: green >=2x, yellow >=1.55x, orange 1.45x–1.55x, red <1.45x.
193
+ // Thresholds per user spec: green >=2x, yellow >=1.55x, orange 1.4x–1.55x, red <1.4x.
194
194
  let RANGE_QUALITY = {
195
195
  GREEN_MIN: 2.0, // >=2.0x → green (wide)
196
196
  YELLOW_MIN: 1.55, // >=1.55x → yellow (effeciant)
197
- ORANGE_MIN: 1.45, // >=1.45x → orange (tight)
198
- RED_MAX: 1.45, // <1.45x → red (suizidal) — exclusive upper bound for red
197
+ ORANGE_MIN: 1.4, // >=1.4x → orange (tight)
198
+ RED_MAX: 1.4, // <1.4x → red (suizidal) — exclusive upper bound for red
199
199
  };
200
200
  // Timing constants used by OrderManager and helpers
201
201
  let TIMING = {
@@ -261,13 +261,31 @@ let TIMING = {
261
261
  // the timer (5 min / 5 s = 60 slots per interval), but long enough to
262
262
  // survive moderate fill-processing bursts.
263
263
  DUST_CANCEL_TIMEOUT_MS: 5 * 1000, // 5 seconds
264
+ // BROADCAST_STALE_CLEAR_MS: a leaked/hung broadcast flag is hard-cleared
265
+ // after this long so it cannot permanently block rebalancing
266
+ // (see manager._clearStaleBroadcastFlag). This is the SINGLE authority on
267
+ // "when is a broadcast region stale": both the maintenance-tick deferral
268
+ // (shouldDeferMaintenanceForBroadcast) and the fill-consumer deferral
269
+ // bound (FILL_BROADCAST_DEFER_MAX_MS, derived below) are expressed in
270
+ // terms of it, so they cannot be tuned out of agreement.
271
+ BROADCAST_STALE_CLEAR_MS: 120000, // 120 seconds
272
+ // BROADCAST_DEFER_SAFETY_MARGIN_MS: headroom added to
273
+ // BROADCAST_STALE_CLEAR_MS when deriving FILL_BROADCAST_DEFER_MAX_MS, so a
274
+ // region that is still considered live by the stale-clear watchdog cannot
275
+ // first trip the fill-consumer deferral bound (which would drop the
276
+ // consumer into the in-lock wait the deferral exists to avoid).
277
+ BROADCAST_DEFER_SAFETY_MARGIN_MS: 30000, // 30 seconds
264
278
  // FILL_BROADCAST_DEFER_MAX_MS: Bound on fill-consumer deferral while a
265
279
  // broadcast region is active. The consumer defers (instead of acquiring
266
280
  // the fill lock and sleeping up to 30s inside it) so concurrent consumers
267
281
  // never queue as lock waiters and time out. Past this bound a stuck flag
268
282
  // falls through to the legacy in-lock wait, which still caps at 30s and
269
283
  // proceeds — a leaked flag can delay fills, never starve them.
270
- FILL_BROADCAST_DEFER_MAX_MS: 60 * 1000, // 60 seconds
284
+ // Derived after override merge from BROADCAST_STALE_CLEAR_MS +
285
+ // BROADCAST_DEFER_SAFETY_MARGIN_MS (see end of this module), so the
286
+ // ordering invariant holds by construction. The value below is only a
287
+ // floor for that derivation.
288
+ FILL_BROADCAST_DEFER_MAX_MS: 120000, // 120 seconds (raised after merge to stale-clear + margin)
271
289
  // FILL_TOTALS_RETRY_BASE_MS / MAX_MS: Backoff for re-processing fills
272
290
  // parked when the accountTotals refresh failed (stale snapshot). The
273
291
  // deferred fills are held OUTSIDE the live queue and re-queued on a
@@ -423,6 +441,13 @@ let TIMING = {
423
441
  // is detached from it.
424
442
  // Derived as SYNC_LOCK_TIMEOUT_MS * 2 after override merge (see end of this module).
425
443
  SYNC_LOCK_FORCE_RELEASE_AGE_MS: 40000, // overridden by derivation after merge
444
+ // GRID_LOCK_HOLD_WARN_MS: observability threshold for _gridLock hold
445
+ // duration. That lock has no acquisition timeout and its callers cannot
446
+ // safely recover from a rejected acquire, so an over-long critical
447
+ // section is surfaced (warn + metric) by the maintenance tick rather than
448
+ // timed out or force-released. A hold crossing this threshold means a
449
+ // section is running unbounded and should be bounded at the source.
450
+ GRID_LOCK_HOLD_WARN_MS: 15000,
426
451
  // GRID_BLOAT_RESYNC_GRACE_MS: Grace period before the maintenance runtime
427
452
  // re-triggers a structural resync for a previously detected grid bloat.
428
453
  // Prevents immediate re-triggering when Grid.loadGrid already scheduled one
@@ -482,6 +507,36 @@ let TIMING = {
482
507
  };
483
508
  // Grid limits and scaling constants
484
509
  let GRID_LIMITS = {
510
+ // MISSING_GENESIS_POLICY: what to do when a persisted grid cannot be tied
511
+ // to a price ladder ("no genesis" -- the genesis-less state analysed in
512
+ // docs/GRID_PRICE_INVARIANT.md). A genesis-less grid is NOT repairable in
513
+ // place: every consumer (nearest-slot adoption, the materialize
514
+ // descriptor-price fallback, reserve-edge anchoring) has no authority for a
515
+ // slot's price, which is exactly how an off-grid price became grid evidence
516
+ // and was re-emitted. The load and sync gates refuse that state outright —
517
+ // no tolerance matcher remains.
518
+ // 'rebuild' (default) -- refuse the snapshot and rebuild a clean ladder
519
+ // through the existing resync machinery
520
+ // (initializeGrid/recalculateGrid, which re-derive
521
+ // prices and reconcile update-first, so only true
522
+ // surplus is cancelled). Deterministic, but the
523
+ // live orders are re-slotted -- the same net effect
524
+ // as a manual `dexbot reset`.
525
+ // 'halt' -- refuse to start and require the operator to run a
526
+ // manual grid reset. Strongest fund safety (nothing
527
+ // is cancelled without consent); the bot stays down
528
+ // until a human acts, so it is opt-in, not default.
529
+ // Read as `config.gridLimits.MISSING_GENESIS_POLICY` (see
530
+ // modules/order/genesis_policy.ts); any other value falls back to 'rebuild'.
531
+ MISSING_GENESIS_POLICY: 'rebuild',
532
+ // MISSING_GENESIS_MISMATCH_RATIO: share of persisted slots that must match
533
+ // the config-derived rail before a migrated (genesis-less) snapshot may
534
+ // adopt that rail as its genesis. Above it, the config was edited since the
535
+ // snapshot, so the config-derived ladder is a DIFFERENT generation:
536
+ // adopting it would mass-virtualize live order tracking in 'enforce' mode
537
+ // (or flood the log in 'log' mode) and persist a genesis the live grid does
538
+ // not match. Treated as a missing genesis instead -- refused, never adopted.
539
+ MISSING_GENESIS_MISMATCH_RATIO: 0.5,
485
540
  // MIN_SPREAD_FACTOR: Ensures spread is at least (incrementPercent × MIN_SPREAD_FACTOR) slots wide.
486
541
  // Rationale: Spread must be sufficiently wide to:
487
542
  // 1. Avoid order collision (orders too close get rejected by blockchain)
@@ -510,11 +565,6 @@ let GRID_LIMITS = {
510
565
  // PRICE_TOLERANCE_MIN_ABSOLUTE: Floor for the price tolerance cap in price units.
511
566
  // Ensures the cap is non-zero even for extremely cheap assets.
512
567
  PRICE_TOLERANCE_MIN_ABSOLUTE: 0.0001,
513
- // ORPHAN_ADOPTION_TOLERANCE_MULTIPLIER: Legacy fallback multiplier for calculatePriceTolerance
514
- // (sync_engine pass-2 before genesis). With genesis-frozen nearest-slot (slotIndexForPrice)
515
- // this multiplier is deprecated — deterministic slotId equality replaces widening. Kept for
516
- // migration fallback when genesis missing; otherwise unused.
517
- ORPHAN_ADOPTION_TOLERANCE_MULTIPLIER: 4,
518
568
  // GRID_REGENERATION_PERCENTAGE: Trigger threshold for automatic grid size recalculation.
519
569
  // Works in BOTH directions (bidirectional), sharing one threshold:
520
570
  // GROW: IF (availableFunds / allocatedCapital) x 100 >= threshold -> regenerate
@@ -597,6 +647,14 @@ let GRID_LIMITS = {
597
647
  // warn threshold one cycle earlier). Cancel settles the slot back to a
598
648
  // spread placeholder — no re-placement, fee-light.
599
649
  GAP_EVACUATION_CANCEL_THRESHOLD: 3,
650
+ // LAST_FILL_PIVOT_TTL_MS: Maximum age of a persisted LAST-FILL-GUARD
651
+ // pivot for it to be re-armed at startup. The pivot is a "latest fill"
652
+ // fact, not a permanent ratchet: after long downtime (dormant bot, stale
653
+ // market regime) a restored pivot would veto legitimate placements
654
+ // indefinitely, so it expires instead. In-memory pivots acquired at
655
+ // runtime are NOT expired — the guard has no clock there and the pivot
656
+ // is refreshed by every fresh fill.
657
+ LAST_FILL_PIVOT_TTL_MS: 24 * 60 * 60 * 1000, // 24 hours
600
658
  // Grid comparison metrics
601
659
  // Detects significant divergence between calculated (in-memory) and persisted grid state
602
660
  // after order fills and rotations
@@ -631,10 +689,6 @@ let GRID_LIMITS = {
631
689
  // Example: 0.1 means two values are considered equal when diff < 0.1% of magnitude.
632
690
  // Note: Final blockchain update filtering still happens with integer precision checks.
633
691
  RELATIVE_ORDER_UPDATE_THRESHOLD_PERCENT: 0.1,
634
- // PRICE_DRIFT_TOLERANCE_MULTIPLIER: Legacy for price-drift-orphan tagging when genesis missing.
635
- // With genesis-frozen nearest-slot, drift is deterministic no-available-nearest-slot (gap/occupied)
636
- // not a tolerance band. Kept for diagnostics fallback only.
637
- PRICE_DRIFT_TOLERANCE_MULTIPLIER: 4,
638
692
  };
639
693
  // Increment percentage bounds for grid configuration
640
694
  let INCREMENT_BOUNDS = {
@@ -800,6 +854,35 @@ let FILL_PROCESSING = {
800
854
  // Reduced from 300s to 60s per tuning review: time-sensitive fills (e.g.,
801
855
  // credential daemon recovery) should not wait 5 minutes between retries.
802
856
  CONSUMER_BACKOFF_MAX_MS: 60000,
857
+ // CORRECTION_LOCK_HOLD_BUDGET_MS: wall-clock budget for the sequential
858
+ // price-update drain in correctAllPriceMismatches. That drain holds
859
+ // _gridLock (no acquisition timeout), so the invariant to protect is
860
+ // *lock-hold duration*, not update count: each update costs SYNC_DELAY_MS
861
+ // plus its RPC round-trip, and that round-trip grows with chain
862
+ // congestion. The drain stops pulling new updates once this much time has
863
+ // elapsed, so a slow chain drains fewer per cycle instead of holding the
864
+ // lock past the 20s fill-lock timeout (the "Lock acquisition timeout"
865
+ // cascade). Cancel-class entries (duplicate orphans / surplus / type
866
+ // mismatch) are ALWAYS fully drained — they are batched with no inter-op
867
+ // delay and are fund-safety-critical — and are never charged against this
868
+ // budget. Only the sequential price-update loop is budgeted; the
869
+ // remainder stays queued durably and re-drains on the next cycle.
870
+ CORRECTION_LOCK_HOLD_BUDGET_MS: 4000,
871
+ // CORRECTION_MAX_UPDATES_PER_CYCLE: optional hard cap on price updates
872
+ // drained per cycle, layered on top of CORRECTION_LOCK_HOLD_BUDGET_MS.
873
+ // Default null = no count cap (the hold-time budget alone governs, so the
874
+ // bound adapts to real RPC latency); a positive integer pins the count;
875
+ // 0 drains no price updates this cycle. Cancel-class entries are never
876
+ // budgeted by either knob.
877
+ CORRECTION_MAX_UPDATES_PER_CYCLE: null,
878
+ // CORRECTION_QUEUE_WARN_THRESHOLD: emit a rate-limited warn when the
879
+ // persisted correction queue reaches this size, so a growing backlog is
880
+ // surfaced instead of silently starving placements.
881
+ CORRECTION_QUEUE_WARN_THRESHOLD: 10,
882
+ // CORRECTION_QUEUE_WARN_RATE_LIMIT_MS: minimum spacing between
883
+ // correction-backlog warns (the drain runs every maintenance tick; the
884
+ // alarm must not spam).
885
+ CORRECTION_QUEUE_WARN_RATE_LIMIT_MS: 5 * 60 * 1000,
803
886
  };
804
887
  // Cleanup and maintenance parameters
805
888
  let MAINTENANCE = {
@@ -1013,7 +1096,7 @@ let MARKET_ADAPTER = {
1013
1096
  // Lower values make the Kalman channel reach maximum influence more easily.
1014
1097
  // Higher values require a stronger move before the Kalman branch reaches full effect.
1015
1098
  // nob: kalS% (Kalman Max Slope %)
1016
- DYNAMIC_WEIGHT_KALMAN_MAX_SLOPE_PCT: 1.0,
1099
+ DYNAMIC_WEIGHT_KALMAN_MAX_SLOPE_PCT: 1.11,
1017
1100
  // DYNAMIC_WEIGHT_AMA_NEUTRAL_ZONE_PCT: Ignore small AMA moves around flat price action.
1018
1101
  // Higher values create a larger neutral zone and reduce small trend reactions.
1019
1102
  // Lower values make the AMA channel react to smaller moves.
@@ -1342,7 +1425,26 @@ let UPDATER = {
1342
1425
  // │ │ │ │ ┌────── day of week (0 - 6) (0 is Sunday)
1343
1426
  // │ │ │ │ │
1344
1427
  // 0 0 * * * (Default: Daily at midnight)
1345
- SCHEDULE: "0 0 * * *"
1428
+ SCHEDULE: "0 0 * * *",
1429
+ // ── Passive version NOTICE (modules/version_notice.ts) ──────────
1430
+ // Deliberately independent of ACTIVE: the notice never changes code, it
1431
+ // only tells the operator a newer release exists. Keeping it on a separate
1432
+ // switch means the default-off auto-updater does not also silence the
1433
+ // "you are running an outdated build" warning.
1434
+ NOTICE_ENABLED: true,
1435
+ // Minimum gap between registry probes (24h). Also throttles failures, so an
1436
+ // offline node pays the network timeout at most once a day, not per start.
1437
+ // Set 0 to probe on every launcher start (an explicit opt-in to always-check).
1438
+ NOTICE_INTERVAL_MS: 86_400_000,
1439
+ // Hard timeout for the registry request. The check never blocks startup,
1440
+ // but a hung socket must not keep the launcher alive either.
1441
+ NOTICE_TIMEOUT_MS: 2_000,
1442
+ // Shorter cap for `dexbot status`, which awaits the probe inline (no
1443
+ // startup work overlaps it), so a stale/offline probe cannot stall the
1444
+ // status output for the full NOTICE_TIMEOUT_MS.
1445
+ NOTICE_STATUS_TIMEOUT_MS: 750,
1446
+ // Registry document queried for the published `latest` version.
1447
+ REGISTRY_URL: "https://registry.npmjs.org/dexbot/latest"
1346
1448
  };
1347
1449
  let LAUNCHER = {
1348
1450
  MONOLITHIC: {
@@ -1563,6 +1665,25 @@ let NATIVE_CLIENT = {
1563
1665
  // Some WebSocket implementations can emit close/error cascades for one
1564
1666
  // underlying connection failure; this window prevents redundant failover work.
1565
1667
  CLOSE_COALESCE_MS: 250,
1668
+ // Escalation for a login session that keeps rejecting cached api ids
1669
+ // (`_local_apis.size() > api_id`) even after the in-place recovery
1670
+ // re-registers them. The retry-once path in callWithApiRecovery handles
1671
+ // the normal reconnect case; a node/session that keeps replying stale is
1672
+ // wedged, and only a fresh socket (preferably on another node) clears it.
1673
+ // After STALE_API_FORCE_RECONNECT_AFTER stale errors within
1674
+ // STALE_API_WINDOW_MS the client forces a reconnect that reports the
1675
+ // active node as failed so the transport deprioritizes it.
1676
+ STALE_API_FORCE_RECONNECT_AFTER: 3,
1677
+ STALE_API_WINDOW_MS: 60000,
1678
+ // Debounce for forced reconnects (transport.forceReconnect), enforced
1679
+ // once per chain client so every escalation source shares it: the
1680
+ // stale api_id window above and the subscriptions fill-channel watchdog.
1681
+ // A wedged session trips both counters in the same tick, so without a
1682
+ // shared window they would stack two reconnects on top of each other.
1683
+ // Once recovery is failing repeatedly this is the floor on how often the
1684
+ // transport is allowed to be torn down; the transport's own exponential
1685
+ // backoff still applies on top of it.
1686
+ FORCED_RECONNECT_COOLDOWN_MS: 30000,
1566
1687
  // WebSocket close codes treated as benign — they do NOT count as a
1567
1688
  // node failure. 1000 = normal closure, 1001 = going away (server
1568
1689
  // shutdown/deploy). Any other code, or wasClean === false, is abnormal.
@@ -1641,6 +1762,48 @@ let NATIVE_CLIENT = {
1641
1762
  // if the server-side subscription silently stops delivering notices.
1642
1763
  // Default: 60 seconds.
1643
1764
  FILL_POLL_INTERVAL_MS: 60000,
1765
+ // CHANNEL_DEGRADED_FAILURE_THRESHOLD: Consecutive processObjects
1766
+ // failures for one account before the fill channel is considered
1767
+ // degraded. The 2026-09-25 incident had every history call rejected
1768
+ // for hours (stale api id) while the process stayed "connected", so
1769
+ // the bot silently missed fills until a manual restart. Crossing this
1770
+ // threshold forces a reconnect (which re-establishes the session and
1771
+ // fires the post-reconnect safety-net sync).
1772
+ CHANNEL_DEGRADED_FAILURE_THRESHOLD: 3,
1773
+ // Minimum gap (ms) between fill-channel error logs for the same account.
1774
+ // Without this, a dead channel logs one warn per poll per account and
1775
+ // floods the error log (95k lines in ~3h during the incident).
1776
+ CHANNEL_ERROR_LOG_INTERVAL_MS: 60000,
1777
+ // CHANNEL_RETRY_LADDER_MS: escalating re-scan delays (ms) used after a
1778
+ // channel failure, instead of waiting for the next 60s fill-poll tick.
1779
+ // One failed scan proves nothing, but a channel still failing seconds
1780
+ // later is wedged — and waiting out the poll cadence costs 3 ticks
1781
+ // (3 min of blind fills) per escalation. The ladder verifies a recovery
1782
+ // attempt quickly, then hands back to the regular poll so a permanently
1783
+ // dead channel cannot become a tight scan loop.
1784
+ //
1785
+ // This does NOT raise the reconnect rate: TRANSPORT.FORCED_RECONNECT_
1786
+ // COOLDOWN_MS still floors that. The ladder's job is to find out within
1787
+ // seconds whether a reconnect actually worked, so the next permitted
1788
+ // reconnect fires immediately instead of idling until the next poll.
1789
+ // Set to [] to disable fast retries entirely.
1790
+ CHANNEL_RETRY_LADDER_MS: [5000, 10000, 15000],
1791
+ // CHANNEL_RETRY_MAX_REFILLS: how many times one continuous failure run
1792
+ // may restart the ladder after a reconnect was issued. Without this bound
1793
+ // the ladder would chain forever whenever reconnects are issued faster
1794
+ // than the ladder completes (which is exactly what happens if
1795
+ // FORCED_RECONNECT_COOLDOWN_MS is ever tuned below the ladder total) —
1796
+ // a permanently dead channel would then scan every 5s indefinitely
1797
+ // instead of settling back to the 60s poll. The operator alert fires
1798
+ // within this many recovery cycles, so once the cap is hit the fast
1799
+ // path has already done its job.
1800
+ CHANNEL_RETRY_MAX_REFILLS: 3,
1801
+ // CHANNEL_RECOVERY_ALERT_AFTER: how many forced-reconnect cycles an
1802
+ // account may go through without the channel recovering before the
1803
+ // watchdog escalates to a distinct operator-facing alert. Purely
1804
+ // informational reconnect looping is invisible; this makes "recovery is
1805
+ // not working, consider a restart" a log line an operator can act on.
1806
+ CHANNEL_RECOVERY_ALERT_AFTER: 3,
1644
1807
  },
1645
1808
  // -------------------------------------------------------------------------
1646
1809
  // ORDER_EVENTS — Local order-event correlation settings (chain_orders.js)
@@ -1743,6 +1906,24 @@ if (settings) {
1743
1906
  // Post-merge derivations: compute values from their documented relationships
1744
1907
  // so that user overrides to base constants propagate automatically.
1745
1908
  TIMING.SYNC_LOCK_FORCE_RELEASE_AGE_MS = TIMING.SYNC_LOCK_TIMEOUT_MS * 2;
1909
+ // Broadcast deferral bounds are all expressed in terms of the single stale
1910
+ // authority (BROADCAST_STALE_CLEAR_MS): the maintenance-tick deferral uses it
1911
+ // directly (shouldDeferMaintenanceForBroadcast) and the fill-consumer bound is
1912
+ // staleClear + a named safety margin. Deriving rather than declaring keeps the
1913
+ // ordering invariant true by construction; the check below catches a future
1914
+ // edit or override that breaks it at load time instead of silently at runtime.
1915
+ const _broadcastStaleClearMs = Number(TIMING.BROADCAST_STALE_CLEAR_MS) > 0
1916
+ ? Number(TIMING.BROADCAST_STALE_CLEAR_MS)
1917
+ : 120000;
1918
+ const _broadcastDeferSafetyMarginMs = Number(TIMING.BROADCAST_DEFER_SAFETY_MARGIN_MS) > 0
1919
+ ? Number(TIMING.BROADCAST_DEFER_SAFETY_MARGIN_MS)
1920
+ : 30000;
1921
+ TIMING.FILL_BROADCAST_DEFER_MAX_MS = Math.max(Number(TIMING.FILL_BROADCAST_DEFER_MAX_MS) > 0 ? Number(TIMING.FILL_BROADCAST_DEFER_MAX_MS) : 0, _broadcastStaleClearMs + _broadcastDeferSafetyMarginMs);
1922
+ if (!(Number(TIMING.FILL_BROADCAST_DEFER_MAX_MS) > _broadcastStaleClearMs)) {
1923
+ throw new Error(`[constants] invariant violated: FILL_BROADCAST_DEFER_MAX_MS (${TIMING.FILL_BROADCAST_DEFER_MAX_MS}) ` +
1924
+ `must exceed BROADCAST_STALE_CLEAR_MS (${_broadcastStaleClearMs}) — the fill-consumer deferral bound ` +
1925
+ `must outlast the stale-broadcast watchdog.`);
1926
+ }
1746
1927
  // Freeze objects to prevent accidental runtime modifications
1747
1928
  Object.freeze(ORDER_TYPES);
1748
1929
  Object.freeze(ORDER_STATES);
@@ -125,8 +125,6 @@ declare class DEXBot {
125
125
  _maintenanceCooldownCycles: number;
126
126
  _lastGridActivityAt: number;
127
127
  _currentCycleId: number;
128
- _autoCancelOrphanCycleMarker: number | null;
129
- _autoCancelOrphanSubCount: number;
130
128
  _consecutiveConsumeFailures: number;
131
129
  _consumeFailureFirstAt: number;
132
130
  _reconnectUnregister: any;
@@ -275,9 +273,15 @@ declare class DEXBot {
275
273
  _recoverFromPersistedGrid(): Promise<{
276
274
  success: boolean;
277
275
  reason: string;
276
+ halt?: undefined;
278
277
  } | {
279
278
  success: boolean;
280
279
  reason?: undefined;
280
+ halt?: undefined;
281
+ } | {
282
+ success: boolean;
283
+ reason: string;
284
+ halt: boolean;
281
285
  }>;
282
286
  /**
283
287
  * Reject a corrupted grid snapshot when catastrophic fund drift is detected.
@@ -655,80 +659,6 @@ declare class DEXBot {
655
659
  * @returns {Promise<Object>} Result object compatible with batch return shape
656
660
  */
657
661
  _reconcileAfterUncertainBroadcast(err: any, opContexts: any, options?: Record<string, any>): Promise<any>;
658
- /**
659
- * Auto-cancel a price-drift orphan from the unmatched-order snapshot.
660
- *
661
- * Only cancels entries with reason === 'price-drift-orphan' — these are
662
- * surplus orders that drifted away from their slot price and have no
663
- * adoptable grid slot. All other unmatched orders (duplicate-price-level,
664
- * already-matched-slot, etc.) are adoptable positions that the structural
665
- * resync will integrate into the grid; cancelling them destroys capital.
666
- *
667
- * This is the post-recovery safety net: if, after
668
- * _reconcileAfterUncertainBroadcast runs, there are still price-drift
669
- * orphans, cancel ONE per cycle. Per-cycle cap = 1 (or 5 in recovery mode)
670
- * — the next cycle will pick up the next orphan if more remain.
671
- *
672
- * Safety conditions (ALL must hold):
673
- * 1. _pendingBroadcasts is empty (no in-flight recovery)
674
- * 2. _lastUnmatchedChainOrders contains at least one price-drift-orphan
675
- * 3. The current cycle has not already auto-cancelled an orphan
676
- * (tracked via this._autoCancelOrphanCycleMarker)
677
- *
678
- * Records the cancel via _recordOwnCancelOps so the fill consumer
679
- * doesn't trip the self-cancel guard.
680
- *
681
- * @returns {Promise<{cancelled: boolean, orderId?: string, reason?: string}>}
682
- */
683
- _autoCancelOneUnmatchedOrphan(): Promise<{
684
- cancelled: boolean;
685
- reason: string;
686
- subCount: any;
687
- message?: undefined;
688
- slotId?: undefined;
689
- orderId?: undefined;
690
- error?: undefined;
691
- } | {
692
- cancelled: boolean;
693
- reason: string;
694
- subCount?: undefined;
695
- message?: undefined;
696
- slotId?: undefined;
697
- orderId?: undefined;
698
- error?: undefined;
699
- } | {
700
- cancelled: boolean;
701
- reason: string;
702
- message: string;
703
- subCount?: undefined;
704
- slotId?: undefined;
705
- orderId?: undefined;
706
- error?: undefined;
707
- } | {
708
- cancelled: boolean;
709
- reason: string;
710
- slotId: any;
711
- subCount?: undefined;
712
- message?: undefined;
713
- orderId?: undefined;
714
- error?: undefined;
715
- } | {
716
- cancelled: boolean;
717
- orderId: any;
718
- reason?: undefined;
719
- subCount?: undefined;
720
- message?: undefined;
721
- slotId?: undefined;
722
- error?: undefined;
723
- } | {
724
- cancelled: boolean;
725
- reason: string;
726
- error: any;
727
- subCount?: undefined;
728
- message?: undefined;
729
- slotId?: undefined;
730
- orderId?: undefined;
731
- }>;
732
662
  /**
733
663
  * Execute operations with retry on BroadcastUncertainError.
734
664
  * The daemon already retries internally against a 25s deadline. If it
@@ -152,8 +152,6 @@ class DEXBot {
152
152
  _maintenanceCooldownCycles;
153
153
  _lastGridActivityAt;
154
154
  _currentCycleId;
155
- _autoCancelOrphanCycleMarker;
156
- _autoCancelOrphanSubCount;
157
155
  _consecutiveConsumeFailures;
158
156
  _consumeFailureFirstAt;
159
157
  _reconnectUnregister;
@@ -268,8 +266,6 @@ class DEXBot {
268
266
  this._lastGridActivityAt = 0;
269
267
  this._lastDeferredDustCount = 0;
270
268
  this._currentCycleId = 0;
271
- this._autoCancelOrphanCycleMarker = null;
272
- this._autoCancelOrphanSubCount = 0;
273
269
  // Dust cancellation is driven by the periodic dust health-check timer
274
270
  // (setupDustHealthCheckInterval) rather than per-dust state maps.
275
271
  this._dustHealthCheckTimer = null;
@@ -912,34 +908,6 @@ class DEXBot {
912
908
  async _reconcileAfterUncertainBroadcast(err, opContexts, options = {}) {
913
909
  return cowRuntime.reconcileAfterUncertainBroadcast(this, err, opContexts, options);
914
910
  }
915
- /**
916
- * Auto-cancel a price-drift orphan from the unmatched-order snapshot.
917
- *
918
- * Only cancels entries with reason === 'price-drift-orphan' — these are
919
- * surplus orders that drifted away from their slot price and have no
920
- * adoptable grid slot. All other unmatched orders (duplicate-price-level,
921
- * already-matched-slot, etc.) are adoptable positions that the structural
922
- * resync will integrate into the grid; cancelling them destroys capital.
923
- *
924
- * This is the post-recovery safety net: if, after
925
- * _reconcileAfterUncertainBroadcast runs, there are still price-drift
926
- * orphans, cancel ONE per cycle. Per-cycle cap = 1 (or 5 in recovery mode)
927
- * — the next cycle will pick up the next orphan if more remain.
928
- *
929
- * Safety conditions (ALL must hold):
930
- * 1. _pendingBroadcasts is empty (no in-flight recovery)
931
- * 2. _lastUnmatchedChainOrders contains at least one price-drift-orphan
932
- * 3. The current cycle has not already auto-cancelled an orphan
933
- * (tracked via this._autoCancelOrphanCycleMarker)
934
- *
935
- * Records the cancel via _recordOwnCancelOps so the fill consumer
936
- * doesn't trip the self-cancel guard.
937
- *
938
- * @returns {Promise<{cancelled: boolean, orderId?: string, reason?: string}>}
939
- */
940
- async _autoCancelOneUnmatchedOrphan() {
941
- return cowRuntime.autoCancelOneUnmatchedOrphan(this);
942
- }
943
911
  /**
944
912
  * Execute operations with retry on BroadcastUncertainError.
945
913
  * The daemon already retries internally against a 25s deadline. If it
@@ -164,60 +164,6 @@ declare function restoreDiscardedCreates(bot: any, discarded: any[], opContexts:
164
164
  * @returns {Promise<Object>}
165
165
  */
166
166
  declare function reconcileAfterUncertainBroadcastImpl(bot: any, err: any, opContexts: any, _options: any): Promise<any>;
167
- /**
168
- * Auto-cancel one unmatched orphan (price-drift orphan) per cycle.
169
- * @param {import('./dexbot_class.js').DEXBot} bot
170
- * @returns {Promise<{cancelled: boolean, reason?: string, orderId?: string}>}
171
- */
172
- declare function autoCancelOneUnmatchedOrphan(bot: any): Promise<{
173
- cancelled: boolean;
174
- reason: string;
175
- subCount: any;
176
- message?: undefined;
177
- slotId?: undefined;
178
- orderId?: undefined;
179
- error?: undefined;
180
- } | {
181
- cancelled: boolean;
182
- reason: string;
183
- subCount?: undefined;
184
- message?: undefined;
185
- slotId?: undefined;
186
- orderId?: undefined;
187
- error?: undefined;
188
- } | {
189
- cancelled: boolean;
190
- reason: string;
191
- message: string;
192
- subCount?: undefined;
193
- slotId?: undefined;
194
- orderId?: undefined;
195
- error?: undefined;
196
- } | {
197
- cancelled: boolean;
198
- reason: string;
199
- slotId: any;
200
- subCount?: undefined;
201
- message?: undefined;
202
- orderId?: undefined;
203
- error?: undefined;
204
- } | {
205
- cancelled: boolean;
206
- orderId: any;
207
- reason?: undefined;
208
- subCount?: undefined;
209
- message?: undefined;
210
- slotId?: undefined;
211
- error?: undefined;
212
- } | {
213
- cancelled: boolean;
214
- reason: string;
215
- error: any;
216
- subCount?: undefined;
217
- message?: undefined;
218
- slotId?: undefined;
219
- orderId?: undefined;
220
- }>;
221
167
  /**
222
168
  * Check whether to execute creates in outside-in pair mode.
223
169
  * @param {import('./dexbot_class.js').DEXBot} bot
@@ -354,11 +300,11 @@ declare function checkGridPriceInvariant(slotId: any, price: any, genesis: any):
354
300
  * copies from the destination hole's `order.price` and which is therefore only
355
301
  * as sound as whatever last wrote that object. Deriving the emitted price here
356
302
  * means a planner bug cannot produce a mis-priced UPDATE on its own; the
357
- * invariant check remains as the backstop for the no-genesis case.
303
+ * invariant check remains as the backstop.
358
304
  *
359
305
  * @returns {number} the destination's genesis level, or NaN when there is no
360
306
  * genesis ladder / no parseable destination index (caller falls back to the
361
- * planned price, which is the migration case the checker fails open on).
307
+ * planned price — an undefined grid, which the load and sync gates refuse).
362
308
  */
363
309
  declare function deriveRotationPrice(bot: any, newGridId: any): number;
364
310
  /**
@@ -621,7 +567,7 @@ declare function processBatchResults(bot: any, result: any, opContexts: any): Pr
621
567
  hadRotation: boolean;
622
568
  updateOperationCount: number;
623
569
  }>;
624
- export { isLastFillGuardBlocked, resolveOnGridPivot, checkGridPriceInvariant, deriveRotationPrice, refreshLastFillPivotFromQueue, runFinalPivotGate, buildOutsideInPairGroupsForOrders, buildOutsideInPairGroupsForCreateEntries, markMissingCreateResultsAsStructuralBlocker, formatUnmatchedChainOrderForLog, recordPendingBroadcast, clearPendingBroadcasts, popPushedWorkingGrid, findChainOrderForSlot, reconcileAfterUncertainBroadcast, reconcileAfterUncertainBroadcastImpl, autoCancelOneUnmatchedOrphan, executeWithRetryOnUncertain, executeChunkedWithRetryOnUncertain, formatPartialBroadcastSummary, executeOperationsWithStrategy, buildActionsFromPlan, buildCowResultFromPlan, applyRotationTransitionsToWorkingGrid, pollChainForConfirmation, updateOrdersOnChainBatchCOW, processBatchResults, adoptPlacedBatchFromChain, resolveRefillBoundaryHold, toRefillSlotIdSet, trackBoundaryHold };
570
+ export { isLastFillGuardBlocked, resolveOnGridPivot, checkGridPriceInvariant, deriveRotationPrice, refreshLastFillPivotFromQueue, runFinalPivotGate, buildOutsideInPairGroupsForOrders, buildOutsideInPairGroupsForCreateEntries, markMissingCreateResultsAsStructuralBlocker, formatUnmatchedChainOrderForLog, recordPendingBroadcast, clearPendingBroadcasts, popPushedWorkingGrid, findChainOrderForSlot, reconcileAfterUncertainBroadcast, reconcileAfterUncertainBroadcastImpl, executeWithRetryOnUncertain, executeChunkedWithRetryOnUncertain, formatPartialBroadcastSummary, executeOperationsWithStrategy, buildActionsFromPlan, buildCowResultFromPlan, applyRotationTransitionsToWorkingGrid, pollChainForConfirmation, updateOrdersOnChainBatchCOW, processBatchResults, adoptPlacedBatchFromChain, resolveRefillBoundaryHold, toRefillSlotIdSet, trackBoundaryHold };
625
571
  export { restoreDiscardedCreates };
626
572
  declare const _default: {
627
573
  buildOutsideInPairGroupsForOrders: typeof buildOutsideInPairGroupsForOrders;
@@ -639,7 +585,6 @@ declare const _default: {
639
585
  findChainOrderForSlot: typeof findChainOrderForSlot;
640
586
  reconcileAfterUncertainBroadcast: typeof reconcileAfterUncertainBroadcast;
641
587
  reconcileAfterUncertainBroadcastImpl: typeof reconcileAfterUncertainBroadcastImpl;
642
- autoCancelOneUnmatchedOrphan: typeof autoCancelOneUnmatchedOrphan;
643
588
  shouldExecuteCreatePairMode: typeof shouldExecuteCreatePairMode;
644
589
  executeWithRetryOnUncertain: typeof executeWithRetryOnUncertain;
645
590
  executeChunkedWithRetryOnUncertain: typeof executeChunkedWithRetryOnUncertain;