Add image paste support for xterm.js terminal
Build App / build-linux (push) Successful in 2m41s
Build App / build-windows (push) Successful in 3m56s

Intercept clipboard paste events containing images in the terminal,
upload them into the Docker container via bollard's tar upload API,
and inject the resulting file path into terminal stdin so Claude Code
can reference the image.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
shadow-testandClaude Opus 4.6 committed 2026-03-01 10:52:08 -08:00
1 parent d947824436
commit db51abb970
6 files changed
+132 -1

No files matched your search

+9
View File
@@ -49,6 +49,14 @@ export function useTerminal() {
[],
);
const pasteImage = useCallback(
async (sessionId: string, imageData: Uint8Array) => {
const bytes = Array.from(imageData);
return commands.pasteImageToTerminal(sessionId, bytes);
},
[],
);
const onOutput = useCallback(
(sessionId: string, callback: (data: Uint8Array) => void) => {
const eventName = `terminal-output-${sessionId}`;
@@ -76,6 +84,7 @@ export function useTerminal() {
open,
close,
sendInput,
pasteImage,
resize,
onOutput,
onExit,