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,18 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const assert = require('assert');
|
|
4
|
+
const { runEsmMockStages, defineEsmMockAbs } = require('../../tests/helpers/esm_mocks');
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
// Compiled ESM graphs cannot be mocked via require.cache; the helper installs
|
|
7
|
+
// loader hooks (one child process per stage so fresh module instances load).
|
|
8
|
+
function clearModule(_modulePath: string) {
|
|
9
|
+
/* no-op under ESM hooks */
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
function registerMock(modulePath: string, exports: any) {
|
|
10
|
-
|
|
11
|
-
id: modulePath,
|
|
12
|
-
filename: modulePath,
|
|
13
|
-
loaded: true,
|
|
14
|
-
exports
|
|
15
|
-
} as any;
|
|
13
|
+
defineEsmMockAbs(modulePath, Object.keys(exports), exports);
|
|
16
14
|
}
|
|
17
15
|
|
|
18
16
|
function createBridgeHarness() {
|
|
@@ -225,6 +223,30 @@ function createBridgeHarness() {
|
|
|
225
223
|
}
|
|
226
224
|
});
|
|
227
225
|
|
|
226
|
+
// The mock replicates the real validator's required-args table: under ESM
|
|
227
|
+
// hooks the real module cannot be require()d here (that would bypass the
|
|
228
|
+
// mock and poison the module cache with the real instance).
|
|
229
|
+
const memuRequiredArgs = {
|
|
230
|
+
'memorize': { groups: [['resourceUrl'], ['modality']], message: 'memorize requires resourceUrl and modality' },
|
|
231
|
+
'retrieve': { groups: [['queries']], message: 'retrieve requires queries' },
|
|
232
|
+
'create-item': { groups: [['categoryId', 'categoryName', 'category'], ['summary']], message: 'create-item requires categoryId or categoryName, plus summary' },
|
|
233
|
+
'update-item': { groups: [['itemId'], ['updates']], message: 'update-item requires itemId and updates' },
|
|
234
|
+
'delete-item': { groups: [['itemId']], message: 'delete-item requires itemId' },
|
|
235
|
+
'memorize-conversation': { groups: [['messages']], message: 'memorize-conversation requires messages array' },
|
|
236
|
+
'memorize-trading-context': { groups: [['context']], message: 'memorize-trading-context requires context' },
|
|
237
|
+
'retrieve-trading-context': { groups: [['query']], message: 'retrieve-trading-context requires query' }
|
|
238
|
+
};
|
|
239
|
+
function validateMemuCommandArgs(command: string, options: any) {
|
|
240
|
+
const spec = (memuRequiredArgs as any)[command];
|
|
241
|
+
if (!spec) return;
|
|
242
|
+
const satisfied = spec.groups.every(
|
|
243
|
+
(group: string[]) => group.some((field) => options[field])
|
|
244
|
+
);
|
|
245
|
+
if (!satisfied) {
|
|
246
|
+
throw new Error(spec.message);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
228
250
|
registerMock(memuBridgePath, {
|
|
229
251
|
describeMemuBridge: (options: any) => ({
|
|
230
252
|
options,
|
|
@@ -238,7 +260,8 @@ function createBridgeHarness() {
|
|
|
238
260
|
options,
|
|
239
261
|
source: 'memu'
|
|
240
262
|
};
|
|
241
|
-
}
|
|
263
|
+
},
|
|
264
|
+
validateMemuCommandArgs
|
|
242
265
|
});
|
|
243
266
|
|
|
244
267
|
clearModule(bridgePath);
|
|
@@ -499,7 +522,7 @@ async function testRunClawCommandDispatchMatrix() {
|
|
|
499
522
|
() => bridge.runClawCommand('memu-create-item', {
|
|
500
523
|
summary: 'missing category'
|
|
501
524
|
}),
|
|
502
|
-
/
|
|
525
|
+
/create-item requires categoryId or categoryName, plus summary/
|
|
503
526
|
);
|
|
504
527
|
|
|
505
528
|
await assert.rejects(
|
|
@@ -531,12 +554,17 @@ async function testRunClawCommandDispatchMatrix() {
|
|
|
531
554
|
console.log(' PASS');
|
|
532
555
|
}
|
|
533
556
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
557
|
+
runEsmMockStages(
|
|
558
|
+
['sanitizes-private-key', 'dispatch-matrix'],
|
|
559
|
+
async (stage: string) => {
|
|
560
|
+
if (stage === 'sanitizes-private-key') {
|
|
561
|
+
await testCreateClawBridgeSanitizesPrivateKey();
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
if (stage === 'dispatch-matrix') {
|
|
565
|
+
await testRunClawCommandDispatchMatrix();
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
throw new Error(`Unknown stage: ${stage}`);
|
|
569
|
+
}
|
|
570
|
+
);
|
|
@@ -54,8 +54,8 @@ function testClawCatalog() {
|
|
|
54
54
|
catalogCopy[0].command = 'mutated';
|
|
55
55
|
assert.notStrictEqual(catalog.getClawToolCatalog()[0].command, 'mutated');
|
|
56
56
|
|
|
57
|
-
const examples = catalog.buildClawCommandExamples('
|
|
58
|
-
assert.ok(examples.some((line: any) => line.startsWith('
|
|
57
|
+
const examples = catalog.buildClawCommandExamples('node dist/claw/scripts/claw_bridge.js');
|
|
58
|
+
assert.ok(examples.some((line: any) => line.startsWith('node dist/claw/scripts/claw_bridge.js manifest')));
|
|
59
59
|
assert.ok(examples.some((line: any) => line.includes('bot-settings-apply')));
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -134,9 +134,13 @@ async function testCredentialDaemonClient() {
|
|
|
134
134
|
|
|
135
135
|
function testDexbotBridgeRootResolution() {
|
|
136
136
|
const bridge = require('../modules/dexbot_bridge');
|
|
137
|
-
const
|
|
137
|
+
const root = bridge.getDexbot2Root();
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
// The resolved root must be a real DEXBot2 checkout that contains this
|
|
140
|
+
// test's compiled location and the module tree the bridge resolves against.
|
|
141
|
+
const rel = path.relative(root, __dirname);
|
|
142
|
+
assert.ok(!rel.startsWith('..') && !path.isAbsolute(rel), 'resolved DEXBot2 root must contain this test');
|
|
143
|
+
assert.ok(fs.existsSync(path.join(root, 'package.json')), 'resolved DEXBot2 root must contain package.json');
|
|
140
144
|
}
|
|
141
145
|
|
|
142
146
|
async function main() {
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const assert = require('assert');
|
|
4
|
+
const { runEsmMockStages, defineEsmMockAbs } = require('../../tests/helpers/esm_mocks');
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
// Compiled ESM graphs cannot be mocked via require.cache; the helper installs
|
|
7
|
+
// loader hooks (one child process per stage so fresh module instances load).
|
|
8
|
+
function clearModule(_modulePath: string) {
|
|
9
|
+
/* no-op under ESM hooks */
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
function registerMock(modulePath: string, exports: any) {
|
|
10
|
-
|
|
11
|
-
id: modulePath,
|
|
12
|
-
filename: modulePath,
|
|
13
|
-
loaded: true,
|
|
14
|
-
exports
|
|
15
|
-
} as any;
|
|
13
|
+
defineEsmMockAbs(modulePath, Object.keys(exports), exports);
|
|
16
14
|
}
|
|
17
15
|
|
|
18
16
|
const { clone } = require('../modules/utils');
|
|
@@ -254,7 +252,22 @@ function createBroadcastHarness() {
|
|
|
254
252
|
}
|
|
255
253
|
});
|
|
256
254
|
|
|
255
|
+
// ESM hooks turn mock keys into synthetic named re-exports, so every name
|
|
256
|
+
// chain_broadcast statically imports must exist here. The error class is a
|
|
257
|
+
// minimal inline replica of the real one (requiring the real module would
|
|
258
|
+
// poison the module cache and bypass the mock).
|
|
259
|
+
class BroadcastUncertainError extends Error {
|
|
260
|
+
code: string;
|
|
261
|
+
constructor(message: string) {
|
|
262
|
+
super(message);
|
|
263
|
+
this.name = 'BroadcastUncertainError';
|
|
264
|
+
this.code = 'BROADCAST_UNCERTAIN';
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
257
268
|
registerMock(credentialClientPath, {
|
|
269
|
+
BroadcastUncertainError,
|
|
270
|
+
DEFAULT_BROADCAST_TIMEOUT_MS: 30000,
|
|
258
271
|
isCredentialDaemonReady: () => calls.daemonReady,
|
|
259
272
|
broadcastOperationViaCredentialDaemon: async (accountName: any, operation: any, options: any) => {
|
|
260
273
|
calls.daemon.broadcast.push({ accountName, operation, options });
|
|
@@ -706,14 +719,21 @@ async function testChainActions() {
|
|
|
706
719
|
console.log(' PASS');
|
|
707
720
|
}
|
|
708
721
|
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
}
|
|
722
|
+
runEsmMockStages(
|
|
723
|
+
['chain-queries', 'chain-broadcast', 'chain-actions'],
|
|
724
|
+
async (stage: string) => {
|
|
725
|
+
if (stage === 'chain-queries') {
|
|
726
|
+
await testChainQueries();
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
if (stage === 'chain-broadcast') {
|
|
730
|
+
await testChainBroadcast();
|
|
731
|
+
return;
|
|
732
|
+
}
|
|
733
|
+
if (stage === 'chain-actions') {
|
|
734
|
+
await testChainActions();
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
throw new Error(`Unknown stage: ${stage}`);
|
|
738
|
+
}
|
|
739
|
+
);
|
|
@@ -2,18 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
const assert = require('assert');
|
|
4
4
|
const Module = require('module');
|
|
5
|
+
const { runEsmMockStages, defineEsmMockAbs } = require('../../tests/helpers/esm_mocks');
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
// Compiled ESM graphs cannot be mocked via require.cache; the helper installs
|
|
8
|
+
// loader hooks (one child process per stage so fresh module instances load).
|
|
9
|
+
function clearModule(_modulePath: string) {
|
|
10
|
+
/* no-op under ESM hooks */
|
|
8
11
|
}
|
|
9
12
|
|
|
10
13
|
function registerMock(modulePath: string, exports: any) {
|
|
11
|
-
|
|
12
|
-
id: modulePath,
|
|
13
|
-
filename: modulePath,
|
|
14
|
-
loaded: true,
|
|
15
|
-
exports
|
|
16
|
-
} as any;
|
|
14
|
+
defineEsmMockAbs(modulePath, Object.keys(exports), exports);
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
const { clone } = require('../modules/utils');
|
|
@@ -503,15 +501,25 @@ function testLiquidityPoolsWrapper() {
|
|
|
503
501
|
console.log(' PASS');
|
|
504
502
|
}
|
|
505
503
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
504
|
+
runEsmMockStages(
|
|
505
|
+
['discovery-feed', 'decision-loop', 'kibana', 'liquidity-pools'],
|
|
506
|
+
async (stage: string) => {
|
|
507
|
+
if (stage === 'discovery-feed') {
|
|
508
|
+
await testPositionDiscoveryAndFeedSource();
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
if (stage === 'decision-loop') {
|
|
512
|
+
await testDecisionLoop();
|
|
513
|
+
return;
|
|
514
|
+
}
|
|
515
|
+
if (stage === 'kibana') {
|
|
516
|
+
await testKibanaPriceSource();
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
if (stage === 'liquidity-pools') {
|
|
520
|
+
testLiquidityPoolsWrapper();
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
throw new Error(`Unknown stage: ${stage}`);
|
|
524
|
+
}
|
|
525
|
+
);
|
|
@@ -4,18 +4,16 @@ const assert = require('assert');
|
|
|
4
4
|
const fs = require('fs/promises');
|
|
5
5
|
const os = require('os');
|
|
6
6
|
const path = require('path');
|
|
7
|
+
const { runEsmMockStages, defineEsmMockAbs } = require('../../tests/helpers/esm_mocks');
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
// Compiled ESM graphs cannot be mocked via require.cache; the helper installs
|
|
10
|
+
// loader hooks (one child process per stage so fresh module instances load).
|
|
11
|
+
function clearModule(_modulePath: string) {
|
|
12
|
+
/* no-op under ESM hooks */
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
function registerMock(modulePath: string, exports: any) {
|
|
13
|
-
|
|
14
|
-
id: modulePath,
|
|
15
|
-
filename: modulePath,
|
|
16
|
-
loaded: true,
|
|
17
|
-
exports
|
|
18
|
-
} as any;
|
|
16
|
+
defineEsmMockAbs(modulePath, Object.keys(exports), exports);
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
const { clone } = require('../modules/utils');
|
|
@@ -98,6 +96,7 @@ function createHonestHarness(options: any = {}) {
|
|
|
98
96
|
calls.getCallOrders.push({ assetId, limit });
|
|
99
97
|
return [{ id: `${assetId}-call-1` }];
|
|
100
98
|
},
|
|
99
|
+
getObjects: async () => [],
|
|
101
100
|
listAssets: async (lowerBound: string, limit: any) => {
|
|
102
101
|
calls.listAssets.push({ lowerBound, limit });
|
|
103
102
|
return listAssetPages.shift() || [];
|
|
@@ -452,14 +451,21 @@ async function testPositionManager() {
|
|
|
452
451
|
console.log(' PASS');
|
|
453
452
|
}
|
|
454
453
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
}
|
|
454
|
+
runEsmMockStages(
|
|
455
|
+
['honest', 'honest-pagination', 'position-manager'],
|
|
456
|
+
async (stage: string) => {
|
|
457
|
+
if (stage === 'honest') {
|
|
458
|
+
await testHonestEcosystem();
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
if (stage === 'honest-pagination') {
|
|
462
|
+
await testHonestEcosystemPaginationAndUnresolvedPair();
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
if (stage === 'position-manager') {
|
|
466
|
+
await testPositionManager();
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
throw new Error(`Unknown stage: ${stage}`);
|
|
470
|
+
}
|
|
471
|
+
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const assert = require('assert');
|
|
4
|
+
const fs = require('fs');
|
|
4
5
|
const path = require('path');
|
|
5
6
|
|
|
6
7
|
// ---------------------------------------------------------------------------
|
|
@@ -154,6 +155,25 @@ function testClawManifest() {
|
|
|
154
155
|
// dexbot_bridge — getDexbot2Root branching only
|
|
155
156
|
// ---------------------------------------------------------------------------
|
|
156
157
|
|
|
158
|
+
// Repo root located independently of the compiled layout: compiled tests run
|
|
159
|
+
// from <repo>/dist/claw/tests, so a fixed __dirname offset would point at
|
|
160
|
+
// dist/ instead of the repo. The repo root is the nearest ancestor holding
|
|
161
|
+
// package.json plus both the modules/ and claw/ source trees.
|
|
162
|
+
function findRepoRoot(startDir: string) {
|
|
163
|
+
let dir = startDir;
|
|
164
|
+
for (let i = 0; i < 10; i++) {
|
|
165
|
+
if (
|
|
166
|
+
fs.existsSync(path.join(dir, 'package.json')) &&
|
|
167
|
+
fs.existsSync(path.join(dir, 'modules')) &&
|
|
168
|
+
fs.existsSync(path.join(dir, 'claw'))
|
|
169
|
+
) {
|
|
170
|
+
return dir;
|
|
171
|
+
}
|
|
172
|
+
dir = path.dirname(dir);
|
|
173
|
+
}
|
|
174
|
+
throw new Error('Unable to locate DEXBot2 repo root');
|
|
175
|
+
}
|
|
176
|
+
|
|
157
177
|
function testDexbotBridgeRootResolution() {
|
|
158
178
|
const bridgePath = require.resolve('../modules/dexbot_bridge');
|
|
159
179
|
const { Config } = require('../../modules/config');
|
|
@@ -173,14 +193,14 @@ function testDexbotBridgeRootResolution() {
|
|
|
173
193
|
}
|
|
174
194
|
|
|
175
195
|
// --- Branch 2: no DEXBOT2_ROOT, auto-detected local repo layout ---
|
|
176
|
-
// The test
|
|
177
|
-
//
|
|
196
|
+
// The test runs inside the DEXBot2 repo, so the existsSync candidate check
|
|
197
|
+
// (dist/modules/order/index.js) should resolve to the repo root itself.
|
|
178
198
|
delete require.cache[bridgePath];
|
|
179
199
|
Config.DEXBOT2_ROOT = undefined;
|
|
180
200
|
try {
|
|
181
201
|
const bridge = require('../modules/dexbot_bridge');
|
|
182
202
|
const root = bridge.getDexbot2Root();
|
|
183
|
-
const expectedRoot =
|
|
203
|
+
const expectedRoot = findRepoRoot(__dirname);
|
|
184
204
|
assert.strictEqual(root, expectedRoot);
|
|
185
205
|
} finally {
|
|
186
206
|
Config.DEXBOT2_ROOT = savedRoot;
|
|
@@ -6,7 +6,6 @@ const os = require('os');
|
|
|
6
6
|
const { getErrorMessage } = require('../../modules/utils/errors');
|
|
7
7
|
const { spawnSync } = require('child_process');
|
|
8
8
|
const path = require('path');
|
|
9
|
-
const { isDistCodeRoot } = require('../../modules/launcher/runtime_entry');
|
|
10
9
|
const mcpServer = require('../scripts/claw_mcp_server');
|
|
11
10
|
|
|
12
11
|
function encodeNewlineMessage(message: any) {
|
|
@@ -31,7 +30,7 @@ async function testParserAcceptsJsonlAcrossChunksAndSingleBuffer() {
|
|
|
31
30
|
capabilities: {},
|
|
32
31
|
clientInfo: {
|
|
33
32
|
name: 'claw-mcp-transport-test',
|
|
34
|
-
version: '1.4.
|
|
33
|
+
version: '1.4.22'
|
|
35
34
|
},
|
|
36
35
|
protocolVersion: '2024-11-05'
|
|
37
36
|
}
|
|
@@ -143,10 +142,17 @@ async function testHandleRequestEmitsNewlineJson() {
|
|
|
143
142
|
}
|
|
144
143
|
|
|
145
144
|
function runServerProcess(input: any) {
|
|
146
|
-
|
|
145
|
+
// Resolve the real checkout root (works from both the source tree and the
|
|
146
|
+
// compiled dist/claw/tests location) and prefer the compiled server script.
|
|
147
|
+
let repoRoot = path.resolve(__dirname, '..', '..');
|
|
148
|
+
while (!fs.existsSync(path.join(repoRoot, 'package.json'))) {
|
|
149
|
+
const parent = path.dirname(repoRoot);
|
|
150
|
+
if (parent === repoRoot) throw new Error('Unable to locate DEXBot2 checkout root');
|
|
151
|
+
repoRoot = parent;
|
|
152
|
+
}
|
|
147
153
|
const clawRoot = path.resolve(__dirname, '..');
|
|
148
|
-
const
|
|
149
|
-
const scriptPath =
|
|
154
|
+
const scriptBase = path.join(clawRoot, 'scripts', 'claw_mcp_server');
|
|
155
|
+
const scriptPath = fs.existsSync(`${scriptBase}.js`) ? `${scriptBase}.js` : `${scriptBase}.ts`;
|
|
150
156
|
const scriptRel = path.relative(repoRoot, scriptPath);
|
|
151
157
|
|
|
152
158
|
const tmpRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'claw-mcp-transport-'));
|
|
@@ -155,8 +161,7 @@ function runServerProcess(input: any) {
|
|
|
155
161
|
fs.writeFileSync(inputPath, input, 'utf8');
|
|
156
162
|
|
|
157
163
|
try {
|
|
158
|
-
const
|
|
159
|
-
const shellCommand = `cat ${shellQuote(inputPath)} | ${shellQuote(process.execPath)} --no-warnings ${loaderArgs}${shellQuote(scriptRel)} --profile-root ${shellQuote(repoRoot)} > ${shellQuote(outputPath)}`;
|
|
164
|
+
const shellCommand = `cat ${shellQuote(inputPath)} | ${shellQuote(process.execPath)} --no-warnings ${shellQuote(scriptRel)} --profile-root ${shellQuote(repoRoot)} > ${shellQuote(outputPath)}`;
|
|
160
165
|
const run = spawnSync('/bin/sh', ['-lc', shellCommand], {
|
|
161
166
|
cwd: repoRoot,
|
|
162
167
|
encoding: 'utf8'
|
|
@@ -182,7 +187,7 @@ async function testMainEntrypointHandlesRealProcessInitialize() {
|
|
|
182
187
|
capabilities: {},
|
|
183
188
|
clientInfo: {
|
|
184
189
|
name: 'claw-mcp-transport-test',
|
|
185
|
-
version: '1.4.
|
|
190
|
+
version: '1.4.22'
|
|
186
191
|
},
|
|
187
192
|
protocolVersion: '2024-11-05'
|
|
188
193
|
}
|