@h-rig/cli 0.0.6-alpha.82 → 0.0.6-alpha.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/build-rig-binaries.js +40 -8
- package/dist/bin/rig.js +23402 -14577
- package/dist/src/app/board.js +217 -41
- package/dist/src/app-opentui/adapters/command.d.ts +2 -0
- package/dist/src/app-opentui/adapters/command.js +329 -0
- package/dist/src/app-opentui/adapters/common.js +2 -2
- package/dist/src/app-opentui/adapters/doctor.d.ts +0 -2
- package/dist/src/app-opentui/adapters/doctor.js +64 -39
- package/dist/src/app-opentui/adapters/family.d.ts +62 -0
- package/dist/src/app-opentui/adapters/family.js +14305 -0
- package/dist/src/app-opentui/adapters/fleet.d.ts +0 -2
- package/dist/src/app-opentui/adapters/fleet.js +90 -60
- package/dist/src/app-opentui/adapters/inbox.d.ts +12 -2
- package/dist/src/app-opentui/adapters/inbox.js +137 -78
- package/dist/src/app-opentui/adapters/init.d.ts +0 -2
- package/dist/src/app-opentui/adapters/init.js +85 -47
- package/dist/src/app-opentui/adapters/inspect.d.ts +52 -0
- package/dist/src/app-opentui/adapters/inspect.js +1024 -0
- package/dist/src/app-opentui/adapters/pi-attach.d.ts +15 -6
- package/dist/src/app-opentui/adapters/pi-attach.js +442 -125
- package/dist/src/app-opentui/adapters/pi.d.ts +23 -0
- package/dist/src/app-opentui/adapters/pi.js +363 -0
- package/dist/src/app-opentui/adapters/plugin.d.ts +84 -0
- package/dist/src/app-opentui/adapters/plugin.js +544 -0
- package/dist/src/app-opentui/adapters/repo.d.ts +37 -0
- package/dist/src/app-opentui/adapters/repo.js +186 -0
- package/dist/src/app-opentui/adapters/run-detail.d.ts +9 -2
- package/dist/src/app-opentui/adapters/run-detail.js +180 -63
- package/dist/src/app-opentui/adapters/server.d.ts +10 -2
- package/dist/src/app-opentui/adapters/server.js +191 -45
- package/dist/src/app-opentui/adapters/tasks.d.ts +11 -2
- package/dist/src/app-opentui/adapters/tasks.js +1123 -143
- package/dist/src/app-opentui/adapters/workspace.d.ts +49 -0
- package/dist/src/app-opentui/adapters/workspace.js +333 -0
- package/dist/src/app-opentui/autocomplete.d.ts +20 -0
- package/dist/src/app-opentui/autocomplete.js +576 -0
- package/dist/src/app-opentui/bootstrap.d.ts +1 -6
- package/dist/src/app-opentui/bootstrap.js +25252 -16474
- package/dist/src/app-opentui/command-palette.d.ts +3 -0
- package/dist/src/app-opentui/command-palette.js +1010 -0
- package/dist/src/app-opentui/command-pty-host.d.ts +62 -0
- package/dist/src/app-opentui/command-pty-host.js +248 -0
- package/dist/src/app-opentui/drone.js +8 -6
- package/dist/src/app-opentui/events.js +1 -1
- package/dist/src/app-opentui/fleet-stats.d.ts +32 -0
- package/dist/src/app-opentui/fleet-stats.js +114 -0
- package/dist/src/app-opentui/focus-manager.d.ts +14 -0
- package/dist/src/app-opentui/focus-manager.js +24 -0
- package/dist/src/app-opentui/index.js +5431 -2797
- package/dist/src/app-opentui/intent.js +179 -50
- package/dist/src/app-opentui/keymap.d.ts +21 -0
- package/dist/src/app-opentui/keymap.js +1748 -0
- package/dist/src/app-opentui/launch-routing.d.ts +16 -0
- package/dist/src/app-opentui/launch-routing.js +55 -0
- package/dist/src/app-opentui/layout.d.ts +7 -0
- package/dist/src/app-opentui/layout.js +13 -6
- package/dist/src/app-opentui/list-search.d.ts +24 -0
- package/dist/src/app-opentui/list-search.js +88 -1
- package/dist/src/app-opentui/pi-host-child.js +99 -17
- package/dist/src/app-opentui/pi-pty-host.d.ts +14 -0
- package/dist/src/app-opentui/pi-pty-host.js +30 -14
- package/dist/src/app-opentui/react/App.d.ts +9 -0
- package/dist/src/app-opentui/react/App.js +5144 -0
- package/dist/src/app-opentui/react/Backdrop.d.ts +5 -0
- package/dist/src/app-opentui/react/Backdrop.js +1834 -0
- package/dist/src/app-opentui/react/ChromeHost.d.ts +5 -0
- package/dist/src/app-opentui/react/ChromeHost.js +2942 -0
- package/dist/src/app-opentui/react/SceneFrameView.d.ts +7 -0
- package/dist/src/app-opentui/react/SceneFrameView.js +529 -0
- package/dist/src/app-opentui/react/context.d.ts +17 -0
- package/dist/src/app-opentui/react/context.js +37 -0
- package/dist/src/app-opentui/react/launch.d.ts +2 -0
- package/dist/src/app-opentui/react/launch.js +5743 -0
- package/dist/src/app-opentui/react/nav.d.ts +18 -0
- package/dist/src/app-opentui/react/nav.js +54 -0
- package/dist/src/app-opentui/react/scroll.d.ts +12 -0
- package/dist/src/app-opentui/react/scroll.js +21 -0
- package/dist/src/app-opentui/react/syntax.d.ts +2 -0
- package/dist/src/app-opentui/react/syntax.js +64 -0
- package/dist/src/app-opentui/registry.js +20428 -4828
- package/dist/src/app-opentui/render/ascii-fleet.d.ts +15 -0
- package/dist/src/app-opentui/render/ascii-fleet.js +82 -0
- package/dist/src/app-opentui/render/constants.d.ts +31 -0
- package/dist/src/app-opentui/render/constants.js +66 -0
- package/dist/src/app-opentui/render/graphics.d.ts +2 -1
- package/dist/src/app-opentui/render/graphics.js +228 -46
- package/dist/src/app-opentui/render/image-visual-layer-worker.js +469 -930
- package/dist/src/app-opentui/render/image-visual-layer.d.ts +25 -10
- package/dist/src/app-opentui/render/image-visual-layer.js +448 -329
- package/dist/src/app-opentui/render/native-host.d.ts +37 -0
- package/dist/src/app-opentui/render/native-host.js +179 -0
- package/dist/src/app-opentui/render/panel-layout.d.ts +38 -0
- package/dist/src/app-opentui/render/panel-layout.js +48 -0
- package/dist/src/app-opentui/render/panels.d.ts +2 -0
- package/dist/src/app-opentui/render/panels.js +78 -38
- package/dist/src/app-opentui/render/preloader.d.ts +10 -0
- package/dist/src/app-opentui/render/preloader.js +165 -0
- package/dist/src/app-opentui/render/scene.d.ts +53 -1
- package/dist/src/app-opentui/render/scene.js +195 -6
- package/dist/src/app-opentui/render/text.d.ts +7 -1
- package/dist/src/app-opentui/render/text.js +15 -8
- package/dist/src/app-opentui/render/type-bar.d.ts +2 -1
- package/dist/src/app-opentui/render/type-bar.js +113 -39
- package/dist/src/app-opentui/runtime-resources.d.ts +16 -0
- package/dist/src/app-opentui/runtime-resources.js +62 -0
- package/dist/src/app-opentui/runtime.d.ts +44 -1
- package/dist/src/app-opentui/runtime.js +5415 -2738
- package/dist/src/app-opentui/scenes/command.d.ts +3 -0
- package/dist/src/app-opentui/scenes/command.js +117 -0
- package/dist/src/app-opentui/scenes/doctor.d.ts +2 -1
- package/dist/src/app-opentui/scenes/doctor.js +221 -17
- package/dist/src/app-opentui/scenes/error.js +60 -20
- package/dist/src/app-opentui/scenes/family-domains/agent.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/agent.js +348 -0
- package/dist/src/app-opentui/scenes/family-domains/browser.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/browser.js +195 -0
- package/dist/src/app-opentui/scenes/family-domains/dist.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/dist.js +243 -0
- package/dist/src/app-opentui/scenes/family-domains/git.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/git.js +195 -0
- package/dist/src/app-opentui/scenes/family-domains/github.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/github.js +274 -0
- package/dist/src/app-opentui/scenes/family-domains/harness.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/harness.js +152 -0
- package/dist/src/app-opentui/scenes/family-domains/index.d.ts +4 -0
- package/dist/src/app-opentui/scenes/family-domains/index.js +1679 -0
- package/dist/src/app-opentui/scenes/family-domains/kit.d.ts +76 -0
- package/dist/src/app-opentui/scenes/family-domains/kit.js +305 -0
- package/dist/src/app-opentui/scenes/family-domains/profile.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/profile.js +212 -0
- package/dist/src/app-opentui/scenes/family-domains/queue.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/queue.js +146 -0
- package/dist/src/app-opentui/scenes/family-domains/remote.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/remote.js +518 -0
- package/dist/src/app-opentui/scenes/family-domains/review.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/review.js +280 -0
- package/dist/src/app-opentui/scenes/family-domains/setup.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/setup.js +267 -0
- package/dist/src/app-opentui/scenes/family-domains/stats.d.ts +2 -0
- package/dist/src/app-opentui/scenes/family-domains/stats.js +370 -0
- package/dist/src/app-opentui/scenes/family.d.ts +3 -0
- package/dist/src/app-opentui/scenes/family.js +2144 -0
- package/dist/src/app-opentui/scenes/fleet.js +552 -43
- package/dist/src/app-opentui/scenes/handoff.js +342 -35
- package/dist/src/app-opentui/scenes/help.js +640 -56
- package/dist/src/app-opentui/scenes/inbox.d.ts +2 -1
- package/dist/src/app-opentui/scenes/inbox.js +329 -21
- package/dist/src/app-opentui/scenes/init.d.ts +2 -1
- package/dist/src/app-opentui/scenes/init.js +120 -34
- package/dist/src/app-opentui/scenes/inspect.d.ts +3 -0
- package/dist/src/app-opentui/scenes/inspect.js +793 -0
- package/dist/src/app-opentui/scenes/main.d.ts +2 -1
- package/dist/src/app-opentui/scenes/main.js +264 -29
- package/dist/src/app-opentui/scenes/pi.d.ts +3 -0
- package/dist/src/app-opentui/scenes/pi.js +508 -0
- package/dist/src/app-opentui/scenes/plugin.d.ts +3 -0
- package/dist/src/app-opentui/scenes/plugin.js +486 -0
- package/dist/src/app-opentui/scenes/repo.d.ts +3 -0
- package/dist/src/app-opentui/scenes/repo.js +424 -0
- package/dist/src/app-opentui/scenes/run-detail.d.ts +2 -1
- package/dist/src/app-opentui/scenes/run-detail.js +362 -35
- package/dist/src/app-opentui/scenes/server.d.ts +2 -1
- package/dist/src/app-opentui/scenes/server.js +243 -26
- package/dist/src/app-opentui/scenes/tasks.js +518 -41
- package/dist/src/app-opentui/scenes/workspace.d.ts +3 -0
- package/dist/src/app-opentui/scenes/workspace.js +426 -0
- package/dist/src/app-opentui/selectable.d.ts +19 -0
- package/dist/src/app-opentui/selectable.js +79 -0
- package/dist/src/app-opentui/state.js +129 -36
- package/dist/src/app-opentui/surface-catalog.d.ts +20 -0
- package/dist/src/app-opentui/surface-catalog.js +540 -0
- package/dist/src/app-opentui/terminal-capabilities.d.ts +7 -0
- package/dist/src/app-opentui/terminal-capabilities.js +15 -0
- package/dist/src/app-opentui/theme.d.ts +28 -6
- package/dist/src/app-opentui/theme.js +61 -8
- package/dist/src/app-opentui/types.d.ts +130 -5
- package/dist/src/commands/_authority-runs.d.ts +1 -1
- package/dist/src/commands/_authority-runs.js +2 -12
- package/dist/src/commands/_doctor-checks.js +62 -13
- package/dist/src/commands/_help-catalog.js +95 -15
- package/dist/src/commands/_operator-view.js +97 -15
- package/dist/src/commands/_pi-frontend.d.ts +2 -0
- package/dist/src/commands/_pi-frontend.js +97 -13
- package/dist/src/commands/_preflight.js +64 -14
- package/dist/src/commands/_server-client.js +82 -18
- package/dist/src/commands/_server-events.d.ts +26 -0
- package/dist/src/commands/_server-events.js +310 -0
- package/dist/src/commands/_snapshot-upload.js +62 -13
- package/dist/src/commands/agent.js +2 -12
- package/dist/src/commands/connect.js +7 -1
- package/dist/src/commands/doctor.js +62 -13
- package/dist/src/commands/github.js +144 -23
- package/dist/src/commands/inbox.js +62 -13
- package/dist/src/commands/init.js +82 -18
- package/dist/src/commands/inspect.js +62 -13
- package/dist/src/commands/run.js +100 -15
- package/dist/src/commands/server.js +71 -26
- package/dist/src/commands/setup.js +62 -13
- package/dist/src/commands/stats.js +157 -28
- package/dist/src/commands/task-run-driver.js +64 -25
- package/dist/src/commands/task.js +196 -43
- package/dist/src/commands.js +419 -123
- package/dist/src/index.js +426 -130
- package/package.json +11 -10
- package/dist/src/app-opentui/render/image-visual-layer-native-canvas.d.ts +0 -2
- package/dist/src/app-opentui/render/image-visual-layer-native-canvas.js +0 -1484
|
@@ -0,0 +1,348 @@
|
|
|
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
|
+
glass: "#1e2230",
|
|
16
|
+
border: "#2a2e3a",
|
|
17
|
+
ink: "#f4f5f8",
|
|
18
|
+
ink2: "#c7c9d3",
|
|
19
|
+
ink3: "#9aa0ae",
|
|
20
|
+
ink4: "#787b86",
|
|
21
|
+
lime: "#ccff4d",
|
|
22
|
+
limeDim: "#a9d63f",
|
|
23
|
+
cyan: "#56d8ff",
|
|
24
|
+
cyanDim: "#3f9fbd",
|
|
25
|
+
red: "#ff5d5d",
|
|
26
|
+
yellow: "#ffd24d",
|
|
27
|
+
magenta: "#ff79b0"
|
|
28
|
+
};
|
|
29
|
+
var styles = {
|
|
30
|
+
ink: otuiFg(RIG_UI.ink),
|
|
31
|
+
ink2: otuiFg(RIG_UI.ink2),
|
|
32
|
+
ink3: otuiFg(RIG_UI.ink3),
|
|
33
|
+
ink4: otuiFg(RIG_UI.ink4),
|
|
34
|
+
lime: otuiFg(RIG_UI.lime),
|
|
35
|
+
limeDim: otuiFg(RIG_UI.limeDim),
|
|
36
|
+
cyan: otuiFg(RIG_UI.cyan),
|
|
37
|
+
red: otuiFg(RIG_UI.red),
|
|
38
|
+
yellow: otuiFg(RIG_UI.yellow),
|
|
39
|
+
magenta: otuiFg(RIG_UI.magenta)
|
|
40
|
+
};
|
|
41
|
+
function statusColor(status) {
|
|
42
|
+
switch (status) {
|
|
43
|
+
case "success":
|
|
44
|
+
case "completed":
|
|
45
|
+
case "merged":
|
|
46
|
+
return RIG_UI.lime;
|
|
47
|
+
case "running":
|
|
48
|
+
case "preparing":
|
|
49
|
+
case "created":
|
|
50
|
+
case "validating":
|
|
51
|
+
case "reviewing":
|
|
52
|
+
case "closing-out":
|
|
53
|
+
case "stopping":
|
|
54
|
+
case "loading":
|
|
55
|
+
case "action":
|
|
56
|
+
return RIG_UI.cyan;
|
|
57
|
+
case "needs-attention":
|
|
58
|
+
case "needs_attention":
|
|
59
|
+
return RIG_UI.yellow;
|
|
60
|
+
case "failed":
|
|
61
|
+
case "error":
|
|
62
|
+
return RIG_UI.red;
|
|
63
|
+
default:
|
|
64
|
+
return RIG_UI.ink3;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function statusGlyph(status) {
|
|
68
|
+
switch (status) {
|
|
69
|
+
case "success":
|
|
70
|
+
case "completed":
|
|
71
|
+
case "merged":
|
|
72
|
+
return "\u2713";
|
|
73
|
+
case "running":
|
|
74
|
+
return "\u25CF";
|
|
75
|
+
case "preparing":
|
|
76
|
+
case "created":
|
|
77
|
+
case "validating":
|
|
78
|
+
case "reviewing":
|
|
79
|
+
case "closing-out":
|
|
80
|
+
case "stopping":
|
|
81
|
+
case "loading":
|
|
82
|
+
case "action":
|
|
83
|
+
return "\u25D0";
|
|
84
|
+
case "needs-attention":
|
|
85
|
+
case "needs_attention":
|
|
86
|
+
return "\u26A0";
|
|
87
|
+
case "failed":
|
|
88
|
+
case "error":
|
|
89
|
+
return "\u2717";
|
|
90
|
+
default:
|
|
91
|
+
return "\xB7";
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function noColorActive() {
|
|
95
|
+
const noColor = process.env.NO_COLOR;
|
|
96
|
+
if (noColor !== undefined && noColor !== "") {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
return process.env.RIG_NO_COLOR !== undefined;
|
|
100
|
+
}
|
|
101
|
+
function statusLabel(status) {
|
|
102
|
+
return {
|
|
103
|
+
glyph: statusGlyph(status),
|
|
104
|
+
color: noColorActive() ? RIG_UI.ink : statusColor(status)
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// packages/cli/src/app-opentui/drone.ts
|
|
109
|
+
import { RGBA, StyledText, TextAttributes as TextAttributes2 } from "@opentui/core";
|
|
110
|
+
var COLOR = {
|
|
111
|
+
body: RGBA.fromHex(RIG_UI.lime),
|
|
112
|
+
mini: RGBA.fromHex(RIG_UI.limeDim),
|
|
113
|
+
rotor: RGBA.fromHex(RIG_UI.cyan),
|
|
114
|
+
path: RGBA.fromHex(RIG_UI.cyan),
|
|
115
|
+
eye: RGBA.fromHex(RIG_UI.ink),
|
|
116
|
+
dim: RGBA.fromHex(RIG_UI.ink4),
|
|
117
|
+
ink: RGBA.fromHex(RIG_UI.ink2)
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// packages/cli/src/app-opentui/render/scene.ts
|
|
121
|
+
function line(text, options = {}) {
|
|
122
|
+
return { text, ...options };
|
|
123
|
+
}
|
|
124
|
+
function blank() {
|
|
125
|
+
return { text: "" };
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// packages/cli/src/app-opentui/fleet-stats.ts
|
|
129
|
+
var ACTIVE_STATUSES = new Set([
|
|
130
|
+
"running",
|
|
131
|
+
"preparing",
|
|
132
|
+
"created",
|
|
133
|
+
"validating",
|
|
134
|
+
"reviewing",
|
|
135
|
+
"closing-out",
|
|
136
|
+
"stopping",
|
|
137
|
+
"loading"
|
|
138
|
+
]);
|
|
139
|
+
|
|
140
|
+
// packages/cli/src/app-opentui/scenes/family-domains/kit.ts
|
|
141
|
+
function relativeTime(iso, now = Date.now()) {
|
|
142
|
+
if (!iso)
|
|
143
|
+
return "";
|
|
144
|
+
const then = Date.parse(iso);
|
|
145
|
+
if (!Number.isFinite(then))
|
|
146
|
+
return "";
|
|
147
|
+
const deltaMs = now - then;
|
|
148
|
+
if (deltaMs < 0)
|
|
149
|
+
return "just now";
|
|
150
|
+
const seconds = Math.floor(deltaMs / 1000);
|
|
151
|
+
if (seconds < 60)
|
|
152
|
+
return "just now";
|
|
153
|
+
const minutes = Math.floor(seconds / 60);
|
|
154
|
+
if (minutes < 60)
|
|
155
|
+
return `${minutes}m ago`;
|
|
156
|
+
const hours = Math.floor(minutes / 60);
|
|
157
|
+
if (hours < 24)
|
|
158
|
+
return `${hours}h ago`;
|
|
159
|
+
const days = Math.floor(hours / 24);
|
|
160
|
+
return `${days}d ago`;
|
|
161
|
+
}
|
|
162
|
+
function actionItemFor(family, sub) {
|
|
163
|
+
const base = sub.base.join(" ");
|
|
164
|
+
if (sub.direct) {
|
|
165
|
+
const label = `run rig ${family} ${base}`.trim();
|
|
166
|
+
return {
|
|
167
|
+
id: `action:${sub.id}`,
|
|
168
|
+
label,
|
|
169
|
+
intent: { scene: "command", argv: [family, ...sub.base], action: { kind: "command-run", label: `Run rig ${family} ${base}`.trim(), payload: { argv: [family, ...sub.base], family } } },
|
|
170
|
+
message: label
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
id: `action:${sub.id}`,
|
|
175
|
+
label: `configure ${family} ${base}`.trim(),
|
|
176
|
+
intent: { scene: "family", argv: [family], action: { kind: "refresh", label: `Configure ${sub.template}`, payload: { family, formSub: sub.id } } },
|
|
177
|
+
message: `configure & run rig ${family} ${sub.template}`
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function metric(label, value, opts = {}) {
|
|
181
|
+
return line(` ${label.padEnd(22)} ${value}`, { fg: opts.fg ?? RIG_UI.ink2, bold: opts.bold });
|
|
182
|
+
}
|
|
183
|
+
function heading(text) {
|
|
184
|
+
return line(text, { fg: RIG_UI.ink, bold: true });
|
|
185
|
+
}
|
|
186
|
+
function drillItem(id, label, message, extra) {
|
|
187
|
+
return { id, label, data: { ...extra ?? {}, familyDrillId: id }, message: message ?? label };
|
|
188
|
+
}
|
|
189
|
+
function drillBackItem(message = "return to overview") {
|
|
190
|
+
return { id: "drill-back", label: "back", data: { familyDrillId: undefined }, message };
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// packages/cli/src/app-opentui/scenes/family-domains/agent.ts
|
|
194
|
+
var GUTTER = " ";
|
|
195
|
+
var COL = { state: 9, id: 22, mode: 9, task: 16, age: 8 };
|
|
196
|
+
var ACTIVE_WINDOW_MS = 60 * 60 * 1000;
|
|
197
|
+
function deriveRowState(agent, now) {
|
|
198
|
+
if (!agent.taskId)
|
|
199
|
+
return { label: "detached", status: "needs-attention" };
|
|
200
|
+
const created = Date.parse(agent.createdAt);
|
|
201
|
+
if (Number.isFinite(created) && now - created <= ACTIVE_WINDOW_MS) {
|
|
202
|
+
return { label: "active", status: "running" };
|
|
203
|
+
}
|
|
204
|
+
return { label: "idle", status: "loading" };
|
|
205
|
+
}
|
|
206
|
+
function str(record, key) {
|
|
207
|
+
const value = record[key];
|
|
208
|
+
return typeof value === "string" ? value : "";
|
|
209
|
+
}
|
|
210
|
+
function rosterFromDetails(details) {
|
|
211
|
+
const raw = details?.["runtimes"];
|
|
212
|
+
if (!Array.isArray(raw))
|
|
213
|
+
return [];
|
|
214
|
+
const rows = [];
|
|
215
|
+
for (const entry of raw) {
|
|
216
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry))
|
|
217
|
+
continue;
|
|
218
|
+
const record = entry;
|
|
219
|
+
const id = str(record, "id");
|
|
220
|
+
if (!id)
|
|
221
|
+
continue;
|
|
222
|
+
rows.push({
|
|
223
|
+
id,
|
|
224
|
+
taskId: str(record, "taskId"),
|
|
225
|
+
mode: str(record, "mode") || "worktree",
|
|
226
|
+
workspaceDir: str(record, "workspaceDir"),
|
|
227
|
+
createdAt: str(record, "createdAt")
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
return rows;
|
|
231
|
+
}
|
|
232
|
+
function subIdByVerb(ctx, verb) {
|
|
233
|
+
const sub = ctx.snap.subcommands.find((entry) => entry.base[0] === verb);
|
|
234
|
+
return sub?.id ?? null;
|
|
235
|
+
}
|
|
236
|
+
function workspaceLeaf(path) {
|
|
237
|
+
if (!path)
|
|
238
|
+
return "";
|
|
239
|
+
const parts = path.split("/").filter(Boolean);
|
|
240
|
+
return parts[parts.length - 1] ?? path;
|
|
241
|
+
}
|
|
242
|
+
function rosterItem(agent) {
|
|
243
|
+
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 });
|
|
244
|
+
}
|
|
245
|
+
function commandRow(id, label, argv, detail, message) {
|
|
246
|
+
return {
|
|
247
|
+
id,
|
|
248
|
+
label,
|
|
249
|
+
intent: { scene: "command", argv: [...argv], action: { kind: "command-run", label, payload: { argv: [...argv] } } },
|
|
250
|
+
message,
|
|
251
|
+
data: { detail }
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
function formRow(ctx, id, label, subId, message) {
|
|
255
|
+
return {
|
|
256
|
+
id,
|
|
257
|
+
label,
|
|
258
|
+
intent: { scene: "family", argv: [ctx.family], action: { kind: "refresh", label, payload: { family: ctx.family, formSub: subId } } },
|
|
259
|
+
message
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function agentDetail(ctx, agent, now) {
|
|
263
|
+
const lines = [];
|
|
264
|
+
const rowState = deriveRowState(agent, now);
|
|
265
|
+
const { glyph, color } = statusLabel(rowState.status);
|
|
266
|
+
lines.push(line(`AGENT RUNTIME \xB7 ${agent.id}`, { fg: RIG_UI.ink, bold: true }));
|
|
267
|
+
lines.push(blank());
|
|
268
|
+
lines.push(metric("state", `${glyph} ${rowState.label}`, { fg: color, bold: true }));
|
|
269
|
+
lines.push(metric("runtime id", agent.id, { fg: RIG_UI.lime, bold: true }));
|
|
270
|
+
lines.push(metric("task", agent.taskId || "\u2014", { fg: agent.taskId ? RIG_UI.cyan : RIG_UI.ink4 }));
|
|
271
|
+
lines.push(metric("mode", agent.mode));
|
|
272
|
+
lines.push(metric("workspace", agent.workspaceDir || "\u2014", { fg: agent.workspaceDir ? RIG_UI.ink2 : RIG_UI.ink4 }));
|
|
273
|
+
if (agent.createdAt) {
|
|
274
|
+
const rel = relativeTime(agent.createdAt, now);
|
|
275
|
+
lines.push(metric("created", rel ? `${rel} (${agent.createdAt})` : agent.createdAt, { fg: RIG_UI.ink3 }));
|
|
276
|
+
}
|
|
277
|
+
lines.push(blank());
|
|
278
|
+
lines.push(heading("ACTIONS"));
|
|
279
|
+
lines.push(ctx.cursor.deck({ label: "back", detail: "return to the agent roster" }, drillBackItem("back to agent roster")));
|
|
280
|
+
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}`)));
|
|
281
|
+
const runSubId = subIdByVerb(ctx, "run");
|
|
282
|
+
if (agent.taskId && runSubId) {
|
|
283
|
+
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}`)));
|
|
284
|
+
}
|
|
285
|
+
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}`)));
|
|
286
|
+
lines.push(blank());
|
|
287
|
+
lines.push(line("back returns to the roster \xB7 view run inspects the journal \xB7 re-run opens the form", { fg: RIG_UI.ink4 }));
|
|
288
|
+
return lines;
|
|
289
|
+
}
|
|
290
|
+
var renderAgent = (ctx) => {
|
|
291
|
+
const roster = rosterFromDetails(ctx.details);
|
|
292
|
+
const now = Date.now();
|
|
293
|
+
if (ctx.drillId) {
|
|
294
|
+
const drilled = roster.find((agent) => `agent:${agent.id}` === ctx.drillId);
|
|
295
|
+
if (drilled)
|
|
296
|
+
return agentDetail(ctx, drilled, now);
|
|
297
|
+
}
|
|
298
|
+
const lines = [];
|
|
299
|
+
lines.push(line(ctx.snap.summary, { fg: RIG_UI.ink3 }));
|
|
300
|
+
lines.push(blank());
|
|
301
|
+
const probed = ctx.state.ran;
|
|
302
|
+
const { glyph, color } = statusLabel(probed && ctx.state.ok ? "success" : "needs-attention");
|
|
303
|
+
lines.push(line(`${glyph} AGENT ROSTER \xB7 rig agent list`, { fg: color, bold: true }));
|
|
304
|
+
lines.push(metric("prepared runtimes", String(roster.length), { fg: roster.length > 0 ? RIG_UI.lime : RIG_UI.ink3, bold: roster.length > 0 }));
|
|
305
|
+
lines.push(blank());
|
|
306
|
+
if (roster.length > 0) {
|
|
307
|
+
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 }));
|
|
308
|
+
for (const agent of roster) {
|
|
309
|
+
const active = ctx.cursor.index === ctx.selected;
|
|
310
|
+
const rowState = deriveRowState(agent, now);
|
|
311
|
+
const stateGlyph = statusLabel(rowState.status);
|
|
312
|
+
const id = agent.id.length > COL.id ? `${agent.id.slice(0, COL.id - 1)}\u2026` : agent.id;
|
|
313
|
+
const task = agent.taskId ? agent.taskId.length > COL.task ? `${agent.taskId.slice(0, COL.task - 1)}\u2026` : agent.taskId : "\u2014";
|
|
314
|
+
const age = relativeTime(agent.createdAt, now) || "\u2014";
|
|
315
|
+
const ws = workspaceLeaf(agent.workspaceDir) || "\u2014";
|
|
316
|
+
const marker = active ? "\u258C " : " ";
|
|
317
|
+
const stateCell = `${stateGlyph.glyph} ${rowState.label}`.padEnd(COL.state);
|
|
318
|
+
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}`, {
|
|
319
|
+
fg: active ? RIG_UI.ink : RIG_UI.ink2,
|
|
320
|
+
...active ? { bg: RIG_UI.glass } : {}
|
|
321
|
+
});
|
|
322
|
+
lines.push(ctx.cursor.row(content, rosterItem(agent)));
|
|
323
|
+
}
|
|
324
|
+
lines.push(blank());
|
|
325
|
+
lines.push(line("select a runtime to open its detail screen (view run \xB7 re-run \xB7 cleanup)", { fg: RIG_UI.ink4 }));
|
|
326
|
+
lines.push(blank());
|
|
327
|
+
} else {
|
|
328
|
+
if (probed && ctx.state.lines.length > 0) {
|
|
329
|
+
for (const text of ctx.state.lines.slice(0, 40))
|
|
330
|
+
lines.push(line(` ${text}`, { fg: RIG_UI.ink2 }));
|
|
331
|
+
} else {
|
|
332
|
+
lines.push(line(" No agent runtimes prepared. Use prepare/run below to provision one.", { fg: RIG_UI.ink3 }));
|
|
333
|
+
}
|
|
334
|
+
lines.push(blank());
|
|
335
|
+
}
|
|
336
|
+
lines.push(heading("ACTIONS"));
|
|
337
|
+
for (const sub of ctx.snap.subcommands) {
|
|
338
|
+
const base = sub.base.join(" ") || ctx.family;
|
|
339
|
+
const detail = sub.direct ? sub.description : `${sub.description} \xB7 ${sub.fields.length} field${sub.fields.length === 1 ? "" : "s"}`;
|
|
340
|
+
lines.push(ctx.cursor.deck({ label: base, detail }, actionItemFor(ctx.family, sub)));
|
|
341
|
+
}
|
|
342
|
+
lines.push(blank());
|
|
343
|
+
lines.push(line("prepare provisions a runtime \xB7 run executes inside one \xB7 cleanup tears them down", { fg: RIG_UI.ink4 }));
|
|
344
|
+
return lines;
|
|
345
|
+
};
|
|
346
|
+
export {
|
|
347
|
+
renderAgent
|
|
348
|
+
};
|
|
@@ -0,0 +1,195 @@
|
|
|
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
|
+
glass: "#1e2230",
|
|
16
|
+
border: "#2a2e3a",
|
|
17
|
+
ink: "#f4f5f8",
|
|
18
|
+
ink2: "#c7c9d3",
|
|
19
|
+
ink3: "#9aa0ae",
|
|
20
|
+
ink4: "#787b86",
|
|
21
|
+
lime: "#ccff4d",
|
|
22
|
+
limeDim: "#a9d63f",
|
|
23
|
+
cyan: "#56d8ff",
|
|
24
|
+
cyanDim: "#3f9fbd",
|
|
25
|
+
red: "#ff5d5d",
|
|
26
|
+
yellow: "#ffd24d",
|
|
27
|
+
magenta: "#ff79b0"
|
|
28
|
+
};
|
|
29
|
+
var styles = {
|
|
30
|
+
ink: otuiFg(RIG_UI.ink),
|
|
31
|
+
ink2: otuiFg(RIG_UI.ink2),
|
|
32
|
+
ink3: otuiFg(RIG_UI.ink3),
|
|
33
|
+
ink4: otuiFg(RIG_UI.ink4),
|
|
34
|
+
lime: otuiFg(RIG_UI.lime),
|
|
35
|
+
limeDim: otuiFg(RIG_UI.limeDim),
|
|
36
|
+
cyan: otuiFg(RIG_UI.cyan),
|
|
37
|
+
red: otuiFg(RIG_UI.red),
|
|
38
|
+
yellow: otuiFg(RIG_UI.yellow),
|
|
39
|
+
magenta: otuiFg(RIG_UI.magenta)
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// packages/cli/src/app-opentui/drone.ts
|
|
43
|
+
import { RGBA, StyledText, TextAttributes as TextAttributes2 } from "@opentui/core";
|
|
44
|
+
var COLOR = {
|
|
45
|
+
body: RGBA.fromHex(RIG_UI.lime),
|
|
46
|
+
mini: RGBA.fromHex(RIG_UI.limeDim),
|
|
47
|
+
rotor: RGBA.fromHex(RIG_UI.cyan),
|
|
48
|
+
path: RGBA.fromHex(RIG_UI.cyan),
|
|
49
|
+
eye: RGBA.fromHex(RIG_UI.ink),
|
|
50
|
+
dim: RGBA.fromHex(RIG_UI.ink4),
|
|
51
|
+
ink: RGBA.fromHex(RIG_UI.ink2)
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// packages/cli/src/app-opentui/render/scene.ts
|
|
55
|
+
function line(text, options = {}) {
|
|
56
|
+
return { text, ...options };
|
|
57
|
+
}
|
|
58
|
+
function blank() {
|
|
59
|
+
return { text: "" };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// packages/cli/src/app-opentui/fleet-stats.ts
|
|
63
|
+
var ACTIVE_STATUSES = new Set([
|
|
64
|
+
"running",
|
|
65
|
+
"preparing",
|
|
66
|
+
"created",
|
|
67
|
+
"validating",
|
|
68
|
+
"reviewing",
|
|
69
|
+
"closing-out",
|
|
70
|
+
"stopping",
|
|
71
|
+
"loading"
|
|
72
|
+
]);
|
|
73
|
+
|
|
74
|
+
// packages/cli/src/app-opentui/scenes/family-domains/kit.ts
|
|
75
|
+
function actionItemFor(family, sub) {
|
|
76
|
+
const base = sub.base.join(" ");
|
|
77
|
+
if (sub.direct) {
|
|
78
|
+
const label = `run rig ${family} ${base}`.trim();
|
|
79
|
+
return {
|
|
80
|
+
id: `action:${sub.id}`,
|
|
81
|
+
label,
|
|
82
|
+
intent: { scene: "command", argv: [family, ...sub.base], action: { kind: "command-run", label: `Run rig ${family} ${base}`.trim(), payload: { argv: [family, ...sub.base], family } } },
|
|
83
|
+
message: label
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
id: `action:${sub.id}`,
|
|
88
|
+
label: `configure ${family} ${base}`.trim(),
|
|
89
|
+
intent: { scene: "family", argv: [family], action: { kind: "refresh", label: `Configure ${sub.template}`, payload: { family, formSub: sub.id } } },
|
|
90
|
+
message: `configure & run rig ${family} ${sub.template}`
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function actionDetail(sub) {
|
|
94
|
+
return sub.direct ? sub.description : `${sub.description} \xB7 ${sub.fields.length} field${sub.fields.length === 1 ? "" : "s"}`;
|
|
95
|
+
}
|
|
96
|
+
function detailText(details, key) {
|
|
97
|
+
const value = details?.[key];
|
|
98
|
+
if (value === undefined || value === null)
|
|
99
|
+
return;
|
|
100
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean")
|
|
101
|
+
return String(value);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
function metric(label, value, opts = {}) {
|
|
105
|
+
return line(` ${label.padEnd(22)} ${value}`, { fg: opts.fg ?? RIG_UI.ink2, bold: opts.bold });
|
|
106
|
+
}
|
|
107
|
+
function heading(text) {
|
|
108
|
+
return line(text, { fg: RIG_UI.ink, bold: true });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// packages/cli/src/app-opentui/scenes/family-domains/browser.ts
|
|
112
|
+
var CONTRACT = {
|
|
113
|
+
attachUrl: "http://127.0.0.1:9333",
|
|
114
|
+
preset: "hp-next-local",
|
|
115
|
+
stateDir: ".tmp/rig-browser/hp-next"
|
|
116
|
+
};
|
|
117
|
+
var AGENT_HELPERS = [
|
|
118
|
+
"rig-browser-launch",
|
|
119
|
+
"rig-browser-check",
|
|
120
|
+
"rig-browser-attach-info"
|
|
121
|
+
];
|
|
122
|
+
function isWorkstation(sub) {
|
|
123
|
+
return sub.base[0] === "hp-next";
|
|
124
|
+
}
|
|
125
|
+
var renderBrowser = (ctx) => {
|
|
126
|
+
const lines = [];
|
|
127
|
+
lines.push(line("BROWSER WORKSTATION \xB7 browser-required task contract", { fg: RIG_UI.cyan, bold: true }));
|
|
128
|
+
lines.push(blank());
|
|
129
|
+
lines.push(heading("WORKSTATION STATUS"));
|
|
130
|
+
const probed = ctx.state.ran;
|
|
131
|
+
const up = ctx.details?.up === true;
|
|
132
|
+
const probeUrl = detailText(ctx.details, "attachUrl") ?? CONTRACT.attachUrl;
|
|
133
|
+
const probePort = detailText(ctx.details, "port") ?? "(unknown)";
|
|
134
|
+
if (probed && up) {
|
|
135
|
+
lines.push(metric("status", `RUNNING on :${probePort}`, { fg: RIG_UI.lime, bold: true }));
|
|
136
|
+
const browser = detailText(ctx.details, "browser");
|
|
137
|
+
if (browser)
|
|
138
|
+
lines.push(metric("browser", browser, { fg: RIG_UI.ink }));
|
|
139
|
+
const pages = detailText(ctx.details, "pages");
|
|
140
|
+
if (pages !== undefined)
|
|
141
|
+
lines.push(metric("open page targets", pages, { fg: RIG_UI.ink2 }));
|
|
142
|
+
const activeUrl = detailText(ctx.details, "activeUrl");
|
|
143
|
+
if (activeUrl)
|
|
144
|
+
lines.push(metric("active page", activeUrl, { fg: RIG_UI.ink2 }));
|
|
145
|
+
lines.push(metric("attach url", probeUrl, { fg: RIG_UI.ink2 }));
|
|
146
|
+
} else if (probed) {
|
|
147
|
+
const reason = detailText(ctx.details, "reason") ?? "no CDP endpoint";
|
|
148
|
+
lines.push(metric("status", "DOWN \u2014 start the workstation", { fg: RIG_UI.red, bold: true }));
|
|
149
|
+
lines.push(metric("probe", `${probeUrl} \xB7 ${reason}`, { fg: RIG_UI.ink3 }));
|
|
150
|
+
lines.push(line(" \u2192 run hp-next start (or dev), then hp-next check before attaching MCP", { fg: RIG_UI.ink2 }));
|
|
151
|
+
} else {
|
|
152
|
+
lines.push(metric("status", "not probed yet", { fg: RIG_UI.ink3 }));
|
|
153
|
+
}
|
|
154
|
+
lines.push(blank());
|
|
155
|
+
lines.push(heading("ATTACH CONTRACT (documented defaults)"));
|
|
156
|
+
lines.push(metric("attach url", CONTRACT.attachUrl, { fg: RIG_UI.ink2 }));
|
|
157
|
+
lines.push(metric("preset / profile", CONTRACT.preset, { fg: RIG_UI.ink2 }));
|
|
158
|
+
lines.push(metric("state dir", CONTRACT.stateDir, { fg: RIG_UI.ink3 }));
|
|
159
|
+
lines.push(blank());
|
|
160
|
+
lines.push(heading("AGENT HELPERS (worker PATH)"));
|
|
161
|
+
for (const helper of AGENT_HELPERS)
|
|
162
|
+
lines.push(metric(helper, "\u2192 inside a run", { fg: RIG_UI.ink3 }));
|
|
163
|
+
lines.push(blank());
|
|
164
|
+
const workstation = [];
|
|
165
|
+
const helpDemo = [];
|
|
166
|
+
for (const sub of ctx.snap.subcommands) {
|
|
167
|
+
if (isWorkstation(sub))
|
|
168
|
+
workstation.push(sub);
|
|
169
|
+
else
|
|
170
|
+
helpDemo.push(sub);
|
|
171
|
+
}
|
|
172
|
+
lines.push(heading(up ? "HP-NEXT WORKSTATION (controls)" : "HP-NEXT WORKSTATION (start here)"));
|
|
173
|
+
if (workstation.length === 0) {
|
|
174
|
+
lines.push(line(" (no hp-next workstation actions in this catalog)", { fg: RIG_UI.ink4 }));
|
|
175
|
+
} else {
|
|
176
|
+
for (const sub of workstation) {
|
|
177
|
+
lines.push(ctx.cursor.deck({ label: sub.base.join(" ") || ctx.family, detail: actionDetail(sub) }, actionItemFor(ctx.family, sub)));
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
lines.push(blank());
|
|
181
|
+
lines.push(heading("HELP & DEMO"));
|
|
182
|
+
if (helpDemo.length === 0) {
|
|
183
|
+
lines.push(line(" (no help/demo actions in this catalog)", { fg: RIG_UI.ink4 }));
|
|
184
|
+
} else {
|
|
185
|
+
for (const sub of helpDemo) {
|
|
186
|
+
lines.push(ctx.cursor.deck({ label: sub.base.join(" ") || ctx.family, detail: actionDetail(sub) }, actionItemFor(ctx.family, sub)));
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
lines.push(blank());
|
|
190
|
+
lines.push(line("enter a row: direct commands run \xB7 parameterized commands open a form", { fg: RIG_UI.ink4 }));
|
|
191
|
+
return lines;
|
|
192
|
+
};
|
|
193
|
+
export {
|
|
194
|
+
renderBrowser
|
|
195
|
+
};
|