4runr-os 2.0.33 → 2.0.35

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.
@@ -2020,7 +2020,7 @@ async function handleDebug(ctx, args) {
2020
2020
  ts: Date.now(),
2021
2021
  tag: 'ERR',
2022
2022
  level: 'ERROR',
2023
- msg: 'Usage: debug <ui|geo|resize|resize-test|resize-torture|resize-trace|dump-layout|listeners|stdout>',
2023
+ msg: 'Usage: debug <ui|geo|resize|resize-test|resize-torture|resize-trace|layout|tree|dump-layout|listeners|stdout>',
2024
2024
  }],
2025
2025
  };
2026
2026
  }
@@ -2629,6 +2629,241 @@ async function handleDebug(ctx, args) {
2629
2629
  });
2630
2630
  return { events };
2631
2631
  }
2632
+ else if (subcommand === 'tree') {
2633
+ // Widget tree diagnostic - shows widget counts to detect duplication
2634
+ const { getUIRuntime } = await import('../ui/uiRuntime.js');
2635
+ const runtime = getUIRuntime();
2636
+ const screen = runtime.screen;
2637
+ const widgets = runtime.widgets;
2638
+ // Count widgets recursively
2639
+ function countWidgets(node, depth = 0) {
2640
+ const result = { total: 0, byName: {} };
2641
+ if (!node)
2642
+ return result;
2643
+ result.total = 1;
2644
+ // Try to identify widget by title or type
2645
+ const name = node.options?.title || node.options?.content || node.type || 'unknown';
2646
+ const shortName = name.substring(0, 30).replace(/\s+/g, '_');
2647
+ result.byName[shortName] = (result.byName[shortName] || 0) + 1;
2648
+ // Recursively count children
2649
+ if (node.children && Array.isArray(node.children)) {
2650
+ for (const child of node.children) {
2651
+ const childResult = countWidgets(child, depth + 1);
2652
+ result.total += childResult.total;
2653
+ // Merge byName
2654
+ for (const [n, count] of Object.entries(childResult.byName)) {
2655
+ result.byName[n] = (result.byName[n] || 0) + count;
2656
+ }
2657
+ }
2658
+ }
2659
+ return result;
2660
+ }
2661
+ // Count specific widgets
2662
+ const screenChildren = screen.children || [];
2663
+ const postureCount = screenChildren.filter((w) => w === widgets.posture).length;
2664
+ const resourcesCount = screenChildren.filter((w) => w === widgets.resources).length;
2665
+ const assetsCount = screenChildren.filter((w) => w === widgets.assets).length;
2666
+ const operationsCount = screenChildren.filter((w) => w === widgets.operations).length;
2667
+ const networkCount = screenChildren.filter((w) => w === widgets.network).length;
2668
+ const capabilitiesCount = screenChildren.filter((w) => w === widgets.capabilities).length;
2669
+ const commandLineCount = screenChildren.filter((w) => w === widgets.commandLine).length;
2670
+ const statusStripCount = screenChildren.filter((w) => w === widgets.statusStrip).length;
2671
+ const treeStats = countWidgets(screen);
2672
+ const events = [
2673
+ cmdEvent,
2674
+ {
2675
+ id: `dbg-tree-1-${Date.now()}`,
2676
+ ts: Date.now(),
2677
+ tag: 'DBG',
2678
+ level: 'INFO',
2679
+ msg: `=== WIDGET TREE DIAGNOSTIC ===`,
2680
+ },
2681
+ {
2682
+ id: `dbg-tree-2-${Date.now()}`,
2683
+ ts: Date.now(),
2684
+ tag: 'DBG',
2685
+ level: 'INFO',
2686
+ msg: ``,
2687
+ },
2688
+ {
2689
+ id: `dbg-tree-3-${Date.now()}`,
2690
+ ts: Date.now(),
2691
+ tag: 'DBG',
2692
+ level: 'INFO',
2693
+ msg: `screen.children.length: ${screenChildren.length} (expected: 8)`,
2694
+ },
2695
+ {
2696
+ id: `dbg-tree-4-${Date.now()}`,
2697
+ ts: Date.now(),
2698
+ tag: 'DBG',
2699
+ level: 'INFO',
2700
+ msg: `Total recursive nodes: ${treeStats.total}`,
2701
+ },
2702
+ {
2703
+ id: `dbg-tree-5-${Date.now()}`,
2704
+ ts: Date.now(),
2705
+ tag: 'DBG',
2706
+ level: 'INFO',
2707
+ msg: ``,
2708
+ },
2709
+ {
2710
+ id: `dbg-tree-6-${Date.now()}`,
2711
+ ts: Date.now(),
2712
+ tag: 'DBG',
2713
+ level: 'INFO',
2714
+ msg: `--- Panel Counts (must be 1 each) ---`,
2715
+ },
2716
+ {
2717
+ id: `dbg-tree-7-${Date.now()}`,
2718
+ ts: Date.now(),
2719
+ tag: 'DBG',
2720
+ level: postureCount === 1 ? 'INFO' : 'ERROR',
2721
+ msg: `POSTURE: ${postureCount} ${postureCount === 1 ? '✓' : '⚠ FAIL'}`,
2722
+ },
2723
+ {
2724
+ id: `dbg-tree-8-${Date.now()}`,
2725
+ ts: Date.now(),
2726
+ tag: 'DBG',
2727
+ level: resourcesCount === 1 ? 'INFO' : 'ERROR',
2728
+ msg: `RESOURCES: ${resourcesCount} ${resourcesCount === 1 ? '✓' : '⚠ FAIL'}`,
2729
+ },
2730
+ {
2731
+ id: `dbg-tree-9-${Date.now()}`,
2732
+ ts: Date.now(),
2733
+ tag: 'DBG',
2734
+ level: assetsCount === 1 ? 'INFO' : 'ERROR',
2735
+ msg: `ASSETS: ${assetsCount} ${assetsCount === 1 ? '✓' : '⚠ FAIL'}`,
2736
+ },
2737
+ {
2738
+ id: `dbg-tree-10-${Date.now()}`,
2739
+ ts: Date.now(),
2740
+ tag: 'DBG',
2741
+ level: operationsCount === 1 ? 'INFO' : 'ERROR',
2742
+ msg: `OPERATIONS: ${operationsCount} ${operationsCount === 1 ? '✓' : '⚠ FAIL'}`,
2743
+ },
2744
+ {
2745
+ id: `dbg-tree-11-${Date.now()}`,
2746
+ ts: Date.now(),
2747
+ tag: 'DBG',
2748
+ level: networkCount === 1 ? 'INFO' : 'ERROR',
2749
+ msg: `NETWORK: ${networkCount} ${networkCount === 1 ? '✓' : '⚠ FAIL'}`,
2750
+ },
2751
+ {
2752
+ id: `dbg-tree-12-${Date.now()}`,
2753
+ ts: Date.now(),
2754
+ tag: 'DBG',
2755
+ level: capabilitiesCount === 1 ? 'INFO' : 'ERROR',
2756
+ msg: `CAPABILITIES: ${capabilitiesCount} ${capabilitiesCount === 1 ? '✓' : '⚠ FAIL'}`,
2757
+ },
2758
+ {
2759
+ id: `dbg-tree-13-${Date.now()}`,
2760
+ ts: Date.now(),
2761
+ tag: 'DBG',
2762
+ level: commandLineCount === 1 ? 'INFO' : 'ERROR',
2763
+ msg: `COMMAND_LINE: ${commandLineCount} ${commandLineCount === 1 ? '✓' : '⚠ FAIL'}`,
2764
+ },
2765
+ {
2766
+ id: `dbg-tree-14-${Date.now()}`,
2767
+ ts: Date.now(),
2768
+ tag: 'DBG',
2769
+ level: statusStripCount === 1 ? 'INFO' : 'ERROR',
2770
+ msg: `STATUS_STRIP: ${statusStripCount} ${statusStripCount === 1 ? '✓' : '⚠ FAIL'}`,
2771
+ },
2772
+ {
2773
+ id: `dbg-tree-15-${Date.now()}`,
2774
+ ts: Date.now(),
2775
+ tag: 'DBG',
2776
+ level: 'INFO',
2777
+ msg: ``,
2778
+ },
2779
+ {
2780
+ id: `dbg-tree-16-${Date.now()}`,
2781
+ ts: Date.now(),
2782
+ tag: 'DBG',
2783
+ level: screenChildren.length === 8 ? 'INFO' : 'ERROR',
2784
+ msg: `${screenChildren.length === 8 ? '✓ PASS' : '⚠ FAIL'}: Total children count (${screenChildren.length} === 8)`,
2785
+ },
2786
+ {
2787
+ id: `dbg-tree-17-${Date.now()}`,
2788
+ ts: Date.now(),
2789
+ tag: 'DBG',
2790
+ level: 'INFO',
2791
+ msg: ``,
2792
+ },
2793
+ {
2794
+ id: `dbg-tree-18-${Date.now()}`,
2795
+ ts: Date.now(),
2796
+ tag: 'DBG',
2797
+ level: 'INFO',
2798
+ msg: `=== END TREE DIAGNOSTIC ===`,
2799
+ },
2800
+ {
2801
+ id: `dbg-tree-19-${Date.now()}`,
2802
+ ts: Date.now(),
2803
+ tag: 'DBG',
2804
+ level: 'INFO',
2805
+ msg: `Toggle fullscreen and run again to verify counts stay stable.`,
2806
+ },
2807
+ ];
2808
+ return { events };
2809
+ }
2810
+ else if (subcommand === 'layout') {
2811
+ // Layout overlay toggle - shows live layout instrumentation
2812
+ const { setLayoutOverlayEnabled, getLayoutOverlayEnabled } = await import('../ui/phase1RuntimeClean.js');
2813
+ if (args[1]?.toLowerCase() === 'on' || args[1]?.toLowerCase() === 'enable') {
2814
+ setLayoutOverlayEnabled(true);
2815
+ return {
2816
+ events: [
2817
+ cmdEvent,
2818
+ {
2819
+ id: `dbg-layout-${Date.now()}`,
2820
+ ts: Date.now(),
2821
+ tag: 'DBG',
2822
+ level: 'INFO',
2823
+ msg: 'Layout overlay ENABLED - live layout stats will show in Operations panel',
2824
+ },
2825
+ ],
2826
+ };
2827
+ }
2828
+ else if (args[1]?.toLowerCase() === 'off' || args[1]?.toLowerCase() === 'disable') {
2829
+ setLayoutOverlayEnabled(false);
2830
+ return {
2831
+ events: [
2832
+ cmdEvent,
2833
+ {
2834
+ id: `dbg-layout-${Date.now()}`,
2835
+ ts: Date.now(),
2836
+ tag: 'DBG',
2837
+ level: 'INFO',
2838
+ msg: 'Layout overlay DISABLED',
2839
+ },
2840
+ ],
2841
+ };
2842
+ }
2843
+ else {
2844
+ // Show current status
2845
+ const enabled = getLayoutOverlayEnabled();
2846
+ return {
2847
+ events: [
2848
+ cmdEvent,
2849
+ {
2850
+ id: `dbg-layout-status-${Date.now()}`,
2851
+ ts: Date.now(),
2852
+ tag: 'DBG',
2853
+ level: 'INFO',
2854
+ msg: `Layout overlay: ${enabled ? 'ENABLED' : 'DISABLED'}`,
2855
+ },
2856
+ {
2857
+ id: `dbg-layout-usage-${Date.now()}`,
2858
+ ts: Date.now(),
2859
+ tag: 'DBG',
2860
+ level: 'INFO',
2861
+ msg: `Usage: debug layout <on|off>`,
2862
+ },
2863
+ ],
2864
+ };
2865
+ }
2866
+ }
2632
2867
  else if (subcommand === 'resize-trace' || subcommand === 'trace-resize') {
2633
2868
  // Resize trace mode toggle
2634
2869
  const { setResizeTraceEnabled, getResizeTraceEnabled } = await import('../ui/phase1RuntimeClean.js');
@@ -3020,7 +3255,7 @@ async function handleDebug(ctx, args) {
3020
3255
  ts: Date.now(),
3021
3256
  tag: 'ERR',
3022
3257
  level: 'ERROR',
3023
- msg: `Unknown debug subcommand: ${subcommand} (try: ui, geo, resize, resize-test, resize-torture, resize-trace, dump-layout, fullscreen, listeners, stdout)`,
3258
+ msg: `Unknown debug subcommand: ${subcommand} (try: ui, geo, resize, resize-test, resize-torture, resize-trace, layout, tree, dump-layout, fullscreen, listeners, stdout)`,
3024
3259
  }],
3025
3260
  };
3026
3261
  }