dexbot 1.4.10 → 1.4.12

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 (502) hide show
  1. package/README.md +6 -5
  2. package/dist/analysis/chart_utils.d.ts.map +1 -1
  3. package/dist/analysis/chart_utils.js +9 -18
  4. package/dist/analysis/chart_utils.js.map +1 -1
  5. package/dist/analysis/math_utils.d.ts.map +1 -1
  6. package/dist/analysis/math_utils.js +6 -16
  7. package/dist/analysis/math_utils.js.map +1 -1
  8. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts +1 -1
  9. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +1 -1
  10. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +31 -38
  11. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +1 -1
  12. package/dist/analysis/trend_detection/hurst_analyzer.js +7 -10
  13. package/dist/analysis/trend_detection/hurst_analyzer.js.map +1 -1
  14. package/dist/analysis/trend_detection/kalman_trend_analyzer.js +10 -14
  15. package/dist/analysis/trend_detection/kalman_trend_analyzer.js.map +1 -1
  16. package/dist/analysis/trend_detection/kalman_velocity_smoothing.js +10 -15
  17. package/dist/analysis/trend_detection/kalman_velocity_smoothing.js.map +1 -1
  18. package/dist/analysis/trend_detection/permutation_entropy_analyzer.js +7 -10
  19. package/dist/analysis/trend_detection/permutation_entropy_analyzer.js.map +1 -1
  20. package/dist/bot.d.ts.map +1 -1
  21. package/dist/bot.js +4 -12
  22. package/dist/bot.js.map +1 -1
  23. package/dist/credential-daemon.d.ts +0 -1
  24. package/dist/credential-daemon.d.ts.map +1 -1
  25. package/dist/credential-daemon.js +3 -123
  26. package/dist/credential-daemon.js.map +1 -1
  27. package/dist/dexbot.d.ts +0 -87
  28. package/dist/dexbot.d.ts.map +1 -1
  29. package/dist/dexbot.js +54 -23
  30. package/dist/dexbot.js.map +1 -1
  31. package/dist/market_adapter/ama_signal_runner.js +8 -9
  32. package/dist/market_adapter/ama_signal_runner.js.map +1 -1
  33. package/dist/market_adapter/candle_utils.js +1 -7
  34. package/dist/market_adapter/candle_utils.js.map +1 -1
  35. package/dist/market_adapter/core/asymmetric_bounds.js +1 -4
  36. package/dist/market_adapter/core/asymmetric_bounds.js.map +1 -1
  37. package/dist/market_adapter/core/config_normalizers.js +5 -9
  38. package/dist/market_adapter/core/config_normalizers.js.map +1 -1
  39. package/dist/market_adapter/core/kibana_candles.js +8 -15
  40. package/dist/market_adapter/core/kibana_candles.js.map +1 -1
  41. package/dist/market_adapter/core/kibana_client.js +7 -13
  42. package/dist/market_adapter/core/kibana_client.js.map +1 -1
  43. package/dist/market_adapter/core/kibana_market_candles.js +6 -12
  44. package/dist/market_adapter/core/kibana_market_candles.js.map +1 -1
  45. package/dist/market_adapter/core/market_adapter_service.d.ts +2 -0
  46. package/dist/market_adapter/core/market_adapter_service.d.ts.map +1 -1
  47. package/dist/market_adapter/core/market_adapter_service.js +100 -101
  48. package/dist/market_adapter/core/market_adapter_service.js.map +1 -1
  49. package/dist/market_adapter/core/strategies/ama.js +5 -10
  50. package/dist/market_adapter/core/strategies/ama.js.map +1 -1
  51. package/dist/market_adapter/core/strategies/ama_slope_model.js +21 -24
  52. package/dist/market_adapter/core/strategies/ama_slope_model.js.map +1 -1
  53. package/dist/market_adapter/core/strategies/atr/calculator.js +3 -5
  54. package/dist/market_adapter/core/strategies/atr/calculator.js.map +1 -1
  55. package/dist/market_adapter/core/strategies/collateral_manager.js +4 -6
  56. package/dist/market_adapter/core/strategies/collateral_manager.js.map +1 -1
  57. package/dist/market_adapter/core/strategies/regime_gate.js +15 -22
  58. package/dist/market_adapter/core/strategies/regime_gate.js.map +1 -1
  59. package/dist/market_adapter/index.d.ts +23 -23
  60. package/dist/market_adapter/index.d.ts.map +1 -1
  61. package/dist/market_adapter/index.js +24 -82
  62. package/dist/market_adapter/index.js.map +1 -1
  63. package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +2 -1
  64. package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +1 -1
  65. package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +1 -1
  66. package/dist/market_adapter/inputs/fetch_lp_data.js +59 -98
  67. package/dist/market_adapter/inputs/fetch_lp_data.js.map +1 -1
  68. package/dist/market_adapter/inputs/kibana_source.js +11 -17
  69. package/dist/market_adapter/inputs/kibana_source.js.map +1 -1
  70. package/dist/market_adapter/interval_utils.js +1 -2
  71. package/dist/market_adapter/interval_utils.js.map +1 -1
  72. package/dist/market_adapter/log_format.js +1 -7
  73. package/dist/market_adapter/log_format.js.map +1 -1
  74. package/dist/market_adapter/lp_chart_core.js +20 -22
  75. package/dist/market_adapter/lp_chart_core.js.map +1 -1
  76. package/dist/market_adapter/lp_chart_runner.d.ts +1 -1
  77. package/dist/market_adapter/lp_chart_runner.d.ts.map +1 -1
  78. package/dist/market_adapter/lp_chart_runner.js +41 -57
  79. package/dist/market_adapter/lp_chart_runner.js.map +1 -1
  80. package/dist/market_adapter/lp_chart_strategy_loader.js +30 -34
  81. package/dist/market_adapter/lp_chart_strategy_loader.js.map +1 -1
  82. package/dist/market_adapter/market_adapter.d.ts +2 -2
  83. package/dist/market_adapter/market_adapter.d.ts.map +1 -1
  84. package/dist/market_adapter/market_adapter.js +163 -222
  85. package/dist/market_adapter/market_adapter.js.map +1 -1
  86. package/dist/market_adapter/merge_lp_data.js +17 -18
  87. package/dist/market_adapter/merge_lp_data.js.map +1 -1
  88. package/dist/market_adapter/test_helpers.js +3 -14
  89. package/dist/market_adapter/test_helpers.js.map +1 -1
  90. package/dist/market_adapter/utils/adapter_client.js +7 -16
  91. package/dist/market_adapter/utils/adapter_client.js.map +1 -1
  92. package/dist/market_adapter/utils/atomic_write.js +3 -5
  93. package/dist/market_adapter/utils/atomic_write.js.map +1 -1
  94. package/dist/market_adapter/utils/chain.d.ts.map +1 -1
  95. package/dist/market_adapter/utils/chain.js +9 -17
  96. package/dist/market_adapter/utils/chain.js.map +1 -1
  97. package/dist/market_adapter/utils/data_discovery.js +8 -10
  98. package/dist/market_adapter/utils/data_discovery.js.map +1 -1
  99. package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +1 -1
  100. package/dist/market_adapter/utils/dynamic_grid_snapshot.js +11 -14
  101. package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +1 -1
  102. package/dist/market_adapter/utils/file_lock.js +14 -19
  103. package/dist/market_adapter/utils/file_lock.js.map +1 -1
  104. package/dist/market_adapter/utils/native_history.js +8 -14
  105. package/dist/market_adapter/utils/native_history.js.map +1 -1
  106. package/dist/market_adapter/utils/paths.js +3 -6
  107. package/dist/market_adapter/utils/paths.js.map +1 -1
  108. package/dist/modules/account_bots.d.ts +1 -1
  109. package/dist/modules/account_bots.d.ts.map +1 -1
  110. package/dist/modules/account_bots.js +90 -97
  111. package/dist/modules/account_bots.js.map +1 -1
  112. package/dist/modules/account_orders.d.ts +0 -9
  113. package/dist/modules/account_orders.d.ts.map +1 -1
  114. package/dist/modules/account_orders.js +26 -121
  115. package/dist/modules/account_orders.js.map +1 -1
  116. package/dist/modules/authority_resolver.js +12 -18
  117. package/dist/modules/authority_resolver.js.map +1 -1
  118. package/dist/modules/bitshares-native/chain_client.js +16 -21
  119. package/dist/modules/bitshares-native/chain_client.js.map +1 -1
  120. package/dist/modules/bitshares-native/crypto/ecc.browser.js +12 -72
  121. package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +1 -1
  122. package/dist/modules/bitshares-native/crypto/ecc.js +13 -40
  123. package/dist/modules/bitshares-native/crypto/ecc.js.map +1 -1
  124. package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts.map +1 -1
  125. package/dist/modules/bitshares-native/crypto/ecc_selector.js +5 -6
  126. package/dist/modules/bitshares-native/crypto/ecc_selector.js.map +1 -1
  127. package/dist/modules/bitshares-native/index.d.ts +8 -8
  128. package/dist/modules/bitshares-native/index.d.ts.map +1 -1
  129. package/dist/modules/bitshares-native/index.js +11 -68
  130. package/dist/modules/bitshares-native/index.js.map +1 -1
  131. package/dist/modules/bitshares-native/lru_cache.js +3 -6
  132. package/dist/modules/bitshares-native/lru_cache.js.map +1 -1
  133. package/dist/modules/bitshares-native/resolvers.js +9 -11
  134. package/dist/modules/bitshares-native/resolvers.js.map +1 -1
  135. package/dist/modules/bitshares-native/serial/chain_constants.js +3 -28
  136. package/dist/modules/bitshares-native/serial/chain_constants.js.map +1 -1
  137. package/dist/modules/bitshares-native/serial/index.d.ts +4 -4
  138. package/dist/modules/bitshares-native/serial/index.d.ts.map +1 -1
  139. package/dist/modules/bitshares-native/serial/index.js +5 -46
  140. package/dist/modules/bitshares-native/serial/index.js.map +1 -1
  141. package/dist/modules/bitshares-native/serial/operations.d.ts +98 -98
  142. package/dist/modules/bitshares-native/serial/operations.d.ts.map +1 -1
  143. package/dist/modules/bitshares-native/serial/operations.js +372 -473
  144. package/dist/modules/bitshares-native/serial/operations.js.map +1 -1
  145. package/dist/modules/bitshares-native/serial/serializer.js +3 -8
  146. package/dist/modules/bitshares-native/serial/serializer.js.map +1 -1
  147. package/dist/modules/bitshares-native/serial/types.js +9 -74
  148. package/dist/modules/bitshares-native/serial/types.js.map +1 -1
  149. package/dist/modules/bitshares-native/signing_client.d.ts.map +1 -1
  150. package/dist/modules/bitshares-native/signing_client.js +11 -48
  151. package/dist/modules/bitshares-native/signing_client.js.map +1 -1
  152. package/dist/modules/bitshares-native/subscriptions.d.ts.map +1 -1
  153. package/dist/modules/bitshares-native/subscriptions.js +24 -27
  154. package/dist/modules/bitshares-native/subscriptions.js.map +1 -1
  155. package/dist/modules/bitshares-native/transport.d.ts.map +1 -1
  156. package/dist/modules/bitshares-native/transport.js +14 -26
  157. package/dist/modules/bitshares-native/transport.js.map +1 -1
  158. package/dist/modules/bitshares-native/tx/builder.js +29 -72
  159. package/dist/modules/bitshares-native/tx/builder.js.map +1 -1
  160. package/dist/modules/bitshares-native/tx/tx_cache.js +12 -21
  161. package/dist/modules/bitshares-native/tx/tx_cache.js.map +1 -1
  162. package/dist/modules/bitshares_client.d.ts +21 -0
  163. package/dist/modules/bitshares_client.d.ts.map +1 -1
  164. package/dist/modules/bitshares_client.js +32 -86
  165. package/dist/modules/bitshares_client.js.map +1 -1
  166. package/dist/modules/bot_settings.d.ts.map +1 -1
  167. package/dist/modules/bot_settings.js +30 -49
  168. package/dist/modules/bot_settings.js.map +1 -1
  169. package/dist/modules/bots_file_lock.d.ts.map +1 -1
  170. package/dist/modules/bots_file_lock.js +5 -13
  171. package/dist/modules/bots_file_lock.js.map +1 -1
  172. package/dist/modules/broadcast_failure.js +1 -3
  173. package/dist/modules/broadcast_failure.js.map +1 -1
  174. package/dist/modules/chain_keys.d.ts +4 -9
  175. package/dist/modules/chain_keys.d.ts.map +1 -1
  176. package/dist/modules/chain_keys.js +77 -182
  177. package/dist/modules/chain_keys.js.map +1 -1
  178. package/dist/modules/chain_orders.d.ts +2 -2
  179. package/dist/modules/chain_orders.d.ts.map +1 -1
  180. package/dist/modules/chain_orders.js +81 -144
  181. package/dist/modules/chain_orders.js.map +1 -1
  182. package/dist/modules/config.d.ts.map +1 -1
  183. package/dist/modules/config.js +23 -28
  184. package/dist/modules/config.js.map +1 -1
  185. package/dist/modules/constants.d.ts +4 -14
  186. package/dist/modules/constants.d.ts.map +1 -1
  187. package/dist/modules/constants.js +46 -78
  188. package/dist/modules/constants.js.map +1 -1
  189. package/dist/modules/cr_planner.js +15 -26
  190. package/dist/modules/cr_planner.js.map +1 -1
  191. package/dist/modules/credential_policy.d.ts +3 -6
  192. package/dist/modules/credential_policy.d.ts.map +1 -1
  193. package/dist/modules/credential_policy.js +62 -153
  194. package/dist/modules/credential_policy.js.map +1 -1
  195. package/dist/modules/credential_runtime.d.ts +1 -1
  196. package/dist/modules/credential_runtime.d.ts.map +1 -1
  197. package/dist/modules/credential_runtime.js +34 -41
  198. package/dist/modules/credential_runtime.js.map +1 -1
  199. package/dist/modules/credential_session_cache.d.ts +1 -1
  200. package/dist/modules/credential_session_cache.d.ts.map +1 -1
  201. package/dist/modules/credential_session_cache.js +5 -42
  202. package/dist/modules/credential_session_cache.js.map +1 -1
  203. package/dist/modules/credit_runtime.d.ts.map +1 -1
  204. package/dist/modules/credit_runtime.js +126 -162
  205. package/dist/modules/credit_runtime.js.map +1 -1
  206. package/dist/modules/crypto/browser_provider.d.ts +1 -1
  207. package/dist/modules/crypto/browser_provider.d.ts.map +1 -1
  208. package/dist/modules/crypto/browser_provider.js +7 -11
  209. package/dist/modules/crypto/browser_provider.js.map +1 -1
  210. package/dist/modules/crypto/index.d.ts +6 -6
  211. package/dist/modules/crypto/index.d.ts.map +1 -1
  212. package/dist/modules/crypto/index.js +12 -30
  213. package/dist/modules/crypto/index.js.map +1 -1
  214. package/dist/modules/crypto/node_provider.d.ts +1 -1
  215. package/dist/modules/crypto/node_provider.d.ts.map +1 -1
  216. package/dist/modules/crypto/node_provider.js +3 -5
  217. package/dist/modules/crypto/node_provider.js.map +1 -1
  218. package/dist/modules/crypto/provider.js +1 -2
  219. package/dist/modules/crypto/pure_ripemd160.js +1 -3
  220. package/dist/modules/crypto/pure_ripemd160.js.map +1 -1
  221. package/dist/modules/crypto/pure_scrypt.js +1 -4
  222. package/dist/modules/crypto/pure_scrypt.js.map +1 -1
  223. package/dist/modules/crypto/pure_secp256k1.d.ts +1 -1
  224. package/dist/modules/crypto/pure_secp256k1.d.ts.map +1 -1
  225. package/dist/modules/crypto/pure_secp256k1.js +1 -16
  226. package/dist/modules/crypto/pure_secp256k1.js.map +1 -1
  227. package/dist/modules/crypto/sync.d.ts.map +1 -1
  228. package/dist/modules/crypto/sync.js +16 -17
  229. package/dist/modules/crypto/sync.js.map +1 -1
  230. package/dist/modules/daemon_node_health.js +14 -16
  231. package/dist/modules/daemon_node_health.js.map +1 -1
  232. package/dist/modules/dexbot_class.d.ts +19 -14
  233. package/dist/modules/dexbot_class.d.ts.map +1 -1
  234. package/dist/modules/dexbot_class.js +127 -164
  235. package/dist/modules/dexbot_class.js.map +1 -1
  236. package/dist/modules/dexbot_cow_runtime.d.ts +28 -27
  237. package/dist/modules/dexbot_cow_runtime.d.ts.map +1 -1
  238. package/dist/modules/dexbot_cow_runtime.js +55 -45
  239. package/dist/modules/dexbot_cow_runtime.js.map +1 -1
  240. package/dist/modules/dexbot_credential_client.d.ts +6 -2
  241. package/dist/modules/dexbot_credential_client.d.ts.map +1 -1
  242. package/dist/modules/dexbot_credential_client.js +21 -31
  243. package/dist/modules/dexbot_credential_client.js.map +1 -1
  244. package/dist/modules/dexbot_fill_runtime.d.ts +23 -23
  245. package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -1
  246. package/dist/modules/dexbot_fill_runtime.js +119 -77
  247. package/dist/modules/dexbot_fill_runtime.js.map +1 -1
  248. package/dist/modules/dexbot_maintenance_runtime.d.ts +46 -38
  249. package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
  250. package/dist/modules/dexbot_maintenance_runtime.js +81 -81
  251. package/dist/modules/dexbot_maintenance_runtime.js.map +1 -1
  252. package/dist/modules/dexbot_startup_runtime.d.ts +3 -3
  253. package/dist/modules/dexbot_startup_runtime.d.ts.map +1 -1
  254. package/dist/modules/dexbot_startup_runtime.js +43 -81
  255. package/dist/modules/dexbot_startup_runtime.js.map +1 -1
  256. package/dist/modules/dexbot_state_recovery.d.ts +11 -11
  257. package/dist/modules/dexbot_state_recovery.js +32 -78
  258. package/dist/modules/dexbot_state_recovery.js.map +1 -1
  259. package/dist/modules/env.js +3 -7
  260. package/dist/modules/env.js.map +1 -1
  261. package/dist/modules/fund_registry.d.ts.map +1 -1
  262. package/dist/modules/fund_registry.js +12 -24
  263. package/dist/modules/fund_registry.js.map +1 -1
  264. package/dist/modules/general_settings.js +10 -16
  265. package/dist/modules/general_settings.js.map +1 -1
  266. package/dist/modules/graceful_shutdown.d.ts.map +1 -1
  267. package/dist/modules/graceful_shutdown.js +12 -19
  268. package/dist/modules/graceful_shutdown.js.map +1 -1
  269. package/dist/modules/key_store.d.ts.map +1 -1
  270. package/dist/modules/key_store.js +27 -65
  271. package/dist/modules/key_store.js.map +1 -1
  272. package/dist/modules/launcher/bot_supervisor.d.ts +1 -1
  273. package/dist/modules/launcher/bot_supervisor.d.ts.map +1 -1
  274. package/dist/modules/launcher/bot_supervisor.js +89 -118
  275. package/dist/modules/launcher/bot_supervisor.js.map +1 -1
  276. package/dist/modules/launcher/child_env.js +1 -5
  277. package/dist/modules/launcher/child_env.js.map +1 -1
  278. package/dist/modules/launcher/credential_bootstrap.js +22 -31
  279. package/dist/modules/launcher/credential_bootstrap.js.map +1 -1
  280. package/dist/modules/launcher/credential_daemon.js +37 -75
  281. package/dist/modules/launcher/credential_daemon.js.map +1 -1
  282. package/dist/modules/launcher/credential_secret.js +2 -37
  283. package/dist/modules/launcher/credential_secret.js.map +1 -1
  284. package/dist/modules/launcher/foreign_cred_daemon.js +25 -31
  285. package/dist/modules/launcher/foreign_cred_daemon.js.map +1 -1
  286. package/dist/modules/launcher/headless_password.js +10 -12
  287. package/dist/modules/launcher/headless_password.js.map +1 -1
  288. package/dist/modules/launcher/launch_modes.js +3 -9
  289. package/dist/modules/launcher/launch_modes.js.map +1 -1
  290. package/dist/modules/launcher/market_adapter_runtime.d.ts +1 -1
  291. package/dist/modules/launcher/market_adapter_runtime.d.ts.map +1 -1
  292. package/dist/modules/launcher/market_adapter_runtime.js +25 -35
  293. package/dist/modules/launcher/market_adapter_runtime.js.map +1 -1
  294. package/dist/modules/launcher/market_adapter_watchdog.d.ts.map +1 -1
  295. package/dist/modules/launcher/market_adapter_watchdog.js +42 -45
  296. package/dist/modules/launcher/market_adapter_watchdog.js.map +1 -1
  297. package/dist/modules/launcher/monolithic_runtime.d.ts +3 -2
  298. package/dist/modules/launcher/monolithic_runtime.d.ts.map +1 -1
  299. package/dist/modules/launcher/monolithic_runtime.js +97 -138
  300. package/dist/modules/launcher/monolithic_runtime.js.map +1 -1
  301. package/dist/modules/launcher/runtime_entry.d.ts +1 -11
  302. package/dist/modules/launcher/runtime_entry.d.ts.map +1 -1
  303. package/dist/modules/launcher/runtime_entry.js +12 -15
  304. package/dist/modules/launcher/runtime_entry.js.map +1 -1
  305. package/dist/modules/launcher/status_reporting.d.ts +1 -1
  306. package/dist/modules/launcher/status_reporting.d.ts.map +1 -1
  307. package/dist/modules/launcher/status_reporting.js +15 -36
  308. package/dist/modules/launcher/status_reporting.js.map +1 -1
  309. package/dist/modules/launcher/supervisor_control.js +4 -9
  310. package/dist/modules/launcher/supervisor_control.js.map +1 -1
  311. package/dist/modules/logger.d.ts +1 -1
  312. package/dist/modules/logger.d.ts.map +1 -1
  313. package/dist/modules/logger.js +3 -38
  314. package/dist/modules/logger.js.map +1 -1
  315. package/dist/modules/market_adapter_whitelist.js +9 -18
  316. package/dist/modules/market_adapter_whitelist.js.map +1 -1
  317. package/dist/modules/node_failure_ledger.js +1 -3
  318. package/dist/modules/node_failure_ledger.js.map +1 -1
  319. package/dist/modules/node_health_cache.d.ts.map +1 -1
  320. package/dist/modules/node_health_cache.js +15 -25
  321. package/dist/modules/node_health_cache.js.map +1 -1
  322. package/dist/modules/node_manager.d.ts +1 -1
  323. package/dist/modules/node_manager.d.ts.map +1 -1
  324. package/dist/modules/node_manager.js +44 -43
  325. package/dist/modules/node_manager.js.map +1 -1
  326. package/dist/modules/order/accounting.d.ts.map +1 -1
  327. package/dist/modules/order/accounting.js +102 -118
  328. package/dist/modules/order/accounting.js.map +1 -1
  329. package/dist/modules/order/async_lock.d.ts +3 -15
  330. package/dist/modules/order/async_lock.d.ts.map +1 -1
  331. package/dist/modules/order/async_lock.js +6 -26
  332. package/dist/modules/order/async_lock.js.map +1 -1
  333. package/dist/modules/order/export.js +34 -75
  334. package/dist/modules/order/export.js.map +1 -1
  335. package/dist/modules/order/format.d.ts +1 -3
  336. package/dist/modules/order/format.d.ts.map +1 -1
  337. package/dist/modules/order/format.js +4 -24
  338. package/dist/modules/order/format.js.map +1 -1
  339. package/dist/modules/order/grid.d.ts +8 -8
  340. package/dist/modules/order/grid.d.ts.map +1 -1
  341. package/dist/modules/order/grid.js +254 -266
  342. package/dist/modules/order/grid.js.map +1 -1
  343. package/dist/modules/order/grid_reconcile.d.ts.map +1 -1
  344. package/dist/modules/order/grid_reconcile.js +77 -94
  345. package/dist/modules/order/grid_reconcile.js.map +1 -1
  346. package/dist/modules/order/grid_reconcile_internal.d.ts.map +1 -1
  347. package/dist/modules/order/grid_reconcile_internal.js +117 -149
  348. package/dist/modules/order/grid_reconcile_internal.js.map +1 -1
  349. package/dist/modules/order/index.d.ts.map +1 -1
  350. package/dist/modules/order/index.js +11 -45
  351. package/dist/modules/order/index.js.map +1 -1
  352. package/dist/modules/order/logger.d.ts +0 -8
  353. package/dist/modules/order/logger.d.ts.map +1 -1
  354. package/dist/modules/order/logger.js +28 -141
  355. package/dist/modules/order/logger.js.map +1 -1
  356. package/dist/modules/order/logger_state.d.ts.map +1 -1
  357. package/dist/modules/order/logger_state.js +3 -4
  358. package/dist/modules/order/logger_state.js.map +1 -1
  359. package/dist/modules/order/manager.d.ts +10 -79
  360. package/dist/modules/order/manager.d.ts.map +1 -1
  361. package/dist/modules/order/manager.js +131 -247
  362. package/dist/modules/order/manager.js.map +1 -1
  363. package/dist/modules/order/processed_fill_store.js +2 -7
  364. package/dist/modules/order/processed_fill_store.js.map +1 -1
  365. package/dist/modules/order/strategy.js +23 -25
  366. package/dist/modules/order/strategy.js.map +1 -1
  367. package/dist/modules/order/sync_engine.d.ts +27 -0
  368. package/dist/modules/order/sync_engine.d.ts.map +1 -1
  369. package/dist/modules/order/sync_engine.js +232 -181
  370. package/dist/modules/order/sync_engine.js.map +1 -1
  371. package/dist/modules/order/utils/math.d.ts +1 -25
  372. package/dist/modules/order/utils/math.d.ts.map +1 -1
  373. package/dist/modules/order/utils/math.js +49 -172
  374. package/dist/modules/order/utils/math.js.map +1 -1
  375. package/dist/modules/order/utils/order.d.ts +46 -2
  376. package/dist/modules/order/utils/order.d.ts.map +1 -1
  377. package/dist/modules/order/utils/order.js +165 -143
  378. package/dist/modules/order/utils/order.js.map +1 -1
  379. package/dist/modules/order/utils/system.d.ts +3 -1
  380. package/dist/modules/order/utils/system.d.ts.map +1 -1
  381. package/dist/modules/order/utils/system.js +152 -211
  382. package/dist/modules/order/utils/system.js.map +1 -1
  383. package/dist/modules/order/utils/timeout.js +1 -4
  384. package/dist/modules/order/utils/timeout.js.map +1 -1
  385. package/dist/modules/order/utils/validate.js +91 -142
  386. package/dist/modules/order/utils/validate.js.map +1 -1
  387. package/dist/modules/order/utils/withPoolRef.js +21 -61
  388. package/dist/modules/order/utils/withPoolRef.js.map +1 -1
  389. package/dist/modules/order/working_grid.js +6 -9
  390. package/dist/modules/order/working_grid.js.map +1 -1
  391. package/dist/modules/path_api.d.ts.map +1 -1
  392. package/dist/modules/path_api.js +8 -11
  393. package/dist/modules/path_api.js.map +1 -1
  394. package/dist/modules/paths.d.ts.map +1 -1
  395. package/dist/modules/paths.js +61 -67
  396. package/dist/modules/paths.js.map +1 -1
  397. package/dist/modules/process_discovery.d.ts.map +1 -1
  398. package/dist/modules/process_discovery.js +14 -23
  399. package/dist/modules/process_discovery.js.map +1 -1
  400. package/dist/modules/runtime.js +7 -11
  401. package/dist/modules/runtime.js.map +1 -1
  402. package/dist/modules/runtime_settings.d.ts.map +1 -1
  403. package/dist/modules/runtime_settings.js +14 -16
  404. package/dist/modules/runtime_settings.js.map +1 -1
  405. package/dist/modules/settings_merge.js +1 -3
  406. package/dist/modules/settings_merge.js.map +1 -1
  407. package/dist/modules/socket_json_client.js +3 -5
  408. package/dist/modules/socket_json_client.js.map +1 -1
  409. package/dist/modules/storage/browser_adapter.js +1 -4
  410. package/dist/modules/storage/browser_adapter.js.map +1 -1
  411. package/dist/modules/storage/index.d.ts +3 -2
  412. package/dist/modules/storage/index.d.ts.map +1 -1
  413. package/dist/modules/storage/index.js +5 -8
  414. package/dist/modules/storage/index.js.map +1 -1
  415. package/dist/modules/storage/node_adapter.d.ts +3 -4
  416. package/dist/modules/storage/node_adapter.d.ts.map +1 -1
  417. package/dist/modules/storage/node_adapter.js +12 -16
  418. package/dist/modules/storage/node_adapter.js.map +1 -1
  419. package/dist/modules/storage/types.js +1 -2
  420. package/dist/modules/types.d.ts +0 -6
  421. package/dist/modules/types.d.ts.map +1 -1
  422. package/dist/modules/types.js +1 -2
  423. package/dist/modules/types.js.map +1 -1
  424. package/dist/modules/utils/base58check.js +8 -15
  425. package/dist/modules/utils/base58check.js.map +1 -1
  426. package/dist/modules/utils/build_dir.js +3 -7
  427. package/dist/modules/utils/build_dir.js.map +1 -1
  428. package/dist/modules/utils/errors.js +1 -5
  429. package/dist/modules/utils/errors.js.map +1 -1
  430. package/dist/modules/utils/math_utils.d.ts +1 -1
  431. package/dist/modules/utils/math_utils.d.ts.map +1 -1
  432. package/dist/modules/utils/math_utils.js +2 -7
  433. package/dist/modules/utils/math_utils.js.map +1 -1
  434. package/dist/modules/validate_profiles.d.ts.map +1 -1
  435. package/dist/modules/validate_profiles.js +18 -25
  436. package/dist/modules/validate_profiles.js.map +1 -1
  437. package/dist/pm2.d.ts +4 -70
  438. package/dist/pm2.d.ts.map +1 -1
  439. package/dist/pm2.js +106 -132
  440. package/dist/pm2.js.map +1 -1
  441. package/dist/scripts/analyze-git.js +13 -17
  442. package/dist/scripts/analyze-git.js.map +1 -1
  443. package/dist/scripts/analyze-orders.d.ts.map +1 -1
  444. package/dist/scripts/analyze-orders.js +48 -63
  445. package/dist/scripts/analyze-orders.js.map +1 -1
  446. package/dist/scripts/diagnose-kibana-candles.d.ts.map +1 -1
  447. package/dist/scripts/diagnose-kibana-candles.js +2 -1
  448. package/dist/scripts/diagnose-kibana-candles.js.map +1 -1
  449. package/dist/scripts/diagnose-pool-history.d.ts.map +1 -1
  450. package/dist/scripts/diagnose-pool-history.js +2 -1
  451. package/dist/scripts/diagnose-pool-history.js.map +1 -1
  452. package/dist/scripts/divergence-calc.d.ts.map +1 -1
  453. package/dist/scripts/divergence-calc.js +2 -2
  454. package/dist/scripts/divergence-calc.js.map +1 -1
  455. package/dist/scripts/fix-err-message.js +17 -22
  456. package/dist/scripts/fix-err-message.js.map +1 -1
  457. package/dist/scripts/generate_lp_chart.d.ts.map +1 -1
  458. package/dist/scripts/generate_lp_chart.js +7 -15
  459. package/dist/scripts/generate_lp_chart.js.map +1 -1
  460. package/dist/scripts/generate_mainnet_corpus_report.d.ts.map +1 -1
  461. package/dist/scripts/generate_mainnet_corpus_report.js +3 -2
  462. package/dist/scripts/generate_mainnet_corpus_report.js.map +1 -1
  463. package/dist/scripts/generate_market_adapter_whitelist.d.ts.map +1 -1
  464. package/dist/scripts/generate_market_adapter_whitelist.js +18 -24
  465. package/dist/scripts/generate_market_adapter_whitelist.js.map +1 -1
  466. package/dist/scripts/native_release_gates.js +15 -19
  467. package/dist/scripts/native_release_gates.js.map +1 -1
  468. package/dist/scripts/print_grid.d.ts.map +1 -1
  469. package/dist/scripts/print_grid.js +2 -2
  470. package/dist/scripts/print_grid.js.map +1 -1
  471. package/dist/scripts/run-tests.js +12 -17
  472. package/dist/scripts/run-tests.js.map +1 -1
  473. package/dist/scripts/runner.d.ts.map +1 -1
  474. package/dist/scripts/runner.js +18 -20
  475. package/dist/scripts/runner.js.map +1 -1
  476. package/dist/scripts/sync-version.js +2 -2
  477. package/dist/scripts/sync-version.js.map +1 -1
  478. package/dist/scripts/test-credit-renewal.d.ts.map +1 -1
  479. package/dist/scripts/test-credit-renewal.js +4 -3
  480. package/dist/scripts/test-credit-renewal.js.map +1 -1
  481. package/dist/scripts/update.js +93 -95
  482. package/dist/scripts/update.js.map +1 -1
  483. package/dist/scripts/validate_bots.d.ts.map +1 -1
  484. package/dist/scripts/validate_bots.js +2 -2
  485. package/dist/scripts/validate_bots.js.map +1 -1
  486. package/dist/scripts/verify-browser-bundle.js +12 -17
  487. package/dist/scripts/verify-browser-bundle.js.map +1 -1
  488. package/dist/unlock.d.ts +0 -30
  489. package/dist/unlock.d.ts.map +1 -1
  490. package/dist/unlock.js +258 -222
  491. package/dist/unlock.js.map +1 -1
  492. package/package.json +5 -8
  493. package/scripts/README.md +1 -1
  494. package/scripts/create-bot-symlinks.sh +2 -2
  495. package/dist/modules/utils/fs_utils.d.ts +0 -18
  496. package/dist/modules/utils/fs_utils.d.ts.map +0 -1
  497. package/dist/modules/utils/fs_utils.js +0 -32
  498. package/dist/modules/utils/fs_utils.js.map +0 -1
  499. package/dist/scripts/migrate_bot_keys.d.ts +0 -3
  500. package/dist/scripts/migrate_bot_keys.d.ts.map +0 -1
  501. package/dist/scripts/migrate_bot_keys.js +0 -225
  502. package/dist/scripts/migrate_bot_keys.js.map +0 -1
