dexbot 1.4.13 → 1.4.15
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/README.md +77 -68
- package/claw/data/positions.json +3391 -1
- package/claw/docs/AI_BOT_LIBRARY_API.md +1 -1
- package/claw/docs/POSITION_HEALTH.md +2 -2
- package/claw/modules/claw_catalog.ts +1 -3
- package/claw/modules/claw_launcher.ts +2 -3
- package/claw/modules/claw_skill_md.ts +1 -1
- package/claw/modules/decision_loop.ts +1 -1
- package/claw/modules/dexbot_profiles.ts +2 -33
- package/claw/modules/feed_price_source.ts +3 -32
- package/claw/modules/launcher_mode_detector.ts +1 -1
- package/claw/modules/mcp_utils.ts +1 -1
- package/claw/modules/mpa_utils.ts +36 -1
- package/claw/modules/position_discovery.ts +1 -28
- package/claw/modules/position_health.ts +1 -20
- package/claw/modules/position_manager.ts +3 -28
- package/claw/modules/skill_utils.ts +1 -1
- package/claw/modules/types.ts +0 -53
- package/claw/package.json +1 -1
- package/claw/runtimes/openclaw-plugin/openclaw.plugin.json +1 -1
- package/claw/runtimes/openclaw-plugin/package.json +1 -1
- package/claw/skills/margin-trading/references/honest-assets.md +1 -1
- package/claw/skills/margin-trading/references/position-management.md +2 -2
- package/claw/skills/shared/references/js-automation-overview.md +2 -2
- package/claw/skills/trend-detection/references/service.md +24 -17
- package/claw/tests/test_claw_bridge.ts +47 -47
- package/claw/tests/test_claw_catalog_and_credentials.ts +9 -9
- package/claw/tests/test_claw_chain_layer.ts +54 -54
- package/claw/tests/test_claw_data_flow.ts +41 -41
- package/claw/tests/test_claw_domain_logic.ts +26 -26
- package/claw/tests/test_claw_manifest_and_matrix.ts +1 -1
- package/claw/tests/test_claw_mcp_transport.ts +16 -16
- package/claw/tests/test_claw_regressions.ts +43 -43
- package/claw/tests/test_claw_skill_generation.ts +1 -1
- package/claw/tests/test_claw_state_store.ts +2 -2
- package/claw/tests/test_dexbot_profiles.ts +4 -4
- package/claw/tests/test_memu_bridge.ts +3 -3
- package/claw/tests/test_nullclaw_tmp_integration.ts +1 -1
- package/claw/tests/test_position_health.ts +2 -2
- package/claw/tests/test_position_manager.ts +18 -18
- package/claw/tests/test_position_manager_watch_health.ts +2 -2
- package/claw/tests/test_short_mpa_strategy.ts +12 -12
- package/dist/analysis/chart_utils.d.ts +13 -1
- package/dist/analysis/chart_utils.d.ts.map +1 -1
- package/dist/analysis/chart_utils.js +16 -1
- package/dist/analysis/chart_utils.js.map +1 -1
- package/dist/analysis/math_utils.d.ts +8 -12
- package/dist/analysis/math_utils.d.ts.map +1 -1
- package/dist/analysis/math_utils.js +9 -75
- package/dist/analysis/math_utils.js.map +1 -1
- package/dist/analysis/tradingview/tradingview_uplot_chart_generator.js +4 -4
- package/dist/dexbot.d.ts.map +1 -1
- package/dist/dexbot.js +54 -35
- package/dist/dexbot.js.map +1 -1
- package/dist/market_adapter/candle_utils.d.ts +18 -1
- package/dist/market_adapter/candle_utils.d.ts.map +1 -1
- package/dist/market_adapter/candle_utils.js +50 -1
- package/dist/market_adapter/candle_utils.js.map +1 -1
- package/dist/market_adapter/core/config_normalizers.js +1 -1
- package/dist/market_adapter/core/config_normalizers.js.map +1 -1
- package/dist/market_adapter/core/kibana_client.d.ts +2 -2
- package/dist/market_adapter/core/kibana_client.js +2 -2
- package/dist/market_adapter/core/kibana_market_candles.d.ts +1 -87
- package/dist/market_adapter/core/kibana_market_candles.d.ts.map +1 -1
- package/dist/market_adapter/core/kibana_market_candles.js +1 -80
- package/dist/market_adapter/core/kibana_market_candles.js.map +1 -1
- package/dist/market_adapter/core/market_adapter_service.d.ts +0 -8
- package/dist/market_adapter/core/market_adapter_service.d.ts.map +1 -1
- package/dist/market_adapter/core/market_adapter_service.js +28 -115
- package/dist/market_adapter/core/market_adapter_service.js.map +1 -1
- package/dist/market_adapter/core/signals/hurst_analyzer.d.ts.map +1 -0
- package/dist/{analysis/trend_detection → market_adapter/core/signals}/hurst_analyzer.js +2 -2
- package/dist/market_adapter/core/signals/hurst_analyzer.js.map +1 -0
- package/dist/{analysis/trend_detection → market_adapter/core/signals}/kalman_trend_analyzer.d.ts +0 -1
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.d.ts.map +1 -0
- package/dist/{analysis/trend_detection → market_adapter/core/signals}/kalman_trend_analyzer.js +2 -4
- package/dist/market_adapter/core/signals/kalman_trend_analyzer.js.map +1 -0
- package/dist/{analysis/trend_detection → market_adapter/core/signals}/kalman_velocity_smoothing.d.ts +25 -4
- package/dist/market_adapter/core/signals/kalman_velocity_smoothing.d.ts.map +1 -0
- package/dist/{analysis/trend_detection → market_adapter/core/signals}/kalman_velocity_smoothing.js +41 -19
- package/dist/market_adapter/core/signals/kalman_velocity_smoothing.js.map +1 -0
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.d.ts.map +1 -0
- package/dist/{analysis/trend_detection → market_adapter/core/signals}/permutation_entropy_analyzer.js +2 -2
- package/dist/market_adapter/core/signals/permutation_entropy_analyzer.js.map +1 -0
- package/dist/market_adapter/core/strategies/ama.d.ts +1 -19
- package/dist/market_adapter/core/strategies/ama.d.ts.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 -13
- package/dist/market_adapter/core/strategies/ama_slope_model.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/ama_slope_model.js +15 -26
- package/dist/market_adapter/core/strategies/ama_slope_model.js.map +1 -1
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts +38 -3
- package/dist/market_adapter/core/strategies/atr/calculator.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/atr/calculator.js +84 -24
- package/dist/market_adapter/core/strategies/atr/calculator.js.map +1 -1
- package/dist/market_adapter/core/strategies/collateral_manager.d.ts +1 -1
- package/dist/market_adapter/core/strategies/collateral_manager.js +1 -1
- package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts +32 -0
- package/dist/market_adapter/core/strategies/dynamic_weight_series.d.ts.map +1 -0
- package/dist/market_adapter/core/strategies/dynamic_weight_series.js +136 -0
- package/dist/market_adapter/core/strategies/dynamic_weight_series.js.map +1 -0
- package/dist/market_adapter/core/strategies/regime_gate.d.ts +6 -21
- package/dist/market_adapter/core/strategies/regime_gate.d.ts.map +1 -1
- package/dist/market_adapter/core/strategies/regime_gate.js +11 -74
- package/dist/market_adapter/core/strategies/regime_gate.js.map +1 -1
- package/dist/market_adapter/core/strategies/regime_interp.d.ts +13 -0
- package/dist/market_adapter/core/strategies/regime_interp.d.ts.map +1 -0
- package/dist/market_adapter/core/strategies/regime_interp.js +74 -0
- package/dist/market_adapter/core/strategies/regime_interp.js.map +1 -0
- package/dist/market_adapter/core/strategies/volatility_shift.d.ts +22 -0
- package/dist/market_adapter/core/strategies/volatility_shift.d.ts.map +1 -0
- package/dist/market_adapter/core/strategies/volatility_shift.js +37 -0
- package/dist/market_adapter/core/strategies/volatility_shift.js.map +1 -0
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js +3 -4
- package/dist/market_adapter/inputs/fetch_cex_synthetic_data.js.map +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts +1 -10
- package/dist/market_adapter/inputs/fetch_lp_data.d.ts.map +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js +1 -1
- package/dist/market_adapter/inputs/fetch_lp_data.js.map +1 -1
- package/dist/market_adapter/lp_chart_core.d.ts.map +1 -1
- package/dist/market_adapter/lp_chart_core.js +0 -10
- package/dist/market_adapter/lp_chart_core.js.map +1 -1
- package/dist/market_adapter/lp_chart_runner.d.ts +1 -16
- package/dist/market_adapter/lp_chart_runner.d.ts.map +1 -1
- package/dist/market_adapter/lp_chart_runner.js +1 -15
- package/dist/market_adapter/lp_chart_runner.js.map +1 -1
- package/dist/market_adapter/market_adapter.d.ts +3 -3
- package/dist/market_adapter/market_adapter.d.ts.map +1 -1
- package/dist/market_adapter/market_adapter.js +6 -8
- package/dist/market_adapter/market_adapter.js.map +1 -1
- package/dist/market_adapter/merge_lp_data.js +5 -5
- package/dist/market_adapter/utils/adapter_client.d.ts +1 -3
- package/dist/market_adapter/utils/adapter_client.d.ts.map +1 -1
- package/dist/market_adapter/utils/adapter_client.js +1 -14
- package/dist/market_adapter/utils/adapter_client.js.map +1 -1
- package/dist/market_adapter/utils/data_discovery.d.ts.map +1 -1
- package/dist/market_adapter/utils/data_discovery.js +1 -2
- package/dist/market_adapter/utils/data_discovery.js.map +1 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts +1 -3
- package/dist/market_adapter/utils/dynamic_grid_snapshot.d.ts.map +1 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js +1 -1
- package/dist/market_adapter/utils/dynamic_grid_snapshot.js.map +1 -1
- package/dist/market_adapter/utils/file_lock.d.ts +10 -2
- package/dist/market_adapter/utils/file_lock.d.ts.map +1 -1
- package/dist/market_adapter/utils/file_lock.js +171 -102
- package/dist/market_adapter/utils/file_lock.js.map +1 -1
- package/dist/market_adapter/utils/native_history.d.ts +1 -9
- package/dist/market_adapter/utils/native_history.d.ts.map +1 -1
- package/dist/market_adapter/utils/native_history.js +1 -21
- package/dist/market_adapter/utils/native_history.js.map +1 -1
- package/dist/modules/account_bots.d.ts +16 -38
- package/dist/modules/account_bots.d.ts.map +1 -1
- package/dist/modules/account_bots.js +16 -38
- package/dist/modules/account_bots.js.map +1 -1
- package/dist/modules/account_orders.d.ts +11 -11
- package/dist/modules/account_orders.d.ts.map +1 -1
- package/dist/modules/account_orders.js +11 -18
- package/dist/modules/account_orders.js.map +1 -1
- package/dist/modules/bitshares_client.d.ts +5 -8
- package/dist/modules/bitshares_client.d.ts.map +1 -1
- package/dist/modules/bitshares_client.js +6 -10
- package/dist/modules/bitshares_client.js.map +1 -1
- package/dist/modules/bots_file_lock.d.ts +8 -5
- package/dist/modules/bots_file_lock.d.ts.map +1 -1
- package/dist/modules/bots_file_lock.js +8 -5
- package/dist/modules/bots_file_lock.js.map +1 -1
- package/dist/modules/chain_keys.d.ts +31 -22
- package/dist/modules/chain_keys.d.ts.map +1 -1
- package/dist/modules/chain_keys.js +31 -22
- package/dist/modules/chain_keys.js.map +1 -1
- package/dist/modules/chain_orders.d.ts +52 -48
- package/dist/modules/chain_orders.d.ts.map +1 -1
- package/dist/modules/chain_orders.js +124 -49
- package/dist/modules/chain_orders.js.map +1 -1
- package/dist/modules/config.d.ts +3 -0
- package/dist/modules/config.d.ts.map +1 -1
- package/dist/modules/config.js +3 -0
- package/dist/modules/config.js.map +1 -1
- package/dist/modules/constants.d.ts +17 -13
- package/dist/modules/constants.d.ts.map +1 -1
- package/dist/modules/constants.js +42 -21
- package/dist/modules/constants.js.map +1 -1
- package/dist/modules/cr_planner.d.ts +2 -1
- package/dist/modules/cr_planner.d.ts.map +1 -1
- package/dist/modules/cr_planner.js +1 -1
- package/dist/modules/cr_planner.js.map +1 -1
- package/dist/modules/credential_policy.d.ts +6 -4
- package/dist/modules/credential_policy.d.ts.map +1 -1
- package/dist/modules/credential_policy.js +6 -4
- package/dist/modules/credential_policy.js.map +1 -1
- package/dist/modules/credit_runtime.d.ts.map +1 -1
- package/dist/modules/credit_runtime.js +4 -8
- package/dist/modules/credit_runtime.js.map +1 -1
- package/dist/modules/dexbot_class.d.ts +33 -88
- package/dist/modules/dexbot_class.d.ts.map +1 -1
- package/dist/modules/dexbot_class.js +36 -68
- package/dist/modules/dexbot_class.js.map +1 -1
- package/dist/modules/dexbot_cow_runtime.d.ts +7 -7
- package/dist/modules/dexbot_cow_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_cow_runtime.js +7 -7
- package/dist/modules/dexbot_cow_runtime.js.map +1 -1
- package/dist/modules/dexbot_credential_client.d.ts +3 -3
- package/dist/modules/dexbot_credential_client.js +3 -3
- package/dist/modules/dexbot_credential_client.js.map +1 -1
- package/dist/modules/dexbot_fill_runtime.d.ts +1 -7
- package/dist/modules/dexbot_fill_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_fill_runtime.js +1 -9
- package/dist/modules/dexbot_fill_runtime.js.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.d.ts.map +1 -1
- package/dist/modules/dexbot_maintenance_runtime.js +3 -1
- package/dist/modules/dexbot_maintenance_runtime.js.map +1 -1
- package/dist/modules/dexbot_state_recovery.d.ts.map +1 -1
- package/dist/modules/dexbot_state_recovery.js +99 -1
- package/dist/modules/dexbot_state_recovery.js.map +1 -1
- package/dist/modules/graceful_shutdown.d.ts +4 -2
- package/dist/modules/graceful_shutdown.d.ts.map +1 -1
- package/dist/modules/graceful_shutdown.js +4 -2
- package/dist/modules/graceful_shutdown.js.map +1 -1
- package/dist/modules/launcher/bot_supervisor.d.ts +1 -1
- package/dist/modules/launcher/bot_supervisor.d.ts.map +1 -1
- package/dist/modules/launcher/bot_supervisor.js +1 -4
- package/dist/modules/launcher/bot_supervisor.js.map +1 -1
- package/dist/modules/launcher/child_env.d.ts.map +1 -1
- package/dist/modules/launcher/child_env.js +3 -0
- package/dist/modules/launcher/child_env.js.map +1 -1
- package/dist/modules/market_adapter_whitelist.d.ts +1 -2
- package/dist/modules/market_adapter_whitelist.d.ts.map +1 -1
- package/dist/modules/market_adapter_whitelist.js +1 -4
- package/dist/modules/market_adapter_whitelist.js.map +1 -1
- package/dist/modules/node_health_cache.d.ts +12 -4
- package/dist/modules/node_health_cache.d.ts.map +1 -1
- package/dist/modules/node_health_cache.js +13 -13
- package/dist/modules/node_health_cache.js.map +1 -1
- package/dist/modules/node_manager.d.ts.map +1 -1
- package/dist/modules/node_manager.js +3 -6
- package/dist/modules/node_manager.js.map +1 -1
- package/dist/modules/order/accounting.d.ts +2 -37
- package/dist/modules/order/accounting.d.ts.map +1 -1
- package/dist/modules/order/accounting.js +2 -64
- package/dist/modules/order/accounting.js.map +1 -1
- package/dist/modules/order/export.d.ts +1 -37
- package/dist/modules/order/export.d.ts.map +1 -1
- package/dist/modules/order/export.js +1 -1
- package/dist/modules/order/export.js.map +1 -1
- package/dist/modules/order/format.d.ts +28 -14
- package/dist/modules/order/format.d.ts.map +1 -1
- package/dist/modules/order/format.js +73 -18
- package/dist/modules/order/format.js.map +1 -1
- package/dist/modules/order/grid.d.ts +11 -5
- package/dist/modules/order/grid.d.ts.map +1 -1
- package/dist/modules/order/grid.js +79 -37
- package/dist/modules/order/grid.js.map +1 -1
- package/dist/modules/order/grid_reconcile_internal.js +2 -2
- package/dist/modules/order/grid_reconcile_internal.js.map +1 -1
- package/dist/modules/order/logger_state.d.ts +3 -45
- package/dist/modules/order/logger_state.d.ts.map +1 -1
- package/dist/modules/order/logger_state.js +3 -55
- package/dist/modules/order/logger_state.js.map +1 -1
- package/dist/modules/order/manager.d.ts +0 -4
- package/dist/modules/order/manager.d.ts.map +1 -1
- package/dist/modules/order/manager.js +3 -9
- package/dist/modules/order/manager.js.map +1 -1
- package/dist/modules/order/sync_engine.d.ts +0 -2
- package/dist/modules/order/sync_engine.d.ts.map +1 -1
- package/dist/modules/order/sync_engine.js +1 -4
- package/dist/modules/order/sync_engine.js.map +1 -1
- package/dist/modules/order/utils/math.d.ts +2 -11
- package/dist/modules/order/utils/math.d.ts.map +1 -1
- package/dist/modules/order/utils/math.js +3 -14
- package/dist/modules/order/utils/math.js.map +1 -1
- package/dist/modules/order/utils/order.d.ts +1 -17
- package/dist/modules/order/utils/order.d.ts.map +1 -1
- package/dist/modules/order/utils/order.js +3 -21
- package/dist/modules/order/utils/order.js.map +1 -1
- package/dist/modules/order/utils/system.d.ts +1 -11
- package/dist/modules/order/utils/system.d.ts.map +1 -1
- package/dist/modules/order/utils/system.js +3 -3
- package/dist/modules/order/utils/system.js.map +1 -1
- package/dist/modules/order/utils/validate.d.ts +1 -26
- package/dist/modules/order/utils/validate.d.ts.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/order/working_grid.d.ts +3 -9
- package/dist/modules/order/working_grid.d.ts.map +1 -1
- package/dist/modules/order/working_grid.js +3 -11
- package/dist/modules/order/working_grid.js.map +1 -1
- package/dist/modules/paths.d.ts +43 -2
- package/dist/modules/paths.d.ts.map +1 -1
- package/dist/modules/paths.js +81 -21
- package/dist/modules/paths.js.map +1 -1
- package/dist/modules/runtime_settings.js +1 -1
- package/dist/modules/runtime_settings.js.map +1 -1
- package/dist/pm2.d.ts +1 -1
- package/dist/pm2.d.ts.map +1 -1
- package/dist/pm2.js +1 -4
- package/dist/pm2.js.map +1 -1
- package/dist/scripts/analyze-orders.d.ts.map +1 -1
- package/dist/scripts/analyze-orders.js +36 -45
- package/dist/scripts/analyze-orders.js.map +1 -1
- package/dist/scripts/sync-version.js +22 -0
- package/dist/scripts/sync-version.js.map +1 -1
- package/ecosystem.config.cjs +32 -0
- package/package.json +4 -1
- package/scripts/README.md +24 -8
- package/scripts/clear-all.sh +39 -12
- package/scripts/clear-logs.sh +1 -1
- package/scripts/clear-market-adapter.sh +3 -3
- package/scripts/clear-orders.sh +1 -1
- package/scripts/create-bot-symlinks.sh +4 -2
- package/scripts/lib/dexbot-paths.sh +63 -0
- package/scripts/reset-settings.sh +1 -1
- package/dist/analysis/trend_detection/hurst_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/hurst_analyzer.js.map +0 -1
- package/dist/analysis/trend_detection/kalman_trend_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/kalman_trend_analyzer.js.map +0 -1
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.d.ts.map +0 -1
- package/dist/analysis/trend_detection/kalman_velocity_smoothing.js.map +0 -1
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.d.ts.map +0 -1
- package/dist/analysis/trend_detection/permutation_entropy_analyzer.js.map +0 -1
- package/dist/market_adapter/index.d.ts +0 -32
- package/dist/market_adapter/index.d.ts.map +0 -1
- package/dist/market_adapter/index.js +0 -39
- package/dist/market_adapter/index.js.map +0 -1
- package/dist/scripts/fix-err-message.d.ts +0 -3
- package/dist/scripts/fix-err-message.d.ts.map +0 -1
- package/dist/scripts/fix-err-message.js +0 -193
- package/dist/scripts/fix-err-message.js.map +0 -1
- /package/dist/{analysis/trend_detection → market_adapter/core/signals}/hurst_analyzer.d.ts +0 -0
- /package/dist/{analysis/trend_detection → market_adapter/core/signals}/permutation_entropy_analyzer.d.ts +0 -0
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
const assert = require('assert');
|
|
4
4
|
const Module = require('module');
|
|
5
5
|
|
|
6
|
-
function clearModule(modulePath) {
|
|
6
|
+
function clearModule(modulePath: string) {
|
|
7
7
|
delete require.cache[modulePath];
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
function registerMock(modulePath, exports) {
|
|
10
|
+
function registerMock(modulePath: string, exports: any) {
|
|
11
11
|
require.cache[modulePath] = {
|
|
12
12
|
id: modulePath,
|
|
13
13
|
filename: modulePath,
|
|
@@ -25,11 +25,11 @@ function createChainDataHarness() {
|
|
|
25
25
|
const feedPath = require.resolve('../modules/feed_price_source');
|
|
26
26
|
|
|
27
27
|
const calls = {
|
|
28
|
-
dbCall: []
|
|
29
|
-
getAsset: [],
|
|
30
|
-
getBackingAsset: [],
|
|
31
|
-
getBitassetData: [],
|
|
32
|
-
getFullAccount: []
|
|
28
|
+
dbCall: [] as Array<{ method: string; args: unknown }>,
|
|
29
|
+
getAsset: [] as string[],
|
|
30
|
+
getBackingAsset: [] as string[],
|
|
31
|
+
getBitassetData: [] as string[],
|
|
32
|
+
getFullAccount: [] as string[]
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
const bts = { id: '1.3.0', precision: 5, symbol: 'BTS' };
|
|
@@ -67,15 +67,15 @@ function createChainDataHarness() {
|
|
|
67
67
|
|
|
68
68
|
registerMock(bridgePath, {
|
|
69
69
|
loadDexbotOrderUtils: () => ({
|
|
70
|
-
blockchainToFloat: (amount, precision) => Number(amount) / (10 ** precision)
|
|
70
|
+
blockchainToFloat: (amount: number, precision: number) => Number(amount) / (10 ** precision)
|
|
71
71
|
}),
|
|
72
72
|
loadDexbotOrderSystemUtils: () => ({
|
|
73
|
-
blockchainToFloat: (amount, precision) => Number(amount) / (10 ** precision)
|
|
73
|
+
blockchainToFloat: (amount: number, precision: number) => Number(amount) / (10 ** precision)
|
|
74
74
|
})
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
registerMock(queriesPath, {
|
|
78
|
-
getAsset: async (symbolOrId) => {
|
|
78
|
+
getAsset: async (symbolOrId: string) => {
|
|
79
79
|
calls.getAsset.push(symbolOrId);
|
|
80
80
|
if (symbolOrId === 'BTS' || symbolOrId === bts.id) {
|
|
81
81
|
return bts;
|
|
@@ -88,7 +88,7 @@ function createChainDataHarness() {
|
|
|
88
88
|
}
|
|
89
89
|
return null;
|
|
90
90
|
},
|
|
91
|
-
getBackingAsset: async (symbolOrId) => {
|
|
91
|
+
getBackingAsset: async (symbolOrId: string) => {
|
|
92
92
|
calls.getBackingAsset.push(symbolOrId);
|
|
93
93
|
if (symbolOrId === honest.id || symbolOrId === honest.symbol) {
|
|
94
94
|
return bts;
|
|
@@ -98,7 +98,7 @@ function createChainDataHarness() {
|
|
|
98
98
|
}
|
|
99
99
|
return null;
|
|
100
100
|
},
|
|
101
|
-
getBitassetData: async (symbolOrId) => {
|
|
101
|
+
getBitassetData: async (symbolOrId: string) => {
|
|
102
102
|
calls.getBitassetData.push(symbolOrId);
|
|
103
103
|
if (symbolOrId === honest.id || symbolOrId === honest.symbol) {
|
|
104
104
|
return {
|
|
@@ -124,14 +124,14 @@ function createChainDataHarness() {
|
|
|
124
124
|
}
|
|
125
125
|
return null;
|
|
126
126
|
},
|
|
127
|
-
getFullAccount: async (accountName) => {
|
|
127
|
+
getFullAccount: async (accountName: string) => {
|
|
128
128
|
calls.getFullAccount.push(accountName);
|
|
129
129
|
if (accountName !== 'alice') {
|
|
130
130
|
return null;
|
|
131
131
|
}
|
|
132
132
|
return clone(account);
|
|
133
133
|
},
|
|
134
|
-
dbCall: async (method, args) => {
|
|
134
|
+
dbCall: async (method: string, args: unknown) => {
|
|
135
135
|
calls.dbCall.push({ method, args: clone(args) });
|
|
136
136
|
if (method === 'get_order_book') {
|
|
137
137
|
return {
|
|
@@ -213,22 +213,22 @@ function createDecisionLoopHarness() {
|
|
|
213
213
|
const discoveryPath = require.resolve('../modules/position_discovery');
|
|
214
214
|
const healthPath = require.resolve('../modules/position_health');
|
|
215
215
|
const feedPath = require.resolve('../modules/feed_price_source');
|
|
216
|
-
const analyzerPath = require.resolve('../../
|
|
216
|
+
const analyzerPath = require.resolve('../../market_adapter/core/signals/kalman_trend_analyzer');
|
|
217
217
|
|
|
218
218
|
const calls = {
|
|
219
|
-
fetchTrendInput: [],
|
|
220
|
-
log: [],
|
|
221
|
-
updates: []
|
|
219
|
+
fetchTrendInput: [] as string[],
|
|
220
|
+
log: [] as string[],
|
|
221
|
+
updates: [] as Array<{ positionId: string; trendSignal: any }>
|
|
222
222
|
};
|
|
223
223
|
|
|
224
224
|
class FakeTrendAnalyzer {
|
|
225
225
|
[key: string]: any;
|
|
226
|
-
constructor(config) {
|
|
226
|
+
constructor(config: any) {
|
|
227
227
|
this.config = config;
|
|
228
228
|
this.updateCount = 0;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
update(marketPrice, feedPrice) {
|
|
231
|
+
update(marketPrice: number, feedPrice: number) {
|
|
232
232
|
this.updateCount += 1;
|
|
233
233
|
this.lastResult = {
|
|
234
234
|
confidence: 80,
|
|
@@ -255,7 +255,7 @@ function createDecisionLoopHarness() {
|
|
|
255
255
|
])
|
|
256
256
|
});
|
|
257
257
|
registerMock(healthPath, {
|
|
258
|
-
assessPosition: (position, trendSignal) => {
|
|
258
|
+
assessPosition: (position: any, trendSignal: any) => {
|
|
259
259
|
calls.updates.push({ positionId: position.id, trendSignal: clone(trendSignal) });
|
|
260
260
|
return {
|
|
261
261
|
actions: position.id === 'pos-1'
|
|
@@ -267,7 +267,7 @@ function createDecisionLoopHarness() {
|
|
|
267
267
|
}
|
|
268
268
|
});
|
|
269
269
|
registerMock(feedPath, {
|
|
270
|
-
fetchTrendInput: async (mpaSymbol) => {
|
|
270
|
+
fetchTrendInput: async (mpaSymbol: string) => {
|
|
271
271
|
calls.fetchTrendInput.push(mpaSymbol);
|
|
272
272
|
if (mpaSymbol === 'HONEST.EUR') {
|
|
273
273
|
throw new Error('feed unavailable');
|
|
@@ -306,7 +306,7 @@ async function testDecisionLoop() {
|
|
|
306
306
|
try {
|
|
307
307
|
const result = await decisionLoop.evaluate('alice', {
|
|
308
308
|
analyzerConfig: { period: 12 },
|
|
309
|
-
logger: (message) => calls.log.push(message)
|
|
309
|
+
logger: (message: string) => calls.log.push(message)
|
|
310
310
|
});
|
|
311
311
|
|
|
312
312
|
assert.strictEqual(result.positionCount, 3);
|
|
@@ -336,19 +336,19 @@ function createKibanaHarness() {
|
|
|
336
336
|
const kibanaPricePath = require.resolve('../modules/kibana_price_source');
|
|
337
337
|
|
|
338
338
|
const calls = {
|
|
339
|
-
getAsset: [],
|
|
340
|
-
marketCandles: []
|
|
341
|
-
marketClosePrices: []
|
|
342
|
-
lpCandles: []
|
|
343
|
-
lpClosePrices: []
|
|
344
|
-
poolAssets: []
|
|
339
|
+
getAsset: [] as string[],
|
|
340
|
+
marketCandles: [] as Array<{ assetA: any; assetB: any; config: any }>,
|
|
341
|
+
marketClosePrices: [] as Array<{ assetA: any; assetB: any; config: any }>,
|
|
342
|
+
lpCandles: [] as Array<{ poolId: any; assetA: any; assetB: any; config: any }>,
|
|
343
|
+
lpClosePrices: [] as Array<{ poolId: any; assetA: any; assetB: any; config: any }>,
|
|
344
|
+
poolAssets: [] as Array<{ poolId: any; config: any }>
|
|
345
345
|
};
|
|
346
346
|
|
|
347
347
|
const bts = { id: '1.3.0', precision: 5, symbol: 'BTS' };
|
|
348
348
|
const honest = { id: '1.3.100', precision: 5, symbol: 'HONEST.USD' };
|
|
349
349
|
|
|
350
350
|
registerMock(chainQueriesPath, {
|
|
351
|
-
getAsset: async (symbolOrId) => {
|
|
351
|
+
getAsset: async (symbolOrId: string) => {
|
|
352
352
|
calls.getAsset.push(symbolOrId);
|
|
353
353
|
if (symbolOrId === 'BTS') {
|
|
354
354
|
return bts;
|
|
@@ -360,25 +360,25 @@ function createKibanaHarness() {
|
|
|
360
360
|
}
|
|
361
361
|
});
|
|
362
362
|
registerMock(marketCandlesPath, {
|
|
363
|
-
getMarketCandles: async (assetA, assetB, config) => {
|
|
363
|
+
getMarketCandles: async (assetA: any, assetB: any, config: any) => {
|
|
364
364
|
calls.marketCandles.push({ assetA, assetB, config: clone(config) });
|
|
365
365
|
return [[1, 2, 2, 2, 2, 10]];
|
|
366
366
|
},
|
|
367
|
-
getMarketClosePrices: async (assetA, assetB, config) => {
|
|
367
|
+
getMarketClosePrices: async (assetA: any, assetB: any, config: any) => {
|
|
368
368
|
calls.marketClosePrices.push({ assetA, assetB, config: clone(config) });
|
|
369
369
|
return [2];
|
|
370
370
|
}
|
|
371
371
|
});
|
|
372
372
|
registerMock(lpSourcePath, {
|
|
373
|
-
discoverPoolAssets: async (poolId, config) => {
|
|
373
|
+
discoverPoolAssets: async (poolId: any, config: any) => {
|
|
374
374
|
calls.poolAssets.push({ poolId, config: clone(config) });
|
|
375
375
|
return ['1.3.0', '1.3.100'];
|
|
376
376
|
},
|
|
377
|
-
getLpCandlesForPool: async (poolId, assetA, assetB, config) => {
|
|
377
|
+
getLpCandlesForPool: async (poolId: any, assetA: any, assetB: any, config: any) => {
|
|
378
378
|
calls.lpCandles.push({ poolId, assetA, assetB, config: clone(config) });
|
|
379
379
|
return [[2, 3, 3, 3, 3, 4]];
|
|
380
380
|
},
|
|
381
|
-
getLpClosePricesForPool: async (poolId, assetA, assetB, config) => {
|
|
381
|
+
getLpClosePricesForPool: async (poolId: any, assetA: any, assetB: any, config: any) => {
|
|
382
382
|
calls.lpClosePrices.push({ poolId, assetA, assetB, config: clone(config) });
|
|
383
383
|
return [3];
|
|
384
384
|
}
|
|
@@ -440,8 +440,8 @@ function createLiquidityHarness() {
|
|
|
440
440
|
const poolsPath = require.resolve('../modules/liquidity_pools');
|
|
441
441
|
const sharedBitShares = { name: 'shared-bitshares-client' };
|
|
442
442
|
const calls = {
|
|
443
|
-
pool: null,
|
|
444
|
-
price: null
|
|
443
|
+
pool: null as any,
|
|
444
|
+
price: null as any
|
|
445
445
|
};
|
|
446
446
|
|
|
447
447
|
registerMock(bitsharesPath, {
|
|
@@ -450,13 +450,13 @@ function createLiquidityHarness() {
|
|
|
450
450
|
registerMock(bridgePath, {
|
|
451
451
|
getDexbot2Root: () => '/tmp',
|
|
452
452
|
loadDexbotOrderSystemUtils: () => ({
|
|
453
|
-
cloneMap: (value) => value,
|
|
454
|
-
deepFreeze: (value) => value,
|
|
455
|
-
derivePoolPrice: (...args) => {
|
|
453
|
+
cloneMap: (value: any) => value,
|
|
454
|
+
deepFreeze: (value: any) => value,
|
|
455
|
+
derivePoolPrice: (...args: any[]) => {
|
|
456
456
|
calls.pool = args;
|
|
457
457
|
return 'pool-price';
|
|
458
458
|
},
|
|
459
|
-
derivePrice: (...args) => {
|
|
459
|
+
derivePrice: (...args: any[]) => {
|
|
460
460
|
calls.price = args;
|
|
461
461
|
return 'derived-price';
|
|
462
462
|
},
|
|
@@ -5,11 +5,11 @@ const fs = require('fs/promises');
|
|
|
5
5
|
const os = require('os');
|
|
6
6
|
const path = require('path');
|
|
7
7
|
|
|
8
|
-
function clearModule(modulePath) {
|
|
8
|
+
function clearModule(modulePath: string) {
|
|
9
9
|
delete require.cache[modulePath];
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
function registerMock(modulePath, exports) {
|
|
12
|
+
function registerMock(modulePath: string, exports: any) {
|
|
13
13
|
require.cache[modulePath] = {
|
|
14
14
|
id: modulePath,
|
|
15
15
|
filename: modulePath,
|
|
@@ -26,12 +26,12 @@ function createHonestHarness(options: any = {}) {
|
|
|
26
26
|
const poolsPath = require.resolve('../modules/liquidity_pools');
|
|
27
27
|
|
|
28
28
|
const calls = {
|
|
29
|
-
derivePoolPrice: [],
|
|
30
|
-
getAsset: [],
|
|
31
|
-
getBackingAsset: [],
|
|
32
|
-
getBitassetData: [],
|
|
33
|
-
getCallOrders: [],
|
|
34
|
-
listAssets: []
|
|
29
|
+
derivePoolPrice: [] as any[],
|
|
30
|
+
getAsset: [] as string[],
|
|
31
|
+
getBackingAsset: [] as string[],
|
|
32
|
+
getBitassetData: [] as string[],
|
|
33
|
+
getCallOrders: [] as any[],
|
|
34
|
+
listAssets: [] as any[]
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
const coreAsset = { id: '1.3.0', precision: 5, symbol: 'BTS' };
|
|
@@ -62,7 +62,7 @@ function createHonestHarness(options: any = {}) {
|
|
|
62
62
|
];
|
|
63
63
|
|
|
64
64
|
registerMock(queriesPath, {
|
|
65
|
-
getAsset: async (symbolOrId) => {
|
|
65
|
+
getAsset: async (symbolOrId: string) => {
|
|
66
66
|
calls.getAsset.push(symbolOrId);
|
|
67
67
|
if (symbolOrId === 'BTS' || symbolOrId === '1.3.0') {
|
|
68
68
|
return coreAsset;
|
|
@@ -78,11 +78,11 @@ function createHonestHarness(options: any = {}) {
|
|
|
78
78
|
}
|
|
79
79
|
return null;
|
|
80
80
|
},
|
|
81
|
-
getBackingAsset: async (assetId) => {
|
|
81
|
+
getBackingAsset: async (assetId: string) => {
|
|
82
82
|
calls.getBackingAsset.push(assetId);
|
|
83
83
|
return coreAsset;
|
|
84
84
|
},
|
|
85
|
-
getBitassetData: async (assetId) => {
|
|
85
|
+
getBitassetData: async (assetId: string) => {
|
|
86
86
|
calls.getBitassetData.push(assetId);
|
|
87
87
|
return {
|
|
88
88
|
current_feed_publication_time: `2026-03-31T00:00:0${assetId === '1.3.100' ? '1' : assetId === '1.3.101' ? '2' : '3'}`,
|
|
@@ -94,18 +94,18 @@ function createHonestHarness(options: any = {}) {
|
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
},
|
|
97
|
-
getCallOrders: async (assetId, limit) => {
|
|
97
|
+
getCallOrders: async (assetId: string, limit: any) => {
|
|
98
98
|
calls.getCallOrders.push({ assetId, limit });
|
|
99
99
|
return [{ id: `${assetId}-call-1` }];
|
|
100
100
|
},
|
|
101
|
-
listAssets: async (lowerBound, limit) => {
|
|
101
|
+
listAssets: async (lowerBound: string, limit: any) => {
|
|
102
102
|
calls.listAssets.push({ lowerBound, limit });
|
|
103
103
|
return listAssetPages.shift() || [];
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
106
|
|
|
107
107
|
registerMock(poolsPath, {
|
|
108
|
-
derivePoolPrice: async (assetA, assetB, options) => {
|
|
108
|
+
derivePoolPrice: async (assetA: any, assetB: any, options: any) => {
|
|
109
109
|
calls.derivePoolPrice.push({ assetA, assetB, options: clone(options) });
|
|
110
110
|
if (typeof options.failPair === 'string' && `${assetA}/${assetB}` === options.failPair) {
|
|
111
111
|
throw new Error('pair unavailable');
|
|
@@ -229,7 +229,7 @@ async function testHonestEcosystemPaginationAndUnresolvedPair() {
|
|
|
229
229
|
});
|
|
230
230
|
|
|
231
231
|
assert.deepStrictEqual(
|
|
232
|
-
loaded.assets.map((asset) => asset.symbol),
|
|
232
|
+
loaded.assets.map((asset: any) => asset.symbol),
|
|
233
233
|
['HONEST.MONEY', 'HONEST.USD', 'HONEST.EUR']
|
|
234
234
|
);
|
|
235
235
|
assert.deepStrictEqual(calls.listAssets, [
|
|
@@ -260,10 +260,10 @@ function createPositionManagerHarness() {
|
|
|
260
260
|
const shortStrategyPath = require.resolve('../modules/short_mpa_strategy');
|
|
261
261
|
|
|
262
262
|
const calls = {
|
|
263
|
-
savedStates: [],
|
|
264
|
-
syncPosition: [],
|
|
265
|
-
listenForFills: [],
|
|
266
|
-
onFill: []
|
|
263
|
+
savedStates: [] as any[],
|
|
264
|
+
syncPosition: [] as string[],
|
|
265
|
+
listenForFills: [] as any[],
|
|
266
|
+
onFill: [] as any[]
|
|
267
267
|
};
|
|
268
268
|
|
|
269
269
|
const coreAsset = { id: '1.3.0', precision: 5, symbol: 'BTS' };
|
|
@@ -282,12 +282,12 @@ function createPositionManagerHarness() {
|
|
|
282
282
|
|
|
283
283
|
registerMock(bridgePath, {
|
|
284
284
|
loadDexbotOrderUtils: () => ({
|
|
285
|
-
blockchainToFloat: (amount, precision) => Number(amount) / (10 ** precision)
|
|
285
|
+
blockchainToFloat: (amount: number, precision: number) => Number(amount) / (10 ** precision)
|
|
286
286
|
})
|
|
287
287
|
});
|
|
288
288
|
|
|
289
289
|
registerMock(profilesPath, {
|
|
290
|
-
writeJsonFileAtomic: async (filePath, state) => {
|
|
290
|
+
writeJsonFileAtomic: async (filePath: string, state: any) => {
|
|
291
291
|
calls.savedStates.push({
|
|
292
292
|
filePath,
|
|
293
293
|
state: clone(state)
|
|
@@ -296,7 +296,7 @@ function createPositionManagerHarness() {
|
|
|
296
296
|
});
|
|
297
297
|
|
|
298
298
|
registerMock(actionsPath, {
|
|
299
|
-
listenForFills: async (accountName, callback) => {
|
|
299
|
+
listenForFills: async (accountName: string, callback: any) => {
|
|
300
300
|
calls.listenForFills.push({ accountName, callback });
|
|
301
301
|
return async () => {
|
|
302
302
|
calls.listenForFills.push({ accountName, callback, type: 'unsubscribe' });
|
|
@@ -311,7 +311,7 @@ function createPositionManagerHarness() {
|
|
|
311
311
|
});
|
|
312
312
|
|
|
313
313
|
registerMock(queriesPath, {
|
|
314
|
-
getAsset: async (symbolOrId) => {
|
|
314
|
+
getAsset: async (symbolOrId: string) => {
|
|
315
315
|
if (symbolOrId === 'HONEST.USD' || symbolOrId === '1.3.100') {
|
|
316
316
|
return mpaAsset;
|
|
317
317
|
}
|
|
@@ -359,7 +359,7 @@ function createPositionManagerHarness() {
|
|
|
359
359
|
},
|
|
360
360
|
manager,
|
|
361
361
|
mpaAsset,
|
|
362
|
-
setAccountSnapshot(nextSnapshot) {
|
|
362
|
+
setAccountSnapshot(nextSnapshot: any) {
|
|
363
363
|
accountSnapshot = clone(nextSnapshot);
|
|
364
364
|
}
|
|
365
365
|
};
|
|
@@ -411,12 +411,12 @@ async function testPositionManager() {
|
|
|
411
411
|
assert.strictEqual(synced.onChain.trackedOrders.entry.orderId, '1.7.1');
|
|
412
412
|
assert.strictEqual(synced.onChain.trackedOrders.entry.sellAmountRemaining, 5);
|
|
413
413
|
|
|
414
|
-
manager.syncPosition = async (positionId) => {
|
|
414
|
+
manager.syncPosition = async (positionId: string) => {
|
|
415
415
|
calls.syncPosition.push(positionId);
|
|
416
416
|
return manager.getPosition(positionId);
|
|
417
417
|
};
|
|
418
418
|
|
|
419
|
-
const unsubscribe = await manager.watchAccount('alice', async (position, fill) => {
|
|
419
|
+
const unsubscribe = await manager.watchAccount('alice', async (position: any, fill: any) => {
|
|
420
420
|
calls.onFill.push({ fill, position });
|
|
421
421
|
});
|
|
422
422
|
|
|
@@ -13,7 +13,7 @@ function testRuntimeMatrix() {
|
|
|
13
13
|
const all = matrix.listSupportedClawRuntimes();
|
|
14
14
|
assert.ok(all.length >= 9);
|
|
15
15
|
|
|
16
|
-
const names = all.map((r) => r.runtime);
|
|
16
|
+
const names = all.map((r: any) => r.runtime);
|
|
17
17
|
assert.deepStrictEqual(names, ['openclaw', 'hermes', 'openfang', 'nanobot', 'picoclaw', 'nanoclaw', 'zeroclaw', 'nullclaw', 'memu']);
|
|
18
18
|
|
|
19
19
|
// Each entry is a defensive clone — mutations must not affect the registry
|
|
@@ -9,17 +9,17 @@ const path = require('path');
|
|
|
9
9
|
const { isDistCodeRoot } = require('../../modules/launcher/runtime_entry');
|
|
10
10
|
const mcpServer = require('../scripts/claw_mcp_server');
|
|
11
11
|
|
|
12
|
-
function encodeNewlineMessage(message) {
|
|
12
|
+
function encodeNewlineMessage(message: any) {
|
|
13
13
|
return `${JSON.stringify(message)}\n`;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
function shellQuote(value) {
|
|
16
|
+
function shellQuote(value: any) {
|
|
17
17
|
return `'${String(value).replace(/'/g, `'\"'\"'`)}'`;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
async function testParserAcceptsJsonlAcrossChunksAndSingleBuffer() {
|
|
21
|
-
const seen = [];
|
|
22
|
-
const parser = mcpServer.createMessageParser((message) => {
|
|
21
|
+
const seen: any[] = [];
|
|
22
|
+
const parser = mcpServer.createMessageParser((message: any) => {
|
|
23
23
|
seen.push(message);
|
|
24
24
|
});
|
|
25
25
|
|
|
@@ -31,7 +31,7 @@ async function testParserAcceptsJsonlAcrossChunksAndSingleBuffer() {
|
|
|
31
31
|
capabilities: {},
|
|
32
32
|
clientInfo: {
|
|
33
33
|
name: 'claw-mcp-transport-test',
|
|
34
|
-
version: '1.4.
|
|
34
|
+
version: '1.4.15'
|
|
35
35
|
},
|
|
36
36
|
protocolVersion: '2024-11-05'
|
|
37
37
|
}
|
|
@@ -66,8 +66,8 @@ async function testParserAcceptsJsonlAcrossChunksAndSingleBuffer() {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
async function testParserIgnoresLegacyContentLengthFrames() {
|
|
69
|
-
const seen = [];
|
|
70
|
-
const parser = mcpServer.createMessageParser((message) => {
|
|
69
|
+
const seen: any[] = [];
|
|
70
|
+
const parser = mcpServer.createMessageParser((message: any) => {
|
|
71
71
|
seen.push(message);
|
|
72
72
|
});
|
|
73
73
|
|
|
@@ -84,7 +84,7 @@ async function testParserIgnoresLegacyContentLengthFrames() {
|
|
|
84
84
|
|
|
85
85
|
async function testHandleRequestEmitsNewlineJson() {
|
|
86
86
|
const repoRoot = path.resolve(__dirname, '..', '..');
|
|
87
|
-
const captured = [];
|
|
87
|
+
const captured: any[] = [];
|
|
88
88
|
const originalWrite = process.stdout.write;
|
|
89
89
|
|
|
90
90
|
process.stdout.write = ((chunk: any, encoding: any, callback: any) => {
|
|
@@ -132,17 +132,17 @@ async function testHandleRequestEmitsNewlineJson() {
|
|
|
132
132
|
assert.strictEqual(responses[1].id, 2);
|
|
133
133
|
assert.ok(Array.isArray(responses[1].result.tools), 'tools/list should return a tool list');
|
|
134
134
|
assert.ok(
|
|
135
|
-
responses[1].result.tools.some((tool) => tool.name === 'claw_runtime'),
|
|
135
|
+
responses[1].result.tools.some((tool: any) => tool.name === 'claw_runtime'),
|
|
136
136
|
'tools/list should include claw_runtime'
|
|
137
137
|
);
|
|
138
138
|
assert.strictEqual(
|
|
139
|
-
responses[1].result.tools.some((tool) => String(tool.name).startsWith('mcp_claw_')),
|
|
139
|
+
responses[1].result.tools.some((tool: any) => String(tool.name).startsWith('mcp_claw_')),
|
|
140
140
|
false,
|
|
141
141
|
'tools/list should expose the raw claw_* tool ids from the MCP server'
|
|
142
142
|
);
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
function runServerProcess(input) {
|
|
145
|
+
function runServerProcess(input: any) {
|
|
146
146
|
const repoRoot = path.resolve(__dirname, '..', '..');
|
|
147
147
|
const clawRoot = path.resolve(__dirname, '..');
|
|
148
148
|
const _isDist = isDistCodeRoot(path.dirname(__dirname));
|
|
@@ -182,7 +182,7 @@ async function testMainEntrypointHandlesRealProcessInitialize() {
|
|
|
182
182
|
capabilities: {},
|
|
183
183
|
clientInfo: {
|
|
184
184
|
name: 'claw-mcp-transport-test',
|
|
185
|
-
version: '1.4.
|
|
185
|
+
version: '1.4.15'
|
|
186
186
|
},
|
|
187
187
|
protocolVersion: '2024-11-05'
|
|
188
188
|
}
|
|
@@ -204,9 +204,9 @@ async function testMainEntrypointHandlesRealProcessInitialize() {
|
|
|
204
204
|
|
|
205
205
|
const responses = run.stdout
|
|
206
206
|
.split('\n')
|
|
207
|
-
.map((line) => line.trim())
|
|
207
|
+
.map((line: any) => line.trim())
|
|
208
208
|
.filter((x: any) => x)
|
|
209
|
-
.map((line) => JSON.parse(line));
|
|
209
|
+
.map((line: any) => JSON.parse(line));
|
|
210
210
|
|
|
211
211
|
assert.strictEqual(responses.length, 2, 'expected two JSON-RPC responses from the entrypoint');
|
|
212
212
|
assert.strictEqual(responses[0].id, 1);
|
|
@@ -214,11 +214,11 @@ async function testMainEntrypointHandlesRealProcessInitialize() {
|
|
|
214
214
|
assert.strictEqual(responses[1].id, 2);
|
|
215
215
|
assert.ok(Array.isArray(responses[1].result.tools), 'tools/list should return a tool array');
|
|
216
216
|
assert.ok(
|
|
217
|
-
responses[1].result.tools.some((tool) => tool.name === 'claw_manifest'),
|
|
217
|
+
responses[1].result.tools.some((tool: any) => tool.name === 'claw_manifest'),
|
|
218
218
|
'tools/list should include claw_manifest'
|
|
219
219
|
);
|
|
220
220
|
assert.strictEqual(
|
|
221
|
-
responses[1].result.tools.some((tool) => String(tool.name).startsWith('mcp_claw_')),
|
|
221
|
+
responses[1].result.tools.some((tool: any) => String(tool.name).startsWith('mcp_claw_')),
|
|
222
222
|
false,
|
|
223
223
|
'entrypoint should expose raw claw_* tool ids from the MCP server'
|
|
224
224
|
);
|