@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,509 +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
- function statusGlyph(status) {
69
- switch (status) {
70
- case "success":
71
- case "completed":
72
- case "merged":
73
- return "\u2713";
74
- case "running":
75
- return "\u25CF";
76
- case "preparing":
77
- case "created":
78
- case "validating":
79
- case "reviewing":
80
- case "closing-out":
81
- case "stopping":
82
- case "loading":
83
- case "action":
84
- return "\u25D0";
85
- case "needs-attention":
86
- case "needs_attention":
87
- return "\u26A0";
88
- case "failed":
89
- case "error":
90
- return "\u2717";
91
- default:
92
- return "\xB7";
93
- }
94
- }
95
- function noColorActive() {
96
- const noColor = process.env.NO_COLOR;
97
- if (noColor !== undefined && noColor !== "") {
98
- return true;
99
- }
100
- return process.env.RIG_NO_COLOR !== undefined;
101
- }
102
- function statusLabel(status) {
103
- return {
104
- glyph: statusGlyph(status),
105
- color: noColorActive() ? RIG_UI.ink : statusColor(status)
106
- };
107
- }
108
-
109
- // packages/cli/src/app-opentui/drone.ts
110
- import { RGBA, StyledText, TextAttributes as TextAttributes2 } from "@opentui/core";
111
- var MINI_DRONE = [
112
- "(!!!) (!!!)",
113
- " \\%==%/ ",
114
- " %%?%% ",
115
- " /%==%\\ ",
116
- "(!!!) (!!!)"
117
- ];
118
- var LEAD_MARK = [
119
- " .-=-. ",
120
- "=%%?%%=",
121
- " '-=-' "
122
- ];
123
- var BLADE_FRAMES = ["---", "\\\\\\", "|||", "///"];
124
- var EYE_FRAMES = ["o", "@", "\u2022", "."];
125
- var COLOR = {
126
- body: RGBA.fromHex(RIG_UI.lime),
127
- mini: RGBA.fromHex(RIG_UI.limeDim),
128
- rotor: RGBA.fromHex(RIG_UI.cyan),
129
- path: RGBA.fromHex(RIG_UI.cyan),
130
- eye: RGBA.fromHex(RIG_UI.ink),
131
- dim: RGBA.fromHex(RIG_UI.ink4),
132
- ink: RGBA.fromHex(RIG_UI.ink2)
133
- };
134
- function bladeForTick(tick, phase = 0) {
135
- return BLADE_FRAMES[(Math.floor(tick / 3) + phase) % BLADE_FRAMES.length];
136
- }
137
- function eyeForTick(tick, phase = 0) {
138
- const pulse = Math.sin(tick * 0.09 + phase);
139
- return pulse > 0.55 ? EYE_FRAMES[1] : pulse > 0.1 ? EYE_FRAMES[0] : pulse > -0.45 ? EYE_FRAMES[2] : EYE_FRAMES[3];
140
- }
141
- function chunk(text, fg, bold = false, dim = false) {
142
- let attributes = TextAttributes2.NONE;
143
- if (bold)
144
- attributes |= TextAttributes2.BOLD;
145
- if (dim)
146
- attributes |= TextAttributes2.DIM;
147
- return { __isChunk: true, text, fg, ...attributes !== TextAttributes2.NONE ? { attributes } : {} };
148
- }
149
- function styledLine(text, colorFor) {
150
- const chunks = [];
151
- let run = "";
152
- let runColor = null;
153
- const flush = () => {
154
- if (!run || !runColor)
155
- return;
156
- chunks.push(chunk(run, COLOR[runColor], runColor === "body" || runColor === "eye", runColor === "dim"));
157
- run = "";
158
- };
159
- for (const char of text) {
160
- const next = colorFor(char);
161
- if (next !== runColor) {
162
- flush();
163
- runColor = next;
164
- }
165
- run += char;
166
- }
167
- flush();
168
- return new StyledText(chunks.length > 0 ? chunks : [chunk("", COLOR.ink)]);
169
- }
170
- function droneColor(char) {
171
- if (char === "?" || char === "o" || char === "@" || char === "\u2022")
172
- return "eye";
173
- if (char === "%" || char === "=")
174
- return "mini";
175
- if (char === "$")
176
- return "body";
177
- if (char === "(" || char === ")" || char === "/" || char === "\\" || char === "|" || char === "-")
178
- return "rotor";
179
- if (char === "\xB7" || char === "\u2022" || char === "'" || char === ".")
180
- return "path";
181
- if (char.trim() === "")
182
- return "dim";
183
- return "ink";
184
- }
185
- function motionColor(char) {
186
- if (char === "\u25CF" || char === "\u25C6" || char === "\u25C9")
187
- return "body";
188
- if (char === "\u2022" || char === "\xB7" || char === "\u2500" || char === "\u2502" || char === "\u2571" || char === "\u2572" || char === "\u256D" || char === "\u256E" || char === "\u2570" || char === "\u256F")
189
- return "path";
190
- if (char === "\u258C" || char === "\u2590" || char === "\u2581" || char === "\u2594")
191
- return "mini";
192
- return droneColor(char);
193
- }
194
- function materializeDrone(lines, tick, phase = 0) {
195
- const blade = bladeForTick(tick, phase);
196
- const eye = eyeForTick(tick, phase);
197
- return lines.map((line) => line.replaceAll("!!!", blade).replaceAll("?", eye));
198
- }
199
- function miniDroneLines(tick, align = "left", phase = 0) {
200
- return materializeDrone(MINI_DRONE, tick, phase).map((text) => ({
201
- text,
202
- styledText: styledLine(text, droneColor),
203
- fg: RIG_UI.limeDim,
204
- align
205
- }));
206
- }
207
- function brandFleetLines(tick, align = "center") {
208
- const left = materializeDrone(MINI_DRONE, tick, 0);
209
- const right = materializeDrone(MINI_DRONE, tick, 2);
210
- const lead = materializeDrone(LEAD_MARK, tick, 1);
211
- const packet = ["\xB7", "\u2022", "\u25CF", "\u2022"][Math.floor(tick / 2) % 4];
212
- const bridge = [
213
- ` ${left[0]} ${lead[0]} ${right[0]}`,
214
- ` ${left[1]} \xB7\u2500\u2500${packet}\u2500\u2500\xB7 ${lead[1]} \xB7\u2500\u2500${packet}\u2500\u2500\xB7 ${right[1]}`,
215
- ` ${left[2]} \xB7' '${lead[2]}' '\xB7 ${right[2]}`,
216
- ` ${left[3]} \u2572 signal bus \u2571 ${right[3]}`,
217
- ` ${left[4]} \xB7\u2500\u2500\u2500${packet}\u2500\u2500\u2500\u2500\u2500\u2500${packet}\u2500\u2500\u2500\xB7 ${right[4]}`
218
- ];
219
- return bridge.map((text) => ({
220
- text,
221
- styledText: styledLine(text, motionColor),
222
- fg: RIG_UI.limeDim,
223
- align
224
- }));
225
- }
226
- function actionDrone(tick, phase = 0) {
227
- const blade = bladeForTick(tick, phase);
228
- const eye = eyeForTick(tick, phase);
229
- return `(${blade})\u2572${eye}\u2571(${blade})`;
230
- }
231
- function actionDroneLine(tick, text, fg = RIG_UI.ink2) {
232
- const prefix = actionDrone(tick);
233
- const content = `${prefix} ${text}`;
234
- return { text: content, styledText: styledLine(content, motionColor), fg, align: "center" };
235
- }
236
-
237
- // packages/cli/src/app-opentui/render/scene.ts
238
- function line(text, options = {}) {
239
- return { text, ...options };
240
- }
241
- function blank() {
242
- return { text: "" };
243
- }
244
- function deckRow(input) {
245
- const prefix = input.active ? "\u25B8" : " ";
246
- const label = input.label.toUpperCase().padEnd(10);
247
- return line(`${prefix} ${label} ${input.detail}`, {
248
- fg: input.active ? RIG_UI.lime : RIG_UI.ink2,
249
- bold: input.active,
250
- selectableIndex: input.index,
251
- activateOnClick: input.activateOnClick
252
- });
253
- }
254
- function loadingRows(label, tick = 0, compact = false) {
255
- const mascot = compact ? miniDroneLines(tick, "center") : brandFleetLines(tick, "center");
256
- return [
257
- blank(),
258
- ...mascot,
259
- blank(),
260
- { ...actionDroneLine(tick, `loading ${label}\u2026`, RIG_UI.cyan), align: "center" }
261
- ];
262
- }
263
- function errorBanner(message, hint) {
264
- return [
265
- line(`\u2717 failed to load \u2014 ${message}`, { fg: RIG_UI.red, bold: true }),
266
- ...hint ? [line(` ${hint}`, { fg: RIG_UI.ink3 })] : [],
267
- line(" select refresh/retry below", { fg: RIG_UI.ink4 }),
268
- line("", { fg: RIG_UI.ink3 })
269
- ];
270
- }
271
- function lastRefreshError(state) {
272
- const value = state.data.lastRefreshError;
273
- return typeof value === "string" && value.trim() ? value : undefined;
274
- }
275
- function makeSceneFrame(input) {
276
- return input;
277
- }
278
-
279
- // packages/cli/src/app-opentui/selectable.ts
280
- function selectableDeckRow(deck, item) {
281
- return { ...deckRow({ ...deck, activateOnClick: true }), selectable: item };
282
- }
283
- function withSelectable(line2, item) {
284
- return { ...line2, selectable: item, activateOnClick: true };
285
- }
286
-
287
- // packages/cli/src/app-opentui/scenes/pi.ts
288
- var PI_ACTIONS = [
289
- { detail: "add an npm package or git source to .pi/settings.json", item: { id: "pi-add", label: "add", prompt: { label: "pi add", scene: "command", argv: ["pi", "add"], intentKind: "command-run", payloadBase: {}, payloadKey: "source", appendValueToArgv: true }, message: "add a Pi extension package" } },
290
- { detail: "search npm for Pi extensions \u2014 results render as an installable list", item: { id: "pi-search", label: "search", prompt: { label: "pi search", scene: "pi", argv: ["pi", "list"], intentKind: "refresh", payloadBase: {}, payloadKey: "piSearch" }, message: "search npm for installable Pi extensions" } },
291
- { detail: "re-read project + user Pi settings", item: { id: "pi-refresh", label: "refresh", intent: { scene: "pi", argv: ["pi", "list"], action: { kind: "refresh", label: "Refresh Pi extensions" } }, message: "reload Pi packages" } }
292
- ];
293
- function snapshot(state) {
294
- const value = state.data.pi;
295
- return value && typeof value === "object" && !Array.isArray(value) ? value : null;
296
- }
297
- function selectedPackage(state) {
298
- const value = state.data.selectedPiPackage;
299
- return typeof value === "string" && value.trim() ? value.trim() : undefined;
300
- }
301
- function selectedUserPackage(state) {
302
- const value = state.data.selectedPiUserPackage;
303
- return typeof value === "string" && value.trim() ? value.trim() : undefined;
304
- }
305
- var PI_BACK_ITEM = {
306
- id: "pi-back",
307
- label: "back",
308
- data: { selectedPiPackage: undefined, selectedPiUserPackage: undefined },
309
- message: "back to Pi package list"
310
- };
311
- var PI_CLEAR_SEARCH_ITEM = {
312
- id: "pi-clear-search",
313
- label: "clear search",
314
- intent: { scene: "pi", argv: ["pi", "list"], action: { kind: "refresh", label: "Clear Pi search", payload: { piSearch: "" } } },
315
- message: "clear the search results"
316
- };
317
- function panelWidth(layout) {
318
- return layout?.centerWidth ?? 118;
319
- }
320
- function panelHeight(layout) {
321
- return Math.max(18, layout?.centerHeight ?? 34);
322
- }
323
- function projectRow(pkg) {
324
- const { glyph, color } = statusLabel(pkg.managedByRigConfig ? "needs-attention" : "success");
325
- const tag = pkg.managedByRigConfig ? " [rig.config runtime.pi.packages]" : "";
326
- const row = line(` ${glyph} ${pkg.source}${tag} \u203A`, { fg: pkg.managedByRigConfig ? color : RIG_UI.ink2 });
327
- const drill = {
328
- id: `pi-detail:${pkg.source}`,
329
- label: pkg.source,
330
- data: { selectedPiPackage: pkg.source },
331
- message: `open ${pkg.source} detail`
332
- };
333
- return withSelectable(row, drill);
334
- }
335
- function installedSource(result, projectPackages) {
336
- return projectPackages.find((pkg) => pkg.source === result.name || pkg.source.startsWith(`${result.name}@`));
337
- }
338
- function searchResultRow(result, installed, width) {
339
- const version = result.version ? `@${result.version}` : "";
340
- const head = `${result.name}${version}`;
341
- const descWidth = Math.max(12, width - head.length - 8);
342
- const desc = result.description.length > descWidth ? `${result.description.slice(0, Math.max(0, descWidth - 1))}\u2026` : result.description;
343
- if (installed) {
344
- const { glyph, color } = statusLabel("success");
345
- return line(` ${glyph} ${head} ${desc} \xB7 installed`, { fg: color });
346
- }
347
- const row = line(` + ${head} ${desc} \u203A`, { fg: RIG_UI.ink2 });
348
- const install = {
349
- id: `pi-install:${result.name}`,
350
- label: `add ${result.name}`,
351
- intent: { scene: "command", argv: ["pi", "add", result.name], action: { kind: "command-run", label: `Add ${result.name}` } },
352
- message: `install ${result.name} via pi add`
353
- };
354
- return withSelectable(row, install);
355
- }
356
- function searchResultsView(pi, width) {
357
- const term = pi.searchTerm ?? "";
358
- const results = pi.searchResults;
359
- const rows = [
360
- line(`SEARCH RESULTS${term ? ` \xB7 "${term}"` : ""} \xB7 ${results.length}`, { fg: RIG_UI.ink3, bold: true }),
361
- line("enter/click a result to install it in-app \xB7 already-installed rows are marked", { fg: RIG_UI.ink4 }),
362
- blank()
363
- ];
364
- if (results.length === 0) {
365
- rows.push(line(` (no Pi extension packages found${term ? ` for "${term}"` : ""})`, { fg: RIG_UI.ink4 }));
366
- } else {
367
- rows.push(...results.map((result) => searchResultRow(result, installedSource(result, pi.projectPackages), width)));
368
- }
369
- rows.push(blank(), selectableDeckRow({ label: "clear search", detail: "return to the package list", index: 0, active: true }, PI_CLEAR_SEARCH_ITEM));
370
- return rows;
371
- }
372
- function packageDetail(pkg, pi) {
373
- const { glyph, color } = statusLabel(pkg.managedByRigConfig ? "needs-attention" : "success");
374
- const hit = pi.searchResults.find((result) => pkg.source === result.name || pkg.source.startsWith(`${result.name}@`));
375
- const pinnedVersion = pkg.source.includes("@") && !pkg.source.startsWith("@") ? pkg.source.slice(pkg.source.indexOf("@") + 1) : undefined;
376
- const version = pinnedVersion ?? hit?.version ?? "";
377
- const settingsLine = pkg.managedByRigConfig ? "rig.config.ts \u2192 runtime.pi.packages (materialized to .pi/settings.json)" : ".pi/settings.json \u2192 packages[]";
378
- const rows = [
379
- line(`${glyph} ${pkg.source}`, { fg: color, bold: true }),
380
- blank(),
381
- line(` version ${version || "(unpinned \u2014 Pi installs latest)"}`, { fg: version ? RIG_UI.ink2 : RIG_UI.ink4 }),
382
- line(` description ${hit?.description || "(run search to fetch a description)"}`, { fg: hit?.description ? RIG_UI.ink3 : RIG_UI.ink4 }),
383
- line(` state ${pkg.managedByRigConfig ? "managed by rig.config (pending materialization)" : "installed (Pi auto-installs at session start)"}`, { fg: pkg.managedByRigConfig ? color : RIG_UI.ink3 }),
384
- line(` settings ${settingsLine}`, { fg: RIG_UI.ink3 }),
385
- blank(),
386
- line("ACTIONS", { fg: RIG_UI.ink3, bold: true })
387
- ];
388
- if (pkg.managedByRigConfig) {
389
- rows.push(line(" managed by rig.config \u2014 edit rig.config.ts to change it", { fg: RIG_UI.ink4 }));
390
- rows.push(blank(), selectableDeckRow({ label: "back", detail: "return to the package list", index: 0, active: false }, PI_BACK_ITEM));
391
- } else {
392
- rows.push(selectableDeckRow({ label: "reinstall", detail: `re-run pi add ${pkg.source} (re-pulls the package)`, index: 0, active: true }, { id: `pi-reinstall:${pkg.source}`, label: `reinstall ${pkg.source}`, intent: { scene: "command", argv: ["pi", "add", pkg.source], action: { kind: "command-run", label: `Reinstall ${pkg.source}` } }, message: `reinstall ${pkg.source}` }), selectableDeckRow({ label: "remove", detail: `remove ${pkg.source} from .pi/settings.json`, index: 1, active: false }, { id: `pi-remove:${pkg.source}`, label: `remove ${pkg.source}`, intent: { scene: "command", argv: ["pi", "remove", pkg.source], action: { kind: "command-run", label: `Remove ${pkg.source}` } }, message: `remove ${pkg.source}` }), blank(), selectableDeckRow({ label: "back", detail: "return to the package list", index: 2, active: false }, PI_BACK_ITEM));
393
- }
394
- return rows;
395
- }
396
- function userPackageRow(source) {
397
- const row = line(` \xB7 ${source} \u203A`, { fg: RIG_UI.ink3 });
398
- const drill = {
399
- id: `pi-user-detail:${source}`,
400
- label: source,
401
- data: { selectedPiUserPackage: source },
402
- message: `open user package ${source}`
403
- };
404
- return withSelectable(row, drill);
405
- }
406
- function userPackageDetail(source, pi) {
407
- const { glyph, color } = statusLabel("success");
408
- const hit = pi.searchResults.find((result) => source === result.name || source.startsWith(`${result.name}@`));
409
- const alreadyInProject = pi.projectPackages.some((pkg) => pkg.source === source || pkg.source.startsWith(`${source}@`));
410
- const pinnedVersion = source.includes("@") && !source.startsWith("@") ? source.slice(source.indexOf("@") + 1) : undefined;
411
- const version = pinnedVersion ?? hit?.version ?? "";
412
- const rows = [
413
- line(`${glyph} ${source}`, { fg: color, bold: true }),
414
- blank(),
415
- line(` version ${version || "(unpinned \u2014 Pi installs latest)"}`, { fg: version ? RIG_UI.ink2 : RIG_UI.ink4 }),
416
- line(` description ${hit?.description || "(run search to fetch a description)"}`, { fg: hit?.description ? RIG_UI.ink3 : RIG_UI.ink4 }),
417
- line(` scope user \u2014 ~/.pi/agent/settings.json (shared across projects)`, { fg: RIG_UI.ink3 }),
418
- line(` in project ${alreadyInProject ? "yes \u2014 already in .pi/settings.json" : "no \u2014 user-only"}`, { fg: alreadyInProject ? RIG_UI.ink3 : RIG_UI.ink4 }),
419
- blank(),
420
- line("ACTIONS", { fg: RIG_UI.ink3, bold: true })
421
- ];
422
- if (alreadyInProject) {
423
- rows.push(line(" already promoted to this project", { fg: RIG_UI.ink4 }));
424
- } else {
425
- rows.push(selectableDeckRow({ label: "promote", detail: `pi add ${source} (copy into THIS project's .pi/settings.json)`, index: 0, active: true }, { id: `pi-promote:${source}`, label: `promote ${source}`, intent: { scene: "command", argv: ["pi", "add", source], action: { kind: "command-run", label: `Promote ${source} to project` } }, message: `promote ${source} to this project` }));
426
- }
427
- rows.push(blank(), selectableDeckRow({ label: "back", detail: "return to the package list", index: 1, active: false }, PI_BACK_ITEM));
428
- return rows;
429
- }
430
- function renderPiScene(state, layout) {
431
- const pi = snapshot(state);
432
- const selected = Math.max(0, Math.min(PI_ACTIONS.length - 1, state.selection.index));
433
- const loading = state.status === "loading" && !pi;
434
- const refreshError = lastRefreshError(state);
435
- const projectPackages = pi?.projectPackages ?? [];
436
- const userPackages = pi?.userPackages ?? [];
437
- const searchTerm = pi?.searchTerm;
438
- const hasSearch = searchTerm !== undefined && searchTerm !== "";
439
- const drilled = selectedPackage(state);
440
- const detailPkg = drilled ? projectPackages.find((pkg) => pkg.source === drilled) : undefined;
441
- const drilledUser = selectedUserPackage(state);
442
- const detailUser = drilledUser ? userPackages.find((source) => source === drilledUser) : undefined;
443
- const bodyWidth = Math.max(40, panelWidth(layout) - (layout?.compact ? 8 : 12));
444
- const panelLines = detailPkg && pi ? [
445
- ...refreshError && !state.error ? errorBanner(refreshError) : [],
446
- line(`PI PACKAGE \xB7 ${detailPkg.source}`, { fg: RIG_UI.ink3, bold: true }),
447
- blank(),
448
- ...packageDetail(detailPkg, pi)
449
- ] : detailUser && pi ? [
450
- ...refreshError && !state.error ? errorBanner(refreshError) : [],
451
- line(`USER PACKAGE \xB7 ${detailUser}`, { fg: RIG_UI.ink3, bold: true }),
452
- blank(),
453
- ...userPackageDetail(detailUser, pi)
454
- ] : hasSearch && pi ? [
455
- ...refreshError && !state.error ? errorBanner(refreshError) : [],
456
- line("Pi extension packages", { fg: RIG_UI.ink3 }),
457
- blank(),
458
- line("ACTIONS", { fg: RIG_UI.ink3, bold: true }),
459
- ...PI_ACTIONS.map(({ detail, item }, index) => selectableDeckRow({ label: item.label, detail, index, active: selected === index }, item)),
460
- blank(),
461
- ...searchResultsView(pi, bodyWidth)
462
- ] : [
463
- ...refreshError && !state.error ? errorBanner(refreshError) : [],
464
- line("Pi extension packages", { fg: RIG_UI.ink3 }),
465
- blank(),
466
- line("ACTIONS", { fg: RIG_UI.ink3, bold: true }),
467
- ...PI_ACTIONS.map(({ detail, item }, index) => selectableDeckRow({ label: item.label, detail, index, active: selected === index }, item)),
468
- blank(),
469
- ...loading ? loadingRows("Pi extensions", state.tick) : [
470
- line(`PROJECT PACKAGES (.pi/settings.json) \xB7 ${projectPackages.length}`, { fg: RIG_UI.ink3, bold: true }),
471
- ...projectPackages.length > 0 ? projectPackages.map((pkg) => projectRow(pkg)) : [line(" (none) \u2014 select add to install one, or search to discover", { fg: RIG_UI.ink4 })],
472
- blank(),
473
- line(`USER PACKAGES (~/.pi/agent/settings.json) \xB7 ${userPackages.length}`, { fg: RIG_UI.ink3, bold: true }),
474
- ...userPackages.length > 0 ? userPackages.map((source) => userPackageRow(source)) : [line(" (none)", { fg: RIG_UI.ink4 })]
475
- ],
476
- blank(),
477
- line("enter/click any package to drill in \xB7 user packages can be promoted to the project \xB7 search installs in-app", { fg: RIG_UI.ink4 })
478
- ];
479
- const headerText = detailPkg ? `rig pi \xB7 ${detailPkg.source}` : detailUser ? `rig pi \xB7 user \xB7 ${detailUser}` : hasSearch ? `rig pi \xB7 search "${searchTerm}" \xB7 ${pi?.searchResults.length ?? 0} hits` : `rig pi \xB7 ${projectPackages.length} project \xB7 ${userPackages.length} user`;
480
- const footerMessage = detailPkg ? `${detailPkg.source} \u2014 back returns to list` : detailUser ? `${detailUser} (user) \u2014 back returns to list` : hasSearch ? `${pi?.searchResults.length ?? 0} search hits \u2014 enter installs \xB7 clear search returns` : pi ? `${projectPackages.length} project \xB7 ${userPackages.length} user Pi packages` : "loading Pi packages";
481
- return makeSceneFrame({
482
- scene: "pi",
483
- title: "Pi",
484
- lines: [],
485
- panels: [{
486
- id: "pi-packages",
487
- top: 0,
488
- width: panelWidth(layout),
489
- height: panelHeight(layout),
490
- lines: panelLines,
491
- backgroundColor: RIG_UI.panel,
492
- backgroundAlpha: 184,
493
- opacity: 0.98,
494
- border: false,
495
- stickyScroll: true,
496
- stickyStart: "top",
497
- chrome: "ad-terminal",
498
- headerText,
499
- headerHeight: 3,
500
- paddingX: layout?.compact ? 3 : 5,
501
- paddingY: 2
502
- }],
503
- footer: { message: footerMessage },
504
- live: state.status === "action" || !pi
505
- });
506
- }
507
- export {
508
- renderPiScene
509
- };
@@ -1,3 +0,0 @@
1
- import type { AppSceneFrame, AppState } from "../types";
2
- import type { StageLayout } from "../layout";
3
- export declare function renderPluginScene(state: AppState, layout?: StageLayout): AppSceneFrame;