@linxiraos/pi-tui 1.3.2 → 1.4.1
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/CHANGELOG.md +181 -181
- package/dist/types/apps/session-picker.d.ts +13 -1
- package/dist/types/autocomplete.d.ts +6 -0
- package/dist/types/components/sparkline.d.ts +34 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/native/describe.d.ts +7 -1
- package/dist/types/native/overlay.d.ts +2 -0
- package/dist/types/native/tone.d.ts +2 -0
- package/dist/types/overlays/agent-hub.d.ts +3 -3
- package/dist/types/overlays/approval-dialog.d.ts +15 -1
- package/dist/types/overlays/jobs-panel.d.ts +3 -0
- package/dist/types/overlays/model-browser.d.ts +1 -1
- package/dist/types/overlays/resume-picker.d.ts +293 -0
- package/dist/types/overlays/resume-tree.d.ts +353 -0
- package/dist/types/overlays/session-selector.d.ts +22 -4
- package/dist/types/render/output-block.d.ts +2 -0
- package/dist/types/render/tool-card.d.ts +2 -0
- package/dist/types/sixel.d.ts +28 -0
- package/dist/types/status-line/host.d.ts +3 -0
- package/dist/types/terminal-capabilities.d.ts +6 -1
- package/dist/types/tools/bash.d.ts +2 -0
- package/dist/types/tools/default-renderer.d.ts +3 -0
- package/dist/types/tools/eval.d.ts +9 -8
- package/dist/types/tools/hub.d.ts +3 -1
- package/dist/types/tools/irc.d.ts +11 -1
- package/dist/types/tools/job-widget.d.ts +226 -0
- package/dist/types/tools/json-tree.d.ts +2 -0
- package/dist/types/tools/line-ranges.d.ts +8 -1
- package/dist/types/tools/mcp.d.ts +23 -0
- package/dist/types/tools/output-meta.d.ts +1 -1
- package/dist/types/tools/read.d.ts +8 -2
- package/dist/types/tools/renderer.d.ts +8 -2
- package/dist/types/tools/result-card.d.ts +1 -1
- package/dist/types/tools/streaming-output.d.ts +1 -0
- package/dist/types/tools/task.d.ts +12 -0
- package/dist/types/tools/wait.d.ts +11 -0
- package/package.json +9 -9
- package/src/apps/session-picker.ts +20 -2
- package/src/autocomplete.d.ts +6 -0
- package/src/autocomplete.ts +21 -6
- package/src/chat/skill-message.ts +16 -17
- package/src/chat/tool-execution.ts +35 -0
- package/src/chrome/transcript-container.ts +85 -13
- package/src/components/editor.ts +17 -7
- package/src/components/image.ts +5 -4
- package/src/components/markdown.ts +11 -3
- package/src/components/sparkline.d.ts +34 -0
- package/src/components/sparkline.ts +89 -0
- package/src/index.d.ts +1 -0
- package/src/index.ts +1 -0
- package/src/native/backend.ts +32 -6
- package/src/native/describe.d.ts +7 -1
- package/src/native/describe.ts +18 -1
- package/src/native/overlay.d.ts +2 -0
- package/src/native/overlay.ts +3 -0
- package/src/native/tone.d.ts +2 -0
- package/src/native/tone.ts +22 -0
- package/src/overlays/agent-hub.ts +14 -10
- package/src/overlays/agent-transcript-viewer.ts +2 -2
- package/src/overlays/agents-hub.ts +2 -1
- package/src/overlays/approval-dialog.ts +59 -13
- package/src/overlays/hub-frame.ts +2 -1
- package/src/overlays/jobs-panel.ts +24 -2
- package/src/overlays/model-browser.ts +3 -0
- package/src/overlays/model-hub.ts +2 -1
- package/src/overlays/resume-picker.ts +706 -0
- package/src/overlays/resume-tree.ts +1901 -0
- package/src/overlays/session-selector.ts +579 -39
- package/src/prompt/attachment-chips.ts +1 -1
- package/src/render/output-block.d.ts +2 -0
- package/src/render/output-block.ts +25 -12
- package/src/render/tool-card.d.ts +2 -0
- package/src/render/tool-card.ts +6 -0
- package/src/sixel.d.ts +28 -0
- package/src/sixel.ts +185 -0
- package/src/status-line/component.ts +19 -2
- package/src/status-line/host.ts +3 -0
- package/src/terminal-capabilities.d.ts +6 -1
- package/src/terminal-capabilities.ts +54 -3
- package/src/theme/symbols.ts +5 -3
- package/src/tools/bash.d.ts +2 -0
- package/src/tools/bash.ts +25 -9
- package/src/tools/default-renderer.d.ts +3 -0
- package/src/tools/default-renderer.ts +54 -17
- package/src/tools/eval.d.ts +9 -8
- package/src/tools/eval.ts +32 -14
- package/src/tools/find.ts +4 -5
- package/src/tools/glob.ts +4 -6
- package/src/tools/grep.ts +2 -4
- package/src/tools/hub.ts +4 -1
- package/src/tools/irc.d.ts +11 -1
- package/src/tools/irc.ts +11 -1
- package/src/tools/job-widget.d.ts +226 -0
- package/src/tools/job-widget.ts +1036 -0
- package/src/tools/json-tree.d.ts +2 -0
- package/src/tools/json-tree.ts +8 -0
- package/src/tools/line-ranges.d.ts +8 -1
- package/src/tools/line-ranges.ts +23 -13
- package/src/tools/mcp.d.ts +23 -0
- package/src/tools/mcp.ts +44 -1
- package/src/tools/output-meta.d.ts +1 -1
- package/src/tools/output-meta.ts +1 -1
- package/src/tools/proc-render.ts +1 -0
- package/src/tools/read.d.ts +8 -2
- package/src/tools/read.ts +64 -21
- package/src/tools/renderer.d.ts +8 -2
- package/src/tools/renderer.ts +8 -2
- package/src/tools/result-card.d.ts +1 -1
- package/src/tools/result-card.ts +1 -2
- package/src/tools/streaming-output.d.ts +1 -0
- package/src/tools/streaming-output.ts +11 -9
- package/src/tools/task.d.ts +12 -0
- package/src/tools/task.ts +25 -1
- package/src/tools/wait.d.ts +11 -0
- package/src/tools/wait.ts +296 -147
- package/src/tui.ts +45 -5
package/src/tui.ts
CHANGED
|
@@ -28,6 +28,7 @@ import { assumedTspHello, NativeBackend, type NativeHost } from "./native/backen
|
|
|
28
28
|
import { col } from "./native/describe";
|
|
29
29
|
import { TSP_PREFIX, type TspHello } from "./native/encode";
|
|
30
30
|
import type { DescribeContext, NativeNode, NativeScreen, NativeSurfaceProvider, NativeUiEvent } from "./native/node";
|
|
31
|
+
import { cropSixelTop } from "./sixel";
|
|
31
32
|
import { STDOUT_BACKLOG_CLEAR_BYTES, setAltScreenActive, type Terminal } from "./terminal";
|
|
32
33
|
import { classifyTerminalMultiplexerModule, terminalMultiplexerSessions } from "./terminal-multiplexer";
|
|
33
34
|
import {
|
|
@@ -36,6 +37,7 @@ import {
|
|
|
36
37
|
encodeKittyDeleteImage,
|
|
37
38
|
encodeKittyDeletePlacement,
|
|
38
39
|
encodeKittyPlacementLine,
|
|
40
|
+
getCellDimensions,
|
|
39
41
|
getTerminalBackgroundColor,
|
|
40
42
|
ImageProtocol,
|
|
41
43
|
isImageProtocolForced,
|
|
@@ -1022,6 +1024,8 @@ export class TUI extends Container {
|
|
|
1022
1024
|
#screenImagePlacements = new Map<number, LiveImagePlacement>();
|
|
1023
1025
|
#altImagePlacements = new Map<number, LiveImagePlacement>();
|
|
1024
1026
|
#nextImagePlacementId = 1;
|
|
1027
|
+
/** Last top-clipped SIXEL crop; only the block straddling row 0 is ever cropped. */
|
|
1028
|
+
#sixelCrop: { source: string; pixels: number; maxHeightPixels: number; output: string } | undefined;
|
|
1025
1029
|
#ghosttyInitialImageDelayDone = false;
|
|
1026
1030
|
#ghosttyInitialImageDelayTimer: RenderTimer | undefined;
|
|
1027
1031
|
#ghosttyImageReadyAtMs = 0;
|
|
@@ -3386,10 +3390,11 @@ export class TUI extends Container {
|
|
|
3386
3390
|
}
|
|
3387
3391
|
|
|
3388
3392
|
/**
|
|
3389
|
-
* Clip
|
|
3390
|
-
*
|
|
3391
|
-
*
|
|
3392
|
-
*
|
|
3393
|
+
* Clip direct placements to the visible source slice: Kitty tracks a live
|
|
3394
|
+
* placement owner, while SIXEL crops the encoded raster (iTerm2 images are
|
|
3395
|
+
* not cropped). SIXEL and iTerm2 have no delete command and composite over
|
|
3396
|
+
* existing pixels, so erase the visible rows they paint above `screenRow`
|
|
3397
|
+
* before repainting.
|
|
3393
3398
|
*/
|
|
3394
3399
|
#imageLineSequence(
|
|
3395
3400
|
line: string,
|
|
@@ -3400,7 +3405,16 @@ export class TUI extends Container {
|
|
|
3400
3405
|
if (screenRow < 0) return line;
|
|
3401
3406
|
const parsed = parseKittyDirectPlacementLine(line);
|
|
3402
3407
|
if (!parsed) {
|
|
3403
|
-
const
|
|
3408
|
+
const requestedLift = directPlacementLift(line);
|
|
3409
|
+
const lift = Math.min(requestedLift, screenRow);
|
|
3410
|
+
if (requestedLift > lift) {
|
|
3411
|
+
const cellHeight = getCellDimensions().heightPx;
|
|
3412
|
+
const cropPixels = Math.round((requestedLift - lift) * cellHeight);
|
|
3413
|
+
const maxHeightPixels = Math.floor((screenRow + 1) * cellHeight);
|
|
3414
|
+
line = line.replace(/\x1bP[0-9;]*q[\s\S]*?\x1b\\/g, sequence =>
|
|
3415
|
+
this.#cropSixel(sequence, cropPixels, maxHeightPixels),
|
|
3416
|
+
);
|
|
3417
|
+
}
|
|
3404
3418
|
return lift > 0 ? `\x1b[${lift}A${`${ERASE_LINE}\x1b[B`.repeat(lift)}${line}` : line;
|
|
3405
3419
|
}
|
|
3406
3420
|
const previous = placements?.get(placementRow);
|
|
@@ -3420,6 +3434,32 @@ export class TUI extends Container {
|
|
|
3420
3434
|
);
|
|
3421
3435
|
}
|
|
3422
3436
|
|
|
3437
|
+
/**
|
|
3438
|
+
* Crop a SIXEL raster whose top rows lie above the viewport. A raster the
|
|
3439
|
+
* cropper cannot parse is dropped: painting it whole would overwrite the
|
|
3440
|
+
* rows below the visible slice.
|
|
3441
|
+
*/
|
|
3442
|
+
#cropSixel(source: string, pixels: number, maxHeightPixels: number): string {
|
|
3443
|
+
const cached = this.#sixelCrop;
|
|
3444
|
+
if (
|
|
3445
|
+
cached !== undefined &&
|
|
3446
|
+
cached.pixels === pixels &&
|
|
3447
|
+
cached.maxHeightPixels === maxHeightPixels &&
|
|
3448
|
+
cached.source === source
|
|
3449
|
+
) {
|
|
3450
|
+
return cached.output;
|
|
3451
|
+
}
|
|
3452
|
+
let output: string;
|
|
3453
|
+
try {
|
|
3454
|
+
output = cropSixelTop(source, pixels, maxHeightPixels);
|
|
3455
|
+
} catch (err) {
|
|
3456
|
+
logger.warn("Dropping top-clipped SIXEL image that cannot be cropped", { err });
|
|
3457
|
+
output = "";
|
|
3458
|
+
}
|
|
3459
|
+
this.#sixelCrop = { source, pixels, maxHeightPixels, output };
|
|
3460
|
+
return output;
|
|
3461
|
+
}
|
|
3462
|
+
|
|
3423
3463
|
#terminalLine(line: PreparedLine): string {
|
|
3424
3464
|
if (line.hasOsc8) return line.terminalContent + LINE_TERMINATOR;
|
|
3425
3465
|
return line.terminalContent.endsWith(SEGMENT_RESET) ? line.terminalContent : line.terminalContent + SEGMENT_RESET;
|