@vtxmacro/cli 2026.9.62 → 2026.9.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,7 +16,7 @@ import { fileURLToPath } from "node:url";
16
16
  // agent-cli-release.json
17
17
  var agent_cli_release_default = {
18
18
  package_name: "@vtxmacro/cli",
19
- package_version: "2026.9.62",
19
+ package_version: "2026.9.64",
20
20
  codex_package_name: "@openai/codex",
21
21
  codex_version: "0.155.0",
22
22
  copilot_sdk_package_name: "@github/copilot-sdk",
package/bin/vtx.js CHANGED
@@ -77,7 +77,7 @@ var init_agent_cli_release = __esm({
77
77
  "agent-cli-release.json"() {
78
78
  agent_cli_release_default = {
79
79
  package_name: "@vtxmacro/cli",
80
- package_version: "2026.9.62",
80
+ package_version: "2026.9.64",
81
81
  codex_package_name: "@openai/codex",
82
82
  codex_version: "0.155.0",
83
83
  copilot_sdk_package_name: "@github/copilot-sdk",
@@ -18174,7 +18174,7 @@ async function acquireInferenceHostProcessLock(path, dependencies = {}) {
18174
18174
  }
18175
18175
  };
18176
18176
  }
18177
- var loadInferenceReceiptDurabilityTimeoutMs, loadInferenceAgentDataRequestTimeoutMs, loadInferenceAgentCommandLockPolicy, InferenceHostProcessLockBusyError, INFERENCE_CREDENTIAL_NAMESPACE, MAX_INFERENCE_PRIVATE_FILE_BYTES, WINDOWS_PRIVATE_ACL_BROKER_SCRIPT, WINDOWS_IDENTITY_COMMAND_TIMEOUT_MS, WINDOWS_PRIVATE_ACL_BROKER_STARTUP_TIMEOUT_MS, SMALL_IDENTITY_COMMAND_TIMEOUT_MS, windowsPowerShellEnvironment, windowsPrivateAclBrokerInvocation, WindowsPrivateAclBroker, defaultWindowsPrivateAclBroker, runWindowsPrivateAcl, windowsAclCache, windowsAclIdentity, aclCacheKey, secureWindowsPrivatePath, invalidateWindowsAclCache, rebindHardenedWindowsAclAfterRename, rebindHardenedWindowsDirectoryAfterOwnedMutation, isDefaultWindowsPrivatePath, secureExistingWindowsPath, linuxProcessIdentity, windowsProcessIdentityInvocation, windowsBootIdentityInvocation, windowsProcessIdentity, darwinProcessIdentity, runSmallIdentityCommand, cachedSystemBootIdentity, readInferenceSystemBootIdentity, defaultProcessIdentity, defaultCurrentProcessIdentity, processLockObservationCache, inferenceProcessIdentitiesMatch, DEFAULT_INFERENCE_HOST_INSTANCE, SAFE_INFERENCE_HOST_INSTANCE, requireNamedInstancePath, credentialStoreIdentity, inferenceHostCredentialContextPath, inferenceHostCredentialContextTransitionPath, credentialContextForConfig, WINDOWS_PRIVATE_FILE_REPLACE_ERROR_CODES;
18177
+ var loadInferenceReceiptDurabilityTimeoutMs, loadInferenceAgentDataRequestTimeoutMs, loadInferenceAgentCommandLockPolicy, InferenceHostProcessLockBusyError, INFERENCE_CREDENTIAL_NAMESPACE, MAX_INFERENCE_PRIVATE_FILE_BYTES, WINDOWS_PRIVATE_ACL_BROKER_SCRIPT, WINDOWS_IDENTITY_COMMAND_TIMEOUT_MS, WINDOWS_PRIVATE_ACL_BROKER_STARTUP_TIMEOUT_MS, SMALL_IDENTITY_COMMAND_TIMEOUT_MS, windowsPowerShellEnvironment, windowsPrivateAclBrokerInvocation, WindowsPrivateAclBroker, defaultWindowsPrivateAclBroker, runWindowsPrivateAcl, windowsAclCache, windowsAclIdentity, aclCacheKey, secureWindowsPrivatePath, invalidateWindowsAclCache, rebindHardenedWindowsAclAfterRename, rebindHardenedWindowsDirectoryAfterOwnedMutation, isDefaultWindowsPrivatePath, secureExistingWindowsPath, linuxProcessIdentity, windowsProcessIdentityInvocation, windowsBootIdentityInvocation, windowsProcessIdentity, darwinProcessIdentity, runSmallIdentityCommand, cachedSystemBootIdentity, readInferenceSystemBootIdentity, defaultProcessIdentity, defaultCurrentProcessIdentity, readInferenceHostProcessLockStatus, processLockObservationCache, inferenceProcessIdentitiesMatch, DEFAULT_INFERENCE_HOST_INSTANCE, SAFE_INFERENCE_HOST_INSTANCE, requireNamedInstancePath, credentialStoreIdentity, inferenceHostCredentialContextPath, inferenceHostCredentialContextTransitionPath, credentialContextForConfig, WINDOWS_PRIVATE_FILE_REPLACE_ERROR_CODES;
18178
18178
  var init_config = __esm({
18179
18179
  "lib/inference-host/config.ts"() {
18180
18180
  "use strict";
@@ -18773,6 +18773,25 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
18773
18773
  if (!identity2) throw new Error("Inference host could not establish its process-start identity.");
18774
18774
  return identity2;
18775
18775
  };
18776
+ readInferenceHostProcessLockStatus = async (path) => {
18777
+ const raw = await readInferencePrivateFile(path, "Inference host process lock");
18778
+ if (raw === null) return { state: "not_running" };
18779
+ try {
18780
+ const owner2 = JSON.parse(raw);
18781
+ if (owner2.schema_version !== 2 || !Number.isSafeInteger(owner2.pid) || owner2.pid <= 0 || typeof owner2.process_identity !== "string" || typeof owner2.boot_identity !== "string") {
18782
+ return { state: "unknown" };
18783
+ }
18784
+ const [identity2, boot] = await Promise.all([
18785
+ defaultProcessIdentity(owner2.pid),
18786
+ readInferenceSystemBootIdentity()
18787
+ ]);
18788
+ if (boot !== owner2.boot_identity) return { state: "stale" };
18789
+ if (identity2 === null) return { state: "unknown" };
18790
+ return { state: identity2 === owner2.process_identity ? "running" : "stale" };
18791
+ } catch {
18792
+ return { state: "unknown" };
18793
+ }
18794
+ };
18776
18795
  processLockObservationCache = /* @__PURE__ */ new Map();
18777
18796
  inferenceProcessIdentitiesMatch = (stored, observed) => stored === observed;
18778
18797
  DEFAULT_INFERENCE_HOST_INSTANCE = "default";
@@ -44581,7 +44600,7 @@ async function runInferenceHostCli(argv2, env = process.env, dependencies = {})
44581
44600
  };
44582
44601
  }
44583
44602
  }
44584
- var INFERENCE_HOST_CLI_VERSION, runtimeReceiptPath, codexRecoveryPath, codexGuardianReceiptRoot, revocationCheckpointPath, foregroundHostLockPath, credentialLifecycleLockPath, serviceRecoveryCommandLockPath, AGENT_HEARTBEAT_INTERVAL_MS, AGENT_HEARTBEAT_MAX_RETRY_DELAY_MS, retryableAgentHeartbeatError, assertRevocationCheckpoint, readRevocationCheckpoint, writeRevocationCheckpoint, clearRevocationCheckpoint, render, INFERENCE_HOST_HELP, parseHostConcurrency, parseInferenceHostArgs, resolveDurableServiceDisplayName, defaultOpenBrowser, registerInferenceHostServiceControlInput, defaultRegisterLifecycleSignalHandlers, lifecycleCancellation, configuredCredentialStore, restoreInferenceHostCredentialContext, recoverInferenceHostCredentialContextTransition, accountKeyForState, assertCredentialMatchesState2, revocationCheckpointForCredential, assertRevocationCheckpointMatchesLocalIdentity, fileExistsPrivately, inspectCodexAuthentication, clearLocalRuntimeArtifacts, assertDurableServiceUninstalled, assertLocalRuntimeArtifactsMayBeDiscarded, defaultRunForeground, preparePortableDurableAdapter, prepareExoAdapter, defaultRunPortableDurableAdapter, login, codexLogin, codexLogout, grokAuthentication, deepSeekCredentialStore, deepSeekLogin, deepSeekLogout, piLogin, piLogout, exoLogin, exoLogout, localStatus, doctor, cleanupLogin, runHost, defaultReadStdin, parseAgentStdin, parseOptionalAgentStdin, agentOperationId, agentSession, agentConnect, foregroundAgentControlState, requireForegroundAgentState, assignmentFromClaim, foregroundAssignmentNext, foregroundAssignmentHeartbeat, foregroundDataCall, foregroundDecisionStatusRequest, foregroundAssignmentLeaseEnded, handleForegroundCancelledAssignment, foregroundDecisionStatus, foregroundDecisionSubmit, foregroundAssignmentRelease, agentRun, agentNext, agentComplete, agentFail, withAgentCommandLock, recoveryBackupPath, serviceRecoveryTransactionPath, readServiceRecoveryTransaction, assertResumableCodexRecoveryEvidence, recoverInstalledCodexService, serviceCommand, hasExplicitCredentialStoreConfiguration, credentialEnvironmentForIdentity, commandRequiresRetainedCredentialStore, commandUsesInstalledServiceCredentials, resolveInferenceHostCommandConfig;
44603
+ var INFERENCE_HOST_CLI_VERSION, runtimeReceiptPath, codexRecoveryPath, codexGuardianReceiptRoot, revocationCheckpointPath, foregroundHostLockPath, credentialLifecycleLockPath, serviceRecoveryCommandLockPath, AGENT_HEARTBEAT_INTERVAL_MS, AGENT_HEARTBEAT_MAX_RETRY_DELAY_MS, retryableAgentHeartbeatError, assertRevocationCheckpoint, readRevocationCheckpoint, writeRevocationCheckpoint, clearRevocationCheckpoint, render, INFERENCE_HOST_HELP, parseHostConcurrency, parseInferenceHostArgs, resolveDurableServiceDisplayName, defaultOpenBrowser, registerInferenceHostServiceControlInput, defaultRegisterLifecycleSignalHandlers, lifecycleCancellation, configuredCredentialStore, restoreInferenceHostCredentialContext, recoverInferenceHostCredentialContextTransition, accountKeyForState, assertCredentialMatchesState2, revocationCheckpointForCredential, assertRevocationCheckpointMatchesLocalIdentity, fileExistsPrivately, inspectCodexAuthentication, clearLocalRuntimeArtifacts, assertDurableServiceUninstalled, assertLocalRuntimeArtifactsMayBeDiscarded, defaultRunForeground, preparePortableDurableAdapter, prepareExoAdapter, defaultRunPortableDurableAdapter, login, codexLogin, codexLogout, grokAuthentication, deepSeekCredentialStore, deepSeekLogin, deepSeekLogout, piLogin, piLogout, exoLogin, exoLogout, localStatus, doctor, cleanupLogin, runHost, defaultReadStdin, parseAgentStdin, parseOptionalAgentStdin, agentOperationId, agentSession, agentConnect, foregroundAgentControlState, requireForegroundAgentState, assignmentFromClaim, foregroundAssignmentNext, foregroundAssignmentHeartbeat, foregroundDataCall, foregroundDecisionStatusRequest, foregroundAssignmentLeaseEnded, handleForegroundCancelledAssignment, foregroundDecisionFollowup, foregroundDecisionStatus, foregroundDecisionSubmit, foregroundAssignmentRelease, agentRun, agentNext, agentComplete, agentFail, withAgentCommandLock, recoveryBackupPath, serviceRecoveryTransactionPath, readServiceRecoveryTransaction, assertResumableCodexRecoveryEvidence, recoverInstalledCodexService, serviceCommand, hasExplicitCredentialStoreConfiguration, credentialEnvironmentForIdentity, commandRequiresRetainedCredentialStore, commandUsesInstalledServiceCredentials, resolveInferenceHostCommandConfig;
44585
44604
  var init_cli = __esm({
44586
44605
  "lib/inference-host/cli.ts"() {
44587
44606
  "use strict";
@@ -44704,7 +44723,7 @@ Commands:
44704
44723
  agent-assignment-heartbeat Renew the current Agent assignment
44705
44724
  agent-data-call Request allowed assignment-scoped VTX data
44706
44725
  agent-decision-submit Submit the normal structured trading decision
44707
- agent-decision-status Resolve an uncertain Agent decision submission
44726
+ agent-decision-status Read a submitted decision outcome or recover uncertain submission
44708
44727
  agent-assignment-release Release the current Agent assignment
44709
44728
  service Install and control the durable background host
44710
44729
  status Inspect local host and credential state
@@ -44724,6 +44743,8 @@ Common options:
44724
44743
  --provider ID Exact provider identity (pi-login or exo-login)
44725
44744
  --exo-root PATH Supported Exo checkout (Exo run/doctor only)
44726
44745
  --max-concurrency N Optional positive-integer local slot limit (default: unlimited)
44746
+ --operation-id ID --assignment-id ID --assignment-generation N
44747
+ Read an accepted decision receipt with agent-decision-status
44727
44748
  --help, -h Show this help
44728
44749
 
44729
44750
  If the OS credential store cannot retain the VTX grant, set
@@ -44776,6 +44797,9 @@ Durable service:
44776
44797
  let lines = 100;
44777
44798
  let serviceManifestPath = null;
44778
44799
  let forceRecovery = false;
44800
+ let decisionStatusOperationId = null;
44801
+ let decisionStatusAssignmentId = null;
44802
+ let decisionStatusAssignmentGeneration = null;
44779
44803
  const positionals = [];
44780
44804
  for (let index = 0; index < argv2.length; index += 1) {
44781
44805
  const argument = argv2[index];
@@ -44791,6 +44815,18 @@ Durable service:
44791
44815
  forceRecovery = true;
44792
44816
  continue;
44793
44817
  }
44818
+ if (["--operation-id", "--assignment-id", "--assignment-generation"].includes(argument)) {
44819
+ const raw = argv2[index + 1];
44820
+ const valid = raw && (argument === "--operation-id" ? /^[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$/u.test(raw) : argument === "--assignment-id" ? /^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/u.test(raw) : /^[0-9]+$/u.test(raw));
44821
+ if (!valid) throw new Error(`${argument} requires a valid receipt identifier.`);
44822
+ if (argument === "--operation-id") decisionStatusOperationId = raw;
44823
+ if (argument === "--assignment-id") decisionStatusAssignmentId = raw;
44824
+ if (argument === "--assignment-generation") {
44825
+ decisionStatusAssignmentGeneration = parseHostConcurrency(raw, argument);
44826
+ }
44827
+ index += 1;
44828
+ continue;
44829
+ }
44794
44830
  if (argument === "--max-concurrency") {
44795
44831
  const raw = argv2[index + 1];
44796
44832
  if (!raw) throw new Error("--max-concurrency requires a value.");
@@ -44848,6 +44884,14 @@ Durable service:
44848
44884
  throw new Error("Inference-host commands do not accept positional arguments.");
44849
44885
  }
44850
44886
  const command = positionals[1] || null;
44887
+ if (decisionStatusOperationId !== null || decisionStatusAssignmentId !== null || decisionStatusAssignmentGeneration !== null) {
44888
+ if (command !== "agent-decision-status") {
44889
+ throw new Error("Decision receipt options are accepted only by agent-decision-status.");
44890
+ }
44891
+ if (!decisionStatusOperationId || !decisionStatusAssignmentId || decisionStatusAssignmentGeneration === null) {
44892
+ throw new Error("Historical decision status requires --operation-id, --assignment-id, and --assignment-generation from the submission receipt.");
44893
+ }
44894
+ }
44851
44895
  if (providerId && !["pi-login", "exo-login"].includes(command ?? "")) {
44852
44896
  throw new Error("--provider is accepted only by pi-login or exo-login.");
44853
44897
  }
@@ -44884,7 +44928,10 @@ Durable service:
44884
44928
  lines,
44885
44929
  serviceAction,
44886
44930
  serviceManifestPath,
44887
- forceRecovery
44931
+ forceRecovery,
44932
+ decisionStatusOperationId,
44933
+ decisionStatusAssignmentId,
44934
+ decisionStatusAssignmentGeneration
44888
44935
  };
44889
44936
  };
44890
44937
  resolveDurableServiceDisplayName = (parsed, dependencies) => {
@@ -45733,6 +45780,12 @@ Waiting for approval...
45733
45780
  `${config2.supervisorStatePath}.service-recovery.json`,
45734
45781
  "Inference-host service recovery transaction"
45735
45782
  );
45783
+ const foregroundState = await readInferenceForegroundAgentControlState(config2.statePath);
45784
+ if (foregroundState && foregroundState.host_id !== state?.host_id) {
45785
+ throw new Error("Foreground Agent assignment belongs to another local host.");
45786
+ }
45787
+ const observedAt = (dependencies.now ?? (() => /* @__PURE__ */ new Date()))().toISOString();
45788
+ const keeperProcess = await readInferenceHostProcessLockStatus(foregroundHostLockPath(config2));
45736
45789
  const agentAttempt = await readInferenceAgentAttemptState(config2.statePath);
45737
45790
  const agentNextRecoveryPresent = await readInferenceAgentNextState(config2.statePath) !== null;
45738
45791
  const agentFailureFence = await readInferenceAgentFailureFence(config2.statePath);
@@ -45760,6 +45813,27 @@ Waiting for approval...
45760
45813
  response_mode: agentAttempt.response_mode,
45761
45814
  deadline_at: agentAttempt.deadline_at
45762
45815
  } : null,
45816
+ foreground_agent: {
45817
+ observed_at: observedAt,
45818
+ keeper_process: keeperProcess,
45819
+ server_heartbeat: "not_observed",
45820
+ scheduling_owner: "harness",
45821
+ assignment: foregroundState?.assignment ? {
45822
+ assignment_id: foregroundState.assignment.assignment_id,
45823
+ assignment_generation: foregroundState.assignment.assignment_generation,
45824
+ model_id: foregroundState.assignment.model_id,
45825
+ reasoning_effort: foregroundState.assignment.reasoning_effort,
45826
+ bot_mode: foregroundState.assignment.bot_mode,
45827
+ execution_mode: foregroundState.assignment.execution_mode,
45828
+ allowed_symbols: foregroundState.assignment.allowed_symbols,
45829
+ lease_expires_at: foregroundState.assignment.lease_expires_at,
45830
+ lease_elapsed_locally: Date.parse(foregroundState.assignment.lease_expires_at) <= Date.parse(observedAt)
45831
+ } : null,
45832
+ pending_claim: foregroundState?.pending_next !== null && foregroundState?.pending_next !== void 0,
45833
+ pending_decision_operation_id: foregroundState?.pending_decision?.request.operation_id ?? null,
45834
+ updated_at: foregroundState?.updated_at ?? null,
45835
+ note: "Local process and saved assignment observations only; not proof of a fresh server heartbeat, a scheduled check, or fresh market data."
45836
+ },
45763
45837
  agent_next_recovery_present: agentNextRecoveryPresent,
45764
45838
  agent_failure_fence: agentFailureFence ? {
45765
45839
  adapter: agentFailureFence.adapter_id,
@@ -46264,9 +46338,11 @@ Waiting for approval...
46264
46338
  response_modes: ["provider_response", "decision_candidate"],
46265
46339
  control_modes: ["provider", "agent"],
46266
46340
  execution_modes: ["client", "server"],
46267
- next_command: "vtx inference-host agent-next --wait-seconds 50 --json",
46341
+ next_command: "vtx inference-host agent-run",
46342
+ provider_next_command: "vtx inference-host agent-next --wait-seconds 50 --json",
46268
46343
  agent_next_command: "vtx inference-host agent-assignment-next --wait-seconds 50 --json",
46269
- keeper_command: "vtx inference-host agent-run"
46344
+ keeper_command: "vtx inference-host agent-run",
46345
+ instructions: "Keep agent-run open, then use agent_next_command for Agent mode or provider_next_command for Provider mode. Before promising recurring Agent checks, verify your harness can schedule the requested cadence. The keeper only renews liveness; market checks and optional decisions belong to your harness. Stopping the keeper or its schedule does not stop the bot; use authorized bot stop, then release the assignment and stop the keeper."
46270
46346
  }, parsed.json),
46271
46347
  stderr: warnings.length > 0 ? `${warnings.join("\n")}
46272
46348
  ` : ""
@@ -46517,11 +46593,30 @@ Waiting for approval...
46517
46593
  }
46518
46594
  await clearInferenceForegroundAgentControlState(config2.statePath);
46519
46595
  };
