Skip to content

SandboxApi readFile reads in entire file for all read tool operations #543

Description

@danthegoodman1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions