@h-rig/cli 0.0.6-alpha.82 → 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 (206) hide show
  1. package/dist/bin/build-rig-binaries.js +40 -8
  2. package/dist/bin/rig.js +23402 -14577
  3. package/dist/src/app/board.js +217 -41
  4. package/dist/src/app-opentui/adapters/command.d.ts +2 -0
  5. package/dist/src/app-opentui/adapters/command.js +329 -0
  6. package/dist/src/app-opentui/adapters/common.js +2 -2
  7. package/dist/src/app-opentui/adapters/doctor.d.ts +0 -2
  8. package/dist/src/app-opentui/adapters/doctor.js +64 -39
  9. package/dist/src/app-opentui/adapters/family.d.ts +62 -0
  10. package/dist/src/app-opentui/adapters/family.js +14305 -0
  11. package/dist/src/app-opentui/adapters/fleet.d.ts +0 -2
  12. package/dist/src/app-opentui/adapters/fleet.js +90 -60
  13. package/dist/src/app-opentui/adapters/inbox.d.ts +12 -2
  14. package/dist/src/app-opentui/adapters/inbox.js +137 -78
  15. package/dist/src/app-opentui/adapters/init.d.ts +0 -2
  16. package/dist/src/app-opentui/adapters/init.js +85 -47
  17. package/dist/src/app-opentui/adapters/inspect.d.ts +52 -0
  18. package/dist/src/app-opentui/adapters/inspect.js +1024 -0
  19. package/dist/src/app-opentui/adapters/pi-attach.d.ts +15 -6
  20. package/dist/src/app-opentui/adapters/pi-attach.js +442 -125
  21. package/dist/src/app-opentui/adapters/pi.d.ts +23 -0
  22. package/dist/src/app-opentui/adapters/pi.js +363 -0
  23. package/dist/src/app-opentui/adapters/plugin.d.ts +84 -0
  24. package/dist/src/app-opentui/adapters/plugin.js +544 -0
  25. package/dist/src/app-opentui/adapters/repo.d.ts +37 -0
  26. package/dist/src/app-opentui/adapters/repo.js +186 -0
  27. package/dist/src/app-opentui/adapters/run-detail.d.ts +9 -2
  28. package/dist/src/app-opentui/adapters/run-detail.js +180 -63
  29. package/dist/src/app-opentui/adapters/server.d.ts +10 -2
  30. package/dist/src/app-opentui/adapters/server.js +191 -45
  31. package/dist/src/app-opentui/adapters/tasks.d.ts +11 -2
  32. package/dist/src/app-opentui/adapters/tasks.js +1123 -143
  33. package/dist/src/app-opentui/adapters/workspace.d.ts +49 -0
  34. package/dist/src/app-opentui/adapters/workspace.js +333 -0
  35. package/dist/src/app-opentui/autocomplete.d.ts +20 -0
  36. package/dist/src/app-opentui/autocomplete.js +576 -0
  37. package/dist/src/app-opentui/bootstrap.d.ts +1 -6
  38. package/dist/src/app-opentui/bootstrap.js +25252 -16474
  39. package/dist/src/app-opentui/command-palette.d.ts +3 -0
  40. package/dist/src/app-opentui/command-palette.js +1010 -0
  41. package/dist/src/app-opentui/command-pty-host.d.ts +62 -0
  42. package/dist/src/app-opentui/command-pty-host.js +248 -0
  43. package/dist/src/app-opentui/drone.js +8 -6
  44. package/dist/src/app-opentui/events.js +1 -1
  45. package/dist/src/app-opentui/fleet-stats.d.ts +32 -0
  46. package/dist/src/app-opentui/fleet-stats.js +114 -0
  47. package/dist/src/app-opentui/focus-manager.d.ts +14 -0
  48. package/dist/src/app-opentui/focus-manager.js +24 -0
  49. package/dist/src/app-opentui/index.js +5431 -2797
  50. package/dist/src/app-opentui/intent.js +179 -50
  51. package/dist/src/app-opentui/keymap.d.ts +21 -0
  52. package/dist/src/app-opentui/keymap.js +1748 -0
  53. package/dist/src/app-opentui/launch-routing.d.ts +16 -0
  54. package/dist/src/app-opentui/launch-routing.js +55 -0
  55. package/dist/src/app-opentui/layout.d.ts +7 -0
  56. package/dist/src/app-opentui/layout.js +13 -6
  57. package/dist/src/app-opentui/list-search.d.ts +24 -0
  58. package/dist/src/app-opentui/list-search.js +88 -1
  59. package/dist/src/app-opentui/pi-host-child.js +99 -17
  60. package/dist/src/app-opentui/pi-pty-host.d.ts +14 -0
  61. package/dist/src/app-opentui/pi-pty-host.js +30 -14
  62. package/dist/src/app-opentui/react/App.d.ts +9 -0
  63. package/dist/src/app-opentui/react/App.js +5144 -0
  64. package/dist/src/app-opentui/react/Backdrop.d.ts +5 -0
  65. package/dist/src/app-opentui/react/Backdrop.js +1834 -0
  66. package/dist/src/app-opentui/react/ChromeHost.d.ts +5 -0
  67. package/dist/src/app-opentui/react/ChromeHost.js +2942 -0
  68. package/dist/src/app-opentui/react/SceneFrameView.d.ts +7 -0
  69. package/dist/src/app-opentui/react/SceneFrameView.js +529 -0
  70. package/dist/src/app-opentui/react/context.d.ts +17 -0
  71. package/dist/src/app-opentui/react/context.js +37 -0
  72. package/dist/src/app-opentui/react/launch.d.ts +2 -0
  73. package/dist/src/app-opentui/react/launch.js +5743 -0
  74. package/dist/src/app-opentui/react/nav.d.ts +18 -0
  75. package/dist/src/app-opentui/react/nav.js +54 -0
  76. package/dist/src/app-opentui/react/scroll.d.ts +12 -0
  77. package/dist/src/app-opentui/react/scroll.js +21 -0
  78. package/dist/src/app-opentui/react/syntax.d.ts +2 -0
  79. package/dist/src/app-opentui/react/syntax.js +64 -0
  80. package/dist/src/app-opentui/registry.js +20428 -4828
  81. package/dist/src/app-opentui/render/ascii-fleet.d.ts +15 -0
  82. package/dist/src/app-opentui/render/ascii-fleet.js +82 -0
  83. package/dist/src/app-opentui/render/constants.d.ts +31 -0
  84. package/dist/src/app-opentui/render/constants.js +66 -0
  85. package/dist/src/app-opentui/render/graphics.d.ts +2 -1
  86. package/dist/src/app-opentui/render/graphics.js +228 -46
  87. package/dist/src/app-opentui/render/image-visual-layer-worker.js +469 -930
  88. package/dist/src/app-opentui/render/image-visual-layer.d.ts +25 -10
  89. package/dist/src/app-opentui/render/image-visual-layer.js +448 -329
  90. package/dist/src/app-opentui/render/native-host.d.ts +37 -0
  91. package/dist/src/app-opentui/render/native-host.js +179 -0
  92. package/dist/src/app-opentui/render/panel-layout.d.ts +38 -0
  93. package/dist/src/app-opentui/render/panel-layout.js +48 -0
  94. package/dist/src/app-opentui/render/panels.d.ts +2 -0
  95. package/dist/src/app-opentui/render/panels.js +78 -38
  96. package/dist/src/app-opentui/render/preloader.d.ts +10 -0
  97. package/dist/src/app-opentui/render/preloader.js +165 -0
  98. package/dist/src/app-opentui/render/scene.d.ts +53 -1
  99. package/dist/src/app-opentui/render/scene.js +195 -6
  100. package/dist/src/app-opentui/render/text.d.ts +7 -1
  101. package/dist/src/app-opentui/render/text.js +15 -8
  102. package/dist/src/app-opentui/render/type-bar.d.ts +2 -1
  103. package/dist/src/app-opentui/render/type-bar.js +113 -39
  104. package/dist/src/app-opentui/runtime-resources.d.ts +16 -0
  105. package/dist/src/app-opentui/runtime-resources.js +62 -0
  106. package/dist/src/app-opentui/runtime.d.ts +44 -1
  107. package/dist/src/app-opentui/runtime.js +5415 -2738
  108. package/dist/src/app-opentui/scenes/command.d.ts +3 -0
  109. package/dist/src/app-opentui/scenes/command.js +117 -0
  110. package/dist/src/app-opentui/scenes/doctor.d.ts +2 -1
  111. package/dist/src/app-opentui/scenes/doctor.js +221 -17
  112. package/dist/src/app-opentui/scenes/error.js +60 -20
  113. package/dist/src/app-opentui/scenes/family-domains/agent.d.ts +2 -0
  114. package/dist/src/app-opentui/scenes/family-domains/agent.js +348 -0
  115. package/dist/src/app-opentui/scenes/family-domains/browser.d.ts +2 -0
  116. package/dist/src/app-opentui/scenes/family-domains/browser.js +195 -0
  117. package/dist/src/app-opentui/scenes/family-domains/dist.d.ts +2 -0
  118. package/dist/src/app-opentui/scenes/family-domains/dist.js +243 -0
  119. package/dist/src/app-opentui/scenes/family-domains/git.d.ts +2 -0
  120. package/dist/src/app-opentui/scenes/family-domains/git.js +195 -0
  121. package/dist/src/app-opentui/scenes/family-domains/github.d.ts +2 -0
  122. package/dist/src/app-opentui/scenes/family-domains/github.js +274 -0
  123. package/dist/src/app-opentui/scenes/family-domains/harness.d.ts +2 -0
  124. package/dist/src/app-opentui/scenes/family-domains/harness.js +152 -0
  125. package/dist/src/app-opentui/scenes/family-domains/index.d.ts +4 -0
  126. package/dist/src/app-opentui/scenes/family-domains/index.js +1679 -0
  127. package/dist/src/app-opentui/scenes/family-domains/kit.d.ts +76 -0
  128. package/dist/src/app-opentui/scenes/family-domains/kit.js +305 -0
  129. package/dist/src/app-opentui/scenes/family-domains/profile.d.ts +2 -0
  130. package/dist/src/app-opentui/scenes/family-domains/profile.js +212 -0
  131. package/dist/src/app-opentui/scenes/family-domains/queue.d.ts +2 -0
  132. package/dist/src/app-opentui/scenes/family-domains/queue.js +146 -0
  133. package/dist/src/app-opentui/scenes/family-domains/remote.d.ts +2 -0
  134. package/dist/src/app-opentui/scenes/family-domains/remote.js +518 -0
  135. package/dist/src/app-opentui/scenes/family-domains/review.d.ts +2 -0
  136. package/dist/src/app-opentui/scenes/family-domains/review.js +280 -0
  137. package/dist/src/app-opentui/scenes/family-domains/setup.d.ts +2 -0
  138. package/dist/src/app-opentui/scenes/family-domains/setup.js +267 -0
  139. package/dist/src/app-opentui/scenes/family-domains/stats.d.ts +2 -0
  140. package/dist/src/app-opentui/scenes/family-domains/stats.js +370 -0
  141. package/dist/src/app-opentui/scenes/family.d.ts +3 -0
  142. package/dist/src/app-opentui/scenes/family.js +2144 -0
  143. package/dist/src/app-opentui/scenes/fleet.js +552 -43
  144. package/dist/src/app-opentui/scenes/handoff.js +342 -35
  145. package/dist/src/app-opentui/scenes/help.js +640 -56
  146. package/dist/src/app-opentui/scenes/inbox.d.ts +2 -1
  147. package/dist/src/app-opentui/scenes/inbox.js +329 -21
  148. package/dist/src/app-opentui/scenes/init.d.ts +2 -1
  149. package/dist/src/app-opentui/scenes/init.js +120 -34
  150. package/dist/src/app-opentui/scenes/inspect.d.ts +3 -0
  151. package/dist/src/app-opentui/scenes/inspect.js +793 -0
  152. package/dist/src/app-opentui/scenes/main.d.ts +2 -1
  153. package/dist/src/app-opentui/scenes/main.js +264 -29
  154. package/dist/src/app-opentui/scenes/pi.d.ts +3 -0
  155. package/dist/src/app-opentui/scenes/pi.js +508 -0
  156. package/dist/src/app-opentui/scenes/plugin.d.ts +3 -0
  157. package/dist/src/app-opentui/scenes/plugin.js +486 -0
  158. package/dist/src/app-opentui/scenes/repo.d.ts +3 -0
  159. package/dist/src/app-opentui/scenes/repo.js +424 -0
  160. package/dist/src/app-opentui/scenes/run-detail.d.ts +2 -1
  161. package/dist/src/app-opentui/scenes/run-detail.js +362 -35
  162. package/dist/src/app-opentui/scenes/server.d.ts +2 -1
  163. package/dist/src/app-opentui/scenes/server.js +243 -26
  164. package/dist/src/app-opentui/scenes/tasks.js +518 -41
  165. package/dist/src/app-opentui/scenes/workspace.d.ts +3 -0
  166. package/dist/src/app-opentui/scenes/workspace.js +426 -0
  167. package/dist/src/app-opentui/selectable.d.ts +19 -0
  168. package/dist/src/app-opentui/selectable.js +79 -0
  169. package/dist/src/app-opentui/state.js +129 -36
  170. package/dist/src/app-opentui/surface-catalog.d.ts +20 -0
  171. package/dist/src/app-opentui/surface-catalog.js +540 -0
  172. package/dist/src/app-opentui/terminal-capabilities.d.ts +7 -0
  173. package/dist/src/app-opentui/terminal-capabilities.js +15 -0
  174. package/dist/src/app-opentui/theme.d.ts +28 -6
  175. package/dist/src/app-opentui/theme.js +61 -8
  176. package/dist/src/app-opentui/types.d.ts +130 -5
  177. package/dist/src/commands/_authority-runs.d.ts +1 -1
  178. package/dist/src/commands/_authority-runs.js +2 -12
  179. package/dist/src/commands/_doctor-checks.js +62 -13
  180. package/dist/src/commands/_help-catalog.js +95 -15
  181. package/dist/src/commands/_operator-view.js +97 -15
  182. package/dist/src/commands/_pi-frontend.d.ts +2 -0
  183. package/dist/src/commands/_pi-frontend.js +97 -13
  184. package/dist/src/commands/_preflight.js +64 -14
  185. package/dist/src/commands/_server-client.js +82 -18
  186. package/dist/src/commands/_server-events.d.ts +26 -0
  187. package/dist/src/commands/_server-events.js +310 -0
  188. package/dist/src/commands/_snapshot-upload.js +62 -13
  189. package/dist/src/commands/agent.js +2 -12
  190. package/dist/src/commands/connect.js +7 -1
  191. package/dist/src/commands/doctor.js +62 -13
  192. package/dist/src/commands/github.js +144 -23
  193. package/dist/src/commands/inbox.js +62 -13
  194. package/dist/src/commands/init.js +82 -18
  195. package/dist/src/commands/inspect.js +62 -13
  196. package/dist/src/commands/run.js +100 -15
  197. package/dist/src/commands/server.js +71 -26
  198. package/dist/src/commands/setup.js +62 -13
  199. package/dist/src/commands/stats.js +157 -28
  200. package/dist/src/commands/task-run-driver.js +64 -25
  201. package/dist/src/commands/task.js +196 -43
  202. package/dist/src/commands.js +419 -123
  203. package/dist/src/index.js +426 -130
  204. package/package.json +11 -10
  205. package/dist/src/app-opentui/render/image-visual-layer-native-canvas.d.ts +0 -2
  206. package/dist/src/app-opentui/render/image-visual-layer-native-canvas.js +0 -1484
