@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,378 +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
-
43
- // packages/cli/src/app-opentui/drone.ts
44
- import { RGBA, StyledText, TextAttributes as TextAttributes2 } from "@opentui/core";
45
- var MINI_DRONE = [
46
- "(!!!) (!!!)",
47
- " \\%==%/ ",
48
- " %%?%% ",
49
- " /%==%\\ ",
50
- "(!!!) (!!!)"
51
- ];
52
- var LEAD_MARK = [
53
- " .-=-. ",
54
- "=%%?%%=",
55
- " '-=-' "
56
- ];
57
- var BLADE_FRAMES = ["---", "\\\\\\", "|||", "///"];
58
- var EYE_FRAMES = ["o", "@", "\u2022", "."];
59
- var COLOR = {
60
- body: RGBA.fromHex(RIG_UI.lime),
61
- mini: RGBA.fromHex(RIG_UI.limeDim),
62
- rotor: RGBA.fromHex(RIG_UI.cyan),
63
- path: RGBA.fromHex(RIG_UI.cyan),
64
- eye: RGBA.fromHex(RIG_UI.ink),
65
- dim: RGBA.fromHex(RIG_UI.ink4),
66
- ink: RGBA.fromHex(RIG_UI.ink2)
67
- };
68
- function bladeForTick(tick, phase = 0) {
69
- return BLADE_FRAMES[(Math.floor(tick / 3) + phase) % BLADE_FRAMES.length];
70
- }
71
- function eyeForTick(tick, phase = 0) {
72
- const pulse = Math.sin(tick * 0.09 + phase);
73
- return pulse > 0.55 ? EYE_FRAMES[1] : pulse > 0.1 ? EYE_FRAMES[0] : pulse > -0.45 ? EYE_FRAMES[2] : EYE_FRAMES[3];
74
- }
75
- function chunk(text, fg, bold = false, dim = false) {
76
- let attributes = TextAttributes2.NONE;
77
- if (bold)
78
- attributes |= TextAttributes2.BOLD;
79
- if (dim)
80
- attributes |= TextAttributes2.DIM;
81
- return { __isChunk: true, text, fg, ...attributes !== TextAttributes2.NONE ? { attributes } : {} };
82
- }
83
- function styledLine(text, colorFor) {
84
- const chunks = [];
85
- let run = "";
86
- let runColor = null;
87
- const flush = () => {
88
- if (!run || !runColor)
89
- return;
90
- chunks.push(chunk(run, COLOR[runColor], runColor === "body" || runColor === "eye", runColor === "dim"));
91
- run = "";
92
- };
93
- for (const char of text) {
94
- const next = colorFor(char);
95
- if (next !== runColor) {
96
- flush();
97
- runColor = next;
98
- }
99
- run += char;
100
- }
101
- flush();
102
- return new StyledText(chunks.length > 0 ? chunks : [chunk("", COLOR.ink)]);
103
- }
104
- function droneColor(char) {
105
- if (char === "?" || char === "o" || char === "@" || char === "\u2022")
106
- return "eye";
107
- if (char === "%" || char === "=")
108
- return "mini";
109
- if (char === "$")
110
- return "body";
111
- if (char === "(" || char === ")" || char === "/" || char === "\\" || char === "|" || char === "-")
112
- return "rotor";
113
- if (char === "\xB7" || char === "\u2022" || char === "'" || char === ".")
114
- return "path";
115
- if (char.trim() === "")
116
- return "dim";
117
- return "ink";
118
- }
119
- function motionColor(char) {
120
- if (char === "\u25CF" || char === "\u25C6" || char === "\u25C9")
121
- return "body";
122
- if (char === "\u2022" || char === "\xB7" || char === "\u2500" || char === "\u2502" || char === "\u2571" || char === "\u2572" || char === "\u256D" || char === "\u256E" || char === "\u2570" || char === "\u256F")
123
- return "path";
124
- if (char === "\u258C" || char === "\u2590" || char === "\u2581" || char === "\u2594")
125
- return "mini";
126
- return droneColor(char);
127
- }
128
- function materializeDrone(lines, tick, phase = 0) {
129
- const blade = bladeForTick(tick, phase);
130
- const eye = eyeForTick(tick, phase);
131
- return lines.map((line) => line.replaceAll("!!!", blade).replaceAll("?", eye));
132
- }
133
- function miniDroneLines(tick, align = "left", phase = 0) {
134
- return materializeDrone(MINI_DRONE, tick, phase).map((text) => ({
135
- text,
136
- styledText: styledLine(text, droneColor),
137
- fg: RIG_UI.limeDim,
138
- align
139
- }));
140
- }
141
- function brandFleetLines(tick, align = "center") {
142
- const left = materializeDrone(MINI_DRONE, tick, 0);
143
- const right = materializeDrone(MINI_DRONE, tick, 2);
144
- const lead = materializeDrone(LEAD_MARK, tick, 1);
145
- const packet = ["\xB7", "\u2022", "\u25CF", "\u2022"][Math.floor(tick / 2) % 4];
146
- const bridge = [
147
- ` ${left[0]} ${lead[0]} ${right[0]}`,
148
- ` ${left[1]} \xB7\u2500\u2500${packet}\u2500\u2500\xB7 ${lead[1]} \xB7\u2500\u2500${packet}\u2500\u2500\xB7 ${right[1]}`,
149
- ` ${left[2]} \xB7' '${lead[2]}' '\xB7 ${right[2]}`,
150
- ` ${left[3]} \u2572 signal bus \u2571 ${right[3]}`,
151
- ` ${left[4]} \xB7\u2500\u2500\u2500${packet}\u2500\u2500\u2500\u2500\u2500\u2500${packet}\u2500\u2500\u2500\xB7 ${right[4]}`
152
- ];
153
- return bridge.map((text) => ({
154
- text,
155
- styledText: styledLine(text, motionColor),
156
- fg: RIG_UI.limeDim,
157
- align
158
- }));
159
- }
160
- function actionDrone(tick, phase = 0) {
161
- const blade = bladeForTick(tick, phase);
162
- const eye = eyeForTick(tick, phase);
163
- return `(${blade})\u2572${eye}\u2571(${blade})`;
164
- }
165
- function actionDroneLine(tick, text, fg = RIG_UI.ink2) {
166
- const prefix = actionDrone(tick);
167
- const content = `${prefix} ${text}`;
168
- return { text: content, styledText: styledLine(content, motionColor), fg, align: "center" };
169
- }
170
-
171
- // packages/cli/src/app-opentui/render/scene.ts
172
- function line(text, options = {}) {
173
- return { text, ...options };
174
- }
175
- function blank() {
176
- return { text: "" };
177
- }
178
- function deckRow(input) {
179
- const prefix = input.active ? "\u25B8" : " ";
180
- const label = input.label.toUpperCase().padEnd(10);
181
- return line(`${prefix} ${label} ${input.detail}`, {
182
- fg: input.active ? RIG_UI.lime : RIG_UI.ink2,
183
- bold: input.active,
184
- selectableIndex: input.index,
185
- activateOnClick: input.activateOnClick
186
- });
187
- }
188
- function loadingRows(label, tick = 0, compact = false) {
189
- const mascot = compact ? miniDroneLines(tick, "center") : brandFleetLines(tick, "center");
190
- return [
191
- blank(),
192
- ...mascot,
193
- blank(),
194
- { ...actionDroneLine(tick, `loading ${label}\u2026`, RIG_UI.cyan), align: "center" }
195
- ];
196
- }
197
- function errorBanner(message, hint) {
198
- return [
199
- line(`\u2717 failed to load \u2014 ${message}`, { fg: RIG_UI.red, bold: true }),
200
- ...hint ? [line(` ${hint}`, { fg: RIG_UI.ink3 })] : [],
201
- line(" select refresh/retry below", { fg: RIG_UI.ink4 }),
202
- line("", { fg: RIG_UI.ink3 })
203
- ];
204
- }
205
- function lastRefreshError(state) {
206
- const value = state.data.lastRefreshError;
207
- return typeof value === "string" && value.trim() ? value : undefined;
208
- }
209
- function makeSceneFrame(input) {
210
- return input;
211
- }
212
-
213
- // packages/cli/src/app-opentui/selectable.ts
214
- function selectableDeckRow(deck, item) {
215
- return { ...deckRow({ ...deck, activateOnClick: true }), selectable: item };
216
- }
217
-
218
- // packages/cli/src/app-opentui/remote-link.ts
219
- var REPAIRABLE_REMOTE_LINK_STATUSES = new Set([
220
- "auth_required",
221
- "project_not_registered",
222
- "no_server_checkout",
223
- "invalid_root",
224
- "needs_prepare",
225
- "error"
226
- ]);
227
- function remoteProjectLinkError(message) {
228
- return /no server-host project root link|remote project(?:-root)? link|x-rig-project-root|serverProjectRoot/i.test(message ?? "");
229
- }
230
- function serverRecordForRemoteLink(state) {
231
- const server = state.data.server;
232
- return server && typeof server === "object" && !Array.isArray(server) ? server : null;
233
- }
234
- function remoteProjectLinkState(state) {
235
- const serverRecord = serverRecordForRemoteLink(state);
236
- if (!serverRecord || serverRecord.kind !== "remote")
237
- return null;
238
- const link = serverRecord.remoteProjectLink;
239
- if (link && typeof link === "object" && !Array.isArray(link))
240
- return link;
241
- const direct = state.data.remoteProjectLink;
242
- if (direct && typeof direct === "object" && !Array.isArray(direct))
243
- return direct;
244
- return null;
245
- }
246
- function shouldOfferRemoteLinkRepair(state, message) {
247
- const link = remoteProjectLinkState(state);
248
- if (link) {
249
- if (link.ok === true)
250
- return false;
251
- const status = link.status ?? "";
252
- return REPAIRABLE_REMOTE_LINK_STATUSES.has(status);
253
- }
254
- const serverRecord = serverRecordForRemoteLink(state);
255
- if (serverRecord && serverRecord.kind !== "remote")
256
- return false;
257
- return remoteProjectLinkError(message ?? state.error?.message);
258
- }
259
-
260
- // packages/cli/src/app-opentui/scenes/server.ts
261
- var SERVER_ACTIONS = [
262
- { detail: "probe selected server, project root, and GitHub auth", item: { id: "refresh", label: "refresh", intent: { scene: "server", argv: ["server", "status"], action: { kind: "refresh", label: "Refresh server" } }, message: "refresh selected server" } },
263
- { detail: "select local server for this repo", item: { id: "local", label: "use local", intent: { scene: "server", argv: ["server", "use", "local"], action: { kind: "server-use-local", label: "Use local server" } }, message: "switch this repo to local" } },
264
- { detail: "type a saved remote alias to select", item: { id: "remote", label: "use remote", prompt: { label: "Use remote alias", scene: "server", argv: ["server", "use"], intentKind: "server-use-remote", payloadBase: {}, payloadKey: "alias" }, message: "choose a saved remote alias" } },
265
- { detail: "show saved local/remote aliases in the status panel", item: { id: "list", label: "list servers", intent: { scene: "server", argv: ["server", "list"], action: { kind: "refresh", label: "List servers" } }, message: "list saved server aliases" } },
266
- { detail: "add and select a remote: enter <alias> <https-url>", item: { id: "add", label: "add remote", prompt: { label: "Add remote", scene: "server", argv: ["server", "add"], intentKind: "server-add-remote", payloadBase: {}, payloadKey: "remote", appendValueToArgv: true }, message: "add a remote server alias" } },
267
- { detail: "spawn the local rig-server detached and return here", item: { id: "start", label: "start local", intent: { scene: "server", argv: ["server", "start"], action: { kind: "refresh", payload: { startLocal: true }, label: "Start local server" } }, message: "start local server detached" } },
268
- { detail: "import gh token into the selected server namespace", item: { id: "auth", label: "import auth", intent: { scene: "server", argv: ["github", "auth", "import-gh"], action: { kind: "github-auth-import", label: "Import GitHub auth" } }, message: "import gh auth to selected server" } },
269
- { detail: "diagnose server/auth/project linkage", item: { id: "doctor", label: "doctor", intent: { scene: "doctor", argv: ["doctor"], action: { kind: "doctor-run", label: "Run doctor" } }, message: "verify server/auth" } },
270
- { detail: "verify selected server can list task source", item: { id: "tasks", label: "tasks", intent: { scene: "tasks", argv: ["task", "list"], action: { kind: "refresh", label: "Open tasks" } }, message: "verify task source" } },
271
- { detail: "verify selected server can list recent runs", item: { id: "runs", label: "runs", intent: { scene: "fleet", argv: ["run", "status"], action: { kind: "refresh", label: "Open runs" } }, message: "open recent runs" } }
272
- ];
273
- function remoteAliasActions(server) {
274
- const aliases = (server?.aliases ?? []).filter((alias) => alias.kind === "remote");
275
- return aliases.map((alias) => ({
276
- detail: `${alias.selected ? "selected" : "select"} ${alias.baseUrl ?? "remote endpoint"}`,
277
- item: {
278
- id: `remote-alias:${alias.alias}`,
279
- label: alias.selected ? `\u2713 ${alias.alias}` : `use ${alias.alias}`,
280
- intent: { scene: "server", argv: ["server", "use", alias.alias], action: { kind: "server-use-remote", label: `Use ${alias.alias}`, payload: { alias: alias.alias } } },
281
- message: `select ${alias.alias}`
282
- }
283
- }));
284
- }
285
- function serverActions(state) {
286
- const server = serverState(state);
287
- const remoteRows = remoteAliasActions(server);
288
- let actions = remoteRows.length > 0 ? [...SERVER_ACTIONS.slice(0, 3), ...remoteRows, ...SERVER_ACTIONS.slice(3)] : [...SERVER_ACTIONS];
289
- if (!shouldOfferRemoteLinkRepair(state))
290
- return actions;
291
- const repair = { detail: "backfill or prepare the selected remote checkout/root link", item: { id: "repair-link", label: "repair link", intent: { scene: "server", argv: ["server", "repair-link"], action: { kind: "remote-link-repair", label: "Repair remote link" } }, message: "prepare remote checkout link" } };
292
- const doctorIndex = actions.findIndex((entry) => entry.item.id === "doctor");
293
- if (doctorIndex < 0)
294
- return [...actions, repair];
295
- return [...actions.slice(0, doctorIndex), repair, ...actions.slice(doctorIndex)];
296
- }
297
- function cleanVisible(value, fallback = "unknown") {
298
- return value?.trim() || fallback;
299
- }
300
- function targetLabel(server) {
301
- if (!server)
302
- return "not checked";
303
- return server.kind === "remote" ? "remote endpoint" : server.kind === "local" ? "local endpoint" : cleanVisible(server.baseUrl);
304
- }
305
- function serverState(state) {
306
- const server = state.data.server;
307
- return server && typeof server === "object" && !Array.isArray(server) ? server : null;
308
- }
309
- function panelWidth(layout) {
310
- return layout?.centerWidth ?? 118;
311
- }
312
- function panelHeight(layout) {
313
- return Math.max(18, layout?.centerHeight ?? 34);
314
- }
315
- function selectedIndex(state, count) {
316
- return Math.max(0, Math.min(count - 1, state.selection.index));
317
- }
318
- function statusRows(server) {
319
- const auth = server?.auth;
320
- const signedIn = auth && (auth.signedIn === true || auth.authenticated === true || auth.status === "authenticated") ? "authenticated" : "auth unknown";
321
- const link = server?.remoteProjectLink;
322
- const linkText = link ? link.ok ? `ready \xB7 ${link.serverProjectRoot ?? "linked"}` : `${link.status ?? "needs repair"} \xB7 ${link.hint ?? link.message ?? "run repair link"}` : server?.kind === "remote" ? "not checked" : "not required";
323
- const selectedLinkSummary = link?.ok ? " \xB7 root link ready" : server?.kind === "remote" && link ? ` \xB7 root link ${link.status ?? "needs repair"}` : "";
324
- return [
325
- line(`selected ${cleanVisible(server?.label, "not checked")}${selectedLinkSummary}`, { fg: RIG_UI.ink2 }),
326
- line(`target ${targetLabel(server)}`, { fg: RIG_UI.ink3 }),
327
- line(`mode ${server?.kind ?? "local or remote"}`, { fg: RIG_UI.ink3 }),
328
- line(`health ${server ? server.reachable ? "reachable" : "unreachable" : "check pending"}`, { fg: server?.reachable ? RIG_UI.limeDim : server ? RIG_UI.red : RIG_UI.yellow }),
329
- line(`github ${signedIn}`, { fg: signedIn === "authenticated" ? RIG_UI.limeDim : RIG_UI.ink4 }),
330
- line(`root link ${linkText}`, { fg: link?.ok ? RIG_UI.limeDim : server?.kind === "remote" ? RIG_UI.yellow : RIG_UI.ink4 }),
331
- ...server?.aliases && server.aliases.length > 0 ? [line(`aliases ${server.aliases.map((alias) => `${alias.selected ? "*" : ""}${alias.alias}${alias.kind === "remote" && alias.baseUrl ? `=${alias.baseUrl}` : ""}`).join(", ")}`, { fg: RIG_UI.ink4 })] : [],
332
- ...server?.error ? [line(`attention ${server.error}`, { fg: RIG_UI.yellow })] : []
333
- ];
334
- }
335
- function renderServerScene(state, layout) {
336
- const server = serverState(state);
337
- const actions = serverActions(state);
338
- const selected = selectedIndex(state, actions.length);
339
- const loading = state.status === "loading" && !server;
340
- const errorText = state.error?.message ?? lastRefreshError(state);
341
- const panelLines = [
342
- ...errorText ? errorBanner(errorText, "select refresh or doctor below to retry") : [],
343
- line("server controls", { fg: RIG_UI.ink3 }),
344
- blank(),
345
- line("STATUS", { fg: RIG_UI.ink3, bold: true }),
346
- ...loading ? loadingRows("server status", state.tick) : statusRows(server),
347
- blank(),
348
- line("ACTIONS", { fg: RIG_UI.ink3, bold: true }),
349
- ...actions.map(({ detail, item }, index) => selectableDeckRow({ label: item.label, detail, index, active: selected === index }, item)),
350
- blank(),
351
- line("enter/click runs native actions \xB7 add/use remote prompts stay in OpenTUI", { fg: RIG_UI.ink4 })
352
- ];
353
- return makeSceneFrame({
354
- scene: "server",
355
- title: "Server",
356
- lines: [],
357
- panels: [{
358
- id: "server-actions",
359
- top: 0,
360
- width: panelWidth(layout),
361
- height: panelHeight(layout),
362
- lines: panelLines,
363
- backgroundColor: RIG_UI.panel,
364
- backgroundAlpha: 184,
365
- opacity: 0.98,
366
- border: false,
367
- chrome: "ad-terminal",
368
- headerText: "rig server \xB7 select / repair / auth",
369
- paddingX: 5,
370
- paddingY: 2
371
- }],
372
- footer: { server: server?.label, message: server?.latencyMs !== undefined ? `${server.latencyMs}ms` : undefined },
373
- live: state.status === "action" || !server
374
- });
375
- }
376
- export {
377
- renderServerScene
378
- };
@@ -1,3 +0,0 @@
1
- import type { StageLayout } from "../layout";
2
- import type { AppSceneFrame, AppState } from "../types";
3
- export declare function renderTasksScene(state: AppState, layout?: StageLayout): AppSceneFrame;