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