dexbot 1.4.21 → 1.4.23
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 +52 -0
- package/README.md +8 -5
- package/analysis/ama_fitting/analyze_ama_price_changes.ts +7 -3
- package/analysis/ama_fitting/analyze_lambda_vs_slow.ts +6 -6
- package/analysis/ama_fitting/calibrate_convergence_er.ts +7 -5
- 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 +26 -17
- 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 +15 -9
- package/analysis/bot_key_utils.ts +13 -6
- package/analysis/bot_usage/discover_bot_accounts.ts +5 -3
- package/analysis/bot_usage/kibana_bot_queries.ts +1 -1
- 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/price_sources.ts +8 -2
- package/analysis/resolve_source.ts +1 -1
- package/analysis/trade_profitability.ts +61 -28
- package/analysis/tradingview/README.md +24 -4
- package/analysis/tradingview/analyze_tradingview.ts +1 -1
- package/analysis/tradingview/tradingview_uplot_chart_generator.ts +356 -86
- 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/index.ts +1 -1
- package/claw/modules/claw_bridge.ts +3 -3
- package/claw/modules/claw_catalog.ts +1 -1
- package/claw/modules/claw_launcher.ts +1 -1
- package/claw/modules/claw_skill_md.ts +7 -10
- package/claw/modules/credit_runtime_adapter.ts +1 -1
- package/claw/modules/decision_loop.ts +5 -9
- package/claw/modules/dexbot_bridge.ts +7 -7
- package/claw/modules/feed_price_source.ts +1 -1
- 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/position_discovery.ts +1 -1
- package/claw/modules/position_health.ts +1 -1
- package/claw/package.json +3 -3
- package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
- package/claw/runtimes/openclaw-plugin/package.json +1 -1
- 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 +45 -21
- 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 +6 -6
- package/dist/analysis/ama_fitting/analyze_lambda_vs_slow.js.map +1 -1
- package/dist/analysis/ama_fitting/calibrate_convergence_er.js +7 -5
- 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 +25 -17
- 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 +1 -1
- package/dist/analysis/bot_fitting/shared_utils.d.ts.map +1 -1
- package/dist/analysis/bot_fitting/shared_utils.js +14 -8
- package/dist/analysis/bot_fitting/shared_utils.js.map +1 -1
- package/dist/analysis/bot_key_utils.d.ts.map +1 -1
- package/dist/analysis/bot_key_utils.js +13 -6
- 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.map +1 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.js +1 -1
- package/dist/analysis/bot_usage/kibana_bot_queries.js.map +1 -1
- package/dist/analysis/chart_css.d.ts +3 -1
- 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/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 +356 -86
- 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 +1 -1
- package/dist/bot.js.map +1 -1
- package/dist/credential-daemon.d.ts +1 -1
- package/dist/credential-daemon.js +1 -1
- package/dist/dexbot.d.ts.map +1 -1
- package/dist/dexbot.js +7 -8
- package/dist/dexbot.js.map +1 -1
- package/dist/market_adapter/ama_signal_runner.js +3 -1
- 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 +0 -14
- package/dist/market_adapter/core/kibana_client.d.ts.map +1 -1
- package/dist/market_adapter/core/kibana_client.js +39 -6
- 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 +21 -11
- package/dist/market_adapter/core/market_adapter_service.d.ts.map +1 -1
- package/dist/market_adapter/core/market_adapter_service.js +95 -37
- 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.map +1 -1
- package/dist/market_adapter/core/strategies/regime_gate.js +26 -20
- 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 +69 -55
- 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 +67 -14
- package/dist/market_adapter/inputs/fetch_lp_data.js.map +1 -1
- package/dist/market_adapter/inputs/kibana_source.d.ts +4 -28
- package/dist/market_adapter/inputs/kibana_source.d.ts.map +1 -1
- package/dist/market_adapter/inputs/kibana_source.js +5 -2
- 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.js +1 -1
- 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 +9 -8
- 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.map +1 -1
- package/dist/modules/account_bots.js +47 -12
- package/dist/modules/account_bots.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.js +10 -10
- 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 +11 -18
- 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_orders.d.ts.map +1 -1
- package/dist/modules/chain_orders.js +15 -17
- package/dist/modules/chain_orders.js.map +1 -1
- package/dist/modules/config.js +1 -1
- package/dist/modules/config.js.map +1 -1
- package/dist/modules/constants.d.ts +21 -20
- package/dist/modules/constants.d.ts.map +1 -1
- package/dist/modules/constants.js +60 -63
- 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 +17 -2
- 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 +36 -197
- 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 +9 -6
- 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 +19 -4
- 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 +9 -19
- 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 +2 -14
- package/dist/modules/launcher/foreign_cred_daemon.js.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.d.ts +1 -1
- package/dist/modules/launcher/market_adapter_runtime.d.ts.map +1 -1
- package/dist/modules/launcher/market_adapter_runtime.js +3 -14
- 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 +3 -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.js +1 -1
- 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 +1 -1
- 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 -0
- package/dist/modules/order/format.d.ts.map +1 -1
- package/dist/modules/order/format.js +0 -6
- 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 +40 -27
- 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 +22 -13
- package/dist/modules/order/logger.js.map +1 -1
- package/dist/modules/order/logger_state.d.ts +4 -9
- package/dist/modules/order/logger_state.d.ts.map +1 -1
- package/dist/modules/order/logger_state.js +5 -14
- 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.map +1 -1
- package/dist/modules/order/processed_fill_store.js +9 -3
- 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.js +7 -7
- package/dist/modules/order/sync_engine.js.map +1 -1
- package/dist/modules/order/utils/math.d.ts +29 -3
- package/dist/modules/order/utils/math.d.ts.map +1 -1
- package/dist/modules/order/utils/math.js +54 -10
- 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 +14 -2
- 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 +1 -1
- 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 +14 -3
- 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.map +1 -1
- package/dist/modules/storage/browser_adapter.js +5 -3
- 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/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 +2 -3
- 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.map +1 -1
- package/dist/scripts/analyze-orders.js +61 -18
- 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 +3 -5
- package/dist/scripts/runner.js.map +1 -1
- package/dist/scripts/sync-version.d.ts +2 -2
- package/dist/scripts/sync-version.js +7 -4
- package/dist/scripts/sync-version.js.map +1 -1
- package/dist/scripts/update.d.ts +1 -1
- package/dist/scripts/update.js +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 +15 -10
- package/docs/COPY_ON_WRITE_MASTER_PLAN.md +9 -9
- package/docs/DEXBOT_COMPARISON.md +19 -19
- package/docs/EVOLUTION.md +18 -44
- package/docs/FUND_MOVEMENT_AND_ACCOUNTING.md +1 -1
- package/docs/GRID_RECALCULATION.md +1 -1
- package/docs/README.md +3 -3
- package/docs/architecture.md +5 -5
- package/docs/developer_guide.md +6 -6
- package/market_adapter/README.md +13 -8
- package/package.json +22 -14
- package/scripts/README.md +33 -7
- package/scripts/clean-dist.js +10 -2
- package/tests/README.md +4 -3
|
@@ -1,37 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
1
3
|
const assert = require('assert');
|
|
2
|
-
const Module = require('module');
|
|
3
4
|
const path = require('path');
|
|
4
|
-
const {
|
|
5
|
+
const { runEsmMockStages, defineEsmMockAbs } = require('../../tests/helpers/esm_mocks');
|
|
6
|
+
|
|
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 */
|
|
11
|
+
}
|
|
5
12
|
|
|
6
|
-
function
|
|
7
|
-
|
|
13
|
+
function registerMock(modulePath: string, exports: any) {
|
|
14
|
+
defineEsmMockAbs(modulePath, Object.keys(exports), exports);
|
|
8
15
|
}
|
|
9
16
|
|
|
10
17
|
async function testClawBitsharesClientNativePathAndConnection() {
|
|
18
|
+
console.log(' bitshares_client native path and connection...');
|
|
19
|
+
|
|
11
20
|
const clawBitsharesPath = require.resolve('../modules/bitshares_client');
|
|
21
|
+
clearModule(clawBitsharesPath);
|
|
12
22
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} finally {
|
|
23
|
-
clearModule(clawBitsharesPath);
|
|
24
|
-
}
|
|
23
|
+
const clawBitshares = require('../modules/bitshares_client');
|
|
24
|
+
|
|
25
|
+
assert.strictEqual(clawBitshares.isConnected(), false, 'initial state should not be connected');
|
|
26
|
+
assert.strictEqual(typeof clawBitshares.BitShares, 'object', 'BitShares proxy should exist');
|
|
27
|
+
assert.strictEqual(typeof clawBitshares.createAccountClient, 'function');
|
|
28
|
+
await assert.rejects(() => clawBitshares.createAccountClient('', 'wif'), /accountName is required/);
|
|
29
|
+
await assert.rejects(() => clawBitshares.createAccountClient('alice', ''), /privateKey is required/);
|
|
30
|
+
|
|
31
|
+
console.log(' PASS');
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
async function testClawBitsharesClientWaitForConnectedTriggersNativeConnect() {
|
|
28
|
-
|
|
35
|
+
console.log(' bitshares_client waitForConnected lazy connect...');
|
|
36
|
+
|
|
29
37
|
const nativePath = require.resolve('../../modules/bitshares-native');
|
|
30
38
|
let connectCalls = 0;
|
|
31
39
|
let nodes: any[] = [];
|
|
32
40
|
let connected = false;
|
|
33
41
|
|
|
34
|
-
|
|
42
|
+
registerMock(nativePath, {
|
|
35
43
|
createChainClient: ({ onStatusChange }: any) => ({
|
|
36
44
|
connect: async () => {
|
|
37
45
|
connectCalls += 1;
|
|
@@ -55,24 +63,24 @@ async function testClawBitsharesClientWaitForConnectedTriggersNativeConnect() {
|
|
|
55
63
|
subscribe: async () => () => {},
|
|
56
64
|
unsubscribe: async () => {},
|
|
57
65
|
}),
|
|
58
|
-
}
|
|
66
|
+
});
|
|
59
67
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
const clawBitsharesPath = require.resolve('../modules/bitshares_client');
|
|
69
|
+
clearModule(clawBitsharesPath);
|
|
70
|
+
const clawBitshares = require('../modules/bitshares_client');
|
|
63
71
|
|
|
64
|
-
|
|
72
|
+
await clawBitshares.waitForConnected(200);
|
|
65
73
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
restoreCachedModule(nativePath, originalNativeEntry);
|
|
72
|
-
}
|
|
74
|
+
assert.strictEqual(connectCalls, 1, 'waitForConnected should initiate a native connect when idle');
|
|
75
|
+
assert.strictEqual(clawBitshares.isConnected(), true, 'client should report connected after lazy connect');
|
|
76
|
+
assert.ok(Array.isArray(clawBitshares.BitShares.node) && clawBitshares.BitShares.node.length > 0, 'default node list should be populated');
|
|
77
|
+
|
|
78
|
+
console.log(' PASS');
|
|
73
79
|
}
|
|
74
80
|
|
|
75
81
|
function testClawRootExportsAvoidSilentCollisions() {
|
|
82
|
+
console.log(' claw root exports...');
|
|
83
|
+
|
|
76
84
|
const clawIndexPath = require.resolve('..');
|
|
77
85
|
clearModule(clawIndexPath);
|
|
78
86
|
|
|
@@ -91,42 +99,20 @@ function testClawRootExportsAvoidSilentCollisions() {
|
|
|
91
99
|
assert.strictEqual(hermesManifest.compatibility.name, 'Hermes');
|
|
92
100
|
assert.strictEqual(openclawManifest.options.runtimeName, 'openclaw');
|
|
93
101
|
assert.strictEqual(openclawManifest.compatibility.name, 'OpenClaw');
|
|
94
|
-
assert.strictEqual(openclawManifest.commandExamples.some((example: any) => example.includes('scripts/claw_bridge.
|
|
102
|
+
assert.strictEqual(openclawManifest.commandExamples.some((example: any) => example.includes('scripts/claw_bridge.js')), true);
|
|
95
103
|
assert.strictEqual(openfangManifest.options.runtimeName, 'openfang');
|
|
96
|
-
assert.strictEqual(openfangManifest.commandExamples.some((example: any) => example.includes('claw_bridge.
|
|
104
|
+
assert.strictEqual(openfangManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
97
105
|
assert.strictEqual(nullManifest.options.runtimeName, 'nullclaw');
|
|
98
|
-
assert.strictEqual(nullManifest.commandExamples.some((example: any) => example.includes('claw_bridge.
|
|
106
|
+
assert.strictEqual(nullManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
99
107
|
assert.strictEqual(manifest.options.runtimeName, 'zeroclaw');
|
|
100
|
-
assert.strictEqual(manifest.commandExamples.some((example: any) => example.includes('claw_bridge.
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function testClawCommandInjectsRuntimeNameViaOption() {
|
|
104
|
-
const clawBridgePath = require.resolve('../modules/claw_bridge');
|
|
105
|
-
const clawInfraPath = require.resolve('../modules/claw_infra');
|
|
106
|
-
|
|
107
|
-
let capturedOptions: any = null;
|
|
108
|
-
const originalClawInfra = setCachedModule(clawInfraPath, {
|
|
109
|
-
createClawInfrastructure: (opts: any) => {
|
|
110
|
-
capturedOptions = opts;
|
|
111
|
-
return {
|
|
112
|
-
runtime: { name: opts.runtime?.name || 'claw-bridge', accountName: null },
|
|
113
|
-
profiles: {},
|
|
114
|
-
market: {}
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
} as any);
|
|
118
|
-
|
|
119
|
-
clearModule(clawBridgePath);
|
|
120
|
-
const { runClawCommand } = require('../modules/claw_bridge');
|
|
108
|
+
assert.strictEqual(manifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
121
109
|
|
|
122
|
-
|
|
123
|
-
assert.strictEqual(capturedOptions.runtime.name, 'openfang', 'runtimeName option should propagate to runtime.name');
|
|
124
|
-
|
|
125
|
-
clearModule(clawBridgePath);
|
|
126
|
-
restoreCachedModule(clawInfraPath, originalClawInfra);
|
|
110
|
+
console.log(' PASS');
|
|
127
111
|
}
|
|
128
112
|
|
|
129
113
|
function testRuntimeSkillTomlQuotesPayloadPlaceholders() {
|
|
114
|
+
console.log(' runtime skill toml quoting...');
|
|
115
|
+
|
|
130
116
|
const { buildRuntimeSkillToml } = require('../modules/claw_skill_md');
|
|
131
117
|
|
|
132
118
|
const toml = buildRuntimeSkillToml(
|
|
@@ -143,9 +129,13 @@ function testRuntimeSkillTomlQuotesPayloadPlaceholders() {
|
|
|
143
129
|
toml.includes("'--profile-root' '/tmp/profile root'"),
|
|
144
130
|
'generated skill commands must shell-quote profile roots with spaces'
|
|
145
131
|
);
|
|
132
|
+
|
|
133
|
+
console.log(' PASS');
|
|
146
134
|
}
|
|
147
135
|
|
|
148
136
|
function testLiquidityPoolWrapperInjectsSharedBitSharesClient() {
|
|
137
|
+
console.log(' liquidity_pools shared client injection...');
|
|
138
|
+
|
|
149
139
|
const bitsharesPath = require.resolve('../modules/bitshares_client');
|
|
150
140
|
const dexbotBridgePath = require.resolve('../modules/dexbot_bridge');
|
|
151
141
|
const liquidityPoolsPath = require.resolve('../modules/liquidity_pools');
|
|
@@ -153,8 +143,8 @@ function testLiquidityPoolWrapperInjectsSharedBitSharesClient() {
|
|
|
153
143
|
let capturedPoolArgs = null;
|
|
154
144
|
let capturedPriceArgs = null;
|
|
155
145
|
|
|
156
|
-
|
|
157
|
-
|
|
146
|
+
registerMock(bitsharesPath, { BitShares: sharedBitShares } as any);
|
|
147
|
+
registerMock(dexbotBridgePath, {
|
|
158
148
|
getDexbot2Root: () => '/tmp',
|
|
159
149
|
loadDexbotOrderSystemUtils: () => ({
|
|
160
150
|
cloneMap: (value: any) => value,
|
|
@@ -190,12 +180,12 @@ function testLiquidityPoolWrapperInjectsSharedBitSharesClient() {
|
|
|
190
180
|
'derivePrice wrapper must inject the shared BitShares client'
|
|
191
181
|
);
|
|
192
182
|
|
|
193
|
-
|
|
194
|
-
restoreCachedModule(dexbotBridgePath, originalDexbotBridge);
|
|
195
|
-
restoreCachedModule(bitsharesPath, originalBitshares);
|
|
183
|
+
console.log(' PASS');
|
|
196
184
|
}
|
|
197
185
|
|
|
198
186
|
async function testDecisionLoopReusesAnalyzerStateForDuplicateMarkets() {
|
|
187
|
+
console.log(' decision_loop analyzer state reuse...');
|
|
188
|
+
|
|
199
189
|
const decisionLoopPath = require.resolve('../modules/decision_loop');
|
|
200
190
|
const discoveryPath = require.resolve('../modules/position_discovery');
|
|
201
191
|
const healthPath = require.resolve('../modules/position_health');
|
|
@@ -230,20 +220,20 @@ async function testDecisionLoopReusesAnalyzerStateForDuplicateMarkets() {
|
|
|
230
220
|
}
|
|
231
221
|
}
|
|
232
222
|
|
|
233
|
-
|
|
223
|
+
registerMock(discoveryPath, {
|
|
234
224
|
discoverPositions: async () => ([
|
|
235
225
|
{ id: 'pos-1', market: 'HONEST.USD/BTS', mpaSymbol: 'HONEST.USD', onChain: { debtAmount: 5 } },
|
|
236
226
|
{ id: 'pos-2', market: 'HONEST.USD/BTS', mpaSymbol: 'HONEST.USD', onChain: { debtAmount: 3 } }
|
|
237
227
|
])
|
|
238
228
|
} as any);
|
|
239
|
-
|
|
229
|
+
registerMock(healthPath, {
|
|
240
230
|
assessPosition: (position: any, trendSignal: any) => ({
|
|
241
231
|
actions: [],
|
|
242
232
|
positionId: position.id,
|
|
243
233
|
trend: trendSignal
|
|
244
234
|
})
|
|
245
235
|
} as any);
|
|
246
|
-
|
|
236
|
+
registerMock(feedPriceSourcePath, {
|
|
247
237
|
fetchTrendInput: async () => {
|
|
248
238
|
trendFetchCount += 1;
|
|
249
239
|
return {
|
|
@@ -253,7 +243,7 @@ async function testDecisionLoopReusesAnalyzerStateForDuplicateMarkets() {
|
|
|
253
243
|
};
|
|
254
244
|
}
|
|
255
245
|
} as any);
|
|
256
|
-
|
|
246
|
+
registerMock(trendAnalyzerPath, { KalmanTrendAnalyzer: FakeTrendAnalyzer } as any);
|
|
257
247
|
clearModule(decisionLoopPath);
|
|
258
248
|
|
|
259
249
|
const { evaluate, resetAnalyzers } = require('../modules/decision_loop');
|
|
@@ -266,14 +256,13 @@ async function testDecisionLoopReusesAnalyzerStateForDuplicateMarkets() {
|
|
|
266
256
|
assert.strictEqual(result.positions[1].trend.premium, -5, 'reused trend signal should come from cached analyzer state');
|
|
267
257
|
|
|
268
258
|
resetAnalyzers();
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
restoreCachedModule(feedPriceSourcePath, originalFeedPriceSource);
|
|
272
|
-
restoreCachedModule(healthPath, originalHealth);
|
|
273
|
-
restoreCachedModule(discoveryPath, originalDiscovery);
|
|
259
|
+
|
|
260
|
+
console.log(' PASS');
|
|
274
261
|
}
|
|
275
262
|
|
|
276
263
|
async function testDecisionLoopReplacesAnalyzerOnConfigChange() {
|
|
264
|
+
console.log(' decision_loop analyzer config replacement...');
|
|
265
|
+
|
|
277
266
|
const decisionLoopPath = require.resolve('../modules/decision_loop');
|
|
278
267
|
const discoveryPath = require.resolve('../modules/position_discovery');
|
|
279
268
|
const healthPath = require.resolve('../modules/position_health');
|
|
@@ -297,18 +286,18 @@ async function testDecisionLoopReplacesAnalyzerOnConfigChange() {
|
|
|
297
286
|
}
|
|
298
287
|
}
|
|
299
288
|
|
|
300
|
-
|
|
289
|
+
registerMock(discoveryPath, {
|
|
301
290
|
discoverPositions: async () => ([
|
|
302
291
|
{ id: 'pos-1', market: 'HONEST.USD/BTS', mpaSymbol: 'HONEST.USD', onChain: { debtAmount: 5 } }
|
|
303
292
|
])
|
|
304
293
|
} as any);
|
|
305
|
-
|
|
294
|
+
registerMock(healthPath, {
|
|
306
295
|
assessPosition: (position: any, trendSignal: any) => ({ actions: [], positionId: position.id, trend: trendSignal })
|
|
307
296
|
} as any);
|
|
308
|
-
|
|
297
|
+
registerMock(feedPriceSourcePath, {
|
|
309
298
|
fetchTrendInput: async () => ({ feedPrice: 100, marketPrice: 95, premium: -5 })
|
|
310
299
|
} as any);
|
|
311
|
-
|
|
300
|
+
registerMock(trendAnalyzerPath, { KalmanTrendAnalyzer: ConfigTrackingAnalyzer } as any);
|
|
312
301
|
clearModule(decisionLoopPath);
|
|
313
302
|
|
|
314
303
|
const { evaluate, resetAnalyzers } = require('../modules/decision_loop');
|
|
@@ -323,18 +312,50 @@ async function testDecisionLoopReplacesAnalyzerOnConfigChange() {
|
|
|
323
312
|
assert.strictEqual(constructionCount, 2, 'changed config should replace the analyzer');
|
|
324
313
|
|
|
325
314
|
resetAnalyzers();
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
restoreCachedModule(feedPriceSourcePath, originalFeedPriceSource);
|
|
329
|
-
restoreCachedModule(healthPath, originalHealth);
|
|
330
|
-
restoreCachedModule(discoveryPath, originalDiscovery);
|
|
315
|
+
|
|
316
|
+
console.log(' PASS');
|
|
331
317
|
}
|
|
332
318
|
|
|
333
319
|
async function testPositionManagerEntryExposesSellPriceInBts() {
|
|
320
|
+
console.log(' position_manager entry sellPriceInBts...');
|
|
321
|
+
|
|
334
322
|
const positionManagerPath = require.resolve('../modules/position_manager');
|
|
335
323
|
const mpaUtilsPath = require.resolve('../modules/mpa_utils');
|
|
336
324
|
|
|
337
|
-
|
|
325
|
+
// ESM hooks turn mock keys into synthetic named re-exports, so every name
|
|
326
|
+
// position_manager statically imports from mpa_utils must exist here. The
|
|
327
|
+
// two helpers beside requireBtsBackedMpa are minimal inline replicas of the
|
|
328
|
+
// real ones (requiring the real module would bypass the mock and poison
|
|
329
|
+
// the module cache with the real instance).
|
|
330
|
+
const blockchainToFloat = (amount: any, precision: any) => Number(amount) / (10 ** precision);
|
|
331
|
+
const computeBtsPerMpa = (settlementPrice: any, mpaAsset: any, backingAsset: any) => {
|
|
332
|
+
const base = settlementPrice?.base;
|
|
333
|
+
const quote = settlementPrice?.quote;
|
|
334
|
+
if (!base || !quote) return null;
|
|
335
|
+
const baseAmount = blockchainToFloat(base.amount, base.asset_id === mpaAsset.id ? mpaAsset.precision : backingAsset.precision);
|
|
336
|
+
const quoteAmount = blockchainToFloat(quote.amount, quote.asset_id === mpaAsset.id ? mpaAsset.precision : backingAsset.precision);
|
|
337
|
+
if (!baseAmount || !quoteAmount) return null;
|
|
338
|
+
if (base.asset_id === backingAsset.id && quote.asset_id === mpaAsset.id) return baseAmount / quoteAmount;
|
|
339
|
+
if (base.asset_id === mpaAsset.id && quote.asset_id === backingAsset.id) return quoteAmount / baseAmount;
|
|
340
|
+
return null;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
registerMock(mpaUtilsPath, {
|
|
344
|
+
computeCallOrderAmounts: (callOrder: any, mpaAsset: any, backingAsset: any, bitassetData: any) => {
|
|
345
|
+
const debtAmount = blockchainToFloat(callOrder.debt, mpaAsset.precision);
|
|
346
|
+
const collateralAmount = blockchainToFloat(callOrder.collateral, backingAsset.precision);
|
|
347
|
+
const btsPerMpa = computeBtsPerMpa(bitassetData?.current_feed?.settlement_price, mpaAsset, backingAsset);
|
|
348
|
+
const debtValueInBts = debtAmount && btsPerMpa ? debtAmount * btsPerMpa : 0;
|
|
349
|
+
const collateralRatio = debtValueInBts > 0 ? collateralAmount / debtValueInBts : null;
|
|
350
|
+
return {
|
|
351
|
+
btsPerMpa,
|
|
352
|
+
collateralAmount: collateralAmount || 0,
|
|
353
|
+
collateralRatio,
|
|
354
|
+
debtAmount: debtAmount || 0,
|
|
355
|
+
debtValueInBts
|
|
356
|
+
};
|
|
357
|
+
},
|
|
358
|
+
getBlockchainToFloat: () => blockchainToFloat,
|
|
338
359
|
requireBtsBackedMpa: async (sym: string) => ({
|
|
339
360
|
backingAsset: { id: '1.3.0', symbol: 'BTS', precision: 5 },
|
|
340
361
|
mpaAsset: { id: `1.3.${sym.length}`, symbol: sym, precision: 5, bitasset_data_id: '2.4.1' }
|
|
@@ -361,16 +382,17 @@ async function testPositionManagerEntryExposesSellPriceInBts() {
|
|
|
361
382
|
assert.strictEqual(position.entry.sellPriceInBts, 1000, 'entry must expose sellPriceInBts for openShort');
|
|
362
383
|
assert.strictEqual(position.entry.priceInBts, 1000, 'entry must also have generic priceInBts from createOrderTracking');
|
|
363
384
|
|
|
364
|
-
|
|
365
|
-
restoreCachedModule(mpaUtilsPath, originalMpaUtils);
|
|
385
|
+
console.log(' PASS');
|
|
366
386
|
}
|
|
367
387
|
|
|
368
388
|
function testClawBridgeRespectsRuntimeNameOption() {
|
|
389
|
+
console.log(' claw_bridge runtime name option...');
|
|
390
|
+
|
|
369
391
|
const clawBridgePath = require.resolve('../modules/claw_bridge');
|
|
370
392
|
const clawInfraPath = require.resolve('../modules/claw_infra');
|
|
371
393
|
|
|
372
394
|
let capturedOptions: any = null;
|
|
373
|
-
|
|
395
|
+
registerMock(clawInfraPath, {
|
|
374
396
|
createClawInfrastructure: (opts: any) => {
|
|
375
397
|
capturedOptions = opts;
|
|
376
398
|
return {
|
|
@@ -393,11 +415,12 @@ function testClawBridgeRespectsRuntimeNameOption() {
|
|
|
393
415
|
createClawBridge({});
|
|
394
416
|
assert.strictEqual(capturedOptions.runtime.name, 'claw-bridge', 'should fall back to claw-bridge');
|
|
395
417
|
|
|
396
|
-
|
|
397
|
-
restoreCachedModule(clawInfraPath, originalClawInfra);
|
|
418
|
+
console.log(' PASS');
|
|
398
419
|
}
|
|
399
420
|
|
|
400
421
|
function testClawBridgeScriptManifestUsesRuntimeSpecificDescriptors() {
|
|
422
|
+
console.log(' claw_bridge script manifest descriptors...');
|
|
423
|
+
|
|
401
424
|
const scriptPath = require.resolve('../scripts/claw_bridge');
|
|
402
425
|
clearModule(scriptPath);
|
|
403
426
|
|
|
@@ -405,48 +428,50 @@ function testClawBridgeScriptManifestUsesRuntimeSpecificDescriptors() {
|
|
|
405
428
|
|
|
406
429
|
const hermesManifest = describeRuntimeManifest('hermes', {});
|
|
407
430
|
assert.strictEqual(hermesManifest.compatibility.name, 'Hermes');
|
|
408
|
-
assert.strictEqual(hermesManifest.commandExamples.some((example: any) => example.includes('scripts/claw_bridge.
|
|
431
|
+
assert.strictEqual(hermesManifest.commandExamples.some((example: any) => example.includes('scripts/claw_bridge.js')), true);
|
|
409
432
|
|
|
410
433
|
const openclawManifest = describeRuntimeManifest('openclaw', {});
|
|
411
434
|
assert.strictEqual(openclawManifest.compatibility.name, 'OpenClaw');
|
|
412
|
-
assert.strictEqual(openclawManifest.commandExamples.some((example: any) => example.includes('scripts/claw_bridge.
|
|
435
|
+
assert.strictEqual(openclawManifest.commandExamples.some((example: any) => example.includes('scripts/claw_bridge.js')), true);
|
|
413
436
|
|
|
414
437
|
const openfangManifest = describeRuntimeManifest('openfang', {});
|
|
415
438
|
assert.strictEqual(openfangManifest.compatibility.name, 'OpenFang');
|
|
416
|
-
assert.strictEqual(openfangManifest.commandExamples.some((example: any) => example.includes('claw_bridge.
|
|
439
|
+
assert.strictEqual(openfangManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
417
440
|
|
|
418
441
|
const nanoclawManifest = describeRuntimeManifest('nanoclaw', {});
|
|
419
442
|
assert.strictEqual(nanoclawManifest.compatibility.name, 'NanoClaw');
|
|
420
|
-
assert.strictEqual(nanoclawManifest.commandExamples.some((example: any) => example.includes('claw_bridge.
|
|
443
|
+
assert.strictEqual(nanoclawManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
421
444
|
|
|
422
445
|
const nullclawManifest = describeRuntimeManifest('nullclaw', {});
|
|
423
446
|
assert.strictEqual(nullclawManifest.compatibility.name, 'NullClaw');
|
|
424
|
-
assert.strictEqual(nullclawManifest.commandExamples.some((example: any) => example.includes('claw_bridge.
|
|
447
|
+
assert.strictEqual(nullclawManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
425
448
|
|
|
426
449
|
const zeroclawManifest = describeRuntimeManifest('zeroclaw', {});
|
|
427
450
|
assert.strictEqual(zeroclawManifest.compatibility.name, 'ZeroClaw');
|
|
428
|
-
assert.strictEqual(zeroclawManifest.commandExamples.some((example: any) => example.includes('claw_bridge.
|
|
451
|
+
assert.strictEqual(zeroclawManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
429
452
|
|
|
430
453
|
const genericManifest = describeRuntimeManifest(null, {});
|
|
431
454
|
assert.strictEqual(genericManifest.compatibility.name, 'Claw');
|
|
432
|
-
assert.strictEqual(genericManifest.commandExamples.some((example: any) => example.includes('scripts/claw_bridge.
|
|
455
|
+
assert.strictEqual(genericManifest.commandExamples.some((example: any) => example.includes('scripts/claw_bridge.js')), true);
|
|
433
456
|
|
|
434
457
|
const payloadSelectedManifest = describeRuntimeManifest(null, { runtimeName: 'openfang' });
|
|
435
458
|
assert.strictEqual(payloadSelectedManifest.compatibility.name, 'OpenFang');
|
|
436
|
-
assert.strictEqual(payloadSelectedManifest.commandExamples.some((example: any) => example.includes('claw_bridge.
|
|
459
|
+
assert.strictEqual(payloadSelectedManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
437
460
|
|
|
438
461
|
const normalizedPayloadManifest = describeRuntimeManifest(null, { runtimeName: ' OpenFang ' });
|
|
439
462
|
assert.strictEqual(normalizedPayloadManifest.compatibility.name, 'OpenFang');
|
|
440
|
-
assert.strictEqual(normalizedPayloadManifest.commandExamples.some((example: any) => example.includes('claw_bridge.
|
|
463
|
+
assert.strictEqual(normalizedPayloadManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
441
464
|
|
|
442
465
|
const hermesPayloadManifest = describeRuntimeManifest(null, { runtimeName: ' Hermes ' });
|
|
443
466
|
assert.strictEqual(hermesPayloadManifest.compatibility.name, 'Hermes');
|
|
444
|
-
assert.strictEqual(hermesPayloadManifest.commandExamples.some((example: any) => example.includes('scripts/claw_bridge.
|
|
467
|
+
assert.strictEqual(hermesPayloadManifest.commandExamples.some((example: any) => example.includes('scripts/claw_bridge.js')), true);
|
|
445
468
|
|
|
446
|
-
|
|
469
|
+
console.log(' PASS');
|
|
447
470
|
}
|
|
448
471
|
|
|
449
472
|
async function testRuntimeCommandManifestUsesRuntimeSpecificDescriptors() {
|
|
473
|
+
console.log(' runClawCommand manifest descriptors...');
|
|
474
|
+
|
|
450
475
|
const { runClawCommand } = require('../modules/claw_bridge');
|
|
451
476
|
|
|
452
477
|
const hermesManifest = await runClawCommand('manifest', { runtimeName: 'hermes' });
|
|
@@ -456,22 +481,53 @@ async function testRuntimeCommandManifestUsesRuntimeSpecificDescriptors() {
|
|
|
456
481
|
|
|
457
482
|
const openfangManifest = await runClawCommand('manifest', { runtimeName: 'openfang' });
|
|
458
483
|
assert.strictEqual(openfangManifest.compatibility.name, 'OpenFang');
|
|
459
|
-
assert.strictEqual(openfangManifest.commandExamples.some((example: any) => example.includes('claw_bridge.
|
|
484
|
+
assert.strictEqual(openfangManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
460
485
|
|
|
461
486
|
const nanoclawManifest = await runClawCommand('manifest', { runtimeName: 'nanoclaw' });
|
|
462
487
|
assert.strictEqual(nanoclawManifest.compatibility.name, 'NanoClaw');
|
|
463
|
-
assert.strictEqual(nanoclawManifest.commandExamples.some((example: any) => example.includes('claw_bridge.
|
|
488
|
+
assert.strictEqual(nanoclawManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
464
489
|
|
|
465
490
|
const nullclawManifest = await runClawCommand('manifest', { runtimeName: 'nullclaw' });
|
|
466
491
|
assert.strictEqual(nullclawManifest.compatibility.name, 'NullClaw');
|
|
467
|
-
assert.strictEqual(nullclawManifest.commandExamples.some((example: any) => example.includes('claw_bridge.
|
|
492
|
+
assert.strictEqual(nullclawManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
468
493
|
|
|
469
494
|
const zeroclawManifest = await runClawCommand('manifest', { runtimeName: 'zeroclaw' });
|
|
470
495
|
assert.strictEqual(zeroclawManifest.compatibility.name, 'ZeroClaw');
|
|
471
|
-
assert.strictEqual(zeroclawManifest.commandExamples.some((example: any) => example.includes('claw_bridge.
|
|
496
|
+
assert.strictEqual(zeroclawManifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')), true);
|
|
497
|
+
|
|
498
|
+
console.log(' PASS');
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
function testClawCommandInjectsRuntimeNameViaOption() {
|
|
502
|
+
console.log(' runClawCommand runtime name injection...');
|
|
503
|
+
|
|
504
|
+
const clawBridgePath = require.resolve('../modules/claw_bridge');
|
|
505
|
+
const clawInfraPath = require.resolve('../modules/claw_infra');
|
|
506
|
+
|
|
507
|
+
let capturedOptions: any = null;
|
|
508
|
+
registerMock(clawInfraPath, {
|
|
509
|
+
createClawInfrastructure: (opts: any) => {
|
|
510
|
+
capturedOptions = opts;
|
|
511
|
+
return {
|
|
512
|
+
runtime: { name: opts.runtime?.name || 'claw-bridge', accountName: null },
|
|
513
|
+
profiles: {},
|
|
514
|
+
market: {}
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
} as any);
|
|
518
|
+
|
|
519
|
+
clearModule(clawBridgePath);
|
|
520
|
+
const { runClawCommand } = require('../modules/claw_bridge');
|
|
521
|
+
|
|
522
|
+
runClawCommand('runtime', { runtimeName: 'openfang' });
|
|
523
|
+
assert.strictEqual(capturedOptions.runtime.name, 'openfang', 'runtimeName option should propagate to runtime.name');
|
|
524
|
+
|
|
525
|
+
console.log(' PASS');
|
|
472
526
|
}
|
|
473
527
|
|
|
474
528
|
function testAccountOrdersBotKeyFallsBackToAssetIds() {
|
|
529
|
+
console.log(' account_orders botKey fallback...');
|
|
530
|
+
|
|
475
531
|
const { createBotKey } = require('../../modules/account_orders');
|
|
476
532
|
|
|
477
533
|
const idOnlyBot = { assetAId: '1.3.1', assetBId: '1.3.0' };
|
|
@@ -489,11 +545,13 @@ function testAccountOrdersBotKeyFallsBackToAssetIds() {
|
|
|
489
545
|
const clawProfiles = require('../modules/dexbot_profiles');
|
|
490
546
|
const clawKey = clawProfiles.createBotKey(idOnlyBot, 0);
|
|
491
547
|
assert.strictEqual(key, clawKey, `account_orders and claw botKey must match for same input, got: ${key} vs ${clawKey}`);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
548
|
|
|
549
|
+
console.log(' PASS');
|
|
550
|
+
}
|
|
495
551
|
|
|
496
552
|
function testBuildQueryScopesAnyPoolByReceivedAsset() {
|
|
553
|
+
console.log(' kibana query pool scoping...');
|
|
554
|
+
|
|
497
555
|
const { buildDirectionalDocumentQuery } = require('../../market_adapter/core/kibana_candles');
|
|
498
556
|
const fieldMap = {
|
|
499
557
|
soldAssetField: 'operation_history.op_object.amount_to_sell.asset_id.keyword',
|
|
@@ -540,10 +598,17 @@ function testBuildQueryScopesAnyPoolByReceivedAsset() {
|
|
|
540
598
|
pairFilters.some((f: any) => f.term?.['operation_history.op_object.min_to_receive.asset_id.keyword'] === '1.3.1'),
|
|
541
599
|
'any-pool query should filter by received asset ID'
|
|
542
600
|
);
|
|
601
|
+
|
|
602
|
+
console.log(' PASS');
|
|
543
603
|
}
|
|
544
604
|
|
|
545
605
|
function testClawDefaultDataPathsStayInsideClawFolder() {
|
|
546
|
-
|
|
606
|
+
console.log(' claw default data paths...');
|
|
607
|
+
|
|
608
|
+
// modules/paths.ts resolveClawDirs keeps claw state inside the repo's
|
|
609
|
+
// claw/ folder regardless of where the code runs from (dist or source),
|
|
610
|
+
// so anchor expectations to that folder rather than to this test file.
|
|
611
|
+
const clawDataDir = path.join(__dirname, '..', '..', '..', 'claw', 'data');
|
|
547
612
|
const clawStateDir = path.join(clawDataDir, 'state');
|
|
548
613
|
const clawInfra = require('../modules/claw_infra');
|
|
549
614
|
const { DEFAULT_STATE_PATH } = require('../modules/position_manager');
|
|
@@ -558,28 +623,89 @@ function testClawDefaultDataPathsStayInsideClawFolder() {
|
|
|
558
623
|
|
|
559
624
|
const stateStore = clawInfra.createStateStore();
|
|
560
625
|
assert.strictEqual(stateStore.filePath, path.join(clawStateDir, 'claw-state.json'));
|
|
561
|
-
}
|
|
562
626
|
|
|
563
|
-
|
|
564
|
-
await testClawBitsharesClientNativePathAndConnection();
|
|
565
|
-
await testClawBitsharesClientWaitForConnectedTriggersNativeConnect();
|
|
566
|
-
testClawRootExportsAvoidSilentCollisions();
|
|
567
|
-
testRuntimeSkillTomlQuotesPayloadPlaceholders();
|
|
568
|
-
testLiquidityPoolWrapperInjectsSharedBitSharesClient();
|
|
569
|
-
await testDecisionLoopReusesAnalyzerStateForDuplicateMarkets();
|
|
570
|
-
await testDecisionLoopReplacesAnalyzerOnConfigChange();
|
|
571
|
-
await testPositionManagerEntryExposesSellPriceInBts();
|
|
572
|
-
testClawBridgeRespectsRuntimeNameOption();
|
|
573
|
-
testClawBridgeScriptManifestUsesRuntimeSpecificDescriptors();
|
|
574
|
-
await testRuntimeCommandManifestUsesRuntimeSpecificDescriptors();
|
|
575
|
-
testClawCommandInjectsRuntimeNameViaOption();
|
|
576
|
-
testAccountOrdersBotKeyFallsBackToAssetIds();
|
|
577
|
-
testBuildQueryScopesAnyPoolByReceivedAsset();
|
|
578
|
-
testClawDefaultDataPathsStayInsideClawFolder();
|
|
579
|
-
console.log('claw regression tests passed');
|
|
627
|
+
console.log(' PASS');
|
|
580
628
|
}
|
|
581
629
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
630
|
+
runEsmMockStages(
|
|
631
|
+
[
|
|
632
|
+
'native-path',
|
|
633
|
+
'wait-connected',
|
|
634
|
+
'root-exports',
|
|
635
|
+
'skill-toml',
|
|
636
|
+
'liquidity-pools',
|
|
637
|
+
'analyzer-reuse',
|
|
638
|
+
'analyzer-replace',
|
|
639
|
+
'position-manager',
|
|
640
|
+
'bridge-runtime-name',
|
|
641
|
+
'script-manifest',
|
|
642
|
+
'runtime-manifest',
|
|
643
|
+
'command-runtime-name',
|
|
644
|
+
'account-orders-bot-key',
|
|
645
|
+
'kibana-query-scopes',
|
|
646
|
+
'default-data-paths'
|
|
647
|
+
],
|
|
648
|
+
async (stage: string) => {
|
|
649
|
+
if (stage === 'native-path') {
|
|
650
|
+
await testClawBitsharesClientNativePathAndConnection();
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
if (stage === 'wait-connected') {
|
|
654
|
+
await testClawBitsharesClientWaitForConnectedTriggersNativeConnect();
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
if (stage === 'root-exports') {
|
|
658
|
+
testClawRootExportsAvoidSilentCollisions();
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
if (stage === 'skill-toml') {
|
|
662
|
+
testRuntimeSkillTomlQuotesPayloadPlaceholders();
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
if (stage === 'liquidity-pools') {
|
|
666
|
+
testLiquidityPoolWrapperInjectsSharedBitSharesClient();
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
if (stage === 'analyzer-reuse') {
|
|
670
|
+
await testDecisionLoopReusesAnalyzerStateForDuplicateMarkets();
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
if (stage === 'analyzer-replace') {
|
|
674
|
+
await testDecisionLoopReplacesAnalyzerOnConfigChange();
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
if (stage === 'position-manager') {
|
|
678
|
+
await testPositionManagerEntryExposesSellPriceInBts();
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
if (stage === 'bridge-runtime-name') {
|
|
682
|
+
testClawBridgeRespectsRuntimeNameOption();
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
if (stage === 'script-manifest') {
|
|
686
|
+
testClawBridgeScriptManifestUsesRuntimeSpecificDescriptors();
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
if (stage === 'runtime-manifest') {
|
|
690
|
+
await testRuntimeCommandManifestUsesRuntimeSpecificDescriptors();
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
if (stage === 'command-runtime-name') {
|
|
694
|
+
testClawCommandInjectsRuntimeNameViaOption();
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
if (stage === 'account-orders-bot-key') {
|
|
698
|
+
testAccountOrdersBotKeyFallsBackToAssetIds();
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
if (stage === 'kibana-query-scopes') {
|
|
702
|
+
testBuildQueryScopesAnyPoolByReceivedAsset();
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
if (stage === 'default-data-paths') {
|
|
706
|
+
testClawDefaultDataPathsStayInsideClawFolder();
|
|
707
|
+
return;
|
|
708
|
+
}
|
|
709
|
+
throw new Error(`Unknown stage: ${stage}`);
|
|
710
|
+
}
|
|
711
|
+
);
|
|
@@ -66,7 +66,7 @@ async function testRuntimeSkillToml() {
|
|
|
66
66
|
assert.ok(toml.includes('name = "bitshares-claw"'));
|
|
67
67
|
const displayName = runtimeName.charAt(0).toUpperCase() + runtimeName.slice(1);
|
|
68
68
|
assert.ok(toml.includes(`${displayName} bridge to the AI-Bot / DEXBot2 BitShares layer`));
|
|
69
|
-
assert.ok(toml.includes('claw_bridge.
|
|
69
|
+
assert.ok(toml.includes('claw_bridge.js'));
|
|
70
70
|
assert.ok(toml.includes('--profile-root'));
|
|
71
71
|
assert.ok(toml.includes('[[tools]]'));
|
|
72
72
|
|
|
@@ -27,7 +27,7 @@ async function main() {
|
|
|
27
27
|
assert.ok(skillText.includes('name = "bitshares-claw"'));
|
|
28
28
|
assert.ok(skillText.includes('NullClaw bridge to the AI-Bot / DEXBot2 BitShares layer'));
|
|
29
29
|
assert.ok(skillText.includes('nullclaw'));
|
|
30
|
-
assert.ok(skillText.includes('claw_bridge.
|
|
30
|
+
assert.ok(skillText.includes('claw_bridge.js'));
|
|
31
31
|
|
|
32
32
|
const bridge = createClawBridge({
|
|
33
33
|
runtime: {
|
|
@@ -42,7 +42,7 @@ async function main() {
|
|
|
42
42
|
assert.strictEqual(manifest.options.runtimeName, 'nullclaw');
|
|
43
43
|
assert.strictEqual(manifest.options.profileRoot, dexbotRoot);
|
|
44
44
|
assert.strictEqual(manifest.compatibility.recommendedTransport, 'skill-toml-or-mcp');
|
|
45
|
-
assert.ok(manifest.commandExamples.some((example: any) => example.includes('claw_bridge.
|
|
45
|
+
assert.ok(manifest.commandExamples.some((example: any) => example.includes('claw_bridge.js')));
|
|
46
46
|
assert.ok(Array.isArray(manifest.tools.catalog));
|
|
47
47
|
assert.strictEqual(runtime.name, 'nullclaw');
|
|
48
48
|
assert.strictEqual(runtime.profileRoot, dexbotRoot);
|
|
@@ -55,4 +55,3 @@ main().catch((err) => {
|
|
|
55
55
|
console.error(err && err.stack ? err.stack : getErrorMessage(err));
|
|
56
56
|
process.exit(1);
|
|
57
57
|
});
|
|
58
|
-
export {};
|