@h-rig/cli 0.0.6-alpha.86 → 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 +287 -578
- 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 +287 -578
- package/dist/src/app-opentui/command-palette.js +1 -0
- package/dist/src/app-opentui/drone.js +1 -0
- package/dist/src/app-opentui/index.js +127 -446
- package/dist/src/app-opentui/keymap.js +2 -387
- package/dist/src/app-opentui/list-search.d.ts +5 -1
- package/dist/src/app-opentui/list-search.js +2 -2
- 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 +107 -433
- package/dist/src/app-opentui/react/Backdrop.js +1 -0
- package/dist/src/app-opentui/react/ChromeHost.js +34 -410
- package/dist/src/app-opentui/react/SceneFrameView.js +55 -5
- package/dist/src/app-opentui/react/launch.js +171 -472
- package/dist/src/app-opentui/react/syntax.js +1 -0
- package/dist/src/app-opentui/registry.js +99 -487
- package/dist/src/app-opentui/render/graphics.js +1 -0
- package/dist/src/app-opentui/render/hover.d.ts +11 -0
- package/dist/src/app-opentui/render/hover.js +34 -0
- package/dist/src/app-opentui/render/native-host.js +1 -0
- package/dist/src/app-opentui/render/panels.js +50 -3
- package/dist/src/app-opentui/render/preloader.js +1 -0
- package/dist/src/app-opentui/render/scene.js +1 -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/render/text.d.ts +13 -0
- package/dist/src/app-opentui/render/text.js +54 -5
- package/dist/src/app-opentui/render/type-bar.js +1 -0
- package/dist/src/app-opentui/runtime.js +127 -446
- package/dist/src/app-opentui/scenes/command.js +1 -0
- package/dist/src/app-opentui/scenes/doctor.js +1 -0
- package/dist/src/app-opentui/scenes/error.js +1 -0
- package/dist/src/app-opentui/scenes/family-domains/agent.js +1 -0
- package/dist/src/app-opentui/scenes/family-domains/browser.js +1 -0
- package/dist/src/app-opentui/scenes/family-domains/dist.js +1 -0
- package/dist/src/app-opentui/scenes/family-domains/git.js +1 -0
- package/dist/src/app-opentui/scenes/family-domains/github.js +1 -0
- package/dist/src/app-opentui/scenes/family-domains/harness.js +1 -0
- package/dist/src/app-opentui/scenes/family-domains/index.js +1 -0
- package/dist/src/app-opentui/scenes/family-domains/kit.js +1 -0
- package/dist/src/app-opentui/scenes/family-domains/profile.js +1 -0
- package/dist/src/app-opentui/scenes/family-domains/queue.js +1 -0
- package/dist/src/app-opentui/scenes/family-domains/remote.js +1 -0
- package/dist/src/app-opentui/scenes/family-domains/review.js +1 -0
- package/dist/src/app-opentui/scenes/family-domains/setup.js +1 -0
- package/dist/src/app-opentui/scenes/family-domains/stats.js +1 -0
- package/dist/src/app-opentui/scenes/family.js +1 -0
- package/dist/src/app-opentui/scenes/fleet.js +3 -5
- package/dist/src/app-opentui/scenes/handoff.js +1 -0
- package/dist/src/app-opentui/scenes/help.js +1 -0
- package/dist/src/app-opentui/scenes/inbox.js +1 -0
- package/dist/src/app-opentui/scenes/init.js +1 -0
- package/dist/src/app-opentui/scenes/inspect.js +1 -0
- package/dist/src/app-opentui/scenes/main.js +1 -0
- package/dist/src/app-opentui/scenes/pi.js +1 -0
- package/dist/src/app-opentui/scenes/plugin.js +1 -0
- package/dist/src/app-opentui/scenes/repo.js +1 -0
- package/dist/src/app-opentui/scenes/run-detail.js +1 -0
- package/dist/src/app-opentui/scenes/server.js +1 -0
- package/dist/src/app-opentui/scenes/tasks.js +3 -5
- package/dist/src/app-opentui/scenes/workspace.js +1 -0
- package/dist/src/app-opentui/selectable.js +1 -0
- package/dist/src/app-opentui/theme.d.ts +1 -0
- package/dist/src/app-opentui/theme.js +1 -0
- 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
|
@@ -1,404 +1,10 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// packages/cli/src/app-opentui/pi-pty-host.ts
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
import { basename } from "path";
|
|
5
|
-
import { RGBA, StyledText, TextAttributes } from "@opentui/core";
|
|
6
|
-
import { Terminal as XtermTerminal } from "@xterm/headless";
|
|
7
|
-
var MIN_COLS = 40;
|
|
8
|
-
var MIN_ROWS = 12;
|
|
9
|
-
var MAX_ROWS = 300;
|
|
10
|
-
var MAX_SNAPSHOT_LINES = 360;
|
|
11
|
-
var STYLED_SNAPSHOT_MARGIN = 6;
|
|
12
|
-
var SNAPSHOT_DELAY_MS = 120;
|
|
13
|
-
var fallbackChildScriptPath = fileURLToPath(new URL("./pi-host-child.ts", import.meta.url));
|
|
14
|
-
var activeHost = null;
|
|
15
|
-
function clampCols(cols) {
|
|
16
|
-
return Math.max(MIN_COLS, Math.trunc(cols || 100));
|
|
17
|
-
}
|
|
18
|
-
function clampRows(rows) {
|
|
19
|
-
return Math.max(MIN_ROWS, Math.min(MAX_ROWS, Math.trunc(rows || 35)));
|
|
20
|
-
}
|
|
21
|
-
var XTERM_COLOR_MODE_INDEXED_16 = 16777216;
|
|
22
|
-
var XTERM_COLOR_MODE_INDEXED_256 = 33554432;
|
|
23
|
-
var XTERM_COLOR_MODE_RGB = 50331648;
|
|
24
|
-
function rgbaFromXtermColor(mode, value) {
|
|
25
|
-
if (mode === 1 || mode === 2 || mode === XTERM_COLOR_MODE_INDEXED_16 || mode === XTERM_COLOR_MODE_INDEXED_256) {
|
|
26
|
-
return RGBA.fromIndex(value);
|
|
27
|
-
}
|
|
28
|
-
if (mode === 3 || mode === XTERM_COLOR_MODE_RGB) {
|
|
29
|
-
return RGBA.fromInts(value >> 16 & 255, value >> 8 & 255, value & 255);
|
|
30
|
-
}
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
function textAttributesFromCell(cell) {
|
|
34
|
-
let attributes = TextAttributes.NONE;
|
|
35
|
-
if (cell.isBold())
|
|
36
|
-
attributes |= TextAttributes.BOLD;
|
|
37
|
-
if (cell.isDim())
|
|
38
|
-
attributes |= TextAttributes.DIM;
|
|
39
|
-
if (cell.isItalic())
|
|
40
|
-
attributes |= TextAttributes.ITALIC;
|
|
41
|
-
if (cell.isUnderline())
|
|
42
|
-
attributes |= TextAttributes.UNDERLINE;
|
|
43
|
-
if (cell.isBlink())
|
|
44
|
-
attributes |= TextAttributes.BLINK;
|
|
45
|
-
if (cell.isInverse())
|
|
46
|
-
attributes |= TextAttributes.INVERSE;
|
|
47
|
-
if (cell.isInvisible())
|
|
48
|
-
attributes |= TextAttributes.HIDDEN;
|
|
49
|
-
if (cell.isStrikethrough())
|
|
50
|
-
attributes |= TextAttributes.STRIKETHROUGH;
|
|
51
|
-
return attributes;
|
|
52
|
-
}
|
|
53
|
-
function sameRgba(a, b) {
|
|
54
|
-
if (!a && !b)
|
|
55
|
-
return true;
|
|
56
|
-
return Boolean(a && b && a.equals(b));
|
|
57
|
-
}
|
|
58
|
-
function sameStyle(a, b) {
|
|
59
|
-
return sameRgba(a.fg, b.fg) && sameRgba(a.bg, b.bg) && (a.attributes ?? 0) === (b.attributes ?? 0);
|
|
60
|
-
}
|
|
61
|
-
function styleFromCell(cell) {
|
|
62
|
-
return {
|
|
63
|
-
fg: rgbaFromXtermColor(cell.getFgColorMode(), cell.getFgColor()),
|
|
64
|
-
bg: rgbaFromXtermColor(cell.getBgColorMode(), cell.getBgColor()),
|
|
65
|
-
attributes: textAttributesFromCell(cell)
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function lineToStyledText(line, cols) {
|
|
69
|
-
if (!line)
|
|
70
|
-
return new StyledText([{ __isChunk: true, text: "" }]);
|
|
71
|
-
const chunks = [];
|
|
72
|
-
let run = "";
|
|
73
|
-
let runStyle = null;
|
|
74
|
-
const flush = () => {
|
|
75
|
-
if (!run)
|
|
76
|
-
return;
|
|
77
|
-
chunks.push({
|
|
78
|
-
__isChunk: true,
|
|
79
|
-
text: run,
|
|
80
|
-
...runStyle?.fg ? { fg: runStyle.fg } : {},
|
|
81
|
-
...runStyle?.bg ? { bg: runStyle.bg } : {},
|
|
82
|
-
...(runStyle?.attributes ?? 0) !== 0 ? { attributes: runStyle.attributes } : {}
|
|
83
|
-
});
|
|
84
|
-
run = "";
|
|
85
|
-
};
|
|
86
|
-
for (let index = 0;index < cols; index += 1) {
|
|
87
|
-
const cell = line.getCell(index);
|
|
88
|
-
if (!cell) {
|
|
89
|
-
if (runStyle !== null)
|
|
90
|
-
flush();
|
|
91
|
-
runStyle = null;
|
|
92
|
-
run += " ";
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
if (cell.getWidth() === 0)
|
|
96
|
-
continue;
|
|
97
|
-
const style = styleFromCell(cell);
|
|
98
|
-
if (!runStyle || !sameStyle(runStyle, style)) {
|
|
99
|
-
flush();
|
|
100
|
-
runStyle = style;
|
|
101
|
-
}
|
|
102
|
-
run += cell.getChars() || " ";
|
|
103
|
-
}
|
|
104
|
-
flush();
|
|
105
|
-
return new StyledText(chunks.length > 0 ? chunks : [{ __isChunk: true, text: "" }]);
|
|
106
|
-
}
|
|
107
|
-
function childCommandPrefix() {
|
|
108
|
-
const execName = basename(process.execPath).toLowerCase();
|
|
109
|
-
const currentEntry = process.argv[1];
|
|
110
|
-
if (execName === "bun" || execName === "bun.exe") {
|
|
111
|
-
return currentEntry ? [process.execPath, currentEntry, "__opentui-pi-host"] : [process.execPath, fallbackChildScriptPath];
|
|
112
|
-
}
|
|
113
|
-
return [process.execPath, "__opentui-pi-host"];
|
|
114
|
-
}
|
|
115
|
-
function withEnv(base) {
|
|
116
|
-
const env = {};
|
|
117
|
-
for (const [key, value] of Object.entries(base ?? process.env)) {
|
|
118
|
-
if (key === "RIG_PLAIN" || key === "RIG_CLI_PLAIN_HELP" || key === "NO_COLOR")
|
|
119
|
-
continue;
|
|
120
|
-
if (typeof value === "string")
|
|
121
|
-
env[key] = value;
|
|
122
|
-
}
|
|
123
|
-
return {
|
|
124
|
-
...env,
|
|
125
|
-
TERM: "xterm-256color",
|
|
126
|
-
COLORTERM: "truecolor",
|
|
127
|
-
FORCE_COLOR: env.FORCE_COLOR ?? "1",
|
|
128
|
-
RIG_OPENTUI_PI_HOST: "1"
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
3
|
function getActivePiHost() {
|
|
132
|
-
return
|
|
133
|
-
}
|
|
134
|
-
async function startPiPtyHost(options) {
|
|
135
|
-
activeHost?.dispose("replace");
|
|
136
|
-
const host = new PiPtyHost(options);
|
|
137
|
-
activeHost = host;
|
|
138
|
-
await host.start();
|
|
139
|
-
return host;
|
|
140
|
-
}
|
|
141
|
-
function stopActivePiHost(reason = "detach") {
|
|
142
|
-
activeHost?.dispose(reason);
|
|
143
|
-
activeHost = null;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
class PiPtyHost {
|
|
147
|
-
runId;
|
|
148
|
-
projectRoot;
|
|
149
|
-
onSnapshot;
|
|
150
|
-
onExit;
|
|
151
|
-
onError;
|
|
152
|
-
terminal;
|
|
153
|
-
disposables = [];
|
|
154
|
-
decoder = new TextDecoder("utf-8");
|
|
155
|
-
proc = null;
|
|
156
|
-
pty = null;
|
|
157
|
-
status = "starting";
|
|
158
|
-
cols;
|
|
159
|
-
rows;
|
|
160
|
-
message = "starting bundled Pi";
|
|
161
|
-
lastResizeError = null;
|
|
162
|
-
exitCode;
|
|
163
|
-
signal;
|
|
164
|
-
notifyTimer = null;
|
|
165
|
-
lastStreamKey = "";
|
|
166
|
-
_disposed = false;
|
|
167
|
-
constructor(options) {
|
|
168
|
-
this.runId = options.runId;
|
|
169
|
-
this.projectRoot = options.projectRoot;
|
|
170
|
-
this.cols = clampCols(options.cols);
|
|
171
|
-
this.rows = clampRows(options.rows);
|
|
172
|
-
this.onSnapshot = options.onSnapshot;
|
|
173
|
-
this.onExit = options.onExit;
|
|
174
|
-
this.onError = options.onError;
|
|
175
|
-
this.terminal = new XtermTerminal({
|
|
176
|
-
allowProposedApi: true,
|
|
177
|
-
cols: this.cols,
|
|
178
|
-
rows: this.rows,
|
|
179
|
-
scrollback: 1000
|
|
180
|
-
});
|
|
181
|
-
this.registerTerminalResponders();
|
|
182
|
-
this.disposables.push(this.terminal.onWriteParsed(() => {
|
|
183
|
-
if (this._disposed)
|
|
184
|
-
return;
|
|
185
|
-
const snapshot = this.createSnapshot();
|
|
186
|
-
const key = snapshot.lines.join(`
|
|
187
|
-
`);
|
|
188
|
-
if (key === this.lastStreamKey)
|
|
189
|
-
return;
|
|
190
|
-
this.lastStreamKey = key;
|
|
191
|
-
this.onSnapshot?.(snapshot);
|
|
192
|
-
}));
|
|
193
|
-
}
|
|
194
|
-
get disposed() {
|
|
195
|
-
return this._disposed;
|
|
196
|
-
}
|
|
197
|
-
get snapshot() {
|
|
198
|
-
return this.createSnapshot();
|
|
199
|
-
}
|
|
200
|
-
async start() {
|
|
201
|
-
if (this._disposed)
|
|
202
|
-
throw new Error("Pi PTY host is disposed.");
|
|
203
|
-
if (typeof Bun.Terminal !== "function") {
|
|
204
|
-
throw new Error("Bun native PTY is unavailable in this runtime. Pi host requires Bun.Terminal.");
|
|
205
|
-
}
|
|
206
|
-
const spawnOptions = {
|
|
207
|
-
cwd: this.projectRoot,
|
|
208
|
-
env: withEnv(process.env),
|
|
209
|
-
terminal: {
|
|
210
|
-
cols: this.cols,
|
|
211
|
-
rows: this.rows,
|
|
212
|
-
name: "xterm-256color",
|
|
213
|
-
data: (_terminal, data) => this.handlePtyData(data)
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
const proc = Bun.spawn([
|
|
217
|
-
...childCommandPrefix(),
|
|
218
|
-
"--run-id",
|
|
219
|
-
this.runId,
|
|
220
|
-
"--project-root",
|
|
221
|
-
this.projectRoot
|
|
222
|
-
], spawnOptions);
|
|
223
|
-
if (!proc.terminal)
|
|
224
|
-
throw new Error("Bun did not attach a terminal to the bundled Pi child process.");
|
|
225
|
-
this.proc = proc;
|
|
226
|
-
this.pty = proc.terminal;
|
|
227
|
-
this.status = "running";
|
|
228
|
-
this.message = "bundled Pi running inside this app";
|
|
229
|
-
this.emitSnapshotSoon(0);
|
|
230
|
-
proc.exited.then((exitCode) => {
|
|
231
|
-
if (this._disposed)
|
|
232
|
-
return;
|
|
233
|
-
this.status = exitCode === 0 ? "exited" : "failed";
|
|
234
|
-
this.exitCode = exitCode;
|
|
235
|
-
this.signal = null;
|
|
236
|
-
this.message = exitCode === 0 ? "bundled Pi exited" : `bundled Pi exited with code ${exitCode}`;
|
|
237
|
-
const snapshot = this.createSnapshot();
|
|
238
|
-
this.onSnapshot?.(snapshot);
|
|
239
|
-
this.onExit?.(snapshot);
|
|
240
|
-
if (activeHost === this)
|
|
241
|
-
activeHost = null;
|
|
242
|
-
this.dispose("exit", { kill: false, notify: false });
|
|
243
|
-
}).catch((error) => {
|
|
244
|
-
if (this._disposed)
|
|
245
|
-
return;
|
|
246
|
-
this.status = "failed";
|
|
247
|
-
this.message = error instanceof Error ? error.message : String(error);
|
|
248
|
-
const snapshot = this.createSnapshot();
|
|
249
|
-
this.onSnapshot?.(snapshot);
|
|
250
|
-
this.onError?.(error, snapshot);
|
|
251
|
-
if (activeHost === this)
|
|
252
|
-
activeHost = null;
|
|
253
|
-
this.dispose("error", { kill: false, notify: false });
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
write(data) {
|
|
257
|
-
if (this._disposed || !this.pty)
|
|
258
|
-
return;
|
|
259
|
-
try {
|
|
260
|
-
this.pty.write(data);
|
|
261
|
-
} catch (error) {
|
|
262
|
-
this.status = "failed";
|
|
263
|
-
this.message = error instanceof Error ? error.message : String(error);
|
|
264
|
-
const snapshot = this.createSnapshot();
|
|
265
|
-
this.onSnapshot?.(snapshot);
|
|
266
|
-
this.onError?.(error, snapshot);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
resize(cols, rows) {
|
|
270
|
-
const nextCols = clampCols(cols);
|
|
271
|
-
const nextRows = clampRows(rows);
|
|
272
|
-
if (nextCols === this.cols && nextRows === this.rows)
|
|
273
|
-
return;
|
|
274
|
-
this.cols = nextCols;
|
|
275
|
-
this.rows = nextRows;
|
|
276
|
-
this.terminal.resize(nextCols, nextRows);
|
|
277
|
-
try {
|
|
278
|
-
this.pty?.resize(nextCols, nextRows);
|
|
279
|
-
this.lastResizeError = null;
|
|
280
|
-
} catch (error) {
|
|
281
|
-
this.lastResizeError = error instanceof Error ? error.message : String(error);
|
|
282
|
-
}
|
|
283
|
-
this.emitSnapshotSoon(0);
|
|
284
|
-
}
|
|
285
|
-
detach() {
|
|
286
|
-
this.dispose("detach");
|
|
287
|
-
return this.createSnapshot("detached from bundled Pi");
|
|
288
|
-
}
|
|
289
|
-
dispose(reason = "dispose", options = {}) {
|
|
290
|
-
if (this._disposed)
|
|
291
|
-
return;
|
|
292
|
-
this._disposed = true;
|
|
293
|
-
if (this.notifyTimer)
|
|
294
|
-
clearTimeout(this.notifyTimer);
|
|
295
|
-
this.notifyTimer = null;
|
|
296
|
-
for (const disposable of this.disposables.splice(0)) {
|
|
297
|
-
try {
|
|
298
|
-
disposable.dispose();
|
|
299
|
-
} catch {}
|
|
300
|
-
}
|
|
301
|
-
if (options.kill !== false) {
|
|
302
|
-
try {
|
|
303
|
-
this.proc?.kill("SIGTERM");
|
|
304
|
-
} catch {}
|
|
305
|
-
}
|
|
306
|
-
try {
|
|
307
|
-
this.pty?.close();
|
|
308
|
-
} catch {}
|
|
309
|
-
try {
|
|
310
|
-
this.terminal.dispose();
|
|
311
|
-
} catch {}
|
|
312
|
-
if (activeHost === this)
|
|
313
|
-
activeHost = null;
|
|
314
|
-
if (options.notify) {
|
|
315
|
-
this.message = reason;
|
|
316
|
-
this.onSnapshot?.(this.createSnapshot(reason));
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
handlePtyData(data) {
|
|
320
|
-
if (this._disposed)
|
|
321
|
-
return;
|
|
322
|
-
const text = this.decoder.decode(data, { stream: true });
|
|
323
|
-
this.respondToRawTerminalQueries(text);
|
|
324
|
-
this.terminal.write(data);
|
|
325
|
-
}
|
|
326
|
-
emitSnapshotSoon(delayMs = SNAPSHOT_DELAY_MS) {
|
|
327
|
-
if (this._disposed || this.notifyTimer)
|
|
328
|
-
return;
|
|
329
|
-
this.notifyTimer = setTimeout(() => {
|
|
330
|
-
this.notifyTimer = null;
|
|
331
|
-
if (this._disposed)
|
|
332
|
-
return;
|
|
333
|
-
this.onSnapshot?.(this.createSnapshot());
|
|
334
|
-
}, delayMs);
|
|
335
|
-
}
|
|
336
|
-
createSnapshot(message = this.message) {
|
|
337
|
-
const buffer = this.terminal.buffer.active;
|
|
338
|
-
const end = buffer.length;
|
|
339
|
-
const start = Math.max(0, end - MAX_SNAPSHOT_LINES);
|
|
340
|
-
const styledStart = Math.max(start, end - this.rows - STYLED_SNAPSHOT_MARGIN);
|
|
341
|
-
const lines = [];
|
|
342
|
-
const styledLines = [];
|
|
343
|
-
for (let row = start;row < end; row += 1) {
|
|
344
|
-
const line = buffer.getLine(row);
|
|
345
|
-
lines.push((line?.translateToString(false) ?? "").slice(0, this.cols));
|
|
346
|
-
if (row >= styledStart)
|
|
347
|
-
styledLines[lines.length - 1] = lineToStyledText(line, this.cols);
|
|
348
|
-
}
|
|
349
|
-
while (lines.length < this.rows) {
|
|
350
|
-
lines.push("");
|
|
351
|
-
styledLines[lines.length - 1] = new StyledText([{ __isChunk: true, text: "" }]);
|
|
352
|
-
}
|
|
353
|
-
const resolvedMessage = this.lastResizeError ? `resize degraded: ${this.lastResizeError}` : message;
|
|
354
|
-
return {
|
|
355
|
-
runId: this.runId,
|
|
356
|
-
status: this.status,
|
|
357
|
-
cols: this.cols,
|
|
358
|
-
rows: this.rows,
|
|
359
|
-
lines,
|
|
360
|
-
styledLines,
|
|
361
|
-
message: resolvedMessage,
|
|
362
|
-
...this.lastResizeError ? { resizeError: this.lastResizeError } : {},
|
|
363
|
-
...this.exitCode !== undefined ? { exitCode: this.exitCode } : {},
|
|
364
|
-
...this.signal !== undefined ? { signal: this.signal } : {}
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
registerTerminalResponders() {
|
|
368
|
-
this.disposables.push(this.terminal.parser.registerCsiHandler({ final: "c" }, (params) => {
|
|
369
|
-
if (params.length === 0 || params[0] === 0)
|
|
370
|
-
this.write("\x1B[?62;22c");
|
|
371
|
-
return false;
|
|
372
|
-
}));
|
|
373
|
-
this.disposables.push(this.terminal.parser.registerCsiHandler({ prefix: ">", final: "c" }, (params) => {
|
|
374
|
-
if (params.length === 0 || params[0] === 0)
|
|
375
|
-
this.write("\x1B[>0;0;0c");
|
|
376
|
-
return false;
|
|
377
|
-
}));
|
|
378
|
-
this.disposables.push(this.terminal.parser.registerCsiHandler({ final: "n" }, (params) => {
|
|
379
|
-
if (params[0] === 5) {
|
|
380
|
-
this.write("\x1B[0n");
|
|
381
|
-
} else if (params[0] === 6) {
|
|
382
|
-
const row = this.terminal.buffer.active.cursorY + 1;
|
|
383
|
-
const col = this.terminal.buffer.active.cursorX + 1;
|
|
384
|
-
this.write(`\x1B[${row};${col}R`);
|
|
385
|
-
}
|
|
386
|
-
return false;
|
|
387
|
-
}));
|
|
388
|
-
}
|
|
389
|
-
respondToRawTerminalQueries(text) {
|
|
390
|
-
if (!text)
|
|
391
|
-
return;
|
|
392
|
-
const decrqm = /\x1b\[\?(\d+)\$p/g;
|
|
393
|
-
let match;
|
|
394
|
-
while ((match = decrqm.exec(text)) !== null) {
|
|
395
|
-
this.write(`\x1B[?${match[1]};2$y`);
|
|
396
|
-
}
|
|
397
|
-
}
|
|
4
|
+
return null;
|
|
398
5
|
}
|
|
6
|
+
function stopActivePiHost(_reason) {}
|
|
399
7
|
export {
|
|
400
8
|
stopActivePiHost,
|
|
401
|
-
|
|
402
|
-
getActivePiHost,
|
|
403
|
-
PiPtyHost
|
|
9
|
+
getActivePiHost
|
|
404
10
|
};
|