dexbot 1.6.7 → 1.6.9

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 (626) hide show
  1. package/CHANGELOG.md +73 -1
  2. package/README.md +3 -3
  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 +55 -16
  17. package/dist/market_adapter/core/market_adapter_service.d.ts +81 -1
  18. package/dist/market_adapter/core/market_adapter_service.js +239 -20
  19. package/dist/market_adapter/core/signals/hurst_analyzer.d.ts +10 -1
  20. package/dist/market_adapter/core/signals/hurst_analyzer.js +40 -18
  21. package/dist/market_adapter/core/signals/permutation_entropy_analyzer.d.ts +26 -2
  22. package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js +132 -29
  23. package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts +8 -1
  24. package/dist/market_adapter/core/strategies/dynamic_weight_series.js +5 -1
  25. package/dist/market_adapter/core/strategies/regime_gate.d.ts +61 -3
  26. package/dist/market_adapter/core/strategies/regime_gate.js +207 -7
  27. package/dist/market_adapter/inputs/window_cache.d.ts +97 -19
  28. package/dist/market_adapter/inputs/window_cache.js +302 -48
  29. package/dist/market_adapter/interval_utils.d.ts +18 -1
  30. package/dist/market_adapter/interval_utils.js +31 -1
  31. package/dist/market_adapter/market_adapter.d.ts +158 -2
  32. package/dist/market_adapter/market_adapter.js +399 -65
  33. package/dist/market_adapter/test_helpers.d.ts +2 -2
  34. package/dist/market_adapter/test_helpers.js +2 -2
  35. package/dist/market_adapter/utils/file_json_cache.d.ts +29 -0
  36. package/dist/market_adapter/utils/file_json_cache.js +106 -0
  37. package/dist/modules/account_bots.js +10 -0
  38. package/dist/modules/account_orders.d.ts +24 -2
  39. package/dist/modules/account_orders.js +41 -4
  40. package/dist/modules/bot_settings.js +10 -1
  41. package/dist/modules/config.d.ts +7 -0
  42. package/dist/modules/config.js +2 -0
  43. package/dist/modules/constants.d.ts +16 -4
  44. package/dist/modules/constants.js +144 -38
  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 +4 -87
  49. package/dist/modules/dexbot_maintenance_runtime.d.ts +15 -1
  50. package/dist/modules/dexbot_maintenance_runtime.js +59 -11
  51. package/dist/modules/dexbot_startup_runtime.js +73 -20
  52. package/dist/modules/dexbot_state_recovery.d.ts +6 -0
  53. package/dist/modules/dexbot_state_recovery.js +21 -0
  54. package/dist/modules/order/async_lock.d.ts +8 -0
  55. package/dist/modules/order/async_lock.js +15 -0
  56. package/dist/modules/order/genesis_policy.d.ts +162 -0
  57. package/dist/modules/order/genesis_policy.js +267 -0
  58. package/dist/modules/order/grid.js +172 -160
  59. package/dist/modules/order/grid_reconcile.d.ts +9 -0
  60. package/dist/modules/order/grid_reconcile.js +13 -4
  61. package/dist/modules/order/grid_reconcile_internal.js +2 -2
  62. package/dist/modules/order/manager.d.ts +4 -0
  63. package/dist/modules/order/manager.js +14 -1
  64. package/dist/modules/order/sync_engine.d.ts +19 -0
  65. package/dist/modules/order/sync_engine.js +284 -344
  66. package/dist/modules/order/utils/math.d.ts +22 -1
  67. package/dist/modules/order/utils/math.js +64 -1
  68. package/dist/modules/order/utils/order.d.ts +43 -58
  69. package/dist/modules/order/utils/order.js +220 -197
  70. package/dist/modules/order/utils/system.js +8 -1
  71. package/dist/modules/paths.d.ts +1 -0
  72. package/dist/modules/paths.js +1 -0
  73. package/dist/modules/version_notice.d.ts +311 -0
  74. package/dist/modules/version_notice.js +709 -0
  75. package/dist/pm2.js +16 -0
  76. package/dist/unlock.js +28 -0
  77. package/docs/BITSHARES_ONBOARDING.md +8 -1
  78. package/docs/COW_INVARIANTS.md +3 -2
  79. package/docs/DEXBOT_COMPARISON.md +4 -4
  80. package/docs/EVOLUTION.md +22 -20
  81. package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +1 -1
  82. package/docs/GRID_PRICE_INVARIANT.md +149 -31
  83. package/docs/GRID_RECALCULATION.md +18 -2
  84. package/docs/README.md +3 -1
  85. package/docs/WORKFLOW.md +16 -5
  86. package/market_adapter/README.md +29 -1
  87. package/modules/README.md +18 -1
  88. package/package.json +13 -5
  89. package/scripts/README.md +28 -2
  90. package/scripts/clear-all.sh +13 -4
  91. package/scripts/clear-logs.sh +13 -4
  92. package/scripts/clear-market-adapter.sh +6 -0
  93. package/scripts/clear-orders.sh +5 -0
  94. package/scripts/lib/dexbot-paths.sh +108 -0
  95. package/tests/README.md +11 -3
  96. package/analysis/account_resolver.ts +0 -161
  97. package/analysis/ama_fitting/analyze_ama_price_changes.ts +0 -155
  98. package/analysis/ama_fitting/analyze_lambda_vs_slow.ts +0 -404
  99. package/analysis/ama_fitting/calibrate_convergence_er.ts +0 -201
  100. package/analysis/ama_fitting/fetch_lp_candles.ts +0 -184
  101. package/analysis/ama_fitting/generate_unified_comparison_chart.ts +0 -232
  102. package/analysis/ama_fitting/optimizer_high_resolution.ts +0 -802
  103. package/analysis/analyze_dynamic_weight.ts +0 -243
  104. package/analysis/analyze_kalman.ts +0 -157
  105. package/analysis/analyze_regime.ts +0 -158
  106. package/analysis/analyze_regime_windows.ts +0 -470
  107. package/analysis/analyze_risk_profile.ts +0 -199
  108. package/analysis/analyze_trade_heatmap.ts +0 -362
  109. package/analysis/analyze_volatility.ts +0 -182
  110. package/analysis/bot_fitting/backtest_ama_sweep.ts +0 -934
  111. package/analysis/bot_fitting/backtest_bot_fitting.ts +0 -861
  112. package/analysis/bot_fitting/shared_utils.ts +0 -52
  113. package/analysis/bot_key_utils.ts +0 -426
  114. package/analysis/bot_usage/discover_bot_accounts.ts +0 -635
  115. package/analysis/bot_usage/kibana_bot_queries.ts +0 -211
  116. package/analysis/chain_pool.ts +0 -47
  117. package/analysis/chart_css.ts +0 -62
  118. package/analysis/chart_ui.ts +0 -105
  119. package/analysis/chart_utils.ts +0 -210
  120. package/analysis/fills_source.ts +0 -228
  121. package/analysis/grid_correction_check.ts +0 -786
  122. package/analysis/math_utils.ts +0 -53
  123. package/analysis/price_sources.ts +0 -136
  124. package/analysis/resolve_bot_accounts.ts +0 -199
  125. package/analysis/resolve_source.ts +0 -99
  126. package/analysis/results/ama_sweep_results_lp_pool_133_1h.json +0 -2455
  127. package/analysis/results/bot_fitting_results_lp_pool_133_1h.json +0 -218
  128. package/analysis/trade_profitability.ts +0 -1335
  129. package/analysis/tradingview/analyze_tradingview.ts +0 -280
  130. package/analysis/tradingview/h-bts_tradingview.html +0 -1570
  131. package/analysis/tradingview/t-bts_tradingview.html +0 -1570
  132. package/analysis/tradingview/tradingview_uplot_chart_generator.ts +0 -3268
  133. package/analysis/trend_detection/dynamic_weight_chart_generator.ts +0 -1481
  134. package/analysis/trend_detection/hurst_analyzer.ts +0 -7
  135. package/analysis/trend_detection/kalman_chart_generator.ts +0 -398
  136. package/analysis/trend_detection/kalman_trend_analyzer.ts +0 -9
  137. package/analysis/trend_detection/kalman_velocity_smoothing.ts +0 -7
  138. package/analysis/trend_detection/package.json +0 -23
  139. package/analysis/trend_detection/permutation_entropy_analyzer.ts +0 -7
  140. package/analysis/trend_detection/regime_chart_generator.ts +0 -338
  141. package/analysis/trend_detection/tests/test_kalman_trend.ts +0 -153
  142. package/analysis/trend_detection/tests/test_kalman_velocity_smoothing.ts +0 -64
  143. package/analysis/trend_detection/volatility_chart_generator.ts +0 -654
  144. package/analysis/tsconfig.json +0 -29
  145. package/claw/tests/package.json +0 -3
  146. package/claw/tests/test_claw_bridge.ts +0 -570
  147. package/claw/tests/test_claw_catalog_and_credentials.ts +0 -156
  148. package/claw/tests/test_claw_chain_layer.ts +0 -739
  149. package/claw/tests/test_claw_data_flow.ts +0 -525
  150. package/claw/tests/test_claw_domain_logic.ts +0 -471
  151. package/claw/tests/test_claw_manifest_and_matrix.ts +0 -222
  152. package/claw/tests/test_claw_mcp_transport.ts +0 -243
  153. package/claw/tests/test_claw_regressions.ts +0 -711
  154. package/claw/tests/test_claw_skill_generation.ts +0 -103
  155. package/claw/tests/test_claw_state_store.ts +0 -44
  156. package/claw/tests/test_dexbot_profiles.ts +0 -654
  157. package/claw/tests/test_memu_bridge.ts +0 -189
  158. package/claw/tests/test_nullclaw_tmp_integration.ts +0 -57
  159. package/claw/tests/test_position_health.ts +0 -343
  160. package/claw/tests/test_position_manager.ts +0 -429
  161. package/claw/tests/test_position_manager_watch_health.ts +0 -100
  162. package/claw/tests/test_short_mpa_strategy.ts +0 -232
  163. package/dist/analysis/account_resolver.d.ts.map +0 -1
  164. package/dist/analysis/account_resolver.js.map +0 -1
  165. package/dist/analysis/ama_fitting/analyze_ama_price_changes.d.ts.map +0 -1
  166. package/dist/analysis/ama_fitting/analyze_ama_price_changes.js.map +0 -1
  167. package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts.map +0 -1
  168. package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js.map +0 -1
  169. package/dist/analysis/ama_fitting/calibrate_convergence_er.d.ts.map +0 -1
  170. package/dist/analysis/ama_fitting/calibrate_convergence_er.js.map +0 -1
  171. package/dist/analysis/ama_fitting/fetch_lp_candles.d.ts.map +0 -1
  172. package/dist/analysis/ama_fitting/fetch_lp_candles.js.map +0 -1
  173. package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts.map +0 -1
  174. package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js.map +0 -1
  175. package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts.map +0 -1
  176. package/dist/analysis/ama_fitting/optimizer_high_resolution.js.map +0 -1
  177. package/dist/analysis/analyze_dynamic_weight.d.ts.map +0 -1
  178. package/dist/analysis/analyze_dynamic_weight.js.map +0 -1
  179. package/dist/analysis/analyze_kalman.d.ts.map +0 -1
  180. package/dist/analysis/analyze_kalman.js.map +0 -1
  181. package/dist/analysis/analyze_regime.d.ts.map +0 -1
  182. package/dist/analysis/analyze_regime.js.map +0 -1
  183. package/dist/analysis/analyze_regime_windows.d.ts.map +0 -1
  184. package/dist/analysis/analyze_regime_windows.js.map +0 -1
  185. package/dist/analysis/analyze_risk_profile.d.ts.map +0 -1
  186. package/dist/analysis/analyze_risk_profile.js.map +0 -1
  187. package/dist/analysis/analyze_trade_heatmap.d.ts.map +0 -1
  188. package/dist/analysis/analyze_trade_heatmap.js.map +0 -1
  189. package/dist/analysis/analyze_volatility.d.ts.map +0 -1
  190. package/dist/analysis/analyze_volatility.js.map +0 -1
  191. package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts.map +0 -1
  192. package/dist/analysis/bot_fitting/backtest_ama_sweep.js.map +0 -1
  193. package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts.map +0 -1
  194. package/dist/analysis/bot_fitting/backtest_bot_fitting.js.map +0 -1
  195. package/dist/analysis/bot_fitting/shared_utils.d.ts.map +0 -1
  196. package/dist/analysis/bot_fitting/shared_utils.js.map +0 -1
  197. package/dist/analysis/bot_key_utils.d.ts.map +0 -1
  198. package/dist/analysis/bot_key_utils.js.map +0 -1
  199. package/dist/analysis/bot_usage/discover_bot_accounts.d.ts.map +0 -1
  200. package/dist/analysis/bot_usage/discover_bot_accounts.js.map +0 -1
  201. package/dist/analysis/bot_usage/kibana_bot_queries.d.ts.map +0 -1
  202. package/dist/analysis/bot_usage/kibana_bot_queries.js.map +0 -1
  203. package/dist/analysis/chain_pool.d.ts.map +0 -1
  204. package/dist/analysis/chain_pool.js.map +0 -1
  205. package/dist/analysis/chart_css.d.ts.map +0 -1
  206. package/dist/analysis/chart_css.js.map +0 -1
  207. package/dist/analysis/chart_ui.d.ts.map +0 -1
  208. package/dist/analysis/chart_ui.js.map +0 -1
  209. package/dist/analysis/chart_utils.d.ts.map +0 -1
  210. package/dist/analysis/chart_utils.js.map +0 -1
  211. package/dist/analysis/fills_source.d.ts.map +0 -1
  212. package/dist/analysis/fills_source.js.map +0 -1
  213. package/dist/analysis/grid_correction_check.d.ts.map +0 -1
  214. package/dist/analysis/grid_correction_check.js.map +0 -1
  215. package/dist/analysis/math_utils.d.ts.map +0 -1
  216. package/dist/analysis/math_utils.js.map +0 -1
  217. package/dist/analysis/price_sources.d.ts.map +0 -1
  218. package/dist/analysis/price_sources.js.map +0 -1
  219. package/dist/analysis/resolve_bot_accounts.d.ts.map +0 -1
  220. package/dist/analysis/resolve_bot_accounts.js.map +0 -1
  221. package/dist/analysis/resolve_source.d.ts.map +0 -1
  222. package/dist/analysis/resolve_source.js.map +0 -1
  223. package/dist/analysis/trade_profitability.d.ts.map +0 -1
  224. package/dist/analysis/trade_profitability.js.map +0 -1
  225. package/dist/analysis/tradingview/analyze_tradingview.d.ts.map +0 -1
  226. package/dist/analysis/tradingview/analyze_tradingview.js.map +0 -1
  227. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +0 -1
  228. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +0 -1
  229. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts.map +0 -1
  230. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js.map +0 -1
  231. package/dist/analysis/trend_detection/hurst_analyzer.d.ts.map +0 -1
  232. package/dist/analysis/trend_detection/hurst_analyzer.js.map +0 -1
  233. package/dist/analysis/trend_detection/kalman_chart_generator.d.ts.map +0 -1
  234. package/dist/analysis/trend_detection/kalman_chart_generator.js.map +0 -1
  235. package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts.map +0 -1
  236. package/dist/analysis/trend_detection/kalman_trend_analyzer.js.map +0 -1
  237. package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts.map +0 -1
  238. package/dist/analysis/trend_detection/kalman_velocity_smoothing.js.map +0 -1
  239. package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts.map +0 -1
  240. package/dist/analysis/trend_detection/permutation_entropy_analyzer.js.map +0 -1
  241. package/dist/analysis/trend_detection/regime_chart_generator.d.ts.map +0 -1
  242. package/dist/analysis/trend_detection/regime_chart_generator.js.map +0 -1
  243. package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts +0 -2
  244. package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts.map +0 -1
  245. package/dist/analysis/trend_detection/tests/test_kalman_trend.js +0 -128
  246. package/dist/analysis/trend_detection/tests/test_kalman_trend.js.map +0 -1
  247. package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts +0 -2
  248. package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts.map +0 -1
  249. package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js +0 -37
  250. package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js.map +0 -1
  251. package/dist/analysis/trend_detection/volatility_chart_generator.d.ts.map +0 -1
  252. package/dist/analysis/trend_detection/volatility_chart_generator.js.map +0 -1
  253. package/dist/bot.d.ts.map +0 -1
  254. package/dist/bot.js.map +0 -1
  255. package/dist/credential-daemon.d.ts.map +0 -1
  256. package/dist/credential-daemon.js.map +0 -1
  257. package/dist/dexbot.d.ts.map +0 -1
  258. package/dist/dexbot.js.map +0 -1
  259. package/dist/market_adapter/ama_signal_runner.d.ts.map +0 -1
  260. package/dist/market_adapter/ama_signal_runner.js.map +0 -1
  261. package/dist/market_adapter/candle_utils.d.ts.map +0 -1
  262. package/dist/market_adapter/candle_utils.js.map +0 -1
  263. package/dist/market_adapter/core/asymmetric_bounds.d.ts.map +0 -1
  264. package/dist/market_adapter/core/asymmetric_bounds.js.map +0 -1
  265. package/dist/market_adapter/core/config_normalizers.d.ts.map +0 -1
  266. package/dist/market_adapter/core/config_normalizers.js.map +0 -1
  267. package/dist/market_adapter/core/kibana_candles.d.ts.map +0 -1
  268. package/dist/market_adapter/core/kibana_candles.js.map +0 -1
  269. package/dist/market_adapter/core/kibana_client.d.ts.map +0 -1
  270. package/dist/market_adapter/core/kibana_client.js.map +0 -1
  271. package/dist/market_adapter/core/kibana_market_candles.d.ts.map +0 -1
  272. package/dist/market_adapter/core/kibana_market_candles.js.map +0 -1
  273. package/dist/market_adapter/core/market_adapter_service.d.ts.map +0 -1
  274. package/dist/market_adapter/core/market_adapter_service.js.map +0 -1
  275. package/dist/market_adapter/core/signals/hurst_analyzer.d.ts.map +0 -1
  276. package/dist/market_adapter/core/signals/hurst_analyzer.js.map +0 -1
  277. package/dist/market_adapter/core/signals/kalman_trend_analyzer.d.ts.map +0 -1
  278. package/dist/market_adapter/core/signals/kalman_trend_analyzer.js.map +0 -1
  279. package/dist/market_adapter/core/signals/kalman_velocity_smoothing.d.ts.map +0 -1
  280. package/dist/market_adapter/core/signals/kalman_velocity_smoothing.js.map +0 -1
  281. package/dist/market_adapter/core/signals/permutation_entropy_analyzer.d.ts.map +0 -1
  282. package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js.map +0 -1
  283. package/dist/market_adapter/core/strategies/ama.d.ts.map +0 -1
  284. package/dist/market_adapter/core/strategies/ama.js.map +0 -1
  285. package/dist/market_adapter/core/strategies/ama_slope_model.d.ts.map +0 -1
  286. package/dist/market_adapter/core/strategies/ama_slope_model.js.map +0 -1
  287. package/dist/market_adapter/core/strategies/atr/calculator.d.ts.map +0 -1
  288. package/dist/market_adapter/core/strategies/atr/calculator.js.map +0 -1
  289. package/dist/market_adapter/core/strategies/collateral_manager.d.ts.map +0 -1
  290. package/dist/market_adapter/core/strategies/collateral_manager.js.map +0 -1
  291. package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts.map +0 -1
  292. package/dist/market_adapter/core/strategies/dynamic_weight_series.js.map +0 -1
  293. package/dist/market_adapter/core/strategies/regime_gate.d.ts.map +0 -1
  294. package/dist/market_adapter/core/strategies/regime_gate.js.map +0 -1
  295. package/dist/market_adapter/core/strategies/regime_interp.d.ts.map +0 -1
  296. package/dist/market_adapter/core/strategies/regime_interp.js.map +0 -1
  297. package/dist/market_adapter/core/strategies/volatility_shift.d.ts.map +0 -1
  298. package/dist/market_adapter/core/strategies/volatility_shift.js.map +0 -1
  299. package/dist/market_adapter/inputs/fetch_book_data.d.ts.map +0 -1
  300. package/dist/market_adapter/inputs/fetch_book_data.js.map +0 -1
  301. package/dist/market_adapter/inputs/fetch_cex_synthetic_data.d.ts.map +0 -1
  302. package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +0 -1
  303. package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +0 -1
  304. package/dist/market_adapter/inputs/fetch_lp_data.js.map +0 -1
  305. package/dist/market_adapter/inputs/kibana_feed_source.d.ts.map +0 -1
  306. package/dist/market_adapter/inputs/kibana_feed_source.js.map +0 -1
  307. package/dist/market_adapter/inputs/kibana_source.d.ts.map +0 -1
  308. package/dist/market_adapter/inputs/kibana_source.js.map +0 -1
  309. package/dist/market_adapter/inputs/window_cache.d.ts.map +0 -1
  310. package/dist/market_adapter/inputs/window_cache.js.map +0 -1
  311. package/dist/market_adapter/interval_utils.d.ts.map +0 -1
  312. package/dist/market_adapter/interval_utils.js.map +0 -1
  313. package/dist/market_adapter/log_format.d.ts.map +0 -1
  314. package/dist/market_adapter/log_format.js.map +0 -1
  315. package/dist/market_adapter/lp_chart_core.d.ts.map +0 -1
  316. package/dist/market_adapter/lp_chart_core.js.map +0 -1
  317. package/dist/market_adapter/lp_chart_runner.d.ts.map +0 -1
  318. package/dist/market_adapter/lp_chart_runner.js.map +0 -1
  319. package/dist/market_adapter/lp_chart_strategy_loader.d.ts.map +0 -1
  320. package/dist/market_adapter/lp_chart_strategy_loader.js.map +0 -1
  321. package/dist/market_adapter/market_adapter.d.ts.map +0 -1
  322. package/dist/market_adapter/market_adapter.js.map +0 -1
  323. package/dist/market_adapter/test_helpers.d.ts.map +0 -1
  324. package/dist/market_adapter/test_helpers.js.map +0 -1
  325. package/dist/market_adapter/utils/adapter_client.d.ts.map +0 -1
  326. package/dist/market_adapter/utils/adapter_client.js.map +0 -1
  327. package/dist/market_adapter/utils/atomic_write.d.ts.map +0 -1
  328. package/dist/market_adapter/utils/atomic_write.js.map +0 -1
  329. package/dist/market_adapter/utils/chain.d.ts.map +0 -1
  330. package/dist/market_adapter/utils/chain.js.map +0 -1
  331. package/dist/market_adapter/utils/data_discovery.d.ts.map +0 -1
  332. package/dist/market_adapter/utils/data_discovery.js.map +0 -1
  333. package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +0 -1
  334. package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +0 -1
  335. package/dist/market_adapter/utils/file_lock.d.ts.map +0 -1
  336. package/dist/market_adapter/utils/file_lock.js.map +0 -1
  337. package/dist/market_adapter/utils/native_history.d.ts.map +0 -1
  338. package/dist/market_adapter/utils/native_history.js.map +0 -1
  339. package/dist/modules/account_bots.d.ts.map +0 -1
  340. package/dist/modules/account_bots.js.map +0 -1
  341. package/dist/modules/account_orders.d.ts.map +0 -1
  342. package/dist/modules/account_orders.js.map +0 -1
  343. package/dist/modules/authority_resolver.d.ts.map +0 -1
  344. package/dist/modules/authority_resolver.js.map +0 -1
  345. package/dist/modules/bitshares-native/chain_client.d.ts.map +0 -1
  346. package/dist/modules/bitshares-native/chain_client.js.map +0 -1
  347. package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts.map +0 -1
  348. package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +0 -1
  349. package/dist/modules/bitshares-native/crypto/ecc.d.ts.map +0 -1
  350. package/dist/modules/bitshares-native/crypto/ecc.js.map +0 -1
  351. package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts.map +0 -1
  352. package/dist/modules/bitshares-native/crypto/ecc_selector.js.map +0 -1
  353. package/dist/modules/bitshares-native/index.d.ts.map +0 -1
  354. package/dist/modules/bitshares-native/index.js.map +0 -1
  355. package/dist/modules/bitshares-native/lru_cache.d.ts.map +0 -1
  356. package/dist/modules/bitshares-native/lru_cache.js.map +0 -1
  357. package/dist/modules/bitshares-native/resolvers.d.ts.map +0 -1
  358. package/dist/modules/bitshares-native/resolvers.js.map +0 -1
  359. package/dist/modules/bitshares-native/serial/chain_constants.d.ts.map +0 -1
  360. package/dist/modules/bitshares-native/serial/chain_constants.js.map +0 -1
  361. package/dist/modules/bitshares-native/serial/index.d.ts.map +0 -1
  362. package/dist/modules/bitshares-native/serial/index.js.map +0 -1
  363. package/dist/modules/bitshares-native/serial/operations.d.ts.map +0 -1
  364. package/dist/modules/bitshares-native/serial/operations.js.map +0 -1
  365. package/dist/modules/bitshares-native/serial/serializer.d.ts.map +0 -1
  366. package/dist/modules/bitshares-native/serial/serializer.js.map +0 -1
  367. package/dist/modules/bitshares-native/serial/types.d.ts.map +0 -1
  368. package/dist/modules/bitshares-native/serial/types.js.map +0 -1
  369. package/dist/modules/bitshares-native/signing_client.d.ts.map +0 -1
  370. package/dist/modules/bitshares-native/signing_client.js.map +0 -1
  371. package/dist/modules/bitshares-native/subscriptions.d.ts.map +0 -1
  372. package/dist/modules/bitshares-native/subscriptions.js.map +0 -1
  373. package/dist/modules/bitshares-native/transport.d.ts.map +0 -1
  374. package/dist/modules/bitshares-native/transport.js.map +0 -1
  375. package/dist/modules/bitshares-native/tx/builder.d.ts.map +0 -1
  376. package/dist/modules/bitshares-native/tx/builder.js.map +0 -1
  377. package/dist/modules/bitshares-native/tx/tx_cache.d.ts.map +0 -1
  378. package/dist/modules/bitshares-native/tx/tx_cache.js.map +0 -1
  379. package/dist/modules/bitshares_client.d.ts.map +0 -1
  380. package/dist/modules/bitshares_client.js.map +0 -1
  381. package/dist/modules/bot_defaults.d.ts.map +0 -1
  382. package/dist/modules/bot_defaults.js.map +0 -1
  383. package/dist/modules/bot_settings.d.ts.map +0 -1
  384. package/dist/modules/bot_settings.js.map +0 -1
  385. package/dist/modules/bots_file_lock.d.ts.map +0 -1
  386. package/dist/modules/bots_file_lock.js.map +0 -1
  387. package/dist/modules/broadcast_failure.d.ts.map +0 -1
  388. package/dist/modules/broadcast_failure.js.map +0 -1
  389. package/dist/modules/chain_keys.d.ts.map +0 -1
  390. package/dist/modules/chain_keys.js.map +0 -1
  391. package/dist/modules/chain_orders.d.ts.map +0 -1
  392. package/dist/modules/chain_orders.js.map +0 -1
  393. package/dist/modules/cli_colors.d.ts.map +0 -1
  394. package/dist/modules/cli_colors.js.map +0 -1
  395. package/dist/modules/cli_start_onboarding.d.ts.map +0 -1
  396. package/dist/modules/cli_start_onboarding.js.map +0 -1
  397. package/dist/modules/cli_start_output.d.ts.map +0 -1
  398. package/dist/modules/cli_start_output.js.map +0 -1
  399. package/dist/modules/config.d.ts.map +0 -1
  400. package/dist/modules/config.js.map +0 -1
  401. package/dist/modules/constants.d.ts.map +0 -1
  402. package/dist/modules/constants.js.map +0 -1
  403. package/dist/modules/cr_planner.d.ts.map +0 -1
  404. package/dist/modules/cr_planner.js.map +0 -1
  405. package/dist/modules/credential_policy.d.ts.map +0 -1
  406. package/dist/modules/credential_policy.js.map +0 -1
  407. package/dist/modules/credential_runtime.d.ts.map +0 -1
  408. package/dist/modules/credential_runtime.js.map +0 -1
  409. package/dist/modules/credential_session_cache.d.ts.map +0 -1
  410. package/dist/modules/credential_session_cache.js.map +0 -1
  411. package/dist/modules/credit_pricing.d.ts.map +0 -1
  412. package/dist/modules/credit_pricing.js.map +0 -1
  413. package/dist/modules/credit_runtime.d.ts.map +0 -1
  414. package/dist/modules/credit_runtime.js.map +0 -1
  415. package/dist/modules/crypto/browser_provider.d.ts.map +0 -1
  416. package/dist/modules/crypto/browser_provider.js.map +0 -1
  417. package/dist/modules/crypto/index.d.ts.map +0 -1
  418. package/dist/modules/crypto/index.js.map +0 -1
  419. package/dist/modules/crypto/node_provider.d.ts.map +0 -1
  420. package/dist/modules/crypto/node_provider.js.map +0 -1
  421. package/dist/modules/crypto/provider.d.ts.map +0 -1
  422. package/dist/modules/crypto/provider.js.map +0 -1
  423. package/dist/modules/crypto/pure_ripemd160.d.ts.map +0 -1
  424. package/dist/modules/crypto/pure_ripemd160.js.map +0 -1
  425. package/dist/modules/crypto/pure_scrypt.d.ts.map +0 -1
  426. package/dist/modules/crypto/pure_scrypt.js.map +0 -1
  427. package/dist/modules/crypto/pure_secp256k1.d.ts.map +0 -1
  428. package/dist/modules/crypto/pure_secp256k1.js.map +0 -1
  429. package/dist/modules/crypto/sync.d.ts.map +0 -1
  430. package/dist/modules/crypto/sync.js.map +0 -1
  431. package/dist/modules/daemon_node_health.d.ts.map +0 -1
  432. package/dist/modules/daemon_node_health.js.map +0 -1
  433. package/dist/modules/dexbot_class.d.ts.map +0 -1
  434. package/dist/modules/dexbot_class.js.map +0 -1
  435. package/dist/modules/dexbot_cow_runtime.d.ts.map +0 -1
  436. package/dist/modules/dexbot_cow_runtime.js.map +0 -1
  437. package/dist/modules/dexbot_credential_client.d.ts.map +0 -1
  438. package/dist/modules/dexbot_credential_client.js.map +0 -1
  439. package/dist/modules/dexbot_fill_runtime.d.ts.map +0 -1
  440. package/dist/modules/dexbot_fill_runtime.js.map +0 -1
  441. package/dist/modules/dexbot_maintenance_runtime.d.ts.map +0 -1
  442. package/dist/modules/dexbot_maintenance_runtime.js.map +0 -1
  443. package/dist/modules/dexbot_startup_runtime.d.ts.map +0 -1
  444. package/dist/modules/dexbot_startup_runtime.js.map +0 -1
  445. package/dist/modules/dexbot_state_recovery.d.ts.map +0 -1
  446. package/dist/modules/dexbot_state_recovery.js.map +0 -1
  447. package/dist/modules/env.d.ts.map +0 -1
  448. package/dist/modules/env.js.map +0 -1
  449. package/dist/modules/fund_registry.d.ts.map +0 -1
  450. package/dist/modules/fund_registry.js.map +0 -1
  451. package/dist/modules/general_settings.d.ts.map +0 -1
  452. package/dist/modules/general_settings.js.map +0 -1
  453. package/dist/modules/graceful_shutdown.d.ts.map +0 -1
  454. package/dist/modules/graceful_shutdown.js.map +0 -1
  455. package/dist/modules/grid_price_source.d.ts.map +0 -1
  456. package/dist/modules/grid_price_source.js.map +0 -1
  457. package/dist/modules/key_store.d.ts.map +0 -1
  458. package/dist/modules/key_store.js.map +0 -1
  459. package/dist/modules/launcher/adapter_requirement.d.ts.map +0 -1
  460. package/dist/modules/launcher/adapter_requirement.js.map +0 -1
  461. package/dist/modules/launcher/bot_supervisor.d.ts.map +0 -1
  462. package/dist/modules/launcher/bot_supervisor.js.map +0 -1
  463. package/dist/modules/launcher/child_env.d.ts.map +0 -1
  464. package/dist/modules/launcher/child_env.js.map +0 -1
  465. package/dist/modules/launcher/credential_bootstrap.d.ts.map +0 -1
  466. package/dist/modules/launcher/credential_bootstrap.js.map +0 -1
  467. package/dist/modules/launcher/credential_daemon.d.ts.map +0 -1
  468. package/dist/modules/launcher/credential_daemon.js.map +0 -1
  469. package/dist/modules/launcher/credential_secret.d.ts.map +0 -1
  470. package/dist/modules/launcher/credential_secret.js.map +0 -1
  471. package/dist/modules/launcher/foreign_cred_daemon.d.ts.map +0 -1
  472. package/dist/modules/launcher/foreign_cred_daemon.js.map +0 -1
  473. package/dist/modules/launcher/headless_password.d.ts.map +0 -1
  474. package/dist/modules/launcher/headless_password.js.map +0 -1
  475. package/dist/modules/launcher/launch_modes.d.ts.map +0 -1
  476. package/dist/modules/launcher/launch_modes.js.map +0 -1
  477. package/dist/modules/launcher/market_adapter_runtime.d.ts.map +0 -1
  478. package/dist/modules/launcher/market_adapter_runtime.js.map +0 -1
  479. package/dist/modules/launcher/market_adapter_watchdog.d.ts.map +0 -1
  480. package/dist/modules/launcher/market_adapter_watchdog.js.map +0 -1
  481. package/dist/modules/launcher/monolithic_runtime.d.ts.map +0 -1
  482. package/dist/modules/launcher/monolithic_runtime.js.map +0 -1
  483. package/dist/modules/launcher/runtime_entry.d.ts.map +0 -1
  484. package/dist/modules/launcher/runtime_entry.js.map +0 -1
  485. package/dist/modules/launcher/status_reporting.d.ts.map +0 -1
  486. package/dist/modules/launcher/status_reporting.js.map +0 -1
  487. package/dist/modules/launcher/supervisor_control.d.ts.map +0 -1
  488. package/dist/modules/launcher/supervisor_control.js.map +0 -1
  489. package/dist/modules/market_adapter_whitelist.d.ts.map +0 -1
  490. package/dist/modules/market_adapter_whitelist.js.map +0 -1
  491. package/dist/modules/node_connect_policy.d.ts.map +0 -1
  492. package/dist/modules/node_connect_policy.js.map +0 -1
  493. package/dist/modules/node_failure_ledger.d.ts.map +0 -1
  494. package/dist/modules/node_failure_ledger.js.map +0 -1
  495. package/dist/modules/node_health_cache.d.ts.map +0 -1
  496. package/dist/modules/node_health_cache.js.map +0 -1
  497. package/dist/modules/node_manager.d.ts.map +0 -1
  498. package/dist/modules/node_manager.js.map +0 -1
  499. package/dist/modules/order/accounting.d.ts.map +0 -1
  500. package/dist/modules/order/accounting.js.map +0 -1
  501. package/dist/modules/order/async_lock.d.ts.map +0 -1
  502. package/dist/modules/order/async_lock.js.map +0 -1
  503. package/dist/modules/order/export.d.ts.map +0 -1
  504. package/dist/modules/order/export.js.map +0 -1
  505. package/dist/modules/order/format.d.ts.map +0 -1
  506. package/dist/modules/order/format.js.map +0 -1
  507. package/dist/modules/order/grid.d.ts.map +0 -1
  508. package/dist/modules/order/grid.js.map +0 -1
  509. package/dist/modules/order/grid_reconcile.d.ts.map +0 -1
  510. package/dist/modules/order/grid_reconcile.js.map +0 -1
  511. package/dist/modules/order/grid_reconcile_internal.d.ts.map +0 -1
  512. package/dist/modules/order/grid_reconcile_internal.js.map +0 -1
  513. package/dist/modules/order/index.d.ts.map +0 -1
  514. package/dist/modules/order/index.js.map +0 -1
  515. package/dist/modules/order/logger.d.ts.map +0 -1
  516. package/dist/modules/order/logger.js.map +0 -1
  517. package/dist/modules/order/logger_state.d.ts.map +0 -1
  518. package/dist/modules/order/logger_state.js.map +0 -1
  519. package/dist/modules/order/manager.d.ts.map +0 -1
  520. package/dist/modules/order/manager.js.map +0 -1
  521. package/dist/modules/order/processed_fill_store.d.ts.map +0 -1
  522. package/dist/modules/order/processed_fill_store.js.map +0 -1
  523. package/dist/modules/order/strategy.d.ts.map +0 -1
  524. package/dist/modules/order/strategy.js.map +0 -1
  525. package/dist/modules/order/sync_engine.d.ts.map +0 -1
  526. package/dist/modules/order/sync_engine.js.map +0 -1
  527. package/dist/modules/order/utils/math.d.ts.map +0 -1
  528. package/dist/modules/order/utils/math.js.map +0 -1
  529. package/dist/modules/order/utils/order.d.ts.map +0 -1
  530. package/dist/modules/order/utils/order.js.map +0 -1
  531. package/dist/modules/order/utils/slot.d.ts.map +0 -1
  532. package/dist/modules/order/utils/slot.js.map +0 -1
  533. package/dist/modules/order/utils/system.d.ts.map +0 -1
  534. package/dist/modules/order/utils/system.js.map +0 -1
  535. package/dist/modules/order/utils/timeout.d.ts.map +0 -1
  536. package/dist/modules/order/utils/timeout.js.map +0 -1
  537. package/dist/modules/order/utils/validate.d.ts.map +0 -1
  538. package/dist/modules/order/utils/validate.js.map +0 -1
  539. package/dist/modules/order/utils/withPoolRef.d.ts.map +0 -1
  540. package/dist/modules/order/utils/withPoolRef.js.map +0 -1
  541. package/dist/modules/order/working_grid.d.ts.map +0 -1
  542. package/dist/modules/order/working_grid.js.map +0 -1
  543. package/dist/modules/path_api.d.ts.map +0 -1
  544. package/dist/modules/path_api.js.map +0 -1
  545. package/dist/modules/paths.d.ts.map +0 -1
  546. package/dist/modules/paths.js.map +0 -1
  547. package/dist/modules/process_discovery.d.ts.map +0 -1
  548. package/dist/modules/process_discovery.js.map +0 -1
  549. package/dist/modules/runtime.d.ts.map +0 -1
  550. package/dist/modules/runtime.js.map +0 -1
  551. package/dist/modules/runtime_settings.d.ts.map +0 -1
  552. package/dist/modules/runtime_settings.js.map +0 -1
  553. package/dist/modules/settings_merge.d.ts.map +0 -1
  554. package/dist/modules/settings_merge.js.map +0 -1
  555. package/dist/modules/socket_json_client.d.ts.map +0 -1
  556. package/dist/modules/socket_json_client.js.map +0 -1
  557. package/dist/modules/storage/browser_adapter.d.ts.map +0 -1
  558. package/dist/modules/storage/browser_adapter.js.map +0 -1
  559. package/dist/modules/storage/index.d.ts.map +0 -1
  560. package/dist/modules/storage/index.js.map +0 -1
  561. package/dist/modules/storage/node_adapter.d.ts.map +0 -1
  562. package/dist/modules/storage/node_adapter.js.map +0 -1
  563. package/dist/modules/storage/types.d.ts.map +0 -1
  564. package/dist/modules/storage/types.js.map +0 -1
  565. package/dist/modules/types.d.ts.map +0 -1
  566. package/dist/modules/types.js.map +0 -1
  567. package/dist/modules/utils/base58check.d.ts.map +0 -1
  568. package/dist/modules/utils/base58check.js.map +0 -1
  569. package/dist/modules/utils/build_dir.d.ts.map +0 -1
  570. package/dist/modules/utils/build_dir.js.map +0 -1
  571. package/dist/modules/utils/chain_logs.d.ts.map +0 -1
  572. package/dist/modules/utils/chain_logs.js.map +0 -1
  573. package/dist/modules/utils/errors.d.ts.map +0 -1
  574. package/dist/modules/utils/errors.js.map +0 -1
  575. package/dist/modules/utils/sanitize_key.d.ts.map +0 -1
  576. package/dist/modules/utils/sanitize_key.js.map +0 -1
  577. package/dist/modules/utils/text_width.d.ts.map +0 -1
  578. package/dist/modules/utils/text_width.js.map +0 -1
  579. package/dist/modules/validate_profiles.d.ts.map +0 -1
  580. package/dist/modules/validate_profiles.js.map +0 -1
  581. package/dist/pm2.d.ts.map +0 -1
  582. package/dist/pm2.js.map +0 -1
  583. package/dist/scripts/analyze-credit.d.ts.map +0 -1
  584. package/dist/scripts/analyze-credit.js.map +0 -1
  585. package/dist/scripts/analyze-git.d.ts.map +0 -1
  586. package/dist/scripts/analyze-git.js.map +0 -1
  587. package/dist/scripts/analyze-orders.d.ts.map +0 -1
  588. package/dist/scripts/analyze-orders.js.map +0 -1
  589. package/dist/scripts/chart_command.d.ts.map +0 -1
  590. package/dist/scripts/chart_command.js.map +0 -1
  591. package/dist/scripts/diagnose-kibana-candles.d.ts.map +0 -1
  592. package/dist/scripts/diagnose-kibana-candles.js.map +0 -1
  593. package/dist/scripts/diagnose-pool-history.d.ts.map +0 -1
  594. package/dist/scripts/diagnose-pool-history.js.map +0 -1
  595. package/dist/scripts/divergence-calc.d.ts.map +0 -1
  596. package/dist/scripts/divergence-calc.js.map +0 -1
  597. package/dist/scripts/dw.d.ts.map +0 -1
  598. package/dist/scripts/dw.js.map +0 -1
  599. package/dist/scripts/generate_lp_chart.d.ts.map +0 -1
  600. package/dist/scripts/generate_lp_chart.js.map +0 -1
  601. package/dist/scripts/generate_mainnet_corpus_report.d.ts.map +0 -1
  602. package/dist/scripts/generate_mainnet_corpus_report.js.map +0 -1
  603. package/dist/scripts/native_release_gates.d.ts.map +0 -1
  604. package/dist/scripts/native_release_gates.js.map +0 -1
  605. package/dist/scripts/print_grid.d.ts.map +0 -1
  606. package/dist/scripts/print_grid.js.map +0 -1
  607. package/dist/scripts/run-tests.d.ts.map +0 -1
  608. package/dist/scripts/run-tests.js.map +0 -1
  609. package/dist/scripts/runner.d.ts.map +0 -1
  610. package/dist/scripts/runner.js.map +0 -1
  611. package/dist/scripts/sync-version.d.ts.map +0 -1
  612. package/dist/scripts/sync-version.js.map +0 -1
  613. package/dist/scripts/test-credit-renewal.d.ts.map +0 -1
  614. package/dist/scripts/test-credit-renewal.js.map +0 -1
  615. package/dist/scripts/tv.d.ts.map +0 -1
  616. package/dist/scripts/tv.js.map +0 -1
  617. package/dist/scripts/update.d.ts.map +0 -1
  618. package/dist/scripts/update.js.map +0 -1
  619. package/dist/scripts/update_dist_freshness.d.ts.map +0 -1
  620. package/dist/scripts/update_dist_freshness.js.map +0 -1
  621. package/dist/scripts/validate_bots.d.ts.map +0 -1
  622. package/dist/scripts/validate_bots.js.map +0 -1
  623. package/dist/scripts/verify-browser-bundle.d.ts.map +0 -1
  624. package/dist/scripts/verify-browser-bundle.js.map +0 -1
  625. package/dist/unlock.d.ts.map +0 -1
  626. package/dist/unlock.js.map +0 -1
