@vtxmacro/cli 2026.10.13 → 2026.10.15

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
@@ -37,7 +37,92 @@ var init_define_VTX_PI_MODEL_POLICY = __esm({
37
37
  var agent_cli_release_default;
38
38
  var init_agent_cli_release = __esm({
39
39
  "agent-cli-release.json"() {
40
- agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.13", 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" } } };
40
+ agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.15", 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" } } };
41
+ }
42
+ });
43
+
44
+ // lib/constants.ts
45
+ var MS_PER_SECOND, SECONDS_PER_MINUTE, MINUTES_PER_HOUR, HOURS_PER_DAY, DAYS_PER_WEEK, MS_PER_MINUTE, SECONDS_PER_HOUR, SECONDS_PER_DAY, SECONDS_PER_WEEK, MINUTES_PER_DAY, MINUTES_PER_WEEK, MS_PER_HOUR, MS_PER_DAY, READ_STAMP_TIE_MS, BACKOFF_GROWTH_FACTOR, BYTES_PER_KIB, BYTES_PER_MIB, OWNER_ONLY_FILE_MODE, OWNER_ONLY_DIRECTORY_MODE, GROUP_OTHER_PERMISSION_BITS, JSON_INDENT_SPACES, INT32_MIN, INT32_MAX, HTTP_STATUS, AI_COST_ESTIMATE_PERIOD_DAYS, SECONDS_PER_AI_COST_ESTIMATE_PERIOD, NODE_ARGV_COMMAND_ARGS_START, EXIT_CODE_TEMPFAIL, JSON_RPC_ERROR_CODES, INFERENCE_HOST_PROCESS_LOCK_RECORD_SCHEMA_VERSION, INFERENCE_HOST_RECLAIM_GUARD_CREATE_PASSES, LINUX_PROC_STAT_COMM_TERMINATOR_CHARS, INFERENCE_HOST_RANDOM_BYTES, EXIT_CODE_INTERRUPTED, EXIT_CODE_SIGNAL_BASE;
46
+ var init_constants = __esm({
47
+ "lib/constants.ts"() {
48
+ "use strict";
49
+ init_define_VTX_EXO_POLICY();
50
+ init_define_VTX_GROK_POLICY();
51
+ init_define_VTX_PI_MODEL_POLICY();
52
+ MS_PER_SECOND = 1e3;
53
+ SECONDS_PER_MINUTE = 60;
54
+ MINUTES_PER_HOUR = 60;
55
+ HOURS_PER_DAY = 24;
56
+ DAYS_PER_WEEK = 7;
57
+ MS_PER_MINUTE = MS_PER_SECOND * SECONDS_PER_MINUTE;
58
+ SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR;
59
+ SECONDS_PER_DAY = SECONDS_PER_HOUR * HOURS_PER_DAY;
60
+ SECONDS_PER_WEEK = SECONDS_PER_DAY * DAYS_PER_WEEK;
61
+ MINUTES_PER_DAY = MINUTES_PER_HOUR * HOURS_PER_DAY;
62
+ MINUTES_PER_WEEK = MINUTES_PER_DAY * DAYS_PER_WEEK;
63
+ MS_PER_HOUR = MS_PER_MINUTE * MINUTES_PER_HOUR;
64
+ MS_PER_DAY = MS_PER_HOUR * HOURS_PER_DAY;
65
+ READ_STAMP_TIE_MS = MS_PER_SECOND / 1e6;
66
+ BACKOFF_GROWTH_FACTOR = 2;
67
+ BYTES_PER_KIB = 1024;
68
+ BYTES_PER_MIB = BYTES_PER_KIB * BYTES_PER_KIB;
69
+ OWNER_ONLY_FILE_MODE = 384;
70
+ OWNER_ONLY_DIRECTORY_MODE = 448;
71
+ GROUP_OTHER_PERMISSION_BITS = 63;
72
+ JSON_INDENT_SPACES = 2;
73
+ INT32_MIN = -(2 ** 31);
74
+ INT32_MAX = 2 ** 31 - 1;
75
+ HTTP_STATUS = {
76
+ OK: 200,
77
+ ACCEPTED: 202,
78
+ NO_CONTENT: 204,
79
+ FOUND: 302,
80
+ SEE_OTHER: 303,
81
+ BAD_REQUEST: 400,
82
+ UNAUTHORIZED: 401,
83
+ PAYMENT_REQUIRED: 402,
84
+ FORBIDDEN: 403,
85
+ NOT_FOUND: 404,
86
+ METHOD_NOT_ALLOWED: 405,
87
+ REQUEST_TIMEOUT: 408,
88
+ CONFLICT: 409,
89
+ CONTENT_TOO_LARGE: 413,
90
+ URI_TOO_LONG: 414,
91
+ UNSUPPORTED_MEDIA_TYPE: 415,
92
+ UNPROCESSABLE_CONTENT: 422,
93
+ TOO_EARLY: 425,
94
+ TOO_MANY_REQUESTS: 429,
95
+ INTERNAL_SERVER_ERROR: 500,
96
+ BAD_GATEWAY: 502,
97
+ SERVICE_UNAVAILABLE: 503,
98
+ GATEWAY_TIMEOUT: 504
99
+ };
100
+ AI_COST_ESTIMATE_PERIOD_DAYS = 30;
101
+ SECONDS_PER_AI_COST_ESTIMATE_PERIOD = SECONDS_PER_DAY * AI_COST_ESTIMATE_PERIOD_DAYS;
102
+ NODE_ARGV_COMMAND_ARGS_START = 2;
103
+ EXIT_CODE_TEMPFAIL = 75;
104
+ JSON_RPC_ERROR_CODES = {
105
+ PARSE_ERROR: -32700,
106
+ INVALID_REQUEST: -32600,
107
+ METHOD_NOT_FOUND: -32601,
108
+ INVALID_PARAMS: -32602,
109
+ INTERNAL_ERROR: -32603,
110
+ SERVER_ERROR_MIN: -32099,
111
+ SERVER_ERROR_MAX: -32e3
112
+ };
113
+ INFERENCE_HOST_PROCESS_LOCK_RECORD_SCHEMA_VERSION = 2;
114
+ INFERENCE_HOST_RECLAIM_GUARD_CREATE_PASSES = 2;
115
+ LINUX_PROC_STAT_COMM_TERMINATOR_CHARS = 2;
116
+ INFERENCE_HOST_RANDOM_BYTES = {
117
+ TEMP_FILE_SUFFIX: 12,
118
+ LOCK_BALLOT_NAME: 16,
119
+ LOCK_TOKEN: 24,
120
+ OAUTH_PKCE_VERIFIER: 48,
121
+ OAUTH_STATE: 32,
122
+ OAUTH_CALLBACK_PATH: 16
123
+ };
124
+ EXIT_CODE_INTERRUPTED = 130;
125
+ EXIT_CODE_SIGNAL_BASE = 128;
41
126
  }
42
127
  });
43
128
 
@@ -88,6 +173,7 @@ var init_config = __esm({
88
173
  init_define_VTX_EXO_POLICY();
89
174
  init_define_VTX_GROK_POLICY();
90
175
  init_define_VTX_PI_MODEL_POLICY();
176
+ init_constants();
91
177
  }
92
178
  });
93
179
 
