@h-rig/cli 0.0.6-alpha.84 → 0.0.6-alpha.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin/rig.js CHANGED
@@ -27666,68 +27666,42 @@ function isTerminalScene(scene) {
27666
27666
  }
27667
27667
  function Backdrop(props) {
27668
27668
  const renderer = useRenderer();
27669
- const imageRef = useRef(null);
27670
27669
  const graphicsRef = useRef(null);
27671
27670
  useEffect(() => {
27672
- const imageVisuals = forceModernImageVisuals() ? new ImageVisualLayer(process.stdout, () => renderer.requestRender?.()) : null;
27673
- if (imageVisuals?.enabled) {
27674
- imageRef.current = imageVisuals;
27675
- } else {
27676
- const layout = computeStageLayout(renderer.width, renderer.height);
27677
- const graphics = createGraphicsLayer(renderer, layout);
27678
- renderer.root.add(graphics);
27679
- graphicsRef.current = graphics;
27680
- }
27671
+ const layout = computeStageLayout(renderer.width, renderer.height);
27672
+ const graphics = createGraphicsLayer(renderer, layout);
27673
+ renderer.root.add(graphics);
27674
+ graphicsRef.current = graphics;
27681
27675
  return () => {
27682
- imageRef.current?.destroy();
27683
- const graphics = graphicsRef.current;
27684
- if (graphics) {
27676
+ const g = graphicsRef.current;
27677
+ if (g) {
27685
27678
  try {
27686
- renderer.root.remove(graphics.id);
27679
+ renderer.root.remove(g.id);
27687
27680
  } catch {}
27688
27681
  }
27689
- imageRef.current = null;
27690
27682
  graphicsRef.current = null;
27691
27683
  };
27692
27684
  }, [renderer]);
27693
27685
  useEffect(() => {
27694
- const layout = computeStageLayout(renderer.width, renderer.height);
27695
- const image = imageRef.current;
27696
27686
  const graphics = graphicsRef.current;
27687
+ if (!graphics)
27688
+ return;
27689
+ const layout = computeStageLayout(renderer.width, renderer.height);
27697
27690
  if (layout.tooSmall) {
27698
- image?.clear();
27699
- if (graphics)
27700
- clearGraphicsLayer(graphics);
27691
+ clearGraphicsLayer(graphics);
27701
27692
  return;
27702
27693
  }
27703
27694
  const stats = fleetStatsFromState(props.state);
27704
- const tick = props.state.tick;
27705
- const animationTick = Math.floor(tick / ANIMATION_SLOWDOWN2);
27695
+ const animationTick = Math.floor(props.state.tick / ANIMATION_SLOWDOWN2);
27706
27696
  const panels = (props.frame.panels ?? []).map((panel) => ({ ...panel }));
27707
27697
  const terminalActive = props.frame.terminalActive ?? isTerminalScene(props.state.scene);
27708
27698
  const fullScreen = Boolean(props.frame.fullScreen);
27709
- if (image) {
27710
- if (terminalActive || fullScreen) {
27711
- image.clear();
27712
- } else {
27713
- image.render({
27714
- layout,
27715
- pixelSize: pixelSizeForRenderer(renderer),
27716
- panels,
27717
- scene: props.state.scene,
27718
- tick,
27719
- load: stats.load,
27720
- activeRuns: stats.active
27721
- });
27722
- }
27723
- } else if (graphics) {
27724
- resizeGraphicsLayer(graphics, layout);
27725
- if (terminalActive || fullScreen) {
27726
- clearGraphicsLayer(graphics);
27727
- } else {
27728
- drawAmbientField(graphics, layout, animationTick, props.state.scene, stats.load, stats.active);
27729
- drawPanelChrome(graphics, layout, panels);
27730
- }
27699
+ resizeGraphicsLayer(graphics, layout);
27700
+ if (terminalActive || fullScreen) {
27701
+ clearGraphicsLayer(graphics);
27702
+ } else {
27703
+ drawAmbientField(graphics, layout, animationTick, props.state.scene, stats.load, stats.active);
27704
+ drawPanelChrome(graphics, layout, panels);
27731
27705
  }
27732
27706
  });
27733
27707
  return null;
@@ -27735,7 +27709,6 @@ function Backdrop(props) {
27735
27709
  var ANIMATION_SLOWDOWN2 = 1;
27736
27710
  var init_Backdrop = __esm(() => {
27737
27711
  init_graphics();
27738
- init_image_visual_layer();
27739
27712
  init_fleet_stats();
27740
27713
  });
27741
27714
 
@@ -20675,68 +20675,42 @@ function isTerminalScene(scene) {
20675
20675
  }
20676
20676
  function Backdrop(props) {
20677
20677
  const renderer = useRenderer();
20678
- const imageRef = useRef(null);
20679
20678
  const graphicsRef = useRef(null);
20680
20679
  useEffect(() => {
20681
- const imageVisuals = forceModernImageVisuals() ? new ImageVisualLayer(process.stdout, () => renderer.requestRender?.()) : null;
20682
- if (imageVisuals?.enabled) {
20683
- imageRef.current = imageVisuals;
20684
- } else {
20685
- const layout = computeStageLayout(renderer.width, renderer.height);
20686
- const graphics = createGraphicsLayer(renderer, layout);
20687
- renderer.root.add(graphics);
20688
- graphicsRef.current = graphics;
20689
- }
20680
+ const layout = computeStageLayout(renderer.width, renderer.height);
20681
+ const graphics = createGraphicsLayer(renderer, layout);
20682
+ renderer.root.add(graphics);
20683
+ graphicsRef.current = graphics;
20690
20684
  return () => {
20691
- imageRef.current?.destroy();
20692
- const graphics = graphicsRef.current;
20693
- if (graphics) {
20685
+ const g = graphicsRef.current;
20686
+ if (g) {
20694
20687
  try {
20695
- renderer.root.remove(graphics.id);
20688
+ renderer.root.remove(g.id);
20696
20689
  } catch {}
20697
20690
  }
20698
- imageRef.current = null;
20699
20691
  graphicsRef.current = null;
20700
20692
  };
20701
20693
  }, [renderer]);
20702
20694
  useEffect(() => {
20703
- const layout = computeStageLayout(renderer.width, renderer.height);
20704
- const image = imageRef.current;
20705
20695
  const graphics = graphicsRef.current;
20696
+ if (!graphics)
20697
+ return;
20698
+ const layout = computeStageLayout(renderer.width, renderer.height);
20706
20699
  if (layout.tooSmall) {
20707
- image?.clear();
20708
- if (graphics)
20709
- clearGraphicsLayer(graphics);
20700
+ clearGraphicsLayer(graphics);
20710
20701
  return;
20711
20702
  }
20712
20703
  const stats = fleetStatsFromState(props.state);
20713
- const tick = props.state.tick;
20714
- const animationTick = Math.floor(tick / ANIMATION_SLOWDOWN2);
20704
+ const animationTick = Math.floor(props.state.tick / ANIMATION_SLOWDOWN2);
20715
20705
  const panels = (props.frame.panels ?? []).map((panel) => ({ ...panel }));
20716
20706
  const terminalActive = props.frame.terminalActive ?? isTerminalScene(props.state.scene);
20717
20707
  const fullScreen = Boolean(props.frame.fullScreen);
20718
- if (image) {
20719
- if (terminalActive || fullScreen) {
20720
- image.clear();
20721
- } else {
20722
- image.render({
20723
- layout,
20724
- pixelSize: pixelSizeForRenderer(renderer),
20725
- panels,
20726
- scene: props.state.scene,
20727
- tick,
20728
- load: stats.load,
20729
- activeRuns: stats.active
20730
- });
20731
- }
20732
- } else if (graphics) {
20733
- resizeGraphicsLayer(graphics, layout);
20734
- if (terminalActive || fullScreen) {
20735
- clearGraphicsLayer(graphics);
20736
- } else {
20737
- drawAmbientField(graphics, layout, animationTick, props.state.scene, stats.load, stats.active);
20738
- drawPanelChrome(graphics, layout, panels);
20739
- }
20708
+ resizeGraphicsLayer(graphics, layout);
20709
+ if (terminalActive || fullScreen) {
20710
+ clearGraphicsLayer(graphics);
20711
+ } else {
20712
+ drawAmbientField(graphics, layout, animationTick, props.state.scene, stats.load, stats.active);
20713
+ drawPanelChrome(graphics, layout, panels);
20740
20714
  }
20741
20715
  });
20742
20716
  return null;
@@ -20744,7 +20718,6 @@ function Backdrop(props) {
20744
20718
  var ANIMATION_SLOWDOWN2 = 1;
20745
20719
  var init_Backdrop = __esm(() => {
20746
20720
  init_graphics();
20747
- init_image_visual_layer();
20748
20721
  init_fleet_stats();
20749
20722
  });
20750
20723
 
@@ -3163,7 +3163,6 @@ var KITTY_CHUNK_SIZE = 4096;
3163
3163
  var PANEL_BLUR_SCALE = 1;
3164
3164
  var PANEL_MASK_CACHE_LIMIT = 16;
3165
3165
  var ZLIB_LEVEL = 1;
3166
- var DEFAULT_IMAGE_RESOLUTION_SCALE = 1;
3167
3166
  var LOAD_BUCKETS = 5;
3168
3167
  function loadBucket(load) {
3169
3168
  if (!Number.isFinite(load ?? NaN))
@@ -3178,12 +3177,6 @@ function imageTransport() {
3178
3177
  return "rgba-zlib";
3179
3178
  return "png";
3180
3179
  }
3181
- function imageResolutionScale() {
3182
- const raw = Number.parseFloat(process.env.RIG_OPENTUI_IMAGE_SCALE ?? "");
3183
- if (Number.isFinite(raw) && raw > 0)
3184
- return Math.max(0.25, Math.min(1, raw));
3185
- return DEFAULT_IMAGE_RESOLUTION_SCALE;
3186
- }
3187
3180
  function rgbaWord(color) {
3188
3181
  return (color[3] << 24 | color[2] << 16 | color[1] << 8 | color[0]) >>> 0;
3189
3182
  }
@@ -4075,18 +4068,6 @@ class ImageVisualLayer {
4075
4068
  this.dispatchWorkerRender(slot, next);
4076
4069
  }
4077
4070
  }
4078
- function pixelSizeForRenderer(renderer) {
4079
- const resolution = renderer.resolution;
4080
- const base = resolution?.width && resolution?.height ? resolution : { width: renderer.width * 12, height: renderer.height * 24 };
4081
- const scale = imageResolutionScale();
4082
- return {
4083
- width: Math.max(renderer.width, Math.floor(base.width * scale)),
4084
- height: Math.max(renderer.height, Math.floor(base.height * scale))
4085
- };
4086
- }
4087
- function forceModernImageVisuals() {
4088
- return getRigTerminalCapabilities().supportsKittyImages;
4089
- }
4090
4071
 
4091
4072
  // packages/cli/src/app-opentui/render/text.ts
4092
4073
  import { RGBA as RGBA4, TextAttributes as TextAttributes4, TextRenderable } from "@opentui/core";
@@ -4723,68 +4704,42 @@ function isTerminalScene(scene) {
4723
4704
  }
4724
4705
  function Backdrop(props) {
4725
4706
  const renderer = useRenderer();
4726
- const imageRef = useRef(null);
4727
4707
  const graphicsRef = useRef(null);
4728
4708
  useEffect(() => {
4729
- const imageVisuals = forceModernImageVisuals() ? new ImageVisualLayer(process.stdout, () => renderer.requestRender?.()) : null;
4730
- if (imageVisuals?.enabled) {
4731
- imageRef.current = imageVisuals;
4732
- } else {
4733
- const layout = computeStageLayout(renderer.width, renderer.height);
4734
- const graphics = createGraphicsLayer(renderer, layout);
4735
- renderer.root.add(graphics);
4736
- graphicsRef.current = graphics;
4737
- }
4709
+ const layout = computeStageLayout(renderer.width, renderer.height);
4710
+ const graphics = createGraphicsLayer(renderer, layout);
4711
+ renderer.root.add(graphics);
4712
+ graphicsRef.current = graphics;
4738
4713
  return () => {
4739
- imageRef.current?.destroy();
4740
- const graphics = graphicsRef.current;
4741
- if (graphics) {
4714
+ const g = graphicsRef.current;
4715
+ if (g) {
4742
4716
  try {
4743
- renderer.root.remove(graphics.id);
4717
+ renderer.root.remove(g.id);
4744
4718
  } catch {}
4745
4719
  }
4746
- imageRef.current = null;
4747
4720
  graphicsRef.current = null;
4748
4721
  };
4749
4722
  }, [renderer]);
4750
4723
  useEffect(() => {
4751
- const layout = computeStageLayout(renderer.width, renderer.height);
4752
- const image = imageRef.current;
4753
4724
  const graphics = graphicsRef.current;
4725
+ if (!graphics)
4726
+ return;
4727
+ const layout = computeStageLayout(renderer.width, renderer.height);
4754
4728
  if (layout.tooSmall) {
4755
- image?.clear();
4756
- if (graphics)
4757
- clearGraphicsLayer(graphics);
4729
+ clearGraphicsLayer(graphics);
4758
4730
  return;
4759
4731
  }
4760
4732
  const stats = fleetStatsFromState(props.state);
4761
- const tick = props.state.tick;
4762
- const animationTick = Math.floor(tick / ANIMATION_SLOWDOWN);
4733
+ const animationTick = Math.floor(props.state.tick / ANIMATION_SLOWDOWN);
4763
4734
  const panels = (props.frame.panels ?? []).map((panel) => ({ ...panel }));
4764
4735
  const terminalActive = props.frame.terminalActive ?? isTerminalScene(props.state.scene);
4765
4736
  const fullScreen = Boolean(props.frame.fullScreen);
4766
- if (image) {
4767
- if (terminalActive || fullScreen) {
4768
- image.clear();
4769
- } else {
4770
- image.render({
4771
- layout,
4772
- pixelSize: pixelSizeForRenderer(renderer),
4773
- panels,
4774
- scene: props.state.scene,
4775
- tick,
4776
- load: stats.load,
4777
- activeRuns: stats.active
4778
- });
4779
- }
4780
- } else if (graphics) {
4781
- resizeGraphicsLayer(graphics, layout);
4782
- if (terminalActive || fullScreen) {
4783
- clearGraphicsLayer(graphics);
4784
- } else {
4785
- drawAmbientField(graphics, layout, animationTick, props.state.scene, stats.load, stats.active);
4786
- drawPanelChrome(graphics, layout, panels);
4787
- }
4737
+ resizeGraphicsLayer(graphics, layout);
4738
+ if (terminalActive || fullScreen) {
4739
+ clearGraphicsLayer(graphics);
4740
+ } else {
4741
+ drawAmbientField(graphics, layout, animationTick, props.state.scene, stats.load, stats.active);
4742
+ drawPanelChrome(graphics, layout, panels);
4788
4743
  }
4789
4744
  });
4790
4745
  return null;