@vtxmacro/cli 2026.10.47 → 2026.10.48
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/bin/exo-harness.ts +24 -8
- package/bin/vtx-mcp.js +26 -10
- package/bin/vtx-service-bootstrap.js +25 -9
- package/bin/vtx-service-launcher.js +24 -8
- package/bin/vtx.js +277 -119
- package/package.json +1 -1
package/bin/exo-harness.ts
CHANGED
|
@@ -71,6 +71,30 @@ var SECONDS_PER_AI_COST_ESTIMATE_PERIOD = SECONDS_PER_DAY * AI_COST_ESTIMATE_PER
|
|
|
71
71
|
var INFERENCE_HOST_MODEL_ID_MAX_CHARS = 256;
|
|
72
72
|
var RETRY_AFTER_HEADER_MAX_CHARS = 128;
|
|
73
73
|
var EXO_POLICY_MAX_TOOL_ROUNDS = 64;
|
|
74
|
+
var HYPERLIQUID_EXCHANGE_SPECIFICATION = {
|
|
75
|
+
// Chain ID of the phantom-agent EIP-712 domain L1 actions sign.
|
|
76
|
+
l1_signing_chain_id: 1337,
|
|
77
|
+
// A signed action hash appends the nonce (and expiresAfter) as big-endian uint64.
|
|
78
|
+
action_nonce_bytes: 8,
|
|
79
|
+
// Largest atomic order group VTX sends.
|
|
80
|
+
max_orders_per_batch: 16,
|
|
81
|
+
// A positionTpsl group is exactly one stop-loss and one take-profit order.
|
|
82
|
+
position_tpsl_order_count: 2,
|
|
83
|
+
// Prices carry at most this many significant figures...
|
|
84
|
+
price_significant_figures: 5,
|
|
85
|
+
// ...unless they are integers at or above this, which keep every digit.
|
|
86
|
+
integer_price_minimum: 1e5,
|
|
87
|
+
// A perp price has at most this many decimals minus the asset's szDecimals.
|
|
88
|
+
perp_price_max_decimals: 6,
|
|
89
|
+
// A HIP-3 builder-DEX asset ID is base + dex index * stride + index in meta.
|
|
90
|
+
hip3_asset_id_base: 1e5,
|
|
91
|
+
hip3_asset_id_dex_stride: 1e4,
|
|
92
|
+
// A trailing stop's percent retracement carries at most this many decimals.
|
|
93
|
+
trailing_retracement_pct_max_decimals: 3,
|
|
94
|
+
// Good-til-cancelled time in force as the order wire spells it.
|
|
95
|
+
good_til_cancelled_time_in_force: "Gtc"
|
|
96
|
+
};
|
|
97
|
+
var HYPERLIQUID_TIF_GTC = HYPERLIQUID_EXCHANGE_SPECIFICATION.good_til_cancelled_time_in_force;
|
|
74
98
|
|
|
75
99
|
// lib/runtime-policy.generated.json
|
|
76
100
|
var runtime_policy_generated_default = {
|
|
@@ -468,8 +492,6 @@ var runtime_policy_generated_default = {
|
|
|
468
492
|
observed_activity_recent_ms: 8e3,
|
|
469
493
|
startup_hold_activation_gap_ms: 9e4,
|
|
470
494
|
hidden_ticker_update_interval_ms: 16,
|
|
471
|
-
client_close_fill_sync_attempts: 3,
|
|
472
|
-
client_close_fill_sync_retry_step_ms: 300,
|
|
473
495
|
post_leverage_update_order_delay_ms: 250,
|
|
474
496
|
takeover_telemetry_error_chars: 500,
|
|
475
497
|
takeover_telemetry_error_name_chars: 120,
|
|
@@ -791,7 +813,6 @@ var runtime_policy_generated_default = {
|
|
|
791
813
|
protective_actions: {
|
|
792
814
|
adoption_request_timeout_milliseconds: 2e4,
|
|
793
815
|
idle_recheck_seconds: 60,
|
|
794
|
-
attention_refresh_seconds: 60,
|
|
795
816
|
evidence_max_items: 32,
|
|
796
817
|
evidence_shared_read_seconds: 10,
|
|
797
818
|
retry_delay_seconds: 15,
|
|
@@ -921,10 +942,6 @@ var runtime_policy_generated_default = {
|
|
|
921
942
|
},
|
|
922
943
|
defaults: {
|
|
923
944
|
server_ai_max_slippage: 5
|
|
924
|
-
},
|
|
925
|
-
risk: {
|
|
926
|
-
max_order_notional: 5e3,
|
|
927
|
-
max_position_notional: 1e4
|
|
928
945
|
}
|
|
929
946
|
},
|
|
930
947
|
agent_cli: {
|
|
@@ -1190,7 +1207,6 @@ var runtime_policy_generated_default = {
|
|
|
1190
1207
|
capacity_recovery_weight_per_minute: 120,
|
|
1191
1208
|
background_floor_weight: 120,
|
|
1192
1209
|
background_admission_wait_seconds: 90,
|
|
1193
|
-
cooldown_seconds: 60,
|
|
1194
1210
|
metadata_ttl_seconds: 300,
|
|
1195
1211
|
user_fees_ttl_seconds: 300,
|
|
1196
1212
|
account_mode_ttl_seconds: 30,
|
package/bin/vtx-mcp.js
CHANGED
|
@@ -43,12 +43,12 @@ var init_define_VTX_PI_MODEL_POLICY = __esm({
|
|
|
43
43
|
var agent_cli_release_default;
|
|
44
44
|
var init_agent_cli_release = __esm({
|
|
45
45
|
"agent-cli-release.json"() {
|
|
46
|
-
agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.
|
|
46
|
+
agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.48", codex_package_name: "@openai/codex", codex_version: "0.155.0", copilot_sdk_package_name: "@github/copilot-sdk", copilot_sdk_version: "1.0.0-beta.8", copilot_cli_package_name: "@github/copilot", copilot_cli_version: "1.0.80", deepseek_harness_version: "0.1.1-rc.2", deepseek_harness_packages: ["@deepseek-ai/dsh-agent", "@deepseek-ai/dsh-agent-instructions", "@deepseek-ai/dsh-agent-loop", "@deepseek-ai/dsh-agent-spine-demo", "@deepseek-ai/dsh-anonymous-user-id", "@deepseek-ai/dsh-atomic-write", "@deepseek-ai/dsh-attachment", "@deepseek-ai/dsh-brand", "@deepseek-ai/dsh-code-runtime", "@deepseek-ai/dsh-credentials", "@deepseek-ai/dsh-fs", "@deepseek-ai/dsh-goal", "@deepseek-ai/dsh-goal-round-driver", "@deepseek-ai/dsh-home-paths", "@deepseek-ai/dsh-invariants", "@deepseek-ai/dsh-jobs", "@deepseek-ai/dsh-jobs-local", "@deepseek-ai/dsh-launch-environment", "@deepseek-ai/dsh-llm", "@deepseek-ai/dsh-llm-deepseek", "@deepseek-ai/dsh-llm-retry", "@deepseek-ai/dsh-output-retention", "@deepseek-ai/dsh-sandbox", "@deepseek-ai/dsh-sandbox-policy", "@deepseek-ai/dsh-scope", "@deepseek-ai/dsh-session", "@deepseek-ai/dsh-session-checkpoint-policy", "@deepseek-ai/dsh-session-persistence", "@deepseek-ai/dsh-session-persistence-jsonl", "@deepseek-ai/dsh-session-projection", "@deepseek-ai/dsh-session-title", "@deepseek-ai/dsh-settings", "@deepseek-ai/dsh-shell", "@deepseek-ai/dsh-shell-env", "@deepseek-ai/dsh-skill", "@deepseek-ai/dsh-skill-filesystem", "@deepseek-ai/dsh-subprocess", "@deepseek-ai/dsh-system-prompt", "@deepseek-ai/dsh-timeout", "@deepseek-ai/dsh-tool-bash", "@deepseek-ai/dsh-tool-goal", "@deepseek-ai/dsh-tool-jobs", "@deepseek-ai/dsh-tool-skill", "@deepseek-ai/dsh-tools", "@deepseek-ai/dsh-typert-protocol", "@deepseek-ai/dsh-user-approval"], deepseek_cordis_package_name: "@deepseek-ai/cordis", deepseek_cordis_version: "4.0.1", deepseek_support_packages: { "@deepseek-ai/cordis-plugin-timer": "1.1.3" }, platforms: { "linux-x64": { package_name: "@openai/codex-linux-x64", target: "x86_64-unknown-linux-musl", binary_name: "codex", sha256: "660e159a49e823ac8e5986cb238f73158ce4b957d40d9292f8de90862644b501" }, "win32-x64": { package_name: "@openai/codex-win32-x64", target: "x86_64-pc-windows-msvc", binary_name: "codex.exe", sha256: "e4c11374bd9de8ad5c3b7617fd4654bb7839901edb0863f9930666863c7a021b" } }, pi_coding_agent_package_name: "@earendil-works/pi-coding-agent", pi_ai_package_name: "@earendil-works/pi-ai", pi_version: "0.85.1", pi_support_packages: ["@earendil-works/pi-agent-core", "@earendil-works/pi-telemetry", "@earendil-works/pi-tui", "@earendil-works/chord"], grok_version: "1.0.30", grok_platforms: { "linux-x64": { package_name: "@xai-official/grok-linux-x64", binary_name: "grok", sha256: "504dd6546ab991b75d36698242875ce461489cd1f8cd84285873cb55bd5c7d54" }, "win32-x64": { package_name: "@xai-official/grok-win32-x64", binary_name: "grok.exe", sha256: "48736d1a4342a801ea26d0ecde4c516b653f791399065adaa55973f83abd8867" } } };
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
// lib/constants.ts
|
|
51
|
-
var MS_PER_SECOND, SECONDS_PER_MINUTE, MINUTES_PER_HOUR, HOURS_PER_DAY, DAYS_PER_WEEK, MS_PER_MINUTE, SECONDS_PER_HOUR, SECONDS_PER_DAY, SECONDS_PER_WEEK, MINUTES_PER_DAY, MINUTES_PER_WEEK, MS_PER_HOUR, MS_PER_DAY, READ_STAMP_TIE_MS, BACKOFF_GROWTH_FACTOR, BYTES_PER_KIB, BYTES_PER_MIB, OWNER_ONLY_FILE_MODE, OWNER_ONLY_DIRECTORY_MODE, GROUP_OTHER_PERMISSION_BITS, JSON_INDENT_SPACES, INT32_MIN, INT32_MAX, CANDLE_TIMEFRAME_SECONDS, HTTP_STATUS, AI_COST_ESTIMATE_PERIOD_DAYS, SECONDS_PER_AI_COST_ESTIMATE_PERIOD, NODE_ARGV_COMMAND_ARGS_START, EXIT_CODE_TEMPFAIL, JSON_RPC_ERROR_CODES, INFERENCE_HOST_PROCESS_LOCK_RECORD_SCHEMA_VERSION, INFERENCE_HOST_RECLAIM_GUARD_CREATE_PASSES, LINUX_PROC_STAT_COMM_TERMINATOR_CHARS, INFERENCE_HOST_RANDOM_BYTES, EXIT_CODE_INTERRUPTED, EXIT_CODE_SIGNAL_BASE;
|
|
51
|
+
var MS_PER_SECOND, SECONDS_PER_MINUTE, MINUTES_PER_HOUR, HOURS_PER_DAY, DAYS_PER_WEEK, MS_PER_MINUTE, SECONDS_PER_HOUR, SECONDS_PER_DAY, SECONDS_PER_WEEK, MINUTES_PER_DAY, MINUTES_PER_WEEK, MS_PER_HOUR, MS_PER_DAY, READ_STAMP_TIE_MS, BACKOFF_GROWTH_FACTOR, BYTES_PER_KIB, BYTES_PER_MIB, OWNER_ONLY_FILE_MODE, OWNER_ONLY_DIRECTORY_MODE, GROUP_OTHER_PERMISSION_BITS, JSON_INDENT_SPACES, INT32_MIN, INT32_MAX, CANDLE_TIMEFRAME_SECONDS, HTTP_STATUS, AI_COST_ESTIMATE_PERIOD_DAYS, SECONDS_PER_AI_COST_ESTIMATE_PERIOD, NODE_ARGV_COMMAND_ARGS_START, EXIT_CODE_TEMPFAIL, JSON_RPC_ERROR_CODES, INFERENCE_HOST_PROCESS_LOCK_RECORD_SCHEMA_VERSION, INFERENCE_HOST_RECLAIM_GUARD_CREATE_PASSES, LINUX_PROC_STAT_COMM_TERMINATOR_CHARS, INFERENCE_HOST_RANDOM_BYTES, HYPERLIQUID_EXCHANGE_SPECIFICATION, HYPERLIQUID_TIF_GTC, EXIT_CODE_INTERRUPTED, EXIT_CODE_SIGNAL_BASE;
|
|
52
52
|
var init_constants = __esm({
|
|
53
53
|
"lib/constants.ts"() {
|
|
54
54
|
"use strict";
|
|
@@ -146,6 +146,30 @@ var init_constants = __esm({
|
|
|
146
146
|
OAUTH_STATE: 32,
|
|
147
147
|
OAUTH_CALLBACK_PATH: 16
|
|
148
148
|
};
|
|
149
|
+
HYPERLIQUID_EXCHANGE_SPECIFICATION = {
|
|
150
|
+
// Chain ID of the phantom-agent EIP-712 domain L1 actions sign.
|
|
151
|
+
l1_signing_chain_id: 1337,
|
|
152
|
+
// A signed action hash appends the nonce (and expiresAfter) as big-endian uint64.
|
|
153
|
+
action_nonce_bytes: 8,
|
|
154
|
+
// Largest atomic order group VTX sends.
|
|
155
|
+
max_orders_per_batch: 16,
|
|
156
|
+
// A positionTpsl group is exactly one stop-loss and one take-profit order.
|
|
157
|
+
position_tpsl_order_count: 2,
|
|
158
|
+
// Prices carry at most this many significant figures...
|
|
159
|
+
price_significant_figures: 5,
|
|
160
|
+
// ...unless they are integers at or above this, which keep every digit.
|
|
161
|
+
integer_price_minimum: 1e5,
|
|
162
|
+
// A perp price has at most this many decimals minus the asset's szDecimals.
|
|
163
|
+
perp_price_max_decimals: 6,
|
|
164
|
+
// A HIP-3 builder-DEX asset ID is base + dex index * stride + index in meta.
|
|
165
|
+
hip3_asset_id_base: 1e5,
|
|
166
|
+
hip3_asset_id_dex_stride: 1e4,
|
|
167
|
+
// A trailing stop's percent retracement carries at most this many decimals.
|
|
168
|
+
trailing_retracement_pct_max_decimals: 3,
|
|
169
|
+
// Good-til-cancelled time in force as the order wire spells it.
|
|
170
|
+
good_til_cancelled_time_in_force: "Gtc"
|
|
171
|
+
};
|
|
172
|
+
HYPERLIQUID_TIF_GTC = HYPERLIQUID_EXCHANGE_SPECIFICATION.good_til_cancelled_time_in_force;
|
|
149
173
|
EXIT_CODE_INTERRUPTED = 130;
|
|
150
174
|
EXIT_CODE_SIGNAL_BASE = 128;
|
|
151
175
|
}
|
|
@@ -1737,8 +1761,6 @@ var runtime_policy_generated_default = {
|
|
|
1737
1761
|
observed_activity_recent_ms: 8e3,
|
|
1738
1762
|
startup_hold_activation_gap_ms: 9e4,
|
|
1739
1763
|
hidden_ticker_update_interval_ms: 16,
|
|
1740
|
-
client_close_fill_sync_attempts: 3,
|
|
1741
|
-
client_close_fill_sync_retry_step_ms: 300,
|
|
1742
1764
|
post_leverage_update_order_delay_ms: 250,
|
|
1743
1765
|
takeover_telemetry_error_chars: 500,
|
|
1744
1766
|
takeover_telemetry_error_name_chars: 120,
|
|
@@ -2060,7 +2082,6 @@ var runtime_policy_generated_default = {
|
|
|
2060
2082
|
protective_actions: {
|
|
2061
2083
|
adoption_request_timeout_milliseconds: 2e4,
|
|
2062
2084
|
idle_recheck_seconds: 60,
|
|
2063
|
-
attention_refresh_seconds: 60,
|
|
2064
2085
|
evidence_max_items: 32,
|
|
2065
2086
|
evidence_shared_read_seconds: 10,
|
|
2066
2087
|
retry_delay_seconds: 15,
|
|
@@ -2190,10 +2211,6 @@ var runtime_policy_generated_default = {
|
|
|
2190
2211
|
},
|
|
2191
2212
|
defaults: {
|
|
2192
2213
|
server_ai_max_slippage: 5
|
|
2193
|
-
},
|
|
2194
|
-
risk: {
|
|
2195
|
-
max_order_notional: 5e3,
|
|
2196
|
-
max_position_notional: 1e4
|
|
2197
2214
|
}
|
|
2198
2215
|
},
|
|
2199
2216
|
agent_cli: {
|
|
@@ -2459,7 +2476,6 @@ var runtime_policy_generated_default = {
|
|
|
2459
2476
|
capacity_recovery_weight_per_minute: 120,
|
|
2460
2477
|
background_floor_weight: 120,
|
|
2461
2478
|
background_admission_wait_seconds: 90,
|
|
2462
|
-
cooldown_seconds: 60,
|
|
2463
2479
|
metadata_ttl_seconds: 300,
|
|
2464
2480
|
user_fees_ttl_seconds: 300,
|
|
2465
2481
|
account_mode_ttl_seconds: 30,
|
|
@@ -14,7 +14,7 @@ import { dirname as dirname4, relative as relative4, resolve as resolve4 } from
|
|
|
14
14
|
import { fileURLToPath } from "node:url";
|
|
15
15
|
|
|
16
16
|
// agent-cli-release.json
|
|
17
|
-
var agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.
|
|
17
|
+
var agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.48", codex_package_name: "@openai/codex", codex_version: "0.155.0", copilot_sdk_package_name: "@github/copilot-sdk", copilot_sdk_version: "1.0.0-beta.8", copilot_cli_package_name: "@github/copilot", copilot_cli_version: "1.0.80", deepseek_harness_version: "0.1.1-rc.2", deepseek_harness_packages: ["@deepseek-ai/dsh-agent", "@deepseek-ai/dsh-agent-instructions", "@deepseek-ai/dsh-agent-loop", "@deepseek-ai/dsh-agent-spine-demo", "@deepseek-ai/dsh-anonymous-user-id", "@deepseek-ai/dsh-atomic-write", "@deepseek-ai/dsh-attachment", "@deepseek-ai/dsh-brand", "@deepseek-ai/dsh-code-runtime", "@deepseek-ai/dsh-credentials", "@deepseek-ai/dsh-fs", "@deepseek-ai/dsh-goal", "@deepseek-ai/dsh-goal-round-driver", "@deepseek-ai/dsh-home-paths", "@deepseek-ai/dsh-invariants", "@deepseek-ai/dsh-jobs", "@deepseek-ai/dsh-jobs-local", "@deepseek-ai/dsh-launch-environment", "@deepseek-ai/dsh-llm", "@deepseek-ai/dsh-llm-deepseek", "@deepseek-ai/dsh-llm-retry", "@deepseek-ai/dsh-output-retention", "@deepseek-ai/dsh-sandbox", "@deepseek-ai/dsh-sandbox-policy", "@deepseek-ai/dsh-scope", "@deepseek-ai/dsh-session", "@deepseek-ai/dsh-session-checkpoint-policy", "@deepseek-ai/dsh-session-persistence", "@deepseek-ai/dsh-session-persistence-jsonl", "@deepseek-ai/dsh-session-projection", "@deepseek-ai/dsh-session-title", "@deepseek-ai/dsh-settings", "@deepseek-ai/dsh-shell", "@deepseek-ai/dsh-shell-env", "@deepseek-ai/dsh-skill", "@deepseek-ai/dsh-skill-filesystem", "@deepseek-ai/dsh-subprocess", "@deepseek-ai/dsh-system-prompt", "@deepseek-ai/dsh-timeout", "@deepseek-ai/dsh-tool-bash", "@deepseek-ai/dsh-tool-goal", "@deepseek-ai/dsh-tool-jobs", "@deepseek-ai/dsh-tool-skill", "@deepseek-ai/dsh-tools", "@deepseek-ai/dsh-typert-protocol", "@deepseek-ai/dsh-user-approval"], deepseek_cordis_package_name: "@deepseek-ai/cordis", deepseek_cordis_version: "4.0.1", deepseek_support_packages: { "@deepseek-ai/cordis-plugin-timer": "1.1.3" }, platforms: { "linux-x64": { package_name: "@openai/codex-linux-x64", target: "x86_64-unknown-linux-musl", binary_name: "codex", sha256: "660e159a49e823ac8e5986cb238f73158ce4b957d40d9292f8de90862644b501" }, "win32-x64": { package_name: "@openai/codex-win32-x64", target: "x86_64-pc-windows-msvc", binary_name: "codex.exe", sha256: "e4c11374bd9de8ad5c3b7617fd4654bb7839901edb0863f9930666863c7a021b" } }, pi_coding_agent_package_name: "@earendil-works/pi-coding-agent", pi_ai_package_name: "@earendil-works/pi-ai", pi_version: "0.85.1", pi_support_packages: ["@earendil-works/pi-agent-core", "@earendil-works/pi-telemetry", "@earendil-works/pi-tui", "@earendil-works/chord"], grok_version: "1.0.30", grok_platforms: { "linux-x64": { package_name: "@xai-official/grok-linux-x64", binary_name: "grok", sha256: "504dd6546ab991b75d36698242875ce461489cd1f8cd84285873cb55bd5c7d54" }, "win32-x64": { package_name: "@xai-official/grok-win32-x64", binary_name: "grok.exe", sha256: "48736d1a4342a801ea26d0ecde4c516b653f791399065adaa55973f83abd8867" } } };
|
|
18
18
|
|
|
19
19
|
// lib/runtime-policy.generated.json
|
|
20
20
|
var runtime_policy_generated_default = {
|
|
@@ -412,8 +412,6 @@ var runtime_policy_generated_default = {
|
|
|
412
412
|
observed_activity_recent_ms: 8e3,
|
|
413
413
|
startup_hold_activation_gap_ms: 9e4,
|
|
414
414
|
hidden_ticker_update_interval_ms: 16,
|
|
415
|
-
client_close_fill_sync_attempts: 3,
|
|
416
|
-
client_close_fill_sync_retry_step_ms: 300,
|
|
417
415
|
post_leverage_update_order_delay_ms: 250,
|
|
418
416
|
takeover_telemetry_error_chars: 500,
|
|
419
417
|
takeover_telemetry_error_name_chars: 120,
|
|
@@ -735,7 +733,6 @@ var runtime_policy_generated_default = {
|
|
|
735
733
|
protective_actions: {
|
|
736
734
|
adoption_request_timeout_milliseconds: 2e4,
|
|
737
735
|
idle_recheck_seconds: 60,
|
|
738
|
-
attention_refresh_seconds: 60,
|
|
739
736
|
evidence_max_items: 32,
|
|
740
737
|
evidence_shared_read_seconds: 10,
|
|
741
738
|
retry_delay_seconds: 15,
|
|
@@ -865,10 +862,6 @@ var runtime_policy_generated_default = {
|
|
|
865
862
|
},
|
|
866
863
|
defaults: {
|
|
867
864
|
server_ai_max_slippage: 5
|
|
868
|
-
},
|
|
869
|
-
risk: {
|
|
870
|
-
max_order_notional: 5e3,
|
|
871
|
-
max_position_notional: 1e4
|
|
872
865
|
}
|
|
873
866
|
},
|
|
874
867
|
agent_cli: {
|
|
@@ -1134,7 +1127,6 @@ var runtime_policy_generated_default = {
|
|
|
1134
1127
|
capacity_recovery_weight_per_minute: 120,
|
|
1135
1128
|
background_floor_weight: 120,
|
|
1136
1129
|
background_admission_wait_seconds: 90,
|
|
1137
|
-
cooldown_seconds: 60,
|
|
1138
1130
|
metadata_ttl_seconds: 300,
|
|
1139
1131
|
user_fees_ttl_seconds: 300,
|
|
1140
1132
|
account_mode_ttl_seconds: 30,
|
|
@@ -1453,6 +1445,30 @@ var INFERENCE_HOST_RANDOM_BYTES = {
|
|
|
1453
1445
|
OAUTH_STATE: 32,
|
|
1454
1446
|
OAUTH_CALLBACK_PATH: 16
|
|
1455
1447
|
};
|
|
1448
|
+
var HYPERLIQUID_EXCHANGE_SPECIFICATION = {
|
|
1449
|
+
// Chain ID of the phantom-agent EIP-712 domain L1 actions sign.
|
|
1450
|
+
l1_signing_chain_id: 1337,
|
|
1451
|
+
// A signed action hash appends the nonce (and expiresAfter) as big-endian uint64.
|
|
1452
|
+
action_nonce_bytes: 8,
|
|
1453
|
+
// Largest atomic order group VTX sends.
|
|
1454
|
+
max_orders_per_batch: 16,
|
|
1455
|
+
// A positionTpsl group is exactly one stop-loss and one take-profit order.
|
|
1456
|
+
position_tpsl_order_count: 2,
|
|
1457
|
+
// Prices carry at most this many significant figures...
|
|
1458
|
+
price_significant_figures: 5,
|
|
1459
|
+
// ...unless they are integers at or above this, which keep every digit.
|
|
1460
|
+
integer_price_minimum: 1e5,
|
|
1461
|
+
// A perp price has at most this many decimals minus the asset's szDecimals.
|
|
1462
|
+
perp_price_max_decimals: 6,
|
|
1463
|
+
// A HIP-3 builder-DEX asset ID is base + dex index * stride + index in meta.
|
|
1464
|
+
hip3_asset_id_base: 1e5,
|
|
1465
|
+
hip3_asset_id_dex_stride: 1e4,
|
|
1466
|
+
// A trailing stop's percent retracement carries at most this many decimals.
|
|
1467
|
+
trailing_retracement_pct_max_decimals: 3,
|
|
1468
|
+
// Good-til-cancelled time in force as the order wire spells it.
|
|
1469
|
+
good_til_cancelled_time_in_force: "Gtc"
|
|
1470
|
+
};
|
|
1471
|
+
var HYPERLIQUID_TIF_GTC = HYPERLIQUID_EXCHANGE_SPECIFICATION.good_til_cancelled_time_in_force;
|
|
1456
1472
|
|
|
1457
1473
|
// lib/cli-release/updater.ts
|
|
1458
1474
|
import { spawn as spawn2 } from "node:child_process";
|
|
@@ -396,8 +396,6 @@ var runtime_policy_generated_default = {
|
|
|
396
396
|
observed_activity_recent_ms: 8e3,
|
|
397
397
|
startup_hold_activation_gap_ms: 9e4,
|
|
398
398
|
hidden_ticker_update_interval_ms: 16,
|
|
399
|
-
client_close_fill_sync_attempts: 3,
|
|
400
|
-
client_close_fill_sync_retry_step_ms: 300,
|
|
401
399
|
post_leverage_update_order_delay_ms: 250,
|
|
402
400
|
takeover_telemetry_error_chars: 500,
|
|
403
401
|
takeover_telemetry_error_name_chars: 120,
|
|
@@ -719,7 +717,6 @@ var runtime_policy_generated_default = {
|
|
|
719
717
|
protective_actions: {
|
|
720
718
|
adoption_request_timeout_milliseconds: 2e4,
|
|
721
719
|
idle_recheck_seconds: 60,
|
|
722
|
-
attention_refresh_seconds: 60,
|
|
723
720
|
evidence_max_items: 32,
|
|
724
721
|
evidence_shared_read_seconds: 10,
|
|
725
722
|
retry_delay_seconds: 15,
|
|
@@ -849,10 +846,6 @@ var runtime_policy_generated_default = {
|
|
|
849
846
|
},
|
|
850
847
|
defaults: {
|
|
851
848
|
server_ai_max_slippage: 5
|
|
852
|
-
},
|
|
853
|
-
risk: {
|
|
854
|
-
max_order_notional: 5e3,
|
|
855
|
-
max_position_notional: 1e4
|
|
856
849
|
}
|
|
857
850
|
},
|
|
858
851
|
agent_cli: {
|
|
@@ -1118,7 +1111,6 @@ var runtime_policy_generated_default = {
|
|
|
1118
1111
|
capacity_recovery_weight_per_minute: 120,
|
|
1119
1112
|
background_floor_weight: 120,
|
|
1120
1113
|
background_admission_wait_seconds: 90,
|
|
1121
|
-
cooldown_seconds: 60,
|
|
1122
1114
|
metadata_ttl_seconds: 300,
|
|
1123
1115
|
user_fees_ttl_seconds: 300,
|
|
1124
1116
|
account_mode_ttl_seconds: 30,
|
|
@@ -1436,6 +1428,30 @@ var INFERENCE_HOST_RANDOM_BYTES = {
|
|
|
1436
1428
|
OAUTH_STATE: 32,
|
|
1437
1429
|
OAUTH_CALLBACK_PATH: 16
|
|
1438
1430
|
};
|
|
1431
|
+
var HYPERLIQUID_EXCHANGE_SPECIFICATION = {
|
|
1432
|
+
// Chain ID of the phantom-agent EIP-712 domain L1 actions sign.
|
|
1433
|
+
l1_signing_chain_id: 1337,
|
|
1434
|
+
// A signed action hash appends the nonce (and expiresAfter) as big-endian uint64.
|
|
1435
|
+
action_nonce_bytes: 8,
|
|
1436
|
+
// Largest atomic order group VTX sends.
|
|
1437
|
+
max_orders_per_batch: 16,
|
|
1438
|
+
// A positionTpsl group is exactly one stop-loss and one take-profit order.
|
|
1439
|
+
position_tpsl_order_count: 2,
|
|
1440
|
+
// Prices carry at most this many significant figures...
|
|
1441
|
+
price_significant_figures: 5,
|
|
1442
|
+
// ...unless they are integers at or above this, which keep every digit.
|
|
1443
|
+
integer_price_minimum: 1e5,
|
|
1444
|
+
// A perp price has at most this many decimals minus the asset's szDecimals.
|
|
1445
|
+
perp_price_max_decimals: 6,
|
|
1446
|
+
// A HIP-3 builder-DEX asset ID is base + dex index * stride + index in meta.
|
|
1447
|
+
hip3_asset_id_base: 1e5,
|
|
1448
|
+
hip3_asset_id_dex_stride: 1e4,
|
|
1449
|
+
// A trailing stop's percent retracement carries at most this many decimals.
|
|
1450
|
+
trailing_retracement_pct_max_decimals: 3,
|
|
1451
|
+
// Good-til-cancelled time in force as the order wire spells it.
|
|
1452
|
+
good_til_cancelled_time_in_force: "Gtc"
|
|
1453
|
+
};
|
|
1454
|
+
var HYPERLIQUID_TIF_GTC = HYPERLIQUID_EXCHANGE_SPECIFICATION.good_til_cancelled_time_in_force;
|
|
1439
1455
|
|
|
1440
1456
|
// lib/inference-host/service-launcher.ts
|
|
1441
1457
|
import { spawn as spawn2 } from "node:child_process";
|
package/bin/vtx.js
CHANGED
|
@@ -122,7 +122,7 @@ var init_routing = __esm({
|
|
|
122
122
|
var agent_cli_release_default;
|
|
123
123
|
var init_agent_cli_release = __esm({
|
|
124
124
|
"agent-cli-release.json"() {
|
|
125
|
-
agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.
|
|
125
|
+
agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.48", codex_package_name: "@openai/codex", codex_version: "0.155.0", copilot_sdk_package_name: "@github/copilot-sdk", copilot_sdk_version: "1.0.0-beta.8", copilot_cli_package_name: "@github/copilot", copilot_cli_version: "1.0.80", deepseek_harness_version: "0.1.1-rc.2", deepseek_harness_packages: ["@deepseek-ai/dsh-agent", "@deepseek-ai/dsh-agent-instructions", "@deepseek-ai/dsh-agent-loop", "@deepseek-ai/dsh-agent-spine-demo", "@deepseek-ai/dsh-anonymous-user-id", "@deepseek-ai/dsh-atomic-write", "@deepseek-ai/dsh-attachment", "@deepseek-ai/dsh-brand", "@deepseek-ai/dsh-code-runtime", "@deepseek-ai/dsh-credentials", "@deepseek-ai/dsh-fs", "@deepseek-ai/dsh-goal", "@deepseek-ai/dsh-goal-round-driver", "@deepseek-ai/dsh-home-paths", "@deepseek-ai/dsh-invariants", "@deepseek-ai/dsh-jobs", "@deepseek-ai/dsh-jobs-local", "@deepseek-ai/dsh-launch-environment", "@deepseek-ai/dsh-llm", "@deepseek-ai/dsh-llm-deepseek", "@deepseek-ai/dsh-llm-retry", "@deepseek-ai/dsh-output-retention", "@deepseek-ai/dsh-sandbox", "@deepseek-ai/dsh-sandbox-policy", "@deepseek-ai/dsh-scope", "@deepseek-ai/dsh-session", "@deepseek-ai/dsh-session-checkpoint-policy", "@deepseek-ai/dsh-session-persistence", "@deepseek-ai/dsh-session-persistence-jsonl", "@deepseek-ai/dsh-session-projection", "@deepseek-ai/dsh-session-title", "@deepseek-ai/dsh-settings", "@deepseek-ai/dsh-shell", "@deepseek-ai/dsh-shell-env", "@deepseek-ai/dsh-skill", "@deepseek-ai/dsh-skill-filesystem", "@deepseek-ai/dsh-subprocess", "@deepseek-ai/dsh-system-prompt", "@deepseek-ai/dsh-timeout", "@deepseek-ai/dsh-tool-bash", "@deepseek-ai/dsh-tool-goal", "@deepseek-ai/dsh-tool-jobs", "@deepseek-ai/dsh-tool-skill", "@deepseek-ai/dsh-tools", "@deepseek-ai/dsh-typert-protocol", "@deepseek-ai/dsh-user-approval"], deepseek_cordis_package_name: "@deepseek-ai/cordis", deepseek_cordis_version: "4.0.1", deepseek_support_packages: { "@deepseek-ai/cordis-plugin-timer": "1.1.3" }, platforms: { "linux-x64": { package_name: "@openai/codex-linux-x64", target: "x86_64-unknown-linux-musl", binary_name: "codex", sha256: "660e159a49e823ac8e5986cb238f73158ce4b957d40d9292f8de90862644b501" }, "win32-x64": { package_name: "@openai/codex-win32-x64", target: "x86_64-pc-windows-msvc", binary_name: "codex.exe", sha256: "e4c11374bd9de8ad5c3b7617fd4654bb7839901edb0863f9930666863c7a021b" } }, pi_coding_agent_package_name: "@earendil-works/pi-coding-agent", pi_ai_package_name: "@earendil-works/pi-ai", pi_version: "0.85.1", pi_support_packages: ["@earendil-works/pi-agent-core", "@earendil-works/pi-telemetry", "@earendil-works/pi-tui", "@earendil-works/chord"], grok_version: "1.0.30", grok_platforms: { "linux-x64": { package_name: "@xai-official/grok-linux-x64", binary_name: "grok", sha256: "504dd6546ab991b75d36698242875ce461489cd1f8cd84285873cb55bd5c7d54" }, "win32-x64": { package_name: "@xai-official/grok-win32-x64", binary_name: "grok.exe", sha256: "48736d1a4342a801ea26d0ecde4c516b653f791399065adaa55973f83abd8867" } } };
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
128
|
|
|
@@ -525,8 +525,6 @@ var init_runtime_policy_generated = __esm({
|
|
|
525
525
|
observed_activity_recent_ms: 8e3,
|
|
526
526
|
startup_hold_activation_gap_ms: 9e4,
|
|
527
527
|
hidden_ticker_update_interval_ms: 16,
|
|
528
|
-
client_close_fill_sync_attempts: 3,
|
|
529
|
-
client_close_fill_sync_retry_step_ms: 300,
|
|
530
528
|
post_leverage_update_order_delay_ms: 250,
|
|
531
529
|
takeover_telemetry_error_chars: 500,
|
|
532
530
|
takeover_telemetry_error_name_chars: 120,
|
|
@@ -848,7 +846,6 @@ var init_runtime_policy_generated = __esm({
|
|
|
848
846
|
protective_actions: {
|
|
849
847
|
adoption_request_timeout_milliseconds: 2e4,
|
|
850
848
|
idle_recheck_seconds: 60,
|
|
851
|
-
attention_refresh_seconds: 60,
|
|
852
849
|
evidence_max_items: 32,
|
|
853
850
|
evidence_shared_read_seconds: 10,
|
|
854
851
|
retry_delay_seconds: 15,
|
|
@@ -978,10 +975,6 @@ var init_runtime_policy_generated = __esm({
|
|
|
978
975
|
},
|
|
979
976
|
defaults: {
|
|
980
977
|
server_ai_max_slippage: 5
|
|
981
|
-
},
|
|
982
|
-
risk: {
|
|
983
|
-
max_order_notional: 5e3,
|
|
984
|
-
max_position_notional: 1e4
|
|
985
978
|
}
|
|
986
979
|
},
|
|
987
980
|
agent_cli: {
|
|
@@ -1247,7 +1240,6 @@ var init_runtime_policy_generated = __esm({
|
|
|
1247
1240
|
capacity_recovery_weight_per_minute: 120,
|
|
1248
1241
|
background_floor_weight: 120,
|
|
1249
1242
|
background_admission_wait_seconds: 90,
|
|
1250
|
-
cooldown_seconds: 60,
|
|
1251
1243
|
metadata_ttl_seconds: 300,
|
|
1252
1244
|
user_fees_ttl_seconds: 300,
|
|
1253
1245
|
account_mode_ttl_seconds: 30,
|
|
@@ -1514,7 +1506,7 @@ var init_runtime_policy_generated = __esm({
|
|
|
1514
1506
|
});
|
|
1515
1507
|
|
|
1516
1508
|
// lib/constants.ts
|
|
1517
|
-
var MS_PER_SECOND, SECONDS_PER_MINUTE, MINUTES_PER_HOUR, HOURS_PER_DAY, DAYS_PER_WEEK, MS_PER_MINUTE, SECONDS_PER_HOUR, SECONDS_PER_DAY, SECONDS_PER_WEEK, MINUTES_PER_DAY, MINUTES_PER_WEEK, MS_PER_HOUR, MS_PER_DAY, READ_STAMP_TIE_MS, READ_STAMP_STEP_BACK_MS, CLOCK_FIELD_DIGITS, BACKOFF_GROWTH_FACTOR, BYTES_PER_KIB, BYTES_PER_MIB, BITS_PER_BYTE, BYTE_MASK, OWNER_ONLY_FILE_MODE, OWNER_ONLY_DIRECTORY_MODE, GROUP_OTHER_PERMISSION_BITS, DECIMAL_RADIX, HEX_RADIX, BASE36_RADIX, BYTE_HEX_DIGITS, UINT32_HEX_DIGITS, RANDOM_FRACTION_PREFIX_LENGTH, PERCENT_SCALE, MIDPOINT_DIVISOR, SQUARE_EXPONENT, FNV1A_32_OFFSET_BASIS, FNV1A_32_PRIME, JSON_INDENT_SPACES, INT32_MIN, INT32_MAX, SET_TIMEOUT_MAX_DELAY_MS, POSITION_SIZE_EPSILON, CANDLE_TIMEFRAME_SECONDS, HTTP_STATUS, HTTP_STATUS_MIN, HTTP_STATUS_MAX, HTTP_CLIENT_ERROR_MIN, HTTP_SERVER_ERROR_MIN, PROMPT_RESCUE_ASKS_PER_CYCLE_BUILD,
|
|
1509
|
+
var MS_PER_SECOND, SECONDS_PER_MINUTE, MINUTES_PER_HOUR, HOURS_PER_DAY, DAYS_PER_WEEK, MS_PER_MINUTE, SECONDS_PER_HOUR, SECONDS_PER_DAY, SECONDS_PER_WEEK, MINUTES_PER_DAY, MINUTES_PER_WEEK, MS_PER_HOUR, MS_PER_DAY, READ_STAMP_TIE_MS, READ_STAMP_STEP_BACK_MS, CLOCK_FIELD_DIGITS, BACKOFF_GROWTH_FACTOR, BYTES_PER_KIB, BYTES_PER_MIB, BITS_PER_BYTE, BYTE_MASK, OWNER_ONLY_FILE_MODE, OWNER_ONLY_DIRECTORY_MODE, GROUP_OTHER_PERMISSION_BITS, DECIMAL_RADIX, HEX_RADIX, BASE36_RADIX, BYTE_HEX_DIGITS, UINT32_HEX_DIGITS, RANDOM_FRACTION_PREFIX_LENGTH, PERCENT_SCALE, MIDPOINT_DIVISOR, SQUARE_EXPONENT, FNV1A_32_OFFSET_BASIS, FNV1A_32_PRIME, JSON_INDENT_SPACES, INT32_MIN, INT32_MAX, SET_TIMEOUT_MAX_DELAY_MS, POSITION_SIZE_EPSILON, CANDLE_TIMEFRAME_SECONDS, HTTP_STATUS, HTTP_STATUS_MIN, HTTP_STATUS_MAX, HTTP_CLIENT_ERROR_MIN, HTTP_SERVER_ERROR_MIN, PROMPT_RESCUE_ASKS_PER_CYCLE_BUILD, AI_COST_ESTIMATE_PERIOD_DAYS, SECONDS_PER_AI_COST_ESTIMATE_PERIOD, DATE_FIELD_DIGITS, EXTERNAL_INFERENCE_LIMITS, NODE_ARGV_COMMAND_ARGS_START, EXIT_CODE_TEMPFAIL, SHA256_INITIAL_STATE, SHA256_ROUND_CONSTANTS, SHA256, UINT64_HIGH_WORD_DIVISOR, CANONICAL_BASE64URL, INFERENCE_ENVELOPE_CRYPTO, EXTERNAL_INFERENCE_SCHEMA_BOUNDS, JSON_RPC_ERROR_CODES, INFERENCE_MCP_SCHEMA_PROBE_MAX_DEPTH, INFERENCE_HOST_PROCESS_LOCK_RECORD_SCHEMA_VERSION, NATIVE_PROTECTION_RECORD_WITH_LOTS_VERSION, INFERENCE_HOST_RECLAIM_GUARD_CREATE_PASSES, LINUX_PROC_STAT_COMM_TERMINATOR_CHARS, INFERENCE_HOST_RANDOM_BYTES, INFERENCE_OAUTH_TOKEN_MAX_LENGTH, INFERENCE_CREDENTIAL_WINDOWS_NOT_FOUND_EXIT_CODE, MACOS_SECURITY_ITEM_NOT_FOUND_EXIT_CODE, INFERENCE_CREDENTIAL_LABEL_ACCOUNT_KEY_CHARS, INFERENCE_HOST_STABLE_OPERATION_ID_HASH_CHARS, INFERENCE_HOST_DRAIN_PRIORITY, INFERENCE_JOB_CLAIM_SCHEMA_VERSION, INFERENCE_HOST_WINDOWS_TASK_IDENTITY_MAX_CHARS, INFERENCE_HOST_OWNER_ONLY_EXECUTABLE_MODE, WINDOWS_TASKKILL_PROCESS_NOT_FOUND_EXIT_CODE, INFERENCE_HOST_CLI_MAX_SERVICE_POSITIONALS, INFERENCE_HOST_CLI_MAX_COMMAND_POSITIONALS, INFERENCE_HOST_DISPLAY_NAME_MAX_CHARS, INFERENCE_HOST_REVOCATION_CHECKPOINT_MAX_CHARS, INFERENCE_HOST_MODEL_ID_MAX_CHARS, CODEX_RECOVERY_RECEIPT_MAX_CHARS, CODEX_HOSTED_ATTEMPT_PATH_SEGMENTS, CODEX_GUARDIAN_PROCESS_TOKEN_BYTES, CODEX_RATE_LIMIT_EXHAUSTED_PERCENT, INFERENCE_HOST_PROXY_TOKEN_BYTES, AGENT_TOOL_SERVER_TOKEN_BYTES, GROK_NATIVE_SESSION_GROUP_NAME_MAX_CHARS, GROK_POLICY_TRANSPORT_MAX_BYTES, EXO_POLICY_MAX_TOOL_ROUNDS, EXO_POLICY_MAX_MODELS, EXO_POLICY_MODEL_NAME_MAX_CHARS, CLAUDE_CODE_POLICY_MAX_MODELS, CLAUDE_CODE_POLICY_MODEL_NAME_MAX_CHARS, CLAUDE_CODE_POLICY_MAX_TURNS, ANTHROPIC_SCHEMA_PROPERTY_NAME_MAX_CHARS, EXO_RUNTIME_VERSION_COMMIT_CHARS, PI_QUALIFIED_MODEL_ID_MAX_CHARS, PI_STRUCTURED_OUTPUT_MAX_DEPTH, PI_STRUCTURED_OUTPUT_MAX_PROPERTIES, INFERENCE_HOST_API_KEY_MIN_CHARS, INFERENCE_HOST_API_KEY_MAX_BYTES, INFERENCE_HOST_API_KEY_IDENTITY_HEX_CHARS, DEEPSEEK_HARNESS_NODE_LTS_MAJOR, DEEPSEEK_HARNESS_NODE_LTS_MIN_MINOR, DEEPSEEK_HARNESS_NODE_CURRENT_MAJOR, PROMPT_FIXED_DIGITS, PROMPT_SIGNIFICANT_DIGITS, PROMPT_NUMBER_MAX_DIGITS, PROMPT_RELATIVE_VOLUME_DIGITS, BINARY_RADIX, PROMPT_PRICE_INTEGER_THRESHOLD, PROMPT_MARGIN_UTILIZATION_DECIMALS, PROMPT_SYMBOL_MAX_CHARS, PROMPT_PARTIAL_UNIT_ROUND_UP_FRACTION, HALF_UP_ROUNDING_OFFSET, PROMPT_ENTRY_PRICE_MATCH_ABS_TOLERANCE, PROMPT_ENTRY_PRICE_MATCH_REL_TOLERANCE, DECISION_OUTPUT_EXAMPLE_TRADABILITY, INDICATOR_RSI_PERIOD, INDICATOR_ATR_PERIOD, INDICATOR_MACD_FAST_PERIOD, INDICATOR_MACD_SLOW_PERIOD, INDICATOR_MACD_SIGNAL_PERIOD, INDICATOR_BOLLINGER_PERIOD, INDICATOR_BOLLINGER_STD_DEV, INDICATOR_OSCILLATOR_MAX, EMA_SMOOTHING_NUMERATOR, PROMPT_EMA_PERIODS, JSON_UNICODE_ESCAPE_PREFIX_LENGTH, JSON_UNICODE_ESCAPE_HEX_DIGITS, JSON_CONTROL_CHARACTER_MAX, RUNTIME_DEBUG_SNIPPET_CHARS, RUNTIME_DEBUG_PROMPT_SNIPPET_CHARS, RUNTIME_DEBUG_TOKEN_PREFIX_CHARS, RUNTIME_DEBUG_USD_DECIMALS, REVIEW_FAILURE_DETAIL_MAX_CHARS, RUNTIME_LATENCY_SECONDS_DECIMALS, AI_SCHEDULE_CLOCK_PARTS, ESTIMATED_CHARS_PER_TOKEN, PROVIDER_ERROR_RAW_TEXT_MAX_CHARS, AI_CALL_COST_DECIMALS, PROVIDER_DIAGNOSTIC_LIMITS, AI_INVOCATION_CONTRACT_VERSION, AI_INVOCATION_TELEMETRY_LIMITS, PROVIDER_USAGE_DETAIL_LIMITS, HYPERLIQUID_EXCHANGE_SPECIFICATION, HYPERLIQUID_TIF_GTC, HYPERLIQUID_TPSL_BATCH_MIN_ORDERS, HYPERLIQUID_USER_FILLS_PROVIDER_PAGE_CAP, HYPERLIQUID_ROW_WEIGHTED_INFO_REQUESTS, HYPERLIQUID_INFO_ROWS_PER_EXTRA_WEIGHT, HYPERLIQUID_PUBLIC_READ_WINDOWS_KEPT, CLIENT_RUNTIME_NOTE_GAP_MAX_LOOPS, HYPERLIQUID_META_AND_ASSET_CTXS_PARTS, HYPERLIQUID_SIDE_PAIR_LENGTH, HYPERLIQUID_SIGNED_SIZE_MATCH_EXTRA_DECIMALS, HYPERLIQUID_OPEN_ORDERS_MAX_NESTING_DEPTH, ACCOUNT_PAYLOAD_MODE_SEARCH_MAX_DEPTH, HYPERLIQUID_ACCOUNT_ROUNDING_DECIMALS, HYPERLIQUID_UNREALIZED_PNL_ZERO_TOLERANCE, HYPERLIQUID_MAX_DEPLOYER_FEE_SCALE, HYPERLIQUID_DEPLOYER_FEE_SCALE_MULTIPLIER, HYPERLIQUID_GROWTH_MODE_FEE_FACTOR, HYPERLIQUID_ALIGNED_QUOTE_NON_DEPLOYER_FEE_FACTOR, HYPERLIQUID_CLOSE_SIZE_RELATIVE_TOLERANCE, HYPERLIQUID_POSITION_SIZE_MATCH_ABS_TOLERANCE, HYPERLIQUID_POSITION_SIZE_MATCH_RELATIVE_TOLERANCE, HYPERLIQUID_LOT_FLOOR_NOISE_DECIMALS, HYPERLIQUID_RECOVERY_BACKOFF_MAX_EXPONENT, HYPERLIQUID_RECOVERY_CONCURRENCY_GROWTH_FACTOR, UUID_BYTES, UUID_HEX_GROUP_ENDS, MSGPACK, CLIENT_RUNTIME_DEFAULT_RETRY_SECONDS, CLIENT_RUNTIME_PROVIDER_ATTEMPT_SUMMARY_MAX_CHARS, CLIENT_RUNTIME_HL_REQUEST_TYPE_MAX_CHARS, CLIENT_RUNTIME_DRAWDOWN_DEBUG_DECIMALS, CLIENT_PROTECTIVE_GROUP_VERSION, CLIENT_PROTECTIVE_TPSL_PAIR_LEGS, CLIENT_PROTECTIVE_FILL_MATCH_ABS_TOLERANCE, CLIENT_PROTECTIVE_FILL_MATCH_REL_TOLERANCE, CLIENT_CLOSE_FILL_EPSILON_ULPS, COPY_TRADING_SIZE_EPSILON, COPY_TRADING_RELATIVE_SIZE_TOLERANCE, COPY_TRADING_NOTIONAL_CAP_TOLERANCE_USD, CLIENT_ACCOUNT_PNL_NONZERO_MIN_USD, RUNTIME_PORTFOLIO_PERIOD_ENTRY_LENGTH, CLIENT_EXCHANGE_RECONCILIATION_MAX_DELAY_MS, RFC1918_172_BLOCK_SECOND_OCTET, AGENT_CLI_TAKEOVER_REQUIRED_EXIT_CODE, EXIT_CODE_INTERRUPTED, EXIT_CODE_SIGNAL_BASE, CLIENT_PROTECTION_CAPABILITY_VERSION, BYOK_PROVIDER_DISPLAY_ORDER_STEP, TOKENS_PER_MILLION, RENDER_DEBUG_ID_RANDOM_CHARS;
|
|
1518
1510
|
var init_constants = __esm({
|
|
1519
1511
|
"lib/constants.ts"() {
|
|
1520
1512
|
"use strict";
|
|
@@ -1610,7 +1602,6 @@ var init_constants = __esm({
|
|
|
1610
1602
|
HTTP_CLIENT_ERROR_MIN = 400;
|
|
1611
1603
|
HTTP_SERVER_ERROR_MIN = 500;
|
|
1612
1604
|
PROMPT_RESCUE_ASKS_PER_CYCLE_BUILD = 2;
|
|
1613
|
-
USD_DISPLAY_DECIMALS = 2;
|
|
1614
1605
|
AI_COST_ESTIMATE_PERIOD_DAYS = 30;
|
|
1615
1606
|
SECONDS_PER_AI_COST_ESTIMATE_PERIOD = SECONDS_PER_DAY * AI_COST_ESTIMATE_PERIOD_DAYS;
|
|
1616
1607
|
DATE_FIELD_DIGITS = 2;
|
|
@@ -1974,8 +1965,11 @@ var init_constants = __esm({
|
|
|
1974
1965
|
hip3_asset_id_base: 1e5,
|
|
1975
1966
|
hip3_asset_id_dex_stride: 1e4,
|
|
1976
1967
|
// A trailing stop's percent retracement carries at most this many decimals.
|
|
1977
|
-
trailing_retracement_pct_max_decimals: 3
|
|
1968
|
+
trailing_retracement_pct_max_decimals: 3,
|
|
1969
|
+
// Good-til-cancelled time in force as the order wire spells it.
|
|
1970
|
+
good_til_cancelled_time_in_force: "Gtc"
|
|
1978
1971
|
};
|
|
1972
|
+
HYPERLIQUID_TIF_GTC = HYPERLIQUID_EXCHANGE_SPECIFICATION.good_til_cancelled_time_in_force;
|
|
1979
1973
|
HYPERLIQUID_TPSL_BATCH_MIN_ORDERS = 2;
|
|
1980
1974
|
HYPERLIQUID_USER_FILLS_PROVIDER_PAGE_CAP = 2e3;
|
|
1981
1975
|
HYPERLIQUID_ROW_WEIGHTED_INFO_REQUESTS = [
|
|
@@ -20650,8 +20644,6 @@ var init_runtime_policy_generated2 = __esm({
|
|
|
20650
20644
|
observed_activity_recent_ms: 8e3,
|
|
20651
20645
|
startup_hold_activation_gap_ms: 9e4,
|
|
20652
20646
|
hidden_ticker_update_interval_ms: 16,
|
|
20653
|
-
client_close_fill_sync_attempts: 3,
|
|
20654
|
-
client_close_fill_sync_retry_step_ms: 300,
|
|
20655
20647
|
post_leverage_update_order_delay_ms: 250,
|
|
20656
20648
|
takeover_telemetry_error_chars: 500,
|
|
20657
20649
|
takeover_telemetry_error_name_chars: 120,
|
|
@@ -20973,7 +20965,6 @@ var init_runtime_policy_generated2 = __esm({
|
|
|
20973
20965
|
protective_actions: {
|
|
20974
20966
|
adoption_request_timeout_milliseconds: 2e4,
|
|
20975
20967
|
idle_recheck_seconds: 60,
|
|
20976
|
-
attention_refresh_seconds: 60,
|
|
20977
20968
|
evidence_max_items: 32,
|
|
20978
20969
|
evidence_shared_read_seconds: 10,
|
|
20979
20970
|
retry_delay_seconds: 15,
|
|
@@ -21103,10 +21094,6 @@ var init_runtime_policy_generated2 = __esm({
|
|
|
21103
21094
|
},
|
|
21104
21095
|
defaults: {
|
|
21105
21096
|
server_ai_max_slippage: 5
|
|
21106
|
-
},
|
|
21107
|
-
risk: {
|
|
21108
|
-
max_order_notional: 5e3,
|
|
21109
|
-
max_position_notional: 1e4
|
|
21110
21097
|
}
|
|
21111
21098
|
},
|
|
21112
21099
|
agent_cli: {
|
|
@@ -21372,7 +21359,6 @@ var init_runtime_policy_generated2 = __esm({
|
|
|
21372
21359
|
capacity_recovery_weight_per_minute: 120,
|
|
21373
21360
|
background_floor_weight: 120,
|
|
21374
21361
|
background_admission_wait_seconds: 90,
|
|
21375
|
-
cooldown_seconds: 60,
|
|
21376
21362
|
metadata_ttl_seconds: 300,
|
|
21377
21363
|
user_fees_ttl_seconds: 300,
|
|
21378
21364
|
account_mode_ttl_seconds: 30,
|
|
@@ -94674,7 +94660,7 @@ var init_hyperliquid_client = __esm({
|
|
|
94674
94660
|
input = { ...input, publicRequestPriority: input.reduceOnly === true ? "trading_reduce" : "trading_execute" };
|
|
94675
94661
|
assertPositiveNumber(input.size, "Hyperliquid order size");
|
|
94676
94662
|
assertPositiveNumber(input.limitPrice, "Hyperliquid limit price");
|
|
94677
|
-
const order = await buildHyperliquidOrderWire(input, input.tif ??
|
|
94663
|
+
const order = await buildHyperliquidOrderWire(input, input.tif ?? HYPERLIQUID_TIF_GTC, input.limitPrice, "limit");
|
|
94678
94664
|
return signHyperliquidPayload(input, {
|
|
94679
94665
|
type: "order",
|
|
94680
94666
|
orders: [order],
|
|
@@ -94743,7 +94729,7 @@ var init_hyperliquid_client = __esm({
|
|
|
94743
94729
|
isTakeProfit: member.triggerKind === "tp"
|
|
94744
94730
|
}) : await buildHyperliquidOrderWire(
|
|
94745
94731
|
memberInput,
|
|
94746
|
-
member.tif ??
|
|
94732
|
+
member.tif ?? HYPERLIQUID_TIF_GTC,
|
|
94747
94733
|
member.limitPrice,
|
|
94748
94734
|
member.priceKind ?? "limit"
|
|
94749
94735
|
)
|
|
@@ -94772,7 +94758,7 @@ var init_hyperliquid_client = __esm({
|
|
|
94772
94758
|
const order = input.orderKind === "trigger" ? await buildHyperliquidTriggerOrderWire({
|
|
94773
94759
|
...input,
|
|
94774
94760
|
triggerPrice: Number(input.triggerPrice)
|
|
94775
|
-
}) : await buildHyperliquidOrderWire(input, input.tif ??
|
|
94761
|
+
}) : await buildHyperliquidOrderWire(input, input.tif ?? HYPERLIQUID_TIF_GTC, input.limitPrice, "limit");
|
|
94776
94762
|
return signHyperliquidPayload(input, {
|
|
94777
94763
|
type: "modify",
|
|
94778
94764
|
oid: modifyTarget,
|
|
@@ -95473,8 +95459,9 @@ var init_hyperliquid_client = __esm({
|
|
|
95473
95459
|
clientOrderIds: durableMutation.clientOrderIds ?? null,
|
|
95474
95460
|
...durableMutation.protection ? { protection: durableMutation.protection } : {},
|
|
95475
95461
|
...durableMutation.protectiveActionId ? { protectiveActionId: durableMutation.protectiveActionId } : {},
|
|
95462
|
+
...durableMutation.safetyClose ? { safetyClose: durableMutation.safetyClose } : {},
|
|
95476
95463
|
// A trailing stop has no CLOID: the server binds the lot it signs.
|
|
95477
|
-
...durableMutation.protection || durableMutation.protectiveActionId || durableMutation.operationKind === "trailing_stop" ? { signedPayload: serializedPayload } : {},
|
|
95464
|
+
...durableMutation.protection || durableMutation.protectiveActionId || durableMutation.safetyClose || durableMutation.operationKind === "trailing_stop" ? { signedPayload: serializedPayload } : {},
|
|
95478
95465
|
attemptEvidence: diagnostics.first_order ? {
|
|
95479
95466
|
requestedExchangeSize: diagnostics.first_order.size,
|
|
95480
95467
|
submittedLimitPrice: diagnostics.first_order.price,
|
|
@@ -96215,6 +96202,21 @@ async function getAiTradingStatus(cookie, profileId, options) {
|
|
|
96215
96202
|
return recordStatusExchanges(await response.json());
|
|
96216
96203
|
}, { cookie });
|
|
96217
96204
|
}
|
|
96205
|
+
async function syncTradeHistoryFills(profileId, walletAddress, fills) {
|
|
96206
|
+
const response = await apiFetch(`${getApiUrl()}/trading/history/sync`, {
|
|
96207
|
+
method: "POST",
|
|
96208
|
+
headers: getProfileHeaders({
|
|
96209
|
+
"Content-Type": "application/json"
|
|
96210
|
+
}, profileId),
|
|
96211
|
+
credentials: "include",
|
|
96212
|
+
body: JSON.stringify({ wallet_address: walletAddress, fills })
|
|
96213
|
+
});
|
|
96214
|
+
if (!response.ok) {
|
|
96215
|
+
const message = await getErrorMessageFromResponse(response, "Failed to sync trade history fills", { fallbackDetail: true });
|
|
96216
|
+
throw new Error(message);
|
|
96217
|
+
}
|
|
96218
|
+
return response.json();
|
|
96219
|
+
}
|
|
96218
96220
|
async function postClientRuntime(path, profileId, body, options) {
|
|
96219
96221
|
const requestUrl2 = `${getApiUrl()}/trading/ai${path}`;
|
|
96220
96222
|
const numericProfileId = toNumericProfileId(profileId);
|
|
@@ -96520,6 +96522,13 @@ async function handOffClientRuntimeSession(profileId, payload, options) {
|
|
|
96520
96522
|
}
|
|
96521
96523
|
);
|
|
96522
96524
|
}
|
|
96525
|
+
function hostHasBrowserExchangeSession() {
|
|
96526
|
+
try {
|
|
96527
|
+
return typeof window !== "undefined" && typeof window.localStorage !== "undefined" && typeof window.sessionStorage !== "undefined";
|
|
96528
|
+
} catch {
|
|
96529
|
+
return false;
|
|
96530
|
+
}
|
|
96531
|
+
}
|
|
96523
96532
|
async function beginClientRuntimeExchangeMutation(profileId, payload, requiredRuntimeSessionId, explicitRuntimeLeaseToken, explicitRuntimeDeviceId, explicitSchedulerInstanceId) {
|
|
96524
96533
|
const authority = payload.pinnedAuthority ?? resolveClientExchangeMutationAuthority(
|
|
96525
96534
|
profileId,
|
|
@@ -96551,6 +96560,7 @@ async function beginClientRuntimeExchangeMutation(profileId, payload, requiredRu
|
|
|
96551
96560
|
...payload.protection ? { protection: payload.protection } : {},
|
|
96552
96561
|
...payload.protectiveActionId ? { protective_action_id: payload.protectiveActionId } : {},
|
|
96553
96562
|
...payload.signedPayload ? { signed_payload: payload.signedPayload } : {},
|
|
96563
|
+
...payload.safetyClose ? { safety_close: payload.safetyClose } : {},
|
|
96554
96564
|
attempt_evidence: payload.attemptEvidence ? {
|
|
96555
96565
|
requested_exchange_size: payload.attemptEvidence.requestedExchangeSize ?? null,
|
|
96556
96566
|
submitted_limit_price: payload.attemptEvidence.submittedLimitPrice ?? null,
|
|
@@ -96670,50 +96680,14 @@ async function refuseClientProtectiveAction(profileId, actionId, reasonCode, req
|
|
|
96670
96680
|
authority.requestOptions
|
|
96671
96681
|
);
|
|
96672
96682
|
}
|
|
96673
|
-
async function reportClientProtectiveEvidence(profileId, report,
|
|
96674
|
-
|
|
96675
|
-
profileId,
|
|
96676
|
-
requiredRuntimeSessionId,
|
|
96677
|
-
explicitRuntimeLeaseToken,
|
|
96678
|
-
explicitRuntimeDeviceId,
|
|
96679
|
-
explicitSchedulerInstanceId
|
|
96680
|
-
);
|
|
96681
|
-
return postClientRuntime(
|
|
96682
|
-
"/runtime/protective-evidence",
|
|
96683
|
-
authority.numericProfileId,
|
|
96684
|
-
JSON.stringify({ ...clientExchangeMutationAuthorityBody(authority), ...report }),
|
|
96685
|
-
authority.requestOptions
|
|
96686
|
-
);
|
|
96683
|
+
async function reportClientProtectiveEvidence(profileId, report, ...identity2) {
|
|
96684
|
+
return postClientDeviceReport("/runtime/protective-evidence", profileId, report, identity2);
|
|
96687
96685
|
}
|
|
96688
|
-
async function reportClientHistoryEvidence(profileId, report,
|
|
96689
|
-
|
|
96690
|
-
profileId,
|
|
96691
|
-
requiredRuntimeSessionId,
|
|
96692
|
-
explicitRuntimeLeaseToken,
|
|
96693
|
-
explicitRuntimeDeviceId,
|
|
96694
|
-
explicitSchedulerInstanceId
|
|
96695
|
-
);
|
|
96696
|
-
return postClientRuntime(
|
|
96697
|
-
"/runtime/history-evidence",
|
|
96698
|
-
authority.numericProfileId,
|
|
96699
|
-
JSON.stringify({ ...clientExchangeMutationAuthorityBody(authority), ...report }),
|
|
96700
|
-
authority.requestOptions
|
|
96701
|
-
);
|
|
96686
|
+
async function reportClientHistoryEvidence(profileId, report, ...identity2) {
|
|
96687
|
+
return postClientDeviceReport("/runtime/history-evidence", profileId, report, identity2);
|
|
96702
96688
|
}
|
|
96703
|
-
async function reportClientPortfolioEvidence(profileId, report,
|
|
96704
|
-
|
|
96705
|
-
profileId,
|
|
96706
|
-
requiredRuntimeSessionId,
|
|
96707
|
-
explicitRuntimeLeaseToken,
|
|
96708
|
-
explicitRuntimeDeviceId,
|
|
96709
|
-
explicitSchedulerInstanceId
|
|
96710
|
-
);
|
|
96711
|
-
return postClientRuntime(
|
|
96712
|
-
"/runtime/portfolio-evidence",
|
|
96713
|
-
authority.numericProfileId,
|
|
96714
|
-
JSON.stringify({ ...clientExchangeMutationAuthorityBody(authority), ...report }),
|
|
96715
|
-
authority.requestOptions
|
|
96716
|
-
);
|
|
96689
|
+
async function reportClientPortfolioEvidence(profileId, report, ...identity2) {
|
|
96690
|
+
return postClientDeviceReport("/runtime/portfolio-evidence", profileId, report, identity2);
|
|
96717
96691
|
}
|
|
96718
96692
|
async function adoptClientProtectiveLegs(profileId, payload, requiredRuntimeSessionId, explicitRuntimeLeaseToken, explicitRuntimeDeviceId, explicitSchedulerInstanceId) {
|
|
96719
96693
|
const authority = resolveClientExchangeMutationAuthority(
|
|
@@ -97412,7 +97386,7 @@ async function getClientRuntimeStatuses(profileIds, signal, options) {
|
|
|
97412
97386
|
ttlMs: viewer.requestKey ? 0 : CLIENT_RUNTIME_STATUSES_DEDUPE_TTL_MS
|
|
97413
97387
|
});
|
|
97414
97388
|
}
|
|
97415
|
-
var clientRuntimeSecretHeaders, preferencesWriteQueue, getCopyTradingRuntimeLeaseToken, getCopyTradingSchedulerInstanceId, AI_TRADE_HISTORY_BY_ORDER_IDS_MAX_BATCH, AI_TRADE_HISTORY_BY_ORDER_IDS_MAX_CONCURRENCY, resolveClientRuntimeStatusViewerHeaders, CLIENT_SUPPORTED_PROMPT_CONTRACT_VERSION, completedDeferredClientRuntimeStops, rememberCompletedDeferredClientRuntimeStop, consumeCompletedDeferredClientRuntimeStop, toNumericProfileId, buildClientRuntimeBody, shouldAttachRuntimeIdempotencyKey, attachRuntimeLeaseHeader, attachRuntimeSchedulerInstanceHeader, resolveRuntimeLeaseToken, resolveSchedulerBoundRuntimeLeaseToken, persistRuntimeLeaseFromPayload, persistRuntimeLeaseStatusMetadata, shouldClearPersistedRuntimeLeaseOnError, createRuntimeRequestError, parseClientRuntimeRequestContext, recordRuntimeAuthFailureBreadcrumb, classifyRuntimeRequestError, annotateRuntimeRequestError, CLIENT_RUNTIME_RETRYABLE_STATUSES, isRetryableClientRuntimeStatus, shouldRetryClientRuntimeHttpStatus, isRuntimeIdempotencyInProgressError, isRetryableRuntimeConflictError, resolveClientRuntimeRetryDelayMs, reconcilePendingClientExchangeMutation, CLIENT_RUNTIME_CLAIM_EXCHANGE_MUTATION_WAIT_CODES, CLIENT_EXCHANGE_AUTHORITY_DEVICE_KEY, CLIENT_EXCHANGE_AUTHORITY_SESSION_KEY, getOrCreateClientExchangeAuthorityIdentity, resolveClientExchangeMutationAuthority, pinClientExchangeMutationAuthority, CLIENT_EXCHANGE_MUTATION_AUTHORITY_MISMATCH, isClientExchangeMutationAuthorityConflict, handOffClientExchangeMutationToReconciliation, clientExchangeMutationAuthorityBody, isPendingClientExchangeMutationError, isMissingActiveClientExchangeMutationError, clientExchangeMutationReconciliationTimers, ClientExchangeMutationRebuildRequiredError, isTerminalClientExchangeMutation, clientExchangeMutationReconciliationKey, clearScheduledClientExchangeMutationReconciliation, snapshotClientExchangeMutationReconciliationAuthority, completeClientExchangeMutationReconciliation, protectiveBoundClientExchangeMutations, rememberProtectiveBoundClientExchangeMutation, isProtectiveBoundClientExchangeMutation, postClientExchangeMutationReconciliation, scheduleClientExchangeMutationReconciliation;
|
|
97389
|
+
var clientRuntimeSecretHeaders, preferencesWriteQueue, getCopyTradingRuntimeLeaseToken, getCopyTradingSchedulerInstanceId, AI_TRADE_HISTORY_BY_ORDER_IDS_MAX_BATCH, AI_TRADE_HISTORY_BY_ORDER_IDS_MAX_CONCURRENCY, resolveClientRuntimeStatusViewerHeaders, CLIENT_SUPPORTED_PROMPT_CONTRACT_VERSION, completedDeferredClientRuntimeStops, rememberCompletedDeferredClientRuntimeStop, consumeCompletedDeferredClientRuntimeStop, toNumericProfileId, buildClientRuntimeBody, shouldAttachRuntimeIdempotencyKey, attachRuntimeLeaseHeader, attachRuntimeSchedulerInstanceHeader, resolveRuntimeLeaseToken, resolveSchedulerBoundRuntimeLeaseToken, persistRuntimeLeaseFromPayload, persistRuntimeLeaseStatusMetadata, shouldClearPersistedRuntimeLeaseOnError, createRuntimeRequestError, parseClientRuntimeRequestContext, recordRuntimeAuthFailureBreadcrumb, classifyRuntimeRequestError, annotateRuntimeRequestError, CLIENT_RUNTIME_RETRYABLE_STATUSES, isRetryableClientRuntimeStatus, shouldRetryClientRuntimeHttpStatus, isRuntimeIdempotencyInProgressError, isRetryableRuntimeConflictError, resolveClientRuntimeRetryDelayMs, reconcilePendingClientExchangeMutation, CLIENT_RUNTIME_CLAIM_EXCHANGE_MUTATION_WAIT_CODES, CLIENT_EXCHANGE_AUTHORITY_DEVICE_KEY, CLIENT_EXCHANGE_AUTHORITY_SESSION_KEY, getOrCreateClientExchangeAuthorityIdentity, resolveClientExchangeMutationAuthority, pinClientExchangeMutationAuthority, CLIENT_EXCHANGE_MUTATION_AUTHORITY_MISMATCH, isClientExchangeMutationAuthorityConflict, handOffClientExchangeMutationToReconciliation, clientExchangeMutationAuthorityBody, isPendingClientExchangeMutationError, isMissingActiveClientExchangeMutationError, clientExchangeMutationReconciliationTimers, ClientExchangeMutationRebuildRequiredError, isTerminalClientExchangeMutation, clientExchangeMutationReconciliationKey, clearScheduledClientExchangeMutationReconciliation, snapshotClientExchangeMutationReconciliationAuthority, completeClientExchangeMutationReconciliation, protectiveBoundClientExchangeMutations, rememberProtectiveBoundClientExchangeMutation, isProtectiveBoundClientExchangeMutation, postClientExchangeMutationReconciliation, scheduleClientExchangeMutationReconciliation, postClientDeviceReport, reportClientTradeMarketRead;
|
|
97416
97390
|
var init_api2 = __esm({
|
|
97417
97391
|
"lib/api.ts"() {
|
|
97418
97392
|
"use strict";
|
|
@@ -97893,7 +97867,7 @@ var init_api2 = __esm({
|
|
|
97893
97867
|
"The active persisted trader lease does not match this runtime execution session."
|
|
97894
97868
|
);
|
|
97895
97869
|
}
|
|
97896
|
-
if (
|
|
97870
|
+
if (!hostHasBrowserExchangeSession()) {
|
|
97897
97871
|
throw new Error(
|
|
97898
97872
|
"Authenticated browser storage is required for manual exchange submission."
|
|
97899
97873
|
);
|
|
@@ -98077,6 +98051,16 @@ var init_api2 = __esm({
|
|
|
98077
98051
|
requestOptions: authority
|
|
98078
98052
|
});
|
|
98079
98053
|
};
|
|
98054
|
+
postClientDeviceReport = (path, profileId, report, identity2) => {
|
|
98055
|
+
const authority = resolveClientExchangeMutationAuthority(profileId, ...identity2);
|
|
98056
|
+
return postClientRuntime(
|
|
98057
|
+
path,
|
|
98058
|
+
authority.numericProfileId,
|
|
98059
|
+
JSON.stringify({ ...clientExchangeMutationAuthorityBody(authority), ...report }),
|
|
98060
|
+
authority.requestOptions
|
|
98061
|
+
);
|
|
98062
|
+
};
|
|
98063
|
+
reportClientTradeMarketRead = (profileId, mutationId, read, ...identity2) => postClientDeviceReport(`/runtime/exchange-mutations/${encodeURIComponent(mutationId)}/position-read`, profileId, read, identity2);
|
|
98080
98064
|
}
|
|
98081
98065
|
});
|
|
98082
98066
|
|
|
@@ -99463,7 +99447,8 @@ var init_browser_trading = __esm({
|
|
|
99463
99447
|
...childClientOrderIds.length ? { clientOrderIds: [String(mutation.clientOrderId), ...childClientOrderIds] } : {},
|
|
99464
99448
|
onExchangeOrderDispatched: input.onExchangeOrderDispatched,
|
|
99465
99449
|
...input.protection ? { protection: input.protection } : {},
|
|
99466
|
-
...input.onSettled ? { onSettled: input.onSettled } : {}
|
|
99450
|
+
...input.onSettled ? { onSettled: input.onSettled } : {},
|
|
99451
|
+
...input.safetyClose ? { safetyClose: input.safetyClose } : {}
|
|
99467
99452
|
},
|
|
99468
99453
|
...childClientOrderIds.length ? { triggerAcknowledgementWalletAddress: input.walletAddress ?? null } : {}
|
|
99469
99454
|
});
|
|
@@ -99777,7 +99762,8 @@ var init_browser_trading = __esm({
|
|
|
99777
99762
|
slippage: input.slippage,
|
|
99778
99763
|
reduceOnly: true,
|
|
99779
99764
|
assets: input.assets,
|
|
99780
|
-
onExchangeOrderDispatched: input.onExchangeOrderDispatched
|
|
99765
|
+
onExchangeOrderDispatched: input.onExchangeOrderDispatched,
|
|
99766
|
+
...input.safetyClose ? { safetyClose: { reason: input.safetyClose, position_size: String(positionSize) } } : {}
|
|
99781
99767
|
});
|
|
99782
99768
|
};
|
|
99783
99769
|
}
|
|
@@ -102028,7 +102014,7 @@ var init_client_exchange_mutations = __esm({
|
|
|
102028
102014
|
});
|
|
102029
102015
|
|
|
102030
102016
|
// lib/runtime/execution-guard-contract.ts
|
|
102031
|
-
var unitsFromPosition, signedUnitsFromPosition, signedUnitsFromEntryPosition, classifyExecutionIntent, reductionFirstOrder,
|
|
102017
|
+
var unitsFromPosition, signedUnitsFromPosition, signedUnitsFromEntryPosition, classifyExecutionIntent, reductionFirstOrder, orderMetadataRetryReason, copyClosingSize, copyOrderClosingSize, copyOrderNotionalCap, resolveExecutionTarget, decisionOrderSizeAsset, flipExecutionLegs, executedOrderPositionEvent;
|
|
102032
102018
|
var init_execution_guard_contract = __esm({
|
|
102033
102019
|
"lib/runtime/execution-guard-contract.ts"() {
|
|
102034
102020
|
"use strict";
|
|
@@ -102229,32 +102215,12 @@ var init_execution_guard_contract = __esm({
|
|
|
102229
102215
|
const reduces = plans.map((plan) => classifyExecutionIntent(plan.decision, plan.units, plan.signedUnits).reduceOnly);
|
|
102230
102216
|
return plans.map((_, index) => index).sort((left, right) => Number(reduces[right]) - Number(reduces[left]));
|
|
102231
102217
|
};
|
|
102232
|
-
usdAmount = (value) => `$${value.toLocaleString("en-US", {
|
|
102233
|
-
minimumFractionDigits: USD_DISPLAY_DECIMALS,
|
|
102234
|
-
maximumFractionDigits: USD_DISPLAY_DECIMALS
|
|
102235
|
-
})}`;
|
|
102236
102218
|
orderMetadataRetryReason = (rejection) => {
|
|
102237
102219
|
const message = String(rejection ?? "").toLowerCase();
|
|
102238
102220
|
if (message.includes("invalid size")) return "invalid_size";
|
|
102239
102221
|
if (message.includes("reference price") && message.includes("95% away")) return "reference_price";
|
|
102240
102222
|
return null;
|
|
102241
102223
|
};
|
|
102242
|
-
orderCeilingRefusal = (input) => {
|
|
102243
|
-
const closingSide2 = input.side === "sell" && input.currentPositionSize > 0 || input.side === "buy" && input.currentPositionSize < 0;
|
|
102244
|
-
if (input.reduceOnly && closingSide2 && input.size <= Math.abs(input.currentPositionSize)) {
|
|
102245
|
-
return null;
|
|
102246
|
-
}
|
|
102247
|
-
const orderNotional = input.size * input.price;
|
|
102248
|
-
if (orderNotional > input.maxOrderNotional) {
|
|
102249
|
-
return `Order notional ${usdAmount(orderNotional)} exceeds limit ${usdAmount(input.maxOrderNotional)}`;
|
|
102250
|
-
}
|
|
102251
|
-
const resultingSize = input.side === "buy" ? input.currentPositionSize + input.size : input.currentPositionSize - input.size;
|
|
102252
|
-
const resultingNotional = Math.abs(resultingSize) * input.price;
|
|
102253
|
-
if (resultingNotional > input.maxPositionNotional) {
|
|
102254
|
-
return `Resulting position notional ${usdAmount(resultingNotional)} exceeds limit ${usdAmount(input.maxPositionNotional)}`;
|
|
102255
|
-
}
|
|
102256
|
-
return null;
|
|
102257
|
-
};
|
|
102258
102224
|
copyClosingSize = (destinationPosition, destinationDelta) => destinationPosition * destinationDelta >= 0 ? 0 : Math.min(Math.abs(destinationDelta), Math.abs(destinationPosition));
|
|
102259
102225
|
copyOrderClosingSize = (input) => {
|
|
102260
102226
|
const size = Number.isFinite(input.size) && input.size > 0 ? input.size : 0;
|
|
@@ -111615,19 +111581,6 @@ var init_runtime_execution = __esm({
|
|
|
111615
111581
|
executionSnapshotCapturedAt
|
|
111616
111582
|
};
|
|
111617
111583
|
}
|
|
111618
|
-
if (input.executionMode === "server") {
|
|
111619
|
-
const ceilingRefusal = orderCeilingRefusal({
|
|
111620
|
-
side: classified.side,
|
|
111621
|
-
size: sizeAsset,
|
|
111622
|
-
price: executionPrice,
|
|
111623
|
-
// A flip's close has filled by now: its new position starts from flat.
|
|
111624
|
-
currentPositionSize: targetResolution.closeOpposingPosition ? 0 : currentPositionSize,
|
|
111625
|
-
reduceOnly: classified.reduceOnly === true,
|
|
111626
|
-
maxOrderNotional: runtime_policy_generated_default2.trading.risk.max_order_notional,
|
|
111627
|
-
maxPositionNotional: runtime_policy_generated_default2.trading.risk.max_position_notional
|
|
111628
|
-
});
|
|
111629
|
-
if (ceilingRefusal !== null) throw new Error(`Order rejected by risk manager: ${ceilingRefusal}`);
|
|
111630
|
-
}
|
|
111631
111584
|
const entryRequiresFlatAbsenceProof = Number.isFinite(currentPositionSize) && currentPositionSize === 0 || targetResolution.closeOpposingPosition;
|
|
111632
111585
|
if (entryRequiresFlatAbsenceProof) {
|
|
111633
111586
|
const finalProtectionObservation = await verifyNoLiveClientProtectiveTriggers(
|
|
@@ -113380,7 +113333,7 @@ var init_periodic_schedule = __esm({
|
|
|
113380
113333
|
});
|
|
113381
113334
|
|
|
113382
113335
|
// lib/runtime/provider-observability.ts
|
|
113383
|
-
var MAX_DIAGNOSTIC_LIST_ITEMS, record4, ERROR_TOKEN, ERROR_DOMAIN, ERROR_INPUT, ERROR_ECHO_REDACTIONS, ERROR_PROSE_REDACTIONS, CONTROL_CHARACTER_RUN, WHITESPACE_RUN, collapseProse, settled, REDACTED_MARKER_START, boundedMessage, normalizeProviderError, identifier, count4, normalizeProviderDiagnostics, providerRequestId, hash4, googleCredentialDiagnostics, extractProviderDiagnostics, estimateRequestInputTokens;
|
|
113336
|
+
var MAX_DIAGNOSTIC_LIST_ITEMS, record4, ERROR_TOKEN, ERROR_DOMAIN, ERROR_INPUT, ERROR_ECHO_REDACTIONS, ERROR_PROSE_REDACTIONS, CONTROL_CHARACTER_RUN, WHITESPACE_RUN, collapseProse, settled, REDACTED_MARKER_START, boundedMessage, normalizeProviderError, identifier, count4, normalizeProviderDiagnostics, providerRequestId, hash4, googleCredentialDiagnostics, withExecutionMode, extractProviderDiagnostics, estimateRequestInputTokens;
|
|
113384
113337
|
var init_provider_observability = __esm({
|
|
113385
113338
|
"lib/runtime/provider-observability.ts"() {
|
|
113386
113339
|
"use strict";
|
|
@@ -113518,7 +113471,12 @@ var init_provider_observability = __esm({
|
|
|
113518
113471
|
const digest2 = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(value));
|
|
113519
113472
|
return Array.from(new Uint8Array(digest2), (b3) => b3.toString(HEX_RADIX).padStart(BYTE_HEX_DIGITS, "0")).join("");
|
|
113520
113473
|
};
|
|
113521
|
-
googleCredentialDiagnostics = async (apiKey) => ({ credential_ref: await hash4(`google:${apiKey}`)
|
|
113474
|
+
googleCredentialDiagnostics = async (apiKey) => ({ credential_ref: await hash4(`google:${apiKey}`) });
|
|
113475
|
+
withExecutionMode = (diagnostics, executionMode) => ({
|
|
113476
|
+
...diagnostics,
|
|
113477
|
+
execution_mode: executionMode,
|
|
113478
|
+
...diagnostics.egress_route === void 0 || diagnostics.egress_route === "node" ? {} : { egress_route: executionMode === "server" ? "server_direct" : "client_direct" }
|
|
113479
|
+
});
|
|
113522
113480
|
extractProviderDiagnostics = async (payload, response) => {
|
|
113523
113481
|
const result = {};
|
|
113524
113482
|
const retryAfter = response?.headers?.get?.("retry-after");
|
|
@@ -116322,6 +116280,156 @@ var init_client_runtime_status_store = __esm({
|
|
|
116322
116280
|
}
|
|
116323
116281
|
});
|
|
116324
116282
|
|
|
116283
|
+
// lib/trade-history-order-id.ts
|
|
116284
|
+
var INTEGER_ID_PATTERN, toSafeIntegerAlias, addOrderIdLookupKey, collectOrderIdLookupKeys;
|
|
116285
|
+
var init_trade_history_order_id = __esm({
|
|
116286
|
+
"lib/trade-history-order-id.ts"() {
|
|
116287
|
+
"use strict";
|
|
116288
|
+
init_define_VTX_CLAUDE_CODE_POLICY();
|
|
116289
|
+
init_define_VTX_EXO_POLICY();
|
|
116290
|
+
init_define_VTX_GROK_POLICY();
|
|
116291
|
+
init_define_VTX_PI_MODEL_POLICY();
|
|
116292
|
+
INTEGER_ID_PATTERN = /^-?\d+$/;
|
|
116293
|
+
toSafeIntegerAlias = (rawString) => {
|
|
116294
|
+
if (!INTEGER_ID_PATTERN.test(rawString)) {
|
|
116295
|
+
return null;
|
|
116296
|
+
}
|
|
116297
|
+
try {
|
|
116298
|
+
const asBigInt = BigInt(rawString);
|
|
116299
|
+
if (asBigInt > BigInt(Number.MAX_SAFE_INTEGER) || asBigInt < BigInt(Number.MIN_SAFE_INTEGER)) {
|
|
116300
|
+
return null;
|
|
116301
|
+
}
|
|
116302
|
+
return String(Number(rawString));
|
|
116303
|
+
} catch {
|
|
116304
|
+
return null;
|
|
116305
|
+
}
|
|
116306
|
+
};
|
|
116307
|
+
addOrderIdLookupKey = (target, rawValue) => {
|
|
116308
|
+
if (rawValue === null || rawValue === void 0) {
|
|
116309
|
+
return;
|
|
116310
|
+
}
|
|
116311
|
+
if (typeof rawValue === "bigint") {
|
|
116312
|
+
target.add(rawValue.toString());
|
|
116313
|
+
return;
|
|
116314
|
+
}
|
|
116315
|
+
if (typeof rawValue === "number") {
|
|
116316
|
+
if (!Number.isFinite(rawValue)) {
|
|
116317
|
+
return;
|
|
116318
|
+
}
|
|
116319
|
+
target.add(String(rawValue));
|
|
116320
|
+
return;
|
|
116321
|
+
}
|
|
116322
|
+
if (typeof rawValue === "string") {
|
|
116323
|
+
const trimmed = rawValue.trim();
|
|
116324
|
+
if (!trimmed) {
|
|
116325
|
+
return;
|
|
116326
|
+
}
|
|
116327
|
+
target.add(trimmed);
|
|
116328
|
+
const numericAlias = toSafeIntegerAlias(trimmed);
|
|
116329
|
+
if (numericAlias) {
|
|
116330
|
+
target.add(numericAlias);
|
|
116331
|
+
}
|
|
116332
|
+
}
|
|
116333
|
+
};
|
|
116334
|
+
collectOrderIdLookupKeys = (rawValue) => {
|
|
116335
|
+
const keys = /* @__PURE__ */ new Set();
|
|
116336
|
+
addOrderIdLookupKey(keys, rawValue);
|
|
116337
|
+
return Array.from(keys);
|
|
116338
|
+
};
|
|
116339
|
+
}
|
|
116340
|
+
});
|
|
116341
|
+
|
|
116342
|
+
// lib/runtime/client-trade-readback.ts
|
|
116343
|
+
var filledOrderIds, syncFilledOrderFills, readClientTradeOutcome, tradeMutationId, reportClientTradeReadback;
|
|
116344
|
+
var init_client_trade_readback = __esm({
|
|
116345
|
+
"lib/runtime/client-trade-readback.ts"() {
|
|
116346
|
+
"use strict";
|
|
116347
|
+
init_define_VTX_CLAUDE_CODE_POLICY();
|
|
116348
|
+
init_define_VTX_EXO_POLICY();
|
|
116349
|
+
init_define_VTX_GROK_POLICY();
|
|
116350
|
+
init_define_VTX_PI_MODEL_POLICY();
|
|
116351
|
+
init_runtime_policy_generated2();
|
|
116352
|
+
init_api2();
|
|
116353
|
+
init_trade_history_order_id();
|
|
116354
|
+
init_hyperliquid_account_state_adapter();
|
|
116355
|
+
init_hyperliquid_client();
|
|
116356
|
+
init_hyperliquid_market_symbol();
|
|
116357
|
+
filledOrderIds = (exchangeResult) => {
|
|
116358
|
+
const statuses = exchangeResult?.response?.data?.statuses;
|
|
116359
|
+
const ids = /* @__PURE__ */ new Set();
|
|
116360
|
+
for (const status of Array.isArray(statuses) ? statuses : []) {
|
|
116361
|
+
const filled = status?.filled;
|
|
116362
|
+
for (const id2 of collectOrderIdLookupKeys(filled?.oid)) ids.add(id2);
|
|
116363
|
+
}
|
|
116364
|
+
return ids;
|
|
116365
|
+
};
|
|
116366
|
+
syncFilledOrderFills = async (target, exchangeResult) => {
|
|
116367
|
+
const orderIds = filledOrderIds(exchangeResult);
|
|
116368
|
+
if (orderIds.size === 0) return;
|
|
116369
|
+
const {
|
|
116370
|
+
close_fill_sync_max_attempts: maxAttempts,
|
|
116371
|
+
close_fill_sync_retry_step_milliseconds: retryStepMs
|
|
116372
|
+
} = runtime_policy_generated_default2.trading.engine.client_runtime;
|
|
116373
|
+
for (let attempt2 = 0; attempt2 < maxAttempts; attempt2 += 1) {
|
|
116374
|
+
if (attempt2 > 0) await new Promise((resolve16) => setTimeout(resolve16, attempt2 * retryStepMs));
|
|
116375
|
+
try {
|
|
116376
|
+
const { rawFills } = await fetchBrowserUserFills({
|
|
116377
|
+
config: target.config,
|
|
116378
|
+
walletAddress: target.walletAddress,
|
|
116379
|
+
symbols: [target.symbol],
|
|
116380
|
+
forceRefresh: true,
|
|
116381
|
+
publicRequestPriority: "trading_reconcile",
|
|
116382
|
+
signal: target.signal
|
|
116383
|
+
});
|
|
116384
|
+
const matching = rawFills.filter((fill) => collectOrderIdLookupKeys(fill.oid).some((id2) => orderIds.has(id2)));
|
|
116385
|
+
if (matching.length > 0) {
|
|
116386
|
+
await syncTradeHistoryFills(Number(target.profileId), target.walletAddress, matching);
|
|
116387
|
+
return;
|
|
116388
|
+
}
|
|
116389
|
+
} catch {
|
|
116390
|
+
}
|
|
116391
|
+
}
|
|
116392
|
+
};
|
|
116393
|
+
readClientTradeOutcome = async (target, exchangeResult) => {
|
|
116394
|
+
const [position] = await Promise.all([
|
|
116395
|
+
fetchBrowserPosition({
|
|
116396
|
+
config: target.config,
|
|
116397
|
+
walletAddress: target.walletAddress,
|
|
116398
|
+
symbol: target.symbol,
|
|
116399
|
+
profileId: target.profileId,
|
|
116400
|
+
publicRequestPriority: "trading_reconcile",
|
|
116401
|
+
signal: target.signal
|
|
116402
|
+
}),
|
|
116403
|
+
syncFilledOrderFills(target, exchangeResult)
|
|
116404
|
+
]);
|
|
116405
|
+
return { position, position_dex: getHyperliquidMarketDex(target.symbol) };
|
|
116406
|
+
};
|
|
116407
|
+
tradeMutationId = (outcome) => {
|
|
116408
|
+
const id2 = outcome instanceof HyperliquidExchangeRejectionError ? outcome.clientMutationId : outcome?.client_runtime_mutation_id;
|
|
116409
|
+
return typeof id2 === "string" && id2.trim() ? id2.trim() : null;
|
|
116410
|
+
};
|
|
116411
|
+
reportClientTradeReadback = async (target, outcome) => {
|
|
116412
|
+
try {
|
|
116413
|
+
const mutationId = tradeMutationId(outcome);
|
|
116414
|
+
const walletAddress = String(target.walletAddress || "").trim();
|
|
116415
|
+
const { config: config2, authority } = target;
|
|
116416
|
+
if (target.executionMode !== "client" || !mutationId || !walletAddress || !config2) return;
|
|
116417
|
+
const read = await readClientTradeOutcome(
|
|
116418
|
+
{ ...target, walletAddress, config: config2 },
|
|
116419
|
+
outcome instanceof Error ? null : outcome
|
|
116420
|
+
);
|
|
116421
|
+
await reportClientTradeMarketRead(target.profileId, mutationId, read, ...authority ? [
|
|
116422
|
+
authority.runtimeSessionId,
|
|
116423
|
+
authority.runtimeLeaseToken,
|
|
116424
|
+
authority.runtimeDeviceId,
|
|
116425
|
+
authority.schedulerInstanceId
|
|
116426
|
+
] : []);
|
|
116427
|
+
} catch {
|
|
116428
|
+
}
|
|
116429
|
+
};
|
|
116430
|
+
}
|
|
116431
|
+
});
|
|
116432
|
+
|
|
116325
116433
|
// lib/runtime/perp-dex-scope.ts
|
|
116326
116434
|
var perpDexScopeForSymbols, equityVenuesForSymbols, profileEquityVenues, profileExchanges, positionsOnVenues;
|
|
116327
116435
|
var init_perp_dex_scope = __esm({
|
|
@@ -116377,6 +116485,7 @@ var init_client_killswitch = __esm({
|
|
|
116377
116485
|
init_api2();
|
|
116378
116486
|
init_constants();
|
|
116379
116487
|
init_browser_trading();
|
|
116488
|
+
init_client_trade_readback();
|
|
116380
116489
|
init_perp_dex_scope();
|
|
116381
116490
|
init_hyperliquid_account_state_adapter();
|
|
116382
116491
|
toPositiveFinite2 = (value) => {
|
|
@@ -116546,6 +116655,7 @@ var init_client_killswitch = __esm({
|
|
|
116546
116655
|
),
|
|
116547
116656
|
Math.round(timeoutSeconds * MS_PER_SECOND)
|
|
116548
116657
|
);
|
|
116658
|
+
const outcomes = [];
|
|
116549
116659
|
try {
|
|
116550
116660
|
for (let index = 0; index < positions.length; index += 1) {
|
|
116551
116661
|
const position = positions[index];
|
|
@@ -116554,7 +116664,7 @@ var init_client_killswitch = __esm({
|
|
|
116554
116664
|
break;
|
|
116555
116665
|
}
|
|
116556
116666
|
try {
|
|
116557
|
-
await executeClientClosePosition({
|
|
116667
|
+
const outcome = await executeClientClosePosition({
|
|
116558
116668
|
profileId: input.profileId,
|
|
116559
116669
|
walletAddress: input.walletAddress,
|
|
116560
116670
|
config: input.config,
|
|
@@ -116562,16 +116672,27 @@ var init_client_killswitch = __esm({
|
|
|
116562
116672
|
symbol: position.symbol,
|
|
116563
116673
|
size: Math.abs(Number(position.size)),
|
|
116564
116674
|
position,
|
|
116565
|
-
signal: closeController.signal
|
|
116675
|
+
signal: closeController.signal,
|
|
116676
|
+
...input.authority ? { ...input.authority, safetyClose: input.reason } : {}
|
|
116566
116677
|
});
|
|
116678
|
+
outcomes.push({ symbol: position.symbol, outcome });
|
|
116567
116679
|
positionsClosed += 1;
|
|
116568
|
-
} catch {
|
|
116680
|
+
} catch (error48) {
|
|
116681
|
+
outcomes.push({ symbol: position.symbol, outcome: error48 });
|
|
116569
116682
|
positionCloseFailures += 1;
|
|
116570
116683
|
}
|
|
116571
116684
|
}
|
|
116572
116685
|
} finally {
|
|
116573
116686
|
clearTimeout(timeoutId);
|
|
116574
116687
|
}
|
|
116688
|
+
await Promise.all(outcomes.map(({ symbol: symbol2, outcome }) => reportClientTradeReadback({
|
|
116689
|
+
profileId: input.profileId,
|
|
116690
|
+
walletAddress: input.walletAddress,
|
|
116691
|
+
config: input.config,
|
|
116692
|
+
symbol: symbol2,
|
|
116693
|
+
executionMode: input.executionMode,
|
|
116694
|
+
authority: input.authority
|
|
116695
|
+
}, outcome)));
|
|
116575
116696
|
return {
|
|
116576
116697
|
requested: true,
|
|
116577
116698
|
positionsClosed,
|
|
@@ -119010,7 +119131,8 @@ var init_provider_client = __esm({
|
|
|
119010
119131
|
providerDispatchClockMs = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
119011
119132
|
beginProviderDispatch = (requestBody) => ({
|
|
119012
119133
|
requestInputTokens: estimateRequestInputTokens(requestBody),
|
|
119013
|
-
|
|
119134
|
+
// Where the call runs is its caller's to say (withExecutionMode, on its invocation record).
|
|
119135
|
+
providerDiagnostics: {},
|
|
119014
119136
|
sentReasoningParameters: extractReasoningParameters(requestBody),
|
|
119015
119137
|
effectiveReasoningParameters: {},
|
|
119016
119138
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -121057,7 +121179,7 @@ var init_provider_client = __esm({
|
|
|
121057
121179
|
provider_request_id: input.providerRequestId ?? response?.providerRequestId,
|
|
121058
121180
|
request_input_tokens: input.requestInputTokens ?? response?.requestInputTokens,
|
|
121059
121181
|
request_input_tokens_source: (input.requestInputTokens ?? response?.requestInputTokens) != null ? "estimated_chars_v1" : null,
|
|
121060
|
-
provider_diagnostics: input.providerDiagnostics ?? response?.providerDiagnostics ?? {},
|
|
121182
|
+
provider_diagnostics: withExecutionMode(input.providerDiagnostics ?? response?.providerDiagnostics ?? {}, input.executionMode),
|
|
121061
121183
|
service_tier: response?.serviceTier,
|
|
121062
121184
|
system_fingerprint: response?.systemFingerprint,
|
|
121063
121185
|
credential_slot_index: input.credentialSlotIndex,
|
|
@@ -121222,6 +121344,7 @@ var init_provider_client = __esm({
|
|
|
121222
121344
|
} : void 0;
|
|
121223
121345
|
const maxTokens = requestedMaxTokens ?? null;
|
|
121224
121346
|
const runtimeMode = toRuntimeExecutionMode(input.mode);
|
|
121347
|
+
const { executionMode } = input;
|
|
121225
121348
|
const normalizedExtraMessages = normalizeRuntimeChatHistory(extraMessages);
|
|
121226
121349
|
const invocationContext = input.invocationContext ?? defaultInvocationContext();
|
|
121227
121350
|
const priorInvocationAttempts = [...input.invocationAttemptChain ?? []];
|
|
@@ -121255,6 +121378,7 @@ var init_provider_client = __esm({
|
|
|
121255
121378
|
const missingKey = new Error(openAiCompatibleOverrideConfigured ? "No API key is saved for the OpenAI-compatible endpoint. Save that endpoint's own key in System settings; the OpenAI key is never sent to a custom endpoint." : `No profile API key was provided for source '${provider}'.`);
|
|
121256
121379
|
const neverSent = await buildBrowserInvocation({
|
|
121257
121380
|
context: invocationContext,
|
|
121381
|
+
executionMode,
|
|
121258
121382
|
attemptIndex: priorInvocationAttempts.length,
|
|
121259
121383
|
status: "failed",
|
|
121260
121384
|
provider,
|
|
@@ -121300,6 +121424,7 @@ var init_provider_client = __esm({
|
|
|
121300
121424
|
const errorDetail = String(attempt2.errorDetail || "Provider compatibility dispatch failed.");
|
|
121301
121425
|
chain.push(await buildBrowserInvocation({
|
|
121302
121426
|
context: invocationContext,
|
|
121427
|
+
executionMode,
|
|
121303
121428
|
attemptIndex: chain.length,
|
|
121304
121429
|
status: "failed",
|
|
121305
121430
|
provider,
|
|
@@ -121635,6 +121760,7 @@ var init_provider_client = __esm({
|
|
|
121635
121760
|
) : null;
|
|
121636
121761
|
const failedInvocation = await buildBrowserInvocation({
|
|
121637
121762
|
context: invocationContext,
|
|
121763
|
+
executionMode,
|
|
121638
121764
|
attemptIndex: invocationAttempts2.length,
|
|
121639
121765
|
status: nativeFailureKind === "timeout" ? "failed" : isAbortLikeError(error48) ? "cancelled" : "failed",
|
|
121640
121766
|
provider,
|
|
@@ -121840,6 +121966,7 @@ var init_provider_client = __esm({
|
|
|
121840
121966
|
);
|
|
121841
121967
|
const successInvocation = await buildBrowserInvocation({
|
|
121842
121968
|
context: invocationContext,
|
|
121969
|
+
executionMode,
|
|
121843
121970
|
attemptIndex: observedInvocationAttempts.length,
|
|
121844
121971
|
status: "succeeded",
|
|
121845
121972
|
provider,
|
|
@@ -128488,6 +128615,7 @@ ${stringifyPromptJson(candlesPayload)}
|
|
|
128488
128615
|
},
|
|
128489
128616
|
profileId: input.profileId,
|
|
128490
128617
|
mode: input.mode,
|
|
128618
|
+
executionMode: input.executionMode,
|
|
128491
128619
|
provider: entryProvider,
|
|
128492
128620
|
model: entry.model_id,
|
|
128493
128621
|
systemPrompt,
|
|
@@ -128869,6 +128997,7 @@ ${reviewOutputContract}`;
|
|
|
128869
128997
|
},
|
|
128870
128998
|
profileId: input.profileId,
|
|
128871
128999
|
mode: input.mode,
|
|
129000
|
+
executionMode: input.executionMode,
|
|
128872
129001
|
provider: reviewProvider,
|
|
128873
129002
|
model: reviewModel,
|
|
128874
129003
|
systemPrompt: reviewPromptArtifacts.systemPrompt,
|
|
@@ -130192,7 +130321,8 @@ var init_engine = __esm({
|
|
|
130192
130321
|
this._primaryAnalysisDisabled = false;
|
|
130193
130322
|
this._loopEarlyReturnRetryDelayMs = CLIENT_RUNTIME_POLICY.loop_early_return_retry_milliseconds;
|
|
130194
130323
|
this._executionModeMismatchConsecutiveCount = 0;
|
|
130195
|
-
|
|
130324
|
+
// Set by attach from the host's own answer; unknown before then.
|
|
130325
|
+
this._expectedExecutionMode = null;
|
|
130196
130326
|
this._settleUnreportedModelCalls = null;
|
|
130197
130327
|
// How many of an error's model calls its last error report carried.
|
|
130198
130328
|
this._lastErrorReportCalls = null;
|
|
@@ -130417,7 +130547,10 @@ var init_engine = __esm({
|
|
|
130417
130547
|
config: paused.config,
|
|
130418
130548
|
signingKey,
|
|
130419
130549
|
timeoutSeconds,
|
|
130420
|
-
venues: stopCloseVenues
|
|
130550
|
+
venues: stopCloseVenues,
|
|
130551
|
+
authority: this.safetyCloseAuthority(),
|
|
130552
|
+
executionMode: this._expectedExecutionMode,
|
|
130553
|
+
reason: "close_on_stop"
|
|
130421
130554
|
});
|
|
130422
130555
|
if (summary.positionCloseFailures > 0) {
|
|
130423
130556
|
throw new Error(`${summary.positionCloseFailures} position(s) could not be closed`);
|
|
@@ -131350,7 +131483,20 @@ var init_engine = __esm({
|
|
|
131350
131483
|
if (lease?.runtimeSessionId !== sessionId || lease.deviceId !== deviceId || lease.mode !== "trader" || !lease.runtimeLeaseToken) return null;
|
|
131351
131484
|
return { runtimeSessionId: sessionId, runtimeLeaseToken: lease.runtimeLeaseToken, runtimeDeviceId: deviceId, schedulerInstanceId: this._instanceId };
|
|
131352
131485
|
}
|
|
131353
|
-
/**
|
|
131486
|
+
/**
|
|
131487
|
+
* The authority a safety close this engine sends outside its cycle (a kill
|
|
131488
|
+
* switch's, a close on stop's) signs with. A browser or desktop page keeps
|
|
131489
|
+
* exactly the authority it had (its own session, or a trader lease it may
|
|
131490
|
+
* use), so its safety close meets no check it did not meet before. A Node
|
|
131491
|
+
* host (the CLI, Android's or VTX's runtime host) has no browser session:
|
|
131492
|
+
* it signs with this engine's own trader lease, bound to a scheduler
|
|
131493
|
+
* instance or not (an agent token's claim binds none), and the close is then
|
|
131494
|
+
* marked a safety close (client-killswitch.ts), so a stale runtime contract
|
|
131495
|
+
* or a bot no longer set to run does not refuse it.
|
|
131496
|
+
*/
|
|
131497
|
+
safetyCloseAuthority() {
|
|
131498
|
+
return hostHasBrowserExchangeSession() ? null : this.traderLeaseAuthority;
|
|
131499
|
+
}
|
|
131354
131500
|
/**
|
|
131355
131501
|
* Resolves once no cycle is in flight, or after the timeout: a Node runtime
|
|
131356
131502
|
* host draining for a restart lets the current cycle finish, as a Python
|
|
@@ -131369,6 +131515,7 @@ var init_engine = __esm({
|
|
|
131369
131515
|
clearTimeout(timer);
|
|
131370
131516
|
return settled2;
|
|
131371
131517
|
}
|
|
131518
|
+
/** Whether this engine runs, starts, or stops a runtime (never claim it again). */
|
|
131372
131519
|
get active() {
|
|
131373
131520
|
return this._startPromise !== null || this._isStopping || this._state === "running" || this._state === "stale" || this._state === "offline";
|
|
131374
131521
|
}
|
|
@@ -131404,7 +131551,7 @@ var init_engine = __esm({
|
|
|
131404
131551
|
if (String(lease.profile_id) !== String(profileId) || !grantSessionId || !grantDeviceId) {
|
|
131405
131552
|
throw new Error("The runtime grant does not belong to this profile.");
|
|
131406
131553
|
}
|
|
131407
|
-
this._expectedExecutionMode = options.executionMode
|
|
131554
|
+
this._expectedExecutionMode = options.executionMode;
|
|
131408
131555
|
this._manualRunRequested = false;
|
|
131409
131556
|
this._aiScheduleCheckPending = false;
|
|
131410
131557
|
this._checkOnlyCycleInFlight = false;
|
|
@@ -132593,6 +132740,11 @@ var init_engine = __esm({
|
|
|
132593
132740
|
await this.reportError("Client runtime session secrets were not initialized.", { fatal: true });
|
|
132594
132741
|
return;
|
|
132595
132742
|
}
|
|
132743
|
+
const executionMode = this._expectedExecutionMode;
|
|
132744
|
+
if (!executionMode) {
|
|
132745
|
+
await this.reportError("Client runtime execution mode was not initialized.", { fatal: true });
|
|
132746
|
+
return;
|
|
132747
|
+
}
|
|
132596
132748
|
const profileId = this._profileId;
|
|
132597
132749
|
const sessionId = this._sessionId;
|
|
132598
132750
|
const deviceId = this._deviceId;
|
|
@@ -132839,7 +132991,7 @@ var init_engine = __esm({
|
|
|
132839
132991
|
},
|
|
132840
132992
|
ignoreAiSchedule,
|
|
132841
132993
|
aiScheduleCheckOnly,
|
|
132842
|
-
executionMode
|
|
132994
|
+
executionMode,
|
|
132843
132995
|
onPreparedExecutionContexts: async ({ config: config2, executionContexts }) => {
|
|
132844
132996
|
if (runtimeMode !== "trader") return;
|
|
132845
132997
|
const cancelled = () => this._state !== "running" || this._isStopping || this._windowHandoffRequested || this._killswitchLatched || this._profileId !== profileId || this._sessionId !== sessionId || this._deviceId !== deviceId || (getRuntimeContractBindingTupleToken(this._activeRuntimeContractIdentity) ?? getRuntimeStatusContractBindingTupleToken(this._runtimeStatus)) !== loopContractBindingToken;
|
|
@@ -132857,6 +133009,7 @@ var init_engine = __esm({
|
|
|
132857
133009
|
decision: "HOLD",
|
|
132858
133010
|
units: 0,
|
|
132859
133011
|
executionContext,
|
|
133012
|
+
executionMode,
|
|
132860
133013
|
shouldCancelBeforeExchangeOrderDispatch: cancelled,
|
|
132861
133014
|
beforeTrailingMaintenance: (signal) => this._assertFreshClientWalletAssignment(profileId, executionContext.walletAddress, signal, "trailing stop maintenance"),
|
|
132862
133015
|
onExchangeOrderDispatched: () => {
|
|
@@ -133369,7 +133522,7 @@ var init_engine = __esm({
|
|
|
133369
133522
|
config: config2,
|
|
133370
133523
|
decision: plan.decision,
|
|
133371
133524
|
units: plan.units,
|
|
133372
|
-
executionMode
|
|
133525
|
+
executionMode,
|
|
133373
133526
|
executionContext: plan.executionContext,
|
|
133374
133527
|
skipTrailingMaintenance: this._trailingObservations.some((request) => request.executionContext.decisionSnapshotId === plan.executionContext.decisionSnapshotId),
|
|
133375
133528
|
signal: analysisAbortController.signal,
|
|
@@ -134910,7 +135063,10 @@ var init_engine = __esm({
|
|
|
134910
135063
|
config: config2,
|
|
134911
135064
|
signingKey,
|
|
134912
135065
|
timeoutSeconds: closeTimeoutSeconds,
|
|
134913
|
-
venues: evaluation.closeVenues
|
|
135066
|
+
venues: evaluation.closeVenues,
|
|
135067
|
+
authority: this.safetyCloseAuthority(),
|
|
135068
|
+
executionMode: this._expectedExecutionMode,
|
|
135069
|
+
reason: "killswitch"
|
|
134914
135070
|
});
|
|
134915
135071
|
} else {
|
|
134916
135072
|
closeSummary = {
|
|
@@ -135904,7 +136060,9 @@ async function attachEngine(options, engine, claimed, claimKind) {
|
|
|
135904
136060
|
claimKind,
|
|
135905
136061
|
preflight,
|
|
135906
136062
|
skipServerHydration: true,
|
|
135907
|
-
unboundSchedulerLease: true
|
|
136063
|
+
unboundSchedulerLease: true,
|
|
136064
|
+
// The headless Client Mode runtime runs on the user's own machine.
|
|
136065
|
+
executionMode: "client"
|
|
135908
136066
|
});
|
|
135909
136067
|
}
|
|
135910
136068
|
async function persistRuntimeState(options, identity2, { claim }) {
|