@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,1539 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// packages/cli/src/app-opentui/react/ChromeHost.tsx
|
|
3
|
-
import { useEffect, useRef } from "react";
|
|
4
|
-
import { useRenderer, useTerminalDimensions } from "@opentui/react";
|
|
5
|
-
import { TextRenderable as TextRenderable5 } from "@opentui/core";
|
|
6
|
-
|
|
7
|
-
// packages/cli/src/app-opentui/layout.ts
|
|
8
|
-
var MIN_TERMINAL_WIDTH = 48;
|
|
9
|
-
var MIN_TERMINAL_HEIGHT = 16;
|
|
10
|
-
function computeStageLayout(width, height) {
|
|
11
|
-
const rawWidth = Math.trunc(width || 80);
|
|
12
|
-
const rawHeight = Math.trunc(height || 24);
|
|
13
|
-
const tooSmall = rawWidth < MIN_TERMINAL_WIDTH || rawHeight < MIN_TERMINAL_HEIGHT;
|
|
14
|
-
const safeWidth = Math.max(40, rawWidth);
|
|
15
|
-
const safeHeight = Math.max(18, rawHeight);
|
|
16
|
-
const compact = safeWidth < 92 || safeHeight < 30;
|
|
17
|
-
const horizontalGutter = compact ? 1 : 2;
|
|
18
|
-
const centerWidth = Math.max(36, safeWidth - horizontalGutter * 2);
|
|
19
|
-
const centerLeft = horizontalGutter;
|
|
20
|
-
const footerTop = Math.max(0, safeHeight - 1);
|
|
21
|
-
const typeBarTop = Math.max(0, footerTop - 1);
|
|
22
|
-
const centerTop = compact ? 1 : Math.max(1, Math.floor(safeHeight * 0.055));
|
|
23
|
-
const centerHeight = Math.max(6, typeBarTop - centerTop);
|
|
24
|
-
return { width: safeWidth, height: safeHeight, centerWidth, centerLeft, centerTop, centerHeight, typeBarTop, footerTop, compact, tooSmall };
|
|
25
|
-
}
|
|
26
|
-
function visibleWidth(text) {
|
|
27
|
-
return [...text].length;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// packages/cli/src/app-opentui/render/type-bar.ts
|
|
31
|
-
import { BoxRenderable, InputRenderable, InputRenderableEvents, RGBA, StyledText, TextRenderable } from "@opentui/core";
|
|
32
|
-
|
|
33
|
-
// packages/cli/src/app-opentui/theme.ts
|
|
34
|
-
import {
|
|
35
|
-
bold as otuiBold,
|
|
36
|
-
dim as otuiDim,
|
|
37
|
-
fg as otuiFg,
|
|
38
|
-
t,
|
|
39
|
-
TextAttributes
|
|
40
|
-
} from "@opentui/core";
|
|
41
|
-
var RIG_UI = {
|
|
42
|
-
bg: "#070809",
|
|
43
|
-
bg2: "#0b0c0e",
|
|
44
|
-
panel: "#101115",
|
|
45
|
-
panel2: "#14161b",
|
|
46
|
-
hover: "#181b24",
|
|
47
|
-
glass: "#1e2230",
|
|
48
|
-
border: "#2a2e3a",
|
|
49
|
-
ink: "#f4f5f8",
|
|
50
|
-
ink2: "#c7c9d3",
|
|
51
|
-
ink3: "#9aa0ae",
|
|
52
|
-
ink4: "#787b86",
|
|
53
|
-
lime: "#ccff4d",
|
|
54
|
-
limeDim: "#a9d63f",
|
|
55
|
-
cyan: "#56d8ff",
|
|
56
|
-
cyanDim: "#3f9fbd",
|
|
57
|
-
red: "#ff5d5d",
|
|
58
|
-
yellow: "#ffd24d",
|
|
59
|
-
magenta: "#ff79b0"
|
|
60
|
-
};
|
|
61
|
-
var styles = {
|
|
62
|
-
ink: otuiFg(RIG_UI.ink),
|
|
63
|
-
ink2: otuiFg(RIG_UI.ink2),
|
|
64
|
-
ink3: otuiFg(RIG_UI.ink3),
|
|
65
|
-
ink4: otuiFg(RIG_UI.ink4),
|
|
66
|
-
lime: otuiFg(RIG_UI.lime),
|
|
67
|
-
limeDim: otuiFg(RIG_UI.limeDim),
|
|
68
|
-
cyan: otuiFg(RIG_UI.cyan),
|
|
69
|
-
red: otuiFg(RIG_UI.red),
|
|
70
|
-
yellow: otuiFg(RIG_UI.yellow),
|
|
71
|
-
magenta: otuiFg(RIG_UI.magenta)
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
// packages/cli/src/app-opentui/render/type-bar.ts
|
|
75
|
-
var TYPEBAR_BG = RGBA.fromInts(20, 25, 14, 224);
|
|
76
|
-
var TYPEBAR_BORDER = RGBA.fromInts(204, 255, 77, 92);
|
|
77
|
-
function createTypeBar(renderer) {
|
|
78
|
-
const background = new BoxRenderable(renderer, {
|
|
79
|
-
id: "typebar-card",
|
|
80
|
-
position: "absolute",
|
|
81
|
-
left: 0,
|
|
82
|
-
top: 0,
|
|
83
|
-
width: 1,
|
|
84
|
-
height: 1,
|
|
85
|
-
backgroundColor: TYPEBAR_BG,
|
|
86
|
-
border: true,
|
|
87
|
-
borderColor: TYPEBAR_BORDER,
|
|
88
|
-
zIndex: 4
|
|
89
|
-
});
|
|
90
|
-
const prefix = new TextRenderable(renderer, {
|
|
91
|
-
id: "typebar-prefix",
|
|
92
|
-
content: " \u203A",
|
|
93
|
-
position: "absolute",
|
|
94
|
-
left: 1,
|
|
95
|
-
top: 0,
|
|
96
|
-
fg: RIG_UI.lime,
|
|
97
|
-
zIndex: 7,
|
|
98
|
-
selectable: true
|
|
99
|
-
});
|
|
100
|
-
const input = new InputRenderable(renderer, {
|
|
101
|
-
id: "typebar-input",
|
|
102
|
-
position: "absolute",
|
|
103
|
-
left: 4,
|
|
104
|
-
top: 0,
|
|
105
|
-
width: 40,
|
|
106
|
-
placeholder: "runs \xB7 tasks \xB7 run next \xB7 help",
|
|
107
|
-
textColor: RIG_UI.ink,
|
|
108
|
-
cursorColor: RIG_UI.lime,
|
|
109
|
-
cursorStyle: { style: "block", blinking: false },
|
|
110
|
-
showCursor: true,
|
|
111
|
-
zIndex: 7,
|
|
112
|
-
selectable: true
|
|
113
|
-
});
|
|
114
|
-
const footer = new TextRenderable(renderer, {
|
|
115
|
-
id: "footer",
|
|
116
|
-
content: "",
|
|
117
|
-
position: "absolute",
|
|
118
|
-
left: 0,
|
|
119
|
-
top: 1,
|
|
120
|
-
width: "100%",
|
|
121
|
-
fg: RIG_UI.ink3,
|
|
122
|
-
zIndex: 7,
|
|
123
|
-
selectable: true
|
|
124
|
-
});
|
|
125
|
-
return { background, input, prefix, footer };
|
|
126
|
-
}
|
|
127
|
-
function modePrefix(mode) {
|
|
128
|
-
switch (mode) {
|
|
129
|
-
case "search":
|
|
130
|
-
return { glyph: " /", color: RIG_UI.cyan };
|
|
131
|
-
case "command":
|
|
132
|
-
return { glyph: " /", color: RIG_UI.lime };
|
|
133
|
-
case "prompt":
|
|
134
|
-
return { glyph: " ?", color: RIG_UI.yellow };
|
|
135
|
-
default:
|
|
136
|
-
return { glyph: " \u203A", color: RIG_UI.ink3 };
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function positionTypeBar(renderables, input, footer, width, typeBarTop, footerTop) {
|
|
140
|
-
const mode = input.mode ?? "nav";
|
|
141
|
-
const editing = mode !== "nav";
|
|
142
|
-
const { glyph, color } = modePrefix(mode);
|
|
143
|
-
renderables.background.visible = true;
|
|
144
|
-
const cardTop = Math.max(0, typeBarTop - 1);
|
|
145
|
-
renderables.background.left = 0;
|
|
146
|
-
renderables.background.top = cardTop;
|
|
147
|
-
renderables.background.width = width;
|
|
148
|
-
renderables.background.height = Math.max(3, footerTop - cardTop + 1);
|
|
149
|
-
renderables.prefix.content = glyph;
|
|
150
|
-
renderables.prefix.fg = color;
|
|
151
|
-
renderables.prefix.left = 2;
|
|
152
|
-
renderables.prefix.top = typeBarTop;
|
|
153
|
-
renderables.input.top = typeBarTop;
|
|
154
|
-
renderables.input.left = 5;
|
|
155
|
-
renderables.input.width = Math.max(10, width - 8);
|
|
156
|
-
renderables.input.value = editing ? input.value : "";
|
|
157
|
-
renderables.input.placeholder = editing ? mode === "prompt" ? input.prompt?.label ?? "type a value" : mode === "command" ? "rig \u2026" : "filter\u2026" : input.placeholder;
|
|
158
|
-
renderables.input.showCursor = editing;
|
|
159
|
-
if (renderables.input.focused)
|
|
160
|
-
renderables.input.blur();
|
|
161
|
-
renderables.footer.top = footerTop;
|
|
162
|
-
renderables.footer.width = "100%";
|
|
163
|
-
renderables.footer.content = formatFooter(footer, width);
|
|
164
|
-
}
|
|
165
|
-
function hideTypeBar(renderables, height) {
|
|
166
|
-
renderables.background.visible = false;
|
|
167
|
-
renderables.background.top = height + 1;
|
|
168
|
-
renderables.prefix.content = "";
|
|
169
|
-
renderables.prefix.top = height + 1;
|
|
170
|
-
renderables.input.value = "";
|
|
171
|
-
renderables.input.placeholder = "";
|
|
172
|
-
renderables.input.top = height + 1;
|
|
173
|
-
renderables.input.left = 0;
|
|
174
|
-
renderables.input.width = 1;
|
|
175
|
-
renderables.input.blur();
|
|
176
|
-
renderables.footer.content = "";
|
|
177
|
-
renderables.footer.top = height + 1;
|
|
178
|
-
}
|
|
179
|
-
function safeFooterMessage(message) {
|
|
180
|
-
const trimmed = message?.trim();
|
|
181
|
-
if (!trimmed)
|
|
182
|
-
return null;
|
|
183
|
-
if (/https?:|\b[a-z0-9-]+\.[a-z]{2,}\b|\brig\b/i.test(trimmed))
|
|
184
|
-
return null;
|
|
185
|
-
return trimmed;
|
|
186
|
-
}
|
|
187
|
-
function liveCell(live) {
|
|
188
|
-
const connected = live.trimStart().startsWith("\u25CF");
|
|
189
|
-
return { text: live, style: connected ? styles.cyan : styles.ink3 };
|
|
190
|
-
}
|
|
191
|
-
function footerCells(footer) {
|
|
192
|
-
const safeMessage = safeFooterMessage(footer.message);
|
|
193
|
-
const cells = [
|
|
194
|
-
footer.section ? { text: `\u25B8 ${footer.section}`, style: (s) => otuiBold(styles.ink2(s)) } : null,
|
|
195
|
-
footer.live ? liveCell(footer.live) : null,
|
|
196
|
-
footer.project ? { text: "workspace", style: styles.ink3 } : null,
|
|
197
|
-
footer.server ? { text: "server selected", style: styles.ink3 } : null,
|
|
198
|
-
footer.auth ? { text: "auth ready", style: styles.ink3 } : null,
|
|
199
|
-
footer.run ? { text: `run ${footer.run}`, style: styles.ink3 } : null,
|
|
200
|
-
safeMessage ? { text: safeMessage, style: styles.ink2 } : null,
|
|
201
|
-
footer.updated ? { text: footer.updated, style: styles.ink3 } : null
|
|
202
|
-
];
|
|
203
|
-
return cells.filter((cell) => cell !== null);
|
|
204
|
-
}
|
|
205
|
-
var FOOTER_SEPARATOR = " \xB7 ";
|
|
206
|
-
function formatFooter(footer, width) {
|
|
207
|
-
const budget = Math.max(8, width - 2);
|
|
208
|
-
const chunks = [styles.ink3(" ")];
|
|
209
|
-
let used = 1;
|
|
210
|
-
footerCells(footer).forEach((cell, index) => {
|
|
211
|
-
const sep = index === 0 ? "" : FOOTER_SEPARATOR;
|
|
212
|
-
const remaining = budget - used - visibleWidth(sep);
|
|
213
|
-
if (remaining <= 0)
|
|
214
|
-
return;
|
|
215
|
-
if (sep) {
|
|
216
|
-
chunks.push(styles.ink4(sep));
|
|
217
|
-
used += visibleWidth(sep);
|
|
218
|
-
}
|
|
219
|
-
const fits = visibleWidth(cell.text) <= remaining;
|
|
220
|
-
const text = fits ? cell.text : remaining <= 1 ? "\u2026" : `${[...cell.text].slice(0, Math.max(0, remaining - 1)).join("")}\u2026`;
|
|
221
|
-
chunks.push(cell.style(text));
|
|
222
|
-
used += visibleWidth(text);
|
|
223
|
-
});
|
|
224
|
-
return new StyledText(chunks);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// packages/cli/src/app-opentui/runtime.ts
|
|
228
|
-
import { BoxRenderable as BoxRenderable3, RGBA as RGBA7, StyledText as StyledText3, TextRenderable as TextRenderable4, createCliRenderer } from "@opentui/core";
|
|
229
|
-
|
|
230
|
-
// packages/cli/src/app-opentui/command-pty-host.ts
|
|
231
|
-
import { basename } from "path";
|
|
232
|
-
import { fileURLToPath } from "url";
|
|
233
|
-
import { Terminal as XtermTerminal } from "@xterm/headless";
|
|
234
|
-
var MIN_COLS = 40;
|
|
235
|
-
var MIN_ROWS = 10;
|
|
236
|
-
var MAX_ROWS = 300;
|
|
237
|
-
var MAX_SNAPSHOT_LINES = 420;
|
|
238
|
-
var SNAPSHOT_DELAY_MS = 80;
|
|
239
|
-
var fallbackCliScriptPath = fileURLToPath(new URL("../../bin/rig.ts", import.meta.url));
|
|
240
|
-
var activeHost = null;
|
|
241
|
-
function clampCols(cols) {
|
|
242
|
-
return Math.max(MIN_COLS, Math.trunc(cols || 120));
|
|
243
|
-
}
|
|
244
|
-
function clampRows(rows) {
|
|
245
|
-
return Math.max(MIN_ROWS, Math.min(MAX_ROWS, Math.trunc(rows || 36)));
|
|
246
|
-
}
|
|
247
|
-
function childCommandPrefix() {
|
|
248
|
-
const execName = basename(process.execPath).toLowerCase();
|
|
249
|
-
const currentEntry = process.argv[1];
|
|
250
|
-
if (execName === "bun" || execName === "bun.exe") {
|
|
251
|
-
return currentEntry ? [process.execPath, currentEntry] : [process.execPath, fallbackCliScriptPath];
|
|
252
|
-
}
|
|
253
|
-
return [process.execPath];
|
|
254
|
-
}
|
|
255
|
-
function withEnv(base) {
|
|
256
|
-
const env = {};
|
|
257
|
-
for (const [key, value] of Object.entries(base ?? process.env)) {
|
|
258
|
-
if (key === "NO_COLOR")
|
|
259
|
-
continue;
|
|
260
|
-
if (typeof value === "string")
|
|
261
|
-
env[key] = value;
|
|
262
|
-
}
|
|
263
|
-
return {
|
|
264
|
-
...env,
|
|
265
|
-
TERM: "xterm-256color",
|
|
266
|
-
COLORTERM: "truecolor",
|
|
267
|
-
FORCE_COLOR: env.FORCE_COLOR ?? "1",
|
|
268
|
-
RIG_PLAIN: "1",
|
|
269
|
-
RIG_OPENTUI_COMMAND_HOST: "1",
|
|
270
|
-
RIG_CLI_PLAIN_HELP: env.RIG_CLI_PLAIN_HELP ?? "1"
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
function commandLabel(argv, fallback) {
|
|
274
|
-
const command = argv.join(" ").trim();
|
|
275
|
-
return fallback?.trim() || (command ? `rig ${command}` : "rig");
|
|
276
|
-
}
|
|
277
|
-
class CommandPtyHost {
|
|
278
|
-
argv;
|
|
279
|
-
projectRoot;
|
|
280
|
-
label;
|
|
281
|
-
env;
|
|
282
|
-
onSnapshot;
|
|
283
|
-
onExit;
|
|
284
|
-
onError;
|
|
285
|
-
terminal;
|
|
286
|
-
decoder = new TextDecoder("utf-8");
|
|
287
|
-
proc = null;
|
|
288
|
-
pty = null;
|
|
289
|
-
status = "starting";
|
|
290
|
-
cols;
|
|
291
|
-
rows;
|
|
292
|
-
message = "starting command";
|
|
293
|
-
exitCode;
|
|
294
|
-
signal;
|
|
295
|
-
notifyTimer = null;
|
|
296
|
-
_disposed = false;
|
|
297
|
-
constructor(options) {
|
|
298
|
-
this.argv = [...options.argv];
|
|
299
|
-
this.projectRoot = options.projectRoot;
|
|
300
|
-
this.label = commandLabel(options.argv, options.label);
|
|
301
|
-
this.env = options.env;
|
|
302
|
-
this.cols = clampCols(options.cols);
|
|
303
|
-
this.rows = clampRows(options.rows);
|
|
304
|
-
this.onSnapshot = options.onSnapshot;
|
|
305
|
-
this.onExit = options.onExit;
|
|
306
|
-
this.onError = options.onError;
|
|
307
|
-
this.terminal = new XtermTerminal({ allowProposedApi: true, cols: this.cols, rows: this.rows, scrollback: 2000 });
|
|
308
|
-
}
|
|
309
|
-
get disposed() {
|
|
310
|
-
return this._disposed;
|
|
311
|
-
}
|
|
312
|
-
get snapshot() {
|
|
313
|
-
return this.createSnapshot();
|
|
314
|
-
}
|
|
315
|
-
async start() {
|
|
316
|
-
if (this._disposed)
|
|
317
|
-
throw new Error("Command PTY host is disposed.");
|
|
318
|
-
if (typeof Bun.Terminal !== "function") {
|
|
319
|
-
throw new Error("Bun native PTY is unavailable in this runtime. Command host requires Bun.Terminal.");
|
|
320
|
-
}
|
|
321
|
-
const spawnOptions = {
|
|
322
|
-
cwd: this.projectRoot,
|
|
323
|
-
env: withEnv(this.env),
|
|
324
|
-
terminal: {
|
|
325
|
-
cols: this.cols,
|
|
326
|
-
rows: this.rows,
|
|
327
|
-
name: "xterm-256color",
|
|
328
|
-
data: (_terminal, data) => this.handlePtyData(data)
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
|
-
const proc = Bun.spawn([...childCommandPrefix(), ...this.argv], spawnOptions);
|
|
332
|
-
if (!proc.terminal)
|
|
333
|
-
throw new Error("Bun did not attach a terminal to the command child process.");
|
|
334
|
-
this.proc = proc;
|
|
335
|
-
this.pty = proc.terminal;
|
|
336
|
-
this.status = "running";
|
|
337
|
-
this.message = "running";
|
|
338
|
-
this.emitSnapshotSoon(0);
|
|
339
|
-
proc.exited.then((exitCode) => {
|
|
340
|
-
if (this._disposed)
|
|
341
|
-
return;
|
|
342
|
-
this.status = exitCode === 0 ? "exited" : "failed";
|
|
343
|
-
this.exitCode = exitCode;
|
|
344
|
-
this.signal = null;
|
|
345
|
-
this.message = exitCode === 0 ? "completed" : `exited with code ${exitCode}`;
|
|
346
|
-
const snapshot = this.createSnapshot();
|
|
347
|
-
this.onSnapshot?.(snapshot);
|
|
348
|
-
this.onExit?.(snapshot);
|
|
349
|
-
if (activeHost === this)
|
|
350
|
-
activeHost = null;
|
|
351
|
-
this.dispose("exit", { kill: false, notify: false });
|
|
352
|
-
}).catch((error) => {
|
|
353
|
-
if (this._disposed)
|
|
354
|
-
return;
|
|
355
|
-
this.status = "failed";
|
|
356
|
-
this.message = error instanceof Error ? error.message : String(error);
|
|
357
|
-
const snapshot = this.createSnapshot();
|
|
358
|
-
this.onSnapshot?.(snapshot);
|
|
359
|
-
this.onError?.(error, snapshot);
|
|
360
|
-
if (activeHost === this)
|
|
361
|
-
activeHost = null;
|
|
362
|
-
this.dispose("error", { kill: false, notify: false });
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
write(data) {
|
|
366
|
-
if (this._disposed || !this.pty)
|
|
367
|
-
return;
|
|
368
|
-
try {
|
|
369
|
-
this.pty.write(data);
|
|
370
|
-
} catch (error) {
|
|
371
|
-
this.status = "failed";
|
|
372
|
-
this.message = error instanceof Error ? error.message : String(error);
|
|
373
|
-
const snapshot = this.createSnapshot();
|
|
374
|
-
this.onSnapshot?.(snapshot);
|
|
375
|
-
this.onError?.(error, snapshot);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
resize(cols, rows) {
|
|
379
|
-
const nextCols = clampCols(cols);
|
|
380
|
-
const nextRows = clampRows(rows);
|
|
381
|
-
if (nextCols === this.cols && nextRows === this.rows)
|
|
382
|
-
return;
|
|
383
|
-
this.cols = nextCols;
|
|
384
|
-
this.rows = nextRows;
|
|
385
|
-
this.terminal.resize(nextCols, nextRows);
|
|
386
|
-
try {
|
|
387
|
-
this.pty?.resize(nextCols, nextRows);
|
|
388
|
-
} catch {}
|
|
389
|
-
this.emitSnapshotSoon(0);
|
|
390
|
-
}
|
|
391
|
-
dispose(reason = "dispose", options = {}) {
|
|
392
|
-
if (this._disposed)
|
|
393
|
-
return;
|
|
394
|
-
this._disposed = true;
|
|
395
|
-
if (this.notifyTimer)
|
|
396
|
-
clearTimeout(this.notifyTimer);
|
|
397
|
-
this.notifyTimer = null;
|
|
398
|
-
if (options.kill !== false) {
|
|
399
|
-
try {
|
|
400
|
-
this.proc?.kill("SIGTERM");
|
|
401
|
-
} catch {}
|
|
402
|
-
}
|
|
403
|
-
try {
|
|
404
|
-
this.pty?.close();
|
|
405
|
-
} catch {}
|
|
406
|
-
try {
|
|
407
|
-
this.terminal.dispose();
|
|
408
|
-
} catch {}
|
|
409
|
-
if (activeHost === this)
|
|
410
|
-
activeHost = null;
|
|
411
|
-
if (options.notify) {
|
|
412
|
-
this.message = reason;
|
|
413
|
-
this.onSnapshot?.(this.createSnapshot(reason));
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
handlePtyData(data) {
|
|
417
|
-
if (this._disposed)
|
|
418
|
-
return;
|
|
419
|
-
this.decoder.decode(data, { stream: true });
|
|
420
|
-
this.terminal.write(data, () => this.emitSnapshotSoon());
|
|
421
|
-
}
|
|
422
|
-
emitSnapshotSoon(delayMs = SNAPSHOT_DELAY_MS) {
|
|
423
|
-
if (this._disposed || this.notifyTimer)
|
|
424
|
-
return;
|
|
425
|
-
this.notifyTimer = setTimeout(() => {
|
|
426
|
-
this.notifyTimer = null;
|
|
427
|
-
if (this._disposed)
|
|
428
|
-
return;
|
|
429
|
-
this.onSnapshot?.(this.createSnapshot());
|
|
430
|
-
}, delayMs);
|
|
431
|
-
}
|
|
432
|
-
createSnapshot(message = this.message) {
|
|
433
|
-
const buffer = this.terminal.buffer.active;
|
|
434
|
-
const end = buffer.length;
|
|
435
|
-
const start = Math.max(0, end - MAX_SNAPSHOT_LINES);
|
|
436
|
-
const lines = [];
|
|
437
|
-
for (let row = start;row < end; row += 1) {
|
|
438
|
-
const line = buffer.getLine(row);
|
|
439
|
-
lines.push((line?.translateToString(false) ?? "").slice(0, this.cols));
|
|
440
|
-
}
|
|
441
|
-
while (lines.length < this.rows)
|
|
442
|
-
lines.push("");
|
|
443
|
-
return {
|
|
444
|
-
command: this.argv,
|
|
445
|
-
label: this.label,
|
|
446
|
-
status: this.status,
|
|
447
|
-
cols: this.cols,
|
|
448
|
-
rows: this.rows,
|
|
449
|
-
lines,
|
|
450
|
-
message,
|
|
451
|
-
...this.exitCode !== undefined ? { exitCode: this.exitCode } : {},
|
|
452
|
-
...this.signal !== undefined ? { signal: this.signal } : {}
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
// packages/cli/src/commands/_help-catalog.ts
|
|
458
|
-
import pc from "picocolors";
|
|
459
|
-
var PRIMARY_GROUPS = [
|
|
460
|
-
{
|
|
461
|
-
name: "server",
|
|
462
|
-
summary: "Choose, inspect, and start the Rig server that owns tasks and runs.",
|
|
463
|
-
usage: ["rig server <status|list|add|use|repair-link|start> [options]"],
|
|
464
|
-
commands: [
|
|
465
|
-
{ command: "status", description: "Show the selected server and remote project-root link for this repo.", primary: true },
|
|
466
|
-
{ command: "use local", description: "Switch this repo to the local Rig server.", primary: true },
|
|
467
|
-
{ command: "add <alias> <url>", description: "Save a remote Rig server URL.", primary: true },
|
|
468
|
-
{ command: "use <alias>", description: "Select a saved remote server alias.", primary: true },
|
|
469
|
-
{ command: "repair-link [--prepare|--backfill-only] [--repo owner/repo]", description: "Backfill or prepare the selected remote's server-host checkout link.", primary: true },
|
|
470
|
-
{ command: "list", description: "List saved local/remote server aliases.", primary: true },
|
|
471
|
-
{ command: "start [--host <host>] [--port <n>]", description: "Start a local rig-server process." }
|
|
472
|
-
],
|
|
473
|
-
examples: [
|
|
474
|
-
"rig server status",
|
|
475
|
-
"rig server add prod https://where.rig-does.work",
|
|
476
|
-
"rig server use prod",
|
|
477
|
-
"rig server repair-link --repo owner/repo",
|
|
478
|
-
"rig server use local",
|
|
479
|
-
"rig server start --port 3773"
|
|
480
|
-
],
|
|
481
|
-
next: ["Use `rig task list` to see server-owned work.", "Use `rig run list` or `rig run attach <id> --follow` to monitor runs."]
|
|
482
|
-
},
|
|
483
|
-
{
|
|
484
|
-
name: "task",
|
|
485
|
-
summary: "Find work, start Pi-backed runs, and validate task results.",
|
|
486
|
-
usage: ["rig task <list|next|show|run> [options]"],
|
|
487
|
-
commands: [
|
|
488
|
-
{ command: "list [--assignee <login|me|@me>] [--state open|closed]", description: "List tasks from the selected server/source.", primary: true },
|
|
489
|
-
{ command: "next [filters]", description: "Render the next matching task as a selected-task card.", primary: true },
|
|
490
|
-
{ command: "show <id>|--task <id> [--raw]", description: "Show a human task summary; --raw prints the full payload.", primary: true },
|
|
491
|
-
{ command: "run [#<issue>|<task-id>|--next|--task <id>]", description: "Submit a task run; interactive follows with bundled Pi.", primary: true },
|
|
492
|
-
{ command: "ready", description: "List task IDs that are runnable now." },
|
|
493
|
-
{ command: "validate|verify [--task <id>]", description: "Run configured task checks/review gates." },
|
|
494
|
-
{ command: "details --task <id>", description: "Show full task info from the configured source." },
|
|
495
|
-
{ command: "reopen [--task <id> | --all] [--reason <text>]", description: "Reopen closed task(s) in the configured source." },
|
|
496
|
-
{ command: "artifacts|artifact-dir|artifact-write", description: "Inspect or write task artifacts." },
|
|
497
|
-
{ command: "report-bug", description: "Create a structured bug report/task." }
|
|
498
|
-
],
|
|
499
|
-
examples: [
|
|
500
|
-
"rig task list --assignee @me --limit 20",
|
|
501
|
-
"rig task next",
|
|
502
|
-
"rig task show 123 --raw",
|
|
503
|
-
"rig task run --next",
|
|
504
|
-
"rig task run #123 --runtime-adapter pi",
|
|
505
|
-
"rig task run --title 'Investigate deploy drift' --initial-prompt 'Check server health'"
|
|
506
|
-
],
|
|
507
|
-
next: ["Use `--detach` to submit without attaching.", "Use `rig run attach <run-id> --follow` to rejoin a live run."]
|
|
508
|
-
},
|
|
509
|
-
{
|
|
510
|
-
name: "run",
|
|
511
|
-
summary: "Observe, attach to, and control Rig runs. `attach` opens the Pi console \u2014 the full worker session, live.",
|
|
512
|
-
usage: ["rig run <list|status|show|attach|steer|stop|resume|restart> [options]"],
|
|
513
|
-
commands: [
|
|
514
|
-
{ command: "list", description: "List recent runs from the selected server or local state.", primary: true },
|
|
515
|
-
{ command: "status", description: "Render active and recent run groups.", primary: true },
|
|
516
|
-
{ command: "show <id>|--run <id> [--raw]", description: "Show a human run summary; --raw prints the full payload.", primary: true },
|
|
517
|
-
{ command: "attach <run-id>|--run <id>", description: "Open the run's Pi console \u2014 see 'Inside the console' below. Works on live AND finished runs.", primary: true },
|
|
518
|
-
{ command: "steer <run-id> --message <text>", description: "Queue a steering message into a live worker without attaching \u2014 delivered into the agent's context within seconds.", primary: true },
|
|
519
|
-
{ command: "stop [<run-id>|--run <id>]", description: "Request stop for one run or local active runs.", primary: true },
|
|
520
|
-
{ command: "resume [<run-id>]", description: "Resume an interrupted run on the selected server (defaults to the most recent resumable)." },
|
|
521
|
-
{ command: "restart [<run-id>]", description: "Re-dispatch a run from a clean runtime, reopening its Pi session where possible." },
|
|
522
|
-
{ command: "timeline --run <id> [--follow]", description: "Stream raw run timeline events (scripts; humans should attach)." },
|
|
523
|
-
{ command: "replay <run-id>|--run <id> [--with-session]", description: "Print the run's consolidated run.jsonl as a merged timeline; --with-session interleaves the Pi session log." },
|
|
524
|
-
{ command: "delete|cleanup", description: "Remove completed run records/artifacts." }
|
|
525
|
-
],
|
|
526
|
-
examples: [
|
|
527
|
-
"rig run attach <run-id> # full session console \u2014 live mirror, steering, worker shell",
|
|
528
|
-
"rig run steer <run-id> --message 'focus on the failing test first'",
|
|
529
|
-
"rig run list",
|
|
530
|
-
"rig run show <run-id>",
|
|
531
|
-
"rig run stop <run-id>"
|
|
532
|
-
],
|
|
533
|
-
next: [
|
|
534
|
-
"Inside the console: the run's COMPLETE transcript loads on open (finished runs too), and new worker turns stream in live.",
|
|
535
|
-
"Inside the console: plain text = steering into the worker's context \xB7 !<cmd> = shell in the WORKER workspace \xB7 /<cmd> includes the worker session's commands \xB7 /rig abort stops the current turn.",
|
|
536
|
-
"The console is read-write but remote-only: nothing runs on your machine; the worker keeps running when you exit.",
|
|
537
|
-
"Use `rig task run --next` to create a new run; interactive mode drops you straight into its console.",
|
|
538
|
-
"Use `--json` when scripts need the full structured record."
|
|
539
|
-
]
|
|
540
|
-
},
|
|
541
|
-
{
|
|
542
|
-
name: "inbox",
|
|
543
|
-
summary: "Review approval and user-input requests that block worker runs.",
|
|
544
|
-
usage: ["rig inbox <approvals|approve|inputs|respond> [options]"],
|
|
545
|
-
commands: [
|
|
546
|
-
{ command: "approvals [--run <id>] [--task <id>]", description: "List pending approvals.", primary: true },
|
|
547
|
-
{ command: "inputs [--run <id>] [--task <id>]", description: "List pending user-input requests.", primary: true },
|
|
548
|
-
{ command: "approve --run <id> --request <id> --decision approve|reject", description: "Resolve an approval request." },
|
|
549
|
-
{ command: "respond --run <id> --request <id> --answer key=value", description: "Answer a user-input request." }
|
|
550
|
-
],
|
|
551
|
-
examples: [
|
|
552
|
-
"rig inbox approvals",
|
|
553
|
-
"rig inbox inputs --run <run-id>",
|
|
554
|
-
"rig inbox approve --run <run-id> --request <request-id> --decision approve"
|
|
555
|
-
],
|
|
556
|
-
next: ["Rejoin the run after resolving a block: `rig run attach <run-id> --follow`."]
|
|
557
|
-
},
|
|
558
|
-
{
|
|
559
|
-
name: "stats",
|
|
560
|
-
summary: "Fleet metrics computed from on-disk run journals (no server required).",
|
|
561
|
-
usage: ["rig stats [show] [--since <7d|30d|ISO date>]"],
|
|
562
|
-
commands: [
|
|
563
|
-
{ command: "show [--since <window>]", description: "Total runs, completion/failure/needs-attention rates, median run time, steering, stalls, approvals.", primary: true }
|
|
564
|
-
],
|
|
565
|
-
examples: [
|
|
566
|
-
"rig stats",
|
|
567
|
-
"rig stats --since 7d",
|
|
568
|
-
"rig stats --since 2026-06-01 --json"
|
|
569
|
-
],
|
|
570
|
-
next: ["Inspect outliers with `rig run list` and `rig run show <run-id>`.", "Use `--json` for the schema'd envelope (see docs/cli-json.md)."]
|
|
571
|
-
},
|
|
572
|
-
{
|
|
573
|
-
name: "inspect",
|
|
574
|
-
summary: "Inspect logs, artifacts, graphs, failures for a task.",
|
|
575
|
-
usage: ["rig inspect <logs|artifacts|failures|graph|audit|diff> --task <id>"],
|
|
576
|
-
commands: [
|
|
577
|
-
{ command: "logs --task <id>", description: "Latest run log for a task (local or selected server).", primary: true },
|
|
578
|
-
{ command: "artifacts --task <id>", description: "List the task's completion artifacts.", primary: true },
|
|
579
|
-
{ command: "failures --task <id>", description: "Recorded failures for a task.", primary: true },
|
|
580
|
-
{ command: "diff --task <id>", description: "Changed files for a task.", primary: true },
|
|
581
|
-
{ command: "graph", description: "Task dependency graph." },
|
|
582
|
-
{ command: "audit", description: "Controlled-command audit trail." }
|
|
583
|
-
],
|
|
584
|
-
examples: ["rig inspect logs --task <id>", "rig inspect diff --task <id>"],
|
|
585
|
-
next: ["Use `rig stats` for fleet-level metrics across runs."]
|
|
586
|
-
},
|
|
587
|
-
{
|
|
588
|
-
name: "repo",
|
|
589
|
-
summary: "Repository sync/baseline helpers for the Rig-managed checkout.",
|
|
590
|
-
usage: ["rig repo <sync|reset-baseline>"],
|
|
591
|
-
commands: [
|
|
592
|
-
{ command: "sync", description: "Sync project repository state.", primary: true },
|
|
593
|
-
{ command: "reset-baseline", description: "Reset the managed baseline for the repo." }
|
|
594
|
-
],
|
|
595
|
-
examples: ["rig repo sync"]
|
|
596
|
-
},
|
|
597
|
-
{
|
|
598
|
-
name: "plugin",
|
|
599
|
-
summary: "Plugin listing, validation, and plugin-contributed commands.",
|
|
600
|
-
usage: ["rig plugin <list|validate|run> [options]"],
|
|
601
|
-
commands: [
|
|
602
|
-
{ command: "list", description: "List plugins declared in rig.config.ts and their contributions.", primary: true },
|
|
603
|
-
{ command: "validate --task <id>", description: "Run plugin-contributed validators for a task.", primary: true },
|
|
604
|
-
{ command: "run <command-id> [args...]", description: "Execute a plugin-contributed CLI command (also callable as `rig <command-id>`)." }
|
|
605
|
-
],
|
|
606
|
-
examples: ["rig plugin list", "rig plugin run <command-id>"]
|
|
607
|
-
},
|
|
608
|
-
{
|
|
609
|
-
name: "init",
|
|
610
|
-
summary: "Set up Rig for this repo: server, GitHub auth, checkout strategy, task source, and Pi wiring.",
|
|
611
|
-
usage: ["rig init [--yes] [--server local|remote] [--repo owner/repo] [--remote-url <url>]"],
|
|
612
|
-
commands: [
|
|
613
|
-
{ command: "init", description: "Interactive setup wizard for a new or existing Rig repo.", primary: true },
|
|
614
|
-
{ command: "init --demo", description: "Offline demo project: files task source + 3 sample tasks, zero GitHub.", primary: true },
|
|
615
|
-
{ command: "init --yes", description: "Non-interactive setup using detected/default settings.", primary: true },
|
|
616
|
-
{ command: "init --server remote --remote-url <url>", description: "Link this repo to a remote Rig server.", primary: true },
|
|
617
|
-
{ command: "init --repair", description: "Repair missing private state without replacing project config." }
|
|
618
|
-
],
|
|
619
|
-
examples: [
|
|
620
|
-
"rig init",
|
|
621
|
-
"rig init --demo",
|
|
622
|
-
"rig init --yes --repo humanity-org/humanwork",
|
|
623
|
-
"rig init --server remote --remote-url https://where.rig-does.work --repo owner/repo"
|
|
624
|
-
],
|
|
625
|
-
next: ["After init, run `rig server status`.", "Then use `rig task list` and `rig task run --next` for day-to-day work."]
|
|
626
|
-
},
|
|
627
|
-
{
|
|
628
|
-
name: "doctor",
|
|
629
|
-
summary: "Diagnostics for project/server/GitHub/Pi state.",
|
|
630
|
-
usage: ["rig doctor"],
|
|
631
|
-
commands: [
|
|
632
|
-
{ command: "doctor", description: "Run setup and runtime diagnostics.", primary: true },
|
|
633
|
-
{ command: "check", description: "Compatibility spelling for diagnostics." }
|
|
634
|
-
],
|
|
635
|
-
examples: ["rig doctor", "rig doctor --json"],
|
|
636
|
-
next: ["Use `rig server status` and `rig github auth status` to inspect common failure points."]
|
|
637
|
-
},
|
|
638
|
-
{
|
|
639
|
-
name: "github",
|
|
640
|
-
summary: "GitHub auth helpers for the selected Rig server.",
|
|
641
|
-
usage: ["rig github auth <status|import-gh|token>"],
|
|
642
|
-
commands: [
|
|
643
|
-
{ command: "auth status", description: "Show GitHub auth state.", primary: true },
|
|
644
|
-
{ command: "auth import-gh", description: "Import the current `gh` token into the selected server." },
|
|
645
|
-
{ command: "auth token --token <token>", description: "Store a token on the selected server." }
|
|
646
|
-
],
|
|
647
|
-
examples: ["rig github auth status", "rig github auth import-gh"],
|
|
648
|
-
next: ["After auth is valid, use `rig task run --next`."]
|
|
649
|
-
}
|
|
650
|
-
];
|
|
651
|
-
var ADVANCED_GROUPS = [
|
|
652
|
-
{
|
|
653
|
-
name: "setup",
|
|
654
|
-
summary: "Bootstrap/check local setup.",
|
|
655
|
-
usage: ["rig setup <bootstrap|check|preflight>"],
|
|
656
|
-
commands: [
|
|
657
|
-
{ command: "bootstrap", description: "Bootstrap local setup dependencies.", primary: true },
|
|
658
|
-
{ command: "check", description: "Check local setup state (toolchain, deps, config).", primary: true },
|
|
659
|
-
{ command: "preflight", description: "Run preflight checks before a run.", primary: true }
|
|
660
|
-
]
|
|
661
|
-
},
|
|
662
|
-
{
|
|
663
|
-
name: "profile",
|
|
664
|
-
summary: "Runtime profile/model defaults.",
|
|
665
|
-
usage: ["rig profile <show|set>"],
|
|
666
|
-
commands: [
|
|
667
|
-
{ command: "show", description: "Show the active execution profile.", primary: true },
|
|
668
|
-
{ command: "set [--model <model>] [--runtime <runtime>] [--plugin <plugin>]", description: "Set model/runtime/plugin profile defaults.", primary: true }
|
|
669
|
-
]
|
|
670
|
-
},
|
|
671
|
-
{
|
|
672
|
-
name: "review",
|
|
673
|
-
summary: "Inspect or change completion review gate policy.",
|
|
674
|
-
usage: ["rig review <show|set>"],
|
|
675
|
-
commands: [
|
|
676
|
-
{ command: "show", description: "Show current review gate settings." },
|
|
677
|
-
{ command: "set <off|advisory|required> [--provider <provider>]", description: "Change review strictness/provider (e.g. --provider greptile)." }
|
|
678
|
-
],
|
|
679
|
-
examples: ["rig review show", "rig review set required --provider greptile"],
|
|
680
|
-
next: ["Use `rig inbox approvals` for blocked run handoffs."]
|
|
681
|
-
},
|
|
682
|
-
{
|
|
683
|
-
name: "browser",
|
|
684
|
-
summary: "Browser workstation actions for browser-required tasks: launch, check, CDP probe, profile reset, and app-specific smokes.",
|
|
685
|
-
usage: ["rig browser <help|explain|demo|hp-next|cdp-probe|profile-persistence|profile-lock-check|smoke-test> [options]"],
|
|
686
|
-
commands: [
|
|
687
|
-
{ command: "help", description: "Rich browser command help (canonical: `rig browser help`).", primary: true },
|
|
688
|
-
{ command: "explain", description: "Explain the browser-required task contract and runtime helper commands.", primary: true },
|
|
689
|
-
{ command: "demo [--port <n>] [--profile <name>] [--state-dir <path>] [--target-url <url>] [--keep-open] [--no-build]", description: "Run a guided real browser/agent demo flow.", primary: true },
|
|
690
|
-
{ command: "hp-next dev", description: "Start hp-next Rig Browser in dev/watch mode.", primary: true },
|
|
691
|
-
{ command: "hp-next start", description: "Build/start the hp-next browser workstation without watch mode.", primary: true },
|
|
692
|
-
{ command: "hp-next check", description: "Validate the hp-next CDP endpoint on the configured port.", primary: true },
|
|
693
|
-
{ command: "hp-next e2e", description: "Run hp-next browser e2e smoke checks through Rig Browser.", primary: true },
|
|
694
|
-
{ command: "hp-next reset", description: "Reset the hp-next browser profile when stale browser state is suspected.", primary: true },
|
|
695
|
-
{ command: "cdp-probe", description: "Run an isolated CDP attach/evaluate/layout probe." },
|
|
696
|
-
{ command: "profile-persistence", description: "Verify a named browser profile persists browser state." },
|
|
697
|
-
{ command: "profile-lock-check", description: "Verify concurrent launches reject the same profile." },
|
|
698
|
-
{ command: "smoke-test", description: "Run the browser package smoke test." }
|
|
699
|
-
],
|
|
700
|
-
examples: [
|
|
701
|
-
"rig browser help",
|
|
702
|
-
"rig browser hp-next check",
|
|
703
|
-
"rig browser hp-next e2e",
|
|
704
|
-
"rig browser cdp-probe",
|
|
705
|
-
"rig browser profile-lock-check"
|
|
706
|
-
],
|
|
707
|
-
next: ["Inside a task run, use rig-browser-launch, rig-browser-check, and rig-browser-attach-info from the worker PATH."]
|
|
708
|
-
},
|
|
709
|
-
{
|
|
710
|
-
name: "pi",
|
|
711
|
-
summary: "Manage Pi extension packages for this project (community extensions from npm/git).",
|
|
712
|
-
usage: ["rig pi <list|add|remove|search> [args]"],
|
|
713
|
-
commands: [
|
|
714
|
-
{ command: "list", description: "Show project and user Pi extension packages." },
|
|
715
|
-
{ command: "add <source>", description: "Add an npm/git Pi extension to .pi/settings.json (auto-installs at next session)." },
|
|
716
|
-
{ command: "remove <source>", description: "Remove an operator-added Pi extension." },
|
|
717
|
-
{ command: "search [term]", description: "Discover Pi extension packages on the npm registry." }
|
|
718
|
-
],
|
|
719
|
-
examples: ["rig pi search subagents", "rig pi add pi-subagents", "rig pi list"],
|
|
720
|
-
next: ["Config-managed extensions: declare `runtime: { pi: { packages: [...] } }` in rig.config.ts \u2014 workers pick them up automatically."]
|
|
721
|
-
},
|
|
722
|
-
{
|
|
723
|
-
name: "queue",
|
|
724
|
-
summary: "Run task queues locally.",
|
|
725
|
-
usage: ["rig queue run [--workers <n>] [--max-tasks <n>] [--action validate|verify|pipeline] [--isolation off|worktree] [--no-runtime-reuse] [--fail-fast] [--skip-project-sync]"],
|
|
726
|
-
commands: [
|
|
727
|
-
{ command: "run [--workers <n>] [--max-tasks <n>] [--action validate|verify|pipeline] [--isolation off|worktree] [--no-runtime-reuse] [--fail-fast] [--skip-project-sync]", description: "Process queue work: drain matching tasks with N workers, optional per-task action and isolation.", primary: true }
|
|
728
|
-
]
|
|
729
|
-
},
|
|
730
|
-
{
|
|
731
|
-
name: "agent",
|
|
732
|
-
summary: "Runtime agent workspace helpers.",
|
|
733
|
-
usage: ["rig agent <list|prepare|run|cleanup>"],
|
|
734
|
-
commands: [
|
|
735
|
-
{ command: "list", description: "List prepared agent runtimes.", primary: true },
|
|
736
|
-
{ command: "prepare [--id <id>] [--mode <mode>] [--task <task>]", description: "Prepare an isolated agent runtime workspace.", primary: true },
|
|
737
|
-
{ command: "run [--id <id>] [--mode <mode>] [--task <task>] [--skip-project-sync]", description: "Prepare (if needed) and run an agent in its workspace.", primary: true },
|
|
738
|
-
{ command: "cleanup [--all] [--id <id>]", description: "Remove prepared agent workspaces.", primary: true }
|
|
739
|
-
]
|
|
740
|
-
},
|
|
741
|
-
{ name: "inspector", summary: "Event stream and drift scanners.", usage: ["rig inspector <stream|scan-upstream-drift>"], commands: [{ command: "stream", description: "Stream events." }] },
|
|
742
|
-
{
|
|
743
|
-
name: "dist",
|
|
744
|
-
summary: "Build/install packaged Rig CLI.",
|
|
745
|
-
usage: ["rig dist <build|install|doctor|rebuild-agent>"],
|
|
746
|
-
commands: [
|
|
747
|
-
{ command: "build [--output-dir <dir>]", description: "Build the distributable Rig CLI.", primary: true },
|
|
748
|
-
{ command: "install [--scope <scope>] [--path <path>]", description: "Install the built CLI to a scope/path.", primary: true },
|
|
749
|
-
{ command: "doctor", description: "Diagnose the dist toolchain and install state.", primary: true },
|
|
750
|
-
{ command: "rebuild-agent", description: "Rebuild the agent runtime image, pruning stale images.", primary: true }
|
|
751
|
-
]
|
|
752
|
-
},
|
|
753
|
-
{ name: "workspace", summary: "Workspace topology/service helpers.", usage: ["rig workspace <summary|topology|remote-hosts>"], commands: [{ command: "summary", description: "Show workspace summary." }] },
|
|
754
|
-
{
|
|
755
|
-
name: "remote",
|
|
756
|
-
summary: "Compatibility remote orchestration controls.",
|
|
757
|
-
usage: ["rig remote <status|tasks|watch|pause|resume|continue|stop|refresh|add-iterations|remove-iterations|endpoint ...>"],
|
|
758
|
-
commands: [
|
|
759
|
-
{ command: "status [--remote <alias>]", description: "Show the remote orchestration state.", primary: true },
|
|
760
|
-
{ command: "tasks [--remote <alias>]", description: "List the remote's tracked tasks.", primary: true },
|
|
761
|
-
{ command: "watch [--remote <alias>] [--seconds <n>] [--event <type>]", description: "Stream remote orchestration events.", primary: true },
|
|
762
|
-
{ command: "pause [--remote <alias>]", description: "Pause the running remote orchestration.", primary: true },
|
|
763
|
-
{ command: "resume [--remote <alias>] [--max-workers <n>] [--max-iterations <n>] [--direct-merge]", description: "Resume the remote with optional tuning.", primary: true },
|
|
764
|
-
{ command: "continue [--remote <alias>]", description: "Continue a paused remote orchestration.", primary: true },
|
|
765
|
-
{ command: "stop [--remote <alias>]", description: "Stop the remote orchestration.", primary: true },
|
|
766
|
-
{ command: "refresh [--remote <alias>]", description: "Refresh remote state.", primary: true },
|
|
767
|
-
{ command: "add-iterations [--count <n>] [--remote <alias>]", description: "Grant the remote more iterations.", primary: true },
|
|
768
|
-
{ command: "remove-iterations [--count <n>] [--remote <alias>]", description: "Reduce the remote's iteration budget.", primary: true },
|
|
769
|
-
{ command: "endpoint list", description: "List configured remote endpoints.", primary: true },
|
|
770
|
-
{ command: "endpoint add --alias <alias> --host <host> --port <n> [--token <token>]", description: "Register a remote endpoint.", primary: true },
|
|
771
|
-
{ command: "endpoint remove --alias <alias>", description: "Remove a remote endpoint.", primary: true },
|
|
772
|
-
{ command: "endpoint test [--alias <alias>]", description: "Test connectivity to a remote endpoint.", primary: true },
|
|
773
|
-
{ command: "endpoint doctor", description: "Diagnose remote endpoint configuration.", primary: true }
|
|
774
|
-
]
|
|
775
|
-
},
|
|
776
|
-
{ name: "git", summary: "Pass through to Rig git-flow helper.", usage: ["rig git <args...>"], commands: [{ command: "<args...>", description: "Advanced git flow operations." }] },
|
|
777
|
-
{ name: "harness", summary: "Pass through to runtime harness CLI.", usage: ["rig harness <args...>"], commands: [{ command: "<args...>", description: "Advanced harness operations." }] },
|
|
778
|
-
{ name: "test", summary: "Project test wrappers.", usage: ["rig test <unit|e2e|all>"], commands: [{ command: "all", description: "Run configured project tests." }] }
|
|
779
|
-
];
|
|
780
|
-
var ALL_GROUPS = [...PRIMARY_GROUPS, ...ADVANCED_GROUPS];
|
|
781
|
-
|
|
782
|
-
// packages/cli/src/app-opentui/surface-catalog.ts
|
|
783
|
-
var BESPOKE_FAMILIES = new Set([
|
|
784
|
-
"run",
|
|
785
|
-
"task",
|
|
786
|
-
"inbox",
|
|
787
|
-
"server",
|
|
788
|
-
"init",
|
|
789
|
-
"doctor",
|
|
790
|
-
"pi",
|
|
791
|
-
"plugin",
|
|
792
|
-
"repo",
|
|
793
|
-
"workspace",
|
|
794
|
-
"inspect"
|
|
795
|
-
]);
|
|
796
|
-
var SAFE_DIRECT_COMMANDS = new Set([
|
|
797
|
-
"server status",
|
|
798
|
-
"server list",
|
|
799
|
-
"server use local",
|
|
800
|
-
"task list",
|
|
801
|
-
"task next",
|
|
802
|
-
"task ready",
|
|
803
|
-
"run list",
|
|
804
|
-
"run status",
|
|
805
|
-
"inbox approvals",
|
|
806
|
-
"inbox inputs",
|
|
807
|
-
"stats show",
|
|
808
|
-
"plugin list",
|
|
809
|
-
"doctor doctor",
|
|
810
|
-
"doctor check",
|
|
811
|
-
"github auth status",
|
|
812
|
-
"browser help",
|
|
813
|
-
"browser explain",
|
|
814
|
-
"pi list",
|
|
815
|
-
"pi search",
|
|
816
|
-
"setup check",
|
|
817
|
-
"profile show",
|
|
818
|
-
"review show",
|
|
819
|
-
"repo sync",
|
|
820
|
-
"agent list",
|
|
821
|
-
"dist doctor",
|
|
822
|
-
"workspace summary",
|
|
823
|
-
"remote status"
|
|
824
|
-
]);
|
|
825
|
-
|
|
826
|
-
// packages/cli/src/app-opentui/intent.ts
|
|
827
|
-
var NAV_SCENES = new Map([
|
|
828
|
-
["", "main"],
|
|
829
|
-
["main", "main"],
|
|
830
|
-
["home", "main"],
|
|
831
|
-
["fleet", "fleet"],
|
|
832
|
-
["runs", "fleet"],
|
|
833
|
-
["run", "fleet"],
|
|
834
|
-
["tasks", "tasks"],
|
|
835
|
-
["task", "tasks"],
|
|
836
|
-
["inbox", "inbox"],
|
|
837
|
-
["server", "server"],
|
|
838
|
-
["init", "init"],
|
|
839
|
-
["doctor", "doctor"],
|
|
840
|
-
["pi", "pi"],
|
|
841
|
-
["plugin", "plugin"],
|
|
842
|
-
["repo", "repo"],
|
|
843
|
-
["workspace", "workspace"],
|
|
844
|
-
["inspect", "inspect"],
|
|
845
|
-
["help", "help"]
|
|
846
|
-
]);
|
|
847
|
-
var TASK_VIEW_COMMANDS = new Set([
|
|
848
|
-
"",
|
|
849
|
-
"all",
|
|
850
|
-
"open",
|
|
851
|
-
"ready",
|
|
852
|
-
"blocked",
|
|
853
|
-
"closed",
|
|
854
|
-
"done",
|
|
855
|
-
"mine",
|
|
856
|
-
"me",
|
|
857
|
-
"sort",
|
|
858
|
-
"status",
|
|
859
|
-
"state",
|
|
860
|
-
"assignee",
|
|
861
|
-
"assigned",
|
|
862
|
-
"label",
|
|
863
|
-
"search",
|
|
864
|
-
"q"
|
|
865
|
-
]);
|
|
866
|
-
var HOLLOW_FAMILIES = new Set([
|
|
867
|
-
"browser",
|
|
868
|
-
"stats",
|
|
869
|
-
"dist",
|
|
870
|
-
"agent",
|
|
871
|
-
"queue",
|
|
872
|
-
"remote",
|
|
873
|
-
"harness",
|
|
874
|
-
"git",
|
|
875
|
-
"setup",
|
|
876
|
-
"profile",
|
|
877
|
-
"review",
|
|
878
|
-
"inspector",
|
|
879
|
-
"test"
|
|
880
|
-
]);
|
|
881
|
-
|
|
882
|
-
// packages/cli/src/commands/_server-events.ts
|
|
883
|
-
import { WsTransport } from "@rig/client";
|
|
884
|
-
import { RIG_WS_CHANNELS } from "@rig/contracts";
|
|
885
|
-
|
|
886
|
-
// packages/cli/src/runner.ts
|
|
887
|
-
import { EventBus } from "@rig/runtime/control-plane/runtime/events";
|
|
888
|
-
import { CliError as RuntimeCliError } from "@rig/runtime/control-plane/errors";
|
|
889
|
-
import { evaluate, loadPolicy, resolveAction } from "@rig/runtime/control-plane/runtime/guard";
|
|
890
|
-
import { buildBinary } from "@rig/runtime/control-plane/runtime/isolation";
|
|
891
|
-
|
|
892
|
-
// packages/cli/src/commands/_server-client.ts
|
|
893
|
-
import { ensureLocalRigServerConnection } from "@rig/runtime/local-server";
|
|
894
|
-
var scopedGitHubBearerTokens = new Map;
|
|
895
|
-
var serverReachabilityCache = new Map;
|
|
896
|
-
var RESUMABLE_RUN_STATUSES = new Set([
|
|
897
|
-
"created",
|
|
898
|
-
"preparing",
|
|
899
|
-
"running",
|
|
900
|
-
"validating",
|
|
901
|
-
"reviewing",
|
|
902
|
-
"stopped",
|
|
903
|
-
"failed",
|
|
904
|
-
"needs-attention",
|
|
905
|
-
"needs_attention"
|
|
906
|
-
]);
|
|
907
|
-
|
|
908
|
-
// packages/cli/src/app-opentui/drone.ts
|
|
909
|
-
import { RGBA as RGBA2, StyledText as StyledText2, TextAttributes as TextAttributes2 } from "@opentui/core";
|
|
910
|
-
var COLOR = {
|
|
911
|
-
body: RGBA2.fromHex(RIG_UI.lime),
|
|
912
|
-
mini: RGBA2.fromHex(RIG_UI.limeDim),
|
|
913
|
-
rotor: RGBA2.fromHex(RIG_UI.cyan),
|
|
914
|
-
path: RGBA2.fromHex(RIG_UI.cyan),
|
|
915
|
-
eye: RGBA2.fromHex(RIG_UI.ink),
|
|
916
|
-
dim: RGBA2.fromHex(RIG_UI.ink4),
|
|
917
|
-
ink: RGBA2.fromHex(RIG_UI.ink2)
|
|
918
|
-
};
|
|
919
|
-
|
|
920
|
-
// packages/cli/src/app-opentui/render/graphics.ts
|
|
921
|
-
import { FrameBufferRenderable, RGBA as RGBA3 } from "@opentui/core";
|
|
922
|
-
|
|
923
|
-
// packages/cli/src/app-opentui/render/constants.ts
|
|
924
|
-
var LCG_MULTIPLIER = 1664525;
|
|
925
|
-
var LCG_INCREMENT = 1013904223;
|
|
926
|
-
var LCG_DIVISOR = 4294967295;
|
|
927
|
-
var PACKET_CYAN_PROBABILITY = 0.22;
|
|
928
|
-
var LANE_INTERP_STEPS = 32;
|
|
929
|
-
var LANE_LEN_BASE = 0.32;
|
|
930
|
-
var LANE_LEN_SPREAD = 0.42;
|
|
931
|
-
var LANE_CURVE_RANGE = 0.7;
|
|
932
|
-
var PACKET_SPEED_BASE = 0.003;
|
|
933
|
-
var PACKET_SPEED_SPREAD = 0.009;
|
|
934
|
-
var DISPATCH_LANES_COMPACT = 7;
|
|
935
|
-
var DISPATCH_LANES_WIDE = 12;
|
|
936
|
-
var DISPATCH_PACKETS_COMPACT = 70;
|
|
937
|
-
var DISPATCH_PACKETS_WIDE = 150;
|
|
938
|
-
var CARRIER_NODES_COMPACT = 5;
|
|
939
|
-
var CARRIER_NODES_WIDE = 7;
|
|
940
|
-
var LOOP_GATES_COMPACT = 4;
|
|
941
|
-
var LOOP_GATES_WIDE = 5;
|
|
942
|
-
var DISPATCH_DRONES_COMPACT = 4;
|
|
943
|
-
var DISPATCH_DRONES_WIDE = 8;
|
|
944
|
-
var CORE_DISPATCH_X = 0.3;
|
|
945
|
-
var CORE_DISPATCH_Y = 0.45;
|
|
946
|
-
var CORE_CARRIER_X = 0.5;
|
|
947
|
-
var CORE_CARRIER_Y = 0.54;
|
|
948
|
-
var CORE_LOOP_X = 0.09;
|
|
949
|
-
var CORE_LOOP_Y = 0.56;
|
|
950
|
-
var RAIL_YS_LOOP = [0.18, 0.5, 0.82];
|
|
951
|
-
var RAIL_YS_CARRIER = [0.24, 0.54, 0.82];
|
|
952
|
-
var RAIL_YS_DISPATCH = [0.18, 0.58, 0.82];
|
|
953
|
-
var GLOW_FALLOFF_EXP_ASCII = 2.2;
|
|
954
|
-
|
|
955
|
-
// packages/cli/src/app-opentui/render/graphics.ts
|
|
956
|
-
var BRAILLE_SAMPLES_X = 2;
|
|
957
|
-
var BRAILLE_SAMPLES_Y = 4;
|
|
958
|
-
var TRANSPARENT = RGBA3.fromValues(0, 0, 0, 0);
|
|
959
|
-
var BACKDROP = RGBA3.fromHex(RIG_UI.bg);
|
|
960
|
-
var PANEL_BG = RGBA3.fromInts(16, 17, 21, 184);
|
|
961
|
-
var PANEL_HEADER_BG = RGBA3.fromInts(16, 17, 21, 188);
|
|
962
|
-
var PANEL_LINE = RGBA3.fromInts(255, 255, 255, 20);
|
|
963
|
-
var PANEL_LINE_DIM = RGBA3.fromInts(255, 255, 255, 8);
|
|
964
|
-
var PANEL_TEXT_DIM = RGBA3.fromInts(108, 110, 121, 255);
|
|
965
|
-
var AC_RGB = [204, 255, 77];
|
|
966
|
-
var C2_RGB = [86, 216, 255];
|
|
967
|
-
var MG_RGB = [255, 121, 176];
|
|
968
|
-
var INK_RGB = [108, 110, 121];
|
|
969
|
-
var BRAILLE_BITS = [
|
|
970
|
-
[1, 8],
|
|
971
|
-
[2, 16],
|
|
972
|
-
[4, 32],
|
|
973
|
-
[64, 128]
|
|
974
|
-
];
|
|
975
|
-
function sceneKind(scene) {
|
|
976
|
-
if (scene === "tasks")
|
|
977
|
-
return "loop";
|
|
978
|
-
if (scene === "help")
|
|
979
|
-
return "carrier";
|
|
980
|
-
return "dispatch";
|
|
981
|
-
}
|
|
982
|
-
function seeded(seed) {
|
|
983
|
-
let value = seed >>> 0;
|
|
984
|
-
return () => {
|
|
985
|
-
value = value * LCG_MULTIPLIER + LCG_INCREMENT >>> 0;
|
|
986
|
-
return value / LCG_DIVISOR;
|
|
987
|
-
};
|
|
988
|
-
}
|
|
989
|
-
function channelBuffer(canvas, channel) {
|
|
990
|
-
switch (channel) {
|
|
991
|
-
case 0:
|
|
992
|
-
return canvas.ac;
|
|
993
|
-
case 1:
|
|
994
|
-
return canvas.c2;
|
|
995
|
-
case 2:
|
|
996
|
-
return canvas.mg;
|
|
997
|
-
case 3:
|
|
998
|
-
return canvas.ink;
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
function addSample(canvas, channel, x, y, value) {
|
|
1002
|
-
const ix = Math.trunc(x);
|
|
1003
|
-
const iy = Math.trunc(y);
|
|
1004
|
-
if (ix < 0 || iy < 0 || ix >= canvas.width || iy >= canvas.height)
|
|
1005
|
-
return;
|
|
1006
|
-
const buffer = channelBuffer(canvas, channel);
|
|
1007
|
-
const index = iy * canvas.width + ix;
|
|
1008
|
-
buffer[index] = Math.min(1, buffer[index] + value);
|
|
1009
|
-
}
|
|
1010
|
-
function drawDot(canvas, channel, cx, cy, radius, value) {
|
|
1011
|
-
const minX = Math.floor(cx - radius);
|
|
1012
|
-
const maxX = Math.ceil(cx + radius);
|
|
1013
|
-
const minY = Math.floor(cy - radius);
|
|
1014
|
-
const maxY = Math.ceil(cy + radius);
|
|
1015
|
-
for (let y = minY;y <= maxY; y += 1) {
|
|
1016
|
-
for (let x = minX;x <= maxX; x += 1) {
|
|
1017
|
-
const dx = x - cx;
|
|
1018
|
-
const dy = y - cy;
|
|
1019
|
-
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
1020
|
-
if (distance > radius)
|
|
1021
|
-
continue;
|
|
1022
|
-
const falloff = 1 - distance / Math.max(0.001, radius);
|
|
1023
|
-
addSample(canvas, channel, x, y, value * (0.28 + falloff * 0.72));
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
function drawGlow(canvas, channel, cx, cy, radius, value) {
|
|
1028
|
-
const minX = Math.floor(cx - radius);
|
|
1029
|
-
const maxX = Math.ceil(cx + radius);
|
|
1030
|
-
const minY = Math.floor(cy - radius);
|
|
1031
|
-
const maxY = Math.ceil(cy + radius);
|
|
1032
|
-
for (let y = minY;y <= maxY; y += 1) {
|
|
1033
|
-
for (let x = minX;x <= maxX; x += 1) {
|
|
1034
|
-
const dx = x - cx;
|
|
1035
|
-
const dy = y - cy;
|
|
1036
|
-
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
1037
|
-
if (distance > radius)
|
|
1038
|
-
continue;
|
|
1039
|
-
const falloff = Math.pow(1 - distance / Math.max(0.001, radius), GLOW_FALLOFF_EXP_ASCII);
|
|
1040
|
-
addSample(canvas, channel, x, y, value * falloff);
|
|
1041
|
-
}
|
|
1042
|
-
}
|
|
1043
|
-
}
|
|
1044
|
-
function drawLine(canvas, channel, x0, y0, x1, y1, value, width = 0.8) {
|
|
1045
|
-
const dx = x1 - x0;
|
|
1046
|
-
const dy = y1 - y0;
|
|
1047
|
-
const steps = Math.max(1, Math.ceil(Math.hypot(dx, dy) * 1.7));
|
|
1048
|
-
for (let step = 0;step <= steps; step += 1) {
|
|
1049
|
-
const t2 = step / steps;
|
|
1050
|
-
const x = x0 + dx * t2;
|
|
1051
|
-
const y = y0 + dy * t2;
|
|
1052
|
-
drawDot(canvas, channel, x, y, width, value);
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
function drawCircleStroke(canvas, channel, cx, cy, radius, value) {
|
|
1056
|
-
const steps = Math.max(18, Math.ceil(radius * 8));
|
|
1057
|
-
for (let step = 0;step < steps; step += 1) {
|
|
1058
|
-
const a = step / steps * Math.PI * 2;
|
|
1059
|
-
drawDot(canvas, channel, cx + Math.cos(a) * radius, cy + Math.sin(a) * radius, 0.72, value);
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
function paletteColor(ac, c2, mg, ink) {
|
|
1063
|
-
const total = Math.max(0.001, ac + c2 + mg + ink);
|
|
1064
|
-
const r = (AC_RGB[0] * ac + C2_RGB[0] * c2 + MG_RGB[0] * mg + INK_RGB[0] * ink) / total;
|
|
1065
|
-
const g = (AC_RGB[1] * ac + C2_RGB[1] * c2 + MG_RGB[1] * mg + INK_RGB[1] * ink) / total;
|
|
1066
|
-
const b = (AC_RGB[2] * ac + C2_RGB[2] * c2 + MG_RGB[2] * mg + INK_RGB[2] * ink) / total;
|
|
1067
|
-
const intensity = Math.min(1, total / 4);
|
|
1068
|
-
const lift = 0.34 + intensity * 0.66;
|
|
1069
|
-
return RGBA3.fromInts(Math.round(r * lift), Math.round(g * lift), Math.round(b * lift), 255);
|
|
1070
|
-
}
|
|
1071
|
-
function clearCanvas(canvas) {
|
|
1072
|
-
canvas.ac.fill(0);
|
|
1073
|
-
canvas.c2.fill(0);
|
|
1074
|
-
canvas.mg.fill(0);
|
|
1075
|
-
canvas.ink.fill(0);
|
|
1076
|
-
}
|
|
1077
|
-
function makeCanvas(layout) {
|
|
1078
|
-
const width = Math.max(1, layout.width * BRAILLE_SAMPLES_X);
|
|
1079
|
-
const height = Math.max(1, layout.height * BRAILLE_SAMPLES_Y);
|
|
1080
|
-
const size = width * height;
|
|
1081
|
-
return {
|
|
1082
|
-
width,
|
|
1083
|
-
height,
|
|
1084
|
-
ac: new Float32Array(size),
|
|
1085
|
-
c2: new Float32Array(size),
|
|
1086
|
-
mg: new Float32Array(size),
|
|
1087
|
-
ink: new Float32Array(size)
|
|
1088
|
-
};
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
class MarketingGlyphCanvas {
|
|
1092
|
-
rand = seeded(6221137);
|
|
1093
|
-
canvas;
|
|
1094
|
-
layout;
|
|
1095
|
-
activeKind = null;
|
|
1096
|
-
lanes = [];
|
|
1097
|
-
motes = [];
|
|
1098
|
-
packets = [];
|
|
1099
|
-
constructor(layout) {
|
|
1100
|
-
this.layout = layout;
|
|
1101
|
-
this.canvas = makeCanvas(layout);
|
|
1102
|
-
this.reset("dispatch");
|
|
1103
|
-
}
|
|
1104
|
-
resize(layout) {
|
|
1105
|
-
if (layout.width === this.layout.width && layout.height === this.layout.height)
|
|
1106
|
-
return;
|
|
1107
|
-
this.layout = layout;
|
|
1108
|
-
this.canvas = makeCanvas(layout);
|
|
1109
|
-
this.reset(this.activeKind ?? "dispatch");
|
|
1110
|
-
}
|
|
1111
|
-
render(layer, scene, tick) {
|
|
1112
|
-
const kind = sceneKind(scene);
|
|
1113
|
-
if (kind !== this.activeKind)
|
|
1114
|
-
this.reset(kind);
|
|
1115
|
-
clearCanvas(this.canvas);
|
|
1116
|
-
this.drawMarketingRails(kind, tick);
|
|
1117
|
-
if (kind === "loop")
|
|
1118
|
-
this.drawLoop(tick);
|
|
1119
|
-
else if (kind === "carrier")
|
|
1120
|
-
this.drawCarrier(tick);
|
|
1121
|
-
else
|
|
1122
|
-
this.drawDispatch(tick);
|
|
1123
|
-
this.blit(layer);
|
|
1124
|
-
}
|
|
1125
|
-
reset(kind) {
|
|
1126
|
-
this.activeKind = kind;
|
|
1127
|
-
this.lanes = [];
|
|
1128
|
-
this.motes = [];
|
|
1129
|
-
this.packets = [];
|
|
1130
|
-
if (kind === "dispatch")
|
|
1131
|
-
this.setupDispatch();
|
|
1132
|
-
else if (kind === "loop")
|
|
1133
|
-
this.setupLoop();
|
|
1134
|
-
else
|
|
1135
|
-
this.setupCarrier();
|
|
1136
|
-
}
|
|
1137
|
-
setupDispatch() {
|
|
1138
|
-
const count = this.layout.compact ? DISPATCH_LANES_COMPACT : DISPATCH_LANES_WIDE;
|
|
1139
|
-
for (let i = 0;i < count; i += 1) {
|
|
1140
|
-
const ang = (-0.9 + 1.8 * (i / Math.max(1, count - 1))) * (Math.PI * 0.5);
|
|
1141
|
-
this.lanes.push({ ang, len: this.canvas.width * (LANE_LEN_BASE + this.rand() * LANE_LEN_SPREAD), curve: (this.rand() - 0.5) * LANE_CURVE_RANGE, phase: this.rand() * Math.PI * 2 });
|
|
1142
|
-
}
|
|
1143
|
-
const packets = this.layout.compact ? DISPATCH_PACKETS_COMPACT : DISPATCH_PACKETS_WIDE;
|
|
1144
|
-
for (let i = 0;i < packets; i += 1)
|
|
1145
|
-
this.packets.push(this.packet(true));
|
|
1146
|
-
}
|
|
1147
|
-
setupLoop() {
|
|
1148
|
-
const lanes = this.layout.compact ? 4 : 7;
|
|
1149
|
-
for (let i = 0;i < lanes; i += 1)
|
|
1150
|
-
this.packets.push(this.packet(true));
|
|
1151
|
-
}
|
|
1152
|
-
setupCarrier() {
|
|
1153
|
-
const nodes = this.layout.compact ? CARRIER_NODES_COMPACT : CARRIER_NODES_WIDE;
|
|
1154
|
-
for (let i = 0;i < nodes * 6; i += 1)
|
|
1155
|
-
this.packets.push(this.packet(true));
|
|
1156
|
-
}
|
|
1157
|
-
packet(random = false) {
|
|
1158
|
-
return {
|
|
1159
|
-
lane: Math.floor(this.rand() * Math.max(1, this.lanes.length || 7)),
|
|
1160
|
-
p: random ? this.rand() : 0,
|
|
1161
|
-
spd: PACKET_SPEED_BASE + this.rand() * PACKET_SPEED_SPREAD,
|
|
1162
|
-
channel: this.rand() < PACKET_CYAN_PROBABILITY ? 1 : 0,
|
|
1163
|
-
wobble: (this.rand() - 0.5) * 7,
|
|
1164
|
-
size: 0.8 + this.rand() * 1.3
|
|
1165
|
-
};
|
|
1166
|
-
}
|
|
1167
|
-
core(kind) {
|
|
1168
|
-
if (kind === "dispatch")
|
|
1169
|
-
return { x: this.canvas.width * CORE_DISPATCH_X, y: this.canvas.height * CORE_DISPATCH_Y };
|
|
1170
|
-
if (kind === "carrier")
|
|
1171
|
-
return { x: this.canvas.width * CORE_CARRIER_X, y: this.canvas.height * CORE_CARRIER_Y };
|
|
1172
|
-
return { x: this.canvas.width * CORE_LOOP_X, y: this.canvas.height * CORE_LOOP_Y };
|
|
1173
|
-
}
|
|
1174
|
-
lanePoint(lane, p, kind = "dispatch") {
|
|
1175
|
-
const core = this.core(kind);
|
|
1176
|
-
const dist = lane.len * p;
|
|
1177
|
-
const bend = Math.sin(p * Math.PI) * lane.curve * 28;
|
|
1178
|
-
const ux = Math.cos(lane.ang);
|
|
1179
|
-
const uy = Math.sin(lane.ang);
|
|
1180
|
-
return { x: core.x + ux * dist + -uy * bend, y: core.y + uy * dist + ux * bend };
|
|
1181
|
-
}
|
|
1182
|
-
drawMotes(tick) {
|
|
1183
|
-
for (const mote of this.motes) {
|
|
1184
|
-
mote.x += 0.1 * mote.z;
|
|
1185
|
-
if (mote.x > this.canvas.width + 2)
|
|
1186
|
-
mote.x = -2;
|
|
1187
|
-
const alpha = (0.035 + 0.08 * mote.z) * (0.55 + 0.45 * Math.sin(tick * 0.03 + mote.tw));
|
|
1188
|
-
drawDot(this.canvas, mote.channel, mote.x, mote.y, 0.45 * mote.z, alpha);
|
|
1189
|
-
}
|
|
1190
|
-
}
|
|
1191
|
-
drawMarketingRails(kind, tick) {
|
|
1192
|
-
const ys = kind === "loop" ? RAIL_YS_LOOP : kind === "carrier" ? RAIL_YS_CARRIER : RAIL_YS_DISPATCH;
|
|
1193
|
-
ys.forEach((ratio, index) => {
|
|
1194
|
-
const y = this.canvas.height * ratio + Math.sin(tick * 0.018 + index) * 1.8;
|
|
1195
|
-
drawLine(this.canvas, index === 1 ? 0 : 1, this.canvas.width * 0.06, y, this.canvas.width * 0.94, y + Math.sin(index) * 2, index === 1 ? 0.11 : 0.07, 0.55);
|
|
1196
|
-
for (let p = (tick * 0.004 + index * 0.21) % 1;p < 1; p += 0.18 + index * 0.02) {
|
|
1197
|
-
const x = this.canvas.width * (0.06 + 0.88 * p);
|
|
1198
|
-
drawDot(this.canvas, index === 2 ? 1 : 0, x, y, 1 + index * 0.25, 0.24);
|
|
1199
|
-
drawGlow(this.canvas, index === 2 ? 1 : 0, x, y, 3.8, 0.035);
|
|
1200
|
-
}
|
|
1201
|
-
});
|
|
1202
|
-
}
|
|
1203
|
-
drawDispatch(tick) {
|
|
1204
|
-
const core = this.core("dispatch");
|
|
1205
|
-
drawGlow(this.canvas, 0, core.x, core.y, 30, 0.12);
|
|
1206
|
-
drawDot(this.canvas, 0, core.x, core.y, 2.2, 0.85);
|
|
1207
|
-
for (const lane of this.lanes) {
|
|
1208
|
-
let prev = this.lanePoint(lane, 0);
|
|
1209
|
-
for (let i = 1;i <= LANE_INTERP_STEPS; i += 1) {
|
|
1210
|
-
const next = this.lanePoint(lane, i / LANE_INTERP_STEPS);
|
|
1211
|
-
drawLine(this.canvas, lane.phase > Math.PI ? 1 : 0, prev.x, prev.y, next.x, next.y, 0.045, 0.38);
|
|
1212
|
-
prev = next;
|
|
1213
|
-
}
|
|
1214
|
-
}
|
|
1215
|
-
for (const packet of this.packets) {
|
|
1216
|
-
packet.p += packet.spd;
|
|
1217
|
-
if (packet.p > 1)
|
|
1218
|
-
Object.assign(packet, this.packet(false));
|
|
1219
|
-
const lane = this.lanes[packet.lane % Math.max(1, this.lanes.length)];
|
|
1220
|
-
if (!lane)
|
|
1221
|
-
continue;
|
|
1222
|
-
const pt = this.lanePoint(lane, packet.p);
|
|
1223
|
-
const fade = packet.p < 0.1 ? packet.p / 0.1 : packet.p > 0.88 ? (1 - packet.p) / 0.12 : 1;
|
|
1224
|
-
const y = pt.y + packet.wobble * Math.sin(packet.p * Math.PI * 2);
|
|
1225
|
-
drawLine(this.canvas, packet.channel, pt.x - 4, y - 1, pt.x, y, 0.08 * fade, 0.38);
|
|
1226
|
-
drawDot(this.canvas, packet.channel, pt.x, y, packet.size, 0.5 * fade);
|
|
1227
|
-
drawGlow(this.canvas, packet.channel, pt.x, y, packet.size * 4, 0.045 * fade);
|
|
1228
|
-
}
|
|
1229
|
-
for (let i = 0;i < (this.layout.compact ? DISPATCH_DRONES_COMPACT : DISPATCH_DRONES_WIDE); i += 1) {
|
|
1230
|
-
const lane = this.lanes[i % Math.max(1, this.lanes.length)];
|
|
1231
|
-
if (!lane)
|
|
1232
|
-
continue;
|
|
1233
|
-
const p = (tick * 0.002 + i * 0.13) % 1;
|
|
1234
|
-
const pt = this.lanePoint(lane, p);
|
|
1235
|
-
this.drawDrone(pt.x, pt.y + Math.sin(tick * 0.04 + i) * 2, 2.6 + i % 2 * 0.6, tick + i * 11, i % 3 === 0 ? 1 : 0);
|
|
1236
|
-
}
|
|
1237
|
-
}
|
|
1238
|
-
drawLoop(tick) {
|
|
1239
|
-
const y = this.canvas.height * 0.56;
|
|
1240
|
-
const x0 = this.canvas.width * 0.09;
|
|
1241
|
-
const x1 = this.canvas.width * 0.91;
|
|
1242
|
-
drawLine(this.canvas, 0, x0, y, x1, y, 0.12, 0.55);
|
|
1243
|
-
const gates = this.layout.compact ? LOOP_GATES_COMPACT : LOOP_GATES_WIDE;
|
|
1244
|
-
const active = Math.floor(tick / 16) % gates;
|
|
1245
|
-
for (let i = 0;i < gates; i += 1) {
|
|
1246
|
-
const x = x0 + (x1 - x0) * (i / Math.max(1, gates - 1));
|
|
1247
|
-
drawLine(this.canvas, i === active ? 0 : 3, x, y - 22, x, y + 22, i === active ? 0.25 : 0.08, i === active ? 0.7 : 0.42);
|
|
1248
|
-
drawDot(this.canvas, i <= active ? 0 : 3, x, y, i === active ? 2.2 : 1.2, i === active ? 0.72 : 0.25);
|
|
1249
|
-
drawCircleStroke(this.canvas, i <= active ? 0 : 3, x, y, i === active ? 4.2 : 2.4, i === active ? 0.18 : 0.08);
|
|
1250
|
-
}
|
|
1251
|
-
for (const packet of this.packets) {
|
|
1252
|
-
packet.p += packet.spd * 0.7;
|
|
1253
|
-
if (packet.p > 1)
|
|
1254
|
-
packet.p = 0;
|
|
1255
|
-
const x = x0 + (x1 - x0) * packet.p;
|
|
1256
|
-
const segment = Math.min(gates - 1, Math.floor(packet.p * gates));
|
|
1257
|
-
const channel = segment < active ? 0 : segment === active ? 1 : 3;
|
|
1258
|
-
const py = y + packet.wobble * Math.sin(packet.p * Math.PI * 2);
|
|
1259
|
-
drawLine(this.canvas, channel, x - 6, py, x, py, 0.1, 0.42);
|
|
1260
|
-
drawDot(this.canvas, channel, x, py, packet.size, channel === 3 ? 0.22 : 0.58);
|
|
1261
|
-
drawGlow(this.canvas, channel, x, py, 3.8, channel === 3 ? 0.02 : 0.04);
|
|
1262
|
-
}
|
|
1263
|
-
this.drawDrone(x0 + (x1 - x0) * (tick * 0.003 % 1), y - 18, 2.7, tick, 0);
|
|
1264
|
-
this.drawDrone(x0 + (x1 - x0) * ((tick * 0.002 + 0.5) % 1), y + 16, 2.2, tick + 40, 2);
|
|
1265
|
-
}
|
|
1266
|
-
drawCarrier(tick) {
|
|
1267
|
-
const core = this.core("carrier");
|
|
1268
|
-
drawGlow(this.canvas, 0, core.x, core.y, 26, 0.12);
|
|
1269
|
-
drawDot(this.canvas, 0, core.x, core.y, 2.4, 0.92);
|
|
1270
|
-
drawCircleStroke(this.canvas, 0, core.x, core.y, 8 + Math.sin(tick * 0.06) * 2, 0.14);
|
|
1271
|
-
const nodes = this.layout.compact ? CARRIER_NODES_COMPACT : CARRIER_NODES_WIDE;
|
|
1272
|
-
const rx = this.canvas.width * 0.36;
|
|
1273
|
-
const ry = this.canvas.height * 0.22;
|
|
1274
|
-
for (let i = 0;i < nodes; i += 1) {
|
|
1275
|
-
const a = i / nodes * Math.PI * 2 - Math.PI / 2 + tick * 0.006;
|
|
1276
|
-
const x = core.x + Math.cos(a) * rx;
|
|
1277
|
-
const y = core.y + Math.sin(a) * ry;
|
|
1278
|
-
drawLine(this.canvas, i % 2 ? 1 : 0, core.x, core.y, x, y, 0.055, 0.36);
|
|
1279
|
-
drawCircleStroke(this.canvas, i % 2 ? 1 : 0, x, y, 4.2, 0.15);
|
|
1280
|
-
drawDot(this.canvas, i % 2 ? 1 : 0, x, y, 1.7, 0.62);
|
|
1281
|
-
this.drawDrone(x, y - 8, 2.1, tick + i * 9, i % 2 ? 1 : 0);
|
|
1282
|
-
}
|
|
1283
|
-
for (const packet of this.packets) {
|
|
1284
|
-
packet.p += packet.spd;
|
|
1285
|
-
if (packet.p > 1)
|
|
1286
|
-
packet.p = 0;
|
|
1287
|
-
const lane = packet.lane % nodes;
|
|
1288
|
-
const a = lane / nodes * Math.PI * 2 - Math.PI / 2 + tick * 0.006;
|
|
1289
|
-
const nx = core.x + Math.cos(a) * rx;
|
|
1290
|
-
const ny = core.y + Math.sin(a) * ry;
|
|
1291
|
-
const x = core.x + (nx - core.x) * packet.p;
|
|
1292
|
-
const y = core.y + (ny - core.y) * packet.p;
|
|
1293
|
-
drawDot(this.canvas, packet.channel, x, y, packet.size, 0.48);
|
|
1294
|
-
drawGlow(this.canvas, packet.channel, x, y, 3.2, 0.035);
|
|
1295
|
-
}
|
|
1296
|
-
}
|
|
1297
|
-
drawDrone(x, y, scale, tick, channel) {
|
|
1298
|
-
const wobble = Math.sin(tick * 0.08) * 0.7;
|
|
1299
|
-
drawDot(this.canvas, channel, x, y + wobble, scale, 0.58);
|
|
1300
|
-
drawDot(this.canvas, 3, x, y + wobble, Math.max(0.6, scale * 0.28), 0.42);
|
|
1301
|
-
const rotor = scale * 1.75;
|
|
1302
|
-
const arms = [
|
|
1303
|
-
[-rotor, -rotor * 0.75],
|
|
1304
|
-
[rotor, -rotor * 0.75],
|
|
1305
|
-
[-rotor, rotor * 0.75],
|
|
1306
|
-
[rotor, rotor * 0.75]
|
|
1307
|
-
];
|
|
1308
|
-
for (const [dx, dy] of arms) {
|
|
1309
|
-
drawLine(this.canvas, channel, x, y + wobble, x + dx, y + dy + wobble, 0.11, 0.38);
|
|
1310
|
-
drawCircleStroke(this.canvas, channel, x + dx, y + dy + wobble, scale * (0.65 + Math.abs(Math.sin(tick * 0.18)) * 0.25), 0.16);
|
|
1311
|
-
drawDot(this.canvas, channel, x + dx, y + dy + wobble, 0.7, 0.25);
|
|
1312
|
-
}
|
|
1313
|
-
drawLine(this.canvas, channel === 1 ? 0 : 1, x - rotor * 2.4, y + wobble + 1.2, x - rotor * 1.2, y + wobble, 0.05, 0.35);
|
|
1314
|
-
}
|
|
1315
|
-
blit(layer) {
|
|
1316
|
-
const fb = layer.frameBuffer;
|
|
1317
|
-
fb.clear(BACKDROP);
|
|
1318
|
-
const { width, height, ac, c2, mg, ink } = this.canvas;
|
|
1319
|
-
for (let cy = 0;cy < this.layout.height; cy += 1) {
|
|
1320
|
-
for (let cx = 0;cx < this.layout.width; cx += 1) {
|
|
1321
|
-
let bits = 0;
|
|
1322
|
-
let acSum = 0;
|
|
1323
|
-
let c2Sum = 0;
|
|
1324
|
-
let mgSum = 0;
|
|
1325
|
-
let inkSum = 0;
|
|
1326
|
-
for (let sy = 0;sy < BRAILLE_SAMPLES_Y; sy += 1) {
|
|
1327
|
-
for (let sx = 0;sx < BRAILLE_SAMPLES_X; sx += 1) {
|
|
1328
|
-
const px = cx * BRAILLE_SAMPLES_X + sx;
|
|
1329
|
-
const py = cy * BRAILLE_SAMPLES_Y + sy;
|
|
1330
|
-
if (px >= width || py >= height)
|
|
1331
|
-
continue;
|
|
1332
|
-
const index = py * width + px;
|
|
1333
|
-
const a = ac[index];
|
|
1334
|
-
const c = c2[index];
|
|
1335
|
-
const m = mg[index];
|
|
1336
|
-
const k = ink[index];
|
|
1337
|
-
const total2 = a + c + m + k;
|
|
1338
|
-
acSum += a;
|
|
1339
|
-
c2Sum += c;
|
|
1340
|
-
mgSum += m;
|
|
1341
|
-
inkSum += k;
|
|
1342
|
-
if (total2 > 0.11)
|
|
1343
|
-
bits |= BRAILLE_BITS[sy][sx];
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
const total = acSum + c2Sum + mgSum + inkSum;
|
|
1347
|
-
if (bits === 0 || total <= 0.02)
|
|
1348
|
-
continue;
|
|
1349
|
-
const char = String.fromCharCode(10240 + bits);
|
|
1350
|
-
fb.setCellWithAlphaBlending(cx, cy, char, paletteColor(acSum, c2Sum, mgSum, inkSum), TRANSPARENT);
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
// packages/cli/src/app-opentui/fleet-stats.ts
|
|
1357
|
-
var ACTIVE_STATUSES = new Set([
|
|
1358
|
-
"running",
|
|
1359
|
-
"preparing",
|
|
1360
|
-
"created",
|
|
1361
|
-
"validating",
|
|
1362
|
-
"reviewing",
|
|
1363
|
-
"closing-out",
|
|
1364
|
-
"stopping",
|
|
1365
|
-
"loading"
|
|
1366
|
-
]);
|
|
1367
|
-
|
|
1368
|
-
// packages/cli/src/app-opentui/render/text.ts
|
|
1369
|
-
import { RGBA as RGBA4, TextAttributes as TextAttributes3, TextRenderable as TextRenderable2 } from "@opentui/core";
|
|
1370
|
-
|
|
1371
|
-
// packages/cli/src/app-opentui/render/hover.ts
|
|
1372
|
-
var listeners = new Set;
|
|
1373
|
-
|
|
1374
|
-
// packages/cli/src/app-opentui/render/text.ts
|
|
1375
|
-
var TRANSPARENT2 = RGBA4.fromInts(0, 0, 0, 0);
|
|
1376
|
-
var HOVER_BG = RGBA4.fromHex(RIG_UI.hover);
|
|
1377
|
-
|
|
1378
|
-
// packages/cli/src/app-opentui/render/panels.ts
|
|
1379
|
-
import { RGBA as RGBA5, ScrollBoxRenderable } from "@opentui/core";
|
|
1380
|
-
var TRANSPARENT3 = RGBA5.fromInts(0, 0, 0, 0);
|
|
1381
|
-
var PANEL_BORDER = hexToRgba(RIG_UI.border, 255);
|
|
1382
|
-
function hexToRgba(hex, alpha) {
|
|
1383
|
-
const clean = hex.replace(/^#/, "");
|
|
1384
|
-
const full = clean.length === 3 ? clean.split("").map((part) => `${part}${part}`).join("") : clean;
|
|
1385
|
-
const value = Number.parseInt(full, 16);
|
|
1386
|
-
if (!Number.isFinite(value))
|
|
1387
|
-
return RGBA5.fromInts(14, 15, 17, alpha);
|
|
1388
|
-
return RGBA5.fromInts(value >> 16 & 255, value >> 8 & 255, value & 255, alpha);
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
|
-
// packages/cli/src/app-opentui/render/native-host.ts
|
|
1392
|
-
import {
|
|
1393
|
-
BoxRenderable as BoxRenderable2,
|
|
1394
|
-
CodeRenderable,
|
|
1395
|
-
DiffRenderable,
|
|
1396
|
-
RGBA as RGBA6,
|
|
1397
|
-
ScrollBoxRenderable as ScrollBoxRenderable2,
|
|
1398
|
-
SyntaxStyle,
|
|
1399
|
-
TextRenderable as TextRenderable3,
|
|
1400
|
-
TextTableRenderable
|
|
1401
|
-
} from "@opentui/core";
|
|
1402
|
-
|
|
1403
|
-
// packages/cli/src/app-opentui/remote-link.ts
|
|
1404
|
-
var REPAIRABLE_REMOTE_LINK_STATUSES = new Set([
|
|
1405
|
-
"auth_required",
|
|
1406
|
-
"project_not_registered",
|
|
1407
|
-
"no_server_checkout",
|
|
1408
|
-
"invalid_root",
|
|
1409
|
-
"needs_prepare",
|
|
1410
|
-
"error"
|
|
1411
|
-
]);
|
|
1412
|
-
|
|
1413
|
-
// packages/cli/src/app-opentui/runtime.ts
|
|
1414
|
-
var PRELOADER_BACKDROP = RGBA7.fromHex(RIG_UI.bg);
|
|
1415
|
-
function inboxPendingCount(state) {
|
|
1416
|
-
const inbox = state.data.inbox;
|
|
1417
|
-
if (!inbox || typeof inbox !== "object" || Array.isArray(inbox))
|
|
1418
|
-
return 0;
|
|
1419
|
-
const record = inbox;
|
|
1420
|
-
const approvals = Array.isArray(record.approvals) ? record.approvals.length : 0;
|
|
1421
|
-
const inputs = Array.isArray(record.inputs) ? record.inputs.length : 0;
|
|
1422
|
-
return approvals + inputs;
|
|
1423
|
-
}
|
|
1424
|
-
var PRIMARY_NAV = [
|
|
1425
|
-
{ id: "cockpit", label: "Cockpit", scene: "main", argv: ["main"], enterLabel: "Cockpit", member: ["main"] },
|
|
1426
|
-
{ id: "runs", label: "Runs", scene: "fleet", argv: ["runs"], enterLabel: "Runs", member: ["fleet", "run-detail", "inspect", "handoff"] },
|
|
1427
|
-
{ id: "tasks", label: "Tasks", scene: "tasks", argv: ["tasks"], enterLabel: "Tasks", member: ["tasks"] },
|
|
1428
|
-
{ id: "inbox", label: "Inbox", scene: "inbox", argv: ["inbox"], enterLabel: "Inbox", member: ["inbox"], badge: inboxPendingCount },
|
|
1429
|
-
{ id: "stats", label: "Stats", scene: "family", argv: ["stats"], enterLabel: "Stats", member: ["family"] },
|
|
1430
|
-
{ id: "init", label: "Init", scene: "init", argv: ["init"], enterLabel: "Init", member: ["init", "doctor", "server", "pi", "plugin", "repo", "workspace"] },
|
|
1431
|
-
{ id: "help", label: "Help", scene: "help", argv: ["help"], enterLabel: "Help", member: ["help"] }
|
|
1432
|
-
];
|
|
1433
|
-
function activeNavSection(scene) {
|
|
1434
|
-
return PRIMARY_NAV.find((section) => section.member.includes(scene)) ?? PRIMARY_NAV[0];
|
|
1435
|
-
}
|
|
1436
|
-
function sceneSectionLabel(scene) {
|
|
1437
|
-
const labels = {
|
|
1438
|
-
main: "cockpit",
|
|
1439
|
-
fleet: "runs",
|
|
1440
|
-
tasks: "tasks",
|
|
1441
|
-
inbox: "inbox",
|
|
1442
|
-
inspect: "inspect",
|
|
1443
|
-
"run-detail": "run",
|
|
1444
|
-
handoff: "pi console",
|
|
1445
|
-
server: "server",
|
|
1446
|
-
doctor: "doctor",
|
|
1447
|
-
init: "init",
|
|
1448
|
-
pi: "pi",
|
|
1449
|
-
plugin: "plugins",
|
|
1450
|
-
repo: "repo",
|
|
1451
|
-
workspace: "workspace",
|
|
1452
|
-
family: "family",
|
|
1453
|
-
command: "command",
|
|
1454
|
-
help: "help",
|
|
1455
|
-
error: "error"
|
|
1456
|
-
};
|
|
1457
|
-
return labels[scene] ?? scene;
|
|
1458
|
-
}
|
|
1459
|
-
function buildNavStrip(state) {
|
|
1460
|
-
const active = activeNavSection(state.scene);
|
|
1461
|
-
const chunks = [];
|
|
1462
|
-
PRIMARY_NAV.forEach((section, index) => {
|
|
1463
|
-
if (index > 0)
|
|
1464
|
-
chunks.push(styles.ink4(" "));
|
|
1465
|
-
const isActive = section.id === active.id;
|
|
1466
|
-
chunks.push(isActive ? otuiBold(styles.lime(section.label)) : styles.ink3(section.label));
|
|
1467
|
-
const badgeCount = section.badge ? section.badge(state) : 0;
|
|
1468
|
-
if (badgeCount > 0) {
|
|
1469
|
-
chunks.push(styles.ink4(" "));
|
|
1470
|
-
chunks.push(otuiBold(styles.yellow(String(badgeCount))));
|
|
1471
|
-
}
|
|
1472
|
-
});
|
|
1473
|
-
return new StyledText3(chunks);
|
|
1474
|
-
}
|
|
1475
|
-
var DESTRUCTIVE_ACTION_KINDS = new Set(["run-stop", "inbox-reject"]);
|
|
1476
|
-
|
|
1477
|
-
// packages/cli/src/app-opentui/react/ChromeHost.tsx
|
|
1478
|
-
function isTerminalScene(scene) {
|
|
1479
|
-
return scene === "handoff" || scene === "command";
|
|
1480
|
-
}
|
|
1481
|
-
function ChromeHost(props) {
|
|
1482
|
-
const renderer = useRenderer();
|
|
1483
|
-
const dims = useTerminalDimensions();
|
|
1484
|
-
const navRef = useRef(null);
|
|
1485
|
-
const barRef = useRef(null);
|
|
1486
|
-
useEffect(() => {
|
|
1487
|
-
const nav = new TextRenderable5(renderer, { id: "react-primary-nav", content: "", position: "absolute", left: 0, top: -2, width: 1, zIndex: 9, selectable: false });
|
|
1488
|
-
renderer.root.add(nav);
|
|
1489
|
-
navRef.current = nav;
|
|
1490
|
-
const bar = createTypeBar(renderer);
|
|
1491
|
-
renderer.root.add(bar.background);
|
|
1492
|
-
renderer.root.add(bar.prefix);
|
|
1493
|
-
renderer.root.add(bar.input);
|
|
1494
|
-
renderer.root.add(bar.footer);
|
|
1495
|
-
barRef.current = bar;
|
|
1496
|
-
return () => {
|
|
1497
|
-
try {
|
|
1498
|
-
renderer.root.remove(nav.id);
|
|
1499
|
-
} catch {}
|
|
1500
|
-
for (const r of [bar.background, bar.prefix, bar.input, bar.footer]) {
|
|
1501
|
-
try {
|
|
1502
|
-
renderer.root.remove(r.id);
|
|
1503
|
-
} catch {}
|
|
1504
|
-
}
|
|
1505
|
-
navRef.current = null;
|
|
1506
|
-
barRef.current = null;
|
|
1507
|
-
};
|
|
1508
|
-
}, [renderer]);
|
|
1509
|
-
useEffect(() => {
|
|
1510
|
-
const { state, frame } = props;
|
|
1511
|
-
const layout = computeStageLayout(dims.width, dims.height);
|
|
1512
|
-
const nav = navRef.current;
|
|
1513
|
-
const bar = barRef.current;
|
|
1514
|
-
const terminalActive = isTerminalScene(state.scene);
|
|
1515
|
-
const showNav = !frame.fullScreen && !terminalActive && state.typeBar.mode !== "command";
|
|
1516
|
-
if (nav) {
|
|
1517
|
-
nav.visible = showNav;
|
|
1518
|
-
if (showNav) {
|
|
1519
|
-
nav.content = buildNavStrip(state);
|
|
1520
|
-
nav.left = layout.centerLeft;
|
|
1521
|
-
nav.top = Math.max(0, layout.centerTop - 2);
|
|
1522
|
-
nav.width = layout.centerWidth;
|
|
1523
|
-
nav.fg = RIG_UI.ink3;
|
|
1524
|
-
nav.zIndex = 9;
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
if (bar) {
|
|
1528
|
-
if (frame.hideTypeBar) {
|
|
1529
|
-
hideTypeBar(bar, layout.height);
|
|
1530
|
-
} else {
|
|
1531
|
-
positionTypeBar(bar, { ...state.typeBar, placeholder: frame.typeBarPlaceholder ?? state.typeBar.placeholder }, { section: sceneSectionLabel(state.scene), ...state.footer, ...frame.footer ?? {} }, layout.width, layout.typeBarTop, layout.footerTop);
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
});
|
|
1535
|
-
return null;
|
|
1536
|
-
}
|
|
1537
|
-
export {
|
|
1538
|
-
ChromeHost
|
|
1539
|
-
};
|