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

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.
Files changed (206) hide show
  1. package/dist/bin/build-rig-binaries.js +40 -8
  2. package/dist/bin/rig.js +23402 -14577
  3. package/dist/src/app/board.js +217 -41
  4. package/dist/src/app-opentui/adapters/command.d.ts +2 -0
  5. package/dist/src/app-opentui/adapters/command.js +329 -0
  6. package/dist/src/app-opentui/adapters/common.js +2 -2
  7. package/dist/src/app-opentui/adapters/doctor.d.ts +0 -2
  8. package/dist/src/app-opentui/adapters/doctor.js +64 -39
  9. package/dist/src/app-opentui/adapters/family.d.ts +62 -0
  10. package/dist/src/app-opentui/adapters/family.js +14305 -0
  11. package/dist/src/app-opentui/adapters/fleet.d.ts +0 -2
  12. package/dist/src/app-opentui/adapters/fleet.js +90 -60
  13. package/dist/src/app-opentui/adapters/inbox.d.ts +12 -2
  14. package/dist/src/app-opentui/adapters/inbox.js +137 -78
  15. package/dist/src/app-opentui/adapters/init.d.ts +0 -2
  16. package/dist/src/app-opentui/adapters/init.js +85 -47
  17. package/dist/src/app-opentui/adapters/inspect.d.ts +52 -0
  18. package/dist/src/app-opentui/adapters/inspect.js +1024 -0
  19. package/dist/src/app-opentui/adapters/pi-attach.d.ts +15 -6
  20. package/dist/src/app-opentui/adapters/pi-attach.js +442 -125
  21. package/dist/src/app-opentui/adapters/pi.d.ts +23 -0
  22. package/dist/src/app-opentui/adapters/pi.js +363 -0
  23. package/dist/src/app-opentui/adapters/plugin.d.ts +84 -0
  24. package/dist/src/app-opentui/adapters/plugin.js +544 -0
  25. package/dist/src/app-opentui/adapters/repo.d.ts +37 -0
  26. package/dist/src/app-opentui/adapters/repo.js +186 -0
  27. package/dist/src/app-opentui/adapters/run-detail.d.ts +9 -2
  28. package/dist/src/app-opentui/adapters/run-detail.js +180 -63
  29. package/dist/src/app-opentui/adapters/server.d.ts +10 -2
  30. package/dist/src/app-opentui/adapters/server.js +191 -45
  31. package/dist/src/app-opentui/adapters/tasks.d.ts +11 -2
  32. package/dist/src/app-opentui/adapters/tasks.js +1123 -143
  33. package/dist/src/app-opentui/adapters/workspace.d.ts +49 -0
  34. package/dist/src/app-opentui/adapters/workspace.js +333 -0
  35. package/dist/src/app-opentui/autocomplete.d.ts +20 -0
  36. package/dist/src/app-opentui/autocomplete.js +576 -0
  37. package/dist/src/app-opentui/bootstrap.d.ts +1 -6
  38. package/dist/src/app-opentui/bootstrap.js +25252 -16474
  39. package/dist/src/app-opentui/command-palette.d.ts +3 -0
  40. package/dist/src/app-opentui/command-palette.js +1010 -0
  41. package/dist/src/app-opentui/command-pty-host.d.ts +62 -0
  42. package/dist/src/app-opentui/command-pty-host.js +248 -0
  43. package/dist/src/app-opentui/drone.js +8 -6
  44. package/dist/src/app-opentui/events.js +1 -1
  45. package/dist/src/app-opentui/fleet-stats.d.ts +32 -0
  46. package/dist/src/app-opentui/fleet-stats.js +114 -0
  47. package/dist/src/app-opentui/focus-manager.d.ts +14 -0
  48. package/dist/src/app-opentui/focus-manager.js +24 -0
  49. package/dist/src/app-opentui/index.js +5431 -2797
  50. package/dist/src/app-opentui/intent.js +179 -50
  51. package/dist/src/app-opentui/keymap.d.ts +21 -0
  52. package/dist/src/app-opentui/keymap.js +1748 -0
  53. package/dist/src/app-opentui/launch-routing.d.ts +16 -0
  54. package/dist/src/app-opentui/launch-routing.js +55 -0
  55. package/dist/src/app-opentui/layout.d.ts +7 -0
  56. package/dist/src/app-opentui/layout.js +13 -6
  57. package/dist/src/app-opentui/list-search.d.ts +24 -0
  58. package/dist/src/app-opentui/list-search.js +88 -1
  59. package/dist/src/app-opentui/pi-host-child.js +99 -17
  60. package/dist/src/app-opentui/pi-pty-host.d.ts +14 -0
  61. package/dist/src/app-opentui/pi-pty-host.js +30 -14
  62. package/dist/src/app-opentui/react/App.d.ts +9 -0
  63. package/dist/src/app-opentui/react/App.js +5144 -0
  64. package/dist/src/app-opentui/react/Backdrop.d.ts +5 -0
  65. package/dist/src/app-opentui/react/Backdrop.js +1834 -0
  66. package/dist/src/app-opentui/react/ChromeHost.d.ts +5 -0
  67. package/dist/src/app-opentui/react/ChromeHost.js +2942 -0
  68. package/dist/src/app-opentui/react/SceneFrameView.d.ts +7 -0
  69. package/dist/src/app-opentui/react/SceneFrameView.js +529 -0
  70. package/dist/src/app-opentui/react/context.d.ts +17 -0
  71. package/dist/src/app-opentui/react/context.js +37 -0
  72. package/dist/src/app-opentui/react/launch.d.ts +2 -0
  73. package/dist/src/app-opentui/react/launch.js +5743 -0
  74. package/dist/src/app-opentui/react/nav.d.ts +18 -0
  75. package/dist/src/app-opentui/react/nav.js +54 -0
  76. package/dist/src/app-opentui/react/scroll.d.ts +12 -0
  77. package/dist/src/app-opentui/react/scroll.js +21 -0
  78. package/dist/src/app-opentui/react/syntax.d.ts +2 -0
  79. package/dist/src/app-opentui/react/syntax.js +64 -0
  80. package/dist/src/app-opentui/registry.js +20428 -4828
  81. package/dist/src/app-opentui/render/ascii-fleet.d.ts +15 -0
  82. package/dist/src/app-opentui/render/ascii-fleet.js +82 -0
  83. package/dist/src/app-opentui/render/constants.d.ts +31 -0
  84. package/dist/src/app-opentui/render/constants.js +66 -0
  85. package/dist/src/app-opentui/render/graphics.d.ts +2 -1
  86. package/dist/src/app-opentui/render/graphics.js +228 -46
  87. package/dist/src/app-opentui/render/image-visual-layer-worker.js +469 -930
  88. package/dist/src/app-opentui/render/image-visual-layer.d.ts +25 -10
  89. package/dist/src/app-opentui/render/image-visual-layer.js +448 -329
  90. package/dist/src/app-opentui/render/native-host.d.ts +37 -0
  91. package/dist/src/app-opentui/render/native-host.js +179 -0
  92. package/dist/src/app-opentui/render/panel-layout.d.ts +38 -0
  93. package/dist/src/app-opentui/render/panel-layout.js +48 -0
  94. package/dist/src/app-opentui/render/panels.d.ts +2 -0
  95. package/dist/src/app-opentui/render/panels.js +78 -38
  96. package/dist/src/app-opentui/render/preloader.d.ts +10 -0
  97. package/dist/src/app-opentui/render/preloader.js +165 -0
  98. package/dist/src/app-opentui/render/scene.d.ts +53 -1
  99. package/dist/src/app-opentui/render/scene.js +195 -6
  100. package/dist/src/app-opentui/render/text.d.ts +7 -1
  101. package/dist/src/app-opentui/render/text.js +15 -8
  102. package/dist/src/app-opentui/render/type-bar.d.ts +2 -1
  103. package/dist/src/app-opentui/render/type-bar.js +113 -39
  104. package/dist/src/app-opentui/runtime-resources.d.ts +16 -0
  105. package/dist/src/app-opentui/runtime-resources.js +62 -0
  106. package/dist/src/app-opentui/runtime.d.ts +44 -1
  107. package/dist/src/app-opentui/runtime.js +5415 -2738
  108. package/dist/src/app-opentui/scenes/command.d.ts +3 -0
  109. package/dist/src/app-opentui/scenes/command.js +117 -0
  110. package/dist/src/app-opentui/scenes/doctor.d.ts +2 -1
  111. package/dist/src/app-opentui/scenes/doctor.js +221 -17
  112. package/dist/src/app-opentui/scenes/error.js +60 -20
  113. package/dist/src/app-opentui/scenes/family-domains/agent.d.ts +2 -0
  114. package/dist/src/app-opentui/scenes/family-domains/agent.js +348 -0
  115. package/dist/src/app-opentui/scenes/family-domains/browser.d.ts +2 -0
  116. package/dist/src/app-opentui/scenes/family-domains/browser.js +195 -0
  117. package/dist/src/app-opentui/scenes/family-domains/dist.d.ts +2 -0
  118. package/dist/src/app-opentui/scenes/family-domains/dist.js +243 -0
  119. package/dist/src/app-opentui/scenes/family-domains/git.d.ts +2 -0
  120. package/dist/src/app-opentui/scenes/family-domains/git.js +195 -0
  121. package/dist/src/app-opentui/scenes/family-domains/github.d.ts +2 -0
  122. package/dist/src/app-opentui/scenes/family-domains/github.js +274 -0
  123. package/dist/src/app-opentui/scenes/family-domains/harness.d.ts +2 -0
  124. package/dist/src/app-opentui/scenes/family-domains/harness.js +152 -0
  125. package/dist/src/app-opentui/scenes/family-domains/index.d.ts +4 -0
  126. package/dist/src/app-opentui/scenes/family-domains/index.js +1679 -0
  127. package/dist/src/app-opentui/scenes/family-domains/kit.d.ts +76 -0
  128. package/dist/src/app-opentui/scenes/family-domains/kit.js +305 -0
  129. package/dist/src/app-opentui/scenes/family-domains/profile.d.ts +2 -0
  130. package/dist/src/app-opentui/scenes/family-domains/profile.js +212 -0
  131. package/dist/src/app-opentui/scenes/family-domains/queue.d.ts +2 -0
  132. package/dist/src/app-opentui/scenes/family-domains/queue.js +146 -0
  133. package/dist/src/app-opentui/scenes/family-domains/remote.d.ts +2 -0
  134. package/dist/src/app-opentui/scenes/family-domains/remote.js +518 -0
  135. package/dist/src/app-opentui/scenes/family-domains/review.d.ts +2 -0
  136. package/dist/src/app-opentui/scenes/family-domains/review.js +280 -0
  137. package/dist/src/app-opentui/scenes/family-domains/setup.d.ts +2 -0
  138. package/dist/src/app-opentui/scenes/family-domains/setup.js +267 -0
  139. package/dist/src/app-opentui/scenes/family-domains/stats.d.ts +2 -0
  140. package/dist/src/app-opentui/scenes/family-domains/stats.js +370 -0
  141. package/dist/src/app-opentui/scenes/family.d.ts +3 -0
  142. package/dist/src/app-opentui/scenes/family.js +2144 -0
  143. package/dist/src/app-opentui/scenes/fleet.js +552 -43
  144. package/dist/src/app-opentui/scenes/handoff.js +342 -35
  145. package/dist/src/app-opentui/scenes/help.js +640 -56
  146. package/dist/src/app-opentui/scenes/inbox.d.ts +2 -1
  147. package/dist/src/app-opentui/scenes/inbox.js +329 -21
  148. package/dist/src/app-opentui/scenes/init.d.ts +2 -1
  149. package/dist/src/app-opentui/scenes/init.js +120 -34
  150. package/dist/src/app-opentui/scenes/inspect.d.ts +3 -0
  151. package/dist/src/app-opentui/scenes/inspect.js +793 -0
  152. package/dist/src/app-opentui/scenes/main.d.ts +2 -1
  153. package/dist/src/app-opentui/scenes/main.js +264 -29
  154. package/dist/src/app-opentui/scenes/pi.d.ts +3 -0
  155. package/dist/src/app-opentui/scenes/pi.js +508 -0
  156. package/dist/src/app-opentui/scenes/plugin.d.ts +3 -0
  157. package/dist/src/app-opentui/scenes/plugin.js +486 -0
  158. package/dist/src/app-opentui/scenes/repo.d.ts +3 -0
  159. package/dist/src/app-opentui/scenes/repo.js +424 -0
  160. package/dist/src/app-opentui/scenes/run-detail.d.ts +2 -1
  161. package/dist/src/app-opentui/scenes/run-detail.js +362 -35
  162. package/dist/src/app-opentui/scenes/server.d.ts +2 -1
  163. package/dist/src/app-opentui/scenes/server.js +243 -26
  164. package/dist/src/app-opentui/scenes/tasks.js +518 -41
  165. package/dist/src/app-opentui/scenes/workspace.d.ts +3 -0
  166. package/dist/src/app-opentui/scenes/workspace.js +426 -0
  167. package/dist/src/app-opentui/selectable.d.ts +19 -0
  168. package/dist/src/app-opentui/selectable.js +79 -0
  169. package/dist/src/app-opentui/state.js +129 -36
  170. package/dist/src/app-opentui/surface-catalog.d.ts +20 -0
  171. package/dist/src/app-opentui/surface-catalog.js +540 -0
  172. package/dist/src/app-opentui/terminal-capabilities.d.ts +7 -0
  173. package/dist/src/app-opentui/terminal-capabilities.js +15 -0
  174. package/dist/src/app-opentui/theme.d.ts +28 -6
  175. package/dist/src/app-opentui/theme.js +61 -8
  176. package/dist/src/app-opentui/types.d.ts +130 -5
  177. package/dist/src/commands/_authority-runs.d.ts +1 -1
  178. package/dist/src/commands/_authority-runs.js +2 -12
  179. package/dist/src/commands/_doctor-checks.js +62 -13
  180. package/dist/src/commands/_help-catalog.js +95 -15
  181. package/dist/src/commands/_operator-view.js +97 -15
  182. package/dist/src/commands/_pi-frontend.d.ts +2 -0
  183. package/dist/src/commands/_pi-frontend.js +97 -13
  184. package/dist/src/commands/_preflight.js +64 -14
  185. package/dist/src/commands/_server-client.js +82 -18
  186. package/dist/src/commands/_server-events.d.ts +26 -0
  187. package/dist/src/commands/_server-events.js +310 -0
  188. package/dist/src/commands/_snapshot-upload.js +62 -13
  189. package/dist/src/commands/agent.js +2 -12
  190. package/dist/src/commands/connect.js +7 -1
  191. package/dist/src/commands/doctor.js +62 -13
  192. package/dist/src/commands/github.js +144 -23
  193. package/dist/src/commands/inbox.js +62 -13
  194. package/dist/src/commands/init.js +82 -18
  195. package/dist/src/commands/inspect.js +62 -13
  196. package/dist/src/commands/run.js +100 -15
  197. package/dist/src/commands/server.js +71 -26
  198. package/dist/src/commands/setup.js +62 -13
  199. package/dist/src/commands/stats.js +157 -28
  200. package/dist/src/commands/task-run-driver.js +64 -25
  201. package/dist/src/commands/task.js +196 -43
  202. package/dist/src/commands.js +419 -123
  203. package/dist/src/index.js +426 -130
  204. package/package.json +11 -10
  205. package/dist/src/app-opentui/render/image-visual-layer-native-canvas.d.ts +0 -2
  206. package/dist/src/app-opentui/render/image-visual-layer-native-canvas.js +0 -1484
