@vtxmacro/cli 2026.10.12 → 2026.10.14

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.
@@ -1,380 +1,1750 @@
1
- /** Loaded by the pinned exoharness/exo TypeScript executor, never by the web app.
2
- * The VTX broker owns OAuth and assignment authority. This module receives only
3
- * a turn-scoped broker capability and the selected vendor credential.
4
- */
5
- import { join } from 'node:path';
6
- import { pathToFileURL } from 'node:url';
1
+ // lib/inference-host/exo-harness.ts
2
+ import { join } from "node:path";
3
+ import { pathToFileURL } from "node:url";
7
4
 
8
- type Json = Record<string, unknown>;
9
- type Message = { role: string; content: unknown };
10
- type ToolCall = { toolCallId: string; request: { functionName: string; arguments: Json } };
11
- type Context = {
12
- exoharness: { current: { conversation: { getEvents(query: Json): Promise<{ events: unknown[] }> };
13
- turn: { addEvents(events: unknown[]): Promise<{ latestEventId: string }> } } };
5
+ // lib/constants.ts
6
+ var MS_PER_SECOND = 1e3;
7
+ var SECONDS_PER_MINUTE = 60;
8
+ var MINUTES_PER_HOUR = 60;
9
+ var HOURS_PER_DAY = 24;
10
+ var DAYS_PER_WEEK = 7;
11
+ var MS_PER_MINUTE = MS_PER_SECOND * SECONDS_PER_MINUTE;
12
+ var SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR;
13
+ var SECONDS_PER_DAY = SECONDS_PER_HOUR * HOURS_PER_DAY;
14
+ var SECONDS_PER_WEEK = SECONDS_PER_DAY * DAYS_PER_WEEK;
15
+ var MINUTES_PER_DAY = MINUTES_PER_HOUR * HOURS_PER_DAY;
16
+ var MINUTES_PER_WEEK = MINUTES_PER_DAY * DAYS_PER_WEEK;
17
+ var MS_PER_HOUR = MS_PER_MINUTE * MINUTES_PER_HOUR;
18
+ var MS_PER_DAY = MS_PER_HOUR * HOURS_PER_DAY;
19
+ var READ_STAMP_TIE_MS = MS_PER_SECOND / 1e6;
20
+ var BYTES_PER_KIB = 1024;
21
+ var BYTES_PER_MIB = BYTES_PER_KIB * BYTES_PER_KIB;
22
+ var INT32_MIN = -(2 ** 31);
23
+ var INT32_MAX = 2 ** 31 - 1;
24
+ var HTTP_STATUS = {
25
+ OK: 200,
26
+ ACCEPTED: 202,
27
+ NO_CONTENT: 204,
28
+ FOUND: 302,
29
+ SEE_OTHER: 303,
30
+ BAD_REQUEST: 400,
31
+ UNAUTHORIZED: 401,
32
+ PAYMENT_REQUIRED: 402,
33
+ FORBIDDEN: 403,
34
+ NOT_FOUND: 404,
35
+ METHOD_NOT_ALLOWED: 405,
36
+ REQUEST_TIMEOUT: 408,
37
+ CONFLICT: 409,
38
+ CONTENT_TOO_LARGE: 413,
39
+ URI_TOO_LONG: 414,
40
+ UNSUPPORTED_MEDIA_TYPE: 415,
41
+ UNPROCESSABLE_CONTENT: 422,
42
+ TOO_EARLY: 425,
43
+ TOO_MANY_REQUESTS: 429,
44
+ INTERNAL_SERVER_ERROR: 500,
45
+ BAD_GATEWAY: 502,
46
+ SERVICE_UNAVAILABLE: 503,
47
+ GATEWAY_TIMEOUT: 504
14
48
  };
15
- type Input = {
16
- provider: 'openai' | 'venice';
17
- mode: 'provider' | 'agent'; systemPrompt: string; userPrompt: string;
18
- outputSchema: Json; decisionSchema: Json; dataContract: { id: string; input_schema: Json }[];
19
- requestedModel: string; providerModel: string; reasoningEffort: string;
20
- nativeReasoningEffort: string | null; maxRounds: number;
21
- deadlineAtMs: number;
22
- };
23
- type ExoHarnessModule = {
24
- materializePromptMessages(conversation: unknown, instructions: Message[]): Promise<Message[]>;
25
- materializeEventsToMessages(events: unknown[]): Message[];
26
- toolResultEvent(id: string, result: unknown): unknown;
27
- };
28
- type Runtime = {
29
- complete(request: Json): Promise<Json>;
30
- };
31
- type ExoModelModule = {
32
- ResponsesRuntime: new (options: { apiKey: string; baseURL: string }) => Runtime;
33
- ChatCompletionsRuntime: new (options: { apiKey: string; baseURL: string }) => Runtime;
34
- responseToLinguaEvents(response: Json): unknown[];
35
- responseToolCalls(response: Json): ToolCall[];
49
+ var HTTP_CLIENT_ERROR_MIN = 400;
50
+ var HTTP_SERVER_ERROR_MIN = 500;
51
+ var AI_COST_ESTIMATE_PERIOD_DAYS = 30;
52
+ var SECONDS_PER_AI_COST_ESTIMATE_PERIOD = SECONDS_PER_DAY * AI_COST_ESTIMATE_PERIOD_DAYS;
53
+ var INFERENCE_HOST_MODEL_ID_MAX_CHARS = 256;
54
+ var RETRY_AFTER_HEADER_MAX_CHARS = 128;
55
+ var EXO_POLICY_MAX_TOOL_ROUNDS = 64;
56
+
57
+ // lib/runtime-policy.generated.json
58
+ var runtime_policy_generated_default = {
59
+ ui: {
60
+ performance_defaults: {
61
+ default_timeframe: "30d"
62
+ },
63
+ execution_metadata_retry: {
64
+ max_attempts: 3,
65
+ base_delay_milliseconds: 2e3,
66
+ max_delay_milliseconds: 3e4
67
+ },
68
+ auth_bootstrap_retry: {
69
+ max_attempts: 3,
70
+ jitter_milliseconds: 750,
71
+ base_delay_milliseconds: 500,
72
+ min_delay_milliseconds: 250,
73
+ max_delay_milliseconds: 1e4,
74
+ recovery_base_delay_milliseconds: 1e3,
75
+ recovery_max_delay_milliseconds: 3e4,
76
+ recovery_exponent_max: 5
77
+ },
78
+ trade_refresh_policy: {
79
+ server_config_stream_timeout_ms: 1e4,
80
+ config_retry_interval_ms: 5e3,
81
+ copy_trading_status_poll_ms: 5e3,
82
+ post_execution_refresh_delay_ms: 3e3,
83
+ account_read_backoff_min_ms: 2e3,
84
+ account_read_backoff_max_ms: 6e4,
85
+ account_read_backoff_exponent_max: 30,
86
+ ai_start_grace_min_ms: 45e3
87
+ },
88
+ deployment_reload_observability: {
89
+ bootstrap_max_error_events_per_page: 4,
90
+ bootstrap_max_profiles: 10
91
+ },
92
+ ws_fallback_polling: {
93
+ screener_active_run_ms: 2500
94
+ },
95
+ deployment_reload: {
96
+ version_poll_interval_seconds: 30,
97
+ reload_delay_seconds: 5
98
+ },
99
+ profile_runtime_status: {
100
+ sync_timeout_ms: 8e3,
101
+ sync_concurrency: 3,
102
+ refresh_interval_ms: 1e4,
103
+ watchdog_interval_ms: 1e3,
104
+ watchdog_grace_ms: 500
105
+ },
106
+ preferences: {
107
+ load_timeout_ms: 5e3,
108
+ initial_load_settle_ms: 100,
109
+ external_save_timeout_ms: 8e3,
110
+ guest_cookie_max_age_days: 9999,
111
+ dropdown_search_max_chars: 200
112
+ },
113
+ navigation_feedback: {
114
+ finish_fallback_ms: 2250
115
+ },
116
+ confirmation_notices: {
117
+ success_indicator_ms: 2e3,
118
+ byok_success_message_ms: 3e3
119
+ },
120
+ screener_runtime_config_retry: {
121
+ base_delay_ms: 1e3,
122
+ max_delay_ms: 3e4
123
+ },
124
+ advanced_chart: {
125
+ debug_log_throttle_ms: 1e3,
126
+ initial_history_stall_ms: 15e3,
127
+ initial_history_recovery_cooldown_ms: 3e4,
128
+ viewport_restore_settle_ms: 100,
129
+ symbol_price_wait_ms: 2e3,
130
+ layout_auto_save_delay_ms: 250
131
+ },
132
+ ai_panel: {
133
+ message_limit: 100,
134
+ post_execution_history_sync_delay_ms: 2e3,
135
+ runtime_error_attempt_group_window_seconds: 120,
136
+ debug_runtime_error_preview_chars: 180
137
+ },
138
+ ai_settings: {
139
+ storage_authority_broadcast_dedupe_window_ms: 2e3,
140
+ margin_type_external_authority_ttl_ms: 12e4,
141
+ screener_status_refresh_delay_ms: 75,
142
+ preference_message_dedupe_keys: 24,
143
+ available_assets_retry_default_ms: 15e3,
144
+ available_assets_retry_min_ms: 1e3,
145
+ available_assets_retry_max_ms: 6e4,
146
+ external_sync_settle_ms: 1e3,
147
+ billing_stats_reuse_ms: 3e3,
148
+ prompt_commit_debounce_ms: 180,
149
+ model_count_display_settle_ms: 320,
150
+ model_picker_scroll_settle_ms: 60
151
+ },
152
+ ai_settings_debug: {
153
+ model_debug_event_limit: 160,
154
+ browser_resource_timings: 40,
155
+ browser_resource_panel_rows: 12,
156
+ browser_timing_refresh_delay_ms: 1500,
157
+ comparable_hash_full_max_chars: 16,
158
+ comparable_hash_edge_chars: 8,
159
+ console_message_chars: 4e3,
160
+ comparable_diff_max_depth: 4,
161
+ react_profile_min_duration_ms: 20,
162
+ react_profile_slower_margin_ms: 25,
163
+ react_profile_slow_update_ms: 100,
164
+ react_profile_repeat_interval_ms: 1500,
165
+ snapshot_ids_head: 10,
166
+ longtask_samples: 12,
167
+ recent_events: 20,
168
+ hydration_recent_events: 12,
169
+ dirty_state_recent_events: 12,
170
+ navbar_profile_entries: 30,
171
+ dropdown_search_paint_events: 6,
172
+ dropdown_options_debounce_ms: 220,
173
+ dropdown_hover_min_interval_ms: 80,
174
+ slow_render_ms: 80,
175
+ render_min_ms: 24,
176
+ render_min_interval_ms: 300,
177
+ model_fingerprint_head: 24,
178
+ models_head: 12
179
+ },
180
+ insights_charts: {
181
+ max_charts: 3,
182
+ max_line_points: 160,
183
+ max_bars: 8
184
+ },
185
+ analysis_chat: {
186
+ new_message_scroll_delay_ms: 100
187
+ },
188
+ snapshot_selector: {
189
+ sync_resolution_pending_ms: 350,
190
+ own_broadcast_window_ms: 5e3,
191
+ seen_imported_ids_limit: 200,
192
+ post_import_reload_delay_ms: 1e3,
193
+ debug_value_chars: 220,
194
+ debug_fingerprint_head_chars: 64,
195
+ debug_head_snapshot_ids: 8,
196
+ debug_comparable_head_chars: 240,
197
+ debug_panel_comparable_head_chars: 120
198
+ },
199
+ safe_mode_settings: {
200
+ usdc_slider_cents_steps: [
201
+ 10,
202
+ 25,
203
+ 50,
204
+ 75,
205
+ 100,
206
+ 150,
207
+ 200,
208
+ 300,
209
+ 400,
210
+ 500,
211
+ 750,
212
+ 1e3,
213
+ 1500,
214
+ 2e3,
215
+ 2500,
216
+ 3e3,
217
+ 4e3,
218
+ 5e3,
219
+ 7500,
220
+ 1e4,
221
+ 15e3,
222
+ 2e4,
223
+ 25e3,
224
+ 3e4,
225
+ 4e4,
226
+ 5e4,
227
+ 75e3,
228
+ 1e5,
229
+ 125e3,
230
+ 15e4,
231
+ 2e5,
232
+ 25e4,
233
+ 3e5,
234
+ 4e5,
235
+ 5e5,
236
+ 6e5,
237
+ 7e5,
238
+ 8e5,
239
+ 9e5,
240
+ 1e6
241
+ ],
242
+ percent_input_step_bps: 1
243
+ },
244
+ copy_trading_settings: {
245
+ scale_multiplier_slider_thousandths_steps: [
246
+ 10,
247
+ 20,
248
+ 30,
249
+ 40,
250
+ 50,
251
+ 75,
252
+ 100,
253
+ 150,
254
+ 200,
255
+ 250,
256
+ 300,
257
+ 400,
258
+ 500,
259
+ 600,
260
+ 700,
261
+ 800,
262
+ 850,
263
+ 900,
264
+ 950,
265
+ 975,
266
+ 1e3,
267
+ 1025,
268
+ 1050,
269
+ 1100,
270
+ 1250,
271
+ 1500,
272
+ 1750,
273
+ 2e3,
274
+ 2500,
275
+ 3e3,
276
+ 4e3,
277
+ 5e3,
278
+ 7500,
279
+ 1e4,
280
+ 15e3,
281
+ 2e4,
282
+ 3e4,
283
+ 4e4,
284
+ 5e4,
285
+ 75e3,
286
+ 1e5
287
+ ]
288
+ },
289
+ analysis_settings: {
290
+ lookback_slider_candles_steps: [
291
+ 1,
292
+ 2,
293
+ 3,
294
+ 4,
295
+ 5,
296
+ 6,
297
+ 7,
298
+ 8,
299
+ 9,
300
+ 10,
301
+ 12,
302
+ 14,
303
+ 16,
304
+ 18,
305
+ 20,
306
+ 24,
307
+ 28,
308
+ 32,
309
+ 36,
310
+ 40,
311
+ 42,
312
+ 44,
313
+ 48,
314
+ 52,
315
+ 56,
316
+ 60,
317
+ 65,
318
+ 70,
319
+ 75,
320
+ 80,
321
+ 90,
322
+ 100,
323
+ 110,
324
+ 120,
325
+ 130,
326
+ 140,
327
+ 150,
328
+ 160,
329
+ 180,
330
+ 200
331
+ ]
332
+ },
333
+ trading_limit_settings: {
334
+ ai_trade_amount_usdc_steps: [
335
+ 20,
336
+ 30,
337
+ 40,
338
+ 50,
339
+ 60,
340
+ 70,
341
+ 80,
342
+ 90,
343
+ 100,
344
+ 150,
345
+ 175,
346
+ 200,
347
+ 225,
348
+ 250,
349
+ 275,
350
+ 300,
351
+ 325,
352
+ 350,
353
+ 375,
354
+ 400,
355
+ 425,
356
+ 450,
357
+ 475,
358
+ 500,
359
+ 600,
360
+ 700,
361
+ 800,
362
+ 900,
363
+ 1e3,
364
+ 1250,
365
+ 1500,
366
+ 1750,
367
+ 2e3,
368
+ 2250,
369
+ 2500,
370
+ 2750,
371
+ 3e3,
372
+ 3250,
373
+ 3500,
374
+ 3750,
375
+ 4e3,
376
+ 4250,
377
+ 4500,
378
+ 4750,
379
+ 5e3,
380
+ 6e3,
381
+ 7e3,
382
+ 8e3,
383
+ 9e3,
384
+ 1e4
385
+ ],
386
+ ai_trade_amount_max_stop_count: 50
387
+ },
388
+ calendar_settings: {
389
+ buffer_input_step_seconds: 30
390
+ },
391
+ debug_logs: {
392
+ snapshot_card_lines: 80,
393
+ render_debug_overlay_entries: 120,
394
+ render_debug_entry_data_chars: 2400,
395
+ analytics_dashboard_lines: 220,
396
+ analytics_metric_capture_interval_ms: 400,
397
+ system_profile_mode_lines: 120,
398
+ admin_text_chars: 160,
399
+ admin_analysis_run_id_chars: 32,
400
+ hyperliquid_balance_preview_count: 3,
401
+ model_picker_preview_count: 5,
402
+ render_debug_entries: 250
403
+ },
404
+ history_panels: {
405
+ display_batch_size: 50,
406
+ load_more_threshold_px: 100,
407
+ trade_history_fetch_page_size: 100,
408
+ ai_panel_interaction_window_ms: 2500,
409
+ ai_panel_defer_max_staleness_ms: 1e4,
410
+ ai_panel_defer_retry_ms: 1500,
411
+ order_id_metadata_traversal_max_nodes: 400
412
+ },
413
+ trade_page: {
414
+ config_first_retry_delay_ms: 1e3,
415
+ margin_mode_min_loading_ms: 250,
416
+ preferences_load_retry_delay_ms_steps: [
417
+ 1500,
418
+ 3e3,
419
+ 6e3,
420
+ 12e3
421
+ ],
422
+ preferences_retry_jitter_max_ms: 1500,
423
+ all_profile_preferences_save_delay_ms: 1500,
424
+ all_profile_save_interaction_window_ms: 2e3,
425
+ all_profile_read_concurrency: 2,
426
+ all_profile_ai_event_dedupe_limit: 200,
427
+ all_profile_order_history_limit: 50,
428
+ all_profile_section_timeout_min_ms: 1e3,
429
+ all_profile_account_summary_poll_min_ms: 1e3,
430
+ all_profile_trade_history_poll_min_ms: 1e3,
431
+ all_profile_live_refresh_idle_timeout_ms: 5e3,
432
+ copy_trading_message_limit: 25,
433
+ browser_account_refresh_min_interval_ms: 1250,
434
+ browser_account_watchdog_poll_min_ms: 1e4,
435
+ rate_limit_retry_buffer_ms: 250,
436
+ restricted_runtime_poll_min_ms: 3e3,
437
+ restricted_runtime_event_limit: 20,
438
+ server_account_rest_catchup_min_interval_ms: 5e3,
439
+ server_account_catchup_poll_min_ms: 5e3,
440
+ execution_rest_catchup_delay_ms_steps: [
441
+ 2e3,
442
+ 8e3
443
+ ],
444
+ unified_bootstrap_hold_min_ms: 4e3,
445
+ unified_bootstrap_hold_max_ms: 8e3,
446
+ observed_activity_recent_ms: 8e3,
447
+ startup_hold_activation_gap_ms: 9e4,
448
+ hidden_ticker_update_interval_ms: 16,
449
+ client_close_fill_sync_attempts: 3,
450
+ client_close_fill_sync_retry_step_ms: 300,
451
+ leverage_update_debounce_ms: 250,
452
+ post_leverage_update_order_delay_ms: 250,
453
+ ai_control_lookback_fallback_candles: 25,
454
+ takeover_telemetry_error_chars: 500,
455
+ takeover_telemetry_error_name_chars: 120,
456
+ takeover_telemetry_failure_chars: 300,
457
+ client_next_run_interval_min_ms: 1e3,
458
+ ws_server_time_reorder_tolerance_ms: 1e3
459
+ },
460
+ trade_account_summary: {
461
+ unified_min_balances_usd: 25,
462
+ unified_balances_account_value_multiple: 3,
463
+ unified_spot_ratio_percent: 50
464
+ },
465
+ trade_debug_logs: {
466
+ text_chars: 180,
467
+ runtime_identity_tail_chars: 18,
468
+ run_id_chars: 8,
469
+ control_step_error_chars: 160,
470
+ control_note_chars: 120,
471
+ error_detail_chars: 120,
472
+ click_target_text_chars: 120,
473
+ ai_log_text_chars: 120,
474
+ preferences_error_chars: 160,
475
+ ssr_error_detail_chars: 160,
476
+ breadcrumb_payload_chars: 500,
477
+ render_debug_data_chars: 1200,
478
+ server_execution_value_chars: 700,
479
+ server_execution_error_chars: 250,
480
+ cost_trace_execution_debug_chars: 500,
481
+ positions_fetch_error_chars: 220,
482
+ ai_debug_lines: 100,
483
+ ai_model_status_lines: 100,
484
+ ai_model_status_shown_lines: 80,
485
+ ai_status_bar_trace_lines: 200,
486
+ ai_status_bar_trace_shown_lines: 120,
487
+ ai_status_bar_transition_lines: 200,
488
+ ai_status_bar_transition_shown_lines: 120,
489
+ ai_status_role_compare_lines: 240,
490
+ ai_status_role_compare_shown_lines: 160,
491
+ ai_status_bar_input_lines: 200,
492
+ ai_status_bar_input_shown_lines: 120,
493
+ ai_engine_transition_lines: 200,
494
+ ai_engine_transition_shown_lines: 120,
495
+ ai_panel_cost_lines: 120,
496
+ ai_panel_cost_shown_lines: 80,
497
+ ai_runtime_error_label_lines: 100,
498
+ ai_runtime_error_label_shown_lines: 80,
499
+ loop_status_mutation_lines: 200,
500
+ loop_status_mutation_shown_lines: 120,
501
+ login_recovery_trace_lines: 240,
502
+ sparkle_ownership_lines: 120,
503
+ ai_trader_start_lines: 100,
504
+ ai_trader_restart_trace_lines: 120,
505
+ ai_control_button_trace_lines: 240,
506
+ profile_status_hydration_lines: 120,
507
+ profile_status_hydration_shown_lines: 100,
508
+ cross_profile_runtime_lines: 120,
509
+ cross_profile_runtime_shown_lines: 80,
510
+ all_mode_ai_history_lines: 120,
511
+ positions_pnl_lines: 240,
512
+ positions_pnl_shown_lines: 200,
513
+ positions_pnl_changed_rows: 12,
514
+ account_state_lines: 80,
515
+ account_state_shown_lines: 200,
516
+ symbol_hydration_lines: 120,
517
+ trade_ui_click_lines: 200,
518
+ manual_close_lines: 80,
519
+ all_mode_interaction_lines: 160,
520
+ chart_render_entries: 80,
521
+ control_state_lines: 80,
522
+ runtime_network_lines: 80,
523
+ provider_fallback_trace_lines: 60,
524
+ runtime_stop_trace_lines: 80,
525
+ runtime_stop_breadcrumb_lines: 40,
526
+ prompt_contract_trace_lines: 80,
527
+ execution_trace_lines: 120,
528
+ single_history_trace_lines: 40,
529
+ ignored_ticker_channels: 8,
530
+ recent_network_targets: 8,
531
+ provider_failure_blocks: 6,
532
+ market_data_failure_blocks: 8,
533
+ pricing_candidates_shown: 10,
534
+ balance_delta_coins: 3,
535
+ all_mode_ai_head_messages: 5,
536
+ server_execution_decisions: 10,
537
+ server_decisions_shown: 5,
538
+ server_execution_refresh_ms: 1e4,
539
+ interaction_sample_delay_ms: 250,
540
+ local_breadcrumb_refresh_ms: 1e3,
541
+ flicker_direction_flip_window_ms: 6e3,
542
+ flicker_warmup_window_ms: 3e4,
543
+ upnl_double_count_min_cents: 50,
544
+ upnl_double_count_tolerance_cents: 5,
545
+ upnl_source_gap_min_cents: 50,
546
+ nonzero_upnl_jump_min_cents: 25,
547
+ nonzero_upnl_jump_min_relative_percent: 50,
548
+ nonzero_upnl_jump_min_margin_percent: 2,
549
+ cross_source_upnl_flicker_max_age_ms: 1e3,
550
+ cross_source_upnl_flicker_min_cents: 5,
551
+ restart_trace_manual_stop_window_minutes: 15,
552
+ hold_age_rounding_ms: 100,
553
+ account_summary_missing_trace_ms: 5e3
554
+ },
555
+ insights_access: {
556
+ initial_prompt_idea_count: 6,
557
+ section_preview_blocks: 2
558
+ },
559
+ marketing: {
560
+ arena_leaderboard_entries: 3,
561
+ data_revalidate_seconds: 60
562
+ },
563
+ calendar: {
564
+ event_highlight_window_minutes: 60,
565
+ search_save_debounce_ms: 250
566
+ },
567
+ system_page: {
568
+ hyperliquid_manual_refresh_cooldown_ms: 800,
569
+ config_retry_initial_delay_ms: 1e3,
570
+ debug_api_profile_poll_ms: 500,
571
+ debug_save_lines: 120,
572
+ debug_model_sync_lines: 80,
573
+ debug_byok_trace_lines: 160,
574
+ debug_profile_delete_trace_lines: 80,
575
+ debug_local_ai_trace_lines: 120,
576
+ debug_hyperliquid_trace_lines: 120,
577
+ debug_oac_trace_lines: 120,
578
+ debug_oac_applied_state_lines: 40,
579
+ debug_report_trace_lines: 40,
580
+ debug_report_trace_line_chars: 360,
581
+ debug_field_value_chars: 96,
582
+ debug_identity_redact_max_chars: 8,
583
+ debug_identity_edge_chars: 4
584
+ },
585
+ analysis_page: {
586
+ debug_log_lines: 120
587
+ },
588
+ changelog_page: {
589
+ profile_search_debounce_ms: 300,
590
+ search_debounce_ms: 300,
591
+ scope_navigation_filters_max_age_ms: 3e4,
592
+ prompt_diff_context_lines: 3,
593
+ debug_event_lines: 120
594
+ },
595
+ help_page: {
596
+ hash_scroll_settle_ms: 250
597
+ },
598
+ history_page: {
599
+ preferences_save_debounce_ms: 500,
600
+ tracked_ws_prompt_id_count: 500,
601
+ ws_prompt_fingerprint_text_chars: 80,
602
+ load_more_visibility_percent: 10
603
+ },
604
+ leaderboard_page: {
605
+ debug_panel_entries: 80,
606
+ debug_navbar_profile_entries: 12
607
+ },
608
+ login_page: {
609
+ desktop_bridge_poll_ms: 250,
610
+ turnstile_site_key_log_chars: 10
611
+ },
612
+ screener_page: {
613
+ search_save_debounce_ms: 250,
614
+ ws_refresh_debounce_ms: 40,
615
+ stop_client_run_wait_checks: 30,
616
+ stop_client_run_wait_poll_ms: 50,
617
+ assignment_load_more_threshold_px: 48,
618
+ debug_log_lines: 160,
619
+ debug_runtime_events: 30,
620
+ debug_search_transitions: 40,
621
+ debug_expansion_transitions: 80,
622
+ debug_value_chars: 260,
623
+ debug_text_chars: 180,
624
+ debug_array_items: 20,
625
+ debug_event_preview_items: 12,
626
+ debug_snapshot_keys: 25,
627
+ debug_snapshot_rows: 8
628
+ },
629
+ sitemap: {
630
+ leaderboard_page_batch_size: 5,
631
+ leaderboard_max_pages: 160,
632
+ leaderboard_scan_attempts: 3,
633
+ home_priority_percent: 100,
634
+ team_priority_percent: 50,
635
+ contact_priority_percent: 50,
636
+ methodology_priority_percent: 80,
637
+ trust_priority_percent: 70,
638
+ insights_priority_percent: 90,
639
+ referrals_priority_percent: 60,
640
+ start_priority_percent: 80,
641
+ leaderboard_priority_percent: 90,
642
+ updates_priority_percent: 80,
643
+ changelog_priority_percent: 70,
644
+ models_priority_percent: 70,
645
+ calendar_priority_percent: 60,
646
+ help_priority_percent: 70,
647
+ faq_priority_percent: 70,
648
+ download_priority_percent: 70,
649
+ privacy_priority_percent: 30,
650
+ terms_priority_percent: 30,
651
+ update_post_priority_percent: 60,
652
+ profile_trade_priority_percent: 70,
653
+ profile_analytics_priority_percent: 70,
654
+ profile_changelog_priority_percent: 60
655
+ },
656
+ tax_page: {
657
+ display_batch_size: 50,
658
+ load_more_delay_ms: 120,
659
+ load_more_visibility_percent: 10,
660
+ selectable_year_count: 5,
661
+ debug_log_lines: 150
662
+ },
663
+ updates_page: {
664
+ post_edited_label_min_gap_ms: 6e4,
665
+ comment_edited_label_min_gap_ms: 2e3,
666
+ meta_description_chars: 160
667
+ },
668
+ social_previews: {
669
+ subject_max_chars: 96,
670
+ viewport_width: 1600,
671
+ viewport_height: 900,
672
+ chart_painted_min_px: 100,
673
+ chart_paint_poll_ms: 200
674
+ },
675
+ manual_order_retry: {
676
+ max_attempts: 2,
677
+ default_retry_after_milliseconds: 1500,
678
+ retry_after_padding_milliseconds: 200,
679
+ min_delay_milliseconds: 500,
680
+ max_delay_milliseconds: 8e3
681
+ },
682
+ api_client: {
683
+ get_dedupe_ttl_ms: 2e3,
684
+ runtime_statuses_dedupe_ttl_ms: 5e3,
685
+ llm_config_prime_ttl_ms: 1e4,
686
+ leaderboard_dedupe_ttl_ms: 2e3,
687
+ platform_pricing_revalidate_seconds: 300,
688
+ platform_pricing_timeout_ms: 2e3,
689
+ market_data_error_detail_chars: 240,
690
+ market_data_interest_error_detail_chars: 200,
691
+ ai_trade_history_order_id_lookup_concurrency: 4,
692
+ exchange_evidence_rejection_detail_chars: 200
693
+ },
694
+ interaction: {
695
+ debounce_ms: 250,
696
+ command_list_scroll_settle_ms: 60
697
+ },
698
+ model_selection: {
699
+ local_context_cache_ttl_hours: 12,
700
+ pending_local_main_selection_ttl_hours: 12,
701
+ pending_openai_compatible_main_selection_ttl_hours: 12
702
+ }
703
+ },
704
+ ai_dashboard: {
705
+ market_news_bounds: {
706
+ max_items_min: 1,
707
+ max_items_max: 100,
708
+ lookback_hours_min: 1,
709
+ lookback_hours_max: 168,
710
+ max_items_steps: [
711
+ 1,
712
+ 2,
713
+ 3,
714
+ 4,
715
+ 5,
716
+ 6,
717
+ 7,
718
+ 8,
719
+ 9,
720
+ 10,
721
+ 15,
722
+ 20,
723
+ 25,
724
+ 30,
725
+ 40,
726
+ 50,
727
+ 60,
728
+ 75,
729
+ 90,
730
+ 100
731
+ ],
732
+ lookback_hours_steps: [
733
+ 1,
734
+ 2,
735
+ 4,
736
+ 8,
737
+ 12,
738
+ 24,
739
+ 48,
740
+ 72,
741
+ 168
742
+ ]
743
+ },
744
+ defaults: {
745
+ calendar_settings: {
746
+ pre_buffer_mins: 60,
747
+ post_buffer_mins: 30
748
+ },
749
+ max_chat_turns: 9999
750
+ }
751
+ },
752
+ trading: {
753
+ engine: {
754
+ client_runtime: {
755
+ reconcile: {
756
+ tick_interval_seconds: 30,
757
+ wake_jitter_max_ms: 1e3,
758
+ network_backoff_max_seconds: 300,
759
+ steal_ack_timeout_ms: 5e3,
760
+ explicit_claim_max_waits: 3,
761
+ local_ai_preflight_timeout_ms: 3e3,
762
+ wake_debounce_ms: 250,
763
+ claim_settle_poll_ms: 50,
764
+ network_backoff_exponent_max: 16
765
+ },
766
+ observability: {
767
+ deployment_reload_stall_warning_ms: 15e3,
768
+ prompt_parity_error_detail_max_chars: 500
769
+ },
770
+ protective_actions: {
771
+ adoption_request_timeout_milliseconds: 2e4,
772
+ idle_recheck_seconds: 60,
773
+ attention_refresh_seconds: 60,
774
+ evidence_max_items: 32,
775
+ evidence_shared_read_seconds: 10,
776
+ retry_delay_seconds: 15,
777
+ evidence_min_sweep_delay_milliseconds: 1e3,
778
+ device_sweep_max_actions: 8,
779
+ remaining_recheck_milliseconds: 2e3,
780
+ evidence_max_age_seconds: 45
781
+ },
782
+ exchange_mutation: {
783
+ settlement_retry_milliseconds: 1e3,
784
+ settlement_retry_window_seconds: 120,
785
+ reconciliation_margin_milliseconds: 250
786
+ },
787
+ protective_plan_set_lock: {
788
+ wait_seconds: 120
789
+ },
790
+ execution_mutation_queue: {
791
+ wait_seconds: 120,
792
+ trade_submit_deadline_seconds: 360
793
+ },
794
+ history_evidence: {
795
+ device_rounds_per_beat: 6,
796
+ device_retry_seconds: 60
797
+ },
798
+ panel_reads: {
799
+ device_open_orders_reuse_seconds: 2,
800
+ all_view_profile_concurrency: 2
801
+ },
802
+ account_stream: {
803
+ fill_forward_interval_ms: 1e3,
804
+ fill_forward_max_pending: 500
805
+ },
806
+ hyperliquid_snapshot: {
807
+ max_fills_per_execution: 20,
808
+ max_fill_payload_bytes: 32768
809
+ },
810
+ loop_early_return_retry_milliseconds: 5e3,
811
+ window_handoff_cleanup_retry_milliseconds: 1e3,
812
+ ai_schedule_pause_min_milliseconds: 1e3,
813
+ ai_schedule_pause_max_milliseconds: 36e5,
814
+ ai_schedule_pause_unknown_milliseconds: 6e4,
815
+ provider_failure_diagnostics_delay_milliseconds: 2500,
816
+ provider_failure_diagnostics_max_age_milliseconds: 3e4,
817
+ killswitch_timer_floor_milliseconds: 1e3,
818
+ cycle_timeout_floor_milliseconds: 1e3,
819
+ decision_settlement_reserve_max_budget_divisor: 2,
820
+ close_fill_sync_max_attempts: 3,
821
+ close_fill_sync_retry_step_milliseconds: 300,
822
+ execution_mode_mismatch_stop_checks: 2,
823
+ request_bounds: {
824
+ min_agent_instruction_retry_after_ms: 25,
825
+ max_fallback_error_length: 500
826
+ },
827
+ pending_protection_recovery: {
828
+ retry_exponent_max: 30
829
+ },
830
+ device_diagnostics: {
831
+ error_cause_max_depth: 4,
832
+ request_path_chars: 200,
833
+ request_method_chars: 12,
834
+ error_kind_chars: 40,
835
+ request_id_chars: 128,
836
+ contract_token_prefix_chars: 12,
837
+ copy_trading_request_id_chars: 80,
838
+ copy_trading_status_chars: 80,
839
+ browser_platform_chars: 40,
840
+ breadcrumbs_max_entries: 40,
841
+ breadcrumb_detail_chars: 280,
842
+ network_debug_max_entries: 80,
843
+ provider_failure_debug_max_entries: 20,
844
+ market_data_failure_debug_max_entries: 20,
845
+ request_string_compact_above_chars: 500,
846
+ prompt_preview_chars: 220,
847
+ provider_failure_snapshot_max_age_seconds: 300,
848
+ local_provider_probe_timeout_ms: 2e3,
849
+ preflight_failure_reason_chars: 200,
850
+ host_error_note_chars: 160,
851
+ tick_failure_note_chars: 300,
852
+ auto_resume_failure_detail_chars: 500,
853
+ vault_migration_error_chars: 200
854
+ },
855
+ request_retry: {
856
+ max_attempts: 3,
857
+ base_delay_milliseconds: 300,
858
+ max_delay_milliseconds: 8e3,
859
+ min_retry_after_milliseconds: 250,
860
+ deadline_attempt_spacing_milliseconds: 250
861
+ }
862
+ },
863
+ server_runtime: {
864
+ exchange_mutation_reconciliation: {
865
+ protective_episode_end_fill_lookback_seconds: 120
866
+ },
867
+ prompt_rescue: {
868
+ request_ttl_seconds: 20,
869
+ snapshot_max_age_seconds: 5,
870
+ snapshot_component_max_skew_seconds: 2,
871
+ client_claim_http_timeout_milliseconds: 5e3,
872
+ client_claim_retry_delay_milliseconds: 1e3,
873
+ client_failure_report_timeout_milliseconds: 2e3,
874
+ client_presence_heartbeat_interval_milliseconds: 3e4,
875
+ client_presence_http_timeout_milliseconds: 5e3,
876
+ client_claim_completion_buffer_milliseconds: 250,
877
+ client_max_concurrent_jobs_max: 32,
878
+ diagnostics_max_elapsed_ms: 12e4,
879
+ diagnostics_max_pending_reads: 1e3,
880
+ diagnostics_max_clock_offset_ms: 864e5,
881
+ failure_max_reported_weight: 1e6,
882
+ failure_max_retry_after_ms: 36e5
883
+ }
884
+ }
885
+ },
886
+ history_reads: {
887
+ max_requests_per_read: 64,
888
+ history_start_ms: 16409952e5,
889
+ device_read_deadline_seconds: 180,
890
+ device_recent_window_hours: 24,
891
+ order_history_default_limit: 2e3,
892
+ order_history_max_limit: 2e3
893
+ },
894
+ tradability: {
895
+ score_min: 1,
896
+ score_max: 10
897
+ }
898
+ },
899
+ agent_cli: {
900
+ update_check_interval_ms: 144e5,
901
+ update_check_timeout_ms: 5e3,
902
+ stage_timeout_ms: 6e5,
903
+ startup_ready_timeout_ms: 12e4,
904
+ headless_claim_max_waits: 10,
905
+ headless_stop_request_timeout_ms: 1e4,
906
+ headless_max_resumes_without_a_cycle: 5,
907
+ headless_resume_backoff_ms_steps: [
908
+ 1e3,
909
+ 5e3,
910
+ 15e3,
911
+ 3e4,
912
+ 6e4
913
+ ],
914
+ headless_backup_first_read_retry_ms_steps: [
915
+ 1e3,
916
+ 5e3
917
+ ],
918
+ browser_login_verifier_bytes: 32,
919
+ update_failure_reason_max_chars: 160,
920
+ update_directory_failure_reason_max_chars: 120,
921
+ update_plan_max_attempts: 3,
922
+ supervisor_max_failed_release_starts: 2
923
+ },
924
+ leaderboard: {
925
+ device_portfolio: {
926
+ device_retry_seconds: 300
927
+ },
928
+ max_page_size: 100
929
+ },
930
+ external_inference: {
931
+ service: {
932
+ update_check_interval_ms: 3e5,
933
+ update_registry_timeout_ms: 15e3,
934
+ bootstrap_readiness_timeout_ms: 6e5,
935
+ bootstrap_stop_timeout_ms: 1e4,
936
+ startup_max_attempts: 40,
937
+ startup_poll_interval_ms: 250,
938
+ restart_stable_uptime_ms: 6e4,
939
+ restart_backoff_base_ms: 1e3,
940
+ restart_backoff_max_ms: 3e4,
941
+ restart_exponent_max: 5,
942
+ cooperative_stop_timeout_ms: 75e3,
943
+ update_readiness_timeout_ms: 6e5,
944
+ rollback_confirmation_min_attempts: 100,
945
+ ready_consecutive_observations: 2,
946
+ update_attempts: 3,
947
+ update_retry_interval_ms: 2e3,
948
+ update_failure_reason_max_chars: 160,
949
+ launcher_poll_interval_ms: 100,
950
+ log_tail_default_lines: 100,
951
+ worker_output_line_max_chars: 4096,
952
+ worker_stdout_tail_max_chars: 65536,
953
+ control_lock_wait_attempts: 400,
954
+ control_lock_retry_interval_ms: 250,
955
+ supervisor_manifest_poll_interval_ms: 250,
956
+ worker_readiness_settle_ms: 500
957
+ },
958
+ claim_diagnostics: {
959
+ event_loop_sample_interval_ms: 100
960
+ },
961
+ host_core: {
962
+ oauth_request_timeout_ms: 15e3,
963
+ oauth_revocation_timeout_ms: 5e3,
964
+ oauth_login_timeout_ms: 6e5,
965
+ mcp_request_timeout_ms: 15e3,
966
+ mcp_retry_after_max_ms: 864e5,
967
+ credential_command_timeout_ms: 15e3,
968
+ credential_command_termination_timeout_ms: 5e3,
969
+ credential_command_output_max_bytes: 1048576,
970
+ private_file_max_bytes: 16777216,
971
+ private_file_replace_attempts: 40,
972
+ private_file_replace_retry_delay_ms: 25,
973
+ atomic_replacement_read_attempts: 3,
974
+ owned_directory_removal_attempts: 10,
975
+ owned_directory_removal_retry_step_ms: 100,
976
+ identity_command_timeout_ms: 5e3,
977
+ identity_command_output_max_bytes: 4096,
978
+ windows_identity_command_timeout_ms: 15e3,
979
+ windows_process_identity_output_max_bytes: 1024,
980
+ windows_acl_broker_startup_timeout_ms: 9e4,
981
+ windows_acl_broker_request_timeout_ms: 15e3,
982
+ windows_acl_broker_idle_shutdown_ms: 3e4,
983
+ windows_acl_broker_kill_grace_ms: 1e3,
984
+ windows_acl_broker_request_max_bytes: 65536,
985
+ windows_acl_broker_output_max_chars: 65536,
986
+ windows_acl_broker_response_line_max_chars: 4096,
987
+ process_lock_publication_grace_ms: 1e4,
988
+ process_lock_record_max_bytes: 65536,
989
+ process_lock_guard_election_lease_ms: 5e3,
990
+ process_lock_guard_election_stale_ms: 3e4,
991
+ process_lock_guard_election_attempts: 8,
992
+ process_lock_guard_election_backoff_ms: 10,
993
+ process_lock_guard_election_backoff_exponent_max: 4,
994
+ process_lock_identity_cache_ms: 5e3
995
+ },
996
+ agent_control: {
997
+ max_turn_decision_operation_ids: 128
998
+ },
999
+ host_runtime: {
1000
+ advertisement_ttl_ms: 12e4,
1001
+ advertisement_refresh_lead_ms: 3e4,
1002
+ host_heartbeat_interval_ms: 3e3,
1003
+ attempt_heartbeat_interval_ms: 3e3,
1004
+ agent_heartbeat_interval_ms: 3e3,
1005
+ agent_heartbeat_max_retry_delay_ms: 9e3,
1006
+ provider_rate_limit_refresh_ms: 6e4,
1007
+ provider_quota_recovery_max_age_refresh_intervals: 2,
1008
+ model_catalog_read_lead_divisor: 2,
1009
+ agent_wake_summary_max_chars: 2e3,
1010
+ drain_timeout_ms: 3e4,
1011
+ remote_retry_limit: 3,
1012
+ minimum_sleep_ms: 10,
1013
+ heartbeat_gap_diagnostic_min_ms: 1e4,
1014
+ heartbeat_gap_diagnostic_factor: 3,
1015
+ agent_auth_cooldown_ms: 3e5,
1016
+ agent_rate_limit_cooldown_ms: 6e4,
1017
+ agent_transient_cooldown_ms: 5e3,
1018
+ claim_start_window_min_ms: 5e3,
1019
+ attempt_start_retry_delay_max_ms: 15e3,
1020
+ claim_dispatch_batch_size: 16,
1021
+ codex_quota_cooldown_max_ms: 6912e5,
1022
+ attempt_start_retry_base_ms: 1e3,
1023
+ attempt_start_retry_exponent_max: 4,
1024
+ remote_retry_backoff_step_ms: 250,
1025
+ remote_retry_backoff_max_ms: 1e3,
1026
+ remote_retry_fallback_ms: 1e3,
1027
+ access_token_refresh_lead_ms: 5e3,
1028
+ rate_limit_read_timeout_max_ms: 2e3,
1029
+ agent_idle_retry_ms: 1e3,
1030
+ agent_idle_poll_ms: 5e3,
1031
+ agent_turn_timeout_ms: 6e5,
1032
+ codex_rate_limit_metadata_timeout_ms: 5e3,
1033
+ codex_login_timeout_ms: 9e5,
1034
+ codex_command_timeout_ms: 3e4,
1035
+ cli_wait_default_seconds: 50,
1036
+ cli_wait_max_seconds: 300,
1037
+ cli_log_lines_default: 100,
1038
+ cli_log_lines_max: 1e4,
1039
+ service_control_input_max_chars: 4096,
1040
+ codex_auth_file_max_bytes: 8388608,
1041
+ agent_stdin_max_bytes: 1e6,
1042
+ agent_next_poll_min_ms: 50,
1043
+ agent_assignment_poll_min_ms: 250,
1044
+ agent_assignment_poll_fallback_ms: 1e3,
1045
+ agent_assignment_poll_max_ms: 5e3,
1046
+ codex_recovery_scan_max_entries: 2e4,
1047
+ codex_recovery_scan_max_depth: 12,
1048
+ codex_recovery_thread_file_max_bytes: 33554432,
1049
+ codex_recovery_thread_scan_lines: 128,
1050
+ codex_quiescence_proof_max_age_ms: 3e4,
1051
+ codex_quiescence_proof_clock_skew_ms: 1e3,
1052
+ codex_guardian_start_timeout_ms: 1e4,
1053
+ codex_guardian_termination_timeout_ms: 5e3,
1054
+ codex_guardian_termination_deadline_min_ms: 25,
1055
+ codex_guardian_state_poll_ms: 25,
1056
+ codex_guardian_shutdown_grace_ms: 2e3,
1057
+ codex_guardian_shutdown_grace_min_ms: 25,
1058
+ codex_guardian_receipt_replace_attempts: 40,
1059
+ codex_guardian_receipt_replace_retry_ms: 25,
1060
+ codex_diagnostic_attempt_ids_max: 64,
1061
+ codex_retired_response_ids_max: 256,
1062
+ codex_stderr_classification_tail_chars: 1024,
1063
+ codex_request_timeout_ms: 3e4,
1064
+ codex_interrupt_timeout_ms: 5e3,
1065
+ codex_login_cancel_timeout_ms: 5e3,
1066
+ codex_close_exit_timeout_ms: 5e3,
1067
+ codex_close_terminate_timeout_ms: 1e3,
1068
+ codex_close_kill_timeout_ms: 1e3,
1069
+ codex_process_tree_cleanup_timeout_ms: 5e3,
1070
+ binary_version_probe_timeout_ms: 1e4,
1071
+ binary_version_probe_stdout_max_chars: 1024,
1072
+ codex_version_probe_stderr_max_bytes: 65536,
1073
+ codex_recovery_process_observations: 2,
1074
+ codex_recovery_process_observation_interval_ms: 250,
1075
+ codex_recovery_process_query_stdout_max_chars: 4e6,
1076
+ codex_recovery_process_query_stderr_max_chars: 4096,
1077
+ deepseek_transport_request_max_bytes: 8388608,
1078
+ exo_command_output_max_bytes: 4e6,
1079
+ exo_git_output_max_chars: 2e5,
1080
+ exo_bridge_request_max_bytes: 2e6,
1081
+ exo_bridge_request_timeout_ms: 3e4,
1082
+ exo_provider_retry_after_max_ms: 864e5,
1083
+ grok_preflight_timeout_ms: 3e4,
1084
+ grok_login_timeout_ms: 9e5,
1085
+ grok_command_timeout_ms: 3e4,
1086
+ grok_auth_output_max_bytes: 65536,
1087
+ grok_binary_max_bytes: 536870912,
1088
+ grok_acp_message_max_bytes: 2e6,
1089
+ grok_close_kill_delay_ms: 1500,
1090
+ grok_mcp_request_max_bytes: 3e5,
1091
+ grok_cwd_marker_max_bytes: 32768,
1092
+ grok_session_summary_max_bytes: 1048576,
1093
+ provider_error_body_timeout_ms: 1e3,
1094
+ provider_error_body_max_bytes: 16384,
1095
+ pi_receipt_event_max_chars: 2e6
1096
+ },
1097
+ quota_membership_cooldown_seconds: 300,
1098
+ transient_membership_cooldown_seconds: 30,
1099
+ runtime_poll_interval_milliseconds: 250
1100
+ },
1101
+ desktop: {
1102
+ runtime_watchdog: {
1103
+ ping_interval_milliseconds: 15e3,
1104
+ telemetry_interval_milliseconds: 3e5
1105
+ },
1106
+ updates: {
1107
+ auto_check_interval_seconds: 21600
1108
+ }
1109
+ },
1110
+ screener: {
1111
+ resource_scheduler: {
1112
+ client_lock_ttl_milliseconds: 12e4,
1113
+ client_poll_interval_milliseconds: 250
1114
+ },
1115
+ ui_bounds: {
1116
+ screener_min_volume_usd_max: 1e9
1117
+ },
1118
+ runtime: {
1119
+ assignment_page_default_limit: 20,
1120
+ client_candidate_owner_lease_grace_ms: 6e4,
1121
+ client_server_heartbeats_per_owner_lease: 2,
1122
+ client_server_heartbeat_min_ms: 5e3,
1123
+ client_server_heartbeat_max_ms: 3e4
1124
+ },
1125
+ defaults: {
1126
+ adaptive_schedule_enabled: true
1127
+ }
1128
+ },
1129
+ deployment: {
1130
+ cutover_buffer: {
1131
+ target_timeout_ms: 3e3,
1132
+ retired_timeout_ms: 45e3,
1133
+ max_body_bytes: 33554432,
1134
+ max_inflight: 16,
1135
+ max_queue: 64
1136
+ }
1137
+ },
1138
+ exchange: {
1139
+ hyperliquid: {
1140
+ client_public_read_budget: {
1141
+ max_weight: 1200,
1142
+ window_seconds: 60,
1143
+ ui_max_weight_percent: 75,
1144
+ background_max_weight_percent: 50,
1145
+ cooldown_seconds: 60,
1146
+ metadata_ttl_seconds: 300,
1147
+ user_fees_ttl_seconds: 300,
1148
+ account_mode_ttl_seconds: 30,
1149
+ default_request_weight: 20,
1150
+ cache_max_entries: 512
1151
+ },
1152
+ read_budget: {
1153
+ weights: {
1154
+ exchange: 1,
1155
+ exchangeStatus: 2,
1156
+ clearinghouseState: 2,
1157
+ spotClearinghouseState: 2,
1158
+ l2Book: 2,
1159
+ allMids: 2,
1160
+ userFills: 120,
1161
+ userFillsByTime: 120,
1162
+ historicalOrders: 120,
1163
+ twapHistory: 120,
1164
+ userTwapSliceFills: 120,
1165
+ userFunding: 45,
1166
+ userNonFundingLedgerUpdates: 45,
1167
+ candleSnapshot: 104,
1168
+ userRole: 60,
1169
+ userAbstraction: 20,
1170
+ userDexAbstraction: 20,
1171
+ activeAssetData: 20,
1172
+ openOrders: 20,
1173
+ orderStatus: 2,
1174
+ portfolio: 20,
1175
+ userFees: 20,
1176
+ metaAndAssetCtxs: 20,
1177
+ meta: 20,
1178
+ perpDexs: 20,
1179
+ spotMeta: 20,
1180
+ approvedAgents: 20,
1181
+ authorizedAgents: 20,
1182
+ agents: 20,
1183
+ apiWallets: 20
1184
+ },
1185
+ exchange_action_batch_size: 40
1186
+ },
1187
+ public_recovery: {
1188
+ fallback_initial_seconds: 2,
1189
+ fallback_max_seconds: 60,
1190
+ permit_lease_seconds: 60,
1191
+ recovery_initial_concurrency: 1,
1192
+ recovery_max_concurrency: 8,
1193
+ recovery_successes_per_step: 4,
1194
+ recovery_min_spacing_ms: 100,
1195
+ queue_poll_ms: 50,
1196
+ recovery_queue_wait_seconds: 10,
1197
+ recovery_quiet_seconds: 30
1198
+ },
1199
+ http: {
1200
+ exchange: {
1201
+ request_timeout_seconds: 10,
1202
+ pool_timeout_seconds: 10
1203
+ },
1204
+ public_critical: {
1205
+ request_timeout_seconds: 10,
1206
+ pool_timeout_seconds: 5
1207
+ }
1208
+ },
1209
+ public_request_priority: {
1210
+ trading_reduce: 1,
1211
+ trading_reconcile: 2,
1212
+ trading_execute: 3,
1213
+ trading_analysis: 4,
1214
+ ui: 5,
1215
+ background: 6
1216
+ },
1217
+ account_stream_backoff: {
1218
+ initial_seconds: 1,
1219
+ max_seconds: 15,
1220
+ multiplier: 2,
1221
+ jitter_seconds: 2,
1222
+ reset_after_seconds: 60
1223
+ },
1224
+ websocket: {
1225
+ ping_interval_seconds: 20,
1226
+ account_open_timeout_seconds: 10
1227
+ }
1228
+ },
1229
+ cache: {
1230
+ order_history_ttl_seconds: 30,
1231
+ twap_history_ttl_seconds: 30,
1232
+ twap_fills_ttl_seconds: 30,
1233
+ funding_history_ttl_seconds: 300
1234
+ }
1235
+ },
1236
+ data_sync: {
1237
+ trade_chain_history: {
1238
+ range_page_limit: 500
1239
+ }
1240
+ },
1241
+ external_news: {
1242
+ benzinga: {
1243
+ enabled: false
1244
+ }
1245
+ },
1246
+ market_data: {
1247
+ chart_interest: {
1248
+ historical_backfill_candle_limit: 1e3,
1249
+ heartbeat_retry_seconds: 15,
1250
+ heartbeat_min_delay_ms: 1e3,
1251
+ catch_up_candle_limit: 300
1252
+ }
1253
+ },
1254
+ auth: {
1255
+ tokens: {
1256
+ email_2fa_code_length: 6,
1257
+ totp_code_length: 6
1258
+ },
1259
+ passwords: {
1260
+ min_length: 12
1261
+ }
1262
+ },
1263
+ android: {
1264
+ app_host: {
1265
+ profiles_refresh_interval_seconds: 60,
1266
+ running_report_interval_seconds: 5,
1267
+ page_identity_retry_seconds: 5,
1268
+ profiles_read_timeout_seconds: 30
1269
+ }
1270
+ },
1271
+ websocket: {
1272
+ client_connection: {
1273
+ reconnect_delay_ms: 3e3,
1274
+ ping_interval_ms: 3e4,
1275
+ message_flush_interval_ms: 16,
1276
+ price_change_highlight_ms: 1e3,
1277
+ debug_recent_channel_limit: 24
1278
+ }
1279
+ },
1280
+ notifications: {
1281
+ desktop: {
1282
+ heartbeat_seconds: 20
1283
+ },
1284
+ telegram: {
1285
+ connect_link_poll_ms: 3e3
1286
+ }
1287
+ },
1288
+ validation: {
1289
+ profile_handles: {
1290
+ min_length: 3,
1291
+ max_length: 20,
1292
+ update_confirmation_ms: 3e3
1293
+ }
1294
+ },
1295
+ profiles: {
1296
+ limits: {
1297
+ handle_changes_per_window: 2,
1298
+ handle_change_window_days: 14
1299
+ }
1300
+ },
1301
+ copy_trading: {
1302
+ source_search: {
1303
+ min_query_length: 2
1304
+ },
1305
+ runtime: {
1306
+ client_account_mode_cache_budget_divisor: 2
1307
+ }
1308
+ },
1309
+ billing: {
1310
+ credit_purchase: {
1311
+ amount_usd_steps: [
1312
+ 10,
1313
+ 25,
1314
+ 50,
1315
+ 100,
1316
+ 500,
1317
+ 1e3
1318
+ ]
1319
+ }
1320
+ },
1321
+ admin: {
1322
+ page: {
1323
+ credit_grant_amount_usd_steps: [
1324
+ 10,
1325
+ 25,
1326
+ 50,
1327
+ 100,
1328
+ 500,
1329
+ 1e3,
1330
+ 5e3,
1331
+ 1e4,
1332
+ 5e4,
1333
+ 1e5
1334
+ ],
1335
+ user_lookup_blur_close_delay_ms: 200,
1336
+ selected_user_refresh_delay_ms: 300,
1337
+ handle_preview_count: 3
1338
+ },
1339
+ models: {
1340
+ analytics: {
1341
+ summary_failure_kinds: 3
1342
+ }
1343
+ },
1344
+ user_search: {
1345
+ min_query_length: 2
1346
+ }
1347
+ },
1348
+ profile_setting_changelog: {
1349
+ public_profile_search_limit: 10,
1350
+ page_default_limit: 50
1351
+ },
1352
+ history: {
1353
+ full_history_default_limit: 20,
1354
+ default_page_size: 50,
1355
+ trade_lookup_max_order_ids: 200,
1356
+ decision_batch_default_limit: 50
1357
+ },
1358
+ updates: {
1359
+ posts: {
1360
+ list_default_limit: 20,
1361
+ list_max_limit: 100
1362
+ }
1363
+ },
1364
+ security: {
1365
+ byok: {
1366
+ max_provider_keys_per_provider: 5
1367
+ }
1368
+ },
1369
+ analysis: {
1370
+ live_request_candles: {
1371
+ default_limit: 100
1372
+ }
1373
+ },
1374
+ users: {
1375
+ search: {
1376
+ min_query_length: 2
1377
+ }
1378
+ },
1379
+ referrals: {
1380
+ code_max_length: 24,
1381
+ dashboard_default_limit: 20
1382
+ },
1383
+ insights: {
1384
+ client_host: {
1385
+ device_read_default_result_bytes: 2e5
1386
+ }
1387
+ },
1388
+ agent_tokens: {
1389
+ browser_login_ttl_seconds: 600,
1390
+ browser_login_poll_interval_seconds: 2
1391
+ }
36
1392
  };
37
1393
 
38
- const record = (value: unknown): Json => value !== null && typeof value === 'object' && !Array.isArray(value) ? value as Json : {};
39
- const validModel = (value: unknown): value is string => typeof value === 'string' && Boolean(value.trim())
40
- && value.length <= 256 && !/[\u0000-\u001f\u007f]/u.test(value);
41
- const count = (value: unknown): number => {
42
- if (!Number.isSafeInteger(value) || Number(value) < 0) throw new Error('exo_usage_invalid');
1394
+ // lib/inference-host/exo-harness.ts
1395
+ var HOST_RUNTIME_POLICY = runtime_policy_generated_default.external_inference.host_runtime;
1396
+ var record = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
1397
+ var validModel = (value) => typeof value === "string" && Boolean(value.trim()) && value.length <= INFERENCE_HOST_MODEL_ID_MAX_CHARS && !/[\u0000-\u001f\u007f]/u.test(value);
1398
+ var count = (value) => {
1399
+ if (!Number.isSafeInteger(value) || Number(value) < 0) throw new Error("exo_usage_invalid");
43
1400
  return Number(value);
44
1401
  };
45
- const rateLimitCode = async (response: Response): Promise<string> => {
46
- if (!response.body) return 'exo_rate_limited';
1402
+ var rateLimitCode = async (response) => {
1403
+ if (!response.body) return "exo_rate_limited";
47
1404
  const reader = response.body.getReader();
48
- const chunks: Uint8Array[] = [];
1405
+ const chunks = [];
49
1406
  let bytes = 0;
50
- let timer: ReturnType<typeof setTimeout> | undefined;
51
- const timeout = new Promise<never>((_resolve, reject) => { timer = setTimeout(() => reject(new Error('exo_error_body_timeout')), 1000); });
1407
+ let timer;
1408
+ const timeout = new Promise((_resolve, reject) => {
1409
+ timer = setTimeout(() => reject(new Error("exo_error_body_timeout")), HOST_RUNTIME_POLICY.provider_error_body_timeout_ms);
1410
+ });
52
1411
  try {
53
- for (;;) {
1412
+ for (; ; ) {
54
1413
  const part = await Promise.race([reader.read(), timeout]);
55
1414
  if (part.done) break;
56
1415
  bytes += part.value.byteLength;
57
- if (bytes > 16_384) return 'exo_rate_limited';
1416
+ if (bytes > HOST_RUNTIME_POLICY.provider_error_body_max_bytes) return "exo_rate_limited";
58
1417
  chunks.push(part.value);
59
1418
  }
60
- const error = record(record(JSON.parse(Buffer.concat(chunks).toString('utf8'))).error);
61
- return error.type === 'insufficient_quota' || error.code === 'insufficient_quota'
62
- ? 'exo_quota_exhausted' : 'exo_rate_limited';
63
- } catch { return 'exo_rate_limited'; }
64
- finally { if (timer) clearTimeout(timer); void reader.cancel().catch(() => undefined); }
1419
+ const error = record(record(JSON.parse(Buffer.concat(chunks).toString("utf8"))).error);
1420
+ return error.type === "insufficient_quota" || error.code === "insufficient_quota" ? "exo_quota_exhausted" : "exo_rate_limited";
1421
+ } catch {
1422
+ return "exo_rate_limited";
1423
+ } finally {
1424
+ if (timer) clearTimeout(timer);
1425
+ void reader.cancel().catch(() => void 0);
1426
+ }
65
1427
  };
66
- const retryAfterDeadline = (value: string | null): number | null => {
67
- if (!value || value.length > 128) return null;
1428
+ var retryAfterDeadline = (value) => {
1429
+ if (!value || value.length > RETRY_AFTER_HEADER_MAX_CHARS) return null;
68
1430
  const now = Date.now();
69
1431
  const trimmed = value.trim();
70
- const deadline = /^\d+(?:\.\d+)?$/u.test(trimmed) ? now + Number(trimmed) * 1000 : Date.parse(trimmed);
71
- return Number.isFinite(deadline) && deadline >= now && deadline - now <= 86_400_000 ? Math.ceil(deadline) : null;
1432
+ const deadline = /^\d+(?:\.\d+)?$/u.test(trimmed) ? now + Number(trimmed) * MS_PER_SECOND : Date.parse(trimmed);
1433
+ return Number.isFinite(deadline) && deadline >= now && deadline - now <= HOST_RUNTIME_POLICY.exo_provider_retry_after_max_ms ? Math.ceil(deadline) : null;
72
1434
  };
73
- const textOf = (response: Json): string => (Array.isArray(response.output) ? response.output : [])
74
- .flatMap((item) => record(item).type === 'message' && Array.isArray(record(item).content) ? record(item).content as unknown[] : [])
75
- .filter((part) => record(part).type === 'output_text')
76
- .map((part) => typeof record(part).text === 'string' ? record(part).text : '').join('');
77
-
78
- // A whole-response JSON fence is a presentation wrapper, not a schema change.
79
- // Keep raw provider events intact; the broker validates the unwrapped document.
80
- const unwrapJsonFence = (text: string): string => {
1435
+ var textOf = (response) => (Array.isArray(response.output) ? response.output : []).flatMap((item) => record(item).type === "message" && Array.isArray(record(item).content) ? record(item).content : []).filter((part) => record(part).type === "output_text").map((part) => typeof record(part).text === "string" ? record(part).text : "").join("");
1436
+ var unwrapJsonFence = (text) => {
81
1437
  const match = /^```(?:json)?[ \t]*\r?\n([\s\S]*?)\r?\n```$/iu.exec(text.trim());
82
1438
  return match ? match[1] : text;
83
1439
  };
84
-
85
- /** Gemma's tool renderer enumerates properties but misses object union fields.
86
- * Add only constraints implied by every object branch. Original union branches
87
- * remain untouched, and the broker still validates the canonical input schema.
88
- */
89
- const veniceToolParameters = (value: unknown): unknown => {
90
- if (typeof value === 'boolean') return value;
1440
+ var veniceToolParameters = (value) => {
1441
+ if (typeof value === "boolean") return value;
91
1442
  const schema = record(value);
92
1443
  const existingProperties = record(schema.properties);
93
1444
  const properties = Object.fromEntries(Object.entries(existingProperties).map(([name, child]) => [name, veniceToolParameters(child)]));
94
- const result: Json = { ...schema, ...(schema.properties ? { properties } : {}) };
1445
+ const result = { ...schema, ...schema.properties ? { properties } : {} };
95
1446
  const union = Array.isArray(schema.anyOf) ? schema.anyOf : Array.isArray(schema.oneOf) ? schema.oneOf : null;
96
- if (!union?.length || (schema.type !== undefined && schema.type !== 'object')) return result;
1447
+ if (!union?.length || schema.type !== void 0 && schema.type !== "object") return result;
97
1448
  const branches = union.map(record);
98
- if (!branches.every((branch) => branch.type === 'object')) return result;
99
- const commonNames = Object.keys(record(branches[0].properties))
100
- .filter((name) => branches.every((branch) => Object.hasOwn(record(branch.properties), name)));
101
- const common: Json = {};
1449
+ if (!branches.every((branch) => branch.type === "object")) return result;
1450
+ const commonNames = Object.keys(record(branches[0].properties)).filter((name) => branches.every((branch) => Object.hasOwn(record(branch.properties), name)));
1451
+ const common = {};
102
1452
  for (const name of commonNames) {
103
1453
  const fields = branches.map((branch) => record(record(branch.properties)[name]));
104
- const derived: Json = {};
1454
+ const derived = {};
105
1455
  const type = fields[0].type;
106
- if (typeof type === 'string' && fields.every((field) => field.type === type)) derived.type = type;
1456
+ if (typeof type === "string" && fields.every((field) => field.type === type)) derived.type = type;
107
1457
  if (fields.every((field) => Array.isArray(field.enum))) {
108
- derived.enum = [...new Map(fields.flatMap((field) => field.enum as unknown[]).map((entry) => [JSON.stringify(entry), entry])).values()];
1458
+ derived.enum = [...new Map(fields.flatMap((field) => field.enum).map((entry) => [JSON.stringify(entry), entry])).values()];
109
1459
  }
110
- common[name] = typeof properties[name] === 'boolean' ? properties[name] : { ...derived, ...record(properties[name]) };
1460
+ common[name] = typeof properties[name] === "boolean" ? properties[name] : { ...derived, ...record(properties[name]) };
111
1461
  }
112
- const required = (Array.isArray(branches[0].required) ? branches[0].required : [])
113
- .filter((name): name is string => typeof name === 'string' && branches.every((branch) => Array.isArray(branch.required) && branch.required.includes(name)));
114
- return { ...result, type: 'object', properties: { ...properties, ...common },
115
- ...((required.length || Array.isArray(schema.required)) ? { required: [...new Set([...(Array.isArray(schema.required) ? schema.required : []), ...required])] } : {}) };
1462
+ const required = (Array.isArray(branches[0].required) ? branches[0].required : []).filter((name) => typeof name === "string" && branches.every((branch) => Array.isArray(branch.required) && branch.required.includes(name)));
1463
+ return {
1464
+ ...result,
1465
+ type: "object",
1466
+ properties: { ...properties, ...common },
1467
+ ...required.length || Array.isArray(schema.required) ? { required: [.../* @__PURE__ */ new Set([...Array.isArray(schema.required) ? schema.required : [], ...required])] } : {}
1468
+ };
116
1469
  };
117
-
118
- const chatResponseEvents = (events: unknown[]): unknown[] => events.map((event) => {
1470
+ var chatResponseEvents = (events) => events.map((event) => {
119
1471
  const data = record(event);
120
1472
  const messages = Array.isArray(data.messages) ? data.messages.map(record) : [];
121
- if (data.type !== 'messages' || messages.length < 2 || !messages.every((message) => message.role === 'assistant')) return event;
122
- // Exo's Responses-to-Lingua conversion splits one Chat assistant response
123
- // into one message per tool call. Keep its calls together so Chat history
124
- // never inserts another assistant message before the first call's result.
1473
+ if (data.type !== "messages" || messages.length <= 1 || !messages.every((message) => message.role === "assistant")) return event;
125
1474
  const content = messages.flatMap((message) => {
126
1475
  if (Array.isArray(message.content)) return message.content;
127
- if (typeof message.content === 'string') return message.content ? [{ type: 'text', text: message.content }] : [];
128
- if (message.content === null || message.content === undefined) return [];
129
- throw new Error('exo_chat_message_invalid');
1476
+ if (typeof message.content === "string") return message.content ? [{ type: "text", text: message.content }] : [];
1477
+ if (message.content === null || message.content === void 0) return [];
1478
+ throw new Error("exo_chat_message_invalid");
130
1479
  });
131
- return { ...data, messages: [{ role: 'assistant', content }] };
1480
+ return { ...data, messages: [{ role: "assistant", content }] };
132
1481
  });
133
-
134
- const chatRequestMessages = (harness: ExoHarnessModule, events: unknown[]): Message[] => {
135
- // The pinned Chat serializer emits Lingua's tagged argument wrapper; Rust
136
- // Lingua persistence also changes numeric argument values. ToolRequested
137
- // preserves the original JSON independently, so use its exact ordered
138
- // receipt instead of coercing either representation. Stored events stay raw.
139
- const requests = events.map((event) => record(record(event).data)).filter((event) => event.type === 'tool_requested');
1482
+ var chatRequestMessages = (harness, events) => {
1483
+ const requests = events.map((event) => record(record(event).data)).filter((event) => event.type === "tool_requested");
140
1484
  let index = 0;
141
1485
  const messages = harness.materializeEventsToMessages(events).map((message) => {
142
- if (message.role !== 'assistant' || !Array.isArray(message.content)) return message;
1486
+ if (message.role !== "assistant" || !Array.isArray(message.content)) return message;
143
1487
  return { ...message, content: message.content.map((part) => {
144
1488
  const content = record(part);
145
- if (content.type !== 'tool_call') return part;
1489
+ if (content.type !== "tool_call") return part;
146
1490
  const event = requests[index++];
147
1491
  const request = record(event?.request);
148
1492
  const args = request.arguments;
149
- if (!event || event.tool_call_id !== content.tool_call_id || request.function_name !== content.tool_name
150
- || args === null || typeof args !== 'object' || Array.isArray(args)) throw new Error('exo_chat_arguments_invalid');
1493
+ if (!event || event.tool_call_id !== content.tool_call_id || request.function_name !== content.tool_name || args === null || typeof args !== "object" || Array.isArray(args)) throw new Error("exo_chat_arguments_invalid");
151
1494
  return { ...content, arguments: args };
152
1495
  }) };
153
1496
  });
154
- if (index !== requests.length) throw new Error('exo_chat_arguments_invalid');
1497
+ if (index !== requests.length) throw new Error("exo_chat_arguments_invalid");
155
1498
  return messages;
156
1499
  };
157
-
158
- const toolsFor = (input: Input): Json[] => input.mode === 'provider' ? [] : [
159
- { name: 'vtx_get_data', description: 'Request assignment-scoped VTX data.', parameters: {
1500
+ var toolsFor = (input) => input.mode === "provider" ? [] : [
1501
+ { name: "vtx_get_data", description: "Request assignment-scoped VTX data.", parameters: {
160
1502
  // Keep the complete branch contract, while exposing its common fields to
161
1503
  // Chat tool renderers that enumerate only top-level properties.
162
- type: 'object', additionalProperties: false, required: ['capability', 'arguments'],
163
- properties: { capability: { type: 'string', enum: input.dataContract.map((entry) => entry.id) }, arguments: { type: 'object' } },
164
- oneOf: input.dataContract.map((entry) => ({ type: 'object', additionalProperties: false,
165
- required: ['capability', 'arguments'], properties: { capability: { const: entry.id }, arguments: entry.input_schema } })) } },
166
- { name: 'vtx_submit_decision', description: 'Submit a canonical VTX decision.', parameters: {
167
- type: 'object', additionalProperties: false, required: ['candidate'], properties: { candidate: input.decisionSchema } } },
168
- { name: 'vtx_decision_status', description: 'Resolve a VTX decision operation.', parameters: {
169
- type: 'object', additionalProperties: false, required: ['operation_id'], properties: { operation_id: { type: 'string', minLength: 1 } } } },
1504
+ type: "object",
1505
+ additionalProperties: false,
1506
+ required: ["capability", "arguments"],
1507
+ properties: { capability: { type: "string", enum: input.dataContract.map((entry) => entry.id) }, arguments: { type: "object" } },
1508
+ oneOf: input.dataContract.map((entry) => ({
1509
+ type: "object",
1510
+ additionalProperties: false,
1511
+ required: ["capability", "arguments"],
1512
+ properties: { capability: { const: entry.id }, arguments: entry.input_schema }
1513
+ }))
1514
+ } },
1515
+ { name: "vtx_submit_decision", description: "Submit a canonical VTX decision.", parameters: {
1516
+ type: "object",
1517
+ additionalProperties: false,
1518
+ required: ["candidate"],
1519
+ properties: { candidate: input.decisionSchema }
1520
+ } },
1521
+ { name: "vtx_decision_status", description: "Resolve a VTX decision operation.", parameters: {
1522
+ type: "object",
1523
+ additionalProperties: false,
1524
+ required: ["operation_id"],
1525
+ properties: { operation_id: { type: "string", minLength: 1 } }
1526
+ } }
170
1527
  ];
171
-
172
- export default {
1528
+ var exo_harness_default = {
173
1529
  tools: [],
174
- async runTurn(context: Context): Promise<void> {
1530
+ async runTurn(context) {
175
1531
  const nativeFetch = globalThis.fetch;
176
- const brokerUrl = new URL(process.env.VTX_EXO_BRIDGE_URL ?? '');
1532
+ const brokerUrl = new URL(process.env.VTX_EXO_BRIDGE_URL ?? "");
177
1533
  const token = process.env.VTX_EXO_BRIDGE_TOKEN;
178
1534
  const source = process.env.VTX_EXO_SOURCE_ROOT;
179
- if (brokerUrl.protocol !== 'http:' || brokerUrl.hostname !== '127.0.0.1' || brokerUrl.username || brokerUrl.password
180
- || brokerUrl.pathname !== '/' || brokerUrl.search || brokerUrl.hash || !token || !source) throw new Error('exo_bridge_invalid');
181
- const broker = async (path: string, body?: Json, deadlineAtMs?: number): Promise<Json> => {
182
- const timeoutMs = deadlineAtMs === undefined ? 30_000 : deadlineAtMs - Date.now();
183
- if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1) throw new Error('exo_deadline_reached');
1535
+ if (brokerUrl.protocol !== "http:" || brokerUrl.hostname !== "127.0.0.1" || brokerUrl.username || brokerUrl.password || brokerUrl.pathname !== "/" || brokerUrl.search || brokerUrl.hash || !token || !source) throw new Error("exo_bridge_invalid");
1536
+ const broker = async (path, body, deadlineAtMs) => {
1537
+ const timeoutMs = deadlineAtMs === void 0 ? HOST_RUNTIME_POLICY.exo_bridge_request_timeout_ms : deadlineAtMs - Date.now();
1538
+ if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1) throw new Error("exo_deadline_reached");
184
1539
  const response = await nativeFetch(new URL(path, brokerUrl), {
185
- method: body === undefined ? 'GET' : 'POST',
186
- headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' },
187
- ...(body === undefined ? {} : { body: JSON.stringify(body) }), redirect: 'error', signal: AbortSignal.timeout(timeoutMs),
1540
+ method: body === void 0 ? "GET" : "POST",
1541
+ headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
1542
+ ...body === void 0 ? {} : { body: JSON.stringify(body) },
1543
+ redirect: "error",
1544
+ signal: AbortSignal.timeout(timeoutMs)
188
1545
  });
189
- if (!response.ok) throw new Error('exo_bridge_rejected');
1546
+ if (!response.ok) throw new Error("exo_bridge_rejected");
190
1547
  return record(await response.json());
191
1548
  };
192
1549
  let dispatched = false;
193
1550
  let terminalKnown = true;
194
1551
  let activeDispatch = false;
195
1552
  let roundDispatch = false;
196
- let failureCode = 'exo_turn_failed';
197
- let retryAtMs: number | null = null;
198
- const usage = { inputTokens: 0, cachedInputTokens: 0, outputTokens: 0, reasoningOutputTokens: 0,
199
- totalTokens: 0, cacheWriteInputTokens: null, cacheWriteSupported: false };
1553
+ let failureCode = "exo_turn_failed";
1554
+ let retryAtMs = null;
1555
+ const usage = {
1556
+ inputTokens: 0,
1557
+ cachedInputTokens: 0,
1558
+ outputTokens: 0,
1559
+ reasoningOutputTokens: 0,
1560
+ totalTokens: 0,
1561
+ cacheWriteInputTokens: null,
1562
+ cacheWriteSupported: false
1563
+ };
200
1564
  let completedCalls = 0;
201
- let lastCompletedResponseId: string | null = null;
202
- let currentReceipt: { responseId: string; providerModel: string; reasoningEffort: string } | null = null;
203
- const addUsage = (nativeUsage: Json): void => {
1565
+ let lastCompletedResponseId = null;
1566
+ let currentReceipt = null;
1567
+ const addUsage = (nativeUsage) => {
204
1568
  const inputTokens = count(nativeUsage.input_tokens);
205
1569
  const outputTokens = count(nativeUsage.output_tokens);
206
1570
  const totalTokens = count(nativeUsage.total_tokens);
207
1571
  const cachedTokens = count(record(nativeUsage.input_tokens_details).cached_tokens ?? 0);
208
1572
  const reasoningTokens = count(record(nativeUsage.output_tokens_details).reasoning_tokens ?? 0);
209
- if (totalTokens !== inputTokens + outputTokens || cachedTokens > inputTokens || reasoningTokens > outputTokens) throw new Error('exo_usage_invalid');
210
- usage.inputTokens = count(usage.inputTokens + inputTokens); usage.outputTokens = count(usage.outputTokens + outputTokens);
211
- usage.totalTokens = count(usage.totalTokens + totalTokens); usage.cachedInputTokens = count(usage.cachedInputTokens + cachedTokens);
1573
+ if (totalTokens !== inputTokens + outputTokens || cachedTokens > inputTokens || reasoningTokens > outputTokens) throw new Error("exo_usage_invalid");
1574
+ usage.inputTokens = count(usage.inputTokens + inputTokens);
1575
+ usage.outputTokens = count(usage.outputTokens + outputTokens);
1576
+ usage.totalTokens = count(usage.totalTokens + totalTokens);
1577
+ usage.cachedInputTokens = count(usage.cachedInputTokens + cachedTokens);
212
1578
  usage.reasoningOutputTokens = count(usage.reasoningOutputTokens + reasoningTokens);
213
1579
  completedCalls += 1;
214
1580
  };
215
1581
  try {
216
- const input = await broker('/input') as unknown as Input;
217
- if (!['openai', 'venice'].includes(input.provider) || !['provider', 'agent'].includes(input.mode) || typeof input.systemPrompt !== 'string' || typeof input.userPrompt !== 'string'
218
- || !Number.isSafeInteger(input.maxRounds) || input.maxRounds < 1 || input.maxRounds > 64
219
- || !Number.isSafeInteger(input.deadlineAtMs) || input.deadlineAtMs < 1
220
- || typeof input.providerModel !== 'string' || !input.providerModel || typeof input.reasoningEffort !== 'string'
221
- || !(input.nativeReasoningEffort === null || typeof input.nativeReasoningEffort === 'string')) throw new Error('exo_input_invalid');
222
- const credential = await broker('/credential');
223
- const expectedBase = input.provider === 'venice' ? 'https://api.venice.ai/api/v1' : 'https://api.openai.com/v1';
224
- const providerBase = new URL(typeof credential.baseURL === 'string' ? credential.baseURL : expectedBase);
225
- const localFixture = providerBase.protocol === 'http:' && providerBase.hostname === '127.0.0.1' && Boolean(providerBase.port) && providerBase.pathname === '/v1';
226
- if ((!localFixture && providerBase.href !== expectedBase)
227
- || providerBase.username || providerBase.password || providerBase.search || providerBase.hash
228
- || typeof credential.apiKey !== 'string' || !credential.apiKey) {
229
- throw new Error('exo_provider_not_qualified');
1582
+ const input = await broker("/input");
1583
+ if (!["openai", "venice"].includes(input.provider) || !["provider", "agent"].includes(input.mode) || typeof input.systemPrompt !== "string" || typeof input.userPrompt !== "string" || !Number.isSafeInteger(input.maxRounds) || input.maxRounds < 1 || input.maxRounds > EXO_POLICY_MAX_TOOL_ROUNDS || !Number.isSafeInteger(input.deadlineAtMs) || input.deadlineAtMs < 1 || typeof input.providerModel !== "string" || !input.providerModel || typeof input.reasoningEffort !== "string" || !(input.nativeReasoningEffort === null || typeof input.nativeReasoningEffort === "string")) throw new Error("exo_input_invalid");
1584
+ const credential = await broker("/credential");
1585
+ const expectedBase = input.provider === "venice" ? "https://api.venice.ai/api/v1" : "https://api.openai.com/v1";
1586
+ const providerBase = new URL(typeof credential.baseURL === "string" ? credential.baseURL : expectedBase);
1587
+ const localFixture = providerBase.protocol === "http:" && providerBase.hostname === "127.0.0.1" && Boolean(providerBase.port) && providerBase.pathname === "/v1";
1588
+ if (!localFixture && providerBase.href !== expectedBase || providerBase.username || providerBase.password || providerBase.search || providerBase.hash || typeof credential.apiKey !== "string" || !credential.apiKey) {
1589
+ throw new Error("exo_provider_not_qualified");
230
1590
  }
231
- if (input.provider === 'venice' && (input.reasoningEffort !== 'none' || input.nativeReasoningEffort !== 'none')) throw new Error('exo_effort_not_qualified');
232
- const providerEndpoint = `${providerBase.href}/${input.provider === 'venice' ? 'chat/completions' : 'responses'}`;
233
- const harness = await import(pathToFileURL(join(source, 'exoharness/typescript/harness/index.ts')).href) as ExoHarnessModule;
234
- const model = await import(pathToFileURL(join(source, 'exoharness/typescript/model-runtime/responses.ts')).href) as ExoModelModule;
1591
+ if (input.provider === "venice" && (input.reasoningEffort !== "none" || input.nativeReasoningEffort !== "none")) throw new Error("exo_effort_not_qualified");
1592
+ const providerEndpoint = `${providerBase.href}/${input.provider === "venice" ? "chat/completions" : "responses"}`;
1593
+ const harness = await import(pathToFileURL(join(source, "exoharness/typescript/harness/index.ts")).href);
1594
+ const model = await import(pathToFileURL(join(source, "exoharness/typescript/model-runtime/responses.ts")).href);
235
1595
  const definitions = toolsFor(input);
236
1596
  const allowed = new Set(definitions.map((tool) => tool.name));
237
- // Install before constructing the upstream SDK, which captures fetch.
238
- // Each complete() may dispatch once. SDK retries after an uncertain call
239
- // are rejected before network I/O; they cannot repeat paid inference.
240
1597
  globalThis.fetch = async (resource, options) => {
241
1598
  const url = new URL(resource instanceof Request ? resource.url : String(resource));
242
- if (url.href !== providerEndpoint || options?.method !== 'POST'
243
- || !activeDispatch || roundDispatch || typeof options.body !== 'string') throw new Error('exo_dispatch_rejected');
1599
+ if (url.href !== providerEndpoint || options?.method !== "POST" || !activeDispatch || roundDispatch || typeof options.body !== "string") throw new Error("exo_dispatch_rejected");
244
1600
  const payload = record(JSON.parse(options.body));
245
- if (payload.model !== input.providerModel || payload.stream === true) throw new Error('exo_request_identity_mismatch');
246
- const format = { name: 'vtx_result', strict: true, schema: input.outputSchema };
247
- if (input.provider === 'venice') {
248
- payload.reasoning_effort = 'none';
249
- payload.venice_parameters = { disable_thinking: true, strip_thinking_response: false, include_venice_system_prompt: false,
250
- enable_web_search: 'off', enable_web_scraping: false, enable_x_search: false, enable_web_citations: false };
251
- // Venice's native JSON grammar suppresses tool selection. Agent
252
- // supplies the same final schema as context and validates it in VTX.
253
- if (input.mode === 'provider') payload.response_format = { type: 'json_schema', json_schema: format };
1601
+ if (payload.model !== input.providerModel || payload.stream === true) throw new Error("exo_request_identity_mismatch");
1602
+ const format = { name: "vtx_result", strict: true, schema: input.outputSchema };
1603
+ if (input.provider === "venice") {
1604
+ payload.reasoning_effort = "none";
1605
+ payload.venice_parameters = {
1606
+ disable_thinking: true,
1607
+ strip_thinking_response: false,
1608
+ include_venice_system_prompt: false,
1609
+ enable_web_search: "off",
1610
+ enable_web_scraping: false,
1611
+ enable_x_search: false,
1612
+ enable_web_citations: false
1613
+ };
1614
+ if (input.mode === "provider") payload.response_format = { type: "json_schema", json_schema: format };
254
1615
  else delete payload.response_format;
255
1616
  } else {
256
1617
  if (input.nativeReasoningEffort === null) delete payload.reasoning;
257
1618
  else payload.reasoning = { effort: input.nativeReasoningEffort };
258
- payload.text = { format: { type: 'json_schema', ...format } };
1619
+ payload.text = { format: { type: "json_schema", ...format } };
259
1620
  }
260
- // Exo marks every tool strict, but VTX capability schemas deliberately
261
- // preserve optional fields and oneOf. The broker validates their exact
262
- // canonical contracts; do not change those semantics for the SDK.
263
- if (Array.isArray(payload.tools)) payload.tools = payload.tools.map((tool) => input.provider === 'venice'
264
- ? { ...record(tool), function: { ...record(record(tool).function), strict: false,
265
- parameters: veniceToolParameters(record(record(tool).function).parameters) } }
266
- : { ...record(tool), strict: false });
267
- await broker('/dispatch', { model: input.providerModel, reasoningEffort: input.reasoningEffort });
1621
+ if (Array.isArray(payload.tools)) payload.tools = payload.tools.map((tool) => input.provider === "venice" ? { ...record(tool), function: {
1622
+ ...record(record(tool).function),
1623
+ strict: false,
1624
+ parameters: veniceToolParameters(record(record(tool).function).parameters)
1625
+ } } : { ...record(tool), strict: false });
1626
+ await broker("/dispatch", { model: input.providerModel, reasoningEffort: input.reasoningEffort });
268
1627
  roundDispatch = true;
269
1628
  dispatched = true;
270
1629
  terminalKnown = false;
271
1630
  currentReceipt = null;
272
1631
  retryAtMs = null;
273
- const response = await nativeFetch(resource, { ...options, body: JSON.stringify(payload), redirect: 'error' });
1632
+ const response = await nativeFetch(resource, { ...options, body: JSON.stringify(payload), redirect: "error" });
274
1633
  const headers = new Headers(response.headers);
275
- headers.set('x-should-retry', 'false');
276
- // A definite client rejection did not yield a model result. Server and
277
- // transport failures stay uncertain, even if an SDK reports an error.
278
- if (!response.ok && response.status >= 400 && response.status < 500 && response.status !== 408) terminalKnown = true;
1634
+ headers.set("x-should-retry", "false");
1635
+ if (!response.ok && response.status >= HTTP_CLIENT_ERROR_MIN && response.status < HTTP_SERVER_ERROR_MIN && response.status !== HTTP_STATUS.REQUEST_TIMEOUT) terminalKnown = true;
279
1636
  if (!response.ok) {
280
- retryAtMs = response.status === 429 ? retryAfterDeadline(response.headers.get('retry-after')) : null;
281
- failureCode = response.status === 401 ? 'exo_invalid_api_key' : response.status === 429 ? await rateLimitCode(response) : 'exo_provider_rejected';
282
- if (response.status !== 429) await response.body?.cancel();
1637
+ retryAtMs = response.status === HTTP_STATUS.TOO_MANY_REQUESTS ? retryAfterDeadline(response.headers.get("retry-after")) : null;
1638
+ failureCode = response.status === HTTP_STATUS.UNAUTHORIZED ? "exo_invalid_api_key" : response.status === HTTP_STATUS.TOO_MANY_REQUESTS ? await rateLimitCode(response) : "exo_provider_rejected";
1639
+ if (response.status !== HTTP_STATUS.TOO_MANY_REQUESTS) await response.body?.cancel();
283
1640
  return new Response(JSON.stringify({ error: { message: failureCode, code: failureCode } }), { status: response.status, headers });
284
1641
  }
285
- if (input.provider === 'venice') {
1642
+ if (input.provider === "venice") {
286
1643
  try {
287
1644
  const raw = record(await response.clone().json());
288
1645
  const choices = Array.isArray(raw.choices) ? raw.choices : [];
289
1646
  const choice = record(choices[0]);
290
- terminalKnown = choices.length === 1 && ['stop', 'tool_calls', 'length', 'content_filter'].includes(String(choice.finish_reason));
291
- if (!validModel(raw.model) || typeof raw.id !== 'string' || !raw.id) throw new Error('exo_response_identity_mismatch');
1647
+ terminalKnown = choices.length === 1 && ["stop", "tool_calls", "length", "content_filter"].includes(String(choice.finish_reason));
1648
+ if (!validModel(raw.model) || typeof raw.id !== "string" || !raw.id) throw new Error("exo_response_identity_mismatch");
292
1649
  const controls = record(raw.venice_parameters);
293
- if (controls.disable_thinking !== true || controls.strip_thinking_response !== false
294
- || controls.include_venice_system_prompt !== false || controls.enable_web_search !== 'off'
295
- || controls.enable_web_scraping !== false || controls.enable_x_search !== false || controls.enable_web_citations !== false
296
- || record(choice.message).reasoning_content || record(choice.message).reasoning
297
- || (record(record(raw.usage).completion_tokens_details).reasoning_tokens ?? 0) !== 0
298
- || (raw.reasoning_effort !== undefined && raw.reasoning_effort !== 'none')) throw new Error('exo_response_effort_mismatch');
1650
+ if (controls.disable_thinking !== true || controls.strip_thinking_response !== false || controls.include_venice_system_prompt !== false || controls.enable_web_search !== "off" || controls.enable_web_scraping !== false || controls.enable_x_search !== false || controls.enable_web_citations !== false || record(choice.message).reasoning_content || record(choice.message).reasoning || (record(record(raw.usage).completion_tokens_details).reasoning_tokens ?? 0) !== 0 || raw.reasoning_effort !== void 0 && raw.reasoning_effort !== "none") throw new Error("exo_response_effort_mismatch");
299
1651
  const nativeUsage = record(raw.usage);
300
- addUsage({ input_tokens: nativeUsage.prompt_tokens, output_tokens: nativeUsage.completion_tokens, total_tokens: nativeUsage.total_tokens,
301
- input_tokens_details: nativeUsage.prompt_tokens_details, output_tokens_details: nativeUsage.completion_tokens_details });
1652
+ addUsage({
1653
+ input_tokens: nativeUsage.prompt_tokens,
1654
+ output_tokens: nativeUsage.completion_tokens,
1655
+ total_tokens: nativeUsage.total_tokens,
1656
+ input_tokens_details: nativeUsage.prompt_tokens_details,
1657
+ output_tokens_details: nativeUsage.completion_tokens_details
1658
+ });
302
1659
  lastCompletedResponseId = raw.id;
303
1660
  currentReceipt = { responseId: raw.id, providerModel: raw.model, reasoningEffort: input.reasoningEffort };
304
- // Exo synthesizes completed status for every Chat response. Inspect
305
- // the real terminal reason before that normalization can hide loss.
306
- if (choices.length !== 1 || !['stop', 'tool_calls'].includes(String(choice.finish_reason))) throw new Error('exo_response_incomplete');
307
- const hasTools = Array.isArray(record(choice.message).tool_calls) && (record(choice.message).tool_calls as unknown[]).length > 0;
308
- if ((choice.finish_reason === 'tool_calls') !== hasTools) throw new Error('exo_response_incomplete');
1661
+ if (choices.length !== 1 || !["stop", "tool_calls"].includes(String(choice.finish_reason))) throw new Error("exo_response_incomplete");
1662
+ const hasTools = Array.isArray(record(choice.message).tool_calls) && record(choice.message).tool_calls.length > 0;
1663
+ if (choice.finish_reason === "tool_calls" !== hasTools) throw new Error("exo_response_incomplete");
309
1664
  } catch (error) {
310
- failureCode = error instanceof Error && /^exo_[a-z_]+$/u.test(error.message) ? error.message : 'exo_response_invalid';
1665
+ failureCode = error instanceof Error && /^exo_[a-z_]+$/u.test(error.message) ? error.message : "exo_response_invalid";
311
1666
  await response.body?.cancel();
312
1667
  throw new Error(failureCode);
313
1668
  }
314
1669
  }
315
1670
  return new Response(response.body, { status: response.status, headers });
316
1671
  };
317
- const RuntimeClass = input.provider === 'venice' ? model.ChatCompletionsRuntime : model.ResponsesRuntime;
1672
+ const RuntimeClass = input.provider === "venice" ? model.ChatCompletionsRuntime : model.ResponsesRuntime;
318
1673
  const runtime = new RuntimeClass({ apiKey: credential.apiKey, baseURL: providerBase.href });
319
1674
  for (let round = 0; round < input.maxRounds; round += 1) {
320
- const instructions: Message[] = [{ role: 'system', content: input.systemPrompt }, { role: 'user', content: input.userPrompt }];
321
- if (input.provider === 'venice' && input.mode === 'agent') instructions.push({
322
- role: 'user', content: JSON.stringify({ final_response_schema: input.outputSchema,
323
- decision_schema: input.decisionSchema, data_contract: input.dataContract }),
1675
+ const instructions = [{ role: "system", content: input.systemPrompt }, { role: "user", content: input.userPrompt }];
1676
+ if (input.provider === "venice" && input.mode === "agent") instructions.push({
1677
+ role: "user",
1678
+ content: JSON.stringify({
1679
+ final_response_schema: input.outputSchema,
1680
+ decision_schema: input.decisionSchema,
1681
+ data_contract: input.dataContract
1682
+ })
324
1683
  });
325
- const messages = input.mode === 'provider' ? instructions : input.provider === 'venice'
326
- ? [...instructions, ...chatRequestMessages(harness, (await context.exoharness.current.conversation.getEvents({
327
- direction: 'asc', types: ['messages', 'tool_requested', 'tool_result'],
328
- })).events)]
329
- : await harness.materializePromptMessages(context.exoharness.current.conversation, instructions);
1684
+ const messages = input.mode === "provider" ? instructions : input.provider === "venice" ? [...instructions, ...chatRequestMessages(harness, (await context.exoharness.current.conversation.getEvents({
1685
+ direction: "asc",
1686
+ types: ["messages", "tool_requested", "tool_result"]
1687
+ })).events)] : await harness.materializePromptMessages(context.exoharness.current.conversation, instructions);
330
1688
  roundDispatch = false;
331
1689
  activeDispatch = true;
332
1690
  const response = await runtime.complete({ model: input.providerModel, messages, tools: definitions });
333
1691
  activeDispatch = false;
334
- // Validate the actual completed provider receipt before exposing any
335
- // model tool call to the broker, especially decision submission.
336
- if (response.status !== 'completed') throw new Error('exo_response_incomplete');
1692
+ if (response.status !== "completed") throw new Error("exo_response_incomplete");
337
1693
  terminalKnown = true;
338
- if (!validModel(response.model) || typeof response.id !== 'string' || !response.id) throw new Error('exo_response_identity_mismatch');
339
- if (input.provider === 'openai') {
1694
+ if (!validModel(response.model) || typeof response.id !== "string" || !response.id) throw new Error("exo_response_identity_mismatch");
1695
+ if (input.provider === "openai") {
340
1696
  const effectiveEffort = record(response.reasoning).effort ?? null;
341
- if (effectiveEffort !== input.nativeReasoningEffort) throw new Error('exo_response_effort_mismatch');
1697
+ if (effectiveEffort !== input.nativeReasoningEffort) throw new Error("exo_response_effort_mismatch");
342
1698
  addUsage(record(response.usage));
343
1699
  lastCompletedResponseId = response.id;
344
1700
  currentReceipt = { responseId: response.id, providerModel: response.model, reasoningEffort: input.reasoningEffort };
345
1701
  }
346
- if (!currentReceipt || currentReceipt.responseId !== response.id || currentReceipt.providerModel !== response.model) throw new Error('exo_response_identity_mismatch');
1702
+ if (!currentReceipt || currentReceipt.responseId !== response.id || currentReceipt.providerModel !== response.model) throw new Error("exo_response_identity_mismatch");
347
1703
  const events = model.responseToLinguaEvents(response);
348
- await context.exoharness.current.turn.addEvents(input.provider === 'venice' ? chatResponseEvents(events) : events);
1704
+ await context.exoharness.current.turn.addEvents(input.provider === "venice" ? chatResponseEvents(events) : events);
349
1705
  const calls = model.responseToolCalls(response);
350
1706
  if (calls.length === 0) {
351
1707
  const rawText = textOf(response);
352
- const text = input.provider === 'venice' && input.mode === 'agent' ? unwrapJsonFence(rawText) : rawText;
353
- if (!text.trim()) throw new Error('exo_response_empty');
354
- await broker('/terminal', { text, providerModel: response.model, reasoningEffort: input.reasoningEffort, responseId: response.id, usage });
1708
+ const text = input.provider === "venice" && input.mode === "agent" ? unwrapJsonFence(rawText) : rawText;
1709
+ if (!text.trim()) throw new Error("exo_response_empty");
1710
+ await broker("/terminal", { text, providerModel: response.model, reasoningEffort: input.reasoningEffort, responseId: response.id, usage });
355
1711
  return;
356
1712
  }
357
- if (input.mode !== 'agent' || calls.some((call) => !allowed.has(call.request.functionName))) throw new Error('exo_tool_not_allowed');
1713
+ if (input.mode !== "agent" || calls.some((call) => !allowed.has(call.request.functionName))) throw new Error("exo_tool_not_allowed");
358
1714
  for (const call of calls) {
359
- const result = await broker('/tool', { callId: call.toolCallId, tool: call.request.functionName, arguments: call.request.arguments,
360
- effectiveModel: `${input.provider}/${currentReceipt!.providerModel}`, effectiveReasoningEffort: input.reasoningEffort }, input.deadlineAtMs);
361
- // Append the entire result directly. The default registry replaces
362
- // results over 8k with previews, which loses assignment data.
363
- await context.exoharness.current.turn.addEvents([harness.toolResultEvent(call.toolCallId,
364
- result.success === true ? { ok: true, value: result.value } : { ok: false, error: 'vtx_tool_failed', value: result.value })]);
1715
+ const result = await broker("/tool", {
1716
+ callId: call.toolCallId,
1717
+ tool: call.request.functionName,
1718
+ arguments: call.request.arguments,
1719
+ effectiveModel: `${input.provider}/${currentReceipt.providerModel}`,
1720
+ effectiveReasoningEffort: input.reasoningEffort
1721
+ }, input.deadlineAtMs);
1722
+ await context.exoharness.current.turn.addEvents([harness.toolResultEvent(
1723
+ call.toolCallId,
1724
+ result.success === true ? { ok: true, value: result.value } : { ok: false, error: "vtx_tool_failed", value: result.value }
1725
+ )]);
365
1726
  }
366
1727
  }
367
- throw new Error('exo_round_limit');
1728
+ throw new Error("exo_round_limit");
368
1729
  } catch (error) {
369
1730
  const code = error instanceof Error && /^exo_[a-z_]+$/u.test(error.message) ? error.message : failureCode;
370
- await broker('/failure', { code, dispatched, terminalKnown, usage: completedCalls ? usage : null,
371
- responseId: currentReceipt?.responseId ?? null, providerModel: currentReceipt?.providerModel ?? null,
372
- reasoningEffort: currentReceipt?.reasoningEffort ?? null, lastCompletedResponseId, retryAtMs }).catch(() => undefined);
373
- // Rust surfaces errors and stacks to its caller; do not propagate SDK
374
- // diagnostics that can contain prompts, provider bodies, or secrets.
1731
+ await broker("/failure", {
1732
+ code,
1733
+ dispatched,
1734
+ terminalKnown,
1735
+ usage: completedCalls ? usage : null,
1736
+ responseId: currentReceipt?.responseId ?? null,
1737
+ providerModel: currentReceipt?.providerModel ?? null,
1738
+ reasoningEffort: currentReceipt?.reasoningEffort ?? null,
1739
+ lastCompletedResponseId,
1740
+ retryAtMs
1741
+ }).catch(() => void 0);
375
1742
  throw new Error(code);
376
1743
  } finally {
377
1744
  globalThis.fetch = nativeFetch;
378
1745
  }
379
- },
1746
+ }
1747
+ };
1748
+ export {
1749
+ exo_harness_default as default
380
1750
  };