@vtxmacro/cli 2026.10.57 → 2026.10.58
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/vtx-mcp.js +1 -1
- package/bin/vtx-service-bootstrap.js +1 -1
- package/bin/vtx.js +65 -35
- package/package.json +1 -1
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.58", 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
|
|
|
@@ -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.58", 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 = {
|
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.58", 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
|
|
|
@@ -105711,7 +105711,7 @@ var init_protective_leg_evidence = __esm({
|
|
|
105711
105711
|
});
|
|
105712
105712
|
|
|
105713
105713
|
// lib/runtime/protective-entry-cover.ts
|
|
105714
|
-
var protectiveEntryCover, protectiveEntryLegSize;
|
|
105714
|
+
var protectiveLegCoverSize, boundOffThePage, liveStopCoverOnPage, protectiveEntryCoverLegs, protectiveEntryCover, protectiveEntryLegSize;
|
|
105715
105715
|
var init_protective_entry_cover = __esm({
|
|
105716
105716
|
"lib/runtime/protective-entry-cover.ts"() {
|
|
105717
105717
|
"use strict";
|
|
@@ -105719,10 +105719,35 @@ var init_protective_entry_cover = __esm({
|
|
|
105719
105719
|
init_define_VTX_EXO_POLICY();
|
|
105720
105720
|
init_define_VTX_GROK_POLICY();
|
|
105721
105721
|
init_define_VTX_PI_MODEL_POLICY();
|
|
105722
|
+
protectiveLegCoverSize = (leg, restingSize = leg.size) => leg.replacement != null && leg.replacement.size < restingSize ? leg.replacement.size : restingSize;
|
|
105723
|
+
boundOffThePage = (orderId, liveOrderIds) => typeof orderId === "number" && !liveOrderIds.has(String(orderId));
|
|
105724
|
+
liveStopCoverOnPage = (input) => {
|
|
105725
|
+
const closeSides = input.positionSize > 0 ? ["a", "sell"] : ["b", "buy"];
|
|
105726
|
+
const liveOrderIds = new Set(input.orders.map((order) => String(order.oid)));
|
|
105727
|
+
const leaving = new Set(input.groups.filter((group) => group.cleanupRequired === true || group.legs.some((leg) => boundOffThePage(leg.orderId, liveOrderIds))).flatMap((group) => group.legs));
|
|
105728
|
+
const legs = input.groups.flatMap((group) => group.legs);
|
|
105729
|
+
return input.orders.filter((order) => !input.excludedOrderIds.has(String(order.oid)) && String(order.coin).trim().toUpperCase() === input.symbol.trim().toUpperCase() && order.reduce_only && order.is_trigger && order.trigger_kind === "sl" && closeSides.includes(String(order.side).trim().toLowerCase())).reduce((total, order) => {
|
|
105730
|
+
const size = Number(order.sz);
|
|
105731
|
+
const leg = legs.find((candidate) => candidate.orderId === order.oid);
|
|
105732
|
+
if (!(size > 0) || leg != null && leaving.has(leg)) return total;
|
|
105733
|
+
return total + (leg == null ? size : protectiveLegCoverSize(leg, size));
|
|
105734
|
+
}, 0);
|
|
105735
|
+
};
|
|
105736
|
+
protectiveEntryCoverLegs = (groups2, entryIsLong, neverLanded) => groups2.filter((group) => group.isLong === entryIsLong).flatMap((group) => group.legs.map((leg) => ({
|
|
105737
|
+
isLong: group.isLong,
|
|
105738
|
+
kind: leg.kind,
|
|
105739
|
+
size: protectiveLegCoverSize(leg),
|
|
105740
|
+
orderId: typeof leg.orderId === "number" ? leg.orderId : null,
|
|
105741
|
+
canStillExist: !neverLanded(group, leg),
|
|
105742
|
+
beingCancelled: group.cleanupRequired === true,
|
|
105743
|
+
group: group.entryOrderId
|
|
105744
|
+
})));
|
|
105722
105745
|
protectiveEntryCover = (input) => {
|
|
105723
105746
|
const cover = { sl: 0, tp: 0 };
|
|
105747
|
+
const groupsOffThePage = new Set(input.storedLegs.filter((leg) => leg.group != null && boundOffThePage(leg.orderId, input.liveOrderIds)).map((leg) => leg.group));
|
|
105724
105748
|
for (const leg of input.storedLegs) {
|
|
105725
105749
|
if (leg.isLong !== input.entryIsLong || leg.beingCancelled === true) continue;
|
|
105750
|
+
if (leg.group != null && groupsOffThePage.has(leg.group)) continue;
|
|
105726
105751
|
const rests = leg.orderId == null ? leg.canStillExist : input.liveOrderIds.has(String(leg.orderId));
|
|
105727
105752
|
if (rests) cover[leg.kind] += leg.size;
|
|
105728
105753
|
}
|
|
@@ -105757,6 +105782,7 @@ var init_protective_oversized_leg = __esm({
|
|
|
105757
105782
|
});
|
|
105758
105783
|
|
|
105759
105784
|
// lib/runtime/protective-report-entry.ts
|
|
105785
|
+
var executedProtectiveReport;
|
|
105760
105786
|
var init_protective_report_entry = __esm({
|
|
105761
105787
|
"lib/runtime/protective-report-entry.ts"() {
|
|
105762
105788
|
"use strict";
|
|
@@ -105764,6 +105790,18 @@ var init_protective_report_entry = __esm({
|
|
|
105764
105790
|
init_define_VTX_EXO_POLICY();
|
|
105765
105791
|
init_define_VTX_GROK_POLICY();
|
|
105766
105792
|
init_define_VTX_PI_MODEL_POLICY();
|
|
105793
|
+
executedProtectiveReport = (input) => ({
|
|
105794
|
+
order_id: input.orderId,
|
|
105795
|
+
...input.clientMutationId !== void 0 ? { client_mutation_id: input.clientMutationId } : {},
|
|
105796
|
+
symbol: input.symbol,
|
|
105797
|
+
action: input.action,
|
|
105798
|
+
status: "executed",
|
|
105799
|
+
execution_metadata: {
|
|
105800
|
+
...input.metadata,
|
|
105801
|
+
protected_size: input.protectedSize,
|
|
105802
|
+
position_tpsl: input.positionTpsl
|
|
105803
|
+
}
|
|
105804
|
+
});
|
|
105767
105805
|
}
|
|
105768
105806
|
});
|
|
105769
105807
|
|
|
@@ -107806,7 +107844,7 @@ var init_native_protection_device = __esm({
|
|
|
107806
107844
|
});
|
|
107807
107845
|
|
|
107808
107846
|
// lib/runtime/runtime-execution.ts
|
|
107809
|
-
var clientProtectiveMutationAuthority, executionReadPriority, serverEntryLeverageAlreadyHeld, fetchClientRuntimeOpenOrders, 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, pendingProtectiveReplacementReport, isConfiguredProtectionRequested, protectiveAction,
|
|
107847
|
+
var clientProtectiveMutationAuthority, executionReadPriority, serverEntryLeverageAlreadyHeld, fetchClientRuntimeOpenOrders, 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, pendingProtectiveReplacementReport, isConfiguredProtectionRequested, protectiveAction, 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, modifyClientTrailingLeg, trailingRatchetIo, isDefinitiveEntryRejection, resolveExchangeSizeDecimals, roundAssetSize, resolvePositionSize, readServerOrderMarkPrice, serverOrderMetadataRetry, resolveCurrentPositionSize, buildPositionSnapshot, signedRemainingExposureAfterConfirmedReduction, 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, listPendingClientProtectiveSymbols, listStoredClientProtectiveSymbols, hasUnresolvedClientProtectiveIdentity, resolveClientProtectiveIdentitiesForAdoption, exportClientProtectiveGroupsForAdoption, adoptionGroupKey, applyClientProtectiveAdoptionOutcomes, hasStoredClientProtectiveGroupsForWallet, hasPendingClientProtectiveGroups, recoverManualClientProtectiveGroups, listStoredClientProtectionSymbols, clientRuntimeDecisionSizesOrders, COMMITTED_EXECUTION_REPORTS, COMMITTED_DECISION_ORDER, getCommittedExecutionReports, getCommittedDecisionOrder, withCommittedExecutionReports, executeClientRuntimeDecisionUnlocked;
|
|
107810
107848
|
var init_runtime_execution = __esm({
|
|
107811
107849
|
"lib/runtime/runtime-execution.ts"() {
|
|
107812
107850
|
"use strict";
|
|
@@ -108864,18 +108902,6 @@ var init_runtime_execution = __esm({
|
|
|
108864
108902
|
input.executionContext.takeProfitMode === "usdc" ? input.executionContext.takeProfitUsdc : input.executionContext.takeProfitPct
|
|
108865
108903
|
) > 0);
|
|
108866
108904
|
protectiveAction = (leg) => leg.kind === "sl" ? "AUTO_SL" : "AUTO_TP";
|
|
108867
|
-
executedProtectiveReport = (input) => ({
|
|
108868
|
-
order_id: input.orderId,
|
|
108869
|
-
...input.clientMutationId !== void 0 ? { client_mutation_id: input.clientMutationId } : {},
|
|
108870
|
-
symbol: input.symbol,
|
|
108871
|
-
action: input.action,
|
|
108872
|
-
status: "executed",
|
|
108873
|
-
execution_metadata: {
|
|
108874
|
-
...input.metadata,
|
|
108875
|
-
protected_size: input.protectedSize,
|
|
108876
|
-
position_tpsl: input.positionTpsl
|
|
108877
|
-
}
|
|
108878
|
-
});
|
|
108879
108905
|
isExactClientPositionTpslPair = (legs) => legs.length === CLIENT_PROTECTIVE_TPSL_PAIR_LEGS && legs.every((leg) => leg.positionTpsl === true) && new Set(legs.map((leg) => leg.kind)).size === CLIENT_PROTECTIVE_TPSL_PAIR_LEGS;
|
|
108880
108906
|
deviceOwnsClientProtectiveLegKind = (group, kind) => group.deviceOwnedLegKinds == null || group.deviceOwnedLegKinds.includes(kind);
|
|
108881
108907
|
isAdoptionNarrowedPositionTpslLeg = (group) => group.deviceOwnedLegKinds?.length === 1 && group.legs.length === 1 && group.legs[0].positionTpsl === true && group.legs[0].kind === group.deviceOwnedLegKinds[0];
|
|
@@ -109093,14 +109119,11 @@ var init_runtime_execution = __esm({
|
|
|
109093
109119
|
};
|
|
109094
109120
|
attachmentMemberNeverLanded = (group, leg) => group.attachmentJournal?.members.some((member) => member.clientOrderId === leg.orderId && member.neverLandedAtMs != null) === true;
|
|
109095
109121
|
storedClientProtectiveCover = async (request, entryIsLong, groups2) => {
|
|
109096
|
-
const storedLegs =
|
|
109097
|
-
|
|
109098
|
-
|
|
109099
|
-
|
|
109100
|
-
|
|
109101
|
-
canStillExist: !attachmentMemberNeverLanded(group, leg),
|
|
109102
|
-
beingCancelled: group.cleanupRequired === true
|
|
109103
|
-
})));
|
|
109122
|
+
const storedLegs = protectiveEntryCoverLegs(
|
|
109123
|
+
groups2,
|
|
109124
|
+
entryIsLong,
|
|
109125
|
+
(group, leg) => attachmentMemberNeverLanded(group, leg)
|
|
109126
|
+
);
|
|
109104
109127
|
const liveOrderIds = /* @__PURE__ */ new Set();
|
|
109105
109128
|
if (storedLegs.some((leg) => !leg.beingCancelled)) {
|
|
109106
109129
|
const symbol2 = request.executionContext.symbol.trim().toUpperCase();
|
|
@@ -109652,6 +109675,8 @@ var init_runtime_execution = __esm({
|
|
|
109652
109675
|
metadata: {
|
|
109653
109676
|
trigger_price: candidates[index].triggerPrice,
|
|
109654
109677
|
entry_order_id: fill.orderId,
|
|
109678
|
+
// Names the entry's row while VTX knows it only by its mutation (its outcome unknown).
|
|
109679
|
+
entry_mutation_id: plan.entryMutationId,
|
|
109655
109680
|
entry_filled_size: fill.filledSize,
|
|
109656
109681
|
entry_average_price: fill.averagePrice
|
|
109657
109682
|
}
|
|
@@ -111874,7 +111899,7 @@ var init_runtime_execution = __esm({
|
|
|
111874
111899
|
};
|
|
111875
111900
|
const retainedGroups = expectedGroupSet.filter((group) => group.pendingEntry != null || isProtectiveReplacementJournalGroup(group));
|
|
111876
111901
|
let stopSizePlacedThisPass = 0;
|
|
111877
|
-
const unresolvedStopSize = inspectedGroups.flatMap((candidate) => candidate.legs).filter((entry) => entry.leg.kind === "sl" && entry.state === "unresolved" && !liveOrders.some((order) => order.oid === entry.leg.orderId)).reduce((total, entry) => total + entry.leg.size, 0);
|
|
111902
|
+
const unresolvedStopSize = inspectedGroups.flatMap((candidate) => candidate.legs).filter((entry) => entry.leg.kind === "sl" && entry.state === "unresolved" && !liveOrders.some((order) => order.oid === entry.leg.orderId)).reduce((total, entry) => total + (entry.leg.replacement != null ? 0 : entry.leg.size), 0);
|
|
111878
111903
|
const lostOrderIds = new Set(
|
|
111879
111904
|
inspectedGroups.flatMap((candidate) => candidate.legs).filter((entry) => entry.state === "terminal").map((entry) => String(entry.leg.orderId))
|
|
111880
111905
|
);
|
|
@@ -111929,10 +111954,6 @@ var init_runtime_execution = __esm({
|
|
|
111929
111954
|
}
|
|
111930
111955
|
return { sentMs, freshOrders };
|
|
111931
111956
|
});
|
|
111932
|
-
const lostLegLiveStopSize = (freshOrders, positionSize) => {
|
|
111933
|
-
const freshIsLong = positionSize > 0;
|
|
111934
|
-
return freshOrders.filter((order) => !lostOrderIds.has(String(order.oid)) && String(order.coin).trim().toUpperCase() === symbol2.trim().toUpperCase() && order.reduce_only && order.is_trigger && order.trigger_kind === "sl" && (freshIsLong ? ["a", "sell"].includes(String(order.side).trim().toLowerCase()) : ["b", "buy"].includes(String(order.side).trim().toLowerCase()))).reduce((total, order) => total + (Number(order.sz) > 0 ? Number(order.sz) : 0), 0);
|
|
111935
|
-
};
|
|
111936
111957
|
const lostLegPositionEpisodeEnded = async (group, terminalStatus, positionSize, botCleanupInFlight, cancelledByUser) => {
|
|
111937
111958
|
if (terminalStatus == null || !episodeEndProofReachable({
|
|
111938
111959
|
orderStatus: terminalStatus.orderStatus,
|
|
@@ -112004,7 +112025,13 @@ var init_runtime_execution = __esm({
|
|
|
112004
112025
|
});
|
|
112005
112026
|
evidence = {
|
|
112006
112027
|
positionSize: position.positionSize,
|
|
112007
|
-
liveStopSize: replaceReachable ?
|
|
112028
|
+
liveStopSize: replaceReachable ? liveStopCoverOnPage({
|
|
112029
|
+
orders: (await readLostLegOrders()).freshOrders,
|
|
112030
|
+
symbol: symbol2,
|
|
112031
|
+
positionSize: position.positionSize,
|
|
112032
|
+
excludedOrderIds: lostOrderIds,
|
|
112033
|
+
groups: expectedGroupSet
|
|
112034
|
+
}) : 0,
|
|
112008
112035
|
markPrice: replaceReachable ? position.markPrice : null
|
|
112009
112036
|
};
|
|
112010
112037
|
} catch (error48) {
|
|
@@ -112377,7 +112404,7 @@ var init_runtime_execution = __esm({
|
|
|
112377
112404
|
if (state2 !== "open" || openOrder == null) {
|
|
112378
112405
|
remainingByKind[leg.kind] = Math.max(
|
|
112379
112406
|
0,
|
|
112380
|
-
remainingByKind[leg.kind] - leg
|
|
112407
|
+
remainingByKind[leg.kind] - protectiveLegCoverSize(leg)
|
|
112381
112408
|
);
|
|
112382
112409
|
retainedLegs.push(leg);
|
|
112383
112410
|
continue;
|
|
@@ -112410,7 +112437,10 @@ var init_runtime_execution = __esm({
|
|
|
112410
112437
|
Math.min(liveOrderSize, remainingByKind[leg.kind]),
|
|
112411
112438
|
request.executionContext.sizeDecimals
|
|
112412
112439
|
);
|
|
112413
|
-
remainingByKind[leg.kind] = Math.max(
|
|
112440
|
+
remainingByKind[leg.kind] = Math.max(
|
|
112441
|
+
0,
|
|
112442
|
+
remainingByKind[leg.kind] - Math.min(allowedSize, protectiveLegCoverSize(leg, liveOrderSize))
|
|
112443
|
+
);
|
|
112414
112444
|
if (allowedSize <= 0) {
|
|
112415
112445
|
const split3 = splitOversizedProtectiveLeg(expectedGroupSet, durableGroup, leg, exactClientProtectiveGroupSnapshot);
|
|
112416
112446
|
if (!replaceExactClientProtectiveGroupSet(profileId, symbol2, expectedGroupSet, split3.groups)) {
|
|
@@ -116397,7 +116427,7 @@ var init_browser_observability = __esm({
|
|
|
116397
116427
|
init_define_VTX_GROK_POLICY();
|
|
116398
116428
|
init_define_VTX_PI_MODEL_POLICY();
|
|
116399
116429
|
init_runtime_policy_generated2();
|
|
116400
|
-
CLIENT_SOURCE_VERSION = typeof process !== "undefined" && true && "
|
|
116430
|
+
CLIENT_SOURCE_VERSION = typeof process !== "undefined" && true && "8bf68d84db2d5f7bef90caab1c5161a2ef91085f".trim() && "8bf68d84db2d5f7bef90caab1c5161a2ef91085f".trim() !== "unstamped" ? "8bf68d84db2d5f7bef90caab1c5161a2ef91085f".trim() : null;
|
|
116401
116431
|
listenersInstalled = false;
|
|
116402
116432
|
state = {
|
|
116403
116433
|
loadedAtMs: Date.now(),
|
|
@@ -129202,9 +129232,9 @@ var init_local_analysis = __esm({
|
|
|
129202
129232
|
RUNTIME_SOURCE_DEFINITION_VERSION = "runtime-source-v1";
|
|
129203
129233
|
DECISION_INPUT_DEFINITION_VERSION = "decision-input-v1";
|
|
129204
129234
|
CONTEXT_ENVELOPE_DEFINITION_VERSION = "context-envelope-v2.1";
|
|
129205
|
-
CLIENT_RUNTIME_SOURCE_VERSION = typeof process !== "undefined" && true && "
|
|
129206
|
-
"
|
|
129207
|
-
) ? "
|
|
129235
|
+
CLIENT_RUNTIME_SOURCE_VERSION = typeof process !== "undefined" && true && "8bf68d84db2d5f7bef90caab1c5161a2ef91085f".trim() && !["unknown", "unstamped", "development"].includes(
|
|
129236
|
+
"8bf68d84db2d5f7bef90caab1c5161a2ef91085f".trim().toLowerCase()
|
|
129237
|
+
) ? "8bf68d84db2d5f7bef90caab1c5161a2ef91085f".trim() : null;
|
|
129208
129238
|
CLIENT_MAIN_PROMPT_RENDERER = "client_runtime.buildLocalRuntimePromptArtifacts:v1";
|
|
129209
129239
|
CLIENT_REVIEW_PROMPT_RENDERER = "client_runtime.review_prompt_assembly:v1";
|
|
129210
129240
|
resolveEffectivePromptRuntimeProvenance = (input) => ({
|