Skip to content

Commit affeb69

Browse files
committed
feat: sync providers and bound transit downloads
1 parent 962d735 commit affeb69

70 files changed

Lines changed: 9559 additions & 367 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/providers/agenty/runtime.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { ProviderFetch } from "../provider-runtime.ts";
33
import type { AgentyActionName } from "./actions.ts";
44

55
import { compactObject, optionalRecord, optionalString, requiredRecord } from "../../core/cast.ts";
6+
import { readBoundedResponseBytes } from "../../core/request.ts";
67
import { providerFetch, ProviderRequestError, providerUserAgent } from "../provider-runtime.ts";
78

89
export const agentyApiBaseUrl = "https://api.agenty.com/v2";
@@ -581,7 +582,12 @@ async function uploadAgentyTransitFile(context: AgentyRuntimeContext, response:
581582
}
582583

583584
const mimeType = response.headers.get("content-type") ?? "application/octet-stream";
584-
const upload = await context.transitFiles.create(new File([await response.arrayBuffer()], name, { type: mimeType }));
585+
const bytes = await readBoundedResponseBytes(response, {
586+
maxBytes: context.transitFiles.maxBytes,
587+
fieldName: "Agenty file output",
588+
createError: (message) => new ProviderRequestError(413, message),
589+
});
590+
const upload = await context.transitFiles.create(new File([Uint8Array.from(bytes)], name, { type: mimeType }));
585591
return {
586592
name,
587593
mimetype: mimeType,

0 commit comments

Comments
 (0)