@sma1lboy/rove 0.9.73 → 0.9.74
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/cli/index.js +310 -310
- package/dist/cli/kobe-run.js +310 -310
- package/dist/cli/pty-host-node.mjs +23 -5
- package/dist/cli/rove-run.js +310 -310
- package/package.json +1 -1
|
@@ -376,15 +376,33 @@ function frameToLine(frame) {
|
|
|
376
376
|
// ../kobe-daemon/src/daemon/pty-exit-store.ts
|
|
377
377
|
import { mkdirSync, readFileSync as readFileSync2, writeFileSync } from "node:fs";
|
|
378
378
|
import { dirname as dirname2 } from "node:path";
|
|
379
|
+
|
|
380
|
+
// ../kobe-daemon/src/daemon/terminal-rows.ts
|
|
381
|
+
var CURSOR_DOWN_RE = /\x1b\[(\d*)[BE]/g;
|
|
382
|
+
var CURSOR_POSITION_RE = /\x1b\[[\d;]*[Hf]/g;
|
|
383
|
+
var MAX_ROWS_PER_ESCAPE = 200;
|
|
384
|
+
var ANSI_RE = /\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)?|\x1b[@-_]/g;
|
|
385
|
+
function breakRowsOnCursorMotion(raw) {
|
|
386
|
+
return raw.replace(CURSOR_DOWN_RE, (_m, count) => `
|
|
387
|
+
`.repeat(Math.min(MAX_ROWS_PER_ESCAPE, Math.max(1, Number.parseInt(count, 10) || 1)))).replace(CURSOR_POSITION_RE, `
|
|
388
|
+
`);
|
|
389
|
+
}
|
|
390
|
+
function terminalRows(raw, maxLineChars) {
|
|
391
|
+
const plain = breakRowsOnCursorMotion(raw).replace(ANSI_RE, "").replace(/\r\n/g, `
|
|
392
|
+
`);
|
|
393
|
+
return plain.split(`
|
|
394
|
+
`).map((line) => {
|
|
395
|
+
const overwritten = line.split("\r").pop() ?? "";
|
|
396
|
+
return maxLineChars === undefined ? overwritten : overwritten.slice(0, maxLineChars);
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// ../kobe-daemon/src/daemon/pty-exit-store.ts
|
|
379
401
|
var MAX_RECORDS = 50;
|
|
380
402
|
var TAIL_LINES = 40;
|
|
381
403
|
var TAIL_LINE_CHARS = 500;
|
|
382
|
-
var ANSI_RE = /\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)?|\x1b[@-_]/g;
|
|
383
404
|
function plainTail(raw) {
|
|
384
|
-
const
|
|
385
|
-
`);
|
|
386
|
-
const lines = plain.split(`
|
|
387
|
-
`).map((line) => (line.split("\r").pop() ?? "").slice(0, TAIL_LINE_CHARS));
|
|
405
|
+
const lines = terminalRows(raw, TAIL_LINE_CHARS);
|
|
388
406
|
while (lines.length > 0 && (lines[lines.length - 1] ?? "").trim() === "")
|
|
389
407
|
lines.pop();
|
|
390
408
|
return lines.slice(-TAIL_LINES);
|