package/docs/WORKFLOW.md CHANGED
@@ -209,7 +209,7 @@ DEXBot2 runs as a **monolithic daemon** (`dexbot start`). This is the production
209
209
  recommended mode:
210
210
 
211
211
  - **Single process** — no PM2, no separate credential daemon management
212
- - **Auto-update** — detects new releases, builds, and restarts cleanly
212
+ - **Optional auto-update** — `dexbot update` (or `UPDATER.ACTIVE` in general settings, **default off**) pulls, builds and restarts cleanly; by default the bot only *reports* that a newer release exists
213
213
  - **Crash restart** — background mode re-spawns on failure
214
214
  - **Per-bot log files** — each bot logs to `<profiles>/logs/<bot>.log` (`~/.config/dexbot2/profiles/logs` by default)
215
215
  - **Built-in daemon** — the credential daemon is managed internally
@@ -260,12 +260,23 @@ the canonical name is preferred in scripts and docs.
260
260
  | `dexbot reload` | `reloadall` | Reload the monolithic runtime without touching the credential daemon (unlock mode) |
261
261
  | `dexbot restart` | `restartall` | Restart the monolithic runtime (unlock mode, re-unlocks credential daemon) |
262
262
  | `dexbot delete` | — | Shut down and clean up the monolithic runtime (unlock mode) |