@@ -173,6 +259,7 @@ var init_client = __esm({
173
259
  init_define_VTX_PI_MODEL_POLICY();
174
260
  init_agent_cli_release();
175
261
  init_types();
262
+ init_constants();
176
263
  SECRET_RESPONSE_FIELDS = /* @__PURE__ */ new Set([
177
264
  "provider_key_slots",
178
265
  "hyperliquid_signing_key",
@@ -250,7 +337,7 @@ var init_client = __esm({
250
337
  if (!response.ok) {
251
338
  throw await parseError(response, `VTX API request failed: ${response.status}`);
252
339
  }
253
- if (response.status === 204) {
340
+ if (response.status === HTTP_STATUS.NO_CONTENT) {
254
341
  return void 0;
255
342
  }
256
343
  return await response.json();
@@ -1022,13 +1109,13 @@ function stringifyToolResult(result) {
1022
1109
  if (typeof result === "string") {
1023
1110
  return result;
1024
1111
  }
1025
- return JSON.stringify(result, null, 2);
1112
+ return JSON.stringify(result, null, JSON_INDENT_SPACES);
1026
1113
  }
1027
1114
  async function handleMcpJsonRpcRequest(request, clientFactory = createDefaultMcpClient) {
1028
1115
  const id = requestId(request);
1029
1116
  const method = String(request.method || "").trim();
1030
1117
  if (!method) {
1031
- return jsonRpcError(id, -32600, "Invalid JSON-RPC request.");
1118
+ return jsonRpcError(id, JSON_RPC_ERROR_CODES.INVALID_REQUEST, "Invalid JSON-RPC request.");
1032
1119
  }
1033
1120
  if (method === "initialize") {
1034
1121
  return jsonRpcResult(id, {
@@ -1056,7 +1143,7 @@ async function handleMcpJsonRpcRequest(request, clientFactory = createDefaultMcp
1056
1143
  const name = String(params.name || "").trim();
1057
1144
  const args = params.arguments && typeof params.arguments === "object" ? params.arguments : {};
1058
1145
  if (!name) {
1059
- return jsonRpcError(id, -32602, "Tool name is required.");
1146
+ return jsonRpcError(id, JSON_RPC_ERROR_CODES.INVALID_PARAMS, "Tool name is required.");
1060
1147
  }
1061
1148
  try {
1062
1149
  const client = await clientFactory();
@@ -1086,7 +1173,7 @@ async function handleMcpJsonRpcRequest(request, clientFactory = createDefaultMcp
1086
1173
  if (isNotification(request)) {
1087
1174
  return null;
1088
1175
  }
1089
- return jsonRpcError(id, -32601, `Unsupported MCP method: ${method}`);
1176
+ return jsonRpcError(id, JSON_RPC_ERROR_CODES.METHOD_NOT_FOUND, `Unsupported MCP method: ${method}`);
1090
1177
  }
1091
1178
  function encodeMcpFrame(message) {
1092
1179
  const body = JSON.stringify(message);
@@ -1121,9 +1208,9 @@ function parseJsonLineFrame(buffer, newlineEnd) {
1121
1208
  }
1122
1209
  function extractFrame(buffer) {
1123
1210
  const headerEnd = buffer.indexOf("\r\n\r\n");
1124
- const delimiterLength = 4;
1211
+ const delimiterLength = "\r\n\r\n".length;
1125
1212
  const normalizedHeaderEnd = headerEnd >= 0 ? headerEnd : buffer.indexOf("\n\n");
1126
- const normalizedDelimiterLength = headerEnd >= 0 ? delimiterLength : 2;
1213
+ const normalizedDelimiterLength = headerEnd >= 0 ? delimiterLength : "\n\n".length;
1127
1214
  if (normalizedHeaderEnd < 0) {
1128
1215
  const newlineEnd = buffer.indexOf("\n");
1129
1216
  if (newlineEnd < 0) {
@@ -1183,6 +1270,7 @@ var init_stdio = __esm({
1183
1270
  init_define_VTX_PI_MODEL_POLICY();
1184
1271
  init_agent_cli_release();
1185
1272
  init_server();
1273
+ init_constants();
1186
1274
  MCP_PROTOCOL_VERSION = "2024-11-05";
1187
1275
  }
1188
1276
  });
@@ -1231,6 +1319,7 @@ var runtime_policy_generated_default = {
1231
1319
  post_execution_refresh_delay_ms: 3e3,
1232
1320
  account_read_backoff_min_ms: 2e3,
1233
1321
  account_read_backoff_max_ms: 6e4,
1322
+ account_read_backoff_exponent_max: 30,
1234
1323
  ai_start_grace_min_ms: 45e3
1235
1324
  },
1236
1325
  deployment_reload_observability: {
@@ -1255,7 +1344,8 @@ var runtime_policy_generated_default = {
1255
1344
  load_timeout_ms: 5e3,
1256
1345
  initial_load_settle_ms: 100,
1257
1346
  external_save_timeout_ms: 8e3,
1258
- guest_cookie_max_age_days: 9999
1347
+ guest_cookie_max_age_days: 9999,
1348
+ dropdown_search_max_chars: 200
1259
1349
  },
1260
1350
  navigation_feedback: {
1261
1351
  finish_fallback_ms: 2250
@@ -1282,6 +1372,48 @@ var runtime_policy_generated_default = {
1282
1372
  runtime_error_attempt_group_window_seconds: 120,
1283
1373
  debug_runtime_error_preview_chars: 180
1284
1374
  },
1375
+ ai_settings: {
1376
+ storage_authority_broadcast_dedupe_window_ms: 2e3,
1377
+ margin_type_external_authority_ttl_ms: 12e4,
1378
+ screener_status_refresh_delay_ms: 75,
1379
+ preference_message_dedupe_keys: 24,
1380
+ available_assets_retry_default_ms: 15e3,
1381
+ available_assets_retry_min_ms: 1e3,
1382
+ available_assets_retry_max_ms: 6e4,
1383
+ external_sync_settle_ms: 1e3,
1384
+ billing_stats_reuse_ms: 3e3,
1385
+ prompt_commit_debounce_ms: 180,
1386
+ model_count_display_settle_ms: 320,
1387
+ model_picker_scroll_settle_ms: 60
1388
+ },
1389
+ ai_settings_debug: {
1390
+ model_debug_event_limit: 160,
1391
+ browser_resource_timings: 40,
1392
+ browser_resource_panel_rows: 12,
1393
+ browser_timing_refresh_delay_ms: 1500,
1394
+ comparable_hash_full_max_chars: 16,
1395
+ comparable_hash_edge_chars: 8,
1396
+ console_message_chars: 4e3,
1397
+ comparable_diff_max_depth: 4,
1398
+ react_profile_min_duration_ms: 20,
1399
+ react_profile_slower_margin_ms: 25,
1400
+ react_profile_slow_update_ms: 100,
1401
+ react_profile_repeat_interval_ms: 1500,
1402
+ snapshot_ids_head: 10,
1403
+ longtask_samples: 12,
1404
+ recent_events: 20,
1405
+ hydration_recent_events: 12,
1406
+ dirty_state_recent_events: 12,
1407
+ navbar_profile_entries: 30,
1408
+ dropdown_search_paint_events: 6,
1409
+ dropdown_options_debounce_ms: 220,
1410
+ dropdown_hover_min_interval_ms: 80,
1411
+ slow_render_ms: 80,
1412
+ render_min_ms: 24,
1413
+ render_min_interval_ms: 300,
1414
+ model_fingerprint_head: 24,
1415
+ models_head: 12
1416
+ },
1285
1417
  insights_charts: {
1286
1418
  max_charts: 3,
1287
1419
  max_line_points: 160,
@@ -1301,6 +1433,198 @@ var runtime_policy_generated_default = {
1301
1433
  debug_comparable_head_chars: 240,
1302
1434
  debug_panel_comparable_head_chars: 120
1303
1435
  },
1436
+ safe_mode_settings: {
1437
+ usdc_slider_cents_steps: [
1438
+ 10,
1439
+ 25,
1440
+ 50,
1441
+ 75,
1442
+ 100,
1443
+ 150,
1444
+ 200,
1445
+ 300,
1446
+ 400,
1447
+ 500,
1448
+ 750,
1449
+ 1e3,
1450
+ 1500,
1451
+ 2e3,
1452
+ 2500,
1453
+ 3e3,
1454
+ 4e3,
1455
+ 5e3,
1456
+ 7500,
1457
+ 1e4,
1458
+ 15e3,
1459
+ 2e4,
1460
+ 25e3,
1461
+ 3e4,
1462
+ 4e4,
1463
+ 5e4,
1464
+ 75e3,
1465
+ 1e5,
1466
+ 125e3,
1467
+ 15e4,
1468
+ 2e5,
1469
+ 25e4,
1470
+ 3e5,
1471
+ 4e5,
1472
+ 5e5,
1473
+ 6e5,
1474
+ 7e5,
1475
+ 8e5,
1476
+ 9e5,
1477
+ 1e6
1478
+ ],
1479
+ percent_input_step_bps: 1
1480
+ },
1481
+ copy_trading_settings: {
1482
+ scale_multiplier_slider_thousandths_steps: [
1483
+ 10,
1484
+ 20,
1485
+ 30,
1486
+ 40,
1487
+ 50,
1488
+ 75,
1489
+ 100,
1490
+ 150,
1491
+ 200,
1492
+ 250,
1493
+ 300,
1494
+ 400,
1495
+ 500,
1496
+ 600,
1497
+ 700,
1498
+ 800,
1499
+ 850,
1500
+ 900,
1501
+ 950,
1502
+ 975,
1503
+ 1e3,
1504
+ 1025,
1505
+ 1050,
1506
+ 1100,
1507
+ 1250,
1508
+ 1500,
1509
+ 1750,
1510
+ 2e3,
1511
+ 2500,
1512
+ 3e3,
1513
+ 4e3,
1514
+ 5e3,
1515
+ 7500,
1516
+ 1e4,
1517
+ 15e3,
1518
+ 2e4,
1519
+ 3e4,
1520
+ 4e4,
1521
+ 5e4,
1522
+ 75e3,
1523
+ 1e5
1524
+ ]
1525
+ },
1526
+ analysis_settings: {
1527
+ lookback_slider_candles_steps: [
1528
+ 1,
1529
+ 2,
1530
+ 3,
1531
+ 4,
1532
+ 5,
1533
+ 6,
1534
+ 7,
1535
+ 8,
1536
+ 9,
1537
+ 10,
1538
+ 12,
1539
+ 14,
1540
+ 16,
1541
+ 18,
1542
+ 20,
1543
+ 24,
1544
+ 28,
1545
+ 32,
1546
+ 36,
1547
+ 40,
1548
+ 42,
1549
+ 44,
1550
+ 48,
1551
+ 52,
1552
+ 56,
1553
+ 60,
1554
+ 65,
1555
+ 70,
1556
+ 75,
1557
+ 80,
1558
+ 90,
1559
+ 100,
1560
+ 110,
1561
+ 120,
1562
+ 130,
1563
+ 140,
1564
+ 150,
1565
+ 160,
1566
+ 180,
1567
+ 200
1568
+ ]
1569
+ },
1570
+ trading_limit_settings: {
1571
+ ai_trade_amount_usdc_steps: [
1572
+ 20,
1573
+ 30,
1574
+ 40,
1575
+ 50,
1576
+ 60,
1577
+ 70,
1578
+ 80,
1579
+ 90,
1580
+ 100,
1581
+ 150,
1582
+ 175,
1583
+ 200,
1584
+ 225,
1585
+ 250,
1586
+ 275,
1587
+ 300,
1588
+ 325,
1589
+ 350,
1590
+ 375,
1591
+ 400,
1592
+ 425,
1593
+ 450,
1594
+ 475,
1595
+ 500,
1596
+ 600,
1597
+ 700,
1598
+ 800,
1599
+ 900,
1600
+ 1e3,
1601
+ 1250,
1602
+ 1500,
1603
+ 1750,
1604
+ 2e3,
1605
+ 2250,
1606
+ 2500,
1607
+ 2750,
1608
+ 3e3,
1609
+ 3250,
1610
+ 3500,
1611
+ 3750,
1612
+ 4e3,
1613
+ 4250,
1614
+ 4500,
1615
+ 4750,
1616
+ 5e3,
1617
+ 6e3,
1618
+ 7e3,
1619
+ 8e3,
1620
+ 9e3,
1621
+ 1e4
1622
+ ],
1623
+ ai_trade_amount_max_stop_count: 50
1624
+ },
1625
+ calendar_settings: {
1626
+ buffer_input_step_seconds: 30
1627
+ },
1304
1628
  debug_logs: {
1305
1629
  snapshot_card_lines: 80,
1306
1630
  render_debug_overlay_entries: 120,
@@ -1311,7 +1635,8 @@ var runtime_policy_generated_default = {
1311
1635
  admin_text_chars: 160,
1312
1636
  admin_analysis_run_id_chars: 32,
1313
1637
  hyperliquid_balance_preview_count: 3,
1314
- model_picker_preview_count: 5
1638
+ model_picker_preview_count: 5,
1639
+ render_debug_entries: 250
1315
1640
  },
1316
1641
  history_panels: {
1317
1642
  display_batch_size: 50,
@@ -1319,20 +1644,298 @@ var runtime_policy_generated_default = {
1319
1644
  trade_history_fetch_page_size: 100,
1320
1645
  ai_panel_interaction_window_ms: 2500,
1321
1646
  ai_panel_defer_max_staleness_ms: 1e4,
1322
- ai_panel_defer_retry_ms: 1500
1647
+ ai_panel_defer_retry_ms: 1500,
1648
+ order_id_metadata_traversal_max_nodes: 400
1649
+ },
1650
+ trade_page: {
1651
+ config_first_retry_delay_ms: 1e3,
1652
+ margin_mode_min_loading_ms: 250,
1653
+ preferences_load_retry_delay_ms_steps: [
1654
+ 1500,
1655
+ 3e3,
1656
+ 6e3,
1657
+ 12e3
1658
+ ],
1659
+ preferences_retry_jitter_max_ms: 1500,
1660
+ all_profile_preferences_save_delay_ms: 1500,
1661
+ all_profile_save_interaction_window_ms: 2e3,
1662
+ all_profile_read_concurrency: 2,
1663
+ all_profile_ai_event_dedupe_limit: 200,
1664
+ all_profile_order_history_limit: 50,
1665
+ all_profile_section_timeout_min_ms: 1e3,
1666
+ all_profile_account_summary_poll_min_ms: 1e3,
1667
+ all_profile_trade_history_poll_min_ms: 1e3,
1668
+ all_profile_live_refresh_idle_timeout_ms: 5e3,
1669
+ copy_trading_message_limit: 25,
1670
+ browser_account_refresh_min_interval_ms: 1250,
1671
+ browser_account_watchdog_poll_min_ms: 1e4,
1672
+ rate_limit_retry_buffer_ms: 250,
1673
+ restricted_runtime_poll_min_ms: 3e3,
1674
+ restricted_runtime_event_limit: 20,
1675
+ server_account_rest_catchup_min_interval_ms: 5e3,
1676
+ server_account_catchup_poll_min_ms: 5e3,
1677
+ execution_rest_catchup_delay_ms_steps: [
1678
+ 2e3,
1679
+ 8e3
1680
+ ],
1681
+ unified_bootstrap_hold_min_ms: 4e3,
1682
+ unified_bootstrap_hold_max_ms: 8e3,
1683
+ observed_activity_recent_ms: 8e3,
1684
+ startup_hold_activation_gap_ms: 9e4,
1685
+ hidden_ticker_update_interval_ms: 16,
1686
+ client_close_fill_sync_attempts: 3,
1687
+ client_close_fill_sync_retry_step_ms: 300,
1688
+ leverage_update_debounce_ms: 250,
1689
+ post_leverage_update_order_delay_ms: 250,
1690
+ ai_control_lookback_fallback_candles: 25,
1691
+ takeover_telemetry_error_chars: 500,
1692
+ takeover_telemetry_error_name_chars: 120,
1693
+ takeover_telemetry_failure_chars: 300,
1694
+ client_next_run_interval_min_ms: 1e3,
1695
+ ws_server_time_reorder_tolerance_ms: 1e3
1696
+ },
1697
+ trade_account_summary: {
1698
+ unified_min_balances_usd: 25,
1699
+ unified_balances_account_value_multiple: 3,
1700
+ unified_spot_ratio_percent: 50
1701
+ },
1702
+ trade_debug_logs: {
1703
+ text_chars: 180,
1704
+ runtime_identity_tail_chars: 18,
1705
+ run_id_chars: 8,
1706
+ control_step_error_chars: 160,
1707
+ control_note_chars: 120,
1708
+ error_detail_chars: 120,
1709
+ click_target_text_chars: 120,
1710
+ ai_log_text_chars: 120,
1711
+ preferences_error_chars: 160,
1712
+ ssr_error_detail_chars: 160,
1713
+ breadcrumb_payload_chars: 500,
1714
+ render_debug_data_chars: 1200,
1715
+ server_execution_value_chars: 700,
1716
+ server_execution_error_chars: 250,
1717
+ cost_trace_execution_debug_chars: 500,
1718
+ positions_fetch_error_chars: 220,
1719
+ ai_debug_lines: 100,
1720
+ ai_model_status_lines: 100,
1721
+ ai_model_status_shown_lines: 80,
1722
+ ai_status_bar_trace_lines: 200,
1723
+ ai_status_bar_trace_shown_lines: 120,
1724
+ ai_status_bar_transition_lines: 200,
1725
+ ai_status_bar_transition_shown_lines: 120,
1726
+ ai_status_role_compare_lines: 240,
1727
+ ai_status_role_compare_shown_lines: 160,
1728
+ ai_status_bar_input_lines: 200,
1729
+ ai_status_bar_input_shown_lines: 120,
1730
+ ai_engine_transition_lines: 200,
1731
+ ai_engine_transition_shown_lines: 120,
1732
+ ai_panel_cost_lines: 120,
1733
+ ai_panel_cost_shown_lines: 80,
1734
+ ai_runtime_error_label_lines: 100,
1735
+ ai_runtime_error_label_shown_lines: 80,
1736
+ loop_status_mutation_lines: 200,
1737
+ loop_status_mutation_shown_lines: 120,
1738
+ login_recovery_trace_lines: 240,
1739
+ sparkle_ownership_lines: 120,
1740
+ ai_trader_start_lines: 100,
1741
+ ai_trader_restart_trace_lines: 120,
1742
+ ai_control_button_trace_lines: 240,
1743
+ profile_status_hydration_lines: 120,
1744
+ profile_status_hydration_shown_lines: 100,
1745
+ cross_profile_runtime_lines: 120,
1746
+ cross_profile_runtime_shown_lines: 80,
1747
+ all_mode_ai_history_lines: 120,
1748
+ positions_pnl_lines: 240,
1749
+ positions_pnl_shown_lines: 200,
1750
+ positions_pnl_changed_rows: 12,
1751
+ account_state_lines: 80,
1752
+ account_state_shown_lines: 200,
1753
+ symbol_hydration_lines: 120,
1754
+ trade_ui_click_lines: 200,
1755
+ manual_close_lines: 80,
1756
+ all_mode_interaction_lines: 160,
1757
+ chart_render_entries: 80,
1758
+ control_state_lines: 80,
1759
+ runtime_network_lines: 80,
1760
+ provider_fallback_trace_lines: 60,
1761
+ runtime_stop_trace_lines: 80,
1762
+ runtime_stop_breadcrumb_lines: 40,
1763
+ prompt_contract_trace_lines: 80,
1764
+ execution_trace_lines: 120,
1765
+ single_history_trace_lines: 40,
1766
+ ignored_ticker_channels: 8,
1767
+ recent_network_targets: 8,
1768
+ provider_failure_blocks: 6,
1769
+ market_data_failure_blocks: 8,
1770
+ pricing_candidates_shown: 10,
1771
+ balance_delta_coins: 3,
1772
+ all_mode_ai_head_messages: 5,
1773
+ server_execution_decisions: 10,
1774
+ server_decisions_shown: 5,
1775
+ server_execution_refresh_ms: 1e4,
1776
+ interaction_sample_delay_ms: 250,
1777
+ local_breadcrumb_refresh_ms: 1e3,
1778
+ flicker_direction_flip_window_ms: 6e3,
1779
+ flicker_warmup_window_ms: 3e4,
1780
+ upnl_double_count_min_cents: 50,
1781
+ upnl_double_count_tolerance_cents: 5,
1782
+ upnl_source_gap_min_cents: 50,
1783
+ nonzero_upnl_jump_min_cents: 25,
1784
+ nonzero_upnl_jump_min_relative_percent: 50,
1785
+ nonzero_upnl_jump_min_margin_percent: 2,
1786
+ cross_source_upnl_flicker_max_age_ms: 1e3,
1787
+ cross_source_upnl_flicker_min_cents: 5,
1788
+ restart_trace_manual_stop_window_minutes: 15,
1789
+ hold_age_rounding_ms: 100,
1790
+ account_summary_missing_trace_ms: 5e3
1323
1791
  },
1324
1792
  insights_access: {
1325
1793
  initial_prompt_idea_count: 6,
1326
1794
  section_preview_blocks: 2
1327
1795
  },
1328
1796
  marketing: {
1329
- arena_leaderboard_entries: 3
1797
+ arena_leaderboard_entries: 3,
1798
+ data_revalidate_seconds: 60
1330
1799
  },
1331
1800
  calendar: {
1332
- event_highlight_window_minutes: 60
1801
+ event_highlight_window_minutes: 60,
1802
+ search_save_debounce_ms: 250
1333
1803
  },
1334
1804
  system_page: {
1335
- hyperliquid_manual_refresh_cooldown_ms: 800
1805
+ hyperliquid_manual_refresh_cooldown_ms: 800,
1806
+ config_retry_initial_delay_ms: 1e3,
1807
+ debug_api_profile_poll_ms: 500,
1808
+ debug_save_lines: 120,
1809
+ debug_model_sync_lines: 80,
1810
+ debug_byok_trace_lines: 160,
1811
+ debug_profile_delete_trace_lines: 80,
1812
+ debug_local_ai_trace_lines: 120,
1813
+ debug_hyperliquid_trace_lines: 120,
1814
+ debug_oac_trace_lines: 120,
1815
+ debug_oac_applied_state_lines: 40,
1816
+ debug_report_trace_lines: 40,
1817
+ debug_report_trace_line_chars: 360,
1818
+ debug_field_value_chars: 96,
1819
+ debug_identity_redact_max_chars: 8,
1820
+ debug_identity_edge_chars: 4
1821
+ },
1822
+ analysis_page: {
1823
+ debug_log_lines: 120
1824
+ },
1825
+ changelog_page: {
1826
+ profile_search_debounce_ms: 300,
1827
+ search_debounce_ms: 300,
1828
+ scope_navigation_filters_max_age_ms: 3e4,
1829
+ prompt_diff_context_lines: 3,
1830
+ debug_event_lines: 120
1831
+ },
1832
+ help_page: {
1833
+ hash_scroll_settle_ms: 250
1834
+ },
1835
+ history_page: {
1836
+ preferences_save_debounce_ms: 500,
1837
+ tracked_ws_prompt_id_count: 500,
1838
+ ws_prompt_fingerprint_text_chars: 80,
1839
+ load_more_visibility_percent: 10
1840
+ },
1841
+ leaderboard_page: {
1842
+ debug_panel_entries: 80,
1843
+ debug_navbar_profile_entries: 12
1844
+ },
1845
+ login_page: {
1846
+ desktop_bridge_poll_ms: 250,
1847
+ turnstile_site_key_log_chars: 10
1848
+ },
1849
+ screener_page: {
1850
+ search_save_debounce_ms: 250,
1851
+ ws_refresh_debounce_ms: 40,
1852
+ stop_client_run_wait_checks: 30,
1853
+ stop_client_run_wait_poll_ms: 50,
1854
+ assignment_load_more_threshold_px: 48,
1855
+ debug_log_lines: 160,
1856
+ debug_runtime_events: 30,
1857
+ debug_search_transitions: 40,
1858
+ debug_expansion_transitions: 80,
1859
+ debug_value_chars: 260,
1860
+ debug_text_chars: 180,
1861
+ debug_array_items: 20,
1862
+ debug_event_preview_items: 12,
1863
+ debug_snapshot_keys: 25,
1864
+ debug_snapshot_rows: 8
1865
+ },
1866
+ sitemap: {
1867
+ leaderboard_page_batch_size: 5,
1868
+ leaderboard_max_pages: 160,
1869
+ leaderboard_scan_attempts: 3,
1870
+ home_priority_percent: 100,
1871
+ team_priority_percent: 50,
1872
+ contact_priority_percent: 50,
1873
+ methodology_priority_percent: 80,
1874
+ trust_priority_percent: 70,
1875
+ insights_priority_percent: 90,
1876
+ referrals_priority_percent: 60,
1877
+ start_priority_percent: 80,
1878
+ leaderboard_priority_percent: 90,
1879
+ updates_priority_percent: 80,
1880
+ changelog_priority_percent: 70,
1881
+ models_priority_percent: 70,
1882
+ calendar_priority_percent: 60,
1883
+ help_priority_percent: 70,
1884
+ faq_priority_percent: 70,
1885
+ download_priority_percent: 70,
1886
+ privacy_priority_percent: 30,
1887
+ terms_priority_percent: 30,
1888
+ update_post_priority_percent: 60,
1889
+ profile_trade_priority_percent: 70,
1890
+ profile_analytics_priority_percent: 70,
1891
+ profile_changelog_priority_percent: 60
1892
+ },
1893
+ tax_page: {
1894
+ display_batch_size: 50,
1895
+ load_more_delay_ms: 120,
1896
+ load_more_visibility_percent: 10,
1897
+ selectable_year_count: 5,
1898
+ debug_log_lines: 150
1899
+ },
1900
+ updates_page: {
1901
+ post_edited_label_min_gap_ms: 6e4,
1902
+ comment_edited_label_min_gap_ms: 2e3,
1903
+ meta_description_chars: 160
1904
+ },
1905
+ social_previews: {
1906
+ subject_max_chars: 96,
1907
+ viewport_width: 1600,
1908
+ viewport_height: 900,
1909
+ chart_painted_min_px: 100,
1910
+ chart_paint_poll_ms: 200
1911
+ },
1912
+ manual_order_retry: {
1913
+ max_attempts: 2,
1914
+ default_retry_after_milliseconds: 1500,
1915
+ retry_after_padding_milliseconds: 200,
1916
+ min_delay_milliseconds: 500,
1917
+ max_delay_milliseconds: 8e3
1918
+ },
1919
+ api_client: {
1920
+ get_dedupe_ttl_ms: 2e3,
1921
+ runtime_statuses_dedupe_ttl_ms: 5e3,
1922
+ llm_config_prime_ttl_ms: 1e4,
1923
+ leaderboard_dedupe_ttl_ms: 2e3,
1924
+ platform_pricing_revalidate_seconds: 300,
1925
+ platform_pricing_timeout_ms: 2e3,
1926
+ market_data_error_detail_chars: 240,
1927
+ market_data_interest_error_detail_chars: 200,
1928
+ ai_trade_history_order_id_lookup_concurrency: 4,
1929
+ exchange_evidence_rejection_detail_chars: 200
1930
+ },
1931
+ interaction: {
1932
+ debounce_ms: 250,
1933
+ command_list_scroll_settle_ms: 60
1934
+ },
1935
+ model_selection: {
1936
+ local_context_cache_ttl_hours: 12,
1937
+ pending_local_main_selection_ttl_hours: 12,
1938
+ pending_openai_compatible_main_selection_ttl_hours: 12
1336
1939
  }
1337
1940
  },
1338
1941
  ai_dashboard: {
@@ -1376,6 +1979,10 @@ var runtime_policy_generated_default = {
1376
1979
  ]
1377
1980
  },
1378
1981
  defaults: {
1982
+ calendar_settings: {
1983
+ pre_buffer_mins: 60,
1984
+ post_buffer_mins: 30
1985
+ },
1379
1986
  max_chat_turns: 9999
1380
1987
  }
1381
1988
  },
@@ -1388,10 +1995,14 @@ var runtime_policy_generated_default = {
1388
1995
  network_backoff_max_seconds: 300,
1389
1996
  steal_ack_timeout_ms: 5e3,
1390
1997
  explicit_claim_max_waits: 3,
1391
- local_ai_preflight_timeout_ms: 3e3
1998
+ local_ai_preflight_timeout_ms: 3e3,
1999
+ wake_debounce_ms: 250,
2000
+ claim_settle_poll_ms: 50,
2001
+ network_backoff_exponent_max: 16
1392
2002
  },
1393
2003
  observability: {
1394
- deployment_reload_stall_warning_ms: 15e3
2004
+ deployment_reload_stall_warning_ms: 15e3,
2005
+ prompt_parity_error_detail_max_chars: 500
1395
2006
  },
1396
2007
  protective_actions: {
1397
2008
  adoption_request_timeout_milliseconds: 2e4,
@@ -1399,11 +2010,16 @@ var runtime_policy_generated_default = {
1399
2010
  attention_refresh_seconds: 60,
1400
2011
  evidence_max_items: 32,
1401
2012
  evidence_shared_read_seconds: 10,
1402
- retry_delay_seconds: 15
2013
+ retry_delay_seconds: 15,
2014
+ evidence_min_sweep_delay_milliseconds: 1e3,
2015
+ device_sweep_max_actions: 8,
2016
+ remaining_recheck_milliseconds: 2e3,
2017
+ evidence_max_age_seconds: 45
1403
2018
  },
1404
2019
  exchange_mutation: {
1405
2020
  settlement_retry_milliseconds: 1e3,
1406
- settlement_retry_window_seconds: 120
2021
+ settlement_retry_window_seconds: 120,
2022
+ reconciliation_margin_milliseconds: 250
1407
2023
  },
1408
2024
  protective_plan_set_lock: {
1409
2025
  wait_seconds: 120
@@ -1417,7 +2033,8 @@ var runtime_policy_generated_default = {
1417
2033
  device_retry_seconds: 60
1418
2034
  },
1419
2035
  panel_reads: {
1420
- device_open_orders_reuse_seconds: 2
2036
+ device_open_orders_reuse_seconds: 2,
2037
+ all_view_profile_concurrency: 2
1421
2038
  },
1422
2039
  account_stream: {
1423
2040
  fill_forward_interval_ms: 1e3,
@@ -1434,9 +2051,56 @@ var runtime_policy_generated_default = {
1434
2051
  ai_schedule_pause_unknown_milliseconds: 6e4,
1435
2052
  provider_failure_diagnostics_delay_milliseconds: 2500,
1436
2053
  provider_failure_diagnostics_max_age_milliseconds: 3e4,
1437
- killswitch_timer_floor_milliseconds: 1e3
2054
+ killswitch_timer_floor_milliseconds: 1e3,
2055
+ cycle_timeout_floor_milliseconds: 1e3,
2056
+ decision_settlement_reserve_max_budget_divisor: 2,
2057
+ close_fill_sync_max_attempts: 3,
2058
+ close_fill_sync_retry_step_milliseconds: 300,
2059
+ execution_mode_mismatch_stop_checks: 2,
2060
+ request_bounds: {
2061
+ min_agent_instruction_retry_after_ms: 25,
2062
+ max_fallback_error_length: 500
2063
+ },
2064
+ pending_protection_recovery: {
2065
+ retry_exponent_max: 30
2066
+ },
2067
+ device_diagnostics: {
2068
+ error_cause_max_depth: 4,
2069
+ request_path_chars: 200,
2070
+ request_method_chars: 12,
2071
+ error_kind_chars: 40,
2072
+ request_id_chars: 128,
2073
+ contract_token_prefix_chars: 12,
2074
+ copy_trading_request_id_chars: 80,
2075
+ copy_trading_status_chars: 80,
2076
+ browser_platform_chars: 40,
2077
+ breadcrumbs_max_entries: 40,
2078
+ breadcrumb_detail_chars: 280,
2079
+ network_debug_max_entries: 80,
2080
+ provider_failure_debug_max_entries: 20,
2081
+ market_data_failure_debug_max_entries: 20,
2082
+ request_string_compact_above_chars: 500,
2083
+ prompt_preview_chars: 220,
2084
+ provider_failure_snapshot_max_age_seconds: 300,
2085
+ local_provider_probe_timeout_ms: 2e3,
2086
+ preflight_failure_reason_chars: 200,
2087
+ host_error_note_chars: 160,
2088
+ tick_failure_note_chars: 300,
2089
+ auto_resume_failure_detail_chars: 500,
2090
+ vault_migration_error_chars: 200
2091
+ },
2092
+ request_retry: {
2093
+ max_attempts: 3,
2094
+ base_delay_milliseconds: 300,
2095
+ max_delay_milliseconds: 8e3,
2096
+ min_retry_after_milliseconds: 250,
2097
+ deadline_attempt_spacing_milliseconds: 250
2098
+ }
1438
2099
  },
1439
2100
  server_runtime: {
2101
+ exchange_mutation_reconciliation: {
2102
+ protective_episode_end_fill_lookback_seconds: 120
2103
+ },
1440
2104
  prompt_rescue: {
1441
2105
  request_ttl_seconds: 20,
1442
2106
  snapshot_max_age_seconds: 5,
@@ -1460,7 +2124,9 @@ var runtime_policy_generated_default = {
1460
2124
  max_requests_per_read: 64,
1461
2125
  history_start_ms: 16409952e5,
1462
2126
  device_read_deadline_seconds: 180,
1463
- device_recent_window_hours: 24
2127
+ device_recent_window_hours: 24,
2128
+ order_history_default_limit: 2e3,
2129
+ order_history_max_limit: 2e3
1464
2130
  },
1465
2131
  tradability: {
1466
2132
  score_min: 1,
@@ -1471,12 +2137,32 @@ var runtime_policy_generated_default = {
1471
2137
  update_check_interval_ms: 144e5,
1472
2138
  update_check_timeout_ms: 5e3,
1473
2139
  stage_timeout_ms: 6e5,
1474
- startup_ready_timeout_ms: 12e4
2140
+ startup_ready_timeout_ms: 12e4,
2141
+ headless_claim_max_waits: 10,
2142
+ headless_stop_request_timeout_ms: 1e4,
2143
+ headless_max_resumes_without_a_cycle: 5,
2144
+ headless_resume_backoff_ms_steps: [
2145
+ 1e3,
2146
+ 5e3,
2147
+ 15e3,
2148
+ 3e4,
2149
+ 6e4
2150
+ ],
2151
+ headless_backup_first_read_retry_ms_steps: [
2152
+ 1e3,
2153
+ 5e3
2154
+ ],
2155
+ browser_login_verifier_bytes: 32,
2156
+ update_failure_reason_max_chars: 160,
2157
+ update_directory_failure_reason_max_chars: 120,
2158
+ update_plan_max_attempts: 3,
2159
+ supervisor_max_failed_release_starts: 2
1475
2160
  },
1476
2161
  leaderboard: {
1477
2162
  device_portfolio: {
1478
2163
  device_retry_seconds: 300
1479
- }
2164
+ },
2165
+ max_page_size: 100
1480
2166
  },
1481
2167
  external_inference: {
1482
2168
  service: {
@@ -1494,6 +2180,13 @@ var runtime_policy_generated_default = {
1494
2180
  update_readiness_timeout_ms: 6e5,
1495
2181
  rollback_confirmation_min_attempts: 100,
1496
2182
  ready_consecutive_observations: 2,
2183
+ update_attempts: 3,
2184
+ update_retry_interval_ms: 2e3,
2185
+ update_failure_reason_max_chars: 160,
2186
+ launcher_poll_interval_ms: 100,
2187
+ log_tail_default_lines: 100,
2188
+ worker_output_line_max_chars: 4096,
2189
+ worker_stdout_tail_max_chars: 65536,
1497
2190
  control_lock_wait_attempts: 400,
1498
2191
  control_lock_retry_interval_ms: 250,
1499
2192
  supervisor_manifest_poll_interval_ms: 250,
@@ -1502,6 +2195,44 @@ var runtime_policy_generated_default = {
1502
2195
  claim_diagnostics: {
1503
2196
  event_loop_sample_interval_ms: 100
1504
2197
  },
2198
+ host_core: {
2199
+ oauth_request_timeout_ms: 15e3,
2200
+ oauth_revocation_timeout_ms: 5e3,
2201
+ oauth_login_timeout_ms: 6e5,
2202
+ mcp_request_timeout_ms: 15e3,
2203
+ mcp_retry_after_max_ms: 864e5,
2204
+ credential_command_timeout_ms: 15e3,
2205
+ credential_command_termination_timeout_ms: 5e3,
2206
+ credential_command_output_max_bytes: 1048576,
2207
+ private_file_max_bytes: 16777216,
2208
+ private_file_replace_attempts: 40,
2209
+ private_file_replace_retry_delay_ms: 25,
2210
+ atomic_replacement_read_attempts: 3,
2211
+ owned_directory_removal_attempts: 10,
2212
+ owned_directory_removal_retry_step_ms: 100,
2213
+ identity_command_timeout_ms: 5e3,
2214
+ identity_command_output_max_bytes: 4096,
2215
+ windows_identity_command_timeout_ms: 15e3,
2216
+ windows_process_identity_output_max_bytes: 1024,
2217
+ windows_acl_broker_startup_timeout_ms: 9e4,
2218
+ windows_acl_broker_request_timeout_ms: 15e3,
2219
+ windows_acl_broker_idle_shutdown_ms: 3e4,
2220
+ windows_acl_broker_kill_grace_ms: 1e3,
2221
+ windows_acl_broker_request_max_bytes: 65536,
2222
+ windows_acl_broker_output_max_chars: 65536,
2223
+ windows_acl_broker_response_line_max_chars: 4096,
2224
+ process_lock_publication_grace_ms: 1e4,
2225
+ process_lock_record_max_bytes: 65536,
2226
+ process_lock_guard_election_lease_ms: 5e3,
2227
+ process_lock_guard_election_stale_ms: 3e4,
2228
+ process_lock_guard_election_attempts: 8,
2229
+ process_lock_guard_election_backoff_ms: 10,
2230
+ process_lock_guard_election_backoff_exponent_max: 4,
2231
+ process_lock_identity_cache_ms: 5e3
2232
+ },
2233
+ agent_control: {
2234
+ max_turn_decision_operation_ids: 128
2235
+ },
1505
2236
  host_runtime: {
1506
2237
  advertisement_ttl_ms: 12e4,
1507
2238
  advertisement_refresh_lead_ms: 3e4,
@@ -1510,6 +2241,9 @@ var runtime_policy_generated_default = {
1510
2241
  agent_heartbeat_interval_ms: 3e3,
1511
2242
  agent_heartbeat_max_retry_delay_ms: 9e3,
1512
2243
  provider_rate_limit_refresh_ms: 6e4,
2244
+ provider_quota_recovery_max_age_refresh_intervals: 2,
2245
+ model_catalog_read_lead_divisor: 2,
2246
+ agent_wake_summary_max_chars: 2e3,
1513
2247
  drain_timeout_ms: 3e4,
1514
2248
  remote_retry_limit: 3,
1515
2249
  minimum_sleep_ms: 10,
@@ -1534,10 +2268,72 @@ var runtime_policy_generated_default = {
1534
2268
  agent_turn_timeout_ms: 6e5,
1535
2269
  codex_rate_limit_metadata_timeout_ms: 5e3,
1536
2270
  codex_login_timeout_ms: 9e5,
1537
- codex_command_timeout_ms: 3e4
2271
+ codex_command_timeout_ms: 3e4,
2272
+ cli_wait_default_seconds: 50,
2273
+ cli_wait_max_seconds: 300,
2274
+ cli_log_lines_default: 100,
2275
+ cli_log_lines_max: 1e4,
2276
+ service_control_input_max_chars: 4096,
2277
+ codex_auth_file_max_bytes: 8388608,
2278
+ agent_stdin_max_bytes: 1e6,
2279
+ agent_next_poll_min_ms: 50,
2280
+ agent_assignment_poll_min_ms: 250,
2281
+ agent_assignment_poll_fallback_ms: 1e3,
2282
+ agent_assignment_poll_max_ms: 5e3,
2283
+ codex_recovery_scan_max_entries: 2e4,
2284
+ codex_recovery_scan_max_depth: 12,
2285
+ codex_recovery_thread_file_max_bytes: 33554432,
2286
+ codex_recovery_thread_scan_lines: 128,
2287
+ codex_quiescence_proof_max_age_ms: 3e4,
2288
+ codex_quiescence_proof_clock_skew_ms: 1e3,
2289
+ codex_guardian_start_timeout_ms: 1e4,
2290
+ codex_guardian_termination_timeout_ms: 5e3,
2291
+ codex_guardian_termination_deadline_min_ms: 25,
2292
+ codex_guardian_state_poll_ms: 25,
2293
+ codex_guardian_shutdown_grace_ms: 2e3,
2294
+ codex_guardian_shutdown_grace_min_ms: 25,
2295
+ codex_guardian_receipt_replace_attempts: 40,
2296
+ codex_guardian_receipt_replace_retry_ms: 25,
2297
+ codex_diagnostic_attempt_ids_max: 64,
2298
+ codex_retired_response_ids_max: 256,
2299
+ codex_stderr_classification_tail_chars: 1024,
2300
+ codex_request_timeout_ms: 3e4,
2301
+ codex_interrupt_timeout_ms: 5e3,
2302
+ codex_login_cancel_timeout_ms: 5e3,
2303
+ codex_close_exit_timeout_ms: 5e3,
2304
+ codex_close_terminate_timeout_ms: 1e3,
2305
+ codex_close_kill_timeout_ms: 1e3,
2306
+ codex_process_tree_cleanup_timeout_ms: 5e3,
2307
+ binary_version_probe_timeout_ms: 1e4,
2308
+ binary_version_probe_stdout_max_chars: 1024,
2309
+ codex_version_probe_stderr_max_bytes: 65536,
2310
+ codex_recovery_process_observations: 2,
2311
+ codex_recovery_process_observation_interval_ms: 250,
2312
+ codex_recovery_process_query_stdout_max_chars: 4e6,
2313
+ codex_recovery_process_query_stderr_max_chars: 4096,
2314
+ deepseek_transport_request_max_bytes: 8388608,
2315
+ exo_command_output_max_bytes: 4e6,
2316
+ exo_git_output_max_chars: 2e5,
2317
+ exo_bridge_request_max_bytes: 2e6,
2318
+ exo_bridge_request_timeout_ms: 3e4,
2319
+ exo_provider_retry_after_max_ms: 864e5,
2320
+ grok_preflight_timeout_ms: 3e4,
2321
+ grok_login_timeout_ms: 9e5,
2322
+ grok_command_timeout_ms: 3e4,
2323
+ grok_auth_output_max_bytes: 65536,
2324
+ grok_binary_max_bytes: 536870912,
2325
+ grok_acp_message_max_bytes: 2e6,
2326
+ grok_close_kill_delay_ms: 1500,
2327
+ grok_mcp_request_max_bytes: 3e5,
2328
+ grok_cwd_marker_max_bytes: 32768,
2329
+ grok_session_summary_max_bytes: 1048576,
2330
+ provider_error_body_timeout_ms: 1e3,
2331
+ provider_error_body_max_bytes: 16384,
2332
+ pi_receipt_event_max_chars: 2e6
1538
2333
  },
1539
2334
  quota_membership_cooldown_seconds: 300,
1540
- transient_membership_cooldown_seconds: 30
2335
+ transient_membership_cooldown_seconds: 30,
2336
+ runtime_poll_interval_milliseconds: 250
1541
2337
  },
1542
2338
  desktop: {
1543
2339
  runtime_watchdog: {
@@ -1553,6 +2349,16 @@ var runtime_policy_generated_default = {
1553
2349
  client_lock_ttl_milliseconds: 12e4,
1554
2350
  client_poll_interval_milliseconds: 250
1555
2351
  },
2352
+ ui_bounds: {
2353
+ screener_min_volume_usd_max: 1e9
2354
+ },
2355
+ runtime: {
2356
+ assignment_page_default_limit: 20,
2357
+ client_candidate_owner_lease_grace_ms: 6e4,
2358
+ client_server_heartbeats_per_owner_lease: 2,
2359
+ client_server_heartbeat_min_ms: 5e3,
2360
+ client_server_heartbeat_max_ms: 3e4
2361
+ },
1556
2362
  defaults: {
1557
2363
  adaptive_schedule_enabled: true
1558
2364
  }
@@ -1686,6 +2492,9 @@ var runtime_policy_generated_default = {
1686
2492
  tokens: {
1687
2493
  email_2fa_code_length: 6,
1688
2494
  totp_code_length: 6
2495
+ },
2496
+ passwords: {
2497
+ min_length: 12
1689
2498
  }
1690
2499
  },
1691
2500
  android: {
@@ -1726,6 +2535,14 @@ var runtime_policy_generated_default = {
1726
2535
  handle_change_window_days: 14
1727
2536
  }
1728
2537
  },
2538
+ copy_trading: {
2539
+ source_search: {
2540
+ min_query_length: 2
2541
+ },
2542
+ runtime: {
2543
+ client_account_mode_cache_budget_divisor: 2
2544
+ }
2545
+ },
1729
2546
  billing: {
1730
2547
  credit_purchase: {
1731
2548
  amount_usd_steps: [
@@ -1765,6 +2582,22 @@ var runtime_policy_generated_default = {
1765
2582
  min_query_length: 2
1766
2583
  }
1767
2584
  },
2585
+ profile_setting_changelog: {
2586
+ public_profile_search_limit: 10,
2587
+ page_default_limit: 50
2588
+ },
2589
+ history: {
2590
+ full_history_default_limit: 20,
2591
+ default_page_size: 50,
2592
+ trade_lookup_max_order_ids: 200,
2593
+ decision_batch_default_limit: 50
2594
+ },
2595
+ updates: {
2596
+ posts: {
2597
+ list_default_limit: 20,
2598
+ list_max_limit: 100
2599
+ }
2600
+ },
1768
2601
  security: {
1769
2602
  byok: {
1770
2603
  max_provider_keys_per_provider: 5
@@ -1781,11 +2614,22 @@ var runtime_policy_generated_default = {
1781
2614
  }
1782
2615
  },
1783
2616
  referrals: {
1784
- code_max_length: 24
2617
+ code_max_length: 24,
2618
+ dashboard_default_limit: 20
2619
+ },
2620
+ insights: {
2621
+ client_host: {
2622
+ device_read_default_result_bytes: 2e5
2623
+ }
2624
+ },
2625
+ agent_tokens: {
2626
+ browser_login_ttl_seconds: 600,
2627
+ browser_login_poll_interval_seconds: 2
1785
2628
  }
1786
2629
  };
1787
2630
 
1788
2631
  // lib/cli-release/updater.ts
2632
+ init_constants();
1789
2633
  init_config();
1790
2634
 
1791
2635
  // lib/agent-core/stop-signals.ts
@@ -1862,13 +2706,15 @@ init_define_VTX_GROK_POLICY();
1862
2706
  init_define_VTX_PI_MODEL_POLICY();
1863
2707
 
1864
2708
  // lib/inference-host/config.ts
2709
+ init_constants();
2710
+ var HOST_CORE_POLICY = runtime_policy_generated_default.external_inference.host_core;
1865
2711
  var InferenceHostProcessLockBusyError = class extends Error {
1866
2712
  constructor() {
1867
2713
  super("Another inference host process already owns this local host.");
1868
2714
  this.name = "InferenceHostProcessLockBusyError";
1869
2715
  }
1870
2716
  };
1871
- var MAX_INFERENCE_PRIVATE_FILE_BYTES = 16 * 1024 * 1024;
2717
+ var MAX_INFERENCE_PRIVATE_FILE_BYTES = HOST_CORE_POLICY.private_file_max_bytes;
1872
2718
  var WINDOWS_PRIVATE_ACL_MODES = ["harden", "verify", "verify-owner", "verify-private"];
1873
2719
  var WINDOWS_PRIVATE_ACL_BROKER_SCRIPT = `$ErrorActionPreference='Stop'
1874
2720
  $ProgressPreference='SilentlyContinue'
@@ -1876,7 +2722,7 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
1876
2722
  $requestId=$null
1877
2723
  $failureStage='request_validation'
1878
2724
  try {
1879
- if($line.Length -lt 2 -or $line.Length -gt 65536) { throw 'invalid request size' }
2725
+ if($line.Length -lt 2 -or $line.Length -gt ${HOST_CORE_POLICY.windows_acl_broker_request_max_bytes}) { throw 'invalid request size' }
1880
2726
  $request=$line | ConvertFrom-Json
1881
2727
  $names=@($request.PSObject.Properties.Name | Sort-Object)
1882
2728
  if(($names -join ',') -ne 'id,kind,mode,path_b64') { throw 'invalid request shape' }
@@ -1952,9 +2798,9 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
1952
2798
  [Console]::Out.WriteLine((@{id=$requestId;status='error';error_code=$failureStage} | ConvertTo-Json -Compress))
1953
2799
  }
1954
2800
  }`;
1955
- var WINDOWS_IDENTITY_COMMAND_TIMEOUT_MS = 15e3;
1956
- var WINDOWS_PRIVATE_ACL_BROKER_STARTUP_TIMEOUT_MS = 9e4;
1957
- var SMALL_IDENTITY_COMMAND_TIMEOUT_MS = 5e3;
2801
+ var WINDOWS_IDENTITY_COMMAND_TIMEOUT_MS = HOST_CORE_POLICY.windows_identity_command_timeout_ms;
2802
+ var WINDOWS_PRIVATE_ACL_BROKER_STARTUP_TIMEOUT_MS = HOST_CORE_POLICY.windows_acl_broker_startup_timeout_ms;
2803
+ var SMALL_IDENTITY_COMMAND_TIMEOUT_MS = HOST_CORE_POLICY.identity_command_timeout_ms;
1958
2804
  var windowsPowerShellEnvironment = (extra = {}) => {
1959
2805
  const sanitizedExtra = { ...extra };
1960
2806
  delete sanitizedExtra.PSModulePath;
@@ -1997,9 +2843,9 @@ var WindowsPrivateAclBroker = class {
1997
2843
  this.queue = operation.then(() => void 0, () => void 0);
1998
2844
  await operation;
1999
2845
  };
2000
- this.requestTimeoutMs = dependencies.requestTimeoutMs ?? 15e3;
2846
+ this.requestTimeoutMs = dependencies.requestTimeoutMs ?? HOST_CORE_POLICY.windows_acl_broker_request_timeout_ms;
2001
2847
  this.startupRequestTimeoutMs = dependencies.startupRequestTimeoutMs ?? WINDOWS_PRIVATE_ACL_BROKER_STARTUP_TIMEOUT_MS;
2002
- this.idleShutdownMs = dependencies.idleShutdownMs ?? 3e4;
2848
+ this.idleShutdownMs = dependencies.idleShutdownMs ?? HOST_CORE_POLICY.windows_acl_broker_idle_shutdown_ms;
2003
2849
  this.spawnProcess = dependencies.spawnProcess ?? (() => {
2004
2850
  const invocation = windowsPrivateAclBrokerInvocation();
2005
2851
  return spawn("powershell.exe", [...invocation.args], {
@@ -2018,7 +2864,7 @@ var WindowsPrivateAclBroker = class {
2018
2864
  this.child = null;
2019
2865
  this.outputBuffer = "";
2020
2866
  child.stdin.end();
2021
- const force = setTimeout(() => child.kill("SIGKILL"), 1e3);
2867
+ const force = setTimeout(() => child.kill("SIGKILL"), HOST_CORE_POLICY.windows_acl_broker_kill_grace_ms);
2022
2868
  force.unref();
2023
2869
  child.once("exit", () => clearTimeout(force));
2024
2870
  }, this.idleShutdownMs);
@@ -2042,7 +2888,7 @@ var WindowsPrivateAclBroker = class {
2042
2888
  }
2043
2889
  acceptLine(child, line) {
2044
2890
  const pending = this.pending;
2045
- if (!pending || !line || line.length > 4096) {
2891
+ if (!pending || !line || line.length > HOST_CORE_POLICY.windows_acl_broker_response_line_max_chars) {
2046
2892
  this.failChild(child, new Error("Windows private ACL broker returned malformed output."));
2047
2893
  return;
2048
2894
  }
@@ -2093,7 +2939,7 @@ var WindowsPrivateAclBroker = class {
2093
2939
  child.stdout.on("data", (chunk) => {
2094
2940
  if (this.child !== child) return;
2095
2941
  this.outputBuffer += chunk;
2096
- if (this.outputBuffer.length > 65536) {
2942
+ if (this.outputBuffer.length > HOST_CORE_POLICY.windows_acl_broker_output_max_chars) {
2097
2943
  this.failChild(child, new Error("Windows private ACL broker exceeded its output limit."));
2098
2944
  return;
2099
2945
  }
@@ -2131,7 +2977,7 @@ var WindowsPrivateAclBroker = class {
2131
2977
  path_b64: Buffer.from(path, "utf8").toString("base64")
2132
2978
  })}
2133
2979
  `;
2134
- if (Buffer.byteLength(request, "utf8") > 65536) {
2980
+ if (Buffer.byteLength(request, "utf8") > HOST_CORE_POLICY.windows_acl_broker_request_max_bytes) {
2135
2981
  throw new Error("Windows private ACL broker request exceeds its input limit.");
2136
2982
  }
2137
2983
  const { child, startedNow } = this.ensureChild();
@@ -2236,7 +3082,7 @@ var linuxProcessIdentity = async (pid) => {
2236
3082
  readFile2("/proc/sys/kernel/random/boot_id", "utf8"),
2237
3083
  readFile2(`/proc/${pid}/stat`, "utf8")
2238
3084
  ]);
2239
- const fields = statLine.slice(statLine.lastIndexOf(")") + 2).trim().split(/\s+/u);
3085
+ const fields = statLine.slice(statLine.lastIndexOf(")") + LINUX_PROC_STAT_COMM_TERMINATOR_CHARS).trim().split(/\s+/u);
2240
3086
  const startTicks = fields[19];
2241
3087
  return startTicks ? `linux:${bootId.trim()}:${startTicks}` : null;
2242
3088
  } catch {
@@ -2291,7 +3137,7 @@ var windowsProcessIdentity = async (pid) => await new Promise((resolvePromise) =
2291
3137
  settle(null);
2292
3138
  }, invocation.timeoutMs);
2293
3139
  child.stdout.on("data", (chunk) => {
2294
- if (output.reduce((total, item) => total + item.byteLength, 0) + Buffer.byteLength(chunk) > 1024) {
3140
+ if (output.reduce((total, item) => total + item.byteLength, 0) + Buffer.byteLength(chunk) > HOST_CORE_POLICY.windows_process_identity_output_max_bytes) {
2295
3141
  child.kill("SIGKILL");
2296
3142
  settle(null);
2297
3143
  return;
@@ -2319,12 +3165,12 @@ var darwinProcessIdentity = async (pid) => await new Promise((resolvePromise) =>
2319
3165
  const timer = setTimeout(() => {
2320
3166
  child.kill("SIGKILL");
2321
3167
  settle(null);
2322
- }, 5e3);
3168
+ }, SMALL_IDENTITY_COMMAND_TIMEOUT_MS);
2323
3169
  child.stdout.on("data", (chunk) => output.push(Buffer.from(chunk)));
2324
3170
  child.once("error", () => settle(null));
2325
3171
  child.once("exit", (code) => {
2326
3172
  const started = Date.parse(Buffer.concat(output).toString("utf8").trim());
2327
- settle(code === 0 && Number.isFinite(started) ? `darwin:${Math.floor(started / 1e3)}` : null);
3173
+ settle(code === 0 && Number.isFinite(started) ? `darwin:${Math.floor(started / MS_PER_SECOND)}` : null);
2328
3174
  });
2329
3175
  });
2330
3176
  var runSmallIdentityCommand = async (command, args, env, timeoutMs = SMALL_IDENTITY_COMMAND_TIMEOUT_MS) => await new Promise((resolvePromise) => {
@@ -2348,7 +3194,7 @@ var runSmallIdentityCommand = async (command, args, env, timeoutMs = SMALL_IDENT
2348
3194
  }, timeoutMs);
2349
3195
  child.stdout.on("data", (chunk) => {
2350
3196
  bytes += Buffer.byteLength(chunk);
2351
- if (bytes > 4096) {
3197
+ if (bytes > HOST_CORE_POLICY.identity_command_output_max_bytes) {
2352
3198
  child.kill("SIGKILL");
2353
3199
  settle(null);
2354
3200
  return;
@@ -2441,7 +3287,7 @@ async function ensureInferencePrivateDirectory(path, dependencies = {}) {
2441
3287
  }
2442
3288
  } catch (error) {
2443
3289
  if (error.code !== "ENOENT") throw error;
2444
- await mkdir2(path, { recursive: true, mode: 448 });
3290
+ await mkdir2(path, { recursive: true, mode: OWNER_ONLY_DIRECTORY_MODE });
2445
3291
  created = true;
2446
3292
  }
2447
3293
  const after = await lstat(path);
@@ -2462,7 +3308,7 @@ async function ensureInferencePrivateDirectory(path, dependencies = {}) {
2462
3308
  }
2463
3309
  return;
2464
3310
  }
2465
- if ((after.mode & 63) !== 0) {
3311
+ if ((after.mode & GROUP_OTHER_PERMISSION_BITS) !== 0) {
2466
3312
  throw new Error("Inference host state directory must have mode 0700.");
2467
3313
  }
2468
3314
  if (typeof process.getuid === "function" && after.uid !== process.getuid()) {
@@ -2493,8 +3339,8 @@ async function replaceAtomicInferencePrivateFile(temporaryPath, destinationPath,
2493
3339
  const platform = options.platform ?? process.platform;
2494
3340
  const renameFile = options.renameFile ?? rename;
2495
3341
  const sleep = options.sleep ?? ((milliseconds) => new Promise((resolve3) => setTimeout(resolve3, milliseconds)));
2496
- const maxAttempts = Math.max(1, options.maxAttempts ?? 40);
2497
- const retryDelayMs = Math.max(0, options.retryDelayMs ?? 25);
3342
+ const maxAttempts = Math.max(1, options.maxAttempts ?? HOST_CORE_POLICY.private_file_replace_attempts);
3343
+ const retryDelayMs = Math.max(0, options.retryDelayMs ?? HOST_CORE_POLICY.private_file_replace_retry_delay_ms);
2498
3344
  for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
2499
3345
  try {
2500
3346
  await renameFile(temporaryPath, destinationPath);
@@ -2520,12 +3366,12 @@ async function writeAtomicInferencePrivateFile(path, contents, dependencies = {}
2520
3366
  }
2521
3367
  const temporary = join2(
2522
3368
  directory,
2523
- `.${process.pid}.${randomBytes(12).toString("hex")}.tmp`
3369
+ `.${process.pid}.${randomBytes(INFERENCE_HOST_RANDOM_BYTES.TEMP_FILE_SUFFIX).toString("hex")}.tmp`
2524
3370
  );
2525
3371
  const handle = await open(
2526
3372
  temporary,
2527
3373
  constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY | constants.O_NOFOLLOW,
2528
- 384
3374
+ OWNER_ONLY_FILE_MODE
2529
3375
  );
2530
3376
  try {
2531
3377
  await handle.writeFile(contents, "utf8");
@@ -2574,12 +3420,12 @@ async function writeAtomicInferencePrivateFile(path, contents, dependencies = {}
2574
3420
  throw error;
2575
3421
  }
2576
3422
  }
2577
- var PROCESS_LOCK_PUBLICATION_GRACE_MS = 1e4;
2578
- var PROCESS_LOCK_MAX_RECORD_BYTES = 64 * 1024;
2579
- var PROCESS_LOCK_GUARD_ELECTION_LEASE_MS = 5e3;
2580
- var PROCESS_LOCK_GUARD_ELECTION_STALE_MS = 3e4;
2581
- var PROCESS_LOCK_GUARD_ELECTION_ATTEMPTS = 8;
2582
- var PROCESS_LOCK_GUARD_ELECTION_BACKOFF_MS = 10;
3423
+ var PROCESS_LOCK_PUBLICATION_GRACE_MS = HOST_CORE_POLICY.process_lock_publication_grace_ms;
3424
+ var PROCESS_LOCK_MAX_RECORD_BYTES = HOST_CORE_POLICY.process_lock_record_max_bytes;
3425
+ var PROCESS_LOCK_GUARD_ELECTION_LEASE_MS = HOST_CORE_POLICY.process_lock_guard_election_lease_ms;
3426
+ var PROCESS_LOCK_GUARD_ELECTION_STALE_MS = HOST_CORE_POLICY.process_lock_guard_election_stale_ms;
3427
+ var PROCESS_LOCK_GUARD_ELECTION_ATTEMPTS = HOST_CORE_POLICY.process_lock_guard_election_attempts;
3428
+ var PROCESS_LOCK_GUARD_ELECTION_BACKOFF_MS = HOST_CORE_POLICY.process_lock_guard_election_backoff_ms;
2583
3429
  var PROCESS_LOCK_LABEL = "Inference host process lock";
2584
3430
  var PROCESS_LOCK_GUARD_LABEL = "Inference host process lock reclamation guard";
2585
3431
  var sameProcessLockFile = (left, right) => left.dev === right.dev && left.ino === right.ino && left.size === right.size && left.mtimeMs === right.mtimeMs && left.ctimeMs === right.ctimeMs;
@@ -2588,7 +3434,7 @@ var openExclusiveProcessLockFile = async (path) => {
2588
3434
  return await open(
2589
3435
  path,
2590
3436
  constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY | constants.O_NOFOLLOW,
2591
- 384
3437
+ OWNER_ONLY_FILE_MODE
2592
3438
  );
2593
3439
  } catch (error) {
2594
3440
  if (error.code === "EEXIST") return null;
@@ -2603,7 +3449,7 @@ var inspectProcessLockFile = async (path, label, probes) => {
2603
3449
  if (error.code === "ENOENT") return { state: "missing" };
2604
3450
  throw error;
2605
3451
  }
2606
- if (before.isSymbolicLink() || !before.isFile() || process.platform !== "win32" && (before.mode & 63) !== 0 || typeof process.getuid === "function" && before.uid !== process.getuid()) {
3452
+ if (before.isSymbolicLink() || !before.isFile() || process.platform !== "win32" && (before.mode & GROUP_OTHER_PERMISSION_BITS) !== 0 || typeof process.getuid === "function" && before.uid !== process.getuid()) {
2607
3453
  throw new Error(`${label} is unsafe.`);
2608
3454
  }
2609
3455
  let handle;
@@ -2630,7 +3476,7 @@ var inspectProcessLockFile = async (path, label, probes) => {
2630
3476
  } catch {
2631
3477
  record = null;
2632
3478
  }
2633
- if (!record || record.schema_version !== 2 || !Number.isSafeInteger(record.pid) || Number(record.pid) < 1 || typeof record.owner_token !== "string" || !record.owner_token || typeof record.process_identity !== "string" || !record.process_identity || typeof record.boot_identity !== "string" || !record.boot_identity) {
3479
+ if (!record || record.schema_version !== INFERENCE_HOST_PROCESS_LOCK_RECORD_SCHEMA_VERSION || !Number.isSafeInteger(record.pid) || Number(record.pid) < 1 || typeof record.owner_token !== "string" || !record.owner_token || typeof record.process_identity !== "string" || !record.process_identity || typeof record.boot_identity !== "string" || !record.boot_identity) {
2634
3480
  if (Date.now() - stat.mtimeMs < PROCESS_LOCK_PUBLICATION_GRACE_MS) return { state: "busy" };
2635
3481
  stale = true;
2636
3482
  return { state: "stale", handle, stat };
@@ -2640,7 +3486,7 @@ var inspectProcessLockFile = async (path, label, probes) => {
2640
3486
  const cacheKey = resolve(path);
2641
3487
  if (await probes.currentBootIdentity() === record.boot_identity && probes.isProcessAlive(ownerPid)) {
2642
3488
  const cached = processLockObservationCache.get(cacheKey);
2643
- const observedIdentity = cached && cached.dev === stat.dev && cached.ino === stat.ino && cached.pid === ownerPid && cached.storedIdentity === storedIdentity && Date.now() - cached.observedAtMs < 5e3 ? cached.observedIdentity : await probes.observeIdentity(ownerPid);
3489
+ const observedIdentity = cached && cached.dev === stat.dev && cached.ino === stat.ino && cached.pid === ownerPid && cached.storedIdentity === storedIdentity && Date.now() - cached.observedAtMs < HOST_CORE_POLICY.process_lock_identity_cache_ms ? cached.observedIdentity : await probes.observeIdentity(ownerPid);
2644
3490
  if (!observedIdentity) {
2645
3491
  throw new Error("Inference host could not verify the existing lock owner identity.");
2646
3492
  }
@@ -2697,7 +3543,7 @@ var removeStaleProcessLockReclaimGuard = async (lockPath, guardPath, inspection)
2697
3543
  if (attempt > 0) {
2698
3544
  await new Promise((resolvePromise) => setTimeout(
2699
3545
  resolvePromise,
2700
- Math.floor(Math.random() * PROCESS_LOCK_GUARD_ELECTION_BACKOFF_MS * 2 ** Math.min(attempt, 4))
3546
+ Math.floor(Math.random() * PROCESS_LOCK_GUARD_ELECTION_BACKOFF_MS * BACKOFF_GROWTH_FACTOR ** Math.min(attempt, HOST_CORE_POLICY.process_lock_guard_election_backoff_exponent_max))
2701
3547
  ));
2702
3548
  let current;
2703
3549
  try {
@@ -2708,7 +3554,7 @@ var removeStaleProcessLockReclaimGuard = async (lockPath, guardPath, inspection)
2708
3554
  }
2709
3555
  if (!sameProcessLockFile(current, inspection.stat)) return;
2710
3556
  }
2711
- const ballotName = `${prefix}${randomBytes(16).toString("hex")}`;
3557
+ const ballotName = `${prefix}${randomBytes(INFERENCE_HOST_RANDOM_BYTES.LOCK_BALLOT_NAME).toString("hex")}`;
2712
3558
  const ballotPath = join2(directory, ballotName);
2713
3559
  const ballot = await openExclusiveProcessLockFile(ballotPath);
2714
3560
  if (!ballot) continue;
@@ -2750,8 +3596,8 @@ var removeStaleProcessLockReclaimGuard = async (lockPath, guardPath, inspection)
2750
3596
  };
2751
3597
  var acquireProcessLockReclaimGuard = async (lockPath, ownerRecord, probes) => {
2752
3598
  const guardPath = `${lockPath}.reclaim`;
2753
- const guardToken = randomBytes(24).toString("base64url");
2754
- for (let attempt = 0; attempt < 2; attempt += 1) {
3599
+ const guardToken = randomBytes(INFERENCE_HOST_RANDOM_BYTES.LOCK_TOKEN).toString("base64url");
3600
+ for (let attempt = 0; attempt < INFERENCE_HOST_RECLAIM_GUARD_CREATE_PASSES; attempt += 1) {
2755
3601
  const handle = await openExclusiveProcessLockFile(guardPath);
2756
3602
  if (handle) {
2757
3603
  try {
@@ -2813,7 +3659,7 @@ var acquireProcessLockReclaimGuard = async (lockPath, ownerRecord, probes) => {
2813
3659
  async function acquireInferenceHostProcessLock(path, dependencies = {}) {
2814
3660
  const directory = dirname2(path);
2815
3661
  await ensureInferencePrivateDirectory(directory);
2816
- const ownerToken = randomBytes(24).toString("base64url");
3662
+ const ownerToken = randomBytes(INFERENCE_HOST_RANDOM_BYTES.LOCK_TOKEN).toString("base64url");
2817
3663
  const probes = {
2818
3664
  currentBootIdentity: dependencies.currentBootIdentity ?? (() => readInferenceSystemBootIdentity()),
2819
3665
  observeIdentity: dependencies.processIdentity ?? defaultProcessIdentity,
@@ -2832,7 +3678,7 @@ async function acquireInferenceHostProcessLock(path, dependencies = {}) {
2832
3678
  probes.currentBootIdentity()
2833
3679
  ]);
2834
3680
  const ownerRecord = (token) => `${JSON.stringify({
2835
- schema_version: 2,
3681
+ schema_version: INFERENCE_HOST_PROCESS_LOCK_RECORD_SCHEMA_VERSION,
2836
3682
  pid: process.pid,
2837
3683
  owner_token: token,
2838
3684
  process_identity: ownerIdentity,
@@ -3078,8 +3924,8 @@ var ensureUpdaterPrivateDirectory = async (path, root, dependencies = {}) => {
3078
3924
  }
3079
3925
  if (resolve2(path) === resolve2(root) || isPathWithin(root, path)) {
3080
3926
  const existing = await lstat2(path).catch(() => null);
3081
- if (existing && existing.isDirectory() && !existing.isSymbolicLink() && (existing.mode & 63) !== 0 && (typeof process.getuid !== "function" || existing.uid === process.getuid())) {
3082
- await chmod(path, 448);
3927
+ if (existing && existing.isDirectory() && !existing.isSymbolicLink() && (existing.mode & GROUP_OTHER_PERMISSION_BITS) !== 0 && (typeof process.getuid !== "function" || existing.uid === process.getuid())) {
3928
+ await chmod(path, OWNER_ONLY_DIRECTORY_MODE);
3083
3929
  }
3084
3930
  }
3085
3931
  await ensureInferencePrivateDirectory(path, { ...dependencies, defaultRoot: root });
@@ -3208,7 +4054,7 @@ var writeCliReleaseRejection = async (path, rejection, privateRoot) => {
3208
4054
  if (privateRoot) await ensureUpdaterPrivateDirectory(privateRoot, privateRoot);
3209
4055
  await writeAtomicInferencePrivateFile(
3210
4056
  path,
3211
- `${JSON.stringify(rejection, null, 2)}
4057
+ `${JSON.stringify(rejection, null, JSON_INDENT_SPACES)}
3212
4058
  `,
3213
4059
  privateRoot ? { defaultRoot: privateRoot } : {}
3214
4060
  );
@@ -3291,7 +4137,7 @@ var writeState = async (paths, state) => {
3291
4137
  await ensureUpdaterPrivateDirectory(paths.root, paths.root);
3292
4138
  await writeAtomicInferencePrivateFile(
3293
4139
  paths.statePath,
3294
- `${JSON.stringify(state, null, 2)}
4140
+ `${JSON.stringify(state, null, JSON_INDENT_SPACES)}
3295
4141
  `,
3296
4142
  { defaultRoot: paths.root }
3297
4143
  );
@@ -3303,7 +4149,7 @@ var appendCliUpdateLog = async (paths, event, fields = {}) => {
3303
4149
  paths.logPath,
3304
4150
  `${JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), event, ...fields })}
3305
4151
  `,
3306
- { encoding: "utf8", mode: 384 }
4152
+ { encoding: "utf8", mode: OWNER_ONLY_FILE_MODE }
3307
4153
  );
3308
4154
  } catch {
3309
4155
  }
@@ -3385,7 +4231,7 @@ var stageAndSelect = async (paths, target, input) => {
3385
4231
  try {
3386
4232
  await ensureUpdaterPrivateDirectory(paths.root, paths.root, { platform: input.platform });
3387
4233
  } catch (error) {
3388
- const reason = `update_directory_unsafe: ${error instanceof Error ? error.message.slice(0, 120) : "unknown"}`;
4234
+ const reason = `update_directory_unsafe: ${error instanceof Error ? error.message.slice(0, runtime_policy_generated_default.agent_cli.update_directory_failure_reason_max_chars) : "unknown"}`;
3389
4235
  await appendCliUpdateLog(paths, "cli_update_failed", { package_version: target.version, reason });
3390
4236
  return { kind: "failed", reason };
3391
4237
  }
@@ -3418,7 +4264,7 @@ var stageAndSelect = async (paths, target, input) => {
3418
4264
  await appendCliUpdateLog(paths, "cli_release_staged", { package_version: selection.package_version });
3419
4265
  return { kind: "staged", selection };
3420
4266
  } catch (error) {
3421
- const reason = error instanceof Error ? error.message.slice(0, 160) : "unknown";
4267
+ const reason = error instanceof Error ? error.message.slice(0, runtime_policy_generated_default.agent_cli.update_failure_reason_max_chars) : "unknown";
3422
4268
  await appendCliUpdateLog(paths, "cli_update_failed", { package_version: target.version, reason });
3423
4269
  return { kind: "failed", reason };
3424
4270
  } finally {
@@ -3506,7 +4352,7 @@ var planCliEntryUpdate = async (entry, argv, env, script, dependencies = {}) =>
3506
4352
  return runSelected();
3507
4353
  } catch (error) {
3508
4354
  await appendCliUpdateLog(paths, "cli_update_check_failed", {
3509
- reason: error instanceof Error ? error.message.slice(0, 160) : "unknown"
4355
+ reason: error instanceof Error ? error.message.slice(0, runtime_policy_generated_default.agent_cli.update_failure_reason_max_chars) : "unknown"
3510
4356
  });
3511
4357
  return { kind: "run" };
3512
4358
  }
@@ -3690,7 +4536,7 @@ var finishRollBack = async (paths, selection, reason, fallback) => {
3690
4536
  });
3691
4537
  return fallback?.package_version ?? null;
3692
4538
  };
3693
- var INTERRUPTED_EXIT_CODE = 130;
4539
+ var INTERRUPTED_EXIT_CODE = EXIT_CODE_INTERRUPTED;
3694
4540
  var superviseRuntime = async (argv, dependencies, env, launcher) => {
3695
4541
  const stderr = dependencies.stderr ?? process.stderr;
3696
4542
  const paths = resolveCliUpdatePaths(env);
@@ -3758,10 +4604,10 @@ var superviseRuntime = async (argv, dependencies, env, launcher) => {
3758
4604
  continue;
3759
4605
  }
3760
4606
  if (result.kind === "exited" || result.kind === "interrupted") {
3761
- const childExitCode = result.signal ? 128 + (osConstants.signals[result.signal] ?? 0) : result.exitCode;
4607
+ const childExitCode = result.signal ? EXIT_CODE_SIGNAL_BASE + (osConstants.signals[result.signal] ?? 0) : result.exitCode;
3762
4608
  return stops.stops > 0 ? await endAfterStop(childExitCode) : childExitCode;
3763
4609
  }
3764
- if (plan.kind !== "reexec" || plan.selection.confirmed_at || failedStarts >= 2) {
4610
+ if (plan.kind !== "reexec" || plan.selection.confirmed_at || failedStarts >= runtime_policy_generated_default.agent_cli.supervisor_max_failed_release_starts) {
3765
4611
  return result.exitCode;
3766
4612
  }
3767
4613
  failedStarts += 1;
@@ -3800,7 +4646,7 @@ var runCliEntry = async (entry, argv, runHere, dependencies = {}, env = process.
3800
4646
  const paths = resolveCliUpdatePaths(env);
3801
4647
  const now = dependencies.now ?? (() => /* @__PURE__ */ new Date());
3802
4648
  const current = dependencies.currentVersion ?? agent_cli_release_default.package_version;
3803
- for (let attempt = 0; attempt < 3; attempt += 1) {
4649
+ for (let attempt = 0; attempt < runtime_policy_generated_default.agent_cli.update_plan_max_attempts; attempt += 1) {
3804
4650
  const plan = await planCliEntryUpdate(entry, argv, env, script, dependencies);
3805
4651
  if (plan.kind === "refuse") {
3806
4652
  stderr.write(`${plan.message}
@@ -3843,7 +4689,7 @@ var runCliEntry = async (entry, argv, runHere, dependencies = {}, env = process.
3843
4689
  }
3844
4690
  return await runHere();
3845
4691
  };
3846
- var RUNTIME_RESTART_FOR_UPDATE_EXIT_CODE = 75;
4692
+ var RUNTIME_RESTART_FOR_UPDATE_EXIT_CODE = EXIT_CODE_TEMPFAIL;
3847
4693
  var RUNTIME_SUPERVISED_ENV = "VTX_CLI_RUNTIME_SUPERVISED";
3848
4694
  var RUNTIME_RESUME_ENV = "VTX_CLI_RUNTIME_RESUME";
3849
4695
  var RUNTIME_SUPERVISOR_PID_ENV = "VTX_CLI_RUNTIME_SUPERVISOR_PID";
@@ -3885,7 +4731,8 @@ var isSupervisableRuntimeCommand = (argv) => {
3885
4731
  };
3886
4732
 
3887
4733
  // bin/vtx-mcp.ts
3888
- process.exitCode = await runCliEntry("vtx-mcp", process.argv.slice(2), async () => {
4734
+ init_constants();
4735
+ process.exitCode = await runCliEntry("vtx-mcp", process.argv.slice(NODE_ARGV_COMMAND_ARGS_START), async () => {
3889
4736
  const { runVtxMcpStdioServer: runVtxMcpStdioServer2 } = await Promise.resolve().then(() => (init_stdio(), stdio_exports));
3890
4737
  await reportCliEntryReady();
3891
4738
  await runVtxMcpStdioServer2();