@vtxmacro/cli 2026.10.63 → 2026.10.64
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 +56 -0
- package/bin/vtx-mcp.js +57 -1
- package/bin/vtx-service-bootstrap.js +57 -1
- package/bin/vtx-service-launcher.js +56 -0
- package/bin/vtx.js +394 -226
- package/package.json +1 -1
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.64", 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
|
|
|
@@ -636,6 +636,54 @@ var init_runtime_policy_generated = __esm({
|
|
|
636
636
|
arena_leaderboard_entries: 3,
|
|
637
637
|
data_revalidate_seconds: 60
|
|
638
638
|
},
|
|
639
|
+
google_analytics: {
|
|
640
|
+
excluded_country_codes: [
|
|
641
|
+
"AT",
|
|
642
|
+
"BE",
|
|
643
|
+
"BG",
|
|
644
|
+
"HR",
|
|
645
|
+
"CY",
|
|
646
|
+
"CZ",
|
|
647
|
+
"DK",
|
|
648
|
+
"EE",
|
|
649
|
+
"FI",
|
|
650
|
+
"FR",
|
|
651
|
+
"DE",
|
|
652
|
+
"GR",
|
|
653
|
+
"HU",
|
|
654
|
+
"IE",
|
|
655
|
+
"IT",
|
|
656
|
+
"LV",
|
|
657
|
+
"LT",
|
|
658
|
+
"LU",
|
|
659
|
+
"MT",
|
|
660
|
+
"NL",
|
|
661
|
+
"PL",
|
|
662
|
+
"PT",
|
|
663
|
+
"RO",
|
|
664
|
+
"SK",
|
|
665
|
+
"SI",
|
|
666
|
+
"ES",
|
|
667
|
+
"SE",
|
|
668
|
+
"GF",
|
|
669
|
+
"GP",
|
|
670
|
+
"MQ",
|
|
671
|
+
"RE",
|
|
672
|
+
"YT",
|
|
673
|
+
"MF",
|
|
674
|
+
"AX",
|
|
675
|
+
"IS",
|
|
676
|
+
"LI",
|
|
677
|
+
"NO",
|
|
678
|
+
"GB",
|
|
679
|
+
"CH",
|
|
680
|
+
"EU"
|
|
681
|
+
],
|
|
682
|
+
unresolved_country_codes: [
|
|
683
|
+
"XX",
|
|
684
|
+
"T1"
|
|
685
|
+
]
|
|
686
|
+
},
|
|
639
687
|
calendar: {
|
|
640
688
|
event_highlight_window_minutes: 60,
|
|
641
689
|
search_save_debounce_ms: 250
|
|
@@ -1542,6 +1590,14 @@ var init_runtime_policy_generated = __esm({
|
|
|
1542
1590
|
posts: {
|
|
1543
1591
|
list_default_limit: 20,
|
|
1544
1592
|
list_max_limit: 100
|
|
1593
|
+
},
|
|
1594
|
+
comments: {
|
|
1595
|
+
max_length: 2e3
|
|
1596
|
+
}
|
|
1597
|
+
},
|
|
1598
|
+
community: {
|
|
1599
|
+
reports: {
|
|
1600
|
+
details_max_length: 1e3
|
|
1545
1601
|
}
|
|
1546
1602
|
},
|
|
1547
1603
|
security: {
|
|
@@ -22351,6 +22407,54 @@ var init_runtime_policy_generated2 = __esm({
|
|
|
22351
22407
|
arena_leaderboard_entries: 3,
|
|
22352
22408
|
data_revalidate_seconds: 60
|
|
22353
22409
|
},
|
|
22410
|
+
google_analytics: {
|
|
22411
|
+
excluded_country_codes: [
|
|
22412
|
+
"AT",
|
|
22413
|
+
"BE",
|
|
22414
|
+
"BG",
|
|
22415
|
+
"HR",
|
|
22416
|
+
"CY",
|
|
22417
|
+
"CZ",
|
|
22418
|
+
"DK",
|
|
22419
|
+
"EE",
|
|
22420
|
+
"FI",
|
|
22421
|
+
"FR",
|
|
22422
|
+
"DE",
|
|
22423
|
+
"GR",
|
|
22424
|
+
"HU",
|
|
22425
|
+
"IE",
|
|
22426
|
+
"IT",
|
|
22427
|
+
"LV",
|
|
22428
|
+
"LT",
|
|
22429
|
+
"LU",
|
|
22430
|
+
"MT",
|
|
22431
|
+
"NL",
|
|
22432
|
+
"PL",
|
|
22433
|
+
"PT",
|
|
22434
|
+
"RO",
|
|
22435
|
+
"SK",
|
|
22436
|
+
"SI",
|
|
22437
|
+
"ES",
|
|
22438
|
+
"SE",
|
|
22439
|
+
"GF",
|
|
22440
|
+
"GP",
|
|
22441
|
+
"MQ",
|
|
22442
|
+
"RE",
|
|
22443
|
+
"YT",
|
|
22444
|
+
"MF",
|
|
22445
|
+
"AX",
|
|
22446
|
+
"IS",
|
|
22447
|
+
"LI",
|
|
22448
|
+
"NO",
|
|
22449
|
+
"GB",
|
|
22450
|
+
"CH",
|
|
22451
|
+
"EU"
|
|
22452
|
+
],
|
|
22453
|
+
unresolved_country_codes: [
|
|
22454
|
+
"XX",
|
|
22455
|
+
"T1"
|
|
22456
|
+
]
|
|
22457
|
+
},
|
|
22354
22458
|
calendar: {
|
|
22355
22459
|
event_highlight_window_minutes: 60,
|
|
22356
22460
|
search_save_debounce_ms: 250
|
|
@@ -23257,6 +23361,14 @@ var init_runtime_policy_generated2 = __esm({
|
|
|
23257
23361
|
posts: {
|
|
23258
23362
|
list_default_limit: 20,
|
|
23259
23363
|
list_max_limit: 100
|
|
23364
|
+
},
|
|
23365
|
+
comments: {
|
|
23366
|
+
max_length: 2e3
|
|
23367
|
+
}
|
|
23368
|
+
},
|
|
23369
|
+
community: {
|
|
23370
|
+
reports: {
|
|
23371
|
+
details_max_length: 1e3
|
|
23260
23372
|
}
|
|
23261
23373
|
},
|
|
23262
23374
|
security: {
|
|
@@ -61581,6 +61693,17 @@ var init_market_data = __esm({
|
|
|
61581
61693
|
}
|
|
61582
61694
|
});
|
|
61583
61695
|
|
|
61696
|
+
// lib/api/open-orders.ts
|
|
61697
|
+
var init_open_orders = __esm({
|
|
61698
|
+
"lib/api/open-orders.ts"() {
|
|
61699
|
+
"use strict";
|
|
61700
|
+
init_define_VTX_CLAUDE_CODE_POLICY();
|
|
61701
|
+
init_define_VTX_EXO_POLICY();
|
|
61702
|
+
init_define_VTX_GROK_POLICY();
|
|
61703
|
+
init_define_VTX_PI_MODEL_POLICY();
|
|
61704
|
+
}
|
|
61705
|
+
});
|
|
61706
|
+
|
|
61584
61707
|
// lib/api/screener.ts
|
|
61585
61708
|
var init_screener = __esm({
|
|
61586
61709
|
"lib/api/screener.ts"() {
|
|
@@ -61870,6 +61993,19 @@ var init_insights_access_center = __esm({
|
|
|
61870
61993
|
}
|
|
61871
61994
|
});
|
|
61872
61995
|
|
|
61996
|
+
// lib/api/community.ts
|
|
61997
|
+
var init_community = __esm({
|
|
61998
|
+
"lib/api/community.ts"() {
|
|
61999
|
+
"use strict";
|
|
62000
|
+
init_define_VTX_CLAUDE_CODE_POLICY();
|
|
62001
|
+
init_define_VTX_EXO_POLICY();
|
|
62002
|
+
init_define_VTX_GROK_POLICY();
|
|
62003
|
+
init_define_VTX_PI_MODEL_POLICY();
|
|
62004
|
+
init_shared();
|
|
62005
|
+
init_constants();
|
|
62006
|
+
}
|
|
62007
|
+
});
|
|
62008
|
+
|
|
61873
62009
|
// lib/api/updates.ts
|
|
61874
62010
|
var init_updates = __esm({
|
|
61875
62011
|
"lib/api/updates.ts"() {
|
|
@@ -61879,6 +62015,7 @@ var init_updates = __esm({
|
|
|
61879
62015
|
init_define_VTX_GROK_POLICY();
|
|
61880
62016
|
init_define_VTX_PI_MODEL_POLICY();
|
|
61881
62017
|
init_shared();
|
|
62018
|
+
init_community();
|
|
61882
62019
|
init_constants();
|
|
61883
62020
|
}
|
|
61884
62021
|
});
|
|
@@ -62028,6 +62165,19 @@ var init_admin_signups = __esm({
|
|
|
62028
62165
|
}
|
|
62029
62166
|
});
|
|
62030
62167
|
|
|
62168
|
+
// lib/api/admin-accounts.ts
|
|
62169
|
+
var init_admin_accounts = __esm({
|
|
62170
|
+
"lib/api/admin-accounts.ts"() {
|
|
62171
|
+
"use strict";
|
|
62172
|
+
init_define_VTX_CLAUDE_CODE_POLICY();
|
|
62173
|
+
init_define_VTX_EXO_POLICY();
|
|
62174
|
+
init_define_VTX_GROK_POLICY();
|
|
62175
|
+
init_define_VTX_PI_MODEL_POLICY();
|
|
62176
|
+
init_community();
|
|
62177
|
+
init_shared();
|
|
62178
|
+
}
|
|
62179
|
+
});
|
|
62180
|
+
|
|
62031
62181
|
// lib/api/client-exchange-reconciliation.ts
|
|
62032
62182
|
var init_client_exchange_reconciliation = __esm({
|
|
62033
62183
|
"lib/api/client-exchange-reconciliation.ts"() {
|
|
@@ -62615,7 +62765,7 @@ var init_hyperliquid_account_contract = __esm({
|
|
|
62615
62765
|
});
|
|
62616
62766
|
|
|
62617
62767
|
// lib/runtime/order-identity.ts
|
|
62618
|
-
var clientOrderIdForMutation, mutationIdForClientOrderId, clientDecisionMutationId;
|
|
62768
|
+
var clientOrderIdForMutation, mutationIdForClientOrderId, listedClientOrderId, clientDecisionMutationId;
|
|
62619
62769
|
var init_order_identity = __esm({
|
|
62620
62770
|
"lib/runtime/order-identity.ts"() {
|
|
62621
62771
|
"use strict";
|
|
@@ -62631,6 +62781,12 @@ var init_order_identity = __esm({
|
|
|
62631
62781
|
const hex4 = cloid.slice("0x".length);
|
|
62632
62782
|
return UUID_HEX_GROUP_ENDS.map((end, index) => hex4.slice(index === 0 ? 0 : UUID_HEX_GROUP_ENDS[index - 1], end)).join("-");
|
|
62633
62783
|
};
|
|
62784
|
+
listedClientOrderId = (row) => {
|
|
62785
|
+
const value = row.cloid;
|
|
62786
|
+
if (value == null) return null;
|
|
62787
|
+
const cloid = typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
62788
|
+
return /^0x[0-9a-f]{32}$/.test(cloid) ? cloid : void 0;
|
|
62789
|
+
};
|
|
62634
62790
|
clientDecisionMutationId = async (input) => {
|
|
62635
62791
|
const key = [
|
|
62636
62792
|
"client-decision:v1",
|
|
@@ -62647,6 +62803,79 @@ var init_order_identity = __esm({
|
|
|
62647
62803
|
}
|
|
62648
62804
|
});
|
|
62649
62805
|
|
|
62806
|
+
// lib/runtime/hyperliquid-open-order-fields.ts
|
|
62807
|
+
var OPEN_ORDER_NUMERIC_STRING, OPEN_ORDER_ID_STRING, malformed, parseCanonicalOpenOrderId, parseOpenOrderFiniteNumber, parseOpenOrderNonNegativeNumber, parseOpenOrderPositiveNumber, parseOpenOrderPresentationNumber, readOpenOrderField;
|
|
62808
|
+
var init_hyperliquid_open_order_fields = __esm({
|
|
62809
|
+
"lib/runtime/hyperliquid-open-order-fields.ts"() {
|
|
62810
|
+
"use strict";
|
|
62811
|
+
init_define_VTX_CLAUDE_CODE_POLICY();
|
|
62812
|
+
init_define_VTX_EXO_POLICY();
|
|
62813
|
+
init_define_VTX_GROK_POLICY();
|
|
62814
|
+
init_define_VTX_PI_MODEL_POLICY();
|
|
62815
|
+
init_runtime_error_reason_rules();
|
|
62816
|
+
OPEN_ORDER_NUMERIC_STRING = /^[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:[eE][+-]?\d+)?$/;
|
|
62817
|
+
OPEN_ORDER_ID_STRING = /^[1-9]\d*$/;
|
|
62818
|
+
malformed = () => new RuntimeReasonError("Malformed Hyperliquid frontendOpenOrders member.", "internal_data_error");
|
|
62819
|
+
parseCanonicalOpenOrderId = (value) => {
|
|
62820
|
+
if (typeof value === "number") {
|
|
62821
|
+
if (Number.isSafeInteger(value) && value > 0) {
|
|
62822
|
+
return value;
|
|
62823
|
+
}
|
|
62824
|
+
throw malformed();
|
|
62825
|
+
}
|
|
62826
|
+
if (typeof value !== "string" || !OPEN_ORDER_ID_STRING.test(value)) {
|
|
62827
|
+
throw malformed();
|
|
62828
|
+
}
|
|
62829
|
+
const parsed = Number(value);
|
|
62830
|
+
if (!Number.isSafeInteger(parsed) || parsed <= 0) {
|
|
62831
|
+
throw malformed();
|
|
62832
|
+
}
|
|
62833
|
+
return parsed;
|
|
62834
|
+
};
|
|
62835
|
+
parseOpenOrderFiniteNumber = (value) => {
|
|
62836
|
+
if (typeof value !== "number" && (typeof value !== "string" || value.trim() === "" || !OPEN_ORDER_NUMERIC_STRING.test(value.trim()))) {
|
|
62837
|
+
throw malformed();
|
|
62838
|
+
}
|
|
62839
|
+
const parsed = typeof value === "number" ? value : Number(value.trim());
|
|
62840
|
+
if (!Number.isFinite(parsed)) {
|
|
62841
|
+
throw malformed();
|
|
62842
|
+
}
|
|
62843
|
+
return parsed;
|
|
62844
|
+
};
|
|
62845
|
+
parseOpenOrderNonNegativeNumber = (value) => {
|
|
62846
|
+
const parsed = parseOpenOrderFiniteNumber(value);
|
|
62847
|
+
if (parsed < 0) {
|
|
62848
|
+
throw malformed();
|
|
62849
|
+
}
|
|
62850
|
+
return parsed;
|
|
62851
|
+
};
|
|
62852
|
+
parseOpenOrderPositiveNumber = (value) => {
|
|
62853
|
+
const parsed = parseOpenOrderFiniteNumber(value);
|
|
62854
|
+
if (parsed <= 0) {
|
|
62855
|
+
throw malformed();
|
|
62856
|
+
}
|
|
62857
|
+
return parsed;
|
|
62858
|
+
};
|
|
62859
|
+
parseOpenOrderPresentationNumber = (value, fallback, options = {}) => {
|
|
62860
|
+
if (value == null || typeof value === "boolean" || typeof value === "string" && value.trim() === "") {
|
|
62861
|
+
return fallback;
|
|
62862
|
+
}
|
|
62863
|
+
const number6 = typeof value === "number" ? value : Number(value);
|
|
62864
|
+
const parsed = Number.isFinite(number6) ? number6 : fallback;
|
|
62865
|
+
return options.positive && parsed <= 0 ? fallback : parsed;
|
|
62866
|
+
};
|
|
62867
|
+
readOpenOrderField = (order, camel, snake) => {
|
|
62868
|
+
if (Object.prototype.hasOwnProperty.call(order, camel)) {
|
|
62869
|
+
return { present: true, value: order[camel] };
|
|
62870
|
+
}
|
|
62871
|
+
if (snake != null && Object.prototype.hasOwnProperty.call(order, snake)) {
|
|
62872
|
+
return { present: true, value: order[snake] };
|
|
62873
|
+
}
|
|
62874
|
+
return { present: false, value: void 0 };
|
|
62875
|
+
};
|
|
62876
|
+
}
|
|
62877
|
+
});
|
|
62878
|
+
|
|
62650
62879
|
// lib/runtime/hyperliquid-order-status.ts
|
|
62651
62880
|
var HYPERLIQUID_PENDING_TRIGGER_REASON_CODE, HYPERLIQUID_TERMINAL_UNFILLED_ORDER_STATUSES, classifyHyperliquidOrderStatus;
|
|
62652
62881
|
var init_hyperliquid_order_status = __esm({
|
|
@@ -63670,7 +63899,7 @@ var init_hyperliquid_exchange_rejections = __esm({
|
|
|
63670
63899
|
});
|
|
63671
63900
|
|
|
63672
63901
|
// lib/runtime/hyperliquid-market-catalog.ts
|
|
63673
|
-
var DEFAULT_DEX, DEFAULT_DEX_INDEX, ISOLATED_ONLY_MARGIN_MODES,
|
|
63902
|
+
var DEFAULT_DEX, DEFAULT_DEX_INDEX, ISOLATED_ONLY_MARGIN_MODES, malformed2, perpDexIndexes, integer3, marketIdentityRow, listedMarketRows;
|
|
63674
63903
|
var init_hyperliquid_market_catalog = __esm({
|
|
63675
63904
|
"lib/runtime/hyperliquid-market-catalog.ts"() {
|
|
63676
63905
|
"use strict";
|
|
@@ -63684,10 +63913,10 @@ var init_hyperliquid_market_catalog = __esm({
|
|
|
63684
63913
|
DEFAULT_DEX = "";
|
|
63685
63914
|
DEFAULT_DEX_INDEX = 0;
|
|
63686
63915
|
ISOLATED_ONLY_MARGIN_MODES = /* @__PURE__ */ new Set(["nocross", "strictisolated"]);
|
|
63687
|
-
|
|
63916
|
+
malformed2 = (message) => new RuntimeReasonError(message, "hyperliquid_data_unavailable");
|
|
63688
63917
|
perpDexIndexes = (perpDexs) => {
|
|
63689
63918
|
if (!Array.isArray(perpDexs) || perpDexs.length === 0 || perpDexs.some((item) => item !== null && (!item || typeof item !== "object" || Array.isArray(item) || !String(item.name ?? "").trim()))) {
|
|
63690
|
-
throw
|
|
63919
|
+
throw malformed2("Hyperliquid returned a malformed perpDexs list.");
|
|
63691
63920
|
}
|
|
63692
63921
|
const indexes = /* @__PURE__ */ new Map([[DEFAULT_DEX, DEFAULT_DEX_INDEX]]);
|
|
63693
63922
|
perpDexs.forEach((item, index) => {
|
|
@@ -63702,14 +63931,14 @@ var init_hyperliquid_market_catalog = __esm({
|
|
|
63702
63931
|
};
|
|
63703
63932
|
marketIdentityRow = (input) => {
|
|
63704
63933
|
const symbol2 = normalizeHyperliquidMarketSymbol(input.asset.name);
|
|
63705
|
-
if (!symbol2) throw
|
|
63934
|
+
if (!symbol2) throw malformed2("A Hyperliquid market entry has no name.");
|
|
63706
63935
|
const dex = getHyperliquidMarketDex(symbol2);
|
|
63707
|
-
if (dex !== String(input.dex ?? "").trim().toLowerCase()) throw
|
|
63936
|
+
if (dex !== String(input.dex ?? "").trim().toLowerCase()) throw malformed2(`Hyperliquid listed ${symbol2} under another DEX.`);
|
|
63708
63937
|
const baseSymbol = dex ? symbol2.slice(dex.length + 1) : symbol2;
|
|
63709
63938
|
const szDecimals = integer3(input.asset.szDecimals);
|
|
63710
|
-
if (szDecimals === null || szDecimals < 0) throw
|
|
63939
|
+
if (szDecimals === null || szDecimals < 0) throw malformed2(`Hyperliquid's entry for ${symbol2} has no size precision.`);
|
|
63711
63940
|
const leverage = input.asset.maxLeverage ? integer3(input.asset.maxLeverage) : 1;
|
|
63712
|
-
if (leverage === null) throw
|
|
63941
|
+
if (leverage === null) throw malformed2(`Hyperliquid's entry for ${symbol2} has an invalid max leverage.`);
|
|
63713
63942
|
const rawMarginMode = input.asset.marginMode;
|
|
63714
63943
|
const marginMode = rawMarginMode === null || rawMarginMode === void 0 ? null : String(rawMarginMode).trim() || null;
|
|
63715
63944
|
const assetId = input.perpDexIndex === DEFAULT_DEX_INDEX ? input.indexInMeta : HYPERLIQUID_EXCHANGE_SPECIFICATION.hip3_asset_id_base + input.perpDexIndex * HYPERLIQUID_EXCHANGE_SPECIFICATION.hip3_asset_id_dex_stride + input.indexInMeta;
|
|
@@ -63738,10 +63967,10 @@ var init_hyperliquid_market_catalog = __esm({
|
|
|
63738
63967
|
for (const [dex, response] of Object.entries(metas)) {
|
|
63739
63968
|
const universe = response && typeof response === "object" ? response.universe : null;
|
|
63740
63969
|
if (!Array.isArray(universe) || universe.length === 0 || universe.some((asset) => !asset || typeof asset !== "object" || !String(asset.name ?? "").trim())) {
|
|
63741
|
-
throw
|
|
63970
|
+
throw malformed2(`Hyperliquid returned malformed market metadata for ${dex || "the default DEX"}.`);
|
|
63742
63971
|
}
|
|
63743
63972
|
const perpDexIndex = dex === DEFAULT_DEX ? DEFAULT_DEX_INDEX : dexIndexes.get(dex);
|
|
63744
|
-
if (perpDexIndex === void 0) throw
|
|
63973
|
+
if (perpDexIndex === void 0) throw malformed2(`Hyperliquid does not list the perp DEX ${dex}.`);
|
|
63745
63974
|
universe.forEach((asset, indexInMeta) => {
|
|
63746
63975
|
const symbol2 = normalizeHyperliquidMarketSymbol(asset.name);
|
|
63747
63976
|
const delisted = asset.isDelisted === true;
|
|
@@ -84764,7 +84993,7 @@ function showThrottleMessage(service) {
|
|
|
84764
84993
|
console.log("==========================");
|
|
84765
84994
|
}
|
|
84766
84995
|
var shown;
|
|
84767
|
-
var
|
|
84996
|
+
var init_community2 = __esm({
|
|
84768
84997
|
"node_modules/ethers/lib.esm/providers/community.js"() {
|
|
84769
84998
|
init_define_VTX_CLAUDE_CODE_POLICY();
|
|
84770
84999
|
init_define_VTX_EXO_POLICY();
|
|
@@ -85856,7 +86085,7 @@ var init_provider_ankr = __esm({
|
|
|
85856
86085
|
init_define_VTX_GROK_POLICY();
|
|
85857
86086
|
init_define_VTX_PI_MODEL_POLICY();
|
|
85858
86087
|
init_utils();
|
|
85859
|
-
|
|
86088
|
+
init_community2();
|
|
85860
86089
|
init_network();
|
|
85861
86090
|
init_provider_jsonrpc();
|
|
85862
86091
|
defaultApiKey = "9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";
|
|
@@ -85968,7 +86197,7 @@ var init_provider_alchemy = __esm({
|
|
|
85968
86197
|
init_define_VTX_GROK_POLICY();
|
|
85969
86198
|
init_define_VTX_PI_MODEL_POLICY();
|
|
85970
86199
|
init_utils();
|
|
85971
|
-
|
|
86200
|
+
init_community2();
|
|
85972
86201
|
init_network();
|
|
85973
86202
|
init_provider_jsonrpc();
|
|
85974
86203
|
defaultApiKey2 = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";
|
|
@@ -86081,7 +86310,7 @@ var init_provider_chainstack = __esm({
|
|
|
86081
86310
|
init_define_VTX_GROK_POLICY();
|
|
86082
86311
|
init_define_VTX_PI_MODEL_POLICY();
|
|
86083
86312
|
init_utils();
|
|
86084
|
-
|
|
86313
|
+
init_community2();
|
|
86085
86314
|
init_network();
|
|
86086
86315
|
init_provider_jsonrpc();
|
|
86087
86316
|
ChainstackProvider = class _ChainstackProvider extends JsonRpcProvider {
|
|
@@ -86178,7 +86407,7 @@ var init_provider_etherscan = __esm({
|
|
|
86178
86407
|
init_abstract_provider();
|
|
86179
86408
|
init_network();
|
|
86180
86409
|
init_plugins_network();
|
|
86181
|
-
|
|
86410
|
+
init_community2();
|
|
86182
86411
|
Supported = "1 11155111 17000 560048 2741 11124 33111 33139 42170 42161 421614 43114 43113 8453 84532 80069 80094 199 1029 81457 168587773 56 97 42220 11142220 252 2523 100 999 737373 747474 59144 59141 5000 5003 43521 143 10143 1287 1284 1285 10 11155420 204 5611 80002 137 534352 534351 1329 1328 146 14601 988 2201 1923 1924 167013 167000 130 1301 480 4801 51 50 324 300".split(/ /g);
|
|
86183
86412
|
THROTTLE = 2e3;
|
|
86184
86413
|
EtherscanPluginId = "org.ethers.plugins.provider.Etherscan";
|
|
@@ -90843,7 +91072,7 @@ var init_provider_infura = __esm({
|
|
|
90843
91072
|
init_define_VTX_GROK_POLICY();
|
|
90844
91073
|
init_define_VTX_PI_MODEL_POLICY();
|
|
90845
91074
|
init_utils();
|
|
90846
|
-
|
|
91075
|
+
init_community2();
|
|
90847
91076
|
init_network();
|
|
90848
91077
|
init_provider_jsonrpc();
|
|
90849
91078
|
init_provider_websocket();
|
|
@@ -91002,7 +91231,7 @@ var init_provider_quicknode = __esm({
|
|
|
91002
91231
|
init_define_VTX_GROK_POLICY();
|
|
91003
91232
|
init_define_VTX_PI_MODEL_POLICY();
|
|
91004
91233
|
init_utils();
|
|
91005
|
-
|
|
91234
|
+
init_community2();
|
|
91006
91235
|
init_network();
|
|
91007
91236
|
init_provider_jsonrpc();
|
|
91008
91237
|
defaultToken = "919b412a057b5e9c9b6dce193c5a60242d6efadb";
|
|
@@ -92149,7 +92378,7 @@ var init_provider_pocket = __esm({
|
|
|
92149
92378
|
init_define_VTX_GROK_POLICY();
|
|
92150
92379
|
init_define_VTX_PI_MODEL_POLICY();
|
|
92151
92380
|
init_utils();
|
|
92152
|
-
|
|
92381
|
+
init_community2();
|
|
92153
92382
|
init_network();
|
|
92154
92383
|
init_provider_jsonrpc();
|
|
92155
92384
|
defaultApplicationId = "62e1ad51b37b8e00394bda3b";
|
|
@@ -92300,7 +92529,7 @@ var init_providers = __esm({
|
|
|
92300
92529
|
init_define_VTX_PI_MODEL_POLICY();
|
|
92301
92530
|
init_abstract_provider();
|
|
92302
92531
|
init_abstract_signer();
|
|
92303
|
-
|
|
92532
|
+
init_community2();
|
|
92304
92533
|
init_default_provider();
|
|
92305
92534
|
init_ens_resolver();
|
|
92306
92535
|
init_network();
|
|
@@ -96206,7 +96435,7 @@ var init_hyperliquid_signer = __esm({
|
|
|
96206
96435
|
});
|
|
96207
96436
|
|
|
96208
96437
|
// lib/runtime/hyperliquid-client.ts
|
|
96209
|
-
var HyperliquidExchangeRejectionError, assertFreshPreparedExecutionContext, normalizeSymbol, normalizeBotMarket, HYPERLIQUID_NONCE_STORAGE_KEY, HYPERLIQUID_NONCE_LOCK_NAME, lastGeneratedNonce, readBrowserStoredHyperliquidNonce, writeBrowserStoredHyperliquidNonce, browserNonceCoordinator, allocateHyperliquidNonce, hostNonceAllocator, allocateActionNonce, generateHyperliquidNonce, normalizeDecimalString, HYPERLIQUID_PRICE_SIGNIFICANT_FIGURES, HYPERLIQUID_INTEGER_PRICE_MINIMUM, shortestDecimalParts, formatHyperliquidPerpPriceGrid, formatHyperliquidTriggerPriceWire, hyperliquidOrderPriceRounding, formatHyperliquidOrderPriceWire, countSignificantDigits, countDecimalPlaces, validateHyperliquidPerpPriceWire, validateHyperliquidSizeWire, formatSizeWire, inferApiUrl, inferIsTestnet, postHyperliquidInfoRead, postHyperliquidInfo, fetchBrowserHyperliquidInfoPayload, fetchBrowserHyperliquidInfoRead, fetchBrowserHyperliquidInfoText, toFiniteNumber,
|
|
96438
|
+
var HyperliquidExchangeRejectionError, assertFreshPreparedExecutionContext, normalizeSymbol, normalizeBotMarket, HYPERLIQUID_NONCE_STORAGE_KEY, HYPERLIQUID_NONCE_LOCK_NAME, lastGeneratedNonce, readBrowserStoredHyperliquidNonce, writeBrowserStoredHyperliquidNonce, browserNonceCoordinator, allocateHyperliquidNonce, hostNonceAllocator, allocateActionNonce, generateHyperliquidNonce, normalizeDecimalString, HYPERLIQUID_PRICE_SIGNIFICANT_FIGURES, HYPERLIQUID_INTEGER_PRICE_MINIMUM, shortestDecimalParts, formatHyperliquidPerpPriceGrid, formatHyperliquidTriggerPriceWire, hyperliquidOrderPriceRounding, formatHyperliquidOrderPriceWire, countSignificantDigits, countDecimalPlaces, validateHyperliquidPerpPriceWire, validateHyperliquidSizeWire, formatSizeWire, inferApiUrl, inferIsTestnet, postHyperliquidInfoRead, postHyperliquidInfo, fetchBrowserHyperliquidInfoPayload, fetchBrowserHyperliquidInfoRead, fetchBrowserHyperliquidInfoText, toFiniteNumber, NATIVE_FIRED_TRIGGER_CONDITION, firstFiniteNumber, parseFundingUsdcFromInfoPosition, isExchangeIsolatedOnly, resolveLeverageTarget, computeHip3AssetId, buildAssetInfosFromMetaResponse, requireWalletAddress, assertPositiveInteger, assertPositiveNumber, normalizeOrderSide, normalizeHyperliquidClientOrderId, resolveAssets, findResolvedAsset, normalizeExecutionAssetMetadata, readDeviceExecutionAssetMetadata, requireBotProfileId, executionAssetMetadataFor, resolveHyperliquidAsset, resolveHyperliquidAssetIndex, decimalUnits, quantizeHyperliquidOrderSizeValue, hyperliquidSignedSizeMatchesRequestedSize, finitePositive, readDevicePrivateExecutionContext, quantizeHyperliquidOrderSize, listBrowserMarketListDexes, browserMarketListMaxMarkets, cutBrowserMarketList, readBrowserPerpDexIndexes, readBrowserMarketListDex, fetchBrowserAvailableAssets, fetchBrowserAllMids, fetchBrowserSymbolMidPrice, fetchBrowserOpenOrders, parseCanonicalHyperliquidOrderStatusEvidence, fetchBrowserOrderStatusEvidence, fetchBrowserUserRole, fetchBrowserAccountState, fetchBrowserPosition, buildHyperliquidOrderWire, buildHyperliquidTriggerOrderWire, signHyperliquidPayload, signHyperliquidPreparedAction, buildHyperliquidCancelAction, buildHyperliquidCancelPayload, buildHyperliquidUpdateLeverageAction, buildHyperliquidUpdateLeveragePayload, buildHyperliquidMarketOrderAction, buildHyperliquidMarketOrderPayload, buildHyperliquidLimitOrderAction, buildHyperliquidLimitOrderPayload, buildHyperliquidTriggerOrderAction, buildHyperliquidTriggerOrderPayload, buildHyperliquidOrderBatchAction, buildHyperliquidOrderBatchPayload, buildHyperliquidModifyOrderAction, buildHyperliquidModifyOrderPayload, TRAILING_PCT_PATTERN, buildHyperliquidTrailingStopAction, buildHyperliquidTrailingStopPayload, extractHyperliquidExchangeError, acknowledgementLookupPacing, lookupUntilListed, resolveHyperliquidTriggerAcknowledgements, readHyperliquidTrailingStopAcknowledgement, resolveHyperliquidModifyAcknowledgement, isDefinitiveHyperliquidExchangeResponse, extractDefinitiveHyperliquidOrderId, CANONICAL_POSITIVE_DECIMAL_PATTERN, extractCanonicalHyperliquidOrderStateAcknowledgement, extractCanonicalHyperliquidOrderStateAcknowledgements, extractCanonicalHyperliquidFilledOrderAcknowledgement, extractDefinitiveHyperliquidOrderMemberResults, buildHyperliquidOrderDiagnostics, loadClientExecutionReferenceEvidence, sha256Hex, extractSignedPayloadClientOrderId, extractSignedPayloadMutationCorrelation, assertDurableMutationMatchesSignedAction, exchangeRejectionReason, exchangeActionPriority, submitHyperliquidExchangePayload;
|
|
96210
96439
|
var init_hyperliquid_client = __esm({
|
|
96211
96440
|
"lib/runtime/hyperliquid-client.ts"() {
|
|
96212
96441
|
"use strict";
|
|
@@ -96216,6 +96445,7 @@ var init_hyperliquid_client = __esm({
|
|
|
96216
96445
|
init_define_VTX_PI_MODEL_POLICY();
|
|
96217
96446
|
init_hyperliquid_account_contract();
|
|
96218
96447
|
init_order_identity();
|
|
96448
|
+
init_hyperliquid_open_order_fields();
|
|
96219
96449
|
init_hyperliquid_order_status();
|
|
96220
96450
|
init_runtime_policy_generated2();
|
|
96221
96451
|
init_constants();
|
|
@@ -96483,65 +96713,7 @@ var init_hyperliquid_client = __esm({
|
|
|
96483
96713
|
const parsed = typeof value === "number" ? value : Number(value);
|
|
96484
96714
|
return Number.isFinite(parsed) ? parsed : fallback;
|
|
96485
96715
|
};
|
|
96486
|
-
OPEN_ORDER_NUMERIC_STRING = /^[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:[eE][+-]?\d+)?$/;
|
|
96487
|
-
OPEN_ORDER_ID_STRING = /^[1-9]\d*$/;
|
|
96488
|
-
parseCanonicalOpenOrderId = (value) => {
|
|
96489
|
-
if (typeof value === "number") {
|
|
96490
|
-
if (Number.isSafeInteger(value) && value > 0) {
|
|
96491
|
-
return value;
|
|
96492
|
-
}
|
|
96493
|
-
throw new Error("Malformed Hyperliquid frontendOpenOrders member.");
|
|
96494
|
-
}
|
|
96495
|
-
if (typeof value !== "string" || !OPEN_ORDER_ID_STRING.test(value)) {
|
|
96496
|
-
throw new Error("Malformed Hyperliquid frontendOpenOrders member.");
|
|
96497
|
-
}
|
|
96498
|
-
const parsed = Number(value);
|
|
96499
|
-
if (!Number.isSafeInteger(parsed) || parsed <= 0) {
|
|
96500
|
-
throw new Error("Malformed Hyperliquid frontendOpenOrders member.");
|
|
96501
|
-
}
|
|
96502
|
-
return parsed;
|
|
96503
|
-
};
|
|
96504
|
-
parseOpenOrderFiniteNumber = (value) => {
|
|
96505
|
-
if (typeof value !== "number" && (typeof value !== "string" || value.trim() === "" || !OPEN_ORDER_NUMERIC_STRING.test(value.trim()))) {
|
|
96506
|
-
throw new Error("Malformed Hyperliquid frontendOpenOrders member.");
|
|
96507
|
-
}
|
|
96508
|
-
const parsed = typeof value === "number" ? value : Number(value.trim());
|
|
96509
|
-
if (!Number.isFinite(parsed)) {
|
|
96510
|
-
throw new Error("Malformed Hyperliquid frontendOpenOrders member.");
|
|
96511
|
-
}
|
|
96512
|
-
return parsed;
|
|
96513
|
-
};
|
|
96514
|
-
parseOpenOrderNonNegativeNumber = (value) => {
|
|
96515
|
-
const parsed = parseOpenOrderFiniteNumber(value);
|
|
96516
|
-
if (parsed < 0) {
|
|
96517
|
-
throw new Error("Malformed Hyperliquid frontendOpenOrders member.");
|
|
96518
|
-
}
|
|
96519
|
-
return parsed;
|
|
96520
|
-
};
|
|
96521
96716
|
NATIVE_FIRED_TRIGGER_CONDITION = "Triggered";
|
|
96522
|
-
parseOpenOrderPositiveNumber = (value) => {
|
|
96523
|
-
const parsed = parseOpenOrderFiniteNumber(value);
|
|
96524
|
-
if (parsed <= 0) {
|
|
96525
|
-
throw new Error("Malformed Hyperliquid frontendOpenOrders member.");
|
|
96526
|
-
}
|
|
96527
|
-
return parsed;
|
|
96528
|
-
};
|
|
96529
|
-
parseOpenOrderPresentationNumber = (value, fallback, options = {}) => {
|
|
96530
|
-
if (value == null || typeof value === "boolean" || typeof value === "string" && value.trim() === "") {
|
|
96531
|
-
return fallback;
|
|
96532
|
-
}
|
|
96533
|
-
const parsed = toFiniteNumber(value, fallback);
|
|
96534
|
-
return options.positive && parsed <= 0 ? fallback : parsed;
|
|
96535
|
-
};
|
|
96536
|
-
readOpenOrderField = (order, camel, snake) => {
|
|
96537
|
-
if (Object.prototype.hasOwnProperty.call(order, camel)) {
|
|
96538
|
-
return { present: true, value: order[camel] };
|
|
96539
|
-
}
|
|
96540
|
-
if (snake != null && Object.prototype.hasOwnProperty.call(order, snake)) {
|
|
96541
|
-
return { present: true, value: order[snake] };
|
|
96542
|
-
}
|
|
96543
|
-
return { present: false, value: void 0 };
|
|
96544
|
-
};
|
|
96545
96717
|
firstFiniteNumber = (values, fallback = 0) => {
|
|
96546
96718
|
for (const value of values) {
|
|
96547
96719
|
if (value == null || typeof value === "string" && value.trim() === "") {
|
|
@@ -97082,7 +97254,8 @@ var init_hyperliquid_client = __esm({
|
|
|
97082
97254
|
"triggerCondition",
|
|
97083
97255
|
"trigger_condition"
|
|
97084
97256
|
);
|
|
97085
|
-
|
|
97257
|
+
const clientOrderId = listedClientOrderId(order);
|
|
97258
|
+
if (!coin || !side || !Number.isFinite(size) || clientOrderId === void 0 || !rawOrderType.present || !orderType || typeof reduceOnly !== "boolean" || typeof isTrigger !== "boolean" || typeof isPositionTpsl !== "boolean" || (isTrigger ? triggerKind == null : normalizedOrderType !== "limit" && !(triggerKind != null && triggerConditionField.value === NATIVE_FIRED_TRIGGER_CONDITION)) || isTrigger && (triggerPrice == null || triggerPrice <= 0)) {
|
|
97086
97259
|
throw new Error("Malformed Hyperliquid frontendOpenOrders member.");
|
|
97087
97260
|
}
|
|
97088
97261
|
return {
|
|
@@ -97100,7 +97273,8 @@ var init_hyperliquid_client = __esm({
|
|
|
97100
97273
|
is_position_tpsl: isPositionTpsl,
|
|
97101
97274
|
trigger_px: triggerPrice,
|
|
97102
97275
|
...triggerKind ? { trigger_kind: triggerKind } : {},
|
|
97103
|
-
order_value: orderValue
|
|
97276
|
+
order_value: orderValue,
|
|
97277
|
+
...clientOrderId ? { cloid: clientOrderId } : {}
|
|
97104
97278
|
};
|
|
97105
97279
|
};
|
|
97106
97280
|
if (input.includeChildren !== true) {
|
|
@@ -97200,7 +97374,7 @@ var init_hyperliquid_client = __esm({
|
|
|
97200
97374
|
}
|
|
97201
97375
|
const orderRecord = nested;
|
|
97202
97376
|
const orderId = orderRecord.oid == null ? null : String(orderRecord.oid);
|
|
97203
|
-
const clientOrderId = orderRecord
|
|
97377
|
+
const clientOrderId = listedClientOrderId(orderRecord) ?? null;
|
|
97204
97378
|
const coin = typeof orderRecord.coin === "string" ? orderRecord.coin.trim() : null;
|
|
97205
97379
|
const side = typeof orderRecord.side === "string" ? orderRecord.side.trim() : null;
|
|
97206
97380
|
const originalSizeRaw = orderRecord.origSz;
|
|
@@ -100113,6 +100287,7 @@ var init_api2 = __esm({
|
|
|
100113
100287
|
init_client_runtime_bootstrap();
|
|
100114
100288
|
init_billing();
|
|
100115
100289
|
init_market_data();
|
|
100290
|
+
init_open_orders();
|
|
100116
100291
|
init_screener();
|
|
100117
100292
|
init_client_host_commands();
|
|
100118
100293
|
init_client_exchange_mutation_begin();
|
|
@@ -100132,6 +100307,7 @@ var init_api2 = __esm({
|
|
|
100132
100307
|
init_mobile_notifications();
|
|
100133
100308
|
init_server_prompt_rescue();
|
|
100134
100309
|
init_admin_signups();
|
|
100310
|
+
init_admin_accounts();
|
|
100135
100311
|
init_client_exchange_reconciliation();
|
|
100136
100312
|
init_client_protective_evidence();
|
|
100137
100313
|
init_server_runtime_lease();
|
|
@@ -108604,7 +108780,7 @@ var init_protective_leg_evidence = __esm({
|
|
|
108604
108780
|
});
|
|
108605
108781
|
|
|
108606
108782
|
// lib/runtime/protective-market-evidence.ts
|
|
108607
|
-
var policy2, CLOCK_MARGIN_MS, FRESH_EVIDENCE_WARN_AFTER_MS, ProtectiveEvidenceUnavailableError, fetchClientRuntimeOpenOrders, provenFromMs, nodeAnswerProves, freshEvidenceWait, storedFreshEvidenceWait, waitFor, readProtectiveMarket, PROTECTIVE_FRESH_EVIDENCE_UNAVAILABLE;
|
|
108783
|
+
var policy2, CLOCK_MARGIN_MS, FRESH_EVIDENCE_WARN_AFTER_MS, ProtectiveEvidenceUnavailableError, fetchClientRuntimeOpenOrders, provenFromMs, nodeAnswerProves, readAfter, freshEvidenceWait, storedFreshEvidenceWait, waitFor, readProtectiveMarket, PROTECTIVE_FRESH_EVIDENCE_UNAVAILABLE;
|
|
108608
108784
|
var init_protective_market_evidence = __esm({
|
|
108609
108785
|
"lib/runtime/protective-market-evidence.ts"() {
|
|
108610
108786
|
"use strict";
|
|
@@ -108653,6 +108829,7 @@ var init_protective_market_evidence = __esm({
|
|
|
108653
108829
|
const fromMs = provenFromMs(notBefore);
|
|
108654
108830
|
return fromMs == null || stateMs != null && Number.isFinite(stateMs) && stateMs >= fromMs;
|
|
108655
108831
|
};
|
|
108832
|
+
readAfter = (market) => (hostMs) => market.orders != null && market.pageSentMs != null && market.pageSentMs > hostMs && (!market.viaNode || nodeAnswerProves(market.position.stateTimeMs, { hostMs }));
|
|
108656
108833
|
freshEvidenceWait = (sinceMs, nowMs2) => {
|
|
108657
108834
|
const since = typeof sinceMs === "number" && Number.isFinite(sinceMs) && sinceMs <= nowMs2 ? sinceMs : nowMs2;
|
|
108658
108835
|
return { sinceMs: since, overdue: nowMs2 - since >= FRESH_EVIDENCE_WARN_AFTER_MS };
|
|
@@ -109123,33 +109300,25 @@ var init_protective_entry_cover = __esm({
|
|
|
109123
109300
|
const { symbol: symbol2, orders } = input;
|
|
109124
109301
|
const entries = input.groups.flatMap((group) => group.legs.map((leg) => ({ group, leg })));
|
|
109125
109302
|
const knownId = ({ leg }) => input.lookedUp?.get(String(leg.orderId)) ?? (typeof leg.orderId === "number" ? leg.orderId : null);
|
|
109303
|
+
const clientId = ({ leg }) => typeof leg.orderId === "string" ? leg.orderId.trim().toLowerCase() : null;
|
|
109126
109304
|
const pendingIds = new Set(entries.flatMap(({ leg }) => leg.replacement?.clientOrderId ? [leg.replacement.clientOrderId] : []));
|
|
109127
|
-
const
|
|
109305
|
+
const companion = (entry) => pendingIds.has(String(entry.leg.orderId));
|
|
109128
109306
|
const claims = /* @__PURE__ */ new Map();
|
|
109129
|
-
const
|
|
109130
|
-
|
|
109131
|
-
|
|
109132
|
-
|
|
109133
|
-
|
|
109134
|
-
}
|
|
109135
|
-
const
|
|
109136
|
-
const
|
|
109137
|
-
|
|
109138
|
-
|
|
109139
|
-
|
|
109140
|
-
leg
|
|
109141
|
-
|
|
109142
|
-
|
|
109143
|
-
const
|
|
109144
|
-
for (const entry of own) claim(entry, pageOrderById(orders, knownId(entry)));
|
|
109145
|
-
const named = new Set(claimed);
|
|
109146
|
-
const leaving = new Set(input.groups.filter((group) => group.cleanupRequired === true || own.some((entry) => entry.group === group && knownId(entry) != null && !claims.has(entry))));
|
|
109147
|
-
const waiting = own.filter(unbound);
|
|
109148
|
-
const unread = (entry) => input.unresolved?.has(String(entry.leg.orderId)) === true;
|
|
109149
|
-
const staying = waiting.filter((entry) => !leaving.has(entry.group));
|
|
109150
|
-
for (const entry of [...waiting.filter((entry2) => leaving.has(entry2.group)), ...staying.filter(unread), ...staying.filter((entry2) => !unread(entry2))]) {
|
|
109151
|
-
claim(entry, byShape(entry, entry.leg));
|
|
109152
|
-
}
|
|
109307
|
+
for (const entry of entries) {
|
|
109308
|
+
const id2 = knownId(entry);
|
|
109309
|
+
const cloid = companion(entry) ? null : clientId(entry);
|
|
109310
|
+
const order = orders.find((candidate) => id2 != null && String(candidate.oid) === String(id2) || cloid != null && typeof candidate.cloid === "string" && candidate.cloid.toLowerCase() === cloid);
|
|
109311
|
+
if (order != null && ![...claims.values()].includes(order)) claims.set(entry, order);
|
|
109312
|
+
}
|
|
109313
|
+
const placedAs = (entry) => input.placed?.get(String(entry.leg.orderId)) ?? (knownId(entry) == null ? void 0 : input.placed?.get(String(knownId(entry))));
|
|
109314
|
+
const unknown2 = (entry) => {
|
|
109315
|
+
const placed = placedAs(entry);
|
|
109316
|
+
if (placed != null) return placed === "unknown";
|
|
109317
|
+
if (knownId(entry) != null || companion(entry)) return false;
|
|
109318
|
+
const journaledAtMs = entry.leg.replaceJournal?.createdAtMs ?? entry.group.attachmentJournal?.createdAtMs;
|
|
109319
|
+
return journaledAtMs == null || input.provesGone?.(journaledAtMs) !== true;
|
|
109320
|
+
};
|
|
109321
|
+
const leaving = new Set(input.groups.filter((group) => group.cleanupRequired === true || entries.some((entry) => entry.group === group && knownId(entry) != null && !claims.has(entry) && !unknown2(entry))));
|
|
109153
109322
|
const byKey = /* @__PURE__ */ new Map();
|
|
109154
109323
|
for (const entry of entries) {
|
|
109155
109324
|
byKey.set(String(entry.leg.orderId), entry);
|
|
@@ -109161,7 +109330,7 @@ var init_protective_entry_cover = __esm({
|
|
|
109161
109330
|
const size = Number(order?.sz);
|
|
109162
109331
|
return entry != null && size > 0 ? protectiveLegCoverSize(entry.leg, Math.min(entry.leg.size, size)) : 0;
|
|
109163
109332
|
};
|
|
109164
|
-
const inFlightOf = (entry) => entry == null || leaving.has(entry.group) || claims.has(entry) || !
|
|
109333
|
+
const inFlightOf = (entry) => entry == null || leaving.has(entry.group) || claims.has(entry) || !unknown2(entry) || !(input.canStillExist ?? ownLegCanStillExist)(entry.group, entry.leg) ? 0 : protectiveLegCoverSize(entry.leg);
|
|
109165
109334
|
return {
|
|
109166
109335
|
/** The leg is on its way out: it covers nothing and takes no share. */
|
|
109167
109336
|
leaving: (leg) => {
|
|
@@ -109170,15 +109339,13 @@ var init_protective_entry_cover = __esm({
|
|
|
109170
109339
|
},
|
|
109171
109340
|
/** What the leg's order on the page covers (nothing on its way out or off the page). */
|
|
109172
109341
|
cover: (leg) => coverOf(entryOf(leg)),
|
|
109173
|
-
/** What a leg whose order
|
|
109342
|
+
/** What a leg whose order the page does not list may still cover: its size while it is unknown. */
|
|
109174
109343
|
inFlight: (leg) => inFlightOf(entryOf(leg)),
|
|
109175
|
-
/** Whether
|
|
109176
|
-
|
|
109177
|
-
|
|
109178
|
-
|
|
109179
|
-
|
|
109180
|
-
leg
|
|
109181
|
-
})),
|
|
109344
|
+
/** Whether the page lists the order carrying the leg's id. */
|
|
109345
|
+
lists: (leg) => {
|
|
109346
|
+
const entry = entryOf(leg);
|
|
109347
|
+
return entry != null && claims.has(entry);
|
|
109348
|
+
},
|
|
109182
109349
|
/** What the legs of one direction cover, by kind (a new entry's attach). */
|
|
109183
109350
|
directionCover: (isLong) => {
|
|
109184
109351
|
const cover = { sl: 0, tp: 0 };
|
|
@@ -109188,21 +109355,21 @@ var init_protective_entry_cover = __esm({
|
|
|
109188
109355
|
return cover;
|
|
109189
109356
|
},
|
|
109190
109357
|
/**
|
|
109191
|
-
* For a lost stop: the stop losses on the page closing the position,
|
|
109192
|
-
* than the orders a status proved ended (`ended`),
|
|
109193
|
-
* and
|
|
109194
|
-
*
|
|
109195
|
-
*
|
|
109358
|
+
* For a lost stop: the stop losses on the page closing the position,
|
|
109359
|
+
* other than the orders a status proved ended (`ended`), each at its
|
|
109360
|
+
* owning leg's cover, and an order no leg owns whole; and, unseen, what
|
|
109361
|
+
* the legs this pass could not read, and the stops it re-placed, may
|
|
109362
|
+
* still cover while unknown.
|
|
109196
109363
|
*/
|
|
109197
|
-
lostStopCover: (positionSize
|
|
109364
|
+
lostStopCover: (positionSize) => {
|
|
109198
109365
|
const isLong = positionSize > 0;
|
|
109199
109366
|
const owners = new Map([...claims].map(([entry, order]) => [order, entry]));
|
|
109200
|
-
const onPage = orders.filter((order) =>
|
|
109367
|
+
const onPage = orders.filter((order) => input.ended?.has(String(order.oid)) !== true && String(order.coin).trim().toUpperCase() === symbol2.trim().toUpperCase() && order.reduce_only && order.is_trigger && order.trigger_kind === "sl" && (isLong ? ["a", "sell"] : ["b", "buy"]).includes(String(order.side).trim().toLowerCase())).reduce((total, order) => {
|
|
109201
109368
|
const owner2 = owners.get(order);
|
|
109202
109369
|
const size = Number(order.sz);
|
|
109203
109370
|
return total + (owner2 != null ? coverOf(owner2) : size > 0 ? size : 0);
|
|
109204
109371
|
}, 0);
|
|
109205
|
-
const unseen = entries.filter((entry) => entry.leg.kind === "sl" && entry.group.isLong === isLong &&
|
|
109372
|
+
const unseen = entries.filter((entry) => entry.leg.kind === "sl" && entry.group.isLong === isLong && (input.unresolved?.has(String(entry.leg.orderId)) === true || placedAs(entry) != null)).reduce((total, entry) => total + inFlightOf(entry), 0);
|
|
109206
109373
|
return { onPage, unseen };
|
|
109207
109374
|
}
|
|
109208
109375
|
};
|
|
@@ -109220,10 +109387,9 @@ var init_protective_placed_stops = __esm({
|
|
|
109220
109387
|
init_define_VTX_EXO_POLICY();
|
|
109221
109388
|
init_define_VTX_GROK_POLICY();
|
|
109222
109389
|
init_define_VTX_PI_MODEL_POLICY();
|
|
109223
|
-
init_protective_entry_cover();
|
|
109224
109390
|
init_protective_leg_evidence();
|
|
109225
109391
|
init_protective_market_evidence();
|
|
109226
|
-
passPlacedStops = (
|
|
109392
|
+
passPlacedStops = () => {
|
|
109227
109393
|
const stops = [];
|
|
109228
109394
|
const pages = /* @__PURE__ */ new WeakMap();
|
|
109229
109395
|
let pagesSeen = 0;
|
|
@@ -109234,65 +109400,80 @@ var init_protective_placed_stops = __esm({
|
|
|
109234
109400
|
}
|
|
109235
109401
|
return pages.get(market);
|
|
109236
109402
|
};
|
|
109237
|
-
const ofShape = (stop, order) => protectiveLiveShapeMatches({
|
|
109238
|
-
shape: liveProtectiveOrderShape(order),
|
|
109239
|
-
symbol: symbol2,
|
|
109240
|
-
isLong: stop.isLong,
|
|
109241
|
-
leg: stop.leg,
|
|
109242
|
-
requirePositionTpsl: false
|
|
109243
|
-
});
|
|
109244
109403
|
return {
|
|
109245
|
-
/** A stop about to be sent, under its client order id
|
|
109246
|
-
add: (leg
|
|
109247
|
-
const stop = {
|
|
109248
|
-
ids: [String(leg.orderId)],
|
|
109249
|
-
leg,
|
|
109250
|
-
isLong,
|
|
109251
|
-
sentMs: protectiveReadStampMs(),
|
|
109252
|
-
pagesBefore: pagesSeen,
|
|
109253
|
-
counts: true
|
|
109254
|
-
};
|
|
109404
|
+
/** A stop about to be sent, under its client order id. */
|
|
109405
|
+
add: (leg) => {
|
|
109406
|
+
const stop = { ids: [String(leg.orderId)], sentMs: protectiveReadStampMs(), pagesBefore: pagesSeen, filled: false };
|
|
109255
109407
|
stops.push(stop);
|
|
109256
109408
|
return stop;
|
|
109257
109409
|
},
|
|
109258
|
-
/**
|
|
109410
|
+
/**
|
|
109411
|
+
* The newest stop this pass sent and still holds, if any: the lost-stop
|
|
109412
|
+
* count reads its market again, proven past this stop's stamp, before it
|
|
109413
|
+
* counts a lost stop after it (runtime-execution.ts readLostLegMarket).
|
|
109414
|
+
*/
|
|
109415
|
+
latest: () => stops[stops.length - 1] ?? null,
|
|
109416
|
+
/** A stop never sent, or refused: forgotten. */
|
|
109259
109417
|
drop: (stop) => {
|
|
109260
109418
|
stops.splice(stops.indexOf(stop), 1);
|
|
109261
109419
|
},
|
|
109262
109420
|
/** Its answer (extractCanonicalHyperliquidOrderStateAcknowledgement): its exchange order id, and whether it filled. */
|
|
109263
109421
|
answered: (stop, answer) => {
|
|
109264
109422
|
stop.ids.push(answer.orderId);
|
|
109265
|
-
|
|
109423
|
+
stop.filled = answer.state === "fulfilled";
|
|
109266
109424
|
},
|
|
109267
|
-
/**
|
|
109268
|
-
|
|
109269
|
-
/**
|
|
109270
|
-
* What they cover beside a lost stop counted on this market, and the page
|
|
109271
|
-
* orders they stand for there, which count nothing beside them
|
|
109272
|
-
* (resolveOwnStops lostStopCover).
|
|
109273
|
-
*/
|
|
109274
|
-
count: (market) => {
|
|
109425
|
+
/** What this market's page tells of each, by its client and exchange order ids, when it does not list it. */
|
|
109426
|
+
on: (market) => {
|
|
109275
109427
|
const read = pageOrder(market);
|
|
109276
|
-
|
|
109277
|
-
|
|
109278
|
-
|
|
109279
|
-
|
|
109280
|
-
|
|
109281
|
-
|
|
109282
|
-
if (order != null) taken.add(order);
|
|
109283
|
-
else if (proven(stop)) stop.counts = false;
|
|
109284
|
-
}
|
|
109285
|
-
const standing = after.filter((stop) => stop.counts);
|
|
109286
|
-
return {
|
|
109287
|
-
size: stops.reduce((total, stop) => total + (stop.counts ? stop.leg.size : 0), 0),
|
|
109288
|
-
standsFor: (order) => standing.some((stop) => ofShape(stop, order))
|
|
109289
|
-
};
|
|
109428
|
+
return new Map(stops.flatMap((stop) => {
|
|
109429
|
+
const after = market.orders != null && read > stop.pagesBefore;
|
|
109430
|
+
const proven = !market.viaNode || nodeAnswerProves(market.position.stateTimeMs, { hostMs: stop.sentMs });
|
|
109431
|
+
const told = after && (stop.filled || proven) ? "gone" : "unknown";
|
|
109432
|
+
return stop.ids.map((id2) => [id2, told]);
|
|
109433
|
+
}));
|
|
109290
109434
|
}
|
|
109291
109435
|
};
|
|
109292
109436
|
};
|
|
109293
109437
|
}
|
|
109294
109438
|
});
|
|
109295
109439
|
|
|
109440
|
+
// lib/runtime/client-order-landing.ts
|
|
109441
|
+
var clientOrderNeverLandsAfterMs, requireClientRuntimeConfigSeconds, pageProvesGone;
|
|
109442
|
+
var init_client_order_landing = __esm({
|
|
109443
|
+
"lib/runtime/client-order-landing.ts"() {
|
|
109444
|
+
"use strict";
|
|
109445
|
+
init_define_VTX_CLAUDE_CODE_POLICY();
|
|
109446
|
+
init_define_VTX_EXO_POLICY();
|
|
109447
|
+
init_define_VTX_GROK_POLICY();
|
|
109448
|
+
init_define_VTX_PI_MODEL_POLICY();
|
|
109449
|
+
init_constants();
|
|
109450
|
+
init_protective_market_evidence();
|
|
109451
|
+
init_runtime_error_reason_rules();
|
|
109452
|
+
clientOrderNeverLandsAfterMs = (config2, ledger) => {
|
|
109453
|
+
const marginMs = requireClientRuntimeConfigSeconds(
|
|
109454
|
+
config2,
|
|
109455
|
+
"client_pending_entry_never_landed_margin_seconds"
|
|
109456
|
+
) * MS_PER_SECOND;
|
|
109457
|
+
if (ledger.kind === "found") return ledger.expiresAfterMs + marginMs;
|
|
109458
|
+
const signedLifetimeSeconds = Number(
|
|
109459
|
+
config2?.client_runtime_exchange_mutation?.expires_after_seconds
|
|
109460
|
+
);
|
|
109461
|
+
if (!Number.isInteger(signedLifetimeSeconds) || signedLifetimeSeconds <= 0) {
|
|
109462
|
+
throw new RuntimeReasonError("Missing required client runtime config: client_runtime_exchange_mutation.expires_after_seconds", "runtime_config_missing");
|
|
109463
|
+
}
|
|
109464
|
+
return ledger.ageStartMs + signedLifetimeSeconds * MS_PER_SECOND + marginMs;
|
|
109465
|
+
};
|
|
109466
|
+
requireClientRuntimeConfigSeconds = (config2, key) => {
|
|
109467
|
+
const value = Number(config2?.[key]);
|
|
109468
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
109469
|
+
throw new RuntimeReasonError(`Missing required client runtime config: ${String(key)}`, "runtime_config_missing");
|
|
109470
|
+
}
|
|
109471
|
+
return value;
|
|
109472
|
+
};
|
|
109473
|
+
pageProvesGone = (market, config2) => ((journaledAtMs) => readAfter(market)(clientOrderNeverLandsAfterMs(config2, { kind: "absent", ageStartMs: journaledAtMs })));
|
|
109474
|
+
}
|
|
109475
|
+
});
|
|
109476
|
+
|
|
109296
109477
|
// lib/runtime/protective-oversized-leg.ts
|
|
109297
109478
|
var OVERSIZED_LEG_GROUP_PREFIX, splitOversizedProtectiveLeg;
|
|
109298
109479
|
var init_protective_oversized_leg = __esm({
|
|
@@ -109364,6 +109545,7 @@ var init_native_position_protection = __esm({
|
|
|
109364
109545
|
init_hyperliquid_client();
|
|
109365
109546
|
init_hyperliquid_market_symbol();
|
|
109366
109547
|
init_hyperliquid_order_status();
|
|
109548
|
+
init_order_identity();
|
|
109367
109549
|
init_protective_stop_replacement();
|
|
109368
109550
|
nativeProtectionSettings = (resolved) => ({
|
|
109369
109551
|
stopLoss: resolved.tpSlEnabled && resolved.stopLossEnabled ? {
|
|
@@ -109527,7 +109709,7 @@ var init_native_position_protection = __esm({
|
|
|
109527
109709
|
if (orderType === TRAILING_ORDER_TYPE && rowOrderId != null && ownTrailing.has(rowOrderId)) continue;
|
|
109528
109710
|
const rowKind = orderType.includes("take profit") ? "tp" : orderType.includes("stop") ? "sl" : null;
|
|
109529
109711
|
if (rowKind !== input.kind) continue;
|
|
109530
|
-
if (own.has(
|
|
109712
|
+
if (own.has(listedClientOrderId(row) ?? "")) {
|
|
109531
109713
|
return { decision: "adopt", order_id: Number(row.oid) };
|
|
109532
109714
|
}
|
|
109533
109715
|
const size = String(row.sz ?? "").trim();
|
|
@@ -111429,7 +111611,7 @@ var init_native_protection_device = __esm({
|
|
|
111429
111611
|
});
|
|
111430
111612
|
|
|
111431
111613
|
// lib/runtime/runtime-execution.ts
|
|
111432
|
-
var clientProtectiveMutationAuthority, executionReadPriority, serverEntryLeverageAlreadyHeld, createRuntimeId, _extractFilledSize, firstMemberAcknowledgement, _extractOrderId, _toExecutionMetadata, _extractClientMutationId, _stableMutationIdentity, trailingStopMemory, protectiveGroupMemory, protectiveGroupReadFailures, windowHandoffCleanupAttempts, clientRuntimeProtectionStorage, resolveClientRuntimeProtectionStorage, setClientRuntimeProtectionStorage, trailingStopStorageKey, readTrackedTrailingStops, writeTrackedTrailingStops, rememberTrailingStop, protectiveGroupStorageKey, LOST_LEG_EVIDENCE_MAX_AGE_MS, EPISODE_END_FILL_LOOKBACK_MS, withClientProtectivePlanSetLock, readClientProtectiveGroups, writeClientProtectiveGroups, hasClientProtectiveGroupReadFailure, readFreshClientProtectiveGroups, stableProtectionSnapshot, exactClientProtectiveGroupSnapshot, exactClientProtectiveGroupSetSnapshot, storableClientProtectiveGroup, replaceExactClientProtectiveGroup, replaceExactClientProtectiveGroupSet, isClientRuntimeLeaseOwnershipError, hasClientRuntimeProtectionState, clearClientRuntimeVetoedProtectiveIntent, rethrowWindowHandoffAfterProtectiveReplacementVeto, canPersistClientProtectiveGroups, removeTrackedTrailingStop, replaceTrackedTrailingStop, replacementJournalEntryOrderId, buildProtectiveReplacementJournalGroup, isProtectiveReplacementJournalGroup, reserveProtectiveLegReplacement, ensureProtectiveReplacementJournalCompanion, buildVetoedProtectiveReplacementCleanup, assertExactProtectiveReplacementDispatchAuthority, transitionProtectiveReplacementAcknowledgement, transitionTerminalProtectiveReplacement, isConfiguredProtectionRequested, protectiveAction, isExactClientPositionTpslPair, deviceOwnsClientProtectiveLegKind, isAdoptionNarrowedPositionTpslLeg, hasAmbiguousClientPositionTpslAuthority, protectiveTerminalShapeMatches, cancelClientProtectiveLeg, buildPendingProtectivePlan, persistPendingClientProtectiveGroup, readAttachEvidence, attachClientProtectivePlan, resolveJournaledAttachmentContinuity, protectiveMemberRested, ledgerOrderIdsByClientOrderId, journaledAttachmentNeverLanded, recoverJournaledClientProtectiveAttachments, readClientOrderMutation, readPendingEntryMutation,
|
|
111614
|
+
var clientProtectiveMutationAuthority, executionReadPriority, serverEntryLeverageAlreadyHeld, createRuntimeId, _extractFilledSize, firstMemberAcknowledgement, _extractOrderId, _toExecutionMetadata, _extractClientMutationId, _stableMutationIdentity, trailingStopMemory, protectiveGroupMemory, protectiveGroupReadFailures, windowHandoffCleanupAttempts, clientRuntimeProtectionStorage, resolveClientRuntimeProtectionStorage, setClientRuntimeProtectionStorage, trailingStopStorageKey, readTrackedTrailingStops, writeTrackedTrailingStops, rememberTrailingStop, protectiveGroupStorageKey, LOST_LEG_EVIDENCE_MAX_AGE_MS, EPISODE_END_FILL_LOOKBACK_MS, withClientProtectivePlanSetLock, readClientProtectiveGroups, writeClientProtectiveGroups, hasClientProtectiveGroupReadFailure, readFreshClientProtectiveGroups, stableProtectionSnapshot, exactClientProtectiveGroupSnapshot, exactClientProtectiveGroupSetSnapshot, storableClientProtectiveGroup, replaceExactClientProtectiveGroup, replaceExactClientProtectiveGroupSet, isClientRuntimeLeaseOwnershipError, hasClientRuntimeProtectionState, clearClientRuntimeVetoedProtectiveIntent, rethrowWindowHandoffAfterProtectiveReplacementVeto, canPersistClientProtectiveGroups, removeTrackedTrailingStop, replaceTrackedTrailingStop, replacementJournalEntryOrderId, buildProtectiveReplacementJournalGroup, isProtectiveReplacementJournalGroup, reserveProtectiveLegReplacement, ensureProtectiveReplacementJournalCompanion, buildVetoedProtectiveReplacementCleanup, assertExactProtectiveReplacementDispatchAuthority, transitionProtectiveReplacementAcknowledgement, transitionTerminalProtectiveReplacement, isConfiguredProtectionRequested, protectiveAction, isExactClientPositionTpslPair, deviceOwnsClientProtectiveLegKind, isAdoptionNarrowedPositionTpslLeg, hasAmbiguousClientPositionTpslAuthority, protectiveTerminalShapeMatches, cancelClientProtectiveLeg, buildPendingProtectivePlan, persistPendingClientProtectiveGroup, readAttachEvidence, attachClientProtectivePlan, resolveJournaledAttachmentContinuity, protectiveMemberRested, ledgerOrderIdsByClientOrderId, journaledAttachmentNeverLanded, recoverJournaledClientProtectiveAttachments, readClientOrderMutation, readPendingEntryMutation, replacePendingEntryRecovery, recoverPendingClientProtectiveGroups, recoverPendingProtectiveReplacements, observedStandaloneProtectiveGroup, migrateTrackedTrailingStopsToStandalone, nativeSettingsOf, nativePassEnded, nativeProtectionIo, nativeStorageReport, readNativeRecord, reconcileNativeProtectionForDecision, reconcileClientProtectiveGroups, cancelAllClientProtectiveGroups, modifyClientTrailingLeg, trailingRatchetIo, isDefinitiveEntryRejection, resolveExchangeSizeDecimals, readServerOrderMarkPrice, serverOrderMetadataRetry, resolveCurrentPositionSize, buildPositionSnapshot, runtimeProtectionAuthority, runtimeProtectionListings, runtimeProtectionListing, resolveServerNativeEntry, SERVER_NATIVE_LEGACY_REFUSAL, isServerNativeLegacyRefusal, serverUserCancelLookup, passUserCancelsFor, serverModeProtectionOwner, runtimeProtectionOwners, resolveRuntimeProtectionOwner, drainServerProtectionForRuntime, drainServerProtectionIfOwned, verifyNoLiveClientProtectiveTriggers, clientExecutionMutations, CLIENT_EXECUTION_QUEUE_TIMEOUT_MESSAGE, withClientExecutionMutation, withClientProtectivePlanSetMutation, allocateServerExecutionCapacity, withClientProtectiveAdoptionMutation, executeClientRuntimeDecisionLocked, unsentDecisionOrderReport, SERVER_AUDIT_RECORDED_ELSEWHERE, serverExecutionAuditOutcome, decisionLegOf, withExecutionAuditId, executeClientRuntimeDecision, waitForFlipCloseFreshness, nextClientTrailingStopDueAtMs, ratchetClientTrailingStopsBetweenCycles, handedOverPlan, listPendingClientProtectiveSymbols, listStoredClientProtectiveSymbols, hasUnresolvedClientProtectiveIdentity, resolveClientProtectiveIdentitiesForAdoption, exportClientProtectiveGroupsForAdoption, adoptionGroupKey, applyClientProtectiveAdoptionOutcomes, hasStoredClientProtectiveGroupsForWallet, hasPendingClientProtectiveGroups, recoverManualClientProtectiveGroups, listStoredClientProtectionSymbols, clientRuntimeDecisionSizesOrders, COMMITTED_EXECUTION_REPORTS, COMMITTED_DECISION_ORDER, getCommittedExecutionReports, getCommittedDecisionOrder, withCommittedExecutionReports, executeClientRuntimeDecisionUnlocked;
|
|
111433
111615
|
var init_runtime_execution = __esm({
|
|
111434
111616
|
"lib/runtime/runtime-execution.ts"() {
|
|
111435
111617
|
"use strict";
|
|
@@ -111470,6 +111652,7 @@ var init_runtime_execution = __esm({
|
|
|
111470
111652
|
init_protective_stop_replacement();
|
|
111471
111653
|
init_protective_entry_cover();
|
|
111472
111654
|
init_protective_placed_stops();
|
|
111655
|
+
init_client_order_landing();
|
|
111473
111656
|
init_protective_oversized_leg();
|
|
111474
111657
|
init_protective_report_entry();
|
|
111475
111658
|
init_error_surface_contract();
|
|
@@ -112680,7 +112863,8 @@ var init_runtime_execution = __esm({
|
|
|
112680
112863
|
const cover = resolveOwnStops({
|
|
112681
112864
|
symbol: request.executionContext.symbol,
|
|
112682
112865
|
groups: candidates,
|
|
112683
|
-
orders: market.orders ?? []
|
|
112866
|
+
orders: market.orders ?? [],
|
|
112867
|
+
provesGone: pageProvesGone(market, request.config)
|
|
112684
112868
|
}).directionCover(entryIsLong);
|
|
112685
112869
|
return { position: market.position, cover };
|
|
112686
112870
|
};
|
|
@@ -113432,8 +113616,7 @@ var init_runtime_execution = __esm({
|
|
|
113432
113616
|
throw new Error("Journaled protective order identity is unresolved.");
|
|
113433
113617
|
}
|
|
113434
113618
|
} else {
|
|
113435
|
-
|
|
113436
|
-
if (ledgerVerdict.proven && !mayRestUnseen) {
|
|
113619
|
+
if (ledgerVerdict.proven && !ownStops.lists(provisionalLeg)) {
|
|
113437
113620
|
newlyNeverLanded.add(provisionalLeg.orderId);
|
|
113438
113621
|
inspected.push({ leg: provisionalLeg, state: "terminal", rested: false, neverLanded: true });
|
|
113439
113622
|
continue;
|
|
@@ -113843,27 +114026,6 @@ var init_runtime_execution = __esm({
|
|
|
113843
114026
|
}
|
|
113844
114027
|
};
|
|
113845
114028
|
readPendingEntryMutation = (request, plan) => readClientOrderMutation(request, plan.entryMutationId, plan.entryClientOrderId);
|
|
113846
|
-
clientOrderNeverLandsAfterMs = (config2, ledger) => {
|
|
113847
|
-
const marginMs = requireClientRuntimeConfigSeconds(
|
|
113848
|
-
config2,
|
|
113849
|
-
"client_pending_entry_never_landed_margin_seconds"
|
|
113850
|
-
) * MS_PER_SECOND;
|
|
113851
|
-
if (ledger.kind === "found") return ledger.expiresAfterMs + marginMs;
|
|
113852
|
-
const signedLifetimeSeconds = Number(
|
|
113853
|
-
config2?.client_runtime_exchange_mutation?.expires_after_seconds
|
|
113854
|
-
);
|
|
113855
|
-
if (!Number.isInteger(signedLifetimeSeconds) || signedLifetimeSeconds <= 0) {
|
|
113856
|
-
throw new Error("Missing required client runtime config: client_runtime_exchange_mutation.expires_after_seconds");
|
|
113857
|
-
}
|
|
113858
|
-
return ledger.ageStartMs + signedLifetimeSeconds * MS_PER_SECOND + marginMs;
|
|
113859
|
-
};
|
|
113860
|
-
requireClientRuntimeConfigSeconds = (config2, key) => {
|
|
113861
|
-
const value = Number(config2?.[key]);
|
|
113862
|
-
if (!Number.isFinite(value) || value < 0) {
|
|
113863
|
-
throw new Error(`Missing required client runtime config: ${String(key)}`);
|
|
113864
|
-
}
|
|
113865
|
-
return value;
|
|
113866
|
-
};
|
|
113867
114029
|
replacePendingEntryRecovery = (profileId, symbol2, group, recovery) => {
|
|
113868
114030
|
const plan = group.pendingEntry;
|
|
113869
114031
|
if (plan == null) throw new Error("Pending entry plan is unavailable.");
|
|
@@ -115015,9 +115177,9 @@ var init_runtime_execution = __esm({
|
|
|
115015
115177
|
let livePositionSize;
|
|
115016
115178
|
let liveOrders;
|
|
115017
115179
|
try {
|
|
115018
|
-
|
|
115019
|
-
livePositionSize = Number(
|
|
115020
|
-
const fetchedOrders =
|
|
115180
|
+
market = await market.withPage();
|
|
115181
|
+
livePositionSize = Number(market.position.size);
|
|
115182
|
+
const fetchedOrders = market.orders;
|
|
115021
115183
|
if (!Array.isArray(fetchedOrders)) {
|
|
115022
115184
|
throw new Error("Malformed live protective-order snapshot.");
|
|
115023
115185
|
}
|
|
@@ -115284,7 +115446,7 @@ var init_runtime_execution = __esm({
|
|
|
115284
115446
|
tp: exposure
|
|
115285
115447
|
};
|
|
115286
115448
|
const retainedGroups = expectedGroupSet.filter((group) => group.pendingEntry != null || isProtectiveReplacementJournalGroup(group));
|
|
115287
|
-
const placedStops = passPlacedStops(
|
|
115449
|
+
const placedStops = passPlacedStops();
|
|
115288
115450
|
const unresolvedLegIds = new Set(inspectedGroups.flatMap((candidate) => candidate.legs).filter((entry) => entry.state === "unresolved").map((entry) => String(entry.leg.orderId)));
|
|
115289
115451
|
const lostOrderIds = new Set(inspectedGroups.flatMap((candidate) => candidate.legs).filter((entry) => entry.state === "terminal").flatMap(({ leg }) => [String(leg.orderId), String(lookedUp.get(String(leg.orderId)) ?? leg.orderId)]));
|
|
115290
115452
|
const statusOnlyOrders = () => inspectedGroups.flatMap((candidate) => candidate.legs).filter((entry) => entry.openOrder == null).map((entry) => ({ receivedMs: entry.statusReceivedMs ?? legsLiveSinceMs, atMs: entry.terminalStatus?.statusTimestampMs ?? entry.statusAtMs }));
|
|
@@ -115296,11 +115458,13 @@ var init_runtime_execution = __esm({
|
|
|
115296
115458
|
});
|
|
115297
115459
|
const qualifyingRead = (read) => {
|
|
115298
115460
|
let current = null;
|
|
115461
|
+
let placedBefore = placedStops.latest();
|
|
115299
115462
|
return async () => {
|
|
115300
115463
|
if (current != null) {
|
|
115301
115464
|
const previous = await current;
|
|
115302
|
-
if (readQualifies(previous.sentMs)) return previous;
|
|
115465
|
+
if (readQualifies(previous.sentMs) && placedBefore === placedStops.latest()) return previous;
|
|
115303
115466
|
}
|
|
115467
|
+
placedBefore = placedStops.latest();
|
|
115304
115468
|
current = read();
|
|
115305
115469
|
const fresh = await current;
|
|
115306
115470
|
if (!readQualifies(fresh.sentMs)) {
|
|
@@ -115311,8 +115475,9 @@ var init_runtime_execution = __esm({
|
|
|
115311
115475
|
};
|
|
115312
115476
|
const readLostLegMarket = qualifyingRead(async () => {
|
|
115313
115477
|
const statuses = statusOnlyOrders();
|
|
115478
|
+
const placed = placedStops.latest();
|
|
115314
115479
|
const market2 = await readProtectiveMarket(request, {
|
|
115315
|
-
notBefore: statuses.every((status) => typeof status.atMs === "number" && status.atMs > 0) ? { exchangeMs: Math.max(...statuses.map((status) => status.atMs)) } : { hostMs: Math.max(...statuses.map((status) => status.receivedMs)) },
|
|
115480
|
+
notBefore: placed == null && statuses.every((status) => typeof status.atMs === "number" && status.atMs > 0) ? { exchangeMs: Math.max(...statuses.map((status) => status.atMs)) } : { hostMs: Math.max(placed?.sentMs ?? 0, ...statuses.map((status) => status.receivedMs)) },
|
|
115316
115481
|
priority: "trading_reconcile"
|
|
115317
115482
|
});
|
|
115318
115483
|
return { sentMs: market2.positionSentMs, market: market2 };
|
|
@@ -115419,17 +115584,17 @@ var init_runtime_execution = __esm({
|
|
|
115419
115584
|
orders: market2.orders ?? [],
|
|
115420
115585
|
lookedUp,
|
|
115421
115586
|
unresolved: unresolvedLegIds,
|
|
115422
|
-
placed: placedStops.
|
|
115423
|
-
ended: lostOrderIds
|
|
115587
|
+
placed: placedStops.on(market2),
|
|
115588
|
+
ended: lostOrderIds,
|
|
115589
|
+
provesGone: pageProvesGone(market2, request.config)
|
|
115424
115590
|
}) : null;
|
|
115425
|
-
const
|
|
115426
|
-
const stops = own?.lostStopCover(positionSize, placed);
|
|
115591
|
+
const stops = own?.lostStopCover(positionSize);
|
|
115427
115592
|
const markPrice = Number(market2.position.markPrice);
|
|
115428
115593
|
evidence2 = {
|
|
115429
115594
|
positionSize,
|
|
115430
115595
|
liveStopSize: stops?.onPage ?? 0,
|
|
115431
|
-
// What the legs this pass could not read
|
|
115432
|
-
inFlightStopSize:
|
|
115596
|
+
// What the legs this pass could not read, and its own re-placed stops, may still cover.
|
|
115597
|
+
inFlightStopSize: stops?.unseen ?? 0,
|
|
115433
115598
|
markPrice: replaceReachable && Number.isFinite(markPrice) && markPrice > 0 ? markPrice : null
|
|
115434
115599
|
};
|
|
115435
115600
|
} catch (error48) {
|
|
@@ -115550,7 +115715,7 @@ var init_runtime_execution = __esm({
|
|
|
115550
115715
|
}]
|
|
115551
115716
|
};
|
|
115552
115717
|
}
|
|
115553
|
-
const placedStop = placedStops.add(provisionalLeg
|
|
115718
|
+
const placedStop = placedStops.add(provisionalLeg);
|
|
115554
115719
|
let dispatchMayHaveStarted = false;
|
|
115555
115720
|
let response;
|
|
115556
115721
|
try {
|
|
@@ -115721,7 +115886,8 @@ var init_runtime_execution = __esm({
|
|
|
115721
115886
|
groups: expectedGroupSet,
|
|
115722
115887
|
orders: liveOrders,
|
|
115723
115888
|
lookedUp,
|
|
115724
|
-
unresolved: unresolvedLegIds
|
|
115889
|
+
unresolved: unresolvedLegIds,
|
|
115890
|
+
provesGone: pageProvesGone(market, request.config)
|
|
115725
115891
|
});
|
|
115726
115892
|
const userCancels = passUserCancelsFor(request);
|
|
115727
115893
|
await userCancels?.prefetch(inspectedGroups.flatMap((candidate) => candidate.group.cleanupRequired === true || exposure <= 0 || candidate.legs.some((entry) => entry.state === "fulfilled") ? [] : candidate.legs.filter((entry) => entry.state === "terminal" && entry.leg.replacement == null).map((entry) => entry.leg.orderId)));
|
|
@@ -119928,7 +120094,7 @@ var init_browser_observability = __esm({
|
|
|
119928
120094
|
init_define_VTX_GROK_POLICY();
|
|
119929
120095
|
init_define_VTX_PI_MODEL_POLICY();
|
|
119930
120096
|
init_runtime_policy_generated2();
|
|
119931
|
-
CLIENT_SOURCE_VERSION = typeof process !== "undefined" && true && "
|
|
120097
|
+
CLIENT_SOURCE_VERSION = typeof process !== "undefined" && true && "455c2035586f6d2a0253fb8dabb4418c3f06b04c".trim() && "455c2035586f6d2a0253fb8dabb4418c3f06b04c".trim() !== "unstamped" ? "455c2035586f6d2a0253fb8dabb4418c3f06b04c".trim() : null;
|
|
119932
120098
|
listenersInstalled = false;
|
|
119933
120099
|
state = {
|
|
119934
120100
|
loadedAtMs: Date.now(),
|
|
@@ -121978,6 +122144,7 @@ var init_copy_trading_evidence = __esm({
|
|
|
121978
122144
|
init_hyperliquid_account_mode_contract();
|
|
121979
122145
|
init_hyperliquid_client();
|
|
121980
122146
|
init_monotonic_clock();
|
|
122147
|
+
init_order_identity();
|
|
121981
122148
|
init_protective_evidence();
|
|
121982
122149
|
ACCOUNT_MODE_CACHE_MS = runtime_policy_generated_default2.exchange.hyperliquid.client_public_read_budget.account_mode_ttl_seconds * MS_PER_SECOND;
|
|
121983
122150
|
dexList2 = (value) => {
|
|
@@ -122014,9 +122181,10 @@ var init_copy_trading_evidence = __esm({
|
|
|
122014
122181
|
const refs = /* @__PURE__ */ new Set();
|
|
122015
122182
|
for (const order of response) {
|
|
122016
122183
|
if (!order || typeof order !== "object") continue;
|
|
122017
|
-
const { oid
|
|
122184
|
+
const { oid } = order;
|
|
122185
|
+
const cloid = listedClientOrderId(order);
|
|
122018
122186
|
if (oid != null && oid !== "") refs.add(String(oid).trim().toLowerCase());
|
|
122019
|
-
if (
|
|
122187
|
+
if (cloid) refs.add(cloid);
|
|
122020
122188
|
}
|
|
122021
122189
|
return refs;
|
|
122022
122190
|
};
|
|
@@ -123418,33 +123586,33 @@ var init_history_evidence = __esm({
|
|
|
123418
123586
|
isDecimalText = (value) => typeof value === "string" && DECIMAL_TEXT.test(value.trim());
|
|
123419
123587
|
isRecord6 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
123420
123588
|
parseHistoryPage = (stream, body, startMs, endMs) => {
|
|
123421
|
-
const
|
|
123589
|
+
const malformed3 = (detail) => new HistoryPageError(`The ${stream} page is not a valid Hyperliquid response: ${detail}`);
|
|
123422
123590
|
if (!STREAMS.has(stream)) throw new HistoryPageError(`Unknown history stream ${stream}.`);
|
|
123423
|
-
if (!isInt(startMs) || !isInt(endMs) || startMs < 0 || endMs < startMs) throw
|
|
123424
|
-
if (typeof body !== "string") throw
|
|
123591
|
+
if (!isInt(startMs) || !isInt(endMs) || startMs < 0 || endMs < startMs) throw malformed3("the window is invalid");
|
|
123592
|
+
if (typeof body !== "string") throw malformed3("the body must be the raw response text");
|
|
123425
123593
|
let rows;
|
|
123426
123594
|
try {
|
|
123427
123595
|
rows = JSON.parse(body);
|
|
123428
123596
|
} catch {
|
|
123429
|
-
throw
|
|
123597
|
+
throw malformed3("the body is not JSON");
|
|
123430
123598
|
}
|
|
123431
|
-
if (!Array.isArray(rows)) throw
|
|
123599
|
+
if (!Array.isArray(rows)) throw malformed3("the body is not a list");
|
|
123432
123600
|
for (const row of rows) {
|
|
123433
|
-
if (!isRecord6(row)) throw
|
|
123601
|
+
if (!isRecord6(row)) throw malformed3("a row is not an object");
|
|
123434
123602
|
const time3 = row.time;
|
|
123435
|
-
if (!isInt(time3)) throw
|
|
123436
|
-
if (time3 < startMs || time3 > endMs) throw
|
|
123437
|
-
if (!isText(row.hash)) throw
|
|
123603
|
+
if (!isInt(time3)) throw malformed3("a row has no millisecond time");
|
|
123604
|
+
if (time3 < startMs || time3 > endMs) throw malformed3("a row lies outside the requested window");
|
|
123605
|
+
if (!isText(row.hash)) throw malformed3("a row has no hash");
|
|
123438
123606
|
if (stream === "fills") {
|
|
123439
123607
|
if (!(isText(row.coin) && isInt(row.oid) && (row.side === "A" || row.side === "B") && isDecimalText(row.px) && isDecimalText(row.sz))) {
|
|
123440
|
-
throw
|
|
123608
|
+
throw malformed3("a fill lacks coin, oid, side, px or sz");
|
|
123441
123609
|
}
|
|
123442
123610
|
continue;
|
|
123443
123611
|
}
|
|
123444
123612
|
const delta = row.delta;
|
|
123445
|
-
if (!isRecord6(delta) || !isText(delta.type)) throw
|
|
123613
|
+
if (!isRecord6(delta) || !isText(delta.type)) throw malformed3("a row has no typed delta");
|
|
123446
123614
|
if (stream === "funding" && !(delta.type === "funding" && isText(delta.coin) && isDecimalText(delta.usdc))) {
|
|
123447
|
-
throw
|
|
123615
|
+
throw malformed3("a funding row lacks coin or usdc");
|
|
123448
123616
|
}
|
|
123449
123617
|
}
|
|
123450
123618
|
return rows;
|
|
@@ -133147,9 +133315,9 @@ var init_local_analysis = __esm({
|
|
|
133147
133315
|
RUNTIME_SOURCE_DEFINITION_VERSION = "runtime-source-v1";
|
|
133148
133316
|
DECISION_INPUT_DEFINITION_VERSION = "decision-input-v1";
|
|
133149
133317
|
CONTEXT_ENVELOPE_DEFINITION_VERSION = "context-envelope-v2.1";
|
|
133150
|
-
CLIENT_RUNTIME_SOURCE_VERSION = typeof process !== "undefined" && true && "
|
|
133151
|
-
"
|
|
133152
|
-
) ? "
|
|
133318
|
+
CLIENT_RUNTIME_SOURCE_VERSION = typeof process !== "undefined" && true && "455c2035586f6d2a0253fb8dabb4418c3f06b04c".trim() && !["unknown", "unstamped", "development"].includes(
|
|
133319
|
+
"455c2035586f6d2a0253fb8dabb4418c3f06b04c".trim().toLowerCase()
|
|
133320
|
+
) ? "455c2035586f6d2a0253fb8dabb4418c3f06b04c".trim() : null;
|
|
133153
133321
|
CLIENT_MAIN_PROMPT_RENDERER = "client_runtime.buildLocalRuntimePromptArtifacts:v1";
|
|
133154
133322
|
CLIENT_REVIEW_PROMPT_RENDERER = "client_runtime.review_prompt_assembly:v1";
|
|
133155
133323
|
resolveEffectivePromptRuntimeProvenance = (input) => ({
|