the universal sandbox runtime for agents and humans. pocketenv.io
sandbox openclaw agent claude-code vercel-sandbox deno-sandbox cloudflare-sandbox atproto sprites daytona
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

Guarantee newline for pty stdout and add sh

Ensure stdout written to the JSON parser is newline-terminated.
Add debug logging for pty stdout/stderr and include 'sh' in the
sandbox command args.

+8 -3
+8 -3
apps/api/src/pty/index.ts
··· 116 116 `--mode=client`, 117 117 `--cols=${process.stdout.columns ?? 80}`, 118 118 `--rows=${process.stdout.rows ?? 24}`, 119 + "sh", 119 120 ], 120 121 env: { 121 122 TERM, ··· 159 160 160 161 const listener = createListener(); 161 162 162 - // Pipe the pty-tunnel-server's stdout (running inside the sandbox) into the 163 - // listener so readConnectionInfo() can parse the JSON connection handshake. 163 + // Pipe the pty-tunnel-server's stdout into the listener so 164 + // readConnectionInfo() can parse the JSON connection handshake. 165 + // We also accept stderr in case the binary writes there instead. 164 166 (async () => { 165 167 for await (const log of cmd.logs()) { 168 + consola.debug(`pty-tunnel-server [${log.stream}]:`, log.data.trimEnd()); 166 169 if (log.stream === "stdout") { 167 - listener.stdoutStream.write(log.data); 170 + // jsonlines parser requires newline-terminated data 171 + const data = log.data.endsWith("\n") ? log.data : log.data + "\n"; 172 + listener.stdoutStream.write(data); 168 173 } 169 174 } 170 175 listener.stdoutStream.end();