@h-rig/cli 0.0.6-alpha.89 → 0.0.6-alpha.90

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 (231) hide show
  1. package/dist/bin/build-rig-binaries.js +8 -40
  2. package/dist/bin/rig.js +12519 -26675
  3. package/dist/src/app/board.js +74 -693
  4. package/dist/src/app/drone-ui.js +1 -1
  5. package/dist/src/app/theme.js +0 -1
  6. package/dist/src/commands/_async-ui.js +1 -1
  7. package/dist/src/commands/_authority-runs.d.ts +1 -1
  8. package/dist/src/commands/_authority-runs.js +12 -2
  9. package/dist/src/commands/_cli-format.d.ts +1 -10
  10. package/dist/src/commands/_cli-format.js +2 -5
  11. package/dist/src/commands/_connection-state.d.ts +1 -11
  12. package/dist/src/commands/_connection-state.js +5 -50
  13. package/dist/src/commands/_doctor-checks.js +40 -501
  14. package/dist/src/commands/_help-catalog.js +17 -99
  15. package/dist/src/commands/_json-output.js +0 -4
  16. package/dist/src/commands/_operator-view.js +54 -575
  17. package/dist/src/commands/_pi-frontend.d.ts +0 -27
  18. package/dist/src/commands/_pi-frontend.js +52 -576
  19. package/dist/src/commands/_preflight.js +66 -553
  20. package/dist/src/commands/_server-client.d.ts +0 -33
  21. package/dist/src/commands/_server-client.js +46 -541
  22. package/dist/src/commands/_snapshot-upload.js +42 -503
  23. package/dist/src/commands/_spinner.js +1 -1
  24. package/dist/src/commands/agent.js +12 -2
  25. package/dist/src/commands/browser.js +1 -1
  26. package/dist/src/commands/connect.js +15 -626
  27. package/dist/src/commands/doctor.js +41 -502
  28. package/dist/src/commands/github.js +51 -584
  29. package/dist/src/commands/inbox.js +41 -502
  30. package/dist/src/commands/init.js +74 -561
  31. package/dist/src/commands/inspect.js +41 -502
  32. package/dist/src/commands/run.js +54 -578
  33. package/dist/src/commands/server.js +163 -692
  34. package/dist/src/commands/setup.js +46 -507
  35. package/dist/src/commands/stats.js +58 -601
  36. package/dist/src/commands/task-run-driver.js +58 -509
  37. package/dist/src/commands/task.js +110 -729
  38. package/dist/src/commands.js +237 -1112
  39. package/dist/src/index.js +244 -1123
  40. package/dist/src/launcher.js +0 -4
  41. package/package.json +9 -13
  42. package/dist/src/app-opentui/adapters/command.d.ts +0 -2
  43. package/dist/src/app-opentui/adapters/command.js +0 -329
  44. package/dist/src/app-opentui/adapters/common.d.ts +0 -56
  45. package/dist/src/app-opentui/adapters/common.js +0 -153
  46. package/dist/src/app-opentui/adapters/doctor.d.ts +0 -9
  47. package/dist/src/app-opentui/adapters/doctor.js +0 -1217
  48. package/dist/src/app-opentui/adapters/family.d.ts +0 -62
  49. package/dist/src/app-opentui/adapters/family.js +0 -14855
  50. package/dist/src/app-opentui/adapters/fleet.d.ts +0 -14
  51. package/dist/src/app-opentui/adapters/fleet.js +0 -1335
  52. package/dist/src/app-opentui/adapters/inbox.d.ts +0 -43
  53. package/dist/src/app-opentui/adapters/inbox.js +0 -1944
  54. package/dist/src/app-opentui/adapters/init.d.ts +0 -11
  55. package/dist/src/app-opentui/adapters/init.js +0 -2818
  56. package/dist/src/app-opentui/adapters/inspect.d.ts +0 -52
  57. package/dist/src/app-opentui/adapters/inspect.js +0 -1455
  58. package/dist/src/app-opentui/adapters/pi-attach.d.ts +0 -32
  59. package/dist/src/app-opentui/adapters/pi-attach.js +0 -2101
  60. package/dist/src/app-opentui/adapters/pi.d.ts +0 -23
  61. package/dist/src/app-opentui/adapters/pi.js +0 -363
  62. package/dist/src/app-opentui/adapters/plugin.d.ts +0 -84
  63. package/dist/src/app-opentui/adapters/plugin.js +0 -544
  64. package/dist/src/app-opentui/adapters/repo.d.ts +0 -37
  65. package/dist/src/app-opentui/adapters/repo.js +0 -186
  66. package/dist/src/app-opentui/adapters/run-detail.d.ts +0 -27
  67. package/dist/src/app-opentui/adapters/run-detail.js +0 -1441
  68. package/dist/src/app-opentui/adapters/server.d.ts +0 -48
  69. package/dist/src/app-opentui/adapters/server.js +0 -1561
  70. package/dist/src/app-opentui/adapters/tasks.d.ts +0 -64
  71. package/dist/src/app-opentui/adapters/tasks.js +0 -4524
  72. package/dist/src/app-opentui/adapters/workspace.d.ts +0 -49
  73. package/dist/src/app-opentui/adapters/workspace.js +0 -333
  74. package/dist/src/app-opentui/autocomplete.d.ts +0 -20
  75. package/dist/src/app-opentui/autocomplete.js +0 -578
  76. package/dist/src/app-opentui/bootstrap.d.ts +0 -11
  77. package/dist/src/app-opentui/bootstrap.js +0 -27833
  78. package/dist/src/app-opentui/command-palette.d.ts +0 -3
  79. package/dist/src/app-opentui/command-palette.js +0 -1038
  80. package/dist/src/app-opentui/command-pty-host.d.ts +0 -62
  81. package/dist/src/app-opentui/command-pty-host.js +0 -248
  82. package/dist/src/app-opentui/drone.d.ts +0 -12
  83. package/dist/src/app-opentui/drone.js +0 -230
  84. package/dist/src/app-opentui/events.d.ts +0 -7
  85. package/dist/src/app-opentui/events.js +0 -28
  86. package/dist/src/app-opentui/fleet-stats.d.ts +0 -32
  87. package/dist/src/app-opentui/fleet-stats.js +0 -114
  88. package/dist/src/app-opentui/focus-manager.d.ts +0 -14
  89. package/dist/src/app-opentui/focus-manager.js +0 -24
  90. package/dist/src/app-opentui/index.d.ts +0 -8
  91. package/dist/src/app-opentui/index.js +0 -5260
  92. package/dist/src/app-opentui/intent.d.ts +0 -3
  93. package/dist/src/app-opentui/intent.js +0 -365
  94. package/dist/src/app-opentui/keymap.d.ts +0 -21
  95. package/dist/src/app-opentui/keymap.js +0 -1377
  96. package/dist/src/app-opentui/launch-routing.d.ts +0 -16
  97. package/dist/src/app-opentui/launch-routing.js +0 -55
  98. package/dist/src/app-opentui/layout.d.ts +0 -22
  99. package/dist/src/app-opentui/layout.js +0 -51
  100. package/dist/src/app-opentui/list-search.d.ts +0 -36
  101. package/dist/src/app-opentui/list-search.js +0 -130
  102. package/dist/src/app-opentui/pi-host-child.d.ts +0 -2
  103. package/dist/src/app-opentui/pi-host-child.js +0 -1299
  104. package/dist/src/app-opentui/pi-pty-host.d.ts +0 -28
  105. package/dist/src/app-opentui/pi-pty-host.js +0 -10
  106. package/dist/src/app-opentui/react/App.d.ts +0 -9
  107. package/dist/src/app-opentui/react/App.js +0 -3866
  108. package/dist/src/app-opentui/react/Backdrop.d.ts +0 -5
  109. package/dist/src/app-opentui/react/Backdrop.js +0 -823
  110. package/dist/src/app-opentui/react/ChromeHost.d.ts +0 -5
  111. package/dist/src/app-opentui/react/ChromeHost.js +0 -1539
  112. package/dist/src/app-opentui/react/SceneFrameView.d.ts +0 -7
  113. package/dist/src/app-opentui/react/SceneFrameView.js +0 -579
  114. package/dist/src/app-opentui/react/context.d.ts +0 -17
  115. package/dist/src/app-opentui/react/context.js +0 -37
  116. package/dist/src/app-opentui/react/launch.d.ts +0 -2
  117. package/dist/src/app-opentui/react/launch.js +0 -4897
  118. package/dist/src/app-opentui/react/nav.d.ts +0 -18
  119. package/dist/src/app-opentui/react/nav.js +0 -54
  120. package/dist/src/app-opentui/react/scroll.d.ts +0 -12
  121. package/dist/src/app-opentui/react/scroll.js +0 -21
  122. package/dist/src/app-opentui/react/syntax.d.ts +0 -2
  123. package/dist/src/app-opentui/react/syntax.js +0 -65
  124. package/dist/src/app-opentui/registry.d.ts +0 -4
  125. package/dist/src/app-opentui/registry.js +0 -22876
  126. package/dist/src/app-opentui/remote-link.d.ts +0 -10
  127. package/dist/src/app-opentui/remote-link.js +0 -47
  128. package/dist/src/app-opentui/render/ascii-fleet.d.ts +0 -15
  129. package/dist/src/app-opentui/render/ascii-fleet.js +0 -82
  130. package/dist/src/app-opentui/render/constants.d.ts +0 -30
  131. package/dist/src/app-opentui/render/constants.js +0 -64
  132. package/dist/src/app-opentui/render/graphics.d.ts +0 -40
  133. package/dist/src/app-opentui/render/graphics.js +0 -713
  134. package/dist/src/app-opentui/render/hover.d.ts +0 -11
  135. package/dist/src/app-opentui/render/hover.js +0 -34
  136. package/dist/src/app-opentui/render/native-host.d.ts +0 -37
  137. package/dist/src/app-opentui/render/native-host.js +0 -180
  138. package/dist/src/app-opentui/render/panel-layout.d.ts +0 -38
  139. package/dist/src/app-opentui/render/panel-layout.js +0 -48
  140. package/dist/src/app-opentui/render/panels.d.ts +0 -12
  141. package/dist/src/app-opentui/render/panels.js +0 -288
  142. package/dist/src/app-opentui/render/preloader.d.ts +0 -10
  143. package/dist/src/app-opentui/render/preloader.js +0 -166
  144. package/dist/src/app-opentui/render/scene.d.ts +0 -68
  145. package/dist/src/app-opentui/render/scene.js +0 -300
  146. package/dist/src/app-opentui/render/terminal-handoff.d.ts +0 -16
  147. package/dist/src/app-opentui/render/terminal-handoff.js +0 -14
  148. package/dist/src/app-opentui/render/text.d.ts +0 -29
  149. package/dist/src/app-opentui/render/text.js +0 -177
  150. package/dist/src/app-opentui/render/type-bar.d.ts +0 -15
  151. package/dist/src/app-opentui/render/type-bar.js +0 -212
  152. package/dist/src/app-opentui/runtime-resources.d.ts +0 -16
  153. package/dist/src/app-opentui/runtime-resources.js +0 -62
  154. package/dist/src/app-opentui/runtime.d.ts +0 -45
  155. package/dist/src/app-opentui/runtime.js +0 -5232
  156. package/dist/src/app-opentui/scenes/command.d.ts +0 -3
  157. package/dist/src/app-opentui/scenes/command.js +0 -118
  158. package/dist/src/app-opentui/scenes/doctor.d.ts +0 -3
  159. package/dist/src/app-opentui/scenes/doctor.js +0 -296
  160. package/dist/src/app-opentui/scenes/error.d.ts +0 -2
  161. package/dist/src/app-opentui/scenes/error.js +0 -277
  162. package/dist/src/app-opentui/scenes/family-domains/agent.d.ts +0 -2
  163. package/dist/src/app-opentui/scenes/family-domains/agent.js +0 -349
  164. package/dist/src/app-opentui/scenes/family-domains/browser.d.ts +0 -2
  165. package/dist/src/app-opentui/scenes/family-domains/browser.js +0 -196
  166. package/dist/src/app-opentui/scenes/family-domains/dist.d.ts +0 -2
  167. package/dist/src/app-opentui/scenes/family-domains/dist.js +0 -244
  168. package/dist/src/app-opentui/scenes/family-domains/git.d.ts +0 -2
  169. package/dist/src/app-opentui/scenes/family-domains/git.js +0 -196
  170. package/dist/src/app-opentui/scenes/family-domains/github.d.ts +0 -2
  171. package/dist/src/app-opentui/scenes/family-domains/github.js +0 -275
  172. package/dist/src/app-opentui/scenes/family-domains/harness.d.ts +0 -2
  173. package/dist/src/app-opentui/scenes/family-domains/harness.js +0 -153
  174. package/dist/src/app-opentui/scenes/family-domains/index.d.ts +0 -4
  175. package/dist/src/app-opentui/scenes/family-domains/index.js +0 -1680
  176. package/dist/src/app-opentui/scenes/family-domains/kit.d.ts +0 -76
  177. package/dist/src/app-opentui/scenes/family-domains/kit.js +0 -306
  178. package/dist/src/app-opentui/scenes/family-domains/profile.d.ts +0 -2
  179. package/dist/src/app-opentui/scenes/family-domains/profile.js +0 -213
  180. package/dist/src/app-opentui/scenes/family-domains/queue.d.ts +0 -2
  181. package/dist/src/app-opentui/scenes/family-domains/queue.js +0 -147
  182. package/dist/src/app-opentui/scenes/family-domains/remote.d.ts +0 -2
  183. package/dist/src/app-opentui/scenes/family-domains/remote.js +0 -519
  184. package/dist/src/app-opentui/scenes/family-domains/review.d.ts +0 -2
  185. package/dist/src/app-opentui/scenes/family-domains/review.js +0 -281
  186. package/dist/src/app-opentui/scenes/family-domains/setup.d.ts +0 -2
  187. package/dist/src/app-opentui/scenes/family-domains/setup.js +0 -268
  188. package/dist/src/app-opentui/scenes/family-domains/stats.d.ts +0 -2
  189. package/dist/src/app-opentui/scenes/family-domains/stats.js +0 -371
  190. package/dist/src/app-opentui/scenes/family.d.ts +0 -3
  191. package/dist/src/app-opentui/scenes/family.js +0 -2199
  192. package/dist/src/app-opentui/scenes/fleet.d.ts +0 -3
  193. package/dist/src/app-opentui/scenes/fleet.js +0 -766
  194. package/dist/src/app-opentui/scenes/handoff.d.ts +0 -2
  195. package/dist/src/app-opentui/scenes/handoff.js +0 -455
  196. package/dist/src/app-opentui/scenes/help.d.ts +0 -3
  197. package/dist/src/app-opentui/scenes/help.js +0 -725
  198. package/dist/src/app-opentui/scenes/inbox.d.ts +0 -3
  199. package/dist/src/app-opentui/scenes/inbox.js +0 -427
  200. package/dist/src/app-opentui/scenes/init.d.ts +0 -3
  201. package/dist/src/app-opentui/scenes/init.js +0 -181
  202. package/dist/src/app-opentui/scenes/inspect.d.ts +0 -3
  203. package/dist/src/app-opentui/scenes/inspect.js +0 -794
  204. package/dist/src/app-opentui/scenes/main.d.ts +0 -3
  205. package/dist/src/app-opentui/scenes/main.js +0 -332
  206. package/dist/src/app-opentui/scenes/pi.d.ts +0 -3
  207. package/dist/src/app-opentui/scenes/pi.js +0 -509
  208. package/dist/src/app-opentui/scenes/plugin.d.ts +0 -3
  209. package/dist/src/app-opentui/scenes/plugin.js +0 -487
  210. package/dist/src/app-opentui/scenes/repo.d.ts +0 -3
  211. package/dist/src/app-opentui/scenes/repo.js +0 -425
  212. package/dist/src/app-opentui/scenes/run-detail.d.ts +0 -3
  213. package/dist/src/app-opentui/scenes/run-detail.js +0 -467
  214. package/dist/src/app-opentui/scenes/server.d.ts +0 -3
  215. package/dist/src/app-opentui/scenes/server.js +0 -378
  216. package/dist/src/app-opentui/scenes/tasks.d.ts +0 -3
  217. package/dist/src/app-opentui/scenes/tasks.js +0 -768
  218. package/dist/src/app-opentui/scenes/workspace.d.ts +0 -3
  219. package/dist/src/app-opentui/scenes/workspace.js +0 -427
  220. package/dist/src/app-opentui/selectable.d.ts +0 -19
  221. package/dist/src/app-opentui/selectable.js +0 -80
  222. package/dist/src/app-opentui/state.d.ts +0 -4
  223. package/dist/src/app-opentui/state.js +0 -399
  224. package/dist/src/app-opentui/surface-catalog.d.ts +0 -20
  225. package/dist/src/app-opentui/surface-catalog.js +0 -542
  226. package/dist/src/app-opentui/theme.d.ts +0 -59
  227. package/dist/src/app-opentui/theme.js +0 -142
  228. package/dist/src/app-opentui/types.d.ts +0 -313
  229. package/dist/src/app-opentui/types.js +0 -1
  230. package/dist/src/commands/_server-events.d.ts +0 -26
  231. package/dist/src/commands/_server-events.js +0 -715