46596
+ foregroundDecisionFollowup = (parsed, request) => ({
46597
+ assignment_generation: request.assignment_generation,
46598
+ status_command: `vtx inference-host agent-decision-status --operation-id ${request.operation_id} --assignment-id ${request.assignment_id} --assignment-generation ${request.assignment_generation} --instance ${parsed.instanceName} --json`,
46599
+ outcome_note: "Submission acceptance is not consumption. Read status while queued or claimed. If outcome_unknown, investigate; never resubmit merely to check progress."
46600
+ });
46520
46601
  foregroundDecisionStatus = async (config2, parsed, dependencies, warnings) => {
46521
46602
  const session = await agentSession(config2, dependencies, warnings);
46603
+ if (parsed.decisionStatusOperationId !== null) {
46604
+ const result3 = await session.client.callTool("inference.agent.decision.status", {
46605
+ host_id: session.localState.host_id,
46606
+ operation_id: parsed.decisionStatusOperationId,
46607
+ assignment_id: parsed.decisionStatusAssignmentId,
46608
+ assignment_generation: parsed.decisionStatusAssignmentGeneration
46609
+ });
46610
+ return {
46611
+ exitCode: 0,
46612
+ stdout: render(result3, parsed.json),
46613
+ stderr: warnings.length > 0 ? `${warnings.join("\n")}
46614
+ ` : ""
46615
+ };
46616
+ }
46522
46617
  let state = await requireForegroundAgentState(config2, session.localState.host_id);
46523
46618
  if (!state.pending_decision) {
46524
- throw new Error("No uncertain foreground Agent decision requires status recovery.");
46619
+ throw new Error("No uncertain foreground Agent decision requires status recovery. Use the receipt status_command to read a successful submission outcome.");
46525
46620
  }
46526
46621
  const checkedAt = (dependencies.now ?? (() => /* @__PURE__ */ new Date()))().toISOString();
46527
46622
  state = {
@@ -46548,7 +46643,7 @@ Waiting for approval...
46548
46643
  }
46549
46644
  return {
46550
46645
  exitCode: 0,
46551
- stdout: render(result2, parsed.json),
46646
+ stdout: render({ ...result2, ...foregroundDecisionFollowup(parsed, state.pending_decision.request) }, parsed.json),
46552
46647
  stderr: warnings.length > 0 ? `${warnings.join("\n")}
46553
46648
  ` : ""
46554
46649
  };
@@ -46603,7 +46698,7 @@ Waiting for approval...
46603
46698
  });
