dexbot 1.6.6 → 1.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +89 -1
- package/README.md +8 -5
- package/analysis/README.md +2 -3
- package/analysis/tradingview/README.md +78 -1
- package/analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md +1 -1
- package/claw/package.json +1 -1
- package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
- package/claw/runtimes/openclaw-plugin/package.json +1 -1
- package/dist/analysis/tradingview/analyze_tradingview.d.ts +4 -0
- package/dist/analysis/tradingview/analyze_tradingview.js +55 -0
- package/dist/analysis/tradingview/grid_reset_config.d.ts +61 -0
- package/dist/analysis/tradingview/grid_reset_config.js +235 -0
- package/dist/analysis/tradingview/grid_reset_sim.d.ts +67 -0
- package/dist/analysis/tradingview/grid_reset_sim.js +307 -0
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +419 -3
- package/dist/dexbot.js +44 -15
- package/dist/market_adapter/core/market_adapter_service.js +14 -2
- package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts +8 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.js +5 -1
- package/dist/market_adapter/inputs/window_cache.d.ts +97 -19
- package/dist/market_adapter/inputs/window_cache.js +302 -48
- package/dist/market_adapter/market_adapter.d.ts +8 -1
- package/dist/market_adapter/market_adapter.js +22 -4
- package/dist/modules/account_bots.js +20 -9
- package/dist/modules/account_orders.d.ts +44 -4
- package/dist/modules/account_orders.js +104 -7
- package/dist/modules/bitshares-native/chain_client.d.ts +10 -0
- package/dist/modules/bitshares-native/chain_client.js +197 -28
- package/dist/modules/bitshares-native/subscriptions.js +312 -10
- package/dist/modules/bitshares-native/transport.d.ts +1 -0
- package/dist/modules/bitshares-native/transport.js +97 -3
- package/dist/modules/bitshares_client.d.ts +20 -0
- package/dist/modules/bitshares_client.js +29 -0
- package/dist/modules/bot_settings.js +10 -1
- package/dist/modules/chain_keys.d.ts +37 -22
- package/dist/modules/chain_keys.js +145 -44
- package/dist/modules/cli_start_onboarding.d.ts +10 -0
- package/dist/modules/cli_start_onboarding.js +15 -0
- package/dist/modules/cli_start_output.d.ts +6 -0
- package/dist/modules/cli_start_output.js +8 -0
- package/dist/modules/config.d.ts +1 -0
- package/dist/modules/config.js +1 -0
- package/dist/modules/constants.d.ts +23 -2
- package/dist/modules/constants.js +196 -15
- package/dist/modules/dexbot_class.d.ts +6 -76
- package/dist/modules/dexbot_class.js +0 -32
- package/dist/modules/dexbot_cow_runtime.d.ts +3 -58
- package/dist/modules/dexbot_cow_runtime.js +53 -96
- package/dist/modules/dexbot_fill_runtime.d.ts +6 -1
- package/dist/modules/dexbot_fill_runtime.js +22 -3
- package/dist/modules/dexbot_maintenance_runtime.d.ts +38 -1
- package/dist/modules/dexbot_maintenance_runtime.js +103 -11
- package/dist/modules/dexbot_startup_runtime.js +73 -20
- package/dist/modules/dexbot_state_recovery.d.ts +6 -0
- package/dist/modules/dexbot_state_recovery.js +34 -1
- package/dist/modules/order/async_lock.d.ts +8 -0
- package/dist/modules/order/async_lock.js +15 -0
- package/dist/modules/order/genesis_policy.d.ts +162 -0
- package/dist/modules/order/genesis_policy.js +267 -0
- package/dist/modules/order/grid.js +109 -135
- package/dist/modules/order/grid_reconcile.d.ts +9 -0
- package/dist/modules/order/grid_reconcile.js +13 -4
- package/dist/modules/order/grid_reconcile_internal.js +13 -2
- package/dist/modules/order/logger.d.ts +12 -2
- package/dist/modules/order/logger.js +29 -7
- package/dist/modules/order/manager.d.ts +53 -0
- package/dist/modules/order/manager.js +86 -25
- package/dist/modules/order/sync_engine.d.ts +19 -0
- package/dist/modules/order/sync_engine.js +284 -344
- package/dist/modules/order/utils/math.d.ts +22 -1
- package/dist/modules/order/utils/math.js +64 -1
- package/dist/modules/order/utils/order.d.ts +43 -58
- package/dist/modules/order/utils/order.js +302 -194
- package/dist/modules/order/utils/system.d.ts +97 -0
- package/dist/modules/order/utils/system.js +282 -3
- package/dist/modules/paths.d.ts +8 -1
- package/dist/modules/paths.js +11 -3
- package/dist/modules/utils/text_width.d.ts +19 -0
- package/dist/modules/utils/text_width.js +97 -0
- package/dist/modules/version_notice.d.ts +165 -0
- package/dist/modules/version_notice.js +364 -0
- package/dist/pm2.js +104 -18
- package/dist/scripts/update.js +62 -13
- package/dist/unlock.d.ts +14 -2
- package/dist/unlock.js +101 -4
- package/docs/BITSHARES_ONBOARDING.md +8 -1
- package/docs/COW_INVARIANTS.md +11 -2
- package/docs/CREDENTIAL_SECURITY.md +26 -0
- package/docs/DEXBOT_COMPARISON.md +4 -4
- package/docs/EVOLUTION.md +20 -18
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +1 -1
- package/docs/GRID_PRICE_INVARIANT.md +204 -31
- package/docs/GRID_RECALCULATION.md +12 -0
- package/docs/LOGGING.md +17 -2
- package/docs/ORDER_ENGINE_POST_1.0_RETROSPECTIVE.md +6 -7
- package/docs/README.md +3 -1
- package/docs/WORKFLOW.md +16 -5
- package/market_adapter/README.md +1 -1
- package/modules/README.md +18 -1
- package/package.json +14 -6
- package/scripts/README.md +28 -2
- package/scripts/clear-all.sh +13 -4
- package/scripts/clear-logs.sh +13 -4
- package/scripts/clear-market-adapter.sh +6 -0
- package/scripts/clear-orders.sh +5 -0
- package/scripts/lib/dexbot-paths.sh +108 -0
- package/tests/README.md +11 -3
- package/analysis/account_resolver.ts +0 -161
- package/analysis/ama_fitting/analyze_ama_price_changes.ts +0 -155
- package/analysis/ama_fitting/analyze_lambda_vs_slow.ts +0 -404
- package/analysis/ama_fitting/calibrate_convergence_er.ts +0 -201
- package/analysis/ama_fitting/fetch_lp_candles.ts +0 -184
- package/analysis/ama_fitting/generate_unified_comparison_chart.ts +0 -232
- package/analysis/ama_fitting/optimizer_high_resolution.ts +0 -802
- package/analysis/analyze_dynamic_weight.ts +0 -243
- package/analysis/analyze_kalman.ts +0 -157
- package/analysis/analyze_regime.ts +0 -158
- package/analysis/analyze_regime_windows.ts +0 -470
- package/analysis/analyze_risk_profile.ts +0 -199
- package/analysis/analyze_trade_heatmap.ts +0 -362
- package/analysis/analyze_volatility.ts +0 -182
- package/analysis/bot_fitting/backtest_ama_sweep.ts +0 -934
- package/analysis/bot_fitting/backtest_bot_fitting.ts +0 -861
- package/analysis/bot_fitting/shared_utils.ts +0 -52
- package/analysis/bot_key_utils.ts +0 -426
- package/analysis/bot_usage/discover_bot_accounts.ts +0 -635
- package/analysis/bot_usage/kibana_bot_queries.ts +0 -211
- package/analysis/chain_pool.ts +0 -47
- package/analysis/chart_css.ts +0 -62
- package/analysis/chart_ui.ts +0 -105
- package/analysis/chart_utils.ts +0 -210
- package/analysis/fills_source.ts +0 -228
- package/analysis/grid_correction_check.ts +0 -786
- package/analysis/math_utils.ts +0 -53
- package/analysis/price_sources.ts +0 -136
- package/analysis/resolve_bot_accounts.ts +0 -199
- package/analysis/resolve_source.ts +0 -99
- package/analysis/results/ama_sweep_results_lp_pool_133_1h.json +0 -2455
- package/analysis/results/bot_fitting_results_lp_pool_133_1h.json +0 -218
- package/analysis/trade_profitability.ts +0 -1335
- package/analysis/tradingview/analyze_tradingview.ts +0 -280
- package/analysis/tradingview/h-bts_tradingview.html +0 -1570
- package/analysis/tradingview/t-bts_tradingview.html +0 -1570
- package/analysis/tradingview/tradingview_uplot_chart_generator.ts +0 -3268
- package/analysis/trend_detection/dynamic_weight_chart_generator.ts +0 -1481
- package/analysis/trend_detection/hurst_analyzer.ts +0 -7
- package/analysis/trend_detection/kalman_chart_generator.ts +0 -398
- package/analysis/trend_detection/kalman_trend_analyzer.ts +0 -9
- package/analysis/trend_detection/kalman_velocity_smoothing.ts +0 -7
- package/analysis/trend_detection/package.json +0 -23
- package/analysis/trend_detection/permutation_entropy_analyzer.ts +0 -7
- package/analysis/trend_detection/regime_chart_generator.ts +0 -338
- package/analysis/trend_detection/tests/test_kalman_trend.ts +0 -153
- package/analysis/trend_detection/tests/test_kalman_velocity_smoothing.ts +0 -64
- package/analysis/trend_detection/volatility_chart_generator.ts +0 -654
- package/analysis/tsconfig.json +0 -29
- package/claw/tests/package.json +0 -3
- package/claw/tests/test_claw_bridge.ts +0 -570
- package/claw/tests/test_claw_catalog_and_credentials.ts +0 -156
- package/claw/tests/test_claw_chain_layer.ts +0 -739
- package/claw/tests/test_claw_data_flow.ts +0 -525
- package/claw/tests/test_claw_domain_logic.ts +0 -471
- package/claw/tests/test_claw_manifest_and_matrix.ts +0 -222
- package/claw/tests/test_claw_mcp_transport.ts +0 -243
- package/claw/tests/test_claw_regressions.ts +0 -711
- package/claw/tests/test_claw_skill_generation.ts +0 -103
- package/claw/tests/test_claw_state_store.ts +0 -44
- package/claw/tests/test_dexbot_profiles.ts +0 -654
- package/claw/tests/test_memu_bridge.ts +0 -189
- package/claw/tests/test_nullclaw_tmp_integration.ts +0 -57
- package/claw/tests/test_position_health.ts +0 -343
- package/claw/tests/test_position_manager.ts +0 -429
- package/claw/tests/test_position_manager_watch_health.ts +0 -100
- package/claw/tests/test_short_mpa_strategy.ts +0 -232
- package/dist/analysis/account_resolver.d.ts.map +0 -1
- package/dist/analysis/account_resolver.js.map +0 -1
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.js.map +0 -1
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js.map +0 -1
- package/dist/analysis/ama_fitting/calibrate_convergence_er.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js.map +0 -1
- package/dist/analysis/ama_fitting/fetch_lp_candles.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/fetch_lp_candles.js.map +0 -1
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js.map +0 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts.map +0 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js.map +0 -1
- package/dist/analysis/analyze_dynamic_weight.d.ts.map +0 -1
- package/dist/analysis/analyze_dynamic_weight.js.map +0 -1
- package/dist/analysis/analyze_kalman.d.ts.map +0 -1
- package/dist/analysis/analyze_kalman.js.map +0 -1
- package/dist/analysis/analyze_regime.d.ts.map +0 -1
- package/dist/analysis/analyze_regime.js.map +0 -1
- package/dist/analysis/analyze_regime_windows.d.ts.map +0 -1
- package/dist/analysis/analyze_regime_windows.js.map +0 -1
- package/dist/analysis/analyze_risk_profile.d.ts.map +0 -1
- package/dist/analysis/analyze_risk_profile.js.map +0 -1
- package/dist/analysis/analyze_trade_heatmap.d.ts.map +0 -1
- package/dist/analysis/analyze_trade_heatmap.js.map +0 -1
- package/dist/analysis/analyze_volatility.d.ts.map +0 -1
- package/dist/analysis/analyze_volatility.js.map +0 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js.map +0 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js.map +0 -1
- package/dist/analysis/bot_fitting/shared_utils.d.ts.map +0 -1
- package/dist/analysis/bot_fitting/shared_utils.js.map +0 -1
- package/dist/analysis/bot_key_utils.d.ts.map +0 -1
- package/dist/analysis/bot_key_utils.js.map +0 -1
- package/dist/analysis/bot_usage/discover_bot_accounts.d.ts.map +0 -1
- package/dist/analysis/bot_usage/discover_bot_accounts.js.map +0 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts.map +0 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.js.map +0 -1
- package/dist/analysis/chain_pool.d.ts.map +0 -1
- package/dist/analysis/chain_pool.js.map +0 -1
- package/dist/analysis/chart_css.d.ts.map +0 -1
- package/dist/analysis/chart_css.js.map +0 -1
- package/dist/analysis/chart_ui.d.ts.map +0 -1
- package/dist/analysis/chart_ui.js.map +0 -1
- package/dist/analysis/chart_utils.d.ts.map +0 -1
- package/dist/analysis/chart_utils.js.map +0 -1
- package/dist/analysis/fills_source.d.ts.map +0 -1
- package/dist/analysis/fills_source.js.map +0 -1
- package/dist/analysis/grid_correction_check.d.ts.map +0 -1
- package/dist/analysis/grid_correction_check.js.map +0 -1
- package/dist/analysis/math_utils.d.ts.map +0 -1
- package/dist/analysis/math_utils.js.map +0 -1
- package/dist/analysis/price_sources.d.ts.map +0 -1
- package/dist/analysis/price_sources.js.map +0 -1
- package/dist/analysis/resolve_bot_accounts.d.ts.map +0 -1
- package/dist/analysis/resolve_bot_accounts.js.map +0 -1
- package/dist/analysis/resolve_source.d.ts.map +0 -1
- package/dist/analysis/resolve_source.js.map +0 -1
- package/dist/analysis/trade_profitability.d.ts.map +0 -1
- package/dist/analysis/trade_profitability.js.map +0 -1
- package/dist/analysis/tradingview/analyze_tradingview.d.ts.map +0 -1
- package/dist/analysis/tradingview/analyze_tradingview.js.map +0 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +0 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/hurst_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/hurst_analyzer.js.map +0 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/kalman_trend_analyzer.js.map +0 -1
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts.map +0 -1
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.js.map +0 -1
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.js.map +0 -1
- package/dist/analysis/trend_detection/regime_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/regime_chart_generator.js.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts +0 -2
- package/dist/analysis/trend_detection/tests/test_kalman_trend.d.ts.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js +0 -128
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts +0 -2
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.d.ts.map +0 -1
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js +0 -37
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js.map +0 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.d.ts.map +0 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.js.map +0 -1
- package/dist/bot.d.ts.map +0 -1
- package/dist/bot.js.map +0 -1
- package/dist/credential-daemon.d.ts.map +0 -1
- package/dist/credential-daemon.js.map +0 -1
- package/dist/dexbot.d.ts.map +0 -1
- package/dist/dexbot.js.map +0 -1
- package/dist/market_adapter/ama_signal_runner.d.ts.map +0 -1
- package/dist/market_adapter/ama_signal_runner.js.map +0 -1
- package/dist/market_adapter/candle_utils.d.ts.map +0 -1
- package/dist/market_adapter/candle_utils.js.map +0 -1
- package/dist/market_adapter/core/asymmetric_bounds.d.ts.map +0 -1
- package/dist/market_adapter/core/asymmetric_bounds.js.map +0 -1
- package/dist/market_adapter/core/config_normalizers.d.ts.map +0 -1
- package/dist/market_adapter/core/config_normalizers.js.map +0 -1
- package/dist/market_adapter/core/kibana_candles.d.ts.map +0 -1
- package/dist/market_adapter/core/kibana_candles.js.map +0 -1
- package/dist/market_adapter/core/kibana_client.d.ts.map +0 -1
- package/dist/market_adapter/core/kibana_client.js.map +0 -1
- package/dist/market_adapter/core/kibana_market_candles.d.ts.map +0 -1
- package/dist/market_adapter/core/kibana_market_candles.js.map +0 -1
- package/dist/market_adapter/core/market_adapter_service.d.ts.map +0 -1
- package/dist/market_adapter/core/market_adapter_service.js.map +0 -1
- package/dist/market_adapter/core/signals/hurst_analyzer.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/hurst_analyzer.js.map +0 -1
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.js.map +0 -1
- package/dist/market_adapter/core/signals/kalman_velocity_smoothing.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/kalman_velocity_smoothing.js.map +0 -1
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.d.ts.map +0 -1
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js.map +0 -1
- package/dist/market_adapter/core/strategies/ama.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/ama.js.map +0 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.js.map +0 -1
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/atr/calculator.js.map +0 -1
- package/dist/market_adapter/core/strategies/collateral_manager.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/collateral_manager.js.map +0 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.js.map +0 -1
- package/dist/market_adapter/core/strategies/regime_gate.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/regime_gate.js.map +0 -1
- package/dist/market_adapter/core/strategies/regime_interp.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/regime_interp.js.map +0 -1
- package/dist/market_adapter/core/strategies/volatility_shift.d.ts.map +0 -1
- package/dist/market_adapter/core/strategies/volatility_shift.js.map +0 -1
- package/dist/market_adapter/inputs/fetch_book_data.d.ts.map +0 -1
- package/dist/market_adapter/inputs/fetch_book_data.js.map +0 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.d.ts.map +0 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +0 -1
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +0 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js.map +0 -1
- package/dist/market_adapter/inputs/kibana_feed_source.d.ts.map +0 -1
- package/dist/market_adapter/inputs/kibana_feed_source.js.map +0 -1
- package/dist/market_adapter/inputs/kibana_source.d.ts.map +0 -1
- package/dist/market_adapter/inputs/kibana_source.js.map +0 -1
- package/dist/market_adapter/inputs/window_cache.d.ts.map +0 -1
- package/dist/market_adapter/inputs/window_cache.js.map +0 -1
- package/dist/market_adapter/interval_utils.d.ts.map +0 -1
- package/dist/market_adapter/interval_utils.js.map +0 -1
- package/dist/market_adapter/log_format.d.ts.map +0 -1
- package/dist/market_adapter/log_format.js.map +0 -1
- package/dist/market_adapter/lp_chart_core.d.ts.map +0 -1
- package/dist/market_adapter/lp_chart_core.js.map +0 -1
- package/dist/market_adapter/lp_chart_runner.d.ts.map +0 -1
- package/dist/market_adapter/lp_chart_runner.js.map +0 -1
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts.map +0 -1
- package/dist/market_adapter/lp_chart_strategy_loader.js.map +0 -1
- package/dist/market_adapter/market_adapter.d.ts.map +0 -1
- package/dist/market_adapter/market_adapter.js.map +0 -1
- package/dist/market_adapter/test_helpers.d.ts.map +0 -1
- package/dist/market_adapter/test_helpers.js.map +0 -1
- package/dist/market_adapter/utils/adapter_client.d.ts.map +0 -1
- package/dist/market_adapter/utils/adapter_client.js.map +0 -1
- package/dist/market_adapter/utils/atomic_write.d.ts.map +0 -1
- package/dist/market_adapter/utils/atomic_write.js.map +0 -1
- package/dist/market_adapter/utils/chain.d.ts.map +0 -1
- package/dist/market_adapter/utils/chain.js.map +0 -1
- package/dist/market_adapter/utils/data_discovery.d.ts.map +0 -1
- package/dist/market_adapter/utils/data_discovery.js.map +0 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +0 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +0 -1
- package/dist/market_adapter/utils/file_lock.d.ts.map +0 -1
- package/dist/market_adapter/utils/file_lock.js.map +0 -1
- package/dist/market_adapter/utils/native_history.d.ts.map +0 -1
- package/dist/market_adapter/utils/native_history.js.map +0 -1
- package/dist/modules/account_bots.d.ts.map +0 -1
- package/dist/modules/account_bots.js.map +0 -1
- package/dist/modules/account_orders.d.ts.map +0 -1
- package/dist/modules/account_orders.js.map +0 -1
- package/dist/modules/authority_resolver.d.ts.map +0 -1
- package/dist/modules/authority_resolver.js.map +0 -1
- package/dist/modules/bitshares-native/chain_client.d.ts.map +0 -1
- package/dist/modules/bitshares-native/chain_client.js.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.d.ts.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc.js.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.d.ts.map +0 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.js.map +0 -1
- package/dist/modules/bitshares-native/index.d.ts.map +0 -1
- package/dist/modules/bitshares-native/index.js.map +0 -1
- package/dist/modules/bitshares-native/lru_cache.d.ts.map +0 -1
- package/dist/modules/bitshares-native/lru_cache.js.map +0 -1
- package/dist/modules/bitshares-native/resolvers.d.ts.map +0 -1
- package/dist/modules/bitshares-native/resolvers.js.map +0 -1
- package/dist/modules/bitshares-native/serial/chain_constants.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/chain_constants.js.map +0 -1
- package/dist/modules/bitshares-native/serial/index.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/index.js.map +0 -1
- package/dist/modules/bitshares-native/serial/operations.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/operations.js.map +0 -1
- package/dist/modules/bitshares-native/serial/serializer.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/serializer.js.map +0 -1
- package/dist/modules/bitshares-native/serial/types.d.ts.map +0 -1
- package/dist/modules/bitshares-native/serial/types.js.map +0 -1
- package/dist/modules/bitshares-native/signing_client.d.ts.map +0 -1
- package/dist/modules/bitshares-native/signing_client.js.map +0 -1
- package/dist/modules/bitshares-native/subscriptions.d.ts.map +0 -1
- package/dist/modules/bitshares-native/subscriptions.js.map +0 -1
- package/dist/modules/bitshares-native/transport.d.ts.map +0 -1
- package/dist/modules/bitshares-native/transport.js.map +0 -1
- package/dist/modules/bitshares-native/tx/builder.d.ts.map +0 -1
- package/dist/modules/bitshares-native/tx/builder.js.map +0 -1
- package/dist/modules/bitshares-native/tx/tx_cache.d.ts.map +0 -1
- package/dist/modules/bitshares-native/tx/tx_cache.js.map +0 -1
- package/dist/modules/bitshares_client.d.ts.map +0 -1
- package/dist/modules/bitshares_client.js.map +0 -1
- package/dist/modules/bot_defaults.d.ts.map +0 -1
- package/dist/modules/bot_defaults.js.map +0 -1
- package/dist/modules/bot_settings.d.ts.map +0 -1
- package/dist/modules/bot_settings.js.map +0 -1
- package/dist/modules/bots_file_lock.d.ts.map +0 -1
- package/dist/modules/bots_file_lock.js.map +0 -1
- package/dist/modules/broadcast_failure.d.ts.map +0 -1
- package/dist/modules/broadcast_failure.js.map +0 -1
- package/dist/modules/chain_keys.d.ts.map +0 -1
- package/dist/modules/chain_keys.js.map +0 -1
- package/dist/modules/chain_orders.d.ts.map +0 -1
- package/dist/modules/chain_orders.js.map +0 -1
- package/dist/modules/cli_colors.d.ts.map +0 -1
- package/dist/modules/cli_colors.js.map +0 -1
- package/dist/modules/config.d.ts.map +0 -1
- package/dist/modules/config.js.map +0 -1
- package/dist/modules/constants.d.ts.map +0 -1
- package/dist/modules/constants.js.map +0 -1
- package/dist/modules/cr_planner.d.ts.map +0 -1
- package/dist/modules/cr_planner.js.map +0 -1
- package/dist/modules/credential_policy.d.ts.map +0 -1
- package/dist/modules/credential_policy.js.map +0 -1
- package/dist/modules/credential_runtime.d.ts.map +0 -1
- package/dist/modules/credential_runtime.js.map +0 -1
- package/dist/modules/credential_session_cache.d.ts.map +0 -1
- package/dist/modules/credential_session_cache.js.map +0 -1
- package/dist/modules/credit_pricing.d.ts.map +0 -1
- package/dist/modules/credit_pricing.js.map +0 -1
- package/dist/modules/credit_runtime.d.ts.map +0 -1
- package/dist/modules/credit_runtime.js.map +0 -1
- package/dist/modules/crypto/browser_provider.d.ts.map +0 -1
- package/dist/modules/crypto/browser_provider.js.map +0 -1
- package/dist/modules/crypto/index.d.ts.map +0 -1
- package/dist/modules/crypto/index.js.map +0 -1
- package/dist/modules/crypto/node_provider.d.ts.map +0 -1
- package/dist/modules/crypto/node_provider.js.map +0 -1
- package/dist/modules/crypto/provider.d.ts.map +0 -1
- package/dist/modules/crypto/provider.js.map +0 -1
- package/dist/modules/crypto/pure_ripemd160.d.ts.map +0 -1
- package/dist/modules/crypto/pure_ripemd160.js.map +0 -1
- package/dist/modules/crypto/pure_scrypt.d.ts.map +0 -1
- package/dist/modules/crypto/pure_scrypt.js.map +0 -1
- package/dist/modules/crypto/pure_secp256k1.d.ts.map +0 -1
- package/dist/modules/crypto/pure_secp256k1.js.map +0 -1
- package/dist/modules/crypto/sync.d.ts.map +0 -1
- package/dist/modules/crypto/sync.js.map +0 -1
- package/dist/modules/daemon_node_health.d.ts.map +0 -1
- package/dist/modules/daemon_node_health.js.map +0 -1
- package/dist/modules/dexbot_class.d.ts.map +0 -1
- package/dist/modules/dexbot_class.js.map +0 -1
- package/dist/modules/dexbot_cow_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_cow_runtime.js.map +0 -1
- package/dist/modules/dexbot_credential_client.d.ts.map +0 -1
- package/dist/modules/dexbot_credential_client.js.map +0 -1
- package/dist/modules/dexbot_fill_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_fill_runtime.js.map +0 -1
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_maintenance_runtime.js.map +0 -1
- package/dist/modules/dexbot_startup_runtime.d.ts.map +0 -1
- package/dist/modules/dexbot_startup_runtime.js.map +0 -1
- package/dist/modules/dexbot_state_recovery.d.ts.map +0 -1
- package/dist/modules/dexbot_state_recovery.js.map +0 -1
- package/dist/modules/env.d.ts.map +0 -1
- package/dist/modules/env.js.map +0 -1
- package/dist/modules/fund_registry.d.ts.map +0 -1
- package/dist/modules/fund_registry.js.map +0 -1
- package/dist/modules/general_settings.d.ts.map +0 -1
- package/dist/modules/general_settings.js.map +0 -1
- package/dist/modules/graceful_shutdown.d.ts.map +0 -1
- package/dist/modules/graceful_shutdown.js.map +0 -1
- package/dist/modules/grid_price_source.d.ts.map +0 -1
- package/dist/modules/grid_price_source.js.map +0 -1
- package/dist/modules/key_store.d.ts.map +0 -1
- package/dist/modules/key_store.js.map +0 -1
- package/dist/modules/launcher/adapter_requirement.d.ts.map +0 -1
- package/dist/modules/launcher/adapter_requirement.js.map +0 -1
- package/dist/modules/launcher/bot_supervisor.d.ts.map +0 -1
- package/dist/modules/launcher/bot_supervisor.js.map +0 -1
- package/dist/modules/launcher/child_env.d.ts.map +0 -1
- package/dist/modules/launcher/child_env.js.map +0 -1
- package/dist/modules/launcher/credential_bootstrap.d.ts.map +0 -1
- package/dist/modules/launcher/credential_bootstrap.js.map +0 -1
- package/dist/modules/launcher/credential_daemon.d.ts.map +0 -1
- package/dist/modules/launcher/credential_daemon.js.map +0 -1
- package/dist/modules/launcher/credential_secret.d.ts.map +0 -1
- package/dist/modules/launcher/credential_secret.js.map +0 -1
- package/dist/modules/launcher/foreign_cred_daemon.d.ts.map +0 -1
- package/dist/modules/launcher/foreign_cred_daemon.js.map +0 -1
- package/dist/modules/launcher/headless_password.d.ts.map +0 -1
- package/dist/modules/launcher/headless_password.js.map +0 -1
- package/dist/modules/launcher/launch_modes.d.ts.map +0 -1
- package/dist/modules/launcher/launch_modes.js.map +0 -1
- package/dist/modules/launcher/market_adapter_runtime.d.ts.map +0 -1
- package/dist/modules/launcher/market_adapter_runtime.js.map +0 -1
- package/dist/modules/launcher/market_adapter_watchdog.d.ts.map +0 -1
- package/dist/modules/launcher/market_adapter_watchdog.js.map +0 -1
- package/dist/modules/launcher/monolithic_runtime.d.ts.map +0 -1
- package/dist/modules/launcher/monolithic_runtime.js.map +0 -1
- package/dist/modules/launcher/runtime_entry.d.ts.map +0 -1
- package/dist/modules/launcher/runtime_entry.js.map +0 -1
- package/dist/modules/launcher/status_reporting.d.ts.map +0 -1
- package/dist/modules/launcher/status_reporting.js.map +0 -1
- package/dist/modules/launcher/supervisor_control.d.ts.map +0 -1
- package/dist/modules/launcher/supervisor_control.js.map +0 -1
- package/dist/modules/market_adapter_whitelist.d.ts.map +0 -1
- package/dist/modules/market_adapter_whitelist.js.map +0 -1
- package/dist/modules/node_connect_policy.d.ts.map +0 -1
- package/dist/modules/node_connect_policy.js.map +0 -1
- package/dist/modules/node_failure_ledger.d.ts.map +0 -1
- package/dist/modules/node_failure_ledger.js.map +0 -1
- package/dist/modules/node_health_cache.d.ts.map +0 -1
- package/dist/modules/node_health_cache.js.map +0 -1
- package/dist/modules/node_manager.d.ts.map +0 -1
- package/dist/modules/node_manager.js.map +0 -1
- package/dist/modules/order/accounting.d.ts.map +0 -1
- package/dist/modules/order/accounting.js.map +0 -1
- package/dist/modules/order/async_lock.d.ts.map +0 -1
- package/dist/modules/order/async_lock.js.map +0 -1
- package/dist/modules/order/export.d.ts.map +0 -1
- package/dist/modules/order/export.js.map +0 -1
- package/dist/modules/order/format.d.ts.map +0 -1
- package/dist/modules/order/format.js.map +0 -1
- package/dist/modules/order/grid.d.ts.map +0 -1
- package/dist/modules/order/grid.js.map +0 -1
- package/dist/modules/order/grid_reconcile.d.ts.map +0 -1
- package/dist/modules/order/grid_reconcile.js.map +0 -1
- package/dist/modules/order/grid_reconcile_internal.d.ts.map +0 -1
- package/dist/modules/order/grid_reconcile_internal.js.map +0 -1
- package/dist/modules/order/index.d.ts.map +0 -1
- package/dist/modules/order/index.js.map +0 -1
- package/dist/modules/order/logger.d.ts.map +0 -1
- package/dist/modules/order/logger.js.map +0 -1
- package/dist/modules/order/logger_state.d.ts.map +0 -1
- package/dist/modules/order/logger_state.js.map +0 -1
- package/dist/modules/order/manager.d.ts.map +0 -1
- package/dist/modules/order/manager.js.map +0 -1
- package/dist/modules/order/processed_fill_store.d.ts.map +0 -1
- package/dist/modules/order/processed_fill_store.js.map +0 -1
- package/dist/modules/order/strategy.d.ts.map +0 -1
- package/dist/modules/order/strategy.js.map +0 -1
- package/dist/modules/order/sync_engine.d.ts.map +0 -1
- package/dist/modules/order/sync_engine.js.map +0 -1
- package/dist/modules/order/utils/math.d.ts.map +0 -1
- package/dist/modules/order/utils/math.js.map +0 -1
- package/dist/modules/order/utils/order.d.ts.map +0 -1
- package/dist/modules/order/utils/order.js.map +0 -1
- package/dist/modules/order/utils/slot.d.ts.map +0 -1
- package/dist/modules/order/utils/slot.js.map +0 -1
- package/dist/modules/order/utils/system.d.ts.map +0 -1
- package/dist/modules/order/utils/system.js.map +0 -1
- package/dist/modules/order/utils/timeout.d.ts.map +0 -1
- package/dist/modules/order/utils/timeout.js.map +0 -1
- package/dist/modules/order/utils/validate.d.ts.map +0 -1
- package/dist/modules/order/utils/validate.js.map +0 -1
- package/dist/modules/order/utils/withPoolRef.d.ts.map +0 -1
- package/dist/modules/order/utils/withPoolRef.js.map +0 -1
- package/dist/modules/order/working_grid.d.ts.map +0 -1
- package/dist/modules/order/working_grid.js.map +0 -1
- package/dist/modules/path_api.d.ts.map +0 -1
- package/dist/modules/path_api.js.map +0 -1
- package/dist/modules/paths.d.ts.map +0 -1
- package/dist/modules/paths.js.map +0 -1
- package/dist/modules/process_discovery.d.ts.map +0 -1
- package/dist/modules/process_discovery.js.map +0 -1
- package/dist/modules/runtime.d.ts.map +0 -1
- package/dist/modules/runtime.js.map +0 -1
- package/dist/modules/runtime_settings.d.ts.map +0 -1
- package/dist/modules/runtime_settings.js.map +0 -1
- package/dist/modules/settings_merge.d.ts.map +0 -1
- package/dist/modules/settings_merge.js.map +0 -1
- package/dist/modules/socket_json_client.d.ts.map +0 -1
- package/dist/modules/socket_json_client.js.map +0 -1
- package/dist/modules/storage/browser_adapter.d.ts.map +0 -1
- package/dist/modules/storage/browser_adapter.js.map +0 -1
- package/dist/modules/storage/index.d.ts.map +0 -1
- package/dist/modules/storage/index.js.map +0 -1
- package/dist/modules/storage/node_adapter.d.ts.map +0 -1
- package/dist/modules/storage/node_adapter.js.map +0 -1
- package/dist/modules/storage/types.d.ts.map +0 -1
- package/dist/modules/storage/types.js.map +0 -1
- package/dist/modules/types.d.ts.map +0 -1
- package/dist/modules/types.js.map +0 -1
- package/dist/modules/utils/base58check.d.ts.map +0 -1
- package/dist/modules/utils/base58check.js.map +0 -1
- package/dist/modules/utils/build_dir.d.ts.map +0 -1
- package/dist/modules/utils/build_dir.js.map +0 -1
- package/dist/modules/utils/chain_logs.d.ts.map +0 -1
- package/dist/modules/utils/chain_logs.js.map +0 -1
- package/dist/modules/utils/errors.d.ts.map +0 -1
- package/dist/modules/utils/errors.js.map +0 -1
- package/dist/modules/utils/sanitize_key.d.ts.map +0 -1
- package/dist/modules/utils/sanitize_key.js.map +0 -1
- package/dist/modules/validate_profiles.d.ts.map +0 -1
- package/dist/modules/validate_profiles.js.map +0 -1
- package/dist/pm2.d.ts.map +0 -1
- package/dist/pm2.js.map +0 -1
- package/dist/scripts/analyze-credit.d.ts.map +0 -1
- package/dist/scripts/analyze-credit.js.map +0 -1
- package/dist/scripts/analyze-git.d.ts.map +0 -1
- package/dist/scripts/analyze-git.js.map +0 -1
- package/dist/scripts/analyze-orders.d.ts.map +0 -1
- package/dist/scripts/analyze-orders.js.map +0 -1
- package/dist/scripts/chart_command.d.ts.map +0 -1
- package/dist/scripts/chart_command.js.map +0 -1
- package/dist/scripts/diagnose-kibana-candles.d.ts.map +0 -1
- package/dist/scripts/diagnose-kibana-candles.js.map +0 -1
- package/dist/scripts/diagnose-pool-history.d.ts.map +0 -1
- package/dist/scripts/diagnose-pool-history.js.map +0 -1
- package/dist/scripts/divergence-calc.d.ts.map +0 -1
- package/dist/scripts/divergence-calc.js.map +0 -1
- package/dist/scripts/dw.d.ts.map +0 -1
- package/dist/scripts/dw.js.map +0 -1
- package/dist/scripts/generate_lp_chart.d.ts.map +0 -1
- package/dist/scripts/generate_lp_chart.js.map +0 -1
- package/dist/scripts/generate_mainnet_corpus_report.d.ts.map +0 -1
- package/dist/scripts/generate_mainnet_corpus_report.js.map +0 -1
- package/dist/scripts/native_release_gates.d.ts.map +0 -1
- package/dist/scripts/native_release_gates.js.map +0 -1
- package/dist/scripts/print_grid.d.ts.map +0 -1
- package/dist/scripts/print_grid.js.map +0 -1
- package/dist/scripts/run-tests.d.ts.map +0 -1
- package/dist/scripts/run-tests.js.map +0 -1
- package/dist/scripts/runner.d.ts.map +0 -1
- package/dist/scripts/runner.js.map +0 -1
- package/dist/scripts/sync-version.d.ts.map +0 -1
- package/dist/scripts/sync-version.js.map +0 -1
- package/dist/scripts/test-credit-renewal.d.ts.map +0 -1
- package/dist/scripts/test-credit-renewal.js.map +0 -1
- package/dist/scripts/tv.d.ts.map +0 -1
- package/dist/scripts/tv.js.map +0 -1
- package/dist/scripts/update.d.ts.map +0 -1
- package/dist/scripts/update.js.map +0 -1
- package/dist/scripts/update_dist_freshness.d.ts.map +0 -1
- package/dist/scripts/update_dist_freshness.js.map +0 -1
- package/dist/scripts/validate_bots.d.ts.map +0 -1
- package/dist/scripts/validate_bots.js.map +0 -1
- package/dist/scripts/verify-browser-bundle.d.ts.map +0 -1
- package/dist/scripts/verify-browser-bundle.js.map +0 -1
- package/dist/unlock.d.ts.map +0 -1
- package/dist/unlock.js.map +0 -1
package/dist/pm2.js
CHANGED
|
@@ -90,13 +90,15 @@ import { createPasswordBootstrapServer } from './modules/launcher/credential_boo
|
|
|
90
90
|
import { parsePm2Args } from './modules/launcher/launch_modes.js';
|
|
91
91
|
import { setupGracefulShutdown } from './modules/graceful_shutdown.js';
|
|
92
92
|
import { UPDATER, TIMING } from './modules/constants.js';
|
|
93
|
-
import { PATHS } from './modules/paths.js';
|
|
93
|
+
import { PATHS, printRelocationNotices } from './modules/paths.js';
|
|
94
94
|
import { buildRuntimeScriptPath } from './modules/launcher/runtime_entry.js';
|
|
95
95
|
import { Config } from './modules/config.js';
|
|
96
96
|
import { waitForConnected } from './modules/bitshares_client.js';
|
|
97
97
|
import * as readline from 'node:readline';
|
|
98
98
|
import { getErrorMessage } from './modules/utils/errors.js';
|
|
99
99
|
import { isSameBotName } from './modules/utils/sanitize_key.js';
|
|
100
|
+
import { muteChainLogs } from './modules/utils/chain_logs.js';
|
|
101
|
+
import { startVersionStatusCheck, printVersionStatus } from './modules/version_notice.js';
|
|
100
102
|
import { CLI_COLORS } from './modules/cli_colors.js';
|
|
101
103
|
import { getStorage } from './modules/storage/index.js';
|
|
102
104
|
import { usesAmaGridPrice } from './modules/dexbot_maintenance_runtime.js';
|
|
@@ -422,24 +424,21 @@ async function main({ botNameFilter = null, clawOnly = false, headless = false,
|
|
|
422
424
|
}
|
|
423
425
|
console.log('='.repeat(50));
|
|
424
426
|
console.log();
|
|
427
|
+
// Start the passive version check immediately but do not await it: the
|
|
428
|
+
// BitShares connect in Step 0 (and the PM2 work below) takes seconds, which
|
|
429
|
+
// fully hides the registry round-trip. The installed-vs-published status is
|
|
430
|
+
// printed in the success block at the end, below the banner, so it can
|
|
431
|
+
// never be mistaken for part of the startup status. The promise never
|
|
432
|
+
// rejects.
|
|
433
|
+
const versionStatus = startVersionStatusCheck();
|
|
425
434
|
if (!clawOnly) {
|
|
426
|
-
// Step 0: Wait for BitShares connection
|
|
427
|
-
//
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
if (!msg.includes('bitshares_client') && !msg.includes('modules/')) {
|
|
434
|
-
originalLog(...args);
|
|
435
|
-
}
|
|
436
|
-
};
|
|
437
|
-
await waitForConnected(TIMING.CONNECTION_TIMEOUT_MS);
|
|
438
|
-
}
|
|
439
|
-
finally {
|
|
440
|
-
// Always restore console output, even if waitForConnected throws
|
|
441
|
-
console.log = originalLog;
|
|
442
|
-
}
|
|
435
|
+
// Step 0: Wait for BitShares connection. The native chain stack
|
|
436
|
+
// ([Transport]/[NodeManager]/[bitshares_client]) logs straight to
|
|
437
|
+
// console regardless of setSuppressConnectionLog, so mute those
|
|
438
|
+
// prefixed lines process-wide to keep the launcher banner and the
|
|
439
|
+
// connection confirmation as the only startup output.
|
|
440
|
+
muteChainLogs();
|
|
441
|
+
await waitForConnected(TIMING.CONNECTION_TIMEOUT_MS);
|
|
443
442
|
console.log(pm2Success('Connected to BitShares'));
|
|
444
443
|
}
|
|
445
444
|
else {
|
|
@@ -450,6 +449,8 @@ async function main({ botNameFilter = null, clawOnly = false, headless = false,
|
|
|
450
449
|
console.error(pm2Error('PM2 is not installed'));
|
|
451
450
|
await installPM2();
|
|
452
451
|
}
|
|
452
|
+
// Step 1b: Make sure PM2 rotates its captured logs
|
|
453
|
+
await ensurePm2Logrotate();
|
|
453
454
|
// Step 2: Ensure credential daemon availability
|
|
454
455
|
try {
|
|
455
456
|
await ensureCredentialDaemonPM2({ headless, passwordFile });
|
|
@@ -475,6 +476,7 @@ async function main({ botNameFilter = null, clawOnly = false, headless = false,
|
|
|
475
476
|
console.log('If dexbot-cred stops, rerun `dexbot pm2` to unlock it again.');
|
|
476
477
|
console.log('='.repeat(50));
|
|
477
478
|
console.log();
|
|
479
|
+
printVersionStatus(await versionStatus);
|
|
478
480
|
}
|
|
479
481
|
function startPM2Process(args, env = buildScopedChildEnv()) {
|
|
480
482
|
return new Promise((resolve, reject) => {
|
|
@@ -566,6 +568,87 @@ async function startManagedRuntimePM2({ apps, bootstrap } = {}) {
|
|
|
566
568
|
}
|
|
567
569
|
await startManagedAppsPM2(apps);
|
|
568
570
|
}
|
|
571
|
+
/**
|
|
572
|
+
* Run a raw `pm2` command and capture its output verbatim. Used for module
|
|
573
|
+
* management (`jlist`, `install`, `set`) whose verbs are not part of the
|
|
574
|
+
* process-control whitelist in execPM2Command.
|
|
575
|
+
* @param {string[]} args - PM2 arguments.
|
|
576
|
+
* @param {Object} [options] - Execution options.
|
|
577
|
+
* @param {number} [options.timeoutMs=0] - Kill the child after this many ms (0 = no limit).
|
|
578
|
+
* @returns {Promise<{code: number, stdout: string, stderr: string}>} Command result.
|
|
579
|
+
*/
|
|
580
|
+
function runPm2Raw(args, { timeoutMs = 0 } = {}) {
|
|
581
|
+
return new Promise((resolve, reject) => {
|
|
582
|
+
const child = spawn('pm2', args, {
|
|
583
|
+
cwd: PATHS.PROJECT_ROOT,
|
|
584
|
+
env: buildScopedChildEnv(),
|
|
585
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
586
|
+
shell: process.platform === 'win32',
|
|
587
|
+
});
|
|
588
|
+
let stdout = '';
|
|
589
|
+
let stderr = '';
|
|
590
|
+
let settled = false;
|
|
591
|
+
let timer = null;
|
|
592
|
+
if (timeoutMs > 0) {
|
|
593
|
+
timer = setTimeout(() => {
|
|
594
|
+
if (settled)
|
|
595
|
+
return;
|
|
596
|
+
settled = true;
|
|
597
|
+
child.kill();
|
|
598
|
+
reject(new Error(`pm2 ${args[0]} timed out after ${timeoutMs}ms`));
|
|
599
|
+
}, timeoutMs);
|
|
600
|
+
}
|
|
601
|
+
const finish = (fn) => {
|
|
602
|
+
if (settled)
|
|
603
|
+
return;
|
|
604
|
+
settled = true;
|
|
605
|
+
if (timer)
|
|
606
|
+
clearTimeout(timer);
|
|
607
|
+
fn();
|
|
608
|
+
};
|
|
609
|
+
child.stdout.on('data', (data) => { stdout += data.toString(); });
|
|
610
|
+
child.stderr.on('data', (data) => { stderr += data.toString(); });
|
|
611
|
+
child.on('error', (err) => finish(() => reject(err)));
|
|
612
|
+
child.on('close', (code) => finish(() => resolve({ code: code ?? 0, stdout, stderr })));
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Best-effort enablement of `pm2-logrotate`. PM2 core does not rotate logs —
|
|
617
|
+
* the per-app `max_size` option is ignored without this module — so a
|
|
618
|
+
* long-running fleet would grow `profiles/logs/*.log` without bound. Never
|
|
619
|
+
* blocks or fails startup.
|
|
620
|
+
* @returns {Promise<void>}
|
|
621
|
+
*/
|
|
622
|
+
async function ensurePm2Logrotate() {
|
|
623
|
+
try {
|
|
624
|
+
const list = await runPm2Raw(['jlist'], { timeoutMs: 15000 });
|
|
625
|
+
if (list.code !== 0)
|
|
626
|
+
return;
|
|
627
|
+
let installed = false;
|
|
628
|
+
try {
|
|
629
|
+
const parsed = JSON.parse(list.stdout || '[]');
|
|
630
|
+
installed = Array.isArray(parsed) && parsed.some((app) => app && app.name === 'pm2-logrotate');
|
|
631
|
+
}
|
|
632
|
+
catch (err) {
|
|
633
|
+
installed = false;
|
|
634
|
+
}
|
|
635
|
+
if (installed)
|
|
636
|
+
return;
|
|
637
|
+
const install = await runPm2Raw(['install', 'pm2-logrotate'], { timeoutMs: 120000 });
|
|
638
|
+
if (install.code !== 0) {
|
|
639
|
+
const detail = (install.stderr || install.stdout || '').trim() || 'pm2 install failed';
|
|
640
|
+
console.warn(pm2Error(`PM2 log rotation not enabled: ${detail}`));
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
await runPm2Raw(['set', 'pm2-logrotate:max_size', '100M'], { timeoutMs: 15000 });
|
|
644
|
+
await runPm2Raw(['set', 'pm2-logrotate:retain', '10'], { timeoutMs: 15000 });
|
|
645
|
+
await runPm2Raw(['set', 'pm2-logrotate:compress', 'true'], { timeoutMs: 15000 });
|
|
646
|
+
console.log('Enabled PM2 log rotation (pm2-logrotate: 100M files, retain 10, compressed).');
|
|
647
|
+
}
|
|
648
|
+
catch (err) {
|
|
649
|
+
console.warn(`PM2 log rotation not enabled: ${getErrorMessage(err)}`);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
569
652
|
/**
|
|
570
653
|
* Check if PM2 is installed locally or globally.
|
|
571
654
|
* @returns {boolean} True if PM2 is found.
|
|
@@ -928,6 +1011,9 @@ Repo-root users can run \`./pm2\` instead.
|
|
|
928
1011
|
const isPm2DirectRun = !!process.argv[1] && (import.meta.url === pathToFileURL(process.argv[1]).href ||
|
|
929
1012
|
path.basename(process.argv[1]).replace(/\.js$/, '') === 'pm2');
|
|
930
1013
|
if (isPm2DirectRun) {
|
|
1014
|
+
// `dexbot pm2` delegates here without printing relocation notices, so the
|
|
1015
|
+
// child owns them: emit once for every pm2 invocation, before dispatch.
|
|
1016
|
+
printRelocationNotices();
|
|
931
1017
|
// Parse command line arguments
|
|
932
1018
|
const { command, target, clawOnly, headless, passwordFile } = parsePm2Args(process.argv);
|
|
933
1019
|
(async () => {
|
package/dist/scripts/update.js
CHANGED
|
@@ -32,10 +32,11 @@
|
|
|
32
32
|
*
|
|
33
33
|
* Usage: node dist/scripts/update.js
|
|
34
34
|
*/
|
|
35
|
-
import { execSync } from 'node:child_process';
|
|
35
|
+
import { execSync, spawnSync } from 'node:child_process';
|
|
36
36
|
import path from 'node:path';
|
|
37
37
|
import fs from 'node:fs';
|
|
38
38
|
import { homedir } from 'node:os';
|
|
39
|
+
import { pathToFileURL } from 'node:url';
|
|
39
40
|
import { sendControlCommand } from '../modules/launcher/supervisor_control.js';
|
|
40
41
|
import { findMissingDistEntries, inspectDistBundle } from './update_dist_freshness.js';
|
|
41
42
|
// Import update configuration from constants
|
|
@@ -447,26 +448,78 @@ function snapshotMonolithicState() {
|
|
|
447
448
|
}
|
|
448
449
|
return { monolithicWasRunning, hadMonolithicFiles };
|
|
449
450
|
}
|
|
451
|
+
/**
|
|
452
|
+
* Absolute file:// URL of the freshly built pm2.js. Prefers dist/ and falls
|
|
453
|
+
* back to the source-tree shim when no build output exists.
|
|
454
|
+
*/
|
|
455
|
+
function resolvePm2ModuleUrl() {
|
|
456
|
+
const distPath = path.join(PATHS.PROJECT_ROOT, BUILD_DIR, 'pm2.js');
|
|
457
|
+
const pm2Path = fs.existsSync(distPath)
|
|
458
|
+
? distPath
|
|
459
|
+
: path.join(PATHS.PROJECT_ROOT, 'pm2.js');
|
|
460
|
+
return pathToFileURL(pm2Path).href;
|
|
461
|
+
}
|
|
450
462
|
/**
|
|
451
463
|
* Regenerate the PM2 ecosystem config so profiles/ecosystem.config.cjs
|
|
452
464
|
* reflects the current bots.json state (including dexbot-adapter and
|
|
453
|
-
* dexbot-update service apps).
|
|
465
|
+
* dexbot-update service apps).
|
|
466
|
+
*
|
|
467
|
+
* This MUST run in a fresh process. The updater loaded the pre-pull copies of
|
|
468
|
+
* modules/paths.js, config.js, constants.js, ... at startup, and Node's ESM
|
|
469
|
+
* registry is keyed by resolved URL for the process lifetime. Rewriting dist/
|
|
470
|
+
* via `npm run build` does not evict those cached modules, so importing the
|
|
471
|
+
* freshly built dist/pm2.js in-process resolves its static imports back to
|
|
472
|
+
* the stale cached copies. That surfaces as build-fresh-but-import-broken
|
|
473
|
+
* errors such as "does not provide an export named 'printRelocationNotices'".
|
|
474
|
+
* A child process starts with an empty registry and sees the new build.
|
|
454
475
|
*/
|
|
455
476
|
async function regenerateEcosystemConfig() {
|
|
456
477
|
log('Regenerating PM2 ecosystem config...');
|
|
457
478
|
try {
|
|
458
|
-
|
|
459
|
-
const
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
479
|
+
const moduleUrl = resolvePm2ModuleUrl();
|
|
480
|
+
const script = [
|
|
481
|
+
`import(${JSON.stringify(moduleUrl)})`,
|
|
482
|
+
' .then((m) => m.generateEcosystemConfig({ clawOnly: false, exitOnError: false }))',
|
|
483
|
+
' .catch((err) => { console.error(err && err.stack ? err.stack : String(err)); process.exit(1); });',
|
|
484
|
+
].join('\n');
|
|
485
|
+
const result = spawnSync(process.execPath, ['--input-type=module', '-e', script], {
|
|
486
|
+
stdio: 'inherit',
|
|
487
|
+
cwd: PATHS.PROJECT_ROOT,
|
|
488
|
+
});
|
|
489
|
+
if (result.error)
|
|
490
|
+
throw result.error;
|
|
491
|
+
if (result.status !== 0) {
|
|
492
|
+
throw new Error(`ecosystem generator exited with code ${result.status}`);
|
|
493
|
+
}
|
|
464
494
|
log('Ecosystem config regenerated successfully.');
|
|
465
495
|
}
|
|
466
496
|
catch (err) {
|
|
467
497
|
log(`Warning: Ecosystem config regeneration failed (${getErrorMessage(err)}). Continuing with existing config.`);
|
|
468
498
|
}
|
|
469
499
|
}
|
|
500
|
+
/**
|
|
501
|
+
* Evaluate `needsMarketAdapter(runningActiveBots)` from the freshly built
|
|
502
|
+
* dist/pm2.js in a child process. Importing pm2.js in-process after the build
|
|
503
|
+
* is unsafe for the same ESM-cache reason documented on
|
|
504
|
+
* regenerateEcosystemConfig(): its link against the cached pre-pull
|
|
505
|
+
* modules/paths.js can fail even though dist/ is fresh.
|
|
506
|
+
*/
|
|
507
|
+
function pm2NeedsMarketAdapter(runningActiveBots) {
|
|
508
|
+
const moduleUrl = resolvePm2ModuleUrl();
|
|
509
|
+
const script = `import(${JSON.stringify(moduleUrl)})` +
|
|
510
|
+
`.then((m) => { process.stdout.write(m.needsMarketAdapter(${JSON.stringify(runningActiveBots)}) ? 'true' : 'false'); })` +
|
|
511
|
+
`.catch((err) => { console.error(err && err.stack ? err.stack : String(err)); process.exit(1); });`;
|
|
512
|
+
const result = spawnSync(process.execPath, ['--input-type=module', '-e', script], {
|
|
513
|
+
stdio: ['ignore', 'pipe', 'inherit'],
|
|
514
|
+
cwd: PATHS.PROJECT_ROOT,
|
|
515
|
+
encoding: 'utf8',
|
|
516
|
+
});
|
|
517
|
+
if (result.error)
|
|
518
|
+
throw result.error;
|
|
519
|
+
if (result.status !== 0)
|
|
520
|
+
throw new Error(`pm2 helper exited with code ${result.status}`);
|
|
521
|
+
return (result.stdout || '').trim() === 'true';
|
|
522
|
+
}
|
|
470
523
|
/**
|
|
471
524
|
* Restart active runtime processes after an update so the new code is picked
|
|
472
525
|
* up. Handles, in order of preference:
|
|
@@ -532,11 +585,7 @@ async function restartActiveRuntimes({ monolithicWasRunning, hadMonolithicFiles
|
|
|
532
585
|
const botsToRestart = activeInConfig.filter((name) => runningProcesses.includes(name));
|
|
533
586
|
const activeBots = (config.bots || []).filter((b) => b.active !== false);
|
|
534
587
|
const runningActiveBots = activeBots.filter((b) => runningProcesses.includes(b.name));
|
|
535
|
-
const
|
|
536
|
-
const pm2Module = fs.existsSync(maPath)
|
|
537
|
-
? await import(maPath)
|
|
538
|
-
: await import(path.join(PATHS.PROJECT_ROOT, 'pm2.js'));
|
|
539
|
-
const marketAdapterRequired = pm2Module.needsMarketAdapter(runningActiveBots);
|
|
588
|
+
const marketAdapterRequired = pm2NeedsMarketAdapter(runningActiveBots);
|
|
540
589
|
const serviceAppsToRestart = marketAdapterRequired ? ['dexbot-adapter'] : [];
|
|
541
590
|
const servicesToRestart = serviceAppsToRestart.filter((name) => runningProcesses.includes(name));
|
|
542
591
|
const allToRestart = [...botsToRestart, ...servicesToRestart];
|
package/dist/unlock.d.ts
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
declare const waitForChildSpawn: any, pidMatchesScriptCandidates: any, candidateRuntimeScriptPaths: any;
|
|
3
3
|
declare const isLikelyCredentialDaemonProcess: any, ensureNoForeignCredentialDaemon: any, findCredentialSocketOwnerPid: any, buildDexbotStartArgs: any;
|
|
4
4
|
declare function waitForStableChildStartup(child: any, { label, timeoutMs }?: any): any;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Handle first-run setup at the launcher boundary. This is shared by
|
|
7
|
+
* `dexbot start`, `dexbot unlock`, and direct `node unlock` invocations.
|
|
8
|
+
* Internal supervisor children must not reopen onboarding after the parent
|
|
9
|
+
* has already completed it. Returns true when an editor was opened; it does
|
|
10
|
+
* not print relocation notices (the caller owns that, since a quiet first run
|
|
11
|
+
* should not print diagnostics ahead of the editor).
|
|
12
|
+
*/
|
|
13
|
+
declare function runStartOnboardingIfNeeded({ allowInteractive, nonInteractiveFlag }?: {
|
|
14
|
+
allowInteractive?: boolean;
|
|
15
|
+
nonInteractiveFlag?: string;
|
|
16
|
+
}): Promise<boolean>;
|
|
17
|
+
declare function main({ argv, startupGraceMs, exitAfterOnboarding, onboard }?: any): Promise<void>;
|
|
18
|
+
export { buildDexbotStartArgs, candidateRuntimeScriptPaths, ensureNoForeignCredentialDaemon, findCredentialSocketOwnerPid, isLikelyCredentialDaemonProcess, main, runStartOnboardingIfNeeded, pidMatchesScriptCandidates, waitForChildSpawn, waitForStableChildStartup };
|
|
7
19
|
//# sourceMappingURL=unlock.d.ts.map
|
package/dist/unlock.js
CHANGED
|
@@ -48,12 +48,17 @@ import { createCredentialDaemonController } from './modules/launcher/credential_
|
|
|
48
48
|
import { buildScopedChildEnv } from './modules/launcher/child_env.js';
|
|
49
49
|
import { parseUnlockArgs } from './modules/launcher/launch_modes.js';
|
|
50
50
|
import { UPDATER, LAUNCHER } from './modules/constants.js';
|
|
51
|
+
import { formatStartupNotice } from './modules/cli_start_output.js';
|
|
51
52
|
import { runtime } from './modules/runtime.js';
|
|
52
|
-
import { PATHS } from './modules/paths.js';
|
|
53
|
+
import { PATHS, printRelocationNotices } from './modules/paths.js';
|
|
54
|
+
import { startVersionStatusCheck, flushVersionStatus, printVersionStatusWhenReady } from './modules/version_notice.js';
|
|
53
55
|
import { buildRuntimeScriptArgs } from './modules/launcher/runtime_entry.js';
|
|
54
56
|
import { sendControlCommand } from './modules/launcher/supervisor_control.js';
|
|
55
57
|
import { registerCleanup, setupGracefulShutdown } from './modules/graceful_shutdown.js';
|
|
56
58
|
import { normalizeBotEntry, resolveRawBotEntries, loadSettingsFile } from './modules/bot_settings.js';
|
|
59
|
+
import { main as runBotEditor } from './modules/account_bots.js';
|
|
60
|
+
import { setSuppressConnectionLog, disconnectClient } from './modules/bitshares_client.js';
|
|
61
|
+
import { selectStartOnboardingCommand } from './modules/cli_start_onboarding.js';
|
|
57
62
|
import * as chainKeys from './modules/chain_keys.js';
|
|
58
63
|
import * as credentialPolicy from './modules/credential_policy.js';
|
|
59
64
|
import { getWhitelistFlags } from './modules/market_adapter_whitelist.js';
|
|
@@ -130,6 +135,11 @@ function printLauncherSuccess({ botName = null, clawOnly = false, isolated = fal
|
|
|
130
135
|
console.log('='.repeat(50));
|
|
131
136
|
console.log();
|
|
132
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Print the pending "new version available" notice, if there is one.
|
|
140
|
+
* Awaited at every terminal launcher path because `process.exit()` would
|
|
141
|
+
* otherwise truncate the in-flight registry request.
|
|
142
|
+
*/
|
|
133
143
|
function makeFinishGuard(cleanup) {
|
|
134
144
|
let settled = false;
|
|
135
145
|
let timer = null;
|
|
@@ -379,7 +389,53 @@ async function runIsolated({ botName, botEntry = null, stayResident = false, sta
|
|
|
379
389
|
});
|
|
380
390
|
}
|
|
381
391
|
// ── Main entry point ───────────────────────────────────────────────
|
|
382
|
-
|
|
392
|
+
/**
|
|
393
|
+
* Handle first-run setup at the launcher boundary. This is shared by
|
|
394
|
+
* `dexbot start`, `dexbot unlock`, and direct `node unlock` invocations.
|
|
395
|
+
* Internal supervisor children must not reopen onboarding after the parent
|
|
396
|
+
* has already completed it. Returns true when an editor was opened; it does
|
|
397
|
+
* not print relocation notices (the caller owns that, since a quiet first run
|
|
398
|
+
* should not print diagnostics ahead of the editor).
|
|
399
|
+
*/
|
|
400
|
+
async function runStartOnboardingIfNeeded({ allowInteractive = true, nonInteractiveFlag = '--headless' } = {}) {
|
|
401
|
+
const keySetup = chainKeys.hasKeySetup();
|
|
402
|
+
let botCount = 0;
|
|
403
|
+
if (keySetup) {
|
|
404
|
+
const { config } = loadSettingsFile(BOTS_FILE, { silent: true });
|
|
405
|
+
botCount = resolveRawBotEntries(config).length;
|
|
406
|
+
}
|
|
407
|
+
const onboardingCommand = selectStartOnboardingCommand(keySetup, botCount);
|
|
408
|
+
if (!onboardingCommand)
|
|
409
|
+
return false;
|
|
410
|
+
if (!allowInteractive) {
|
|
411
|
+
const command = onboardingCommand === 'key' ? 'dexbot key' : 'dexbot bot';
|
|
412
|
+
throw new Error(`Incomplete setup for ${nonInteractiveFlag}; run ${command} interactively first.`);
|
|
413
|
+
}
|
|
414
|
+
console.log(formatStartupNotice(onboardingCommand === 'key'
|
|
415
|
+
? "No key vault configured yet - entering key setup ('dexbot key')."
|
|
416
|
+
: "Key vault configured but no bots defined - entering bot setup ('dexbot bot').", {
|
|
417
|
+
isTTY: process.stdout.isTTY,
|
|
418
|
+
noColor: Boolean(Config.NO_COLOR),
|
|
419
|
+
}));
|
|
420
|
+
if (onboardingCommand === 'key') {
|
|
421
|
+
await chainKeys.main();
|
|
422
|
+
return true;
|
|
423
|
+
}
|
|
424
|
+
setSuppressConnectionLog(true);
|
|
425
|
+
try {
|
|
426
|
+
await runBotEditor();
|
|
427
|
+
}
|
|
428
|
+
finally {
|
|
429
|
+
try {
|
|
430
|
+
disconnectClient();
|
|
431
|
+
}
|
|
432
|
+
catch (err) {
|
|
433
|
+
console.warn('Failed to disconnect BitShares after bot helper exit:', getErrorMessage(err) || err);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
return true;
|
|
437
|
+
}
|
|
438
|
+
async function main({ argv = process.argv, startupGraceMs = DEFAULT_STARTUP_GRACE_MS, exitAfterOnboarding = false, onboard = false } = {}) {
|
|
383
439
|
if (typeof chainKeys.checkKeysFileSecurity === 'function')
|
|
384
440
|
chainKeys.checkKeysFileSecurity();
|
|
385
441
|
if (typeof credentialPolicy.checkPolicyFileSecurity === 'function')
|
|
@@ -389,11 +445,42 @@ async function main({ argv = process.argv, startupGraceMs = DEFAULT_STARTUP_GRAC
|
|
|
389
445
|
const forceForegroundIsolated = Config.DEXBOT_ISOLATED_FOREGROUND;
|
|
390
446
|
const isMonolithicBgChild = Config.DEXBOT_MONOLITHIC_BG;
|
|
391
447
|
const forceForeground = argv.includes('--foreground');
|
|
448
|
+
const isInternalChild = isDetachedSupervisorChild || isMonolithicBgChild;
|
|
392
449
|
if (parsed.control) {
|
|
393
450
|
await handleControl({ cmd: parsed.control.cmd, target: parsed.control.target ?? undefined });
|
|
394
451
|
return;
|
|
395
452
|
}
|
|
396
453
|
const { botName, clawOnly, creditOnly, isolated, dryrun, headless, passwordFile } = parsed;
|
|
454
|
+
// Onboarding is a launcher-CLI concern: the direct-run bootstrap opts in so
|
|
455
|
+
// programmatic callers (tests, embeds) never block on an interactive prompt.
|
|
456
|
+
if (onboard && !isInternalChild) {
|
|
457
|
+
// Non-interactive entry points (headless automation, dry-run
|
|
458
|
+
// validation) must fail fast instead of blocking on an editor prompt.
|
|
459
|
+
const nonInteractiveFlag = headless ? '--headless' : (dryrun ? '--dryrun' : null);
|
|
460
|
+
const onboarding = await runStartOnboardingIfNeeded({
|
|
461
|
+
allowInteractive: !nonInteractiveFlag,
|
|
462
|
+
nonInteractiveFlag: nonInteractiveFlag ?? '--headless',
|
|
463
|
+
});
|
|
464
|
+
if (onboarding) {
|
|
465
|
+
if (exitAfterOnboarding)
|
|
466
|
+
process.exit(0);
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
if (!isInternalChild)
|
|
471
|
+
printRelocationNotices();
|
|
472
|
+
// Kick off the passive version check now and await it only at the terminal
|
|
473
|
+
// paths below. It reports the installed version against the published
|
|
474
|
+
// latest — green when current, orange when a newer release exists — and
|
|
475
|
+
// appends the one-time `dexbot update` hint. The password prompt and
|
|
476
|
+
// daemon startup that follow take seconds, which hides the registry
|
|
477
|
+
// round-trip entirely. The promise never rejects and resolves to null when
|
|
478
|
+
// the check is disabled.
|
|
479
|
+
// Internal children (detached supervisor, monolithic bg) stay silent: they
|
|
480
|
+
// would re-probe and re-print a notice the launcher already handled. A
|
|
481
|
+
// --dryrun is a side-effect-free validation, so it never probes or writes
|
|
482
|
+
// the cache either.
|
|
483
|
+
const versionStatus = (isInternalChild || dryrun) ? Promise.resolve(null) : startVersionStatusCheck();
|
|
397
484
|
let effectiveBotName = botName;
|
|
398
485
|
if (creditOnly && !effectiveBotName) {
|
|
399
486
|
const creditBots = listConfiguredBots().filter((b) => b.creditOnly === true && b.active !== false);
|
|
@@ -418,6 +505,7 @@ async function main({ argv = process.argv, startupGraceMs = DEFAULT_STARTUP_GRAC
|
|
|
418
505
|
printLauncherHeader({ botName: effectiveBotName || botName, clawOnly, creditOnly, isolated, dryrun, headless });
|
|
419
506
|
console.log(`DEXBot2 already running in background (PID ${pid}).`);
|
|
420
507
|
console.log('Use `dexbot stat` to inspect it, or `dexbot restart` to restart it.');
|
|
508
|
+
await flushVersionStatus(versionStatus);
|
|
421
509
|
process.exitCode = 0;
|
|
422
510
|
return;
|
|
423
511
|
}
|
|
@@ -477,6 +565,7 @@ async function main({ argv = process.argv, startupGraceMs = DEFAULT_STARTUP_GRAC
|
|
|
477
565
|
if (pid > 0) {
|
|
478
566
|
console.log(`DEXBot2 already running in background (PID ${pid}).`);
|
|
479
567
|
console.log('Use `dexbot stat` to inspect it, or `dexbot restart` to restart it.');
|
|
568
|
+
await flushVersionStatus(versionStatus);
|
|
480
569
|
process.exitCode = 0;
|
|
481
570
|
return;
|
|
482
571
|
}
|
|
@@ -519,16 +608,22 @@ async function main({ argv = process.argv, startupGraceMs = DEFAULT_STARTUP_GRAC
|
|
|
519
608
|
child.unref();
|
|
520
609
|
storage.writeFile(MONOLITHIC_PID_FILE, String(child.pid), { mode: 0o600 });
|
|
521
610
|
printLauncherStartupSummary({ botNames: launchedBotNames, mode: 'background' });
|
|
611
|
+
await flushVersionStatus(versionStatus);
|
|
522
612
|
process.exit(0);
|
|
523
613
|
}
|
|
524
614
|
if (clawOnly) {
|
|
525
615
|
printLauncherSuccess({ clawOnly });
|
|
616
|
+
await flushVersionStatus(versionStatus);
|
|
526
617
|
const exitCode = await controller.waitForManagedDaemon();
|
|
527
618
|
process.exitCode = exitCode || 0;
|
|
528
619
|
return;
|
|
529
620
|
}
|
|
530
621
|
if (isolated) {
|
|
531
622
|
if (isDetachedSupervisorChild || forceForegroundIsolated) {
|
|
623
|
+
// Never delay the bot launch on the probe: this branch stays
|
|
624
|
+
// resident for the bot's lifetime, so print when the probe
|
|
625
|
+
// settles instead of awaiting it before supervisor.start().
|
|
626
|
+
printVersionStatusWhenReady(versionStatus);
|
|
532
627
|
process.exitCode = await runIsolated({
|
|
533
628
|
botName: botName ?? undefined,
|
|
534
629
|
botEntry: selectedBot,
|
|
@@ -547,6 +642,7 @@ async function main({ argv = process.argv, startupGraceMs = DEFAULT_STARTUP_GRAC
|
|
|
547
642
|
console.log(`Supervisor PID: ${supervisorPid}`);
|
|
548
643
|
console.log(`Control socket: ${Config.DEXBOT_SUPERVISOR_SOCKET || SOCKET_PATH}`);
|
|
549
644
|
console.log(`Supervisor logs: ${SUPERVISOR_OUT_LOG}`);
|
|
645
|
+
await flushVersionStatus(versionStatus);
|
|
550
646
|
process.exitCode = 0;
|
|
551
647
|
return;
|
|
552
648
|
}
|
|
@@ -619,6 +715,7 @@ async function main({ argv = process.argv, startupGraceMs = DEFAULT_STARTUP_GRAC
|
|
|
619
715
|
if (!updater?.pendingRestart) {
|
|
620
716
|
if (!isMonolithicBgChild) {
|
|
621
717
|
printLauncherStartupSummary({ botNames: launchedBotNames, mode: 'foreground' });
|
|
718
|
+
await flushVersionStatus(versionStatus);
|
|
622
719
|
}
|
|
623
720
|
}
|
|
624
721
|
const onSigint = () => forwardSignal(botProcess, 'SIGINT');
|
|
@@ -1009,7 +1106,7 @@ if (isUnlockStartDirectRun) {
|
|
|
1009
1106
|
}
|
|
1010
1107
|
(async () => {
|
|
1011
1108
|
try {
|
|
1012
|
-
await main();
|
|
1109
|
+
await main({ exitAfterOnboarding: true, onboard: true });
|
|
1013
1110
|
}
|
|
1014
1111
|
catch (err) {
|
|
1015
1112
|
console.error(statusError(`unlock failed: ${getErrorMessage(err) || err}`));
|
|
@@ -1017,5 +1114,5 @@ if (isUnlockStartDirectRun) {
|
|
|
1017
1114
|
}
|
|
1018
1115
|
})();
|
|
1019
1116
|
}
|
|
1020
|
-
export { buildDexbotStartArgs, candidateRuntimeScriptPaths, ensureNoForeignCredentialDaemon, findCredentialSocketOwnerPid, isLikelyCredentialDaemonProcess, main, pidMatchesScriptCandidates, waitForChildSpawn, waitForStableChildStartup };
|
|
1117
|
+
export { buildDexbotStartArgs, candidateRuntimeScriptPaths, ensureNoForeignCredentialDaemon, findCredentialSocketOwnerPid, isLikelyCredentialDaemonProcess, main, runStartOnboardingIfNeeded, pidMatchesScriptCandidates, waitForChildSpawn, waitForStableChildStartup };
|
|
1021
1118
|
//# sourceMappingURL=unlock.js.map
|
|
@@ -492,9 +492,16 @@ overrides the location entirely.
|
|
|
492
492
|
| `dexbot-adapter.log` / `dexbot-adapter-error.log` | Market adapter managed by the runtime |
|
|
493
493
|
| `market_adapter.log` | Standalone adapter mode |
|
|
494
494
|
| `dexbot-update.log` / `dexbot-update-error.log` | Auto-updater |
|
|
495
|
+
| `daemon-audit.jsonl` | Credential daemon audit trail (`sign_denied` and friends) |
|
|
495
496
|
|
|
496
497
|
See [LOGGING.md](LOGGING.md) for log levels, rotation, and JSON output.
|
|
497
|
-
`dexbot clear` empties the logs directory wherever it resolves
|
|
498
|
+
`dexbot clear` empties the logs directory wherever it resolves: every `*.log`, rotated
|
|
499
|
+
`*.log.N` and `*.jsonl*` — so the credential-daemon audit trail
|
|
500
|
+
(`daemon-audit.jsonl` and its rotated siblings) goes too; the preview names it.
|
|
501
|
+
Stop the runtime first (`dexbot stop`): a running daemon keeps writing to the
|
|
502
|
+
unlinked files, so the space is only freed on restart, and the scripts warn you
|
|
503
|
+
when they detect a live runtime. Siblings: `clear-orders`, `clear-market-adapter`,
|
|
504
|
+
`clear-all`.
|
|
498
505
|
|
|
499
506
|
### "I forgot the master password"
|
|
500
507
|
|
package/docs/COW_INVARIANTS.md
CHANGED
|
@@ -69,10 +69,18 @@ This document defines the non-negotiable behavioral invariants for the DEXBot2 s
|
|
|
69
69
|
- A hold run carrying fresh fills (>= `TIMING.BOUNDARY_HOLD_RESYNC_THRESHOLD`) requests a guard-aware structural re-center (`requestStructuralGridResync`, cooldown `TIMING.BOUNDARY_HOLD_RESYNC_COOLDOWN_MS`) instead of holding forever — the heal path when the grid is trailing the market.
|
|
70
70
|
|
|
71
71
|
- `INV-COW-008` Owed fill crawls survive unapplied commits
|
|
72
|
-
- `order/strategy.ts` records a crawl per shift-eligible fill at intake (slot-level dedupe, capped at 500); `deriveTargetBoundary` folds still-owed `_pendingFillCrawls` into the next derivation, excluding the current batch's slots and reserve
|
|
72
|
+
- `order/strategy.ts` records a crawl per shift-eligible fill at intake (slot-level dedupe, capped at 500); `deriveTargetBoundary` folds still-owed `_pendingFillCrawls` into the next derivation, excluding the current batch's slots, reserve slots, and window members — a window that reaches the grid edge is not a reserve, using the same window exclusion every placement picker and `countLiveReserveOrders` apply.
|
|
73
73
|
- `_commitWorkingGrid` clears them only when the plan's boundary was actually applied — a held boundary (`boundaryHeld`), a gate-rejected boundary, and a null boundary all leave them owed.
|
|
74
74
|
- `consumePendingFillCrawls` applies them onto a restored finite boundary; `applyPersistedPendingCrawls` is the shared startup/recovery wrapper used before sync/reconcile; `_clearPendingFillCrawls` drops them when the boundary is re-anchored (grid rebuild via `initializeGrid`, rejected snapshot via `rejectCorruptedGridSnapshot`, persisted snapshot wipe via `AccountOrders.clearGrid`).
|
|
75
75
|
|
|
76
|
+
- `INV-COW-009` LAST-FILL-GUARD pivot survives restarts with the snapshot, and only as a fill fact
|
|
77
|
+
- Single source of truth: the manager's in-memory pivot is authoritative at runtime; the disk row is a mirror that rides the grid snapshot (`persistGridSnapshot` → `storeMasterGrid` 10th param → `lastFillPivot`), so it invalidates in lockstep with the boundary/genesis instead of forming a second ledger (the `_pendingFillCrawls` lockstep contract).
|
|
78
|
+
- Provenance gate: only a pivot written through the shared `setLastFillPivot(type, price, 'fill')` writer is persist-eligible. A book-seeded pivot (`seedLastFilledPricesFromBook`, provenance `'book'`) is a heuristic — max resting buy / min resting sell is not market truth — and is never fossilized into the snapshot. The fill-batch and queued-fill refresh sites funnel through one implementation (free function in `utils/system.ts`; `OrderManager._setLastFillPivot` delegates to it), so value, timestamp, and provenance cannot drift apart; the queued-fill refresh and the restore path call the same free function directly, with the legacy-stub fallback built into the shared writer rather than copy-pasted. A single-sided book arms through the same writer with provenance `'book'`; the two-sided midpoint and per-side mirror seeds stay direct writes by design, because they carry no pivot provenance and must not be persist-eligible.
|
|
79
|
+
- The row carries `{price, type, fillsAt, genesisHash}` validated by one shared gate (`normalizeLastFillPivot`) used by BOTH the `storeMasterGrid` sanitizer and the loader — the two shape checks cannot drift. `null` from the payload builder always clears the stored row (consumed pivot / cold manager / no live genesis), `undefined` stays a legacy no-op for old callers, and a malformed shape also clears.
|
|
80
|
+
- Restore ordering: `grid.loadGrid` restores the pivot right after `_restoreBoundary` — with the persisted genesis applied and the grid re-typed, BEFORE the first reconcile/broadcast — so a restart cannot re-open the cold window where evacuation stamps get applied against a boundary still being rebuilt. All `loadGrid` callers (startup resume, price-match resume, recovery reload) inherit it; there is no second restore call site to drift.
|
|
81
|
+
- Validation chain (`restoreLastFillPivot`): TTL expiry (`GRID_LIMITS.LAST_FILL_PIVOT_TTL_MS`, 24h; the pivot is a "latest fill" fact, not a permanent ratchet; expired pivots hand over to the startup book seed) and genesis binding (mismatched hash = dead generation) erase the row through one shared drop path (`clearPersistedLastFillPivot` under the bot's persistence lock, best-effort). Off-grid refusal (`resolveOnGridPivot` — the runtime's own ladder validator, imported lazily from the restore site so ONE implementation serves both the per-probe live guard and the restore; the restorer can never accept a value the runtime would refuse per probe) is a no-op that falls back to the book seed and leaves the row for the next snapshot flush to clear (the cold in-memory pivot makes the payload builder return null). The snapped ladder level is restored, never the raw float, and the ORIGINAL `fillsAt` is preserved through `setLastFillPivot`'s `atMs` param so the TTL keeps meaning "age of the last fill", not "time since this restart".
|
|
82
|
+
- Generation invalidation mirrors the pending-crawl ledger: `initializeGrid` and `rejectCorruptedGridSnapshot` clear the in-memory pivot via `resetLastFillPivot` (exposed as `OrderManager._resetLastFillPivot`), which clears the FULL scalar family — per-side mirrors included — so `seedLastFilledPricesFromBook`'s cold gate cannot be silently suppressed by stale per-side values after a grid rebuild, and `AccountOrders.clearGrid` wipes the persisted row with the snapshot. The guard re-arms on the first real fill of the new generation.
|
|
83
|
+
|
|
76
84
|
- `INV-PROJ-001` New projected orders remain virtual
|
|
77
85
|
- Orders projected into empty slots must be `VIRTUAL` with no `orderId` until chain confirmation.
|
|
78
86
|
|
|
@@ -200,7 +208,8 @@ This document defines the non-negotiable behavioral invariants for the DEXBot2 s
|
|
|
200
208
|
- Enforced at all six emission sites (CREATE / UPDATE / CREATE-FALLBACK, RECONCILE-CREATE / RECONCILE-UPDATE, STARTUP-CREATE): an off-grid emission is blocked, never broadcast.
|
|
201
209
|
- Range guards (`isChainPriceOutOfGrid`) are bounds checks, not membership checks — they cannot substitute for this invariant.
|
|
202
210
|
- Adoption keeps the slot's own level (a fill/chain price is metadata, not the slot's price); `loadGrid` repairs a pre-existing off-grid slot price at load.
|
|
203
|
-
-
|
|
211
|
+
- A snapshot carrying orders but no usable ladder is **refused** before any mutation (`loadGrid`, before the startup resume decision, and at the persisted-row schema), and the sync entry refuses to reconcile a ladder-less grid at all — without a ladder no consumer has authority for a slot's price, which is what this invariant exists to prevent. The tolerance matcher that used to cover that state has been removed. `config.gridLimits.MISSING_GENESIS_POLICY` picks the response: `'rebuild'` (default, structural resync) or `'halt'` (manual reset). One decision, one module: `modules/order/genesis_policy.ts`.
|
|
212
|
+
- Tests: GPI-001..015 (`tests/test_grid_price_invariant_guard.ts`), GPI-WIRE-001..009 (`tests/test_grid_price_invariant_wiring.ts`), LEGACY-ADOPT/MATERIALIZE/ADOPT-NAME (`tests/test_sync_out_of_grid_defer.ts`), GEN-01..21 (`tests/test_missing_genesis_policy.ts`).
|
|
204
213
|
|
|
205
214
|
---
|
|
206
215
|
|
|
@@ -288,6 +288,32 @@ The failure path is consistent regardless of whether the daemon or the
|
|
|
288
288
|
interactive password prompt handled the authentication, making the output
|
|
289
289
|
predictable for monitoring and alerting.
|
|
290
290
|
|
|
291
|
+
### Cancelling the key manager (Escape ≠ wrong password)
|
|
292
|
+
|
|
293
|
+
Pressing **Escape** at any interactive key-manager prompt is an explicit
|
|
294
|
+
*cancellation*, never a failed authentication. The contract:
|
|
295
|
+
|
|
296
|
+
- `authenticate()` throws `MasterPasswordCancelledError` on Escape
|
|
297
|
+
(`modules/chain_keys.ts`). `isMasterPasswordFailure()` recognizes
|
|
298
|
+
cancellation alongside a genuinely wrong password, so every abort path
|
|
299
|
+
(`key_store`, `chain_orders`, `credential_daemon`, `dexbot_class`, `dexbot`)
|
|
300
|
+
handles it without reporting it as an authentication failure.
|
|
301
|
+
- `main()` returns whether a **usable vault** exists, routes every close through
|
|
302
|
+
one message, keeps submenu Escape local to the operation, and
|
|
303
|
+
`selectKeyName()` returns `null` on cancel. `dexbot.ts` honors that return
|
|
304
|
+
value and surfaces a cancellation message during first-run setup.
|
|
305
|
+
- **Setup completeness is a usable account entry, not password metadata.**
|
|
306
|
+
`hasKeySetup()` requires a valid `v2` encrypted key, so `dexbot start` routes
|
|
307
|
+
back into onboarding instead of launching with a vault that cannot sign
|
|
308
|
+
(`selectStartOnboardingCommand(hasKeySetup, botCount)`: no usable key → `key`;
|
|
309
|
+
key but no bot definitions → `bot`; otherwise launch).
|
|
310
|
+
- Non-interactive launches never block on a prompt: `--headless` / `--dryrun`
|
|
311
|
+
with incomplete configuration fail fast with a message. Programmatic
|
|
312
|
+
`unlock.main()` callers (tests, embeds) get no onboarding at all.
|
|
313
|
+
|
|
314
|
+
Cancellation leaves no secret material behind: it is a read-only abort of the
|
|
315
|
+
prompt, and the 3-attempt cap applies only to real password attempts.
|
|
316
|
+
|
|
291
317
|
---
|
|
292
318
|
|
|
293
319
|
## 6. Startup Path — Daemon-First, Interactive Fallback
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# DEXBot vs DEXBot2 — Detailed Comparison Report
|
|
2
2
|
|
|
3
3
|
> **Date:** 2026-09-02 *(metrics refreshed against local source trees)*
|
|
4
|
-
> **Scope:** Full architectural, functional, and operational comparison between the original [DEXBot](https://github.com/Codaone/DEXBot) (Python, v1.0.0) and DEXBot2 (TypeScript, v1.6.
|
|
4
|
+
> **Scope:** Full architectural, functional, and operational comparison between the original [DEXBot](https://github.com/Codaone/DEXBot) (Python, v1.0.0) and DEXBot2 (TypeScript, v1.6.8).
|
|
5
5
|
> **Audience:** Developers, contributors, and operators evaluating or migrating between the two projects.
|
|
6
6
|
|
|
7
7
|
---
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
| Attribute | DEXBot (original) | DEXBot2 |
|
|
38
38
|
|---|---|---|
|
|
39
|
-
| **Release Track** | 1.0.0 | v1.6.
|
|
39
|
+
| **Release Track** | 1.0.0 | v1.6.8 |
|
|
40
40
|
| **Language** | Python 3.6+ | TypeScript 5.x |
|
|
41
41
|
| **Status** | Released 1.0.0, unmaintained | Active development |
|
|
42
42
|
| **Last Repo Activity** | May 23, 2020 | 2026-09-02 |
|
|
@@ -776,7 +776,7 @@ Where:
|
|
|
776
776
|
|
|
777
777
|
| Metric | DEXBot | DEXBot2 |
|
|
778
778
|
|---|---|---|
|
|
779
|
-
| **Release Track** | 1.0.0 | v1.6.
|
|
779
|
+
| **Release Track** | 1.0.0 | v1.6.8 |
|
|
780
780
|
| **Active Since** | ~2018 | December 2025 |
|
|
781
781
|
| **Last Commit** | May 23, 2020 | 2026-09-02 |
|
|
782
782
|
| **Total Commits** | 2281 | 2,125 (v1.4.25) |
|
|
@@ -882,7 +882,7 @@ The 500× figure is not theoretical: it materializes in production when higher o
|
|
|
882
882
|
| **Security** | ★★★☆☆ | ★★★★★ (AES-256-GCM, credential daemon, authority resolution) | DEXBot2 |
|
|
883
883
|
| **Ease of Setup** | ★★☆☆☆ (PyQt5/PyInstaller/Systemd dependency hell) | ★★★★★ (`npm i -g dexbot`, zero deps) | DEXBot2 |
|
|
884
884
|
| **Accessibility** | ★★★★★ (GUI) | ★★☆☆☆ (CLI only) | DEXBot |
|
|
885
|
-
| **Testing Depth** | ★★★☆☆ | ★★★★★ (
|
|
885
|
+
| **Testing Depth** | ★★★☆☆ | ★★★★★ (305 test files; focused regressions) | DEXBot2 |
|
|
886
886
|
| **Documentation** | ★★★☆☆ | ★★★★★ (architecture/accounting/security/adapter docs) | DEXBot2 |
|
|
887
887
|
| **Dependency Footprint** | ★★☆☆☆ (heavy) | ★★★★★ (0 runtime deps) | DEXBot2 |
|
|
888
888
|
| **Extensibility** | ★★★★★ (plugins) | ★☆☆☆☆ | DEXBot |
|