@@ -0,0 +1,37 @@
1
+ import { BoxRenderable, CodeRenderable, DiffRenderable, ScrollBoxRenderable, TextRenderable, TextTableRenderable, type CliRenderer } from "@opentui/core";
2
+ import type { StageLayout } from "../layout";
3
+ export type NativeMountKind = "code" | "diff" | "markdown" | "table";
4
+ /** A scene's request to render native content in a rectangle of its panel. */
5
+ export type NativeMount = {
6
+ readonly kind: NativeMountKind;
7
+ /** Source/markdown/diff text. */
8
+ readonly content: string;
9
+ /** Rows for `kind: "table"` — first row is the header. */
10
+ readonly rows?: readonly (readonly string[])[];
11
+ /** Tree-sitter filetype for `kind: "code"` (e.g. "typescript", "json"). */
12
+ readonly filetype?: string;
13
+ /** Cell rectangle to occupy (defaults to the centered content area). */
14
+ readonly top?: number;
15
+ readonly left?: number;
16
+ readonly width?: number;
17
+ readonly height?: number;
18
+ /** Pin to the bottom (log/diff tails). */
19
+ readonly stickyBottom?: boolean;
20
+ };
21
+ export type NativeHost = {
22
+ readonly scrollBox: ScrollBoxRenderable;
23
+ code: CodeRenderable | null;
24
+ diff: DiffRenderable | null;
25
+ table: TextTableRenderable | null;
26
+ active: NativeMountKind | null;
27
+ lastKey: string;
28
+ };
29
+ export declare function createNativeHost(renderer: CliRenderer): NativeHost | null;
30
+ export declare function hideNativeHost(host: NativeHost | null): void;
31
+ /** Position + populate the native host for a scene's mount request. Returns true
32
+ * if it rendered natively; false means the caller should fall back to lines. */
33
+ export declare function applyNativeHost(host: NativeHost | null, mount: NativeMount, layout: StageLayout): boolean;
34
+ export declare function destroyNativeHost(host: NativeHost | null): void;
35
+ /** A tiny title bar the scene can keep above the native host (line-rendered). */
36
+ export declare function nativeTitleBar(renderer: CliRenderer, id: string): TextRenderable;
37
+ export { BoxRenderable };
@@ -0,0 +1,179 @@
1
+ // @bun
2
+ // packages/cli/src/app-opentui/render/native-host.ts
3
+ import {
4
+ BoxRenderable,
5
+ CodeRenderable,
6
+ DiffRenderable,
7
+ RGBA,
8
+ ScrollBoxRenderable,
9
+ SyntaxStyle,
10
+ TextRenderable,
11
+ TextTableRenderable
12
+ } from "@opentui/core";
13
+
14
+ // packages/cli/src/app-opentui/theme.ts
15
+ import {
16
+ bold as otuiBold,
17
+ dim as otuiDim,
18
+ fg as otuiFg,
19
+ t,
20
+ TextAttributes
21
+ } from "@opentui/core";
22
+ var RIG_UI = {
23
+ bg: "#070809",
24
+ bg2: "#0b0c0e",
25
+ panel: "#101115",
26
+ panel2: "#14161b",
27
+ glass: "#1e2230",
28
+ border: "#2a2e3a",
29
+ ink: "#f4f5f8",
30
+ ink2: "#c7c9d3",
31
+ ink3: "#9aa0ae",
32
+ ink4: "#787b86",
33
+ lime: "#ccff4d",
34
+ limeDim: "#a9d63f",
35
+ cyan: "#56d8ff",
36
+ cyanDim: "#3f9fbd",
37
+ red: "#ff5d5d",
38
+ yellow: "#ffd24d",
39
+ magenta: "#ff79b0"
40
+ };
41
+ var styles = {
42
+ ink: otuiFg(RIG_UI.ink),
43
+ ink2: otuiFg(RIG_UI.ink2),
44
+ ink3: otuiFg(RIG_UI.ink3),
45
+ ink4: otuiFg(RIG_UI.ink4),
46
+ lime: otuiFg(RIG_UI.lime),
47
+ limeDim: otuiFg(RIG_UI.limeDim),
48
+ cyan: otuiFg(RIG_UI.cyan),
49
+ red: otuiFg(RIG_UI.red),
50
+ yellow: otuiFg(RIG_UI.yellow),
51
+ magenta: otuiFg(RIG_UI.magenta)
52
+ };
53
+
54
+ // packages/cli/src/app-opentui/render/native-host.ts
55
+ var syntaxStyle = null;
56
+ function rigSyntaxStyle() {
57
+ if (syntaxStyle)
58
+ return syntaxStyle;
59
+ syntaxStyle = SyntaxStyle.fromStyles({
60
+ keyword: { fg: RGBA.fromHex(RIG_UI.magenta), bold: true },
61
+ string: { fg: RGBA.fromHex(RIG_UI.lime) },
62
+ number: { fg: RGBA.fromHex(RIG_UI.cyan) },
63
+ comment: { fg: RGBA.fromHex(RIG_UI.ink4), italic: true },
64
+ function: { fg: RGBA.fromHex(RIG_UI.cyan) },
65
+ type: { fg: RGBA.fromHex(RIG_UI.limeDim) },
66
+ constant: { fg: RGBA.fromHex(RIG_UI.yellow) },
67
+ default: { fg: RGBA.fromHex(RIG_UI.ink2) }
68
+ });
69
+ return syntaxStyle;
70
+ }
71
+ function tableContent(rows) {
72
+ return rows.map((row, rowIndex) => row.map((cell) => [{ __isChunk: true, text: cell, fg: RGBA.fromHex(rowIndex === 0 ? RIG_UI.ink3 : RIG_UI.ink2) }]));
73
+ }
74
+ function createNativeHost(renderer) {
75
+ try {
76
+ const scrollBox = new ScrollBoxRenderable(renderer, {
77
+ id: "rig-native-scrollbox",
78
+ position: "absolute",
79
+ left: 0,
80
+ top: 0,
81
+ width: 1,
82
+ height: 1,
83
+ scrollY: true,
84
+ zIndex: 9,
85
+ visible: false
86
+ });
87
+ renderer.root.add(scrollBox);
88
+ return { scrollBox, code: null, diff: null, table: null, active: null, lastKey: "" };
89
+ } catch {
90
+ return null;
91
+ }
92
+ }
93
+ function hideAllChildren(host) {
94
+ if (host.code)
95
+ host.code.visible = false;
96
+ if (host.diff)
97
+ host.diff.visible = false;
98
+ if (host.table)
99
+ host.table.visible = false;
100
+ }
101
+ function hideNativeHost(host) {
102
+ if (!host)
103
+ return;
104
+ host.scrollBox.visible = false;
105
+ hideAllChildren(host);
106
+ host.active = null;
107
+ }
108
+ function applyNativeHost(host, mount, layout) {
109
+ if (!host)
110
+ return false;
111
+ try {
112
+ const left = mount.left ?? layout.centerLeft;
113
+ const top = mount.top ?? layout.centerTop;
114
+ const width = Math.max(8, mount.width ?? layout.centerWidth);
115
+ const height = Math.max(3, mount.height ?? layout.centerHeight);
116
+ host.scrollBox.left = left;
117
+ host.scrollBox.top = top;
118
+ host.scrollBox.width = width;
119
+ host.scrollBox.height = height;
120
+ host.scrollBox.visible = true;
121
+ hideAllChildren(host);
122
+ const rowCount = mount.rows?.length ?? 0;
123
+ const key = `${mount.kind}:${width}x${height}:${mount.content.length}:${mount.filetype ?? ""}:${rowCount}`;
124
+ if (mount.kind === "table") {
125
+ if (!host.table) {
126
+ host.table = new TextTableRenderable(host.scrollBox.ctx, { id: "rig-native-table", content: [], width: "100%", showBorders: true, columnWidthMode: "full", borderColor: RIG_UI.ink4 });
127
+ host.scrollBox.add(host.table);
128
+ }
129
+ if (host.lastKey !== key)
130
+ host.table.content = tableContent(mount.rows ?? []);
131
+ host.table.visible = true;
132
+ } else if (mount.kind === "diff") {
133
+ if (!host.diff) {
134
+ host.diff = new DiffRenderable(host.scrollBox.ctx, { id: "rig-native-diff", diff: "", width: "100%" });
135
+ host.scrollBox.add(host.diff);
136
+ }
137
+ if (host.lastKey !== key)
138
+ host.diff.diff = mount.content;
139
+ host.diff.visible = true;
140
+ } else {
141
+ const filetype = mount.kind === "markdown" ? "markdown" : mount.filetype ?? "text";
142
+ if (!host.code) {
143
+ host.code = new CodeRenderable(host.scrollBox.ctx, { id: "rig-native-code", content: "", filetype, syntaxStyle: rigSyntaxStyle(), width: "100%" });
144
+ host.scrollBox.add(host.code);
145
+ }
146
+ if (host.lastKey !== key) {
147
+ host.code.filetype = filetype;
148
+ host.code.content = mount.content;
149
+ }
150
+ host.code.visible = true;
151
+ }
152
+ host.active = mount.kind;
153
+ host.lastKey = key;
154
+ if (mount.stickyBottom)
155
+ host.scrollBox.scrollTo?.({ x: 0, y: Number.MAX_SAFE_INTEGER });
156
+ return true;
157
+ } catch {
158
+ hideNativeHost(host);
159
+ return false;
160
+ }
161
+ }
162
+ function destroyNativeHost(host) {
163
+ if (!host)
164
+ return;
165
+ try {
166
+ host.scrollBox.destroy?.();
167
+ } catch {}
168
+ }
169
+ function nativeTitleBar(renderer, id) {
170
+ return new TextRenderable(renderer, { id, content: "", position: "absolute", left: 0, top: 0, fg: RIG_UI.ink3, zIndex: 10, visible: false });
171
+ }
172
+ export {
173
+ nativeTitleBar,
174
+ hideNativeHost,
175
+ destroyNativeHost,
176
+ createNativeHost,
177
+ applyNativeHost,
178
+ BoxRenderable
179
+ };
@@ -0,0 +1,38 @@
1
+ import type { StageLayout } from "../layout";
2
+ import type { AppScenePanel } from "../types";
3
+ export type PanelCellRect = {
4
+ readonly left: number;
5
+ readonly top: number;
6
+ readonly width: number;
7
+ readonly height: number;
8
+ readonly right: number;
9
+ readonly bottom: number;
10
+ readonly headerHeight: number;
11
+ readonly dividerY: number;
12
+ };
13
+ export type PanelContentRect = {
14
+ readonly left: number;
15
+ readonly top: number;
16
+ readonly width: number;
17
+ readonly height: number;
18
+ readonly paddingX: number;
19
+ readonly paddingY: number;
20
+ readonly contentWidth: number;
21
+ };
22
+ export type PanelPixelSize = {
23
+ readonly width: number;
24
+ readonly height: number;
25
+ };
26
+ export type PanelPixelPlacement = {
27
+ readonly left: number;
28
+ readonly top: number;
29
+ readonly width: number;
30
+ readonly height: number;
31
+ readonly leftCells: number;
32
+ readonly topCells: number;
33
+ readonly widthCells: number;
34
+ readonly heightCells: number;
35
+ };
36
+ export declare function panelCellRect(layout: StageLayout, panel: AppScenePanel): PanelCellRect | null;
37
+ export declare function panelContentRect(layout: StageLayout, panel: AppScenePanel): PanelContentRect | null;
38
+ export declare function panelPixelPlacement(layout: StageLayout, panel: AppScenePanel, size: PanelPixelSize, minPixels?: number): PanelPixelPlacement | null;
@@ -0,0 +1,48 @@
1
+ // @bun
2
+ // packages/cli/src/app-opentui/render/panel-layout.ts
3
+ function panelCellRect(layout, panel) {
4
+ const left = Math.max(0, Math.min(layout.width - 1, layout.centerLeft + (panel.left ?? 0)));
5
+ const desiredWidth = panel.width ?? layout.centerWidth;
6
+ const width = Math.max(1, Math.min(layout.width - left, desiredWidth));
7
+ const top = Math.max(0, Math.min(layout.height - 1, layout.centerTop + panel.top));
8
+ const height = Math.max(1, Math.min(layout.height - top, panel.height));
9
+ if (width <= 3 || height <= 3)
10
+ return null;
11
+ const right = left + width - 1;
12
+ const bottom = top + height - 1;
13
+ const headerHeight = panel.chrome === "ad-terminal" ? Math.max(3, Math.min(height - 2, panel.headerHeight ?? 3)) : 0;
14
+ const dividerY = headerHeight ? Math.min(bottom - 1, top + headerHeight) : top;
15
+ return { left, top, width, height, right, bottom, headerHeight, dividerY };
16
+ }
17
+ function panelContentRect(layout, panel) {
18
+ const rect = panelCellRect(layout, panel);
19
+ if (!rect)
20
+ return null;
21
+ const chromeInset = panel.chrome === "ad-terminal" ? 1 : 0;
22
+ const left = rect.left + chromeInset;
23
+ const top = rect.top + rect.headerHeight + chromeInset;
24
+ const width = Math.max(1, Math.min(layout.width - left, rect.width - chromeInset * 2));
25
+ const height = Math.max(1, Math.min(layout.height - top, rect.height - rect.headerHeight - chromeInset * 2));
26
+ const paddingX = panel.paddingX ?? (panel.chrome === "ad-terminal" ? 5 : 2);
27
+ const paddingY = panel.paddingY ?? (panel.chrome === "ad-terminal" ? 2 : 1);
28
+ const contentWidth = Math.max(1, width - paddingX * 2 - 1);
29
+ return { left, top, width, height, paddingX, paddingY, contentWidth };
30
+ }
31
+ function panelPixelPlacement(layout, panel, size, minPixels = 8) {
32
+ const cellW = size.width / layout.width;
33
+ const cellH = size.height / layout.height;
34
+ const leftCells = layout.centerLeft + (panel.left ?? 0);
35
+ const topCells = layout.centerTop + panel.top;
36
+ const widthCells = panel.width ?? layout.centerWidth;
37
+ const heightCells = panel.height;
38
+ const left = Math.round(leftCells * cellW);
39
+ const top = Math.round(topCells * cellH);
40
+ const width = Math.round(widthCells * cellW);
41
+ const height = Math.round(heightCells * cellH);
42
+ return width > minPixels && height > minPixels ? { left, top, width, height, leftCells, topCells, widthCells, heightCells } : null;
43
+ }
44
+ export {
45
+ panelPixelPlacement,
46
+ panelContentRect,
47
+ panelCellRect
48
+ };
@@ -4,6 +4,8 @@ import type { AppSceneLine, AppScenePanel } from "../types";
4
4
  import { type TextLineRenderable } from "./text";