@@ -0,0 +1,15 @@
1
+ export declare const FLEET_GRID_WIDTH = 52;
2
+ export declare const FLEET_GRID_HEIGHT = 27;
3
+ export type FleetSprite = {
4
+ readonly art: readonly string[];
5
+ readonly x: number;
6
+ readonly y: number;
7
+ readonly amp: number;
8
+ readonly speed: number;
9
+ readonly phase: number;
10
+ readonly dx: number;
11
+ readonly driftSpeed: number;
12
+ };
13
+ export declare function fleetRows(tick: number, options?: {
14
+ readonly animate?: boolean;
15
+ }): string[];
@@ -0,0 +1,82 @@
1
+ // @bun
2
+ // packages/cli/src/app-opentui/render/ascii-fleet.ts
3
+ var LEAD_DRONE = [
4
+ " .-=-. .-=-. ",
5
+ " ( !!! ) ( !!! ) ",
6
+ " '-=-'._ _.'-=-' ",
7
+ " '._ _.' ",
8
+ " '=$$$$$$$=.' ",
9
+ " =$$$$$$$$$$$= ",
10
+ " $$$@@@@@@@@@@$$$ ",
11
+ " $$$@@ @@$$$ ",
12
+ " $$@ ? @$$$ ",
13
+ " $$$@ '-' @$$$ ",
14
+ " $$$@@ @@$$$ ",
15
+ " $$$@@@@@@@@@@$$$ ",
16
+ " =$$$$$$$$$$$= ",
17
+ " '=$$$$$$$=.' ",
18
+ " _.' '._ ",
19
+ " .-=-.' '.-=-. ",
20
+ " ( !!! ) ( !!! ) ",
21
+ " '-=-' '-=-' "
22
+ ];
23
+ var MINI_DRONE = [
24
+ "(!!!) (!!!)",
25
+ " \\%==%/ ",
26
+ " %%?%% ",
27
+ " /%==%\\ ",
28
+ "(!!!) (!!!)"
29
+ ];
30
+ var ROTORS = ["---", "\\\\\\", "|||", "///"];
31
+ var FLEET_GRID_WIDTH = 52;
32
+ var FLEET_GRID_HEIGHT = 27;
33
+ var FLEET = [
34
+ { art: MINI_DRONE, x: 0, y: 2, amp: 1, speed: 0.05, phase: 0, dx: 1, driftSpeed: 0.02 },
35
+ { art: MINI_DRONE, x: 39, y: 2, amp: 1, speed: 0.044, phase: 2.1, dx: 1, driftSpeed: 0.017 },
36
+ { art: MINI_DRONE, x: 1, y: 20, amp: 1, speed: 0.048, phase: 4.2, dx: 1, driftSpeed: 0.023 },
37
+ { art: MINI_DRONE, x: 38, y: 20, amp: 1, speed: 0.041, phase: 1.3, dx: 1, driftSpeed: 0.015 },
38
+ { art: LEAD_DRONE, x: 10, y: 5, amp: 2, speed: 0.04, phase: 0, dx: 0, driftSpeed: 0.011 }
39
+ ];
40
+ function fleetRows(tick, options = {}) {
41
+ const animate = options.animate ?? true;
42
+ const t = animate ? tick : 0;
43
+ const blade = ROTORS[Math.floor(t / 4) % ROTORS.length];
44
+ const pulse = Math.sin(t * 0.07);
45
+ const eye = pulse > 0.45 ? "@" : pulse > -0.1 ? "o" : ".";
46
+ const grid = Array.from({ length: FLEET_GRID_HEIGHT }, () => Array.from({ length: FLEET_GRID_WIDTH }, () => " "));
47
+ for (const drone of FLEET) {
48
+ const yOffset = drone.y + Math.round(drone.amp * Math.sin(t * drone.speed + drone.phase));
49
+ const xOffset = drone.x + Math.round(drone.dx * Math.sin(t * drone.driftSpeed + drone.phase));
50
+ for (let row = 0;row < drone.art.length; row += 1) {
51
+ const source = drone.art[row];
52
+ const targetY = yOffset + row;
53
+ if (targetY < 0 || targetY >= FLEET_GRID_HEIGHT)
54
+ continue;
55
+ for (let col = 0;col < source.length; col += 1) {
56
+ let char = source[col];
57
+ if (char === " ")
58
+ continue;
59
+ const targetX = xOffset + col;
60
+ if (targetX < 0 || targetX >= FLEET_GRID_WIDTH)
61
+ continue;
62
+ if (source.slice(col, col + 3) === "!!!") {
63
+ for (let rotorIndex = 0;rotorIndex < 3; rotorIndex += 1) {
64
+ if (targetX + rotorIndex < FLEET_GRID_WIDTH)
65
+ grid[targetY][targetX + rotorIndex] = blade[rotorIndex];
66
+ }
67
+ col += 2;
68
+ continue;
69
+ }
70
+ if (char === "?")
71
+ char = eye;
72
+ grid[targetY][targetX] = char;
73
+ }
74
+ }
75
+ }
76
+ return grid.map((row) => row.join("").replace(/\s+$/, ""));
77
+ }
78
+ export {
79
+ fleetRows,
80
+ FLEET_GRID_WIDTH,
81
+ FLEET_GRID_HEIGHT
82
+ };
@@ -0,0 +1,31 @@
1
+ export declare const LCG_MULTIPLIER = 1664525;
2
+ export declare const LCG_INCREMENT = 1013904223;
3
+ export declare const LCG_DIVISOR = 4294967295;
4
+ export declare const PACKET_CYAN_PROBABILITY = 0.22;
5
+ export declare const LANE_INTERP_STEPS = 32;
6
+ export declare const LANE_LEN_BASE = 0.32;
7
+ export declare const LANE_LEN_SPREAD = 0.42;
8
+ export declare const LANE_CURVE_RANGE = 0.7;
9
+ export declare const PACKET_SPEED_BASE = 0.003;
10
+ export declare const PACKET_SPEED_SPREAD = 0.009;
11
+ export declare const DISPATCH_LANES_COMPACT = 7;
12
+ export declare const DISPATCH_LANES_WIDE = 12;
13
+ export declare const DISPATCH_PACKETS_COMPACT = 70;
14
+ export declare const DISPATCH_PACKETS_WIDE = 150;
15
+ export declare const CARRIER_NODES_COMPACT = 5;
16
+ export declare const CARRIER_NODES_WIDE = 7;
17
+ export declare const LOOP_GATES_COMPACT = 4;
18
+ export declare const LOOP_GATES_WIDE = 5;
19
+ export declare const DISPATCH_DRONES_COMPACT = 4;
20
+ export declare const DISPATCH_DRONES_WIDE = 8;
21
+ export declare const CORE_DISPATCH_X = 0.3;
22
+ export declare const CORE_DISPATCH_Y = 0.45;
23
+ export declare const CORE_CARRIER_X = 0.5;
24
+ export declare const CORE_CARRIER_Y = 0.54;
25
+ export declare const CORE_LOOP_X = 0.09;
26
+ export declare const CORE_LOOP_Y = 0.56;
27
+ export declare const RAIL_YS_LOOP: readonly [0.18, 0.5, 0.82];
28
+ export declare const RAIL_YS_CARRIER: readonly [0.24, 0.54, 0.82];
29
+ export declare const RAIL_YS_DISPATCH: readonly [0.18, 0.58, 0.82];
30
+ export declare const GLOW_FALLOFF_EXP_ASCII = 2.2;
31
+ export declare const GLOW_FALLOFF_EXP_IMAGE = 2.4;
@@ -0,0 +1,66 @@
1
+ // @bun
2
+ // packages/cli/src/app-opentui/render/constants.ts
3
+ var LCG_MULTIPLIER = 1664525;
4
+ var LCG_INCREMENT = 1013904223;
5
+ var LCG_DIVISOR = 4294967295;
6
+ var PACKET_CYAN_PROBABILITY = 0.22;
7
+ var LANE_INTERP_STEPS = 32;
8
+ var LANE_LEN_BASE = 0.32;
9
+ var LANE_LEN_SPREAD = 0.42;
10
+ var LANE_CURVE_RANGE = 0.7;
11
+ var PACKET_SPEED_BASE = 0.003;
12
+ var PACKET_SPEED_SPREAD = 0.009;
13
+ var DISPATCH_LANES_COMPACT = 7;
14
+ var DISPATCH_LANES_WIDE = 12;
15
+ var DISPATCH_PACKETS_COMPACT = 70;
16
+ var DISPATCH_PACKETS_WIDE = 150;
17
+ var CARRIER_NODES_COMPACT = 5;
18
+ var CARRIER_NODES_WIDE = 7;
19
+ var LOOP_GATES_COMPACT = 4;
20
+ var LOOP_GATES_WIDE = 5;
21
+ var DISPATCH_DRONES_COMPACT = 4;
22
+ var DISPATCH_DRONES_WIDE = 8;
23
+ var CORE_DISPATCH_X = 0.3;
24
+ var CORE_DISPATCH_Y = 0.45;
25
+ var CORE_CARRIER_X = 0.5;
26
+ var CORE_CARRIER_Y = 0.54;
27
+ var CORE_LOOP_X = 0.09;
28
+ var CORE_LOOP_Y = 0.56;
29
+ var RAIL_YS_LOOP = [0.18, 0.5, 0.82];
30
+ var RAIL_YS_CARRIER = [0.24, 0.54, 0.82];
31
+ var RAIL_YS_DISPATCH = [0.18, 0.58, 0.82];
32
+ var GLOW_FALLOFF_EXP_ASCII = 2.2;
33
+ var GLOW_FALLOFF_EXP_IMAGE = 2.4;
34
+ export {
35
+ RAIL_YS_LOOP,
36
+ RAIL_YS_DISPATCH,
37
+ RAIL_YS_CARRIER,
38
+ PACKET_SPEED_SPREAD,
39
+ PACKET_SPEED_BASE,
40
+ PACKET_CYAN_PROBABILITY,
41
+ LOOP_GATES_WIDE,
42
+ LOOP_GATES_COMPACT,
43
+ LCG_MULTIPLIER,
44
+ LCG_INCREMENT,
45
+ LCG_DIVISOR,
46
+ LANE_LEN_SPREAD,
47
+ LANE_LEN_BASE,
48
+ LANE_INTERP_STEPS,
49
+ LANE_CURVE_RANGE,
50
+ GLOW_FALLOFF_EXP_IMAGE,
51
+ GLOW_FALLOFF_EXP_ASCII,
52
+ DISPATCH_PACKETS_WIDE,
53
+ DISPATCH_PACKETS_COMPACT,
54
+ DISPATCH_LANES_WIDE,
55
+ DISPATCH_LANES_COMPACT,
56
+ DISPATCH_DRONES_WIDE,
57
+ DISPATCH_DRONES_COMPACT,
58
+ CORE_LOOP_Y,
59
+ CORE_LOOP_X,
60
+ CORE_DISPATCH_Y,
61
+ CORE_DISPATCH_X,
62
+ CORE_CARRIER_Y,
63
+ CORE_CARRIER_X,
64
+ CARRIER_NODES_WIDE,
65
+ CARRIER_NODES_COMPACT
66
+ };
@@ -3,6 +3,7 @@ import type { StageLayout } from "../layout";
3
3
  import type { AppSceneId, AppScenePanel } from "../types";
