dexbot 1.4.20 → 1.4.22
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 +53 -0
- package/README.md +23 -13
- package/analysis/ama_fitting/analyze_ama_price_changes.ts +7 -3
- package/analysis/ama_fitting/analyze_lambda_vs_slow.ts +3 -3
- package/analysis/ama_fitting/calibrate_convergence_er.ts +8 -6
- package/analysis/ama_fitting/fetch_lp_candles.ts +8 -3
- package/analysis/ama_fitting/generate_unified_comparison_chart.ts +30 -67
- package/analysis/ama_fitting/optimizer_high_resolution.ts +22 -13
- package/analysis/ama_fitting/package.json +1 -1
- package/analysis/analyze_derivatives.ts +4 -4
- package/analysis/analyze_dynamic_weight.ts +21 -5
- package/analysis/analyze_kalman.ts +54 -25
- package/analysis/analyze_regime.ts +2 -2
- package/analysis/analyze_regime_windows.ts +27 -19
- package/analysis/analyze_risk_profile.ts +3 -3
- package/analysis/analyze_trade_heatmap.ts +3 -3
- package/analysis/analyze_volatility.ts +2 -2
- package/analysis/bot_fitting/README.md +93 -19
- package/analysis/bot_fitting/backtest_ama_sweep.ts +316 -199
- package/analysis/bot_fitting/backtest_bot_fitting.ts +520 -85
- package/analysis/bot_fitting/shared_utils.ts +16 -10
- package/analysis/bot_key_utils.ts +14 -11
- package/analysis/bot_usage/discover_bot_accounts.ts +5 -3
- package/analysis/bot_usage/kibana_bot_queries.ts +2 -257
- package/analysis/chart_css.ts +6 -4
- package/analysis/chart_ui.ts +0 -1
- package/analysis/chart_utils.ts +11 -2
- package/analysis/derivative_chart_generator.ts +2 -2
- package/analysis/math_utils.ts +1 -8
- package/analysis/price_sources.ts +8 -2
- package/analysis/resolve_source.ts +1 -1
- package/analysis/results/ama_sweep_results_lp_pool_133_1h.json +2455 -0
- package/analysis/results/bot_fitting_results_lp_pool_133_1h.json +218 -0
- package/analysis/trade_profitability.ts +61 -28
- package/analysis/tradingview/analyze_tradingview.ts +1 -1
- package/analysis/tradingview/h-bts_tradingview.html +1570 -0
- package/analysis/tradingview/t-bts_tradingview.html +1570 -0
- package/analysis/tradingview/tradingview_uplot_chart_generator.ts +302 -74
- package/analysis/trend_detection/DYNAMIC_WEIGHT_RESEARCH.md +1 -1
- package/analysis/trend_detection/derivative_analyzer.ts +12 -3
- package/analysis/trend_detection/dynamic_weight_chart_generator.ts +25 -27
- package/analysis/trend_detection/hurst_analyzer.ts +1 -1
- package/analysis/trend_detection/kalman_chart_generator.ts +42 -14
- package/analysis/trend_detection/package.json +1 -1
- package/analysis/trend_detection/regime_chart_generator.ts +39 -19
- package/analysis/trend_detection/tests/test_kalman_trend.ts +1 -1
- package/analysis/trend_detection/tests/test_kalman_velocity_smoothing.ts +1 -1
- package/analysis/trend_detection/volatility_chart_generator.ts +1 -1
- package/claw/ecosystem.config.cjs +2 -3
- package/claw/examples/memu_integration_example.ts +17 -17
- package/claw/index.ts +1 -1
- package/claw/modules/chain_actions.ts +51 -54
- package/claw/modules/chain_broadcast.ts +66 -104
- package/claw/modules/claw_bridge.ts +63 -83
- package/claw/modules/claw_catalog.ts +48 -17
- package/claw/modules/claw_infra.ts +1 -5
- package/claw/modules/claw_launcher.ts +48 -50
- package/claw/modules/claw_skill_md.ts +15 -21
- package/claw/modules/credit_runtime_adapter.ts +3 -19
- package/claw/modules/decision_loop.ts +9 -9
- package/claw/modules/dexbot_bridge.ts +8 -8
- package/claw/modules/dexbot_profiles.ts +5 -21
- package/claw/modules/feed_price_source.ts +1 -1
- package/claw/modules/honest_ecosystem.ts +24 -8
- package/claw/modules/kibana_price_source.ts +1 -1
- package/claw/modules/launcher_mode_detector.ts +1 -1
- package/claw/modules/launcher_paths.ts +1 -1
- package/claw/modules/liquidity_pools.ts +10 -3
- package/claw/modules/mcp_utils.ts +109 -0
- package/claw/modules/memu_bridge.ts +76 -54
- package/claw/modules/mpa_utils.ts +26 -3
- package/claw/modules/position_discovery.ts +17 -28
- package/claw/modules/position_health.ts +1 -1
- package/claw/modules/position_manager.ts +32 -41
- package/claw/modules/position_manager_watch.ts +3 -2
- package/claw/modules/short_mpa_strategy.ts +1 -9
- package/claw/modules/skill_utils.ts +5 -3
- package/claw/modules/utils.ts +9 -1
- package/claw/package.json +3 -3
- package/claw/runtimes/openclaw-plugin/index.ts +27 -10
- package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
- package/claw/runtimes/openclaw-plugin/package.json +1 -1
- package/claw/scripts/claw_bridge.ts +1 -1
- package/claw/scripts/claw_mcp_server.ts +19 -78
- package/claw/scripts/honest_assets_report.ts +19 -84
- package/claw/scripts/memu_mcp_server.ts +57 -155
- package/claw/skills/launcher-ops/references/launcher-workflow.md +2 -2
- package/claw/tests/package.json +1 -1
- package/claw/tests/test_claw_bridge.ts +47 -19
- package/claw/tests/test_claw_catalog_and_credentials.ts +8 -4
- package/claw/tests/test_claw_chain_layer.ts +39 -19
- package/claw/tests/test_claw_data_flow.ts +28 -20
- package/claw/tests/test_claw_domain_logic.ts +25 -19
- package/claw/tests/test_claw_manifest_and_matrix.ts +23 -3
- package/claw/tests/test_claw_mcp_transport.ts +13 -8
- package/claw/tests/test_claw_regressions.ts +254 -128
- package/claw/tests/test_claw_skill_generation.ts +1 -1
- package/claw/tests/test_nullclaw_tmp_integration.ts +2 -3
- package/claw/tests/test_position_health.ts +1 -77
- package/claw/tests/test_position_manager.ts +20 -18
- package/claw/tests/test_position_manager_watch_health.ts +39 -43
- package/claw/tests/test_short_mpa_strategy.ts +20 -17
- package/claw/tsconfig.json +4 -3
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.js +7 -3
- package/dist/analysis/ama_fitting/analyze_ama_price_changes.js.map +1 -1
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js +3 -3
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js.map +1 -1
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js +8 -6
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js.map +1 -1
- package/dist/analysis/ama_fitting/fetch_lp_candles.js +8 -3
- package/dist/analysis/ama_fitting/fetch_lp_candles.js.map +1 -1
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts +2 -2
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.d.ts.map +1 -1
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js +31 -75
- package/dist/analysis/ama_fitting/generate_unified_comparison_chart.js.map +1 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.d.ts.map +1 -1
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js +21 -13
- package/dist/analysis/ama_fitting/optimizer_high_resolution.js.map +1 -1
- package/dist/analysis/analyze_derivatives.d.ts +0 -18
- package/dist/analysis/analyze_derivatives.d.ts.map +1 -1
- package/dist/analysis/analyze_derivatives.js +4 -4
- package/dist/analysis/analyze_derivatives.js.map +1 -1
- package/dist/analysis/analyze_dynamic_weight.d.ts +0 -11
- package/dist/analysis/analyze_dynamic_weight.d.ts.map +1 -1
- package/dist/analysis/analyze_dynamic_weight.js +19 -5
- package/dist/analysis/analyze_dynamic_weight.js.map +1 -1
- package/dist/analysis/analyze_kalman.d.ts +0 -10
- package/dist/analysis/analyze_kalman.d.ts.map +1 -1
- package/dist/analysis/analyze_kalman.js +51 -26
- package/dist/analysis/analyze_kalman.js.map +1 -1
- package/dist/analysis/analyze_regime.d.ts +0 -17
- package/dist/analysis/analyze_regime.d.ts.map +1 -1
- package/dist/analysis/analyze_regime.js +2 -2
- package/dist/analysis/analyze_regime.js.map +1 -1
- package/dist/analysis/analyze_regime_windows.d.ts +0 -16
- package/dist/analysis/analyze_regime_windows.d.ts.map +1 -1
- package/dist/analysis/analyze_regime_windows.js +28 -21
- package/dist/analysis/analyze_regime_windows.js.map +1 -1
- package/dist/analysis/analyze_risk_profile.js +3 -3
- package/dist/analysis/analyze_risk_profile.js.map +1 -1
- package/dist/analysis/analyze_trade_heatmap.js +3 -3
- package/dist/analysis/analyze_trade_heatmap.js.map +1 -1
- package/dist/analysis/analyze_volatility.d.ts +0 -19
- package/dist/analysis/analyze_volatility.d.ts.map +1 -1
- package/dist/analysis/analyze_volatility.js +2 -2
- package/dist/analysis/analyze_volatility.js.map +1 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts +30 -14
- package/dist/analysis/bot_fitting/backtest_ama_sweep.d.ts.map +1 -1
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js +330 -193
- package/dist/analysis/bot_fitting/backtest_ama_sweep.js.map +1 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts +136 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.d.ts.map +1 -1
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js +527 -83
- package/dist/analysis/bot_fitting/backtest_bot_fitting.js.map +1 -1
- package/dist/analysis/bot_fitting/shared_utils.d.ts +2 -13
- package/dist/analysis/bot_fitting/shared_utils.d.ts.map +1 -1
- package/dist/analysis/bot_fitting/shared_utils.js +15 -9
- package/dist/analysis/bot_fitting/shared_utils.js.map +1 -1
- package/dist/analysis/bot_key_utils.d.ts +1 -1
- package/dist/analysis/bot_key_utils.d.ts.map +1 -1
- package/dist/analysis/bot_key_utils.js +14 -11
- package/dist/analysis/bot_key_utils.js.map +1 -1
- package/dist/analysis/bot_usage/discover_bot_accounts.js +5 -3
- package/dist/analysis/bot_usage/discover_bot_accounts.js.map +1 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts +1 -337
- package/dist/analysis/bot_usage/kibana_bot_queries.d.ts.map +1 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.js +2 -242
- package/dist/analysis/bot_usage/kibana_bot_queries.js.map +1 -1
- package/dist/analysis/chart_css.d.ts +2 -14
- package/dist/analysis/chart_css.d.ts.map +1 -1
- package/dist/analysis/chart_css.js +6 -3
- package/dist/analysis/chart_css.js.map +1 -1
- package/dist/analysis/chart_ui.d.ts.map +1 -1
- package/dist/analysis/chart_ui.js.map +1 -1
- package/dist/analysis/chart_utils.d.ts.map +1 -1
- package/dist/analysis/chart_utils.js +15 -2
- package/dist/analysis/chart_utils.js.map +1 -1
- package/dist/analysis/derivative_chart_generator.js +2 -2
- package/dist/analysis/derivative_chart_generator.js.map +1 -1
- package/dist/analysis/math_utils.d.ts +3 -5
- package/dist/analysis/math_utils.d.ts.map +1 -1
- package/dist/analysis/math_utils.js +3 -5
- package/dist/analysis/math_utils.js.map +1 -1
- package/dist/analysis/price_sources.d.ts +1 -0
- package/dist/analysis/price_sources.d.ts.map +1 -1
- package/dist/analysis/price_sources.js +8 -2
- package/dist/analysis/price_sources.js.map +1 -1
- package/dist/analysis/resolve_source.d.ts.map +1 -1
- package/dist/analysis/resolve_source.js +1 -1
- package/dist/analysis/resolve_source.js.map +1 -1
- package/dist/analysis/trade_profitability.d.ts.map +1 -1
- package/dist/analysis/trade_profitability.js +58 -29
- package/dist/analysis/trade_profitability.js.map +1 -1
- package/dist/analysis/tradingview/analyze_tradingview.js +1 -1
- package/dist/analysis/tradingview/analyze_tradingview.js.map +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.d.ts.map +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +302 -74
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js.map +1 -1
- package/dist/analysis/trend_detection/derivative_analyzer.d.ts +1 -0
- package/dist/analysis/trend_detection/derivative_analyzer.d.ts.map +1 -1
- package/dist/analysis/trend_detection/derivative_analyzer.js +12 -3
- package/dist/analysis/trend_detection/derivative_analyzer.js.map +1 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.d.ts.map +1 -1
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js +26 -27
- package/dist/analysis/trend_detection/dynamic_weight_chart_generator.js.map +1 -1
- package/dist/analysis/trend_detection/hurst_analyzer.d.ts +1 -1
- package/dist/analysis/trend_detection/hurst_analyzer.d.ts.map +1 -1
- package/dist/analysis/trend_detection/hurst_analyzer.js +1 -1
- package/dist/analysis/trend_detection/hurst_analyzer.js.map +1 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.d.ts.map +1 -1
- package/dist/analysis/trend_detection/kalman_chart_generator.js +41 -13
- package/dist/analysis/trend_detection/kalman_chart_generator.js.map +1 -1
- package/dist/analysis/trend_detection/regime_chart_generator.d.ts.map +1 -1
- package/dist/analysis/trend_detection/regime_chart_generator.js +38 -19
- package/dist/analysis/trend_detection/regime_chart_generator.js.map +1 -1
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js +1 -1
- package/dist/analysis/trend_detection/tests/test_kalman_trend.js.map +1 -1
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js +1 -1
- package/dist/analysis/trend_detection/tests/test_kalman_velocity_smoothing.js.map +1 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.js +1 -1
- package/dist/analysis/trend_detection/volatility_chart_generator.js.map +1 -1
- package/dist/bot.js +3 -3
- package/dist/bot.js.map +1 -1
- package/dist/credential-daemon.d.ts +1 -1
- package/dist/credential-daemon.js +2 -2
- package/dist/credential-daemon.js.map +1 -1
- package/dist/dexbot.d.ts.map +1 -1
- package/dist/dexbot.js +25 -22
- package/dist/dexbot.js.map +1 -1
- package/dist/market_adapter/ama_signal_runner.js +6 -4
- package/dist/market_adapter/ama_signal_runner.js.map +1 -1
- package/dist/market_adapter/candle_utils.d.ts +1 -3
- package/dist/market_adapter/candle_utils.d.ts.map +1 -1
- package/dist/market_adapter/candle_utils.js +1 -11
- package/dist/market_adapter/candle_utils.js.map +1 -1
- package/dist/market_adapter/core/asymmetric_bounds.d.ts.map +1 -1
- package/dist/market_adapter/core/asymmetric_bounds.js +33 -30
- package/dist/market_adapter/core/asymmetric_bounds.js.map +1 -1
- package/dist/market_adapter/core/config_normalizers.d.ts.map +1 -1
- package/dist/market_adapter/core/config_normalizers.js +10 -1
- package/dist/market_adapter/core/config_normalizers.js.map +1 -1
- package/dist/market_adapter/core/kibana_candles.d.ts +18 -42
- package/dist/market_adapter/core/kibana_candles.d.ts.map +1 -1
- package/dist/market_adapter/core/kibana_candles.js +101 -7
- package/dist/market_adapter/core/kibana_candles.js.map +1 -1
- package/dist/market_adapter/core/kibana_client.d.ts +1 -17
- package/dist/market_adapter/core/kibana_client.d.ts.map +1 -1
- package/dist/market_adapter/core/kibana_client.js +40 -7
- package/dist/market_adapter/core/kibana_client.js.map +1 -1
- package/dist/market_adapter/core/kibana_market_candles.d.ts +0 -27
- package/dist/market_adapter/core/kibana_market_candles.d.ts.map +1 -1
- package/dist/market_adapter/core/kibana_market_candles.js +1 -1
- package/dist/market_adapter/core/kibana_market_candles.js.map +1 -1
- package/dist/market_adapter/core/market_adapter_service.d.ts +22 -13
- package/dist/market_adapter/core/market_adapter_service.d.ts.map +1 -1
- package/dist/market_adapter/core/market_adapter_service.js +96 -38
- package/dist/market_adapter/core/market_adapter_service.js.map +1 -1
- package/dist/market_adapter/core/signals/hurst_analyzer.d.ts +10 -1
- package/dist/market_adapter/core/signals/hurst_analyzer.d.ts.map +1 -1
- package/dist/market_adapter/core/signals/hurst_analyzer.js +28 -17
- package/dist/market_adapter/core/signals/hurst_analyzer.js.map +1 -1
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.d.ts +5 -0
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.d.ts.map +1 -1
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.js +24 -24
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.js.map +1 -1
- package/dist/market_adapter/core/signals/kalman_velocity_smoothing.d.ts.map +1 -1
- package/dist/market_adapter/core/signals/kalman_velocity_smoothing.js +5 -1
- package/dist/market_adapter/core/signals/kalman_velocity_smoothing.js.map +1 -1
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.d.ts.map +1 -1
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js +20 -3
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js.map +1 -1
- package/dist/market_adapter/core/strategies/ama.js +1 -1
- package/dist/market_adapter/core/strategies/ama.js.map +1 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.d.ts +2 -2
- package/dist/market_adapter/core/strategies/ama_slope_model.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.js +16 -4
- package/dist/market_adapter/core/strategies/ama_slope_model.js.map +1 -1
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts +4 -3
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/atr/calculator.js +16 -8
- package/dist/market_adapter/core/strategies/atr/calculator.js.map +1 -1
- package/dist/market_adapter/core/strategies/collateral_manager.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/collateral_manager.js +8 -3
- package/dist/market_adapter/core/strategies/collateral_manager.js.map +1 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts +40 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.js +116 -2
- package/dist/market_adapter/core/strategies/dynamic_weight_series.js.map +1 -1
- package/dist/market_adapter/core/strategies/regime_gate.d.ts +1 -2
- package/dist/market_adapter/core/strategies/regime_gate.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/regime_gate.js +27 -21
- package/dist/market_adapter/core/strategies/regime_gate.js.map +1 -1
- package/dist/market_adapter/core/strategies/volatility_shift.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/volatility_shift.js +3 -0
- package/dist/market_adapter/core/strategies/volatility_shift.js.map +1 -1
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +71 -57
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts +0 -26
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js +72 -19
- package/dist/market_adapter/inputs/fetch_lp_data.js.map +1 -1
- package/dist/market_adapter/inputs/kibana_source.d.ts +5 -30
- package/dist/market_adapter/inputs/kibana_source.d.ts.map +1 -1
- package/dist/market_adapter/inputs/kibana_source.js +6 -3
- package/dist/market_adapter/inputs/kibana_source.js.map +1 -1
- package/dist/market_adapter/lp_chart_core.js +1 -1
- package/dist/market_adapter/lp_chart_core.js.map +1 -1
- package/dist/market_adapter/lp_chart_runner.d.ts +10 -1
- package/dist/market_adapter/lp_chart_runner.d.ts.map +1 -1
- package/dist/market_adapter/lp_chart_runner.js +2 -2
- package/dist/market_adapter/lp_chart_runner.js.map +1 -1
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts +1 -2
- package/dist/market_adapter/lp_chart_strategy_loader.d.ts.map +1 -1
- package/dist/market_adapter/lp_chart_strategy_loader.js +5 -5
- package/dist/market_adapter/lp_chart_strategy_loader.js.map +1 -1
- package/dist/market_adapter/market_adapter.d.ts +1 -2
- package/dist/market_adapter/market_adapter.d.ts.map +1 -1
- package/dist/market_adapter/market_adapter.js +5 -7
- package/dist/market_adapter/market_adapter.js.map +1 -1
- package/dist/market_adapter/test_helpers.d.ts +3 -3
- package/dist/market_adapter/test_helpers.d.ts.map +1 -1
- package/dist/market_adapter/test_helpers.js +3 -3
- package/dist/market_adapter/test_helpers.js.map +1 -1
- package/dist/market_adapter/utils/adapter_client.js +1 -1
- package/dist/market_adapter/utils/adapter_client.js.map +1 -1
- package/dist/market_adapter/utils/atomic_write.js +1 -1
- package/dist/market_adapter/utils/atomic_write.js.map +1 -1
- package/dist/market_adapter/utils/chain.d.ts +0 -2
- package/dist/market_adapter/utils/chain.d.ts.map +1 -1
- package/dist/market_adapter/utils/chain.js +2 -3
- package/dist/market_adapter/utils/chain.js.map +1 -1
- package/dist/market_adapter/utils/data_discovery.d.ts.map +1 -1
- package/dist/market_adapter/utils/data_discovery.js +24 -8
- package/dist/market_adapter/utils/data_discovery.js.map +1 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +1 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js +2 -5
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +1 -1
- package/dist/market_adapter/utils/file_lock.d.ts +4 -1
- package/dist/market_adapter/utils/file_lock.d.ts.map +1 -1
- package/dist/market_adapter/utils/file_lock.js +89 -25
- package/dist/market_adapter/utils/file_lock.js.map +1 -1
- package/dist/market_adapter/utils/native_history.d.ts.map +1 -1
- package/dist/market_adapter/utils/native_history.js +5 -1
- package/dist/market_adapter/utils/native_history.js.map +1 -1
- package/dist/modules/account_bots.d.ts +3 -0
- package/dist/modules/account_bots.d.ts.map +1 -1
- package/dist/modules/account_bots.js +157 -47
- package/dist/modules/account_bots.js.map +1 -1
- package/dist/modules/account_orders.d.ts +1 -7
- package/dist/modules/account_orders.d.ts.map +1 -1
- package/dist/modules/account_orders.js +9 -17
- package/dist/modules/account_orders.js.map +1 -1
- package/dist/modules/authority_resolver.js +1 -1
- package/dist/modules/authority_resolver.js.map +1 -1
- package/dist/modules/bitshares-native/chain_client.js +1 -1
- package/dist/modules/bitshares-native/chain_client.js.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts +0 -12
- package/dist/modules/bitshares-native/crypto/ecc.browser.d.ts.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.js +1 -1
- package/dist/modules/bitshares-native/crypto/ecc.browser.js.map +1 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.js +1 -1
- package/dist/modules/bitshares-native/crypto/ecc_selector.js.map +1 -1
- package/dist/modules/bitshares-native/index.d.ts.map +1 -1
- package/dist/modules/bitshares-native/index.js +1 -1
- package/dist/modules/bitshares-native/index.js.map +1 -1
- package/dist/modules/bitshares-native/lru_cache.js +1 -1
- package/dist/modules/bitshares-native/lru_cache.js.map +1 -1
- package/dist/modules/bitshares-native/resolvers.d.ts +0 -2
- package/dist/modules/bitshares-native/resolvers.d.ts.map +1 -1
- package/dist/modules/bitshares-native/resolvers.js +18 -4
- package/dist/modules/bitshares-native/resolvers.js.map +1 -1
- package/dist/modules/bitshares-native/serial/chain_constants.js +1 -1
- package/dist/modules/bitshares-native/serial/chain_constants.js.map +1 -1
- package/dist/modules/bitshares-native/serial/index.d.ts.map +1 -1
- package/dist/modules/bitshares-native/serial/index.js +1 -1
- package/dist/modules/bitshares-native/serial/index.js.map +1 -1
- package/dist/modules/bitshares-native/serial/operations.js +1 -1
- package/dist/modules/bitshares-native/serial/operations.js.map +1 -1
- package/dist/modules/bitshares-native/serial/serializer.js +1 -1
- package/dist/modules/bitshares-native/serial/serializer.js.map +1 -1
- package/dist/modules/bitshares-native/serial/types.js +1 -1
- package/dist/modules/bitshares-native/serial/types.js.map +1 -1
- package/dist/modules/bitshares-native/signing_client.js +2 -2
- package/dist/modules/bitshares-native/signing_client.js.map +1 -1
- package/dist/modules/bitshares-native/subscriptions.d.ts.map +1 -1
- package/dist/modules/bitshares-native/subscriptions.js +5 -14
- package/dist/modules/bitshares-native/subscriptions.js.map +1 -1
- package/dist/modules/bitshares-native/transport.js +1 -1
- package/dist/modules/bitshares-native/transport.js.map +1 -1
- package/dist/modules/bitshares-native/tx/builder.js +1 -1
- package/dist/modules/bitshares-native/tx/builder.js.map +1 -1
- package/dist/modules/bitshares-native/tx/tx_cache.d.ts +3 -2
- package/dist/modules/bitshares-native/tx/tx_cache.d.ts.map +1 -1
- package/dist/modules/bitshares-native/tx/tx_cache.js +7 -4
- package/dist/modules/bitshares-native/tx/tx_cache.js.map +1 -1
- package/dist/modules/bitshares_client.d.ts +2 -14
- package/dist/modules/bitshares_client.d.ts.map +1 -1
- package/dist/modules/bitshares_client.js +32 -41
- package/dist/modules/bitshares_client.js.map +1 -1
- package/dist/modules/bot_settings.d.ts.map +1 -1
- package/dist/modules/bot_settings.js +12 -19
- package/dist/modules/bot_settings.js.map +1 -1
- package/dist/modules/bots_file_lock.d.ts +1 -1
- package/dist/modules/bots_file_lock.js +1 -1
- package/dist/modules/broadcast_failure.d.ts +13 -0
- package/dist/modules/broadcast_failure.d.ts.map +1 -1
- package/dist/modules/broadcast_failure.js +0 -13
- package/dist/modules/broadcast_failure.js.map +1 -1
- package/dist/modules/chain_keys.js +2 -2
- package/dist/modules/chain_keys.js.map +1 -1
- package/dist/modules/chain_orders.d.ts +2 -3
- package/dist/modules/chain_orders.d.ts.map +1 -1
- package/dist/modules/chain_orders.js +23 -42
- package/dist/modules/chain_orders.js.map +1 -1
- package/dist/modules/config.d.ts.map +1 -1
- package/dist/modules/config.js +5 -2
- package/dist/modules/config.js.map +1 -1
- package/dist/modules/constants.d.ts +21 -21
- package/dist/modules/constants.d.ts.map +1 -1
- package/dist/modules/constants.js +53 -60
- package/dist/modules/constants.js.map +1 -1
- package/dist/modules/cr_planner.d.ts +1 -7
- package/dist/modules/cr_planner.d.ts.map +1 -1
- package/dist/modules/cr_planner.js +3 -77
- package/dist/modules/cr_planner.js.map +1 -1
- package/dist/modules/credential_policy.d.ts +0 -4
- package/dist/modules/credential_policy.d.ts.map +1 -1
- package/dist/modules/credential_policy.js +18 -3
- package/dist/modules/credential_policy.js.map +1 -1
- package/dist/modules/credit_runtime.d.ts +0 -7
- package/dist/modules/credit_runtime.d.ts.map +1 -1
- package/dist/modules/credit_runtime.js +21 -60
- package/dist/modules/credit_runtime.js.map +1 -1
- package/dist/modules/crypto/index.d.ts +0 -2
- package/dist/modules/crypto/index.d.ts.map +1 -1
- package/dist/modules/crypto/index.js +0 -2
- package/dist/modules/crypto/index.js.map +1 -1
- package/dist/modules/crypto/sync.js.map +1 -1
- package/dist/modules/daemon_node_health.js +1 -1
- package/dist/modules/daemon_node_health.js.map +1 -1
- package/dist/modules/dexbot_class.d.ts +8 -134
- package/dist/modules/dexbot_class.d.ts.map +1 -1
- package/dist/modules/dexbot_class.js +39 -199
- package/dist/modules/dexbot_class.js.map +1 -1
- package/dist/modules/dexbot_credential_client.js +1 -1
- package/dist/modules/dexbot_credential_client.js.map +1 -1
- package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_fill_runtime.js +3 -6
- package/dist/modules/dexbot_fill_runtime.js.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.d.ts +6 -34
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.js +27 -19
- package/dist/modules/dexbot_maintenance_runtime.js.map +1 -1
- package/dist/modules/dexbot_startup_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_startup_runtime.js +31 -15
- package/dist/modules/dexbot_startup_runtime.js.map +1 -1
- package/dist/modules/dexbot_state_recovery.d.ts +2 -2
- package/dist/modules/dexbot_state_recovery.d.ts.map +1 -1
- package/dist/modules/dexbot_state_recovery.js +11 -7
- package/dist/modules/dexbot_state_recovery.js.map +1 -1
- package/dist/modules/fund_registry.d.ts.map +1 -1
- package/dist/modules/fund_registry.js +24 -6
- package/dist/modules/fund_registry.js.map +1 -1
- package/dist/modules/general_settings.d.ts +1 -2
- package/dist/modules/general_settings.d.ts.map +1 -1
- package/dist/modules/general_settings.js +1 -2
- package/dist/modules/general_settings.js.map +1 -1
- package/dist/modules/graceful_shutdown.d.ts.map +1 -1
- package/dist/modules/graceful_shutdown.js +10 -1
- package/dist/modules/graceful_shutdown.js.map +1 -1
- package/dist/modules/grid_price_source.d.ts +19 -0
- package/dist/modules/grid_price_source.d.ts.map +1 -0
- package/dist/modules/grid_price_source.js +23 -0
- package/dist/modules/grid_price_source.js.map +1 -0
- package/dist/modules/key_store.d.ts +0 -5
- package/dist/modules/key_store.d.ts.map +1 -1
- package/dist/modules/key_store.js +1 -14
- package/dist/modules/key_store.js.map +1 -1
- package/dist/modules/launcher/bot_supervisor.d.ts.map +1 -1
- package/dist/modules/launcher/bot_supervisor.js +15 -26
- package/dist/modules/launcher/bot_supervisor.js.map +1 -1
- package/dist/modules/launcher/child_env.d.ts +1 -2
- package/dist/modules/launcher/child_env.d.ts.map +1 -1
- package/dist/modules/launcher/child_env.js +1 -1
- package/dist/modules/launcher/child_env.js.map +1 -1
- package/dist/modules/launcher/foreign_cred_daemon.d.ts.map +1 -1
- package/dist/modules/launcher/foreign_cred_daemon.js +7 -13
- package/dist/modules/launcher/foreign_cred_daemon.js.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.d.ts +3 -4
- package/dist/modules/launcher/market_adapter_runtime.d.ts.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.js +10 -29
- package/dist/modules/launcher/market_adapter_runtime.js.map +1 -1
- package/dist/modules/launcher/market_adapter_watchdog.d.ts.map +1 -1
- package/dist/modules/launcher/market_adapter_watchdog.js +3 -2
- package/dist/modules/launcher/market_adapter_watchdog.js.map +1 -1
- package/dist/modules/launcher/monolithic_runtime.d.ts +0 -1
- package/dist/modules/launcher/monolithic_runtime.d.ts.map +1 -1
- package/dist/modules/launcher/monolithic_runtime.js +4 -18
- package/dist/modules/launcher/monolithic_runtime.js.map +1 -1
- package/dist/modules/launcher/runtime_entry.d.ts.map +1 -1
- package/dist/modules/launcher/runtime_entry.js +4 -5
- package/dist/modules/launcher/runtime_entry.js.map +1 -1
- package/dist/modules/launcher/status_reporting.d.ts +1 -2
- package/dist/modules/launcher/status_reporting.d.ts.map +1 -1
- package/dist/modules/launcher/status_reporting.js +2 -5
- package/dist/modules/launcher/status_reporting.js.map +1 -1
- package/dist/modules/launcher/supervisor_control.js +1 -1
- package/dist/modules/launcher/supervisor_control.js.map +1 -1
- package/dist/modules/market_adapter_whitelist.d.ts +2 -2
- package/dist/modules/market_adapter_whitelist.d.ts.map +1 -1
- package/dist/modules/market_adapter_whitelist.js +12 -6
- package/dist/modules/market_adapter_whitelist.js.map +1 -1
- package/dist/modules/node_failure_ledger.d.ts +23 -0
- package/dist/modules/node_failure_ledger.d.ts.map +1 -1
- package/dist/modules/node_failure_ledger.js +0 -23
- package/dist/modules/node_failure_ledger.js.map +1 -1
- package/dist/modules/node_manager.d.ts.map +1 -1
- package/dist/modules/node_manager.js +3 -3
- package/dist/modules/node_manager.js.map +1 -1
- package/dist/modules/order/accounting.js +3 -3
- package/dist/modules/order/accounting.js.map +1 -1
- package/dist/modules/order/async_lock.d.ts +6 -0
- package/dist/modules/order/async_lock.d.ts.map +1 -1
- package/dist/modules/order/async_lock.js +11 -0
- package/dist/modules/order/async_lock.js.map +1 -1
- package/dist/modules/order/export.d.ts +1 -1
- package/dist/modules/order/export.js +10 -10
- package/dist/modules/order/export.js.map +1 -1
- package/dist/modules/order/format.d.ts +1 -8
- package/dist/modules/order/format.d.ts.map +1 -1
- package/dist/modules/order/format.js +0 -14
- package/dist/modules/order/format.js.map +1 -1
- package/dist/modules/order/grid.d.ts +2 -12
- package/dist/modules/order/grid.d.ts.map +1 -1
- package/dist/modules/order/grid.js +23 -24
- package/dist/modules/order/grid.js.map +1 -1
- package/dist/modules/order/grid_reconcile.d.ts +1 -1
- package/dist/modules/order/grid_reconcile.js +1 -1
- package/dist/modules/order/grid_reconcile_internal.js +1 -1
- package/dist/modules/order/grid_reconcile_internal.js.map +1 -1
- package/dist/modules/order/logger.d.ts +3 -0
- package/dist/modules/order/logger.d.ts.map +1 -1
- package/dist/modules/order/logger.js +23 -14
- package/dist/modules/order/logger.js.map +1 -1
- package/dist/modules/order/logger_state.d.ts +5 -22
- package/dist/modules/order/logger_state.d.ts.map +1 -1
- package/dist/modules/order/logger_state.js +6 -25
- package/dist/modules/order/logger_state.js.map +1 -1
- package/dist/modules/order/manager.d.ts +1 -4
- package/dist/modules/order/manager.d.ts.map +1 -1
- package/dist/modules/order/manager.js +34 -33
- package/dist/modules/order/manager.js.map +1 -1
- package/dist/modules/order/processed_fill_store.d.ts +0 -5
- package/dist/modules/order/processed_fill_store.d.ts.map +1 -1
- package/dist/modules/order/processed_fill_store.js +10 -15
- package/dist/modules/order/processed_fill_store.js.map +1 -1
- package/dist/modules/order/strategy.d.ts +6 -4
- package/dist/modules/order/strategy.d.ts.map +1 -1
- package/dist/modules/order/strategy.js +6 -4
- package/dist/modules/order/strategy.js.map +1 -1
- package/dist/modules/order/sync_engine.d.ts.map +1 -1
- package/dist/modules/order/sync_engine.js +17 -10
- package/dist/modules/order/sync_engine.js.map +1 -1
- package/dist/modules/order/utils/math.d.ts +7 -1
- package/dist/modules/order/utils/math.d.ts.map +1 -1
- package/dist/modules/order/utils/math.js +19 -1
- package/dist/modules/order/utils/math.js.map +1 -1
- package/dist/modules/order/utils/order.d.ts.map +1 -1
- package/dist/modules/order/utils/order.js +11 -4
- package/dist/modules/order/utils/order.js.map +1 -1
- package/dist/modules/order/utils/system.d.ts +3 -8
- package/dist/modules/order/utils/system.d.ts.map +1 -1
- package/dist/modules/order/utils/system.js +14 -4
- package/dist/modules/order/utils/system.js.map +1 -1
- package/dist/modules/order/utils/validate.js +1 -1
- package/dist/modules/order/utils/validate.js.map +1 -1
- package/dist/modules/path_api.js +1 -1
- package/dist/modules/path_api.js.map +1 -1
- package/dist/modules/paths.d.ts +1 -7
- package/dist/modules/paths.d.ts.map +1 -1
- package/dist/modules/paths.js +1 -1
- package/dist/modules/paths.js.map +1 -1
- package/dist/modules/process_discovery.d.ts +3 -0
- package/dist/modules/process_discovery.d.ts.map +1 -1
- package/dist/modules/process_discovery.js +15 -1
- package/dist/modules/process_discovery.js.map +1 -1
- package/dist/modules/runtime_settings.js +4 -2
- package/dist/modules/runtime_settings.js.map +1 -1
- package/dist/modules/settings_merge.d.ts +5 -1
- package/dist/modules/settings_merge.d.ts.map +1 -1
- package/dist/modules/settings_merge.js +17 -4
- package/dist/modules/settings_merge.js.map +1 -1
- package/dist/modules/socket_json_client.d.ts.map +1 -1
- package/dist/modules/socket_json_client.js +12 -2
- package/dist/modules/socket_json_client.js.map +1 -1
- package/dist/modules/storage/browser_adapter.d.ts +8 -3
- package/dist/modules/storage/browser_adapter.d.ts.map +1 -1
- package/dist/modules/storage/browser_adapter.js +58 -7
- package/dist/modules/storage/browser_adapter.js.map +1 -1
- package/dist/modules/storage/index.d.ts +1 -1
- package/dist/modules/storage/index.js +1 -1
- package/dist/modules/types.d.ts +1 -1
- package/dist/modules/types.d.ts.map +1 -1
- package/dist/modules/utils/sanitize_key.d.ts +7 -0
- package/dist/modules/utils/sanitize_key.d.ts.map +1 -0
- package/dist/modules/utils/sanitize_key.js +15 -0
- package/dist/modules/utils/sanitize_key.js.map +1 -0
- package/dist/modules/validate_profiles.d.ts.map +1 -1
- package/dist/modules/validate_profiles.js +6 -8
- package/dist/modules/validate_profiles.js.map +1 -1
- package/dist/pm2.d.ts.map +1 -1
- package/dist/pm2.js +8 -9
- package/dist/pm2.js.map +1 -1
- package/dist/scripts/analyze-git.d.ts +1 -1
- package/dist/scripts/analyze-git.js +1 -1
- package/dist/scripts/analyze-orders.d.ts +2 -2
- package/dist/scripts/analyze-orders.d.ts.map +1 -1
- package/dist/scripts/analyze-orders.js +39 -28
- package/dist/scripts/analyze-orders.js.map +1 -1
- package/dist/scripts/diagnose-pool-history.js +1 -1
- package/dist/scripts/divergence-calc.d.ts +1 -1
- package/dist/scripts/divergence-calc.js +3 -3
- package/dist/scripts/native_release_gates.js +4 -2
- package/dist/scripts/native_release_gates.js.map +1 -1
- package/dist/scripts/print_grid.d.ts +1 -1
- package/dist/scripts/print_grid.js +1 -1
- package/dist/scripts/run-tests.js +38 -19
- package/dist/scripts/run-tests.js.map +1 -1
- package/dist/scripts/runner.d.ts +3 -5
- package/dist/scripts/runner.d.ts.map +1 -1
- package/dist/scripts/runner.js +4 -6
- package/dist/scripts/runner.js.map +1 -1
- package/dist/scripts/sync-version.d.ts +2 -2
- package/dist/scripts/sync-version.js +2 -2
- package/dist/scripts/update.d.ts +1 -1
- package/dist/scripts/update.js +2 -2
- package/dist/scripts/update.js.map +1 -1
- package/dist/scripts/validate_bots.d.ts +1 -1
- package/dist/scripts/validate_bots.js +1 -1
- package/dist/scripts/verify-browser-bundle.d.ts +1 -1
- package/dist/scripts/verify-browser-bundle.js +1 -1
- package/dist/unlock.js +4 -4
- package/dist/unlock.js.map +1 -1
- package/docs/BITSHARES_ONBOARDING.md +63 -18
- package/docs/COPY_ON_WRITE_MASTER_PLAN.md +14 -23
- package/docs/COW_INVARIANTS.md +4 -4
- package/docs/CREDENTIAL_SECURITY.md +0 -11
- package/docs/DEXBOT_COMPARISON.md +12 -12
- package/docs/EVOLUTION.md +17 -43
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +27 -83
- package/docs/GRID_RECALCULATION.md +1 -13
- package/docs/GRID_RECONCILE.md +24 -24
- package/docs/LIFECYCLE.md +4 -4
- package/docs/LOGGING.md +1 -1
- package/docs/MPA_CREDIT_USAGE.md +3 -3
- package/docs/README.md +2 -2
- package/docs/WORKFLOW.md +2 -2
- package/docs/architecture.md +48 -43
- package/docs/developer_guide.md +22 -24
- package/market_adapter/README.md +0 -2
- package/modules/README.md +2 -1
- package/package.json +22 -14
- package/scripts/README.md +34 -8
- package/scripts/clean-dist.js +10 -2
- package/tests/README.md +4 -3
- package/claw/openclaw.plugin.json +0 -13
- package/dist/market_adapter/merge_lp_data.d.ts +0 -3
- package/dist/market_adapter/merge_lp_data.d.ts.map +0 -1
- package/dist/market_adapter/merge_lp_data.js +0 -125
- package/dist/market_adapter/merge_lp_data.js.map +0 -1
- package/dist/market_adapter/utils/paths.d.ts +0 -3
- package/dist/market_adapter/utils/paths.d.ts.map +0 -1
- package/dist/market_adapter/utils/paths.js +0 -5
- package/dist/market_adapter/utils/paths.js.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use strict';
|
|
1
2
|
|
|
2
3
|
import { createRequire } from 'node:module';
|
|
3
4
|
const require = createRequire(import.meta.url);
|
|
@@ -8,7 +9,6 @@ import { loadSettingsFile, resolveRawBotEntries, saveSettingsFile, normalizeBotE
|
|
|
8
9
|
import { normalizeMode, detectMode, setPreferredMode, describeModeChoice } from './launcher_mode_detector.js';
|
|
9
10
|
import { normalizeRoot, resolveRuntimeScript, normalizeProfileDir } from './launcher_paths.js';
|
|
10
11
|
import { getErrorMessage } from '../../modules/utils/errors.js';
|
|
11
|
-
'use strict';
|
|
12
12
|
|
|
13
13
|
const storage = getStorage();
|
|
14
14
|
|
|
@@ -56,6 +56,40 @@ function getSpawn(): any {
|
|
|
56
56
|
return _spawn;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Spawn a detached background child and wait for the spawn itself to succeed.
|
|
61
|
+
* Spawn failures (missing script, ENOENT, EACCES) are reported asynchronously
|
|
62
|
+
* via the child's 'error' event; waiting one macrotask lets those surface as a
|
|
63
|
+
* thrown error instead of callers receiving a false { started: true } result.
|
|
64
|
+
* A permanent 'error' handler remains attached so late errors are logged
|
|
65
|
+
* rather than crashing the host with an unhandled 'error' event.
|
|
66
|
+
*/
|
|
67
|
+
function spawnDetached(scriptPath: string, args: string[], cwd: string): Promise<any> {
|
|
68
|
+
const child = getSpawn()('node', [scriptPath, ...args], {
|
|
69
|
+
detached: true,
|
|
70
|
+
stdio: 'ignore',
|
|
71
|
+
cwd
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return new Promise((resolve, reject) => {
|
|
75
|
+
let settled = false;
|
|
76
|
+
child.on('error', (err: any) => {
|
|
77
|
+
if (!settled) {
|
|
78
|
+
settled = true;
|
|
79
|
+
reject(new Error(`Failed to spawn ${scriptPath}: ${getErrorMessage(err)}`));
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
console.error(`[LAUNCHER] Child process error (${scriptPath}): ${getErrorMessage(err)}`);
|
|
83
|
+
});
|
|
84
|
+
setImmediate(() => {
|
|
85
|
+
if (!settled) {
|
|
86
|
+
settled = true;
|
|
87
|
+
resolve(child);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
59
93
|
let _pm2: any;
|
|
60
94
|
function getPM2Module(): any {
|
|
61
95
|
if (_pm2 === undefined) {
|
|
@@ -88,16 +122,7 @@ async function launcherStart(botName: string | null, options: Record<string, any
|
|
|
88
122
|
args.push(botName);
|
|
89
123
|
}
|
|
90
124
|
|
|
91
|
-
const child =
|
|
92
|
-
detached: true,
|
|
93
|
-
stdio: 'ignore',
|
|
94
|
-
cwd: ROOT
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
child.on('error', (err: any) => {
|
|
98
|
-
console.error(`[LAUNCHER] Failed to spawn ${dexbotPath}: ${getErrorMessage(err)}`);
|
|
99
|
-
});
|
|
100
|
-
|
|
125
|
+
const child = await spawnDetached(dexbotPath, args, ROOT);
|
|
101
126
|
child.unref();
|
|
102
127
|
|
|
103
128
|
return {
|
|
@@ -124,16 +149,7 @@ async function launcherDrystart(botName: string | null, options: Record<string,
|
|
|
124
149
|
args.push(botName);
|
|
125
150
|
}
|
|
126
151
|
|
|
127
|
-
const child =
|
|
128
|
-
detached: true,
|
|
129
|
-
stdio: 'ignore',
|
|
130
|
-
cwd: ROOT
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
child.on('error', (err: any) => {
|
|
134
|
-
console.error(`[LAUNCHER] Failed to spawn ${dexbotPath}: ${getErrorMessage(err)}`);
|
|
135
|
-
});
|
|
136
|
-
|
|
152
|
+
const child = await spawnDetached(dexbotPath, args, ROOT);
|
|
137
153
|
child.unref();
|
|
138
154
|
|
|
139
155
|
return {
|
|
@@ -158,10 +174,10 @@ async function launcherReset(botName: string | null, options: Record<string, any
|
|
|
158
174
|
const { config } = loadSettingsFile(PROFILES_BOTS_FILE);
|
|
159
175
|
const entries = normalizeBotEntries(resolveRawBotEntries(config));
|
|
160
176
|
|
|
161
|
-
const targets = botName ? entries.filter((b: any) => b.name === botName) : entries.filter((b: any) => b.active);
|
|
177
|
+
const targets = botName ? entries.filter((b: any) => b.name === botName) : entries.filter((b: any) => b.active !== false);
|
|
162
178
|
|
|
163
179
|
if (botName && targets.length === 0) {
|
|
164
|
-
throw new Error(`Bot '${botName}' not found in
|
|
180
|
+
throw new Error(`Bot '${botName}' not found in ${PROFILES_BOTS_FILE}`);
|
|
165
181
|
}
|
|
166
182
|
|
|
167
183
|
const triggered: Array<Record<string, any>> = [];
|
|
@@ -221,7 +237,7 @@ async function launcherDisable(botName: string | null, options: Record<string, a
|
|
|
221
237
|
|
|
222
238
|
const match = entries.find((b: any) => b.name === botName);
|
|
223
239
|
if (!match) {
|
|
224
|
-
throw new Error(`Bot '${botName}' not found in
|
|
240
|
+
throw new Error(`Bot '${botName}' not found in ${PROFILES_BOTS_FILE}`);
|
|
225
241
|
}
|
|
226
242
|
|
|
227
243
|
if (match.active === false) {
|
|
@@ -252,10 +268,10 @@ async function launcherPm2Start(botName: string | null, options: Record<string,
|
|
|
252
268
|
const { config } = loadSettingsFile(PROFILES_BOTS_FILE);
|
|
253
269
|
const entries = normalizeBotEntries(resolveRawBotEntries(config));
|
|
254
270
|
|
|
255
|
-
const targets = botName ? entries.filter((b: any) => b.name === botName) : entries.filter((b: any) => b.active);
|
|
271
|
+
const targets = botName ? entries.filter((b: any) => b.name === botName) : entries.filter((b: any) => b.active !== false);
|
|
256
272
|
|
|
257
273
|
if (botName && targets.length === 0) {
|
|
258
|
-
throw new Error(`Bot '${botName}' not found or not active in
|
|
274
|
+
throw new Error(`Bot '${botName}' not found or not active in ${PROFILES_BOTS_FILE}`);
|
|
259
275
|
}
|
|
260
276
|
|
|
261
277
|
// Then check if daemon is ready
|
|
@@ -292,7 +308,7 @@ async function launcherPm2Start(botName: string | null, options: Record<string,
|
|
|
292
308
|
* @param {Object} [options={}] - Options
|
|
293
309
|
* @returns {Promise<Object>} { stopped: true, target }
|
|
294
310
|
*/
|
|
295
|
-
async function launcherPm2Stop(target: string,
|
|
311
|
+
async function launcherPm2Stop(target: string, _options: Record<string, any> = {}) {
|
|
296
312
|
await getPM2Module().stopPM2Processes(target || 'all');
|
|
297
313
|
return {
|
|
298
314
|
stopped: true,
|
|
@@ -306,7 +322,7 @@ async function launcherPm2Stop(target: string, options: Record<string, any> = {}
|
|
|
306
322
|
* @param {Object} [options={}] - Options
|
|
307
323
|
* @returns {Promise<Object>} { deleted: true, target }
|
|
308
324
|
*/
|
|
309
|
-
async function launcherPm2Delete(target: string,
|
|
325
|
+
async function launcherPm2Delete(target: string, _options: Record<string, any> = {}) {
|
|
310
326
|
await getPM2Module().deletePM2Processes(target || 'all');
|
|
311
327
|
return {
|
|
312
328
|
deleted: true,
|
|
@@ -320,7 +336,7 @@ async function launcherPm2Delete(target: string, options: Record<string, any> =
|
|
|
320
336
|
* @param {Object} [options={}] - Options
|
|
321
337
|
* @returns {Promise<Object>} { restarted: true, target }
|
|
322
338
|
*/
|
|
323
|
-
async function launcherPm2Restart(target: string,
|
|
339
|
+
async function launcherPm2Restart(target: string, _options: Record<string, any> = {}) {
|
|
324
340
|
await getPM2Module().restartPM2Processes(target || 'all');
|
|
325
341
|
return {
|
|
326
342
|
restarted: true,
|
|
@@ -422,16 +438,7 @@ async function launcherClawOnly(options: Record<string, any> = {}) {
|
|
|
422
438
|
const ROOT = normalizeRoot(options);
|
|
423
439
|
const pm2ScriptPath = resolveRuntimeScript(ROOT, 'pm2.js');
|
|
424
440
|
|
|
425
|
-
const child =
|
|
426
|
-
detached: true,
|
|
427
|
-
stdio: 'ignore',
|
|
428
|
-
cwd: ROOT
|
|
429
|
-
});
|
|
430
|
-
|
|
431
|
-
child.on('error', (err: any) => {
|
|
432
|
-
console.error(`[LAUNCHER] Failed to spawn ${pm2ScriptPath}: ${getErrorMessage(err)}`);
|
|
433
|
-
});
|
|
434
|
-
|
|
441
|
+
const child = await spawnDetached(pm2ScriptPath, ['claw-only'], ROOT);
|
|
435
442
|
child.unref();
|
|
436
443
|
|
|
437
444
|
return {
|
|
@@ -459,16 +466,7 @@ async function launcherUnlockStart(botName: string | null, options: Record<strin
|
|
|
459
466
|
args.push(botName);
|
|
460
467
|
}
|
|
461
468
|
|
|
462
|
-
const child =
|
|
463
|
-
detached: true,
|
|
464
|
-
stdio: 'ignore',
|
|
465
|
-
cwd: ROOT
|
|
466
|
-
});
|
|
467
|
-
|
|
468
|
-
child.on('error', (err: any) => {
|
|
469
|
-
console.error(`[LAUNCHER] Failed to spawn ${unlockPath}: ${getErrorMessage(err)}`);
|
|
470
|
-
});
|
|
471
|
-
|
|
469
|
+
const child = await spawnDetached(unlockPath, args, ROOT);
|
|
472
470
|
child.unref();
|
|
473
471
|
|
|
474
472
|
return {
|
|
@@ -481,5 +479,5 @@ async function launcherUnlockStart(botName: string | null, options: Record<strin
|
|
|
481
479
|
};
|
|
482
480
|
}
|
|
483
481
|
|
|
484
|
-
export { launcherRun,
|
|
482
|
+
export { launcherRun, launcherDrystart, launcherReset, launcherDisable, launcherPm2Start, launcherPm2Stop, launcherPm2Delete, launcherPm2Restart }
|
|
485
483
|
|
|
@@ -12,14 +12,11 @@ function normalizeClawRepoRoot(repoRoot: string) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
// Generated docs must reference scripts that actually exist. Claw tooling
|
|
15
|
-
//
|
|
16
|
-
//
|
|
15
|
+
// ships compiled to dist/claw/scripts/ (npm run build); generated skill
|
|
16
|
+
// files always reference the node + .js form so they work without any
|
|
17
|
+
// TypeScript loader installed.
|
|
17
18
|
function resolveScriptInvocation(repoRoot: string, name: string) {
|
|
18
|
-
|
|
19
|
-
if (storage.exists(jsPath)) {
|
|
20
|
-
return { command: 'node', script: jsPath };
|
|
21
|
-
}
|
|
22
|
-
return { command: 'npx tsx', script: path.join(repoRoot, 'claw', 'scripts', `${name}.ts`) };
|
|
19
|
+
return { command: 'node', script: path.join(repoRoot, 'dist', 'claw', 'scripts', `${name}.js`) };
|
|
23
20
|
}
|
|
24
21
|
|
|
25
22
|
function buildBridgeInvocation(repoRoot: string, profileRoot: string, command: string, extraArgs: any[] = []) {
|
|
@@ -49,8 +46,8 @@ function buildToolSummary(runtimeName: string) {
|
|
|
49
46
|
|
|
50
47
|
function buildRuntimeSetup(runtime: any, repoRoot: string, profileRoot: string) {
|
|
51
48
|
const { command, script: mcpScriptPath } = resolveScriptInvocation(repoRoot, 'claw_mcp_server');
|
|
52
|
-
// command is 'node'
|
|
53
|
-
// executable and args correctly for
|
|
49
|
+
// command is 'node'; split so the config blocks can set the
|
|
50
|
+
// executable and args correctly for the built layout.
|
|
54
51
|
const runnerParts = command.split(' ');
|
|
55
52
|
const mcpExec = runnerParts[0];
|
|
56
53
|
const mcpArgs = `[${[...runnerParts.slice(1), mcpScriptPath, '--profile-root', profileRoot].map((part: any) => JSON.stringify(part)).join(', ')}]`;
|
|
@@ -209,7 +206,7 @@ function buildRuntimeSetup(runtime: any, repoRoot: string, profileRoot: string)
|
|
|
209
206
|
'Start the memU MCP server:',
|
|
210
207
|
'',
|
|
211
208
|
'```bash',
|
|
212
|
-
`
|
|
209
|
+
`node ${path.join(repoRoot, 'dist', 'claw', 'scripts', 'memu_mcp_server.js').replace(/\\/g, '/')} --memu-dir ${PATHS.CLAW.MEMU_DIR.replace(/\\/g, '/')}`,
|
|
213
210
|
'```',
|
|
214
211
|
'',
|
|
215
212
|
'Or use the npm script:',
|
|
@@ -237,20 +234,17 @@ function buildRuntimeSetup(runtime: any, repoRoot: string, profileRoot: string)
|
|
|
237
234
|
}
|
|
238
235
|
|
|
239
236
|
function buildRuntimeWorkflow(runtime: any) {
|
|
240
|
-
|
|
241
|
-
return [
|
|
242
|
-
'- Start with `claw_manifest`, `claw_runtime`, `claw_profile_context`, `claw_market_snapshot`, `claw_account_snapshot`, or `claw_open_orders`.',
|
|
243
|
-
'- For MPA and short workflows, use `claw_build_open_short_plan`, `claw_build_take_profit_plan`, or `claw_build_close_short_plan` before executing trades.',
|
|
244
|
-
'- Use `claw_honest_context`, `claw_honest_pair`, and `claw_honest_price` when the task involves HONEST assets or discovery.',
|
|
245
|
-
'- The shared Claw MCP server registers raw tool ids such as `claw_manifest`; if Hermes shows a namespaced label in its UI, follow the label shown there.'
|
|
246
|
-
].join('\n');
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return [
|
|
237
|
+
const baseLines = [
|
|
250
238
|
'- Start with `claw_manifest`, `claw_runtime`, `claw_profile_context`, `claw_market_snapshot`, `claw_account_snapshot`, or `claw_open_orders`.',
|
|
251
239
|
'- For MPA and short workflows, use `claw_build_open_short_plan`, `claw_build_take_profit_plan`, or `claw_build_close_short_plan` before executing trades.',
|
|
252
240
|
'- Use `claw_honest_context`, `claw_honest_pair`, and `claw_honest_price` when the task involves HONEST assets or discovery.'
|
|
253
|
-
]
|
|
241
|
+
];
|
|
242
|
+
|
|
243
|
+
if (runtime.runtime === 'hermes') {
|
|
244
|
+
baseLines.push('- The shared Claw MCP server registers raw tool ids such as `claw_manifest`; if Hermes shows a namespaced label in its UI, follow the label shown there.');
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return baseLines.join('\n');
|
|
254
248
|
}
|
|
255
249
|
|
|
256
250
|
function buildRuntimeSkillToml(runtime: any, repoRoot: string, profileRoot: string) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
'use strict';
|
|
1
2
|
|
|
2
3
|
import { PATHS } from '../../modules/paths.js';
|
|
3
4
|
import CreditRuntime from '../../modules/credit_runtime.js';
|
|
4
5
|
import { getErrorMessage } from '../../modules/utils/errors.js';
|
|
5
|
-
'use strict';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
function createCreditRuntimeAdapter(infra: any, options: Record<string, any> = {}) {
|
|
@@ -24,7 +24,7 @@ function createCreditRuntimeAdapter(infra: any, options: Record<string, any> = {
|
|
|
24
24
|
assetA: botEntry.assetA,
|
|
25
25
|
assetB: botEntry.assetB,
|
|
26
26
|
},
|
|
27
|
-
_log: (msg: string
|
|
27
|
+
_log: (msg: string) => {
|
|
28
28
|
const logger = infra.runtime?.logger || console;
|
|
29
29
|
if (typeof logger.info === 'function') logger.info(`[credit-runtime] ${msg}`);
|
|
30
30
|
else logger.log(`[credit-runtime] ${msg}`);
|
|
@@ -100,10 +100,7 @@ function createCreditRuntimeAdapter(infra: any, options: Record<string, any> = {
|
|
|
100
100
|
const rt = await _getRuntime(botRef);
|
|
101
101
|
if (!rt) {
|
|
102
102
|
try {
|
|
103
|
-
const
|
|
104
|
-
const bot = bundle.bots.find(
|
|
105
|
-
(b: Record<string, any>) => b.botKey === botRef || b.name === botRef,
|
|
106
|
-
);
|
|
103
|
+
const bot = await _resolveBotEntry(botRef);
|
|
107
104
|
if (!bot) return { error: `bot not found: ${botRef}` };
|
|
108
105
|
if (!bot.debtPolicy) return { error: `bot ${botRef} has no debtPolicy configured` };
|
|
109
106
|
return { error: `unable to initialize credit runtime for ${botRef}` };
|
|
@@ -142,19 +139,6 @@ function createCreditRuntimeAdapter(infra: any, options: Record<string, any> = {
|
|
|
142
139
|
_ensureSigningKey(rt, privateKey);
|
|
143
140
|
return rt.processPendingReborrows();
|
|
144
141
|
},
|
|
145
|
-
|
|
146
|
-
listRuntimes(): any[] {
|
|
147
|
-
return Array.from(_runtimes.entries())
|
|
148
|
-
.filter(([_, rt]) => rt.isEnabled())
|
|
149
|
-
.map(([key, rt]) => ({
|
|
150
|
-
botKey: key,
|
|
151
|
-
enabled: rt.isEnabled(),
|
|
152
|
-
}));
|
|
153
|
-
},
|
|
154
|
-
|
|
155
|
-
getRuntime(botRef: string): any | null {
|
|
156
|
-
return _runtimes.get(botRef) || null;
|
|
157
|
-
},
|
|
158
142
|
};
|
|
159
143
|
}
|
|
160
144
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use strict';
|
|
1
2
|
/**
|
|
2
3
|
* Decision Loop
|
|
3
4
|
*
|
|
@@ -16,22 +17,17 @@
|
|
|
16
17
|
*/
|
|
17
18
|
|
|
18
19
|
|
|
19
|
-
import { createRequire } from 'node:module';
|
|
20
|
-
const require = createRequire(import.meta.url);
|
|
21
|
-
|
|
22
20
|
import { discoverPositions } from './position_discovery.js';
|
|
23
21
|
import { assessPosition } from './position_health.js';
|
|
24
22
|
import { fetchTrendInput } from './feed_price_source.js';
|
|
25
23
|
import { getErrorMessage } from '../../modules/utils/errors.js';
|
|
26
|
-
|
|
24
|
+
// Static import (previously a lazy createRequire fallback): lazy require()
|
|
25
|
+
// bypasses the ESM loader hooks that compiled tests use for module mocking,
|
|
26
|
+
// and the analyzer module carries no circular-import risk.
|
|
27
|
+
import { KalmanTrendAnalyzer } from '../../market_adapter/core/signals/kalman_trend_analyzer.js';
|
|
27
28
|
|
|
28
29
|
|
|
29
|
-
// Lazy-load KalmanTrendAnalyzer to avoid circular dependency issues at startup
|
|
30
|
-
let KalmanTrendAnalyzer: any = null;
|
|
31
30
|
function getTrendAnalyzer() {
|
|
32
|
-
if (!KalmanTrendAnalyzer) {
|
|
33
|
-
KalmanTrendAnalyzer = require('../../market_adapter/core/signals/kalman_trend_analyzer').KalmanTrendAnalyzer;
|
|
34
|
-
}
|
|
35
31
|
return KalmanTrendAnalyzer;
|
|
36
32
|
}
|
|
37
33
|
|
|
@@ -186,6 +182,10 @@ function buildSummary(assessments: Array<Record<string, any>>) {
|
|
|
186
182
|
function resetAnalyzers() {
|
|
187
183
|
analyzers.clear();
|
|
188
184
|
analyzerConfigs.clear();
|
|
185
|
+
// Premiums belong to the analyzer generation that produced them; keeping
|
|
186
|
+
// them across a reset would let the reuse path report a stale value from
|
|
187
|
+
// discarded config.
|
|
188
|
+
marketPremiums.clear();
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
export { evaluate, getOrCreateAnalyzer, resetAnalyzers }
|
|
@@ -41,13 +41,13 @@ function getDexbot2Root() {
|
|
|
41
41
|
function resolveDexbot2Path(relativePath: string) {
|
|
42
42
|
const root = getDexbot2Root();
|
|
43
43
|
const normalizedPath = String(relativePath || '');
|
|
44
|
-
const candidates = [path.join(root, normalizedPath)];
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
// Compiled build first: under plain node there is no tsx-style .js→.ts
|
|
46
|
+
// interception, so resolving to the source tree would break require().
|
|
47
|
+
const candidates = [
|
|
48
|
+
path.join(root, BUILD_DIR, normalizedPath),
|
|
49
|
+
path.join(root, normalizedPath),
|
|
50
|
+
];
|
|
51
51
|
|
|
52
52
|
for (const candidate of candidates) {
|
|
53
53
|
if (candidateExists(candidate)) {
|
|
@@ -55,7 +55,7 @@ function resolveDexbot2Path(relativePath: string) {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
return candidates[
|
|
58
|
+
return candidates[0];
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
function requireDexbot2Module(relativePath: string) {
|
|
@@ -78,5 +78,5 @@ function loadDexbotOrderSystemUtils() {
|
|
|
78
78
|
return requireDexbot2Module('modules/order/utils/system');
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
export { getDexbot2Root, loadDexbotOrderConstants, loadDexbotOrderSubsystem, loadDexbotOrderSystemUtils, loadDexbotOrderUtils, requireDexbot2Module
|
|
81
|
+
export { getDexbot2Root, loadDexbotOrderConstants, loadDexbotOrderSubsystem, loadDexbotOrderSystemUtils, loadDexbotOrderUtils, requireDexbot2Module }
|
|
82
82
|
|
|
@@ -12,7 +12,7 @@ import { clone } from './utils.js';
|
|
|
12
12
|
import { createBotKey, sanitizeKey } from '../../modules/account_orders.js';
|
|
13
13
|
const storage = getStorage();
|
|
14
14
|
|
|
15
|
-
import type { BotSettings, ProfileOptions,
|
|
15
|
+
import type { BotSettings, ProfileOptions, ClawProfileBundle } from './types.js';
|
|
16
16
|
import { getErrorMessage } from '../../modules/utils/errors.js';
|
|
17
17
|
|
|
18
18
|
const DEFAULT_MANIFEST_FILE = 'config.json';
|
|
@@ -661,7 +661,7 @@ async function normalizeBotEntries(rawEntries: Record<string, any>[], options: P
|
|
|
661
661
|
if (logger) {
|
|
662
662
|
validateBotEntry(entry, index, logger);
|
|
663
663
|
}
|
|
664
|
-
const normalized = { active: entry.active === undefined ? true : !!entry.active
|
|
664
|
+
const normalized = { ...entry, active: entry.active === undefined ? true : !!entry.active };
|
|
665
665
|
results.push({ ...normalized, botIndex: index, botKey: createBotKey(normalized, index) });
|
|
666
666
|
}
|
|
667
667
|
return results;
|
|
@@ -1008,8 +1008,8 @@ async function loadDexbotProfileBundle(profileRoot: string | null, options: Part
|
|
|
1008
1008
|
* The adapter wraps bundle loading, settings validation, and atomic writes behind
|
|
1009
1009
|
* per-file locks so concurrent updates do not clobber each other.
|
|
1010
1010
|
*
|
|
1011
|
-
* @returns {Object} Adapter with loadBundle,
|
|
1012
|
-
*
|
|
1011
|
+
* @returns {Object} Adapter with loadBundle, getBotSettings,
|
|
1012
|
+
* previewBotSettingsUpdate, applyBotSettingsPatch, updateBotSettings, getClawProfileContext
|
|
1013
1013
|
*/
|
|
1014
1014
|
function createDexbotProfileAdapter(profileRoot: string | null, options: Partial<ProfileOptions> = {}) {
|
|
1015
1015
|
let cachedBundle: any = null;
|
|
@@ -1025,16 +1025,6 @@ function createDexbotProfileAdapter(profileRoot: string | null, options: Partial
|
|
|
1025
1025
|
return resolveProfilesDir(profileRoot || options.profileRoot);
|
|
1026
1026
|
}
|
|
1027
1027
|
|
|
1028
|
-
async function listBots({ activeOnly = false, forceReload = false } = {}) {
|
|
1029
|
-
const bundle = await loadBundle(forceReload);
|
|
1030
|
-
return activeOnly ? bundle.activeBots : bundle.bots;
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
async function findBot(identifier: any, forceReload = false) {
|
|
1034
|
-
const bundle = await loadBundle(forceReload);
|
|
1035
|
-
return bundle.bots.find((bot: any) => matchBotIdentifier(bot, identifier)) || null;
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
1028
|
async function getBotBundle(identifier: any, forceReload = false) {
|
|
1039
1029
|
const bundle = await loadBundle(forceReload);
|
|
1040
1030
|
const bot = bundle.bots.find((entry: any) => matchBotIdentifier(entry, identifier)) || null;
|
|
@@ -1272,20 +1262,14 @@ function createDexbotProfileAdapter(profileRoot: string | null, options: Partial
|
|
|
1272
1262
|
}
|
|
1273
1263
|
|
|
1274
1264
|
return {
|
|
1275
|
-
buildClawProfileContext: (bundle: any, contextOptions = {}) => buildClawProfileContext(bundle, contextOptions),
|
|
1276
1265
|
applyBotSettingsPatch,
|
|
1277
|
-
findBot,
|
|
1278
|
-
getBotBundle,
|
|
1279
1266
|
getBotSettings,
|
|
1280
1267
|
getClawProfileContext,
|
|
1281
|
-
getProfilesDir,
|
|
1282
|
-
listBots,
|
|
1283
1268
|
loadBundle,
|
|
1284
1269
|
previewBotSettingsUpdate,
|
|
1285
|
-
resolveProfilesDir: () => resolveProfilesDir(profileRoot || options.profileRoot),
|
|
1286
1270
|
updateBotSettings
|
|
1287
1271
|
};
|
|
1288
1272
|
}
|
|
1289
1273
|
|
|
1290
|
-
export {
|
|
1274
|
+
export { createBotKey, createDexbotProfileAdapter, matchBotIdentifier, normalizeBotEntries, resolveProfilesDir, resolveRawBotEntries, validateBotEntry, writeJsonFileAtomic }
|
|
1291
1275
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use strict';
|
|
1
2
|
/**
|
|
2
3
|
* Feed Price Source
|
|
3
4
|
*
|
|
@@ -12,7 +13,6 @@
|
|
|
12
13
|
import { getAsset, getBackingAsset, getBitassetData, dbCall } from './chain_queries.js';
|
|
13
14
|
import { computeBtsPerMpa } from './mpa_utils.js';
|
|
14
15
|
import { roundTo } from '../../modules/order/utils/math.js';
|
|
15
|
-
'use strict';
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -88,7 +88,11 @@ async function fetchLivePoolReserves(poolId: string = HARDCODED_POOL_ID) {
|
|
|
88
88
|
};
|
|
89
89
|
_poolReservesCache = { poolId, ts: Date.now(), value: result };
|
|
90
90
|
return result;
|
|
91
|
-
} catch {
|
|
91
|
+
} catch (err: any) {
|
|
92
|
+
// Never cache failures, but surface them: silently serving the hardcoded
|
|
93
|
+
// fallback snapshot hides a degraded node and produces confidently-wrong
|
|
94
|
+
// bridge prices with no telemetry trail.
|
|
95
|
+
console.warn(`[honest-ecosystem] live pool reserves fetch failed for ${poolId}, using hardcoded fallback: ${err?.message || err}`);
|
|
92
96
|
return null;
|
|
93
97
|
}
|
|
94
98
|
}
|
|
@@ -217,10 +221,15 @@ async function resolveHonestPairContext(assetA: any, assetB: any, options: Recor
|
|
|
217
221
|
};
|
|
218
222
|
}
|
|
219
223
|
|
|
220
|
-
|
|
221
|
-
|
|
224
|
+
/**
|
|
225
|
+
* Paginate list_assets with the shared dedup/boundary rules used across the
|
|
226
|
+
* HONEST tooling. `onPage` receives each de-duplicated page and accumulates
|
|
227
|
+
* whatever it needs; returning `false` stops pagination early (e.g. crossing
|
|
228
|
+
* a prefix boundary).
|
|
229
|
+
*/
|
|
230
|
+
async function paginateListAssets({ batchSize = 100, maxPages = 100, startSymbol = '' }: Record<string, any> = {}, onPage: (pageItems: any[], batch: any[]) => boolean | void) {
|
|
222
231
|
let lowerBound = startSymbol;
|
|
223
|
-
let previousLastSymbol = null;
|
|
232
|
+
let previousLastSymbol: string | null = null;
|
|
224
233
|
|
|
225
234
|
for (let page = 0; page < maxPages; page += 1) {
|
|
226
235
|
const batch = await listAssets(lowerBound, batchSize);
|
|
@@ -237,17 +246,24 @@ async function loadHonestAssets({ prefix = DEFAULT_PREFIX, batchSize = 100, maxP
|
|
|
237
246
|
break;
|
|
238
247
|
}
|
|
239
248
|
|
|
240
|
-
const
|
|
241
|
-
all.push(...matching);
|
|
249
|
+
const keepGoing = await onPage(pageItems, batch);
|
|
242
250
|
|
|
243
251
|
previousLastSymbol = pageItems[pageItems.length - 1].symbol;
|
|
244
252
|
lowerBound = previousLastSymbol;
|
|
245
253
|
|
|
246
|
-
if (batch.length < batchSize) {
|
|
254
|
+
if (keepGoing === false || batch.length < batchSize) {
|
|
247
255
|
break;
|
|
248
256
|
}
|
|
249
257
|
}
|
|
258
|
+
}
|
|
250
259
|
|
|
260
|
+
async function loadHonestAssets({ prefix = DEFAULT_PREFIX, batchSize = 100, maxPages = 100, startSymbol = DEFAULT_PREFIX }: Record<string, any> = {}) {
|
|
261
|
+
const all: any[] = [];
|
|
262
|
+
|
|
263
|
+
await paginateListAssets({ batchSize, maxPages, startSymbol }, (pageItems) => {
|
|
264
|
+
const matching = pageItems.filter((asset) => isHonestAsset(asset) && asset.symbol.startsWith(prefix));
|
|
265
|
+
all.push(...matching);
|
|
266
|
+
});
|
|
251
267
|
const mpas = [];
|
|
252
268
|
for (const asset of all) {
|
|
253
269
|
if (!isMpa(asset)) {
|
|
@@ -357,5 +373,5 @@ function createHonestEcosystemAdapter(options: Record<string, any> = {}) {
|
|
|
357
373
|
};
|
|
358
374
|
}
|
|
359
375
|
|
|
360
|
-
export {
|
|
376
|
+
export { buildHonestEcosystemContext, createHonestEcosystemAdapter, getHardcodedHonestMoneyBridge, getHonestMoneyBridge, isMpa, loadHonestAssets, paginateListAssets, resolveHardcodedHonestMoneyPrice, resolveHonestPairContext, resolveHonestPairPrice }
|
|
361
377
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use strict';
|
|
1
2
|
/**
|
|
2
3
|
* Kibana Price Source
|
|
3
4
|
*
|
|
@@ -16,7 +17,6 @@
|
|
|
16
17
|
import { getMarketCandles, getMarketClosePrices } from '../../market_adapter/core/kibana_market_candles.js';
|
|
17
18
|
import { getLpCandlesForPool, getLpClosePricesForPool, discoverPoolAssets } from '../../market_adapter/inputs/kibana_source.js';
|
|
18
19
|
import { getAsset } from './chain_queries.js';
|
|
19
|
-
'use strict';
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
1
2
|
|
|
2
3
|
import { path } from '../../modules/path_api.js';
|
|
3
4
|
import { getStorage } from '../../modules/storage/index.js';
|
|
4
5
|
import { loadSettingsFile, resolveRawBotEntries } from '../../modules/bot_settings.js';
|
|
5
6
|
import { normalizeProfileDir } from './launcher_paths.js';
|
|
6
|
-
'use strict';
|
|
7
7
|
|
|
8
8
|
const storage = getStorage();
|
|
9
9
|
const { ensureDir, readJSON, writeJSON } = storage;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
1
2
|
|
|
2
3
|
import { path } from '../../modules/path_api.js';
|
|
3
4
|
import { getStorage } from '../../modules/storage/index.js';
|
|
4
5
|
import { BUILD_DIR } from '../../modules/constants.js';
|
|
5
6
|
import { PATHS } from '../../modules/paths.js';
|
|
6
|
-
'use strict';
|
|
7
7
|
|
|
8
8
|
const storage = getStorage();
|
|
9
9
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
import * as client from './bitshares_client.js';
|
|
4
|
-
import {
|
|
4
|
+
import { loadDexbotOrderSystemUtils, requireDexbot2Module } from './dexbot_bridge.js';
|
|
5
5
|
function getDexbotSystem() {
|
|
6
6
|
return loadDexbotOrderSystemUtils();
|
|
7
7
|
}
|
|
@@ -13,9 +13,16 @@ function derivePoolPrice(assetA: any, assetB: any, poolRef?: string | null | Rec
|
|
|
13
13
|
try {
|
|
14
14
|
const { withPoolRef: wrapWithPoolRef } = requireDexbot2Module('modules/order/utils/withPoolRef') as any;
|
|
15
15
|
const override = wrapWithPoolRef(client.BitShares, resolvedPoolRef);
|
|
16
|
-
|
|
16
|
+
// The caller pinned a specific pool: honoring the pin or failing is
|
|
17
|
+
// correct, silently deriving from a different auto-selected pool is not.
|
|
18
|
+
if (!override) {
|
|
19
|
+
console.warn(`[liquidity-pools] derivePoolPrice could not pin pool ${resolvedPoolRef}`);
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return override.derivePoolPrice(assetA, assetB);
|
|
17
23
|
} catch (e: any) {
|
|
18
24
|
console.warn(`[liquidity-pools] derivePoolPrice with poolRef failed: ${e?.message || e}`);
|
|
25
|
+
return null;
|
|
19
26
|
}
|
|
20
27
|
}
|
|
21
28
|
return system.derivePoolPrice(client.BitShares, assetA, assetB);
|
|
@@ -47,5 +54,5 @@ function createDexbotPoolHelper() {
|
|
|
47
54
|
};
|
|
48
55
|
}
|
|
49
56
|
|
|
50
|
-
export { derivePoolPrice, derivePrice, createDexbotPoolHelper
|
|
57
|
+
export { derivePoolPrice, derivePrice, createDexbotPoolHelper }
|
|
51
58
|
|