5
5
  export type ScrollPanelRenderable = ScrollBoxRenderable & {
6
6
  __rigTextLines: TextLineRenderable[];
7
+ __rigRenderer: CliRenderer;
8
+ __rigOnLineMouseDown?: (line: AppSceneLine, event: MouseEvent) => void;
7
9
  __rigPanelId?: string;
8
10
  };
9
11
  export declare function createScrollPanelLayer(renderer: CliRenderer, id: string, onLineMouseDown?: (line: AppSceneLine, event: MouseEvent) => void): ScrollPanelRenderable;
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  // packages/cli/src/app-opentui/render/panels.ts
3
- import { RGBA, ScrollBoxRenderable } from "@opentui/core";
3
+ import { RGBA as RGBA2, ScrollBoxRenderable } from "@opentui/core";
4
4
 
5
5
  // packages/cli/src/app-opentui/theme.ts
6
6
  import {
@@ -14,15 +14,17 @@ var RIG_UI = {
14
14
  bg: "#070809",
15
15
  bg2: "#0b0c0e",
16
16
  panel: "#101115",
17
- panel2: "#101115",
18
- glass: "#14161b",
19
- ink: "#f2f3f6",
20
- ink2: "#aeb0ba",
21
- ink3: "#6c6e79",
22
- ink4: "#44464f",
17
+ panel2: "#14161b",
18
+ glass: "#1e2230",
19
+ border: "#2a2e3a",
20
+ ink: "#f4f5f8",
21
+ ink2: "#c7c9d3",
22
+ ink3: "#9aa0ae",
23
+ ink4: "#787b86",
23
24
  lime: "#ccff4d",
24
25
  limeDim: "#a9d63f",
25
26
  cyan: "#56d8ff",
27
+ cyanDim: "#3f9fbd",
26
28
  red: "#ff5d5d",
27
29
  yellow: "#ffd24d",
28
30
  magenta: "#ff79b0"
@@ -40,8 +42,39 @@ var styles = {
40
42
  magenta: otuiFg(RIG_UI.magenta)
41
43
  };
42
44
 
45
+ // packages/cli/src/app-opentui/render/panel-layout.ts
46
+ function panelCellRect(layout, panel) {
47
+ const left = Math.max(0, Math.min(layout.width - 1, layout.centerLeft + (panel.left ?? 0)));
48
+ const desiredWidth = panel.width ?? layout.centerWidth;
49
+ const width = Math.max(1, Math.min(layout.width - left, desiredWidth));
50
+ const top = Math.max(0, Math.min(layout.height - 1, layout.centerTop + panel.top));
51
+ const height = Math.max(1, Math.min(layout.height - top, panel.height));
52
+ if (width <= 3 || height <= 3)
53
+ return null;
54
+ const right = left + width - 1;
55
+ const bottom = top + height - 1;
56
+ const headerHeight = panel.chrome === "ad-terminal" ? Math.max(3, Math.min(height - 2, panel.headerHeight ?? 3)) : 0;
57
+ const dividerY = headerHeight ? Math.min(bottom - 1, top + headerHeight) : top;
58
+ return { left, top, width, height, right, bottom, headerHeight, dividerY };
59
+ }
60
+ function panelContentRect(layout, panel) {
61
+ const rect = panelCellRect(layout, panel);
62
+ if (!rect)
63
+ return null;
64
+ const chromeInset = panel.chrome === "ad-terminal" ? 1 : 0;
65
+ const left = rect.left + chromeInset;
66
+ const top = rect.top + rect.headerHeight + chromeInset;
67
+ const width = Math.max(1, Math.min(layout.width - left, rect.width - chromeInset * 2));
68
+ const height = Math.max(1, Math.min(layout.height - top, rect.height - rect.headerHeight - chromeInset * 2));
69
+ const paddingX = panel.paddingX ?? (panel.chrome === "ad-terminal" ? 5 : 2);
70
+ const paddingY = panel.paddingY ?? (panel.chrome === "ad-terminal" ? 2 : 1);
71
+ const contentWidth = Math.max(1, width - paddingX * 2 - 1);
72
+ return { left, top, width, height, paddingX, paddingY, contentWidth };
73
+ }
74
+
43
75
  // packages/cli/src/app-opentui/render/text.ts
44
- import { TextAttributes as TextAttributes2, TextRenderable } from "@opentui/core";
76
+ import { RGBA, TextAttributes as TextAttributes2, TextRenderable } from "@opentui/core";
77
+ var TRANSPARENT = RGBA.fromInts(0, 0, 0, 0);
45
78
  function selectableMouseHandler(currentLineRef, onLineMouseDown) {
46
79
  return (event) => {
47
80
  const currentLine = currentLineRef();
@@ -74,25 +107,30 @@ function applyFlowTextLine(renderable, line, width) {
74
107
  renderable.width = Math.max(1, width);
75
108
  renderable.content = line?.styledText ?? line?.text ?? "";
76
109
  renderable.fg = line?.fg ?? RIG_UI.ink2;
110
+ renderable.bg = line?.bg ?? TRANSPARENT;
77
111
  renderable.attributes = line?.bold ? TextAttributes2.BOLD : line?.dim ? TextAttributes2.DIM : 0;
78
112
  }
79
113
 
80
114
  // packages/cli/src/app-opentui/render/panels.ts
81
- var TRANSPARENT = RGBA.fromInts(0, 0, 0, 0);
115
+ var TRANSPARENT2 = RGBA2.fromInts(0, 0, 0, 0);
82
116
  var MAX_PANEL_LINES = 420;
117
+ var PANEL_OPAQUE_ALPHA = 255;
118
+ var PANEL_BORDER = hexToRgba(RIG_UI.border, 255);
83
119
  function hexToRgba(hex, alpha) {
84
120
  const clean = hex.replace(/^#/, "");
85
121
  const full = clean.length === 3 ? clean.split("").map((part) => `${part}${part}`).join("") : clean;
86
122
  const value = Number.parseInt(full, 16);
87
123
  if (!Number.isFinite(value))
88
- return RGBA.fromInts(14, 15, 17, alpha);
89
- return RGBA.fromInts(value >> 16 & 255, value >> 8 & 255, value & 255, alpha);
124
+ return RGBA2.fromInts(14, 15, 17, alpha);
125
+ return RGBA2.fromInts(value >> 16 & 255, value >> 8 & 255, value & 255, alpha);
90
126
  }
91
127
  function panelBackground(panel) {
92
- return hexToRgba(panel.backgroundColor ?? RIG_UI.panel, panel.backgroundAlpha ?? 184);
128
+ return hexToRgba(panel.backgroundColor ?? RIG_UI.panel, PANEL_OPAQUE_ALPHA);
93
129
  }
94
130
  function panelBorder(panel) {
95
- return panel.borderColor ? hexToRgba(panel.borderColor, panel.borderAlpha ?? 54) : TRANSPARENT;
131
+ if (panel.borderColor)
132
+ return hexToRgba(panel.borderColor, panel.borderAlpha ?? 255);
133
+ return PANEL_BORDER;
96
134
  }
97
135
  function createScrollPanelLayer(renderer, id, onLineMouseDown) {
98
136
  const panel = new ScrollBoxRenderable(renderer, {
@@ -102,7 +140,7 @@ function createScrollPanelLayer(renderer, id, onLineMouseDown) {
102
140
  top: -2,
103
141
  width: 1,
104
142
  height: 1,
105
- backgroundColor: TRANSPARENT,
143
+ backgroundColor: TRANSPARENT2,
106
144
  border: false,
107
145
  shouldFill: true,
108
146
  opacity: 1,
@@ -118,7 +156,7 @@ function createScrollPanelLayer(renderer, id, onLineMouseDown) {
118
156
  visible: false,
119
157
  width: 1,
120
158
  trackOptions: {
121
- backgroundColor: TRANSPARENT,
159
+ backgroundColor: TRANSPARENT2,
122
160
  foregroundColor: hexToRgba(RIG_UI.ink4, 84)
123
161
  }
124
162
  },
@@ -126,18 +164,24 @@ function createScrollPanelLayer(renderer, id, onLineMouseDown) {
126
164
  height: 0,
127
165
  visible: false,
128
166
  trackOptions: {
129
- backgroundColor: TRANSPARENT,
130
- foregroundColor: TRANSPARENT
167
+ backgroundColor: TRANSPARENT2,
168
+ foregroundColor: TRANSPARENT2
131
169
  }
132
170
  }
133
171
  });
134
172
  panel.__rigTextLines = [];
135
- for (let index = 0;index < MAX_PANEL_LINES; index += 1) {
136
- const line = createFlowTextLine(renderer, `${id}-line-${index}`, onLineMouseDown);
173
+ panel.__rigRenderer = renderer;
174
+ panel.__rigOnLineMouseDown = onLineMouseDown;
175
+ return panel;
176
+ }
177
+ function ensurePanelLineCount(panel, desiredCount) {
178
+ const target = Math.min(MAX_PANEL_LINES, Math.max(0, desiredCount));
179
+ while (panel.__rigTextLines.length < target) {
180
+ const index = panel.__rigTextLines.length;
181
+ const line = createFlowTextLine(panel.__rigRenderer, `${panel.id}-line-${index}`, panel.__rigOnLineMouseDown);
137
182
  panel.__rigTextLines.push(line);
138
183
  panel.add(line);
139
184
  }
140
- return panel;
141
185
  }
142
186
  function hidePanel(panel) {
143
187
  panel.visible = false;
@@ -145,7 +189,7 @@ function hidePanel(panel) {
145
189
  panel.left = 0;
146
190
  panel.width = 1;
147
191
  panel.height = 1;
148
- panel.backgroundColor = TRANSPARENT;
192
+ panel.backgroundColor = TRANSPARENT2;
149
193
  panel.border = false;
150
194
  panel.__rigPanelId = undefined;
151
195
  panel.__rigTextLines.forEach((line) => applyFlowTextLine(line, undefined, 1));
@@ -157,19 +201,12 @@ function applyScrollPanels(panels, layout, scenePanels) {
157
201
  hidePanel(renderable);
158
202
  return;
159
203
  }
160
- const cardLeft = Math.max(0, Math.min(layout.width - 1, layout.centerLeft + (panel.left ?? 0)));
161
- const desiredWidth = panel.width ?? layout.centerWidth;
162
- const cardWidth = Math.max(1, Math.min(layout.width - cardLeft, desiredWidth));
163
- const cardTop = Math.max(0, Math.min(layout.height - 1, layout.centerTop + panel.top));
164
- const cardHeight = Math.max(1, Math.min(layout.height - cardTop, panel.height));
165
- const headerHeight = panel.chrome === "ad-terminal" ? Math.max(3, Math.min(cardHeight - 2, panel.headerHeight ?? 3)) : 0;
166
- const left = cardLeft + (panel.chrome === "ad-terminal" ? 1 : 0);
167
- const top = cardTop + headerHeight + (panel.chrome === "ad-terminal" ? 1 : 0);
168
- const width = Math.max(1, Math.min(layout.width - left, cardWidth - (panel.chrome === "ad-terminal" ? 2 : 0)));
169
- const height = Math.max(1, Math.min(layout.height - top, cardHeight - headerHeight - (panel.chrome === "ad-terminal" ? 2 : 0)));
170
- const paddingX = panel.paddingX ?? (panel.chrome === "ad-terminal" ? 5 : 2);
171
- const paddingY = panel.paddingY ?? (panel.chrome === "ad-terminal" ? 2 : 1);
172
- const contentWidth = Math.max(1, width - paddingX * 2 - 1);
204
+ const contentRect = panelContentRect(layout, panel);
205
+ if (!contentRect) {
206
+ hidePanel(renderable);
207
+ return;
208
+ }
209
+ const { left, top, width, height, paddingX, paddingY, contentWidth } = contentRect;
173
210
  renderable.visible = true;
174
211
  renderable.left = left;
175
212
  renderable.top = top;
@@ -177,9 +214,10 @@ function applyScrollPanels(panels, layout, scenePanels) {
177
214
  renderable.height = height;
178
215
  renderable.zIndex = panel.zIndex ?? 6;
179
216
  renderable.opacity = panel.opacity ?? 1;
180
- renderable.backgroundColor = panel.chrome === "ad-terminal" ? TRANSPARENT : panelBackground(panel);
181
- renderable.border = panel.chrome === "ad-terminal" ? false : panel.border ?? false;
182
- renderable.borderColor = panelBorder(panel);
217
+ const adTerminal = panel.chrome === "ad-terminal";
218
+ renderable.backgroundColor = adTerminal ? TRANSPARENT2 : panelBackground(panel);
219
+ renderable.border = adTerminal ? false : true;
220
+ renderable.borderColor = adTerminal ? TRANSPARENT2 : panelBorder(panel);
183
221
  renderable.paddingX = paddingX;
184
222
  renderable.paddingY = paddingY;
185
223
  renderable.stickyScroll = panel.stickyScroll ?? false;
@@ -190,8 +228,10 @@ function applyScrollPanels(panels, layout, scenePanels) {
190
228
  renderable.__rigPanelId = panel.id;
191
229
  renderable.scrollTo(0);
192
230
  }
231
+ const lineCount = Math.min(panel.lines.length, MAX_PANEL_LINES);
232
+ ensurePanelLineCount(renderable, lineCount);
193
233
  renderable.__rigTextLines.forEach((line, lineIndex) => {
194
- applyFlowTextLine(line, panel.lines[lineIndex], contentWidth);
234
+ applyFlowTextLine(line, lineIndex < lineCount ? panel.lines[lineIndex] : undefined, contentWidth);
195
235
  });
196
236
  });
197
237
  }
@@ -0,0 +1,10 @@
1
+ import type { StageLayout } from "../layout";
2
+ import type { AppSceneFrame, AppSceneId } from "../types";
3
+ export type PreloaderTransitionState = {
4
+ scene: AppSceneId | null;
5
+ startedAtMs: number;
6
+ minUntilMs: number;
7
+ };
8
+ export declare function maybeStartPreloaderTransition(transition: PreloaderTransitionState, scene: AppSceneId, now?: number): void;
9
+ export declare function isPreloaderActive(transition: PreloaderTransitionState, targetReady: boolean, now?: number): boolean;
10
+ export declare function renderAsciiPreloaderFrame(scene: AppSceneId, layout: StageLayout, tick: number): AppSceneFrame;