46604
46699
  return {
46605
46700
  exitCode: 0,
46606
- stdout: render({ ...status, recovered: true }, parsed.json),
46701
+ stdout: render({ ...status, recovered: true, ...foregroundDecisionFollowup(parsed, state.pending_decision.request) }, parsed.json),
46607
46702
  stderr: warnings.length > 0 ? `${warnings.join("\n")}
46608
46703
  ` : ""
46609
46704
  };
@@ -46631,7 +46726,7 @@ Waiting for approval...
46631
46726
  });
46632
46727
  return {
46633
46728
  exitCode: 0,
46634
- stdout: render(result2, parsed.json),
46729
+ stdout: render({ ...result2, ...foregroundDecisionFollowup(parsed, state.pending_decision.request) }, parsed.json),
46635
46730
  stderr: warnings.length > 0 ? `${warnings.join("\n")}
46636
46731
  ` : ""
46637
46732
  };
@@ -46664,7 +46759,7 @@ Waiting for approval...
46664
46759
  });
46665
46760
  return {
46666
46761
  exitCode: 0,
46667
- stdout: render({ ...status, recovered: true }, parsed.json),
46762
+ stdout: render({ ...status, recovered: true, ...foregroundDecisionFollowup(parsed, state.pending_decision.request) }, parsed.json),
46668
46763
  stderr: warnings.length > 0 ? `${warnings.join("\n")}
46669
46764
  ` : ""
46670
46765
  };