@@ -1,467 +0,0 @@
1
- // @bun
2
- // packages/cli/src/app-opentui/theme.ts
3
- import {
4
- bold as otuiBold,
5
- dim as otuiDim,
6
- fg as otuiFg,
7
- t,
8
- TextAttributes
9
- } from "@opentui/core";
10
- var RIG_UI = {
11
- bg: "#070809",
12
- bg2: "#0b0c0e",
13
- panel: "#101115",
14
- panel2: "#14161b",
15
- hover: "#181b24",
16
- glass: "#1e2230",
17
- border: "#2a2e3a",
18
- ink: "#f4f5f8",
19
- ink2: "#c7c9d3",
20
- ink3: "#9aa0ae",
21
- ink4: "#787b86",
22
- lime: "#ccff4d",
23
- limeDim: "#a9d63f",
24
- cyan: "#56d8ff",
25
- cyanDim: "#3f9fbd",
26
- red: "#ff5d5d",
27
- yellow: "#ffd24d",
28
- magenta: "#ff79b0"
29
- };
30
- var styles = {
31
- ink: otuiFg(RIG_UI.ink),
32
- ink2: otuiFg(RIG_UI.ink2),
33
- ink3: otuiFg(RIG_UI.ink3),
34
- ink4: otuiFg(RIG_UI.ink4),
35
- lime: otuiFg(RIG_UI.lime),
36
- limeDim: otuiFg(RIG_UI.limeDim),
37
- cyan: otuiFg(RIG_UI.cyan),
38
- red: otuiFg(RIG_UI.red),
39
- yellow: otuiFg(RIG_UI.yellow),
40
- magenta: otuiFg(RIG_UI.magenta)
41
- };
42
- function statusColor(status) {
43
- switch (status) {
44
- case "success":
45
- case "completed":
46
- case "merged":
47
- return RIG_UI.lime;
48
- case "running":
49
- case "preparing":
50
- case "created":
51
- case "validating":
52
- case "reviewing":
53
- case "closing-out":
54
- case "stopping":
55
- case "loading":
56
- case "action":
57
- return RIG_UI.cyan;
58
- case "needs-attention":
59
- case "needs_attention":
60
- return RIG_UI.yellow;
61
- case "failed":
62
- case "error":
63
- return RIG_UI.red;
64
- default:
65
- return RIG_UI.ink3;
66
- }
67
- }
68
-
69
- // packages/cli/src/app-opentui/drone.ts
70
- import { RGBA, StyledText, TextAttributes as TextAttributes2 } from "@opentui/core";
71
- var MINI_DRONE = [
72
- "(!!!) (!!!)",
73
- " \\%==%/ ",
74
- " %%?%% ",
75
- " /%==%\\ ",
76
- "(!!!) (!!!)"
77
- ];
78
- var LEAD_MARK = [
79
- " .-=-. ",
80
- "=%%?%%=",
81
- " '-=-' "
82
- ];
83
- var BLADE_FRAMES = ["---", "\\\\\\", "|||", "///"];
84
- var EYE_FRAMES = ["o", "@", "\u2022", "."];
85
- var COLOR = {
86
- body: RGBA.fromHex(RIG_UI.lime),
87
- mini: RGBA.fromHex(RIG_UI.limeDim),
88
- rotor: RGBA.fromHex(RIG_UI.cyan),
89
- path: RGBA.fromHex(RIG_UI.cyan),
90
- eye: RGBA.fromHex(RIG_UI.ink),
91
- dim: RGBA.fromHex(RIG_UI.ink4),
92
- ink: RGBA.fromHex(RIG_UI.ink2)
93
- };
94
- function bladeForTick(tick, phase = 0) {
95
- return BLADE_FRAMES[(Math.floor(tick / 3) + phase) % BLADE_FRAMES.length];
96
- }
97
- function eyeForTick(tick, phase = 0) {
98
- const pulse = Math.sin(tick * 0.09 + phase);
99
- return pulse > 0.55 ? EYE_FRAMES[1] : pulse > 0.1 ? EYE_FRAMES[0] : pulse > -0.45 ? EYE_FRAMES[2] : EYE_FRAMES[3];
100
- }
101
- function chunk(text, fg, bold = false, dim = false) {
102
- let attributes = TextAttributes2.NONE;
103
- if (bold)
104
- attributes |= TextAttributes2.BOLD;
105
- if (dim)
106
- attributes |= TextAttributes2.DIM;
107
- return { __isChunk: true, text, fg, ...attributes !== TextAttributes2.NONE ? { attributes } : {} };
108
- }
109
- function styledLine(text, colorFor) {
110
- const chunks = [];
111
- let run = "";
112
- let runColor = null;
113
- const flush = () => {
114
- if (!run || !runColor)
115
- return;
116
- chunks.push(chunk(run, COLOR[runColor], runColor === "body" || runColor === "eye", runColor === "dim"));
117
- run = "";
118
- };
119
- for (const char of text) {
120
- const next = colorFor(char);
121
- if (next !== runColor) {
122
- flush();
123
- runColor = next;
124
- }
125
- run += char;
126
- }
127
- flush();
128
- return new StyledText(chunks.length > 0 ? chunks : [chunk("", COLOR.ink)]);
129
- }
130
- function droneColor(char) {
131
- if (char === "?" || char === "o" || char === "@" || char === "\u2022")
132
- return "eye";
133
- if (char === "%" || char === "=")
134
- return "mini";
135
- if (char === "$")
136
- return "body";
137
- if (char === "(" || char === ")" || char === "/" || char === "\\" || char === "|" || char === "-")
138
- return "rotor";
139
- if (char === "\xB7" || char === "\u2022" || char === "'" || char === ".")
140
- return "path";
141
- if (char.trim() === "")
142
- return "dim";
143
- return "ink";
144
- }
145
- function motionColor(char) {
146
- if (char === "\u25CF" || char === "\u25C6" || char === "\u25C9")
147
- return "body";
148
- if (char === "\u2022" || char === "\xB7" || char === "\u2500" || char === "\u2502" || char === "\u2571" || char === "\u2572" || char === "\u256D" || char === "\u256E" || char === "\u2570" || char === "\u256F")
149
- return "path";
150
- if (char === "\u258C" || char === "\u2590" || char === "\u2581" || char === "\u2594")
151
- return "mini";
152
- return droneColor(char);
153
- }
154
- function materializeDrone(lines, tick, phase = 0) {
155
- const blade = bladeForTick(tick, phase);
156
- const eye = eyeForTick(tick, phase);
157
- return lines.map((line) => line.replaceAll("!!!", blade).replaceAll("?", eye));
158
- }
159
- function miniDroneLines(tick, align = "left", phase = 0) {
160
- return materializeDrone(MINI_DRONE, tick, phase).map((text) => ({
161
- text,
162
- styledText: styledLine(text, droneColor),
163
- fg: RIG_UI.limeDim,
164
- align
165
- }));
166
- }
167
- function brandFleetLines(tick, align = "center") {
168
- const left = materializeDrone(MINI_DRONE, tick, 0);
169
- const right = materializeDrone(MINI_DRONE, tick, 2);
170
- const lead = materializeDrone(LEAD_MARK, tick, 1);
171
- const packet = ["\xB7", "\u2022", "\u25CF", "\u2022"][Math.floor(tick / 2) % 4];
172
- const bridge = [
173
- ` ${left[0]} ${lead[0]} ${right[0]}`,
174
- ` ${left[1]} \xB7\u2500\u2500${packet}\u2500\u2500\xB7 ${lead[1]} \xB7\u2500\u2500${packet}\u2500\u2500\xB7 ${right[1]}`,
175
- ` ${left[2]} \xB7' '${lead[2]}' '\xB7 ${right[2]}`,
176
- ` ${left[3]} \u2572 signal bus \u2571 ${right[3]}`,
177
- ` ${left[4]} \xB7\u2500\u2500\u2500${packet}\u2500\u2500\u2500\u2500\u2500\u2500${packet}\u2500\u2500\u2500\xB7 ${right[4]}`
178
- ];
179
- return bridge.map((text) => ({
180
- text,
181
- styledText: styledLine(text, motionColor),
182
- fg: RIG_UI.limeDim,
183
- align
184
- }));
185
- }
186
- function actionDrone(tick, phase = 0) {
187
- const blade = bladeForTick(tick, phase);
188
- const eye = eyeForTick(tick, phase);
189
- return `(${blade})\u2572${eye}\u2571(${blade})`;
190
- }
191
- function actionDroneLine(tick, text, fg = RIG_UI.ink2) {
192
- const prefix = actionDrone(tick);
193
- const content = `${prefix} ${text}`;
194
- return { text: content, styledText: styledLine(content, motionColor), fg, align: "center" };
195
- }
196
-
197
- // packages/cli/src/app-opentui/render/scene.ts
198
- function line(text, options = {}) {
199
- return { text, ...options };
200
- }
201
- function blank() {
202
- return { text: "" };
203
- }
204
- function deckRow(input) {
205
- const prefix = input.active ? "\u25B8" : " ";
206
- const label = input.label.toUpperCase().padEnd(10);
207
- return line(`${prefix} ${label} ${input.detail}`, {
208
- fg: input.active ? RIG_UI.lime : RIG_UI.ink2,
209
- bold: input.active,
210
- selectableIndex: input.index,
211
- activateOnClick: input.activateOnClick
212
- });
213
- }
214
- function kv(label, value, fg = RIG_UI.ink2) {
215
- return line(` ${label.toUpperCase().padEnd(10)} ${value}`, { fg });
216
- }
217
- function loadingRows(label, tick = 0, compact = false) {
218
- const mascot = compact ? miniDroneLines(tick, "center") : brandFleetLines(tick, "center");
219
- return [
220
- blank(),
221
- ...mascot,
222
- blank(),
223
- { ...actionDroneLine(tick, `loading ${label}\u2026`, RIG_UI.cyan), align: "center" }
224
- ];
225
- }
226
- function errorBanner(message, hint) {
227
- return [
228
- line(`\u2717 failed to load \u2014 ${message}`, { fg: RIG_UI.red, bold: true }),
229
- ...hint ? [line(` ${hint}`, { fg: RIG_UI.ink3 })] : [],
230
- line(" select refresh/retry below", { fg: RIG_UI.ink4 }),
231
- line("", { fg: RIG_UI.ink3 })
232
- ];
233
- }
234
- function lastRefreshError(state) {
235
- const value = state.data.lastRefreshError;
236
- return typeof value === "string" && value.trim() ? value : undefined;
237
- }
238
- function makeSceneFrame(input) {
239
- return input;
240
- }
241
-
242
- // packages/cli/src/app-opentui/selectable.ts
243
- function withSelectable(line2, item) {
244
- return { ...line2, selectable: item, activateOnClick: true };
245
- }
246
-
247
- // packages/cli/src/app-opentui/scenes/run-detail.ts
248
- function actionRow(deck, item) {
249
- const row = deckRow({ ...deck, activateOnClick: true });
250
- return item ? withSelectable(row, item) : row;
251
- }
252
- function isTerminalRunStatus(status) {
253
- return ["completed", "complete", "done", "failed", "error", "errored", "merged", "cancelled", "canceled", "stopped", "aborted"].includes(status.toLowerCase());
254
- }
255
- function runDetailActions(runId, status) {
256
- const short = runId ? runId.slice(0, 8) : "";
257
- const attach = {
258
- label: "pi",
259
- detail: "attach bundled Pi \u2014 live or finished transcript",
260
- item: runId ? { id: "attach", label: "attach", intent: { scene: "handoff", argv: ["attach", runId], action: { kind: "run-attach", payload: { runId }, label: `Attach Pi ${short}` } }, message: "attach real bundled Pi" } : null
261
- };
262
- const inspect = {
263
- label: "inspect",
264
- detail: "logs/timeline/diff/failures",
265
- item: runId ? { id: "inspect", label: "inspect", data: { selectedRunId: runId }, intent: { scene: "inspect", argv: ["inspect", runId], action: { kind: "refresh", payload: { runId }, label: `Inspect ${short}` } }, message: "logs/timeline/diff/failures" } : null
266
- };
267
- const fleet = {
268
- label: "runs",
269
- detail: "return to fleet",
270
- item: { id: "fleet", label: "fleet", intent: { scene: "fleet", argv: ["fleet"], action: { kind: "refresh", label: "Opening fleet" } }, message: "back to fleet" }
271
- };
272
- if (runId && isTerminalRunStatus(status)) {
273
- const rerun = {
274
- label: "rerun",
275
- detail: "re-dispatch this run from a clean runtime",
276
- item: { id: "rerun", label: "rerun", intent: { scene: "command", argv: ["run", "restart", runId], action: { kind: "command-run", payload: { runId }, label: `Rerun ${short}` } }, message: "re-dispatch this run (rig run restart)" }
277
- };
278
- return [attach, rerun, inspect, fleet];
279
- }
280
- const steer = {
281
- label: "steer",
282
- detail: "send an inline steer message",
283
- item: runId ? { id: "steer", label: "steer", prompt: { label: `steer ${short}`, scene: "run-detail", argv: ["steer", runId], intentKind: "run-steer", payloadBase: { runId }, payloadKey: "message" }, message: "send an inline steer message" } : null
284
- };
285
- const stop = {
286
- label: "stop",
287
- detail: "request stop",
288
- item: runId ? { id: "stop", label: "stop", intent: { scene: "run-detail", argv: ["stop", runId], action: { kind: "run-stop", payload: { runId }, label: `Stop ${short}` } }, message: "request stop" } : null
289
- };
290
- return [attach, steer, stop, inspect, fleet];
291
- }
292
- function snapshot(state) {
293
- const value = state.data.runDetail;
294
- return value && typeof value === "object" && !Array.isArray(value) ? value : null;
295
- }
296
- function selectedRunId(state, run) {
297
- if (run?.runId)
298
- return run.runId;
299
- return typeof state.data.selectedRunId === "string" ? state.data.selectedRunId : undefined;
300
- }
301
- var ENTRY_ROW_LIMIT = 40;
302
- function entryField(entry, keys) {
303
- for (const key of keys) {
304
- const value = entry[key];
305
- if (typeof value === "string" && value.trim())
306
- return value.trim();
307
- if (typeof value === "number")
308
- return String(value);
309
- }
310
- return "";
311
- }
312
- function entryMessage(entry) {
313
- return String(entry.detail ?? entry.message ?? entry.text ?? entry.title ?? entry.type ?? "event").replace(/\s+/g, " ").slice(0, 160);
314
- }
315
- function entrySeverityColor(entry, fallback) {
316
- const token = `${entryField(entry, ["type", "level", "status", "kind"])} ${entryMessage(entry)}`.toLowerCase();
317
- if (/\b(fail|failed|failure|error|fatal|crash|abort)\b/.test(token))
318
- return RIG_UI.red;
319
- if (/\b(warn|warning|attention|degraded|retry)\b/.test(token))
320
- return RIG_UI.yellow;
321
- if (/\b(success|succeeded|completed|done|merged|passed)\b/.test(token))
322
- return RIG_UI.limeDim;
323
- return fallback;
324
- }
325
- function entryRow(entry, fallback) {
326
- const color = entrySeverityColor(entry, fallback);
327
- const time = entryField(entry, ["timestamp", "ts", "time", "at"]).replace("T", " ").slice(0, 19);
328
- const type = entryField(entry, ["type", "level", "kind", "status"]).slice(0, 14);
329
- const glyph = color === RIG_UI.red ? "\u2717" : color === RIG_UI.yellow ? "\u26A0" : "\xB7";
330
- const segments = [time, type ? type.toUpperCase() : undefined, entryMessage(entry)].filter((part) => Boolean(part));
331
- return line(`${glyph} ${segments.join(" \xB7 ")}`, { fg: color, bold: color === RIG_UI.red });
332
- }
333
- function entrySection(label, entries, fallback) {
334
- if (entries.length === 0)
335
- return [];
336
- const shown = entries.slice(0, ENTRY_ROW_LIMIT);
337
- const overflow = entries.length - shown.length;
338
- return [
339
- line("", { fg: RIG_UI.ink3 }),
340
- line(`${label} (${entries.length})`, { fg: RIG_UI.ink3, bold: true }),
341
- ...shown.map((entry) => entryRow(entry, fallback)),
342
- ...overflow > 0 ? [line(` (${overflow} more)`, { fg: RIG_UI.ink4 })] : []
343
- ];
344
- }
345
- function primaryError(state) {
346
- return state.error?.message ?? lastRefreshError(state);
347
- }
348
- function optimisticStatus(state, runId) {
349
- const value = state.data.optimisticRun;
350
- if (!value || typeof value !== "object" || Array.isArray(value))
351
- return;
352
- const record = value;
353
- if (runId && record.runId !== runId)
354
- return;
355
- return typeof record.status === "string" ? record.status : undefined;
356
- }
357
- function pendingSteer(state, runId) {
358
- const value = state.data.pendingRunMessage;
359
- if (!value || typeof value !== "object" || Array.isArray(value))
360
- return null;
361
- const record = value;
362
- if (runId && record.runId !== runId)
363
- return null;
364
- if (typeof record.text !== "string")
365
- return null;
366
- return {
367
- text: record.text,
368
- status: typeof record.status === "string" ? record.status : "queued",
369
- ...typeof record.result === "string" && record.result.trim() ? { result: record.result.trim() } : {}
370
- };
371
- }
372
- function steerBlock(pending) {
373
- const failed = pending.status === "failed";
374
- const sent = pending.status === "sent" || pending.status === "delivered";
375
- const glyph = failed ? "\u2717" : sent ? "\u2713" : "\u27F3";
376
- const color = failed ? RIG_UI.red : sent ? RIG_UI.lime : RIG_UI.cyan;
377
- const echoed = pending.text.length > 84 ? `${pending.text.slice(0, 83)}\u2026` : pending.text;
378
- return [
379
- line("", { fg: RIG_UI.ink3 }),
380
- line(`${glyph} STEER \xB7 ${pending.status}`, { fg: color, bold: true }),
381
- line(` "${echoed}"`, { fg: RIG_UI.ink2 }),
382
- ...pending.result ? [line(` ${failed ? "error" : "result"}: ${pending.result.replace(/\s+/g, " ").slice(0, 120)}`, { fg: failed ? RIG_UI.red : RIG_UI.ink3 })] : []
383
- ];
384
- }
385
- function timelineCountLabel(snapshot2) {
386
- const shown = snapshot2.timeline.length;
387
- const total = snapshot2.timelineTotal;
388
- return total !== undefined && total > shown ? `showing ${shown} of ${total}` : `${shown} loaded`;
389
- }
390
- function loadMoreItem(runId, cursor) {
391
- return {
392
- id: "timeline-load-more",
393
- label: "load more timeline",
394
- data: { runDetailLoadMore: { runId, cursor } },
395
- intent: { scene: "run-detail", argv: ["run", "status", runId], action: { kind: "refresh", payload: { runId }, label: "Load more timeline" } },
396
- message: "fetch the next page of timeline events"
397
- };
398
- }
399
- function panelWidth(layout) {
400
- return layout?.centerWidth ?? 100;
401
- }
402
- function panelHeight(layout) {
403
- return Math.max(10, (layout?.centerHeight ?? 24) - 1);
404
- }
405
- function renderRunDetailScene(state, layout) {
406
- const run = snapshot(state);
407
- const runId = selectedRunId(state, run);
408
- const status = optimisticStatus(state, runId) ?? run?.status ?? "loading";
409
- const actions = runDetailActions(runId, status);
410
- const actionCount = actions.length;
411
- const canLoadMore = Boolean(run?.timelineCursor && runId);
412
- const loadMoreIndex = actionCount;
413
- const maxIndex = canLoadMore ? loadMoreIndex : Math.max(0, actionCount - 1);
414
- const selected = Math.max(0, Math.min(maxIndex, state.selection.index));
415
- const timeline = run?.timeline ?? [];
416
- const logs = run?.logs ?? [];
417
- const pending = pendingSteer(state, runId);
418
- const loading = state.status === "loading" && !run;
419
- const errorText = primaryError(state);
420
- const timelineSection = run ? [
421
- line("", { fg: RIG_UI.ink3 }),
422
- line(`TIMELINE \xB7 ${timelineCountLabel(run)}`, { fg: RIG_UI.ink3, bold: true }),
423
- ...timeline.slice(0, ENTRY_ROW_LIMIT).map((entry) => entryRow(entry, RIG_UI.ink2)),
424
- ...canLoadMore && runId ? [withSelectable(deckRow({ label: "load more", detail: `next page \xB7 ${timelineCountLabel(run)}`, index: loadMoreIndex, active: selected === loadMoreIndex, activateOnClick: true }), loadMoreItem(runId, run.timelineCursor))] : []
425
- ] : [];
426
- return makeSceneFrame({
427
- scene: "run-detail",
428
- title: "Run",
429
- lines: [
430
- line("", { fg: RIG_UI.ink4 }),
431
- line(` run \xB7 ${runId ? `${runId.slice(0, 8)} \xB7 ${status}` : "loading"}`, { fg: run ? statusColor(status) : RIG_UI.ink3 })
432
- ],
433
- panels: [{
434
- id: "run-detail",
435
- top: 0,
436
- width: panelWidth(layout),
437
- height: panelHeight(layout),
438
- lines: [
439
- ...errorText ? errorBanner(errorText, "select inspect/runs below, or retry the action") : [],
440
- line(run ? run.title : "Run telemetry", { fg: RIG_UI.ink, bold: true }),
441
- ...loading ? loadingRows("run telemetry", state.tick) : runId ? [kv("run", runId, RIG_UI.ink2), kv("status", status, statusColor(status))] : [line("loading run telemetry", { fg: RIG_UI.ink3 })],
442
- ...pending ? steerBlock(pending) : [],
443
- line("", { fg: RIG_UI.ink3 }),
444
- line("ACTIONS", { fg: RIG_UI.ink3, bold: true }),
445
- ...actions.map((action, index) => actionRow({ label: action.label, detail: action.detail, index, active: selected === index }, action.item)),
446
- ...timelineSection,
447
- ...entrySection("LOGS", logs, RIG_UI.ink3)
448
- ],
449
- backgroundColor: RIG_UI.panel,
450
- backgroundAlpha: 184,
451
- opacity: 1,
452
- border: false,
453
- stickyScroll: true,
454
- stickyStart: "bottom",
455
- chrome: "ad-terminal",
456
- headerText: runId ? `run ${runId.slice(0, 8)}` : "run",
457
- headerHeight: 3,
458
- paddingX: layout?.compact ? 2 : 3,
459
- paddingY: 1
460
- }],
461
- footer: { run: runId ? `${runId.slice(0, 8)} ${status}` : undefined, message: "enter/click action" },
462
- live: state.status === "action" || !run
463
- });
464
- }
465
- export {
466
- renderRunDetailScene
467
- };
@@ -1,3 +0,0 @@
1
- import type { AppSceneFrame, AppState } from "../types";
2
- import type { StageLayout } from "../layout";
3
- export declare function renderServerScene(state: AppState, layout?: StageLayout): AppSceneFrame;