@vtxmacro/cli 2026.10.23 → 2026.10.24
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 +4 -0
- package/bin/vtx-mcp.js +5 -1
- package/bin/vtx-service-bootstrap.js +5 -1
- package/bin/vtx-service-launcher.js +4 -0
- package/bin/vtx.js +261 -51
- package/package.json +1 -1
package/bin/exo-harness.ts
CHANGED
|
@@ -1225,6 +1225,10 @@ var runtime_policy_generated_default = {
|
|
|
1225
1225
|
recovery_queue_wait_seconds: 10,
|
|
1226
1226
|
recovery_quiet_seconds: 30
|
|
1227
1227
|
},
|
|
1228
|
+
acknowledgement_lookup: {
|
|
1229
|
+
window_milliseconds: 1e4,
|
|
1230
|
+
poll_milliseconds: 1e3
|
|
1231
|
+
},
|
|
1228
1232
|
http: {
|
|
1229
1233
|
exchange: {
|
|
1230
1234
|
request_timeout_seconds: 10,
|
package/bin/vtx-mcp.js
CHANGED
|
@@ -37,7 +37,7 @@ var init_define_VTX_PI_MODEL_POLICY = __esm({
|
|
|
37
37
|
var agent_cli_release_default;
|
|
38
38
|
var init_agent_cli_release = __esm({
|
|
39
39
|
"agent-cli-release.json"() {
|
|
40
|
-
agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.
|
|
40
|
+
agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.24", 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" } } };
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
|
|
@@ -2462,6 +2462,10 @@ var runtime_policy_generated_default = {
|
|
|
2462
2462
|
recovery_queue_wait_seconds: 10,
|
|
2463
2463
|
recovery_quiet_seconds: 30
|
|
2464
2464
|
},
|
|
2465
|
+
acknowledgement_lookup: {
|
|
2466
|
+
window_milliseconds: 1e4,
|
|
2467
|
+
poll_milliseconds: 1e3
|
|
2468
|
+
},
|
|
2465
2469
|
http: {
|
|
2466
2470
|
exchange: {
|
|
2467
2471
|
request_timeout_seconds: 10,
|
|
@@ -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.24", 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 = {
|
|
@@ -1169,6 +1169,10 @@ var runtime_policy_generated_default = {
|
|
|
1169
1169
|
recovery_queue_wait_seconds: 10,
|
|
1170
1170
|
recovery_quiet_seconds: 30
|
|
1171
1171
|
},
|
|
1172
|
+
acknowledgement_lookup: {
|
|
1173
|
+
window_milliseconds: 1e4,
|
|
1174
|
+
poll_milliseconds: 1e3
|
|
1175
|
+
},
|
|
1172
1176
|
http: {
|
|
1173
1177
|
exchange: {
|
|
1174
1178
|
request_timeout_seconds: 10,
|
|
@@ -1153,6 +1153,10 @@ var runtime_policy_generated_default = {
|
|
|
1153
1153
|
recovery_queue_wait_seconds: 10,
|
|
1154
1154
|
recovery_quiet_seconds: 30
|
|
1155
1155
|
},
|
|
1156
|
+
acknowledgement_lookup: {
|
|
1157
|
+
window_milliseconds: 1e4,
|
|
1158
|
+
poll_milliseconds: 1e3
|
|
1159
|
+
},
|
|
1156
1160
|
http: {
|
|
1157
1161
|
exchange: {
|
|
1158
1162
|
request_timeout_seconds: 10,
|
package/bin/vtx.js
CHANGED
|
@@ -113,7 +113,7 @@ var init_routing = __esm({
|
|
|
113
113
|
var agent_cli_release_default;
|
|
114
114
|
var init_agent_cli_release = __esm({
|
|
115
115
|
"agent-cli-release.json"() {
|
|
116
|
-
agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.
|
|
116
|
+
agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.24", 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" } } };
|
|
117
117
|
}
|
|
118
118
|
});
|
|
119
119
|
|
|
@@ -1273,6 +1273,10 @@ var init_runtime_policy_generated = __esm({
|
|
|
1273
1273
|
recovery_queue_wait_seconds: 10,
|
|
1274
1274
|
recovery_quiet_seconds: 30
|
|
1275
1275
|
},
|
|
1276
|
+
acknowledgement_lookup: {
|
|
1277
|
+
window_milliseconds: 1e4,
|
|
1278
|
+
poll_milliseconds: 1e3
|
|
1279
|
+
},
|
|
1276
1280
|
http: {
|
|
1277
1281
|
exchange: {
|
|
1278
1282
|
request_timeout_seconds: 10,
|
|
@@ -21093,6 +21097,10 @@ var init_runtime_policy_generated2 = __esm({
|
|
|
21093
21097
|
recovery_queue_wait_seconds: 10,
|
|
21094
21098
|
recovery_quiet_seconds: 30
|
|
21095
21099
|
},
|
|
21100
|
+
acknowledgement_lookup: {
|
|
21101
|
+
window_milliseconds: 1e4,
|
|
21102
|
+
poll_milliseconds: 1e3
|
|
21103
|
+
},
|
|
21096
21104
|
http: {
|
|
21097
21105
|
exchange: {
|
|
21098
21106
|
request_timeout_seconds: 10,
|
|
@@ -90355,7 +90363,7 @@ var init_hyperliquid_signer = __esm({
|
|
|
90355
90363
|
});
|
|
90356
90364
|
|
|
90357
90365
|
// lib/runtime/hyperliquid-client.ts
|
|
90358
|
-
var HyperliquidExchangeRejectionError, durableMutationAuthorityArgs, assertFreshPreparedExecutionContext, normalizeSymbol, 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, coerceMarketMaxLeverage, toFiniteNumber, OPEN_ORDER_NUMERIC_STRING, OPEN_ORDER_ID_STRING, parseCanonicalOpenOrderId, parseOpenOrderFiniteNumber, parseOpenOrderNonNegativeNumber, NATIVE_FIRED_TRIGGER_CONDITION, parseOpenOrderPositiveNumber, parseOpenOrderPresentationNumber, readOpenOrderField, firstFiniteNumber, parseFundingUsdcFromInfoPosition, isExchangeIsolatedOnly, resolveLeverageTarget, computeHip3AssetId, getPerpDexIndexMap, buildAssetInfosFromMetaResponse, requireWalletAddress, assertPositiveInteger, assertPositiveNumber, normalizeOrderSide, normalizeHyperliquidClientOrderId, resolveAssets, findResolvedAsset, normalizeExecutionAssetMetadata, resolveHyperliquidAsset, resolveHyperliquidAssetIndex, decimalUnits, quantizeHyperliquidOrderSizeValue, hyperliquidSignedSizeMatchesRequestedSize, finitePositive, readDevicePrivateExecutionContext, quantizeHyperliquidOrderSize, fetchBrowserAvailableAssets, fetchBrowserAllMids, fetchBrowserSymbolMidPrice, fetchBrowserOpenOrders, parseCanonicalHyperliquidOrderStatusEvidence, fetchBrowserOrderStatusEvidence, fetchBrowserUserRole, fetchBrowserAccountState, fetchBrowserPosition, buildHyperliquidOrderWire, buildHyperliquidTriggerOrderWire, signHyperliquidPayload, signHyperliquidPreparedAction, buildHyperliquidCancelPayload, buildHyperliquidUpdateLeveragePayload, buildHyperliquidMarketOrderPayload, buildHyperliquidLimitOrderPayload, buildHyperliquidTriggerOrderPayload, buildHyperliquidOrderBatchPayload, buildHyperliquidModifyOrderPayload, extractHyperliquidExchangeError, resolveHyperliquidTriggerAcknowledgements, resolveHyperliquidModifyAcknowledgement, isDefinitiveHyperliquidExchangeResponse, extractDefinitiveHyperliquidOrderId, CANONICAL_POSITIVE_DECIMAL_PATTERN, extractCanonicalHyperliquidOrderStateAcknowledgement, extractCanonicalHyperliquidOrderStateAcknowledgements, extractCanonicalHyperliquidFilledOrderAcknowledgement, extractDefinitiveHyperliquidOrderMemberResults, buildHyperliquidOrderDiagnostics, loadClientExecutionReferenceEvidence, sha256Hex, extractSignedPayloadClientOrderId, extractSignedPayloadMutationCorrelation, assertDurableMutationMatchesSignedAction, exchangeRejectionReason, exchangeActionPriority, submitHyperliquidExchangePayload;
|
|
90366
|
+
var HyperliquidExchangeRejectionError, durableMutationAuthorityArgs, assertFreshPreparedExecutionContext, normalizeSymbol, 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, coerceMarketMaxLeverage, toFiniteNumber, OPEN_ORDER_NUMERIC_STRING, OPEN_ORDER_ID_STRING, parseCanonicalOpenOrderId, parseOpenOrderFiniteNumber, parseOpenOrderNonNegativeNumber, NATIVE_FIRED_TRIGGER_CONDITION, parseOpenOrderPositiveNumber, parseOpenOrderPresentationNumber, readOpenOrderField, firstFiniteNumber, parseFundingUsdcFromInfoPosition, isExchangeIsolatedOnly, resolveLeverageTarget, computeHip3AssetId, getPerpDexIndexMap, buildAssetInfosFromMetaResponse, requireWalletAddress, assertPositiveInteger, assertPositiveNumber, normalizeOrderSide, normalizeHyperliquidClientOrderId, resolveAssets, findResolvedAsset, normalizeExecutionAssetMetadata, resolveHyperliquidAsset, resolveHyperliquidAssetIndex, decimalUnits, quantizeHyperliquidOrderSizeValue, hyperliquidSignedSizeMatchesRequestedSize, finitePositive, readDevicePrivateExecutionContext, quantizeHyperliquidOrderSize, fetchBrowserAvailableAssets, fetchBrowserAllMids, fetchBrowserSymbolMidPrice, fetchBrowserOpenOrders, parseCanonicalHyperliquidOrderStatusEvidence, fetchBrowserOrderStatusEvidence, fetchBrowserUserRole, fetchBrowserAccountState, fetchBrowserPosition, buildHyperliquidOrderWire, buildHyperliquidTriggerOrderWire, signHyperliquidPayload, signHyperliquidPreparedAction, buildHyperliquidCancelPayload, buildHyperliquidUpdateLeveragePayload, buildHyperliquidMarketOrderPayload, buildHyperliquidLimitOrderPayload, buildHyperliquidTriggerOrderPayload, buildHyperliquidOrderBatchPayload, buildHyperliquidModifyOrderPayload, extractHyperliquidExchangeError, acknowledgementLookupPacing, lookupUntilListed, resolveHyperliquidTriggerAcknowledgements, resolveHyperliquidModifyAcknowledgement, isDefinitiveHyperliquidExchangeResponse, extractDefinitiveHyperliquidOrderId, CANONICAL_POSITIVE_DECIMAL_PATTERN, extractCanonicalHyperliquidOrderStateAcknowledgement, extractCanonicalHyperliquidOrderStateAcknowledgements, extractCanonicalHyperliquidFilledOrderAcknowledgement, extractDefinitiveHyperliquidOrderMemberResults, buildHyperliquidOrderDiagnostics, loadClientExecutionReferenceEvidence, sha256Hex, extractSignedPayloadClientOrderId, extractSignedPayloadMutationCorrelation, assertDurableMutationMatchesSignedAction, exchangeRejectionReason, exchangeActionPriority, submitHyperliquidExchangePayload;
|
|
90359
90367
|
var init_hyperliquid_client = __esm({
|
|
90360
90368
|
"lib/runtime/hyperliquid-client.ts"() {
|
|
90361
90369
|
"use strict";
|
|
@@ -91861,7 +91869,24 @@ var init_hyperliquid_client = __esm({
|
|
|
91861
91869
|
}
|
|
91862
91870
|
return null;
|
|
91863
91871
|
};
|
|
91864
|
-
|
|
91872
|
+
acknowledgementLookupPacing = () => ({
|
|
91873
|
+
windowMs: runtime_policy_generated_default2.exchange.hyperliquid.acknowledgement_lookup.window_milliseconds,
|
|
91874
|
+
pollMs: runtime_policy_generated_default2.exchange.hyperliquid.acknowledgement_lookup.poll_milliseconds,
|
|
91875
|
+
sleep: (ms) => new Promise((resolve14) => {
|
|
91876
|
+
globalThis.setTimeout(resolve14, ms);
|
|
91877
|
+
}),
|
|
91878
|
+
// Monotonic: a wall-clock step must not stretch or cut the window.
|
|
91879
|
+
nowMs: () => globalThis.performance.now()
|
|
91880
|
+
});
|
|
91881
|
+
lookupUntilListed = async (lookup, clientOrderId, pacing) => {
|
|
91882
|
+
const deadline = pacing.nowMs() + pacing.windowMs;
|
|
91883
|
+
for (; ; ) {
|
|
91884
|
+
const evidence = await lookup(clientOrderId);
|
|
91885
|
+
if (evidence.responseStatus !== "unknownOid" || pacing.nowMs() + pacing.pollMs > deadline) return evidence;
|
|
91886
|
+
await pacing.sleep(pacing.pollMs);
|
|
91887
|
+
}
|
|
91888
|
+
};
|
|
91889
|
+
resolveHyperliquidTriggerAcknowledgements = async (payload, action, lookup, pacing = acknowledgementLookupPacing()) => {
|
|
91865
91890
|
if (action.type !== "order" || action.grouping !== "normalTpsl" && action.grouping !== "positionTpsl" || !Array.isArray(action.orders) || payload == null || typeof payload !== "object" || Array.isArray(payload)) {
|
|
91866
91891
|
return payload;
|
|
91867
91892
|
}
|
|
@@ -91883,7 +91908,7 @@ var init_hyperliquid_client = __esm({
|
|
|
91883
91908
|
}
|
|
91884
91909
|
let evidence;
|
|
91885
91910
|
try {
|
|
91886
|
-
evidence = await lookup
|
|
91911
|
+
evidence = await lookupUntilListed(lookup, clientOrderId, pacing);
|
|
91887
91912
|
} catch {
|
|
91888
91913
|
return payload;
|
|
91889
91914
|
}
|
|
@@ -91895,7 +91920,7 @@ var init_hyperliquid_client = __esm({
|
|
|
91895
91920
|
}
|
|
91896
91921
|
return { ...root, response: { ...response, data: { ...data4, statuses: resolved } } };
|
|
91897
91922
|
};
|
|
91898
|
-
resolveHyperliquidModifyAcknowledgement = async (payload, action, lookup) => {
|
|
91923
|
+
resolveHyperliquidModifyAcknowledgement = async (payload, action, lookup, pacing = acknowledgementLookupPacing()) => {
|
|
91899
91924
|
if (action.type !== "modify" || payload == null || typeof payload !== "object" || Array.isArray(payload)) {
|
|
91900
91925
|
return payload;
|
|
91901
91926
|
}
|
|
@@ -91908,7 +91933,7 @@ var init_hyperliquid_client = __esm({
|
|
|
91908
91933
|
}
|
|
91909
91934
|
let evidence;
|
|
91910
91935
|
try {
|
|
91911
|
-
evidence = await lookup
|
|
91936
|
+
evidence = await lookupUntilListed(lookup, clientOrderId, pacing);
|
|
91912
91937
|
} catch {
|
|
91913
91938
|
return payload;
|
|
91914
91939
|
}
|
|
@@ -96303,7 +96328,7 @@ var init_browser_trading = __esm({
|
|
|
96303
96328
|
};
|
|
96304
96329
|
executeClientMarketOrder = async (input) => {
|
|
96305
96330
|
input = { ...input, publicRequestPriority: input.reduceOnly === true ? "trading_reduce" : "trading_execute" };
|
|
96306
|
-
if ((input.positionChildren?.length ?? 0) > 0 && input.protection) {
|
|
96331
|
+
if ((input.positionChildren?.length ?? 0) > 0 && input.protection && !input.protection.native) {
|
|
96307
96332
|
throw new Error("An entry carries either native position children or server-owned protection, not both.");
|
|
96308
96333
|
}
|
|
96309
96334
|
throwIfAborted(input.signal);
|
|
@@ -98348,7 +98373,7 @@ var init_protective_evidence = __esm({
|
|
|
98348
98373
|
});
|
|
98349
98374
|
|
|
98350
98375
|
// lib/runtime/protective-actions.ts
|
|
98351
|
-
var DECIMAL, CLOID, fail2, exactKeys, nonNegativeInteger, decimalString, canonicalTriggerOrder, canonicalProtectiveWireAction, assertProtectiveActionLocallySafe, authorityArgs2, errorCode2, foreignClaimExpiresAtMs, drainLocks, refusedUntil, drainClientProtectiveActions, drainOnce;
|
|
98376
|
+
var DECIMAL, CLOID, fail2, exactKeys, nonNegativeInteger, decimalString, POSITION_ORDER_SIZE, orderSizeString, canonicalTriggerOrder, canonicalProtectiveWireAction, assertProtectiveActionLocallySafe, authorityArgs2, errorCode2, foreignClaimExpiresAtMs, drainLocks, refusedUntil, drainClientProtectiveActions, drainOnce;
|
|
98352
98377
|
var init_protective_actions = __esm({
|
|
98353
98378
|
"lib/runtime/protective-actions.ts"() {
|
|
98354
98379
|
"use strict";
|
|
@@ -98387,6 +98412,8 @@ var init_protective_actions = __esm({
|
|
|
98387
98412
|
if (typeof value !== "string" || !DECIMAL.test(value) || Number(value) <= 0) fail2(`${label2} is invalid.`);
|
|
98388
98413
|
return value;
|
|
98389
98414
|
};
|
|
98415
|
+
POSITION_ORDER_SIZE = "0";
|
|
98416
|
+
orderSizeString = (value) => value === POSITION_ORDER_SIZE ? POSITION_ORDER_SIZE : decimalString(value, "size");
|
|
98390
98417
|
canonicalTriggerOrder = (value) => {
|
|
98391
98418
|
const order = exactKeys(value, ["a", "b", "p", "s", "r", "t", "c"], "order");
|
|
98392
98419
|
const type = exactKeys(order.t, ["trigger"], "order type");
|
|
@@ -98401,7 +98428,7 @@ var init_protective_actions = __esm({
|
|
|
98401
98428
|
a: nonNegativeInteger(order.a, "asset"),
|
|
98402
98429
|
b: order.b,
|
|
98403
98430
|
p: decimalString(order.p, "price"),
|
|
98404
|
-
s:
|
|
98431
|
+
s: orderSizeString(order.s),
|
|
98405
98432
|
r: true,
|
|
98406
98433
|
t: {
|
|
98407
98434
|
trigger: {
|
|
@@ -98419,9 +98446,12 @@ var init_protective_actions = __esm({
|
|
|
98419
98446
|
const action = exactKeys(wire, ["type", "orders", "grouping"], "action");
|
|
98420
98447
|
const orders = Array.isArray(action.orders) ? action.orders.map(canonicalTriggerOrder) : fail2("orders are missing.");
|
|
98421
98448
|
const grouping = action.grouping;
|
|
98422
|
-
|
|
98449
|
+
const positionOrders = orders.filter((order) => order.s === POSITION_ORDER_SIZE);
|
|
98450
|
+
const kinds = orders.map((order) => order.t.trigger.tpsl);
|
|
98451
|
+
if (!(orders.length === 1 && grouping === "na" && positionOrders.length === 0) && !(orders.length === HYPERLIQUID_EXCHANGE_SPECIFICATION.position_tpsl_order_count && grouping === "positionTpsl" && (positionOrders.length === 0 || positionOrders.length === orders.length)) && !(grouping === "positionTpsl" && orders.length === 1 && positionOrders.length === 1)) {
|
|
98423
98452
|
fail2("order grouping is invalid.");
|
|
98424
98453
|
}
|
|
98454
|
+
if (positionOrders.length > 0 && new Set(kinds).size !== kinds.length) fail2("position orders repeat a kind.");
|
|
98425
98455
|
return { type: "order", orders, grouping };
|
|
98426
98456
|
}
|
|
98427
98457
|
if (kind === "modify") {
|
|
@@ -99602,7 +99632,7 @@ var init_protective_entry_cover = __esm({
|
|
|
99602
99632
|
});
|
|
99603
99633
|
|
|
99604
99634
|
// lib/runtime/native-position-protection.ts
|
|
99605
|
-
var nativeProtectionSettings, memberSetting, KINDS, formatTriggerOrNull, nativePositionTriggerPrice, nativeEntryRequest, HALF_UP_DIGIT, roundDecimalHalfUp, nativeTrailingRetracement, nativeAfterFillActions, classifyNativeOrderEnd, isOpenInDirection, nativePlacementGate, nativeStrayOrderDecision, explainAbsentProtectiveOrder;
|
|
99635
|
+
var nativeProtectionSettings, memberSetting, KINDS, formatTriggerOrNull, nativePositionTriggerPrice, nativeEntryRequest, HALF_UP_DIGIT, roundDecimalHalfUp, nativeTrailingRetracement, nativeAfterFillActions, classifyNativeOrderEnd, isOpenInDirection, nativePlacementGate, nativeStrayOrderDecision, explainAbsentProtectiveOrder, readServerNativeProtectionState;
|
|
99606
99636
|
var init_native_position_protection = __esm({
|
|
99607
99637
|
"lib/runtime/native-position-protection.ts"() {
|
|
99608
99638
|
"use strict";
|
|
@@ -99751,11 +99781,21 @@ var init_native_position_protection = __esm({
|
|
|
99751
99781
|
if (isOpenInDirection(input.position, input.isLong)) return "status_read";
|
|
99752
99782
|
return input.positionStateMs > input.lastSeenRestingMs ? "ended_with_position" : "need_reads";
|
|
99753
99783
|
};
|
|
99784
|
+
readServerNativeProtectionState = (listing) => {
|
|
99785
|
+
const raw = listing?.native_position_protection;
|
|
99786
|
+
if (!raw || typeof raw !== "object") return null;
|
|
99787
|
+
const record5 = raw;
|
|
99788
|
+
const symbols = (value) => Array.isArray(value) && value.every((item) => typeof item === "string") ? value : null;
|
|
99789
|
+
const legacy = symbols(record5.legacy_symbols);
|
|
99790
|
+
const native = symbols(record5.native_symbols);
|
|
99791
|
+
if (typeof record5.enabled !== "boolean" || legacy == null || native == null) return null;
|
|
99792
|
+
return { enabled: record5.enabled, legacySymbols: new Set(legacy), nativeSymbols: new Set(native) };
|
|
99793
|
+
};
|
|
99754
99794
|
}
|
|
99755
99795
|
});
|
|
99756
99796
|
|
|
99757
99797
|
// lib/runtime/native-protection-device.ts
|
|
99758
|
-
var NATIVE_PROTECTION_RECORD_VERSION, nativeProtectionStorage, resolveStorage, setNativeProtectionStorage, recordKey, isMember, readNativeProtectionRecord, writeNativeProtectionRecord, NativeOrderNotSentError, withDispatchBoundary, attempt, errorText, actionOf, isOpenInDirection2, restingOrderIdAt, definitivelyRefused, planNativeOpen, recordEntryChildren, observeMembers, UNKNOWN_ORDER_RESPONSE, resolveUnknownOrderIds, settleNativeProtectionAfterFill, reconcileNativeProtection;
|
|
99798
|
+
var NATIVE_PROTECTION_RECORD_VERSION, nativeProtectionStorage, resolveStorage, setNativeProtectionStorage, recordKey, isMember, readNativeProtectionRecord, writeNativeProtectionRecord, NativeOrderNotSentError, withDispatchBoundary, attempt, notSentRestores, errorText, actionOf, isOpenInDirection2, restingOrderIdAt, definitivelyRefused, planNativeOpen, recordEntryChildren, observeMembers, UNKNOWN_ORDER_RESPONSE, resolveUnknownOrderIds, settleNativeProtectionAfterFill, reconcileNativeProtection;
|
|
99759
99799
|
var init_native_protection_device = __esm({
|
|
99760
99800
|
"lib/runtime/native-protection-device.ts"() {
|
|
99761
99801
|
"use strict";
|
|
@@ -99828,9 +99868,18 @@ var init_native_protection_device = __esm({
|
|
|
99828
99868
|
const response = await call();
|
|
99829
99869
|
return definitivelyRefused(response) ? { ok: false, refused: true, error: response } : { ok: true, response };
|
|
99830
99870
|
} catch (error48) {
|
|
99871
|
+
if (io.endsPass?.(error48)) throw error48;
|
|
99831
99872
|
return { ok: false, refused: io.isDefinitiveRefusal(error48), error: error48 };
|
|
99832
99873
|
}
|
|
99833
99874
|
};
|
|
99875
|
+
notSentRestores = async (send, restore) => {
|
|
99876
|
+
try {
|
|
99877
|
+
return await send();
|
|
99878
|
+
} catch (error48) {
|
|
99879
|
+
if (error48 instanceof NativeOrderNotSentError) restore();
|
|
99880
|
+
throw error48;
|
|
99881
|
+
}
|
|
99882
|
+
};
|
|
99834
99883
|
errorText = (error48) => error48 instanceof Error ? error48.message : typeof error48 === "string" ? error48 : "Exchange call failed.";
|
|
99835
99884
|
actionOf = (kind) => kind === "sl" ? "AUTO_SL" : "AUTO_TP";
|
|
99836
99885
|
isOpenInDirection2 = (position, isLong) => isLong ? position > 0 : position < 0;
|
|
@@ -100039,7 +100088,7 @@ var init_native_protection_device = __esm({
|
|
|
100039
100088
|
action: actionOf(step.kind),
|
|
100040
100089
|
status: "failed",
|
|
100041
100090
|
execution_metadata: {
|
|
100042
|
-
reason_code: "protective_modify_rejected",
|
|
100091
|
+
reason_code: outcome2.error instanceof NativeOrderNotSentError ? "protective_modify_not_sent" : "protective_modify_rejected",
|
|
100043
100092
|
trigger_price: step.trigger,
|
|
100044
100093
|
error: errorText(outcome2.error)
|
|
100045
100094
|
}
|
|
@@ -100082,19 +100131,46 @@ var init_native_protection_device = __esm({
|
|
|
100082
100131
|
continue;
|
|
100083
100132
|
}
|
|
100084
100133
|
const sentAtMs = io.nowMs();
|
|
100085
|
-
const
|
|
100134
|
+
const journaled = {
|
|
100086
100135
|
kind: step.kind,
|
|
100087
|
-
|
|
100088
|
-
|
|
100089
|
-
|
|
100136
|
+
clientOrderId,
|
|
100137
|
+
orderId: null,
|
|
100138
|
+
trigger: step.trigger,
|
|
100139
|
+
placedAtMs: null,
|
|
100140
|
+
sentAtMs,
|
|
100141
|
+
replacedOnce: existing?.replacedOnce ?? false
|
|
100142
|
+
};
|
|
100143
|
+
const before = [...members];
|
|
100144
|
+
if (index >= 0) members[index] = journaled;
|
|
100145
|
+
else members.push(journaled);
|
|
100146
|
+
if (!io.persist({ ...record5, phase: "active", members })) {
|
|
100147
|
+
members.splice(0, members.length, ...before);
|
|
100148
|
+
reports.push({
|
|
100149
|
+
order_id: null,
|
|
100150
|
+
symbol: symbol2,
|
|
100151
|
+
action: actionOf(step.kind),
|
|
100152
|
+
status: "failed",
|
|
100153
|
+
execution_metadata: { reason_code: "protective_lifecycle_persistence_failed", trigger_price: step.trigger }
|
|
100154
|
+
});
|
|
100155
|
+
continue;
|
|
100156
|
+
}
|
|
100157
|
+
const outcome = await notSentRestores(
|
|
100158
|
+
() => attempt(io, () => io.placePositionOrder({
|
|
100159
|
+
kind: step.kind,
|
|
100160
|
+
triggerPrice: Number(step.trigger),
|
|
100161
|
+
clientOrderId
|
|
100162
|
+
})),
|
|
100163
|
+
() => io.persist({ ...record5, phase: "active", members: before })
|
|
100164
|
+
);
|
|
100090
100165
|
if (!outcome.ok && outcome.refused) {
|
|
100166
|
+
members.splice(0, members.length, ...before);
|
|
100091
100167
|
reports.push({
|
|
100092
100168
|
order_id: null,
|
|
100093
100169
|
symbol: symbol2,
|
|
100094
100170
|
action: actionOf(step.kind),
|
|
100095
100171
|
status: "failed",
|
|
100096
100172
|
execution_metadata: {
|
|
100097
|
-
reason_code: "protective_place_rejected",
|
|
100173
|
+
reason_code: outcome.error instanceof NativeOrderNotSentError ? "protective_place_not_sent" : "protective_place_rejected",
|
|
100098
100174
|
trigger_price: step.trigger,
|
|
100099
100175
|
error: errorText(outcome.error)
|
|
100100
100176
|
}
|
|
@@ -100102,16 +100178,11 @@ var init_native_protection_device = __esm({
|
|
|
100102
100178
|
continue;
|
|
100103
100179
|
}
|
|
100104
100180
|
const placed = {
|
|
100105
|
-
|
|
100106
|
-
|
|
100107
|
-
orderId: outcome.ok ? restingOrderIdAt(outcome.response, 0) : null,
|
|
100108
|
-
trigger: step.trigger,
|
|
100109
|
-
placedAtMs: null,
|
|
100110
|
-
sentAtMs,
|
|
100111
|
-
replacedOnce: existing?.replacedOnce ?? false
|
|
100181
|
+
...journaled,
|
|
100182
|
+
orderId: outcome.ok ? restingOrderIdAt(outcome.response, 0) : null
|
|
100112
100183
|
};
|
|
100113
100184
|
if (index >= 0) members[index] = placed;
|
|
100114
|
-
else members.
|
|
100185
|
+
else members[members.length - 1] = placed;
|
|
100115
100186
|
reports.push({
|
|
100116
100187
|
order_id: placed.orderId == null ? null : String(placed.orderId),
|
|
100117
100188
|
symbol: symbol2,
|
|
@@ -100179,11 +100250,69 @@ var init_native_protection_device = __esm({
|
|
|
100179
100250
|
if (gate !== "place") return args.member;
|
|
100180
100251
|
const clientOrderId = clientOrderIdForMutation(io.newMutationId());
|
|
100181
100252
|
const sentAtMs = io.nowMs();
|
|
100182
|
-
const
|
|
100253
|
+
const journaled = {
|
|
100183
100254
|
kind: args.member.kind,
|
|
100184
|
-
|
|
100185
|
-
|
|
100186
|
-
|
|
100255
|
+
clientOrderId,
|
|
100256
|
+
orderId: null,
|
|
100257
|
+
trigger: args.trigger,
|
|
100258
|
+
placedAtMs: null,
|
|
100259
|
+
sentAtMs,
|
|
100260
|
+
replacedOnce: args.replacedOnce
|
|
100261
|
+
};
|
|
100262
|
+
if (!io.persist({
|
|
100263
|
+
...record5,
|
|
100264
|
+
members: [
|
|
100265
|
+
...members,
|
|
100266
|
+
journaled,
|
|
100267
|
+
...observations.slice(args.observationIndex + 1).map((entry) => entry.member)
|
|
100268
|
+
]
|
|
100269
|
+
})) {
|
|
100270
|
+
reports.push({
|
|
100271
|
+
order_id: args.member.orderId == null ? null : String(args.member.orderId),
|
|
100272
|
+
symbol: symbol2,
|
|
100273
|
+
action: actionOf(args.member.kind),
|
|
100274
|
+
status: "failed",
|
|
100275
|
+
execution_metadata: { reason_code: "protective_lifecycle_persistence_failed", trigger_price: args.trigger }
|
|
100276
|
+
});
|
|
100277
|
+
return args.member;
|
|
100278
|
+
}
|
|
100279
|
+
const outcome = await notSentRestores(
|
|
100280
|
+
() => attempt(io, () => io.placePositionOrder({
|
|
100281
|
+
kind: args.member.kind,
|
|
100282
|
+
triggerPrice: Number(args.trigger),
|
|
100283
|
+
clientOrderId
|
|
100284
|
+
})),
|
|
100285
|
+
() => io.persist({
|
|
100286
|
+
...record5,
|
|
100287
|
+
members: [
|
|
100288
|
+
...members,
|
|
100289
|
+
args.member,
|
|
100290
|
+
...observations.slice(args.observationIndex + 1).map((entry) => entry.member)
|
|
100291
|
+
]
|
|
100292
|
+
})
|
|
100293
|
+
);
|
|
100294
|
+
if (!outcome.ok && outcome.error instanceof NativeOrderNotSentError) {
|
|
100295
|
+
io.persist({
|
|
100296
|
+
...record5,
|
|
100297
|
+
members: [
|
|
100298
|
+
...members,
|
|
100299
|
+
args.member,
|
|
100300
|
+
...observations.slice(args.observationIndex + 1).map((entry) => entry.member)
|
|
100301
|
+
]
|
|
100302
|
+
});
|
|
100303
|
+
reports.push({
|
|
100304
|
+
order_id: args.member.orderId == null ? null : String(args.member.orderId),
|
|
100305
|
+
symbol: symbol2,
|
|
100306
|
+
action: actionOf(args.member.kind),
|
|
100307
|
+
status: "failed",
|
|
100308
|
+
execution_metadata: {
|
|
100309
|
+
reason_code: "protective_place_not_sent",
|
|
100310
|
+
trigger_price: args.trigger,
|
|
100311
|
+
error: errorText(outcome.error)
|
|
100312
|
+
}
|
|
100313
|
+
});
|
|
100314
|
+
return args.member;
|
|
100315
|
+
}
|
|
100187
100316
|
const refused = !outcome.ok && outcome.refused;
|
|
100188
100317
|
const placed = {
|
|
100189
100318
|
kind: args.member.kind,
|
|
@@ -100211,7 +100340,7 @@ var init_native_protection_device = __esm({
|
|
|
100211
100340
|
});
|
|
100212
100341
|
return placed;
|
|
100213
100342
|
};
|
|
100214
|
-
for (const { member, row } of observations) {
|
|
100343
|
+
for (const [observationIndex, { member, row }] of observations.entries()) {
|
|
100215
100344
|
if (row) {
|
|
100216
100345
|
const stray = nativeStrayOrderDecision({
|
|
100217
100346
|
placedMs: member.placedAtMs ?? Number.POSITIVE_INFINITY,
|
|
@@ -100263,7 +100392,8 @@ var init_native_protection_device = __esm({
|
|
|
100263
100392
|
trigger: currentTrigger(member) ?? member.trigger,
|
|
100264
100393
|
replacedOnce: member.replacedOnce,
|
|
100265
100394
|
eventMs: Number.NEGATIVE_INFINITY,
|
|
100266
|
-
reasonCode: "protective_order_never_landed_placed"
|
|
100395
|
+
reasonCode: "protective_order_never_landed_placed",
|
|
100396
|
+
observationIndex
|
|
100267
100397
|
});
|
|
100268
100398
|
members.push(placed);
|
|
100269
100399
|
if (!placed.retiredReason) anyResting = true;
|
|
@@ -100331,7 +100461,8 @@ var init_native_protection_device = __esm({
|
|
|
100331
100461
|
trigger,
|
|
100332
100462
|
replacedOnce: true,
|
|
100333
100463
|
eventMs: evidence.statusTimestampMs ?? Number.POSITIVE_INFINITY,
|
|
100334
|
-
reasonCode: "protective_stop_replaced"
|
|
100464
|
+
reasonCode: "protective_stop_replaced",
|
|
100465
|
+
observationIndex
|
|
100335
100466
|
});
|
|
100336
100467
|
members.push(replacement);
|
|
100337
100468
|
if (replacement !== member && !replacement.retiredReason) anyResting = true;
|
|
@@ -100380,7 +100511,7 @@ function copiedTargetNow(reconciliation, recordedTarget, actualPosition) {
|
|
|
100380
100511
|
);
|
|
100381
100512
|
return { copiedNow, targetNow, kept: copiedTargetBesideOwnPosition(targetNow, copiedNow, actualPosition) };
|
|
100382
100513
|
}
|
|
100383
|
-
var clientProtectiveMutationAuthority, executionReadPriority, serverEntryLeverageAlreadyHeld, fetchClientRuntimeOpenOrders, _extractOrderResponseStates, 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, replaceProtectiveLeg, replacementJournalEntryOrderId, buildProtectiveReplacementJournalGroup, isProtectiveReplacementJournalGroup, reserveProtectiveLegReplacement, ensureProtectiveReplacementJournalCompanion, buildVetoedProtectiveReplacementCleanup, assertExactProtectiveReplacementDispatchAuthority, transitionProtectiveReplacementAcknowledgement, transitionTerminalProtectiveReplacement, pendingProtectiveReplacementReport, isConfiguredProtectionRequested, protectiveAction, executedProtectiveReport, isExactClientPositionTpslPair, deviceOwnsClientProtectiveLegKind, isAdoptionNarrowedPositionTpslLeg, hasAmbiguousClientPositionTpslAuthority, protectiveStableShapeMatches, observedProtectiveGroupingMatches, protectiveLiveShapeMatches, protectiveTerminalShapeMatches, cancelClientProtectiveLeg, buildPendingProtectivePlan, persistPendingClientProtectiveGroup, attachmentMemberNeverLanded, storedClientProtectiveCover, attachClientProtectivePlan, resolveJournaledAttachmentContinuity, protectiveMemberRested, ledgerOrderIdsByClientOrderId, journaledAttachmentNeverLanded, recoverJournaledClientProtectiveAttachments, readClientOrderMutation, readPendingEntryMutation, clientOrderNeverLandsAfterMs, requireClientRuntimeConfigSeconds, replacePendingEntryRecovery, recoverPendingClientProtectiveGroups, recoverPendingProtectiveReplacements, liveProtectiveOrderShape, observedStandaloneProtectiveGroup, migrateTrackedTrailingStopsToStandalone, nativeSettingsOf, nativeProtectionIo, nativeStorageReport, readNativeRecord, reconcileNativeProtectionForDecision, reconcileClientProtectiveGroups, cancelAllClientProtectiveGroups, tightenClientTrailingStops, throwIfAborted2, sleep2, isDefinitiveEntryRejection, resolveExchangeSizeDecimals, roundAssetSize, resolvePositionSize, readServerOrderMarkPrice, serverOrderMetadataRetry, resolveCurrentPositionSize, buildPositionSnapshot, signedRemainingExposureAfterConfirmedReduction, runtimeProtectionAuthority, runtimeProtectionOwners, resolveRuntimeProtectionOwner, drainServerProtectionForRuntime, drainServerProtectionIfOwned, verifyNoLiveClientProtectiveTriggers, clientExecutionMutations, CLIENT_EXECUTION_QUEUE_TIMEOUT_MESSAGE, withClientExecutionMutation, withClientProtectivePlanSetMutation, allocateServerExecutionCapacity, withClientProtectiveAdoptionMutation, executeClientRuntimeDecisionLocked, unsentDecisionOrderReport, withCapacityTrim, SERVER_AUDIT_RECORDED_ELSEWHERE, serverExecutionAuditOutcome, decisionLegOf, withExecutionAuditId, executeClientRuntimeDecision, waitForFlipCloseFreshness, maintainClientRuntimeTrailingStops, listPendingClientProtectiveSymbols, listStoredClientProtectiveSymbols, hasUnresolvedClientProtectiveIdentity, resolveClientProtectiveIdentitiesForAdoption, exportClientProtectiveGroupsForAdoption, adoptionGroupKey, applyClientProtectiveAdoptionOutcomes, hasStoredClientProtectiveGroupsForWallet, hasPendingClientProtectiveGroups, recoverManualClientProtectiveGroups, clientRuntimeDecisionSizesOrders, COMMITTED_EXECUTION_REPORTS, COMMITTED_DECISION_ORDER, getCommittedExecutionReports, getCommittedDecisionOrder, withCommittedExecutionReports, executeClientRuntimeDecisionUnlocked, executeClientCopyTradingIntent, _copyCancelOrderId, executeClientCopyTradingOrderAction;
|
|
100514
|
+
var clientProtectiveMutationAuthority, executionReadPriority, serverEntryLeverageAlreadyHeld, fetchClientRuntimeOpenOrders, _extractOrderResponseStates, 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, replaceProtectiveLeg, replacementJournalEntryOrderId, buildProtectiveReplacementJournalGroup, isProtectiveReplacementJournalGroup, reserveProtectiveLegReplacement, ensureProtectiveReplacementJournalCompanion, buildVetoedProtectiveReplacementCleanup, assertExactProtectiveReplacementDispatchAuthority, transitionProtectiveReplacementAcknowledgement, transitionTerminalProtectiveReplacement, pendingProtectiveReplacementReport, isConfiguredProtectionRequested, protectiveAction, executedProtectiveReport, isExactClientPositionTpslPair, deviceOwnsClientProtectiveLegKind, isAdoptionNarrowedPositionTpslLeg, hasAmbiguousClientPositionTpslAuthority, protectiveStableShapeMatches, observedProtectiveGroupingMatches, protectiveLiveShapeMatches, protectiveTerminalShapeMatches, cancelClientProtectiveLeg, buildPendingProtectivePlan, persistPendingClientProtectiveGroup, attachmentMemberNeverLanded, storedClientProtectiveCover, attachClientProtectivePlan, resolveJournaledAttachmentContinuity, protectiveMemberRested, ledgerOrderIdsByClientOrderId, journaledAttachmentNeverLanded, recoverJournaledClientProtectiveAttachments, readClientOrderMutation, readPendingEntryMutation, clientOrderNeverLandsAfterMs, requireClientRuntimeConfigSeconds, replacePendingEntryRecovery, recoverPendingClientProtectiveGroups, recoverPendingProtectiveReplacements, liveProtectiveOrderShape, observedStandaloneProtectiveGroup, migrateTrackedTrailingStopsToStandalone, nativeSettingsOf, nativePassEnded, nativeProtectionIo, nativeStorageReport, readNativeRecord, reconcileNativeProtectionForDecision, reconcileClientProtectiveGroups, cancelAllClientProtectiveGroups, tightenClientTrailingStops, throwIfAborted2, sleep2, isDefinitiveEntryRejection, resolveExchangeSizeDecimals, roundAssetSize, resolvePositionSize, readServerOrderMarkPrice, serverOrderMetadataRetry, resolveCurrentPositionSize, buildPositionSnapshot, signedRemainingExposureAfterConfirmedReduction, runtimeProtectionAuthority, runtimeProtectionListings, runtimeProtectionListing, resolveServerNativeEntry, SERVER_NATIVE_LEGACY_REFUSAL, isServerNativeLegacyRefusal, runtimeProtectionOwners, resolveRuntimeProtectionOwner, drainServerProtectionForRuntime, drainServerProtectionIfOwned, verifyNoLiveClientProtectiveTriggers, clientExecutionMutations, CLIENT_EXECUTION_QUEUE_TIMEOUT_MESSAGE, withClientExecutionMutation, withClientProtectivePlanSetMutation, allocateServerExecutionCapacity, withClientProtectiveAdoptionMutation, executeClientRuntimeDecisionLocked, unsentDecisionOrderReport, withCapacityTrim, SERVER_AUDIT_RECORDED_ELSEWHERE, serverExecutionAuditOutcome, decisionLegOf, withExecutionAuditId, executeClientRuntimeDecision, waitForFlipCloseFreshness, maintainClientRuntimeTrailingStops, listPendingClientProtectiveSymbols, listStoredClientProtectiveSymbols, hasUnresolvedClientProtectiveIdentity, resolveClientProtectiveIdentitiesForAdoption, exportClientProtectiveGroupsForAdoption, adoptionGroupKey, applyClientProtectiveAdoptionOutcomes, hasStoredClientProtectiveGroupsForWallet, hasPendingClientProtectiveGroups, recoverManualClientProtectiveGroups, clientRuntimeDecisionSizesOrders, COMMITTED_EXECUTION_REPORTS, COMMITTED_DECISION_ORDER, getCommittedExecutionReports, getCommittedDecisionOrder, withCommittedExecutionReports, executeClientRuntimeDecisionUnlocked, executeClientCopyTradingIntent, _copyCancelOrderId, executeClientCopyTradingOrderAction;
|
|
100384
100515
|
var init_runtime_execution = __esm({
|
|
100385
100516
|
"lib/runtime/runtime-execution.ts"() {
|
|
100386
100517
|
"use strict";
|
|
@@ -101071,7 +101202,7 @@ var init_runtime_execution = __esm({
|
|
|
101071
101202
|
if (status != null && status !== HTTP_STATUS.UNAUTHORIZED && status !== HTTP_STATUS.FORBIDDEN) return false;
|
|
101072
101203
|
return normalized.includes("runtime lease required") || normalized.includes("invalid or expired runtime lease") || normalized.includes("runtime lease no longer resolves to an active profile") || normalized.includes("runtime lease does not match the requested runtime session");
|
|
101073
101204
|
};
|
|
101074
|
-
hasClientRuntimeProtectionState = (profileId, symbol2) => readClientProtectiveGroups(String(profileId).trim(), symbol2).length > 0 || hasClientProtectiveGroupReadFailure(String(profileId).trim(), symbol2);
|
|
101205
|
+
hasClientRuntimeProtectionState = (profileId, symbol2) => readClientProtectiveGroups(String(profileId).trim(), symbol2).length > 0 || hasClientProtectiveGroupReadFailure(String(profileId).trim(), symbol2) || readNativeRecord(String(profileId).trim(), symbol2).kind !== "none";
|
|
101075
101206
|
clearClientRuntimeVetoedProtectiveIntent = (input) => {
|
|
101076
101207
|
const profileId = String(input.profileId).trim();
|
|
101077
101208
|
const symbol2 = String(input.symbol).trim();
|
|
@@ -103954,6 +104085,7 @@ var init_runtime_execution = __esm({
|
|
|
103954
104085
|
takeProfitPct: toPositiveNumber(context.takeProfitPct),
|
|
103955
104086
|
takeProfitUsdc: toPositiveNumber(context.takeProfitUsdc)
|
|
103956
104087
|
});
|
|
104088
|
+
nativePassEnded = (request, error48) => Boolean(request.signal?.aborted) || isClientRuntimeWindowHandoffBeforePlanDispatch(error48 instanceof NativeOrderNotSentError ? error48.cause : error48);
|
|
103957
104089
|
nativeProtectionIo = (request, isLong) => {
|
|
103958
104090
|
const symbol2 = request.executionContext.symbol;
|
|
103959
104091
|
const walletAddress = String(request.executionContext.walletAddress || "").trim();
|
|
@@ -103972,6 +104104,12 @@ var init_runtime_execution = __esm({
|
|
|
103972
104104
|
if (!mutationId) throw new Error("Native protective order id is malformed.");
|
|
103973
104105
|
return mutationId;
|
|
103974
104106
|
};
|
|
104107
|
+
const fenced = (call) => withDispatchBoundary(
|
|
104108
|
+
(onDispatched) => call(() => {
|
|
104109
|
+
request.onExchangeOrderDispatched?.("protection");
|
|
104110
|
+
onDispatched();
|
|
104111
|
+
})
|
|
104112
|
+
);
|
|
103975
104113
|
return {
|
|
103976
104114
|
readPosition: async () => {
|
|
103977
104115
|
const snapshot = await fetchBrowserPositionSnapshot(
|
|
@@ -103991,7 +104129,7 @@ var init_runtime_execution = __esm({
|
|
|
103991
104129
|
signal: request.signal,
|
|
103992
104130
|
orderId
|
|
103993
104131
|
}),
|
|
103994
|
-
placePositionOrder: ({ kind, triggerPrice, clientOrderId }) =>
|
|
104132
|
+
placePositionOrder: ({ kind, triggerPrice, clientOrderId }) => fenced((onExchangeOrderDispatched) => executeClientOrderBatch({
|
|
103995
104133
|
...common,
|
|
103996
104134
|
onExchangeOrderDispatched,
|
|
103997
104135
|
mutationId: mutationOf(clientOrderId),
|
|
@@ -104010,7 +104148,7 @@ var init_runtime_execution = __esm({
|
|
|
104010
104148
|
clientOrderId
|
|
104011
104149
|
}]
|
|
104012
104150
|
})),
|
|
104013
|
-
modifyPositionOrder: ({ orderId, kind, triggerPrice, clientOrderId }) =>
|
|
104151
|
+
modifyPositionOrder: ({ orderId, kind, triggerPrice, clientOrderId }) => fenced((onExchangeOrderDispatched) => executeClientModifyOrder({
|
|
104014
104152
|
...common,
|
|
104015
104153
|
onExchangeOrderDispatched,
|
|
104016
104154
|
mutationId: mutationOf(clientOrderId),
|
|
@@ -104026,7 +104164,7 @@ var init_runtime_execution = __esm({
|
|
|
104026
104164
|
triggerIsMarket: true,
|
|
104027
104165
|
positionOrder: true
|
|
104028
104166
|
})),
|
|
104029
|
-
cancelOrder: (orderId) =>
|
|
104167
|
+
cancelOrder: (orderId) => fenced((onExchangeOrderDispatched) => executeClientCancelOrder({
|
|
104030
104168
|
...common,
|
|
104031
104169
|
onExchangeOrderDispatched,
|
|
104032
104170
|
publicRequestPriority: "trading_reduce",
|
|
@@ -104036,7 +104174,8 @@ var init_runtime_execution = __esm({
|
|
|
104036
104174
|
neverLandsAfterMs: (sentAtMs) => clientOrderNeverLandsAfterMs(request.config, { kind: "absent", ageStartMs: sentAtMs }),
|
|
104037
104175
|
newMutationId: () => createRuntimeId().toLowerCase(),
|
|
104038
104176
|
nowMs: () => Date.now(),
|
|
104039
|
-
persist: (record5) => writeNativeProtectionRecord(String(request.profileId).trim(), symbol2, record5)
|
|
104177
|
+
persist: (record5) => writeNativeProtectionRecord(String(request.profileId).trim(), symbol2, record5),
|
|
104178
|
+
endsPass: (error48) => nativePassEnded(request, error48)
|
|
104040
104179
|
};
|
|
104041
104180
|
};
|
|
104042
104181
|
nativeStorageReport = (symbol2, reasonCode) => ({
|
|
@@ -104091,7 +104230,9 @@ var init_runtime_execution = __esm({
|
|
|
104091
104230
|
}
|
|
104092
104231
|
return reports;
|
|
104093
104232
|
} catch (error48) {
|
|
104094
|
-
if (request
|
|
104233
|
+
if (nativePassEnded(request, error48)) {
|
|
104234
|
+
throw error48 instanceof NativeOrderNotSentError ? error48.cause : error48;
|
|
104235
|
+
}
|
|
104095
104236
|
return [{
|
|
104096
104237
|
...nativeStorageReport(symbol2, "protective_open_orders_unresolved"),
|
|
104097
104238
|
execution_metadata: {
|
|
@@ -105855,10 +105996,9 @@ var init_runtime_execution = __esm({
|
|
|
105855
105996
|
runtimeDeviceId: request.runtimeDeviceId,
|
|
105856
105997
|
schedulerInstanceId: request.schedulerInstanceId
|
|
105857
105998
|
});
|
|
105858
|
-
|
|
105859
|
-
|
|
105860
|
-
|
|
105861
|
-
const cached2 = runtimeProtectionOwners.get(request);
|
|
105999
|
+
runtimeProtectionListings = /* @__PURE__ */ new WeakMap();
|
|
106000
|
+
runtimeProtectionListing = (request) => {
|
|
106001
|
+
const cached2 = runtimeProtectionListings.get(request);
|
|
105862
106002
|
if (cached2) return cached2;
|
|
105863
106003
|
const authority = runtimeProtectionAuthority(request);
|
|
105864
106004
|
const pending3 = listClientProtectiveActions(
|
|
@@ -105867,7 +106007,49 @@ var init_runtime_execution = __esm({
|
|
|
105867
106007
|
authority.runtimeLeaseToken,
|
|
105868
106008
|
authority.runtimeDeviceId,
|
|
105869
106009
|
authority.schedulerInstanceId
|
|
105870
|
-
)
|
|
106010
|
+
);
|
|
106011
|
+
runtimeProtectionListings.set(request, pending3);
|
|
106012
|
+
return pending3;
|
|
106013
|
+
};
|
|
106014
|
+
resolveServerNativeEntry = async (input) => {
|
|
106015
|
+
let state2;
|
|
106016
|
+
try {
|
|
106017
|
+
state2 = readServerNativeProtectionState(await runtimeProtectionListing(input.request));
|
|
106018
|
+
} catch {
|
|
106019
|
+
return null;
|
|
106020
|
+
}
|
|
106021
|
+
if (state2 == null || !state2.enabled) return null;
|
|
106022
|
+
const settings = nativeSettingsOf(input.request.executionContext);
|
|
106023
|
+
if (settings.stopLoss?.trailing) return null;
|
|
106024
|
+
const symbol2 = normalizeHyperliquidMarketSymbol(input.request.executionContext.symbol);
|
|
106025
|
+
const request = nativeEntryRequest({
|
|
106026
|
+
settings,
|
|
106027
|
+
isLong: input.isLong,
|
|
106028
|
+
sizeDecimals: input.request.executionContext.sizeDecimals,
|
|
106029
|
+
referencePrice: input.referencePrice,
|
|
106030
|
+
entrySize: input.entrySize,
|
|
106031
|
+
positionBefore: input.positionBefore,
|
|
106032
|
+
positionHasLegacyLegs: state2.legacySymbols.has(symbol2)
|
|
106033
|
+
});
|
|
106034
|
+
if (request.shape === "legacy_per_entry") return null;
|
|
106035
|
+
return {
|
|
106036
|
+
native: { position_before: String(input.positionBefore) },
|
|
106037
|
+
children: request.shape === "entry_with_position_children" ? request.children.map((child) => ({
|
|
106038
|
+
kind: child.kind,
|
|
106039
|
+
triggerPrice: Number(child.trigger),
|
|
106040
|
+
clientOrderId: clientOrderIdForMutation(createRuntimeId().toLowerCase())
|
|
106041
|
+
})) : []
|
|
106042
|
+
};
|
|
106043
|
+
};
|
|
106044
|
+
SERVER_NATIVE_LEGACY_REFUSAL = "native_protection_legacy_position";
|
|
106045
|
+
isServerNativeLegacyRefusal = (error48) => Boolean(error48 && typeof error48 === "object") && error48.code === SERVER_NATIVE_LEGACY_REFUSAL;
|
|
106046
|
+
runtimeProtectionOwners = /* @__PURE__ */ new WeakMap();
|
|
106047
|
+
resolveRuntimeProtectionOwner = (request) => {
|
|
106048
|
+
if (request.executionMode === "server") return Promise.resolve("server");
|
|
106049
|
+
const cached2 = runtimeProtectionOwners.get(request);
|
|
106050
|
+
if (cached2) return cached2;
|
|
106051
|
+
const authority = runtimeProtectionAuthority(request);
|
|
106052
|
+
const pending3 = runtimeProtectionListing(request).then((listed) => listed.client_protection_owner);
|
|
105871
106053
|
runtimeProtectionOwners.set(request, pending3);
|
|
105872
106054
|
return pending3;
|
|
105873
106055
|
};
|
|
@@ -106595,7 +106777,7 @@ var init_runtime_execution = __esm({
|
|
|
106595
106777
|
const context = input.executionContext;
|
|
106596
106778
|
const profileId = String(input.profileId).trim();
|
|
106597
106779
|
if (input.decision !== "HOLD" && Math.max(0, Math.trunc(input.units)) > 0) return true;
|
|
106598
|
-
if (readClientProtectiveGroups(profileId, context.symbol).some((group) => group.legs.length > 0 || group.attachmentJournal != null) || hasClientProtectiveGroupReadFailure(profileId, context.symbol)) {
|
|
106780
|
+
if (readClientProtectiveGroups(profileId, context.symbol).some((group) => group.legs.length > 0 || group.attachmentJournal != null) || hasClientProtectiveGroupReadFailure(profileId, context.symbol) || readNativeRecord(profileId, context.symbol).kind !== "none") {
|
|
106599
106781
|
return true;
|
|
106600
106782
|
}
|
|
106601
106783
|
const positionSize = Number.isFinite(context.currentPositionSize) ? Number(context.currentPositionSize) : 0;
|
|
@@ -107441,6 +107623,13 @@ var init_runtime_execution = __esm({
|
|
|
107441
107623
|
}
|
|
107442
107624
|
}
|
|
107443
107625
|
const nativeProtection = nativeOpen != null || nativeAddRecord != null;
|
|
107626
|
+
let serverNative = serverOwnedProtection ? await resolveServerNativeEntry({
|
|
107627
|
+
request: input,
|
|
107628
|
+
isLong: classified.side === "buy",
|
|
107629
|
+
referencePrice: executionPrice,
|
|
107630
|
+
entrySize: sizeAsset,
|
|
107631
|
+
positionBefore: targetResolution.closeOpposingPosition ? 0 : currentPositionSize
|
|
107632
|
+
}) : null;
|
|
107444
107633
|
if (localProtection && !nativeProtection) {
|
|
107445
107634
|
entryMutationId ??= createRuntimeId().toLowerCase();
|
|
107446
107635
|
entryClientOrderId = clientOrderIdForMutation(entryMutationId);
|
|
@@ -107535,8 +107724,10 @@ var init_runtime_execution = __esm({
|
|
|
107535
107724
|
protection: {
|
|
107536
107725
|
source: "runtime_config",
|
|
107537
107726
|
requested_entry_size: sizeAsset,
|
|
107538
|
-
is_long: entrySide === "buy"
|
|
107727
|
+
is_long: entrySide === "buy",
|
|
107728
|
+
...serverNative ? { native: serverNative.native } : {}
|
|
107539
107729
|
},
|
|
107730
|
+
...serverNative && serverNative.children.length > 0 ? { positionChildren: serverNative.children } : {},
|
|
107540
107731
|
onSettled: (mutation) => {
|
|
107541
107732
|
settledServerProtectedEntry = mutation;
|
|
107542
107733
|
}
|
|
@@ -107544,7 +107735,15 @@ var init_runtime_execution = __esm({
|
|
|
107544
107735
|
});
|
|
107545
107736
|
try {
|
|
107546
107737
|
try {
|
|
107547
|
-
|
|
107738
|
+
try {
|
|
107739
|
+
marketOrderResponse = await sendEntry();
|
|
107740
|
+
} catch (nativeRefusal) {
|
|
107741
|
+
if (serverNative == null || !isServerNativeLegacyRefusal(nativeRefusal) || entryDispatchBoundaryPassed) {
|
|
107742
|
+
throw nativeRefusal;
|
|
107743
|
+
}
|
|
107744
|
+
serverNative = null;
|
|
107745
|
+
marketOrderResponse = await sendEntry();
|
|
107746
|
+
}
|
|
107548
107747
|
} catch (rejection) {
|
|
107549
107748
|
const retry = await serverOrderMetadataRetry(input, rejection, "entry", entryMutationId);
|
|
107550
107749
|
const retrySize = retry === null ? 0 : quantizeHyperliquidOrderSizeValue(intendedSizeAsset, retry.sizeDecimals, "nearest");
|
|
@@ -107609,7 +107808,7 @@ var init_runtime_execution = __esm({
|
|
|
107609
107808
|
}
|
|
107610
107809
|
const confirmedMarketFill = extractCanonicalHyperliquidFilledOrderAcknowledgement(
|
|
107611
107810
|
// An entry carrying position children is member 0 of its action.
|
|
107612
|
-
nativeOpen != null ? firstMemberAcknowledgement(marketOrderResponse) : marketOrderResponse
|
|
107811
|
+
nativeOpen != null || (serverNative?.children.length ?? 0) > 0 ? firstMemberAcknowledgement(marketOrderResponse) : marketOrderResponse
|
|
107613
107812
|
);
|
|
107614
107813
|
executionReports.push({
|
|
107615
107814
|
order_id: _extractOrderId(marketOrderResponse),
|
|
@@ -107682,6 +107881,10 @@ var init_runtime_execution = __esm({
|
|
|
107682
107881
|
if (nativeProtection) {
|
|
107683
107882
|
const symbol2 = input.executionContext.symbol;
|
|
107684
107883
|
let record5 = nativeOpen != null ? recordEntryChildren(nativeOpen.record, marketOrderResponse) : nativeAddRecord;
|
|
107884
|
+
let keepNativeJournal = false;
|
|
107885
|
+
if (nativeOpen != null && !writeNativeProtectionRecord(nativeProfileId, symbol2, record5)) {
|
|
107886
|
+
executionReports.push(nativeStorageReport(symbol2, "protective_lifecycle_persistence_failed"));
|
|
107887
|
+
}
|
|
107685
107888
|
if (confirmedMarketFill == null) {
|
|
107686
107889
|
executionReports.push({
|
|
107687
107890
|
order_id: _extractOrderId(marketOrderResponse),
|
|
@@ -107704,10 +107907,17 @@ var init_runtime_execution = __esm({
|
|
|
107704
107907
|
if (settled.record != null) record5 = settled.record;
|
|
107705
107908
|
} catch (postEntryProtectionError) {
|
|
107706
107909
|
if (isClientRuntimeLeaseOwnershipError(postEntryProtectionError)) throw postEntryProtectionError;
|
|
107707
|
-
|
|
107910
|
+
if (nativePassEnded(input, postEntryProtectionError)) {
|
|
107911
|
+
keepNativeJournal = true;
|
|
107912
|
+
const cause = postEntryProtectionError instanceof NativeOrderNotSentError ? postEntryProtectionError.cause : postEntryProtectionError;
|
|
107913
|
+
if (isClientRuntimeWindowHandoffBeforePlanDispatch(cause)) throw cause;
|
|
107914
|
+
appendPostEntryProtectionFailure(cause);
|
|
107915
|
+
} else {
|
|
107916
|
+
appendPostEntryProtectionFailure(postEntryProtectionError);
|
|
107917
|
+
}
|
|
107708
107918
|
}
|
|
107709
107919
|
}
|
|
107710
|
-
if (!writeNativeProtectionRecord(nativeProfileId, symbol2, record5)) {
|
|
107920
|
+
if (!keepNativeJournal && !writeNativeProtectionRecord(nativeProfileId, symbol2, record5)) {
|
|
107711
107921
|
executionReports.push(nativeStorageReport(symbol2, "protective_lifecycle_persistence_failed"));
|
|
107712
107922
|
}
|
|
107713
107923
|
}
|