dexbot 1.6.11 → 1.6.13

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 (398) hide show
  1. package/CHANGELOG.md +67 -4
  2. package/README.md +2 -1
  3. package/analysis/README.md +11 -11
  4. package/analysis/ama_fitting/README.md +5 -3
  5. package/analysis/tradingview/README.md +1 -1
  6. package/analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md +3 -3
  7. package/claw/README.md +1 -0
  8. package/claw/docs/AI_BOT_LIBRARY_API.md +2 -0
  9. package/claw/docs/DEXBOT2_TUNING_CHEAT_SHEET.md +4 -3
  10. package/claw/modules/chain_broadcast.ts +7 -1
  11. package/claw/modules/claw_bridge.ts +0 -3
  12. package/claw/modules/claw_launcher.ts +1 -1
  13. package/claw/modules/claw_skill_md.ts +1 -0
  14. package/claw/modules/launcher_mode_detector.ts +9 -2
  15. package/claw/package.json +3 -3
  16. package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
  17. package/claw/runtimes/openclaw-plugin/package.json +1 -1
  18. package/claw/tsconfig.json +2 -2
  19. package/dist/analysis/account_resolver.d.ts +1 -1
  20. package/dist/analysis/account_resolver.js +2 -1
  21. package/dist/analysis/ama_fitting/analyze_ama_price_changes.js +3 -4
  22. package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js +3 -21
  23. package/dist/analysis/ama_fitting/calibrate_convergence_er.js +0 -1
  24. package/dist/analysis/ama_fitting/fetch_lp_candles.js +55 -45
  25. package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts +1 -8
  26. package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js +45 -24
  27. package/dist/analysis/ama_fitting/optimizer_high_resolution.js +34 -78
  28. package/dist/analysis/analyze_args.d.ts +43 -0
  29. package/dist/analysis/analyze_args.js +61 -0
  30. package/dist/analysis/analyze_dynamic_weight.js +7 -17
  31. package/dist/analysis/analyze_kalman.js +7 -17
  32. package/dist/analysis/analyze_regime.js +7 -17
  33. package/dist/analysis/analyze_regime_windows.js +8 -18
  34. package/dist/analysis/analyze_risk_profile.js +8 -18
  35. package/dist/analysis/analyze_trade_heatmap.js +7 -17
  36. package/dist/analysis/analyze_volatility.js +7 -17
  37. package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts +221 -28
  38. package/dist/analysis/bot_fitting/backtest_ama_sweep.js +23 -103
  39. package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts +34 -4
  40. package/dist/analysis/bot_fitting/backtest_bot_fitting.js +32 -150
  41. package/dist/analysis/bot_fitting/backtest_lookback_drawdown.js +19 -34
  42. package/dist/analysis/bot_fitting/shared_utils.d.ts +77 -9
  43. package/dist/analysis/bot_fitting/shared_utils.js +125 -9
  44. package/dist/analysis/bot_key_utils.d.ts +18 -10
  45. package/dist/analysis/bot_key_utils.js +7 -4
  46. package/dist/analysis/bot_usage/discover_bot_accounts.js +44 -47
  47. package/dist/analysis/bot_usage/kibana_bot_queries.d.ts +1 -21
  48. package/dist/analysis/chain_pool.d.ts +3 -1
  49. package/dist/analysis/chart_ui.d.ts +35 -3
  50. package/dist/analysis/chart_ui.js +43 -4
  51. package/dist/analysis/chart_utils.d.ts +5 -5
  52. package/dist/analysis/chart_utils.js +9 -0
  53. package/dist/analysis/fills_cache.d.ts +4 -24
  54. package/dist/analysis/fills_cache.js +3 -84
  55. package/dist/analysis/fills_source.d.ts +33 -3
  56. package/dist/analysis/fills_source.js +83 -13
  57. package/dist/analysis/grid_correction_check.d.ts +2 -24
  58. package/dist/analysis/grid_correction_check.js +27 -69
  59. package/dist/analysis/math_utils.d.ts +91 -6
  60. package/dist/analysis/math_utils.js +119 -7
  61. package/dist/analysis/pnl_report.js +29 -29
  62. package/dist/analysis/price_sources.d.ts +30 -9
  63. package/dist/analysis/price_sources.js +28 -4
  64. package/dist/analysis/resolve_bot_accounts.js +2 -2
  65. package/dist/analysis/resolve_source.d.ts +1 -1
  66. package/dist/analysis/resolve_source.js +31 -10
  67. package/dist/analysis/trade_profitability.d.ts +29 -2
  68. package/dist/analysis/trade_profitability.js +73 -147
  69. package/dist/analysis/tradingview/analyze_tradingview.d.ts +3 -8
  70. package/dist/analysis/tradingview/analyze_tradingview.js +7 -6
  71. package/dist/analysis/tradingview/grid_reset_config.d.ts +41 -32
  72. package/dist/analysis/tradingview/grid_reset_config.js +23 -11
  73. package/dist/analysis/tradingview/grid_reset_sim.d.ts +75 -9
  74. package/dist/analysis/tradingview/grid_reset_sim.js +4 -3
  75. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts +69 -4
  76. package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +20 -34
  77. package/dist/analysis/trend_detection/backtest_ama_slope_huber.d.ts +1 -101
  78. package/dist/analysis/trend_detection/backtest_ama_slope_huber.js +26 -84
  79. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts +63 -1
  80. package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +16 -41
  81. package/dist/analysis/trend_detection/huber_scale_variants.d.ts +9 -3
  82. package/dist/analysis/trend_detection/huber_scale_variants.js +4 -4
  83. package/dist/analysis/trend_detection/kalman_chart_generator.d.ts +30 -1
  84. package/dist/analysis/trend_detection/kalman_chart_generator.js +3 -3
  85. package/dist/analysis/trend_detection/regime_chart_generator.d.ts +31 -1
  86. package/dist/analysis/trend_detection/regime_chart_generator.js +2 -2
  87. package/dist/analysis/trend_detection/volatility_chart_generator.d.ts +33 -1
  88. package/dist/analysis/trend_detection/volatility_chart_generator.js +9 -10
  89. package/dist/analysis/worker_pool.d.ts +38 -0
  90. package/dist/analysis/worker_pool.js +67 -0
  91. package/dist/credential-daemon.js +34 -20
  92. package/dist/dexbot.js +78 -59
  93. package/dist/market_adapter/ama_signal_runner.js +21 -54
  94. package/dist/market_adapter/candle_utils.d.ts +29 -19
  95. package/dist/market_adapter/candle_utils.js +35 -21
  96. package/dist/market_adapter/cli_args.d.ts +22 -0
  97. package/dist/market_adapter/cli_args.js +30 -0
  98. package/dist/market_adapter/core/asymmetric_bounds.d.ts +13 -4
  99. package/dist/market_adapter/core/config_normalizers.d.ts +3 -3
  100. package/dist/market_adapter/core/config_normalizers.js +11 -6
  101. package/dist/market_adapter/core/kibana_candles.d.ts +56 -19
  102. package/dist/market_adapter/core/kibana_candles.js +12 -9
  103. package/dist/market_adapter/core/kibana_client.d.ts +9 -1
  104. package/dist/market_adapter/core/kibana_client.js +8 -7
  105. package/dist/market_adapter/core/kibana_market_candles.d.ts +3 -2
  106. package/dist/market_adapter/core/market_adapter_service.d.ts +320 -153
  107. package/dist/market_adapter/core/market_adapter_service.js +228 -269
  108. package/dist/market_adapter/core/signals/hurst_analyzer.d.ts +1 -6
  109. package/dist/market_adapter/core/signals/hurst_analyzer.js +1 -1
  110. package/dist/market_adapter/core/signals/permutation_entropy_analyzer.d.ts +1 -11
  111. package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js +1 -1
  112. package/dist/market_adapter/core/strategies/ama.d.ts +10 -2
  113. package/dist/market_adapter/core/strategies/ama.js +2 -4
  114. package/dist/market_adapter/core/strategies/ama_slope_model.d.ts +14 -1
  115. package/dist/market_adapter/core/strategies/ama_slope_model.js +12 -34
  116. package/dist/market_adapter/core/strategies/atr/calculator.d.ts +7 -2
  117. package/dist/market_adapter/core/strategies/atr/calculator.js +2 -34
  118. package/dist/market_adapter/core/strategies/collateral_manager.d.ts +7 -1
  119. package/dist/market_adapter/core/strategies/collateral_manager.js +0 -22
  120. package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts +34 -6
  121. package/dist/market_adapter/core/strategies/dynamic_weight_series.js +7 -7
  122. package/dist/market_adapter/core/strategies/regime_gate.d.ts +24 -15
  123. package/dist/market_adapter/core/strategies/regime_gate.js +4 -31
  124. package/dist/market_adapter/core/strategies/regime_interp.d.ts +7 -1
  125. package/dist/market_adapter/core/strategies/regime_interp.js +14 -22
  126. package/dist/market_adapter/core/strategies/volatility_shift.d.ts +11 -1
  127. package/dist/market_adapter/core/strategies/volatility_shift.js +0 -13
  128. package/dist/market_adapter/inputs/cex_candle_parsing.d.ts +29 -0
  129. package/dist/market_adapter/inputs/cex_candle_parsing.js +52 -0
  130. package/dist/market_adapter/inputs/fetch_book_data.d.ts +20 -4
  131. package/dist/market_adapter/inputs/fetch_book_data.js +3 -2
  132. package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +160 -332
  133. package/dist/market_adapter/inputs/fetch_lp_data.d.ts +50 -8
  134. package/dist/market_adapter/inputs/fetch_lp_data.js +47 -22
  135. package/dist/market_adapter/inputs/kibana_feed_source.d.ts +74 -15
  136. package/dist/market_adapter/inputs/kibana_feed_source.js +26 -41
  137. package/dist/market_adapter/inputs/kibana_source.d.ts +25 -3
  138. package/dist/market_adapter/inputs/kibana_source.js +2 -2
  139. package/dist/market_adapter/inputs/window_cache.d.ts +93 -156
  140. package/dist/market_adapter/inputs/window_cache.js +59 -184
  141. package/dist/market_adapter/interval_utils.d.ts +15 -5
  142. package/dist/market_adapter/interval_utils.js +16 -1
  143. package/dist/market_adapter/log_format.d.ts +6 -6
  144. package/dist/market_adapter/log_format.js +28 -21
  145. package/dist/market_adapter/lp_chart_core.d.ts +22 -1
  146. package/dist/market_adapter/lp_chart_core.js +26 -192
  147. package/dist/market_adapter/lp_chart_runner.d.ts +10 -7
  148. package/dist/market_adapter/lp_chart_runner.js +37 -19
  149. package/dist/market_adapter/lp_chart_strategy_loader.d.ts +41 -6
  150. package/dist/market_adapter/lp_chart_strategy_loader.js +8 -7
  151. package/dist/market_adapter/market_adapter.d.ts +94 -32
  152. package/dist/market_adapter/market_adapter.js +94 -120
  153. package/dist/market_adapter/utils/adapter_client.d.ts +3 -3
  154. package/dist/market_adapter/utils/adapter_client.js +2 -2
  155. package/dist/market_adapter/utils/atomic_write.d.ts +8 -1
  156. package/dist/market_adapter/utils/chain.d.ts +50 -41
  157. package/dist/market_adapter/utils/chain.js +40 -46
  158. package/dist/market_adapter/utils/data_discovery.d.ts +49 -2
  159. package/dist/market_adapter/utils/data_discovery.js +220 -27
  160. package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts +12 -3
  161. package/dist/market_adapter/utils/file_json_cache.d.ts +2 -2
  162. package/dist/market_adapter/utils/file_lock.d.ts +28 -14
  163. package/dist/market_adapter/utils/file_lock.js +36 -32
  164. package/dist/market_adapter/utils/month_shards.d.ts +84 -0
  165. package/dist/market_adapter/utils/month_shards.js +237 -0
  166. package/dist/market_adapter/utils/native_history.d.ts +9 -2
  167. package/dist/market_adapter/utils/native_history.js +35 -28
  168. package/dist/modules/account_bots.d.ts +578 -21
  169. package/dist/modules/account_bots.js +272 -267
  170. package/dist/modules/account_orders.d.ts +79 -30
  171. package/dist/modules/account_orders.js +60 -64
  172. package/dist/modules/authority_resolver.d.ts +12 -2
  173. package/dist/modules/authority_resolver.js +15 -8
  174. package/dist/modules/bitshares-native/chain_client.d.ts +39 -4
  175. package/dist/modules/bitshares-native/chain_client.js +59 -59
  176. package/dist/modules/bitshares-native/crypto/ecc.browser.js +11 -171
  177. package/dist/modules/bitshares-native/crypto/ecc.js +13 -176
  178. package/dist/modules/bitshares-native/crypto/ecc_core.d.ts +33 -0
  179. package/dist/modules/bitshares-native/crypto/ecc_core.js +213 -0
  180. package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts +2 -1
  181. package/dist/modules/bitshares-native/crypto/ecc_selector.js +1 -13
  182. package/dist/modules/bitshares-native/index.d.ts +1 -1
  183. package/dist/modules/bitshares-native/lru_cache.d.ts +7 -7
  184. package/dist/modules/bitshares-native/resolvers.d.ts +18 -6
  185. package/dist/modules/bitshares-native/resolvers.js +22 -25
  186. package/dist/modules/bitshares-native/serial/lazy_buffer.d.ts +4 -0
  187. package/dist/modules/bitshares-native/serial/lazy_buffer.js +21 -0
  188. package/dist/modules/bitshares-native/serial/operations.d.ts +1 -1
  189. package/dist/modules/bitshares-native/serial/serializer.d.ts +16 -12
  190. package/dist/modules/bitshares-native/serial/serializer.js +7 -13
  191. package/dist/modules/bitshares-native/serial/types.d.ts +25 -16
  192. package/dist/modules/bitshares-native/serial/types.js +73 -108
  193. package/dist/modules/bitshares-native/signing_client.d.ts +32 -2
  194. package/dist/modules/bitshares-native/signing_client.js +19 -14
  195. package/dist/modules/bitshares-native/subscriptions.d.ts +81 -1
  196. package/dist/modules/bitshares-native/subscriptions.js +12 -12
  197. package/dist/modules/bitshares-native/transport.d.ts +5 -4
  198. package/dist/modules/bitshares-native/transport.js +5 -4
  199. package/dist/modules/bitshares-native/tx/builder.d.ts +40 -5
  200. package/dist/modules/bitshares-native/tx/builder.js +4 -3
  201. package/dist/modules/bitshares-native/tx/tx_cache.d.ts +4 -4
  202. package/dist/modules/bitshares_client.d.ts +45 -13
  203. package/dist/modules/bitshares_client.js +28 -19
  204. package/dist/modules/bot_defaults.d.ts +8 -16
  205. package/dist/modules/bot_defaults.js +1 -5
  206. package/dist/modules/bot_settings.d.ts +44 -10
  207. package/dist/modules/bot_settings.js +11 -8
  208. package/dist/modules/bots_file_lock.d.ts +6 -6
  209. package/dist/modules/bots_file_lock.js +16 -12
  210. package/dist/modules/broadcast_failure.d.ts +4 -3
  211. package/dist/modules/broadcast_failure.js +5 -4
  212. package/dist/modules/chain_keys.d.ts +42 -40
  213. package/dist/modules/chain_keys.js +53 -45
  214. package/dist/modules/chain_orders.d.ts +94 -60
  215. package/dist/modules/chain_orders.js +81 -118
  216. package/dist/modules/cli_start_onboarding.d.ts +2 -1
  217. package/dist/modules/constants.d.ts +534 -32
  218. package/dist/modules/constants.js +35 -48
  219. package/dist/modules/cr_planner.d.ts +41 -3
  220. package/dist/modules/cr_planner.js +1 -5
  221. package/dist/modules/credential_policy.d.ts +68 -8
  222. package/dist/modules/credential_policy.js +37 -31
  223. package/dist/modules/credential_session_cache.d.ts +2 -2
  224. package/dist/modules/credit_pricing.d.ts +43 -6
  225. package/dist/modules/credit_pricing.js +70 -60
  226. package/dist/modules/credit_runtime.d.ts +283 -118
  227. package/dist/modules/credit_runtime.js +500 -231
  228. package/dist/modules/crypto/browser_provider.js +6 -4
  229. package/dist/modules/crypto/node_provider.js +1 -1
  230. package/dist/modules/crypto/pure_scrypt.js +35 -4
  231. package/dist/modules/crypto/pure_secp256k1.js +72 -26
  232. package/dist/modules/crypto/sync.d.ts +9 -9
  233. package/dist/modules/crypto/sync.js +16 -9
  234. package/dist/modules/daemon_node_health.d.ts +4 -3
  235. package/dist/modules/dexbot_class.d.ts +213 -146
  236. package/dist/modules/dexbot_class.js +183 -86
  237. package/dist/modules/dexbot_cow_runtime.d.ts +160 -87
  238. package/dist/modules/dexbot_cow_runtime.js +302 -234
  239. package/dist/modules/dexbot_credential_client.d.ts +19 -18
  240. package/dist/modules/dexbot_credential_client.js +1 -2
  241. package/dist/modules/dexbot_fill_runtime.d.ts +63 -49
  242. package/dist/modules/dexbot_fill_runtime.js +53 -47
  243. package/dist/modules/dexbot_maintenance_runtime.d.ts +127 -71
  244. package/dist/modules/dexbot_maintenance_runtime.js +187 -147
  245. package/dist/modules/dexbot_startup_runtime.d.ts +11 -11
  246. package/dist/modules/dexbot_startup_runtime.js +56 -57
  247. package/dist/modules/dexbot_state_recovery.d.ts +13 -12
  248. package/dist/modules/dexbot_state_recovery.js +18 -13
  249. package/dist/modules/fund_registry.d.ts +4 -2
  250. package/dist/modules/fund_registry.js +10 -10
  251. package/dist/modules/general_settings.d.ts +30 -4
  252. package/dist/modules/graceful_shutdown.d.ts +3 -3
  253. package/dist/modules/graceful_shutdown.js +19 -13
  254. package/dist/modules/grid_price_source.d.ts +1 -1
  255. package/dist/modules/key_store.d.ts +14 -8
  256. package/dist/modules/key_store.js +7 -7
  257. package/dist/modules/launcher/adapter_requirement.d.ts +11 -5
  258. package/dist/modules/launcher/adapter_requirement.js +5 -5
  259. package/dist/modules/launcher/bot_supervisor.d.ts +106 -24
  260. package/dist/modules/launcher/bot_supervisor.js +12 -11
  261. package/dist/modules/launcher/credential_bootstrap.d.ts +1 -1
  262. package/dist/modules/launcher/credential_bootstrap.js +1 -1
  263. package/dist/modules/launcher/credential_daemon.d.ts +4 -4
  264. package/dist/modules/launcher/credential_daemon.js +2 -2
  265. package/dist/modules/launcher/credential_secret.d.ts +1 -1
  266. package/dist/modules/launcher/foreign_cred_daemon.d.ts +2 -2
  267. package/dist/modules/launcher/market_adapter_runtime.d.ts +61 -6
  268. package/dist/modules/launcher/market_adapter_watchdog.d.ts +10 -2
  269. package/dist/modules/launcher/market_adapter_watchdog.js +4 -0
  270. package/dist/modules/launcher/monolithic_runtime.d.ts +18 -16
  271. package/dist/modules/launcher/status_reporting.d.ts +22 -14
  272. package/dist/modules/launcher/supervisor_control.d.ts +8 -1
  273. package/dist/modules/launcher/supervisor_control.js +4 -2
  274. package/dist/modules/lazy_shim.d.ts +11 -0
  275. package/dist/modules/lazy_shim.js +16 -0
  276. package/dist/modules/market_adapter_whitelist.d.ts +9 -3
  277. package/dist/modules/market_adapter_whitelist.js +15 -3
  278. package/dist/modules/node_connect_policy.d.ts +3 -2
  279. package/dist/modules/node_failure_ledger.d.ts +6 -5
  280. package/dist/modules/node_manager.d.ts +41 -11
  281. package/dist/modules/node_manager.js +5 -4
  282. package/dist/modules/order/accounting.d.ts +53 -24
  283. package/dist/modules/order/accounting.js +16 -15
  284. package/dist/modules/order/async_lock.d.ts +5 -2
  285. package/dist/modules/order/async_lock.js +1 -1
  286. package/dist/modules/order/export.d.ts +7 -6
  287. package/dist/modules/order/export.js +1 -7
  288. package/dist/modules/order/format.d.ts +16 -7
  289. package/dist/modules/order/format.js +15 -3
  290. package/dist/modules/order/genesis_policy.d.ts +24 -21
  291. package/dist/modules/order/genesis_policy.js +17 -10
  292. package/dist/modules/order/grid.d.ts +144 -36
  293. package/dist/modules/order/grid.js +226 -145
  294. package/dist/modules/order/grid_reconcile.d.ts +21 -20
  295. package/dist/modules/order/grid_reconcile.js +13 -12
  296. package/dist/modules/order/grid_reconcile_internal.d.ts +85 -72
  297. package/dist/modules/order/grid_reconcile_internal.js +28 -19
  298. package/dist/modules/order/index.d.ts +264 -1
  299. package/dist/modules/order/logger.d.ts +46 -19
  300. package/dist/modules/order/logger.js +38 -49
  301. package/dist/modules/order/logger_state.d.ts +4 -4
  302. package/dist/modules/order/manager.d.ts +232 -191
  303. package/dist/modules/order/manager.js +110 -130
  304. package/dist/modules/order/processed_fill_store.d.ts +18 -3
  305. package/dist/modules/order/processed_fill_store.js +16 -27
  306. package/dist/modules/order/strategy.d.ts +21 -13
  307. package/dist/modules/order/strategy.js +5 -6
  308. package/dist/modules/order/sync_engine.d.ts +91 -33
  309. package/dist/modules/order/sync_engine.js +84 -53
  310. package/dist/modules/order/utils/math.d.ts +157 -102
  311. package/dist/modules/order/utils/math.js +77 -38
  312. package/dist/modules/order/utils/order.d.ts +310 -110
  313. package/dist/modules/order/utils/order.js +153 -126
  314. package/dist/modules/order/utils/slot.d.ts +1 -1
  315. package/dist/modules/order/utils/system.d.ts +156 -26
  316. package/dist/modules/order/utils/system.js +103 -71
  317. package/dist/modules/order/utils/validate.d.ts +89 -41
  318. package/dist/modules/order/utils/validate.js +26 -24
  319. package/dist/modules/order/utils/withPoolRef.d.ts +6 -4
  320. package/dist/modules/order/utils/withPoolRef.js +18 -12
  321. package/dist/modules/order/working_grid.d.ts +14 -13
  322. package/dist/modules/paths.d.ts +1 -4
  323. package/dist/modules/paths.js +33 -61
  324. package/dist/modules/process_discovery.d.ts +1 -1
  325. package/dist/modules/process_discovery.js +2 -1
  326. package/dist/modules/runtime.d.ts +7 -3
  327. package/dist/modules/runtime.js +4 -3
  328. package/dist/modules/runtime_settings.d.ts +14 -11
  329. package/dist/modules/runtime_settings.js +30 -24
  330. package/dist/modules/settings_merge.d.ts +29 -3
  331. package/dist/modules/settings_merge.js +56 -78
  332. package/dist/modules/socket_json_client.d.ts +9 -5
  333. package/dist/modules/storage/browser_adapter.d.ts +38 -53
  334. package/dist/modules/storage/browser_adapter.js +7 -30
  335. package/dist/modules/storage/index.d.ts +1 -1
  336. package/dist/modules/storage/node_adapter.d.ts +45 -27
  337. package/dist/modules/storage/node_adapter.js +9 -9
  338. package/dist/modules/storage/types.d.ts +5 -4
  339. package/dist/modules/types.d.ts +1090 -6
  340. package/dist/modules/types.js +4 -1
  341. package/dist/modules/utils/asset_symbols.d.ts +2 -1
  342. package/dist/modules/utils/asset_symbols.js +2 -1
  343. package/dist/modules/utils/errors.d.ts +9 -0
  344. package/dist/modules/utils/errors.js +24 -4
  345. package/dist/modules/utils/time_range.d.ts +1 -12
  346. package/dist/modules/utils/time_range.js +1 -1
  347. package/dist/modules/validate_profiles.js +53 -43
  348. package/dist/modules/version_notice.d.ts +23 -11
  349. package/dist/modules/version_notice.js +6 -4
  350. package/dist/pm2.d.ts +28 -27
  351. package/dist/pm2.js +61 -40
  352. package/dist/scripts/analyze-credit.d.ts +2 -1
  353. package/dist/scripts/analyze-credit.js +23 -24
  354. package/dist/scripts/analyze-git.js +2 -15
  355. package/dist/scripts/analyze-orders.d.ts +77 -9
  356. package/dist/scripts/analyze-orders.js +65 -40
  357. package/dist/scripts/chart_command.d.ts +27 -18
  358. package/dist/scripts/chart_command.js +15 -13
  359. package/dist/scripts/check_any.d.ts +22 -0
  360. package/dist/scripts/check_any.js +158 -0
  361. package/dist/scripts/diagnose-pool-history.js +13 -13
  362. package/dist/scripts/print_grid.js +0 -1
  363. package/dist/scripts/run-tests.js +39 -8
  364. package/dist/scripts/runner.js +1 -1
  365. package/dist/scripts/sync-version.js +0 -10
  366. package/dist/scripts/test-credit-renewal.js +30 -21
  367. package/dist/scripts/update.d.ts +10 -5
  368. package/dist/scripts/update.js +168 -103
  369. package/dist/scripts/update_dist_freshness.js +1 -0
  370. package/dist/scripts/update_layout.d.ts +61 -0
  371. package/dist/scripts/update_layout.js +180 -0
  372. package/dist/scripts/validate_bots.js +2 -1
  373. package/dist/scripts/verify-browser-bundle.js +8 -0
  374. package/dist/unlock.d.ts +28 -3
  375. package/dist/unlock.js +63 -35
  376. package/docs/BITSHARES_ONBOARDING.md +10 -12
  377. package/docs/COPY_ON_WRITE_MASTER_PLAN.md +2 -2
  378. package/docs/COW_INVARIANTS.md +13 -6
  379. package/docs/DEXBOT_COMPARISON.md +8 -8
  380. package/docs/EVOLUTION.md +10 -8
  381. package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +5 -5
  382. package/docs/GRID_RECALCULATION.md +4 -2
  383. package/docs/GRID_RECONCILE.md +14 -3
  384. package/docs/LIFECYCLE.md +11 -11
  385. package/docs/MPA_CREDIT_USAGE.md +22 -3
  386. package/docs/README.md +14 -3
  387. package/docs/WORKFLOW.md +1 -0
  388. package/docs/architecture.md +31 -19
  389. package/docs/developer_guide.md +6 -6
  390. package/market_adapter/README.md +12 -5
  391. package/modules/README.md +4 -1
  392. package/package.json +9 -9
  393. package/scripts/README.md +43 -38
  394. package/tests/README.md +25 -10
  395. package/dist/scripts/diagnose-kibana-candles.d.ts +0 -3
  396. package/dist/scripts/diagnose-kibana-candles.js +0 -82
  397. package/scripts/git-viewer.sh +0 -489
  398. package/scripts/postinstall.js +0 -16