package/dist/pm2.js CHANGED
@@ -1,5 +1,9 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
2
+ import { fileURLToPath } from 'node:url';
3
+ import { pathToFileURL } from 'node:url';
4
+ import { dirname as _esmDirname } from 'node:path';
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = _esmDirname(__filename);
3
7
  // node-only entry point — PM2 process orchestration (spawn, exec, fs, os)
4
8
  /**
5
9
  * pm2.ts - PM2 Orchestration Launcher
@@ -46,7 +50,7 @@
46
50
  *
47
51
  * Step 2: ECOSYSTEM CONFIGURATION GENERATION
48
52
  * - Reads bot definitions from profiles/bots.json for bot mode
49
- * - Generates profiles/ecosystem.config.js with absolute paths
53
+ * - Generates profiles/ecosystem.config.cjs with absolute paths
50
54
  * - Filters only active bots (active !== false)
51
55
  * - If bot-name provided, filters to only that bot
52
56
  * - In claw-only mode, generates only the credential daemon app
@@ -68,73 +72,42 @@
68
72
  * - Credential daemon is started as a PM2 app after one-shot bootstrap
69
73
  * - Bots request private keys from credential daemon via Unix socket
70
74
  */
71
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
72
- if (k2 === undefined) k2 = k;
73
- var desc = Object.getOwnPropertyDescriptor(m, k);
74
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
75
- desc = { enumerable: true, get: function() { return m[k]; } };
76
- }
77
- Object.defineProperty(o, k2, desc);
78
- }) : (function(o, m, k, k2) {
79
- if (k2 === undefined) k2 = k;
80
- o[k2] = m[k];
81
- }));
82
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
83
- Object.defineProperty(o, "default", { enumerable: true, value: v });
84
- }) : function(o, v) {
85
- o["default"] = v;
86
- });
87
- var __importStar = (this && this.__importStar) || (function () {
88
- var ownKeys = function(o) {
89
- ownKeys = Object.getOwnPropertyNames || function (o) {
90
- var ar = [];
91
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
92
- return ar;
93
- };
94
- return ownKeys(o);
95
- };
96
- return function (mod) {
97
- if (mod && mod.__esModule) return mod;
98
- var result = {};
99
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
100
- __setModuleDefault(result, mod);
101
- return result;
102
- };
103
- })();
104
- const config_1 = require("./modules/config");
105
- const path_api_1 = require("./modules/path_api");
106
- const node_child_process_1 = require("node:child_process");
107
- const system_1 = require("./modules/order/utils/system");
108
- const bots_file_lock_1 = require("./modules/bots_file_lock");
109
- const bot_settings_1 = require("./modules/bot_settings");
110
- const chainKeys = __importStar(require("./modules/chain_keys"));
111
- const credentialPolicy = __importStar(require("./modules/credential_policy"));
112
- const headless_password_1 = require("./modules/launcher/headless_password");
113
- const child_env_1 = require("./modules/launcher/child_env");
114
- const credential_bootstrap_1 = require("./modules/launcher/credential_bootstrap");
115
- const launch_modes_1 = require("./modules/launcher/launch_modes");
116
- const graceful_shutdown_1 = require("./modules/graceful_shutdown");
117
- const constants_1 = require("./modules/constants");
118
- const paths_1 = require("./modules/paths");
119
- const runtime_entry_1 = require("./modules/launcher/runtime_entry");
120
- const storage_1 = require("./modules/storage");
121
- const fs_utils_1 = require("./modules/utils/fs_utils");
122
- const config_2 = require("./modules/config");
123
- const bitshares_client_1 = require("./modules/bitshares_client");
124
- const readline = __importStar(require("node:readline"));
125
- const errors_1 = require("./modules/utils/errors");
126
- (0, config_1.setUmask)(0o077);
75
+ import { createRequire } from 'node:module';
76
+ const require = createRequire(import.meta.url);
77
+ import { setUmask } from './modules/config.js';
78
+ import { path } from './modules/path_api.js';
79
+ import { spawn, execSync } from 'node:child_process';
80
+ import { parseJsonWithComments } from './modules/order/utils/system.js';
81
+ import { readBotsFileWithLock } from './modules/bots_file_lock.js';
82
+ import { loadSettingsFile, selectActiveBotEntries } from './modules/bot_settings.js';
83
+ import * as chainKeys from './modules/chain_keys.js';
84
+ import * as credentialPolicy from './modules/credential_policy.js';
85
+ import { readHeadlessPassword } from './modules/launcher/headless_password.js';
86
+ import { buildScopedChildEnv } from './modules/launcher/child_env.js';
87
+ import { createPasswordBootstrapServer } from './modules/launcher/credential_bootstrap.js';
88
+ import { parsePm2Args } from './modules/launcher/launch_modes.js';
89
+ import { setupGracefulShutdown } from './modules/graceful_shutdown.js';
90
+ import { UPDATER, TIMING } from './modules/constants.js';
91
+ import { PATHS } from './modules/paths.js';
92
+ import { isDistCodeRoot, buildRuntimeScriptPath } from './modules/launcher/runtime_entry.js';
93
+ import { Config } from './modules/config.js';
94
+ import { waitForConnected } from './modules/bitshares_client.js';
95
+ import * as readline from 'node:readline';
96
+ import { getErrorMessage } from './modules/utils/errors.js';
97
+ import { getStorage } from './modules/storage/index.js';
98
+ setUmask(0o077);
127
99
  const { ensureCredentialRuntimeDirSync, getCredentialReadyFilePath, getCredentialSocketPath, } = require('./modules/credential_runtime');
