@h-rig/cli 0.0.6-alpha.87 → 0.0.6-alpha.89
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/rig.js +1380 -865
- package/dist/src/app/board.js +462 -48
- package/dist/src/app-opentui/adapters/common.d.ts +3 -0
- package/dist/src/app-opentui/adapters/common.js +4 -0
- package/dist/src/app-opentui/adapters/doctor.js +458 -46
- package/dist/src/app-opentui/adapters/family.js +701 -151
- package/dist/src/app-opentui/adapters/fleet.js +477 -46
- package/dist/src/app-opentui/adapters/inbox.js +477 -46
- package/dist/src/app-opentui/adapters/init.js +497 -74
- package/dist/src/app-opentui/adapters/inspect.js +477 -46
- package/dist/src/app-opentui/adapters/pi-attach.d.ts +7 -0
- package/dist/src/app-opentui/adapters/pi-attach.js +1004 -519
- package/dist/src/app-opentui/adapters/run-detail.js +477 -46
- package/dist/src/app-opentui/adapters/server.d.ts +26 -0
- package/dist/src/app-opentui/adapters/server.js +676 -59
- package/dist/src/app-opentui/adapters/tasks.js +621 -549
- package/dist/src/app-opentui/autocomplete.js +4 -2
- package/dist/src/app-opentui/bootstrap.js +1376 -861
- package/dist/src/app-opentui/command-palette.js +37 -10
- package/dist/src/app-opentui/index.js +632 -528
- package/dist/src/app-opentui/intent.js +33 -8
- package/dist/src/app-opentui/keymap.js +43 -414
- package/dist/src/app-opentui/pi-host-child.js +496 -57
- package/dist/src/app-opentui/pi-pty-host.d.ts +14 -64
- package/dist/src/app-opentui/pi-pty-host.js +3 -397
- package/dist/src/app-opentui/react/App.js +144 -469
- package/dist/src/app-opentui/react/ChromeHost.js +44 -415
- package/dist/src/app-opentui/react/launch.js +659 -552
- package/dist/src/app-opentui/react/nav.js +1 -1
- package/dist/src/app-opentui/registry.js +1181 -742
- package/dist/src/app-opentui/remote-link.d.ts +10 -0
- package/dist/src/app-opentui/remote-link.js +47 -0
- package/dist/src/app-opentui/render/terminal-handoff.d.ts +16 -0
- package/dist/src/app-opentui/render/terminal-handoff.js +14 -0
- package/dist/src/app-opentui/runtime.js +632 -528
- package/dist/src/app-opentui/scenes/doctor.js +1 -1
- package/dist/src/app-opentui/scenes/error.js +50 -4
- package/dist/src/app-opentui/scenes/family.js +60 -6
- package/dist/src/app-opentui/scenes/fleet.js +65 -13
- package/dist/src/app-opentui/scenes/help.js +4 -2
- package/dist/src/app-opentui/scenes/init.js +12 -12
- package/dist/src/app-opentui/scenes/main.js +7 -7
- package/dist/src/app-opentui/scenes/server.js +83 -11
- package/dist/src/app-opentui/scenes/tasks.js +79 -16
- package/dist/src/app-opentui/state.js +25 -5
- package/dist/src/app-opentui/surface-catalog.js +4 -2
- package/dist/src/app-opentui/types.d.ts +1 -1
- package/dist/src/commands/_cli-format.d.ts +10 -1
- package/dist/src/commands/_cli-format.js +5 -2
- package/dist/src/commands/_connection-state.d.ts +11 -1
- package/dist/src/commands/_connection-state.js +50 -5
- package/dist/src/commands/_doctor-checks.js +458 -46
- package/dist/src/commands/_help-catalog.js +4 -2
- package/dist/src/commands/_json-output.js +4 -0
- package/dist/src/commands/_operator-view.js +496 -57
- package/dist/src/commands/_pi-frontend.d.ts +25 -0
- package/dist/src/commands/_pi-frontend.js +497 -57
- package/dist/src/commands/_preflight.js +509 -72
- package/dist/src/commands/_server-client.d.ts +33 -0
- package/dist/src/commands/_server-client.js +477 -46
- package/dist/src/commands/_server-events.js +446 -41
- package/dist/src/commands/_snapshot-upload.js +460 -48
- package/dist/src/commands/connect.js +620 -15
- package/dist/src/commands/doctor.js +458 -46
- package/dist/src/commands/github.js +462 -50
- package/dist/src/commands/inbox.js +458 -46
- package/dist/src/commands/init.js +497 -74
- package/dist/src/commands/inspect.js +458 -46
- package/dist/src/commands/run.js +496 -57
- package/dist/src/commands/server.js +647 -163
- package/dist/src/commands/setup.js +463 -51
- package/dist/src/commands/stats.js +462 -48
- package/dist/src/commands/task-run-driver.js +464 -52
- package/dist/src/commands/task.js +551 -85
- package/dist/src/commands.js +701 -151
- package/dist/src/index.js +705 -151
- package/dist/src/launcher.js +4 -0
- package/package.json +8 -8
|
@@ -225,7 +225,7 @@ function formatFooter(footer, width) {
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
// packages/cli/src/app-opentui/runtime.ts
|
|
228
|
-
import { BoxRenderable as BoxRenderable3, RGBA as
|
|
228
|
+
import { BoxRenderable as BoxRenderable3, RGBA as RGBA7, StyledText as StyledText3, TextRenderable as TextRenderable4, createCliRenderer } from "@opentui/core";
|
|
229
229
|
|
|
230
230
|
// packages/cli/src/app-opentui/command-pty-host.ts
|
|
231
231
|
import { basename } from "path";
|
|
@@ -460,12 +460,13 @@ var PRIMARY_GROUPS = [
|
|
|
460
460
|
{
|
|
461
461
|
name: "server",
|
|
462
462
|
summary: "Choose, inspect, and start the Rig server that owns tasks and runs.",
|
|
463
|
-
usage: ["rig server <status|list|add|use|start> [options]"],
|
|
463
|
+
usage: ["rig server <status|list|add|use|repair-link|start> [options]"],
|
|
464
464
|
commands: [
|
|
465
|
-
{ command: "status", description: "Show the selected server for this repo.", primary: true },
|
|
465
|
+
{ command: "status", description: "Show the selected server and remote project-root link for this repo.", primary: true },
|
|
466
466
|
{ command: "use local", description: "Switch this repo to the local Rig server.", primary: true },
|
|
467
467
|
{ command: "add <alias> <url>", description: "Save a remote Rig server URL.", primary: true },
|
|
468
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 },
|
|
469
470
|
{ command: "list", description: "List saved local/remote server aliases.", primary: true },
|
|
470
471
|
{ command: "start [--host <host>] [--port <n>]", description: "Start a local rig-server process." }
|
|
471
472
|
],
|
|
@@ -473,6 +474,7 @@ var PRIMARY_GROUPS = [
|
|
|
473
474
|
"rig server status",
|
|
474
475
|
"rig server add prod https://where.rig-does.work",
|
|
475
476
|
"rig server use prod",
|
|
477
|
+
"rig server repair-link --repo owner/repo",
|
|
476
478
|
"rig server use local",
|
|
477
479
|
"rig server start --port 3773"
|
|
478
480
|
],
|
|
@@ -877,389 +879,6 @@ var HOLLOW_FAMILIES = new Set([
|
|
|
877
879
|
"test"
|
|
878
880
|
]);
|
|
879
881
|
|
|
880
|
-
// packages/cli/src/app-opentui/pi-pty-host.ts
|
|
881
|
-
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
882
|
-
import { basename as basename2 } from "path";
|
|
883
|
-
import { RGBA as RGBA2, StyledText as StyledText2, TextAttributes as TextAttributes2 } from "@opentui/core";
|
|
884
|
-
import { Terminal as XtermTerminal2 } from "@xterm/headless";
|
|
885
|
-
var MIN_COLS2 = 40;
|
|
886
|
-
var MIN_ROWS2 = 12;
|
|
887
|
-
var MAX_ROWS2 = 300;
|
|
888
|
-
var MAX_SNAPSHOT_LINES2 = 360;
|
|
889
|
-
var STYLED_SNAPSHOT_MARGIN = 6;
|
|
890
|
-
var SNAPSHOT_DELAY_MS2 = 120;
|
|
891
|
-
var fallbackChildScriptPath = fileURLToPath2(new URL("./pi-host-child.ts", import.meta.url));
|
|
892
|
-
var activeHost2 = null;
|
|
893
|
-
function clampCols2(cols) {
|
|
894
|
-
return Math.max(MIN_COLS2, Math.trunc(cols || 100));
|
|
895
|
-
}
|
|
896
|
-
function clampRows2(rows) {
|
|
897
|
-
return Math.max(MIN_ROWS2, Math.min(MAX_ROWS2, Math.trunc(rows || 35)));
|
|
898
|
-
}
|
|
899
|
-
var XTERM_COLOR_MODE_INDEXED_16 = 16777216;
|
|
900
|
-
var XTERM_COLOR_MODE_INDEXED_256 = 33554432;
|
|
901
|
-
var XTERM_COLOR_MODE_RGB = 50331648;
|
|
902
|
-
function rgbaFromXtermColor(mode, value) {
|
|
903
|
-
if (mode === 1 || mode === 2 || mode === XTERM_COLOR_MODE_INDEXED_16 || mode === XTERM_COLOR_MODE_INDEXED_256) {
|
|
904
|
-
return RGBA2.fromIndex(value);
|
|
905
|
-
}
|
|
906
|
-
if (mode === 3 || mode === XTERM_COLOR_MODE_RGB) {
|
|
907
|
-
return RGBA2.fromInts(value >> 16 & 255, value >> 8 & 255, value & 255);
|
|
908
|
-
}
|
|
909
|
-
return;
|
|
910
|
-
}
|
|
911
|
-
function textAttributesFromCell(cell) {
|
|
912
|
-
let attributes = TextAttributes2.NONE;
|
|
913
|
-
if (cell.isBold())
|
|
914
|
-
attributes |= TextAttributes2.BOLD;
|
|
915
|
-
if (cell.isDim())
|
|
916
|
-
attributes |= TextAttributes2.DIM;
|
|
917
|
-
if (cell.isItalic())
|
|
918
|
-
attributes |= TextAttributes2.ITALIC;
|
|
919
|
-
if (cell.isUnderline())
|
|
920
|
-
attributes |= TextAttributes2.UNDERLINE;
|
|
921
|
-
if (cell.isBlink())
|
|
922
|
-
attributes |= TextAttributes2.BLINK;
|
|
923
|
-
if (cell.isInverse())
|
|
924
|
-
attributes |= TextAttributes2.INVERSE;
|
|
925
|
-
if (cell.isInvisible())
|
|
926
|
-
attributes |= TextAttributes2.HIDDEN;
|
|
927
|
-
if (cell.isStrikethrough())
|
|
928
|
-
attributes |= TextAttributes2.STRIKETHROUGH;
|
|
929
|
-
return attributes;
|
|
930
|
-
}
|
|
931
|
-
function sameRgba(a, b) {
|
|
932
|
-
if (!a && !b)
|
|
933
|
-
return true;
|
|
934
|
-
return Boolean(a && b && a.equals(b));
|
|
935
|
-
}
|
|
936
|
-
function sameStyle(a, b) {
|
|
937
|
-
return sameRgba(a.fg, b.fg) && sameRgba(a.bg, b.bg) && (a.attributes ?? 0) === (b.attributes ?? 0);
|
|
938
|
-
}
|
|
939
|
-
function styleFromCell(cell) {
|
|
940
|
-
return {
|
|
941
|
-
fg: rgbaFromXtermColor(cell.getFgColorMode(), cell.getFgColor()),
|
|
942
|
-
bg: rgbaFromXtermColor(cell.getBgColorMode(), cell.getBgColor()),
|
|
943
|
-
attributes: textAttributesFromCell(cell)
|
|
944
|
-
};
|
|
945
|
-
}
|
|
946
|
-
function lineToStyledText(line, cols) {
|
|
947
|
-
if (!line)
|
|
948
|
-
return new StyledText2([{ __isChunk: true, text: "" }]);
|
|
949
|
-
const chunks = [];
|
|
950
|
-
let run = "";
|
|
951
|
-
let runStyle = null;
|
|
952
|
-
const flush = () => {
|
|
953
|
-
if (!run)
|
|
954
|
-
return;
|
|
955
|
-
chunks.push({
|
|
956
|
-
__isChunk: true,
|
|
957
|
-
text: run,
|
|
958
|
-
...runStyle?.fg ? { fg: runStyle.fg } : {},
|
|
959
|
-
...runStyle?.bg ? { bg: runStyle.bg } : {},
|
|
960
|
-
...(runStyle?.attributes ?? 0) !== 0 ? { attributes: runStyle.attributes } : {}
|
|
961
|
-
});
|
|
962
|
-
run = "";
|
|
963
|
-
};
|
|
964
|
-
for (let index = 0;index < cols; index += 1) {
|
|
965
|
-
const cell = line.getCell(index);
|
|
966
|
-
if (!cell) {
|
|
967
|
-
if (runStyle !== null)
|
|
968
|
-
flush();
|
|
969
|
-
runStyle = null;
|
|
970
|
-
run += " ";
|
|
971
|
-
continue;
|
|
972
|
-
}
|
|
973
|
-
if (cell.getWidth() === 0)
|
|
974
|
-
continue;
|
|
975
|
-
const style = styleFromCell(cell);
|
|
976
|
-
if (!runStyle || !sameStyle(runStyle, style)) {
|
|
977
|
-
flush();
|
|
978
|
-
runStyle = style;
|
|
979
|
-
}
|
|
980
|
-
run += cell.getChars() || " ";
|
|
981
|
-
}
|
|
982
|
-
flush();
|
|
983
|
-
return new StyledText2(chunks.length > 0 ? chunks : [{ __isChunk: true, text: "" }]);
|
|
984
|
-
}
|
|
985
|
-
function childCommandPrefix2() {
|
|
986
|
-
const execName = basename2(process.execPath).toLowerCase();
|
|
987
|
-
const currentEntry = process.argv[1];
|
|
988
|
-
if (execName === "bun" || execName === "bun.exe") {
|
|
989
|
-
return currentEntry ? [process.execPath, currentEntry, "__opentui-pi-host"] : [process.execPath, fallbackChildScriptPath];
|
|
990
|
-
}
|
|
991
|
-
return [process.execPath, "__opentui-pi-host"];
|
|
992
|
-
}
|
|
993
|
-
function withEnv2(base) {
|
|
994
|
-
const env = {};
|
|
995
|
-
for (const [key, value] of Object.entries(base ?? process.env)) {
|
|
996
|
-
if (key === "RIG_PLAIN" || key === "RIG_CLI_PLAIN_HELP" || key === "NO_COLOR")
|
|
997
|
-
continue;
|
|
998
|
-
if (typeof value === "string")
|
|
999
|
-
env[key] = value;
|
|
1000
|
-
}
|
|
1001
|
-
return {
|
|
1002
|
-
...env,
|
|
1003
|
-
TERM: "xterm-256color",
|
|
1004
|
-
COLORTERM: "truecolor",
|
|
1005
|
-
FORCE_COLOR: env.FORCE_COLOR ?? "1",
|
|
1006
|
-
RIG_OPENTUI_PI_HOST: "1"
|
|
1007
|
-
};
|
|
1008
|
-
}
|
|
1009
|
-
class PiPtyHost {
|
|
1010
|
-
runId;
|
|
1011
|
-
projectRoot;
|
|
1012
|
-
onSnapshot;
|
|
1013
|
-
onExit;
|
|
1014
|
-
onError;
|
|
1015
|
-
terminal;
|
|
1016
|
-
disposables = [];
|
|
1017
|
-
decoder = new TextDecoder("utf-8");
|
|
1018
|
-
proc = null;
|
|
1019
|
-
pty = null;
|
|
1020
|
-
status = "starting";
|
|
1021
|
-
cols;
|
|
1022
|
-
rows;
|
|
1023
|
-
message = "starting bundled Pi";
|
|
1024
|
-
lastResizeError = null;
|
|
1025
|
-
exitCode;
|
|
1026
|
-
signal;
|
|
1027
|
-
notifyTimer = null;
|
|
1028
|
-
lastStreamKey = "";
|
|
1029
|
-
_disposed = false;
|
|
1030
|
-
constructor(options) {
|
|
1031
|
-
this.runId = options.runId;
|
|
1032
|
-
this.projectRoot = options.projectRoot;
|
|
1033
|
-
this.cols = clampCols2(options.cols);
|
|
1034
|
-
this.rows = clampRows2(options.rows);
|
|
1035
|
-
this.onSnapshot = options.onSnapshot;
|
|
1036
|
-
this.onExit = options.onExit;
|
|
1037
|
-
this.onError = options.onError;
|
|
1038
|
-
this.terminal = new XtermTerminal2({
|
|
1039
|
-
allowProposedApi: true,
|
|
1040
|
-
cols: this.cols,
|
|
1041
|
-
rows: this.rows,
|
|
1042
|
-
scrollback: 1000
|
|
1043
|
-
});
|
|
1044
|
-
this.registerTerminalResponders();
|
|
1045
|
-
this.disposables.push(this.terminal.onWriteParsed(() => {
|
|
1046
|
-
if (this._disposed)
|
|
1047
|
-
return;
|
|
1048
|
-
const snapshot = this.createSnapshot();
|
|
1049
|
-
const key = snapshot.lines.join(`
|
|
1050
|
-
`);
|
|
1051
|
-
if (key === this.lastStreamKey)
|
|
1052
|
-
return;
|
|
1053
|
-
this.lastStreamKey = key;
|
|
1054
|
-
this.onSnapshot?.(snapshot);
|
|
1055
|
-
}));
|
|
1056
|
-
}
|
|
1057
|
-
get disposed() {
|
|
1058
|
-
return this._disposed;
|
|
1059
|
-
}
|
|
1060
|
-
get snapshot() {
|
|
1061
|
-
return this.createSnapshot();
|
|
1062
|
-
}
|
|
1063
|
-
async start() {
|
|
1064
|
-
if (this._disposed)
|
|
1065
|
-
throw new Error("Pi PTY host is disposed.");
|
|
1066
|
-
if (typeof Bun.Terminal !== "function") {
|
|
1067
|
-
throw new Error("Bun native PTY is unavailable in this runtime. Pi host requires Bun.Terminal.");
|
|
1068
|
-
}
|
|
1069
|
-
const spawnOptions = {
|
|
1070
|
-
cwd: this.projectRoot,
|
|
1071
|
-
env: withEnv2(process.env),
|
|
1072
|
-
terminal: {
|
|
1073
|
-
cols: this.cols,
|
|
1074
|
-
rows: this.rows,
|
|
1075
|
-
name: "xterm-256color",
|
|
1076
|
-
data: (_terminal, data) => this.handlePtyData(data)
|
|
1077
|
-
}
|
|
1078
|
-
};
|
|
1079
|
-
const proc = Bun.spawn([
|
|
1080
|
-
...childCommandPrefix2(),
|
|
1081
|
-
"--run-id",
|
|
1082
|
-
this.runId,
|
|
1083
|
-
"--project-root",
|
|
1084
|
-
this.projectRoot
|
|
1085
|
-
], spawnOptions);
|
|
1086
|
-
if (!proc.terminal)
|
|
1087
|
-
throw new Error("Bun did not attach a terminal to the bundled Pi child process.");
|
|
1088
|
-
this.proc = proc;
|
|
1089
|
-
this.pty = proc.terminal;
|
|
1090
|
-
this.status = "running";
|
|
1091
|
-
this.message = "bundled Pi running inside this app";
|
|
1092
|
-
this.emitSnapshotSoon(0);
|
|
1093
|
-
proc.exited.then((exitCode) => {
|
|
1094
|
-
if (this._disposed)
|
|
1095
|
-
return;
|
|
1096
|
-
this.status = exitCode === 0 ? "exited" : "failed";
|
|
1097
|
-
this.exitCode = exitCode;
|
|
1098
|
-
this.signal = null;
|
|
1099
|
-
this.message = exitCode === 0 ? "bundled Pi exited" : `bundled Pi exited with code ${exitCode}`;
|
|
1100
|
-
const snapshot = this.createSnapshot();
|
|
1101
|
-
this.onSnapshot?.(snapshot);
|
|
1102
|
-
this.onExit?.(snapshot);
|
|
1103
|
-
if (activeHost2 === this)
|
|
1104
|
-
activeHost2 = null;
|
|
1105
|
-
this.dispose("exit", { kill: false, notify: false });
|
|
1106
|
-
}).catch((error) => {
|
|
1107
|
-
if (this._disposed)
|
|
1108
|
-
return;
|
|
1109
|
-
this.status = "failed";
|
|
1110
|
-
this.message = error instanceof Error ? error.message : String(error);
|
|
1111
|
-
const snapshot = this.createSnapshot();
|
|
1112
|
-
this.onSnapshot?.(snapshot);
|
|
1113
|
-
this.onError?.(error, snapshot);
|
|
1114
|
-
if (activeHost2 === this)
|
|
1115
|
-
activeHost2 = null;
|
|
1116
|
-
this.dispose("error", { kill: false, notify: false });
|
|
1117
|
-
});
|
|
1118
|
-
}
|
|
1119
|
-
write(data) {
|
|
1120
|
-
if (this._disposed || !this.pty)
|
|
1121
|
-
return;
|
|
1122
|
-
try {
|
|
1123
|
-
this.pty.write(data);
|
|
1124
|
-
} catch (error) {
|
|
1125
|
-
this.status = "failed";
|
|
1126
|
-
this.message = error instanceof Error ? error.message : String(error);
|
|
1127
|
-
const snapshot = this.createSnapshot();
|
|
1128
|
-
this.onSnapshot?.(snapshot);
|
|
1129
|
-
this.onError?.(error, snapshot);
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
resize(cols, rows) {
|
|
1133
|
-
const nextCols = clampCols2(cols);
|
|
1134
|
-
const nextRows = clampRows2(rows);
|
|
1135
|
-
if (nextCols === this.cols && nextRows === this.rows)
|
|
1136
|
-
return;
|
|
1137
|
-
this.cols = nextCols;
|
|
1138
|
-
this.rows = nextRows;
|
|
1139
|
-
this.terminal.resize(nextCols, nextRows);
|
|
1140
|
-
try {
|
|
1141
|
-
this.pty?.resize(nextCols, nextRows);
|
|
1142
|
-
this.lastResizeError = null;
|
|
1143
|
-
} catch (error) {
|
|
1144
|
-
this.lastResizeError = error instanceof Error ? error.message : String(error);
|
|
1145
|
-
}
|
|
1146
|
-
this.emitSnapshotSoon(0);
|
|
1147
|
-
}
|
|
1148
|
-
detach() {
|
|
1149
|
-
this.dispose("detach");
|
|
1150
|
-
return this.createSnapshot("detached from bundled Pi");
|
|
1151
|
-
}
|
|
1152
|
-
dispose(reason = "dispose", options = {}) {
|
|
1153
|
-
if (this._disposed)
|
|
1154
|
-
return;
|
|
1155
|
-
this._disposed = true;
|
|
1156
|
-
if (this.notifyTimer)
|
|
1157
|
-
clearTimeout(this.notifyTimer);
|
|
1158
|
-
this.notifyTimer = null;
|
|
1159
|
-
for (const disposable of this.disposables.splice(0)) {
|
|
1160
|
-
try {
|
|
1161
|
-
disposable.dispose();
|
|
1162
|
-
} catch {}
|
|
1163
|
-
}
|
|
1164
|
-
if (options.kill !== false) {
|
|
1165
|
-
try {
|
|
1166
|
-
this.proc?.kill("SIGTERM");
|
|
1167
|
-
} catch {}
|
|
1168
|
-
}
|
|
1169
|
-
try {
|
|
1170
|
-
this.pty?.close();
|
|
1171
|
-
} catch {}
|
|
1172
|
-
try {
|
|
1173
|
-
this.terminal.dispose();
|
|
1174
|
-
} catch {}
|
|
1175
|
-
if (activeHost2 === this)
|
|
1176
|
-
activeHost2 = null;
|
|
1177
|
-
if (options.notify) {
|
|
1178
|
-
this.message = reason;
|
|
1179
|
-
this.onSnapshot?.(this.createSnapshot(reason));
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
handlePtyData(data) {
|
|
1183
|
-
if (this._disposed)
|
|
1184
|
-
return;
|
|
1185
|
-
const text = this.decoder.decode(data, { stream: true });
|
|
1186
|
-
this.respondToRawTerminalQueries(text);
|
|
1187
|
-
this.terminal.write(data);
|
|
1188
|
-
}
|
|
1189
|
-
emitSnapshotSoon(delayMs = SNAPSHOT_DELAY_MS2) {
|
|
1190
|
-
if (this._disposed || this.notifyTimer)
|
|
1191
|
-
return;
|
|
1192
|
-
this.notifyTimer = setTimeout(() => {
|
|
1193
|
-
this.notifyTimer = null;
|
|
1194
|
-
if (this._disposed)
|
|
1195
|
-
return;
|
|
1196
|
-
this.onSnapshot?.(this.createSnapshot());
|
|
1197
|
-
}, delayMs);
|
|
1198
|
-
}
|
|
1199
|
-
createSnapshot(message = this.message) {
|
|
1200
|
-
const buffer = this.terminal.buffer.active;
|
|
1201
|
-
const end = buffer.length;
|
|
1202
|
-
const start = Math.max(0, end - MAX_SNAPSHOT_LINES2);
|
|
1203
|
-
const styledStart = Math.max(start, end - this.rows - STYLED_SNAPSHOT_MARGIN);
|
|
1204
|
-
const lines = [];
|
|
1205
|
-
const styledLines = [];
|
|
1206
|
-
for (let row = start;row < end; row += 1) {
|
|
1207
|
-
const line = buffer.getLine(row);
|
|
1208
|
-
lines.push((line?.translateToString(false) ?? "").slice(0, this.cols));
|
|
1209
|
-
if (row >= styledStart)
|
|
1210
|
-
styledLines[lines.length - 1] = lineToStyledText(line, this.cols);
|
|
1211
|
-
}
|
|
1212
|
-
while (lines.length < this.rows) {
|
|
1213
|
-
lines.push("");
|
|
1214
|
-
styledLines[lines.length - 1] = new StyledText2([{ __isChunk: true, text: "" }]);
|
|
1215
|
-
}
|
|
1216
|
-
const resolvedMessage = this.lastResizeError ? `resize degraded: ${this.lastResizeError}` : message;
|
|
1217
|
-
return {
|
|
1218
|
-
runId: this.runId,
|
|
1219
|
-
status: this.status,
|
|
1220
|
-
cols: this.cols,
|
|
1221
|
-
rows: this.rows,
|
|
1222
|
-
lines,
|
|
1223
|
-
styledLines,
|
|
1224
|
-
message: resolvedMessage,
|
|
1225
|
-
...this.lastResizeError ? { resizeError: this.lastResizeError } : {},
|
|
1226
|
-
...this.exitCode !== undefined ? { exitCode: this.exitCode } : {},
|
|
1227
|
-
...this.signal !== undefined ? { signal: this.signal } : {}
|
|
1228
|
-
};
|
|
1229
|
-
}
|
|
1230
|
-
registerTerminalResponders() {
|
|
1231
|
-
this.disposables.push(this.terminal.parser.registerCsiHandler({ final: "c" }, (params) => {
|
|
1232
|
-
if (params.length === 0 || params[0] === 0)
|
|
1233
|
-
this.write("\x1B[?62;22c");
|
|
1234
|
-
return false;
|
|
1235
|
-
}));
|
|
1236
|
-
this.disposables.push(this.terminal.parser.registerCsiHandler({ prefix: ">", final: "c" }, (params) => {
|
|
1237
|
-
if (params.length === 0 || params[0] === 0)
|
|
1238
|
-
this.write("\x1B[>0;0;0c");
|
|
1239
|
-
return false;
|
|
1240
|
-
}));
|
|
1241
|
-
this.disposables.push(this.terminal.parser.registerCsiHandler({ final: "n" }, (params) => {
|
|
1242
|
-
if (params[0] === 5) {
|
|
1243
|
-
this.write("\x1B[0n");
|
|
1244
|
-
} else if (params[0] === 6) {
|
|
1245
|
-
const row = this.terminal.buffer.active.cursorY + 1;
|
|
1246
|
-
const col = this.terminal.buffer.active.cursorX + 1;
|
|
1247
|
-
this.write(`\x1B[${row};${col}R`);
|
|
1248
|
-
}
|
|
1249
|
-
return false;
|
|
1250
|
-
}));
|
|
1251
|
-
}
|
|
1252
|
-
respondToRawTerminalQueries(text) {
|
|
1253
|
-
if (!text)
|
|
1254
|
-
return;
|
|
1255
|
-
const decrqm = /\x1b\[\?(\d+)\$p/g;
|
|
1256
|
-
let match;
|
|
1257
|
-
while ((match = decrqm.exec(text)) !== null) {
|
|
1258
|
-
this.write(`\x1B[?${match[1]};2$y`);
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
882
|
// packages/cli/src/commands/_server-events.ts
|
|
1264
883
|
import { WsTransport } from "@rig/client";
|
|
1265
884
|
import { RIG_WS_CHANNELS } from "@rig/contracts";
|
|
@@ -1287,19 +906,19 @@ var RESUMABLE_RUN_STATUSES = new Set([
|
|
|
1287
906
|
]);
|
|
1288
907
|
|
|
1289
908
|
// packages/cli/src/app-opentui/drone.ts
|
|
1290
|
-
import { RGBA as
|
|
909
|
+
import { RGBA as RGBA2, StyledText as StyledText2, TextAttributes as TextAttributes2 } from "@opentui/core";
|
|
1291
910
|
var COLOR = {
|
|
1292
|
-
body:
|
|
1293
|
-
mini:
|
|
1294
|
-
rotor:
|
|
1295
|
-
path:
|
|
1296
|
-
eye:
|
|
1297
|
-
dim:
|
|
1298
|
-
ink:
|
|
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)
|
|
1299
918
|
};
|
|
1300
919
|
|
|
1301
920
|
// packages/cli/src/app-opentui/render/graphics.ts
|
|
1302
|
-
import { FrameBufferRenderable, RGBA as
|
|
921
|
+
import { FrameBufferRenderable, RGBA as RGBA3 } from "@opentui/core";
|
|
1303
922
|
|
|
1304
923
|
// packages/cli/src/app-opentui/render/constants.ts
|
|
1305
924
|
var LCG_MULTIPLIER = 1664525;
|
|
@@ -1336,13 +955,13 @@ var GLOW_FALLOFF_EXP_ASCII = 2.2;
|
|
|
1336
955
|
// packages/cli/src/app-opentui/render/graphics.ts
|
|
1337
956
|
var BRAILLE_SAMPLES_X = 2;
|
|
1338
957
|
var BRAILLE_SAMPLES_Y = 4;
|
|
1339
|
-
var TRANSPARENT =
|
|
1340
|
-
var BACKDROP =
|
|
1341
|
-
var PANEL_BG =
|
|
1342
|
-
var PANEL_HEADER_BG =
|
|
1343
|
-
var PANEL_LINE =
|
|
1344
|
-
var PANEL_LINE_DIM =
|
|
1345
|
-
var PANEL_TEXT_DIM =
|
|
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);
|
|
1346
965
|
var AC_RGB = [204, 255, 77];
|
|
1347
966
|
var C2_RGB = [86, 216, 255];
|
|
1348
967
|
var MG_RGB = [255, 121, 176];
|
|
@@ -1447,7 +1066,7 @@ function paletteColor(ac, c2, mg, ink) {
|
|
|
1447
1066
|
const b = (AC_RGB[2] * ac + C2_RGB[2] * c2 + MG_RGB[2] * mg + INK_RGB[2] * ink) / total;
|
|
1448
1067
|
const intensity = Math.min(1, total / 4);
|
|
1449
1068
|
const lift = 0.34 + intensity * 0.66;
|
|
1450
|
-
return
|
|
1069
|
+
return RGBA3.fromInts(Math.round(r * lift), Math.round(g * lift), Math.round(b * lift), 255);
|
|
1451
1070
|
}
|
|
1452
1071
|
function clearCanvas(canvas) {
|
|
1453
1072
|
canvas.ac.fill(0);
|
|
@@ -1747,26 +1366,26 @@ var ACTIVE_STATUSES = new Set([
|
|
|
1747
1366
|
]);
|
|
1748
1367
|
|
|
1749
1368
|
// packages/cli/src/app-opentui/render/text.ts
|
|
1750
|
-
import { RGBA as
|
|
1369
|
+
import { RGBA as RGBA4, TextAttributes as TextAttributes3, TextRenderable as TextRenderable2 } from "@opentui/core";
|
|
1751
1370
|
|
|
1752
1371
|
// packages/cli/src/app-opentui/render/hover.ts
|
|
1753
1372
|
var listeners = new Set;
|
|
1754
1373
|
|
|
1755
1374
|
// packages/cli/src/app-opentui/render/text.ts
|
|
1756
|
-
var TRANSPARENT2 =
|
|
1757
|
-
var HOVER_BG =
|
|
1375
|
+
var TRANSPARENT2 = RGBA4.fromInts(0, 0, 0, 0);
|
|
1376
|
+
var HOVER_BG = RGBA4.fromHex(RIG_UI.hover);
|
|
1758
1377
|
|
|
1759
1378
|
// packages/cli/src/app-opentui/render/panels.ts
|
|
1760
|
-
import { RGBA as
|
|
1761
|
-
var TRANSPARENT3 =
|
|
1379
|
+
import { RGBA as RGBA5, ScrollBoxRenderable } from "@opentui/core";
|
|
1380
|
+
var TRANSPARENT3 = RGBA5.fromInts(0, 0, 0, 0);
|
|
1762
1381
|
var PANEL_BORDER = hexToRgba(RIG_UI.border, 255);
|
|
1763
1382
|
function hexToRgba(hex, alpha) {
|
|
1764
1383
|
const clean = hex.replace(/^#/, "");
|
|
1765
1384
|
const full = clean.length === 3 ? clean.split("").map((part) => `${part}${part}`).join("") : clean;
|
|
1766
1385
|
const value = Number.parseInt(full, 16);
|
|
1767
1386
|
if (!Number.isFinite(value))
|
|
1768
|
-
return
|
|
1769
|
-
return
|
|
1387
|
+
return RGBA5.fromInts(14, 15, 17, alpha);
|
|
1388
|
+
return RGBA5.fromInts(value >> 16 & 255, value >> 8 & 255, value & 255, alpha);
|
|
1770
1389
|
}
|
|
1771
1390
|
|
|
1772
1391
|
// packages/cli/src/app-opentui/render/native-host.ts
|
|
@@ -1774,15 +1393,25 @@ import {
|
|
|
1774
1393
|
BoxRenderable as BoxRenderable2,
|
|
1775
1394
|
CodeRenderable,
|
|
1776
1395
|
DiffRenderable,
|
|
1777
|
-
RGBA as
|
|
1396
|
+
RGBA as RGBA6,
|
|
1778
1397
|
ScrollBoxRenderable as ScrollBoxRenderable2,
|
|
1779
1398
|
SyntaxStyle,
|
|
1780
1399
|
TextRenderable as TextRenderable3,
|
|
1781
1400
|
TextTableRenderable
|
|
1782
1401
|
} from "@opentui/core";
|
|
1783
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
|
+
|
|
1784
1413
|
// packages/cli/src/app-opentui/runtime.ts
|
|
1785
|
-
var PRELOADER_BACKDROP =
|
|
1414
|
+
var PRELOADER_BACKDROP = RGBA7.fromHex(RIG_UI.bg);
|
|
1786
1415
|
function inboxPendingCount(state) {
|
|
1787
1416
|
const inbox = state.data.inbox;
|
|
1788
1417
|
if (!inbox || typeof inbox !== "object" || Array.isArray(inbox))
|
|
@@ -1798,7 +1427,7 @@ var PRIMARY_NAV = [
|
|
|
1798
1427
|
{ id: "tasks", label: "Tasks", scene: "tasks", argv: ["tasks"], enterLabel: "Tasks", member: ["tasks"] },
|
|
1799
1428
|
{ id: "inbox", label: "Inbox", scene: "inbox", argv: ["inbox"], enterLabel: "Inbox", member: ["inbox"], badge: inboxPendingCount },
|
|
1800
1429
|
{ id: "stats", label: "Stats", scene: "family", argv: ["stats"], enterLabel: "Stats", member: ["family"] },
|
|
1801
|
-
{ id: "
|
|
1430
|
+
{ id: "init", label: "Init", scene: "init", argv: ["init"], enterLabel: "Init", member: ["init", "doctor", "server", "pi", "plugin", "repo", "workspace"] },
|
|
1802
1431
|
{ id: "help", label: "Help", scene: "help", argv: ["help"], enterLabel: "Help", member: ["help"] }
|
|
1803
1432
|
];
|
|
1804
1433
|
function activeNavSection(scene) {
|
|
@@ -1815,7 +1444,7 @@ function sceneSectionLabel(scene) {
|
|
|
1815
1444
|
handoff: "pi console",
|
|
1816
1445
|
server: "server",
|
|
1817
1446
|
doctor: "doctor",
|
|
1818
|
-
init: "
|
|
1447
|
+
init: "init",
|
|
1819
1448
|
pi: "pi",
|
|
1820
1449
|
plugin: "plugins",
|
|
1821
1450
|
repo: "repo",
|
|
@@ -1841,7 +1470,7 @@ function buildNavStrip(state) {
|
|
|
1841
1470
|
chunks.push(otuiBold(styles.yellow(String(badgeCount))));
|
|
1842
1471
|
}
|
|
1843
1472
|
});
|
|
1844
|
-
return new
|
|
1473
|
+
return new StyledText3(chunks);
|
|
1845
1474
|
}
|
|
1846
1475
|
var DESTRUCTIVE_ACTION_KINDS = new Set(["run-stop", "inbox-reject"]);
|
|
1847
1476
|
|