Problem
Generated commands can receive binary responses, but pkg/runtime/client.go::doRawFullOnce always buffers the full body in memory. The output path then treats the result like ordinary formatter input; users must know to select raw output, and large downloads remain fully buffered.
This makes generated commands unsuitable for large artifacts and can corrupt terminal output when a binary response is handled through a text-oriented default formatter.
Proposal
Provide an explicit binary-response execution path based on the declared response media type or schema format.
- Stream successful response bytes directly to an explicitly selected file or stdout.
- Keep non-2xx bodies in the normal bounded error path.
- Avoid writing binary bytes to an interactive terminal without explicit user intent.
- Define overwrite behavior and never silently replace an existing file.
- Close partial files safely on cancellation or read failure.
Binary request bodies already work through --file; this issue is limited to response handling and avoiding full-response buffering.
Alternatives considered
-o raw preserves bytes but still buffers the complete response and does not provide safe file ownership or terminal behavior.
Acceptance criteria
- A large test response is copied without retaining the complete body in memory.
- stdout and file destinations preserve byte-for-byte content.
- Cancellation closes the response and leaves no successful-looking partial artifact.
- Existing JSON/table/yaml/raw behavior remains unchanged for non-binary responses.
- Catalog and generated Skill metadata explain the required output mode.
Affected surface
Runtime HTTP/auth/body/output behavior; command catalog; generated Skill docs.
Problem
Generated commands can receive binary responses, but
pkg/runtime/client.go::doRawFullOncealways buffers the full body in memory. The output path then treats the result like ordinary formatter input; users must know to select raw output, and large downloads remain fully buffered.This makes generated commands unsuitable for large artifacts and can corrupt terminal output when a binary response is handled through a text-oriented default formatter.
Proposal
Provide an explicit binary-response execution path based on the declared response media type or schema format.
Binary request bodies already work through
--file; this issue is limited to response handling and avoiding full-response buffering.Alternatives considered
-o rawpreserves bytes but still buffers the complete response and does not provide safe file ownership or terminal behavior.Acceptance criteria
Affected surface
Runtime HTTP/auth/body/output behavior; command catalog; generated Skill docs.