fix: storage S3 stream conversion, API client FormData support, and attachment API

Fix S3 provider to use async generator for web stream conversion instead
of Readable.fromWeb, add postForm helper and attachment API methods to
the UI client, and add local disk storage provider tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Forgotten
2026-02-20 10:33:10 -06:00
parent 0a551e84e1
commit 6d0f58d559
4 changed files with 112 additions and 3 deletions

View File

@@ -40,7 +40,15 @@ async function toReadableStream(body: unknown): Promise<Readable> {
};
if (typeof candidate.transformToWebStream === "function") {
return Readable.fromWeb(candidate.transformToWebStream() as globalThis.ReadableStream<any>);
const webStream = candidate.transformToWebStream();
const reader = webStream.getReader();
return Readable.from((async function* () {
while (true) {
const { done, value } = await reader.read();
if (done) break;
if (value) yield value;
}
})());
}
if (typeof candidate.arrayBuffer === "function") {