263
- | `dexbot clear` | — | Remove all log files from the logs directory (`<profiles>/logs`) |
264
- | `dexbot clear-orders` | — | Remove all persisted order files (`<profiles>/orders`) |
265
- | `dexbot clear-market-adapter` | — | Remove market adapter data, state, and logs |
266
- | `dexbot clear-all` | — | Remove orders, logs, market adapter, and claw files (all of the above) |
263
+ | `dexbot clear` | — | Delete `*.log`, rotated `*.log.*` and `*.jsonl*` from the logs directory (`<profiles>/logs`) |
264
+ | `dexbot clear-orders` | — | Delete all persisted order files (`<profiles>/orders`); grids regenerate on next start |
265
+ | `dexbot clear-market-adapter` | — | Delete market adapter data, state (incl. `market_adapter.lock`), and adapter logs |
266
+ | `dexbot clear-all` | — | Delete orders, logs, market adapter, and claw data (all of the above) |
267
267
  | `dexbot help` | — | Print the full CLI reference (grouped by Runtime/Trading/Config/Analysis/Files) |
268
268
 
269
+ > ⚠️ **The `clear*` commands are offline-only** — stop the runtime first
270
+ > (`dexbot stop` / `dexbot pm2 stop all`). They detect a live runtime (pid files
271
+ > + this install's online PM2 apps) and warn, but the warning is advisory: the
272
+ > deletion still runs, a live bot re-creates the state within seconds, and open
273
+ > log FDs keep the disk space until it restarts.
274
+ >
275
+ > `clear*` never touches config — `bots.json`, `keys.json`, the settings files and
276
+ > `credit_runtime/` survive. `clear` / `clear-all` do delete the credential audit
277
+ > trail `logs/daemon-audit.jsonl` (and its rotated siblings) along with the rest
278
+ > of the logs; the preview names it explicitly.
279
+
269
280
  ## NPM Scripts for Branch Synchronization
270
281
 
271
282
  The following npm scripts provide safe, automated branch synchronization:
@@ -292,6 +292,33 @@ Pair-specific AMA profiles live in `profiles/market_profiles.json`:
292
292
  }
