@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,467 +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
|
-
function statusColor(status) {
|
|
43
|
-
switch (status) {
|
|
44
|
-
case "success":
|
|
45
|
-
case "completed":
|
|
46
|
-
case "merged":
|
|
47
|
-
return RIG_UI.lime;
|
|
48
|
-
case "running":
|
|
49
|
-
case "preparing":
|
|
50
|
-
case "created":
|
|
51
|
-
case "validating":
|
|
52
|
-
case "reviewing":
|
|
53
|
-
case "closing-out":
|
|
54
|
-
case "stopping":
|
|
55
|
-
case "loading":
|
|
56
|
-
case "action":
|
|
57
|
-
return RIG_UI.cyan;
|
|
58
|
-
case "needs-attention":
|
|
59
|
-
case "needs_attention":
|
|
60
|
-
return RIG_UI.yellow;
|
|
61
|
-
case "failed":
|
|
62
|
-
case "error":
|
|
63
|
-
return RIG_UI.red;
|
|
64
|
-
default:
|
|
65
|
-
return RIG_UI.ink3;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// packages/cli/src/app-opentui/drone.ts
|
|
70
|
-
import { RGBA, StyledText, TextAttributes as TextAttributes2 } from "@opentui/core";
|
|
71
|
-
var MINI_DRONE = [
|
|
72
|
-
"(!!!) (!!!)",
|
|
73
|
-
" \\%==%/ ",
|
|
74
|
-
" %%?%% ",
|
|
75
|
-
" /%==%\\ ",
|
|
76
|
-
"(!!!) (!!!)"
|
|
77
|
-
];
|
|
78
|
-
var LEAD_MARK = [
|
|
79
|
-
" .-=-. ",
|
|
80
|
-
"=%%?%%=",
|
|
81
|
-
" '-=-' "
|
|
82
|
-
];
|
|
83
|
-
var BLADE_FRAMES = ["---", "\\\\\\", "|||", "///"];
|
|
84
|
-
var EYE_FRAMES = ["o", "@", "\u2022", "."];
|
|
85
|
-
var COLOR = {
|
|
86
|
-
body: RGBA.fromHex(RIG_UI.lime),
|
|
87
|
-
mini: RGBA.fromHex(RIG_UI.limeDim),
|
|
88
|
-
rotor: RGBA.fromHex(RIG_UI.cyan),
|
|
89
|
-
path: RGBA.fromHex(RIG_UI.cyan),
|
|
90
|
-
eye: RGBA.fromHex(RIG_UI.ink),
|
|
91
|
-
dim: RGBA.fromHex(RIG_UI.ink4),
|
|
92
|
-
ink: RGBA.fromHex(RIG_UI.ink2)
|
|
93
|
-
};
|
|
94
|
-
function bladeForTick(tick, phase = 0) {
|
|
95
|
-
return BLADE_FRAMES[(Math.floor(tick / 3) + phase) % BLADE_FRAMES.length];
|
|
96
|
-
}
|
|
97
|
-
function eyeForTick(tick, phase = 0) {
|
|
98
|
-
const pulse = Math.sin(tick * 0.09 + phase);
|
|
99
|
-
return pulse > 0.55 ? EYE_FRAMES[1] : pulse > 0.1 ? EYE_FRAMES[0] : pulse > -0.45 ? EYE_FRAMES[2] : EYE_FRAMES[3];
|
|
100
|
-
}
|
|
101
|
-
function chunk(text, fg, bold = false, dim = false) {
|
|
102
|
-
let attributes = TextAttributes2.NONE;
|
|
103
|
-
if (bold)
|
|
104
|
-
attributes |= TextAttributes2.BOLD;
|
|
105
|
-
if (dim)
|
|
106
|
-
attributes |= TextAttributes2.DIM;
|
|
107
|
-
return { __isChunk: true, text, fg, ...attributes !== TextAttributes2.NONE ? { attributes } : {} };
|
|
108
|
-
}
|
|
109
|
-
function styledLine(text, colorFor) {
|
|
110
|
-
const chunks = [];
|
|
111
|
-
let run = "";
|
|
112
|
-
let runColor = null;
|
|
113
|
-
const flush = () => {
|
|
114
|
-
if (!run || !runColor)
|
|
115
|
-
return;
|
|
116
|
-
chunks.push(chunk(run, COLOR[runColor], runColor === "body" || runColor === "eye", runColor === "dim"));
|
|
117
|
-
run = "";
|
|
118
|
-
};
|
|
119
|
-
for (const char of text) {
|
|
120
|
-
const next = colorFor(char);
|
|
121
|
-
if (next !== runColor) {
|
|
122
|
-
flush();
|
|
123
|
-
runColor = next;
|
|
124
|
-
}
|
|
125
|
-
run += char;
|
|
126
|
-
}
|
|
127
|
-
flush();
|
|
128
|
-
return new StyledText(chunks.length > 0 ? chunks : [chunk("", COLOR.ink)]);
|
|
129
|
-
}
|
|
130
|
-
function droneColor(char) {
|
|
131
|
-
if (char === "?" || char === "o" || char === "@" || char === "\u2022")
|
|
132
|
-
return "eye";
|
|
133
|
-
if (char === "%" || char === "=")
|
|
134
|
-
return "mini";
|
|
135
|
-
if (char === "$")
|
|
136
|
-
return "body";
|
|
137
|
-
if (char === "(" || char === ")" || char === "/" || char === "\\" || char === "|" || char === "-")
|
|
138
|
-
return "rotor";
|
|
139
|
-
if (char === "\xB7" || char === "\u2022" || char === "'" || char === ".")
|
|
140
|
-
return "path";
|
|
141
|
-
if (char.trim() === "")
|
|
142
|
-
return "dim";
|
|
143
|
-
return "ink";
|
|
144
|
-
}
|
|
145
|
-
function motionColor(char) {
|
|
146
|
-
if (char === "\u25CF" || char === "\u25C6" || char === "\u25C9")
|
|
147
|
-
return "body";
|
|
148
|
-
if (char === "\u2022" || char === "\xB7" || char === "\u2500" || char === "\u2502" || char === "\u2571" || char === "\u2572" || char === "\u256D" || char === "\u256E" || char === "\u2570" || char === "\u256F")
|
|
149
|
-
return "path";
|
|
150
|
-
if (char === "\u258C" || char === "\u2590" || char === "\u2581" || char === "\u2594")
|
|
151
|
-
return "mini";
|
|
152
|
-
return droneColor(char);
|
|
153
|
-
}
|
|
154
|
-
function materializeDrone(lines, tick, phase = 0) {
|
|
155
|
-
const blade = bladeForTick(tick, phase);
|
|
156
|
-
const eye = eyeForTick(tick, phase);
|
|
157
|
-
return lines.map((line) => line.replaceAll("!!!", blade).replaceAll("?", eye));
|
|
158
|
-
}
|
|
159
|
-
function miniDroneLines(tick, align = "left", phase = 0) {
|
|
160
|
-
return materializeDrone(MINI_DRONE, tick, phase).map((text) => ({
|
|
161
|
-
text,
|
|
162
|
-
styledText: styledLine(text, droneColor),
|
|
163
|
-
fg: RIG_UI.limeDim,
|
|
164
|
-
align
|
|
165
|
-
}));
|
|
166
|
-
}
|
|
167
|
-
function brandFleetLines(tick, align = "center") {
|
|
168
|
-
const left = materializeDrone(MINI_DRONE, tick, 0);
|
|
169
|
-
const right = materializeDrone(MINI_DRONE, tick, 2);
|
|
170
|
-
const lead = materializeDrone(LEAD_MARK, tick, 1);
|
|
171
|
-
const packet = ["\xB7", "\u2022", "\u25CF", "\u2022"][Math.floor(tick / 2) % 4];
|
|
172
|
-
const bridge = [
|
|
173
|
-
` ${left[0]} ${lead[0]} ${right[0]}`,
|
|
174
|
-
` ${left[1]} \xB7\u2500\u2500${packet}\u2500\u2500\xB7 ${lead[1]} \xB7\u2500\u2500${packet}\u2500\u2500\xB7 ${right[1]}`,
|
|
175
|
-
` ${left[2]} \xB7' '${lead[2]}' '\xB7 ${right[2]}`,
|
|
176
|
-
` ${left[3]} \u2572 signal bus \u2571 ${right[3]}`,
|
|
177
|
-
` ${left[4]} \xB7\u2500\u2500\u2500${packet}\u2500\u2500\u2500\u2500\u2500\u2500${packet}\u2500\u2500\u2500\xB7 ${right[4]}`
|
|
178
|
-
];
|
|
179
|
-
return bridge.map((text) => ({
|
|
180
|
-
text,
|
|
181
|
-
styledText: styledLine(text, motionColor),
|
|
182
|
-
fg: RIG_UI.limeDim,
|
|
183
|
-
align
|
|
184
|
-
}));
|
|
185
|
-
}
|
|
186
|
-
function actionDrone(tick, phase = 0) {
|
|
187
|
-
const blade = bladeForTick(tick, phase);
|
|
188
|
-
const eye = eyeForTick(tick, phase);
|
|
189
|
-
return `(${blade})\u2572${eye}\u2571(${blade})`;
|
|
190
|
-
}
|
|
191
|
-
function actionDroneLine(tick, text, fg = RIG_UI.ink2) {
|
|
192
|
-
const prefix = actionDrone(tick);
|
|
193
|
-
const content = `${prefix} ${text}`;
|
|
194
|
-
return { text: content, styledText: styledLine(content, motionColor), fg, align: "center" };
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// packages/cli/src/app-opentui/render/scene.ts
|
|
198
|
-
function line(text, options = {}) {
|
|
199
|
-
return { text, ...options };
|
|
200
|
-
}
|
|
201
|
-
function blank() {
|
|
202
|
-
return { text: "" };
|
|
203
|
-
}
|
|
204
|
-
function deckRow(input) {
|
|
205
|
-
const prefix = input.active ? "\u25B8" : " ";
|
|
206
|
-
const label = input.label.toUpperCase().padEnd(10);
|
|
207
|
-
return line(`${prefix} ${label} ${input.detail}`, {
|
|
208
|
-
fg: input.active ? RIG_UI.lime : RIG_UI.ink2,
|
|
209
|
-
bold: input.active,
|
|
210
|
-
selectableIndex: input.index,
|
|
211
|
-
activateOnClick: input.activateOnClick
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
function kv(label, value, fg = RIG_UI.ink2) {
|
|
215
|
-
return line(` ${label.toUpperCase().padEnd(10)} ${value}`, { fg });
|
|
216
|
-
}
|
|
217
|
-
function loadingRows(label, tick = 0, compact = false) {
|
|
218
|
-
const mascot = compact ? miniDroneLines(tick, "center") : brandFleetLines(tick, "center");
|
|
219
|
-
return [
|
|
220
|
-
blank(),
|
|
221
|
-
...mascot,
|
|
222
|
-
blank(),
|
|
223
|
-
{ ...actionDroneLine(tick, `loading ${label}\u2026`, RIG_UI.cyan), align: "center" }
|
|
224
|
-
];
|
|
225
|
-
}
|
|
226
|
-
function errorBanner(message, hint) {
|
|
227
|
-
return [
|
|
228
|
-
line(`\u2717 failed to load \u2014 ${message}`, { fg: RIG_UI.red, bold: true }),
|
|
229
|
-
...hint ? [line(` ${hint}`, { fg: RIG_UI.ink3 })] : [],
|
|
230
|
-
line(" select refresh/retry below", { fg: RIG_UI.ink4 }),
|
|
231
|
-
line("", { fg: RIG_UI.ink3 })
|
|
232
|
-
];
|
|
233
|
-
}
|
|
234
|
-
function lastRefreshError(state) {
|
|
235
|
-
const value = state.data.lastRefreshError;
|
|
236
|
-
return typeof value === "string" && value.trim() ? value : undefined;
|
|
237
|
-
}
|
|
238
|
-
function makeSceneFrame(input) {
|
|
239
|
-
return input;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// packages/cli/src/app-opentui/selectable.ts
|
|
243
|
-
function withSelectable(line2, item) {
|
|
244
|
-
return { ...line2, selectable: item, activateOnClick: true };
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
// packages/cli/src/app-opentui/scenes/run-detail.ts
|
|
248
|
-
function actionRow(deck, item) {
|
|
249
|
-
const row = deckRow({ ...deck, activateOnClick: true });
|
|
250
|
-
return item ? withSelectable(row, item) : row;
|
|
251
|
-
}
|
|
252
|
-
function isTerminalRunStatus(status) {
|
|
253
|
-
return ["completed", "complete", "done", "failed", "error", "errored", "merged", "cancelled", "canceled", "stopped", "aborted"].includes(status.toLowerCase());
|
|
254
|
-
}
|
|
255
|
-
function runDetailActions(runId, status) {
|
|
256
|
-
const short = runId ? runId.slice(0, 8) : "";
|
|
257
|
-
const attach = {
|
|
258
|
-
label: "pi",
|
|
259
|
-
detail: "attach bundled Pi \u2014 live or finished transcript",
|
|
260
|
-
item: runId ? { id: "attach", label: "attach", intent: { scene: "handoff", argv: ["attach", runId], action: { kind: "run-attach", payload: { runId }, label: `Attach Pi ${short}` } }, message: "attach real bundled Pi" } : null
|
|
261
|
-
};
|
|
262
|
-
const inspect = {
|
|
263
|
-
label: "inspect",
|
|
264
|
-
detail: "logs/timeline/diff/failures",
|
|
265
|
-
item: runId ? { id: "inspect", label: "inspect", data: { selectedRunId: runId }, intent: { scene: "inspect", argv: ["inspect", runId], action: { kind: "refresh", payload: { runId }, label: `Inspect ${short}` } }, message: "logs/timeline/diff/failures" } : null
|
|
266
|
-
};
|
|
267
|
-
const fleet = {
|
|
268
|
-
label: "runs",
|
|
269
|
-
detail: "return to fleet",
|
|
270
|
-
item: { id: "fleet", label: "fleet", intent: { scene: "fleet", argv: ["fleet"], action: { kind: "refresh", label: "Opening fleet" } }, message: "back to fleet" }
|
|
271
|
-
};
|
|
272
|
-
if (runId && isTerminalRunStatus(status)) {
|
|
273
|
-
const rerun = {
|
|
274
|
-
label: "rerun",
|
|
275
|
-
detail: "re-dispatch this run from a clean runtime",
|
|
276
|
-
item: { id: "rerun", label: "rerun", intent: { scene: "command", argv: ["run", "restart", runId], action: { kind: "command-run", payload: { runId }, label: `Rerun ${short}` } }, message: "re-dispatch this run (rig run restart)" }
|
|
277
|
-
};
|
|
278
|
-
return [attach, rerun, inspect, fleet];
|
|
279
|
-
}
|
|
280
|
-
const steer = {
|
|
281
|
-
label: "steer",
|
|
282
|
-
detail: "send an inline steer message",
|
|
283
|
-
item: runId ? { id: "steer", label: "steer", prompt: { label: `steer ${short}`, scene: "run-detail", argv: ["steer", runId], intentKind: "run-steer", payloadBase: { runId }, payloadKey: "message" }, message: "send an inline steer message" } : null
|
|
284
|
-
};
|
|
285
|
-
const stop = {
|
|
286
|
-
label: "stop",
|
|
287
|
-
detail: "request stop",
|
|
288
|
-
item: runId ? { id: "stop", label: "stop", intent: { scene: "run-detail", argv: ["stop", runId], action: { kind: "run-stop", payload: { runId }, label: `Stop ${short}` } }, message: "request stop" } : null
|
|
289
|
-
};
|
|
290
|
-
return [attach, steer, stop, inspect, fleet];
|
|
291
|
-
}
|
|
292
|
-
function snapshot(state) {
|
|
293
|
-
const value = state.data.runDetail;
|
|
294
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
295
|
-
}
|
|
296
|
-
function selectedRunId(state, run) {
|
|
297
|
-
if (run?.runId)
|
|
298
|
-
return run.runId;
|
|
299
|
-
return typeof state.data.selectedRunId === "string" ? state.data.selectedRunId : undefined;
|
|
300
|
-
}
|
|
301
|
-
var ENTRY_ROW_LIMIT = 40;
|
|
302
|
-
function entryField(entry, keys) {
|
|
303
|
-
for (const key of keys) {
|
|
304
|
-
const value = entry[key];
|
|
305
|
-
if (typeof value === "string" && value.trim())
|
|
306
|
-
return value.trim();
|
|
307
|
-
if (typeof value === "number")
|
|
308
|
-
return String(value);
|
|
309
|
-
}
|
|
310
|
-
return "";
|
|
311
|
-
}
|
|
312
|
-
function entryMessage(entry) {
|
|
313
|
-
return String(entry.detail ?? entry.message ?? entry.text ?? entry.title ?? entry.type ?? "event").replace(/\s+/g, " ").slice(0, 160);
|
|
314
|
-
}
|
|
315
|
-
function entrySeverityColor(entry, fallback) {
|
|
316
|
-
const token = `${entryField(entry, ["type", "level", "status", "kind"])} ${entryMessage(entry)}`.toLowerCase();
|
|
317
|
-
if (/\b(fail|failed|failure|error|fatal|crash|abort)\b/.test(token))
|
|
318
|
-
return RIG_UI.red;
|
|
319
|
-
if (/\b(warn|warning|attention|degraded|retry)\b/.test(token))
|
|
320
|
-
return RIG_UI.yellow;
|
|
321
|
-
if (/\b(success|succeeded|completed|done|merged|passed)\b/.test(token))
|
|
322
|
-
return RIG_UI.limeDim;
|
|
323
|
-
return fallback;
|
|
324
|
-
}
|
|
325
|
-
function entryRow(entry, fallback) {
|
|
326
|
-
const color = entrySeverityColor(entry, fallback);
|
|
327
|
-
const time = entryField(entry, ["timestamp", "ts", "time", "at"]).replace("T", " ").slice(0, 19);
|
|
328
|
-
const type = entryField(entry, ["type", "level", "kind", "status"]).slice(0, 14);
|
|
329
|
-
const glyph = color === RIG_UI.red ? "\u2717" : color === RIG_UI.yellow ? "\u26A0" : "\xB7";
|
|
330
|
-
const segments = [time, type ? type.toUpperCase() : undefined, entryMessage(entry)].filter((part) => Boolean(part));
|
|
331
|
-
return line(`${glyph} ${segments.join(" \xB7 ")}`, { fg: color, bold: color === RIG_UI.red });
|
|
332
|
-
}
|
|
333
|
-
function entrySection(label, entries, fallback) {
|
|
334
|
-
if (entries.length === 0)
|
|
335
|
-
return [];
|
|
336
|
-
const shown = entries.slice(0, ENTRY_ROW_LIMIT);
|
|
337
|
-
const overflow = entries.length - shown.length;
|
|
338
|
-
return [
|
|
339
|
-
line("", { fg: RIG_UI.ink3 }),
|
|
340
|
-
line(`${label} (${entries.length})`, { fg: RIG_UI.ink3, bold: true }),
|
|
341
|
-
...shown.map((entry) => entryRow(entry, fallback)),
|
|
342
|
-
...overflow > 0 ? [line(` (${overflow} more)`, { fg: RIG_UI.ink4 })] : []
|
|
343
|
-
];
|
|
344
|
-
}
|
|
345
|
-
function primaryError(state) {
|
|
346
|
-
return state.error?.message ?? lastRefreshError(state);
|
|
347
|
-
}
|
|
348
|
-
function optimisticStatus(state, runId) {
|
|
349
|
-
const value = state.data.optimisticRun;
|
|
350
|
-
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
351
|
-
return;
|
|
352
|
-
const record = value;
|
|
353
|
-
if (runId && record.runId !== runId)
|
|
354
|
-
return;
|
|
355
|
-
return typeof record.status === "string" ? record.status : undefined;
|
|
356
|
-
}
|
|
357
|
-
function pendingSteer(state, runId) {
|
|
358
|
-
const value = state.data.pendingRunMessage;
|
|
359
|
-
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
360
|
-
return null;
|
|
361
|
-
const record = value;
|
|
362
|
-
if (runId && record.runId !== runId)
|
|
363
|
-
return null;
|
|
364
|
-
if (typeof record.text !== "string")
|
|
365
|
-
return null;
|
|
366
|
-
return {
|
|
367
|
-
text: record.text,
|
|
368
|
-
status: typeof record.status === "string" ? record.status : "queued",
|
|
369
|
-
...typeof record.result === "string" && record.result.trim() ? { result: record.result.trim() } : {}
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
function steerBlock(pending) {
|
|
373
|
-
const failed = pending.status === "failed";
|
|
374
|
-
const sent = pending.status === "sent" || pending.status === "delivered";
|
|
375
|
-
const glyph = failed ? "\u2717" : sent ? "\u2713" : "\u27F3";
|
|
376
|
-
const color = failed ? RIG_UI.red : sent ? RIG_UI.lime : RIG_UI.cyan;
|
|
377
|
-
const echoed = pending.text.length > 84 ? `${pending.text.slice(0, 83)}\u2026` : pending.text;
|
|
378
|
-
return [
|
|
379
|
-
line("", { fg: RIG_UI.ink3 }),
|
|
380
|
-
line(`${glyph} STEER \xB7 ${pending.status}`, { fg: color, bold: true }),
|
|
381
|
-
line(` "${echoed}"`, { fg: RIG_UI.ink2 }),
|
|
382
|
-
...pending.result ? [line(` ${failed ? "error" : "result"}: ${pending.result.replace(/\s+/g, " ").slice(0, 120)}`, { fg: failed ? RIG_UI.red : RIG_UI.ink3 })] : []
|
|
383
|
-
];
|
|
384
|
-
}
|
|
385
|
-
function timelineCountLabel(snapshot2) {
|
|
386
|
-
const shown = snapshot2.timeline.length;
|
|
387
|
-
const total = snapshot2.timelineTotal;
|
|
388
|
-
return total !== undefined && total > shown ? `showing ${shown} of ${total}` : `${shown} loaded`;
|
|
389
|
-
}
|
|
390
|
-
function loadMoreItem(runId, cursor) {
|
|
391
|
-
return {
|
|
392
|
-
id: "timeline-load-more",
|
|
393
|
-
label: "load more timeline",
|
|
394
|
-
data: { runDetailLoadMore: { runId, cursor } },
|
|
395
|
-
intent: { scene: "run-detail", argv: ["run", "status", runId], action: { kind: "refresh", payload: { runId }, label: "Load more timeline" } },
|
|
396
|
-
message: "fetch the next page of timeline events"
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
function panelWidth(layout) {
|
|
400
|
-
return layout?.centerWidth ?? 100;
|
|
401
|
-
}
|
|
402
|
-
function panelHeight(layout) {
|
|
403
|
-
return Math.max(10, (layout?.centerHeight ?? 24) - 1);
|
|
404
|
-
}
|
|
405
|
-
function renderRunDetailScene(state, layout) {
|
|
406
|
-
const run = snapshot(state);
|
|
407
|
-
const runId = selectedRunId(state, run);
|
|
408
|
-
const status = optimisticStatus(state, runId) ?? run?.status ?? "loading";
|
|
409
|
-
const actions = runDetailActions(runId, status);
|
|
410
|
-
const actionCount = actions.length;
|
|
411
|
-
const canLoadMore = Boolean(run?.timelineCursor && runId);
|
|
412
|
-
const loadMoreIndex = actionCount;
|
|
413
|
-
const maxIndex = canLoadMore ? loadMoreIndex : Math.max(0, actionCount - 1);
|
|
414
|
-
const selected = Math.max(0, Math.min(maxIndex, state.selection.index));
|
|
415
|
-
const timeline = run?.timeline ?? [];
|
|
416
|
-
const logs = run?.logs ?? [];
|
|
417
|
-
const pending = pendingSteer(state, runId);
|
|
418
|
-
const loading = state.status === "loading" && !run;
|
|
419
|
-
const errorText = primaryError(state);
|
|
420
|
-
const timelineSection = run ? [
|
|
421
|
-
line("", { fg: RIG_UI.ink3 }),
|
|
422
|
-
line(`TIMELINE \xB7 ${timelineCountLabel(run)}`, { fg: RIG_UI.ink3, bold: true }),
|
|
423
|
-
...timeline.slice(0, ENTRY_ROW_LIMIT).map((entry) => entryRow(entry, RIG_UI.ink2)),
|
|
424
|
-
...canLoadMore && runId ? [withSelectable(deckRow({ label: "load more", detail: `next page \xB7 ${timelineCountLabel(run)}`, index: loadMoreIndex, active: selected === loadMoreIndex, activateOnClick: true }), loadMoreItem(runId, run.timelineCursor))] : []
|
|
425
|
-
] : [];
|
|
426
|
-
return makeSceneFrame({
|
|
427
|
-
scene: "run-detail",
|
|
428
|
-
title: "Run",
|
|
429
|
-
lines: [
|
|
430
|
-
line("", { fg: RIG_UI.ink4 }),
|
|
431
|
-
line(` run \xB7 ${runId ? `${runId.slice(0, 8)} \xB7 ${status}` : "loading"}`, { fg: run ? statusColor(status) : RIG_UI.ink3 })
|
|
432
|
-
],
|
|
433
|
-
panels: [{
|
|
434
|
-
id: "run-detail",
|
|
435
|
-
top: 0,
|
|
436
|
-
width: panelWidth(layout),
|
|
437
|
-
height: panelHeight(layout),
|
|
438
|
-
lines: [
|
|
439
|
-
...errorText ? errorBanner(errorText, "select inspect/runs below, or retry the action") : [],
|
|
440
|
-
line(run ? run.title : "Run telemetry", { fg: RIG_UI.ink, bold: true }),
|
|
441
|
-
...loading ? loadingRows("run telemetry", state.tick) : runId ? [kv("run", runId, RIG_UI.ink2), kv("status", status, statusColor(status))] : [line("loading run telemetry", { fg: RIG_UI.ink3 })],
|
|
442
|
-
...pending ? steerBlock(pending) : [],
|
|
443
|
-
line("", { fg: RIG_UI.ink3 }),
|
|
444
|
-
line("ACTIONS", { fg: RIG_UI.ink3, bold: true }),
|
|
445
|
-
...actions.map((action, index) => actionRow({ label: action.label, detail: action.detail, index, active: selected === index }, action.item)),
|
|
446
|
-
...timelineSection,
|
|
447
|
-
...entrySection("LOGS", logs, RIG_UI.ink3)
|
|
448
|
-
],
|
|
449
|
-
backgroundColor: RIG_UI.panel,
|
|
450
|
-
backgroundAlpha: 184,
|
|
451
|
-
opacity: 1,
|
|
452
|
-
border: false,
|
|
453
|
-
stickyScroll: true,
|
|
454
|
-
stickyStart: "bottom",
|
|
455
|
-
chrome: "ad-terminal",
|
|
456
|
-
headerText: runId ? `run ${runId.slice(0, 8)}` : "run",
|
|
457
|
-
headerHeight: 3,
|
|
458
|
-
paddingX: layout?.compact ? 2 : 3,
|
|
459
|
-
paddingY: 1
|
|
460
|
-
}],
|
|
461
|
-
footer: { run: runId ? `${runId.slice(0, 8)} ${status}` : undefined, message: "enter/click action" },
|
|
462
|
-
live: state.status === "action" || !run
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
export {
|
|
466
|
-
renderRunDetailScene
|
|
467
|
-
};
|