128
- const storage = (0, storage_1.getStorage)();
100
+ const storage = getStorage();
101
+ const { ensureDir, unlink: safeUnlink } = storage;
129
102
  // Setup graceful shutdown handlers
130
- (0, graceful_shutdown_1.setupGracefulShutdown)();
103
+ setupGracefulShutdown();
131
104
  const PM2_COLORS = {
132
105
  reset: '\x1b[0m',
133
106
  ok: '\x1b[1;92m',
134
107
  error: '\x1b[1;31m',
135
108
  };
136
109
  function colorPm2Output(text, color, stream = process.stdout) {
137
- return stream.isTTY && !config_2.Config.NO_COLOR
110
+ return stream.isTTY && !Config.NO_COLOR
138
111
  ? `${color}${text}${PM2_COLORS.reset}`
139
112
  : text;
140
113
  }
@@ -145,15 +118,15 @@ function pm2Error(text) {
145
118
  return colorPm2Output(text, PM2_COLORS.error, process.stderr);
146
119
  }
147
120
  const CODE_ROOT = __dirname;
148
- const BOTS_JSON = paths_1.PATHS.PROFILES.BOTS_JSON;
149
- const ECOSYSTEM_FILE = paths_1.PATHS.PROFILES.ECOSYSTEM_CONFIG_JS;
150
- const POLICY_CONFIG_FILE = paths_1.PATHS.PROFILES.DAEMON_POLICIES_JSON;
151
- const LOGS_DIR = paths_1.PATHS.LOGS_DIR;
121
+ const BOTS_JSON = PATHS.PROFILES.BOTS_JSON;
122
+ const ECOSYSTEM_FILE = PATHS.PROFILES.ECOSYSTEM_CONFIG_JS;
123
+ const POLICY_CONFIG_FILE = PATHS.PROFILES.DAEMON_POLICIES_JSON;
124
+ const LOGS_DIR = PATHS.LOGS_DIR;
152
125
  const CREDENTIAL_DAEMON_APP_NAME = 'dexbot-cred';
