4runr-os 2.9.58 → 2.9.60

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.
@@ -7,6 +7,7 @@ use ratatui::prelude::*;
7
7
  use std::time::{Duration, Instant};
8
8
 
9
9
  mod app;
10
+ mod debug_log;
10
11
  mod io;
11
12
  mod screens;
12
13
  mod storage;
@@ -600,6 +601,10 @@ fn main() -> Result<()> {
600
601
  if is_switching {
601
602
  #[cfg(debug_assertions)]
602
603
  eprintln!("[MAIN] SCREEN SWITCH: {:?} -> {:?} (clearing)", previous_screen, current_screen);
604
+ debug_log::log_screen(
605
+ &format!("{:?}", previous_screen.as_ref().unwrap_or(&current_screen)),
606
+ &format!("{:?}", current_screen),
607
+ );
603
608
  terminal.clear()?;
604
609
  }
605
610
 
@@ -623,8 +628,12 @@ fn main() -> Result<()> {
623
628
  // OPTIMIZATION: Reduced poll timeout to 1ms for faster input detection
624
629
  // This allows loop to run ~1000 times/second when idle, but input is detected immediately
625
630
  if crossterm::event::poll(Duration::from_millis(1))? {
631
+ let on_setup = app.state.navigation.current_screen() == &screens::Screen::SetupPortal;
626
632
  match event::read()? {
627
633
  Event::Key(key) => {
634
+ if on_setup {
635
+ debug_log::log_input("Key", &format!("{:?}", key));
636
+ }
628
637
  if key.kind == KeyEventKind::Press {
629
638
  if app.handle_input(key, &mut io_handler, ws_client.as_ref())? {
630
639
  break; // Exit requested
@@ -632,8 +641,11 @@ fn main() -> Result<()> {
632
641
  }
633
642
  }
634
643
  Event::Mouse(mouse) => {
644
+ if on_setup {
645
+ debug_log::log_input("Mouse", &format!("{:?}", mouse));
646
+ }
635
647
  // Handle mouse scroll events for Setup Portal
636
- if app.state.navigation.current_screen() == &screens::Screen::SetupPortal {
648
+ if on_setup {
637
649
  if !app.state.setup_portal.detecting {
638
650
  match mouse.kind {
639
651
  MouseEventKind::ScrollUp => {
@@ -649,9 +661,11 @@ fn main() -> Result<()> {
649
661
  }
650
662
  }
651
663
  }
652
- Event::Resize(_width, _height) => {
664
+ Event::Resize(w, h) => {
665
+ if on_setup {
666
+ debug_log::log_input("Resize", &format!("{}x{}", w, h));
667
+ }
653
668
  // Terminal was resized - force immediate re-render with correct dimensions
654
- // This fixes the initial render issue where portal dimensions might be wrong
655
669
  terminal.clear()?;
656
670
  app.request_immediate_render("terminal_resize");
657
671
  }
@@ -144,7 +144,7 @@ fn render_header(f: &mut Frame, area: Rect, state: &AppState) {
144
144
 
145
145
  // Line 1: Brand + version + mode + uptime - Bug 3 fix: Use "4Runr." with dot (matches brand logo)
146
146
  // Use npm package version (2.9.24) - matches package.json
147
- const PACKAGE_VERSION: &str = "2.9.58";
147
+ const PACKAGE_VERSION: &str = "2.9.60";
148
148
  let brand_line = Line::from(vec![
149
149
  Span::styled("4Runr.", Style::default().fg(BRAND_PURPLE).add_modifier(Modifier::BOLD)),
150
150
  Span::styled(" AI AGENT OS", Style::default().fg(BRAND_VIOLET)),
@@ -5,13 +5,16 @@ use ratatui::prelude::*;
5
5
  use ratatui::widgets::{Block, Borders, Paragraph, Wrap, Clear, List, ListItem};
6
6
  use crate::app::{AppState, GatewayOption};
7
7
 
8
- /// When SETUP_PORTAL_DEBUG=1, log to stderr (works in release). Use to capture dimensions/layout when windowed.
8
+ /// When SETUP_PORTAL_DEBUG=1 or SETUP_PORTAL_DEBUG_FILE is set, log to file (and optionally stderr).
9
9
  fn setup_debug_enabled() -> bool {
10
10
  std::env::var("SETUP_PORTAL_DEBUG").as_deref() == Ok("1")
11
+ || std::env::var("SETUP_PORTAL_DEBUG_FILE").is_ok()
11
12
  }
12
13
 
13
14
  fn dbg_log(msg: &str) {
14
15
  if setup_debug_enabled() {
16
+ crate::debug_log::log(msg);
17
+ #[cfg(debug_assertions)]
15
18
  eprintln!("{}", msg);
16
19
  }
17
20
  }
@@ -96,6 +99,24 @@ pub fn render(f: &mut Frame, state: &mut AppState) {
96
99
  portal_area.x, portal_area.y, portal_area.width, portal_area.height));
97
100
  }
98
101
 
102
+ // File strategy: one composite RENDER line per frame (throttled) so file has full trace
103
+ if setup_debug_enabled() {
104
+ static mut RENDER_LOG_COUNT: u64 = 0;
105
+ unsafe {
106
+ RENDER_LOG_COUNT += 1;
107
+ let throttle = RENDER_LOG_COUNT <= 25 || RENDER_LOG_COUNT % 30 == 0;
108
+ if throttle {
109
+ let sel = format!("{:?}", state.setup_portal.selected_option);
110
+ crate::debug_log::log_render(&format!(
111
+ "frame={} dims={}x{} portal=({},{},{},{}) selected={}",
112
+ RENDER_LOG_COUNT, area.width, area.height,
113
+ portal_area.x, portal_area.y, portal_area.width, portal_area.height,
114
+ sel
115
+ ));
116
+ }
117
+ }
118
+ }
119
+
99
120
  // Split portal into sections
100
121
  use ratatui::layout::{Constraint, Direction, Layout};
101
122
 
@@ -126,6 +147,19 @@ pub fn render(f: &mut Frame, state: &mut AppState) {
126
147
  let c = &chunks[2];
127
148
  dbg_log(&format!("[SETUP_PORTAL] content chunk: x={} y={} w={} h={}", c.x, c.y, c.width, c.height));
128
149
  }
150
+ if setup_debug_enabled() {
151
+ static mut N: u64 = 0;
152
+ unsafe {
153
+ N += 1;
154
+ if N <= 25 || N % 30 == 0 {
155
+ let c = &chunks[2];
156
+ crate::debug_log::log_render(&format!(
157
+ "content_chunk=({},{},{},{})",
158
+ c.x, c.y, c.width, c.height
159
+ ));
160
+ }
161
+ }
162
+ }
129
163
 
130
164
  render_header(f, chunks[0], state);
131
165
  render_description(f, chunks[1]);
@@ -196,8 +230,11 @@ fn render_options_list(f: &mut Frame, area: Rect, state: &mut AppState, _render_
196
230
  static mut N: u64 = 0;
197
231
  unsafe {
198
232
  N += 1;
199
- if N <= 5 || N % 120 == 0 {
200
- dbg_log(&format!("[LIST] area: x={} y={} w={} h={}", area.x, area.y, area.width, area.height));
233
+ if N <= 10 || N % 30 == 0 {
234
+ crate::debug_log::log_render(&format!(
235
+ "list area=({},{},{},{})",
236
+ area.x, area.y, area.width, area.height
237
+ ));
201
238
  }
202
239
  }
203
240
  }
@@ -247,8 +284,11 @@ fn render_options_list(f: &mut Frame, area: Rect, state: &mut AppState, _render_
247
284
  static mut N: u64 = 0;
248
285
  unsafe {
249
286
  N += 1;
250
- if N <= 5 || N % 120 == 0 {
251
- dbg_log(&format!("[LIST] inner: x={} y={} w={} h={}", inner.x, inner.y, inner.width, inner.height));
287
+ if N <= 10 || N % 30 == 0 {
288
+ crate::debug_log::log_render(&format!(
289
+ "list inner=({},{},{},{})",
290
+ inner.x, inner.y, inner.width, inner.height
291
+ ));
252
292
  }
253
293
  }
254
294
  }
@@ -268,8 +308,11 @@ fn render_option_details(f: &mut Frame, area: Rect, state: &AppState, _render_id
268
308
  static mut N: u64 = 0;
269
309
  unsafe {
270
310
  N += 1;
271
- if N <= 5 || N % 120 == 0 {
272
- dbg_log(&format!("[DETAILS] area: x={} y={} w={} h={}", area.x, area.y, area.width, area.height));
311
+ if N <= 10 || N % 30 == 0 {
312
+ crate::debug_log::log_render(&format!(
313
+ "details area=({},{},{},{})",
314
+ area.x, area.y, area.width, area.height
315
+ ));
273
316
  }
274
317
  }
275
318
  }
@@ -373,8 +416,11 @@ fn render_option_details(f: &mut Frame, area: Rect, state: &AppState, _render_id
373
416
  static mut N: u64 = 0;
374
417
  unsafe {
375
418
  N += 1;
376
- if N <= 5 || N % 120 == 0 {
377
- dbg_log(&format!("[DETAILS] inner: x={} y={} w={} h={}", inner.x, inner.y, inner.width, inner.height));
419
+ if N <= 10 || N % 30 == 0 {
420
+ crate::debug_log::log_render(&format!(
421
+ "details inner=({},{},{},{})",
422
+ inner.x, inner.y, inner.width, inner.height
423
+ ));
378
424
  }
379
425
  }
380
426
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "4runr-os",
3
- "version": "2.9.58",
3
+ "version": "2.9.60",
4
4
  "type": "module",
5
- "description": "4Runr AI Agent OS - Secure terminal interface for AI agents. v2.9.58: Setup Portal autoresize + SETUP_PORTAL_DEBUG=1 for windowed-mode debug. v2.9.57: Auto-update Windows fix. ⚠️ Pre-MVP / Development Phase",
5
+ "description": "4Runr AI Agent OS - Secure terminal interface for AI agents. v2.9.60: Setup Portal debug shows log file path. v2.9.59: File debug. ⚠️ Pre-MVP / Development Phase",
6
6
  "main": "dist/index.js",
7
7
  "bin": {
8
8
  "4runr": "dist/index.js",