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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/dist/bin/rig.js +22085 -14618
  2. package/dist/src/app/board.js +155 -28
  3. package/dist/src/app-opentui/adapters/doctor.d.ts +0 -2
  4. package/dist/src/app-opentui/adapters/doctor.js +1 -25
  5. package/dist/src/app-opentui/adapters/family.d.ts +62 -0
  6. package/dist/src/app-opentui/adapters/family.js +14305 -0
  7. package/dist/src/app-opentui/adapters/fleet.d.ts +0 -2
  8. package/dist/src/app-opentui/adapters/fleet.js +6 -40
  9. package/dist/src/app-opentui/adapters/inbox.d.ts +12 -2
  10. package/dist/src/app-opentui/adapters/inbox.js +54 -59
  11. package/dist/src/app-opentui/adapters/init.d.ts +0 -2
  12. package/dist/src/app-opentui/adapters/init.js +0 -26
  13. package/dist/src/app-opentui/adapters/inspect.d.ts +52 -0
  14. package/dist/src/app-opentui/adapters/inspect.js +1024 -0
  15. package/dist/src/app-opentui/adapters/pi-attach.d.ts +15 -6
  16. package/dist/src/app-opentui/adapters/pi-attach.js +348 -93
  17. package/dist/src/app-opentui/adapters/pi.d.ts +23 -0
  18. package/dist/src/app-opentui/adapters/pi.js +363 -0
  19. package/dist/src/app-opentui/adapters/plugin.d.ts +84 -0
  20. package/dist/src/app-opentui/adapters/plugin.js +544 -0
  21. package/dist/src/app-opentui/adapters/repo.d.ts +37 -0
  22. package/dist/src/app-opentui/adapters/repo.js +186 -0
  23. package/dist/src/app-opentui/adapters/run-detail.d.ts +9 -2
  24. package/dist/src/app-opentui/adapters/run-detail.js +97 -44
  25. package/dist/src/app-opentui/adapters/server.d.ts +10 -2
  26. package/dist/src/app-opentui/adapters/server.js +96 -27
  27. package/dist/src/app-opentui/adapters/tasks.d.ts +0 -2
  28. package/dist/src/app-opentui/adapters/tasks.js +437 -105
  29. package/dist/src/app-opentui/adapters/workspace.d.ts +49 -0
  30. package/dist/src/app-opentui/adapters/workspace.js +333 -0
  31. package/dist/src/app-opentui/autocomplete.d.ts +20 -0
  32. package/dist/src/app-opentui/autocomplete.js +576 -0
  33. package/dist/src/app-opentui/bootstrap.js +24296 -16919
  34. package/dist/src/app-opentui/command-palette.d.ts +3 -0
  35. package/dist/src/app-opentui/command-palette.js +1010 -0
  36. package/dist/src/app-opentui/drone.js +8 -6
  37. package/dist/src/app-opentui/fleet-stats.d.ts +32 -0
  38. package/dist/src/app-opentui/fleet-stats.js +114 -0
  39. package/dist/src/app-opentui/index.js +3438 -1724
  40. package/dist/src/app-opentui/intent.js +71 -48
  41. package/dist/src/app-opentui/keymap.d.ts +6 -5
  42. package/dist/src/app-opentui/keymap.js +1064 -23
  43. package/dist/src/app-opentui/layout.d.ts +7 -0
  44. package/dist/src/app-opentui/layout.js +13 -6
  45. package/dist/src/app-opentui/list-search.d.ts +24 -0
  46. package/dist/src/app-opentui/list-search.js +88 -1
  47. package/dist/src/app-opentui/pi-host-child.js +33 -1
  48. package/dist/src/app-opentui/pi-pty-host.d.ts +5 -0
  49. package/dist/src/app-opentui/pi-pty-host.js +21 -3
  50. package/dist/src/app-opentui/react/App.d.ts +9 -0
  51. package/dist/src/app-opentui/react/App.js +5144 -0
  52. package/dist/src/app-opentui/react/Backdrop.d.ts +5 -0
  53. package/dist/src/app-opentui/react/Backdrop.js +1834 -0
  54. package/dist/src/app-opentui/react/ChromeHost.d.ts +5 -0
  55. package/dist/src/app-opentui/react/ChromeHost.js +2942 -0
  56. package/dist/src/app-opentui/react/SceneFrameView.d.ts +7 -0
  57. package/dist/src/app-opentui/react/SceneFrameView.js +529 -0
  58. package/dist/src/app-opentui/react/context.d.ts +17 -0
  59. package/dist/src/app-opentui/react/context.js +37 -0
  60. package/dist/src/app-opentui/react/launch.d.ts +2 -0
  61. package/dist/src/app-opentui/react/launch.js +5743 -0
  62. package/dist/src/app-opentui/react/nav.d.ts +18 -0
  63. package/dist/src/app-opentui/react/nav.js +54 -0
  64. package/dist/src/app-opentui/react/scroll.d.ts +12 -0
  65. package/dist/src/app-opentui/react/scroll.js +21 -0
  66. package/dist/src/app-opentui/react/syntax.d.ts +2 -0
  67. package/dist/src/app-opentui/react/syntax.js +64 -0
  68. package/dist/src/app-opentui/registry.js +19923 -5151
  69. package/dist/src/app-opentui/render/constants.d.ts +31 -0
  70. package/dist/src/app-opentui/render/constants.js +66 -0
  71. package/dist/src/app-opentui/render/graphics.d.ts +2 -1
  72. package/dist/src/app-opentui/render/graphics.js +106 -39
  73. package/dist/src/app-opentui/render/image-visual-layer-worker.js +108 -20
  74. package/dist/src/app-opentui/render/image-visual-layer.d.ts +7 -0
  75. package/dist/src/app-opentui/render/image-visual-layer.js +109 -20
  76. package/dist/src/app-opentui/render/native-host.d.ts +37 -0
  77. package/dist/src/app-opentui/render/native-host.js +179 -0
  78. package/dist/src/app-opentui/render/panels.js +18 -11
  79. package/dist/src/app-opentui/render/preloader.js +8 -6
  80. package/dist/src/app-opentui/render/scene.d.ts +50 -1
  81. package/dist/src/app-opentui/render/scene.js +183 -6
  82. package/dist/src/app-opentui/render/text.d.ts +7 -1
  83. package/dist/src/app-opentui/render/text.js +10 -7
  84. package/dist/src/app-opentui/render/type-bar.js +69 -30
  85. package/dist/src/app-opentui/runtime.d.ts +44 -1
  86. package/dist/src/app-opentui/runtime.js +3231 -1363
  87. package/dist/src/app-opentui/scenes/command.js +20 -6
  88. package/dist/src/app-opentui/scenes/doctor.js +176 -11
  89. package/dist/src/app-opentui/scenes/error.js +20 -10
  90. package/dist/src/app-opentui/scenes/family-domains/agent.d.ts +2 -0
  91. package/dist/src/app-opentui/scenes/family-domains/agent.js +348 -0
  92. package/dist/src/app-opentui/scenes/family-domains/browser.d.ts +2 -0
  93. package/dist/src/app-opentui/scenes/family-domains/browser.js +195 -0
  94. package/dist/src/app-opentui/scenes/family-domains/dist.d.ts +2 -0
  95. package/dist/src/app-opentui/scenes/family-domains/dist.js +243 -0
  96. package/dist/src/app-opentui/scenes/family-domains/git.d.ts +2 -0
  97. package/dist/src/app-opentui/scenes/family-domains/git.js +195 -0
  98. package/dist/src/app-opentui/scenes/family-domains/github.d.ts +2 -0
  99. package/dist/src/app-opentui/scenes/family-domains/github.js +274 -0
  100. package/dist/src/app-opentui/scenes/family-domains/harness.d.ts +2 -0
  101. package/dist/src/app-opentui/scenes/family-domains/harness.js +152 -0
  102. package/dist/src/app-opentui/scenes/family-domains/index.d.ts +4 -0
  103. package/dist/src/app-opentui/scenes/family-domains/index.js +1679 -0
  104. package/dist/src/app-opentui/scenes/family-domains/kit.d.ts +76 -0
  105. package/dist/src/app-opentui/scenes/family-domains/kit.js +305 -0
  106. package/dist/src/app-opentui/scenes/family-domains/profile.d.ts +2 -0
  107. package/dist/src/app-opentui/scenes/family-domains/profile.js +212 -0
  108. package/dist/src/app-opentui/scenes/family-domains/queue.d.ts +2 -0
  109. package/dist/src/app-opentui/scenes/family-domains/queue.js +146 -0
  110. package/dist/src/app-opentui/scenes/family-domains/remote.d.ts +2 -0
  111. package/dist/src/app-opentui/scenes/family-domains/remote.js +518 -0
  112. package/dist/src/app-opentui/scenes/family-domains/review.d.ts +2 -0
  113. package/dist/src/app-opentui/scenes/family-domains/review.js +280 -0
  114. package/dist/src/app-opentui/scenes/family-domains/setup.d.ts +2 -0
  115. package/dist/src/app-opentui/scenes/family-domains/setup.js +267 -0
  116. package/dist/src/app-opentui/scenes/family-domains/stats.d.ts +2 -0
  117. package/dist/src/app-opentui/scenes/family-domains/stats.js +370 -0
  118. package/dist/src/app-opentui/scenes/family.d.ts +3 -0
  119. package/dist/src/app-opentui/scenes/family.js +2144 -0
  120. package/dist/src/app-opentui/scenes/fleet.js +521 -31
  121. package/dist/src/app-opentui/scenes/handoff.js +204 -12
  122. package/dist/src/app-opentui/scenes/help.js +609 -40
  123. package/dist/src/app-opentui/scenes/inbox.js +278 -17
  124. package/dist/src/app-opentui/scenes/init.js +84 -39
  125. package/dist/src/app-opentui/scenes/inspect.d.ts +3 -0
  126. package/dist/src/app-opentui/scenes/inspect.js +793 -0
  127. package/dist/src/app-opentui/scenes/main.js +218 -39
  128. package/dist/src/app-opentui/scenes/pi.d.ts +3 -0
  129. package/dist/src/app-opentui/scenes/pi.js +508 -0
  130. package/dist/src/app-opentui/scenes/plugin.d.ts +3 -0
  131. package/dist/src/app-opentui/scenes/plugin.js +486 -0
  132. package/dist/src/app-opentui/scenes/repo.d.ts +3 -0
  133. package/dist/src/app-opentui/scenes/repo.js +424 -0
  134. package/dist/src/app-opentui/scenes/run-detail.js +333 -20
  135. package/dist/src/app-opentui/scenes/server.js +181 -15
  136. package/dist/src/app-opentui/scenes/tasks.js +486 -31
  137. package/dist/src/app-opentui/scenes/workspace.d.ts +3 -0
  138. package/dist/src/app-opentui/scenes/workspace.js +426 -0
  139. package/dist/src/app-opentui/selectable.d.ts +19 -0
  140. package/dist/src/app-opentui/selectable.js +79 -0
  141. package/dist/src/app-opentui/state.js +83 -30
  142. package/dist/src/app-opentui/surface-catalog.d.ts +20 -0
  143. package/dist/src/app-opentui/surface-catalog.js +540 -0
  144. package/dist/src/app-opentui/theme.d.ts +28 -6
  145. package/dist/src/app-opentui/theme.js +61 -8
  146. package/dist/src/app-opentui/types.d.ts +121 -4
  147. package/dist/src/commands/_authority-runs.d.ts +1 -1
  148. package/dist/src/commands/_authority-runs.js +2 -12
  149. package/dist/src/commands/_help-catalog.js +95 -15
  150. package/dist/src/commands/_operator-view.js +34 -2
  151. package/dist/src/commands/_pi-frontend.d.ts +2 -0
  152. package/dist/src/commands/_pi-frontend.js +34 -0
  153. package/dist/src/commands/_server-events.d.ts +26 -0
  154. package/dist/src/commands/_server-events.js +310 -0
  155. package/dist/src/commands/agent.js +2 -12
  156. package/dist/src/commands/run.js +34 -2
  157. package/dist/src/commands/server.js +2 -12
  158. package/dist/src/commands/stats.js +95 -15
  159. package/dist/src/commands/task-run-driver.js +2 -12
  160. package/dist/src/commands/task.js +131 -29
  161. package/dist/src/commands.js +192 -31
  162. package/dist/src/index.js +192 -31
  163. package/package.json +11 -9
