@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,277 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// packages/cli/src/app-opentui/drone.ts
|
|
3
|
-
import { RGBA, StyledText, TextAttributes as TextAttributes2 } from "@opentui/core";
|
|
4
|
-
|
|
5
|
-
// packages/cli/src/app-opentui/theme.ts
|
|
6
|
-
import {
|
|
7
|
-
bold as otuiBold,
|
|
8
|
-
dim as otuiDim,
|
|
9
|
-
fg as otuiFg,
|
|
10
|
-
t,
|
|
11
|
-
TextAttributes
|
|
12
|
-
} from "@opentui/core";
|
|
13
|
-
var RIG_UI = {
|
|
14
|
-
bg: "#070809",
|
|
15
|
-
bg2: "#0b0c0e",
|
|
16
|
-
panel: "#101115",
|
|
17
|
-
panel2: "#14161b",
|
|
18
|
-
hover: "#181b24",
|
|
19
|
-
glass: "#1e2230",
|
|
20
|
-
border: "#2a2e3a",
|
|
21
|
-
ink: "#f4f5f8",
|
|
22
|
-
ink2: "#c7c9d3",
|
|
23
|
-
ink3: "#9aa0ae",
|
|
24
|
-
ink4: "#787b86",
|
|
25
|
-
lime: "#ccff4d",
|
|
26
|
-
limeDim: "#a9d63f",
|
|
27
|
-
cyan: "#56d8ff",
|
|
28
|
-
cyanDim: "#3f9fbd",
|
|
29
|
-
red: "#ff5d5d",
|
|
30
|
-
yellow: "#ffd24d",
|
|
31
|
-
magenta: "#ff79b0"
|
|
32
|
-
};
|
|
33
|
-
var styles = {
|
|
34
|
-
ink: otuiFg(RIG_UI.ink),
|
|
35
|
-
ink2: otuiFg(RIG_UI.ink2),
|
|
36
|
-
ink3: otuiFg(RIG_UI.ink3),
|
|
37
|
-
ink4: otuiFg(RIG_UI.ink4),
|
|
38
|
-
lime: otuiFg(RIG_UI.lime),
|
|
39
|
-
limeDim: otuiFg(RIG_UI.limeDim),
|
|
40
|
-
cyan: otuiFg(RIG_UI.cyan),
|
|
41
|
-
red: otuiFg(RIG_UI.red),
|
|
42
|
-
yellow: otuiFg(RIG_UI.yellow),
|
|
43
|
-
magenta: otuiFg(RIG_UI.magenta)
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
// packages/cli/src/app-opentui/drone.ts
|
|
47
|
-
var MINI_DRONE = [
|
|
48
|
-
"(!!!) (!!!)",
|
|
49
|
-
" \\%==%/ ",
|
|
50
|
-
" %%?%% ",
|
|
51
|
-
" /%==%\\ ",
|
|
52
|
-
"(!!!) (!!!)"
|
|
53
|
-
];
|
|
54
|
-
var LEAD_MARK = [
|
|
55
|
-
" .-=-. ",
|
|
56
|
-
"=%%?%%=",
|
|
57
|
-
" '-=-' "
|
|
58
|
-
];
|
|
59
|
-
var BLADE_FRAMES = ["---", "\\\\\\", "|||", "///"];
|
|
60
|
-
var EYE_FRAMES = ["o", "@", "\u2022", "."];
|
|
61
|
-
var COLOR = {
|
|
62
|
-
body: RGBA.fromHex(RIG_UI.lime),
|
|
63
|
-
mini: RGBA.fromHex(RIG_UI.limeDim),
|
|
64
|
-
rotor: RGBA.fromHex(RIG_UI.cyan),
|
|
65
|
-
path: RGBA.fromHex(RIG_UI.cyan),
|
|
66
|
-
eye: RGBA.fromHex(RIG_UI.ink),
|
|
67
|
-
dim: RGBA.fromHex(RIG_UI.ink4),
|
|
68
|
-
ink: RGBA.fromHex(RIG_UI.ink2)
|
|
69
|
-
};
|
|
70
|
-
function bladeForTick(tick, phase = 0) {
|
|
71
|
-
return BLADE_FRAMES[(Math.floor(tick / 3) + phase) % BLADE_FRAMES.length];
|
|
72
|
-
}
|
|
73
|
-
function eyeForTick(tick, phase = 0) {
|
|
74
|
-
const pulse = Math.sin(tick * 0.09 + phase);
|
|
75
|
-
return pulse > 0.55 ? EYE_FRAMES[1] : pulse > 0.1 ? EYE_FRAMES[0] : pulse > -0.45 ? EYE_FRAMES[2] : EYE_FRAMES[3];
|
|
76
|
-
}
|
|
77
|
-
function chunk(text, fg, bold = false, dim = false) {
|
|
78
|
-
let attributes = TextAttributes2.NONE;
|
|
79
|
-
if (bold)
|
|
80
|
-
attributes |= TextAttributes2.BOLD;
|
|
81
|
-
if (dim)
|
|
82
|
-
attributes |= TextAttributes2.DIM;
|
|
83
|
-
return { __isChunk: true, text, fg, ...attributes !== TextAttributes2.NONE ? { attributes } : {} };
|
|
84
|
-
}
|
|
85
|
-
function styledLine(text, colorFor) {
|
|
86
|
-
const chunks = [];
|
|
87
|
-
let run = "";
|
|
88
|
-
let runColor = null;
|
|
89
|
-
const flush = () => {
|
|
90
|
-
if (!run || !runColor)
|
|
91
|
-
return;
|
|
92
|
-
chunks.push(chunk(run, COLOR[runColor], runColor === "body" || runColor === "eye", runColor === "dim"));
|
|
93
|
-
run = "";
|
|
94
|
-
};
|
|
95
|
-
for (const char of text) {
|
|
96
|
-
const next = colorFor(char);
|
|
97
|
-
if (next !== runColor) {
|
|
98
|
-
flush();
|
|
99
|
-
runColor = next;
|
|
100
|
-
}
|
|
101
|
-
run += char;
|
|
102
|
-
}
|
|
103
|
-
flush();
|
|
104
|
-
return new StyledText(chunks.length > 0 ? chunks : [chunk("", COLOR.ink)]);
|
|
105
|
-
}
|
|
106
|
-
function droneColor(char) {
|
|
107
|
-
if (char === "?" || char === "o" || char === "@" || char === "\u2022")
|
|
108
|
-
return "eye";
|
|
109
|
-
if (char === "%" || char === "=")
|
|
110
|
-
return "mini";
|
|
111
|
-
if (char === "$")
|
|
112
|
-
return "body";
|
|
113
|
-
if (char === "(" || char === ")" || char === "/" || char === "\\" || char === "|" || char === "-")
|
|
114
|
-
return "rotor";
|
|
115
|
-
if (char === "\xB7" || char === "\u2022" || char === "'" || char === ".")
|
|
116
|
-
return "path";
|
|
117
|
-
if (char.trim() === "")
|
|
118
|
-
return "dim";
|
|
119
|
-
return "ink";
|
|
120
|
-
}
|
|
121
|
-
function motionColor(char) {
|
|
122
|
-
if (char === "\u25CF" || char === "\u25C6" || char === "\u25C9")
|
|
123
|
-
return "body";
|
|
124
|
-
if (char === "\u2022" || char === "\xB7" || char === "\u2500" || char === "\u2502" || char === "\u2571" || char === "\u2572" || char === "\u256D" || char === "\u256E" || char === "\u2570" || char === "\u256F")
|
|
125
|
-
return "path";
|
|
126
|
-
if (char === "\u258C" || char === "\u2590" || char === "\u2581" || char === "\u2594")
|
|
127
|
-
return "mini";
|
|
128
|
-
return droneColor(char);
|
|
129
|
-
}
|
|
130
|
-
function materializeDrone(lines, tick, phase = 0) {
|
|
131
|
-
const blade = bladeForTick(tick, phase);
|
|
132
|
-
const eye = eyeForTick(tick, phase);
|
|
133
|
-
return lines.map((line) => line.replaceAll("!!!", blade).replaceAll("?", eye));
|
|
134
|
-
}
|
|
135
|
-
function brandFleetLines(tick, align = "center") {
|
|
136
|
-
const left = materializeDrone(MINI_DRONE, tick, 0);
|
|
137
|
-
const right = materializeDrone(MINI_DRONE, tick, 2);
|
|
138
|
-
const lead = materializeDrone(LEAD_MARK, tick, 1);
|
|
139
|
-
const packet = ["\xB7", "\u2022", "\u25CF", "\u2022"][Math.floor(tick / 2) % 4];
|
|
140
|
-
const bridge = [
|
|
141
|
-
` ${left[0]} ${lead[0]} ${right[0]}`,
|
|
142
|
-
` ${left[1]} \xB7\u2500\u2500${packet}\u2500\u2500\xB7 ${lead[1]} \xB7\u2500\u2500${packet}\u2500\u2500\xB7 ${right[1]}`,
|
|
143
|
-
` ${left[2]} \xB7' '${lead[2]}' '\xB7 ${right[2]}`,
|
|
144
|
-
` ${left[3]} \u2572 signal bus \u2571 ${right[3]}`,
|
|
145
|
-
` ${left[4]} \xB7\u2500\u2500\u2500${packet}\u2500\u2500\u2500\u2500\u2500\u2500${packet}\u2500\u2500\u2500\xB7 ${right[4]}`
|
|
146
|
-
];
|
|
147
|
-
return bridge.map((text) => ({
|
|
148
|
-
text,
|
|
149
|
-
styledText: styledLine(text, motionColor),
|
|
150
|
-
fg: RIG_UI.limeDim,
|
|
151
|
-
align
|
|
152
|
-
}));
|
|
153
|
-
}
|
|
154
|
-
function errorDrone(tick) {
|
|
155
|
-
return brandFleetLines(tick).map((line, index) => ({
|
|
156
|
-
...line,
|
|
157
|
-
fg: index % 2 === 0 ? RIG_UI.red : line.fg
|
|
158
|
-
}));
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// packages/cli/src/app-opentui/remote-link.ts
|
|
162
|
-
var REPAIRABLE_REMOTE_LINK_STATUSES = new Set([
|
|
163
|
-
"auth_required",
|
|
164
|
-
"project_not_registered",
|
|
165
|
-
"no_server_checkout",
|
|
166
|
-
"invalid_root",
|
|
167
|
-
"needs_prepare",
|
|
168
|
-
"error"
|
|
169
|
-
]);
|
|
170
|
-
function remoteProjectLinkError(message) {
|
|
171
|
-
return /no server-host project root link|remote project(?:-root)? link|x-rig-project-root|serverProjectRoot/i.test(message ?? "");
|
|
172
|
-
}
|
|
173
|
-
function serverRecordForRemoteLink(state) {
|
|
174
|
-
const server = state.data.server;
|
|
175
|
-
return server && typeof server === "object" && !Array.isArray(server) ? server : null;
|
|
176
|
-
}
|
|
177
|
-
function remoteProjectLinkState(state) {
|
|
178
|
-
const serverRecord = serverRecordForRemoteLink(state);
|
|
179
|
-
if (!serverRecord || serverRecord.kind !== "remote")
|
|
180
|
-
return null;
|
|
181
|
-
const link = serverRecord.remoteProjectLink;
|
|
182
|
-
if (link && typeof link === "object" && !Array.isArray(link))
|
|
183
|
-
return link;
|
|
184
|
-
const direct = state.data.remoteProjectLink;
|
|
185
|
-
if (direct && typeof direct === "object" && !Array.isArray(direct))
|
|
186
|
-
return direct;
|
|
187
|
-
return null;
|
|
188
|
-
}
|
|
189
|
-
function shouldOfferRemoteLinkRepair(state, message) {
|
|
190
|
-
const link = remoteProjectLinkState(state);
|
|
191
|
-
if (link) {
|
|
192
|
-
if (link.ok === true)
|
|
193
|
-
return false;
|
|
194
|
-
const status = link.status ?? "";
|
|
195
|
-
return REPAIRABLE_REMOTE_LINK_STATUSES.has(status);
|
|
196
|
-
}
|
|
197
|
-
const serverRecord = serverRecordForRemoteLink(state);
|
|
198
|
-
if (serverRecord && serverRecord.kind !== "remote")
|
|
199
|
-
return false;
|
|
200
|
-
return remoteProjectLinkError(message ?? state.error?.message);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// packages/cli/src/app-opentui/render/scene.ts
|
|
204
|
-
function line(text, options = {}) {
|
|
205
|
-
return { text, ...options };
|
|
206
|
-
}
|
|
207
|
-
function deckRow(input) {
|
|
208
|
-
const prefix = input.active ? "\u25B8" : " ";
|
|
209
|
-
const label = input.label.toUpperCase().padEnd(10);
|
|
210
|
-
return line(`${prefix} ${label} ${input.detail}`, {
|
|
211
|
-
fg: input.active ? RIG_UI.lime : RIG_UI.ink2,
|
|
212
|
-
bold: input.active,
|
|
213
|
-
selectableIndex: input.index,
|
|
214
|
-
activateOnClick: input.activateOnClick
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
function makeSceneFrame(input) {
|
|
218
|
-
return input;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// packages/cli/src/app-opentui/selectable.ts
|
|
222
|
-
function selectableDeckRow(deck, item) {
|
|
223
|
-
return { ...deckRow({ ...deck, activateOnClick: true }), selectable: item };
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// packages/cli/src/app-opentui/scenes/error.ts
|
|
227
|
-
var ERROR_ACTIONS = [
|
|
228
|
-
{ detail: "return to dashboard", item: { id: "main", label: "main", intent: { scene: "main", argv: [], action: { kind: "refresh", label: "Back to dashboard" } }, message: "back to dashboard" } },
|
|
229
|
-
{ detail: "run diagnostics", item: { id: "doctor", label: "doctor", intent: { scene: "doctor", argv: ["doctor"], action: { kind: "doctor-run", label: "Run doctor" } }, message: "run diagnostics" } },
|
|
230
|
-
{ detail: "open server controls", item: { id: "server", label: "server", intent: { scene: "server", argv: ["server", "status"], action: { kind: "refresh", label: "Open server controls" } }, message: "open server controls" } }
|
|
231
|
-
];
|
|
232
|
-
var ERROR_REPAIR_LINK_ACTION = { detail: "backfill or prepare selected remote project-root link", item: { id: "repair-link", label: "repair link", intent: { scene: "server", argv: ["server", "repair-link"], action: { kind: "remote-link-repair", label: "Repair remote link", payload: { returnScene: "server" } } }, message: "repair remote project link" } };
|
|
233
|
-
function errorActions(state) {
|
|
234
|
-
return shouldOfferRemoteLinkRepair(state, state.error?.message) ? [...ERROR_ACTIONS, ERROR_REPAIR_LINK_ACTION] : ERROR_ACTIONS;
|
|
235
|
-
}
|
|
236
|
-
function renderErrorScene(state) {
|
|
237
|
-
const message = state.error?.message ?? "Unknown app error";
|
|
238
|
-
const hint = state.error?.hint ?? "Use the actions below to recover.";
|
|
239
|
-
const actions = errorActions(state);
|
|
240
|
-
const selected = Math.max(0, Math.min(actions.length - 1, state.selection.index));
|
|
241
|
-
return makeSceneFrame({
|
|
242
|
-
scene: "error",
|
|
243
|
-
title: "Error",
|
|
244
|
-
lines: [
|
|
245
|
-
...errorDrone(state.tick).slice(2, 10)
|
|
246
|
-
],
|
|
247
|
-
panels: [{
|
|
248
|
-
id: "error-recovery",
|
|
249
|
-
top: 2,
|
|
250
|
-
width: 96,
|
|
251
|
-
height: 18,
|
|
252
|
-
lines: [
|
|
253
|
-
line("DRONE SIGNAL DEGRADED", { fg: RIG_UI.red, bold: true }),
|
|
254
|
-
line(message, { fg: RIG_UI.ink2 }),
|
|
255
|
-
...hint ? [line(hint, { fg: RIG_UI.yellow })] : [],
|
|
256
|
-
line("", { fg: RIG_UI.ink3 }),
|
|
257
|
-
line("ACTIONS", { fg: RIG_UI.ink3, bold: true }),
|
|
258
|
-
...actions.map(({ detail, item }, index) => selectableDeckRow({ label: item.label, detail, index, active: selected === index }, item))
|
|
259
|
-
],
|
|
260
|
-
backgroundColor: RIG_UI.panel,
|
|
261
|
-
backgroundAlpha: 184,
|
|
262
|
-
opacity: 1,
|
|
263
|
-
border: false,
|
|
264
|
-
chrome: "ad-terminal",
|
|
265
|
-
headerText: "recovery",
|
|
266
|
-
headerHeight: 3,
|
|
267
|
-
paddingX: 3,
|
|
268
|
-
paddingY: 1
|
|
269
|
-
}],
|
|
270
|
-
footer: { message: "enter/click a recovery action" },
|
|
271
|
-
hideTypeBar: true,
|
|
272
|
-
live: true
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
export {
|
|
276
|
-
renderErrorScene
|
|
277
|
-
};
|
|
@@ -1,349 +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
|
-
function statusGlyph(status) {
|
|
69
|
-
switch (status) {
|
|
70
|
-
case "success":
|
|
71
|
-
case "completed":
|
|
72
|
-
case "merged":
|
|
73
|
-
return "\u2713";
|
|
74
|
-
case "running":
|
|
75
|
-
return "\u25CF";
|
|
76
|
-
case "preparing":
|
|
77
|
-
case "created":
|
|
78
|
-
case "validating":
|
|
79
|
-
case "reviewing":
|
|
80
|
-
case "closing-out":
|
|
81
|
-
case "stopping":
|
|
82
|
-
case "loading":
|
|
83
|
-
case "action":
|
|
84
|
-
return "\u25D0";
|
|
85
|
-
case "needs-attention":
|
|
86
|
-
case "needs_attention":
|
|
87
|
-
return "\u26A0";
|
|
88
|
-
case "failed":
|
|
89
|
-
case "error":
|
|
90
|
-
return "\u2717";
|
|
91
|
-
default:
|
|
92
|
-
return "\xB7";
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function noColorActive() {
|
|
96
|
-
const noColor = process.env.NO_COLOR;
|
|
97
|
-
if (noColor !== undefined && noColor !== "") {
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
return process.env.RIG_NO_COLOR !== undefined;
|
|
101
|
-
}
|
|
102
|
-
function statusLabel(status) {
|
|
103
|
-
return {
|
|
104
|
-
glyph: statusGlyph(status),
|
|
105
|
-
color: noColorActive() ? RIG_UI.ink : statusColor(status)
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// packages/cli/src/app-opentui/drone.ts
|
|
110
|
-
import { RGBA, StyledText, TextAttributes as TextAttributes2 } from "@opentui/core";
|
|
111
|
-
var COLOR = {
|
|
112
|
-
body: RGBA.fromHex(RIG_UI.lime),
|
|
113
|
-
mini: RGBA.fromHex(RIG_UI.limeDim),
|
|
114
|
-
rotor: RGBA.fromHex(RIG_UI.cyan),
|
|
115
|
-
path: RGBA.fromHex(RIG_UI.cyan),
|
|
116
|
-
eye: RGBA.fromHex(RIG_UI.ink),
|
|
117
|
-
dim: RGBA.fromHex(RIG_UI.ink4),
|
|
118
|
-
ink: RGBA.fromHex(RIG_UI.ink2)
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
// packages/cli/src/app-opentui/render/scene.ts
|
|
122
|
-
function line(text, options = {}) {
|
|
123
|
-
return { text, ...options };
|
|
124
|
-
}
|
|
125
|
-
function blank() {
|
|
126
|
-
return { text: "" };
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// packages/cli/src/app-opentui/fleet-stats.ts
|
|
130
|
-
var ACTIVE_STATUSES = new Set([
|
|
131
|
-
"running",
|
|
132
|
-
"preparing",
|
|
133
|
-
"created",
|
|
134
|
-
"validating",
|
|
135
|
-
"reviewing",
|
|
136
|
-
"closing-out",
|
|
137
|
-
"stopping",
|
|
138
|
-
"loading"
|
|
139
|
-
]);
|
|
140
|
-
|
|
141
|
-
// packages/cli/src/app-opentui/scenes/family-domains/kit.ts
|
|
142
|
-
function relativeTime(iso, now = Date.now()) {
|
|
143
|
-
if (!iso)
|
|
144
|
-
return "";
|
|
145
|
-
const then = Date.parse(iso);
|
|
146
|
-
if (!Number.isFinite(then))
|
|
147
|
-
return "";
|
|
148
|
-
const deltaMs = now - then;
|
|
149
|
-
if (deltaMs < 0)
|
|
150
|
-
return "just now";
|
|
151
|
-
const seconds = Math.floor(deltaMs / 1000);
|
|
152
|
-
if (seconds < 60)
|
|
153
|
-
return "just now";
|
|
154
|
-
const minutes = Math.floor(seconds / 60);
|
|
155
|
-
if (minutes < 60)
|
|
156
|
-
return `${minutes}m ago`;
|
|
157
|
-
const hours = Math.floor(minutes / 60);
|
|
158
|
-
if (hours < 24)
|
|
159
|
-
return `${hours}h ago`;
|
|
160
|
-
const days = Math.floor(hours / 24);
|
|
161
|
-
return `${days}d ago`;
|
|
162
|
-
}
|
|
163
|
-
function actionItemFor(family, sub) {
|
|
164
|
-
const base = sub.base.join(" ");
|
|
165
|
-
if (sub.direct) {
|
|
166
|
-
const label = `run rig ${family} ${base}`.trim();
|
|
167
|
-
return {
|
|
168
|
-
id: `action:${sub.id}`,
|
|
169
|
-
label,
|
|
170
|
-
intent: { scene: "command", argv: [family, ...sub.base], action: { kind: "command-run", label: `Run rig ${family} ${base}`.trim(), payload: { argv: [family, ...sub.base], family } } },
|
|
171
|
-
message: label
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
return {
|
|
175
|
-
id: `action:${sub.id}`,
|
|
176
|
-
label: `configure ${family} ${base}`.trim(),
|
|
177
|
-
intent: { scene: "family", argv: [family], action: { kind: "refresh", label: `Configure ${sub.template}`, payload: { family, formSub: sub.id } } },
|
|
178
|
-
message: `configure & run rig ${family} ${sub.template}`
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
function metric(label, value, opts = {}) {
|
|
182
|
-
return line(` ${label.padEnd(22)} ${value}`, { fg: opts.fg ?? RIG_UI.ink2, bold: opts.bold });
|
|
183
|
-
}
|
|
184
|
-
function heading(text) {
|
|
185
|
-
return line(text, { fg: RIG_UI.ink, bold: true });
|
|
186
|
-
}
|
|
187
|
-
function drillItem(id, label, message, extra) {
|
|
188
|
-
return { id, label, data: { ...extra ?? {}, familyDrillId: id }, message: message ?? label };
|
|
189
|
-
}
|
|
190
|
-
function drillBackItem(message = "return to overview") {
|
|
191
|
-
return { id: "drill-back", label: "back", data: { familyDrillId: undefined }, message };
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// packages/cli/src/app-opentui/scenes/family-domains/agent.ts
|
|
195
|
-
var GUTTER = " ";
|
|
196
|
-
var COL = { state: 9, id: 22, mode: 9, task: 16, age: 8 };
|
|
197
|
-
var ACTIVE_WINDOW_MS = 60 * 60 * 1000;
|
|
198
|
-
function deriveRowState(agent, now) {
|
|
199
|
-
if (!agent.taskId)
|
|
200
|
-
return { label: "detached", status: "needs-attention" };
|
|
201
|
-
const created = Date.parse(agent.createdAt);
|
|
202
|
-
if (Number.isFinite(created) && now - created <= ACTIVE_WINDOW_MS) {
|
|
203
|
-
return { label: "active", status: "running" };
|
|
204
|
-
}
|
|
205
|
-
return { label: "idle", status: "loading" };
|
|
206
|
-
}
|
|
207
|
-
function str(record, key) {
|
|
208
|
-
const value = record[key];
|
|
209
|
-
return typeof value === "string" ? value : "";
|
|
210
|
-
}
|
|
211
|
-
function rosterFromDetails(details) {
|
|
212
|
-
const raw = details?.["runtimes"];
|
|
213
|
-
if (!Array.isArray(raw))
|
|
214
|
-
return [];
|
|
215
|
-
const rows = [];
|
|
216
|
-
for (const entry of raw) {
|
|
217
|
-
if (!entry || typeof entry !== "object" || Array.isArray(entry))
|
|
218
|
-
continue;
|
|
219
|
-
const record = entry;
|
|
220
|
-
const id = str(record, "id");
|
|
221
|
-
if (!id)
|
|
222
|
-
continue;
|
|
223
|
-
rows.push({
|
|
224
|
-
id,
|
|
225
|
-
taskId: str(record, "taskId"),
|
|
226
|
-
mode: str(record, "mode") || "worktree",
|
|
227
|
-
workspaceDir: str(record, "workspaceDir"),
|
|
228
|
-
createdAt: str(record, "createdAt")
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
return rows;
|
|
232
|
-
}
|
|
233
|
-
function subIdByVerb(ctx, verb) {
|
|
234
|
-
const sub = ctx.snap.subcommands.find((entry) => entry.base[0] === verb);
|
|
235
|
-
return sub?.id ?? null;
|
|
236
|
-
}
|
|
237
|
-
function workspaceLeaf(path) {
|
|
238
|
-
if (!path)
|
|
239
|
-
return "";
|
|
240
|
-
const parts = path.split("/").filter(Boolean);
|
|
241
|
-
return parts[parts.length - 1] ?? path;
|
|
242
|
-
}
|
|
243
|
-
function rosterItem(agent) {
|
|
244
|
-
return drillItem(`agent:${agent.id}`, `inspect runtime ${agent.id}`, `runtime ${agent.id}${agent.taskId ? ` \xB7 task ${agent.taskId}` : ""} \u2014 open detail`, { runtimeId: agent.id, taskId: agent.taskId, workspaceDir: agent.workspaceDir });
|
|
245
|
-
}
|
|
246
|
-
function commandRow(id, label, argv, detail, message) {
|
|
247
|
-
return {
|
|
248
|
-
id,
|
|
249
|
-
label,
|
|
250
|
-
intent: { scene: "command", argv: [...argv], action: { kind: "command-run", label, payload: { argv: [...argv] } } },
|
|
251
|
-
message,
|
|
252
|
-
data: { detail }
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
function formRow(ctx, id, label, subId, message) {
|
|
256
|
-
return {
|
|
257
|
-
id,
|
|
258
|
-
label,
|
|
259
|
-
intent: { scene: "family", argv: [ctx.family], action: { kind: "refresh", label, payload: { family: ctx.family, formSub: subId } } },
|
|
260
|
-
message
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
function agentDetail(ctx, agent, now) {
|
|
264
|
-
const lines = [];
|
|
265
|
-
const rowState = deriveRowState(agent, now);
|
|
266
|
-
const { glyph, color } = statusLabel(rowState.status);
|
|
267
|
-
lines.push(line(`AGENT RUNTIME \xB7 ${agent.id}`, { fg: RIG_UI.ink, bold: true }));
|
|
268
|
-
lines.push(blank());
|
|
269
|
-
lines.push(metric("state", `${glyph} ${rowState.label}`, { fg: color, bold: true }));
|
|
270
|
-
lines.push(metric("runtime id", agent.id, { fg: RIG_UI.lime, bold: true }));
|
|
271
|
-
lines.push(metric("task", agent.taskId || "\u2014", { fg: agent.taskId ? RIG_UI.cyan : RIG_UI.ink4 }));
|
|
272
|
-
lines.push(metric("mode", agent.mode));
|
|
273
|
-
lines.push(metric("workspace", agent.workspaceDir || "\u2014", { fg: agent.workspaceDir ? RIG_UI.ink2 : RIG_UI.ink4 }));
|
|
274
|
-
if (agent.createdAt) {
|
|
275
|
-
const rel = relativeTime(agent.createdAt, now);
|
|
276
|
-
lines.push(metric("created", rel ? `${rel} (${agent.createdAt})` : agent.createdAt, { fg: RIG_UI.ink3 }));
|
|
277
|
-
}
|
|
278
|
-
lines.push(blank());
|
|
279
|
-
lines.push(heading("ACTIONS"));
|
|
280
|
-
lines.push(ctx.cursor.deck({ label: "back", detail: "return to the agent roster" }, drillBackItem("back to agent roster")));
|
|
281
|
-
lines.push(ctx.cursor.deck({ label: "view run", detail: `inspect the run journal for ${agent.id}` }, commandRow(`agent-detail-view-run:${agent.id}`, `view run ${agent.id}`, ["run", "show", agent.id], `inspect the run journal for ${agent.id}`, `show the run journal for runtime ${agent.id}`)));
|
|
282
|
-
const runSubId = subIdByVerb(ctx, "run");
|
|
283
|
-
if (agent.taskId && runSubId) {
|
|
284
|
-
lines.push(ctx.cursor.deck({ label: "re-run task", detail: `open the run form for task ${agent.taskId}` }, formRow(ctx, `agent-detail-rerun:${agent.id}`, `re-run task ${agent.taskId}`, runSubId, `open the run form for task ${agent.taskId}`)));
|
|
285
|
-
}
|
|
286
|
-
lines.push(ctx.cursor.deck({ label: "cleanup", detail: `tear down runtime ${agent.id}` }, commandRow(`agent-detail-cleanup:${agent.id}`, `cleanup ${agent.id}`, ["agent", "cleanup", "--id", agent.id], `tear down runtime ${agent.id}`, `cleanup runtime ${agent.id}`)));
|
|
287
|
-
lines.push(blank());
|
|
288
|
-
lines.push(line("back returns to the roster \xB7 view run inspects the journal \xB7 re-run opens the form", { fg: RIG_UI.ink4 }));
|
|
289
|
-
return lines;
|
|
290
|
-
}
|
|
291
|
-
var renderAgent = (ctx) => {
|
|
292
|
-
const roster = rosterFromDetails(ctx.details);
|
|
293
|
-
const now = Date.now();
|
|
294
|
-
if (ctx.drillId) {
|
|
295
|
-
const drilled = roster.find((agent) => `agent:${agent.id}` === ctx.drillId);
|
|
296
|
-
if (drilled)
|
|
297
|
-
return agentDetail(ctx, drilled, now);
|
|
298
|
-
}
|
|
299
|
-
const lines = [];
|
|
300
|
-
lines.push(line(ctx.snap.summary, { fg: RIG_UI.ink3 }));
|
|
301
|
-
lines.push(blank());
|
|
302
|
-
const probed = ctx.state.ran;
|
|
303
|
-
const { glyph, color } = statusLabel(probed && ctx.state.ok ? "success" : "needs-attention");
|
|
304
|
-
lines.push(line(`${glyph} AGENT ROSTER \xB7 rig agent list`, { fg: color, bold: true }));
|
|
305
|
-
lines.push(metric("prepared runtimes", String(roster.length), { fg: roster.length > 0 ? RIG_UI.lime : RIG_UI.ink3, bold: roster.length > 0 }));
|
|
306
|
-
lines.push(blank());
|
|
307
|
-
if (roster.length > 0) {
|
|
308
|
-
lines.push(line(`${GUTTER}${"STATE".padEnd(COL.state)}${GUTTER}${"RUNTIME".padEnd(COL.id)}${GUTTER}${"MODE".padEnd(COL.mode)}${GUTTER}${"TASK".padEnd(COL.task)}${GUTTER}${"AGE".padEnd(COL.age)}${GUTTER}WORKSPACE`, { fg: RIG_UI.ink, bold: true, bg: RIG_UI.glass }));
|
|
309
|
-
for (const agent of roster) {
|
|
310
|
-
const active = ctx.cursor.index === ctx.selected;
|
|
311
|
-
const rowState = deriveRowState(agent, now);
|
|
312
|
-
const stateGlyph = statusLabel(rowState.status);
|
|
313
|
-
const id = agent.id.length > COL.id ? `${agent.id.slice(0, COL.id - 1)}\u2026` : agent.id;
|
|
314
|
-
const task = agent.taskId ? agent.taskId.length > COL.task ? `${agent.taskId.slice(0, COL.task - 1)}\u2026` : agent.taskId : "\u2014";
|
|
315
|
-
const age = relativeTime(agent.createdAt, now) || "\u2014";
|
|
316
|
-
const ws = workspaceLeaf(agent.workspaceDir) || "\u2014";
|
|
317
|
-
const marker = active ? "\u258C " : " ";
|
|
318
|
-
const stateCell = `${stateGlyph.glyph} ${rowState.label}`.padEnd(COL.state);
|
|
319
|
-
const content = line(`${marker}${stateCell}${GUTTER}${id.padEnd(COL.id)}${GUTTER}${agent.mode.padEnd(COL.mode)}${GUTTER}${task.padEnd(COL.task)}${GUTTER}${age.padEnd(COL.age)}${GUTTER}${ws}`, {
|
|
320
|
-
fg: active ? RIG_UI.ink : RIG_UI.ink2,
|
|
321
|
-
...active ? { bg: RIG_UI.glass } : {}
|
|
322
|
-
});
|
|
323
|
-
lines.push(ctx.cursor.row(content, rosterItem(agent)));
|
|
324
|
-
}
|
|
325
|
-
lines.push(blank());
|
|
326
|
-
lines.push(line("select a runtime to open its detail screen (view run \xB7 re-run \xB7 cleanup)", { fg: RIG_UI.ink4 }));
|
|
327
|
-
lines.push(blank());
|
|
328
|
-
} else {
|
|
329
|
-
if (probed && ctx.state.lines.length > 0) {
|
|
330
|
-
for (const text of ctx.state.lines.slice(0, 40))
|
|
331
|
-
lines.push(line(` ${text}`, { fg: RIG_UI.ink2 }));
|
|
332
|
-
} else {
|
|
333
|
-
lines.push(line(" No agent runtimes prepared. Use prepare/run below to provision one.", { fg: RIG_UI.ink3 }));
|
|
334
|
-
}
|
|
335
|
-
lines.push(blank());
|
|
336
|
-
}
|
|
337
|
-
lines.push(heading("ACTIONS"));
|
|
338
|
-
for (const sub of ctx.snap.subcommands) {
|
|
339
|
-
const base = sub.base.join(" ") || ctx.family;
|
|
340
|
-
const detail = sub.direct ? sub.description : `${sub.description} \xB7 ${sub.fields.length} field${sub.fields.length === 1 ? "" : "s"}`;
|
|
341
|
-
lines.push(ctx.cursor.deck({ label: base, detail }, actionItemFor(ctx.family, sub)));
|
|
342
|
-
}
|
|
343
|
-
lines.push(blank());
|
|
344
|
-
lines.push(line("prepare provisions a runtime \xB7 run executes inside one \xB7 cleanup tears them down", { fg: RIG_UI.ink4 }));
|
|
345
|
-
return lines;
|
|
346
|
-
};
|
|
347
|
-
export {
|
|
348
|
-
renderAgent
|
|
349
|
-
};
|