SessionEnv.readFile() returns a complete string. The built-in tool then applies offset, limit, and its 50 KB output truncation after the full file has been read. Under a 128 MB runtime limit (e.g. Cloudflare Workers), attempting to read a 1 GB file will fail before truncation helps.
The SandboxApi should implement a normal read_at(path, offset, size?) so it can call repeated chunked reads so it can be used for chunk streaming for more efficient line by line reading. It can then collapse the readFile and readFileBuffer in the API into a single read_at that can be used by the higher level tools.
SessionEnv.readFile() returns a complete string. The built-in tool then applies offset, limit, and its 50 KB output truncation after the full file has been read. Under a 128 MB runtime limit (e.g. Cloudflare Workers), attempting to read a 1 GB file will fail before truncation helps.
The SandboxApi should implement a normal
read_at(path, offset, size?)so it can call repeated chunked reads so it can be used for chunk streaming for more efficient line by line reading. It can then collapse thereadFileandreadFileBufferin the API into a singleread_atthat can be used by the higher level tools.