293
293
  ```
294
294
 
295
+ ## Off-Hour Idle Behavior
296
+
297
+ The adapter only has work once per closed candle, so it stays quiet in between:
298
+
299
+ | Phase | Behavior |
300
+ |-------|----------|
301
+ | Startup | **Sleep-first, before any connection.** A respawned daemon checks whether every active AMA bot already consumed the newest closed candle; if so it sleeps to the next `pollSeconds` boundary (default 3600) without opening a socket, otherwise a catch-up cycle runs immediately. |
302
+ | Per bot, per cycle | **Closed-bucket gate before any fetch.** If the bot already consumed the newest closed bucket and its candle cache covers it (right source, no unresolved gaps, warmup target met), the bot is skipped before the native overlap fetch, the Kibana stale-tail check, and the candle re-serialize. |
303
+ | Between cycles | The BitShares socket is torn down after every cycle; the process sleeps with only an unref'd lock heartbeat. |
304
+
305
+ Both gates fail **open**: any input they cannot evaluate — fresh or unusable state, an interval that differs from the poll cadence (e.g. 2h candles polled hourly), a marker ahead of the clock (clock skew), an active bot with no row or no consumed marker (bootstrap owed), a bot whose last cycle left repair outstanding (`unresolvedGapCount > 0`, or `candleCount < rawKeepCount`, including an unknown count next to a known target) — runs the full cycle instead. Per-bot verdicts are never aggregated, so one lagging bot triggers a catch-up for everyone, and the veto is logged with its reason and bot keys:
306
+
307
+ ```
308
+ Startup: running a catch-up cycle now — no_state_row [broken-bot].
309
+ ```
310
+
311
+ Only bots the adapter would actually process are in scope, so a removed bot's leftover state row cannot keep the daemon awake. `kibanaBackfillCount`/`kibanaGapRepairCount` are deliberately ignored: they are action counts from a cycle that already applied its repair, not owed work.
312
+
313
+ Two deliberate trade-offs:
314
+
315
+ - An active bot that can *never* write state (unresolvable market, persistent pre-persist failure) disables the startup sleep for the whole daemon indefinitely — fail-safe by design, since healthy bots still take the per-bot skip; fixing or deactivating the bot restores the sleep.
316
+ - A config change made *after* the last cycle (e.g. a grown AMA window) waits for the next boundary. That backfill is bounded by one poll period, and no candle can close while the adapter sleeps, so no market value is ever late.
317
+
318
+ One-shot entry points (`--once`, and `runOnceForAma` behind `ama_signal_runner`) always run a full cycle — they exist to produce a computed AMA on demand, not a state-only "skipped" record with null prices.
319
+
320
+ Skipped work is visible in state: skipped bots record `lastCycleSource: "off-hour-skip"` with a fresh `lastCycleAt`, so monitoring can tell an idle-by-design adapter from a dead process. A skip record is a last-known snapshot, not an epoch reset: `amaPrice`, `amaCenterPrice`, `lastCandleTs` and the other data fields keep the values from the last full cycle, and only `lastCycleSource`/`lastCycleAt`/`pendingClosedCandle`/`lastTriggerSuppressedReason` are refreshed. Between-cycle consumers therefore read the most recent computed values rather than a hole.
321
+
295
322
  ## Live Writes and Dry-Run
296
323
 
297
324
  The whitelist controls what the adapter may write. Non-whitelisted bots are
@@ -834,7 +861,7 @@ closed 1h candles.
834
861
 
835
862
  #### Shared Month-Shard Cache and Fetch Robustness
836
863
 
837
- Pool, book, and feed candle fetches share one cache entry point (`runCachedWindows` in `market_adapter/inputs/window_cache.ts`): candles live in fixed calendar-month shards (`<base>.shard_YYYY-MM.json`, UTC) whose names never shift, so a run loads only the shards overlapping its requested range, queries only genuinely missing buckets plus a bounded 48h tail refresh, and rewrites only shards that gained buckets or query coverage — pure-reuse runs perform zero writes and zero deletes. Shard metas record the ranges actually queried (`meta.queriedRanges`, monotonically unioned). A missing range is pruned only when recorded query coverage genuinely covers it — the absence of local buckets alone never certifies history as empty. Partial windows merge into the run output but are never persisted. Stable month shards are the only supported cache format; obsolete run-relative cache files are ignored. Every range fetch runs through `fetchRangeWithRetry` (per-range attempts + linear backoff + abort-signal timeout; the LP path keeps a 4-attempt budget), one-shot Kibana queries retry transient errors (3 attempts), paged fetchers cap at `kibanaMaxPages` (500), and bidirectional fetches tolerate a one-direction failure.
864
+ Pool, book, and feed candle fetches share one cache entry point (`runCachedWindows` in `market_adapter/inputs/window_cache.ts`): candles live in fixed calendar-month shards (`<base>.shard_YYYY-MM.json`, UTC) whose names never shift, so a run loads only the shards overlapping its requested range, queries only genuinely missing buckets plus a bounded tail refresh, and rewrites only shards that gained buckets or query coverage — pure-reuse runs perform zero writes and zero deletes. Shard metas record the ranges actually queried (`meta.queriedRanges`, monotonically unioned) together with `at`, the time each query ran; spans merge only when they assert the same verification time, so per-bucket freshness stays exact. A missing range is pruned only when recorded query coverage genuinely covers it — the absence of local buckets alone never certifies history as empty — and only once the range ended more than `GAP_SETTLE_HORIZON_MS` ago, judged per gap rather than per window (a month-old gap at the leading edge of the newest window is as settled as one in a fully past window). The tail window re-queries only buckets that no query has seen `TAIL_SETTLE_LAG_MS` after they closed (`settleCoverage`), so a rerun costs ~lag+elapsed hours instead of a fixed 48h, and the refresh never reaches back past `TAIL_REFRESH_HOURS` (an unsettled bucket must be refreshed because index lag is still open, but a coverage hole older than 48h is past any plausible lag and must not drag the boundary back weeks); caches without `at` fall back to that fixed window. Clusters of gaps within `GAP_MERGE_TOLERANCE_BUCKETS` collapse into one query, and the sub-range path is bounded by merged span hours rather than gap count, so one extra small hole can no longer escalate a run to a full-window fetch. Because spans merge only on an identical `at`, a shard gains one span per re-verifying run; the persisted list is capped at `MAX_COVERAGE_SPANS` by dropping the oldest spans, which can never invent emptiness (it can only make those buckets look unsettled, bounded by the same 48h ceiling). A run that re-verifies the tail therefore rewrites that shard even when the candles come back identical — the moved verification time is the news, and skipping the write would throw it away; pure-reuse runs still write nothing. Partial windows merge into the run output but are never persisted. Stable month shards are the only supported cache format; obsolete run-relative cache files are ignored. Every range fetch runs through `fetchRangeWithRetry` (per-range attempts + linear backoff + abort-signal timeout; the LP path keeps a 4-attempt budget), one-shot Kibana queries retry transient errors (3 attempts), paged fetchers cap at `kibanaMaxPages` (500), and bidirectional fetches tolerate a one-direction failure.
838
865
 
839
866
  #### AMA Warmup Window — Why Candle Length Matters
840
867
 
@@ -980,6 +1007,7 @@ Important fields in `market_adapter/state/market_adapter_state.json`:
980
1007
  | Field | Meaning |
981
1008
  |-------|---------|
982
1009
  | `meta.updatedAt` | Last completed adapter cycle (ISO timestamp) |
1010
+ | `lastCycleSource` | How the last cycle ended the bot: a fetch source (`native-incremental-overlap`, `kibana-backfill`, …) or `off-hour-skip` when the closed-candle gate skipped the work |
983
1011
  | `meta.metrics.processedBots` | Number of bots evaluated this cycle |
984
1012
  | `meta.metrics.durationMs` | Cycle wall-clock duration in milliseconds |
985
1013
  | `lastCycleAt` | Last cycle timestamp for a bot |
package/modules/README.md CHANGED
@@ -28,10 +28,16 @@ modules/
28
28
  ├── dexbot_state_recovery.ts state recovery after restart
29
29
  ├── bitshares_client.ts blockchain connection manager
30
30
  ├── node_manager.ts multi-node health and failover
31
+ ├── node_connect_policy.ts node connection/failover policy
31
32
  ├── chain_orders.ts blockchain order operations
32
33
  ├── account_orders.ts account order queries
33
34
  ├── credit_runtime.ts MPA/credit deal workflow executor
35
+ ├── credit_pricing.ts credit/debt pricing helpers
34
36
  ├── cr_planner.ts collateral-ratio planning
37
+ ├── version_notice.ts passive npm-registry version check + status line
38
+ ├── cli_start_onboarding.ts first-run setup routing for `dexbot start`
39
+ ├── cli_start_output.ts launcher notice formatting
40
+ ├── cli_colors.ts shared CLI color helpers
35
41
  ├── credential_runtime.ts credential daemon lifecycle
36
42
  ├── credential_policy.ts signing policy validation
37
43
  ├── credential_session_cache.ts encrypted session cache
@@ -48,6 +54,7 @@ modules/
48
54
  ├── authority_resolver.ts signing key resolution
49
55
  ├── key_store.ts key storage (node-only)
50
56
  ├── process_discovery.ts Linux /proc/* filesystem reads
57
+ ├── grid_price_source.ts grid center price source resolution
51
58
  ├── validate_profiles.ts profile validation
52
59
  ├── general_settings.ts global settings loader
53
60
  ├── bot_settings.ts per-bot settings loader
@@ -86,6 +93,7 @@ modules/
86
93
  │ ├── strategy.ts grid rebalancing, consolidation, rotation
87
94
  │ ├── accounting.ts fund tracking, fee accounting
88
95
  │ ├── sync_engine.ts blockchain sync, fill detection, reconciliation
96
+ │ ├── genesis_policy.ts missing-ladder refusal + rebuild/halt policy ([doc](../docs/GRID_PRICE_INVARIANT.md))
89
97
  │ ├── grid_reconcile.ts startup grid reconciliation ([doc](../docs/GRID_RECONCILE.md))
90
98
  │ ├── grid_reconcile_internal.ts internal grid reconciliation helpers
91
99
  │ ├── index.ts barrel export
@@ -96,6 +104,13 @@ modules/
96
104
  │ ├── format.ts numeric formatting helpers
97
105
  │ ├── export.ts trade history export
98
106
  │ └── utils/ math, order predicates, validation, system helpers
107
+ │ ├── math.ts precision conversion, RMS divergence, rail geometry
108
+ │ ├── order.ts order state predicates, grid indexing, reconciliation helpers
109
+ │ ├── slot.ts slot/price-level helpers
110
+ │ ├── system.ts system utilities, price derivation, fill deduplication
111
+ │ ├── timeout.ts bounded wait helpers
112
+ │ ├── validate.ts order validation, grid reconciliation, COW action building
113
+ │ └── withPoolRef.ts startPrice mode + poolRef resolution
99
114
  │
100
115
  ├── launcher/ process lifecycle (PM2, unlock, isolated)
101
116
  │ ├── bot_supervisor.ts per-bot process supervision
@@ -128,8 +143,10 @@ modules/
128
143
  └── utils/
129
144
  ├── base58check.ts Base58Check encoding
130
145
  ├── build_dir.ts BUILD_DIR constant helper
146
+ ├── chain_logs.ts shared chain log helpers
131
147
  ├── errors.ts getErrorMessage helper
132
- └── sanitize_key.ts shared sanitizeKey helper
148
+ ├── sanitize_key.ts shared sanitizeKey helper
149
+ └── text_width.ts display-width-aware text measurement (CJK/emoji tables)
133
150
  ```
