@vtxmacro/cli 2026.10.61 → 2026.10.62
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 +2 -1
- package/bin/vtx-mcp.js +3 -2
- package/bin/vtx-service-bootstrap.js +3 -2
- package/bin/vtx-service-launcher.js +2 -1
- package/bin/vtx.js +419 -260
- package/package.json +1 -1
package/bin/exo-harness.ts
CHANGED
|
@@ -933,7 +933,8 @@ var runtime_policy_generated_default = {
|
|
|
933
933
|
request_bounds: {
|
|
934
934
|
min_agent_instruction_retry_after_ms: 25,
|
|
935
935
|
max_fallback_error_length: 500,
|
|
936
|
-
max_trade_sync_executions: 64
|
|
936
|
+
max_trade_sync_executions: 64,
|
|
937
|
+
max_user_cancel_order_ids: 64
|
|
937
938
|
},
|
|
938
939
|
pending_protection_recovery: {
|
|
939
940
|
retry_exponent_max: 30
|
package/bin/vtx-mcp.js
CHANGED
|
@@ -43,7 +43,7 @@ var init_define_VTX_PI_MODEL_POLICY = __esm({
|
|
|
43
43
|
var agent_cli_release_default;
|
|
44
44
|
var init_agent_cli_release = __esm({
|
|
45
45
|
"agent-cli-release.json"() {
|
|
46
|
-
agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.
|
|
46
|
+
agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.62", codex_package_name: "@openai/codex", codex_version: "0.155.0", copilot_sdk_package_name: "@github/copilot-sdk", copilot_sdk_version: "1.0.0-beta.8", copilot_cli_package_name: "@github/copilot", copilot_cli_version: "1.0.80", deepseek_harness_version: "0.1.1-rc.2", deepseek_harness_packages: ["@deepseek-ai/dsh-agent", "@deepseek-ai/dsh-agent-instructions", "@deepseek-ai/dsh-agent-loop", "@deepseek-ai/dsh-agent-spine-demo", "@deepseek-ai/dsh-anonymous-user-id", "@deepseek-ai/dsh-atomic-write", "@deepseek-ai/dsh-attachment", "@deepseek-ai/dsh-brand", "@deepseek-ai/dsh-code-runtime", "@deepseek-ai/dsh-credentials", "@deepseek-ai/dsh-fs", "@deepseek-ai/dsh-goal", "@deepseek-ai/dsh-goal-round-driver", "@deepseek-ai/dsh-home-paths", "@deepseek-ai/dsh-invariants", "@deepseek-ai/dsh-jobs", "@deepseek-ai/dsh-jobs-local", "@deepseek-ai/dsh-launch-environment", "@deepseek-ai/dsh-llm", "@deepseek-ai/dsh-llm-deepseek", "@deepseek-ai/dsh-llm-retry", "@deepseek-ai/dsh-output-retention", "@deepseek-ai/dsh-sandbox", "@deepseek-ai/dsh-sandbox-policy", "@deepseek-ai/dsh-scope", "@deepseek-ai/dsh-session", "@deepseek-ai/dsh-session-checkpoint-policy", "@deepseek-ai/dsh-session-persistence", "@deepseek-ai/dsh-session-persistence-jsonl", "@deepseek-ai/dsh-session-projection", "@deepseek-ai/dsh-session-title", "@deepseek-ai/dsh-settings", "@deepseek-ai/dsh-shell", "@deepseek-ai/dsh-shell-env", "@deepseek-ai/dsh-skill", "@deepseek-ai/dsh-skill-filesystem", "@deepseek-ai/dsh-subprocess", "@deepseek-ai/dsh-system-prompt", "@deepseek-ai/dsh-timeout", "@deepseek-ai/dsh-tool-bash", "@deepseek-ai/dsh-tool-goal", "@deepseek-ai/dsh-tool-jobs", "@deepseek-ai/dsh-tool-skill", "@deepseek-ai/dsh-tools", "@deepseek-ai/dsh-typert-protocol", "@deepseek-ai/dsh-user-approval"], deepseek_cordis_package_name: "@deepseek-ai/cordis", deepseek_cordis_version: "4.0.1", deepseek_support_packages: { "@deepseek-ai/cordis-plugin-timer": "1.1.3" }, platforms: { "linux-x64": { package_name: "@openai/codex-linux-x64", target: "x86_64-unknown-linux-musl", binary_name: "codex", sha256: "660e159a49e823ac8e5986cb238f73158ce4b957d40d9292f8de90862644b501" }, "win32-x64": { package_name: "@openai/codex-win32-x64", target: "x86_64-pc-windows-msvc", binary_name: "codex.exe", sha256: "e4c11374bd9de8ad5c3b7617fd4654bb7839901edb0863f9930666863c7a021b" } }, pi_coding_agent_package_name: "@earendil-works/pi-coding-agent", pi_ai_package_name: "@earendil-works/pi-ai", pi_version: "0.85.1", pi_support_packages: ["@earendil-works/pi-agent-core", "@earendil-works/pi-telemetry", "@earendil-works/pi-tui", "@earendil-works/chord"], grok_version: "1.0.30", grok_platforms: { "linux-x64": { package_name: "@xai-official/grok-linux-x64", binary_name: "grok", sha256: "504dd6546ab991b75d36698242875ce461489cd1f8cd84285873cb55bd5c7d54" }, "win32-x64": { package_name: "@xai-official/grok-win32-x64", binary_name: "grok.exe", sha256: "48736d1a4342a801ea26d0ecde4c516b653f791399065adaa55973f83abd8867" } } };
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
|
|
@@ -2533,7 +2533,8 @@ var runtime_policy_generated_default = {
|
|
|
2533
2533
|
request_bounds: {
|
|
2534
2534
|
min_agent_instruction_retry_after_ms: 25,
|
|
2535
2535
|
max_fallback_error_length: 500,
|
|
2536
|
-
max_trade_sync_executions: 64
|
|
2536
|
+
max_trade_sync_executions: 64,
|
|
2537
|
+
max_user_cancel_order_ids: 64
|
|
2537
2538
|
},
|
|
2538
2539
|
pending_protection_recovery: {
|
|
2539
2540
|
retry_exponent_max: 30
|
|
@@ -14,7 +14,7 @@ import { dirname as dirname4, relative as relative4, resolve as resolve4 } from
|
|
|
14
14
|
import { fileURLToPath } from "node:url";
|
|
15
15
|
|
|
16
16
|
// agent-cli-release.json
|
|
17
|
-
var agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.
|
|
17
|
+
var agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.62", 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 = {
|
|
@@ -804,7 +804,8 @@ var runtime_policy_generated_default = {
|
|
|
804
804
|
request_bounds: {
|
|
805
805
|
min_agent_instruction_retry_after_ms: 25,
|
|
806
806
|
max_fallback_error_length: 500,
|
|
807
|
-
max_trade_sync_executions: 64
|
|
807
|
+
max_trade_sync_executions: 64,
|
|
808
|
+
max_user_cancel_order_ids: 64
|
|
808
809
|
},
|
|
809
810
|
pending_protection_recovery: {
|
|
810
811
|
retry_exponent_max: 30
|
|
@@ -788,7 +788,8 @@ var runtime_policy_generated_default = {
|
|
|
788
788
|
request_bounds: {
|
|
789
789
|
min_agent_instruction_retry_after_ms: 25,
|
|
790
790
|
max_fallback_error_length: 500,
|
|
791
|
-
max_trade_sync_executions: 64
|
|
791
|
+
max_trade_sync_executions: 64,
|
|
792
|
+
max_user_cancel_order_ids: 64
|
|
792
793
|
},
|
|
793
794
|
pending_protection_recovery: {
|
|
794
795
|
retry_exponent_max: 30
|
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.62", 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
|
|
|
@@ -917,7 +917,8 @@ var init_runtime_policy_generated = __esm({
|
|
|
917
917
|
request_bounds: {
|
|
918
918
|
min_agent_instruction_retry_after_ms: 25,
|
|
919
919
|
max_fallback_error_length: 500,
|
|
920
|
-
max_trade_sync_executions: 64
|
|
920
|
+
max_trade_sync_executions: 64,
|
|
921
|
+
max_user_cancel_order_ids: 64
|
|
921
922
|
},
|
|
922
923
|
pending_protection_recovery: {
|
|
923
924
|
retry_exponent_max: 30
|
|
@@ -22631,7 +22632,8 @@ var init_runtime_policy_generated2 = __esm({
|
|
|
22631
22632
|
request_bounds: {
|
|
22632
22633
|
min_agent_instruction_retry_after_ms: 25,
|
|
22633
22634
|
max_fallback_error_length: 500,
|
|
22634
|
-
max_trade_sync_executions: 64
|
|
22635
|
+
max_trade_sync_executions: 64,
|
|
22636
|
+
max_user_cancel_order_ids: 64
|
|
22635
22637
|
},
|
|
22636
22638
|
pending_protection_recovery: {
|
|
22637
22639
|
retry_exponent_max: 30
|
|
@@ -59986,6 +59988,7 @@ var init_client_exchange_mutation_begin = __esm({
|
|
|
59986
59988
|
...payload.protectiveActionId ? { protective_action_id: payload.protectiveActionId } : {},
|
|
59987
59989
|
...payload.signedPayload ? { signed_payload: payload.signedPayload } : {},
|
|
59988
59990
|
...payload.safetyClose ? { safety_close: payload.safetyClose } : {},
|
|
59991
|
+
...payload.userCancel != null ? { user_cancel: payload.userCancel } : {},
|
|
59989
59992
|
attempt_evidence: payload.attemptEvidence ? {
|
|
59990
59993
|
requested_exchange_size: payload.attemptEvidence.requestedExchangeSize ?? null,
|
|
59991
59994
|
submitted_limit_price: payload.attemptEvidence.submittedLimitPrice ?? null,
|
|
@@ -61190,187 +61193,6 @@ var init_billing = __esm({
|
|
|
61190
61193
|
}
|
|
61191
61194
|
});
|
|
61192
61195
|
|
|
61193
|
-
// lib/api/market-data.ts
|
|
61194
|
-
async function getRecentCandles(limit, exchange = "kraken", symbol2 = "PI_XBTUSD", timeframe = "1m", signal) {
|
|
61195
|
-
return (await readRecentCandles(limit, exchange, symbol2, timeframe, signal, null)).candles;
|
|
61196
|
-
}
|
|
61197
|
-
async function getRecentCandlesForProfile(profileId, limit, exchange, symbol2, timeframe, signal) {
|
|
61198
|
-
return readRecentCandles(limit, exchange, symbol2, timeframe, signal, profileId);
|
|
61199
|
-
}
|
|
61200
|
-
async function getLiveTicker(symbol2 = "PI_XBTUSD", exchange = "kraken", signal) {
|
|
61201
|
-
const requestKey = `live-ticker:${symbol2}:${exchange}`;
|
|
61202
|
-
return shareClientGetRequest(requestKey, async (requestSignal) => {
|
|
61203
|
-
const requestUrl2 = `${getApiUrl()}/ticker/live?symbol=${encodeURIComponent(symbol2)}&exchange=${encodeURIComponent(exchange)}`;
|
|
61204
|
-
const trace = startRuntimeNetworkDebugTrace({
|
|
61205
|
-
kind: "runtime",
|
|
61206
|
-
label: "market_data_api:ticker_live",
|
|
61207
|
-
method: "GET",
|
|
61208
|
-
url: requestUrl2,
|
|
61209
|
-
note: `symbol=${symbol2} exchange=${exchange}`
|
|
61210
|
-
});
|
|
61211
|
-
let response = null;
|
|
61212
|
-
try {
|
|
61213
|
-
response = await apiFetch(requestUrl2, { cache: "no-store", signal: requestSignal });
|
|
61214
|
-
if (!response.ok) {
|
|
61215
|
-
const error48 = await buildMarketDataFetchError(response, "live ticker", "/ticker/live");
|
|
61216
|
-
trace.attachResponse({ status: response.status, statusText: response.statusText, url: response.url });
|
|
61217
|
-
trace.completeError(error48, response.status);
|
|
61218
|
-
throw error48;
|
|
61219
|
-
}
|
|
61220
|
-
trace.attachResponse({ status: response.status, statusText: response.statusText, url: response.url });
|
|
61221
|
-
const payload = await response.json();
|
|
61222
|
-
trace.completeSuccess(response.status);
|
|
61223
|
-
return payload;
|
|
61224
|
-
} catch (error48) {
|
|
61225
|
-
if (response && !response.ok) throw error48;
|
|
61226
|
-
if (response && !isAbortLikeError(error48)) {
|
|
61227
|
-
const failure2 = buildMarketDataResponseBodyError(error48, "live ticker", response, "/ticker/live");
|
|
61228
|
-
trace.completeError(failure2, response.status);
|
|
61229
|
-
throw failure2;
|
|
61230
|
-
}
|
|
61231
|
-
trace.completeError(error48, response?.status ?? null);
|
|
61232
|
-
if (isAbortLikeError(error48)) throw error48;
|
|
61233
|
-
throw buildMarketDataNetworkError(error48, "live ticker", "/ticker/live");
|
|
61234
|
-
}
|
|
61235
|
-
}, { signal });
|
|
61236
|
-
}
|
|
61237
|
-
async function getExecutionAssetMetadata(exchange, symbol2, options) {
|
|
61238
|
-
const params = new URLSearchParams();
|
|
61239
|
-
if (options?.forceCatalogRefresh) params.set("force_catalog_refresh", "true");
|
|
61240
|
-
if (options?.publicRequestPriority) params.set("public_request_priority", options.publicRequestPriority);
|
|
61241
|
-
const query = params.size > 0 ? `?${params.toString()}` : "";
|
|
61242
|
-
const url2 = `${getApiUrl()}/trading/execution-metadata/${encodeURIComponent(exchange)}/${encodeURIComponent(symbol2)}${query}`;
|
|
61243
|
-
const response = await apiFetch(url2, {
|
|
61244
|
-
headers: getProfileHeaders({}, options?.profileId),
|
|
61245
|
-
credentials: "include",
|
|
61246
|
-
cache: "no-store",
|
|
61247
|
-
signal: options?.signal
|
|
61248
|
-
});
|
|
61249
|
-
if (!response.ok) {
|
|
61250
|
-
const summary = `Failed to fetch execution asset metadata: ${response.status} ${response.statusText}`;
|
|
61251
|
-
const code = await response.clone().json().then((body) => typeof body?.detail?.code === "string" ? body.detail.code : null).catch(() => null);
|
|
61252
|
-
const detail = await getErrorMessageFromResponse(response, summary);
|
|
61253
|
-
throw new ExecutionAssetMetadataRequestError(
|
|
61254
|
-
detail === summary ? summary : `${summary}: ${detail}`,
|
|
61255
|
-
response.status,
|
|
61256
|
-
parseRetryAfterMs2(response.headers.get("Retry-After")),
|
|
61257
|
-
code
|
|
61258
|
-
);
|
|
61259
|
-
}
|
|
61260
|
-
return response.json();
|
|
61261
|
-
}
|
|
61262
|
-
var CANDLES_MISSING_HEADER, CandlesMissingRangeError, parseCandlesMissing, readRecentCandles, ExecutionAssetMetadataRequestError, CLIENT_EXECUTION_METADATA_DEVICE_READ, executionMetadataNeedsDeviceRead;
|
|
61263
|
-
var init_market_data = __esm({
|
|
61264
|
-
"lib/api/market-data.ts"() {
|
|
61265
|
-
"use strict";
|
|
61266
|
-
init_define_VTX_CLAUDE_CODE_POLICY();
|
|
61267
|
-
init_define_VTX_EXO_POLICY();
|
|
61268
|
-
init_define_VTX_GROK_POLICY();
|
|
61269
|
-
init_define_VTX_PI_MODEL_POLICY();
|
|
61270
|
-
init_abort();
|
|
61271
|
-
init_runtime_redaction();
|
|
61272
|
-
init_network_debug();
|
|
61273
|
-
init_shared();
|
|
61274
|
-
init_constants();
|
|
61275
|
-
CANDLES_MISSING_HEADER = "X-VTX-Candles-Missing";
|
|
61276
|
-
CandlesMissingRangeError = class extends Error {
|
|
61277
|
-
};
|
|
61278
|
-
parseCandlesMissing = (value) => {
|
|
61279
|
-
if (value === null || value.trim() === "") return null;
|
|
61280
|
-
const [startText, endText, ...extra] = value.split(",");
|
|
61281
|
-
const startMs = Number(startText?.trim());
|
|
61282
|
-
const endMs = Number(endText?.trim());
|
|
61283
|
-
if (extra.length > 0 || !Number.isSafeInteger(startMs) || !Number.isSafeInteger(endMs) || startMs > endMs) {
|
|
61284
|
-
throw new CandlesMissingRangeError(`The candle answer named an unreadable missing range: ${sanitizeRuntimeDiagnosticValue(value)}`);
|
|
61285
|
-
}
|
|
61286
|
-
return { startMs, endMs };
|
|
61287
|
-
};
|
|
61288
|
-
readRecentCandles = async (limit, exchange, symbol2, timeframe, signal, profileId) => {
|
|
61289
|
-
const params = new URLSearchParams({ limit: limit.toString(), exchange, symbol: symbol2, timeframe });
|
|
61290
|
-
const requestUrl2 = `${getApiUrl()}/candles/recent?${params.toString()}`;
|
|
61291
|
-
const forProfile = profileId === null ? {} : { credentials: "include", headers: getProfileHeaders({}, profileId) };
|
|
61292
|
-
return shareClientGetRequest(`recent-candles:${profileId ?? "none"}:${params.toString()}`, async (requestSignal) => {
|
|
61293
|
-
const trace = startRuntimeNetworkDebugTrace({
|
|
61294
|
-
kind: "runtime",
|
|
61295
|
-
label: "market_data_api:candles_recent",
|
|
61296
|
-
method: "GET",
|
|
61297
|
-
url: requestUrl2,
|
|
61298
|
-
note: `symbol=${symbol2} exchange=${exchange} timeframe=${timeframe} limit=${limit}`
|
|
61299
|
-
});
|
|
61300
|
-
let response = null;
|
|
61301
|
-
try {
|
|
61302
|
-
response = await apiFetch(requestUrl2, {
|
|
61303
|
-
...forProfile,
|
|
61304
|
-
cache: "no-store",
|
|
61305
|
-
signal: requestSignal
|
|
61306
|
-
});
|
|
61307
|
-
if (!response.ok) {
|
|
61308
|
-
const error48 = await buildMarketDataFetchError(response, "recent candles", "/candles/recent");
|
|
61309
|
-
trace.attachResponse({ status: response.status, statusText: response.statusText, url: response.url });
|
|
61310
|
-
trace.completeError(error48, response.status);
|
|
61311
|
-
console.error(`[API] ${error48.message} URL: ${response.url}`);
|
|
61312
|
-
throw error48;
|
|
61313
|
-
}
|
|
61314
|
-
trace.attachResponse({ status: response.status, statusText: response.statusText, url: response.url });
|
|
61315
|
-
const missing2 = parseCandlesMissing(response.headers.get(CANDLES_MISSING_HEADER));
|
|
61316
|
-
const payload = await response.json();
|
|
61317
|
-
trace.completeSuccess(response.status);
|
|
61318
|
-
return { candles: payload, missing: missing2 };
|
|
61319
|
-
} catch (error48) {
|
|
61320
|
-
if (response && !response.ok) throw error48;
|
|
61321
|
-
if (response && error48 instanceof CandlesMissingRangeError) {
|
|
61322
|
-
trace.completeError(error48, response.status);
|
|
61323
|
-
throw error48;
|
|
61324
|
-
}
|
|
61325
|
-
if (response && !isAbortLikeError(error48)) {
|
|
61326
|
-
const failure2 = buildMarketDataResponseBodyError(error48, "recent candles", response, "/candles/recent");
|
|
61327
|
-
trace.completeError(failure2, response.status);
|
|
61328
|
-
throw failure2;
|
|
61329
|
-
}
|
|
61330
|
-
trace.completeError(error48, response?.status ?? null);
|
|
61331
|
-
if (isAbortLikeError(error48)) throw error48;
|
|
61332
|
-
throw buildMarketDataNetworkError(error48, "recent candles", "/candles/recent");
|
|
61333
|
-
}
|
|
61334
|
-
}, { signal, shareAbortScoped: true });
|
|
61335
|
-
};
|
|
61336
|
-
ExecutionAssetMetadataRequestError = class extends Error {
|
|
61337
|
-
constructor(message, status, retryAfterMs, code = null) {
|
|
61338
|
-
super(message);
|
|
61339
|
-
this.status = status;
|
|
61340
|
-
this.retryAfterMs = retryAfterMs;
|
|
61341
|
-
this.code = code;
|
|
61342
|
-
this.name = "ExecutionAssetMetadataRequestError";
|
|
61343
|
-
}
|
|
61344
|
-
};
|
|
61345
|
-
CLIENT_EXECUTION_METADATA_DEVICE_READ = "client_execution_metadata_device_read";
|
|
61346
|
-
executionMetadataNeedsDeviceRead = (error48) => error48 instanceof ExecutionAssetMetadataRequestError && error48.code === CLIENT_EXECUTION_METADATA_DEVICE_READ;
|
|
61347
|
-
}
|
|
61348
|
-
});
|
|
61349
|
-
|
|
61350
|
-
// lib/api/screener.ts
|
|
61351
|
-
var init_screener = __esm({
|
|
61352
|
-
"lib/api/screener.ts"() {
|
|
61353
|
-
"use strict";
|
|
61354
|
-
init_define_VTX_CLAUDE_CODE_POLICY();
|
|
61355
|
-
init_define_VTX_EXO_POLICY();
|
|
61356
|
-
init_define_VTX_GROK_POLICY();
|
|
61357
|
-
init_define_VTX_PI_MODEL_POLICY();
|
|
61358
|
-
init_shared();
|
|
61359
|
-
}
|
|
61360
|
-
});
|
|
61361
|
-
|
|
61362
|
-
// lib/api/client-host-commands.ts
|
|
61363
|
-
var init_client_host_commands = __esm({
|
|
61364
|
-
"lib/api/client-host-commands.ts"() {
|
|
61365
|
-
"use strict";
|
|
61366
|
-
init_define_VTX_CLAUDE_CODE_POLICY();
|
|
61367
|
-
init_define_VTX_EXO_POLICY();
|
|
61368
|
-
init_define_VTX_GROK_POLICY();
|
|
61369
|
-
init_define_VTX_PI_MODEL_POLICY();
|
|
61370
|
-
init_shared();
|
|
61371
|
-
}
|
|
61372
|
-
});
|
|
61373
|
-
|
|
61374
61196
|
// lib/runtime/server-runtime-lease.ts
|
|
61375
61197
|
var CLIENT_RUNTIME_SERVER_LEASE_STORAGE_KEY, normalizeProfileId, normalizeLeaseGeneration, parseLeaseRecord, readPersistedLeaseMap, writePersistedLeaseMap, isLeaseExpired, runtimeLeaseHeaders, persistedRuntimeLeaseHeaders, getPersistedClientRuntimeServerLease, persistExistingClientRuntimeServerLease, persistClientRuntimeServerLease, clearPersistedClientRuntimeServerLease;
|
|
61376
61198
|
var init_server_runtime_lease = __esm({
|
|
@@ -61597,6 +61419,223 @@ var init_server_runtime_lease = __esm({
|
|
|
61597
61419
|
}
|
|
61598
61420
|
});
|
|
61599
61421
|
|
|
61422
|
+
// lib/api/market-data.ts
|
|
61423
|
+
async function getRecentCandles(limit, exchange = "kraken", symbol2 = "PI_XBTUSD", timeframe = "1m", signal) {
|
|
61424
|
+
return (await readRecentCandles(limit, exchange, symbol2, timeframe, signal, null)).candles;
|
|
61425
|
+
}
|
|
61426
|
+
async function getRecentCandlesForProfile(profileId, limit, exchange, symbol2, timeframe, signal) {
|
|
61427
|
+
return readRecentCandles(limit, exchange, symbol2, timeframe, signal, profileId);
|
|
61428
|
+
}
|
|
61429
|
+
async function getLiveTicker(symbol2 = "PI_XBTUSD", exchange = "kraken", signal) {
|
|
61430
|
+
const requestKey = `live-ticker:${symbol2}:${exchange}`;
|
|
61431
|
+
return shareClientGetRequest(requestKey, async (requestSignal) => {
|
|
61432
|
+
const requestUrl2 = `${getApiUrl()}/ticker/live?symbol=${encodeURIComponent(symbol2)}&exchange=${encodeURIComponent(exchange)}`;
|
|
61433
|
+
const trace = startRuntimeNetworkDebugTrace({
|
|
61434
|
+
kind: "runtime",
|
|
61435
|
+
label: "market_data_api:ticker_live",
|
|
61436
|
+
method: "GET",
|
|
61437
|
+
url: requestUrl2,
|
|
61438
|
+
note: `symbol=${symbol2} exchange=${exchange}`
|
|
61439
|
+
});
|
|
61440
|
+
let response = null;
|
|
61441
|
+
try {
|
|
61442
|
+
response = await apiFetch(requestUrl2, { cache: "no-store", signal: requestSignal });
|
|
61443
|
+
if (!response.ok) {
|
|
61444
|
+
const error48 = await buildMarketDataFetchError(response, "live ticker", "/ticker/live");
|
|
61445
|
+
trace.attachResponse({ status: response.status, statusText: response.statusText, url: response.url });
|
|
61446
|
+
trace.completeError(error48, response.status);
|
|
61447
|
+
throw error48;
|
|
61448
|
+
}
|
|
61449
|
+
trace.attachResponse({ status: response.status, statusText: response.statusText, url: response.url });
|
|
61450
|
+
const payload = await response.json();
|
|
61451
|
+
trace.completeSuccess(response.status);
|
|
61452
|
+
return payload;
|
|
61453
|
+
} catch (error48) {
|
|
61454
|
+
if (response && !response.ok) throw error48;
|
|
61455
|
+
if (response && !isAbortLikeError(error48)) {
|
|
61456
|
+
const failure2 = buildMarketDataResponseBodyError(error48, "live ticker", response, "/ticker/live");
|
|
61457
|
+
trace.completeError(failure2, response.status);
|
|
61458
|
+
throw failure2;
|
|
61459
|
+
}
|
|
61460
|
+
trace.completeError(error48, response?.status ?? null);
|
|
61461
|
+
if (isAbortLikeError(error48)) throw error48;
|
|
61462
|
+
throw buildMarketDataNetworkError(error48, "live ticker", "/ticker/live");
|
|
61463
|
+
}
|
|
61464
|
+
}, { signal });
|
|
61465
|
+
}
|
|
61466
|
+
async function getExecutionAssetMetadata(exchange, symbol2, options) {
|
|
61467
|
+
const params = new URLSearchParams();
|
|
61468
|
+
if (options?.forceCatalogRefresh) params.set("force_catalog_refresh", "true");
|
|
61469
|
+
if (options?.publicRequestPriority) params.set("public_request_priority", options.publicRequestPriority);
|
|
61470
|
+
const query = params.size > 0 ? `?${params.toString()}` : "";
|
|
61471
|
+
const url2 = `${getApiUrl()}/trading/execution-metadata/${encodeURIComponent(exchange)}/${encodeURIComponent(symbol2)}${query}`;
|
|
61472
|
+
const response = await apiFetch(url2, {
|
|
61473
|
+
// The bot's runtime reads it on its lease once the host's session ended.
|
|
61474
|
+
headers: getProfileHeaders(options?.profileId != null ? persistedRuntimeLeaseHeaders(options.profileId) : {}, options?.profileId),
|
|
61475
|
+
credentials: "include",
|
|
61476
|
+
cache: "no-store",
|
|
61477
|
+
signal: options?.signal
|
|
61478
|
+
});
|
|
61479
|
+
if (!response.ok) {
|
|
61480
|
+
const summary = `Failed to fetch execution asset metadata: ${response.status} ${response.statusText}`;
|
|
61481
|
+
const code = await response.clone().json().then((body) => typeof body?.detail?.code === "string" ? body.detail.code : null).catch(() => null);
|
|
61482
|
+
const detail = await getErrorMessageFromResponse(response, summary);
|
|
61483
|
+
throw new ExecutionAssetMetadataRequestError(
|
|
61484
|
+
detail === summary ? summary : `${summary}: ${detail}`,
|
|
61485
|
+
response.status,
|
|
61486
|
+
parseRetryAfterMs2(response.headers.get("Retry-After")),
|
|
61487
|
+
code
|
|
61488
|
+
);
|
|
61489
|
+
}
|
|
61490
|
+
return response.json();
|
|
61491
|
+
}
|
|
61492
|
+
var CANDLES_MISSING_HEADER, CandlesMissingRangeError, parseCandlesMissing, readRecentCandles, ExecutionAssetMetadataRequestError, CLIENT_EXECUTION_METADATA_DEVICE_READ, executionMetadataNeedsDeviceRead;
|
|
61493
|
+
var init_market_data = __esm({
|
|
61494
|
+
"lib/api/market-data.ts"() {
|
|
61495
|
+
"use strict";
|
|
61496
|
+
init_define_VTX_CLAUDE_CODE_POLICY();
|
|
61497
|
+
init_define_VTX_EXO_POLICY();
|
|
61498
|
+
init_define_VTX_GROK_POLICY();
|
|
61499
|
+
init_define_VTX_PI_MODEL_POLICY();
|
|
61500
|
+
init_abort();
|
|
61501
|
+
init_runtime_redaction();
|
|
61502
|
+
init_network_debug();
|
|
61503
|
+
init_server_runtime_lease();
|
|
61504
|
+
init_shared();
|
|
61505
|
+
init_constants();
|
|
61506
|
+
CANDLES_MISSING_HEADER = "X-VTX-Candles-Missing";
|
|
61507
|
+
CandlesMissingRangeError = class extends Error {
|
|
61508
|
+
};
|
|
61509
|
+
parseCandlesMissing = (value) => {
|
|
61510
|
+
if (value === null || value.trim() === "") return null;
|
|
61511
|
+
const [startText, endText, ...extra] = value.split(",");
|
|
61512
|
+
const startMs = Number(startText?.trim());
|
|
61513
|
+
const endMs = Number(endText?.trim());
|
|
61514
|
+
if (extra.length > 0 || !Number.isSafeInteger(startMs) || !Number.isSafeInteger(endMs) || startMs > endMs) {
|
|
61515
|
+
throw new CandlesMissingRangeError(`The candle answer named an unreadable missing range: ${sanitizeRuntimeDiagnosticValue(value)}`);
|
|
61516
|
+
}
|
|
61517
|
+
return { startMs, endMs };
|
|
61518
|
+
};
|
|
61519
|
+
readRecentCandles = async (limit, exchange, symbol2, timeframe, signal, profileId) => {
|
|
61520
|
+
const params = new URLSearchParams({ limit: limit.toString(), exchange, symbol: symbol2, timeframe });
|
|
61521
|
+
const requestUrl2 = `${getApiUrl()}/candles/recent?${params.toString()}`;
|
|
61522
|
+
const forProfile = profileId === null ? {} : { credentials: "include", headers: getProfileHeaders(persistedRuntimeLeaseHeaders(profileId), profileId) };
|
|
61523
|
+
return shareClientGetRequest(`recent-candles:${profileId ?? "none"}:${params.toString()}`, async (requestSignal) => {
|
|
61524
|
+
const trace = startRuntimeNetworkDebugTrace({
|
|
61525
|
+
kind: "runtime",
|
|
61526
|
+
label: "market_data_api:candles_recent",
|
|
61527
|
+
method: "GET",
|
|
61528
|
+
url: requestUrl2,
|
|
61529
|
+
note: `symbol=${symbol2} exchange=${exchange} timeframe=${timeframe} limit=${limit}`
|
|
61530
|
+
});
|
|
61531
|
+
let response = null;
|
|
61532
|
+
try {
|
|
61533
|
+
response = await apiFetch(requestUrl2, {
|
|
61534
|
+
...forProfile,
|
|
61535
|
+
cache: "no-store",
|
|
61536
|
+
signal: requestSignal
|
|
61537
|
+
});
|
|
61538
|
+
if (!response.ok) {
|
|
61539
|
+
const error48 = await buildMarketDataFetchError(response, "recent candles", "/candles/recent");
|
|
61540
|
+
trace.attachResponse({ status: response.status, statusText: response.statusText, url: response.url });
|
|
61541
|
+
trace.completeError(error48, response.status);
|
|
61542
|
+
console.error(`[API] ${error48.message} URL: ${response.url}`);
|
|
61543
|
+
throw error48;
|
|
61544
|
+
}
|
|
61545
|
+
trace.attachResponse({ status: response.status, statusText: response.statusText, url: response.url });
|
|
61546
|
+
const missing2 = parseCandlesMissing(response.headers.get(CANDLES_MISSING_HEADER));
|
|
61547
|
+
const payload = await response.json();
|
|
61548
|
+
trace.completeSuccess(response.status);
|
|
61549
|
+
return { candles: payload, missing: missing2 };
|
|
61550
|
+
} catch (error48) {
|
|
61551
|
+
if (response && !response.ok) throw error48;
|
|
61552
|
+
if (response && error48 instanceof CandlesMissingRangeError) {
|
|
61553
|
+
trace.completeError(error48, response.status);
|
|
61554
|
+
throw error48;
|
|
61555
|
+
}
|
|
61556
|
+
if (response && !isAbortLikeError(error48)) {
|
|
61557
|
+
const failure2 = buildMarketDataResponseBodyError(error48, "recent candles", response, "/candles/recent");
|
|
61558
|
+
trace.completeError(failure2, response.status);
|
|
61559
|
+
throw failure2;
|
|
61560
|
+
}
|
|
61561
|
+
trace.completeError(error48, response?.status ?? null);
|
|
61562
|
+
if (isAbortLikeError(error48)) throw error48;
|
|
61563
|
+
throw buildMarketDataNetworkError(error48, "recent candles", "/candles/recent");
|
|
61564
|
+
}
|
|
61565
|
+
}, { signal, shareAbortScoped: true });
|
|
61566
|
+
};
|
|
61567
|
+
ExecutionAssetMetadataRequestError = class extends Error {
|
|
61568
|
+
constructor(message, status, retryAfterMs, code = null) {
|
|
61569
|
+
super(message);
|
|
61570
|
+
this.status = status;
|
|
61571
|
+
this.retryAfterMs = retryAfterMs;
|
|
61572
|
+
this.code = code;
|
|
61573
|
+
this.name = "ExecutionAssetMetadataRequestError";
|
|
61574
|
+
}
|
|
61575
|
+
};
|
|
61576
|
+
CLIENT_EXECUTION_METADATA_DEVICE_READ = "client_execution_metadata_device_read";
|
|
61577
|
+
executionMetadataNeedsDeviceRead = (error48) => error48 instanceof ExecutionAssetMetadataRequestError && error48.code === CLIENT_EXECUTION_METADATA_DEVICE_READ;
|
|
61578
|
+
}
|
|
61579
|
+
});
|
|
61580
|
+
|
|
61581
|
+
// lib/api/screener.ts
|
|
61582
|
+
var init_screener = __esm({
|
|
61583
|
+
"lib/api/screener.ts"() {
|
|
61584
|
+
"use strict";
|
|
61585
|
+
init_define_VTX_CLAUDE_CODE_POLICY();
|
|
61586
|
+
init_define_VTX_EXO_POLICY();
|
|
61587
|
+
init_define_VTX_GROK_POLICY();
|
|
61588
|
+
init_define_VTX_PI_MODEL_POLICY();
|
|
61589
|
+
init_shared();
|
|
61590
|
+
}
|
|
61591
|
+
});
|
|
61592
|
+
|
|
61593
|
+
// lib/api/client-host-commands.ts
|
|
61594
|
+
var init_client_host_commands = __esm({
|
|
61595
|
+
"lib/api/client-host-commands.ts"() {
|
|
61596
|
+
"use strict";
|
|
61597
|
+
init_define_VTX_CLAUDE_CODE_POLICY();
|
|
61598
|
+
init_define_VTX_EXO_POLICY();
|
|
61599
|
+
init_define_VTX_GROK_POLICY();
|
|
61600
|
+
init_define_VTX_PI_MODEL_POLICY();
|
|
61601
|
+
init_shared();
|
|
61602
|
+
}
|
|
61603
|
+
});
|
|
61604
|
+
|
|
61605
|
+
// lib/api/client-user-cancels.ts
|
|
61606
|
+
async function readClientUserCancels(profileId, orderIds, signal) {
|
|
61607
|
+
if (orderIds.length === 0) return /* @__PURE__ */ new Set();
|
|
61608
|
+
const numericProfileId = Number(profileId);
|
|
61609
|
+
const body = { order_ids: [...orderIds] };
|
|
61610
|
+
const response = await apiFetch(`${getApiUrl()}/trading/ai/runtime/protection/user-cancels`, {
|
|
61611
|
+
method: "POST",
|
|
61612
|
+
credentials: "include",
|
|
61613
|
+
headers: getProfileHeaders(
|
|
61614
|
+
{ "Content-Type": "application/json" },
|
|
61615
|
+
Number.isSafeInteger(numericProfileId) ? numericProfileId : void 0
|
|
61616
|
+
),
|
|
61617
|
+
body: JSON.stringify(body),
|
|
61618
|
+
signal
|
|
61619
|
+
});
|
|
61620
|
+
if (!response.ok) {
|
|
61621
|
+
const detail = await response.clone().json().then((answer2) => answer2?.detail, () => null);
|
|
61622
|
+
if (isMissingApiRoute({ status: Number(response.status), detail })) return /* @__PURE__ */ new Set();
|
|
61623
|
+
throw new Error(await getErrorMessageFromResponse(response, "Failed to read the user cancels"));
|
|
61624
|
+
}
|
|
61625
|
+
const answer = await response.json();
|
|
61626
|
+
return new Set(answer.cancels.map((row) => String(row.order_id)));
|
|
61627
|
+
}
|
|
61628
|
+
var init_client_user_cancels = __esm({
|
|
61629
|
+
"lib/api/client-user-cancels.ts"() {
|
|
61630
|
+
"use strict";
|
|
61631
|
+
init_define_VTX_CLAUDE_CODE_POLICY();
|
|
61632
|
+
init_define_VTX_EXO_POLICY();
|
|
61633
|
+
init_define_VTX_GROK_POLICY();
|
|
61634
|
+
init_define_VTX_PI_MODEL_POLICY();
|
|
61635
|
+
init_shared();
|
|
61636
|
+
}
|
|
61637
|
+
});
|
|
61638
|
+
|
|
61600
61639
|
// lib/api/logout.ts
|
|
61601
61640
|
var init_logout = __esm({
|
|
61602
61641
|
"lib/api/logout.ts"() {
|
|
@@ -61617,7 +61656,8 @@ async function getLLMConfig(cookie, profileId, signal) {
|
|
|
61617
61656
|
const key = clientGetRequestKey("llm-config", effectiveProfileId);
|
|
61618
61657
|
return shareClientGetRequest(key, async (requestSignal) => {
|
|
61619
61658
|
const headers = getProfileHeaders({
|
|
61620
|
-
"Content-Type": "application/json"
|
|
61659
|
+
"Content-Type": "application/json",
|
|
61660
|
+
...!cookie && profileId != null ? persistedRuntimeLeaseHeaders(profileId) : {}
|
|
61621
61661
|
}, profileId);
|
|
61622
61662
|
const held = cookie ? null : heldPayloads.get(key) ?? null;
|
|
61623
61663
|
if (cookie) headers.Cookie = cookie;
|
|
@@ -61659,6 +61699,7 @@ var init_llm_config = __esm({
|
|
|
61659
61699
|
init_define_VTX_PI_MODEL_POLICY();
|
|
61660
61700
|
init_constants();
|
|
61661
61701
|
init_shared();
|
|
61702
|
+
init_server_runtime_lease();
|
|
61662
61703
|
REVISION_HEADER = "X-VTX-Config-Revision";
|
|
61663
61704
|
heldPayloads = /* @__PURE__ */ new Map();
|
|
61664
61705
|
}
|
|
@@ -62006,6 +62047,48 @@ var init_client_protective_evidence = __esm({
|
|
|
62006
62047
|
}
|
|
62007
62048
|
});
|
|
62008
62049
|
|
|
62050
|
+
// lib/api/provider-relays.ts
|
|
62051
|
+
function relayNativeProviderRequest(provider, apiKey, payload, options = {}) {
|
|
62052
|
+
return apiFetch(`${getApiUrl()}/llm/native-provider-relay`, {
|
|
62053
|
+
method: "POST",
|
|
62054
|
+
credentials: "include",
|
|
62055
|
+
headers: relayHeaders(options.profileId),
|
|
62056
|
+
body: JSON.stringify({
|
|
62057
|
+
provider,
|
|
62058
|
+
api_key: apiKey,
|
|
62059
|
+
payload,
|
|
62060
|
+
...options.planId ? { plan_id: options.planId } : {},
|
|
62061
|
+
...options.traceId ? { trace_id: options.traceId } : {}
|
|
62062
|
+
}),
|
|
62063
|
+
signal: options.signal
|
|
62064
|
+
});
|
|
62065
|
+
}
|
|
62066
|
+
function relayGoogleEgressRequest(model, apiKey, payload, options) {
|
|
62067
|
+
return apiFetch(`${getApiUrl()}/llm/google-egress-relay`, {
|
|
62068
|
+
method: "POST",
|
|
62069
|
+
credentials: "include",
|
|
62070
|
+
headers: relayHeaders(options.profileId),
|
|
62071
|
+
body: JSON.stringify({ model, api_key: apiKey, payload, timeout_seconds: options.timeoutSeconds }),
|
|
62072
|
+
signal: options.signal
|
|
62073
|
+
});
|
|
62074
|
+
}
|
|
62075
|
+
var relayHeaders;
|
|
62076
|
+
var init_provider_relays = __esm({
|
|
62077
|
+
"lib/api/provider-relays.ts"() {
|
|
62078
|
+
"use strict";
|
|
62079
|
+
init_define_VTX_CLAUDE_CODE_POLICY();
|
|
62080
|
+
init_define_VTX_EXO_POLICY();
|
|
62081
|
+
init_define_VTX_GROK_POLICY();
|
|
62082
|
+
init_define_VTX_PI_MODEL_POLICY();
|
|
62083
|
+
init_server_runtime_lease();
|
|
62084
|
+
init_shared();
|
|
62085
|
+
relayHeaders = (profileId) => getProfileHeaders({
|
|
62086
|
+
"Content-Type": "application/json",
|
|
62087
|
+
...profileId != null ? persistedRuntimeLeaseHeaders(profileId) : {}
|
|
62088
|
+
}, profileId);
|
|
62089
|
+
}
|
|
62090
|
+
});
|
|
62091
|
+
|
|
62009
62092
|
// lib/runtime/hyperliquid-account-mode-contract.ts
|
|
62010
62093
|
function resolveExactHyperliquidAccountMode(userAbstraction, ...dexEvidence) {
|
|
62011
62094
|
const mode = extractCanonicalHyperliquidAccountMode(userAbstraction);
|
|
@@ -62635,7 +62718,7 @@ var init_hyperliquid_max_leverage = __esm({
|
|
|
62635
62718
|
});
|
|
62636
62719
|
|
|
62637
62720
|
// lib/candle-timeframes.ts
|
|
62638
|
-
var candleTimeframeSeconds, compareCandleTimeframes, sortCandleTimeframes;
|
|
62721
|
+
var candleTimeframeSeconds, compareCandleTimeframes, sortCandleTimeframes, candleClosedInSeries;
|
|
62639
62722
|
var init_candle_timeframes = __esm({
|
|
62640
62723
|
"lib/candle-timeframes.ts"() {
|
|
62641
62724
|
"use strict";
|
|
@@ -62647,6 +62730,7 @@ var init_candle_timeframes = __esm({
|
|
|
62647
62730
|
candleTimeframeSeconds = (timeframe) => Object.prototype.hasOwnProperty.call(CANDLE_TIMEFRAME_SECONDS, timeframe) ? CANDLE_TIMEFRAME_SECONDS[timeframe] : void 0;
|
|
62648
62731
|
compareCandleTimeframes = (left, right) => (candleTimeframeSeconds(left) ?? Number.MAX_SAFE_INTEGER) - (candleTimeframeSeconds(right) ?? Number.MAX_SAFE_INTEGER);
|
|
62649
62732
|
sortCandleTimeframes = (timeframes) => [...timeframes].sort(compareCandleTimeframes);
|
|
62733
|
+
candleClosedInSeries = (openTimestamp, newestOpenTimestamp, timeframeSeconds, asOfTimestamp) => openTimestamp < newestOpenTimestamp || openTimestamp + timeframeSeconds <= asOfTimestamp;
|
|
62650
62734
|
}
|
|
62651
62735
|
});
|
|
62652
62736
|
|
|
@@ -65289,7 +65373,8 @@ var init_write_fence = __esm({
|
|
|
65289
65373
|
{
|
|
65290
65374
|
...pinnedAuthority ? { pinnedAuthority } : {},
|
|
65291
65375
|
mutationId: durableMutation.mutationId,
|
|
65292
|
-
...await fields(pinnedAuthority)
|
|
65376
|
+
...await fields(pinnedAuthority),
|
|
65377
|
+
...durableMutation.userCancel != null ? { userCancel: durableMutation.userCancel } : {}
|
|
65293
65378
|
},
|
|
65294
65379
|
...fencedMutationAuthorityArgs(durableMutation)
|
|
65295
65380
|
);
|
|
@@ -98594,30 +98679,6 @@ async function reportServerBackupReadiness(profileId, ready, hostId, signal, pow
|
|
|
98594
98679
|
}
|
|
98595
98680
|
return response.json();
|
|
98596
98681
|
}
|
|
98597
|
-
function relayNativeProviderRequest(provider, apiKey, payload, options = {}) {
|
|
98598
|
-
return apiFetch(`${getApiUrl()}/llm/native-provider-relay`, {
|
|
98599
|
-
method: "POST",
|
|
98600
|
-
credentials: "include",
|
|
98601
|
-
headers: getProfileHeaders({ "Content-Type": "application/json" }, options.profileId),
|
|
98602
|
-
body: JSON.stringify({
|
|
98603
|
-
provider,
|
|
98604
|
-
api_key: apiKey,
|
|
98605
|
-
payload,
|
|
98606
|
-
...options.planId ? { plan_id: options.planId } : {},
|
|
98607
|
-
...options.traceId ? { trace_id: options.traceId } : {}
|
|
98608
|
-
}),
|
|
98609
|
-
signal: options.signal
|
|
98610
|
-
});
|
|
98611
|
-
}
|
|
98612
|
-
function relayGoogleEgressRequest(model, apiKey, payload, options) {
|
|
98613
|
-
return apiFetch(`${getApiUrl()}/llm/google-egress-relay`, {
|
|
98614
|
-
method: "POST",
|
|
98615
|
-
credentials: "include",
|
|
98616
|
-
headers: getProfileHeaders({ "Content-Type": "application/json" }, options.profileId),
|
|
98617
|
-
body: JSON.stringify({ model, api_key: apiKey, payload, timeout_seconds: options.timeoutSeconds }),
|
|
98618
|
-
signal: options.signal
|
|
98619
|
-
});
|
|
98620
|
-
}
|
|
98621
98682
|
async function getClientRuntimeSecrets(profileId, options) {
|
|
98622
98683
|
const params = new URLSearchParams();
|
|
98623
98684
|
if (options?.activeProvider) {
|
|
@@ -100051,6 +100112,8 @@ var init_api2 = __esm({
|
|
|
100051
100112
|
init_market_data();
|
|
100052
100113
|
init_screener();
|
|
100053
100114
|
init_client_host_commands();
|
|
100115
|
+
init_client_exchange_mutation_begin();
|
|
100116
|
+
init_client_user_cancels();
|
|
100054
100117
|
init_logout();
|
|
100055
100118
|
init_llm_config();
|
|
100056
100119
|
init_llm_config();
|
|
@@ -100069,6 +100132,7 @@ var init_api2 = __esm({
|
|
|
100069
100132
|
init_client_exchange_reconciliation();
|
|
100070
100133
|
init_client_protective_evidence();
|
|
100071
100134
|
init_server_runtime_lease();
|
|
100135
|
+
init_provider_relays();
|
|
100072
100136
|
clientRuntimeSecretHeaders = (profileId) => {
|
|
100073
100137
|
const headers = getProfileHeaders({}, profileId);
|
|
100074
100138
|
const leaseProfileId = profileId ?? getActiveProfileId();
|
|
@@ -102199,6 +102263,7 @@ var init_browser_trading = __esm({
|
|
|
102199
102263
|
mutationId: mutation.mutationId,
|
|
102200
102264
|
operationKind: "cancel",
|
|
102201
102265
|
symbol: input.symbol,
|
|
102266
|
+
userCancel: input.userCancel === true,
|
|
102202
102267
|
onExchangeOrderDispatched: input.onExchangeOrderDispatched
|
|
102203
102268
|
}
|
|
102204
102269
|
});
|
|
@@ -104334,7 +104399,9 @@ async function getClientRuntimeExchangeMutation(profileId, mutationId, signal) {
|
|
|
104334
104399
|
method: "GET",
|
|
104335
104400
|
credentials: "include",
|
|
104336
104401
|
cache: "no-store",
|
|
104337
|
-
|
|
104402
|
+
// A host's runtime reads on its bot's lease once the host's session ended; the
|
|
104403
|
+
// Node runtime host keeps this read on its protection route (server-host/live-fetch.ts).
|
|
104404
|
+
headers: Number.isSafeInteger(numericProfileId) ? getProfileHeaders(persistedRuntimeLeaseHeaders(numericProfileId), numericProfileId) : getProfileHeaders({}),
|
|
104338
104405
|
signal
|
|
104339
104406
|
}
|
|
104340
104407
|
);
|
|
@@ -104352,6 +104419,7 @@ var init_client_exchange_mutations = __esm({
|
|
|
104352
104419
|
init_define_VTX_GROK_POLICY();
|
|
104353
104420
|
init_define_VTX_PI_MODEL_POLICY();
|
|
104354
104421
|
init_constants();
|
|
104422
|
+
init_server_runtime_lease();
|
|
104355
104423
|
init_shared();
|
|
104356
104424
|
}
|
|
104357
104425
|
});
|
|
@@ -105195,7 +105263,8 @@ var init_writes = __esm({
|
|
|
105195
105263
|
mutationId,
|
|
105196
105264
|
...context.onSettled ? { onSettled: context.onSettled } : {},
|
|
105197
105265
|
...context.signal ? { signal: context.signal } : {},
|
|
105198
|
-
...context.onExchangeOrderDispatched ? { onExchangeOrderDispatched: context.onExchangeOrderDispatched } : {}
|
|
105266
|
+
...context.onExchangeOrderDispatched ? { onExchangeOrderDispatched: context.onExchangeOrderDispatched } : {},
|
|
105267
|
+
...context.userCancel != null ? { userCancel: context.userCancel } : {}
|
|
105199
105268
|
},
|
|
105200
105269
|
captureTimeoutMs: deps.captureTimeoutMs,
|
|
105201
105270
|
begin: {
|
|
@@ -105783,7 +105852,12 @@ var init_runtime_writes = __esm({
|
|
|
105783
105852
|
},
|
|
105784
105853
|
cancelOrder: async (input) => {
|
|
105785
105854
|
const name = await listed(input.symbol, input.signal);
|
|
105786
|
-
return cancelResponse(await answering(operationsFor(input).cancelOrder({
|
|
105855
|
+
return cancelResponse(await answering(operationsFor(input).cancelOrder({
|
|
105856
|
+
...writeContext2(input),
|
|
105857
|
+
userCancel: input.userCancel === true,
|
|
105858
|
+
symbol: name,
|
|
105859
|
+
orderId: input.orderId
|
|
105860
|
+
})));
|
|
105787
105861
|
},
|
|
105788
105862
|
closePosition: async (input) => {
|
|
105789
105863
|
const name = await listed(input.symbol, input.signal);
|
|
@@ -106899,6 +106973,69 @@ var init_bounded_lock = __esm({
|
|
|
106899
106973
|
}
|
|
106900
106974
|
});
|
|
106901
106975
|
|
|
106976
|
+
// lib/runtime/protective-user-cancels.ts
|
|
106977
|
+
var MAX_USER_CANCEL_ORDER_IDS, passUserCancels, readEachUserCancel;
|
|
106978
|
+
var init_protective_user_cancels = __esm({
|
|
106979
|
+
"lib/runtime/protective-user-cancels.ts"() {
|
|
106980
|
+
"use strict";
|
|
106981
|
+
init_define_VTX_CLAUDE_CODE_POLICY();
|
|
106982
|
+
init_define_VTX_EXO_POLICY();
|
|
106983
|
+
init_define_VTX_GROK_POLICY();
|
|
106984
|
+
init_define_VTX_PI_MODEL_POLICY();
|
|
106985
|
+
init_runtime_policy_generated2();
|
|
106986
|
+
MAX_USER_CANCEL_ORDER_IDS = runtime_policy_generated_default2.trading.engine.client_runtime.request_bounds.max_user_cancel_order_ids;
|
|
106987
|
+
passUserCancels = (read, options = {}) => {
|
|
106988
|
+
const maxPerRead = Math.max(1, Math.floor(options.maxPerRead ?? MAX_USER_CANCEL_ORDER_IDS));
|
|
106989
|
+
const answers = /* @__PURE__ */ new Map();
|
|
106990
|
+
const failures = /* @__PURE__ */ new Map();
|
|
106991
|
+
const exchangeOrderId = (orderId) => {
|
|
106992
|
+
const key = String(orderId).trim();
|
|
106993
|
+
return /^[0-9]+$/.test(key) ? key : null;
|
|
106994
|
+
};
|
|
106995
|
+
const readBatch = async (orderIds) => {
|
|
106996
|
+
try {
|
|
106997
|
+
const { cancelled, unread } = await read(orderIds);
|
|
106998
|
+
for (const orderId of orderIds) {
|
|
106999
|
+
if (unread?.has(orderId)) failures.set(orderId, unread.get(orderId));
|
|
107000
|
+
else answers.set(orderId, cancelled.has(orderId));
|
|
107001
|
+
}
|
|
107002
|
+
} catch (error48) {
|
|
107003
|
+
if (options.signal?.aborted) throw error48;
|
|
107004
|
+
for (const orderId of orderIds) failures.set(orderId, error48);
|
|
107005
|
+
}
|
|
107006
|
+
};
|
|
107007
|
+
return {
|
|
107008
|
+
prefetch: async (orderIds) => {
|
|
107009
|
+
const unknown2 = [...new Set(orderIds.map(exchangeOrderId))].filter((orderId) => orderId != null && !answers.has(orderId) && !failures.has(orderId));
|
|
107010
|
+
for (let start = 0; start < unknown2.length; start += maxPerRead) {
|
|
107011
|
+
await readBatch(unknown2.slice(start, start + maxPerRead));
|
|
107012
|
+
}
|
|
107013
|
+
},
|
|
107014
|
+
cancelled: async (orderId) => {
|
|
107015
|
+
const key = exchangeOrderId(orderId);
|
|
107016
|
+
if (key == null) return false;
|
|
107017
|
+
if (!answers.has(key) && !failures.has(key)) await readBatch([key]);
|
|
107018
|
+
if (failures.has(key)) throw failures.get(key);
|
|
107019
|
+
return answers.get(key) === true;
|
|
107020
|
+
}
|
|
107021
|
+
};
|
|
107022
|
+
};
|
|
107023
|
+
readEachUserCancel = (lookup, signal) => async (orderIds) => {
|
|
107024
|
+
const cancelled = /* @__PURE__ */ new Set();
|
|
107025
|
+
const unread = /* @__PURE__ */ new Map();
|
|
107026
|
+
for (const orderId of orderIds) {
|
|
107027
|
+
try {
|
|
107028
|
+
if (await lookup(orderId)) cancelled.add(orderId);
|
|
107029
|
+
} catch (error48) {
|
|
107030
|
+
if (signal?.aborted) throw error48;
|
|
107031
|
+
unread.set(orderId, error48);
|
|
107032
|
+
}
|
|
107033
|
+
}
|
|
107034
|
+
return { cancelled, unread };
|
|
107035
|
+
};
|
|
107036
|
+
}
|
|
107037
|
+
});
|
|
107038
|
+
|
|
106902
107039
|
// lib/runtime/prompt-number-contract.ts
|
|
106903
107040
|
var finiteNumber2, roundPromptFixed, roundPromptSignificant, roundPromptRelativeVolume, roundPromptNonnegativeUnits;
|
|
106904
107041
|
var init_prompt_number_contract = __esm({
|
|
@@ -109401,7 +109538,7 @@ var init_native_position_protection = __esm({
|
|
|
109401
109538
|
});
|
|
109402
109539
|
|
|
109403
109540
|
// lib/runtime/native-protection-device.ts
|
|
109404
|
-
var NATIVE_PROTECTION_RECORD_VERSION, MAX_PLACE_ATTEMPTS, FILL_PROOF_DEADLINE_MS, owesMove, owingMove, warningKey, moveMade, pricedFrom, followsPosition, pricedOn, nativeProtectionStorage, resolveStorage, setNativeProtectionStorage, recordKey, listNativeProtectionSymbols, isPricedOrAbsent, isMember, isRetracement, isLot, isStandbyAdd, readNativeProtectionRecord, versioned, writeNativeProtectionRecord, NO_FILLS, nativeFillsPageFromUserFills, readPositionAndPage, fillsReader, flatReadOf, orderFillTimes, namedOrderId, NativeOrderNotSentError, withDispatchBoundary, locallyRefused, attempt, notSentRestores, errorText2, actionOf, positionOrderReport, isOpenInDirection2, coverRows, restingOrderIdAt, definitivelyRefused, TRAILING_LOT_FIRED, TRAILING_LOT_POSITION_ENDED, TRAILING_LOT_OTHER_SIDE, lotFillLeftPosition, uncoveredByLots, lotOfAdd, ORDER_ID_PATTERN, lotFillOrderId, TRAILING_LOT_POSITION_UNDECIDED, lotPositionSince, ownLotOrderIds, lotRetracement, lotReport, sendTrailingLot, planNativeFillLot, planNativeStandbyAdd, nameNativeStandbyAdd, dropNativeStandbyAdd, dropNativePendingLot, planNativePendingLot, planNativeOpen, recordEntryChildren, observeMembers, ridesOnOpen, namedOrderReports, UNKNOWN_ORDER_RESPONSE, resolveUnknownOrderIds, cancellingThroughVtx, moveMember, plannedPair, resolveStandbyAdds, withoutExpiredAdds, settleNativeProtectionAfterFill, reconcileNativeProtection;
|
|
109541
|
+
var NATIVE_PROTECTION_RECORD_VERSION, MAX_PLACE_ATTEMPTS, FILL_PROOF_DEADLINE_MS, owesMove, owingMove, warningKey, moveMade, pricedFrom, followsPosition, pricedOn, nativeProtectionStorage, resolveStorage, setNativeProtectionStorage, recordKey, listNativeProtectionSymbols, isPricedOrAbsent, isMember, isRetracement, isLot, isStandbyAdd, readNativeProtectionRecord, withoutStoredUserCancels, versioned, writeNativeProtectionRecord, NO_FILLS, nativeFillsPageFromUserFills, readPositionAndPage, fillsReader, flatReadOf, orderFillTimes, namedOrderId, NativeOrderNotSentError, withDispatchBoundary, locallyRefused, attempt, notSentRestores, errorText2, actionOf, positionOrderReport, isOpenInDirection2, coverRows, restingOrderIdAt, definitivelyRefused, TRAILING_LOT_FIRED, TRAILING_LOT_POSITION_ENDED, TRAILING_LOT_OTHER_SIDE, lotFillLeftPosition, uncoveredByLots, lotOfAdd, ORDER_ID_PATTERN, lotFillOrderId, TRAILING_LOT_POSITION_UNDECIDED, lotPositionSince, ownLotOrderIds, lotRetracement, lotReport, sendTrailingLot, planNativeFillLot, planNativeStandbyAdd, nameNativeStandbyAdd, dropNativeStandbyAdd, dropNativePendingLot, planNativePendingLot, planNativeOpen, recordEntryChildren, observeMembers, ridesOnOpen, namedOrderReports, UNKNOWN_ORDER_RESPONSE, resolveUnknownOrderIds, cancellingThroughVtx, endedByUserCancel, moveMember, plannedPair, resolveStandbyAdds, withoutExpiredAdds, settleNativeProtectionAfterFill, reconcileNativeProtection;
|
|
109405
109542
|
var init_native_protection_device = __esm({
|
|
109406
109543
|
"lib/runtime/native-protection-device.ts"() {
|
|
109407
109544
|
"use strict";
|
|
@@ -109445,7 +109582,7 @@ var init_native_protection_device = __esm({
|
|
|
109445
109582
|
if (position?.entryPrice == null) return members;
|
|
109446
109583
|
const priced = pricedFrom({ size: position.size, entryPrice: position.entryPrice });
|
|
109447
109584
|
const earlier = new Set(startedWith.map((member) => member.clientOrderId));
|
|
109448
|
-
return members.map((member) => member.priced != null || earlier.has(member.clientOrderId) || owesMove(member) || member.pendingModify || member.plannedAfterMs != null || member.retiredReason
|
|
109585
|
+
return members.map((member) => member.priced != null || earlier.has(member.clientOrderId) || owesMove(member) || member.pendingModify || member.plannedAfterMs != null || member.retiredReason ? member : { ...member, priced });
|
|
109449
109586
|
};
|
|
109450
109587
|
nativeProtectionStorage = null;
|
|
109451
109588
|
resolveStorage = () => nativeProtectionStorage ?? browserRuntimeStateStorage();
|
|
@@ -109495,7 +109632,14 @@ var init_native_protection_device = __esm({
|
|
|
109495
109632
|
if (parsed?.version !== NATIVE_PROTECTION_RECORD_VERSION && parsed?.version !== NATIVE_PROTECTION_RECORD_WITH_LOTS_VERSION || parsed.profileId !== profileId || parsed.symbol !== symbol2 || typeof parsed.walletAddress !== "string" || typeof parsed.isLong !== "boolean" || parsed.phase !== "entry_pending" && parsed.phase !== "active" || typeof parsed.entryMutationId !== "string" || typeof parsed.entryClientOrderId !== "string" || typeof parsed.createdAtMs !== "number" || !Array.isArray(parsed.members) || !parsed.members.every(isMember) || parsed.lots !== void 0 && (parsed.version !== NATIVE_PROTECTION_RECORD_WITH_LOTS_VERSION || !Array.isArray(parsed.lots) || !parsed.lots.every(isLot)) || parsed.standby !== void 0 && (!Array.isArray(parsed.standby) || !parsed.standby.every(isStandbyAdd)) || parsed.positionOrderId !== void 0 && typeof parsed.positionOrderId !== "string") {
|
|
109496
109633
|
throw new Error("Stored native protection record is invalid.");
|
|
109497
109634
|
}
|
|
109498
|
-
return parsed;
|
|
109635
|
+
return withoutStoredUserCancels(parsed);
|
|
109636
|
+
};
|
|
109637
|
+
withoutStoredUserCancels = (record6) => {
|
|
109638
|
+
const unmarked = (entry) => {
|
|
109639
|
+
const { userCancelledOrderId: _stored, ...rest } = entry;
|
|
109640
|
+
return rest;
|
|
109641
|
+
};
|
|
109642
|
+
return { ...record6, members: record6.members.map(unmarked), ...record6.lots ? { lots: record6.lots.map(unmarked) } : {} };
|
|
109499
109643
|
};
|
|
109500
109644
|
versioned = (record6) => {
|
|
109501
109645
|
const { lots, ...rest } = record6;
|
|
@@ -109942,13 +110086,14 @@ var init_native_protection_device = __esm({
|
|
|
109942
110086
|
}
|
|
109943
110087
|
return { ...record6, members };
|
|
109944
110088
|
};
|
|
109945
|
-
cancellingThroughVtx = async (io, orderId) =>
|
|
110089
|
+
cancellingThroughVtx = async (io, orderId) => await endedByUserCancel(io, orderId) !== false;
|
|
110090
|
+
endedByUserCancel = async (io, orderId) => {
|
|
109946
110091
|
if (!io.userCancelledOrder) return false;
|
|
109947
110092
|
try {
|
|
109948
110093
|
return await io.userCancelledOrder(orderId);
|
|
109949
110094
|
} catch (error48) {
|
|
109950
110095
|
if (io.endsPass?.(error48)) throw error48;
|
|
109951
|
-
return
|
|
110096
|
+
return null;
|
|
109952
110097
|
}
|
|
109953
110098
|
};
|
|
109954
110099
|
moveMember = async (args) => {
|
|
@@ -110155,7 +110300,7 @@ var init_native_protection_device = __esm({
|
|
|
110155
110300
|
const afterMs = boundary.addFillMs ?? 0;
|
|
110156
110301
|
record6 = {
|
|
110157
110302
|
...record6,
|
|
110158
|
-
members: record6.members.map((member) => member.retiredReason || member.
|
|
110303
|
+
members: record6.members.map((member) => member.retiredReason || member.plannedAfterMs != null ? member : owingMove(member, afterMs))
|
|
110159
110304
|
};
|
|
110160
110305
|
}
|
|
110161
110306
|
if (boundary.undecided) {
|
|
@@ -110231,7 +110376,7 @@ var init_native_protection_device = __esm({
|
|
|
110231
110376
|
if (step.action === "place_trailing") continue;
|
|
110232
110377
|
const index = members.findIndex((member) => member.kind === step.kind);
|
|
110233
110378
|
const existing = index >= 0 ? members[index] : null;
|
|
110234
|
-
if (existing?.
|
|
110379
|
+
if (existing?.retiredReason) continue;
|
|
110235
110380
|
if (existing?.pendingModify) continue;
|
|
110236
110381
|
const clientOrderId = clientOrderIdForMutation(io.newMutationId());
|
|
110237
110382
|
if (step.action === "modify") {
|
|
@@ -110403,7 +110548,7 @@ var init_native_protection_device = __esm({
|
|
|
110403
110548
|
lotIndex = lots.length - 1;
|
|
110404
110549
|
}
|
|
110405
110550
|
const journaledLot = lotIndex >= 0 ? lots[lotIndex] : null;
|
|
110406
|
-
if (journaledLot && journaledLot.mutationId == null && !journaledLot.retiredReason &&
|
|
110551
|
+
if (journaledLot && journaledLot.mutationId == null && !journaledLot.retiredReason && io.placeTrailingLot) {
|
|
110407
110552
|
const size = journaledLot.size || fillLotSize;
|
|
110408
110553
|
const retracement = lotRetracement(input.settings, size, input.sizeDecimals);
|
|
110409
110554
|
if (retracement) {
|
|
@@ -110502,6 +110647,10 @@ var init_native_protection_device = __esm({
|
|
|
110502
110647
|
...entry,
|
|
110503
110648
|
member: entry.row ? { ...entry.member, placedAtMs: entry.row.timestamp || entry.member.placedAtMs } : entry.member
|
|
110504
110649
|
}));
|
|
110650
|
+
await io.prefetchUserCancels?.([
|
|
110651
|
+
...observations.filter((entry) => entry.row == null && !entry.member.retiredReason && !entry.member.pendingModify).map((entry) => entry.member.orderId),
|
|
110652
|
+
...(record6.lots ?? []).filter((lot) => !lot.retiredReason && !page.some((order) => order.oid === lot.orderId)).map((lot) => lot.orderId)
|
|
110653
|
+
].filter((orderId) => orderId != null));
|
|
110505
110654
|
const members = [];
|
|
110506
110655
|
let anyResting = false;
|
|
110507
110656
|
const positionOpen = isOpenInDirection2(position.size, record6.isLong);
|
|
@@ -110525,7 +110674,7 @@ var init_native_protection_device = __esm({
|
|
|
110525
110674
|
const moveTargets = /* @__PURE__ */ new Map();
|
|
110526
110675
|
if (movable && position.entryPrice != null && record6.members.some((member) => owesMove(member) || follows(member))) {
|
|
110527
110676
|
const restingTrigger = (kind) => {
|
|
110528
|
-
const observed = observations.find((entry) => entry.member.kind === kind && entry.row != null && !entry.member.retiredReason
|
|
110677
|
+
const observed = observations.find((entry) => entry.member.kind === kind && entry.row != null && !entry.member.retiredReason);
|
|
110529
110678
|
return observed?.row?.trigger_px != null ? String(observed.row.trigger_px) : null;
|
|
110530
110679
|
};
|
|
110531
110680
|
for (const step of nativeAfterFillActions({
|
|
@@ -110713,7 +110862,7 @@ var init_native_protection_device = __esm({
|
|
|
110713
110862
|
members.push(moveMade(member));
|
|
110714
110863
|
continue;
|
|
110715
110864
|
}
|
|
110716
|
-
if ((owesMove(member) || follows(member)) && movable && !member.retiredReason &&
|
|
110865
|
+
if ((owesMove(member) || follows(member)) && movable && !member.retiredReason && !member.pendingModify && nativePlacementGate({
|
|
110717
110866
|
eventMs: Math.max(owesMove(member) ? member.pendingMove?.afterMs ?? 0 : 0, member.placedAtMs ?? 0),
|
|
110718
110867
|
position: position.size,
|
|
110719
110868
|
positionStateMs: stateMs,
|
|
@@ -110752,11 +110901,11 @@ var init_native_protection_device = __esm({
|
|
|
110752
110901
|
}
|
|
110753
110902
|
anyResting = true;
|
|
110754
110903
|
members.push(
|
|
110755
|
-
movable && priceNow && member.priced == null && !owesMove(member) && !member.pendingModify && !member.retiredReason
|
|
110904
|
+
movable && priceNow && member.priced == null && !owesMove(member) && !member.pendingModify && !member.retiredReason ? { ...member, priced: priceNow } : member
|
|
110756
110905
|
);
|
|
110757
110906
|
continue;
|
|
110758
110907
|
}
|
|
110759
|
-
if (member.retiredReason
|
|
110908
|
+
if (member.retiredReason) {
|
|
110760
110909
|
members.push(member);
|
|
110761
110910
|
continue;
|
|
110762
110911
|
}
|
|
@@ -110765,20 +110914,11 @@ var init_native_protection_device = __esm({
|
|
|
110765
110914
|
members.push(member);
|
|
110766
110915
|
continue;
|
|
110767
110916
|
}
|
|
110768
|
-
|
|
110769
|
-
|
|
110770
|
-
|
|
110771
|
-
|
|
110772
|
-
|
|
110773
|
-
if (io.endsPass?.(error48)) throw error48;
|
|
110774
|
-
anyResting = true;
|
|
110775
|
-
members.push(member);
|
|
110776
|
-
continue;
|
|
110777
|
-
}
|
|
110778
|
-
if (cancelledByUser) {
|
|
110779
|
-
members.push({ ...member, userCancelledOrderId: member.orderId });
|
|
110780
|
-
continue;
|
|
110781
|
-
}
|
|
110917
|
+
const memberUserCancel = member.orderId == null ? false : await endedByUserCancel(io, member.orderId);
|
|
110918
|
+
if (memberUserCancel !== false) {
|
|
110919
|
+
if (memberUserCancel == null) anyResting = true;
|
|
110920
|
+
members.push(memberUserCancel ? { ...member, retiredReason: CANCELLED_BY_USER } : member);
|
|
110921
|
+
continue;
|
|
110782
110922
|
}
|
|
110783
110923
|
if (member.plannedAfterMs != null) {
|
|
110784
110924
|
if (!kindEnabled(member)) continue;
|
|
@@ -110971,7 +111111,7 @@ var init_native_protection_device = __esm({
|
|
|
110971
111111
|
let lot = prior;
|
|
110972
111112
|
const restingRow = lot.orderId == null ? null : page.find((order) => order.oid === lot.orderId) ?? null;
|
|
110973
111113
|
const otherSideUnnamed = lot.retiredReason === TRAILING_LOT_OTHER_SIDE && lot.mutationId != null && lot.orderId == null;
|
|
110974
|
-
if (
|
|
111114
|
+
if (lot.retiredReason && !otherSideUnnamed && !(restingRow && readListedProtectiveRow({ triggerCondition: restingRow.trigger_condition }) === "resting")) {
|
|
110975
111115
|
lots.push(lot);
|
|
110976
111116
|
continue;
|
|
110977
111117
|
}
|
|
@@ -111111,7 +111251,7 @@ var init_native_protection_device = __esm({
|
|
|
111111
111251
|
lots.push(lot);
|
|
111112
111252
|
continue;
|
|
111113
111253
|
}
|
|
111114
|
-
if (lot.retiredReason
|
|
111254
|
+
if (lot.retiredReason) {
|
|
111115
111255
|
lots.push(lot);
|
|
111116
111256
|
continue;
|
|
111117
111257
|
}
|
|
@@ -111135,6 +111275,12 @@ var init_native_protection_device = __esm({
|
|
|
111135
111275
|
}
|
|
111136
111276
|
continue;
|
|
111137
111277
|
}
|
|
111278
|
+
const lotUserCancel = await endedByUserCancel(io, lotOrderId);
|
|
111279
|
+
if (lotUserCancel !== false) {
|
|
111280
|
+
if (lotUserCancel == null) anyResting = true;
|
|
111281
|
+
lots.push(lotUserCancel ? { ...lot, retiredReason: CANCELLED_BY_USER } : lot);
|
|
111282
|
+
continue;
|
|
111283
|
+
}
|
|
111138
111284
|
const evidence2 = await io.readOrderStatus(lotOrderId);
|
|
111139
111285
|
const end = classifyNativeOrderEnd({
|
|
111140
111286
|
orderStatus: evidence2.responseValid ? String(evidence2.orderStatus ?? "") : "",
|
|
@@ -111195,7 +111341,7 @@ var init_native_protection_device = __esm({
|
|
|
111195
111341
|
});
|
|
111196
111342
|
|
|
111197
111343
|
// lib/runtime/runtime-execution.ts
|
|
111198
|
-
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, clientOrderNeverLandsAfterMs, requireClientRuntimeConfigSeconds, 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, 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;
|
|
111344
|
+
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, clientOrderNeverLandsAfterMs, requireClientRuntimeConfigSeconds, 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;
|
|
111199
111345
|
var init_runtime_execution = __esm({
|
|
111200
111346
|
"lib/runtime/runtime-execution.ts"() {
|
|
111201
111347
|
"use strict";
|
|
@@ -111212,6 +111358,8 @@ var init_runtime_execution = __esm({
|
|
|
111212
111358
|
init_client_runtime_ownership_errors();
|
|
111213
111359
|
init_api2();
|
|
111214
111360
|
init_client_exchange_mutations();
|
|
111361
|
+
init_client_user_cancels();
|
|
111362
|
+
init_protective_user_cancels();
|
|
111215
111363
|
init_hyperliquid_order_status();
|
|
111216
111364
|
init_execution_capacity();
|
|
111217
111365
|
init_protective_actions();
|
|
@@ -111535,7 +111683,6 @@ var init_runtime_execution = __esm({
|
|
|
111535
111683
|
return [];
|
|
111536
111684
|
}
|
|
111537
111685
|
const replacedOrderId = legRecord.replacedOrderId == null ? void 0 : Number(legRecord.replacedOrderId);
|
|
111538
|
-
const userCancelledOrderId = legRecord.userCancelledOrderId == null ? void 0 : Number(legRecord.userCancelledOrderId);
|
|
111539
111686
|
const replaceJournalRecord = legRecord.replaceJournal;
|
|
111540
111687
|
let replaceJournal;
|
|
111541
111688
|
if (replaceJournalRecord != null) {
|
|
@@ -111553,7 +111700,7 @@ var init_runtime_execution = __esm({
|
|
|
111553
111700
|
...journalObservedAtMs !== void 0 ? { unknownOidObservedAtMs: journalObservedAtMs } : {}
|
|
111554
111701
|
};
|
|
111555
111702
|
}
|
|
111556
|
-
if (replacedOrderId !== void 0 && (!Number.isSafeInteger(replacedOrderId) || replacedOrderId <= 0)
|
|
111703
|
+
if (replacedOrderId !== void 0 && (!Number.isSafeInteger(replacedOrderId) || replacedOrderId <= 0)) {
|
|
111557
111704
|
protectiveGroupReadFailures.add(key);
|
|
111558
111705
|
return [];
|
|
111559
111706
|
}
|
|
@@ -111599,7 +111746,6 @@ var init_runtime_execution = __esm({
|
|
|
111599
111746
|
...evidenceWait,
|
|
111600
111747
|
...replacedOrderId !== void 0 ? { replacedOrderId } : {},
|
|
111601
111748
|
...replaceJournal ? { replaceJournal } : {},
|
|
111602
|
-
...userCancelledOrderId !== void 0 ? { userCancelledOrderId } : {},
|
|
111603
111749
|
...replacement ? { replacement } : {}
|
|
111604
111750
|
}];
|
|
111605
111751
|
});
|
|
@@ -114508,6 +114654,7 @@ var init_runtime_execution = __esm({
|
|
|
114508
114654
|
const symbol2 = request.executionContext.symbol;
|
|
114509
114655
|
const walletAddress = String(request.executionContext.walletAddress || "").trim();
|
|
114510
114656
|
const exitSide = isLong ? "sell" : "buy";
|
|
114657
|
+
const userCancels = passUserCancelsFor(request);
|
|
114511
114658
|
const common = {
|
|
114512
114659
|
profileId: request.profileId,
|
|
114513
114660
|
...clientProtectiveMutationAuthority(request),
|
|
@@ -114620,7 +114767,7 @@ var init_runtime_execution = __esm({
|
|
|
114620
114767
|
neverLandsAfterMs: (sentAtMs) => clientOrderNeverLandsAfterMs(request.config, { kind: "absent", ageStartMs: sentAtMs }),
|
|
114621
114768
|
// A Server bot's writes are VTX's own: its refused places are not bounded as a device's are.
|
|
114622
114769
|
vtxSigns: request.executionMode === "server",
|
|
114623
|
-
...
|
|
114770
|
+
...userCancels ? { userCancelledOrder: userCancels.cancelled, prefetchUserCancels: userCancels.prefetch } : {},
|
|
114624
114771
|
newMutationId: () => createRuntimeId().toLowerCase(),
|
|
114625
114772
|
nowMs: () => Date.now(),
|
|
114626
114773
|
persist: (record6) => writeNativeProtectionRecord(String(request.profileId).trim(), symbol2, record6),
|
|
@@ -115145,10 +115292,10 @@ var init_runtime_execution = __esm({
|
|
|
115145
115292
|
const resolveLostClientProtectiveLeg = async (group, waitingLeg, botCleanupInFlight, terminalStatus) => {
|
|
115146
115293
|
const { freshEvidenceSinceMs: _waitedSinceMs, ...leg } = waitingLeg;
|
|
115147
115294
|
const botCleanup = botCleanupInFlight || leg.replacement != null;
|
|
115148
|
-
let cancelledByUser =
|
|
115149
|
-
if (!
|
|
115295
|
+
let cancelledByUser = false;
|
|
115296
|
+
if (!botCleanup && userCancels) {
|
|
115150
115297
|
try {
|
|
115151
|
-
cancelledByUser = await
|
|
115298
|
+
cancelledByUser = await userCancels.cancelled(leg.orderId);
|
|
115152
115299
|
} catch (error48) {
|
|
115153
115300
|
if (request.signal?.aborted) throw error48;
|
|
115154
115301
|
return {
|
|
@@ -115486,6 +115633,8 @@ var init_runtime_execution = __esm({
|
|
|
115486
115633
|
lookedUp,
|
|
115487
115634
|
unresolved: unresolvedLegIds
|
|
115488
115635
|
});
|
|
115636
|
+
const userCancels = passUserCancelsFor(request);
|
|
115637
|
+
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)));
|
|
115489
115638
|
groupLoop: for (let groupIndex = 0; groupIndex < inspectedGroups.length; groupIndex += 1) {
|
|
115490
115639
|
const inspected = inspectedGroups[groupIndex];
|
|
115491
115640
|
let durableGroup = inspected.group;
|
|
@@ -116343,6 +116492,16 @@ var init_runtime_execution = __esm({
|
|
|
116343
116492
|
SERVER_NATIVE_LEGACY_REFUSAL = "native_protection_legacy_position";
|
|
116344
116493
|
isServerNativeLegacyRefusal = (error48) => Boolean(error48 && typeof error48 === "object") && error48.code === SERVER_NATIVE_LEGACY_REFUSAL;
|
|
116345
116494
|
serverUserCancelLookup = null;
|
|
116495
|
+
passUserCancelsFor = (request) => {
|
|
116496
|
+
const profileId = String(request.profileId).trim();
|
|
116497
|
+
const lookup = serverUserCancelLookup;
|
|
116498
|
+
if (request.executionMode === "server") {
|
|
116499
|
+
return lookup ? passUserCancels(readEachUserCancel((orderId) => lookup(profileId, orderId), request.signal), { signal: request.signal }) : null;
|
|
116500
|
+
}
|
|
116501
|
+
return passUserCancels(async (orderIds) => ({ cancelled: await readClientUserCancels(profileId, orderIds, request.signal) }), {
|
|
116502
|
+
signal: request.signal
|
|
116503
|
+
});
|
|
116504
|
+
};
|
|
116346
116505
|
serverModeProtectionOwner = "server";
|
|
116347
116506
|
runtimeProtectionOwners = /* @__PURE__ */ new WeakMap();
|
|
116348
116507
|
resolveRuntimeProtectionOwner = (request) => {
|
|
@@ -116903,8 +117062,7 @@ var init_runtime_execution = __esm({
|
|
|
116903
117062
|
// A trailing stop keeps its own distance under the server (client_protective_adoption.py plan_risk).
|
|
116904
117063
|
...leg.trailingRisk ? { risk_mode: leg.trailingRisk.mode, risk_value: String(leg.trailingRisk.value) } : {},
|
|
116905
117064
|
// A stop re-placed once stays re-placed once under the server.
|
|
116906
|
-
...leg.replacedOrderId != null ? { replaced_order_id: String(leg.replacedOrderId) } : {}
|
|
116907
|
-
...leg.userCancelledOrderId != null ? { user_cancelled_order_id: String(leg.userCancelledOrderId) } : {}
|
|
117065
|
+
...leg.replacedOrderId != null ? { replaced_order_id: String(leg.replacedOrderId) } : {}
|
|
116908
117066
|
})),
|
|
116909
117067
|
...group.pendingEntry && group.legs.length === 0 ? [
|
|
116910
117068
|
...group.pendingEntry.stopLoss.enabled ? [{
|
|
@@ -119680,7 +119838,7 @@ var init_browser_observability = __esm({
|
|
|
119680
119838
|
init_define_VTX_GROK_POLICY();
|
|
119681
119839
|
init_define_VTX_PI_MODEL_POLICY();
|
|
119682
119840
|
init_runtime_policy_generated2();
|
|
119683
|
-
CLIENT_SOURCE_VERSION = typeof process !== "undefined" && true && "
|
|
119841
|
+
CLIENT_SOURCE_VERSION = typeof process !== "undefined" && true && "3ff286d7fc6667e818cc519c84b33e40f68d2161".trim() && "3ff286d7fc6667e818cc519c84b33e40f68d2161".trim() !== "unstamped" ? "3ff286d7fc6667e818cc519c84b33e40f68d2161".trim() : null;
|
|
119684
119842
|
listenersInstalled = false;
|
|
119685
119843
|
state = {
|
|
119686
119844
|
loadedAtMs: Date.now(),
|
|
@@ -124652,8 +124810,8 @@ var init_candle_prompt_contract = __esm({
|
|
|
124652
124810
|
throw new Error("Candle prompt rows must be ordered by timestamp");
|
|
124653
124811
|
}
|
|
124654
124812
|
}
|
|
124655
|
-
const
|
|
124656
|
-
const openIndexes = timestamps.map((timestamp, index) => timestamp
|
|
124813
|
+
const newestOpenTimestamp = timestamps[timestamps.length - 1];
|
|
124814
|
+
const openIndexes = timestamps.map((timestamp, index) => candleClosedInSeries(timestamp, newestOpenTimestamp, intervalSeconds, asOfTimestamp) ? -1 : index).filter((index) => index >= 0);
|
|
124657
124815
|
if (openIndexes.length === 0) {
|
|
124658
124816
|
return projected;
|
|
124659
124817
|
}
|
|
@@ -124680,7 +124838,7 @@ var init_candle_prompt_contract = __esm({
|
|
|
124680
124838
|
if (intervalSeconds === void 0 || lastOpenTimestamp === void 0) {
|
|
124681
124839
|
return 0;
|
|
124682
124840
|
}
|
|
124683
|
-
const lastIsClosed = lastOpenTimestamp
|
|
124841
|
+
const lastIsClosed = candleClosedInSeries(lastOpenTimestamp, lastOpenTimestamp, intervalSeconds, input.asOfTimestamp);
|
|
124684
124842
|
return lastIsClosed ? input.openTimestamps.length : input.openTimestamps.length - 1;
|
|
124685
124843
|
};
|
|
124686
124844
|
calculateRelativeVolumeSeries = (input) => {
|
|
@@ -125934,7 +126092,8 @@ var init_market_context = __esm({
|
|
|
125934
126092
|
if (timeframeSeconds === void 0) {
|
|
125935
126093
|
throw new RuntimeReasonError(`Unsupported candle timeframe: ${timeframe}`, "internal_data_error");
|
|
125936
126094
|
}
|
|
125937
|
-
const
|
|
126095
|
+
const newestOpen = candles[candles.length - 1].timestamp;
|
|
126096
|
+
const lastIsClosed = candleClosedInSeries(newestOpen, newestOpen, timeframeSeconds, asOf);
|
|
125938
126097
|
const statsWindow = lastIsClosed ? candles : candles.slice(0, -1);
|
|
125939
126098
|
if (statsWindow.length > 0) {
|
|
125940
126099
|
const features = extractWindowFeatures(statsWindow, input.lookbacks[timeframe]);
|
|
@@ -132897,9 +133056,9 @@ var init_local_analysis = __esm({
|
|
|
132897
133056
|
RUNTIME_SOURCE_DEFINITION_VERSION = "runtime-source-v1";
|
|
132898
133057
|
DECISION_INPUT_DEFINITION_VERSION = "decision-input-v1";
|
|
132899
133058
|
CONTEXT_ENVELOPE_DEFINITION_VERSION = "context-envelope-v2.1";
|
|
132900
|
-
CLIENT_RUNTIME_SOURCE_VERSION = typeof process !== "undefined" && true && "
|
|
132901
|
-
"
|
|
132902
|
-
) ? "
|
|
133059
|
+
CLIENT_RUNTIME_SOURCE_VERSION = typeof process !== "undefined" && true && "3ff286d7fc6667e818cc519c84b33e40f68d2161".trim() && !["unknown", "unstamped", "development"].includes(
|
|
133060
|
+
"3ff286d7fc6667e818cc519c84b33e40f68d2161".trim().toLowerCase()
|
|
133061
|
+
) ? "3ff286d7fc6667e818cc519c84b33e40f68d2161".trim() : null;
|
|
132903
133062
|
CLIENT_MAIN_PROMPT_RENDERER = "client_runtime.buildLocalRuntimePromptArtifacts:v1";
|
|
132904
133063
|
CLIENT_REVIEW_PROMPT_RENDERER = "client_runtime.review_prompt_assembly:v1";
|
|
132905
133064
|
resolveEffectivePromptRuntimeProvenance = (input) => ({
|