4
4
  export type RigGraphicsLayer = FrameBufferRenderable & {
5
5
  __rigMarketingCanvas?: MarketingGlyphCanvas;
6
+ __rigAmbientKey?: string;
6
7
  };
7
8
  declare class MarketingGlyphCanvas {
8
9
  private rand;
@@ -34,6 +35,6 @@ export declare function createGraphicsLayer(renderer: CliRenderer, layout: Stage
34
35
  export declare function resizeGraphicsLayer(layer: RigGraphicsLayer, layout: StageLayout): void;
35
36
  export declare function clearGraphicsLayer(layer: RigGraphicsLayer): void;
36
37
  export declare function drawPanelChrome(layer: RigGraphicsLayer, layout: StageLayout, panels: readonly AppScenePanel[]): void;
37
- export declare function drawAmbientField(layer: RigGraphicsLayer, layout: StageLayout, tick: number, scene?: AppSceneId): void;
38
+ export declare function drawAmbientField(layer: RigGraphicsLayer, layout: StageLayout, _tick: number, scene?: AppSceneId, load?: number, activeRuns?: number): void;
38
39
  export declare function drawSparkline(layer: RigGraphicsLayer, x: number, y: number, values: readonly number[], color?: RGBA): void;
39
40
  export {};
@@ -14,15 +14,17 @@ var RIG_UI = {
14
14
  bg: "#070809",
15
15
  bg2: "#0b0c0e",
16
16
  panel: "#101115",
17
- panel2: "#101115",
18
- glass: "#14161b",
19
- ink: "#f2f3f6",
20
- ink2: "#aeb0ba",
21
- ink3: "#6c6e79",
22
- ink4: "#44464f",
17
+ panel2: "#14161b",
18
+ glass: "#1e2230",
19
+ border: "#2a2e3a",
20
+ ink: "#f4f5f8",
21
+ ink2: "#c7c9d3",
22
+ ink3: "#9aa0ae",
23
+ ink4: "#787b86",
23
24
  lime: "#ccff4d",
24
25
  limeDim: "#a9d63f",
25
26
  cyan: "#56d8ff",
27
+ cyanDim: "#3f9fbd",
26
28
  red: "#ff5d5d",
27
29
  yellow: "#ffd24d",
28
30
  magenta: "#ff79b0"
@@ -40,7 +42,134 @@ var styles = {
40
42
  magenta: otuiFg(RIG_UI.magenta)
41
43
  };
42
44
 
45
+ // packages/cli/src/app-opentui/render/ascii-fleet.ts
46
+ var LEAD_DRONE = [
47
+ " .-=-. .-=-. ",
48
+ " ( !!! ) ( !!! ) ",
49
+ " '-=-'._ _.'-=-' ",
50
+ " '._ _.' ",
51
+ " '=$$$$$$$=.' ",
52
+ " =$$$$$$$$$$$= ",
53
+ " $$$@@@@@@@@@@$$$ ",
54
+ " $$$@@ @@$$$ ",
55
+ " $$@ ? @$$$ ",
56
+ " $$$@ '-' @$$$ ",
57
+ " $$$@@ @@$$$ ",
58
+ " $$$@@@@@@@@@@$$$ ",
59
+ " =$$$$$$$$$$$= ",
60
+ " '=$$$$$$$=.' ",
61
+ " _.' '._ ",
62
+ " .-=-.' '.-=-. ",
63
+ " ( !!! ) ( !!! ) ",
64
+ " '-=-' '-=-' "
65
+ ];
66
+ var MINI_DRONE = [
67
+ "(!!!) (!!!)",
68
+ " \\%==%/ ",
69
+ " %%?%% ",
70
+ " /%==%\\ ",
71
+ "(!!!) (!!!)"
72
+ ];
73
+ var ROTORS = ["---", "\\\\\\", "|||", "///"];
74
+ var FLEET_GRID_WIDTH = 52;
75
+ var FLEET_GRID_HEIGHT = 27;
76
+ var FLEET = [
77
+ { art: MINI_DRONE, x: 0, y: 2, amp: 1, speed: 0.05, phase: 0, dx: 1, driftSpeed: 0.02 },
78
+ { art: MINI_DRONE, x: 39, y: 2, amp: 1, speed: 0.044, phase: 2.1, dx: 1, driftSpeed: 0.017 },
79
+ { art: MINI_DRONE, x: 1, y: 20, amp: 1, speed: 0.048, phase: 4.2, dx: 1, driftSpeed: 0.023 },
80
+ { art: MINI_DRONE, x: 38, y: 20, amp: 1, speed: 0.041, phase: 1.3, dx: 1, driftSpeed: 0.015 },
81
+ { art: LEAD_DRONE, x: 10, y: 5, amp: 2, speed: 0.04, phase: 0, dx: 0, driftSpeed: 0.011 }
82
+ ];
83
+ function fleetRows(tick, options = {}) {
84
+ const animate = options.animate ?? true;
85
+ const t2 = animate ? tick : 0;
86
+ const blade = ROTORS[Math.floor(t2 / 4) % ROTORS.length];
87
+ const pulse = Math.sin(t2 * 0.07);
88
+ const eye = pulse > 0.45 ? "@" : pulse > -0.1 ? "o" : ".";
89
+ const grid = Array.from({ length: FLEET_GRID_HEIGHT }, () => Array.from({ length: FLEET_GRID_WIDTH }, () => " "));
90
+ for (const drone of FLEET) {
91
+ const yOffset = drone.y + Math.round(drone.amp * Math.sin(t2 * drone.speed + drone.phase));
92
+ const xOffset = drone.x + Math.round(drone.dx * Math.sin(t2 * drone.driftSpeed + drone.phase));
93
+ for (let row = 0;row < drone.art.length; row += 1) {
94
+ const source = drone.art[row];
95
+ const targetY = yOffset + row;
96
+ if (targetY < 0 || targetY >= FLEET_GRID_HEIGHT)
97
+ continue;
98
+ for (let col = 0;col < source.length; col += 1) {
99
+ let char = source[col];
100
+ if (char === " ")
101
+ continue;
102
+ const targetX = xOffset + col;
103
+ if (targetX < 0 || targetX >= FLEET_GRID_WIDTH)
104
+ continue;
105
+ if (source.slice(col, col + 3) === "!!!") {
106
+ for (let rotorIndex = 0;rotorIndex < 3; rotorIndex += 1) {
107
+ if (targetX + rotorIndex < FLEET_GRID_WIDTH)
108
+ grid[targetY][targetX + rotorIndex] = blade[rotorIndex];
109
+ }
110
+ col += 2;
111
+ continue;
112
+ }
113
+ if (char === "?")
114
+ char = eye;
115
+ grid[targetY][targetX] = char;
116
+ }
117
+ }
118
+ }
119
+ return grid.map((row) => row.join("").replace(/\s+$/, ""));
120
+ }
121
+
122
+ // packages/cli/src/app-opentui/render/panel-layout.ts
123
+ function panelCellRect(layout, panel) {
124
+ const left = Math.max(0, Math.min(layout.width - 1, layout.centerLeft + (panel.left ?? 0)));
125
+ const desiredWidth = panel.width ?? layout.centerWidth;
126
+ const width = Math.max(1, Math.min(layout.width - left, desiredWidth));
127
+ const top = Math.max(0, Math.min(layout.height - 1, layout.centerTop + panel.top));
128
+ const height = Math.max(1, Math.min(layout.height - top, panel.height));
129
+ if (width <= 3 || height <= 3)
130
+ return null;
131
+ const right = left + width - 1;
132
+ const bottom = top + height - 1;
133
+ const headerHeight = panel.chrome === "ad-terminal" ? Math.max(3, Math.min(height - 2, panel.headerHeight ?? 3)) : 0;
134
+ const dividerY = headerHeight ? Math.min(bottom - 1, top + headerHeight) : top;
135
+ return { left, top, width, height, right, bottom, headerHeight, dividerY };
136
+ }
137
+
138
+ // packages/cli/src/app-opentui/render/constants.ts
139
+ var LCG_MULTIPLIER = 1664525;
140
+ var LCG_INCREMENT = 1013904223;
141
+ var LCG_DIVISOR = 4294967295;
142
+ var PACKET_CYAN_PROBABILITY = 0.22;
143
+ var LANE_INTERP_STEPS = 32;
144
+ var LANE_LEN_BASE = 0.32;
145
+ var LANE_LEN_SPREAD = 0.42;
146
+ var LANE_CURVE_RANGE = 0.7;
147
+ var PACKET_SPEED_BASE = 0.003;
148
+ var PACKET_SPEED_SPREAD = 0.009;
149
+ var DISPATCH_LANES_COMPACT = 7;
150
+ var DISPATCH_LANES_WIDE = 12;
151
+ var DISPATCH_PACKETS_COMPACT = 70;
152
+ var DISPATCH_PACKETS_WIDE = 150;
153
+ var CARRIER_NODES_COMPACT = 5;
154
+ var CARRIER_NODES_WIDE = 7;
155
+ var LOOP_GATES_COMPACT = 4;
156
+ var LOOP_GATES_WIDE = 5;
157
+ var DISPATCH_DRONES_COMPACT = 4;
158
+ var DISPATCH_DRONES_WIDE = 8;
159
+ var CORE_DISPATCH_X = 0.3;
160
+ var CORE_DISPATCH_Y = 0.45;
161
+ var CORE_CARRIER_X = 0.5;
162
+ var CORE_CARRIER_Y = 0.54;
163
+ var CORE_LOOP_X = 0.09;
164
+ var CORE_LOOP_Y = 0.56;
165
+ var RAIL_YS_LOOP = [0.18, 0.5, 0.82];
166
+ var RAIL_YS_CARRIER = [0.24, 0.54, 0.82];
167
+ var RAIL_YS_DISPATCH = [0.18, 0.58, 0.82];
168
+ var GLOW_FALLOFF_EXP_ASCII = 2.2;
169
+
43
170
  // packages/cli/src/app-opentui/render/graphics.ts
171
+ var BRAILLE_SAMPLES_X = 2;
172
+ var BRAILLE_SAMPLES_Y = 4;
44
173
  var TRANSPARENT = RGBA.fromValues(0, 0, 0, 0);
45
174
  var BACKDROP = RGBA.fromHex(RIG_UI.bg);
46
175
  var PANEL_BG = RGBA.fromInts(16, 17, 21, 184);
@@ -68,8 +197,8 @@ function sceneKind(scene) {
68
197
  function seeded(seed) {
69
198
  let value = seed >>> 0;
70
199
  return () => {
71
- value = value * 1664525 + 1013904223 >>> 0;
72
- return value / 4294967295;
200
+ value = value * LCG_MULTIPLIER + LCG_INCREMENT >>> 0;
201
+ return value / LCG_DIVISOR;
73
202
  };
74
203
  }
75
204
  function channelBuffer(canvas, channel) {
@@ -122,7 +251,7 @@ function drawGlow(canvas, channel, cx, cy, radius, value) {
122
251
  const distance = Math.sqrt(dx * dx + dy * dy);
123
252
  if (distance > radius)
124
253
  continue;
125
- const falloff = Math.pow(1 - distance / Math.max(0.001, radius), 2.2);
254
+ const falloff = Math.pow(1 - distance / Math.max(0.001, radius), GLOW_FALLOFF_EXP_ASCII);
126
255
  addSample(canvas, channel, x, y, value * falloff);
127
256
  }
128
257
  }
@@ -161,8 +290,8 @@ function clearCanvas(canvas) {
161
290
  canvas.ink.fill(0);
162
291
  }
163
292
  function makeCanvas(layout) {
164
- const width = Math.max(1, layout.width * 2);
165
- const height = Math.max(1, layout.height * 4);
293
+ const width = Math.max(1, layout.width * BRAILLE_SAMPLES_X);
294
+ const height = Math.max(1, layout.height * BRAILLE_SAMPLES_Y);
166
295
  const size = width * height;
167
296
  return {
168
297
  width,
@@ -221,12 +350,12 @@ class MarketingGlyphCanvas {
221
350
  this.setupCarrier();
222
351
  }
223
352
  setupDispatch() {
224
- const count = this.layout.compact ? 7 : 12;
353
+ const count = this.layout.compact ? DISPATCH_LANES_COMPACT : DISPATCH_LANES_WIDE;
225
354
  for (let i = 0;i < count; i += 1) {
226
355
  const ang = (-0.9 + 1.8 * (i / Math.max(1, count - 1))) * (Math.PI * 0.5);
227
- this.lanes.push({ ang, len: this.canvas.width * (0.32 + this.rand() * 0.42), curve: (this.rand() - 0.5) * 0.7, phase: this.rand() * Math.PI * 2 });
356
+ this.lanes.push({ ang, len: this.canvas.width * (LANE_LEN_BASE + this.rand() * LANE_LEN_SPREAD), curve: (this.rand() - 0.5) * LANE_CURVE_RANGE, phase: this.rand() * Math.PI * 2 });
228
357
  }
229
- const packets = this.layout.compact ? 70 : 150;
358
+ const packets = this.layout.compact ? DISPATCH_PACKETS_COMPACT : DISPATCH_PACKETS_WIDE;
230
359
  for (let i = 0;i < packets; i += 1)
231
360
  this.packets.push(this.packet(true));
232
361
  }
@@ -236,7 +365,7 @@ class MarketingGlyphCanvas {
236
365
  this.packets.push(this.packet(true));
237
366
  }
238
367
  setupCarrier() {
239
- const nodes = this.layout.compact ? 5 : 7;
368
+ const nodes = this.layout.compact ? CARRIER_NODES_COMPACT : CARRIER_NODES_WIDE;
240
369
  for (let i = 0;i < nodes * 6; i += 1)
241
370
  this.packets.push(this.packet(true));
242
371
  }
@@ -244,18 +373,18 @@ class MarketingGlyphCanvas {
244
373
  return {
245
374
  lane: Math.floor(this.rand() * Math.max(1, this.lanes.length || 7)),
246
375
  p: random ? this.rand() : 0,
247
- spd: 0.003 + this.rand() * 0.009,
248
- channel: this.rand() < 0.22 ? 1 : 0,
376
+ spd: PACKET_SPEED_BASE + this.rand() * PACKET_SPEED_SPREAD,
377
+ channel: this.rand() < PACKET_CYAN_PROBABILITY ? 1 : 0,
249
378
  wobble: (this.rand() - 0.5) * 7,
250
379
  size: 0.8 + this.rand() * 1.3
251
380
  };
252
381
  }
253
382
  core(kind) {
254
383
  if (kind === "dispatch")
255
- return { x: this.canvas.width * 0.3, y: this.canvas.height * 0.45 };
384
+ return { x: this.canvas.width * CORE_DISPATCH_X, y: this.canvas.height * CORE_DISPATCH_Y };
256
385
  if (kind === "carrier")
257
- return { x: this.canvas.width * 0.5, y: this.canvas.height * 0.54 };
258
- return { x: this.canvas.width * 0.09, y: this.canvas.height * 0.56 };
386
+ return { x: this.canvas.width * CORE_CARRIER_X, y: this.canvas.height * CORE_CARRIER_Y };
387
+ return { x: this.canvas.width * CORE_LOOP_X, y: this.canvas.height * CORE_LOOP_Y };
259
388
  }
260
389
  lanePoint(lane, p, kind = "dispatch") {
261
390
  const core = this.core(kind);
@@ -275,7 +404,7 @@ class MarketingGlyphCanvas {
275
404
  }
276
405
  }
277
406
  drawMarketingRails(kind, tick) {
278
- const ys = kind === "loop" ? [0.18, 0.5, 0.82] : kind === "carrier" ? [0.24, 0.54, 0.82] : [0.18, 0.58, 0.82];
407
+ const ys = kind === "loop" ? RAIL_YS_LOOP : kind === "carrier" ? RAIL_YS_CARRIER : RAIL_YS_DISPATCH;
279
408
  ys.forEach((ratio, index) => {
280
409
  const y = this.canvas.height * ratio + Math.sin(tick * 0.018 + index) * 1.8;
281
410
  drawLine(this.canvas, index === 1 ? 0 : 1, this.canvas.width * 0.06, y, this.canvas.width * 0.94, y + Math.sin(index) * 2, index === 1 ? 0.11 : 0.07, 0.55);
@@ -292,8 +421,8 @@ class MarketingGlyphCanvas {
292
421
  drawDot(this.canvas, 0, core.x, core.y, 2.2, 0.85);
293
422
  for (const lane of this.lanes) {
294
423
  let prev = this.lanePoint(lane, 0);
295
- for (let i = 1;i <= 32; i += 1) {
296
- const next = this.lanePoint(lane, i / 32);
424
+ for (let i = 1;i <= LANE_INTERP_STEPS; i += 1) {
425
+ const next = this.lanePoint(lane, i / LANE_INTERP_STEPS);
297
426
  drawLine(this.canvas, lane.phase > Math.PI ? 1 : 0, prev.x, prev.y, next.x, next.y, 0.045, 0.38);
298
427
  prev = next;
299
428
  }
@@ -312,7 +441,7 @@ class MarketingGlyphCanvas {
312
441
  drawDot(this.canvas, packet.channel, pt.x, y, packet.size, 0.5 * fade);
313
442
  drawGlow(this.canvas, packet.channel, pt.x, y, packet.size * 4, 0.045 * fade);
314
443
  }
315
- for (let i = 0;i < (this.layout.compact ? 4 : 8); i += 1) {
444
+ for (let i = 0;i < (this.layout.compact ? DISPATCH_DRONES_COMPACT : DISPATCH_DRONES_WIDE); i += 1) {
316
445
  const lane = this.lanes[i % Math.max(1, this.lanes.length)];
317
446
  if (!lane)
318
447
  continue;
@@ -326,7 +455,7 @@ class MarketingGlyphCanvas {
326
455
  const x0 = this.canvas.width * 0.09;
327
456
  const x1 = this.canvas.width * 0.91;
328
457
  drawLine(this.canvas, 0, x0, y, x1, y, 0.12, 0.55);
329
- const gates = this.layout.compact ? 4 : 5;
458
+ const gates = this.layout.compact ? LOOP_GATES_COMPACT : LOOP_GATES_WIDE;
330
459
  const active = Math.floor(tick / 16) % gates;
331
460
  for (let i = 0;i < gates; i += 1) {
332
461
  const x = x0 + (x1 - x0) * (i / Math.max(1, gates - 1));
@@ -354,7 +483,7 @@ class MarketingGlyphCanvas {
354
483
  drawGlow(this.canvas, 0, core.x, core.y, 26, 0.12);
355
484
  drawDot(this.canvas, 0, core.x, core.y, 2.4, 0.92);
356
485
  drawCircleStroke(this.canvas, 0, core.x, core.y, 8 + Math.sin(tick * 0.06) * 2, 0.14);
357
- const nodes = this.layout.compact ? 5 : 7;
486
+ const nodes = this.layout.compact ? CARRIER_NODES_COMPACT : CARRIER_NODES_WIDE;
358
487
  const rx = this.canvas.width * 0.36;
359
488
  const ry = this.canvas.height * 0.22;
360
489
  for (let i = 0;i < nodes; i += 1) {
@@ -409,10 +538,10 @@ class MarketingGlyphCanvas {
409
538
  let c2Sum = 0;
410
539
  let mgSum = 0;
411
540
  let inkSum = 0;
412
- for (let sy = 0;sy < 4; sy += 1) {
413
- for (let sx = 0;sx < 2; sx += 1) {
414
- const px = cx * 2 + sx;
415
- const py = cy * 4 + sy;
541
+ for (let sy = 0;sy < BRAILLE_SAMPLES_Y; sy += 1) {
542
+ for (let sx = 0;sx < BRAILLE_SAMPLES_X; sx += 1) {
543
+ const px = cx * BRAILLE_SAMPLES_X + sx;
544
+ const py = cy * BRAILLE_SAMPLES_Y + sy;
416
545
  if (px >= width || py >= height)
417
546
  continue;
418
547
  const index = py * width + px;
@@ -460,14 +589,7 @@ function resizeGraphicsLayer(layer, layout) {
460
589
  }
461
590
  function clearGraphicsLayer(layer) {
462
591
  layer.frameBuffer.clear(BACKDROP);
463
- }
464
- function panelRect(layout, panel) {
465
- const left = Math.max(0, Math.min(layout.width - 1, layout.centerLeft + (panel.left ?? 0)));
466
- const desiredWidth = panel.width ?? layout.centerWidth;
467
- const width = Math.max(1, Math.min(layout.width - left, desiredWidth));
468
- const top = Math.max(0, Math.min(layout.height - 1, layout.centerTop + panel.top));
469
- const height = Math.max(1, Math.min(layout.height - top, panel.height));
470
- return width > 3 && height > 3 ? { left, top, width, height } : null;
592
+ layer.__rigAmbientKey = undefined;
471
593
  }
472
594
  function writeCell(layer, x, y, char, fg, bg) {
473
595
  layer.frameBuffer.setCellWithAlphaBlending(x, y, char, fg, bg);
@@ -491,14 +613,10 @@ function drawRoundedFill(layer, left, top, right, bottom, dividerY) {
491
613
  drawCornerCut(layer, right, bottom, "\u2598", PANEL_BG);
492
614
  }
493
615
  function drawAdTerminalPanel(layer, layout, panel) {
494
- const rect = panelRect(layout, panel);
616
+ const rect = panelCellRect(layout, panel);
495
617
  if (!rect)
496
618
  return;
497
- const { left, top, width, height } = rect;
498
- const right = left + width - 1;
499
- const bottom = top + height - 1;
500
- const headerHeight = Math.max(3, Math.min(height - 2, panel.headerHeight ?? 3));
501
- const dividerY = Math.min(bottom - 1, top + headerHeight);
619
+ const { left, top, width, right, bottom, headerHeight, dividerY } = rect;
502
620
  drawRoundedFill(layer, left, top, right, bottom, dividerY);
503
621
  if (dividerY > top && dividerY < bottom) {
504
622
  for (let x = left + 2;x < right - 1; x += 1) {
@@ -517,8 +635,72 @@ function drawPanelChrome(layer, layout, panels) {
517
635
  drawAdTerminalPanel(layer, layout, panel);
518
636
  }
519
637
  }
520
- function drawAmbientField(layer, layout, tick, scene = "fleet") {
521
- layer.__rigMarketingCanvas?.render(layer, scene, tick);
638
+ function staticFleetTick(scene) {
639
+ let hash = 0;
640
+ for (let index = 0;index < scene.length; index += 1)
641
+ hash = hash * 33 + scene.charCodeAt(index) >>> 0;
642
+ return 11 + hash % 97;
643
+ }
644
+ function withAlpha(hex, alpha) {
645
+ const a = Math.max(0, Math.min(255, Math.round(alpha * 255)));
646
+ const [r, g, b] = RGBA.fromHex(hex).toInts();
647
+ return RGBA.fromInts(r, g, b, a);
648
+ }
649
+ function asciiFleetColor(char, row, alpha) {
650
+ if (char === "@" || char === "$" || char === "o")
651
+ return withAlpha(RIG_UI.lime, alpha);
652
+ if (char === "%" || char === "!" || char === "/" || char === "\\" || char === "|")
653
+ return withAlpha(RIG_UI.cyan, alpha);
654
+ if (char === "." || char === "'" || char === "_" || row < 3 || row > FLEET_GRID_HEIGHT - 4) {
655
+ return RGBA.fromInts(108, 110, 121, Math.min(170, Math.max(0, Math.min(255, Math.round(alpha * 255)))));
656
+ }
657
+ return withAlpha(RIG_UI.limeDim, alpha);
658
+ }
659
+ var AMBIENT_LOAD_BUCKETS = 5;
660
+ function ambientLoadBucket(load) {
661
+ if (!Number.isFinite(load))
662
+ return 0;
663
+ return Math.max(0, Math.min(AMBIENT_LOAD_BUCKETS, Math.round(load * AMBIENT_LOAD_BUCKETS)));
664
+ }
665
+ function drawAmbientField(layer, layout, _tick, scene = "fleet", load = 0, activeRuns = 0) {
666
+ const bucket = ambientLoadBucket(load);
667
+ const rows = fleetRows(staticFleetTick(scene), { animate: true });
668
+ let droneTotal = 0;
669
+ for (const line of rows)
670
+ for (const char of line)
671
+ if (char === "@" || char === "$" || char === "%")
672
+ droneTotal += 1;
673
+ const litTarget = Math.max(0, Math.min(droneTotal, Math.floor(activeRuns)));
674
+ const key = `${layout.width}x${layout.height}|${scene}|l${bucket}|d${litTarget}`;
675
+ if (layer.__rigAmbientKey === key)
676
+ return;
677
+ const fb = layer.frameBuffer;
678
+ fb.clear(BACKDROP);
679
+ const left = Math.floor((layout.width - FLEET_GRID_WIDTH) / 2);
680
+ const top = Math.floor((layout.height - FLEET_GRID_HEIGHT) / 2);
681
+ const baseAlpha = 0.62 + bucket / AMBIENT_LOAD_BUCKETS * 0.18;
682
+ let droneIndex = 0;
683
+ for (let row = 0;row < rows.length; row += 1) {
684
+ const y = top + row;
685
+ if (y < 0 || y >= layout.height)
686
+ continue;
687
+ const line = rows[row];
688
+ for (let col = 0;col < line.length; col += 1) {
689
+ const x = left + col;
690
+ if (x < 0 || x >= layout.width)
691
+ continue;
692
+ const char = line[col];
693
+ if (char === " ")
694
+ continue;
695
+ const isDrone = char === "@" || char === "$" || char === "%";
696
+ const lit = isDrone && droneIndex < litTarget;
697
+ if (isDrone)
698
+ droneIndex += 1;
699
+ const alpha = lit ? 1 : baseAlpha;
700
+ fb.setCellWithAlphaBlending(x, y, char, asciiFleetColor(char, row, alpha), TRANSPARENT);
701
+ }
702
+ }
703
+ layer.__rigAmbientKey = key;
522
704
  }
523
705
  function drawSparkline(layer, x, y, values, color = RGBA.fromHex(RIG_UI.cyan)) {
524
706
  const chars = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"];