@@ -11,15 +11,17 @@ var RIG_UI = {
11
11
  bg: "#070809",
12
12
  bg2: "#0b0c0e",
13
13
  panel: "#101115",
14
- panel2: "#101115",
15
- glass: "#14161b",
16
- ink: "#f2f3f6",
17
- ink2: "#aeb0ba",
18
- ink3: "#6c6e79",
19
- ink4: "#44464f",
14
+ panel2: "#14161b",
15
+ glass: "#1e2230",
16
+ border: "#2a2e3a",
17
+ ink: "#f4f5f8",
18
+ ink2: "#c7c9d3",
19
+ ink3: "#9aa0ae",
20
+ ink4: "#787b86",
20
21
  lime: "#ccff4d",
21
22
  limeDim: "#a9d63f",
22
23
  cyan: "#56d8ff",
24
+ cyanDim: "#3f9fbd",
23
25
  red: "#ff5d5d",
24
26
  yellow: "#ffd24d",
25
27
  magenta: "#ff79b0"
@@ -38,11 +40,11 @@ var styles = {
38
40
  };
39
41
  function statusColor(status) {
40
42
  switch (status) {
41
- case "running":
42
43
  case "success":
43
44
  case "completed":
44
45
  case "merged":
45
46
  return RIG_UI.lime;
47
+ case "running":
46
48
  case "preparing":
47
49
  case "created":
48
50
  case "validating":
@@ -62,11 +64,182 @@ function statusColor(status) {
62
64
  return RIG_UI.ink3;
63
65
  }
64
66
  }
67
+ function statusGlyph(status) {
68
+ switch (status) {
69
+ case "success":
70
+ case "completed":
71
+ case "merged":
72
+ return "\u2713";
73
+ case "running":
74
+ return "\u25CF";
75
+ case "preparing":
76
+ case "created":
77
+ case "validating":
78
+ case "reviewing":
79
+ case "closing-out":
80
+ case "stopping":
81
+ case "loading":
82
+ case "action":
83
+ return "\u25D0";
84
+ case "needs-attention":
85
+ case "needs_attention":
86
+ return "\u26A0";
87
+ case "failed":
88
+ case "error":
89
+ return "\u2717";
90
+ default:
91
+ return "\xB7";
92
+ }
93
+ }
94
+ function noColorActive() {
95
+ const noColor = process.env.NO_COLOR;
96
+ if (noColor !== undefined && noColor !== "") {
97
+ return true;
98
+ }
99
+ return process.env.RIG_NO_COLOR !== undefined;
100
+ }
101
+ function statusLabel(status) {
102
+ return {
103
+ glyph: statusGlyph(status),
104
+ color: noColorActive() ? RIG_UI.ink : statusColor(status)
105
+ };
106
+ }
107
+
108
+ // packages/cli/src/app-opentui/drone.ts
109
+ import { RGBA, StyledText, TextAttributes as TextAttributes2 } from "@opentui/core";
110
+ var MINI_DRONE = [
111
+ "(!!!) (!!!)",
112
+ " \\%==%/ ",
113
+ " %%?%% ",
114
+ " /%==%\\ ",
115
+ "(!!!) (!!!)"
116
+ ];
117
+ var LEAD_MARK = [
118
+ " .-=-. ",
119
+ "=%%?%%=",
120
+ " '-=-' "
121
+ ];
122
+ var BLADE_FRAMES = ["---", "\\\\\\", "|||", "///"];
123
+ var EYE_FRAMES = ["o", "@", "\u2022", "."];
124
+ var COLOR = {
125
+ body: RGBA.fromHex(RIG_UI.lime),
126
+ mini: RGBA.fromHex(RIG_UI.limeDim),
127
+ rotor: RGBA.fromHex(RIG_UI.cyan),
128
+ path: RGBA.fromHex(RIG_UI.cyan),
129
+ eye: RGBA.fromHex(RIG_UI.ink),
130
+ dim: RGBA.fromHex(RIG_UI.ink4),
131
+ ink: RGBA.fromHex(RIG_UI.ink2)
132
+ };
133
+ function bladeForTick(tick, phase = 0) {
134
+ return BLADE_FRAMES[(Math.floor(tick / 3) + phase) % BLADE_FRAMES.length];
135
+ }
136
+ function eyeForTick(tick, phase = 0) {
137
+ const pulse = Math.sin(tick * 0.09 + phase);
138
+ return pulse > 0.55 ? EYE_FRAMES[1] : pulse > 0.1 ? EYE_FRAMES[0] : pulse > -0.45 ? EYE_FRAMES[2] : EYE_FRAMES[3];
139
+ }
140
+ function chunk(text, fg, bold = false, dim = false) {
141
+ let attributes = TextAttributes2.NONE;
142
+ if (bold)
143
+ attributes |= TextAttributes2.BOLD;
144
+ if (dim)
145
+ attributes |= TextAttributes2.DIM;
146
+ return { __isChunk: true, text, fg, ...attributes !== TextAttributes2.NONE ? { attributes } : {} };
147
+ }
148
+ function styledLine(text, colorFor) {
149
+ const chunks = [];
150
+ let run = "";
151
+ let runColor = null;
152
+ const flush = () => {
153
+ if (!run || !runColor)
154
+ return;
155
+ chunks.push(chunk(run, COLOR[runColor], runColor === "body" || runColor === "eye", runColor === "dim"));
156
+ run = "";
157
+ };
158
+ for (const char of text) {
159
+ const next = colorFor(char);
160
+ if (next !== runColor) {
161
+ flush();
162
+ runColor = next;
163
+ }
164
+ run += char;
165
+ }
166
+ flush();
167
+ return new StyledText(chunks.length > 0 ? chunks : [chunk("", COLOR.ink)]);
168
+ }
169
+ function droneColor(char) {
170
+ if (char === "?" || char === "o" || char === "@" || char === "\u2022")
171
+ return "eye";
172
+ if (char === "%" || char === "=")
173
+ return "mini";
174
+ if (char === "$")
175
+ return "body";
176
+ if (char === "(" || char === ")" || char === "/" || char === "\\" || char === "|" || char === "-")
177
+ return "rotor";
178
+ if (char === "\xB7" || char === "\u2022" || char === "'" || char === ".")
179
+ return "path";
180
+ if (char.trim() === "")
181
+ return "dim";
182
+ return "ink";
183
+ }
184
+ function motionColor(char) {
185
+ if (char === "\u25CF" || char === "\u25C6" || char === "\u25C9")
186
+ return "body";
187
+ if (char === "\u2022" || char === "\xB7" || char === "\u2500" || char === "\u2502" || char === "\u2571" || char === "\u2572" || char === "\u256D" || char === "\u256E" || char === "\u2570" || char === "\u256F")
188
+ return "path";
189
+ if (char === "\u258C" || char === "\u2590" || char === "\u2581" || char === "\u2594")
190
+ return "mini";
191
+ return droneColor(char);
192
+ }
193
+ function materializeDrone(lines, tick, phase = 0) {
194
+ const blade = bladeForTick(tick, phase);
195
+ const eye = eyeForTick(tick, phase);
196
+ return lines.map((line) => line.replaceAll("!!!", blade).replaceAll("?", eye));
197
+ }
198
+ function miniDroneLines(tick, align = "left", phase = 0) {
199
+ return materializeDrone(MINI_DRONE, tick, phase).map((text) => ({
200
+ text,
201
+ styledText: styledLine(text, droneColor),
202
+ fg: RIG_UI.limeDim,
203
+ align
204
+ }));
205
+ }
206
+ function brandFleetLines(tick, align = "center") {
207
+ const left = materializeDrone(MINI_DRONE, tick, 0);
208
+ const right = materializeDrone(MINI_DRONE, tick, 2);
209
+ const lead = materializeDrone(LEAD_MARK, tick, 1);
210
+ const packet = ["\xB7", "\u2022", "\u25CF", "\u2022"][Math.floor(tick / 2) % 4];
211
+ const bridge = [
212
+ ` ${left[0]} ${lead[0]} ${right[0]}`,
213
+ ` ${left[1]} \xB7\u2500\u2500${packet}\u2500\u2500\xB7 ${lead[1]} \xB7\u2500\u2500${packet}\u2500\u2500\xB7 ${right[1]}`,
214
+ ` ${left[2]} \xB7' '${lead[2]}' '\xB7 ${right[2]}`,
215
+ ` ${left[3]} \u2572 signal bus \u2571 ${right[3]}`,
216
+ ` ${left[4]} \xB7\u2500\u2500\u2500${packet}\u2500\u2500\u2500\u2500\u2500\u2500${packet}\u2500\u2500\u2500\xB7 ${right[4]}`
217
+ ];
218
+ return bridge.map((text) => ({
219
+ text,
220
+ styledText: styledLine(text, motionColor),
221
+ fg: RIG_UI.limeDim,
222
+ align
223
+ }));
224
+ }
225
+ function actionDrone(tick, phase = 0) {
226
+ const blade = bladeForTick(tick, phase);
227
+ const eye = eyeForTick(tick, phase);
228
+ return `(${blade})\u2572${eye}\u2571(${blade})`;
229
+ }
230
+ function actionDroneLine(tick, text, fg = RIG_UI.ink2) {
231
+ const prefix = actionDrone(tick);
232
+ const content = `${prefix} ${text}`;
233
+ return { text: content, styledText: styledLine(content, motionColor), fg, align: "center" };
234
+ }
65
235
 
66
236
  // packages/cli/src/app-opentui/render/scene.ts
67
237
  function line(text, options = {}) {
68
238
  return { text, ...options };
69
239
  }
240
+ function blank() {
241
+ return { text: "" };
242
+ }
70
243
  function deckRow(input) {
71
244
  const prefix = input.active ? "\u25B8" : " ";
72
245
  const label = input.label.toUpperCase().padEnd(10);
@@ -77,11 +250,43 @@ function deckRow(input) {
77
250
  activateOnClick: input.activateOnClick
78
251
  });
79
252
  }
253
+ function loadingRows(label, tick = 0, compact = false) {
254
+ const mascot = compact ? miniDroneLines(tick, "center") : brandFleetLines(tick, "center");
255
+ return [
256
+ blank(),
257
+ ...mascot,
258
+ blank(),
259
+ { ...actionDroneLine(tick, `loading ${label}\u2026`, RIG_UI.cyan), align: "center" }
260
+ ];
261
+ }
262
+ function errorBanner(message, hint) {
263
+ return [
264
+ line(`\u2717 failed to load \u2014 ${message}`, { fg: RIG_UI.red, bold: true }),
265
+ ...hint ? [line(` ${hint}`, { fg: RIG_UI.ink3 })] : [],
266
+ line(" select refresh/retry below", { fg: RIG_UI.ink4 }),
267
+ line("", { fg: RIG_UI.ink3 })
268
+ ];
269
+ }
270
+ function lastRefreshError(state) {
271
+ const value = state.data.lastRefreshError;
272
+ return typeof value === "string" && value.trim() ? value : undefined;
273
+ }
80
274
  function makeSceneFrame(input) {
81
275
  return input;
82
276
  }
83
277
 
278
+ // packages/cli/src/app-opentui/selectable.ts
279
+ function selectableDeckRow(deck, item) {
280
+ return { ...deckRow({ ...deck, activateOnClick: true }), selectable: item };
281
+ }
282
+
84
283
  // packages/cli/src/app-opentui/scenes/inbox.ts
284
+ var INBOX_RECOVERY_ITEMS = [
285
+ { id: "refresh", label: "refresh", intent: { scene: "inbox", argv: ["inbox"], action: { kind: "refresh", label: "Refresh inbox" } }, message: "refresh inbox" },
286
+ { id: "runs", label: "runs", intent: { scene: "fleet", argv: ["runs"], action: { kind: "refresh", label: "Open runs" } }, message: "open runs" },
287
+ { id: "tasks", label: "tasks", intent: { scene: "tasks", argv: ["tasks"], action: { kind: "refresh", label: "Open tasks" } }, message: "open tasks" },
288
+ { id: "doctor", label: "doctor", intent: { scene: "doctor", argv: ["doctor"], action: { kind: "doctor-run", label: "Run doctor" } }, message: "diagnose inbox" }
289
+ ];
85
290
  function inboxRecords(state) {
86
291
  const inbox = state.data.inbox;
87
292
  if (!inbox || typeof inbox !== "object" || Array.isArray(inbox))
@@ -98,21 +303,70 @@ function panelWidth(layout) {
98
303
  function panelHeight(layout) {
99
304
  return Math.max(8, (layout?.centerHeight ?? 24) - 1);
100
305
  }
306
+ function diffLine(text) {
307
+ if (text.startsWith("+++") || text.startsWith("---"))
308
+ return line(` ${text}`, { fg: RIG_UI.ink, bold: true });
309
+ if (text.startsWith("@@"))
310
+ return line(` ${text}`, { fg: RIG_UI.cyan });
311
+ if (text.startsWith("diff ") || text.startsWith("index "))
312
+ return line(` ${text}`, { fg: RIG_UI.ink3, bold: true });
313
+ if (text.startsWith("+"))
314
+ return line(` ${text}`, { fg: RIG_UI.lime });
315
+ if (text.startsWith("-"))
316
+ return line(` ${text}`, { fg: RIG_UI.red });
317
+ return line(` ${text}`, { fg: RIG_UI.ink3 });
318
+ }
319
+ function payloadLines(record) {
320
+ const out = [];
321
+ for (const detail of record.details) {
322
+ out.push(line(` ${detail.label.padEnd(8)} ${detail.value}`, { fg: RIG_UI.ink2 }));
323
+ }
324
+ if (record.diff && record.diff.trim()) {
325
+ out.push(line(" \u2500\u2500 preview \u2500\u2500", { fg: RIG_UI.ink4 }));
326
+ for (const text of record.diff.split(`
327
+ `).slice(0, 40))
328
+ out.push(diffLine(text));
329
+ }
330
+ return out;
331
+ }
332
+ function attachItem(record) {
333
+ const runId = record.runId;
334
+ return {
335
+ id: `${record.requestId}:attach`,
336
+ label: "attach",
337
+ data: { selectedInboxRequestId: record.requestId, selectedRunId: runId },
338
+ intent: { scene: "handoff", argv: ["attach", runId], action: { kind: "run-attach", payload: { runId }, label: `Attach Pi ${runId.slice(0, 8)}` } },
339
+ message: `attach run ${runId.slice(0, 8)}`
340
+ };
341
+ }
101
342
  function requestLines(record, startIndex, selected) {
102
- const title = `${record.title || record.requestId} \xB7 run ${record.runId.slice(0, 8)}`;
343
+ const { glyph, color } = statusLabel(record.status);
344
+ const title = `${glyph} ${record.title || record.requestId} \xB7 run ${record.runId.slice(0, 8)}`;
345
+ const requestId = record.requestId;
103
346
  if (record.kind === "approvals") {
347
+ const approve = { id: `${requestId}:approve`, label: "approve", data: { selectedInboxRequestId: requestId }, intent: { scene: "inbox", argv: ["inbox", "approve", requestId], action: { kind: "inbox-approve", payload: { requestId }, label: `Approve ${requestId}` } }, message: `approve ${requestId}` };
348
+ const reject = { id: `${requestId}:reject`, label: "reject", data: { selectedInboxRequestId: requestId }, intent: { scene: "inbox", argv: ["inbox", "reject", requestId], action: { kind: "inbox-reject", payload: { requestId }, label: `Reject ${requestId}` } }, message: `reject ${requestId}` };
104
349
  return [
105
- line(title, { fg: statusColor(record.status), bold: true }),
106
- deckRow({ label: "approve", detail: `approve ${record.requestId.slice(0, 10)}`, index: startIndex, active: selected === startIndex, activateOnClick: true }),
107
- deckRow({ label: "reject", detail: `reject ${record.requestId.slice(0, 10)}`, index: startIndex + 1, active: selected === startIndex + 1, activateOnClick: true }),
108
- deckRow({ label: "attach", detail: `open run ${record.runId.slice(0, 8)}`, index: startIndex + 2, active: selected === startIndex + 2, activateOnClick: true }),
350
+ line(title, { fg: color, bold: true }),
351
+ ...payloadLines(record),
352
+ selectableDeckRow({ label: "approve", detail: `approve ${requestId.slice(0, 10)}`, index: startIndex, active: selected === startIndex }, approve),
353
+ selectableDeckRow({ label: "reject", detail: `reject ${requestId.slice(0, 10)}`, index: startIndex + 1, active: selected === startIndex + 1 }, reject),
354
+ selectableDeckRow({ label: "attach", detail: `open run ${record.runId.slice(0, 8)}`, index: startIndex + 2, active: selected === startIndex + 2 }, attachItem(record)),
109
355
  line("", { fg: RIG_UI.ink3 })
110
356
  ];
111
357
  }
358
+ const answer = {
359
+ id: `${requestId}:answer`,
360
+ label: "answer",
361
+ data: { selectedInboxRequestId: requestId, selectedRunId: record.runId },
362
+ prompt: { label: `answer ${requestId.slice(0, 10)}`, scene: "inbox", argv: ["inbox", "answer", requestId], intentKind: "inbox-answer", payloadBase: { requestId }, payloadKey: "answer" },
363
+ message: `answer ${requestId} inline`
364
+ };
112
365
  return [
113
- line(title, { fg: statusColor(record.status), bold: true }),
114
- deckRow({ label: "answer", detail: `open answer command for ${record.requestId.slice(0, 10)}`, index: startIndex, active: selected === startIndex, activateOnClick: true }),
115
- deckRow({ label: "attach", detail: `open run ${record.runId.slice(0, 8)}`, index: startIndex + 1, active: selected === startIndex + 1, activateOnClick: true }),
366
+ line(title, { fg: color, bold: true }),
367
+ ...payloadLines(record),
368
+ selectableDeckRow({ label: "answer", detail: `answer ${requestId.slice(0, 10)} inline`, index: startIndex, active: selected === startIndex }, answer),
369
+ selectableDeckRow({ label: "attach", detail: `open run ${record.runId.slice(0, 8)}`, index: startIndex + 1, active: selected === startIndex + 1 }, attachItem(record)),
116
370
  line("", { fg: RIG_UI.ink3 })
117
371
  ];
118
372
  }
@@ -122,10 +376,18 @@ function renderInboxScene(state, layout) {
122
376
  const selected = Math.max(0, state.selection.index);
123
377
  const optimistic = state.data.inboxOptimistic;
124
378
  const optimisticLine = optimistic && typeof optimistic === "object" && !Array.isArray(optimistic) ? `${optimistic.requestId ?? "request"} ${optimistic.status ?? "pending"}` : "idle";
379
+ const loading = state.status === "loading" && all.length === 0;
380
+ const refreshError = lastRefreshError(state);
125
381
  const lines = [];
126
382
  let selectableIndex = 0;
383
+ if (refreshError && !state.error) {
384
+ lines.push(...errorBanner(refreshError));
385
+ }
127
386
  if (all.length === 0) {
128
- lines.push(line("No pending approvals or input requests.", { fg: RIG_UI.ink3 }), line("Runs that need a decision will appear here with approve/reject/answer actions.", { fg: RIG_UI.ink4 }), line("", { fg: RIG_UI.ink3 }), line("ACTIONS", { fg: RIG_UI.ink3, bold: true }), deckRow({ label: "refresh", detail: "reload pending requests", index: 0, active: selected === 0, activateOnClick: true }), deckRow({ label: "runs", detail: "open runs", index: 1, active: selected === 1, activateOnClick: true }), deckRow({ label: "tasks", detail: "open tasks", index: 2, active: selected === 2, activateOnClick: true }), deckRow({ label: "doctor", detail: "diagnose inbox/server/auth", index: 3, active: selected === 3, activateOnClick: true }));
387
+ lines.push(...loading ? loadingRows("inbox", state.tick, true) : [
388
+ line("No pending approvals or input requests.", { fg: RIG_UI.ink3 }),
389
+ line("Runs that need a decision will appear here with approve/reject/answer actions.", { fg: RIG_UI.ink4 })
390
+ ], line("", { fg: RIG_UI.ink3 }), line("ACTIONS", { fg: RIG_UI.ink3, bold: true }), selectableDeckRow({ label: "refresh", detail: "reload pending requests", index: 0, active: selected === 0 }, INBOX_RECOVERY_ITEMS[0]), selectableDeckRow({ label: "runs", detail: "open runs", index: 1, active: selected === 1 }, INBOX_RECOVERY_ITEMS[1]), selectableDeckRow({ label: "tasks", detail: "open tasks", index: 2, active: selected === 2 }, INBOX_RECOVERY_ITEMS[2]), selectableDeckRow({ label: "doctor", detail: "diagnose inbox/server/auth", index: 3, active: selected === 3 }, INBOX_RECOVERY_ITEMS[3]));
129
391
  } else {
130
392
  for (const record of all.slice(0, 8)) {
131
393
  lines.push(...requestLines(record, selectableIndex, selected));
@@ -156,7 +418,6 @@ function renderInboxScene(state, layout) {
156
418
  paddingY: 1
157
419
  }],
158
420
  footer: { message: all.length > 0 ? "enter/click activates selected request action" : "no pending requests" },
159
- hideTypeBar: true,
160
421
  live: state.status === "action" || all.length === 0
161
422
  });
162
423
  }
@@ -11,15 +11,17 @@ var RIG_UI = {
11
11
  bg: "#070809",
12
12
  bg2: "#0b0c0e",
13
13
  panel: "#101115",
14
- panel2: "#101115",
15
- glass: "#14161b",
16
- ink: "#f2f3f6",
17
- ink2: "#aeb0ba",
18
- ink3: "#6c6e79",
19
- ink4: "#44464f",
14
+ panel2: "#14161b",
15
+ glass: "#1e2230",
16
+ border: "#2a2e3a",
17
+ ink: "#f4f5f8",
18
+ ink2: "#c7c9d3",
19
+ ink3: "#9aa0ae",
20
+ ink4: "#787b86",
20
21
  lime: "#ccff4d",
21
22
  limeDim: "#a9d63f",
22
23
  cyan: "#56d8ff",
24
+ cyanDim: "#3f9fbd",
23
25
  red: "#ff5d5d",
24
26
  yellow: "#ffd24d",
25
27
  magenta: "#ff79b0"
@@ -37,6 +39,18 @@ var styles = {
37
39
  magenta: otuiFg(RIG_UI.magenta)
38
40
  };
39
41
 
42
+ // packages/cli/src/app-opentui/drone.ts
43
+ import { RGBA, StyledText, TextAttributes as TextAttributes2 } from "@opentui/core";
44
+ var COLOR = {
45
+ body: RGBA.fromHex(RIG_UI.lime),
46
+ mini: RGBA.fromHex(RIG_UI.limeDim),
47
+ rotor: RGBA.fromHex(RIG_UI.cyan),
48
+ path: RGBA.fromHex(RIG_UI.cyan),
49
+ eye: RGBA.fromHex(RIG_UI.ink),
50
+ dim: RGBA.fromHex(RIG_UI.ink4),
51
+ ink: RGBA.fromHex(RIG_UI.ink2)
52
+ };
53
+
40
54
  // packages/cli/src/app-opentui/render/scene.ts
41
55
  function line(text, options = {}) {
42
56
  return { text, ...options };
@@ -58,61 +72,92 @@ function makeSceneFrame(input) {
58
72
  return input;
59
73
  }
60
74
 
75
+ // packages/cli/src/app-opentui/selectable.ts
76
+ function selectableDeckRow(deck, item) {
77
+ return { ...deckRow({ ...deck, activateOnClick: true }), selectable: item };
78
+ }
79
+
61
80
  // packages/cli/src/app-opentui/scenes/init.ts
81
+ var STEP_CONFIG_RUN = { id: "step-config", label: "run setup wizard", intent: { scene: "command", argv: ["init"], action: { kind: "command-run", label: "Run setup wizard" } }, message: "full interactive setup wizard" };
82
+ var STEP_SERVER = { id: "step-server", label: "select server", intent: { scene: "server", argv: ["server", "status"], action: { kind: "refresh", label: "Choose server" } }, message: "select local or remote server" };
83
+ var STEP_AUTH = { id: "step-auth", label: "connect GitHub", intent: { scene: "command", argv: ["github", "auth", "import-gh"], action: { kind: "command-run", label: "Connect GitHub" } }, message: "import GitHub auth into the selected server" };
84
+ var STEP_TASKS = { id: "step-tasks", label: "pick a task source", intent: { scene: "command", argv: ["init", "--repair"], action: { kind: "command-run", label: "Configure task source" } }, message: "configure or repair the task source" };
85
+ var SETUP_STEPS = [
86
+ { id: "config", label: "Project config", detail: "rig.config + private state", done: (s) => s.configured, cta: "Run setup wizard", item: STEP_CONFIG_RUN },
87
+ { id: "server", label: "Server target", detail: "local or remote, reachable", done: (s) => s.serverReachable, cta: "Choose a server", item: STEP_SERVER },
88
+ { id: "auth", label: "GitHub auth", detail: "signed in on the selected server", done: (s) => s.authSignedIn, cta: "Connect GitHub", item: STEP_AUTH },
89
+ { id: "tasks", label: "Task source", detail: "where work comes from", done: (s) => s.taskSourceReady, cta: "Pick a task source", item: STEP_TASKS }
90
+ ];
91
+ var SECONDARY_ACTIONS = [
92
+ { label: "repair", detail: "reconfigure generated config and private state", item: { id: "repair", label: "repair", intent: { scene: "command", argv: ["init", "--repair"], action: { kind: "command-run", label: "Reconfigure project" } }, message: "verify or rewrite generated config" } },
93
+ { label: "demo", detail: "seed an offline demo task source to explore", item: { id: "demo", label: "demo", intent: { scene: "command", argv: ["init", "--demo", "--repair"], action: { kind: "command-run", label: "Seed demo project" } }, message: "offline demo project" } },
94
+ { label: "doctor", detail: "diagnose what is still missing", item: { id: "doctor", label: "doctor", intent: { scene: "doctor", argv: ["doctor"], action: { kind: "doctor-run", label: "Run doctor" } }, message: "verify setup" } }
95
+ ];
96
+ function record(value) {
97
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
98
+ }
62
99
  function initData(state) {
63
- const init = state.data.init;
64
- return init && typeof init === "object" && !Array.isArray(init) ? init : {};
100
+ return record(state.data.init) ?? {};
65
101
  }
66
102
  function facts(state) {
67
103
  const value = initData(state).facts;
68
104
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
69
105
  }
106
+ function setupSignals(state, factState) {
107
+ const configured = factState?.hasConfig === true || state.data.projectConfigured === true;
108
+ const server = record(state.data.server);
109
+ const auth = record(server?.auth);
110
+ const serverReachable = Boolean(server) && server?.reachable !== false;
111
+ const authSignedIn = auth?.signedIn === true || auth?.authenticated === true || auth?.status === "authenticated";
112
+ const tasks = record(state.data.tasks);
113
+ const taskRecords = Array.isArray(tasks?.records) ? tasks.records : [];
114
+ const taskSourceReady = configured && taskRecords.length > 0;
115
+ return { configured, serverReachable, authSignedIn, taskSourceReady };
116
+ }
70
117
  function panelWidth(layout) {
71
118
  return layout?.centerWidth ?? 118;
72
119
  }
73
120
  function panelHeight(layout) {
74
121
  return Math.max(18, layout?.centerHeight ?? 34);
75
122
  }
76
- function selectedIndex(state, count) {
77
- return Math.max(0, Math.min(count - 1, state.selection.index));
78
- }
79
- function statusRows(factState, status, configured) {
80
- return [
81
- line(`config ${configured ? factState?.configPath ?? "present" : "needs setup"}`, { fg: configured ? RIG_UI.ink2 : RIG_UI.yellow }),
82
- line(`git ${factState?.hasGit ? "present" : "missing / not checked"}`, { fg: factState?.hasGit ? RIG_UI.ink3 : RIG_UI.yellow }),
83
- line(`state ${status}`, { fg: configured ? RIG_UI.limeDim : RIG_UI.ink3 })
84
- ];
123
+ function checklistRow(step, ordinal, done, isNext) {
124
+ const glyph = done ? "\u2713" : isNext ? "\u25B8" : "\u25CB";
125
+ const fg = done ? RIG_UI.limeDim : isNext ? RIG_UI.lime : RIG_UI.ink3;
126
+ const tag = done ? "done" : isNext ? "next" : "todo";
127
+ const text = `${glyph} ${ordinal}. ${step.label.padEnd(16)} ${step.detail} \u2014 ${tag}`;
128
+ return { text: ` ${text}`, fg, bold: done || isNext };
85
129
  }
86
130
  function renderInitScene(state, layout) {
87
131
  const factState = facts(state);
88
- const init = initData(state);
89
- const status = typeof init.status === "string" ? init.status : factState?.hasConfig ? "configured" : "needs-init";
90
- const configured = factState?.hasConfig === true;
91
- const selected = selectedIndex(state, 6);
92
- const actionRows = [
93
- deckRow({ label: "wizard", detail: "full interactive setup wizard", index: 0, active: selected === 0, activateOnClick: true }),
94
- deckRow({ label: "reconfig", detail: "repair/reconfigure generated config and private state", index: 1, active: selected === 1, activateOnClick: true }),
95
- deckRow({ label: "demo", detail: "seed offline demo task source", index: 2, active: selected === 2, activateOnClick: true }),
96
- deckRow({ label: "remote", detail: "configure remote server and checkout link", index: 3, active: selected === 3, activateOnClick: true }),
97
- deckRow({ label: "auth", detail: "import GitHub auth into selected server", index: 4, active: selected === 4, activateOnClick: true }),
98
- deckRow({ label: "doctor", detail: "verify setup after changes", index: 5, active: selected === 5, activateOnClick: true })
99
- ];
132
+ const signals = setupSignals(state, factState);
133
+ const completed = SETUP_STEPS.filter((step) => step.done(signals)).length;
134
+ const allDone = completed === SETUP_STEPS.length;
135
+ const nextStep = SETUP_STEPS.find((step) => !step.done(signals));
136
+ const selected = Math.max(0, state.selection.index);
137
+ const primary = nextStep ? selectableDeckRow({ label: "next", detail: `${nextStep.cta} \u2014 recommended`, active: selected === 0 }, { ...nextStep.item, id: "init-primary" }) : selectableDeckRow({ label: "verify", detail: "Setup complete \u2014 run doctor to confirm", active: selected === 0 }, { id: "init-primary", label: "verify", intent: { scene: "doctor", argv: ["doctor"], action: { kind: "doctor-run", label: "Run doctor" } }, message: "verify setup end-to-end" });
138
+ const secondaryRows = SECONDARY_ACTIONS.map(({ label, detail, item }, index) => selectableDeckRow({ label, detail, active: selected === index + 1 }, item));
139
+ const progress = allDone ? "all set" : `${completed} of ${SETUP_STEPS.length} complete`;
100
140
  const panelLines = [
101
- line(configured ? "project setup \xB7 configured" : "project setup \xB7 choose a path", { fg: RIG_UI.ink3 }),
141
+ line(allDone ? "SETUP \xB7 ready to go" : "SETUP \xB7 let's get you running", { fg: allDone ? RIG_UI.limeDim : RIG_UI.ink, bold: true }),
142
+ line(`progress ${progress}`, { fg: allDone ? RIG_UI.limeDim : RIG_UI.ink2 }),
143
+ blank(),
144
+ line("CHECKLIST", { fg: RIG_UI.ink3, bold: true }),
145
+ ...SETUP_STEPS.map((step, index) => checklistRow(step, index + 1, step.done(signals), step.id === nextStep?.id)),
102
146
  blank(),
103
- ...statusRows(factState, status, configured),
147
+ line("NEXT STEP", { fg: RIG_UI.ink3, bold: true }),
148
+ primary,
104
149
  blank(),
105
- line("ACTIONS", { fg: RIG_UI.ink3, bold: true }),
106
- ...actionRows,
150
+ line("OTHER PATHS", { fg: RIG_UI.ink3, bold: true }),
151
+ ...secondaryRows,
107
152
  blank(),
108
- line("enter/click runs action \xB7 esc returns home \xB7 tab switches surfaces", { fg: RIG_UI.ink4 })
153
+ line("enter/click runs the highlighted action \xB7 esc goes back \xB7 tab switches sections", { fg: RIG_UI.ink4 })
109
154
  ];
110
155
  return makeSceneFrame({
111
156
  scene: "init",
112
- title: "Init",
157
+ title: "Setup",
113
158
  lines: [],
114
159
  panels: [{
115
- id: "init-actions",
160
+ id: "init-setup",
116
161
  top: 0,
117
162
  width: panelWidth(layout),
118
163
  height: panelHeight(layout),
@@ -122,12 +167,12 @@ function renderInitScene(state, layout) {
122
167
  opacity: 0.98,
123
168
  border: false,
124
169
  chrome: "ad-terminal",
125
- headerText: "rig init \xB7 setup / repair / reconfigure",
170
+ headerText: "rig setup \xB7 guided onboarding",
126
171
  paddingX: 5,
127
172
  paddingY: 2
128
173
  }],
129
- footer: { message: configured ? "configured" : "setup needed" },
130
- live: !configured || state.status === "action"
174
+ footer: { message: allDone ? "setup complete" : "setup in progress" },
175
+ live: !allDone || state.status === "action"
131
176
  });
132
177
  }
133
178
  export {
@@ -0,0 +1,3 @@
1
+ import type { AppSceneFrame, AppState } from "../types";
2
+ import type { StageLayout } from "../layout";
3
+ export declare function renderInspectScene(state: AppState, layout?: StageLayout): AppSceneFrame;