@vtxmacro/cli 2026.10.3 → 2026.10.5

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 CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import { createRequire as __vtxCreateRequire } from 'node:module'; const require = __vtxCreateRequire(import.meta.url);
2
3
 
3
4
  // lib/agent-core/client.ts
4
5
  import { randomUUID } from "node:crypto";
@@ -55,7 +56,10 @@ async function parseError(response, fallback) {
55
56
  const rawDetail = detail && typeof detail === "object" && "detail" in detail ? detail.detail : detail;
56
57
  const detailMessage = rawDetail && typeof rawDetail === "object" && typeof rawDetail.message === "string" ? String(rawDetail.message).trim() : "";
57
58
  const message = typeof rawDetail === "string" ? rawDetail : detailMessage || fallback;
58
- const code = rawDetail && typeof rawDetail === "object" && "code" in rawDetail ? String(rawDetail.code || "") : void 0;
59
+ const topLevelCode = detail && typeof detail === "object" && typeof detail.code === "string" ? String(detail.code).trim() : "";
60
+ const headerCode = String(response.headers?.get?.("x-vtx-error-code") || "").trim();
61
+ const nestedCode = rawDetail && typeof rawDetail === "object" && "code" in rawDetail ? String(rawDetail.code || "") : "";
62
+ const code = topLevelCode || headerCode || nestedCode || void 0;
59
63
  return new AgentClientError({
60
64
  status: response.status,
61
65
  code,
@@ -87,6 +91,14 @@ var VtxAgentClient = class _VtxAgentClient {
87
91
  this.activeProfileId = config.activeProfileId ?? null;
88
92
  this.fetchImpl = config.fetchImpl ?? fetch;
89
93
  }
94
+ /** How shared web runtime code (lib/api.ts) reaches the API as this client. */
95
+ apiTransport() {
96
+ const token = this.token;
97
+ return {
98
+ baseUrl: this.apiUrl,
99
+ authorization: () => token ? `Bearer ${token}` : null
100
+ };
101
+ }
90
102
  async request(path, options = {}) {
91
103
  const normalizedPath = path.startsWith("/") ? path : `/${path}`;
92
104
  const headers = {
@@ -218,44 +230,6 @@ var VtxAgentClient = class _VtxAgentClient {
218
230
  headers: { "x-client-runtime-lease": leaseToken }
219
231
  });
220
232
  }
221
- getRuntimeSecrets(profileId, leaseToken, options = {}) {
222
- const params = new URLSearchParams();
223
- if (options.activeProvider) {
224
- params.set("active_provider", options.activeProvider);
225
- }
226
- if (typeof options.includeAllProviderKeys === "boolean") {
227
- params.set("include_all_provider_keys", String(options.includeAllProviderKeys));
228
- }
229
- const query = params.toString();
230
- return this.request(`/auth/me/client-runtime-secrets${query ? `?${query}` : ""}`, {
231
- profileId,
232
- headers: { "x-client-runtime-lease": leaseToken }
233
- });
234
- }
235
- getRuntimePromptContractMetadata(profileId, payload, leaseToken) {
236
- return this.request("/trading/ai/runtime/prompt-contract/metadata", {
237
- method: "POST",
238
- profileId,
239
- headers: { "x-client-runtime-lease": leaseToken },
240
- body: payload
241
- });
242
- }
243
- getRuntimePromptContractDerivedContext(profileId, payload, leaseToken) {
244
- return this.request("/trading/ai/runtime/prompt-contract/derived-context", {
245
- method: "POST",
246
- profileId,
247
- headers: { "x-client-runtime-lease": leaseToken },
248
- body: payload
249
- });
250
- }
251
- getRuntimePrompt(profileId, payload, leaseToken) {
252
- return this.request("/trading/ai/runtime/prompt", {
253
- method: "POST",
254
- profileId,
255
- headers: { "x-client-runtime-lease": leaseToken },
256
- body: payload
257
- });
258
- }
259
233
  getLlmConfig(profileId) {
260
234
  return this.request("/llm/config", { profileId });
261
235
  }
@@ -267,33 +241,6 @@ var VtxAgentClient = class _VtxAgentClient {
267
241
  body: payload
268
242
  });
269
243
  }
270
- reportRuntimeDecision(profileId, payload, leaseToken) {
271
- return this.request("/trading/ai/runtime/decision", {
272
- method: "POST",
273
- profileId,
274
- idempotencyKey: randomUUID(),
275
- headers: { "x-client-runtime-lease": leaseToken },
276
- body: payload
277
- });
278
- }
279
- reportRuntimeTradeSync(profileId, payload, leaseToken) {
280
- return this.request("/trading/ai/runtime/trade-sync", {
281
- method: "POST",
282
- profileId,
283
- idempotencyKey: randomUUID(),
284
- headers: { "x-client-runtime-lease": leaseToken },
285
- body: payload
286
- });
287
- }
288
- reportRuntimeError(profileId, payload, leaseToken) {
289
- return this.request("/trading/ai/runtime/error", {
290
- method: "POST",
291
- profileId,
292
- idempotencyKey: randomUUID(),
293
- headers: { "x-client-runtime-lease": leaseToken },
294
- body: payload
295
- });
296
- }
297
244
  getTradeHistory(profileId) {
298
245
  return this.request("/trading/ai/history", { profileId });
299
246
  }
@@ -406,7 +353,7 @@ function createAgentClient(config) {
406
353
  }
407
354
 
408
355
  // lib/agent-core/config.ts
409
- import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
356
+ import { mkdir, readdir, readFile, rm, writeFile } from "node:fs/promises";
410
357
  import { dirname, join } from "node:path";
411
358
  import { homedir } from "node:os";
412
359
  function defaultBaseDir() {
@@ -416,10 +363,12 @@ function resolveAgentCliConfig(env = process.env) {
416
363
  const baseDir = String(env.VTX_HOME || "").trim() || defaultBaseDir();
417
364
  const rawProfile = String(env.VTX_PROFILE_ID || "").trim();
418
365
  const parsedProfile = rawProfile ? Number(rawProfile) : NaN;
366
+ const explicitStatePath = String(env.VTX_RUNTIME_STATE_PATH || "").trim();
419
367
  return {
420
368
  apiUrl: String(env.VTX_API_URL || "http://localhost:8000").replace(/\/+$/, ""),
421
369
  tokenPath: String(env.VTX_TOKEN_PATH || "").trim() || join(baseDir, "token.json"),
422
- statePath: String(env.VTX_RUNTIME_STATE_PATH || "").trim() || join(baseDir, "runtime-state.json"),
370
+ statePath: explicitStatePath || join(baseDir, "runtime-state.json"),
371
+ runtimeStateDir: explicitStatePath ? null : baseDir,
423
372
  runtimeDeviceId: String(env.VTX_RUNTIME_DEVICE_ID || "").trim() || null,
424
373
  activeProfileId: Number.isFinite(parsedProfile) && parsedProfile > 0 ? parsedProfile : null,
425
374
  outputJson: String(env.VTX_OUTPUT || "").trim().toLowerCase() === "json"
@@ -1,3 +1,5 @@
1
+ import { createRequire as __vtxCreateRequire } from 'node:module'; const require = __vtxCreateRequire(import.meta.url);
2
+
1
3
  // lib/inference-host/service-bootstrap.ts
2
4
  import { spawn as spawn2 } from "node:child_process";
3
5
  import { createHash, randomUUID } from "node:crypto";
@@ -16,7 +18,7 @@ import { fileURLToPath } from "node:url";
16
18
  // agent-cli-release.json
17
19
  var agent_cli_release_default = {
18
20
  package_name: "@vtxmacro/cli",
19
- package_version: "2026.10.3",
21
+ package_version: "2026.10.5",
20
22
  codex_package_name: "@openai/codex",
21
23
  codex_version: "0.155.0",
22
24
  copilot_sdk_package_name: "@github/copilot-sdk",
@@ -190,30 +192,27 @@ var runtime_policy_generated_default = {
190
192
  trading: {
191
193
  engine: {
192
194
  client_runtime: {
193
- recovery: {
194
- resume_retry_base_delay_ms: 1e3,
195
- resume_retry_max_delay_ms: 3e4,
196
- transient_load_min_delay_ms: 3e4,
197
- transient_load_max_delay_ms: 12e4,
198
- rate_limit_buffer_ms: 1e3,
199
- rate_limit_max_delay_ms: 3e5,
200
- engine_stop_settle_retry_delay_ms: 250,
201
- recoverable_reset_settle_retry_delay_ms: 1500,
202
- local_ai_preflight_timeout_ms: 3e3,
203
- surge_stagger_max_ms: 6e4,
204
- surge_stagger_min_ms: 2e3,
205
- surge_stagger_min_candidates: 4,
206
- stagger_deadline_ttl_ms: 3e5,
207
- server_active_reprobe_delay_ms: 6e4,
208
- transient_load_jitter_ms: 1e4,
209
- cross_host_completed_ttl_ms: 15e3,
210
- telemetry_dedupe_ttl_ms: 5e3,
211
- browser_presence_heartbeat_interval_ms: 3e4,
212
- host_liveness_heartbeat_interval_ms: 3e4,
213
- host_liveness_recovery_nudge_ttl_ms: 1e4
195
+ reconcile: {
196
+ tick_interval_seconds: 30,
197
+ wake_jitter_max_ms: 1e3,
198
+ network_backoff_max_seconds: 300,
199
+ steal_ack_timeout_ms: 5e3,
200
+ explicit_claim_max_waits: 3,
201
+ local_ai_preflight_timeout_ms: 3e3
214
202
  },
215
203
  observability: {
216
204
  deployment_reload_stall_warning_ms: 15e3
205
+ },
206
+ protective_actions: {
207
+ adoption_request_timeout_milliseconds: 2e4,
208
+ idle_recheck_seconds: 60,
209
+ attention_refresh_seconds: 60,
210
+ evidence_max_items: 32,
211
+ evidence_shared_read_seconds: 10
212
+ },
213
+ history_evidence: {
214
+ device_rounds_per_beat: 6,
215
+ device_retry_seconds: 60
217
216
  }
218
217
  },
219
218
  server_runtime: {
@@ -299,7 +298,6 @@ var runtime_policy_generated_default = {
299
298
  userRole: 60,
300
299
  userAbstraction: 20,
301
300
  userDexAbstraction: 20,
302
- userActiveAssetData: 20,
303
301
  activeAssetData: 20,
304
302
  openOrders: 20,
305
303
  orderStatus: 2,
@@ -1,3 +1,5 @@
1
+ import { createRequire as __vtxCreateRequire } from 'node:module'; const require = __vtxCreateRequire(import.meta.url);
2
+
1
3
  // lib/runtime-policy.generated.json
2
4
  var runtime_policy_generated_default = {
3
5
  ui: {
@@ -73,30 +75,27 @@ var runtime_policy_generated_default = {
73
75
  trading: {
74
76
  engine: {
75
77
  client_runtime: {
76
- recovery: {
77
- resume_retry_base_delay_ms: 1e3,
78
- resume_retry_max_delay_ms: 3e4,
79
- transient_load_min_delay_ms: 3e4,
80
- transient_load_max_delay_ms: 12e4,
81
- rate_limit_buffer_ms: 1e3,
82
- rate_limit_max_delay_ms: 3e5,
83
- engine_stop_settle_retry_delay_ms: 250,
84
- recoverable_reset_settle_retry_delay_ms: 1500,
85
- local_ai_preflight_timeout_ms: 3e3,
86
- surge_stagger_max_ms: 6e4,
87
- surge_stagger_min_ms: 2e3,
88
- surge_stagger_min_candidates: 4,
89
- stagger_deadline_ttl_ms: 3e5,
90
- server_active_reprobe_delay_ms: 6e4,
91
- transient_load_jitter_ms: 1e4,
92
- cross_host_completed_ttl_ms: 15e3,
93
- telemetry_dedupe_ttl_ms: 5e3,
94
- browser_presence_heartbeat_interval_ms: 3e4,
95
- host_liveness_heartbeat_interval_ms: 3e4,
96
- host_liveness_recovery_nudge_ttl_ms: 1e4
78
+ reconcile: {
79
+ tick_interval_seconds: 30,
80
+ wake_jitter_max_ms: 1e3,
81
+ network_backoff_max_seconds: 300,
82
+ steal_ack_timeout_ms: 5e3,
83
+ explicit_claim_max_waits: 3,
84
+ local_ai_preflight_timeout_ms: 3e3
97
85
  },
98
86
  observability: {
99
87
  deployment_reload_stall_warning_ms: 15e3
88
+ },
89
+ protective_actions: {
90
+ adoption_request_timeout_milliseconds: 2e4,
91
+ idle_recheck_seconds: 60,
92
+ attention_refresh_seconds: 60,
93
+ evidence_max_items: 32,
94
+ evidence_shared_read_seconds: 10
95
+ },
96
+ history_evidence: {
97
+ device_rounds_per_beat: 6,
98
+ device_retry_seconds: 60
100
99
  }
101
100
  },
102
101
  server_runtime: {
@@ -182,7 +181,6 @@ var runtime_policy_generated_default = {
182
181
  userRole: 60,
183
182
  userAbstraction: 20,
184
183
  userDexAbstraction: 20,
185
- userActiveAssetData: 20,
186
184
  activeAssetData: 20,
187
185
  openOrders: 20,
188
186
  orderStatus: 2,