@h-rig/cli 0.0.6-alpha.87 → 0.0.6-alpha.88
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 +210 -562
- 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/family.js +31 -4
- package/dist/src/app-opentui/adapters/pi-attach.d.ts +7 -0
- package/dist/src/app-opentui/adapters/pi-attach.js +527 -473
- package/dist/src/app-opentui/adapters/tasks.js +82 -468
- package/dist/src/app-opentui/bootstrap.js +210 -562
- package/dist/src/app-opentui/index.js +68 -441
- package/dist/src/app-opentui/keymap.js +2 -387
- package/dist/src/app-opentui/pi-host-child.js +31 -4
- 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 +42 -427
- package/dist/src/app-opentui/react/ChromeHost.js +28 -411
- package/dist/src/app-opentui/react/launch.js +106 -466
- package/dist/src/app-opentui/registry.js +96 -482
- 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 +68 -441
- package/dist/src/commands/_operator-view.js +31 -4
- package/dist/src/commands/_pi-frontend.d.ts +25 -0
- package/dist/src/commands/_pi-frontend.js +32 -4
- package/dist/src/commands/run.js +31 -4
- package/dist/src/commands/task.js +31 -4
- package/dist/src/commands.js +31 -4
- package/dist/src/index.js +31 -4
- package/package.json +8 -8
|
@@ -1784,395 +1784,10 @@ function intentFromTypeBar(value) {
|
|
|
1784
1784
|
}
|
|
1785
1785
|
|
|
1786
1786
|
// packages/cli/src/app-opentui/pi-pty-host.ts
|
|
1787
|
-
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1788
|
-
import { basename as basename2 } from "path";
|
|
1789
|
-
import { RGBA as RGBA2, StyledText as StyledText2, TextAttributes as TextAttributes3 } from "@opentui/core";
|
|
1790
|
-
import { Terminal as XtermTerminal2 } from "@xterm/headless";
|
|
1791
|
-
var MIN_COLS2 = 40;
|
|
1792
|
-
var MIN_ROWS2 = 12;
|
|
1793
|
-
var MAX_ROWS2 = 300;
|
|
1794
|
-
var MAX_SNAPSHOT_LINES2 = 360;
|
|
1795
|
-
var STYLED_SNAPSHOT_MARGIN = 6;
|
|
1796
|
-
var SNAPSHOT_DELAY_MS2 = 120;
|
|
1797
|
-
var fallbackChildScriptPath = fileURLToPath2(new URL("./pi-host-child.ts", import.meta.url));
|
|
1798
|
-
var activeHost2 = null;
|
|
1799
|
-
function clampCols2(cols) {
|
|
1800
|
-
return Math.max(MIN_COLS2, Math.trunc(cols || 100));
|
|
1801
|
-
}
|
|
1802
|
-
function clampRows2(rows) {
|
|
1803
|
-
return Math.max(MIN_ROWS2, Math.min(MAX_ROWS2, Math.trunc(rows || 35)));
|
|
1804
|
-
}
|
|
1805
|
-
var XTERM_COLOR_MODE_INDEXED_16 = 16777216;
|
|
1806
|
-
var XTERM_COLOR_MODE_INDEXED_256 = 33554432;
|
|
1807
|
-
var XTERM_COLOR_MODE_RGB = 50331648;
|
|
1808
|
-
function rgbaFromXtermColor(mode, value) {
|
|
1809
|
-
if (mode === 1 || mode === 2 || mode === XTERM_COLOR_MODE_INDEXED_16 || mode === XTERM_COLOR_MODE_INDEXED_256) {
|
|
1810
|
-
return RGBA2.fromIndex(value);
|
|
1811
|
-
}
|
|
1812
|
-
if (mode === 3 || mode === XTERM_COLOR_MODE_RGB) {
|
|
1813
|
-
return RGBA2.fromInts(value >> 16 & 255, value >> 8 & 255, value & 255);
|
|
1814
|
-
}
|
|
1815
|
-
return;
|
|
1816
|
-
}
|
|
1817
|
-
function textAttributesFromCell(cell) {
|
|
1818
|
-
let attributes = TextAttributes3.NONE;
|
|
1819
|
-
if (cell.isBold())
|
|
1820
|
-
attributes |= TextAttributes3.BOLD;
|
|
1821
|
-
if (cell.isDim())
|
|
1822
|
-
attributes |= TextAttributes3.DIM;
|
|
1823
|
-
if (cell.isItalic())
|
|
1824
|
-
attributes |= TextAttributes3.ITALIC;
|
|
1825
|
-
if (cell.isUnderline())
|
|
1826
|
-
attributes |= TextAttributes3.UNDERLINE;
|
|
1827
|
-
if (cell.isBlink())
|
|
1828
|
-
attributes |= TextAttributes3.BLINK;
|
|
1829
|
-
if (cell.isInverse())
|
|
1830
|
-
attributes |= TextAttributes3.INVERSE;
|
|
1831
|
-
if (cell.isInvisible())
|
|
1832
|
-
attributes |= TextAttributes3.HIDDEN;
|
|
1833
|
-
if (cell.isStrikethrough())
|
|
1834
|
-
attributes |= TextAttributes3.STRIKETHROUGH;
|
|
1835
|
-
return attributes;
|
|
1836
|
-
}
|
|
1837
|
-
function sameRgba(a, b) {
|
|
1838
|
-
if (!a && !b)
|
|
1839
|
-
return true;
|
|
1840
|
-
return Boolean(a && b && a.equals(b));
|
|
1841
|
-
}
|
|
1842
|
-
function sameStyle(a, b) {
|
|
1843
|
-
return sameRgba(a.fg, b.fg) && sameRgba(a.bg, b.bg) && (a.attributes ?? 0) === (b.attributes ?? 0);
|
|
1844
|
-
}
|
|
1845
|
-
function styleFromCell(cell) {
|
|
1846
|
-
return {
|
|
1847
|
-
fg: rgbaFromXtermColor(cell.getFgColorMode(), cell.getFgColor()),
|
|
1848
|
-
bg: rgbaFromXtermColor(cell.getBgColorMode(), cell.getBgColor()),
|
|
1849
|
-
attributes: textAttributesFromCell(cell)
|
|
1850
|
-
};
|
|
1851
|
-
}
|
|
1852
|
-
function lineToStyledText(line2, cols) {
|
|
1853
|
-
if (!line2)
|
|
1854
|
-
return new StyledText2([{ __isChunk: true, text: "" }]);
|
|
1855
|
-
const chunks = [];
|
|
1856
|
-
let run = "";
|
|
1857
|
-
let runStyle = null;
|
|
1858
|
-
const flush = () => {
|
|
1859
|
-
if (!run)
|
|
1860
|
-
return;
|
|
1861
|
-
chunks.push({
|
|
1862
|
-
__isChunk: true,
|
|
1863
|
-
text: run,
|
|
1864
|
-
...runStyle?.fg ? { fg: runStyle.fg } : {},
|
|
1865
|
-
...runStyle?.bg ? { bg: runStyle.bg } : {},
|
|
1866
|
-
...(runStyle?.attributes ?? 0) !== 0 ? { attributes: runStyle.attributes } : {}
|
|
1867
|
-
});
|
|
1868
|
-
run = "";
|
|
1869
|
-
};
|
|
1870
|
-
for (let index = 0;index < cols; index += 1) {
|
|
1871
|
-
const cell = line2.getCell(index);
|
|
1872
|
-
if (!cell) {
|
|
1873
|
-
if (runStyle !== null)
|
|
1874
|
-
flush();
|
|
1875
|
-
runStyle = null;
|
|
1876
|
-
run += " ";
|
|
1877
|
-
continue;
|
|
1878
|
-
}
|
|
1879
|
-
if (cell.getWidth() === 0)
|
|
1880
|
-
continue;
|
|
1881
|
-
const style = styleFromCell(cell);
|
|
1882
|
-
if (!runStyle || !sameStyle(runStyle, style)) {
|
|
1883
|
-
flush();
|
|
1884
|
-
runStyle = style;
|
|
1885
|
-
}
|
|
1886
|
-
run += cell.getChars() || " ";
|
|
1887
|
-
}
|
|
1888
|
-
flush();
|
|
1889
|
-
return new StyledText2(chunks.length > 0 ? chunks : [{ __isChunk: true, text: "" }]);
|
|
1890
|
-
}
|
|
1891
|
-
function childCommandPrefix2() {
|
|
1892
|
-
const execName = basename2(process.execPath).toLowerCase();
|
|
1893
|
-
const currentEntry = process.argv[1];
|
|
1894
|
-
if (execName === "bun" || execName === "bun.exe") {
|
|
1895
|
-
return currentEntry ? [process.execPath, currentEntry, "__opentui-pi-host"] : [process.execPath, fallbackChildScriptPath];
|
|
1896
|
-
}
|
|
1897
|
-
return [process.execPath, "__opentui-pi-host"];
|
|
1898
|
-
}
|
|
1899
|
-
function withEnv2(base) {
|
|
1900
|
-
const env = {};
|
|
1901
|
-
for (const [key, value] of Object.entries(base ?? process.env)) {
|
|
1902
|
-
if (key === "RIG_PLAIN" || key === "RIG_CLI_PLAIN_HELP" || key === "NO_COLOR")
|
|
1903
|
-
continue;
|
|
1904
|
-
if (typeof value === "string")
|
|
1905
|
-
env[key] = value;
|
|
1906
|
-
}
|
|
1907
|
-
return {
|
|
1908
|
-
...env,
|
|
1909
|
-
TERM: "xterm-256color",
|
|
1910
|
-
COLORTERM: "truecolor",
|
|
1911
|
-
FORCE_COLOR: env.FORCE_COLOR ?? "1",
|
|
1912
|
-
RIG_OPENTUI_PI_HOST: "1"
|
|
1913
|
-
};
|
|
1914
|
-
}
|
|
1915
1787
|
function getActivePiHost() {
|
|
1916
|
-
return
|
|
1917
|
-
}
|
|
1918
|
-
function stopActivePiHost(reason = "detach") {
|
|
1919
|
-
activeHost2?.dispose(reason);
|
|
1920
|
-
activeHost2 = null;
|
|
1921
|
-
}
|
|
1922
|
-
|
|
1923
|
-
class PiPtyHost {
|
|
1924
|
-
runId;
|
|
1925
|
-
projectRoot;
|
|
1926
|
-
onSnapshot;
|
|
1927
|
-
onExit;
|
|
1928
|
-
onError;
|
|
1929
|
-
terminal;
|
|
1930
|
-
disposables = [];
|
|
1931
|
-
decoder = new TextDecoder("utf-8");
|
|
1932
|
-
proc = null;
|
|
1933
|
-
pty = null;
|
|
1934
|
-
status = "starting";
|
|
1935
|
-
cols;
|
|
1936
|
-
rows;
|
|
1937
|
-
message = "starting bundled Pi";
|
|
1938
|
-
lastResizeError = null;
|
|
1939
|
-
exitCode;
|
|
1940
|
-
signal;
|
|
1941
|
-
notifyTimer = null;
|
|
1942
|
-
lastStreamKey = "";
|
|
1943
|
-
_disposed = false;
|
|
1944
|
-
constructor(options) {
|
|
1945
|
-
this.runId = options.runId;
|
|
1946
|
-
this.projectRoot = options.projectRoot;
|
|
1947
|
-
this.cols = clampCols2(options.cols);
|
|
1948
|
-
this.rows = clampRows2(options.rows);
|
|
1949
|
-
this.onSnapshot = options.onSnapshot;
|
|
1950
|
-
this.onExit = options.onExit;
|
|
1951
|
-
this.onError = options.onError;
|
|
1952
|
-
this.terminal = new XtermTerminal2({
|
|
1953
|
-
allowProposedApi: true,
|
|
1954
|
-
cols: this.cols,
|
|
1955
|
-
rows: this.rows,
|
|
1956
|
-
scrollback: 1000
|
|
1957
|
-
});
|
|
1958
|
-
this.registerTerminalResponders();
|
|
1959
|
-
this.disposables.push(this.terminal.onWriteParsed(() => {
|
|
1960
|
-
if (this._disposed)
|
|
1961
|
-
return;
|
|
1962
|
-
const snapshot = this.createSnapshot();
|
|
1963
|
-
const key = snapshot.lines.join(`
|
|
1964
|
-
`);
|
|
1965
|
-
if (key === this.lastStreamKey)
|
|
1966
|
-
return;
|
|
1967
|
-
this.lastStreamKey = key;
|
|
1968
|
-
this.onSnapshot?.(snapshot);
|
|
1969
|
-
}));
|
|
1970
|
-
}
|
|
1971
|
-
get disposed() {
|
|
1972
|
-
return this._disposed;
|
|
1973
|
-
}
|
|
1974
|
-
get snapshot() {
|
|
1975
|
-
return this.createSnapshot();
|
|
1976
|
-
}
|
|
1977
|
-
async start() {
|
|
1978
|
-
if (this._disposed)
|
|
1979
|
-
throw new Error("Pi PTY host is disposed.");
|
|
1980
|
-
if (typeof Bun.Terminal !== "function") {
|
|
1981
|
-
throw new Error("Bun native PTY is unavailable in this runtime. Pi host requires Bun.Terminal.");
|
|
1982
|
-
}
|
|
1983
|
-
const spawnOptions = {
|
|
1984
|
-
cwd: this.projectRoot,
|
|
1985
|
-
env: withEnv2(process.env),
|
|
1986
|
-
terminal: {
|
|
1987
|
-
cols: this.cols,
|
|
1988
|
-
rows: this.rows,
|
|
1989
|
-
name: "xterm-256color",
|
|
1990
|
-
data: (_terminal, data) => this.handlePtyData(data)
|
|
1991
|
-
}
|
|
1992
|
-
};
|
|
1993
|
-
const proc = Bun.spawn([
|
|
1994
|
-
...childCommandPrefix2(),
|
|
1995
|
-
"--run-id",
|
|
1996
|
-
this.runId,
|
|
1997
|
-
"--project-root",
|
|
1998
|
-
this.projectRoot
|
|
1999
|
-
], spawnOptions);
|
|
2000
|
-
if (!proc.terminal)
|
|
2001
|
-
throw new Error("Bun did not attach a terminal to the bundled Pi child process.");
|
|
2002
|
-
this.proc = proc;
|
|
2003
|
-
this.pty = proc.terminal;
|
|
2004
|
-
this.status = "running";
|
|
2005
|
-
this.message = "bundled Pi running inside this app";
|
|
2006
|
-
this.emitSnapshotSoon(0);
|
|
2007
|
-
proc.exited.then((exitCode) => {
|
|
2008
|
-
if (this._disposed)
|
|
2009
|
-
return;
|
|
2010
|
-
this.status = exitCode === 0 ? "exited" : "failed";
|
|
2011
|
-
this.exitCode = exitCode;
|
|
2012
|
-
this.signal = null;
|
|
2013
|
-
this.message = exitCode === 0 ? "bundled Pi exited" : `bundled Pi exited with code ${exitCode}`;
|
|
2014
|
-
const snapshot = this.createSnapshot();
|
|
2015
|
-
this.onSnapshot?.(snapshot);
|
|
2016
|
-
this.onExit?.(snapshot);
|
|
2017
|
-
if (activeHost2 === this)
|
|
2018
|
-
activeHost2 = null;
|
|
2019
|
-
this.dispose("exit", { kill: false, notify: false });
|
|
2020
|
-
}).catch((error) => {
|
|
2021
|
-
if (this._disposed)
|
|
2022
|
-
return;
|
|
2023
|
-
this.status = "failed";
|
|
2024
|
-
this.message = error instanceof Error ? error.message : String(error);
|
|
2025
|
-
const snapshot = this.createSnapshot();
|
|
2026
|
-
this.onSnapshot?.(snapshot);
|
|
2027
|
-
this.onError?.(error, snapshot);
|
|
2028
|
-
if (activeHost2 === this)
|
|
2029
|
-
activeHost2 = null;
|
|
2030
|
-
this.dispose("error", { kill: false, notify: false });
|
|
2031
|
-
});
|
|
2032
|
-
}
|
|
2033
|
-
write(data) {
|
|
2034
|
-
if (this._disposed || !this.pty)
|
|
2035
|
-
return;
|
|
2036
|
-
try {
|
|
2037
|
-
this.pty.write(data);
|
|
2038
|
-
} catch (error) {
|
|
2039
|
-
this.status = "failed";
|
|
2040
|
-
this.message = error instanceof Error ? error.message : String(error);
|
|
2041
|
-
const snapshot = this.createSnapshot();
|
|
2042
|
-
this.onSnapshot?.(snapshot);
|
|
2043
|
-
this.onError?.(error, snapshot);
|
|
2044
|
-
}
|
|
2045
|
-
}
|
|
2046
|
-
resize(cols, rows) {
|
|
2047
|
-
const nextCols = clampCols2(cols);
|
|
2048
|
-
const nextRows = clampRows2(rows);
|
|
2049
|
-
if (nextCols === this.cols && nextRows === this.rows)
|
|
2050
|
-
return;
|
|
2051
|
-
this.cols = nextCols;
|
|
2052
|
-
this.rows = nextRows;
|
|
2053
|
-
this.terminal.resize(nextCols, nextRows);
|
|
2054
|
-
try {
|
|
2055
|
-
this.pty?.resize(nextCols, nextRows);
|
|
2056
|
-
this.lastResizeError = null;
|
|
2057
|
-
} catch (error) {
|
|
2058
|
-
this.lastResizeError = error instanceof Error ? error.message : String(error);
|
|
2059
|
-
}
|
|
2060
|
-
this.emitSnapshotSoon(0);
|
|
2061
|
-
}
|
|
2062
|
-
detach() {
|
|
2063
|
-
this.dispose("detach");
|
|
2064
|
-
return this.createSnapshot("detached from bundled Pi");
|
|
2065
|
-
}
|
|
2066
|
-
dispose(reason = "dispose", options = {}) {
|
|
2067
|
-
if (this._disposed)
|
|
2068
|
-
return;
|
|
2069
|
-
this._disposed = true;
|
|
2070
|
-
if (this.notifyTimer)
|
|
2071
|
-
clearTimeout(this.notifyTimer);
|
|
2072
|
-
this.notifyTimer = null;
|
|
2073
|
-
for (const disposable of this.disposables.splice(0)) {
|
|
2074
|
-
try {
|
|
2075
|
-
disposable.dispose();
|
|
2076
|
-
} catch {}
|
|
2077
|
-
}
|
|
2078
|
-
if (options.kill !== false) {
|
|
2079
|
-
try {
|
|
2080
|
-
this.proc?.kill("SIGTERM");
|
|
2081
|
-
} catch {}
|
|
2082
|
-
}
|
|
2083
|
-
try {
|
|
2084
|
-
this.pty?.close();
|
|
2085
|
-
} catch {}
|
|
2086
|
-
try {
|
|
2087
|
-
this.terminal.dispose();
|
|
2088
|
-
} catch {}
|
|
2089
|
-
if (activeHost2 === this)
|
|
2090
|
-
activeHost2 = null;
|
|
2091
|
-
if (options.notify) {
|
|
2092
|
-
this.message = reason;
|
|
2093
|
-
this.onSnapshot?.(this.createSnapshot(reason));
|
|
2094
|
-
}
|
|
2095
|
-
}
|
|
2096
|
-
handlePtyData(data) {
|
|
2097
|
-
if (this._disposed)
|
|
2098
|
-
return;
|
|
2099
|
-
const text = this.decoder.decode(data, { stream: true });
|
|
2100
|
-
this.respondToRawTerminalQueries(text);
|
|
2101
|
-
this.terminal.write(data);
|
|
2102
|
-
}
|
|
2103
|
-
emitSnapshotSoon(delayMs = SNAPSHOT_DELAY_MS2) {
|
|
2104
|
-
if (this._disposed || this.notifyTimer)
|
|
2105
|
-
return;
|
|
2106
|
-
this.notifyTimer = setTimeout(() => {
|
|
2107
|
-
this.notifyTimer = null;
|
|
2108
|
-
if (this._disposed)
|
|
2109
|
-
return;
|
|
2110
|
-
this.onSnapshot?.(this.createSnapshot());
|
|
2111
|
-
}, delayMs);
|
|
2112
|
-
}
|
|
2113
|
-
createSnapshot(message = this.message) {
|
|
2114
|
-
const buffer = this.terminal.buffer.active;
|
|
2115
|
-
const end = buffer.length;
|
|
2116
|
-
const start = Math.max(0, end - MAX_SNAPSHOT_LINES2);
|
|
2117
|
-
const styledStart = Math.max(start, end - this.rows - STYLED_SNAPSHOT_MARGIN);
|
|
2118
|
-
const lines = [];
|
|
2119
|
-
const styledLines = [];
|
|
2120
|
-
for (let row = start;row < end; row += 1) {
|
|
2121
|
-
const line2 = buffer.getLine(row);
|
|
2122
|
-
lines.push((line2?.translateToString(false) ?? "").slice(0, this.cols));
|
|
2123
|
-
if (row >= styledStart)
|
|
2124
|
-
styledLines[lines.length - 1] = lineToStyledText(line2, this.cols);
|
|
2125
|
-
}
|
|
2126
|
-
while (lines.length < this.rows) {
|
|
2127
|
-
lines.push("");
|
|
2128
|
-
styledLines[lines.length - 1] = new StyledText2([{ __isChunk: true, text: "" }]);
|
|
2129
|
-
}
|
|
2130
|
-
const resolvedMessage = this.lastResizeError ? `resize degraded: ${this.lastResizeError}` : message;
|
|
2131
|
-
return {
|
|
2132
|
-
runId: this.runId,
|
|
2133
|
-
status: this.status,
|
|
2134
|
-
cols: this.cols,
|
|
2135
|
-
rows: this.rows,
|
|
2136
|
-
lines,
|
|
2137
|
-
styledLines,
|
|
2138
|
-
message: resolvedMessage,
|
|
2139
|
-
...this.lastResizeError ? { resizeError: this.lastResizeError } : {},
|
|
2140
|
-
...this.exitCode !== undefined ? { exitCode: this.exitCode } : {},
|
|
2141
|
-
...this.signal !== undefined ? { signal: this.signal } : {}
|
|
2142
|
-
};
|
|
2143
|
-
}
|
|
2144
|
-
registerTerminalResponders() {
|
|
2145
|
-
this.disposables.push(this.terminal.parser.registerCsiHandler({ final: "c" }, (params) => {
|
|
2146
|
-
if (params.length === 0 || params[0] === 0)
|
|
2147
|
-
this.write("\x1B[?62;22c");
|
|
2148
|
-
return false;
|
|
2149
|
-
}));
|
|
2150
|
-
this.disposables.push(this.terminal.parser.registerCsiHandler({ prefix: ">", final: "c" }, (params) => {
|
|
2151
|
-
if (params.length === 0 || params[0] === 0)
|
|
2152
|
-
this.write("\x1B[>0;0;0c");
|
|
2153
|
-
return false;
|
|
2154
|
-
}));
|
|
2155
|
-
this.disposables.push(this.terminal.parser.registerCsiHandler({ final: "n" }, (params) => {
|
|
2156
|
-
if (params[0] === 5) {
|
|
2157
|
-
this.write("\x1B[0n");
|
|
2158
|
-
} else if (params[0] === 6) {
|
|
2159
|
-
const row = this.terminal.buffer.active.cursorY + 1;
|
|
2160
|
-
const col = this.terminal.buffer.active.cursorX + 1;
|
|
2161
|
-
this.write(`\x1B[${row};${col}R`);
|
|
2162
|
-
}
|
|
2163
|
-
return false;
|
|
2164
|
-
}));
|
|
2165
|
-
}
|
|
2166
|
-
respondToRawTerminalQueries(text) {
|
|
2167
|
-
if (!text)
|
|
2168
|
-
return;
|
|
2169
|
-
const decrqm = /\x1b\[\?(\d+)\$p/g;
|
|
2170
|
-
let match;
|
|
2171
|
-
while ((match = decrqm.exec(text)) !== null) {
|
|
2172
|
-
this.write(`\x1B[?${match[1]};2$y`);
|
|
2173
|
-
}
|
|
2174
|
-
}
|
|
1788
|
+
return null;
|
|
2175
1789
|
}
|
|
1790
|
+
function stopActivePiHost(_reason) {}
|
|
2176
1791
|
|
|
2177
1792
|
// packages/cli/src/app-opentui/keymap.ts
|
|
2178
1793
|
var autocompleteState;
|
|
@@ -2404,7 +2019,7 @@ function handleAppKeyPress(context, key) {
|
|
|
2404
2019
|
}
|
|
2405
2020
|
|
|
2406
2021
|
// packages/cli/src/app-opentui/runtime.ts
|
|
2407
|
-
import { BoxRenderable as BoxRenderable3, RGBA as
|
|
2022
|
+
import { BoxRenderable as BoxRenderable3, RGBA as RGBA7, StyledText as StyledText3, TextRenderable as TextRenderable4, createCliRenderer } from "@opentui/core";
|
|
2408
2023
|
|
|
2409
2024
|
// packages/cli/src/commands/_server-events.ts
|
|
2410
2025
|
import { WsTransport } from "@rig/client";
|
|
@@ -2433,7 +2048,7 @@ var RESUMABLE_RUN_STATUSES = new Set([
|
|
|
2433
2048
|
]);
|
|
2434
2049
|
|
|
2435
2050
|
// packages/cli/src/app-opentui/render/graphics.ts
|
|
2436
|
-
import { FrameBufferRenderable, RGBA as
|
|
2051
|
+
import { FrameBufferRenderable, RGBA as RGBA2 } from "@opentui/core";
|
|
2437
2052
|
|
|
2438
2053
|
// packages/cli/src/app-opentui/render/ascii-fleet.ts
|
|
2439
2054
|
var LEAD_DRONE = [
|
|
@@ -2577,13 +2192,13 @@ var GLOW_FALLOFF_EXP_ASCII = 2.2;
|
|
|
2577
2192
|
// packages/cli/src/app-opentui/render/graphics.ts
|
|
2578
2193
|
var BRAILLE_SAMPLES_X = 2;
|
|
2579
2194
|
var BRAILLE_SAMPLES_Y = 4;
|
|
2580
|
-
var TRANSPARENT =
|
|
2581
|
-
var BACKDROP =
|
|
2582
|
-
var PANEL_BG =
|
|
2583
|
-
var PANEL_HEADER_BG =
|
|
2584
|
-
var PANEL_LINE =
|
|
2585
|
-
var PANEL_LINE_DIM =
|
|
2586
|
-
var PANEL_TEXT_DIM =
|
|
2195
|
+
var TRANSPARENT = RGBA2.fromValues(0, 0, 0, 0);
|
|
2196
|
+
var BACKDROP = RGBA2.fromHex(RIG_UI.bg);
|
|
2197
|
+
var PANEL_BG = RGBA2.fromInts(16, 17, 21, 184);
|
|
2198
|
+
var PANEL_HEADER_BG = RGBA2.fromInts(16, 17, 21, 188);
|
|
2199
|
+
var PANEL_LINE = RGBA2.fromInts(255, 255, 255, 20);
|
|
2200
|
+
var PANEL_LINE_DIM = RGBA2.fromInts(255, 255, 255, 8);
|
|
2201
|
+
var PANEL_TEXT_DIM = RGBA2.fromInts(108, 110, 121, 255);
|
|
2587
2202
|
var AC_RGB = [204, 255, 77];
|
|
2588
2203
|
var C2_RGB = [86, 216, 255];
|
|
2589
2204
|
var MG_RGB = [255, 121, 176];
|
|
@@ -2688,7 +2303,7 @@ function paletteColor(ac, c2, mg, ink) {
|
|
|
2688
2303
|
const b = (AC_RGB[2] * ac + C2_RGB[2] * c2 + MG_RGB[2] * mg + INK_RGB[2] * ink) / total;
|
|
2689
2304
|
const intensity = Math.min(1, total / 4);
|
|
2690
2305
|
const lift = 0.34 + intensity * 0.66;
|
|
2691
|
-
return
|
|
2306
|
+
return RGBA2.fromInts(Math.round(r * lift), Math.round(g * lift), Math.round(b * lift), 255);
|
|
2692
2307
|
}
|
|
2693
2308
|
function clearCanvas(canvas) {
|
|
2694
2309
|
canvas.ac.fill(0);
|
|
@@ -3043,8 +2658,8 @@ function staticFleetTick(scene) {
|
|
|
3043
2658
|
}
|
|
3044
2659
|
function withAlpha(hex, alpha) {
|
|
3045
2660
|
const a = Math.max(0, Math.min(255, Math.round(alpha * 255)));
|
|
3046
|
-
const [r, g, b] =
|
|
3047
|
-
return
|
|
2661
|
+
const [r, g, b] = RGBA2.fromHex(hex).toInts();
|
|
2662
|
+
return RGBA2.fromInts(r, g, b, a);
|
|
3048
2663
|
}
|
|
3049
2664
|
function asciiFleetColor(char, row, alpha) {
|
|
3050
2665
|
if (char === "@" || char === "$" || char === "o")
|
|
@@ -3052,7 +2667,7 @@ function asciiFleetColor(char, row, alpha) {
|
|
|
3052
2667
|
if (char === "%" || char === "!" || char === "/" || char === "\\" || char === "|")
|
|
3053
2668
|
return withAlpha(RIG_UI.cyan, alpha);
|
|
3054
2669
|
if (char === "." || char === "'" || char === "_" || row < 3 || row > FLEET_GRID_HEIGHT - 4) {
|
|
3055
|
-
return
|
|
2670
|
+
return RGBA2.fromInts(108, 110, 121, Math.min(170, Math.max(0, Math.min(255, Math.round(alpha * 255)))));
|
|
3056
2671
|
}
|
|
3057
2672
|
return withAlpha(RIG_UI.limeDim, alpha);
|
|
3058
2673
|
}
|
|
@@ -3104,7 +2719,7 @@ function drawAmbientField(layer, layout, _tick, scene = "fleet", load = 0, activ
|
|
|
3104
2719
|
}
|
|
3105
2720
|
|
|
3106
2721
|
// packages/cli/src/app-opentui/render/text.ts
|
|
3107
|
-
import { RGBA as
|
|
2722
|
+
import { RGBA as RGBA3, TextAttributes as TextAttributes3, TextRenderable } from "@opentui/core";
|
|
3108
2723
|
|
|
3109
2724
|
// packages/cli/src/app-opentui/render/hover.ts
|
|
3110
2725
|
var hoveredId;
|
|
@@ -3134,8 +2749,8 @@ function subscribeHover(listener) {
|
|
|
3134
2749
|
}
|
|
3135
2750
|
|
|
3136
2751
|
// packages/cli/src/app-opentui/render/text.ts
|
|
3137
|
-
var TRANSPARENT2 =
|
|
3138
|
-
var HOVER_BG =
|
|
2752
|
+
var TRANSPARENT2 = RGBA3.fromInts(0, 0, 0, 0);
|
|
2753
|
+
var HOVER_BG = RGBA3.fromHex(RIG_UI.hover);
|
|
3139
2754
|
function lineIsClickable(line2) {
|
|
3140
2755
|
return line2?.selectable !== undefined || line2?.selectableIndex !== undefined;
|
|
3141
2756
|
}
|
|
@@ -3144,7 +2759,7 @@ function lineSelectableId(line2) {
|
|
|
3144
2759
|
}
|
|
3145
2760
|
function lineBackground(line2) {
|
|
3146
2761
|
if (line2?.bg)
|
|
3147
|
-
return
|
|
2762
|
+
return RGBA3.fromHex(line2.bg);
|
|
3148
2763
|
const id = lineSelectableId(line2);
|
|
3149
2764
|
if (id !== undefined && isHovered(id))
|
|
3150
2765
|
return HOVER_BG;
|
|
@@ -3194,12 +2809,12 @@ function applyFlowTextLine(renderable, line2, width) {
|
|
|
3194
2809
|
renderable.content = line2?.styledText ?? line2?.text ?? "";
|
|
3195
2810
|
renderable.fg = line2?.fg ?? RIG_UI.ink2;
|
|
3196
2811
|
renderable.bg = lineBackground(line2);
|
|
3197
|
-
renderable.attributes = line2?.bold ?
|
|
2812
|
+
renderable.attributes = line2?.bold ? TextAttributes3.BOLD : line2?.dim ? TextAttributes3.DIM : 0;
|
|
3198
2813
|
}
|
|
3199
2814
|
|
|
3200
2815
|
// packages/cli/src/app-opentui/render/panels.ts
|
|
3201
|
-
import { RGBA as
|
|
3202
|
-
var TRANSPARENT3 =
|
|
2816
|
+
import { RGBA as RGBA4, ScrollBoxRenderable } from "@opentui/core";
|
|
2817
|
+
var TRANSPARENT3 = RGBA4.fromInts(0, 0, 0, 0);
|
|
3203
2818
|
var MAX_PANEL_LINES = 420;
|
|
3204
2819
|
var PANEL_OPAQUE_ALPHA = 255;
|
|
3205
2820
|
var PANEL_BORDER = hexToRgba(RIG_UI.border, 255);
|
|
@@ -3208,8 +2823,8 @@ function hexToRgba(hex, alpha) {
|
|
|
3208
2823
|
const full = clean.length === 3 ? clean.split("").map((part) => `${part}${part}`).join("") : clean;
|
|
3209
2824
|
const value = Number.parseInt(full, 16);
|
|
3210
2825
|
if (!Number.isFinite(value))
|
|
3211
|
-
return
|
|
3212
|
-
return
|
|
2826
|
+
return RGBA4.fromInts(14, 15, 17, alpha);
|
|
2827
|
+
return RGBA4.fromInts(value >> 16 & 255, value >> 8 & 255, value & 255, alpha);
|
|
3213
2828
|
}
|
|
3214
2829
|
function panelBackground(panel) {
|
|
3215
2830
|
return hexToRgba(panel.backgroundColor ?? RIG_UI.panel, PANEL_OPAQUE_ALPHA);
|
|
@@ -3324,9 +2939,9 @@ function applyScrollPanels(panels, layout, scenePanels) {
|
|
|
3324
2939
|
}
|
|
3325
2940
|
|
|
3326
2941
|
// packages/cli/src/app-opentui/render/type-bar.ts
|
|
3327
|
-
import { BoxRenderable, InputRenderable, InputRenderableEvents, RGBA as
|
|
3328
|
-
var TYPEBAR_BG =
|
|
3329
|
-
var TYPEBAR_BORDER =
|
|
2942
|
+
import { BoxRenderable, InputRenderable, InputRenderableEvents, RGBA as RGBA5, StyledText as StyledText2, TextRenderable as TextRenderable2 } from "@opentui/core";
|
|
2943
|
+
var TYPEBAR_BG = RGBA5.fromInts(20, 25, 14, 224);
|
|
2944
|
+
var TYPEBAR_BORDER = RGBA5.fromInts(204, 255, 77, 92);
|
|
3330
2945
|
function createTypeBar(renderer) {
|
|
3331
2946
|
const background = new BoxRenderable(renderer, {
|
|
3332
2947
|
id: "typebar-card",
|
|
@@ -3474,7 +3089,7 @@ function formatFooter(footer, width) {
|
|
|
3474
3089
|
chunks.push(cell.style(text));
|
|
3475
3090
|
used += visibleWidth(text);
|
|
3476
3091
|
});
|
|
3477
|
-
return new
|
|
3092
|
+
return new StyledText2(chunks);
|
|
3478
3093
|
}
|
|
3479
3094
|
|
|
3480
3095
|
// packages/cli/src/app-opentui/render/native-host.ts
|
|
@@ -3482,7 +3097,7 @@ import {
|
|
|
3482
3097
|
BoxRenderable as BoxRenderable2,
|
|
3483
3098
|
CodeRenderable,
|
|
3484
3099
|
DiffRenderable,
|
|
3485
|
-
RGBA as
|
|
3100
|
+
RGBA as RGBA6,
|
|
3486
3101
|
ScrollBoxRenderable as ScrollBoxRenderable2,
|
|
3487
3102
|
SyntaxStyle,
|
|
3488
3103
|
TextRenderable as TextRenderable3,
|
|
@@ -3493,19 +3108,19 @@ function rigSyntaxStyle() {
|
|
|
3493
3108
|
if (syntaxStyle)
|
|
3494
3109
|
return syntaxStyle;
|
|
3495
3110
|
syntaxStyle = SyntaxStyle.fromStyles({
|
|
3496
|
-
keyword: { fg:
|
|
3497
|
-
string: { fg:
|
|
3498
|
-
number: { fg:
|
|
3499
|
-
comment: { fg:
|
|
3500
|
-
function: { fg:
|
|
3501
|
-
type: { fg:
|
|
3502
|
-
constant: { fg:
|
|
3503
|
-
default: { fg:
|
|
3111
|
+
keyword: { fg: RGBA6.fromHex(RIG_UI.magenta), bold: true },
|
|
3112
|
+
string: { fg: RGBA6.fromHex(RIG_UI.lime) },
|
|
3113
|
+
number: { fg: RGBA6.fromHex(RIG_UI.cyan) },
|
|
3114
|
+
comment: { fg: RGBA6.fromHex(RIG_UI.ink4), italic: true },
|
|
3115
|
+
function: { fg: RGBA6.fromHex(RIG_UI.cyan) },
|
|
3116
|
+
type: { fg: RGBA6.fromHex(RIG_UI.limeDim) },
|
|
3117
|
+
constant: { fg: RGBA6.fromHex(RIG_UI.yellow) },
|
|
3118
|
+
default: { fg: RGBA6.fromHex(RIG_UI.ink2) }
|
|
3504
3119
|
});
|
|
3505
3120
|
return syntaxStyle;
|
|
3506
3121
|
}
|
|
3507
3122
|
function tableContent(rows) {
|
|
3508
|
-
return rows.map((row, rowIndex) => row.map((cell) => [{ __isChunk: true, text: cell, fg:
|
|
3123
|
+
return rows.map((row, rowIndex) => row.map((cell) => [{ __isChunk: true, text: cell, fg: RGBA6.fromHex(rowIndex === 0 ? RIG_UI.ink3 : RIG_UI.ink2) }]));
|
|
3509
3124
|
}
|
|
3510
3125
|
function createNativeHost(renderer) {
|
|
3511
3126
|
try {
|
|
@@ -3604,7 +3219,7 @@ function destroyNativeHost(host) {
|
|
|
3604
3219
|
}
|
|
3605
3220
|
|
|
3606
3221
|
// packages/cli/src/app-opentui/runtime.ts
|
|
3607
|
-
var PRELOADER_BACKDROP =
|
|
3222
|
+
var PRELOADER_BACKDROP = RGBA7.fromHex(RIG_UI.bg);
|
|
3608
3223
|
function inboxPendingCount(state) {
|
|
3609
3224
|
const inbox = state.data.inbox;
|
|
3610
3225
|
if (!inbox || typeof inbox !== "object" || Array.isArray(inbox))
|
|
@@ -3701,7 +3316,7 @@ function buildNavStrip(state) {
|
|
|
3701
3316
|
chunks.push(otuiBold(styles.yellow(String(badgeCount))));
|
|
3702
3317
|
}
|
|
3703
3318
|
});
|
|
3704
|
-
return new
|
|
3319
|
+
return new StyledText3(chunks);
|
|
3705
3320
|
}
|
|
3706
3321
|
function renderedItemsOrStateItems(_state, renderedItems) {
|
|
3707
3322
|
return renderedItems ? [...renderedItems] : [];
|
|
@@ -3837,7 +3452,7 @@ function Backdrop(props) {
|
|
|
3837
3452
|
// packages/cli/src/app-opentui/react/SceneFrameView.tsx
|
|
3838
3453
|
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
3839
3454
|
import { useRenderer as useRenderer2 } from "@opentui/react";
|
|
3840
|
-
import { TextAttributes as
|
|
3455
|
+
import { TextAttributes as TextAttributes4 } from "@opentui/core";
|
|
3841
3456
|
|
|
3842
3457
|
// packages/cli/src/app-opentui/react/scroll.ts
|
|
3843
3458
|
var registries = new Set;
|
|
@@ -3859,7 +3474,7 @@ function scrollActiveBody(delta) {
|
|
|
3859
3474
|
// packages/cli/src/app-opentui/react/SceneFrameView.tsx
|
|
3860
3475
|
import { jsxDEV, Fragment } from "@opentui/react/jsx-dev-runtime";
|
|
3861
3476
|
function lineAttributes(line2) {
|
|
3862
|
-
return line2?.bold ?
|
|
3477
|
+
return line2?.bold ? TextAttributes4.BOLD : line2?.dim ? TextAttributes4.DIM : 0;
|
|
3863
3478
|
}
|
|
3864
3479
|
function lineContent(line2) {
|
|
3865
3480
|
return line2.styledText ?? line2.text ?? "";
|