@vtxmacro/cli 2026.8.47 → 2026.8.49
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/README.md +6 -4
- package/bin/vtx.js +74 -27
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -124,10 +124,12 @@ The command never kills an arbitrary process, logs either account out, changes
|
|
|
124
124
|
VTX profile settings, or controls a Trader. If any package-owned VTX automation
|
|
125
125
|
is still live, recovery fails closed and preserves its evidence.
|
|
126
126
|
|
|
127
|
-
For each VTX profile and lane, **
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
For each VTX profile and lane, **Host #1** is tried first and later compatible
|
|
128
|
+
hosts follow in the saved Host cascade order. Distinct computers may use the
|
|
129
|
+
same authenticated subscription; provider quota remains account-level.
|
|
130
|
+
Quota/credits exhaustion can advance only to a later host reporting a different
|
|
131
|
+
account identity. Unusable authentication and exhausted recoverable host failures
|
|
132
|
+
can advance the same logical call. VTX never changes
|
|
131
133
|
provider, model, effort, or response mode, and never cascades a bad request,
|
|
132
134
|
policy rejection, or uncertain dispatch outcome.
|
|
133
135
|
|
package/bin/vtx.js
CHANGED
|
@@ -38,7 +38,7 @@ var init_agent_cli_release = __esm({
|
|
|
38
38
|
"agent-cli-release.json"() {
|
|
39
39
|
agent_cli_release_default = {
|
|
40
40
|
package_name: "@vtxmacro/cli",
|
|
41
|
-
package_version: "2026.8.
|
|
41
|
+
package_version: "2026.8.49",
|
|
42
42
|
codex_package_name: "@openai/codex",
|
|
43
43
|
codex_version: "0.147.0",
|
|
44
44
|
copilot_sdk_package_name: "@github/copilot-sdk",
|
|
@@ -16880,7 +16880,7 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
|
|
|
16880
16880
|
}
|
|
16881
16881
|
}`;
|
|
16882
16882
|
WINDOWS_IDENTITY_COMMAND_TIMEOUT_MS = 15e3;
|
|
16883
|
-
WINDOWS_PRIVATE_ACL_BROKER_STARTUP_TIMEOUT_MS =
|
|
16883
|
+
WINDOWS_PRIVATE_ACL_BROKER_STARTUP_TIMEOUT_MS = 9e4;
|
|
16884
16884
|
SMALL_IDENTITY_COMMAND_TIMEOUT_MS = 5e3;
|
|
16885
16885
|
windowsPowerShellEnvironment = (extra = {}) => {
|
|
16886
16886
|
const sanitizedExtra = { ...extra };
|
|
@@ -18428,12 +18428,15 @@ var init_mcp_client = __esm({
|
|
|
18428
18428
|
"External inference claim request was not applied before its generation became stale"
|
|
18429
18429
|
) || errorText.includes("External inference host advertisement is expired or superseded"));
|
|
18430
18430
|
const retryableInfrastructureRejection = EXTERNAL_INFERENCE_AUTOMATED_HOST_TOOLS.includes(name) && (errorText.includes("External inference polling is at its configured concurrency limit") || errorText.includes("The Insights action reached the response timeout") || errorText.includes("Insights capability failed without exposing private runtime details"));
|
|
18431
|
-
const retryableClaimRejection = name === "inference.job.claim" && !definitivelyNotApplied && (retryableInfrastructureRejection || errorText.includes("External inference host is not live enough to claim work") || errorText.includes("External inference host request generation is stale"));
|
|
18431
|
+
const retryableClaimRejection = name === "inference.job.claim" && !definitivelyNotApplied && (retryableInfrastructureRejection || errorText.includes("External inference host is not live enough to claim work") || errorText.includes("External inference host request generation is stale") || errorText.includes("External inference claim runtime fence is stale"));
|
|
18432
18432
|
const retryableHeartbeatClockSkew = name === "inference.host.heartbeat" && definitivelyNotApplied;
|
|
18433
18433
|
const retryableAdvertisementClockSkew = (name === "inference.host.register" || name === "inference.host.advertise") && definitivelyNotApplied;
|
|
18434
18434
|
const staleHostHeartbeatGeneration = name === "inference.host.heartbeat" && errorText.includes("Heartbeat generations do not match the current host authority.");
|
|
18435
|
+
const obsoleteClaimReplay = name === "inference.job.claim" && errorText.includes(
|
|
18436
|
+
"External inference claim replay is no longer dispatchable"
|
|
18437
|
+
);
|
|
18435
18438
|
throw new ExternalInferenceMcpError(
|
|
18436
|
-
staleHostHeartbeatGeneration ? "generation_stale" : "tool_rejected",
|
|
18439
|
+
staleHostHeartbeatGeneration ? "generation_stale" : obsoleteClaimReplay ? "claim_replay_obsolete" : "tool_rejected",
|
|
18437
18440
|
`Insights MCP rejected ${name}.`,
|
|
18438
18441
|
{
|
|
18439
18442
|
definitivelyNotApplied: definitivelyNotApplied || staleHostHeartbeatGeneration,
|
|
@@ -31521,6 +31524,18 @@ var init_runner = __esm({
|
|
|
31521
31524
|
} catch (error48) {
|
|
31522
31525
|
if (!this.options.signal?.aborted && controlPlaneFatal(error48)) {
|
|
31523
31526
|
requestDrain("authority_lost");
|
|
31527
|
+
} else if (!this.options.signal?.aborted && error48 instanceof ExternalInferenceMcpError && error48.code === "claim_replay_obsolete") {
|
|
31528
|
+
await mutateReceipt((current) => ({
|
|
31529
|
+
...current,
|
|
31530
|
+
pending_claim_request: current.pending_claim_request?.claim_request_id === request.claim_request_id ? null : current.pending_claim_request,
|
|
31531
|
+
updated_at: isoAt(now())
|
|
31532
|
+
}));
|
|
31533
|
+
emitDiagnostic("claim_replay_retired", {
|
|
31534
|
+
request_advertisement_generation: request.advertisement_generation,
|
|
31535
|
+
current_advertisement_generation: receipt.advertisement_generation
|
|
31536
|
+
});
|
|
31537
|
+
nextClaimAt = now();
|
|
31538
|
+
continue;
|
|
31524
31539
|
} else if (!this.options.signal?.aborted && error48 instanceof ExternalInferenceMcpError && error48.definitivelyNotApplied) {
|
|
31525
31540
|
if (request.advertisement_generation < receipt.advertisement_generation) {
|
|
31526
31541
|
await mutateReceipt((current) => ({
|
|
@@ -33576,6 +33591,7 @@ __export(cli_exports, {
|
|
|
33576
33591
|
import { createHash as createHash7, randomUUID as randomUUID2 } from "node:crypto";
|
|
33577
33592
|
import { spawn as spawn7 } from "node:child_process";
|
|
33578
33593
|
import { lstat as lstat4, realpath as realpath4, rm as rm6 } from "node:fs/promises";
|
|
33594
|
+
import { hostname as osHostname } from "node:os";
|
|
33579
33595
|
import { join as join7, resolve as resolve5 } from "node:path";
|
|
33580
33596
|
async function runInferenceHostCli(argv2, env = process.env, dependencies = {}) {
|
|
33581
33597
|
const warnings = [];
|
|
@@ -33677,7 +33693,7 @@ async function runInferenceHostCli(argv2, env = process.env, dependencies = {})
|
|
|
33677
33693
|
};
|
|
33678
33694
|
}
|
|
33679
33695
|
}
|
|
33680
|
-
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, defaultOpenBrowser, registerInferenceHostServiceControlInput, defaultRegisterLifecycleSignalHandlers, lifecycleCancellation, configuredCredentialStore, restoreInferenceHostCredentialContext, recoverInferenceHostCredentialContextTransition, accountKeyForState, assertCredentialMatchesState2, revocationCheckpointForCredential, assertRevocationCheckpointMatchesLocalIdentity, fileExistsPrivately, inspectCodexAuthentication, clearLocalRuntimeArtifacts, assertDurableServiceUninstalled, assertLocalRuntimeArtifactsMayBeDiscarded, defaultRunForeground, preparePortableDurableAdapter, defaultRunPortableDurableAdapter, login, codexLogin, codexLogout, localStatus, doctor, cleanupLogin, runHost, defaultReadStdin, parseAgentStdin, agentOperationId, agentSession, agentConnect, agentRun, agentNext, agentComplete, agentFail, withAgentCommandLock, recoveryBackupPath, serviceRecoveryTransactionPath, readServiceRecoveryTransaction, assertResumableCodexRecoveryEvidence, recoverInstalledCodexService, serviceCommand, hasExplicitCredentialStoreConfiguration, credentialEnvironmentForIdentity, commandRequiresRetainedCredentialStore, commandUsesInstalledServiceCredentials, resolveInferenceHostCommandConfig;
|
|
33696
|
+
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, defaultRunPortableDurableAdapter, login, codexLogin, codexLogout, localStatus, doctor, cleanupLogin, runHost, defaultReadStdin, parseAgentStdin, agentOperationId, agentSession, agentConnect, agentRun, agentNext, agentComplete, agentFail, withAgentCommandLock, recoveryBackupPath, serviceRecoveryTransactionPath, readServiceRecoveryTransaction, assertResumableCodexRecoveryEvidence, recoverInstalledCodexService, serviceCommand, hasExplicitCredentialStoreConfiguration, credentialEnvironmentForIdentity, commandRequiresRetainedCredentialStore, commandUsesInstalledServiceCredentials, resolveInferenceHostCommandConfig;
|
|
33681
33697
|
var init_cli = __esm({
|
|
33682
33698
|
"lib/inference-host/cli.ts"() {
|
|
33683
33699
|
"use strict";
|
|
@@ -33920,6 +33936,7 @@ Durable service:
|
|
|
33920
33936
|
instanceExplicit,
|
|
33921
33937
|
instanceFlagExplicit,
|
|
33922
33938
|
displayName,
|
|
33939
|
+
displayNameExplicit,
|
|
33923
33940
|
adapter,
|
|
33924
33941
|
modelId,
|
|
33925
33942
|
modelLabel,
|
|
@@ -33931,6 +33948,17 @@ Durable service:
|
|
|
33931
33948
|
forceRecovery
|
|
33932
33949
|
};
|
|
33933
33950
|
};
|
|
33951
|
+
resolveDurableServiceDisplayName = (parsed, dependencies) => {
|
|
33952
|
+
if (parsed.displayNameExplicit) return parsed.displayName;
|
|
33953
|
+
try {
|
|
33954
|
+
const machineName = (dependencies.hostname ?? osHostname)().trim();
|
|
33955
|
+
if (machineName && machineName.length <= 128 && !/[\u0000-\u001f\u007f-\u009f]/u.test(machineName)) {
|
|
33956
|
+
return machineName;
|
|
33957
|
+
}
|
|
33958
|
+
} catch {
|
|
33959
|
+
}
|
|
33960
|
+
return parsed.displayName;
|
|
33961
|
+
};
|
|
33934
33962
|
defaultOpenBrowser = (url2) => {
|
|
33935
33963
|
const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
|
|
33936
33964
|
const args = process.platform === "win32" ? ["/c", "start", "", url2] : [url2];
|
|
@@ -35693,6 +35721,7 @@ Waiting for approval...
|
|
|
35693
35721
|
if (parsed.modelId || parsed.modelLabel || parsed.reasoningEffort) {
|
|
35694
35722
|
throw new Error("Durable services discover their exact model and effort catalog from the authenticated runtime.");
|
|
35695
35723
|
}
|
|
35724
|
+
const displayName = resolveDurableServiceDisplayName(parsed, dependencies);
|
|
35696
35725
|
if (adapter !== "codex") {
|
|
35697
35726
|
const prepared = await (dependencies.prepareDurableAdapter ?? preparePortableDurableAdapter)(
|
|
35698
35727
|
adapter
|
|
@@ -35700,7 +35729,7 @@ Waiting for approval...
|
|
|
35700
35729
|
try {
|
|
35701
35730
|
const status2 = await manager.install({
|
|
35702
35731
|
adapter,
|
|
35703
|
-
displayName
|
|
35732
|
+
displayName,
|
|
35704
35733
|
maxConcurrency: parsed.maxConcurrency,
|
|
35705
35734
|
authenticatedAccountIdentity: prepared.preflight.authenticatedAccountIdentity,
|
|
35706
35735
|
authenticatedAccountEmail: prepared.preflight.authenticatedAccountEmail,
|
|
@@ -35729,7 +35758,7 @@ Waiting for approval...
|
|
|
35729
35758
|
});
|
|
35730
35759
|
const status = await manager.install({
|
|
35731
35760
|
adapter: "codex",
|
|
35732
|
-
displayName
|
|
35761
|
+
displayName,
|
|
35733
35762
|
maxConcurrency: parsed.maxConcurrency,
|
|
35734
35763
|
authenticatedAccountEmail: preflight?.authenticated_account_email ?? null,
|
|
35735
35764
|
authenticatedAccountPlan: preflight?.authenticated_account_plan ?? null
|
|
@@ -38994,9 +39023,7 @@ async function beginClientRuntimeExchangeMutation(profileId, payload) {
|
|
|
38994
39023
|
"/runtime/exchange-mutations/begin",
|
|
38995
39024
|
authority.numericProfileId,
|
|
38996
39025
|
JSON.stringify({
|
|
38997
|
-
|
|
38998
|
-
device_id: authority.deviceId,
|
|
38999
|
-
mode: authority.mode,
|
|
39026
|
+
...clientExchangeMutationAuthorityBody(authority),
|
|
39000
39027
|
mutation_id: payload.mutationId,
|
|
39001
39028
|
operation_kind: payload.operationKind,
|
|
39002
39029
|
symbol: payload.symbol,
|
|
@@ -39074,9 +39101,7 @@ async function reportClientRuntimeExchangeAttemptTransition(profileId, mutationI
|
|
|
39074
39101
|
`/runtime/exchange-mutations/${encodeURIComponent(mutationId)}/attempt`,
|
|
39075
39102
|
authority.numericProfileId,
|
|
39076
39103
|
JSON.stringify({
|
|
39077
|
-
|
|
39078
|
-
device_id: authority.deviceId,
|
|
39079
|
-
mode: authority.mode,
|
|
39104
|
+
...clientExchangeMutationAuthorityBody(authority),
|
|
39080
39105
|
phase: payload.phase,
|
|
39081
39106
|
client_observed_at: payload.clientObservedAt
|
|
39082
39107
|
}),
|
|
@@ -39093,15 +39118,14 @@ async function settleClientRuntimeExchangeMutation(profileId, mutationId, payloa
|
|
|
39093
39118
|
`/runtime/exchange-mutations/${encodeURIComponent(mutationId)}/settle`,
|
|
39094
39119
|
authority.numericProfileId,
|
|
39095
39120
|
JSON.stringify({
|
|
39096
|
-
|
|
39097
|
-
device_id: authority.deviceId,
|
|
39098
|
-
mode: authority.mode,
|
|
39121
|
+
...clientExchangeMutationAuthorityBody(authority),
|
|
39099
39122
|
outcome: payload.outcome,
|
|
39100
39123
|
exchange_order_id: payload.exchangeOrderId ?? null,
|
|
39101
39124
|
order_member_results: payload.orderMemberResults?.map((result3) => ({
|
|
39102
39125
|
client_order_id: result3.clientOrderId,
|
|
39103
39126
|
exchange_order_id: result3.exchangeOrderId,
|
|
39104
|
-
order_status: result3.orderStatus
|
|
39127
|
+
order_status: result3.orderStatus,
|
|
39128
|
+
filled_size: result3.filledSize ?? null
|
|
39105
39129
|
})) ?? null,
|
|
39106
39130
|
client_observed_at: payload.clientObservedAt ?? null
|
|
39107
39131
|
}),
|
|
@@ -39155,7 +39179,7 @@ async function reconcileActiveClientRuntimeExchangeMutation(profileId) {
|
|
|
39155
39179
|
}
|
|
39156
39180
|
return rememberCompletedDeferredClientRuntimeStop(profileId, result2);
|
|
39157
39181
|
}
|
|
39158
|
-
var getApiUrl, API_URL, sleep2, isTransientNetworkFetchError, createIdempotencyKey, getErrorMessage, getErrorPayloadOrEmpty, getErrorPayloadOrFallbackDetail, getErrorMessageFromResponse, _activeProfileId, PROFILE_STORAGE_KEY, completedDeferredClientRuntimeStops, rememberCompletedDeferredClientRuntimeStop, toNumericProfileId, shouldAttachRuntimeIdempotencyKey, attachRuntimeLeaseHeader, resolveRuntimeLeaseToken, persistRuntimeLeaseFromPayload, persistRuntimeLeaseStatusMetadata, shouldClearPersistedRuntimeLeaseOnError, isMissingRuntimeLeaseError, createRuntimeRequestError, parseClientRuntimeRequestContext, recordRuntimeAuthFailureBreadcrumb, classifyRuntimeRequestError, annotateRuntimeRequestError, parseRuntimeRetryAfterMs, shouldRecoverMissingRuntimeLease, recoverMissingRuntimeLease, isRetryableClientRuntimeStatus, shouldRetryClientRuntimeHttpStatus, resolveClientRuntimeRetryDelayMs, CLIENT_EXCHANGE_AUTHORITY_DEVICE_KEY, CLIENT_EXCHANGE_AUTHORITY_SESSION_KEY, getOrCreateClientExchangeAuthorityIdentity, resolveClientExchangeMutationAuthority, isPendingClientExchangeMutationError, clientExchangeMutationReconciliationTimers, MAX_CLIENT_EXCHANGE_RECONCILIATION_DELAY_MS, CLIENT_EXCHANGE_RECONCILIATION_CLOCK_SKEW_MS, ClientExchangeMutationRebuildRequiredError, isTerminalClientExchangeMutation, clientExchangeMutationReconciliationKey, clearScheduledClientExchangeMutationReconciliation, postClientExchangeMutationReconciliation, scheduleClientExchangeMutationReconciliation;
|
|
39182
|
+
var getApiUrl, API_URL, sleep2, isTransientNetworkFetchError, createIdempotencyKey, getErrorMessage, getErrorPayloadOrEmpty, getErrorPayloadOrFallbackDetail, getErrorMessageFromResponse, _activeProfileId, PROFILE_STORAGE_KEY, preferencesWriteQueue, CLIENT_SUPPORTED_PROMPT_CONTRACT_VERSION, completedDeferredClientRuntimeStops, rememberCompletedDeferredClientRuntimeStop, toNumericProfileId, shouldAttachRuntimeIdempotencyKey, attachRuntimeLeaseHeader, resolveRuntimeLeaseToken, persistRuntimeLeaseFromPayload, persistRuntimeLeaseStatusMetadata, shouldClearPersistedRuntimeLeaseOnError, isMissingRuntimeLeaseError, createRuntimeRequestError, parseClientRuntimeRequestContext, recordRuntimeAuthFailureBreadcrumb, classifyRuntimeRequestError, annotateRuntimeRequestError, parseRuntimeRetryAfterMs, shouldRecoverMissingRuntimeLease, recoverMissingRuntimeLease, isRetryableClientRuntimeStatus, shouldRetryClientRuntimeHttpStatus, resolveClientRuntimeRetryDelayMs, CLIENT_EXCHANGE_AUTHORITY_DEVICE_KEY, CLIENT_EXCHANGE_AUTHORITY_SESSION_KEY, getOrCreateClientExchangeAuthorityIdentity, resolveClientExchangeMutationAuthority, clientExchangeMutationAuthorityBody, isPendingClientExchangeMutationError, clientExchangeMutationReconciliationTimers, MAX_CLIENT_EXCHANGE_RECONCILIATION_DELAY_MS, CLIENT_EXCHANGE_RECONCILIATION_CLOCK_SKEW_MS, ClientExchangeMutationRebuildRequiredError, isTerminalClientExchangeMutation, clientExchangeMutationReconciliationKey, clearScheduledClientExchangeMutationReconciliation, postClientExchangeMutationReconciliation, scheduleClientExchangeMutationReconciliation;
|
|
39159
39183
|
var init_api2 = __esm({
|
|
39160
39184
|
"lib/api.ts"() {
|
|
39161
39185
|
"use strict";
|
|
@@ -39264,6 +39288,10 @@ var init_api2 = __esm({
|
|
|
39264
39288
|
}
|
|
39265
39289
|
}
|
|
39266
39290
|
}
|
|
39291
|
+
preferencesWriteQueue = Promise.resolve();
|
|
39292
|
+
CLIENT_SUPPORTED_PROMPT_CONTRACT_VERSION = String(
|
|
39293
|
+
process.env.NEXT_PUBLIC_CLIENT_RUNTIME_PROMPT_CONTRACT_VERSION || "2026-08-19"
|
|
39294
|
+
).trim() || "2026-08-19";
|
|
39267
39295
|
completedDeferredClientRuntimeStops = /* @__PURE__ */ new Set();
|
|
39268
39296
|
rememberCompletedDeferredClientRuntimeStop = (profileId, result2) => {
|
|
39269
39297
|
if (result2.runtime_stop_completed === true) {
|
|
@@ -39479,6 +39507,7 @@ var init_api2 = __esm({
|
|
|
39479
39507
|
device_id: requestContext.deviceId,
|
|
39480
39508
|
mode: requestContext.mode ?? null,
|
|
39481
39509
|
last_run_at: requestContext.lastRunAt ?? null,
|
|
39510
|
+
prompt_contract_version: CLIENT_SUPPORTED_PROMPT_CONTRACT_VERSION,
|
|
39482
39511
|
force_takeover: false,
|
|
39483
39512
|
claim_reason: "auto_resume"
|
|
39484
39513
|
})
|
|
@@ -39566,6 +39595,12 @@ var init_api2 = __esm({
|
|
|
39566
39595
|
}
|
|
39567
39596
|
};
|
|
39568
39597
|
};
|
|
39598
|
+
clientExchangeMutationAuthorityBody = (authority) => ({
|
|
39599
|
+
session_id: authority.sessionId,
|
|
39600
|
+
device_id: authority.deviceId,
|
|
39601
|
+
mode: authority.mode,
|
|
39602
|
+
prompt_contract_version: CLIENT_SUPPORTED_PROMPT_CONTRACT_VERSION
|
|
39603
|
+
});
|
|
39569
39604
|
isPendingClientExchangeMutationError = (error48) => {
|
|
39570
39605
|
const status = Number(error48?.status);
|
|
39571
39606
|
const message = error48 instanceof Error ? error48.message : String(error48 ?? "");
|
|
@@ -49176,10 +49211,11 @@ var init_hyperliquid_client = __esm({
|
|
|
49176
49211
|
init_runtime_redaction();
|
|
49177
49212
|
init_exchange_mutation_fence();
|
|
49178
49213
|
HyperliquidExchangeRejectionError = class extends Error {
|
|
49179
|
-
constructor(message, orderDiagnostics) {
|
|
49214
|
+
constructor(message, orderDiagnostics, clientMutationId = null) {
|
|
49180
49215
|
super(message);
|
|
49181
49216
|
this.name = "HyperliquidExchangeRejectionError";
|
|
49182
49217
|
this.orderDiagnostics = orderDiagnostics;
|
|
49218
|
+
this.clientMutationId = clientMutationId;
|
|
49183
49219
|
}
|
|
49184
49220
|
};
|
|
49185
49221
|
assertFreshPreparedExecutionContext = (preparedContext) => {
|
|
@@ -49851,14 +49887,14 @@ var init_hyperliquid_client = __esm({
|
|
|
49851
49887
|
p: limitPriceWire,
|
|
49852
49888
|
s: sizeWire,
|
|
49853
49889
|
r: input.reduceOnly !== false,
|
|
49854
|
-
...normalizeHyperliquidClientOrderId(input.clientOrderId) ? { c: normalizeHyperliquidClientOrderId(input.clientOrderId) } : {},
|
|
49855
49890
|
t: {
|
|
49856
49891
|
trigger: {
|
|
49857
49892
|
isMarket: input.triggerIsMarket !== false,
|
|
49858
49893
|
triggerPx: triggerPriceWire,
|
|
49859
49894
|
tpsl: "triggerKind" in input && input.triggerKind ? input.triggerKind : "isTakeProfit" in input && input.isTakeProfit === true ? "tp" : "sl"
|
|
49860
49895
|
}
|
|
49861
|
-
}
|
|
49896
|
+
},
|
|
49897
|
+
...normalizeHyperliquidClientOrderId(input.clientOrderId) ? { c: normalizeHyperliquidClientOrderId(input.clientOrderId) } : {}
|
|
49862
49898
|
};
|
|
49863
49899
|
};
|
|
49864
49900
|
signHyperliquidPayload = async (input, action) => {
|
|
@@ -50096,10 +50132,14 @@ var init_hyperliquid_client = __esm({
|
|
|
50096
50132
|
if (!/^\d+$/.test(exchangeOrderId) || !/[1-9]/.test(exchangeOrderId)) {
|
|
50097
50133
|
return null;
|
|
50098
50134
|
}
|
|
50135
|
+
const rawFilledSize = filled && typeof filled === "object" && !Array.isArray(filled) ? filled.totalSz : null;
|
|
50136
|
+
const filledSize = rawFilledSize == null ? null : String(rawFilledSize).trim();
|
|
50137
|
+
const hasExactFilledSize = filledSize != null && filledSize.length > 0 && Number.isFinite(Number(filledSize)) && Number(filledSize) > 0;
|
|
50099
50138
|
results.push({
|
|
50100
50139
|
clientOrderId,
|
|
50101
50140
|
exchangeOrderId,
|
|
50102
|
-
orderStatus: resting != null ? "open" : "filled"
|
|
50141
|
+
orderStatus: resting != null ? "open" : "filled",
|
|
50142
|
+
...resting == null && hasExactFilledSize ? { filledSize } : {}
|
|
50103
50143
|
});
|
|
50104
50144
|
}
|
|
50105
50145
|
return results;
|
|
@@ -50455,7 +50495,8 @@ var init_hyperliquid_client = __esm({
|
|
|
50455
50495
|
}
|
|
50456
50496
|
throw new HyperliquidExchangeRejectionError(
|
|
50457
50497
|
sanitizeRuntimeDiagnosticValue(exchangeError.message),
|
|
50458
|
-
buildHyperliquidOrderDiagnostics(input.payload, response.status)
|
|
50498
|
+
buildHyperliquidOrderDiagnostics(input.payload, response.status),
|
|
50499
|
+
durableMutation?.mutationId ?? null
|
|
50459
50500
|
);
|
|
50460
50501
|
}
|
|
50461
50502
|
if (durableMutation && !isDefinitiveHyperliquidExchangeResponse(
|
|
@@ -50472,11 +50513,10 @@ var init_hyperliquid_client = __esm({
|
|
|
50472
50513
|
payload,
|
|
50473
50514
|
input.payload.action
|
|
50474
50515
|
) : null;
|
|
50475
|
-
const exactOrderMemberResults = extractedOrderMemberResults && extractedOrderMemberResults.length > 1 ? extractedOrderMemberResults : null;
|
|
50476
50516
|
await settleDurableMutation(
|
|
50477
50517
|
"success",
|
|
50478
50518
|
exactExchangeOrderId,
|
|
50479
|
-
|
|
50519
|
+
extractedOrderMemberResults
|
|
50480
50520
|
);
|
|
50481
50521
|
trace.completeSuccess(response.status);
|
|
50482
50522
|
return durableMutation?.operationKind === "order" ? {
|
|
@@ -51821,6 +51861,7 @@ var init_runtime_execution = __esm({
|
|
|
51821
51861
|
init_hyperliquid_account_state_adapter();
|
|
51822
51862
|
init_hyperliquid_client();
|
|
51823
51863
|
init_network_debug();
|
|
51864
|
+
init_runtime_redaction();
|
|
51824
51865
|
createRuntimeId = () => {
|
|
51825
51866
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
51826
51867
|
return crypto.randomUUID();
|
|
@@ -52576,16 +52617,22 @@ var init_runtime_execution = __esm({
|
|
|
52576
52617
|
note: `symbol=${input.executionContext.symbol} kind=${triggerInput.isTakeProfit ? "tp" : "sl"} side=${exitSide} sizeAsset=${sizeAsset} triggerPrice=${triggerInput.triggerPrice} order_id=${_extractOrderId(triggerResponse) || "none"}`
|
|
52577
52618
|
});
|
|
52578
52619
|
} catch (triggerError) {
|
|
52579
|
-
const message = triggerError
|
|
52620
|
+
const message = getSanitizedRuntimeErrorMessage(triggerError) || "Unknown protective trigger order error.";
|
|
52621
|
+
const rejection = triggerError instanceof HyperliquidExchangeRejectionError ? triggerError : null;
|
|
52580
52622
|
executionReports.push({
|
|
52581
52623
|
order_id: null,
|
|
52624
|
+
client_mutation_id: rejection?.clientMutationId ?? null,
|
|
52582
52625
|
symbol: input.executionContext.symbol,
|
|
52583
52626
|
action: triggerInput.label,
|
|
52584
52627
|
status: "failed",
|
|
52585
52628
|
execution_metadata: {
|
|
52586
52629
|
trigger_price: triggerInput.triggerPrice,
|
|
52587
52630
|
is_take_profit: triggerInput.isTakeProfit,
|
|
52588
|
-
|
|
52631
|
+
reason_code: "execution_error",
|
|
52632
|
+
execution_stage: "protective_trigger_order",
|
|
52633
|
+
entry_order_id: _extractOrderId(marketOrderResponse),
|
|
52634
|
+
error: message,
|
|
52635
|
+
...rejection ? { order_diagnostics: rejection.orderDiagnostics } : {}
|
|
52589
52636
|
}
|
|
52590
52637
|
});
|
|
52591
52638
|
appendRuntimeDebugEvent({
|