134
151
 
135
152
  ## Key Relationships
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dexbot",
3
- "version": "1.6.7",
3
+ "version": "1.6.9",
4
4
  "description": "The first open source trading bot with zero runtime dependencies and a fully adaptive market making strategy.",
5
5
  "main": "dist/modules/dexbot_class.js",
6
6
  "exports": {
@@ -15,6 +15,8 @@
15
15
  "files": [
16
16
  "dist",
17
17
  "!dist/analysis/legacy",
18
+ "!dist/**/*.js.map",
19
+ "!dist/**/*.d.ts.map",
18
20
  "ecosystem.config.cjs",
19
21
  "scripts/bots",
20
22
  "scripts/clean-dist.js",
@@ -37,6 +39,7 @@
37
39
  "scripts/unlock",
38
40
  "scripts/update.js",
39
41
  "claw",
42
+ "!claw/tests",
40
43
  "docs/BITSHARES_ONBOARDING.md",
41
44
  "docs/CREDENTIAL_SECURITY.md",
42
45
  "docs/GRID_RECALCULATION.md",
@@ -57,9 +60,13 @@
57
60
  "docs/docker.md",
58
61
  "market_adapter/README.md",
59
62
  "modules/README.md",
60
- "analysis",
61
- "!analysis/charts",
62
- "!analysis/legacy",
63
+ "analysis/README.md",
64
+ "analysis/ama_fitting/README.md",
65
+ "analysis/bot_fitting/README.md",
66
+ "analysis/tradingview/README.md",
67
+ "analysis/trend_detection/README.md",
68
+ "analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md",
69
+ "analysis/uplot",
63
70
  "tests/README.md",
64
71
  "CHANGELOG.md",
65
72
  "README.md",
@@ -98,7 +105,7 @@
98
105
  "native:ecc-invariants": "npm run build && npm run build:tests && node dist/tests/test_native_ecc.js",
99
106
  "native:corpus": "npm run build && node dist/scripts/generate_mainnet_corpus_report.js",
100
107
  "test:credit-renewal": "npm run build && node dist/scripts/test-credit-renewal.js",
101
- "test:legacy": "npm run build && npm run build:tests && node dist/analysis/legacy/tests/test_derivative_chart.js && node dist/analysis/legacy/tests/test_derivative_entry_bias.js && node dist/analysis/legacy/tests/test_derivative_momentum_gate.js && node dist/analysis/legacy/tests/test_derivative_signal_trap_regression.js",
108
+ "test:legacy": "npm run build && npm run build:tests && node dist/analysis/legacy/tests/test_derivative_chart.js && node dist/analysis/legacy/tests/test_derivative_entry_bias.js && node dist/analysis/legacy/tests/test_derivative_momentum_gate.js && node dist/analysis/legacy/tests/test_derivative_signal_trap_regression.js && node dist/analysis/legacy/tests/test_kalman_trend.js && node dist/analysis/legacy/tests/test_kalman_velocity_smoothing.js",
102
109
  "version:sync": "npm run build && node dist/scripts/sync-version.js",
103
110
  "version:check": "npm run build && node dist/scripts/sync-version.js --check",
104
111
  "verify:browser-bundle": "npm run build && node dist/scripts/verify-browser-bundle.js",
@@ -165,6 +172,7 @@
165
172
  "./dist/modules/credential_runtime.js": false,
166
173
  "./dist/modules/dexbot_credential_client.js": false,
167
174
  "./dist/modules/node_health_cache.js": false,
175
+ "./dist/modules/version_notice.js": false,
168
176
  "./dist/modules/daemon_node_health.js": false,
169
177
  "./dist/modules/storage/node_adapter.js": false,
170
178
  "./dist/modules/key_store.js": false,
package/scripts/README.md CHANGED
@@ -32,12 +32,37 @@ Env overrides: `DEXBOT_PROFILE_ROOT`, `DEXBOT_MARKET_ADAPTER_DATA_DIR`,
32
32
  `dexbot` CLI, the resolved runtime dirs are passed automatically, so the CLI
33
33
  always clears the same dirs the runtime uses.
34
34
 
35
+ **Two behaviors are shared by all four `clear-*` scripts** (helpers in
36
+ `scripts/lib/dexbot-paths.sh`):
37
+
38
+ - **Advisory live-runtime warning.** Before the confirmation prompt, the scripts
39
+ read `<profiles>/{monolithic,monolithic-bot,monolithic-cred}.pid` and — only when
40
+ the PM2 daemon is already up, so a cleanup script can never spawn one — the
41
+ online PM2 apps belonging to this install (`pm2 jlist`, filtered to
42
+ `cwd`/`script_path` under the project or profiles root). If anything is found, a
43
+ `YELLOW` warning is printed. It is **advisory**: the prompt still runs, the
44
+ deletion still happens, and the exit code is unchanged. The reason it matters:
45
+ a live bot re-persists its grid within seconds, a live adapter rewrites its
46
+ state file *and* `market_adapter.lock` (a deleted lock lets a second adapter
47
+ start), and open log FDs mean the disk space is only reclaimed on restart. Stop
48
+ first with `dexbot stop` / `dexbot pm2 stop all`.
49
+ - **One log predicate.** Every `find` over the logs directory goes through
50
+ `log_files` (`*.log`, rotated `*.log.*`, `*.jsonl*`), so the preview, the count,
51
+ the delete and the verification can never disagree. `*.jsonl*` also sweeps the
52
+ credential audit trail `logs/daemon-audit.jsonl` **and** its rotated
53
+ `daemon-audit.jsonl.1` siblings, which match no other pattern — they used to
54
+ survive a "clear" and leave a partial wipe. The audit trail is deleted with
55
+ everything else, with no extra prompt and no opt-in flag; it is only named in
56
+ the preview (`Includes the credential audit trail: daemon-audit.jsonl*`) so the
57
+ deletion is never a surprise.
58
+
35
59
  ### Wipe Logs
36
60
  **File:** `clear-logs.sh`
37
61
  **Purpose:** Delete all bot `.log` and `.jsonl` files, including `profiles/logs/market_adapter.log`.
38
62
  ```bash
39
63
  # IRREVERSIBLE: Deletes all files in profiles/logs/*.log and *.jsonl, including market_adapter.log
40
- # Prompts for confirmation before deleting.
64
+ # (also the credential audit trail daemon-audit.jsonl and its rotated siblings)
65
+ # Prompts for confirmation before deleting; warns first if a runtime is live.
41
66
  bash scripts/clear-logs.sh
42
67
  ```
43
68
 
@@ -67,7 +92,8 @@ bash scripts/clear-market-adapter.sh
67
92
  # IRREVERSIBLE: Deletes profiles/orders/*, profiles/logs/*.{log,jsonl},
68
93
  # market_adapter/{data,state}/*, and claw data (positions.json, watcher-health.json, memu/) under
69
94
  # <profiles>/claw/data (or <repo>/claw/data for source checkouts).
70
- # Prompts for confirmation before deleting.
95
+ # Also deletes daemon-audit.jsonl and its rotated siblings.
96
+ # Prompts for confirmation before deleting; warns first if a runtime is live.
71
97
  bash scripts/clear-all.sh
72
98
  ```
73
99
 
@@ -4,6 +4,10 @@
4
4
  # This combines the behavior of clear-orders.sh, clear-logs.sh, and
5
5
  # clear-market-adapter.sh while using a single confirmation prompt. It also
6
6
  # removes claw data (positions, watcher health, memu) from <profiles>/claw/data.
7
+ # That includes the credential daemon's audit trail (daemon-audit.jsonl and its
8
+ # rotated siblings), which is named in the preview so the wipe is never a surprise.
9
+ # Advisory only: if a runtime is detected, a warning is printed (the deletion
10
+ # still runs — stop with `dexbot stop` first if you want it to take effect).
7
11
  # Usage: ./scripts/clear-all.sh or bash scripts/clear-all.sh
8
12
 
9
13
  set -e
@@ -66,7 +70,7 @@ else
66
70
  fi
67
71
 
68
72
  if [ -d "$LOGS_DIR" ]; then
69
- LOG_COUNT=$(find "$LOGS_DIR" -type f \( -name "*.log" -o -name "*.log.*" -o -name "*.jsonl" \) 2>/dev/null | wc -l)
73
+ LOG_COUNT=$(log_files "$LOGS_DIR" | wc -l)
70
74
  else
71
75
  log_warning "Logs directory does not exist: $LOGS_DIR"
72
76
  fi
@@ -111,7 +115,7 @@ fi
111
115
 
112
116
  if [ "$LOG_COUNT" -gt 0 ]; then
113
117
  log_info "Log files to be deleted:"
114
- find "$LOGS_DIR" -type f \( -name "*.log" -o -name "*.log.*" -o -name "*.jsonl" \) 2>/dev/null | while read -r file; do
118
+ log_files "$LOGS_DIR" | while read -r file; do
115
119
  SIZE=$(du -h "$file" | cut -f1)
116
120
  echo -e "${BLUE} -${NC} $(realpath --relative-to="$PROJECT_ROOT" "$file") ($SIZE)"
117
121
  done
@@ -145,6 +149,11 @@ if [ "$CLAW_COUNT" -gt 0 ]; then
145
149
  log_info ""
146
150
  fi
147
151
 
152
+ # Warn (advisory) when a live runtime would undo the deletion
153
+ warn_if_runtime_running
154
+ note_audit_included "$LOGS_DIR"
155
+ log_info ""
156
+
148
157
  # Ask for confirmation
149
158
  read -p "Delete all listed files? (y/n): " -r CONFIRM
150
159
 
@@ -159,7 +168,7 @@ if [ "$ORDER_COUNT" -gt 0 ]; then
159
168
  fi
160
169
 
161
170
  if [ "$LOG_COUNT" -gt 0 ]; then
162
- find "$LOGS_DIR" -type f \( -name "*.log" -o -name "*.log.*" -o -name "*.jsonl" \) 2>/dev/null -delete
171
+ log_files "$LOGS_DIR" | while read -r file; do rm -f "$file"; done
163
172
  fi
164
173
 
165
174
  if [ "$MA_DATA_COUNT" -gt 0 ]; then
@@ -188,7 +197,7 @@ if [ -d "$ORDERS_DIR" ]; then
188
197
  fi
189
198
 
190
199
  if [ -d "$LOGS_DIR" ]; then
191
- REMAINING_LOGS=$(find "$LOGS_DIR" -type f \( -name "*.log" -o -name "*.log.*" -o -name "*.jsonl" \) 2>/dev/null | wc -l)
200
+ REMAINING_LOGS=$(log_files "$LOGS_DIR" | wc -l)
192
201
  fi
193
202
 
194
203
  if [ -d "$MA_DATA_DIR" ]; then
@@ -2,6 +2,10 @@
2
2
  # Clear all log files from profiles/logs directory
3
3
  #
4
4
  # This script safely removes all log files while preserving the logs directory structure.
5
+ # That includes the credential daemon's audit trail (daemon-audit.jsonl and its
6
+ # rotated siblings), which is named in the preview so the wipe is never a surprise.
7
+ # Advisory only: if a runtime is detected, a warning is printed (the deletion still
8
+ # runs — stop with `dexbot stop` first if you want it to take effect).
5
9
  # Usage: ./scripts/clear-logs.sh or bash scripts/clear-logs.sh
6
10
 
7
11
  set -e
@@ -49,7 +53,7 @@ if [ ! -d "$LOGS_DIR" ]; then
49
53
  fi
50
54
 
51
55
  # Count log files
52
- LOG_COUNT=$(find "$LOGS_DIR" -type f \( -name "*.log" -o -name "*.log.*" -o -name "*.jsonl" \) 2>/dev/null | wc -l)
56
+ LOG_COUNT=$(log_files "$LOGS_DIR" | wc -l)
53
57
 
54
58
  if [ "$LOG_COUNT" -eq 0 ]; then
55
59
  log_info "No log files found in $LOGS_DIR"
@@ -61,13 +65,18 @@ log_info ""
61
65
 
62
66
  # Show what will be deleted
63
67
  log_info "Log files to be deleted:"
64
- find "$LOGS_DIR" -type f \( -name "*.log" -o -name "*.log.*" -o -name "*.jsonl" \) 2>/dev/null | while read file; do
68
+ log_files "$LOGS_DIR" | while read file; do
65
69
  SIZE=$(du -h "$file" | cut -f1)
66
70
  echo -e "${BLUE} -${NC} $(basename "$file") ($SIZE)"
67
71
  done
68
72
 
69
73
  log_info ""
70
74
 
75
+ # Warn (advisory) when a live runtime would undo the deletion
76
+ warn_if_runtime_running
77
+ note_audit_included "$LOGS_DIR"
78
+ log_info ""
79
+
71
80
  # Ask for confirmation
72
81
  read -p "Delete these log files? (y/n): " -r CONFIRM
73
82
 
@@ -77,11 +86,11 @@ if [ "$CONFIRM" != "y" ] && [ "$CONFIRM" != "Y" ]; then
77
86
  fi
78
87
 
79
88
  # Delete log files
80
- find "$LOGS_DIR" -type f \( -name "*.log" -o -name "*.log.*" -o -name "*.jsonl" \) 2>/dev/null -delete
89
+ log_files "$LOGS_DIR" | while read -r file; do rm -f "$file"; done
81
90
  DELETED=$?
82
91
 
83
92
  # Re-count to confirm
84
- REMAINING=$(find "$LOGS_DIR" -type f \( -name "*.log" -o -name "*.log.*" -o -name "*.jsonl" \) 2>/dev/null | wc -l)
93
+ REMAINING=$(log_files "$LOGS_DIR" | wc -l)
85
94
 
86
95
  log_info "=========================================="
87
96
  if [ "$REMAINING" -eq 0 ]; then
@@ -5,6 +5,9 @@
5
5
  # and market_adapter/state/, plus profiles/logs/market_adapter.log,
6
6
  # dexbot-adapter.log, and dexbot-adapter-error.log. The market
7
7
  # adapter will bootstrap fresh from Kibana and regenerate state on next run.
8
+ # Advisory only: if a runtime is detected, a warning is printed (the deletion still
9
+ # runs — stop with `dexbot stop` first, since a live adapter rewrites its state file
10
+ # and its market_adapter.lock, and a deleted lock lets a second adapter start).
8
11
  #
9
12
  # Usage: ./scripts/clear-market-adapter.sh or bash scripts/clear-market-adapter.sh
10
13
 
@@ -127,6 +130,9 @@ if [ "$LOG_COUNT" -gt 0 ]; then
127
130
  log_info ""
128
131
  fi
129
132
 
133
+ # Warn (advisory) when a live runtime would undo the deletion
134
+ warn_if_runtime_running
135
+
130
136
  # Ask for confirmation
131
137
  read -p "Delete all listed market adapter files? (y/n): " -r CONFIRM
132
138
 
@@ -4,6 +4,8 @@
4
4
  # This script safely removes all bot order state files while preserving the orders directory.
5
5
  # Use this to reset bot order grids and start fresh (clears cached order data).
6
6
  # WARNING: This will lose all persisted grid information. Bots will regenerate grids on next run.
7
+ # Advisory only: if a runtime is detected, a warning is printed (the deletion still
8
+ # runs — stop with `dexbot stop` first, since a running bot re-persists its grid).
7
9
  # Usage: ./scripts/clear-orders.sh or bash scripts/clear-orders.sh
8
10
 
9
11
  set -e
@@ -74,6 +76,9 @@ done
74
76
 
75
77
  log_info ""
76
78
 
79
+ # Warn (advisory) when a live runtime would undo the deletion
80
+ warn_if_runtime_running
81
+
77
82
  # Ask for confirmation
78
83
  read -p "Delete these order files? (y/n): " -r CONFIRM
79
84
 
@@ -11,6 +11,10 @@
11
11
  # source "$SCRIPT_DIR/lib/dexbot-paths.sh"
12
12
  #
13
13
  # Defines: PROFILE_ROOT, MA_DATA_DIR, MA_STATE_DIR, CLAW_DATA_DIR
14
+ #
15
+ # Also provides the advisory runtime-detection and log-predicate helpers used by
16
+ # the clear-* scripts: live_pid_from_file, runtime_processes,
17
+ # warn_if_runtime_running, log_files, note_audit_included.
14
18
 
15
19
  # Well-known files that mark a profiles dir as populated (any one suffices) —
16
20
  # mirrors PROFILE_STATE_MARKERS in modules/paths.ts. Not just bots.json, so a
@@ -121,3 +125,107 @@ elif [ "$PROFILE_ROOT" = "${PROJECT_ROOT}/profiles" ]; then
121
125
  else
122
126
  CLAW_DATA_DIR="${PROFILE_ROOT}/claw/data"
123
127
  fi
128
+
129
+ # ---------------------------------------------------------------------------
130
+ # Runtime detection (advisory only — never blocks, never changes exit codes)
131
+ #
132
+ # The clear-* scripts delete runtime state. When the runtime is up it re-creates
133
+ # that state within seconds (grid snapshots; adapter state *and* its lock) and
134
+ # keeps the deleted log files open, so the space is only reclaimed on restart.
135
+ # Detecting that here keeps the warning identical in every script.
136
+ #
137
+ # Deliberately side-effect free: liveness is read from pid files, and `pm2 jlist`
138
+ # is probed only when the PM2 daemon is already up — otherwise a cleanup script
139
+ # would spawn a daemon as a side effect. Mirrors the runtime locations in
140
+ # modules/paths.ts (MONOLITHIC_PID, MONOLITHIC_BOT_PID, MONOLITHIC_CRED_PID).
141
+ # ---------------------------------------------------------------------------
142
+
143
+ # Echo the pid recorded in $1 when that process is alive, nothing otherwise.
144
+ # A recycled pid can produce a false positive; the warning is advisory, so that
145
+ # is preferable to the cost of a full process-table scan.
146
+ live_pid_from_file() {
147
+ [ -f "$1" ] || return 0
148
+ _lpf_pid="$(tr -dc '0-9' < "$1" 2>/dev/null)"
149
+ [ -n "$_lpf_pid" ] || return 0
150
+ kill -0 "$_lpf_pid" 2>/dev/null || return 0
151
+ echo "$_lpf_pid"
152
+ }
153
+
154
+ # Echo one "<label> <pid>" line per live runtime process: the monolithic
155
+ # runtime's pid files first, then PM2 apps belonging to this install.
156
+ runtime_processes() {
157
+ for _rp_file in monolithic.pid monolithic-bot.pid monolithic-cred.pid; do
158
+ _rp_pid="$(live_pid_from_file "${PROFILE_ROOT}/${_rp_file}")"
159
+ if [ -n "$_rp_pid" ]; then
160
+ echo "${_rp_file} ${_rp_pid}"
161
+ fi
162
+ done
163
+
164
+ _rp_pm2_home="${PM2_HOME:-${HOME}/.pm2}"
165
+ _rp_pm2_pid="$(live_pid_from_file "${_rp_pm2_home}/pm2.pid")"
166
+ if [ -n "$_rp_pm2_pid" ] && command -v pm2 >/dev/null 2>&1; then
167
+ # Filter to online apps whose cwd/exec path is this install, so an
168
+ # unrelated PM2 daemon on the same host is not reported. `process.argv`
169
+ # after -e starts at index 1 (no script path is prepended).
170
+ pm2 jlist 2>/dev/null | node -e '
171
+ let raw = "";
172
+ process.stdin.on("data", (chunk) => { raw += chunk; }).on("end", () => {
173
+ let apps;
174
+ try { apps = JSON.parse(raw); } catch { process.exit(0); }
175
+ const roots = process.argv.slice(1).filter(Boolean);
176
+ for (const app of apps || []) {
177
+ const env = app.pm2_env || {};
178
+ if (env.status && env.status !== "online") continue;
179
+ const scope = env.cwd || env.pm_exec_path || "";
180
+ if (roots.some((root) => scope === root || scope.startsWith(root + "/"))) {
181
+ console.log("pm2:" + (app.name || "?") + " " + (app.pid || "?"));
182
+ }
183
+ }
184
+ });' "${PROJECT_ROOT}" "${PROFILE_ROOT}" 2>/dev/null || true
185
+ fi
186
+ }
187
+
188
+ # Print a warning when a live runtime is detected. Advisory: prints and returns,
189
+ # never prompts, never exits, never changes the script's exit code.
190
+ warn_if_runtime_running() {
191
+ _wirr_found="$(runtime_processes)"
192
+ [ -n "$_wirr_found" ] || return 0
193
+ if command -v log_warning >/dev/null 2>&1; then
194
+ log_warning "A DEXBot2 runtime appears to be RUNNING:"
195
+ echo "${_wirr_found}" | while read -r _wirr_line; do
196
+ log_warning " - ${_wirr_line}"
197
+ done
198
+ log_warning "The deletion below is unreliable while it runs: bots re-persist"
199
+ log_warning "their grids within seconds, the market adapter rewrites its state"
200
+ log_warning "file and lock, and open log handles keep the disk space until the"
201
+ log_warning "processes restart. Stop first: dexbot stop (or dexbot pm2 stop all)."
202
+ else
203
+ echo "WARNING: a DEXBot2 runtime appears to be running:" >&2
204
+ echo "${_wirr_found}" >&2
205
+ fi
206
+ }
207
+
208
+ # ---------------------------------------------------------------------------
209
+ # Log file predicate
210
+ #
211
+ # One predicate for every find over the logs directory, so the preview, the
212
+ # count, the delete and the verification can never disagree. `*.jsonl*` (not
213
+ # `*.jsonl`) so the credential daemon's rotated audit siblings
214
+ # (daemon-audit.jsonl.1) are wiped together with daemon-audit.jsonl — they match
215
+ # no other pattern, and leaving them behind would make "clear" a partial wipe.
216
+ # ---------------------------------------------------------------------------
217
+ log_files() {
218
+ find "$1" -type f \( -name "*.log" -o -name "*.log.*" -o -name "*.jsonl*" \) 2>/dev/null
219
+ }
220
+
221
+ # The audit trail is log content as far as these commands are concerned, so it is
222
+ # deleted with everything else — it is only named in the preview so the deletion
223
+ # is never a surprise. No extra prompt, no opt-in flag.
224
+ note_audit_included() {
225
+ [ -n "$(find "$1" -type f -name 'daemon-audit.jsonl*' 2>/dev/null | head -n 1)" ] || return 0
226
+ if command -v log_info >/dev/null 2>&1; then
227
+ log_info "Includes the credential audit trail: daemon-audit.jsonl*"
228
+ else
229
+ echo "Includes the credential audit trail: daemon-audit.jsonl*" >&2
230
+ fi
231
+ }
package/tests/README.md CHANGED
@@ -11,6 +11,9 @@ npm test
11
11
  # Run a single test file
12
12
  npm run build:tests
13
13
  node dist/tests/<file>.js
14
+
15
+ # Run the archived legacy suites (excluded from `npm test`)
16
+ npm run test:legacy
14
17
  ```
15
18
 
16
19
  ## Directory Layout
@@ -54,6 +57,10 @@ Price derivation, orderbook inspection, tolerance checks.
54
57
  AMA signal processing, price offset, bound clamping, signal gates.
55
58
  *Examples:* `test_market_adapter_logic.ts`, `test_market_adapter_service.ts`, `test_market_adapter_signal_gates.ts`, `test_market_adapter_integration_core.ts`
56
59
 
60
+ ### Analysis & Charting
61
+ Research/analysis tools: chart generators, backtests, and the grid-reset replay used by the TradingView exporter ([GRID_RECALCULATION.md](../docs/GRID_RECALCULATION.md)).
62
+ *Examples:* `test_grid_reset_sim.ts`, `test_tradingview_chart_storage_key.ts`, `test_backtest_bot_fitting_logic.ts`
63
+
57
64
  ### Order Management & Execution
58
65
  Order lifecycle, fill processing, trade history, batch execution.
59
66
  *Examples:* `test_open_orders.ts`, `test_fills.ts`, `test_fill_batch_chunking.ts`, `test_fill_replay_guards.ts`, `test_uncertain_broadcast.ts`
@@ -79,8 +86,8 @@ Credential management, daemon lifecycle, session caching, debt policy.
79
86
  *Examples:* `test_credential_daemon.ts`, `test_credential_runtime.ts`, `test_credential_session_cache.ts`, `test_credit_runtime.ts`
80
87
 
81
88
  ### PM2 & Process Management
82
- PM2 lifecycle, startup ordering, bot supervision.
83
- *Examples:* `test_pm2_logic.ts`, `test_pm2_main_output.ts`, `test_bot_supervisor.ts`, `test_unlock_main.ts`
89
+ PM2 lifecycle, startup ordering, bot supervision, launcher version reporting.
90
+ *Examples:* `test_pm2_logic.ts`, `test_pm2_main_output.ts`, `test_bot_supervisor.ts`, `test_unlock_main.ts`, `test_version_notice.ts`
84
91
 
85
92
  ### Diagnostics & Benchmarks
86
93
  Interactive tools and performance benchmarks (not part of CI).
@@ -124,10 +131,11 @@ Shared utility functions, precision handling, chain helpers.
124
131
  - Every emitted order's price must equal its slot's genesis level (`priceForSlot(idx, genesis)`); off-grid emissions are blocked, not counted
125
132
  - The guard itself plus the live batch wiring, escalation thresholds, and per-order stranded-hold clocks are each pinned and mutation-tested
126
133
  - Adoption keeps the slot's own level; `loadGrid` repairs a pre-existing off-grid slot price
134
+ - A snapshot with no usable ladder is refused at load (`MISSING_GENESIS_POLICY` rebuild/halt) and the sync entry refuses rather than falling back to a tolerance matcher
127
135
 
128
136
  **Reference:** [docs/GRID_PRICE_INVARIANT.md](../docs/GRID_PRICE_INVARIANT.md)
129
137
 
130
- **Examples:** `test_grid_price_invariant_guard.ts`, `test_grid_price_invariant_wiring.ts`, `test_grid_price_slot_invariant.ts`, `test_final_pivot_gate.ts`, `test_hold_and_center_guards.ts`, `test_sync_out_of_grid_defer.ts`
138
+ **Examples:** `test_grid_price_invariant_guard.ts`, `test_grid_price_invariant_wiring.ts`, `test_grid_price_slot_invariant.ts`, `test_final_pivot_gate.ts`, `test_hold_and_center_guards.ts`, `test_sync_out_of_grid_defer.ts`, `test_missing_genesis_policy.ts`, `test_last_fill_pivot_persistence.ts`
131
139
 
132
140
  ---
133
141