@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,142 +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 SELECTION_MARKER = "\u258C";
31
- var SELECTION_MARKER_IDLE = " ";
32
- var LABEL_WIDTH = 14;
33
- var COLUMN_GUTTER = " ";
34
- var RIG_SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
35
- var styles = {
36
- ink: otuiFg(RIG_UI.ink),
37
- ink2: otuiFg(RIG_UI.ink2),
38
- ink3: otuiFg(RIG_UI.ink3),
39
- ink4: otuiFg(RIG_UI.ink4),
40
- lime: otuiFg(RIG_UI.lime),
41
- limeDim: otuiFg(RIG_UI.limeDim),
42
- cyan: otuiFg(RIG_UI.cyan),
43
- red: otuiFg(RIG_UI.red),
44
- yellow: otuiFg(RIG_UI.yellow),
45
- magenta: otuiFg(RIG_UI.magenta)
46
- };
47
- function statusColor(status) {
48
- switch (status) {
49
- case "success":
50
- case "completed":
51
- case "merged":
52
- return RIG_UI.lime;
53
- case "running":
54
- case "preparing":
55
- case "created":
56
- case "validating":
57
- case "reviewing":
58
- case "closing-out":
59
- case "stopping":
60
- case "loading":
61
- case "action":
62
- return RIG_UI.cyan;
63
- case "needs-attention":
64
- case "needs_attention":
65
- return RIG_UI.yellow;
66
- case "failed":
67
- case "error":
68
- return RIG_UI.red;
69
- default:
70
- return RIG_UI.ink3;
71
- }
72
- }
73
- function statusGlyph(status) {
74
- switch (status) {
75
- case "success":
76
- case "completed":
77
- case "merged":
78
- return "\u2713";
79
- case "running":
80
- return "\u25CF";
81
- case "preparing":
82
- case "created":
83
- case "validating":
84
- case "reviewing":
85
- case "closing-out":
86
- case "stopping":
87
- case "loading":
88
- case "action":
89
- return "\u25D0";
90
- case "needs-attention":
91
- case "needs_attention":
92
- return "\u26A0";
93
- case "failed":
94
- case "error":
95
- return "\u2717";
96
- default:
97
- return "\xB7";
98
- }
99
- }
100
- function noColorActive() {
101
- const noColor = process.env.NO_COLOR;
102
- if (noColor !== undefined && noColor !== "") {
103
- return true;
104
- }
105
- return process.env.RIG_NO_COLOR !== undefined;
106
- }
107
- function statusLabel(status) {
108
- return {
109
- glyph: statusGlyph(status),
110
- color: noColorActive() ? RIG_UI.ink : statusColor(status)
111
- };
112
- }
113
- function sceneTitle(title) {
114
- return t`${otuiBold(styles.ink(title))}`;
115
- }
116
- function commandText(command) {
117
- return t`${styles.lime(command)}`;
118
- }
119
- function faint(text) {
120
- return styles.ink4(text);
121
- }
122
- export {
123
- t,
124
- styles,
125
- statusLabel,
126
- statusGlyph,
127
- statusColor,
128
- sceneTitle,
129
- noColorActive,
130
- otuiFg as fg,
131
- faint,
132
- otuiDim as dim,
133
- commandText,
134
- otuiBold as bold,
135
- TextAttributes,
136
- SELECTION_MARKER_IDLE,
137
- SELECTION_MARKER,
138
- RIG_UI,
139
- RIG_SPINNER_FRAMES,
140
- LABEL_WIDTH,
141
- COLUMN_GUTTER
142
- };
@@ -1,313 +0,0 @@
1
- import type { StyledText } from "@opentui/core";
2
- import type { RunnerContext } from "../runner";
3
- import type { StageLayout } from "./layout";
4
- export type AppSceneId = "main" | "fleet" | "tasks" | "inbox" | "server" | "init" | "doctor" | "command" | "run-detail" | "handoff" | "pi" | "plugin" | "repo" | "workspace" | "inspect" | "family" | "help" | "error";
5
- export type AppActionKind = "none" | "refresh" | "navigate" | "task-run-next" | "task-run-id" | "run-stop" | "run-attach" | "run-steer" | "inbox-approve" | "inbox-reject" | "inbox-answer" | "init-start" | "server-use-local" | "server-use-remote" | "server-add-remote" | "github-auth-import" | "remote-link-repair" | "command-run" | "doctor-run";
6
- export type AppIntent = {
7
- readonly scene: AppSceneId;
8
- readonly argv: readonly string[];
9
- readonly raw?: string;
10
- readonly action: {
11
- readonly kind: AppActionKind;
12
- readonly label?: string;
13
- readonly payload?: Record<string, unknown>;
14
- };
15
- };
16
- export type AppStatus = "idle" | "loading" | "action" | "success" | "error";
17
- export type AppFooterState = {
18
- readonly project?: string;
19
- readonly server?: string;
20
- readonly auth?: string;
21
- readonly run?: string;
22
- readonly message?: string;
23
- readonly [key: string]: string | undefined;
24
- };
25
- /** Modal input model for the bottom command bar. nav = vim navigation
26
- * (printable keys are shortcuts); search = live-filter the current list scene;
27
- * command = type a full `rig …` command; prompt = capture one value for a
28
- * pending inline action (inbox answer, run steer) without dropping to a PTY. */
29
- export type AppTypeBarMode = "nav" | "search" | "command" | "prompt";
30
- /** Describes an inline prompt: the next submitted value is folded into this
31
- * intent under `payloadKey`, then dispatched. Keeps answer/steer in-app. */
32
- export type AppInlinePrompt = {
33
- readonly label: string;
34
- readonly scene: AppSceneId;
35
- readonly argv: readonly string[];
36
- readonly intentKind: AppActionKind;
37
- readonly payloadBase: Record<string, unknown>;
38
- readonly payloadKey: string;
39
- /** When true, the typed value is tokenized and appended to `argv` (for
40
- * collecting a parameterized command's args before running it) rather than
41
- * folded into the action payload. Used by the actionable command catalog (#21). */
42
- readonly appendValueToArgv?: boolean;
43
- };
44
- export type AppTypeBarState = {
45
- readonly value: string;
46
- readonly placeholder: string;
47
- readonly message?: string;
48
- readonly mode?: AppTypeBarMode;
49
- readonly prompt?: AppInlinePrompt;
50
- };
51
- /** A pending confirmation gate for a destructive action (#16). The held intent
52
- * only dispatches on an explicit second Enter; esc cancels. */
53
- export type AppConfirmState = {
54
- readonly label: string;
55
- readonly intent: AppIntent;
56
- };
57
- export type AppErrorState = {
58
- readonly message: string;
59
- readonly hint?: string;
60
- readonly cause?: unknown;
61
- };
62
- export type AppSelectionState = {
63
- readonly index: number;
64
- readonly count: number;
65
- };
66
- export type AppSelectableItem = {
67
- readonly id: string;
68
- readonly label: string;
69
- readonly data?: Record<string, unknown>;
70
- readonly intent?: AppIntent;
71
- readonly message?: string;
72
- /** Activating this item opens an inline prompt instead of dispatching an
73
- * intent — the typed value is folded into the action (#15). */
74
- readonly prompt?: AppInlinePrompt;
75
- };
76
- /** Typed state.data slices (#7). Scalar selections/flags are precisely typed so
77
- * their reads don't need casts; heterogeneous server-record slices stay `unknown`
78
- * (consumers narrow them) and the index signature keeps dynamic writes compiling.
79
- * This retires the untyped `Record<string, unknown>` bag while staying compatible
80
- * with every existing patch site. */
81
- export type AppData = {
82
- readonly selectedRunId?: string;
83
- readonly selectedTaskId?: string;
84
- /** When set, the tasks scene shows that task's dedicated DETAIL screen
85
- * (native-markdown body + actions) instead of the list (#3/#5/#7). */
86
- readonly taskDetailId?: string;
87
- readonly selectedInboxRequestId?: string;
88
- readonly projectConfigured?: boolean;
89
- readonly lastRefreshError?: string;
90
- readonly fleet?: unknown;
91
- readonly tasks?: unknown;
92
- readonly inbox?: unknown;
93
- readonly inboxOptimistic?: unknown;
94
- readonly server?: unknown;
95
- readonly runDetail?: unknown;
96
- readonly inspect?: unknown;
97
- /** Active sub-view of the inspect scene (logs/timeline/diff/failures). */
98
- readonly inspectView?: string;
99
- readonly pi?: unknown;
100
- readonly plugin?: unknown;
101
- readonly repo?: unknown;
102
- readonly workspace?: unknown;
103
- readonly piTerminal?: unknown;
104
- readonly commandTerminal?: unknown;
105
- /** Generic family-browser slice: the active family's catalog + live state. */
106
- readonly family?: unknown;
107
- /** Which CLI family the family scene is currently showing. */
108
- readonly familyName?: string;
109
- /** In-progress command-form state (selected subcommand + adapted field values). */
110
- readonly familyForm?: unknown;
111
- /** The drilled-into item id within the active family's bespoke surface — when
112
- * set, the renderer shows that item's dedicated DETAIL screen (#5). */
113
- readonly familyDrillId?: string;
114
- readonly piAttach?: unknown;
115
- readonly handoff?: unknown;
116
- readonly doctor?: unknown;
117
- readonly init?: unknown;
118
- readonly dispatchingRun?: unknown;
119
- readonly latestSubmittedRun?: unknown;
120
- readonly [key: string]: unknown;
121
- };
122
- export type AppState = {
123
- readonly projectRoot: string;
124
- readonly scene: AppSceneId;
125
- readonly status: AppStatus;
126
- readonly tick: number;
127
- readonly argv: readonly string[];
128
- readonly intent: AppIntent;
129
- readonly typeBar: AppTypeBarState;
130
- readonly footer: AppFooterState;
131
- readonly selection: AppSelectionState;
132
- readonly data: AppData;
133
- readonly runtimeReady: boolean;
134
- readonly actionLabel?: string;
135
- readonly error?: AppErrorState;
136
- /** Scene back-stack for esc-pops-one-level navigation (#13). */
137
- readonly history: readonly AppSceneId[];
138
- /** Pending destructive-action confirmation gate (#16). */
139
- readonly confirm?: AppConfirmState;
140
- /** Wall-clock ms of the last successful data refresh, for "updated Ns ago" (#14). */
141
- readonly dataUpdatedAtMs?: number;
142
- };
143
- export type AppStatePatch = Omit<Partial<AppState>, "typeBar" | "footer" | "selection" | "data"> & {
144
- readonly typeBar?: Partial<AppTypeBarState>;
145
- readonly footer?: Partial<AppFooterState>;
146
- readonly selection?: Partial<AppSelectionState>;
147
- readonly data?: AppData;
148
- };
149
- export type AppEvent = {
150
- readonly type: "scene.change";
151
- readonly scene: AppSceneId;
152
- readonly intent?: AppIntent;
153
- } | {
154
- readonly type: "action.started";
155
- readonly label: string;
156
- readonly optimistic?: Record<string, unknown>;
157
- } | {
158
- readonly type: "action.progress";
159
- readonly label: string;
160
- readonly detail?: string;
161
- readonly data?: Record<string, unknown>;
162
- } | {
163
- readonly type: "action.completed";
164
- readonly label: string;
165
- readonly data?: Record<string, unknown>;
166
- } | {
167
- readonly type: "action.failed";
168
- readonly label: string;
169
- readonly message: string;
170
- readonly hint?: string;
171
- readonly cause?: unknown;
172
- } | {
173
- readonly type: "data.patch";
174
- readonly data: Record<string, unknown>;
175
- } | {
176
- readonly type: "footer.patch";
177
- readonly footer: Partial<AppFooterState>;
178
- } | {
179
- readonly type: "typebar.patch";
180
- readonly typeBar: Partial<AppTypeBarState>;
181
- } | {
182
- readonly type: "runtime.ready";
183
- readonly runner: RunnerContext;
184
- } | {
185
- readonly type: "runtime.failed";
186
- readonly message: string;
187
- readonly hint?: string;
188
- readonly cause?: unknown;
189
- } | {
190
- readonly type: "confirm.request";
191
- readonly confirm: AppConfirmState;
192
- } | {
193
- readonly type: "confirm.cancel";
194
- };
195
- export type AppStore = {
196
- getState(): AppState;
197
- setState(next: AppState): void;
198
- patch(patch: AppStatePatch): void;
199
- subscribe(listener: (state: AppState) => void): () => void;
200
- };
201
- export type AppEventBus = {
202
- emit(event: AppEvent): void;
203
- subscribe(listener: (event: AppEvent) => void): () => void;
204
- };
205
- export type AppSceneLine = {
206
- readonly text: string;
207
- readonly styledText?: StyledText;
208
- readonly fg?: string;
209
- readonly bg?: string;
210
- readonly bold?: boolean;
211
- readonly dim?: boolean;
212
- readonly align?: "left" | "center" | "right";
213
- /** Compacted selectable index into the rendered item list. Derived by the
214
- * runtime at render time from `selectable`; scenes never set this directly. */
215
- readonly selectableIndex?: number;
216
- /** Stable id of the selectable item this line activates. Derived from
217
- * `selectable.id` at render time so clicks match by id, not position (#12). */
218
- readonly selectableId?: string;
219
- /** The full selectable item this line activates. The runtime DERIVES the
220
- * scene's selectable list from these (single source of truth, #6/#12). */
221
- readonly selectable?: AppSelectableItem;
222
- /** Activate on single click instead of only selecting/double-clicking. */
223
- readonly activateOnClick?: boolean;
224
- };
225
- export type AppScenePanel = {
226
- readonly id: string;
227
- readonly top: number;
228
- readonly left?: number;
229
- readonly width?: number;
230
- readonly height: number;
231
- readonly lines: readonly AppSceneLine[];
232
- readonly backgroundColor?: string;
233
- readonly backgroundAlpha?: number;
234
- readonly border?: boolean;
235
- readonly borderColor?: string;
236
- readonly borderAlpha?: number;
237
- readonly opacity?: number;
238
- readonly zIndex?: number;
239
- readonly stickyScroll?: boolean;
240
- readonly stickyStart?: "bottom" | "top" | "left" | "right";
241
- readonly chrome?: "ad-terminal" | "none";
242
- readonly headerText?: string;
243
- readonly headerHeight?: number;
244
- readonly paddingX?: number;
245
- readonly paddingY?: number;
246
- };
247
- export type AppSceneFrame = {
248
- readonly scene: AppSceneId;
249
- readonly title?: string;
250
- readonly lines: readonly AppSceneLine[];
251
- readonly panels?: readonly AppScenePanel[];
252
- readonly footer?: Partial<AppFooterState>;
253
- readonly typeBarPlaceholder?: string;
254
- readonly live?: boolean;
255
- /** Use the full terminal canvas instead of the centered app layout. */
256
- readonly fullScreen?: boolean;
257
- /** Hide and blur the command typebar while another terminal app owns input. */
258
- readonly hideTypeBar?: boolean;
259
- /** Raw keypresses should be forwarded to the embedded terminal host. */
260
- readonly terminalActive?: boolean;
261
- /** Render this content with a NATIVE OpenTUI component (Tree-sitter code,
262
- * diff, or markdown) inside a scrollbox, instead of the AppSceneLine pipeline
263
- * (#7). The scene's own `lines` still render around it (header/tabs). */
264
- readonly native?: AppNativeMount;
265
- };
266
- /** A scene's request to mount a native OpenTUI renderable in a panel rectangle. */
267
- export type AppNativeMount = {
268
- readonly kind: "code" | "diff" | "markdown" | "table";
269
- /** Source/diff/markdown text for code/diff/markdown kinds. */
270
- readonly content: string;
271
- /** Rows for `kind: "table"` — the first row is the header. Rendered with the
272
- * native TextTableRenderable (read-only dense tables). */
273
- readonly rows?: readonly (readonly string[])[];
274
- /** Tree-sitter filetype for `kind: "code"` (e.g. "typescript", "json"). */
275
- readonly filetype?: string;
276
- readonly top?: number;
277
- readonly left?: number;
278
- readonly width?: number;
279
- readonly height?: number;
280
- /** Pin scroll to the bottom (log/diff tails). */
281
- readonly stickyBottom?: boolean;
282
- };
283
- export type AppSceneRenderer = (state: AppState, layout?: StageLayout) => AppSceneFrame;
284
- export type AppRuntime = {
285
- getState(): AppState;
286
- patchState(patch: AppStatePatch): void;
287
- emit(event: AppEvent): void;
288
- setScene(scene: AppSceneId, intent?: AppIntent): void;
289
- runIntent(intent: AppIntent): Promise<void>;
290
- /** Pop the scene back-stack one level (esc), refreshing the target (#13). */
291
- goBack(): Promise<void>;
292
- getRunnerContext(): Promise<RunnerContext>;
293
- suspend(): void;
294
- resume(): void;
295
- destroy(): void;
296
- };
297
- export type AppAdapter = {
298
- readonly id: string;
299
- start?(runtime: AppRuntime): void | Promise<void>;
300
- handleIntent?(runtime: AppRuntime, intent: AppIntent): boolean | void | Promise<boolean | void>;
301
- };
302
- export type AppLaunchOptions = {
303
- readonly projectRoot: string;
304
- readonly argv: readonly string[];
305
- readonly dryRun?: boolean;
306
- readonly runId?: string;
307
- readonly policyMode?: "off" | "observe" | "enforce";
308
- readonly projectConfigured?: boolean;
309
- readonly initialFooter?: AppFooterState;
310
- readonly initializeRuntime?: () => Promise<RunnerContext>;
311
- readonly adapters?: readonly AppAdapter[];
312
- readonly sceneRenderers?: Partial<Record<AppSceneId, AppSceneRenderer>>;
313
- };
@@ -1 +0,0 @@
1
- // @bun
@@ -1,26 +0,0 @@
1
- export type RigLiveStatus = "connecting" | "connected" | "disconnected";
2
- export type RigLiveHandlers = {
3
- /** Any snapshot-affecting change (run/task/inbox state). The canonical
4
- * "something changed, re-pull what you show" signal. */
5
- readonly onSnapshotInvalidated?: (payload: unknown) => void;
6
- /** A run appended a log/timeline line — for live run-detail tails. */
7
- readonly onRunLogAppended?: (payload: unknown) => void;
8
- /** Sequence-numbered engine domain events. */
9
- readonly onEngineEvent?: (payload: unknown) => void;
10
- /** Socket health transitions; callers gate their polling fallback on this. */
11
- readonly onStatus?: (status: RigLiveStatus) => void;
12
- };
13
- export type RigLiveSubscription = {
14
- /** True while the push socket is connected — gate HTTP fallback polling on it. */
15
- readonly connected: () => boolean;
16
- readonly close: () => void;
17
- };
18
- /** http(s):// → ws(s)://, with the auth token as the `token` query param the
19
- * server's upgrade handler authenticates against (packages/server/src/
20
- * websocket.ts). Mirrors pi-rig's buildRigWebSocketUrl so every surface speaks
21
- * the same dialect. */
22
- export declare function buildRigWebSocketUrl(baseUrl: string, authToken: string | null): string;
23
- /** Open a reconnecting push subscription to the Rig server for a project root.
24
- * Resolves the same connection (local/remote + auth) the HTTP `…ViaServer`
25
- * calls use, so the socket targets the exact server the surface reads from. */
26
- export declare function connectRigServerEvents(projectRoot: string, handlers: RigLiveHandlers): Promise<RigLiveSubscription>;