@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.
- package/dist/bin/build-rig-binaries.js +40 -8
- package/dist/bin/rig.js +23402 -14577
- package/dist/src/app/board.js +217 -41
- package/dist/src/app-opentui/adapters/command.d.ts +2 -0
- package/dist/src/app-opentui/adapters/command.js +329 -0
- package/dist/src/app-opentui/adapters/common.js +2 -2
- package/dist/src/app-opentui/adapters/doctor.d.ts +0 -2
- package/dist/src/app-opentui/adapters/doctor.js +64 -39
- package/dist/src/app-opentui/adapters/family.d.ts +62 -0
- package/dist/src/app-opentui/adapters/family.js +14305 -0
- package/dist/src/app-opentui/adapters/fleet.d.ts +0 -2
- package/dist/src/app-opentui/adapters/fleet.js +90 -60
- package/dist/src/app-opentui/adapters/inbox.d.ts +12 -2
- package/dist/src/app-opentui/adapters/inbox.js +137 -78
- package/dist/src/app-opentui/adapters/init.d.ts +0 -2
- package/dist/src/app-opentui/adapters/init.js +85 -47
- package/dist/src/app-opentui/adapters/inspect.d.ts +52 -0
- package/dist/src/app-opentui/adapters/inspect.js +1024 -0
- package/dist/src/app-opentui/adapters/pi-attach.d.ts +15 -6
- package/dist/src/app-opentui/adapters/pi-attach.js +442 -125
- package/dist/src/app-opentui/adapters/pi.d.ts +23 -0
- package/dist/src/app-opentui/adapters/pi.js +363 -0
- package/dist/src/app-opentui/adapters/plugin.d.ts +84 -0
- package/dist/src/app-opentui/adapters/plugin.js +544 -0
- package/dist/src/app-opentui/adapters/repo.d.ts +37 -0
- package/dist/src/app-opentui/adapters/repo.js +186 -0
- package/dist/src/app-opentui/adapters/run-detail.d.ts +9 -2
- package/dist/src/app-opentui/adapters/run-detail.js +180 -63
- package/dist/src/app-opentui/adapters/server.d.ts +10 -2
- package/dist/src/app-opentui/adapters/server.js +191 -45
- package/dist/src/app-opentui/adapters/tasks.d.ts +11 -2
- package/dist/src/app-opentui/adapters/tasks.js +1123 -143
- package/dist/src/app-opentui/adapters/workspace.d.ts +49 -0
- package/dist/src/app-opentui/adapters/workspace.js +333 -0
- package/dist/src/app-opentui/autocomplete.d.ts +20 -0
- package/dist/src/app-opentui/autocomplete.js +576 -0
- package/dist/src/app-opentui/bootstrap.d.ts +1 -6
- package/dist/src/app-opentui/bootstrap.js +25252 -16474
- package/dist/src/app-opentui/command-palette.d.ts +3 -0
- package/dist/src/app-opentui/command-palette.js +1010 -0
- package/dist/src/app-opentui/command-pty-host.d.ts +62 -0
- package/dist/src/app-opentui/command-pty-host.js +248 -0
- package/dist/src/app-opentui/drone.js +8 -6
- package/dist/src/app-opentui/events.js +1 -1
- package/dist/src/app-opentui/fleet-stats.d.ts +32 -0
- package/dist/src/app-opentui/fleet-stats.js +114 -0
- package/dist/src/app-opentui/focus-manager.d.ts +14 -0
- package/dist/src/app-opentui/focus-manager.js +24 -0
- package/dist/src/app-opentui/index.js +5431 -2797
- package/dist/src/app-opentui/intent.js +179 -50
- package/dist/src/app-opentui/keymap.d.ts +21 -0
- package/dist/src/app-opentui/keymap.js +1748 -0
- package/dist/src/app-opentui/launch-routing.d.ts +16 -0
- package/dist/src/app-opentui/launch-routing.js +55 -0
- package/dist/src/app-opentui/layout.d.ts +7 -0
- package/dist/src/app-opentui/layout.js +13 -6
- package/dist/src/app-opentui/list-search.d.ts +24 -0
- package/dist/src/app-opentui/list-search.js +88 -1
- package/dist/src/app-opentui/pi-host-child.js +99 -17
- package/dist/src/app-opentui/pi-pty-host.d.ts +14 -0
- package/dist/src/app-opentui/pi-pty-host.js +30 -14
- package/dist/src/app-opentui/react/App.d.ts +9 -0
- package/dist/src/app-opentui/react/App.js +5144 -0
- package/dist/src/app-opentui/react/Backdrop.d.ts +5 -0
- package/dist/src/app-opentui/react/Backdrop.js +1834 -0
- package/dist/src/app-opentui/react/ChromeHost.d.ts +5 -0
- package/dist/src/app-opentui/react/ChromeHost.js +2942 -0
- package/dist/src/app-opentui/react/SceneFrameView.d.ts +7 -0
- package/dist/src/app-opentui/react/SceneFrameView.js +529 -0
- package/dist/src/app-opentui/react/context.d.ts +17 -0
- package/dist/src/app-opentui/react/context.js +37 -0
- package/dist/src/app-opentui/react/launch.d.ts +2 -0
- package/dist/src/app-opentui/react/launch.js +5743 -0
- package/dist/src/app-opentui/react/nav.d.ts +18 -0
- package/dist/src/app-opentui/react/nav.js +54 -0
- package/dist/src/app-opentui/react/scroll.d.ts +12 -0
- package/dist/src/app-opentui/react/scroll.js +21 -0
- package/dist/src/app-opentui/react/syntax.d.ts +2 -0
- package/dist/src/app-opentui/react/syntax.js +64 -0
- package/dist/src/app-opentui/registry.js +20428 -4828
- package/dist/src/app-opentui/render/ascii-fleet.d.ts +15 -0
- package/dist/src/app-opentui/render/ascii-fleet.js +82 -0
- package/dist/src/app-opentui/render/constants.d.ts +31 -0
- package/dist/src/app-opentui/render/constants.js +66 -0
- package/dist/src/app-opentui/render/graphics.d.ts +2 -1
- package/dist/src/app-opentui/render/graphics.js +228 -46
- package/dist/src/app-opentui/render/image-visual-layer-worker.js +469 -930
- package/dist/src/app-opentui/render/image-visual-layer.d.ts +25 -10
- package/dist/src/app-opentui/render/image-visual-layer.js +448 -329
- package/dist/src/app-opentui/render/native-host.d.ts +37 -0
- package/dist/src/app-opentui/render/native-host.js +179 -0
- package/dist/src/app-opentui/render/panel-layout.d.ts +38 -0
- package/dist/src/app-opentui/render/panel-layout.js +48 -0
- package/dist/src/app-opentui/render/panels.d.ts +2 -0
- package/dist/src/app-opentui/render/panels.js +78 -38
- package/dist/src/app-opentui/render/preloader.d.ts +10 -0
- package/dist/src/app-opentui/render/preloader.js +165 -0
- package/dist/src/app-opentui/render/scene.d.ts +53 -1
- package/dist/src/app-opentui/render/scene.js +195 -6
- package/dist/src/app-opentui/render/text.d.ts +7 -1
- package/dist/src/app-opentui/render/text.js +15 -8
- package/dist/src/app-opentui/render/type-bar.d.ts +2 -1
- package/dist/src/app-opentui/render/type-bar.js +113 -39
- package/dist/src/app-opentui/runtime-resources.d.ts +16 -0
- package/dist/src/app-opentui/runtime-resources.js +62 -0
- package/dist/src/app-opentui/runtime.d.ts +44 -1
- package/dist/src/app-opentui/runtime.js +5415 -2738
- package/dist/src/app-opentui/scenes/command.d.ts +3 -0
- package/dist/src/app-opentui/scenes/command.js +117 -0
- package/dist/src/app-opentui/scenes/doctor.d.ts +2 -1
- package/dist/src/app-opentui/scenes/doctor.js +221 -17
- package/dist/src/app-opentui/scenes/error.js +60 -20
- package/dist/src/app-opentui/scenes/family-domains/agent.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/agent.js +348 -0
- package/dist/src/app-opentui/scenes/family-domains/browser.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/browser.js +195 -0
- package/dist/src/app-opentui/scenes/family-domains/dist.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/dist.js +243 -0
- package/dist/src/app-opentui/scenes/family-domains/git.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/git.js +195 -0
- package/dist/src/app-opentui/scenes/family-domains/github.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/github.js +274 -0
- package/dist/src/app-opentui/scenes/family-domains/harness.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/harness.js +152 -0
- package/dist/src/app-opentui/scenes/family-domains/index.d.ts +4 -0
- package/dist/src/app-opentui/scenes/family-domains/index.js +1679 -0
- package/dist/src/app-opentui/scenes/family-domains/kit.d.ts +76 -0
- package/dist/src/app-opentui/scenes/family-domains/kit.js +305 -0
- package/dist/src/app-opentui/scenes/family-domains/profile.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/profile.js +212 -0
- package/dist/src/app-opentui/scenes/family-domains/queue.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/queue.js +146 -0
- package/dist/src/app-opentui/scenes/family-domains/remote.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/remote.js +518 -0
- package/dist/src/app-opentui/scenes/family-domains/review.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/review.js +280 -0
- package/dist/src/app-opentui/scenes/family-domains/setup.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/setup.js +267 -0
- package/dist/src/app-opentui/scenes/family-domains/stats.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/stats.js +370 -0
- package/dist/src/app-opentui/scenes/family.d.ts +3 -0
- package/dist/src/app-opentui/scenes/family.js +2144 -0
- package/dist/src/app-opentui/scenes/fleet.js +552 -43
- package/dist/src/app-opentui/scenes/handoff.js +342 -35
- package/dist/src/app-opentui/scenes/help.js +640 -56
- package/dist/src/app-opentui/scenes/inbox.d.ts +2 -1
- package/dist/src/app-opentui/scenes/inbox.js +329 -21
- package/dist/src/app-opentui/scenes/init.d.ts +2 -1
- package/dist/src/app-opentui/scenes/init.js +120 -34
- package/dist/src/app-opentui/scenes/inspect.d.ts +3 -0
- package/dist/src/app-opentui/scenes/inspect.js +793 -0
- package/dist/src/app-opentui/scenes/main.d.ts +2 -1
- package/dist/src/app-opentui/scenes/main.js +264 -29
- package/dist/src/app-opentui/scenes/pi.d.ts +3 -0
- package/dist/src/app-opentui/scenes/pi.js +508 -0
- package/dist/src/app-opentui/scenes/plugin.d.ts +3 -0
- package/dist/src/app-opentui/scenes/plugin.js +486 -0
- package/dist/src/app-opentui/scenes/repo.d.ts +3 -0
- package/dist/src/app-opentui/scenes/repo.js +424 -0
- package/dist/src/app-opentui/scenes/run-detail.d.ts +2 -1
- package/dist/src/app-opentui/scenes/run-detail.js +362 -35
- package/dist/src/app-opentui/scenes/server.d.ts +2 -1
- package/dist/src/app-opentui/scenes/server.js +243 -26
- package/dist/src/app-opentui/scenes/tasks.js +518 -41
- package/dist/src/app-opentui/scenes/workspace.d.ts +3 -0
- package/dist/src/app-opentui/scenes/workspace.js +426 -0
- package/dist/src/app-opentui/selectable.d.ts +19 -0
- package/dist/src/app-opentui/selectable.js +79 -0
- package/dist/src/app-opentui/state.js +129 -36
- package/dist/src/app-opentui/surface-catalog.d.ts +20 -0
- package/dist/src/app-opentui/surface-catalog.js +540 -0
- package/dist/src/app-opentui/terminal-capabilities.d.ts +7 -0
- package/dist/src/app-opentui/terminal-capabilities.js +15 -0
- package/dist/src/app-opentui/theme.d.ts +28 -6
- package/dist/src/app-opentui/theme.js +61 -8
- package/dist/src/app-opentui/types.d.ts +130 -5
- package/dist/src/commands/_authority-runs.d.ts +1 -1
- package/dist/src/commands/_authority-runs.js +2 -12
- package/dist/src/commands/_doctor-checks.js +62 -13
- package/dist/src/commands/_help-catalog.js +95 -15
- package/dist/src/commands/_operator-view.js +97 -15
- package/dist/src/commands/_pi-frontend.d.ts +2 -0
- package/dist/src/commands/_pi-frontend.js +97 -13
- package/dist/src/commands/_preflight.js +64 -14
- package/dist/src/commands/_server-client.js +82 -18
- package/dist/src/commands/_server-events.d.ts +26 -0
- package/dist/src/commands/_server-events.js +310 -0
- package/dist/src/commands/_snapshot-upload.js +62 -13
- package/dist/src/commands/agent.js +2 -12
- package/dist/src/commands/connect.js +7 -1
- package/dist/src/commands/doctor.js +62 -13
- package/dist/src/commands/github.js +144 -23
- package/dist/src/commands/inbox.js +62 -13
- package/dist/src/commands/init.js +82 -18
- package/dist/src/commands/inspect.js +62 -13
- package/dist/src/commands/run.js +100 -15
- package/dist/src/commands/server.js +71 -26
- package/dist/src/commands/setup.js +62 -13
- package/dist/src/commands/stats.js +157 -28
- package/dist/src/commands/task-run-driver.js +64 -25
- package/dist/src/commands/task.js +196 -43
- package/dist/src/commands.js +419 -123
- package/dist/src/index.js +426 -130
- package/package.json +11 -10
- package/dist/src/app-opentui/render/image-visual-layer-native-canvas.d.ts +0 -2
- package/dist/src/app-opentui/render/image-visual-layer-native-canvas.js +0 -1484
|
@@ -11,15 +11,17 @@ var RIG_UI = {
|
|
|
11
11
|
bg: "#070809",
|
|
12
12
|
bg2: "#0b0c0e",
|
|
13
13
|
panel: "#101115",
|
|
14
|
-
panel2: "#
|
|
15
|
-
glass: "#
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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,16 +39,22 @@ 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 };
|
|
43
57
|
}
|
|
44
|
-
function blank() {
|
|
45
|
-
return { text: "" };
|
|
46
|
-
}
|
|
47
|
-
function center(text, fg = RIG_UI.ink2, bold = false) {
|
|
48
|
-
return { text, fg, bold, align: "center" };
|
|
49
|
-
}
|
|
50
58
|
function deckRow(input) {
|
|
51
59
|
const prefix = input.active ? "\u25B8" : " ";
|
|
52
60
|
const label = input.label.toUpperCase().padEnd(10);
|
|
@@ -61,7 +69,118 @@ function makeSceneFrame(input) {
|
|
|
61
69
|
return input;
|
|
62
70
|
}
|
|
63
71
|
|
|
72
|
+
// packages/cli/src/app-opentui/selectable.ts
|
|
73
|
+
function selectableDeckRow(deck, item) {
|
|
74
|
+
return { ...deckRow({ ...deck, activateOnClick: true }), selectable: item };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// packages/cli/src/app-opentui/render/ascii-fleet.ts
|
|
78
|
+
var LEAD_DRONE = [
|
|
79
|
+
" .-=-. .-=-. ",
|
|
80
|
+
" ( !!! ) ( !!! ) ",
|
|
81
|
+
" '-=-'._ _.'-=-' ",
|
|
82
|
+
" '._ _.' ",
|
|
83
|
+
" '=$$$$$$$=.' ",
|
|
84
|
+
" =$$$$$$$$$$$= ",
|
|
85
|
+
" $$$@@@@@@@@@@$$$ ",
|
|
86
|
+
" $$$@@ @@$$$ ",
|
|
87
|
+
" $$@ ? @$$$ ",
|
|
88
|
+
" $$$@ '-' @$$$ ",
|
|
89
|
+
" $$$@@ @@$$$ ",
|
|
90
|
+
" $$$@@@@@@@@@@$$$ ",
|
|
91
|
+
" =$$$$$$$$$$$= ",
|
|
92
|
+
" '=$$$$$$$=.' ",
|
|
93
|
+
" _.' '._ ",
|
|
94
|
+
" .-=-.' '.-=-. ",
|
|
95
|
+
" ( !!! ) ( !!! ) ",
|
|
96
|
+
" '-=-' '-=-' "
|
|
97
|
+
];
|
|
98
|
+
var MINI_DRONE = [
|
|
99
|
+
"(!!!) (!!!)",
|
|
100
|
+
" \\%==%/ ",
|
|
101
|
+
" %%?%% ",
|
|
102
|
+
" /%==%\\ ",
|
|
103
|
+
"(!!!) (!!!)"
|
|
104
|
+
];
|
|
105
|
+
var ROTORS = ["---", "\\\\\\", "|||", "///"];
|
|
106
|
+
var FLEET_GRID_WIDTH = 52;
|
|
107
|
+
var FLEET_GRID_HEIGHT = 27;
|
|
108
|
+
var FLEET = [
|
|
109
|
+
{ art: MINI_DRONE, x: 0, y: 2, amp: 1, speed: 0.05, phase: 0, dx: 1, driftSpeed: 0.02 },
|
|
110
|
+
{ art: MINI_DRONE, x: 39, y: 2, amp: 1, speed: 0.044, phase: 2.1, dx: 1, driftSpeed: 0.017 },
|
|
111
|
+
{ art: MINI_DRONE, x: 1, y: 20, amp: 1, speed: 0.048, phase: 4.2, dx: 1, driftSpeed: 0.023 },
|
|
112
|
+
{ art: MINI_DRONE, x: 38, y: 20, amp: 1, speed: 0.041, phase: 1.3, dx: 1, driftSpeed: 0.015 },
|
|
113
|
+
{ art: LEAD_DRONE, x: 10, y: 5, amp: 2, speed: 0.04, phase: 0, dx: 0, driftSpeed: 0.011 }
|
|
114
|
+
];
|
|
115
|
+
function fleetRows(tick, options = {}) {
|
|
116
|
+
const animate = options.animate ?? true;
|
|
117
|
+
const t2 = animate ? tick : 0;
|
|
118
|
+
const blade = ROTORS[Math.floor(t2 / 4) % ROTORS.length];
|
|
119
|
+
const pulse = Math.sin(t2 * 0.07);
|
|
120
|
+
const eye = pulse > 0.45 ? "@" : pulse > -0.1 ? "o" : ".";
|
|
121
|
+
const grid = Array.from({ length: FLEET_GRID_HEIGHT }, () => Array.from({ length: FLEET_GRID_WIDTH }, () => " "));
|
|
122
|
+
for (const drone of FLEET) {
|
|
123
|
+
const yOffset = drone.y + Math.round(drone.amp * Math.sin(t2 * drone.speed + drone.phase));
|
|
124
|
+
const xOffset = drone.x + Math.round(drone.dx * Math.sin(t2 * drone.driftSpeed + drone.phase));
|
|
125
|
+
for (let row = 0;row < drone.art.length; row += 1) {
|
|
126
|
+
const source = drone.art[row];
|
|
127
|
+
const targetY = yOffset + row;
|
|
128
|
+
if (targetY < 0 || targetY >= FLEET_GRID_HEIGHT)
|
|
129
|
+
continue;
|
|
130
|
+
for (let col = 0;col < source.length; col += 1) {
|
|
131
|
+
let char = source[col];
|
|
132
|
+
if (char === " ")
|
|
133
|
+
continue;
|
|
134
|
+
const targetX = xOffset + col;
|
|
135
|
+
if (targetX < 0 || targetX >= FLEET_GRID_WIDTH)
|
|
136
|
+
continue;
|
|
137
|
+
if (source.slice(col, col + 3) === "!!!") {
|
|
138
|
+
for (let rotorIndex = 0;rotorIndex < 3; rotorIndex += 1) {
|
|
139
|
+
if (targetX + rotorIndex < FLEET_GRID_WIDTH)
|
|
140
|
+
grid[targetY][targetX + rotorIndex] = blade[rotorIndex];
|
|
141
|
+
}
|
|
142
|
+
col += 2;
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
if (char === "?")
|
|
146
|
+
char = eye;
|
|
147
|
+
grid[targetY][targetX] = char;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return grid.map((row) => row.join("").replace(/\s+$/, ""));
|
|
152
|
+
}
|
|
153
|
+
|
|
64
154
|
// packages/cli/src/app-opentui/scenes/handoff.ts
|
|
155
|
+
function elapsedLabel(step, nowMs) {
|
|
156
|
+
const end = step.endedAtMs ?? nowMs;
|
|
157
|
+
const seconds = Math.max(0, (end - step.startedAtMs) / 1000);
|
|
158
|
+
return `${seconds.toFixed(1)}s`;
|
|
159
|
+
}
|
|
160
|
+
function prepStepLines(handoff) {
|
|
161
|
+
const now = Date.now();
|
|
162
|
+
const steps = handoff.steps ?? [];
|
|
163
|
+
const out = [
|
|
164
|
+
line(`Preparing bundled Pi for ${handoff.runId.slice(0, 8)}`, { fg: RIG_UI.ink, bold: true }),
|
|
165
|
+
line("connect \u2192 fetch transcript \u2192 spawn host \u2192 start Pi", { fg: RIG_UI.ink4 }),
|
|
166
|
+
line("", {}),
|
|
167
|
+
line("STEPS", { fg: RIG_UI.ink3, bold: true })
|
|
168
|
+
];
|
|
169
|
+
for (const step of steps) {
|
|
170
|
+
const glyph = step.status === "done" ? "\u2713" : step.status === "failed" ? "\u2717" : "\u283F";
|
|
171
|
+
const color = step.status === "failed" ? RIG_UI.red : step.status === "done" ? RIG_UI.limeDim : RIG_UI.cyan;
|
|
172
|
+
out.push(line(`${glyph} ${step.label} \xB7 ${elapsedLabel(step, now)}`, { fg: color }));
|
|
173
|
+
}
|
|
174
|
+
if (steps.length === 0)
|
|
175
|
+
out.push(line("\u283F connecting\u2026", { fg: RIG_UI.cyan }));
|
|
176
|
+
return out;
|
|
177
|
+
}
|
|
178
|
+
function handoffAttachItem(runId) {
|
|
179
|
+
return { id: "attach", label: "attach", intent: { scene: "handoff", argv: ["attach", runId], action: { kind: "run-attach", payload: { runId }, label: `Attach Pi ${runId.slice(0, 8)}` } }, message: "open bundled Pi" };
|
|
180
|
+
}
|
|
181
|
+
var HANDOFF_RUNS_ITEM = { id: "runs", label: "runs", intent: { scene: "fleet", argv: ["fleet"], action: { kind: "refresh", label: "Back to fleet" } }, message: "back to fleet" };
|
|
182
|
+
var HANDOFF_RUNS_PICK_ITEM = { id: "runs", label: "runs", intent: { scene: "fleet", argv: ["fleet"], action: { kind: "refresh", label: "Open runs" } }, message: "select a run first" };
|
|
183
|
+
var HANDOFF_TASKS_ITEM = { id: "tasks", label: "tasks", intent: { scene: "tasks", argv: ["tasks"], action: { kind: "refresh", label: "Open tasks" } }, message: "open tasks" };
|
|
65
184
|
function handoffState(state) {
|
|
66
185
|
const value = state.data.piAttach ?? state.data.handoff;
|
|
67
186
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
@@ -76,16 +195,157 @@ function clip(value, width) {
|
|
|
76
195
|
return value.length <= width ? value : `${value.slice(0, Math.max(0, width - 1))}\u2026`;
|
|
77
196
|
}
|
|
78
197
|
function terminalRail(snapshot) {
|
|
79
|
-
const
|
|
80
|
-
|
|
198
|
+
const controls = snapshot.status === "failed" ? "failed \xB7 r runs \xB7 enter retry" : "bundled Pi \xB7 mouse wheel scroll \xB7 ctrl-] detach";
|
|
199
|
+
const text = ` run ${snapshot.runId.slice(0, 8)} \xB7 ${controls} \xB7 ${snapshot.message ?? snapshot.status}`;
|
|
200
|
+
return line(clip(text, snapshot.cols), { fg: snapshot.status === "failed" ? RIG_UI.red : RIG_UI.limeDim });
|
|
201
|
+
}
|
|
202
|
+
function shouldShowTerminalPreloader(snapshot) {
|
|
203
|
+
if (snapshot.status !== "starting" && snapshot.status !== "running")
|
|
204
|
+
return false;
|
|
205
|
+
const nonEmptyLines = snapshot.lines.filter((entry) => entry.trim().length > 0).length;
|
|
206
|
+
return nonEmptyLines <= 4;
|
|
81
207
|
}
|
|
82
|
-
function
|
|
208
|
+
function terminalPreloaderLines(snapshot, tick) {
|
|
209
|
+
const bodyRows = Math.max(1, snapshot.rows - 1);
|
|
210
|
+
const existing = snapshot.lines.slice(0, bodyRows).map((text, index) => line(text, { fg: RIG_UI.ink, styledText: snapshot.styledLines?.[index] }));
|
|
211
|
+
const sprite = fleetRows(tick);
|
|
212
|
+
const top = Math.max(0, Math.floor((bodyRows - sprite.length) / 2));
|
|
213
|
+
const left = Math.max(0, Math.floor((snapshot.cols - FLEET_GRID_WIDTH) / 2));
|
|
214
|
+
for (let index = 0;index < sprite.length && top + index < existing.length; index += 1) {
|
|
215
|
+
const targetIndex = top + index;
|
|
216
|
+
const current = snapshot.lines[targetIndex] ?? "";
|
|
217
|
+
if (current.trim())
|
|
218
|
+
continue;
|
|
219
|
+
existing[targetIndex] = line(`${" ".repeat(left)}${sprite[index] ?? ""}`, {
|
|
220
|
+
fg: index >= 7 && index <= 18 ? RIG_UI.lime : RIG_UI.limeDim
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
return existing;
|
|
224
|
+
}
|
|
225
|
+
function terminalLines(snapshot, tick) {
|
|
83
226
|
const hasVisibleOutput = snapshot.lines.some((entry) => entry.trim().length > 0);
|
|
84
|
-
const body = !hasVisibleOutput && snapshot.status === "running" ? [line(`starting bundled Pi for ${snapshot.runId.slice(0, 8)}\u2026`, { fg: RIG_UI.ink3 })] : snapshot.lines.map((text, index) => line(text, { fg: RIG_UI.ink, styledText: snapshot.styledLines?.[index] }));
|
|
227
|
+
const body = shouldShowTerminalPreloader(snapshot) ? terminalPreloaderLines(snapshot, tick) : !hasVisibleOutput && snapshot.status === "running" ? [line(`starting bundled Pi for ${snapshot.runId.slice(0, 8)}\u2026`, { fg: RIG_UI.ink3 })] : snapshot.lines.map((text, index) => line(text, { fg: RIG_UI.ink, styledText: snapshot.styledLines?.[index] }));
|
|
85
228
|
return [...body, terminalRail(snapshot)];
|
|
86
229
|
}
|
|
230
|
+
function entryText(entry) {
|
|
231
|
+
return String(entry.detail ?? entry.message ?? entry.text ?? entry.title ?? entry.type ?? "event").replace(/\s+/g, " ").slice(0, 200);
|
|
232
|
+
}
|
|
233
|
+
function inspectSnapshot(state) {
|
|
234
|
+
const inspect = state.data.inspect;
|
|
235
|
+
if (!inspect || typeof inspect !== "object" || Array.isArray(inspect))
|
|
236
|
+
return null;
|
|
237
|
+
return inspect;
|
|
238
|
+
}
|
|
239
|
+
function rerunItem(runId, taskId) {
|
|
240
|
+
if (taskId) {
|
|
241
|
+
return {
|
|
242
|
+
id: "rerun",
|
|
243
|
+
label: "rerun",
|
|
244
|
+
intent: { scene: "fleet", argv: ["task", "run", taskId], action: { kind: "task-run-id", payload: { task: taskId }, label: `Rerun task ${taskId}` } },
|
|
245
|
+
message: "re-dispatch this task as a new run"
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
id: "rerun",
|
|
250
|
+
label: "rerun",
|
|
251
|
+
intent: { scene: "command", argv: ["run", "retry", runId], action: { kind: "command-run", payload: { runId }, label: `Rerun ${runId.slice(0, 8)}` } },
|
|
252
|
+
message: "re-run this run"
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
function inspectItem(runId) {
|
|
256
|
+
return {
|
|
257
|
+
id: "inspect",
|
|
258
|
+
label: "inspect",
|
|
259
|
+
data: { selectedRunId: runId },
|
|
260
|
+
intent: { scene: "inspect", argv: ["inspect", runId], action: { kind: "refresh", payload: { runId }, label: `Inspect ${runId.slice(0, 8)}` } },
|
|
261
|
+
message: "logs / timeline / diff / failures"
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
function failureReason(state, terminal) {
|
|
265
|
+
const handoff = handoffState(state);
|
|
266
|
+
if (handoff?.failureReason?.trim())
|
|
267
|
+
return handoff.failureReason.trim();
|
|
268
|
+
if (terminal.message?.trim())
|
|
269
|
+
return terminal.message.trim();
|
|
270
|
+
const snap = inspectSnapshot(state);
|
|
271
|
+
const firstFailure = Array.isArray(snap?.failures) && snap.failures.length > 0 ? snap.failures[snap.failures.length - 1] : null;
|
|
272
|
+
if (firstFailure)
|
|
273
|
+
return entryText(firstFailure);
|
|
274
|
+
const lastError = typeof state.data.lastRefreshError === "string" ? state.data.lastRefreshError.trim() : "";
|
|
275
|
+
if (lastError)
|
|
276
|
+
return lastError;
|
|
277
|
+
return `bundled Pi exited with code ${terminal.exitCode ?? "unknown"}`;
|
|
278
|
+
}
|
|
279
|
+
function failedSurfaceLines(state, terminal) {
|
|
280
|
+
const runId = terminal.runId;
|
|
281
|
+
const snap = inspectSnapshot(state);
|
|
282
|
+
const taskId = snap?.taskId;
|
|
283
|
+
const selected = Math.max(0, state.selection.index);
|
|
284
|
+
const out = [
|
|
285
|
+
line("", {}),
|
|
286
|
+
line(" \u2717 RUN FAILED", { fg: RIG_UI.red, bold: true }),
|
|
287
|
+
line(` run ${runId.slice(0, 8)}${taskId ? ` \xB7 task ${taskId}` : ""}`, { fg: RIG_UI.ink3 }),
|
|
288
|
+
line("", {}),
|
|
289
|
+
line(" REASON", { fg: RIG_UI.ink3, bold: true }),
|
|
290
|
+
line(` ${failureReason(state, terminal)}`, { fg: RIG_UI.red }),
|
|
291
|
+
line("", {}),
|
|
292
|
+
line(" ACTIONS", { fg: RIG_UI.ink3, bold: true }),
|
|
293
|
+
selectableDeckRow({ label: "rerun", detail: taskId ? "re-dispatch this task as a new run" : "re-run this run", index: 0, active: selected === 0 }, rerunItem(runId, taskId)),
|
|
294
|
+
selectableDeckRow({ label: "inspect", detail: "logs / timeline / diff / failures", index: 1, active: selected === 1 }, inspectItem(runId)),
|
|
295
|
+
selectableDeckRow({ label: "runs", detail: "return to fleet", index: 2, active: selected === 2 }, HANDOFF_RUNS_ITEM)
|
|
296
|
+
];
|
|
297
|
+
const section = (title, rows, color, limit) => {
|
|
298
|
+
const records = Array.isArray(rows) ? rows.slice(-limit) : [];
|
|
299
|
+
if (records.length === 0)
|
|
300
|
+
return;
|
|
301
|
+
out.push(line("", {}), line(` ${title} (${Array.isArray(rows) ? rows.length : 0})`, { fg: RIG_UI.ink3, bold: true }));
|
|
302
|
+
for (const entry of records)
|
|
303
|
+
out.push(line(` \xB7 ${entryText(entry)}`, { fg: color }));
|
|
304
|
+
};
|
|
305
|
+
section("FAILURES", snap?.failures, RIG_UI.red, 12);
|
|
306
|
+
section("TIMELINE", snap?.timeline, RIG_UI.ink2, 20);
|
|
307
|
+
section("LOGS", snap?.logs, RIG_UI.ink3, 30);
|
|
308
|
+
if (snap && typeof snap.diff === "string" && snap.diff.trim()) {
|
|
309
|
+
const diffLines = snap.diff.split(`
|
|
310
|
+
`).slice(0, 80);
|
|
311
|
+
out.push(line("", {}), line(" DIFF", { fg: RIG_UI.ink3, bold: true }));
|
|
312
|
+
for (const text of diffLines) {
|
|
313
|
+
out.push(line(` ${text}`, { fg: text.startsWith("+") ? RIG_UI.limeDim : text.startsWith("-") ? RIG_UI.red : RIG_UI.ink3 }));
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return out;
|
|
317
|
+
}
|
|
87
318
|
function renderHandoffScene(state) {
|
|
88
319
|
const terminal = terminalState(state);
|
|
320
|
+
if (terminal && terminal.status === "failed") {
|
|
321
|
+
return makeSceneFrame({
|
|
322
|
+
scene: "handoff",
|
|
323
|
+
title: "Pi",
|
|
324
|
+
lines: [],
|
|
325
|
+
panels: [{
|
|
326
|
+
id: `pi-failed-${terminal.runId}`,
|
|
327
|
+
top: 0,
|
|
328
|
+
left: 0,
|
|
329
|
+
width: terminal.cols,
|
|
330
|
+
height: terminal.rows,
|
|
331
|
+
lines: failedSurfaceLines(state, terminal),
|
|
332
|
+
backgroundColor: "#0a0506",
|
|
333
|
+
backgroundAlpha: 200,
|
|
334
|
+
opacity: 1,
|
|
335
|
+
border: false,
|
|
336
|
+
chrome: "ad-terminal",
|
|
337
|
+
headerText: "run failed \xB7 investigate / rerun",
|
|
338
|
+
headerHeight: 3,
|
|
339
|
+
paddingX: 2,
|
|
340
|
+
paddingY: 1,
|
|
341
|
+
stickyScroll: true,
|
|
342
|
+
stickyStart: "top"
|
|
343
|
+
}],
|
|
344
|
+
footer: { run: terminal.runId.slice(0, 8), message: "\u2717 failed \xB7 enter rerun \xB7 inspect for detail" },
|
|
345
|
+
live: true,
|
|
346
|
+
fullScreen: true
|
|
347
|
+
});
|
|
348
|
+
}
|
|
89
349
|
if (terminal && (terminal.status === "starting" || terminal.status === "running")) {
|
|
90
350
|
return makeSceneFrame({
|
|
91
351
|
scene: "handoff",
|
|
@@ -97,7 +357,7 @@ function renderHandoffScene(state) {
|
|
|
97
357
|
left: 0,
|
|
98
358
|
width: terminal.cols,
|
|
99
359
|
height: terminal.rows,
|
|
100
|
-
lines: terminalLines(terminal),
|
|
360
|
+
lines: terminalLines(terminal, state.tick),
|
|
101
361
|
backgroundColor: "#050607",
|
|
102
362
|
backgroundAlpha: 128,
|
|
103
363
|
opacity: 1,
|
|
@@ -113,32 +373,79 @@ function renderHandoffScene(state) {
|
|
|
113
373
|
});
|
|
114
374
|
}
|
|
115
375
|
const handoff = handoffState(state);
|
|
376
|
+
if (!terminal && handoff && handoff.status === "entering-pi" && (handoff.steps?.length ?? 0) > 0) {
|
|
377
|
+
return makeSceneFrame({
|
|
378
|
+
scene: "handoff",
|
|
379
|
+
title: "Pi handoff",
|
|
380
|
+
lines: [],
|
|
381
|
+
panels: [{
|
|
382
|
+
id: `pi-prep-${handoff.runId}`,
|
|
383
|
+
top: 0,
|
|
384
|
+
width: 96,
|
|
385
|
+
height: 18,
|
|
386
|
+
lines: prepStepLines(handoff),
|
|
387
|
+
backgroundColor: RIG_UI.panel,
|
|
388
|
+
backgroundAlpha: 184,
|
|
389
|
+
opacity: 1,
|
|
390
|
+
border: false,
|
|
391
|
+
chrome: "ad-terminal",
|
|
392
|
+
headerText: "preparing bundled Pi",
|
|
393
|
+
headerHeight: 3,
|
|
394
|
+
paddingX: 3,
|
|
395
|
+
paddingY: 1
|
|
396
|
+
}],
|
|
397
|
+
footer: { run: `${handoff.runId.slice(0, 8)} preparing`, message: handoff.message ?? "preparing bundled Pi" },
|
|
398
|
+
hideTypeBar: true,
|
|
399
|
+
live: true
|
|
400
|
+
});
|
|
401
|
+
}
|
|
116
402
|
const runId = handoff?.runId ?? terminal?.runId ?? (typeof state.data.selectedRunId === "string" ? state.data.selectedRunId : undefined);
|
|
117
403
|
const status = handoff?.status ?? (runId ? "preparing" : "select-run");
|
|
118
|
-
const message = handoff?.message ?? (runId ? "ready to start bundled Pi inside
|
|
404
|
+
const message = handoff?.message ?? (runId ? "ready to start bundled Pi inside this app" : "choose a run before entering Pi");
|
|
119
405
|
const hasRun = Boolean(runId);
|
|
406
|
+
const selected = Math.max(0, Math.min(1, state.selection.index));
|
|
120
407
|
return makeSceneFrame({
|
|
121
408
|
scene: "handoff",
|
|
122
409
|
title: "Pi handoff",
|
|
123
410
|
lines: [
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
blank(),
|
|
127
|
-
...hasRun ? [
|
|
128
|
-
line(` run ${runId}`, { fg: RIG_UI.limeDim }),
|
|
129
|
-
line(` status ${status}`, { fg: status === "failed" ? RIG_UI.red : RIG_UI.cyan }),
|
|
130
|
-
line(` message ${message}`, { fg: RIG_UI.ink2 }),
|
|
131
|
-
blank(),
|
|
132
|
-
deckRow({ label: "attach", detail: "open bundled Pi", index: 0, active: true })
|
|
133
|
-
] : [
|
|
134
|
-
line(" run none selected", { fg: RIG_UI.yellow }),
|
|
135
|
-
line(` message ${message}`, { fg: RIG_UI.ink2 }),
|
|
136
|
-
blank(),
|
|
137
|
-
deckRow({ label: "runs", detail: "select a run first", index: 0, active: true })
|
|
138
|
-
]
|
|
411
|
+
line("", { fg: RIG_UI.ink4 }),
|
|
412
|
+
line(` ${hasRun ? "pi" : "attach"} \xB7 ${status}`, { fg: RIG_UI.ink3 })
|
|
139
413
|
],
|
|
140
|
-
|
|
141
|
-
|
|
414
|
+
panels: [{
|
|
415
|
+
id: "pi-handoff",
|
|
416
|
+
top: 0,
|
|
417
|
+
width: 96,
|
|
418
|
+
height: 16,
|
|
419
|
+
lines: [
|
|
420
|
+
line(hasRun ? "Bundled Pi handoff" : "Select a run before entering Pi", { fg: RIG_UI.ink, bold: true }),
|
|
421
|
+
...hasRun ? [
|
|
422
|
+
line(`run ${runId}`, { fg: RIG_UI.limeDim }),
|
|
423
|
+
line(`status ${status}`, { fg: status === "failed" ? RIG_UI.red : RIG_UI.cyan }),
|
|
424
|
+
line(`message ${message}`, { fg: RIG_UI.ink2 }),
|
|
425
|
+
line("", { fg: RIG_UI.ink3 }),
|
|
426
|
+
line("ACTIONS", { fg: RIG_UI.ink3, bold: true }),
|
|
427
|
+
selectableDeckRow({ label: "attach", detail: "open bundled Pi", index: 0, active: selected === 0 }, handoffAttachItem(runId)),
|
|
428
|
+
selectableDeckRow({ label: "runs", detail: "return to fleet", index: 1, active: selected === 1 }, HANDOFF_RUNS_ITEM)
|
|
429
|
+
] : [
|
|
430
|
+
line(`message ${message}`, { fg: RIG_UI.ink2 }),
|
|
431
|
+
line("", { fg: RIG_UI.ink3 }),
|
|
432
|
+
line("ACTIONS", { fg: RIG_UI.ink3, bold: true }),
|
|
433
|
+
selectableDeckRow({ label: "runs", detail: "select a run first", index: 0, active: selected === 0 }, HANDOFF_RUNS_PICK_ITEM),
|
|
434
|
+
selectableDeckRow({ label: "tasks", detail: "open tasks to dispatch work", index: 1, active: selected === 1 }, HANDOFF_TASKS_ITEM)
|
|
435
|
+
]
|
|
436
|
+
],
|
|
437
|
+
backgroundColor: RIG_UI.panel,
|
|
438
|
+
backgroundAlpha: 184,
|
|
439
|
+
opacity: 1,
|
|
440
|
+
border: false,
|
|
441
|
+
chrome: "ad-terminal",
|
|
442
|
+
headerText: hasRun ? "pi handoff" : "attach",
|
|
443
|
+
headerHeight: 3,
|
|
444
|
+
paddingX: 3,
|
|
445
|
+
paddingY: 1
|
|
446
|
+
}],
|
|
447
|
+
footer: { run: runId ? `${runId.slice(0, 8)} handoff` : "select run", message: "enter/click action" },
|
|
448
|
+
hideTypeBar: true,
|
|
142
449
|
live: true
|
|
143
450
|
});
|
|
144
451
|
}
|