153
- const CREDENTIAL_SOCKET_PATH = getCredentialSocketPath({ root: paths_1.PATHS.PROJECT_ROOT });
154
- const CREDENTIAL_READY_FILE = getCredentialReadyFilePath({ root: paths_1.PATHS.PROJECT_ROOT });
126
+ const CREDENTIAL_SOCKET_PATH = getCredentialSocketPath({ root: PATHS.PROJECT_ROOT });
127
+ const CREDENTIAL_READY_FILE = getCredentialReadyFilePath({ root: PATHS.PROJECT_ROOT });
155
128
  function runtimeScript(...segments) {
156
- return path_api_1.path.join(CODE_ROOT, ...segments);
129
+ return path.join(CODE_ROOT, ...segments);
157
130
  }
158
131
  function usesAmaGridPrice(bot) {
159
132
  const gridPrice = typeof bot?.gridPrice === 'string' ? bot.gridPrice.trim().toLowerCase() : '';
@@ -223,14 +196,14 @@ function buildEcosystemApps(bots, { includeUpdater = true } = {}) {
223
196
  const botName = bot.name || `bot-${index}`;
224
197
  return {
225
198
  name: botName,
226
- script: (0, runtime_entry_1.buildRuntimeScriptPath)(CODE_ROOT, ['bot']),
199
+ script: buildRuntimeScriptPath(CODE_ROOT, ['bot']),
227
200
  args: botName,
228
- cwd: paths_1.PATHS.PROJECT_ROOT,
201
+ cwd: PATHS.PROJECT_ROOT,
229
202
  max_memory_restart: '250M',
230
203
  watch: false,
231
204
  autorestart: true,
232
- error_file: path_api_1.path.join(LOGS_DIR, `${botName}-error.log`),
233
- out_file: path_api_1.path.join(LOGS_DIR, `${botName}.log`),
205
+ error_file: path.join(LOGS_DIR, `${botName}-error.log`),
206
+ out_file: path.join(LOGS_DIR, `${botName}.log`),
234
207
  log_date_format: 'YY-MM-DD HH:mm:ss.SSS',
235
208
  merge_logs: false,
236
209
  combine_logs: true,
@@ -243,13 +216,13 @@ function buildEcosystemApps(bots, { includeUpdater = true } = {}) {
243
216
  if (needsMarketAdapter(bots)) {
244
217
  apps.unshift({
245
218
  name: 'dexbot-adapter',
246
- script: (0, runtime_entry_1.buildRuntimeScriptPath)(CODE_ROOT, ['market_adapter', 'market_adapter']),
247
- cwd: paths_1.PATHS.PROJECT_ROOT,
219
+ script: buildRuntimeScriptPath(CODE_ROOT, ['market_adapter', 'market_adapter']),
220
+ cwd: PATHS.PROJECT_ROOT,
248
221
  watch: false,
249
222
  autorestart: true,
250
223
  max_memory_restart: '150M',
251
- error_file: path_api_1.path.join(LOGS_DIR, 'dexbot-adapter-error.log'),
252
- out_file: path_api_1.path.join(LOGS_DIR, 'dexbot-adapter.log'),
224
+ error_file: path.join(LOGS_DIR, 'dexbot-adapter-error.log'),
225
+ out_file: path.join(LOGS_DIR, 'dexbot-adapter.log'),
253
226
  log_date_format: 'YY-MM-DD HH:mm:ss.SSS',
254
227
  merge_logs: false,
255
228
  combine_logs: true,
@@ -257,18 +230,18 @@ function buildEcosystemApps(bots, { includeUpdater = true } = {}) {
257
230
  max_restarts: 13,
258
231
  min_uptime: 60000,
259
232
  restart_delay: 3000,
260
- ...((0, runtime_entry_1.isDistCodeRoot)(CODE_ROOT) ? {} : { node_args: ['--import', 'tsx'] })
233
+ ...(isDistCodeRoot(CODE_ROOT) ? {} : { node_args: ['--import', 'tsx'] })
261
234
  });
262
235
  }
263
- if (includeUpdater && constants_1.UPDATER.ACTIVE) {
236
+ if (includeUpdater && UPDATER.ACTIVE) {
264
237
  apps.push({
265
238
  name: "dexbot-update",
266
239
  script: runtimeScript('scripts', 'update.js'),
267
- cwd: paths_1.PATHS.PROJECT_ROOT,
240
+ cwd: PATHS.PROJECT_ROOT,
268
241
  autorestart: false,
269
- cron_restart: constants_1.UPDATER.SCHEDULE,
270
- error_file: path_api_1.path.join(LOGS_DIR, `dexbot-update-error.log`),
271
- out_file: path_api_1.path.join(LOGS_DIR, `dexbot-update.log`),
242
+ cron_restart: UPDATER.SCHEDULE,
243
+ error_file: path.join(LOGS_DIR, `dexbot-update-error.log`),
244
+ out_file: path.join(LOGS_DIR, `dexbot-update.log`),
272
245
  log_date_format: "YY-MM-DD HH:mm:ss.SSS",
273
246
  max_size: '100M'
274
247
  });
@@ -279,10 +252,10 @@ function buildCredentialDaemonApp({ credentialEnv = {} } = {}) {
279
252
  return {
280
253
  name: CREDENTIAL_DAEMON_APP_NAME,
281
254
  script: runtimeScript('credential-daemon.js'),
282
- cwd: paths_1.PATHS.PROJECT_ROOT,
255
+ cwd: PATHS.PROJECT_ROOT,
283
256
  autorestart: false,
284
- error_file: path_api_1.path.join(LOGS_DIR, 'dexbot-cred-error.log'),
285
- out_file: path_api_1.path.join(LOGS_DIR, 'dexbot-cred.log'),
257
+ error_file: path.join(LOGS_DIR, 'dexbot-cred-error.log'),
258
+ out_file: path.join(LOGS_DIR, 'dexbot-cred.log'),
286
259
  log_date_format: 'YY-MM-DD HH:mm:ss.SSS',
287
260
  merge_logs: false,
288
261
  combine_logs: true,
@@ -295,7 +268,7 @@ function buildCredentialDaemonApp({ credentialEnv = {} } = {}) {
295
268
  };
296
269
  }
297
270
  /**
298
- * Generate ecosystem.config.js from bots.json or claw-only mode.
271
+ * Generate ecosystem.config.cjs from bots.json or claw-only mode.
299
272
  * @param {Object} [options={}] - Generation options.
300
273
  * @param {string|null} [options.botNameFilter=null] - Optional bot name to filter by.
301
274
  * @param {boolean} [options.clawOnly=false] - Generate no managed bot apps.
@@ -312,14 +285,14 @@ function generateEcosystemConfig({ botNameFilter = null, clawOnly = false, exitO
312
285
  }
313
286
  // Ensure logs directory exists
314
287
  if (!storage.exists(LOGS_DIR)) {
315
- (0, fs_utils_1.ensureDir)(LOGS_DIR);
288
+ ensureDir(LOGS_DIR);
316
289
  }
317
290
  try {
318
291
  if (clawOnly) {
319
292
  const appsClaw = [];
320
293
  const ecosystemContent = `// Auto-generated by pm2.js - DO NOT EDIT
321
294
  // Regenerate with: dexbot pm2 or node dist/dexbot.js pm2
322
- export default { apps: ${JSON.stringify(appsClaw, null, 2)} }
295
+ module.exports = { apps: ${JSON.stringify(appsClaw, null, 2)} }
323
296
  `;
324
297
  storage.writeFile(ECOSYSTEM_FILE, ecosystemContent);
325
298
  return appsClaw;
@@ -327,8 +300,8 @@ export default { apps: ${JSON.stringify(appsClaw, null, 2)} }
327
300
  if (!storage.exists(BOTS_JSON)) {
328
301
  fail('profiles/bots.json not found. Run: dexbot bot');
329
302
  }
330
- const { config } = (0, bot_settings_1.loadSettingsFile)(BOTS_JSON, { exitOnError });
331
- const bots = (0, bot_settings_1.selectActiveBotEntries)(config);
303
+ const { config } = loadSettingsFile(BOTS_JSON, { exitOnError });
304
+ const bots = selectActiveBotEntries(config);
332
305
  if (botNameFilter) {
333
306
  const filtered = bots.filter((b) => b.name === botNameFilter);
334
307
  if (filtered.length === 0) {
@@ -354,7 +327,7 @@ module.exports = { apps: ${JSON.stringify(apps, null, 2)} };
354
327
  return apps;
355
328
  }
356
329
  catch (err) {
357
- fail(`Error reading bots.json: ${(0, errors_1.getErrorMessage)(err)}`);
330
+ fail(`Error reading bots.json: ${getErrorMessage(err)}`);
358
331
  }
359
332
  }
360
333
  async function runManagedAppsPm2Action(action, { regenerate = false } = {}) {
@@ -368,15 +341,15 @@ async function runManagedAppsPm2Action(action, { regenerate = false } = {}) {
368
341
  }
369
342
  function cleanupStaleCredentialDaemonFiles() {
370
343
  try {
371
- (0, fs_utils_1.safeUnlink)(CREDENTIAL_SOCKET_PATH);
372
- (0, fs_utils_1.safeUnlink)(CREDENTIAL_READY_FILE);
344
+ safeUnlink(CREDENTIAL_SOCKET_PATH);
345
+ safeUnlink(CREDENTIAL_READY_FILE);
373
346
  }
374
347
  catch (e) {
375
348
  // Socket files already cleaned, that's fine
376
349
  }
377
350
  }
378
351
  async function ensureCredentialDaemonPM2({ forceRefresh = false, headless = false, passwordFile = null } = {}) {
379
- ensureCredentialRuntimeDirSync({ root: paths_1.PATHS.PROJECT_ROOT, socketPath: CREDENTIAL_SOCKET_PATH, readyFilePath: CREDENTIAL_READY_FILE });
352
+ ensureCredentialRuntimeDirSync({ root: PATHS.PROJECT_ROOT, socketPath: CREDENTIAL_SOCKET_PATH, readyFilePath: CREDENTIAL_READY_FILE });
380
353
  credentialPolicy.ensurePolicyConfig(POLICY_CONFIG_FILE);
381
354
  const daemonReady = await chainKeys.isDaemonResponsive({
382
355
  socketPath: CREDENTIAL_SOCKET_PATH,
@@ -392,12 +365,12 @@ async function ensureCredentialDaemonPM2({ forceRefresh = false, headless = fals
392
365
  try {
393
366
  let vaultSecret;
394
367
  if (headless) {
395
- vaultSecret = chainKeys.unlockWithPassword((0, headless_password_1.readHeadlessPassword)({ passwordFile }));
368
+ vaultSecret = chainKeys.unlockWithPassword(readHeadlessPassword({ passwordFile }));
396
369
  }
397
370
  else {
398
371
  vaultSecret = await chainKeys.authenticate();
399
372
  }
400
- bootstrap = await (0, credential_bootstrap_1.createPasswordBootstrapServer)({ secret: vaultSecret });
373
+ bootstrap = await createPasswordBootstrapServer({ secret: vaultSecret });
401
374
  console.log(pm2Success('✓ Authentication successful'));
402
375
  await startManagedRuntimePM2({ apps: [], bootstrap });
403
376
  return true;
@@ -410,17 +383,17 @@ async function ensureCredentialDaemonPM2({ forceRefresh = false, headless = fals
410
383
  }
411
384
  async function assertActiveBotTarget(target) {
412
385
  try {
413
- const { config } = await (0, bots_file_lock_1.readBotsFileWithLock)(BOTS_JSON, system_1.parseJsonWithComments);
414
- const botExists = (0, bot_settings_1.selectActiveBotEntries)(config).some((b) => b.name === target);
386
+ const { config } = await readBotsFileWithLock(BOTS_JSON, parseJsonWithComments);
387
+ const botExists = selectActiveBotEntries(config).some((b) => b.name === target);
415
388
  if (!botExists) {
416
389
  throw new Error(`Bot '${target}' not found or not active in profiles/bots.json`);
417
390
  }
418
391
  }
419
392
  catch (err) {
420
- if (String(err && (0, errors_1.getErrorMessage)(err) || '').includes('not found or not active')) {
393
+ if (String(err && getErrorMessage(err) || '').includes('not found or not active')) {
421
394
  throw err;
422
395
  }
423
- throw new Error(`Failed to read bots configuration: ${(0, errors_1.getErrorMessage)(err)}`);
396
+ throw new Error(`Failed to read bots configuration: ${getErrorMessage(err)}`);
424
397
  }
425
398
  }
426
399
  /**
@@ -434,7 +407,7 @@ async function main({ botNameFilter = null, clawOnly = false, headless = false,
434
407
  if (typeof chainKeys.checkKeysFileSecurity === 'function')
435
408
  chainKeys.checkKeysFileSecurity();
436
409
  if (typeof credentialPolicy.checkPolicyFileSecurity === 'function')
437
- credentialPolicy.checkPolicyFileSecurity(paths_1.PATHS.PROFILES.DAEMON_POLICIES_JSON);
410
+ credentialPolicy.checkPolicyFileSecurity(PATHS.PROFILES.DAEMON_POLICIES_JSON);
438
411
  console.log('='.repeat(50));
439
412
  console.log('DEXBot2 PM2 Launcher');
440
413
  if (clawOnly) {
@@ -460,7 +433,7 @@ async function main({ botNameFilter = null, clawOnly = false, headless = false,
460
433
  originalLog(...args);
461
434
  }
462
435
  };
463
- await (0, bitshares_client_1.waitForConnected)(constants_1.TIMING.CONNECTION_TIMEOUT_MS);
436
+ await waitForConnected(TIMING.CONNECTION_TIMEOUT_MS);
464
437
  }
465
438
  finally {
466
439
  // Always restore console output, even if waitForConnected throws
@@ -481,7 +454,7 @@ async function main({ botNameFilter = null, clawOnly = false, headless = false,
481
454
  await ensureCredentialDaemonPM2({ headless, passwordFile });
482
455
  }
483
456
  catch (error) {
484
- console.error(pm2Error(`\n❌ ${(0, errors_1.getErrorMessage)(error)}`));
457
+ console.error(pm2Error(`\n❌ ${getErrorMessage(error)}`));
485
458
  process.exit(1);
486
459
  }
487
460
  // Step 3: Generate ecosystem config
@@ -502,10 +475,10 @@ async function main({ botNameFilter = null, clawOnly = false, headless = false,
502
475
  console.log('='.repeat(50));
503
476
  console.log();
504
477
  }
505
- function startPM2Process(args, env = (0, child_env_1.buildScopedChildEnv)()) {
478
+ function startPM2Process(args, env = buildScopedChildEnv()) {
506
479
  return new Promise((resolve, reject) => {
507
- const pm2 = (0, node_child_process_1.spawn)('pm2', args, {
508
- cwd: paths_1.PATHS.PROJECT_ROOT,
480
+ const pm2 = spawn('pm2', args, {
481
+ cwd: PATHS.PROJECT_ROOT,
509
482
  env,
510
483
  stdio: ['ignore', 'pipe', 'pipe'],
511
484
  detached: false,
@@ -553,7 +526,7 @@ function startCredentialDaemonPM2({ credentialEnv = {} } = {}) {
553
526
  '--log-date-format', app.log_date_format,
554
527
  '--no-autorestart',
555
528
  ];
556
- return startPM2Process(args, (0, child_env_1.buildScopedChildEnv)({ extra: app.env }))
529
+ return startPM2Process(args, buildScopedChildEnv({ extra: app.env }))
557
530
  .then(() => {
558
531
  console.log(`[PM2] App [${CREDENTIAL_DAEMON_APP_NAME}] launched`);
559
532
  });
@@ -566,12 +539,12 @@ async function startManagedRuntimePM2({ apps, bootstrap } = {}) {
566
539
  // PM2-persisted env var. Once consumed the file is deleted, so a
567
540
  // future `pm2 restart dexbot-cred` or `pm2 resurrect` will not
568
541
  // find it and will fall through to interactive auth.
569
- const bootstrapPathFile = path_api_1.path.join(path_api_1.path.dirname(CREDENTIAL_SOCKET_PATH), '.dexbot-cred-bootstrap-path');
542
+ const bootstrapPathFile = path.join(path.dirname(CREDENTIAL_SOCKET_PATH), '.dexbot-cred-bootstrap-path');
570
543
  try {
571
544
  storage.writeFile(bootstrapPathFile, bootstrap.socketPath, { mode: 0o600 });
572
545
  }
573
546
  catch (err) {
574
- throw new Error(`Cannot write bootstrap path file at ${bootstrapPathFile}: ${(0, errors_1.getErrorMessage)(err)}. ` +
547
+ throw new Error(`Cannot write bootstrap path file at ${bootstrapPathFile}: ${getErrorMessage(err)}. ` +
575
548
  `The daemon needs this file to find the bootstrap socket.`);
576
549
  }
577
550
  // Start the daemon WITHOUT DEXBOT_CRED_BOOTSTRAP_SOCKET so PM2 never
@@ -584,7 +557,7 @@ async function startManagedRuntimePM2({ apps, bootstrap } = {}) {
584
557
  await startCredentialDaemonPM2({ credentialEnv: daemonEnv });
585
558
  await Promise.all([
586
559
  bootstrap.waitForTransfer(),
587
- chainKeys.waitForDaemon(constants_1.TIMING.DAEMON_STARTUP_TIMEOUT_MS, {
560
+ chainKeys.waitForDaemon(TIMING.DAEMON_STARTUP_TIMEOUT_MS, {
588
561
  socketPath: CREDENTIAL_SOCKET_PATH,
589
562
  readyFilePath: CREDENTIAL_READY_FILE,
590
563
  }),
@@ -604,7 +577,7 @@ function checkPM2Installed() {
604
577
  catch (e) {
605
578
  // Check if pm2 is available in PATH
606
579
  try {
607
- (0, node_child_process_1.execSync)('pm2 --version', { stdio: 'ignore' });
580
+ execSync('pm2 --version', { stdio: 'ignore' });
608
581
  return true;
609
582
  }
610
583
  catch (err) {
@@ -632,7 +605,7 @@ async function installPM2() {
632
605
  // Helper to run installation command
633
606
  const runInstall = (command, args) => {
634
607
  return new Promise((res, rej) => {
635
- const proc = (0, node_child_process_1.spawn)(command, args, {
608
+ const proc = spawn(command, args, {
636
609
  stdio: 'inherit',
637
610
  shell: process.platform === 'win32'
638
611
  });
@@ -717,7 +690,7 @@ async function execPM2Command(action, target, { suppressStderrOnError = false, s
717
690
  if (target) {
718
691
  args.push(target);
719
692
  }
720
- const pm2 = (0, node_child_process_1.spawn)('pm2', args, {
693
+ const pm2 = spawn('pm2', args, {
721
694
  stdio: 'pipe',
722
695
  shell: process.platform === 'win32'
723
696
  });
@@ -756,7 +729,7 @@ async function execPM2CommandIgnoreMissing(action, target, options = {}) {
756
729
  return true;
757
730
  }
758
731
  catch (error) {
759
- const message = String(error && (0, errors_1.getErrorMessage)(error) ? (0, errors_1.getErrorMessage)(error) : error);
732
+ const message = String(error && getErrorMessage(error) ? getErrorMessage(error) : error);
760
733
  if (message.includes('Process or Namespace') || message.includes('not found') || message.includes('does not exist')) {
761
734
  return false;
762
735
  }
@@ -785,7 +758,7 @@ async function stopPM2Processes(target) {
785
758
  await runManagedAppsPm2Action('stop', { regenerate: true });
786
759
  }
787
760
  catch (err) {
788
- console.warn(`Skipping managed bot stop: ${(0, errors_1.getErrorMessage)(err)}`);
761
+ console.warn(`Skipping managed bot stop: ${getErrorMessage(err)}`);
789
762
  }
790
763
  }
791
764
  console.log('');
@@ -799,14 +772,14 @@ async function stopPM2Processes(target) {
799
772
  }
800
773
  // Validate bot exists in configuration before stopping (with lock protection)
801
774
  try {
802
- const { config } = await (0, bots_file_lock_1.readBotsFileWithLock)(BOTS_JSON, system_1.parseJsonWithComments);
803
- const botExists = (0, bot_settings_1.selectActiveBotEntries)(config).some((b) => b.name === target);
775
+ const { config } = await readBotsFileWithLock(BOTS_JSON, parseJsonWithComments);
776
+ const botExists = selectActiveBotEntries(config).some((b) => b.name === target);
804
777
  if (!botExists) {
805
778
  throw new Error(`Bot '${target}' not found or not active in profiles/bots.json`);
806
779
  }
807
780
  }
808
781
  catch (err) {
809
- throw new Error(`Failed to read bots configuration: ${(0, errors_1.getErrorMessage)(err)}`);
782
+ throw new Error(`Failed to read bots configuration: ${getErrorMessage(err)}`);
810
783
  }
811
784
  // Stop specific bot by name
812
785
  await execPM2Command('stop', target);
@@ -831,7 +804,7 @@ async function deletePM2Processes(target) {
831
804
  await runManagedAppsPm2Action('delete', { regenerate: true });
832
805
  }
833
806
  catch (err) {
834
- console.warn(`Skipping managed bot delete: ${(0, errors_1.getErrorMessage)(err)}`);
807
+ console.warn(`Skipping managed bot delete: ${getErrorMessage(err)}`);
835
808
  }
836
809
  }
837
810
  console.log('');
@@ -846,14 +819,14 @@ async function deletePM2Processes(target) {
846
819
  }
847
820
  // Validate bot exists in configuration before deleting (with lock protection)
848
821
  try {
849
- const { config } = await (0, bots_file_lock_1.readBotsFileWithLock)(BOTS_JSON, system_1.parseJsonWithComments);
850
- const botExists = (0, bot_settings_1.selectActiveBotEntries)(config).some((b) => b.name === target);
822
+ const { config } = await readBotsFileWithLock(BOTS_JSON, parseJsonWithComments);
823
+ const botExists = selectActiveBotEntries(config).some((b) => b.name === target);
851
824
  if (!botExists) {
852
825
  throw new Error(`Bot '${target}' not found or not active in profiles/bots.json`);
853
826
  }
854
827
  }
855
828
  catch (err) {
856
- throw new Error(`Failed to read bots configuration: ${(0, errors_1.getErrorMessage)(err)}`);
829
+ throw new Error(`Failed to read bots configuration: ${getErrorMessage(err)}`);
857
830
  }
858
831
  // Delete specific bot by name
859
832
  await execPM2Command('delete', target);
@@ -921,11 +894,11 @@ Repo-root users can run \`./pm2\` instead.
921
894
  `);
922
895
  }
923
896
  // Run if called directly or via the root-level pm2.js shim
924
- const isPm2DirectRun = require.main === module || (process.argv[1] &&
925
- path_api_1.path.basename(process.argv[1]).replace(/\.js$/, '') === 'pm2');
897
+ const isPm2DirectRun = !!process.argv[1] && (import.meta.url === pathToFileURL(process.argv[1]).href ||
898
+ path.basename(process.argv[1]).replace(/\.js$/, '') === 'pm2');
926
899
  if (isPm2DirectRun) {
927
900
  // Parse command line arguments
928
- const { command, target, clawOnly, headless, passwordFile } = (0, launch_modes_1.parsePm2Args)(process.argv);
901
+ const { command, target, clawOnly, headless, passwordFile } = parsePm2Args(process.argv);
929
902
  (async () => {
930
903
  try {
931
904
  if (!command) {
@@ -945,7 +918,7 @@ if (isPm2DirectRun) {
945
918
  process.exit(0);
946
919
  }
947
920
  else if (command === 'update') {
948
- const update = (0, node_child_process_1.spawn)(config_2.Config.EXEC_PATH, [runtimeScript('scripts', 'update.js')], { stdio: 'inherit' });
921
+ const update = spawn(Config.EXEC_PATH, [runtimeScript('scripts', 'update.js')], { stdio: 'inherit' });
949
922
  update.on('close', (code) => process.exit(code));
950
923
  }
951
924
  else if (command === 'stop') {
@@ -959,7 +932,7 @@ if (isPm2DirectRun) {
959
932
  process.exit(0);
960
933
  }
961
934
  catch (err) {
962
- console.error(pm2Error(`Failed to stop processes: ${(0, errors_1.getErrorMessage)(err)}`));
935
+ console.error(pm2Error(`Failed to stop processes: ${getErrorMessage(err)}`));
963
936
  process.exit(1);
964
937
  }
965
938
  }
@@ -974,7 +947,7 @@ if (isPm2DirectRun) {
974
947
  process.exit(0);
975
948
  }
976
949
  catch (err) {
977
- console.error(pm2Error(`Failed to delete processes: ${(0, errors_1.getErrorMessage)(err)}`));
950
+ console.error(pm2Error(`Failed to delete processes: ${getErrorMessage(err)}`));
978
951
  process.exit(1);
979
952
  }
980
953
  }
@@ -989,7 +962,7 @@ if (isPm2DirectRun) {
989
962
  process.exit(0);
990
963
  }
991
964
  catch (err) {
992
- console.error(pm2Error(`Failed to restart processes: ${(0, errors_1.getErrorMessage)(err)}`));
965
+ console.error(pm2Error(`Failed to restart processes: ${getErrorMessage(err)}`));
993
966
  process.exit(1);
994
967
  }
995
968
  }
@@ -1004,15 +977,16 @@ if (isPm2DirectRun) {
1004
977
  }
1005
978
  }
1006
979
  catch (err) {
1007
- console.error(pm2Error(`Error: ${(0, errors_1.getErrorMessage)(err)}`));
980
+ console.error(pm2Error(`Error: ${getErrorMessage(err)}`));
1008
981
  process.exit(1);
1009
982
  }
1010
983
  })();
1011
984
  }
1012
- module.exports = {
985
+ export { buildCredentialDaemonApp, buildEcosystemApps, buildScopedChildEnv, countManagedBots, deletePM2Processes, ensureCredentialDaemonPM2, generateEcosystemConfig, isServiceApp, main, needsMarketAdapter, restartPM2Processes, stopPM2Processes, startManagedRuntimePM2, usesAmaGridPrice };
986
+ export default {
1013
987
  buildCredentialDaemonApp,
1014
988
  buildEcosystemApps,
1015
- buildScopedChildEnv: child_env_1.buildScopedChildEnv,
989
+ buildScopedChildEnv,
1016
990
  countManagedBots,
1017
991
  deletePM2Processes,
1018
992
  ensureCredentialDaemonPM2,