@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,332 +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 blank() {
|
|
60
|
-
return { text: "" };
|
|
61
|
-
}
|
|
62
|
-
function deckRow(input) {
|
|
63
|
-
const prefix = input.active ? "\u25B8" : " ";
|
|
64
|
-
const label = input.label.toUpperCase().padEnd(10);
|
|
65
|
-
return line(`${prefix} ${label} ${input.detail}`, {
|
|
66
|
-
fg: input.active ? RIG_UI.lime : RIG_UI.ink2,
|
|
67
|
-
bold: input.active,
|
|
68
|
-
selectableIndex: input.index,
|
|
69
|
-
activateOnClick: input.activateOnClick
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
function kv(label, value, fg = RIG_UI.ink2) {
|
|
73
|
-
return line(` ${label.toUpperCase().padEnd(10)} ${value}`, { fg });
|
|
74
|
-
}
|
|
75
|
-
function makeSceneFrame(input) {
|
|
76
|
-
return input;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// packages/cli/src/app-opentui/selectable.ts
|
|
80
|
-
function selectableDeckRow(deck, item) {
|
|
81
|
-
return { ...deckRow({ ...deck, activateOnClick: true }), selectable: item };
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// packages/cli/src/app-opentui/fleet-stats.ts
|
|
85
|
-
var ACTIVE_STATUSES = new Set([
|
|
86
|
-
"running",
|
|
87
|
-
"preparing",
|
|
88
|
-
"created",
|
|
89
|
-
"validating",
|
|
90
|
-
"reviewing",
|
|
91
|
-
"closing-out",
|
|
92
|
-
"stopping",
|
|
93
|
-
"loading"
|
|
94
|
-
]);
|
|
95
|
-
var SPARK_CHARS = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"];
|
|
96
|
-
function normalizeStatus(status) {
|
|
97
|
-
return status.replace(/_/g, "-").toLowerCase();
|
|
98
|
-
}
|
|
99
|
-
function runsFromState(state) {
|
|
100
|
-
const fleet = state.data.fleet;
|
|
101
|
-
if (!fleet || typeof fleet !== "object" || Array.isArray(fleet))
|
|
102
|
-
return [];
|
|
103
|
-
const runs = fleet.runs;
|
|
104
|
-
return Array.isArray(runs) ? runs : [];
|
|
105
|
-
}
|
|
106
|
-
function computeFleetStats(runs) {
|
|
107
|
-
const byStatus = new Map;
|
|
108
|
-
let active = 0;
|
|
109
|
-
let succeeded = 0;
|
|
110
|
-
let failed = 0;
|
|
111
|
-
for (const run of runs) {
|
|
112
|
-
const status = normalizeStatus(run.status ?? "");
|
|
113
|
-
byStatus.set(status, (byStatus.get(status) ?? 0) + 1);
|
|
114
|
-
if (ACTIVE_STATUSES.has(status))
|
|
115
|
-
active += 1;
|
|
116
|
-
else if (status === "success" || status === "completed" || status === "merged")
|
|
117
|
-
succeeded += 1;
|
|
118
|
-
else if (status === "failed" || status === "error")
|
|
119
|
-
failed += 1;
|
|
120
|
-
}
|
|
121
|
-
const total = runs.length;
|
|
122
|
-
const load = total === 0 ? 0 : active / total;
|
|
123
|
-
const sparkline = buildSparklineSeries(active, succeeded, failed);
|
|
124
|
-
return { total, active, succeeded, failed, byStatus, load, sparkline };
|
|
125
|
-
}
|
|
126
|
-
function buildSparklineSeries(active, succeeded, failed) {
|
|
127
|
-
const peak = Math.max(1, active, succeeded, failed);
|
|
128
|
-
const base = [succeeded, Math.round(succeeded * 0.6 + failed * 0.4), failed, Math.round((active + failed) / 2), active];
|
|
129
|
-
return base.map((value) => Math.max(0, Math.min(peak, value)) / peak);
|
|
130
|
-
}
|
|
131
|
-
function fleetStatsFromState(state) {
|
|
132
|
-
return computeFleetStats(runsFromState(state));
|
|
133
|
-
}
|
|
134
|
-
function sparklineString(values, width) {
|
|
135
|
-
if (values.length === 0)
|
|
136
|
-
return "";
|
|
137
|
-
const series = width && width > 0 && values.length > width ? values.slice(values.length - width) : values;
|
|
138
|
-
return series.map((value) => {
|
|
139
|
-
const clamped = Math.max(0, Math.min(1, value));
|
|
140
|
-
const index = Math.min(SPARK_CHARS.length - 1, Math.round(clamped * (SPARK_CHARS.length - 1)));
|
|
141
|
-
return SPARK_CHARS[index];
|
|
142
|
-
}).join("");
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// packages/cli/src/app-opentui/scenes/main.ts
|
|
146
|
-
var CONFIGURED_MENU = [
|
|
147
|
-
["init", "guided setup, reconfigure, repair project state", { id: "init", label: "init", intent: { scene: "init", argv: ["init"], action: { kind: "refresh", label: "Open init" } }, message: "open native init flow" }],
|
|
148
|
-
["server", "local/remote target, auth, linkage", { id: "server", label: "server", intent: { scene: "server", argv: ["server", "status"], action: { kind: "refresh", label: "Checking server" } }, message: "check selected server" }],
|
|
149
|
-
["github", "auth, selected repo, stored token", { id: "github", label: "github", intent: { scene: "server", argv: ["github", "auth", "status"], action: { kind: "refresh", label: "Checking GitHub auth" } }, message: "check GitHub auth" }],
|
|
150
|
-
["tasks", "browse, filter, dispatch, attach active work", { id: "tasks", label: "tasks", intent: { scene: "tasks", argv: ["tasks"], action: { kind: "refresh", label: "Opening tasks" } }, message: "selected tasks" }],
|
|
151
|
-
["runs", "attach, stop, resume, inspect live sessions", { id: "runs", label: "runs", intent: { scene: "fleet", argv: ["runs"], action: { kind: "refresh", label: "Opening runs" } }, message: "selected runs" }],
|
|
152
|
-
["inbox", "approve, reject, answer, attach", { id: "inbox", label: "inbox", intent: { scene: "inbox", argv: ["inbox"], action: { kind: "refresh", label: "Loading inbox" } }, message: "selected inbox" }],
|
|
153
|
-
["doctor", "diagnose and repair broken surfaces", { id: "doctor", label: "doctor", intent: { scene: "doctor", argv: ["doctor"], action: { kind: "doctor-run", label: "Running doctor" } }, message: "diagnose project" }],
|
|
154
|
-
["browser", "browser workstation, hp-next, CDP, profile smokes", { id: "browser", label: "browser", intent: { scene: "family", argv: ["browser"], action: { kind: "refresh", label: "Open browser workstation", payload: { family: "browser" } } }, message: "browser workstation control panel" }],
|
|
155
|
-
["stats", "fleet metrics: completion, failures, run time", { id: "stats", label: "stats", intent: { scene: "family", argv: ["stats"], action: { kind: "refresh", label: "Open stats", payload: { family: "stats" } } }, message: "fleet metrics dashboard" }],
|
|
156
|
-
["agent", "runtime agent workspace roster and controls", { id: "agent", label: "agent", intent: { scene: "family", argv: ["agent"], action: { kind: "refresh", label: "Open agents", payload: { family: "agent" } } }, message: "agent workspace controls" }],
|
|
157
|
-
["remote", "remote orchestration status and controls", { id: "remote", label: "remote", intent: { scene: "family", argv: ["remote"], action: { kind: "refresh", label: "Open remote", payload: { family: "remote" } } }, message: "remote orchestration controls" }],
|
|
158
|
-
["pi", "Pi extension packages, search/add/remove/list", { id: "pi", label: "pi", intent: { scene: "pi", argv: ["pi", "list"], action: { kind: "refresh", label: "Open Pi extensions" } }, message: "Pi extension package actions" }],
|
|
159
|
-
["inspect", "logs, artifacts, failures, graph, audit, diff", { id: "inspect", label: "inspect", intent: { scene: "inspect", argv: ["inspect"], action: { kind: "refresh", label: "Open inspect actions" } }, message: "logs/artifacts/failures/diff" }],
|
|
160
|
-
["plugin", "plugin list, validation, contributed commands", { id: "plugin", label: "plugin", intent: { scene: "plugin", argv: ["plugin", "list"], action: { kind: "refresh", label: "Open plugin actions" } }, message: "plugin contributions" }],
|
|
161
|
-
["repo", "repo sync, git helper, harness helper", { id: "repo", label: "repo", intent: { scene: "repo", argv: ["repo", "status"], action: { kind: "refresh", label: "Open repo/git/harness actions" } }, message: "repo/git/harness helpers" }],
|
|
162
|
-
["workspace", "workspace topology, remotes, service helpers", { id: "workspace", label: "workspace", intent: { scene: "workspace", argv: ["workspace", "summary"], action: { kind: "refresh", label: "Open workspace summary" } }, message: "workspace topology" }],
|
|
163
|
-
["help", "all actions, shortcuts, mouse controls", { id: "help", label: "help", intent: { scene: "help", argv: ["help"], action: { kind: "none", label: "Opening help" } }, message: "selected help" }]
|
|
164
|
-
];
|
|
165
|
-
var ONBOARD_PRIMARY = {
|
|
166
|
-
id: "onboard-init",
|
|
167
|
-
label: "Start guided init",
|
|
168
|
-
intent: { scene: "init", argv: ["init"], action: { kind: "refresh", label: "Init" } },
|
|
169
|
-
message: "open the native init checklist"
|
|
170
|
-
};
|
|
171
|
-
var ONBOARD_SECONDARY = [
|
|
172
|
-
["server", "select a local or remote target", { id: "server", label: "server", intent: { scene: "server", argv: ["server", "status"], action: { kind: "refresh", label: "Checking server" } }, message: "check selected server" }],
|
|
173
|
-
["doctor", "diagnose what is missing", { id: "doctor", label: "doctor", intent: { scene: "doctor", argv: ["doctor"], action: { kind: "doctor-run", label: "Running doctor" } }, message: "diagnose missing setup" }],
|
|
174
|
-
["help", "shortcuts and controls", { id: "help", label: "help", intent: { scene: "help", argv: ["help"], action: { kind: "none", label: "Opening help" } }, message: "selected help" }]
|
|
175
|
-
];
|
|
176
|
-
function record(value) {
|
|
177
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
178
|
-
}
|
|
179
|
-
function serverSummary(state) {
|
|
180
|
-
const server = record(state.data.server);
|
|
181
|
-
const auth = record(server?.auth);
|
|
182
|
-
const signedIn = auth?.signedIn === true || auth?.authenticated === true || auth?.status === "authenticated";
|
|
183
|
-
const login = typeof auth?.login === "string" && auth.login.trim() ? auth.login.trim() : undefined;
|
|
184
|
-
return {
|
|
185
|
-
label: typeof server?.label === "string" && server.label.trim() ? server.label.trim() : state.footer.server ?? "not checked yet",
|
|
186
|
-
target: typeof server?.kind === "string" ? `${server.kind} endpoint` : "open Server to probe",
|
|
187
|
-
health: server ? server.reachable === false ? "unreachable" : "reachable" : "pending",
|
|
188
|
-
auth: server ? signedIn ? `signed in${login ? ` as ${login}` : ""}` : "not signed in / unknown" : "pending"
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
function inboxPending(state) {
|
|
192
|
-
const inbox = record(state.data.inbox);
|
|
193
|
-
const approvals = Array.isArray(inbox?.approvals) ? inbox.approvals.length : 0;
|
|
194
|
-
const inputs = Array.isArray(inbox?.inputs) ? inbox.inputs.length : 0;
|
|
195
|
-
return approvals + inputs;
|
|
196
|
-
}
|
|
197
|
-
function readyTaskCount(state) {
|
|
198
|
-
const tasks = record(state.data.tasks);
|
|
199
|
-
const records = Array.isArray(tasks?.records) ? tasks.records : [];
|
|
200
|
-
return records.filter((entry) => {
|
|
201
|
-
const status = record(entry)?.status;
|
|
202
|
-
return typeof status === "string" && /(ready|open|todo|pending)/i.test(status);
|
|
203
|
-
}).length;
|
|
204
|
-
}
|
|
205
|
-
function needsAttention(state) {
|
|
206
|
-
const stats = fleetStatsFromState(state);
|
|
207
|
-
let attention = stats.failed;
|
|
208
|
-
for (const [status, count] of stats.byStatus) {
|
|
209
|
-
if (/(needs-attention|stalled|blocked|error)/i.test(status))
|
|
210
|
-
attention += count;
|
|
211
|
-
}
|
|
212
|
-
return attention;
|
|
213
|
-
}
|
|
214
|
-
function tile(count, label, hint, color, item, active) {
|
|
215
|
-
const lit = count > 0;
|
|
216
|
-
const row = selectableDeckRow({ label: `${String(count).padStart(2)} ${label}`, detail: hint, active }, item);
|
|
217
|
-
return { ...row, fg: lit ? color : RIG_UI.ink3, bold: lit || active };
|
|
218
|
-
}
|
|
219
|
-
function panelWidth(layout) {
|
|
220
|
-
return layout?.centerWidth ?? 118;
|
|
221
|
-
}
|
|
222
|
-
function panelHeight(layout) {
|
|
223
|
-
return Math.max(22, layout?.centerHeight ?? 36);
|
|
224
|
-
}
|
|
225
|
-
function configuredMenuRows(selectedIndex) {
|
|
226
|
-
return CONFIGURED_MENU.map(([label, detail, item], index) => ({
|
|
227
|
-
...deckRow({ label, detail, index, active: index === selectedIndex, activateOnClick: true }),
|
|
228
|
-
selectable: item
|
|
229
|
-
}));
|
|
230
|
-
}
|
|
231
|
-
function onboardingRows(selectedIndex) {
|
|
232
|
-
const primary = selectableDeckRow({ label: "init", detail: "Start guided init \u2014 recommended", active: selectedIndex === 0 }, ONBOARD_PRIMARY);
|
|
233
|
-
const secondary = ONBOARD_SECONDARY.map(([label, detail, item], index) => ({
|
|
234
|
-
...deckRow({ label, detail, index: index + 1, active: selectedIndex === index + 1, activateOnClick: true }),
|
|
235
|
-
selectable: item
|
|
236
|
-
}));
|
|
237
|
-
return [primary, ...secondary];
|
|
238
|
-
}
|
|
239
|
-
var TILE_RUNS = { id: "tile-runs", label: "runs", intent: { scene: "fleet", argv: ["runs"], action: { kind: "refresh", label: "Opening runs" } }, message: "active runs \u2014 attach/stop/inspect" };
|
|
240
|
-
var TILE_ATTENTION = { id: "tile-attention", label: "attention", intent: { scene: "fleet", argv: ["runs"], action: { kind: "refresh", label: "Opening runs" } }, message: "runs that need attention" };
|
|
241
|
-
var TILE_INBOX = { id: "tile-inbox", label: "inbox", intent: { scene: "inbox", argv: ["inbox"], action: { kind: "refresh", label: "Loading inbox" } }, message: "pending approvals + input requests" };
|
|
242
|
-
var TILE_TASKS = { id: "tile-tasks", label: "tasks", intent: { scene: "tasks", argv: ["tasks"], action: { kind: "refresh", label: "Opening tasks" } }, message: "ready tasks \u2014 dispatch work" };
|
|
243
|
-
function dashboardLines(state, selected) {
|
|
244
|
-
const stats = fleetStatsFromState(state);
|
|
245
|
-
const attention = needsAttention(state);
|
|
246
|
-
const pending = inboxPending(state);
|
|
247
|
-
const ready = readyTaskCount(state);
|
|
248
|
-
const spark = sparklineString(stats.sparkline, 24);
|
|
249
|
-
const lines = [
|
|
250
|
-
line("FLEET", { fg: RIG_UI.ink, bold: true }),
|
|
251
|
-
tile(stats.active, "ACTIVE RUNS", "attach \xB7 steer \xB7 stop \xB7 inspect", RIG_UI.cyan, TILE_RUNS, selected === 0),
|
|
252
|
-
tile(attention, "NEEDS ATTENTION", "failed / stalled runs to triage", RIG_UI.red, TILE_ATTENTION, selected === 1),
|
|
253
|
-
tile(pending, "PENDING APPROVALS", "blockers waiting on you", RIG_UI.yellow, TILE_INBOX, selected === 2),
|
|
254
|
-
tile(ready, "READY TASKS", "dispatch a new run", RIG_UI.lime, TILE_TASKS, selected === 3)
|
|
255
|
-
];
|
|
256
|
-
if (spark.trim())
|
|
257
|
-
lines.push(line(` throughput ${spark} ${stats.succeeded} done \xB7 ${stats.failed} failed \xB7 ${stats.total} total`, { fg: RIG_UI.ink3 }));
|
|
258
|
-
return { lines, tileCount: 4 };
|
|
259
|
-
}
|
|
260
|
-
function statusLine(state) {
|
|
261
|
-
const label = state.actionLabel ?? (state.runtimeReady ? "ready" : "starting up");
|
|
262
|
-
if (state.status === "error") {
|
|
263
|
-
return line(`\u2717 ${state.error?.message ?? label}`, { fg: RIG_UI.red, bold: true });
|
|
264
|
-
}
|
|
265
|
-
if (state.status === "action") {
|
|
266
|
-
return line(`\u25D0 ${label}`, { fg: RIG_UI.cyan, bold: true });
|
|
267
|
-
}
|
|
268
|
-
if (state.status === "success") {
|
|
269
|
-
return line(`\u2713 ${label}`, { fg: RIG_UI.limeDim, bold: true });
|
|
270
|
-
}
|
|
271
|
-
return line(`\u25CF ${label}`, { fg: RIG_UI.ink2, bold: true });
|
|
272
|
-
}
|
|
273
|
-
function renderMainScene(state, layout) {
|
|
274
|
-
const configured = state.data.projectConfigured === true;
|
|
275
|
-
const server = serverSummary(state);
|
|
276
|
-
const selected = Math.max(0, state.selection.index);
|
|
277
|
-
const dash = configured ? dashboardLines(state, selected) : { lines: [], tileCount: 0 };
|
|
278
|
-
const actionSelected = configured ? selected - dash.tileCount : selected;
|
|
279
|
-
const lines = configured ? [
|
|
280
|
-
line("COCKPIT", { fg: RIG_UI.ink, bold: true }),
|
|
281
|
-
line("arrows + enter or click a tile/row \xB7 esc goes back \xB7 ctrl-c exits", { fg: RIG_UI.ink3 }),
|
|
282
|
-
blank(),
|
|
283
|
-
...dash.lines,
|
|
284
|
-
blank(),
|
|
285
|
-
line("MANAGE", { fg: RIG_UI.ink, bold: true }),
|
|
286
|
-
...configuredMenuRows(actionSelected),
|
|
287
|
-
blank(),
|
|
288
|
-
line("CONTEXT", { fg: RIG_UI.ink3, bold: true }),
|
|
289
|
-
kv("config", "configured", RIG_UI.limeDim),
|
|
290
|
-
kv("server", `${server.label} \xB7 ${server.health}`, server.health === "reachable" ? RIG_UI.limeDim : RIG_UI.yellow),
|
|
291
|
-
kv("github", server.auth, server.auth.startsWith("signed in") ? RIG_UI.limeDim : RIG_UI.yellow),
|
|
292
|
-
blank(),
|
|
293
|
-
statusLine(state)
|
|
294
|
-
] : [
|
|
295
|
-
line("WELCOME", { fg: RIG_UI.ink, bold: true }),
|
|
296
|
-
line("This project isn't initialized yet. One native init flow gets you running.", { fg: RIG_UI.ink2 }),
|
|
297
|
-
blank(),
|
|
298
|
-
line("GET STARTED", { fg: RIG_UI.ink, bold: true }),
|
|
299
|
-
...onboardingRows(actionSelected),
|
|
300
|
-
blank(),
|
|
301
|
-
line("CONTEXT", { fg: RIG_UI.ink3, bold: true }),
|
|
302
|
-
kv("config", "needs setup", RIG_UI.yellow),
|
|
303
|
-
kv("server", `${server.label} \xB7 ${server.health}`, server.health === "reachable" ? RIG_UI.limeDim : RIG_UI.yellow),
|
|
304
|
-
kv("github", server.auth, server.auth.startsWith("signed in") ? RIG_UI.limeDim : RIG_UI.yellow),
|
|
305
|
-
blank(),
|
|
306
|
-
statusLine(state)
|
|
307
|
-
];
|
|
308
|
-
return makeSceneFrame({
|
|
309
|
-
scene: "main",
|
|
310
|
-
title: "Cockpit",
|
|
311
|
-
lines: [],
|
|
312
|
-
panels: [{
|
|
313
|
-
id: "cockpit",
|
|
314
|
-
top: 0,
|
|
315
|
-
width: panelWidth(layout),
|
|
316
|
-
height: panelHeight(layout),
|
|
317
|
-
lines,
|
|
318
|
-
backgroundColor: RIG_UI.panel,
|
|
319
|
-
backgroundAlpha: 184,
|
|
320
|
-
opacity: 0.98,
|
|
321
|
-
border: false,
|
|
322
|
-
chrome: "ad-terminal",
|
|
323
|
-
headerText: "cockpit",
|
|
324
|
-
paddingX: layout?.compact ? 3 : 5,
|
|
325
|
-
paddingY: 2
|
|
326
|
-
}],
|
|
327
|
-
live: true
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
export {
|
|
331
|
-
renderMainScene
|
|
332
|
-
};
|