@@ -1,82 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire } from 'node:module';
3
- const require = createRequire(import.meta.url);
4
- 'use strict';
5
- /**
6
- * Diagnostic: Fetch raw Kibana LP candles for pool 1.19.133
7
- * to verify whether the pool actually had trading activity.
8
- */
9
- const kibanaSource = require('../market_adapter/inputs/kibana_source');
10
- async function main() {
11
- const assetA = { id: '1.3.5537', precision: 4, symbol: 'IOB.XRP' };
12
- const assetB = { id: '1.3.0', precision: 5, symbol: 'BTS' };
13
- console.log('Fetching Kibana LP candles for pool 1.19.133...');
14
- console.log('Lookback: 720h (30 days), interval: 1h');
15
- console.log('');
16
- const candles = await kibanaSource.getLpCandlesForPool('1.19.133', assetA, assetB, {
17
- intervalSeconds: 3600,
18
- lookbackHours: 720,
19
- apiKey: null,
20
- });
21
- console.log(`Total candles returned: ${candles.length}`);
22
- if (candles.length === 0) {
23
- console.log('NO candles returned from Kibana.');
24
- return;
25
- }
26
- // Count unique close prices
27
- const uniqueCloses = new Set(candles.map((c) => c[4]));
28
- console.log(`Unique close prices: ${uniqueCloses.size}`);
29
- // Show first and last
30
- const first = candles[0];
31
- const last = candles[candles.length - 1];
32
- console.log(`\nFirst candle: ${new Date(first[0]).toISOString()} O=${first[1]} H=${first[2]} L=${first[3]} C=${first[4]} vol=${first[5]}`);
33
- console.log(`Last candle: ${new Date(last[0]).toISOString()} O=${last[1]} H=${last[2]} L=${last[3]} C=${last[4]} vol=${last[5]}`);
34
- // Find runs of identical prices
35
- let maxRun = 0;
36
- let currentRun = 1;
37
- let maxRunPrice = null;
38
- for (let i = 1; i < candles.length; i++) {
39
- if (candles[i][4] === candles[i - 1][4]) {
40
- currentRun++;
41
- if (currentRun > maxRun) {
42
- maxRun = currentRun;
43
- maxRunPrice = candles[i][4];
44
- }
45
- }
46
- else {
47
- currentRun = 1;
48
- }
49
- }
50
- console.log(`\nLongest run of identical closes: ${maxRun} candles @ ${maxRunPrice}`);
51
- // Show candles with non-zero volume
52
- const withVolume = candles.filter((c) => c[5] > 0);
53
- console.log(`Candles with volume > 0: ${withVolume.length}`);
54
- const trueOhlc = candles.filter((c) => c[5] > 0 && (c[1] !== c[2] || c[1] !== c[3] || c[1] !== c[4]));
55
- console.log(`Candles with non-flat OHLC: ${trueOhlc.length}`);
56
- // Show a few recent candles
57
- console.log('\nLast 10 candles:');
58
- candles.slice(-10).forEach((c, i) => {
59
- const idx = candles.length - 10 + i;
60
- console.log(` [${idx}] ${new Date(c[0]).toISOString()} O=${c[1].toFixed(6)} H=${c[2].toFixed(6)} L=${c[3].toFixed(6)} C=${c[4].toFixed(6)} vol=${c[5].toFixed(2)}`);
61
- });
62
- if (trueOhlc.length > 0) {
63
- console.log('\nRecent non-flat OHLC candles:');
64
- trueOhlc.slice(-10).forEach((c) => {
65
- console.log(` ${new Date(c[0]).toISOString()} O=${c[1].toFixed(6)} H=${c[2].toFixed(6)} L=${c[3].toFixed(6)} C=${c[4].toFixed(6)} vol=${c[5].toFixed(2)}`);
66
- });
67
- }
68
- // Show where price changes happened
69
- console.log('\nPrice changes (first 20):');
70
- let changes = 0;
71
- for (let i = 1; i < candles.length && changes < 20; i++) {
72
- if (candles[i][4] !== candles[i - 1][4]) {
73
- changes++;
74
- console.log(` [${i}] ${new Date(candles[i][0]).toISOString()} ${candles[i - 1][4].toFixed(6)} -> ${candles[i][4].toFixed(6)}`);
75
- }
76
- }
77
- }
78
- main().catch(err => {
79
- console.error('Fatal:', err);
80
- process.exit(1);
81
- });
82
- //# sourceMappingURL=diagnose-kibana-candles.js.map
@@ -1,489 +0,0 @@
1
- #!/bin/bash
2
- # Git Viewer - Interactive tool for monitoring and navigating git changes
3
- # This script provides a comprehensive view of uncommitted, committed, and pushed changes
4
- # with an interactive menu system and fzf-based search/preview capabilities.
5
-
6
- ################################################################################
7
- # DEPENDENCY CHECK SECTION
8
- ################################################################################
9
-
10
- # check_dependencies: Verify and install required system tools
11
- # Required packages:
12
- # - delta: Enhanced diff viewer with syntax highlighting
13
- # - fzf: Fuzzy finder for interactive selection
14
- # - bat/batcat: Syntax-highlighted file viewer
15
- # This function checks each dependency and installs missing packages
16
- # using the appropriate package manager for the current OS.
17
- check_dependencies() {
18
- local missing_packages=()
19
-
20
- # Check for delta - used for colorized diff output
21
- if ! command -v delta &> /dev/null; then
22
- missing_packages+=("git-delta")
23
- fi
24
-
25
- # Check for fzf - used for interactive file/commit selection
26
- if ! command -v fzf &> /dev/null; then
27
- missing_packages+=("fzf")
28
- fi
29
-
30
- # Check for batcat (Ubuntu) or bat (other distros) - used for file syntax highlighting
31
- if ! command -v batcat &> /dev/null && ! command -v bat &> /dev/null; then
32
- missing_packages+=("bat")
33
- fi
34
-
35
- # Install missing packages if any were found
36
- if [ ${#missing_packages[@]} -gt 0 ]; then
37
- echo "Installing missing dependencies: ${missing_packages[@]}"
38
-
39
- if command -v apt-get &> /dev/null; then
40
- sudo apt-get update -qq
41
- sudo apt-get install -y -qq "${missing_packages[@]}"
42
- elif command -v brew &> /dev/null; then
43
- brew install "${missing_packages[@]}"
44
- elif command -v dnf &> /dev/null; then
45
- sudo dnf install -y "${missing_packages[@]}"
46
- elif command -v pacman &> /dev/null; then
47
- sudo pacman -Syu --noconfirm "${missing_packages[@]}"
48
- else
49
- echo "Warning: Could not detect package manager. Please install manually: ${missing_packages[@]}"
50
- echo " apt-get: sudo apt-get install ${missing_packages[*]}"
51
- echo " brew: brew install ${missing_packages[*]}"
52
- return 0
53
- fi
54
-
55
- echo "Dependencies installed successfully!"
56
- sleep 1
57
- fi
58
- }
59
-
60
- # Run dependency check on script startup
61
- check_dependencies
62
-
63
- ################################################################################
64
- # TERMINAL & CLEANUP SECTION
65
- ################################################################################
66
-
67
- # clear_screen: ANSI escape sequence to clear terminal and move cursor to home position
68
- # Uses: ESC[2J (clear screen) + ESC[H (move cursor to 0,0)
69
- clear_screen() {
70
- printf "\033[2J\033[H"
71
- }
72
-
73
- # cleanup: Graceful exit handler called when user presses Ctrl+C or terminates script
74
- # Resets terminal to normal mode and exits with status 0
75
- cleanup() {
76
- clear_screen
77
- # Reset terminal to normal mode (in case any special terminal modes were enabled)
78
- stty sane 2>/dev/null || true
79
- echo "Exiting..."
80
- exit 0
81
- }
82
-
83
- # Set up signal handlers for graceful shutdown on interrupt or termination signals
84
- trap cleanup INT TERM
85
-
86
- ################################################################################
87
- # MENU & DISPLAY SECTION
88
- ################################################################################
89
-
90
- # show_menu: Display main navigation menu with available options
91
- # Options:
92
- # [1] View all changes - Show complete git status across all change categories
93
- # [2] Search uncommitted - Interactive search through staged/unstaged/untracked files
94
- # [3] Search committed - Interactive search through unpushed commits
95
- # [4] Search pushed - Interactive search through remote commits
96
- # [q] Quit - Exit the application
97
- show_menu() {
98
- echo ""
99
- echo "═══════════════════════════════════════════════════════"
100
- echo "CONTROLS:"
101
- echo " [1] View all changes [2] Search uncommitted"
102
- echo " [3] Search committed [4] Search pushed"
103
- echo " [q] Quit"
104
- echo "═══════════════════════════════════════════════════════"
105
- }
106
-
107
- # show_all_changes: Display comprehensive view of all git changes in three categories
108
- # Categories displayed:
109
- # 1. UNCOMMITTED: Changes not yet committed (staged, unstaged, untracked)
110
- # 2. COMMITTED: Local commits not yet pushed to remote
111
- # 3. PUSHED: Latest commits on the remote branch
112
- # Uses delta for enhanced diff output and displays timestamp of last update
113
- show_all_changes() {
114
- clear_screen
115
- echo "=== Complete Git Changes Monitor ==="
116
- echo "Last update: $(date '+%Y-%m-%d %H:%M:%S')"
117
- echo "=================================================="
118
- echo ""
119
-
120
- # Get current branch and derive remote branch name
121
- current_branch=$(git rev-parse --abbrev-ref HEAD)
122
- remote_branch="origin/$current_branch"
123
- echo "Current branch: $current_branch | Remote: $remote_branch"
124
- echo ""
125
-
126
- # Section 1: Display uncommitted changes (staged, unstaged, untracked)
127
- echo "========== 1. UNCOMMITTED (All changes not yet committed) =========="
128
- echo "--- Staged changes ---"
129
- git diff --staged | delta || echo "No staged changes"
130
- echo ""
131
- echo "--- Unstaged changes ---"
132
- git diff | delta || echo "No unstaged changes"
133
- echo ""
134
- echo "--- Untracked files ---"
135
- git ls-files --others --exclude-standard || echo "No untracked files"
136
-
137
- echo ""
138
- # Section 2: Display commits that exist locally but haven't been pushed to remote
139
- echo "========== 2. COMMITTED (Local commits not yet pushed) =========="
140
- echo "Commits:"
141
- git log origin/$(git rev-parse --abbrev-ref HEAD)..HEAD --oneline 2>/dev/null || echo "No committed unpushed changes"
142
- echo ""
143
- echo "Diff:"
144
- git diff origin/$(git rev-parse --abbrev-ref HEAD)..HEAD 2>/dev/null | delta || echo "No diff in unpushed commits"
145
-
146
- echo ""
147
- # Section 3: Display latest commits from the remote branch
148
- echo "========== 3. PUSHED (On remote branch) =========="
149
- echo "Latest pushed commits:"
150
- git log origin/$(git rev-parse --abbrev-ref HEAD) --oneline -10 2>/dev/null || echo "Remote branch not found"
151
-
152
- show_menu
153
- }
154
-
155
- ################################################################################
156
- # SEARCH UNCOMMITTED SECTION
157
- ################################################################################
158
-
159
- # search_uncommitted: Interactive search and preview of uncommitted changes
160
- # Displays:
161
- # - Staged files
162
- # - Unstaged files
163
- # - Untracked files
164
- # Uses fzf for fuzzy file selection with live preview via batcat/bat
165
- # After selecting a file, user can toggle between:
166
- # [f] Full file view - Show entire file with syntax highlighting
167
- # [d] Diff view - Show only changes made to the file
168
- # [q] Back - Return to file selection
169
- # [b] Main menu - Return to main menu
170
- search_uncommitted() {
171
- clear_screen
172
- echo "╔═══════════════════════════════════════════════════════╗"
173
- echo "║ SEARCH MODE - Type to filter files"
174
- echo "║ UP/DOWN arrows select | ENTER opens file | ESC back"
175
- echo "╚═══════════════════════════════════════════════════════╝"
176
- echo ""
177
-
178
- # Gather all uncommitted files from three sources
179
- staged=$(git diff --staged --name-only)
180
- unstaged=$(git diff --name-only)
181
- untracked=$(git ls-files --others --exclude-standard)
182
- # Combine all file lists, remove empty lines, and deduplicate
183
- files=$(echo -e "$staged\n$unstaged\n$untracked" | grep -v "^$" | sort -u)
184
-
185
- # Handle case where no uncommitted files exist
186
- if [ -z "$files" ]; then
187
- echo "No uncommitted files"
188
- sleep 2
189
- show_all_changes
190
- return
191
- fi
192
-
193
- # Loop to handle multiple file selections before returning to main menu
194
- while true; do
195
- # Use fzf to select file with preview window showing first 100 lines
196
- # --preview uses batcat or fallback to head for file preview
197
- # --preview-window=right:67% shows preview on right side with 67% width
198
- # --bind 'esc:abort' allows ESC to exit fzf without selection
199
- selected=$(echo "$files" | fzf --ansi --preview 'batcat --color=always --line-range :100 {} 2>/dev/null || head -100 {}' --preview-window=right:67% --bind 'esc:abort')
200
-
201
- # If user pressed ESC, return to main menu
202
- if [ -z "$selected" ]; then
203
- show_all_changes
204
- return
205
- fi
206
-
207
- # File was selected - enter file viewing mode
208
- if [ -n "$selected" ]; then
209
- view_mode="full" # Start in full file view mode
210
- # Loop to allow user to toggle between full/diff views for same file
211
- while true; do
212
- clear_screen
213
- echo "╔═══════════════════════════════════════════════════════╗"
214
- echo "║ VIEWING: $selected"
215
- echo "║ Display: $([ "$view_mode" = "diff" ] && echo "DIFF ONLY" || echo "FULL FILE")"
216
- echo "╚═══════════════════════════════════════════════════════╝"
217
- echo ""
218
- echo "⚠️ DO NOT TYPE - Use SINGLE KEYS only:"
219
- echo " [f]=Full [d]=Diff [q]=Back to search [b]=Main menu"
220
- echo ""
221
- echo "────────────────────────────────────────────────────────"
222
- echo ""
223
-
224
- # Display either diff or full file content based on current view mode
225
- if [ "$view_mode" = "diff" ]; then
226
- # Check if file is tracked in git
227
- if git ls-files --error-unmatch "$selected" 2>/dev/null; then
228
- # File is tracked - show diff of changes
229
- git diff --color=always "$selected" 2>/dev/null | delta || echo "No changes in this file"
230
- else
231
- # File is untracked (new) - cannot show diff
232
- echo "File is untracked (new file) - no diff to show"
233
- fi
234
- else
235
- # Full file view mode - show entire file with syntax highlighting
236
- batcat --color=always "$selected" 2>/dev/null || cat "$selected"
237
- fi
238
-
239
- echo ""
240
- echo "════════════════════════════════════════════════════════"
241
- # Read single keystroke without requiring Enter (non-blocking read)
242
- read -n 1 -s key
243
-
244
- # Handle user input
245
- case $key in
246
- f) view_mode="full" ;; # Switch to full file view
247
- d) view_mode="diff" ;; # Switch to diff view
248
- q) break ;; # Return to file selection
249
- b) show_all_changes; return ;; # Return to main menu
250
- esac
251
- done
252
- fi
253
- done
254
- }
255
-
256
- ################################################################################
257
- # SEARCH COMMITTED SECTION
258
- ################################################################################
259
-
260
- # search_committed: Interactive search and view of unpushed local commits
261
- # Displays commits that exist locally but have not been pushed to the remote branch
262
- # Uses fzf with commit preview to show commit details
263
- # Allows user to view full commit diff with syntax highlighting
264
- search_committed() {
265
- current_branch=$(git rev-parse --abbrev-ref HEAD)
266
- remote_branch="origin/$current_branch"
267
-
268
- clear_screen
269
- echo "╔═══════════════════════════════════════════════════════╗"
270
- echo "║ SEARCH COMMITTED (UNPUSHED) ║"
271
- echo "║ Use arrows to navigate | Enter to view full | Esc to back"
272
- echo "╚═══════════════════════════════════════════════════════╝"
273
- echo ""
274
-
275
- # Get all commits that exist on local branch but not on remote
276
- commits=$(git log $remote_branch..HEAD --oneline 2>/dev/null)
277
-
278
- # Handle case where no unpushed commits exist
279
- if [ -z "$commits" ]; then
280
- echo "No unpushed commits"
281
- sleep 2
282
- show_all_changes
283
- return
284
- fi
285
-
286
- # Loop to allow searching multiple commits
287
- while true; do
288
- # Use fzf to select commit with preview showing commit details
289
- # Preview extracts commit hash from first field and shows git show output
290
- selected=$(echo "$commits" | fzf --ansi --preview 'commit_hash=$(echo {} | awk "{print \$1}"); git show --color=always $commit_hash | head -100' --preview-window=right:67% --bind 'esc:abort')
291
-
292
- # If user pressed ESC, return to main menu
293
- if [ -z "$selected" ]; then
294
- show_all_changes
295
- return
296
- fi
297
-
298
- # Commit was selected - show full commit details
299
- if [ -n "$selected" ]; then
300
- # Extract commit hash from first field of selected line
301
- commit_hash=$(echo "$selected" | awk '{print $1}')
302
-
303
- clear_screen
304
- echo "╔═══════════════════════════════════════════════════════╗"
305
- echo "║ COMMIT: $commit_hash"
306
- echo "║ Press [q] to go back, [b] to back to main menu"
307
- echo "╚═══════════════════════════════════════════════════════╝"
308
- echo ""
309
- # Display full commit details with enhanced diff via delta
310
- git show --color=always "$commit_hash" | delta
311
-
312
- echo ""
313
- echo "════════════════════════════════════════════════════════"
314
- # Prompt for next action
315
- read -n 1 -p "Press [q] to search again, [b] for main menu: " key
316
-
317
- # Return to main menu if requested
318
- if [ "$key" = "b" ]; then
319
- show_all_changes
320
- return
321
- fi
322
- fi
323
- done
324
- }
325
-
326
- ################################################################################
327
- # SEARCH PUSHED SECTION
328
- ################################################################################
329
-
330
- # search_pushed: Interactive search and view of pushed remote commits
331
- # Displays latest 100 commits from the remote branch
332
- # Uses fzf with commit preview to show commit details
333
- # Similar to search_committed but operates on remote branch history
334
- search_pushed() {
335
- current_branch=$(git rev-parse --abbrev-ref HEAD)
336
- remote_branch="origin/$current_branch"
337
-
338
- clear_screen
339
- echo "╔═══════════════════════════════════════════════════════╗"
340
- echo "║ SEARCH PUSHED COMMITS (Latest 100) ║"
341
- echo "║ Use arrows to navigate | Enter to view full | Esc to back"
342
- echo "╚═══════════════════════════════════════════════════════╝"
343
- echo ""
344
-
345
- # Get latest 100 commits from remote branch
346
- commits=$(git log $remote_branch --oneline -100 2>/dev/null)
347
-
348
- # Handle case where no remote commits exist
349
- if [ -z "$commits" ]; then
350
- echo "No pushed commits found"
351
- sleep 2
352
- show_all_changes
353
- return
354
- fi
355
-
356
- # Loop to allow searching multiple commits
357
- while true; do
358
- # Use fzf to select commit with preview showing commit details
359
- selected=$(echo "$commits" | fzf --ansi --preview 'commit_hash=$(echo {} | awk "{print \$1}"); git show --color=always $commit_hash | head -100' --preview-window=right:67% --bind 'esc:abort')
360
-
361
- # If user pressed ESC, return to main menu
362
- if [ -z "$selected" ]; then
363
- show_all_changes
364
- return
365
- fi
366
-
367
- # Commit was selected - show full commit details
368
- if [ -n "$selected" ]; then
369
- # Extract commit hash from first field of selected line
370
- commit_hash=$(echo "$selected" | awk '{print $1}')
371
-
372
- clear_screen
373
- echo "╔═══════════════════════════════════════════════════════╗"
374
- echo "║ PUSHED COMMIT: $commit_hash"
375
- echo "║ Press [q] to go back, [b] to back to main menu"
376
- echo "╚═══════════════════════════════════════════════════════╝"
377
- echo ""
378
- # Display full commit details with enhanced diff via delta
379
- git show --color=always "$commit_hash" | delta
380
-
381
- echo ""
382
- echo "════════════════════════════════════════════════════════"
383
- # Prompt for next action
384
- read -n 1 -p "Press [q] to search again, [b] for main menu: " key
385
-
386
- # Return to main menu if requested
387
- if [ "$key" = "b" ]; then
388
- show_all_changes
389
- return
390
- fi
391
- fi
392
- done
393
- }
394
-
395
- ################################################################################
396
- # STATE DETECTION & AUTO-REFRESH SECTION
397
- ################################################################################
398
-
399
- # get_local_state: Capture state of local working directory for change detection
400
- # Returns a string representation of:
401
- # - Staged changes statistics
402
- # - Unstaged changes statistics
403
- # - Untracked files list
404
- # Used to detect if working directory has changed since last check
405
- get_local_state() {
406
- local state=""
407
- state+="$(git diff --staged --stat 2>/dev/null)|||"
408
- state+="$(git diff --stat 2>/dev/null)|||"
409
- state+="$(git ls-files --others --exclude-standard 2>/dev/null)"
410
- echo "$state"
411
- }
412
-
413
- # get_remote_state: Capture state of remote commits for change detection
414
- # Returns a string representation of:
415
- # - Unpushed commits (commits local but not on remote)
416
- # - Latest 10 remote commits (to detect new pushed commits)
417
- # Used to detect if remote branch has changed since last check
418
- get_remote_state() {
419
- current_branch=$(git rev-parse --abbrev-ref HEAD)
420
- remote_branch="origin/$current_branch"
421
-
422
- local state=""
423
- state+="$(git log $remote_branch..HEAD --oneline 2>/dev/null)|||"
424
- state+="$(git log $remote_branch --oneline -10 2>/dev/null)"
425
- echo "$state"
426
- }
427
-
428
- ################################################################################
429
- # MAIN LOOP - INTERACTIVE MODE
430
- ################################################################################
431
-
432
- # Display initial git status on script startup
433
- show_all_changes
434
-
435
- # Initialize state caches for detecting changes
436
- previous_local_state=$(get_local_state)
437
- previous_remote_state=$(get_remote_state)
438
- last_update_time=$(date +%s)
439
- last_remote_update_time=$(date +%s)
440
-
441
- # Main event loop: monitor for user input and auto-refresh on changes
442
- # Polling intervals:
443
- # - Local changes: checked every 1 second
444
- # - Remote changes: checked every 15 seconds (slower to reduce network traffic)
445
- # User input: read with 1 second timeout to balance responsiveness and CPU usage
446
- while true; do
447
- current_time=$(date +%s)
448
-
449
- # Check for keypress with 1 second timeout
450
- # read -t 1 waits up to 1 second for input
451
- # read -n 1 reads a single character
452
- # Exit code 0 means key was pressed, non-zero means timeout
453
- read -t 1 -n 1 action
454
-
455
- if [ $? -eq 0 ]; then
456
- # Key was pressed - handle menu navigation
457
- case $action in
458
- 1) show_all_changes ;; # Show all changes overview
459
- 2) search_uncommitted ;; # Search uncommitted files
460
- 3) search_committed ;; # Search unpushed commits
461
- 4) search_pushed ;; # Search remote commits
462
- q) cleanup ;; # Quit application
463
- esac
464
- else
465
- # No key pressed - check for changes in working directory or remote
466
- local_state=$(get_local_state)
467
-
468
- # Check local changes every 1 second
469
- if [ $((current_time - last_update_time)) -ge 1 ]; then
470
- # If working directory state has changed, refresh display
471
- if [ "$local_state" != "$previous_local_state" ]; then
472
- show_all_changes
473
- previous_local_state="$local_state"
474
- fi
475
- last_update_time=$current_time
476
- fi
477
-
478
- # Check remote changes every 15 seconds (less frequent to save resources)
479
- if [ $((current_time - last_remote_update_time)) -ge 15 ]; then
480
- remote_state=$(get_remote_state)
481
- # If remote branch state has changed, refresh display
482
- if [ "$remote_state" != "$previous_remote_state" ]; then
483
- show_all_changes
484
- previous_remote_state="$remote_state"
485
- fi
486
- last_remote_update_time=$current_time
487
- fi
488
- fi
489
- done
@@ -1,16 +0,0 @@
1
- 'use strict';
2
- if (process.env.npm_config_global !== 'true') {
3
- console.log('');
4
- console.log('DEXBot2 installed locally. To use the `dexbot` command:');
5
- console.log(' npm link # makes `dexbot` available globally');
6
- console.log(' # or use: npx dexbot <cmd> # or: ./node_modules/.bin/dexbot <cmd>');
7
- console.log('');
8
- process.exit(0);
9
- }
10
- console.log('');
11
- console.log('DEXBot2 installed! To get started:');
12
- console.log(' dexbot key Set up master password');
13
- console.log(' dexbot bot Create and manage bots');
14
- console.log(' dexbot start Run credential daemon + bot');
15
- console.log(' dexbot help Show all commands');
16
- console.log('');