Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

feat: increase maximum payload and ciphertext size limits for image and file pastes

0xken15dc22118d5481
diff --git a/cli/src/lib/terminalBinary.ts b/cli/src/lib/terminalBinary.ts
index 20e8dc29d..58a3d0c79 100644
--- a/cli/src/lib/terminalBinary.ts
+++ b/cli/src/lib/terminalBinary.ts
@@ -21,14 +21,14 @@ export const TERMINAL_LOCAL_PASTE_MAX_PAYLOAD_BYTES = 6 * 1024 * 1024
// text paste, but the bytes are already-compressed PNG data rather than text — see
// `terminalStreamManager.ts`'s `pasteImage()`. Mirrors terminal_binary.dart's
// terminalLocalImagePasteMaxPayloadBytes — keep the two in step.
-export const TERMINAL_BINARY_IMAGE_PASTE_MAX_CIPHERTEXT_BYTES = 4 * 1024 * 1024
-export const TERMINAL_LOCAL_IMAGE_PASTE_MAX_PAYLOAD_BYTES = 4 * 1024 * 1024
+export const TERMINAL_BINARY_IMAGE_PASTE_MAX_CIPHERTEXT_BYTES = 8 * 1024 * 1024
+export const TERMINAL_LOCAL_IMAGE_PASTE_MAX_PAYLOAD_BYTES = 8 * 1024 * 1024
// A dropped (non-image) file, delivered whole so its path can be pasted on the far side — see
// terminalStreamManager.ts's pasteFile(). Ordinary files run larger than a screenshot, hence its
// own, more generous ceiling; this is a modest atomic-frame limit, not a general file-transfer
// feature. Mirrors terminal_binary.dart's terminalLocalPasteFileMaxPayloadBytes — keep in step.
-export const TERMINAL_BINARY_PASTE_FILE_MAX_CIPHERTEXT_BYTES = 10 * 1024 * 1024
-export const TERMINAL_LOCAL_PASTE_FILE_MAX_PAYLOAD_BYTES = 10 * 1024 * 1024
+export const TERMINAL_BINARY_PASTE_FILE_MAX_CIPHERTEXT_BYTES = 20 * 1024 * 1024
+export const TERMINAL_LOCAL_PASTE_FILE_MAX_PAYLOAD_BYTES = 20 * 1024 * 1024
export const enum TerminalBinaryKind {
input = 1,
diff --git a/cli/src/lib/terminalStreamManager.spec.ts b/cli/src/lib/terminalStreamManager.spec.ts
index e71ce0f86..ba3e3f47f 100644
--- a/cli/src/lib/terminalStreamManager.spec.ts
+++ b/cli/src/lib/terminalStreamManager.spec.ts
@@ -4,7 +4,7 @@ import type { RegisteredSession } from './registry.js'
import { TerminalStreamManager, terminalEngineCapabilities, UPLOAD_CHUNK_BYTES } from './terminalStreamManager.js'
import { TERMINAL_ACTION_SUCCEEDED, type TerminalStreamHandle, type TerminalStreamSink } from './terminalTypes.js'
import type { TerminalBackendCoordinator } from './terminalBackendCoordinator.js'
-import { TerminalBinaryKind, type TerminalBinaryClear } from './terminalBinary.js'
+import { TerminalBinaryKind, TERMINAL_LOCAL_IMAGE_PASTE_MAX_PAYLOAD_BYTES, type TerminalBinaryClear } from './terminalBinary.js'
import { writeImageToOsClipboard, type OsClipboardImageResult } from './osClipboard.js'
import { writePasteDropFile, writePasteImageFile } from './pasteDropFiles.js'
@@ -343,7 +343,7 @@ describe('TerminalStreamManager', () => {
it('rejects a begin over the per-kind size ceiling before any chunk is sent', async () => {
const streamId = await openStream()
- await begin(streamId, { uploadKind: 'image', totalBytes: 4 * 1024 * 1024 + 1 })
+ await begin(streamId, { uploadKind: 'image', totalBytes: TERMINAL_LOCAL_IMAGE_PASTE_MAX_PAYLOAD_BYTES + 1 })
expect(lastResult().payload).toMatchObject({ streamId, accepted: false })
expect(sent.some((f) => f.type === 'terminal_chunked_upload_progress')).toBe(false)
})