mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-30 21:49:18 +01:00
Replace the 32 KB serial-printf base64 chunk loop in the command-managed writeFile with a single `base64 -d` process fed via stdin (temp file + atomic rename), collapsing thousands of serial round-trips into one. A bounded large-chunk stdin fallback covers payloads too big for one stdin string. Stream readFile downloads through the runner's onLog byte counter, decoding incrementally instead of buffering one big string. Make writeFile/readFile the byte-level source of truth via an optional per-call progress hook, and have prepareSandboxManagedRuntime own the phase labels (workspace + per-asset upload, workspace restore), direction, and throttled log lines via the shared runtime-progress reporter. Tests: O(1) upload process for a multi-MB payload with exact (binary-safe) bytes; streamed download reports monotonic progress to the total; upload and restore emit throttled, labeled, directional percentage lines.