@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.
@@ -14,7 +14,7 @@ import { dirname as dirname4, relative as relative4, resolve as resolve4 } from
14
14
  import { fileURLToPath } from "node:url";
15
15
 
16
16
  // agent-cli-release.json
17
- var agent_cli_release_default = { package_name: "@vtxmacro/cli", package_version: "2026.10.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" } } };
17
+ var 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" } } };
18
18
 
19
19
  // lib/runtime-policy.generated.json
20
20
  var runtime_policy_generated_default = {
@@ -44,6 +44,7 @@ var runtime_policy_generated_default = {
44
44
  post_execution_refresh_delay_ms: 3e3,
45
45
  account_read_backoff_min_ms: 2e3,
46
46
  account_read_backoff_max_ms: 6e4,
47
+ account_read_backoff_exponent_max: 30,
47
48
  ai_start_grace_min_ms: 45e3
48
49
  },
49
50
  deployment_reload_observability: {
@@ -68,7 +69,8 @@ var runtime_policy_generated_default = {
68
69
  load_timeout_ms: 5e3,
69
70
  initial_load_settle_ms: 100,
70
71
  external_save_timeout_ms: 8e3,
71
- guest_cookie_max_age_days: 9999
72
+ guest_cookie_max_age_days: 9999,
73
+ dropdown_search_max_chars: 200
72
74
  },
73
75
  navigation_feedback: {
74
76
  finish_fallback_ms: 2250
@@ -95,6 +97,48 @@ var runtime_policy_generated_default = {
95
97
  runtime_error_attempt_group_window_seconds: 120,
96
98
  debug_runtime_error_preview_chars: 180
97
99
  },
100
+ ai_settings: {
101
+ storage_authority_broadcast_dedupe_window_ms: 2e3,
102
+ margin_type_external_authority_ttl_ms: 12e4,
103
+ screener_status_refresh_delay_ms: 75,
104
+ preference_message_dedupe_keys: 24,
105
+ available_assets_retry_default_ms: 15e3,
106
+ available_assets_retry_min_ms: 1e3,
107
+ available_assets_retry_max_ms: 6e4,
108
+ external_sync_settle_ms: 1e3,
109
+ billing_stats_reuse_ms: 3e3,
110
+ prompt_commit_debounce_ms: 180,
111
+ model_count_display_settle_ms: 320,
112
+ model_picker_scroll_settle_ms: 60
113
+ },
114
+ ai_settings_debug: {
115
+ model_debug_event_limit: 160,
116
+ browser_resource_timings: 40,
117
+ browser_resource_panel_rows: 12,
118
+ browser_timing_refresh_delay_ms: 1500,
119
+ comparable_hash_full_max_chars: 16,
120
+ comparable_hash_edge_chars: 8,
121
+ console_message_chars: 4e3,
122
+ comparable_diff_max_depth: 4,
123
+ react_profile_min_duration_ms: 20,
124
+ react_profile_slower_margin_ms: 25,
125
+ react_profile_slow_update_ms: 100,
126
+ react_profile_repeat_interval_ms: 1500,
127
+ snapshot_ids_head: 10,
128
+ longtask_samples: 12,
129
+ recent_events: 20,
130
+ hydration_recent_events: 12,
131
+ dirty_state_recent_events: 12,
132
+ navbar_profile_entries: 30,
133
+ dropdown_search_paint_events: 6,
134
+ dropdown_options_debounce_ms: 220,
135
+ dropdown_hover_min_interval_ms: 80,
136
+ slow_render_ms: 80,
137
+ render_min_ms: 24,
138
+ render_min_interval_ms: 300,
139
+ model_fingerprint_head: 24,
140
+ models_head: 12
141
+ },
98
142
  insights_charts: {
99
143
  max_charts: 3,
100
144
  max_line_points: 160,
@@ -114,6 +158,198 @@ var runtime_policy_generated_default = {
114
158
  debug_comparable_head_chars: 240,
115
159
  debug_panel_comparable_head_chars: 120
116
160
  },
161
+ safe_mode_settings: {
162
+ usdc_slider_cents_steps: [
163
+ 10,
164
+ 25,
165
+ 50,
166
+ 75,
167
+ 100,
168
+ 150,
169
+ 200,
170
+ 300,
171
+ 400,
172
+ 500,
173
+ 750,
174
+ 1e3,
175
+ 1500,
176
+ 2e3,
177
+ 2500,
178
+ 3e3,
179
+ 4e3,
180
+ 5e3,
181
+ 7500,
182
+ 1e4,
183
+ 15e3,
184
+ 2e4,
185
+ 25e3,
186
+ 3e4,
187
+ 4e4,
188
+ 5e4,
189
+ 75e3,
190
+ 1e5,
191
+ 125e3,
192
+ 15e4,
193
+ 2e5,
194
+ 25e4,
195
+ 3e5,
196
+ 4e5,
197
+ 5e5,
198
+ 6e5,
199
+ 7e5,
200
+ 8e5,
201
+ 9e5,
202
+ 1e6
203
+ ],
204
+ percent_input_step_bps: 1
205
+ },
206
+ copy_trading_settings: {
207
+ scale_multiplier_slider_thousandths_steps: [
208
+ 10,
209
+ 20,
210
+ 30,
211
+ 40,
212
+ 50,
213
+ 75,
214
+ 100,
215
+ 150,
216
+ 200,
217
+ 250,
218
+ 300,
219
+ 400,
220
+ 500,
221
+ 600,
222
+ 700,
223
+ 800,
224
+ 850,
225
+ 900,
226
+ 950,
227
+ 975,
228
+ 1e3,
229
+ 1025,
230
+ 1050,
231
+ 1100,
232
+ 1250,
233
+ 1500,
234
+ 1750,
235
+ 2e3,
236
+ 2500,
237
+ 3e3,
238
+ 4e3,
239
+ 5e3,
240
+ 7500,
241
+ 1e4,
242
+ 15e3,
243
+ 2e4,
244
+ 3e4,
245
+ 4e4,
246
+ 5e4,
247
+ 75e3,
248
+ 1e5
249
+ ]
250
+ },
251
+ analysis_settings: {
252
+ lookback_slider_candles_steps: [
253
+ 1,
254
+ 2,
255
+ 3,
256
+ 4,
257
+ 5,
258
+ 6,
259
+ 7,
260
+ 8,
261
+ 9,
262
+ 10,
263
+ 12,
264
+ 14,
265
+ 16,
266
+ 18,
267
+ 20,
268
+ 24,
269
+ 28,
270
+ 32,
271
+ 36,
272
+ 40,
273
+ 42,
274
+ 44,
275
+ 48,
276
+ 52,
277
+ 56,
278
+ 60,
279
+ 65,
280
+ 70,
281
+ 75,
282
+ 80,
283
+ 90,
284
+ 100,
285
+ 110,
286
+ 120,
287
+ 130,
288
+ 140,
289
+ 150,
290
+ 160,
291
+ 180,
292
+ 200
293
+ ]
294
+ },
295
+ trading_limit_settings: {
296
+ ai_trade_amount_usdc_steps: [
297
+ 20,
298
+ 30,
299
+ 40,
300
+ 50,
301
+ 60,
302
+ 70,
303
+ 80,
304
+ 90,
305
+ 100,
306
+ 150,
307
+ 175,
308
+ 200,
309
+ 225,
310
+ 250,
311
+ 275,
312
+ 300,
313
+ 325,
314
+ 350,
315
+ 375,
316
+ 400,
317
+ 425,
318
+ 450,
319
+ 475,
320
+ 500,
321
+ 600,
322
+ 700,
323
+ 800,
324
+ 900,
325
+ 1e3,
326
+ 1250,
327
+ 1500,
328
+ 1750,
329
+ 2e3,
330
+ 2250,
331
+ 2500,
332
+ 2750,
333
+ 3e3,
334
+ 3250,
335
+ 3500,
336
+ 3750,
337
+ 4e3,
338
+ 4250,
339
+ 4500,
340
+ 4750,
341
+ 5e3,
342
+ 6e3,
343
+ 7e3,
344
+ 8e3,
345
+ 9e3,
346
+ 1e4
347
+ ],
348
+ ai_trade_amount_max_stop_count: 50
349
+ },
350
+ calendar_settings: {
351
+ buffer_input_step_seconds: 30
352
+ },
117
353
  debug_logs: {
118
354
  snapshot_card_lines: 80,
119
355
  render_debug_overlay_entries: 120,
@@ -124,7 +360,8 @@ var runtime_policy_generated_default = {
124
360
  admin_text_chars: 160,
125
361
  admin_analysis_run_id_chars: 32,
126
362
  hyperliquid_balance_preview_count: 3,
127
- model_picker_preview_count: 5
363
+ model_picker_preview_count: 5,
364
+ render_debug_entries: 250
128
365
  },
129
366
  history_panels: {
130
367
  display_batch_size: 50,
@@ -132,20 +369,298 @@ var runtime_policy_generated_default = {
132
369
  trade_history_fetch_page_size: 100,
133
370
  ai_panel_interaction_window_ms: 2500,
134
371
  ai_panel_defer_max_staleness_ms: 1e4,
135
- ai_panel_defer_retry_ms: 1500
372
+ ai_panel_defer_retry_ms: 1500,
373
+ order_id_metadata_traversal_max_nodes: 400
374
+ },
375
+ trade_page: {
376
+ config_first_retry_delay_ms: 1e3,
377
+ margin_mode_min_loading_ms: 250,
378
+ preferences_load_retry_delay_ms_steps: [
379
+ 1500,
380
+ 3e3,
381
+ 6e3,
382
+ 12e3
383
+ ],
384
+ preferences_retry_jitter_max_ms: 1500,
385
+ all_profile_preferences_save_delay_ms: 1500,
386
+ all_profile_save_interaction_window_ms: 2e3,
387
+ all_profile_read_concurrency: 2,
388
+ all_profile_ai_event_dedupe_limit: 200,
389
+ all_profile_order_history_limit: 50,
390
+ all_profile_section_timeout_min_ms: 1e3,
391
+ all_profile_account_summary_poll_min_ms: 1e3,
392
+ all_profile_trade_history_poll_min_ms: 1e3,
393
+ all_profile_live_refresh_idle_timeout_ms: 5e3,
394
+ copy_trading_message_limit: 25,
395
+ browser_account_refresh_min_interval_ms: 1250,
396
+ browser_account_watchdog_poll_min_ms: 1e4,
397
+ rate_limit_retry_buffer_ms: 250,
398
+ restricted_runtime_poll_min_ms: 3e3,
399
+ restricted_runtime_event_limit: 20,
400
+ server_account_rest_catchup_min_interval_ms: 5e3,
401
+ server_account_catchup_poll_min_ms: 5e3,
402
+ execution_rest_catchup_delay_ms_steps: [
403
+ 2e3,
404
+ 8e3
405
+ ],
406
+ unified_bootstrap_hold_min_ms: 4e3,
407
+ unified_bootstrap_hold_max_ms: 8e3,
408
+ observed_activity_recent_ms: 8e3,
409
+ startup_hold_activation_gap_ms: 9e4,
410
+ hidden_ticker_update_interval_ms: 16,
411
+ client_close_fill_sync_attempts: 3,
412
+ client_close_fill_sync_retry_step_ms: 300,
413
+ leverage_update_debounce_ms: 250,
414
+ post_leverage_update_order_delay_ms: 250,
415
+ ai_control_lookback_fallback_candles: 25,
416
+ takeover_telemetry_error_chars: 500,
417
+ takeover_telemetry_error_name_chars: 120,
418
+ takeover_telemetry_failure_chars: 300,
419
+ client_next_run_interval_min_ms: 1e3,
420
+ ws_server_time_reorder_tolerance_ms: 1e3
421
+ },
422
+ trade_account_summary: {
423
+ unified_min_balances_usd: 25,
424
+ unified_balances_account_value_multiple: 3,
425
+ unified_spot_ratio_percent: 50
426
+ },
427
+ trade_debug_logs: {
428
+ text_chars: 180,
429
+ runtime_identity_tail_chars: 18,
430
+ run_id_chars: 8,
431
+ control_step_error_chars: 160,
432
+ control_note_chars: 120,
433
+ error_detail_chars: 120,
434
+ click_target_text_chars: 120,
435
+ ai_log_text_chars: 120,
436
+ preferences_error_chars: 160,
437
+ ssr_error_detail_chars: 160,
438
+ breadcrumb_payload_chars: 500,
439
+ render_debug_data_chars: 1200,
440
+ server_execution_value_chars: 700,
441
+ server_execution_error_chars: 250,
442
+ cost_trace_execution_debug_chars: 500,
443
+ positions_fetch_error_chars: 220,
444
+ ai_debug_lines: 100,
445
+ ai_model_status_lines: 100,
446
+ ai_model_status_shown_lines: 80,
447
+ ai_status_bar_trace_lines: 200,
448
+ ai_status_bar_trace_shown_lines: 120,
449
+ ai_status_bar_transition_lines: 200,
450
+ ai_status_bar_transition_shown_lines: 120,
451
+ ai_status_role_compare_lines: 240,
452
+ ai_status_role_compare_shown_lines: 160,
453
+ ai_status_bar_input_lines: 200,
454
+ ai_status_bar_input_shown_lines: 120,
455
+ ai_engine_transition_lines: 200,
456
+ ai_engine_transition_shown_lines: 120,
457
+ ai_panel_cost_lines: 120,
458
+ ai_panel_cost_shown_lines: 80,
459
+ ai_runtime_error_label_lines: 100,
460
+ ai_runtime_error_label_shown_lines: 80,
461
+ loop_status_mutation_lines: 200,
462
+ loop_status_mutation_shown_lines: 120,
463
+ login_recovery_trace_lines: 240,
464
+ sparkle_ownership_lines: 120,
465
+ ai_trader_start_lines: 100,
466
+ ai_trader_restart_trace_lines: 120,
467
+ ai_control_button_trace_lines: 240,
468
+ profile_status_hydration_lines: 120,
469
+ profile_status_hydration_shown_lines: 100,
470
+ cross_profile_runtime_lines: 120,
471
+ cross_profile_runtime_shown_lines: 80,
472
+ all_mode_ai_history_lines: 120,
473
+ positions_pnl_lines: 240,
474
+ positions_pnl_shown_lines: 200,
475
+ positions_pnl_changed_rows: 12,
476
+ account_state_lines: 80,
477
+ account_state_shown_lines: 200,
478
+ symbol_hydration_lines: 120,
479
+ trade_ui_click_lines: 200,
480
+ manual_close_lines: 80,
481
+ all_mode_interaction_lines: 160,
482
+ chart_render_entries: 80,
483
+ control_state_lines: 80,
484
+ runtime_network_lines: 80,
485
+ provider_fallback_trace_lines: 60,
486
+ runtime_stop_trace_lines: 80,
487
+ runtime_stop_breadcrumb_lines: 40,
488
+ prompt_contract_trace_lines: 80,
489
+ execution_trace_lines: 120,
490
+ single_history_trace_lines: 40,
491
+ ignored_ticker_channels: 8,
492
+ recent_network_targets: 8,
493
+ provider_failure_blocks: 6,
494
+ market_data_failure_blocks: 8,
495
+ pricing_candidates_shown: 10,
496
+ balance_delta_coins: 3,
497
+ all_mode_ai_head_messages: 5,
498
+ server_execution_decisions: 10,
499
+ server_decisions_shown: 5,
500
+ server_execution_refresh_ms: 1e4,
501
+ interaction_sample_delay_ms: 250,
502
+ local_breadcrumb_refresh_ms: 1e3,
503
+ flicker_direction_flip_window_ms: 6e3,
504
+ flicker_warmup_window_ms: 3e4,
505
+ upnl_double_count_min_cents: 50,
506
+ upnl_double_count_tolerance_cents: 5,
507
+ upnl_source_gap_min_cents: 50,
508
+ nonzero_upnl_jump_min_cents: 25,
509
+ nonzero_upnl_jump_min_relative_percent: 50,
510
+ nonzero_upnl_jump_min_margin_percent: 2,
511
+ cross_source_upnl_flicker_max_age_ms: 1e3,
512
+ cross_source_upnl_flicker_min_cents: 5,
513
+ restart_trace_manual_stop_window_minutes: 15,
514
+ hold_age_rounding_ms: 100,
515
+ account_summary_missing_trace_ms: 5e3
136
516
  },
137
517
  insights_access: {
138
518
  initial_prompt_idea_count: 6,
139
519
  section_preview_blocks: 2
140
520
  },
141
521
  marketing: {
142
- arena_leaderboard_entries: 3
522
+ arena_leaderboard_entries: 3,
523
+ data_revalidate_seconds: 60
143
524
  },
144
525
  calendar: {
145
- event_highlight_window_minutes: 60
526
+ event_highlight_window_minutes: 60,
527
+ search_save_debounce_ms: 250
146
528
  },
147
529
  system_page: {
148
- hyperliquid_manual_refresh_cooldown_ms: 800
530
+ hyperliquid_manual_refresh_cooldown_ms: 800,
531
+ config_retry_initial_delay_ms: 1e3,
532
+ debug_api_profile_poll_ms: 500,
533
+ debug_save_lines: 120,
534
+ debug_model_sync_lines: 80,
535
+ debug_byok_trace_lines: 160,
536
+ debug_profile_delete_trace_lines: 80,
537
+ debug_local_ai_trace_lines: 120,
538
+ debug_hyperliquid_trace_lines: 120,
539
+ debug_oac_trace_lines: 120,
540
+ debug_oac_applied_state_lines: 40,
541
+ debug_report_trace_lines: 40,
542
+ debug_report_trace_line_chars: 360,
543
+ debug_field_value_chars: 96,
544
+ debug_identity_redact_max_chars: 8,
545
+ debug_identity_edge_chars: 4
546
+ },
547
+ analysis_page: {
548
+ debug_log_lines: 120
549
+ },
550
+ changelog_page: {
551
+ profile_search_debounce_ms: 300,
552
+ search_debounce_ms: 300,
553
+ scope_navigation_filters_max_age_ms: 3e4,
554
+ prompt_diff_context_lines: 3,
555
+ debug_event_lines: 120
556
+ },
557
+ help_page: {
558
+ hash_scroll_settle_ms: 250
559
+ },
560
+ history_page: {
561
+ preferences_save_debounce_ms: 500,
562
+ tracked_ws_prompt_id_count: 500,
563
+ ws_prompt_fingerprint_text_chars: 80,
564
+ load_more_visibility_percent: 10
565
+ },
566
+ leaderboard_page: {
567
+ debug_panel_entries: 80,
568
+ debug_navbar_profile_entries: 12
569
+ },
570
+ login_page: {
571
+ desktop_bridge_poll_ms: 250,
572
+ turnstile_site_key_log_chars: 10
573
+ },
574
+ screener_page: {
575
+ search_save_debounce_ms: 250,
576
+ ws_refresh_debounce_ms: 40,
577
+ stop_client_run_wait_checks: 30,
578
+ stop_client_run_wait_poll_ms: 50,
579
+ assignment_load_more_threshold_px: 48,
580
+ debug_log_lines: 160,
581
+ debug_runtime_events: 30,
582
+ debug_search_transitions: 40,
583
+ debug_expansion_transitions: 80,
584
+ debug_value_chars: 260,
585
+ debug_text_chars: 180,
586
+ debug_array_items: 20,
587
+ debug_event_preview_items: 12,
588
+ debug_snapshot_keys: 25,
589
+ debug_snapshot_rows: 8
590
+ },
591
+ sitemap: {
592
+ leaderboard_page_batch_size: 5,
593
+ leaderboard_max_pages: 160,
594
+ leaderboard_scan_attempts: 3,
595
+ home_priority_percent: 100,
596
+ team_priority_percent: 50,
597
+ contact_priority_percent: 50,
598
+ methodology_priority_percent: 80,
599
+ trust_priority_percent: 70,
600
+ insights_priority_percent: 90,
601
+ referrals_priority_percent: 60,
602
+ start_priority_percent: 80,
603
+ leaderboard_priority_percent: 90,
604
+ updates_priority_percent: 80,
605
+ changelog_priority_percent: 70,
606
+ models_priority_percent: 70,
607
+ calendar_priority_percent: 60,
608
+ help_priority_percent: 70,
609
+ faq_priority_percent: 70,
610
+ download_priority_percent: 70,
611
+ privacy_priority_percent: 30,
612
+ terms_priority_percent: 30,
613
+ update_post_priority_percent: 60,
614
+ profile_trade_priority_percent: 70,
615
+ profile_analytics_priority_percent: 70,
616
+ profile_changelog_priority_percent: 60
617
+ },
618
+ tax_page: {
619
+ display_batch_size: 50,
620
+ load_more_delay_ms: 120,
621
+ load_more_visibility_percent: 10,
622
+ selectable_year_count: 5,
623
+ debug_log_lines: 150
624
+ },
625
+ updates_page: {
626
+ post_edited_label_min_gap_ms: 6e4,
627
+ comment_edited_label_min_gap_ms: 2e3,
628
+ meta_description_chars: 160
629
+ },
630
+ social_previews: {
631
+ subject_max_chars: 96,
632
+ viewport_width: 1600,
633
+ viewport_height: 900,
634
+ chart_painted_min_px: 100,
635
+ chart_paint_poll_ms: 200
636
+ },
637
+ manual_order_retry: {
638
+ max_attempts: 2,
639
+ default_retry_after_milliseconds: 1500,
640
+ retry_after_padding_milliseconds: 200,
641
+ min_delay_milliseconds: 500,
642
+ max_delay_milliseconds: 8e3
643
+ },
644
+ api_client: {
645
+ get_dedupe_ttl_ms: 2e3,
646
+ runtime_statuses_dedupe_ttl_ms: 5e3,
647
+ llm_config_prime_ttl_ms: 1e4,
648
+ leaderboard_dedupe_ttl_ms: 2e3,
649
+ platform_pricing_revalidate_seconds: 300,
650
+ platform_pricing_timeout_ms: 2e3,
651
+ market_data_error_detail_chars: 240,
652
+ market_data_interest_error_detail_chars: 200,
653
+ ai_trade_history_order_id_lookup_concurrency: 4,
654
+ exchange_evidence_rejection_detail_chars: 200
655
+ },
656
+ interaction: {
657
+ debounce_ms: 250,
658
+ command_list_scroll_settle_ms: 60
659
+ },
660
+ model_selection: {
661
+ local_context_cache_ttl_hours: 12,
662
+ pending_local_main_selection_ttl_hours: 12,
663
+ pending_openai_compatible_main_selection_ttl_hours: 12
149
664
  }
150
665
  },
151
666
  ai_dashboard: {
@@ -189,6 +704,10 @@ var runtime_policy_generated_default = {
189
704
  ]
190
705
  },
191
706
  defaults: {
707
+ calendar_settings: {
708
+ pre_buffer_mins: 60,
709
+ post_buffer_mins: 30
710
+ },
192
711
  max_chat_turns: 9999
193
712
  }
194
713
  },
@@ -201,10 +720,14 @@ var runtime_policy_generated_default = {
201
720
  network_backoff_max_seconds: 300,
202
721
  steal_ack_timeout_ms: 5e3,
203
722
  explicit_claim_max_waits: 3,
204
- local_ai_preflight_timeout_ms: 3e3
723
+ local_ai_preflight_timeout_ms: 3e3,
724
+ wake_debounce_ms: 250,
725
+ claim_settle_poll_ms: 50,
726
+ network_backoff_exponent_max: 16
205
727
  },
206
728
  observability: {
207
- deployment_reload_stall_warning_ms: 15e3
729
+ deployment_reload_stall_warning_ms: 15e3,
730
+ prompt_parity_error_detail_max_chars: 500
208
731
  },
209
732
  protective_actions: {
210
733
  adoption_request_timeout_milliseconds: 2e4,
@@ -212,11 +735,16 @@ var runtime_policy_generated_default = {
212
735
  attention_refresh_seconds: 60,
213
736
  evidence_max_items: 32,
214
737
  evidence_shared_read_seconds: 10,
215
- retry_delay_seconds: 15
738
+ retry_delay_seconds: 15,
739
+ evidence_min_sweep_delay_milliseconds: 1e3,
740
+ device_sweep_max_actions: 8,
741
+ remaining_recheck_milliseconds: 2e3,
742
+ evidence_max_age_seconds: 45
216
743
  },
217
744
  exchange_mutation: {
218
745
  settlement_retry_milliseconds: 1e3,
219
- settlement_retry_window_seconds: 120
746
+ settlement_retry_window_seconds: 120,
747
+ reconciliation_margin_milliseconds: 250
220
748
  },
221
749
  protective_plan_set_lock: {
222
750
  wait_seconds: 120
@@ -230,7 +758,8 @@ var runtime_policy_generated_default = {
230
758
  device_retry_seconds: 60
231
759
  },
232
760
  panel_reads: {
233
- device_open_orders_reuse_seconds: 2
761
+ device_open_orders_reuse_seconds: 2,
762
+ all_view_profile_concurrency: 2
234
763
  },
235
764
  account_stream: {
236
765
  fill_forward_interval_ms: 1e3,
@@ -247,9 +776,56 @@ var runtime_policy_generated_default = {
247
776
  ai_schedule_pause_unknown_milliseconds: 6e4,
248
777
  provider_failure_diagnostics_delay_milliseconds: 2500,
249
778
  provider_failure_diagnostics_max_age_milliseconds: 3e4,
250
- killswitch_timer_floor_milliseconds: 1e3
779
+ killswitch_timer_floor_milliseconds: 1e3,
780
+ cycle_timeout_floor_milliseconds: 1e3,
781
+ decision_settlement_reserve_max_budget_divisor: 2,
782
+ close_fill_sync_max_attempts: 3,
783
+ close_fill_sync_retry_step_milliseconds: 300,
784
+ execution_mode_mismatch_stop_checks: 2,
785
+ request_bounds: {
786
+ min_agent_instruction_retry_after_ms: 25,
787
+ max_fallback_error_length: 500
788
+ },
789
+ pending_protection_recovery: {
790
+ retry_exponent_max: 30
791
+ },
792
+ device_diagnostics: {
793
+ error_cause_max_depth: 4,
794
+ request_path_chars: 200,
795
+ request_method_chars: 12,
796
+ error_kind_chars: 40,
797
+ request_id_chars: 128,
798
+ contract_token_prefix_chars: 12,
799
+ copy_trading_request_id_chars: 80,
800
+ copy_trading_status_chars: 80,
801
+ browser_platform_chars: 40,
802
+ breadcrumbs_max_entries: 40,
803
+ breadcrumb_detail_chars: 280,
804
+ network_debug_max_entries: 80,
805
+ provider_failure_debug_max_entries: 20,
806
+ market_data_failure_debug_max_entries: 20,
807
+ request_string_compact_above_chars: 500,
808
+ prompt_preview_chars: 220,
809
+ provider_failure_snapshot_max_age_seconds: 300,
810
+ local_provider_probe_timeout_ms: 2e3,
811
+ preflight_failure_reason_chars: 200,
812
+ host_error_note_chars: 160,
813
+ tick_failure_note_chars: 300,
814
+ auto_resume_failure_detail_chars: 500,
815
+ vault_migration_error_chars: 200
816
+ },
817
+ request_retry: {
818
+ max_attempts: 3,
819
+ base_delay_milliseconds: 300,
820
+ max_delay_milliseconds: 8e3,
821
+ min_retry_after_milliseconds: 250,
822
+ deadline_attempt_spacing_milliseconds: 250
823
+ }
251
824
  },
252
825
  server_runtime: {
826
+ exchange_mutation_reconciliation: {
827
+ protective_episode_end_fill_lookback_seconds: 120
828
+ },
253
829
  prompt_rescue: {
254
830
  request_ttl_seconds: 20,
255
831
  snapshot_max_age_seconds: 5,
@@ -273,7 +849,9 @@ var runtime_policy_generated_default = {
273
849
  max_requests_per_read: 64,
274
850
  history_start_ms: 16409952e5,
275
851
  device_read_deadline_seconds: 180,
276
- device_recent_window_hours: 24
852
+ device_recent_window_hours: 24,
853
+ order_history_default_limit: 2e3,
854
+ order_history_max_limit: 2e3
277
855
  },
278
856
  tradability: {
279
857
  score_min: 1,
@@ -284,12 +862,32 @@ var runtime_policy_generated_default = {
284
862
  update_check_interval_ms: 144e5,
285
863
  update_check_timeout_ms: 5e3,
286
864
  stage_timeout_ms: 6e5,
287
- startup_ready_timeout_ms: 12e4
865
+ startup_ready_timeout_ms: 12e4,
866
+ headless_claim_max_waits: 10,
867
+ headless_stop_request_timeout_ms: 1e4,
868
+ headless_max_resumes_without_a_cycle: 5,
869
+ headless_resume_backoff_ms_steps: [
870
+ 1e3,
871
+ 5e3,
872
+ 15e3,
873
+ 3e4,
874
+ 6e4
875
+ ],
876
+ headless_backup_first_read_retry_ms_steps: [
877
+ 1e3,
878
+ 5e3
879
+ ],
880
+ browser_login_verifier_bytes: 32,
881
+ update_failure_reason_max_chars: 160,
882
+ update_directory_failure_reason_max_chars: 120,
883
+ update_plan_max_attempts: 3,
884
+ supervisor_max_failed_release_starts: 2
288
885
  },
289
886
  leaderboard: {
290
887
  device_portfolio: {
291
888
  device_retry_seconds: 300
292
- }
889
+ },
890
+ max_page_size: 100
293
891
  },
294
892
  external_inference: {
295
893
  service: {
@@ -307,6 +905,13 @@ var runtime_policy_generated_default = {
307
905
  update_readiness_timeout_ms: 6e5,
308
906
  rollback_confirmation_min_attempts: 100,
309
907
  ready_consecutive_observations: 2,
908
+ update_attempts: 3,
909
+ update_retry_interval_ms: 2e3,
910
+ update_failure_reason_max_chars: 160,
911
+ launcher_poll_interval_ms: 100,
912
+ log_tail_default_lines: 100,
913
+ worker_output_line_max_chars: 4096,
914
+ worker_stdout_tail_max_chars: 65536,
310
915
  control_lock_wait_attempts: 400,
311
916
  control_lock_retry_interval_ms: 250,
312
917
  supervisor_manifest_poll_interval_ms: 250,
@@ -315,6 +920,44 @@ var runtime_policy_generated_default = {
315
920
  claim_diagnostics: {
316
921
  event_loop_sample_interval_ms: 100
317
922
  },
923
+ host_core: {
924
+ oauth_request_timeout_ms: 15e3,
925
+ oauth_revocation_timeout_ms: 5e3,
926
+ oauth_login_timeout_ms: 6e5,
927
+ mcp_request_timeout_ms: 15e3,
928
+ mcp_retry_after_max_ms: 864e5,
929
+ credential_command_timeout_ms: 15e3,
930
+ credential_command_termination_timeout_ms: 5e3,
931
+ credential_command_output_max_bytes: 1048576,
932
+ private_file_max_bytes: 16777216,
933
+ private_file_replace_attempts: 40,
934
+ private_file_replace_retry_delay_ms: 25,
935
+ atomic_replacement_read_attempts: 3,
936
+ owned_directory_removal_attempts: 10,
937
+ owned_directory_removal_retry_step_ms: 100,
938
+ identity_command_timeout_ms: 5e3,
939
+ identity_command_output_max_bytes: 4096,
940
+ windows_identity_command_timeout_ms: 15e3,
941
+ windows_process_identity_output_max_bytes: 1024,
942
+ windows_acl_broker_startup_timeout_ms: 9e4,
943
+ windows_acl_broker_request_timeout_ms: 15e3,
944
+ windows_acl_broker_idle_shutdown_ms: 3e4,
945
+ windows_acl_broker_kill_grace_ms: 1e3,
946
+ windows_acl_broker_request_max_bytes: 65536,
947
+ windows_acl_broker_output_max_chars: 65536,
948
+ windows_acl_broker_response_line_max_chars: 4096,
949
+ process_lock_publication_grace_ms: 1e4,
950
+ process_lock_record_max_bytes: 65536,
951
+ process_lock_guard_election_lease_ms: 5e3,
952
+ process_lock_guard_election_stale_ms: 3e4,
953
+ process_lock_guard_election_attempts: 8,
954
+ process_lock_guard_election_backoff_ms: 10,
955
+ process_lock_guard_election_backoff_exponent_max: 4,
956
+ process_lock_identity_cache_ms: 5e3
957
+ },
958
+ agent_control: {
959
+ max_turn_decision_operation_ids: 128
960
+ },
318
961
  host_runtime: {
319
962
  advertisement_ttl_ms: 12e4,
320
963
  advertisement_refresh_lead_ms: 3e4,
@@ -323,6 +966,9 @@ var runtime_policy_generated_default = {
323
966
  agent_heartbeat_interval_ms: 3e3,
324
967
  agent_heartbeat_max_retry_delay_ms: 9e3,
325
968
  provider_rate_limit_refresh_ms: 6e4,
969
+ provider_quota_recovery_max_age_refresh_intervals: 2,
970
+ model_catalog_read_lead_divisor: 2,
971
+ agent_wake_summary_max_chars: 2e3,
326
972
  drain_timeout_ms: 3e4,
327
973
  remote_retry_limit: 3,
328
974
  minimum_sleep_ms: 10,
@@ -347,10 +993,72 @@ var runtime_policy_generated_default = {
347
993
  agent_turn_timeout_ms: 6e5,
348
994
  codex_rate_limit_metadata_timeout_ms: 5e3,
349
995
  codex_login_timeout_ms: 9e5,
350
- codex_command_timeout_ms: 3e4
996
+ codex_command_timeout_ms: 3e4,
997
+ cli_wait_default_seconds: 50,
998
+ cli_wait_max_seconds: 300,
999
+ cli_log_lines_default: 100,
1000
+ cli_log_lines_max: 1e4,
1001
+ service_control_input_max_chars: 4096,
1002
+ codex_auth_file_max_bytes: 8388608,
1003
+ agent_stdin_max_bytes: 1e6,
1004
+ agent_next_poll_min_ms: 50,
1005
+ agent_assignment_poll_min_ms: 250,
1006
+ agent_assignment_poll_fallback_ms: 1e3,
1007
+ agent_assignment_poll_max_ms: 5e3,
1008
+ codex_recovery_scan_max_entries: 2e4,
1009
+ codex_recovery_scan_max_depth: 12,
1010
+ codex_recovery_thread_file_max_bytes: 33554432,
1011
+ codex_recovery_thread_scan_lines: 128,
1012
+ codex_quiescence_proof_max_age_ms: 3e4,
1013
+ codex_quiescence_proof_clock_skew_ms: 1e3,
1014
+ codex_guardian_start_timeout_ms: 1e4,
1015
+ codex_guardian_termination_timeout_ms: 5e3,
1016
+ codex_guardian_termination_deadline_min_ms: 25,
1017
+ codex_guardian_state_poll_ms: 25,
1018
+ codex_guardian_shutdown_grace_ms: 2e3,
1019
+ codex_guardian_shutdown_grace_min_ms: 25,
1020
+ codex_guardian_receipt_replace_attempts: 40,
1021
+ codex_guardian_receipt_replace_retry_ms: 25,
1022
+ codex_diagnostic_attempt_ids_max: 64,
1023
+ codex_retired_response_ids_max: 256,
1024
+ codex_stderr_classification_tail_chars: 1024,
1025
+ codex_request_timeout_ms: 3e4,
1026
+ codex_interrupt_timeout_ms: 5e3,
1027
+ codex_login_cancel_timeout_ms: 5e3,
1028
+ codex_close_exit_timeout_ms: 5e3,
1029
+ codex_close_terminate_timeout_ms: 1e3,
1030
+ codex_close_kill_timeout_ms: 1e3,
1031
+ codex_process_tree_cleanup_timeout_ms: 5e3,
1032
+ binary_version_probe_timeout_ms: 1e4,
1033
+ binary_version_probe_stdout_max_chars: 1024,
1034
+ codex_version_probe_stderr_max_bytes: 65536,
1035
+ codex_recovery_process_observations: 2,
1036
+ codex_recovery_process_observation_interval_ms: 250,
1037
+ codex_recovery_process_query_stdout_max_chars: 4e6,
1038
+ codex_recovery_process_query_stderr_max_chars: 4096,
1039
+ deepseek_transport_request_max_bytes: 8388608,
1040
+ exo_command_output_max_bytes: 4e6,
1041
+ exo_git_output_max_chars: 2e5,
1042
+ exo_bridge_request_max_bytes: 2e6,
1043
+ exo_bridge_request_timeout_ms: 3e4,
1044
+ exo_provider_retry_after_max_ms: 864e5,
1045
+ grok_preflight_timeout_ms: 3e4,
1046
+ grok_login_timeout_ms: 9e5,
1047
+ grok_command_timeout_ms: 3e4,
1048
+ grok_auth_output_max_bytes: 65536,
1049
+ grok_binary_max_bytes: 536870912,
1050
+ grok_acp_message_max_bytes: 2e6,
1051
+ grok_close_kill_delay_ms: 1500,
1052
+ grok_mcp_request_max_bytes: 3e5,
1053
+ grok_cwd_marker_max_bytes: 32768,
1054
+ grok_session_summary_max_bytes: 1048576,
1055
+ provider_error_body_timeout_ms: 1e3,
1056
+ provider_error_body_max_bytes: 16384,
1057
+ pi_receipt_event_max_chars: 2e6
351
1058
  },
352
1059
  quota_membership_cooldown_seconds: 300,
353
- transient_membership_cooldown_seconds: 30
1060
+ transient_membership_cooldown_seconds: 30,
1061
+ runtime_poll_interval_milliseconds: 250
354
1062
  },
355
1063
  desktop: {
356
1064
  runtime_watchdog: {
@@ -366,6 +1074,16 @@ var runtime_policy_generated_default = {
366
1074
  client_lock_ttl_milliseconds: 12e4,
367
1075
  client_poll_interval_milliseconds: 250
368
1076
  },
1077
+ ui_bounds: {
1078
+ screener_min_volume_usd_max: 1e9
1079
+ },
1080
+ runtime: {
1081
+ assignment_page_default_limit: 20,
1082
+ client_candidate_owner_lease_grace_ms: 6e4,
1083
+ client_server_heartbeats_per_owner_lease: 2,
1084
+ client_server_heartbeat_min_ms: 5e3,
1085
+ client_server_heartbeat_max_ms: 3e4
1086
+ },
369
1087
  defaults: {
370
1088
  adaptive_schedule_enabled: true
371
1089
  }
@@ -499,6 +1217,9 @@ var runtime_policy_generated_default = {
499
1217
  tokens: {
500
1218
  email_2fa_code_length: 6,
501
1219
  totp_code_length: 6
1220
+ },
1221
+ passwords: {
1222
+ min_length: 12
502
1223
  }
503
1224
  },
504
1225
  android: {
@@ -539,6 +1260,14 @@ var runtime_policy_generated_default = {
539
1260
  handle_change_window_days: 14
540
1261
  }
541
1262
  },
1263
+ copy_trading: {
1264
+ source_search: {
1265
+ min_query_length: 2
1266
+ },
1267
+ runtime: {
1268
+ client_account_mode_cache_budget_divisor: 2
1269
+ }
1270
+ },
542
1271
  billing: {
543
1272
  credit_purchase: {
544
1273
  amount_usd_steps: [
@@ -578,6 +1307,22 @@ var runtime_policy_generated_default = {
578
1307
  min_query_length: 2
579
1308
  }
580
1309
  },
1310
+ profile_setting_changelog: {
1311
+ public_profile_search_limit: 10,
1312
+ page_default_limit: 50
1313
+ },
1314
+ history: {
1315
+ full_history_default_limit: 20,
1316
+ default_page_size: 50,
1317
+ trade_lookup_max_order_ids: 200,
1318
+ decision_batch_default_limit: 50
1319
+ },
1320
+ updates: {
1321
+ posts: {
1322
+ list_default_limit: 20,
1323
+ list_max_limit: 100
1324
+ }
1325
+ },
581
1326
  security: {
582
1327
  byok: {
583
1328
  max_provider_keys_per_provider: 5
@@ -594,10 +1339,58 @@ var runtime_policy_generated_default = {
594
1339
  }
595
1340
  },
596
1341
  referrals: {
597
- code_max_length: 24
1342
+ code_max_length: 24,
1343
+ dashboard_default_limit: 20
1344
+ },
1345
+ insights: {
1346
+ client_host: {
1347
+ device_read_default_result_bytes: 2e5
1348
+ }
1349
+ },
1350
+ agent_tokens: {
1351
+ browser_login_ttl_seconds: 600,
1352
+ browser_login_poll_interval_seconds: 2
598
1353
  }
599
1354
  };
600
1355
 
1356
+ // lib/constants.ts
1357
+ var MS_PER_SECOND = 1e3;
1358
+ var SECONDS_PER_MINUTE = 60;
1359
+ var MINUTES_PER_HOUR = 60;
1360
+ var HOURS_PER_DAY = 24;
1361
+ var DAYS_PER_WEEK = 7;
1362
+ var MS_PER_MINUTE = MS_PER_SECOND * SECONDS_PER_MINUTE;
1363
+ var SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR;
1364
+ var SECONDS_PER_DAY = SECONDS_PER_HOUR * HOURS_PER_DAY;
1365
+ var SECONDS_PER_WEEK = SECONDS_PER_DAY * DAYS_PER_WEEK;
1366
+ var MINUTES_PER_DAY = MINUTES_PER_HOUR * HOURS_PER_DAY;
1367
+ var MINUTES_PER_WEEK = MINUTES_PER_DAY * DAYS_PER_WEEK;
1368
+ var MS_PER_HOUR = MS_PER_MINUTE * MINUTES_PER_HOUR;
1369
+ var MS_PER_DAY = MS_PER_HOUR * HOURS_PER_DAY;
1370
+ var READ_STAMP_TIE_MS = MS_PER_SECOND / 1e6;
1371
+ var BACKOFF_GROWTH_FACTOR = 2;
1372
+ var BYTES_PER_KIB = 1024;
1373
+ var BYTES_PER_MIB = BYTES_PER_KIB * BYTES_PER_KIB;
1374
+ var OWNER_ONLY_FILE_MODE = 384;
1375
+ var OWNER_ONLY_DIRECTORY_MODE = 448;
1376
+ var GROUP_OTHER_PERMISSION_BITS = 63;
1377
+ var JSON_INDENT_SPACES = 2;
1378
+ var INT32_MIN = -(2 ** 31);
1379
+ var INT32_MAX = 2 ** 31 - 1;
1380
+ var AI_COST_ESTIMATE_PERIOD_DAYS = 30;
1381
+ var SECONDS_PER_AI_COST_ESTIMATE_PERIOD = SECONDS_PER_DAY * AI_COST_ESTIMATE_PERIOD_DAYS;
1382
+ var INFERENCE_HOST_PROCESS_LOCK_RECORD_SCHEMA_VERSION = 2;
1383
+ var INFERENCE_HOST_RECLAIM_GUARD_CREATE_PASSES = 2;
1384
+ var LINUX_PROC_STAT_COMM_TERMINATOR_CHARS = 2;
1385
+ var INFERENCE_HOST_RANDOM_BYTES = {
1386
+ TEMP_FILE_SUFFIX: 12,
1387
+ LOCK_BALLOT_NAME: 16,
1388
+ LOCK_TOKEN: 24,
1389
+ OAUTH_PKCE_VERIFIER: 48,
1390
+ OAUTH_STATE: 32,
1391
+ OAUTH_CALLBACK_PATH: 16
1392
+ };
1393
+
601
1394
  // lib/cli-release/updater.ts
602
1395
  import { spawn as spawn2 } from "node:child_process";
603
1396
  import { createHash, randomUUID } from "node:crypto";
@@ -611,13 +1404,14 @@ import { constants } from "node:fs";
611
1404
  import { lstat, mkdir, open, readdir, readFile, realpath, rename, rm } from "node:fs/promises";
612
1405
  import { homedir } from "node:os";
613
1406
  import { basename, dirname, isAbsolute, join, relative, resolve, win32 as windowsPath } from "node:path";
1407
+ var HOST_CORE_POLICY = runtime_policy_generated_default.external_inference.host_core;
614
1408
  var InferenceHostProcessLockBusyError = class extends Error {
615
1409
  constructor() {
616
1410
  super("Another inference host process already owns this local host.");
617
1411
  this.name = "InferenceHostProcessLockBusyError";
618
1412
  }
619
1413
  };
620
- var MAX_INFERENCE_PRIVATE_FILE_BYTES = 16 * 1024 * 1024;
1414
+ var MAX_INFERENCE_PRIVATE_FILE_BYTES = HOST_CORE_POLICY.private_file_max_bytes;
621
1415
  var WINDOWS_PRIVATE_ACL_MODES = ["harden", "verify", "verify-owner", "verify-private"];
622
1416
  var WINDOWS_PRIVATE_ACL_BROKER_SCRIPT = `$ErrorActionPreference='Stop'
623
1417
  $ProgressPreference='SilentlyContinue'
@@ -625,7 +1419,7 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
625
1419
  $requestId=$null
626
1420
  $failureStage='request_validation'
627
1421
  try {
628
- if($line.Length -lt 2 -or $line.Length -gt 65536) { throw 'invalid request size' }
1422
+ if($line.Length -lt 2 -or $line.Length -gt ${HOST_CORE_POLICY.windows_acl_broker_request_max_bytes}) { throw 'invalid request size' }
629
1423
  $request=$line | ConvertFrom-Json
630
1424
  $names=@($request.PSObject.Properties.Name | Sort-Object)
631
1425
  if(($names -join ',') -ne 'id,kind,mode,path_b64') { throw 'invalid request shape' }
@@ -701,9 +1495,9 @@ while(($line=[Console]::In.ReadLine()) -ne $null) {
701
1495
  [Console]::Out.WriteLine((@{id=$requestId;status='error';error_code=$failureStage} | ConvertTo-Json -Compress))
702
1496
  }
703
1497
  }`;
704
- var WINDOWS_IDENTITY_COMMAND_TIMEOUT_MS = 15e3;
705
- var WINDOWS_PRIVATE_ACL_BROKER_STARTUP_TIMEOUT_MS = 9e4;
706
- var SMALL_IDENTITY_COMMAND_TIMEOUT_MS = 5e3;
1498
+ var WINDOWS_IDENTITY_COMMAND_TIMEOUT_MS = HOST_CORE_POLICY.windows_identity_command_timeout_ms;
1499
+ var WINDOWS_PRIVATE_ACL_BROKER_STARTUP_TIMEOUT_MS = HOST_CORE_POLICY.windows_acl_broker_startup_timeout_ms;
1500
+ var SMALL_IDENTITY_COMMAND_TIMEOUT_MS = HOST_CORE_POLICY.identity_command_timeout_ms;
707
1501
  var windowsPowerShellEnvironment = (extra = {}) => {
708
1502
  const sanitizedExtra = { ...extra };
709
1503
  delete sanitizedExtra.PSModulePath;
@@ -746,9 +1540,9 @@ var WindowsPrivateAclBroker = class {
746
1540
  this.queue = operation.then(() => void 0, () => void 0);
747
1541
  await operation;
748
1542
  };
749
- this.requestTimeoutMs = dependencies.requestTimeoutMs ?? 15e3;
1543
+ this.requestTimeoutMs = dependencies.requestTimeoutMs ?? HOST_CORE_POLICY.windows_acl_broker_request_timeout_ms;
750
1544
  this.startupRequestTimeoutMs = dependencies.startupRequestTimeoutMs ?? WINDOWS_PRIVATE_ACL_BROKER_STARTUP_TIMEOUT_MS;
751
- this.idleShutdownMs = dependencies.idleShutdownMs ?? 3e4;
1545
+ this.idleShutdownMs = dependencies.idleShutdownMs ?? HOST_CORE_POLICY.windows_acl_broker_idle_shutdown_ms;
752
1546
  this.spawnProcess = dependencies.spawnProcess ?? (() => {
753
1547
  const invocation = windowsPrivateAclBrokerInvocation();
754
1548
  return spawn("powershell.exe", [...invocation.args], {
@@ -767,7 +1561,7 @@ var WindowsPrivateAclBroker = class {
767
1561
  this.child = null;
768
1562
  this.outputBuffer = "";
769
1563
  child.stdin.end();
770
- const force = setTimeout(() => child.kill("SIGKILL"), 1e3);
1564
+ const force = setTimeout(() => child.kill("SIGKILL"), HOST_CORE_POLICY.windows_acl_broker_kill_grace_ms);
771
1565
  force.unref();
772
1566
  child.once("exit", () => clearTimeout(force));
773
1567
  }, this.idleShutdownMs);
@@ -791,7 +1585,7 @@ var WindowsPrivateAclBroker = class {
791
1585
  }
792
1586
  acceptLine(child, line) {
793
1587
  const pending = this.pending;
794
- if (!pending || !line || line.length > 4096) {
1588
+ if (!pending || !line || line.length > HOST_CORE_POLICY.windows_acl_broker_response_line_max_chars) {
795
1589
  this.failChild(child, new Error("Windows private ACL broker returned malformed output."));
796
1590
  return;
797
1591
  }
@@ -842,7 +1636,7 @@ var WindowsPrivateAclBroker = class {
842
1636
  child.stdout.on("data", (chunk) => {
843
1637
  if (this.child !== child) return;
844
1638
  this.outputBuffer += chunk;
845
- if (this.outputBuffer.length > 65536) {
1639
+ if (this.outputBuffer.length > HOST_CORE_POLICY.windows_acl_broker_output_max_chars) {
846
1640
  this.failChild(child, new Error("Windows private ACL broker exceeded its output limit."));
847
1641
  return;
848
1642
  }
@@ -880,7 +1674,7 @@ var WindowsPrivateAclBroker = class {
880
1674
  path_b64: Buffer.from(path, "utf8").toString("base64")
881
1675
  })}
882
1676
  `;
883
- if (Buffer.byteLength(request, "utf8") > 65536) {
1677
+ if (Buffer.byteLength(request, "utf8") > HOST_CORE_POLICY.windows_acl_broker_request_max_bytes) {
884
1678
  throw new Error("Windows private ACL broker request exceeds its input limit.");
885
1679
  }
886
1680
  const { child, startedNow } = this.ensureChild();
@@ -985,7 +1779,7 @@ var linuxProcessIdentity = async (pid) => {
985
1779
  readFile("/proc/sys/kernel/random/boot_id", "utf8"),
986
1780
  readFile(`/proc/${pid}/stat`, "utf8")
987
1781
  ]);
988
- const fields = statLine.slice(statLine.lastIndexOf(")") + 2).trim().split(/\s+/u);
1782
+ const fields = statLine.slice(statLine.lastIndexOf(")") + LINUX_PROC_STAT_COMM_TERMINATOR_CHARS).trim().split(/\s+/u);
989
1783
  const startTicks = fields[19];
990
1784
  return startTicks ? `linux:${bootId.trim()}:${startTicks}` : null;
991
1785
  } catch {
@@ -1040,7 +1834,7 @@ var windowsProcessIdentity = async (pid) => await new Promise((resolvePromise) =
1040
1834
  settle(null);
1041
1835
  }, invocation.timeoutMs);
1042
1836
  child.stdout.on("data", (chunk) => {
1043
- if (output.reduce((total, item) => total + item.byteLength, 0) + Buffer.byteLength(chunk) > 1024) {
1837
+ if (output.reduce((total, item) => total + item.byteLength, 0) + Buffer.byteLength(chunk) > HOST_CORE_POLICY.windows_process_identity_output_max_bytes) {
1044
1838
  child.kill("SIGKILL");
1045
1839
  settle(null);
1046
1840
  return;
@@ -1068,12 +1862,12 @@ var darwinProcessIdentity = async (pid) => await new Promise((resolvePromise) =>
1068
1862
  const timer = setTimeout(() => {
1069
1863
  child.kill("SIGKILL");
1070
1864
  settle(null);
1071
- }, 5e3);
1865
+ }, SMALL_IDENTITY_COMMAND_TIMEOUT_MS);
1072
1866
  child.stdout.on("data", (chunk) => output.push(Buffer.from(chunk)));
1073
1867
  child.once("error", () => settle(null));
1074
1868
  child.once("exit", (code) => {
1075
1869
  const started = Date.parse(Buffer.concat(output).toString("utf8").trim());
1076
- settle(code === 0 && Number.isFinite(started) ? `darwin:${Math.floor(started / 1e3)}` : null);
1870
+ settle(code === 0 && Number.isFinite(started) ? `darwin:${Math.floor(started / MS_PER_SECOND)}` : null);
1077
1871
  });
1078
1872
  });
1079
1873
  var runSmallIdentityCommand = async (command, args, env, timeoutMs = SMALL_IDENTITY_COMMAND_TIMEOUT_MS) => await new Promise((resolvePromise) => {
@@ -1097,7 +1891,7 @@ var runSmallIdentityCommand = async (command, args, env, timeoutMs = SMALL_IDENT
1097
1891
  }, timeoutMs);
1098
1892
  child.stdout.on("data", (chunk) => {
1099
1893
  bytes += Buffer.byteLength(chunk);
1100
- if (bytes > 4096) {
1894
+ if (bytes > HOST_CORE_POLICY.identity_command_output_max_bytes) {
1101
1895
  child.kill("SIGKILL");
1102
1896
  settle(null);
1103
1897
  return;
@@ -1184,7 +1978,7 @@ async function ensureInferencePrivateDirectory(path, dependencies = {}) {
1184
1978
  }
1185
1979
  } catch (error) {
1186
1980
  if (error.code !== "ENOENT") throw error;
1187
- await mkdir(path, { recursive: true, mode: 448 });
1981
+ await mkdir(path, { recursive: true, mode: OWNER_ONLY_DIRECTORY_MODE });
1188
1982
  created = true;
1189
1983
  }
1190
1984
  const after = await lstat(path);
@@ -1205,7 +1999,7 @@ async function ensureInferencePrivateDirectory(path, dependencies = {}) {
1205
1999
  }
1206
2000
  return;
1207
2001
  }
1208
- if ((after.mode & 63) !== 0) {
2002
+ if ((after.mode & GROUP_OTHER_PERMISSION_BITS) !== 0) {
1209
2003
  throw new Error("Inference host state directory must have mode 0700.");
1210
2004
  }
1211
2005
  if (typeof process.getuid === "function" && after.uid !== process.getuid()) {
@@ -1236,8 +2030,8 @@ async function replaceAtomicInferencePrivateFile(temporaryPath, destinationPath,
1236
2030
  const platform = options.platform ?? process.platform;
1237
2031
  const renameFile = options.renameFile ?? rename;
1238
2032
  const sleep = options.sleep ?? ((milliseconds) => new Promise((resolve5) => setTimeout(resolve5, milliseconds)));
1239
- const maxAttempts = Math.max(1, options.maxAttempts ?? 40);
1240
- const retryDelayMs = Math.max(0, options.retryDelayMs ?? 25);
2033
+ const maxAttempts = Math.max(1, options.maxAttempts ?? HOST_CORE_POLICY.private_file_replace_attempts);
2034
+ const retryDelayMs = Math.max(0, options.retryDelayMs ?? HOST_CORE_POLICY.private_file_replace_retry_delay_ms);
1241
2035
  for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
1242
2036
  try {
1243
2037
  await renameFile(temporaryPath, destinationPath);
@@ -1263,12 +2057,12 @@ async function writeAtomicInferencePrivateFile(path, contents, dependencies = {}
1263
2057
  }
1264
2058
  const temporary = join(
1265
2059
  directory,
1266
- `.${process.pid}.${randomBytes(12).toString("hex")}.tmp`
2060
+ `.${process.pid}.${randomBytes(INFERENCE_HOST_RANDOM_BYTES.TEMP_FILE_SUFFIX).toString("hex")}.tmp`
1267
2061
  );
1268
2062
  const handle = await open(
1269
2063
  temporary,
1270
2064
  constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY | constants.O_NOFOLLOW,
1271
- 384
2065
+ OWNER_ONLY_FILE_MODE
1272
2066
  );
1273
2067
  try {
1274
2068
  await handle.writeFile(contents, "utf8");
@@ -1317,12 +2111,12 @@ async function writeAtomicInferencePrivateFile(path, contents, dependencies = {}
1317
2111
  throw error;
1318
2112
  }
1319
2113
  }
1320
- var PROCESS_LOCK_PUBLICATION_GRACE_MS = 1e4;
1321
- var PROCESS_LOCK_MAX_RECORD_BYTES = 64 * 1024;
1322
- var PROCESS_LOCK_GUARD_ELECTION_LEASE_MS = 5e3;
1323
- var PROCESS_LOCK_GUARD_ELECTION_STALE_MS = 3e4;
1324
- var PROCESS_LOCK_GUARD_ELECTION_ATTEMPTS = 8;
1325
- var PROCESS_LOCK_GUARD_ELECTION_BACKOFF_MS = 10;
2114
+ var PROCESS_LOCK_PUBLICATION_GRACE_MS = HOST_CORE_POLICY.process_lock_publication_grace_ms;
2115
+ var PROCESS_LOCK_MAX_RECORD_BYTES = HOST_CORE_POLICY.process_lock_record_max_bytes;
2116
+ var PROCESS_LOCK_GUARD_ELECTION_LEASE_MS = HOST_CORE_POLICY.process_lock_guard_election_lease_ms;
2117
+ var PROCESS_LOCK_GUARD_ELECTION_STALE_MS = HOST_CORE_POLICY.process_lock_guard_election_stale_ms;
2118
+ var PROCESS_LOCK_GUARD_ELECTION_ATTEMPTS = HOST_CORE_POLICY.process_lock_guard_election_attempts;
2119
+ var PROCESS_LOCK_GUARD_ELECTION_BACKOFF_MS = HOST_CORE_POLICY.process_lock_guard_election_backoff_ms;
1326
2120
  var PROCESS_LOCK_LABEL = "Inference host process lock";
1327
2121
  var PROCESS_LOCK_GUARD_LABEL = "Inference host process lock reclamation guard";
1328
2122
  var sameProcessLockFile = (left, right) => left.dev === right.dev && left.ino === right.ino && left.size === right.size && left.mtimeMs === right.mtimeMs && left.ctimeMs === right.ctimeMs;
@@ -1331,7 +2125,7 @@ var openExclusiveProcessLockFile = async (path) => {
1331
2125
  return await open(
1332
2126
  path,
1333
2127
  constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY | constants.O_NOFOLLOW,
1334
- 384
2128
+ OWNER_ONLY_FILE_MODE
1335
2129
  );
1336
2130
  } catch (error) {
1337
2131
  if (error.code === "EEXIST") return null;
@@ -1346,7 +2140,7 @@ var inspectProcessLockFile = async (path, label, probes) => {
1346
2140
  if (error.code === "ENOENT") return { state: "missing" };
1347
2141
  throw error;
1348
2142
  }
1349
- if (before.isSymbolicLink() || !before.isFile() || process.platform !== "win32" && (before.mode & 63) !== 0 || typeof process.getuid === "function" && before.uid !== process.getuid()) {
2143
+ if (before.isSymbolicLink() || !before.isFile() || process.platform !== "win32" && (before.mode & GROUP_OTHER_PERMISSION_BITS) !== 0 || typeof process.getuid === "function" && before.uid !== process.getuid()) {
1350
2144
  throw new Error(`${label} is unsafe.`);
1351
2145
  }
1352
2146
  let handle;
@@ -1373,7 +2167,7 @@ var inspectProcessLockFile = async (path, label, probes) => {
1373
2167
  } catch {
1374
2168
  record = null;
1375
2169
  }
1376
- 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) {
2170
+ 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) {
1377
2171
  if (Date.now() - stat.mtimeMs < PROCESS_LOCK_PUBLICATION_GRACE_MS) return { state: "busy" };
1378
2172
  stale = true;
1379
2173
  return { state: "stale", handle, stat };
@@ -1383,7 +2177,7 @@ var inspectProcessLockFile = async (path, label, probes) => {
1383
2177
  const cacheKey = resolve(path);
1384
2178
  if (await probes.currentBootIdentity() === record.boot_identity && probes.isProcessAlive(ownerPid)) {
1385
2179
  const cached = processLockObservationCache.get(cacheKey);
1386
- 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);
2180
+ 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);
1387
2181
  if (!observedIdentity) {
1388
2182
  throw new Error("Inference host could not verify the existing lock owner identity.");
1389
2183
  }
@@ -1440,7 +2234,7 @@ var removeStaleProcessLockReclaimGuard = async (lockPath, guardPath, inspection)
1440
2234
  if (attempt > 0) {
1441
2235
  await new Promise((resolvePromise) => setTimeout(
1442
2236
  resolvePromise,
1443
- Math.floor(Math.random() * PROCESS_LOCK_GUARD_ELECTION_BACKOFF_MS * 2 ** Math.min(attempt, 4))
2237
+ 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))
1444
2238
  ));
1445
2239
  let current;
1446
2240
  try {
@@ -1451,7 +2245,7 @@ var removeStaleProcessLockReclaimGuard = async (lockPath, guardPath, inspection)
1451
2245
  }
1452
2246
  if (!sameProcessLockFile(current, inspection.stat)) return;
1453
2247
  }
1454
- const ballotName = `${prefix}${randomBytes(16).toString("hex")}`;
2248
+ const ballotName = `${prefix}${randomBytes(INFERENCE_HOST_RANDOM_BYTES.LOCK_BALLOT_NAME).toString("hex")}`;
1455
2249
  const ballotPath = join(directory, ballotName);
1456
2250
  const ballot = await openExclusiveProcessLockFile(ballotPath);
1457
2251
  if (!ballot) continue;
@@ -1493,8 +2287,8 @@ var removeStaleProcessLockReclaimGuard = async (lockPath, guardPath, inspection)
1493
2287
  };
1494
2288
  var acquireProcessLockReclaimGuard = async (lockPath, ownerRecord, probes) => {
1495
2289
  const guardPath = `${lockPath}.reclaim`;
1496
- const guardToken = randomBytes(24).toString("base64url");
1497
- for (let attempt = 0; attempt < 2; attempt += 1) {
2290
+ const guardToken = randomBytes(INFERENCE_HOST_RANDOM_BYTES.LOCK_TOKEN).toString("base64url");
2291
+ for (let attempt = 0; attempt < INFERENCE_HOST_RECLAIM_GUARD_CREATE_PASSES; attempt += 1) {
1498
2292
  const handle = await openExclusiveProcessLockFile(guardPath);
1499
2293
  if (handle) {
1500
2294
  try {
@@ -1556,7 +2350,7 @@ var acquireProcessLockReclaimGuard = async (lockPath, ownerRecord, probes) => {
1556
2350
  async function acquireInferenceHostProcessLock(path, dependencies = {}) {
1557
2351
  const directory = dirname(path);
1558
2352
  await ensureInferencePrivateDirectory(directory);
1559
- const ownerToken = randomBytes(24).toString("base64url");
2353
+ const ownerToken = randomBytes(INFERENCE_HOST_RANDOM_BYTES.LOCK_TOKEN).toString("base64url");
1560
2354
  const probes = {
1561
2355
  currentBootIdentity: dependencies.currentBootIdentity ?? (() => readInferenceSystemBootIdentity()),
1562
2356
  observeIdentity: dependencies.processIdentity ?? defaultProcessIdentity,
@@ -1575,7 +2369,7 @@ async function acquireInferenceHostProcessLock(path, dependencies = {}) {
1575
2369
  probes.currentBootIdentity()
1576
2370
  ]);
1577
2371
  const ownerRecord = (token) => `${JSON.stringify({
1578
- schema_version: 2,
2372
+ schema_version: INFERENCE_HOST_PROCESS_LOCK_RECORD_SCHEMA_VERSION,
1579
2373
  pid: process.pid,
1580
2374
  owner_token: token,
1581
2375
  process_identity: ownerIdentity,
@@ -1790,8 +2584,8 @@ var ensureUpdaterPrivateDirectory = async (path, root, dependencies = {}) => {
1790
2584
  }
1791
2585
  if (resolve2(path) === resolve2(root) || isPathWithin(root, path)) {
1792
2586
  const existing = await lstat2(path).catch(() => null);
1793
- if (existing && existing.isDirectory() && !existing.isSymbolicLink() && (existing.mode & 63) !== 0 && (typeof process.getuid !== "function" || existing.uid === process.getuid())) {
1794
- await chmod(path, 448);
2587
+ if (existing && existing.isDirectory() && !existing.isSymbolicLink() && (existing.mode & GROUP_OTHER_PERMISSION_BITS) !== 0 && (typeof process.getuid !== "function" || existing.uid === process.getuid())) {
2588
+ await chmod(path, OWNER_ONLY_DIRECTORY_MODE);
1795
2589
  }
1796
2590
  }
1797
2591
  await ensureInferencePrivateDirectory(path, { ...dependencies, defaultRoot: root });
@@ -1920,7 +2714,7 @@ var writeCliReleaseRejection = async (path, rejection, privateRoot) => {
1920
2714
  if (privateRoot) await ensureUpdaterPrivateDirectory(privateRoot, privateRoot);
1921
2715
  await writeAtomicInferencePrivateFile(
1922
2716
  path,
1923
- `${JSON.stringify(rejection, null, 2)}
2717
+ `${JSON.stringify(rejection, null, JSON_INDENT_SPACES)}
1924
2718
  `,
1925
2719
  privateRoot ? { defaultRoot: privateRoot } : {}
1926
2720
  );
@@ -1968,8 +2762,8 @@ var readLauncherState = async (manifest) => {
1968
2762
  };
1969
2763
 
1970
2764
  // lib/inference-host/service-bootstrap.ts
1971
- var UPDATE_ATTEMPTS = 3;
1972
- var UPDATE_RETRY_MS = 2e3;
2765
+ var UPDATE_ATTEMPTS = runtime_policy_generated_default.external_inference.service.update_attempts;
2766
+ var UPDATE_RETRY_MS = runtime_policy_generated_default.external_inference.service.update_retry_interval_ms;
1973
2767
  var CANDIDATE_READINESS_TIMEOUT_MS = runtime_policy_generated_default.external_inference.service.bootstrap_readiness_timeout_ms;
1974
2768
  var SERVICE_DRAIN_COMMAND = "vtx-inference-host-service-drain-v1";
1975
2769
  var SERVICE_QUIESCE_COMMAND = "vtx-inference-host-service-quiesce-v1";
@@ -2073,12 +2867,12 @@ var defaultRunSupervisor = (executable, args) => {
2073
2867
  };
2074
2868
  };
2075
2869
  var appendBootstrapLog = async (path, event, fields = {}) => {
2076
- await mkdir3(dirname4(path), { recursive: true, mode: 448 });
2870
+ await mkdir3(dirname4(path), { recursive: true, mode: OWNER_ONLY_DIRECTORY_MODE });
2077
2871
  await appendFile2(
2078
2872
  path,
2079
2873
  `${JSON.stringify({ at: (/* @__PURE__ */ new Date()).toISOString(), event, ...fields })}
2080
2874
  `,
2081
- { encoding: "utf8", mode: 384 }
2875
+ { encoding: "utf8", mode: OWNER_ONLY_FILE_MODE }
2082
2876
  );
2083
2877
  };
2084
2878
  var fetchLatestRelease = async (fetchImpl, signal) => await fetchLatestCliRelease(fetchImpl, {
@@ -2088,7 +2882,7 @@ var fetchLatestRelease = async (fetchImpl, signal) => await fetchLatestCliReleas
2088
2882
  var atomicWriteSelection = async (manifestPath, selection) => {
2089
2883
  await writeAtomicInferencePrivateFile(
2090
2884
  selectionPathFor(manifestPath),
2091
- `${JSON.stringify(selection, null, 2)}
2885
+ `${JSON.stringify(selection, null, JSON_INDENT_SPACES)}
2092
2886
  `
2093
2887
  );
2094
2888
  };
@@ -2165,7 +2959,7 @@ var waitForCandidateReadiness = async (manifestPath, candidate, signal, timeoutM
2165
2959
  }
2166
2960
  } catch {
2167
2961
  }
2168
- await waitForUpdateCheck(250, signal);
2962
+ await waitForUpdateCheck(runtime_policy_generated_default.external_inference.service.startup_poll_interval_ms, signal);
2169
2963
  }
2170
2964
  return signal.aborted ? "aborted" : "timeout";
2171
2965
  };
@@ -2263,7 +3057,7 @@ var runInferenceHostServiceBootstrap = async (manifestPathValue, dependencies =
2263
3057
  return await updateSelection(manifestPath, manifest, updateDependencies);
2264
3058
  } catch (error) {
2265
3059
  await appendBootstrapLog(manifest.log_path, "service_update_deferred", {
2266
- reason: error instanceof Error ? error.message.slice(0, 160) : "unknown"
3060
+ reason: error instanceof Error ? error.message.slice(0, runtime_policy_generated_default.external_inference.service.update_failure_reason_max_chars) : "unknown"
2267
3061
  });
2268
3062
  return { active, candidate: null };
2269
3063
  }