@@ -51020,10 +51115,11 @@ var init_hyperliquid_account_state_adapter = __esm({
51020
51115
  const markPrice = Number.isFinite(size) && Math.abs(size) > 0 && Number.isFinite(positionValue) && positionValue > 0 ? positionValue / Math.abs(size) : null;
51021
51116
  return {
51022
51117
  size: Number.isFinite(size) ? size : 0,
51118
+ entryPrice: Number.isFinite(Number(position?.entryPx)) && Number(position?.entryPx) > 0 ? Number(position.entryPx) : null,
51023
51119
  markPrice: markPrice != null && Number.isFinite(markPrice) && markPrice > 0 ? markPrice : null
51024
51120
  };
51025
51121
  }
51026
- return { size: 0, markPrice: null };
51122
+ return { size: 0, markPrice: null, entryPrice: null };
51027
51123
  };
51028
51124
  fetchBrowserAccountState = async (input) => {
51029
51125
  configureHyperliquidMarketSymbolCasing(input.config.client_runtime_hyperliquid_case_sensitive_symbols);
@@ -87507,7 +87603,7 @@ var init_browser_trading = __esm({
87507
87603
  });
87508
87604
 
87509
87605
  // lib/runtime/execution-guard-contract.ts
87510
- var unitsFromPosition, signedUnitsFromPosition, classifyExecutionIntent, resolveExecutionTarget;
87606
+ var unitsFromPosition, signedUnitsFromPosition, signedUnitsFromEntryPosition, classifyExecutionIntent, resolveExecutionTarget;
87511
87607
  var init_execution_guard_contract = __esm({
87512
87608
  "lib/runtime/execution-guard-contract.ts"() {
87513
87609
  "use strict";
@@ -87534,6 +87630,17 @@ var init_execution_guard_contract = __esm({
87534
87630
  }
87535
87631
  return sizeValue < 0 ? -units : units;
87536
87632
  };
87633
+ signedUnitsFromEntryPosition = (size, entryPrice, unitSizeUsdc) => {
87634
+ const sizeValue = Number(size);
87635
+ if (!Number.isFinite(sizeValue)) throw new Error("Position size is invalid for execution unit classification.");
87636
+ if (sizeValue === 0) return 0;
87637
+ const entry = Number(entryPrice);
87638
+ const unit = Number(unitSizeUsdc);
87639
+ if (!Number.isFinite(entry) || entry <= 0 || !Number.isFinite(unit) || unit <= 0) {
87640
+ throw new Error("Position entry price and unit size must be positive for execution unit classification.");
87641
+ }
87642
+ return signedUnitsFromPosition(sizeValue, entry, unit);
87643
+ };
87537
87644
  classifyExecutionIntent = (action, requestedUnits, snapshotSignedUnits) => {
87538
87645
  const actionNormalized = String(action ?? "HOLD").trim().toUpperCase();
87539
87646
  const parsedUnits = Number.parseInt(String(Number(requestedUnits ?? 0)), 10);
@@ -87758,7 +87865,7 @@ var init_runtime_execution = __esm({
87758
87865
  const classified = classifyExecutionIntent(
87759
87866
  input.decision,
87760
87867
  input.units,
87761
- signedUnitsFromPosition(context.currentPositionSize, context.lastPrice, context.unitSizeUsdc)
87868
+ signedUnitsFromEntryPosition(context.currentPositionSize, context.currentPositionEntryPrice, context.unitSizeUsdc)
87762
87869
  );
87763
87870
  return classified.reduceOnly ? "trading_reduce" : "trading_execute";
87764
87871
  };
@@ -91564,9 +91671,8 @@ var init_runtime_execution = __esm({
91564
91671
  sessionId: input.sessionId,
91565
91672
  signal: input.signal
91566
91673
  });
91567
- const refreshedPosition = resolvePositionSize(
91568
- refreshed.positions.find((position) => position.symbol === input.executionContext.symbol)
91569
- );
91674
+ const refreshedPositionSnapshot = refreshed.positions.find((position) => position.symbol === input.executionContext.symbol);
91675
+ const refreshedPosition = resolvePositionSize(refreshedPositionSnapshot);
91570
91676
  const refreshedPrice = Number(refreshed.availableToTrade.mark_price);
91571
91677
  appendRuntimeDebugEvent({
91572
91678
  label: "execution_snapshot_refreshed",
@@ -91574,6 +91680,7 @@ var init_runtime_execution = __esm({
91574
91680
  });
91575
91681
  return {
91576
91682
  currentPositionSize: Number.isFinite(refreshedPosition) ? refreshedPosition : snapshotPositionSize,
91683
+ currentPositionEntryPrice: refreshedPositionSnapshot?.entry_price ?? null,
91577
91684
  executionPrice: Number.isFinite(refreshedPrice) && refreshedPrice > 0 ? refreshedPrice : decisionPrice,
91578
91685
  executionSnapshotId: createRuntimeId(),
91579
91686
  executionSnapshotCapturedAt: (/* @__PURE__ */ new Date()).toISOString()
@@ -91596,6 +91703,7 @@ var init_runtime_execution = __esm({
91596
91703
  });
91597
91704
  return {
91598
91705
  currentPositionSize: Number.isFinite(parsedLiveSize) ? parsedLiveSize : snapshotPositionSize,
91706
+ currentPositionEntryPrice: liveBrowserSnapshot.entryPrice,
91599
91707
  executionPrice: decisionPrice,
91600
91708
  executionSnapshotId: createRuntimeId(),
91601
91709
  executionSnapshotCapturedAt: (/* @__PURE__ */ new Date()).toISOString()
@@ -91670,6 +91778,11 @@ var init_runtime_execution = __esm({
91670
91778
  note: `decision=${input.decision} units=${requestedUnits} symbol=${input.executionContext.symbol}`
91671
91779
  });
91672
91780
  const decisionSnapshotPositionSize = Number.isFinite(input.executionContext.currentPositionSize) ? Number(input.executionContext.currentPositionSize) : 0;
91781
+ const decisionSnapshotSignedUnits = signedUnitsFromEntryPosition(
91782
+ decisionSnapshotPositionSize,
91783
+ input.executionContext.currentPositionEntryPrice,
91784
+ input.executionContext.unitSizeUsdc
91785
+ );
91673
91786
  const profileId = String(input.profileId).trim();
91674
91787
  const hasTrackedProtection = readClientProtectiveGroups(
91675
91788
  profileId,
@@ -91691,6 +91804,7 @@ var init_runtime_execution = __esm({
91691
91804
  if (shouldTrail && !reconciliationReports.some((report) => report.status === "failed")) {
91692
91805
  const {
91693
91806
  currentPositionSize: currentPositionSize2,
91807
+ currentPositionEntryPrice: currentPositionEntryPrice2,
91694
91808
  executionPrice: executionPrice2,
91695
91809
  executionSnapshotId: executionSnapshotId2,
91696
91810
  executionSnapshotCapturedAt: executionSnapshotCapturedAt2
@@ -91715,9 +91829,9 @@ var init_runtime_execution = __esm({
91715
91829
  side: null,
91716
91830
  reduceOnly: false,
91717
91831
  requestedUnits,
91718
- targetSignedUnits: signedUnitsFromPosition(
91832
+ targetSignedUnits: signedUnitsFromEntryPosition(
91719
91833
  currentPositionSize2,
91720
- executionPrice2,
91834
+ currentPositionEntryPrice2,
91721
91835
  input.executionContext.unitSizeUsdc
91722
91836
  ),
91723
91837
  executedSizeAsset: 0,
@@ -91733,11 +91847,7 @@ var init_runtime_execution = __esm({
91733
91847
  side: null,
91734
91848
  reduceOnly: false,
91735
91849
  requestedUnits,
91736
- targetSignedUnits: signedUnitsFromPosition(
91737
- decisionSnapshotPositionSize,
91738
- input.executionContext.lastPrice,
91739
- input.executionContext.unitSizeUsdc
91740
- ),
91850
+ targetSignedUnits: decisionSnapshotSignedUnits,
91741
91851
  executedSizeAsset: 0,
91742
91852
  executionReports: reconciliationReports,
91743
91853
  message: reconciliationReports.some((report) => report.status === "executed") ? "Reconciled protective orders" : input.decision === "HOLD" ? "Hold (No Action)" : "Unsupported decision",
@@ -91747,20 +91857,16 @@ var init_runtime_execution = __esm({
91747
91857
  }
91748
91858
  const {
91749
91859
  currentPositionSize,
91860
+ currentPositionEntryPrice,
91750
91861
  executionPrice,
91751
91862
  executionSnapshotId,
91752
91863
  executionSnapshotCapturedAt
91753
91864
  } = await resolveCurrentPositionSize(input);
91754
91865
  throwIfAborted2(input.signal);
91755
91866
  const currentPosition = buildPositionSnapshot(input.executionContext.symbol, currentPositionSize);
91756
- const decisionSnapshotSignedUnits = signedUnitsFromPosition(
91757
- decisionSnapshotPositionSize,
91758
- input.executionContext.lastPrice,
91759
- input.executionContext.unitSizeUsdc
91760
- );
91761
- const liveSignedUnits = signedUnitsFromPosition(
91867
+ const liveSignedUnits = signedUnitsFromEntryPosition(
91762
91868
  currentPositionSize,
91763
- executionPrice,
91869
+ currentPositionEntryPrice,
91764
91870
  input.executionContext.unitSizeUsdc
91765
91871
  );
91766
91872
  const classified = classifyExecutionIntent(
@@ -93894,6 +94000,7 @@ async function fetchLocalHyperliquidSnapshot(input) {
93894
94000
  decisionSnapshotId: input.decisionSnapshotId,
93895
94001
  decisionSnapshotCapturedAt: input.decisionSnapshotCapturedAt,
93896
94002
  currentPositionSize: Number.isFinite(currentPositionSize) ? currentPositionSize : 0,
94003
+ currentPositionEntryPrice: accountState.positions.find((position) => normalizeRuntimeSymbol(position.symbol) === normalizeRuntimeSymbol(input.symbol))?.entry_price ?? null,
93897
94004
  walletAddress,
93898
94005
  lastPrice,
93899
94006
  unitSizeUsdc: requirePositiveNumber2(promptKnobs.trade_size ?? input.llmConfig.default_ai_trade_amount, "trade size"),
@@ -94213,9 +94320,9 @@ function createHeadlessLocalWorker(options) {
94213
94320
  const classifiedIntent = candidateHyperliquidContext ? classifyExecutionIntent(
94214
94321
  providerDecision.decision,
94215
94322
  providerDecision.units,
94216
- signedUnitsFromPosition(
94323
+ signedUnitsFromEntryPosition(
94217
94324
  candidateHyperliquidContext.executionContext.currentPositionSize,
94218
- candidateHyperliquidContext.executionContext.lastPrice,
94325
+ candidateHyperliquidContext.executionContext.currentPositionEntryPrice,
94219
94326
  candidateHyperliquidContext.executionContext.unitSizeUsdc
94220
94327
  )
94221
94328
  ).intent : "hold";
@@ -94255,7 +94362,7 @@ function createHeadlessLocalWorker(options) {
94255
94362
  for (const position of localHyperliquidContext.accountState.positions) {
94256
94363
  if (Number(position.size) === 0) continue;
94257
94364
  const entryPrice = requirePositiveNumber2(position.entry_price, "position entry price");
94258
- const signedUnits = signedUnitsFromPosition(Number(position.size), entryPrice, unitSize);
94365
+ const signedUnits = signedUnitsFromEntryPosition(Number(position.size), entryPrice, unitSize);
94259
94366
  globalUsage += Math.abs(signedUnits);
94260
94367
  if (getHyperliquidMarketDex(position.symbol) === venue) exchangeUsage += Math.abs(signedUnits);
94261
94368
  if (normalizeRuntimeSymbol(position.symbol) === normalizeRuntimeSymbol(symbol2)) currentSignedUnits = signedUnits;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtxmacro/cli",
3
- "version": "2026.9.62",
3
+ "version": "2026.9.64",
4
4
  "description": "VTX Macro CLI, MCP server, and durable external inference host.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",