batchwork 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/body.d.ts +2 -2
  2. package/dist/body.d.ts.map +1 -1
  3. package/dist/chunk-6jgvqdpc.js +52 -0
  4. package/dist/chunk-6jgvqdpc.js.map +11 -0
  5. package/dist/{chunk-n50t31ca.js → chunk-7y95mhvm.js} +118 -139
  6. package/dist/chunk-7y95mhvm.js.map +27 -0
  7. package/dist/{chunk-mathjpg6.js → chunk-k7n7k3et.js} +46 -41
  8. package/dist/chunk-k7n7k3et.js.map +13 -0
  9. package/dist/{chunk-14qcscwd.js → chunk-zss8h417.js} +203 -191
  10. package/dist/chunk-zss8h417.js.map +12 -0
  11. package/dist/guards.d.ts +5 -0
  12. package/dist/guards.d.ts.map +1 -0
  13. package/dist/http.d.ts +3 -2
  14. package/dist/http.d.ts.map +1 -1
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +27 -28
  18. package/dist/index.js.map +1 -1
  19. package/dist/jsonl.d.ts +3 -2
  20. package/dist/jsonl.d.ts.map +1 -1
  21. package/dist/model.d.ts +48 -1
  22. package/dist/model.d.ts.map +1 -1
  23. package/dist/next/index.d.ts +1 -1
  24. package/dist/next/index.d.ts.map +1 -1
  25. package/dist/next/index.js +14 -20
  26. package/dist/next/index.js.map +3 -3
  27. package/dist/postgres/batch-store.d.ts.map +1 -1
  28. package/dist/postgres/index.js +22 -15
  29. package/dist/postgres/index.js.map +4 -4
  30. package/dist/postgres/types.d.ts +1 -1
  31. package/dist/postgres/types.d.ts.map +1 -1
  32. package/dist/providers/anthropic.d.ts.map +1 -1
  33. package/dist/providers/azure.d.ts.map +1 -1
  34. package/dist/providers/google.d.ts.map +1 -1
  35. package/dist/providers/mistral.d.ts.map +1 -1
  36. package/dist/providers/openai-compatible.d.ts +2 -2
  37. package/dist/providers/openai-compatible.d.ts.map +1 -1
  38. package/dist/providers/shared.d.ts +8 -8
  39. package/dist/providers/shared.d.ts.map +1 -1
  40. package/dist/providers/xai.d.ts.map +1 -1
  41. package/dist/redis/index.js +40 -6
  42. package/dist/redis/index.js.map +4 -4
  43. package/dist/redis/types.d.ts +18 -5
  44. package/dist/redis/types.d.ts.map +1 -1
  45. package/dist/server/index.js +13 -14
  46. package/dist/server/index.js.map +1 -1
  47. package/dist/server/poller.d.ts +6 -4
  48. package/dist/server/poller.d.ts.map +1 -1
  49. package/dist/server/signing.d.ts.map +1 -1
  50. package/dist/types.d.ts +16 -2
  51. package/dist/types.d.ts.map +1 -1
  52. package/dist/util.d.ts +16 -7
  53. package/dist/util.d.ts.map +1 -1
  54. package/package.json +19 -19
  55. package/dist/chunk-14qcscwd.js.map +0 -12
  56. package/dist/chunk-mathjpg6.js.map +0 -13
  57. package/dist/chunk-n50t31ca.js.map +0 -28
  58. package/dist/chunk-v0bahtg2.js +0 -7
  59. package/dist/chunk-v0bahtg2.js.map +0 -9
@@ -0,0 +1,12 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/model.ts", "../src/body.ts", "../src/batch.ts"],
4
+ "sourcesContent": [
5
+ "import type { createAnthropic } from \"@ai-sdk/anthropic\";\nimport type { createAzure } from \"@ai-sdk/azure\";\nimport type { createGoogleGenerativeAI } from \"@ai-sdk/google\";\nimport type { createGroq } from \"@ai-sdk/groq\";\nimport type { createMistral } from \"@ai-sdk/mistral\";\nimport type { createOpenAI } from \"@ai-sdk/openai\";\nimport type { createTogetherAI } from \"@ai-sdk/togetherai\";\nimport type { createXai } from \"@ai-sdk/xai\";\nimport type {\n EmbeddingModel,\n ImageModel,\n LanguageModel,\n TranscriptionModel,\n} from \"ai\";\n\nimport { MissingDependencyError, UnsupportedProviderError } from \"./errors\";\nimport { isString } from \"./guards\";\nimport type { BatchProvider, ProviderCredentials, VideoModel } from \"./types\";\nimport { trimTrailingSlashes } from \"./util\";\n\n/** The shape `loadProvider` expects from each optional `@ai-sdk/*` package. */\ninterface AnthropicModule {\n createAnthropic: typeof createAnthropic;\n}\ninterface AzureModule {\n createAzure: typeof createAzure;\n}\ninterface GoogleModule {\n createGoogleGenerativeAI: typeof createGoogleGenerativeAI;\n}\ninterface GroqModule {\n createGroq: typeof createGroq;\n}\ninterface MistralModule {\n createMistral: typeof createMistral;\n}\ninterface OpenAIModule {\n createOpenAI: typeof createOpenAI;\n}\ninterface TogetherModule {\n createTogetherAI: typeof createTogetherAI;\n}\ninterface XaiModule {\n createXai: typeof createXai;\n}\n\n/** The module each provider's `@ai-sdk/*` package resolves to. */\ninterface ProviderModules {\n anthropic: AnthropicModule;\n azure: AzureModule;\n google: GoogleModule;\n groq: GroqModule;\n mistral: MistralModule;\n openai: OpenAIModule;\n together: TogetherModule;\n xai: XaiModule;\n}\n\n/** Imports the `@ai-sdk/*` package backing a provider. */\nexport type ProviderLoader = <P extends BatchProvider>(\n provider: P\n) => Promise<ProviderModules[P]>;\n\ntype ProviderImporters = {\n [P in BatchProvider]: () => Promise<ProviderModules[P]>;\n};\n\n/** A fetch implementation compatible with the AI SDK provider `fetch` option. */\nexport type CapturingFetch = typeof globalThis.fetch;\n\n/** OpenAI exposes several request shapes; we mirror the one the model implies. */\nexport type OpenAIModelKind = \"chat\" | \"responses\" | \"completion\";\n\nexport interface ResolvedModel {\n /** Relevant for OpenAI; other providers always use a single chat endpoint. */\n kind: OpenAIModelKind;\n modelId: string;\n provider: BatchProvider;\n}\n\n/**\n * Placeholder API key used only when building request bodies. Body building\n * intercepts the request before it is sent, so no real credential is needed —\n * but the provider refuses to construct a model without one.\n */\nconst CAPTURE_API_KEY = \"batchwork-capture\";\n\nconst azureCaptureBaseUrl = (\n baseURL: string | undefined\n): string | undefined => {\n if (!baseURL) {\n return;\n }\n const normalized = trimTrailingSlashes(baseURL);\n try {\n if (new URL(normalized).hostname.endsWith(\".openai.azure.com\")) {\n // The AI SDK appends `/v1` itself, so it wants the `/openai` root —\n // accept the bare resource URL, `/openai`, or `/openai/v1` forms.\n const root = normalized.replace(/\\/v1$/u, \"\");\n return root.endsWith(\"/openai\") ? root : `${root}/openai`;\n }\n } catch {\n // Let the provider report malformed URLs with its normal error.\n }\n return normalized;\n};\n\n/** The optional `@ai-sdk/*` package backing each provider. */\nconst PACKAGE_BY_PROVIDER: Record<\n BatchProvider,\n { label: string; specifier: string }\n> = {\n anthropic: { label: \"Anthropic\", specifier: \"@ai-sdk/anthropic\" },\n azure: { label: \"Azure OpenAI\", specifier: \"@ai-sdk/azure\" },\n google: { label: \"Google Gemini\", specifier: \"@ai-sdk/google\" },\n groq: { label: \"Groq\", specifier: \"@ai-sdk/groq\" },\n mistral: { label: \"Mistral\", specifier: \"@ai-sdk/mistral\" },\n openai: { label: \"OpenAI\", specifier: \"@ai-sdk/openai\" },\n together: { label: \"Together AI\", specifier: \"@ai-sdk/togetherai\" },\n xai: { label: \"xAI\", specifier: \"@ai-sdk/xai\" },\n};\n\n/**\n * AI SDK provider id prefixes (the part before the first `.` in `model.provider`)\n * mapped to batch providers.\n */\nconst PROVIDER_BY_FAMILY = new Map<string, BatchProvider>([\n [\"anthropic\", \"anthropic\"],\n [\"azure\", \"azure\"],\n [\"google\", \"google\"],\n [\"groq\", \"groq\"],\n [\"mistral\", \"mistral\"],\n [\"openai\", \"openai\"],\n [\"together\", \"together\"],\n [\"togetherai\", \"together\"],\n [\"xai\", \"xai\"],\n]);\n\n/** Aliases accepted in the `\"provider/model\"` string form. */\nconst PROVIDER_BY_ALIAS = new Map<string, BatchProvider>([\n ...PROVIDER_BY_FAMILY,\n [\"gemini\", \"google\"],\n]);\n\nconst splitOnce = (value: string, separator: string): [string, string] => {\n const index = value.indexOf(separator);\n if (index === -1) {\n return [value, \"\"];\n }\n return [value.slice(0, index), value.slice(index + separator.length)];\n};\n\nconst openaiKind = (suffix: string): OpenAIModelKind => {\n if (suffix === \"responses\") {\n return \"responses\";\n }\n if (suffix === \"completion\") {\n return \"completion\";\n }\n // Default to chat completions: the most widely supported batch endpoint.\n return \"chat\";\n};\n\n/** Resolve a `\"provider/model\"` string into a provider + model id. */\nconst resolveModelString = (value: string): ResolvedModel => {\n const [providerId, modelId] = splitOnce(value, \"/\");\n if (modelId === \"\") {\n throw new UnsupportedProviderError(value);\n }\n const provider = PROVIDER_BY_ALIAS.get(providerId);\n if (!provider) {\n throw new UnsupportedProviderError(providerId);\n }\n return { kind: \"chat\", modelId, provider };\n};\n\n/**\n * Resolve any AI SDK `model` (a `\"provider/model\"` string or a provider model\n * object such as `openai(\"gpt-5.5\")`) to a provider + model id + request\n * shape. Gateway/registry model objects whose `modelId` is itself\n * `\"provider/model\"` are also handled.\n */\nexport const resolveModel = (\n model:\n | LanguageModel\n | EmbeddingModel\n | ImageModel\n | TranscriptionModel\n | VideoModel\n): ResolvedModel => {\n if (isString(model)) {\n return resolveModelString(model);\n }\n\n const [family, suffix] = splitOnce(model.provider, \".\");\n const provider = PROVIDER_BY_FAMILY.get(family);\n if (provider === \"openai\" || provider === \"azure\") {\n return { kind: openaiKind(suffix), modelId: model.modelId, provider };\n }\n if (provider) {\n return { kind: \"chat\", modelId: model.modelId, provider };\n }\n // Gateway/registry providers carry the real target in the model id.\n if (model.modelId.includes(\"/\")) {\n return resolveModelString(model.modelId);\n }\n throw new UnsupportedProviderError(model.provider);\n};\n\nconst importers: ProviderImporters = {\n anthropic: () => import(\"@ai-sdk/anthropic\"),\n azure: () => import(\"@ai-sdk/azure\"),\n google: () => import(\"@ai-sdk/google\"),\n groq: () => import(\"@ai-sdk/groq\"),\n mistral: () => import(\"@ai-sdk/mistral\"),\n openai: () => import(\"@ai-sdk/openai\"),\n together: () => import(\"@ai-sdk/togetherai\"),\n xai: () => import(\"@ai-sdk/xai\"),\n};\n\nconst importProvider: ProviderLoader = (provider) => {\n const importer = importers[provider];\n // A provider id outside the union (e.g. from an untyped caller) has no\n // importer; surface that as unsupported rather than as a missing package.\n if (importer === undefined) {\n return Promise.reject(new UnsupportedProviderError(provider));\n }\n return importer();\n};\n\n/**\n * Import the `@ai-sdk/*` package for a provider, translating a missing optional\n * dependency into a `MissingDependencyError`. The importer is injectable (like\n * the capturing `fetch`) so tests can drive the failure paths without\n * uninstalling a package. Exported for testing; not part of the public API.\n */\nexport const loadProvider = async <P extends BatchProvider>(\n provider: P,\n load: ProviderLoader = importProvider\n): Promise<ProviderModules[P]> => {\n try {\n return await load(provider);\n } catch (error) {\n if (error instanceof UnsupportedProviderError) {\n throw error;\n }\n const { specifier, label } = PACKAGE_BY_PROVIDER[provider];\n throw new MissingDependencyError(specifier, label);\n }\n};\n\n/**\n * Construct an AI SDK model wired to a capturing `fetch`, used to derive the\n * provider request body for each batch item without making a network call.\n */\nexport const createCaptureModel = async (\n resolved: ResolvedModel,\n credentials: ProviderCredentials,\n fetchImpl: CapturingFetch\n): Promise<LanguageModel> => {\n const settings = {\n apiKey: credentials.apiKey ?? CAPTURE_API_KEY,\n baseURL: credentials.baseURL,\n fetch: fetchImpl,\n headers: credentials.headers,\n };\n\n switch (resolved.provider) {\n case \"openai\": {\n const { createOpenAI } = await loadProvider(\"openai\");\n const provider = createOpenAI(settings);\n if (resolved.kind === \"responses\") {\n return provider.responses(resolved.modelId);\n }\n if (resolved.kind === \"completion\") {\n return provider.completion(resolved.modelId);\n }\n return provider.chat(resolved.modelId);\n }\n case \"azure\": {\n const { createAzure } = await loadProvider(\"azure\");\n const provider = createAzure({\n ...settings,\n // Batchwork documents Azure base URLs as the API root ending in\n // `/openai/v1`; the AI SDK expects the Azure root before `/v1`.\n baseURL: azureCaptureBaseUrl(credentials.baseURL),\n });\n if (resolved.kind === \"responses\") {\n return provider.responses(resolved.modelId);\n }\n if (resolved.kind === \"completion\") {\n return provider.completion(resolved.modelId);\n }\n return provider.chat(resolved.modelId);\n }\n case \"anthropic\": {\n const { createAnthropic } = await loadProvider(\"anthropic\");\n return createAnthropic(settings).messages(resolved.modelId);\n }\n case \"groq\": {\n const { createGroq } = await loadProvider(\"groq\");\n return createGroq(settings).languageModel(resolved.modelId);\n }\n case \"mistral\": {\n const { createMistral } = await loadProvider(\"mistral\");\n return createMistral(settings).languageModel(resolved.modelId);\n }\n case \"google\": {\n const { createGoogleGenerativeAI } = await loadProvider(\"google\");\n return createGoogleGenerativeAI(settings).languageModel(resolved.modelId);\n }\n case \"xai\": {\n const { createXai } = await loadProvider(\"xai\");\n return createXai(settings).languageModel(resolved.modelId);\n }\n case \"together\": {\n const { createTogetherAI } = await loadProvider(\"together\");\n return createTogetherAI(settings).languageModel(resolved.modelId);\n }\n default: {\n throw new UnsupportedProviderError(resolved.provider);\n }\n }\n};\n\n/**\n * Providers whose batch API accepts embeddings. Together is excluded: it exposes\n * an embedding model, but its batch endpoint rejects `/v1/embeddings`. Anthropic,\n * Groq, and xAI have no embedding model at all.\n */\nexport const EMBEDDING_PROVIDERS = new Set<BatchProvider>([\n \"google\",\n \"mistral\",\n \"openai\",\n]);\n\nexport const unsupportedEmbeddingProvider = (\n provider: BatchProvider\n): UnsupportedProviderError =>\n new UnsupportedProviderError(\n provider,\n `batchwork: provider \"${provider}\" does not offer batch embeddings. Embeddings are supported for: openai, mistral, google.`\n );\n\n/**\n * Construct an AI SDK text embedding model wired to a capturing `fetch`, used to\n * derive the provider embedding request body for each batch item without making\n * a network call. Throws for providers without an embedding model.\n */\nexport const createCaptureEmbeddingModel = async (\n resolved: ResolvedModel,\n credentials: ProviderCredentials,\n fetchImpl: CapturingFetch\n): Promise<EmbeddingModel> => {\n const settings = {\n apiKey: credentials.apiKey ?? CAPTURE_API_KEY,\n baseURL: credentials.baseURL,\n fetch: fetchImpl,\n headers: credentials.headers,\n };\n\n switch (resolved.provider) {\n case \"openai\": {\n const { createOpenAI } = await loadProvider(\"openai\");\n return createOpenAI(settings).embeddingModel(resolved.modelId);\n }\n case \"mistral\": {\n const { createMistral } = await loadProvider(\"mistral\");\n return createMistral(settings).embeddingModel(resolved.modelId);\n }\n case \"google\": {\n const { createGoogleGenerativeAI } = await loadProvider(\"google\");\n return createGoogleGenerativeAI(settings).embeddingModel(\n resolved.modelId\n );\n }\n default: {\n throw unsupportedEmbeddingProvider(resolved.provider);\n }\n }\n};\n\n/**\n * Providers whose batch API accepts image editing. OpenAI and xAI both expose\n * `/v1/images/edits` as a batch endpoint (JSON bodies with asset references —\n * OpenAI takes uploaded file ids or image URLs plus an optional mask; xAI\n * takes image URLs only). Google's Gemini batch has no edit endpoint.\n */\nexport const IMAGE_EDIT_PROVIDERS = new Set<BatchProvider>([\"openai\", \"xai\"]);\n\nexport const unsupportedImageEditProvider = (\n provider: BatchProvider\n): UnsupportedProviderError =>\n new UnsupportedProviderError(\n provider,\n `batchwork: provider \"${provider}\" does not offer batch image editing. Image edits are supported for: openai, xai.`\n );\n\n/**\n * Providers whose batch API accepts video generation. xAI exposes\n * `/v1/videos/generations` (plus `/edits` and `/extensions`) as batch\n * endpoints for Grok Imagine. OpenAI's Videos API (Sora) is deprecated and\n * shuts down 2026-09-24, so it is deliberately not supported; Google's Veo\n * models are not batch-compatible.\n */\nexport const VIDEO_PROVIDERS = new Set<BatchProvider>([\"xai\"]);\n\nexport const unsupportedVideoProvider = (\n provider: BatchProvider\n): UnsupportedProviderError =>\n new UnsupportedProviderError(\n provider,\n `batchwork: provider \"${provider}\" does not offer batch video generation. Videos are supported for: xai.`\n );\n\n/**\n * Construct an AI SDK video model wired to a capturing `fetch`, used to derive\n * the provider video request body for each batch item without making a network\n * call. Throws for providers without batch video support.\n */\nexport const createCaptureVideoModel = async (\n resolved: ResolvedModel,\n credentials: ProviderCredentials,\n fetchImpl: CapturingFetch\n): Promise<VideoModel> => {\n if (resolved.provider !== \"xai\") {\n throw unsupportedVideoProvider(resolved.provider);\n }\n const { createXai } = await loadProvider(\"xai\");\n return createXai({\n apiKey: credentials.apiKey ?? CAPTURE_API_KEY,\n baseURL: credentials.baseURL,\n fetch: fetchImpl,\n headers: credentials.headers,\n }).video(resolved.modelId);\n};\n\n/**\n * Providers whose batch API accepts audio translation (Whisper's\n * translate-to-English task). Groq and Together expose\n * `/v1/audio/translations` as a batch endpoint; Mistral batches\n * transcriptions but not translations.\n */\nexport const TRANSLATION_PROVIDERS = new Set<BatchProvider>([\n \"groq\",\n \"together\",\n]);\n\nexport const unsupportedTranslationProvider = (\n provider: BatchProvider\n): UnsupportedProviderError =>\n new UnsupportedProviderError(\n provider,\n `batchwork: provider \"${provider}\" does not offer batch translation. Translations are supported for: groq, together.`\n );\n\n/**\n * Providers whose batch API accepts moderation. OpenAI exposes\n * `/v1/moderations` as a batch endpoint (omni moderation, text + images);\n * Mistral runs its moderation models through the same batch job flow\n * (text-only). No other provider has a standalone moderation API.\n */\nexport const MODERATION_PROVIDERS = new Set<BatchProvider>([\n \"mistral\",\n \"openai\",\n]);\n\nexport const unsupportedModerationProvider = (\n provider: BatchProvider\n): UnsupportedProviderError =>\n new UnsupportedProviderError(\n provider,\n `batchwork: provider \"${provider}\" does not offer batch moderation. Moderations are supported for: openai, mistral.`\n );\n\n/**\n * Providers whose batch API accepts audio transcription. Groq, Mistral, and\n * Together expose `/v1/audio/transcriptions` as a batch endpoint; OpenAI's\n * batch API does not accept audio endpoints, and the remaining providers have\n * no standalone transcription API.\n */\nexport const TRANSCRIPTION_PROVIDERS = new Set<BatchProvider>([\n \"groq\",\n \"mistral\",\n \"together\",\n]);\n\nexport const unsupportedTranscriptionProvider = (\n provider: BatchProvider\n): UnsupportedProviderError =>\n new UnsupportedProviderError(\n provider,\n `batchwork: provider \"${provider}\" does not offer batch transcription. Transcriptions are supported for: groq, mistral, together.`\n );\n\n/**\n * Providers whose batch API accepts image generation. OpenAI and xAI expose\n * `/v1/images/generations` as a batch endpoint; Google runs Gemini image models\n * through `:batchGenerateContent`. Imagen (Google `:predict`) is not\n * batch-supported, Together's batch API is chat/audio only, and Anthropic, Groq,\n * and Mistral have no image model.\n */\nexport const IMAGE_PROVIDERS = new Set<BatchProvider>([\n \"google\",\n \"openai\",\n \"xai\",\n]);\n\nexport const unsupportedImageProvider = (\n provider: BatchProvider\n): UnsupportedProviderError =>\n new UnsupportedProviderError(\n provider,\n `batchwork: provider \"${provider}\" does not offer batch image generation. Image batches are supported for: openai, google, xai.`\n );\n\n/**\n * Construct an AI SDK image model wired to a capturing `fetch`, used to derive\n * the provider image-generation request body for each batch item without making\n * a network call. Throws for providers without batch image support.\n */\nexport const createCaptureImageModel = async (\n resolved: ResolvedModel,\n credentials: ProviderCredentials,\n fetchImpl: CapturingFetch\n): Promise<ImageModel> => {\n const settings = {\n apiKey: credentials.apiKey ?? CAPTURE_API_KEY,\n baseURL: credentials.baseURL,\n fetch: fetchImpl,\n headers: credentials.headers,\n };\n\n switch (resolved.provider) {\n case \"openai\": {\n const { createOpenAI } = await loadProvider(\"openai\");\n return createOpenAI(settings).image(resolved.modelId);\n }\n case \"google\": {\n const { createGoogleGenerativeAI } = await loadProvider(\"google\");\n return createGoogleGenerativeAI(settings).image(resolved.modelId);\n }\n case \"xai\": {\n const { createXai } = await loadProvider(\"xai\");\n return createXai(settings).image(resolved.modelId);\n }\n default: {\n throw unsupportedImageProvider(resolved.provider);\n }\n }\n};\n",
6
+ "import {\n embed,\n experimental_generateVideo,\n generateImage,\n generateText,\n} from \"ai\";\nimport type { EmbeddingModel, ImageModel, LanguageModel } from \"ai\";\nimport pMap from \"p-map\";\n\nimport { BatchworkError } from \"./errors\";\nimport { isString } from \"./guards\";\nimport { assertByteLength, resolveBatchLimits } from \"./limits\";\nimport type { ResolvedBatchLimits } from \"./limits\";\nimport {\n createCaptureEmbeddingModel,\n createCaptureImageModel,\n createCaptureModel,\n createCaptureVideoModel,\n unsupportedImageEditProvider,\n unsupportedModerationProvider,\n unsupportedTranscriptionProvider,\n} from \"./model\";\nimport type { CapturingFetch, ResolvedModel } from \"./model\";\nimport type {\n BatchDefaults,\n BatchEmbeddingRequest,\n BatchImageDefaults,\n BatchImageEditDefaults,\n BatchImageEditRequest,\n BatchImageRef,\n BatchImageRequest,\n BatchLimits,\n BatchModerationRequest,\n BatchRequest,\n BatchTranscriptionDefaults,\n BatchTranscriptionRequest,\n BatchTranslationDefaults,\n BatchTranslationRequest,\n BatchVideoDefaults,\n BatchVideoRequest,\n JsonObject,\n JsonValue,\n ProviderCredentials,\n VideoModel,\n} from \"./types\";\nimport { isJsonObject, parseJson } from \"./util\";\n\ntype GenerateTextInput = Parameters<typeof generateText>[0];\n\n/** A provider request body derived from a single batch item. */\nexport interface BuiltRequest {\n /** The serialized provider request body (becomes the batch line). */\n body: JsonObject;\n customId: string;\n /** API endpoint path the model targets, e.g. `/v1/chat/completions`. */\n endpoint: string;\n}\n\nconst MAX_CAUSE_DEPTH = 10;\n\n/**\n * Thrown by the capturing `fetch` to abort the request after its body has been\n * serialized. The body travels inside the error (not shared state), so capture\n * is correct even under concurrency.\n */\nclass CaptureSignalError extends Error {\n readonly url: string;\n readonly rawBody: string;\n\n constructor(url: string, rawBody: string) {\n super(\"batchwork:capture\");\n this.name = \"CaptureSignalError\";\n this.url = url;\n this.rawBody = rawBody;\n }\n}\n\nconst resolveUrl = (input: string | URL | Request): string => {\n if (input instanceof URL) {\n return input.toString();\n }\n if (input instanceof Request) {\n return input.url;\n }\n return input;\n};\n\nconst extractBody = (init?: RequestInit): string => {\n const body = init?.body;\n if (isString(body)) {\n return body;\n }\n if (body instanceof Uint8Array) {\n return new TextDecoder().decode(body);\n }\n throw new BatchworkError(\n \"batchwork: unable to read the provider request body during capture.\"\n );\n};\n\n// `CapturingFetch` is `typeof fetch`, whose declaration varies by runtime\n// types: Bun's adds a `preconnect` member. Capture only ever calls it as a\n// plain fetch, so a no-op `preconnect` keeps the bare implementation\n// assignable under both sets of types.\nconst captureFetch: CapturingFetch = Object.assign(\n (input: string | URL | Request, init?: RequestInit) =>\n Promise.reject(\n new CaptureSignalError(resolveUrl(input), extractBody(init))\n ),\n {\n preconnect: () => {\n // Never called during capture.\n },\n }\n);\n\n/** Whether a thrown value carries an Error-style `cause`. */\nconst hasCause = (value: unknown): value is { cause: unknown } =>\n typeof value === \"object\" && value !== null && \"cause\" in value;\n\n/**\n * Walk a thrown value's `cause` chain (starting at the value itself) looking\n * for the capture signal, giving up after `MAX_CAUSE_DEPTH` links.\n */\nconst findCapture = (\n cause: unknown,\n depth = 0\n): CaptureSignalError | undefined => {\n if (depth >= MAX_CAUSE_DEPTH) {\n return;\n }\n if (cause instanceof CaptureSignalError) {\n return cause;\n }\n return hasCause(cause) ? findCapture(cause.cause, depth + 1) : undefined;\n};\n\nconst endpointFromUrl = (url: string): string => {\n try {\n return new URL(url).pathname;\n } catch {\n return url;\n }\n};\n\nconst mergeDefaults = <Request extends object>(\n request: Request,\n defaults: NoInfer<Partial<Request>> | undefined\n): Request => {\n if (!defaults) {\n return request;\n }\n return { ...defaults, ...request };\n};\n\n/**\n * Map a batch request to AI SDK `generateText` input. Fields are listed\n * explicitly so `customId` never leaks into the provider request.\n */\nconst toGenerateInput = (\n model: LanguageModel,\n request: BatchRequest\n): GenerateTextInput =>\n // SAFETY: `prompt`/`messages` form a discriminated union in the AI SDK\n // types; both keys are passed and `generateText` validates the XOR at\n // runtime, so the object always satisfies one branch.\n ({\n frequencyPenalty: request.frequencyPenalty,\n maxOutputTokens: request.maxOutputTokens,\n maxRetries: 0,\n messages: request.messages,\n model,\n presencePenalty: request.presencePenalty,\n prompt: request.prompt,\n providerOptions: request.providerOptions,\n seed: request.seed,\n stopSequences: request.stopSequences,\n system: request.system,\n temperature: request.temperature,\n toolChoice: request.toolChoice,\n tools: request.tools,\n topK: request.topK,\n topP: request.topP,\n }) as GenerateTextInput;\n\n/** Turn a capture signal into a {@link BuiltRequest}. */\nconst bodyFromCapture = (\n capture: CaptureSignalError,\n customId: string,\n maxRequestBytes: number\n): BuiltRequest => {\n assertByteLength(`request \"${customId}\"`, capture.rawBody, maxRequestBytes);\n const body = parseJson(capture.rawBody);\n if (!isJsonObject(body)) {\n throw new BatchworkError(\n `batchwork: the captured body for request \"${customId}\" is not a JSON object.`\n );\n }\n return { body, customId, endpoint: endpointFromUrl(capture.url) };\n};\n\nconst captureOne = async (\n model: LanguageModel,\n request: BatchRequest,\n customId: string,\n maxRequestBytes: number\n): Promise<BuiltRequest> => {\n try {\n await generateText(toGenerateInput(model, request));\n } catch (error) {\n // A genuine failure (one that never reached the capturing `fetch`, e.g. an\n // invalid prompt) carries no capture signal and is rethrown.\n const capture = findCapture(error);\n if (!capture) {\n throw error;\n }\n return bodyFromCapture(capture, customId, maxRequestBytes);\n }\n throw new BatchworkError(\n \"batchwork: the request was not intercepted while building the batch body.\"\n );\n};\n\nconst captureEmbeddingOne = async (\n model: EmbeddingModel,\n request: BatchEmbeddingRequest,\n customId: string,\n maxRequestBytes: number\n): Promise<BuiltRequest> => {\n try {\n // `maxRetries: 0` is load-bearing: with retries enabled the capture error\n // is wrapped in a `RetryError` (under `.errors`, not `.cause`) and\n // `findCapture`'s cause walk would miss it.\n await embed({\n maxRetries: 0,\n model,\n providerOptions: request.providerOptions,\n value: request.value,\n });\n } catch (error) {\n // A genuine failure (one that never reached the capturing `fetch`, e.g. an\n // invalid prompt) carries no capture signal and is rethrown.\n const capture = findCapture(error);\n if (!capture) {\n throw error;\n }\n return bodyFromCapture(capture, customId, maxRequestBytes);\n }\n throw new BatchworkError(\n \"batchwork: the request was not intercepted while building the embedding body.\"\n );\n};\n\nconst captureImageOne = async (\n model: ImageModel,\n request: BatchImageRequest,\n customId: string,\n maxRequestBytes: number\n): Promise<BuiltRequest> => {\n try {\n await generateImage({\n aspectRatio: request.aspectRatio,\n // `maxImagesPerCall: n` forces a single `doGenerate` call so the captured\n // body carries the requested `n` rather than a fanned-out per-call count.\n maxImagesPerCall: request.n,\n // `maxRetries: 0` is load-bearing: with retries enabled the capture error\n // is wrapped in a `RetryError` (under `.errors`, not `.cause`) and\n // `findCapture`'s cause walk would miss it.\n maxRetries: 0,\n model,\n n: request.n,\n prompt: request.prompt,\n providerOptions: request.providerOptions,\n seed: request.seed,\n size: request.size,\n });\n } catch (error) {\n // A genuine failure (one that never reached the capturing `fetch`, e.g. an\n // invalid prompt) carries no capture signal and is rethrown.\n const capture = findCapture(error);\n if (!capture) {\n throw error;\n }\n return bodyFromCapture(capture, customId, maxRequestBytes);\n }\n throw new BatchworkError(\n \"batchwork: the request was not intercepted while building the image body.\"\n );\n};\n\n/**\n * Assign and validate a unique `customId` for each request (sequentially, so\n * duplicates are reported deterministically before bodies are captured in\n * parallel). Auto-generates `request-{index}` when omitted.\n */\nconst assignCustomIds = <T extends { customId?: string }>(\n requests: readonly T[]\n): { customId: string; request: T }[] => {\n const seen = new Set<string>();\n return requests.map((request, index) => {\n const customId = request.customId ?? `request-${index}`;\n if (seen.has(customId)) {\n throw new BatchworkError(\n `batchwork: duplicate customId \"${customId}\". customId values must be unique within a batch.`\n );\n }\n seen.add(customId);\n return { customId, request };\n });\n};\n\n/**\n * Derive provider request bodies for every batch item by running each through\n * the AI SDK with a capturing `fetch`. This reuses the AI SDK's full message,\n * tool, and multimodal conversion, so the body matches what `generateText`\n * would send — minus the network call.\n */\nexport const buildRequestBodies = async (\n resolved: ResolvedModel,\n requests: readonly BatchRequest[],\n defaults: BatchDefaults | undefined,\n credentials: ProviderCredentials,\n rawLimits?: BatchLimits | ResolvedBatchLimits\n): Promise<BuiltRequest[]> => {\n const limits = resolveBatchLimits(rawLimits);\n if (requests.length > limits.maxRequests) {\n throw new BatchworkError(\n `batchwork: requests length ${requests.length} exceeds the ${limits.maxRequests} request limit.`\n );\n }\n const model = await createCaptureModel(resolved, credentials, captureFetch);\n const items = assignCustomIds(requests);\n\n return await pMap(\n items,\n async (item) => {\n const built = await captureOne(\n model,\n mergeDefaults(item.request, defaults),\n item.customId,\n limits.maxRequestBytes\n );\n assertByteLength(\n `request \"${item.customId}\"`,\n JSON.stringify(built.body),\n limits.maxRequestBytes\n );\n return built;\n },\n { concurrency: limits.captureConcurrency }\n );\n};\n\n/**\n * Derive provider embedding request bodies for every batch item by running each\n * through the AI SDK `embed` with a capturing `fetch`. Mirrors\n * {@link buildRequestBodies} for the embedding endpoint; each item maps to a\n * single embedding (`input: [value]`), correlated by `customId`.\n */\nexport const buildEmbeddingBodies = async (\n resolved: ResolvedModel,\n requests: readonly BatchEmbeddingRequest[],\n credentials: ProviderCredentials,\n rawLimits?: BatchLimits | ResolvedBatchLimits\n): Promise<BuiltRequest[]> => {\n const limits = resolveBatchLimits(rawLimits);\n if (requests.length > limits.maxRequests) {\n throw new BatchworkError(\n `batchwork: requests length ${requests.length} exceeds the ${limits.maxRequests} request limit.`\n );\n }\n const model = await createCaptureEmbeddingModel(\n resolved,\n credentials,\n captureFetch\n );\n const items = assignCustomIds(requests);\n\n return await pMap(\n items,\n async (item) => {\n const built = await captureEmbeddingOne(\n model,\n item.request,\n item.customId,\n limits.maxRequestBytes\n );\n assertByteLength(\n `request \"${item.customId}\"`,\n JSON.stringify(built.body),\n limits.maxRequestBytes\n );\n return built;\n },\n { concurrency: limits.captureConcurrency }\n );\n};\n\nconst MODERATION_ENDPOINT = \"/v1/moderations\";\n\n/**\n * Build the OpenAI omni moderation content-part array for a request that\n * involves images: an optional text part followed by one part per image URL.\n */\nconst moderationParts = (\n value: string | undefined,\n imageUrls: readonly string[]\n): JsonValue[] => {\n const parts: JsonValue[] = [];\n if (value !== undefined) {\n parts.push({ text: value, type: \"text\" });\n }\n for (const url of imageUrls) {\n parts.push({ image_url: { url }, type: \"image_url\" });\n }\n return parts;\n};\n\n/**\n * Build the provider moderation body directly — the AI SDK has no moderation\n * call to capture. Both providers take `{ input }`; OpenAI carries the model\n * per line, Mistral on the job.\n */\nconst moderationBody = (\n resolved: ResolvedModel,\n request: BatchModerationRequest,\n customId: string\n): JsonObject => {\n const { value } = request;\n const imageUrls = request.imageUrls ?? [];\n if (value === undefined && imageUrls.length === 0) {\n throw new BatchworkError(\n `batchwork: moderation request \"${customId}\" needs \\`value\\` or \\`imageUrls\\`.`\n );\n }\n const options = request.providerOptions?.[resolved.provider];\n if (resolved.provider === \"openai\") {\n // A text-only request sends the bare string; images switch to the\n // content-part array.\n const input =\n imageUrls.length === 0 && value !== undefined\n ? value\n : moderationParts(value, imageUrls);\n return { input, model: resolved.modelId, ...options };\n }\n if (resolved.provider === \"mistral\") {\n if (imageUrls.length > 0) {\n throw new BatchworkError(\n `batchwork: moderation request \"${customId}\" has \\`imageUrls\\`, but Mistral moderation is text-only.`\n );\n }\n // `model` is included for uniformity; the Mistral adapter strips it from\n // each line and sets it on the job instead.\n return { input: value ?? \"\", model: resolved.modelId, ...options };\n }\n throw unsupportedModerationProvider(resolved.provider);\n};\n\n/**\n * Build provider moderation request bodies for every batch item. Each item\n * maps to a single moderation verdict, correlated by `customId`.\n */\nexport const buildModerationBodies = (\n resolved: ResolvedModel,\n requests: readonly BatchModerationRequest[],\n rawLimits?: BatchLimits | ResolvedBatchLimits\n): BuiltRequest[] => {\n const limits = resolveBatchLimits(rawLimits);\n if (requests.length > limits.maxRequests) {\n throw new BatchworkError(\n `batchwork: requests length ${requests.length} exceeds the ${limits.maxRequests} request limit.`\n );\n }\n return assignCustomIds(requests).map((item) => {\n const body = moderationBody(resolved, item.request, item.customId);\n assertByteLength(\n `request \"${item.customId}\"`,\n JSON.stringify(body),\n limits.maxRequestBytes\n );\n return { body, customId: item.customId, endpoint: MODERATION_ENDPOINT };\n });\n};\n\nconst TRANSCRIPTION_ENDPOINT = \"/v1/audio/transcriptions\";\n\n/**\n * Build the provider transcription body directly. Batch audio endpoints take\n * JSON with a hosted audio URL — unlike the synchronous transcription APIs\n * (and the AI SDK's `transcribe`), which upload the file as multipart form\n * data — so there is no SDK call to capture.\n */\n/**\n * The optional audio fields shared by every provider's line: `language`, and\n * the timestamp granularities (which, where the provider needs it, also\n * require the verbose response shape). `providerOptions` spreads after these,\n * so it can still override `response_format`.\n */\nconst audioOptions = (\n request: BatchTranscriptionRequest,\n verboseTimestamps: boolean\n): JsonObject => {\n const fields: JsonObject = {};\n if (request.language) {\n fields.language = request.language;\n }\n if (request.timestampGranularities) {\n if (verboseTimestamps) {\n fields.response_format = \"verbose_json\";\n }\n fields.timestamp_granularities = request.timestampGranularities;\n }\n return fields;\n};\n\nconst transcriptionBody = (\n resolved: ResolvedModel,\n request: BatchTranscriptionRequest\n): JsonObject => {\n const options = request.providerOptions?.[resolved.provider];\n if (resolved.provider === \"groq\") {\n return {\n model: resolved.modelId,\n url: request.audioUrl,\n ...audioOptions(request, true),\n ...options,\n };\n }\n if (resolved.provider === \"mistral\") {\n // `model` is included for uniformity; the Mistral adapter strips it from\n // each line and sets it on the job instead.\n return {\n file_url: request.audioUrl,\n model: resolved.modelId,\n ...audioOptions(request, false),\n ...options,\n };\n }\n if (resolved.provider === \"together\") {\n // Together's audio batch lines carry the hosted URL in `file`; extra\n // fields pass through to the underlying transcription API.\n return {\n file: request.audioUrl,\n model: resolved.modelId,\n ...audioOptions(request, true),\n ...options,\n };\n }\n throw unsupportedTranscriptionProvider(resolved.provider);\n};\n\nconst buildAudioBodies = (\n resolved: ResolvedModel,\n requests: readonly BatchTranscriptionRequest[],\n defaults: BatchTranscriptionDefaults | undefined,\n endpoint: string,\n rawLimits?: BatchLimits | ResolvedBatchLimits\n): BuiltRequest[] => {\n const limits = resolveBatchLimits(rawLimits);\n if (requests.length > limits.maxRequests) {\n throw new BatchworkError(\n `batchwork: requests length ${requests.length} exceeds the ${limits.maxRequests} request limit.`\n );\n }\n return assignCustomIds(requests).map((item) => {\n const body = transcriptionBody(\n resolved,\n mergeDefaults(item.request, defaults)\n );\n assertByteLength(\n `request \"${item.customId}\"`,\n JSON.stringify(body),\n limits.maxRequestBytes\n );\n return { body, customId: item.customId, endpoint };\n });\n};\n\n/**\n * Build provider transcription request bodies for every batch item. Each item\n * maps to a single transcription of a hosted audio URL, correlated by\n * `customId`.\n */\nexport const buildTranscriptionBodies = (\n resolved: ResolvedModel,\n requests: readonly BatchTranscriptionRequest[],\n defaults: BatchTranscriptionDefaults | undefined,\n rawLimits?: BatchLimits | ResolvedBatchLimits\n): BuiltRequest[] =>\n buildAudioBodies(\n resolved,\n requests,\n defaults,\n TRANSCRIPTION_ENDPOINT,\n rawLimits\n );\n\n/**\n * Build provider audio-translation request bodies for every batch item. The\n * body shape is identical to transcription (minus `language` — the output is\n * always English); only the endpoint differs.\n */\nexport const buildTranslationBodies = (\n resolved: ResolvedModel,\n requests: readonly BatchTranslationRequest[],\n defaults: BatchTranslationDefaults | undefined,\n rawLimits?: BatchLimits | ResolvedBatchLimits\n): BuiltRequest[] =>\n buildAudioBodies(\n resolved,\n requests,\n defaults,\n \"/v1/audio/translations\",\n rawLimits\n );\n\n/**\n * Derive provider image-generation request bodies for every batch item by\n * running each through the AI SDK `generateImage` with a capturing `fetch`.\n * Mirrors {@link buildRequestBodies} for the image endpoint; each item maps to a\n * single image-generation call, correlated by `customId`.\n */\nexport const buildImageBodies = async (\n resolved: ResolvedModel,\n requests: readonly BatchImageRequest[],\n defaults: BatchImageDefaults | undefined,\n credentials: ProviderCredentials,\n rawLimits?: BatchLimits | ResolvedBatchLimits\n): Promise<BuiltRequest[]> => {\n const limits = resolveBatchLimits(rawLimits);\n if (requests.length > limits.maxRequests) {\n throw new BatchworkError(\n `batchwork: requests length ${requests.length} exceeds the ${limits.maxRequests} request limit.`\n );\n }\n const model = await createCaptureImageModel(\n resolved,\n credentials,\n captureFetch\n );\n const items = assignCustomIds(requests);\n\n return await pMap(\n items,\n async (item) => {\n const built = await captureImageOne(\n model,\n mergeDefaults(item.request, defaults),\n item.customId,\n limits.maxRequestBytes\n );\n assertByteLength(\n `request \"${item.customId}\"`,\n JSON.stringify(built.body),\n limits.maxRequestBytes\n );\n return built;\n },\n { concurrency: limits.captureConcurrency }\n );\n};\n\nconst IMAGE_EDIT_ENDPOINT = \"/v1/images/edits\";\n\nconst openaiImageRef = (ref: BatchImageRef): JsonObject =>\n \"fileId\" in ref ? { file_id: ref.fileId } : { image_url: ref.imageUrl };\n\n/**\n * Build the provider image-edit body directly — the AI SDK's `generateImage`\n * has no way to pass input images, so there is no call to capture. Both\n * providers take JSON with asset references: OpenAI `{ images: [{ file_id |\n * image_url }], mask? }`, xAI `{ image: { url } }` (URLs only, no masks).\n */\nconst imageEditBody = (\n resolved: ResolvedModel,\n request: BatchImageEditRequest,\n customId: string\n): JsonObject => {\n if (request.images.length === 0) {\n throw new BatchworkError(\n `batchwork: image-edit request \"${customId}\" needs at least one entry in \\`images\\`.`\n );\n }\n const options = request.providerOptions?.[resolved.provider];\n if (resolved.provider === \"openai\") {\n const body: JsonObject = {\n images: request.images.map(openaiImageRef),\n model: resolved.modelId,\n prompt: request.prompt,\n };\n if (request.mask) {\n body.mask = openaiImageRef(request.mask);\n }\n if (request.n !== undefined) {\n body.n = request.n;\n }\n if (request.size) {\n body.size = request.size;\n }\n return { ...body, ...options };\n }\n if (resolved.provider === \"xai\") {\n if (request.mask) {\n throw new BatchworkError(\n `batchwork: image-edit request \"${customId}\" has a \\`mask\\`, but xAI image edits do not support masks.`\n );\n }\n if (request.size) {\n throw new BatchworkError(\n `batchwork: image-edit request \"${customId}\" has \\`size\\`, but xAI image edits take \\`providerOptions.xai.aspect_ratio\\` instead.`\n );\n }\n const urls = request.images.map((ref) => {\n if (\"fileId\" in ref) {\n throw new BatchworkError(\n `batchwork: image-edit request \"${customId}\" uses a \\`fileId\\` reference, but xAI image edits accept image URLs only.`\n );\n }\n return ref.imageUrl;\n });\n const body: JsonObject = {\n model: resolved.modelId,\n prompt: request.prompt,\n ...(urls.length === 1\n ? { image: { url: urls[0] } }\n : { images: urls.map((url) => ({ url })) }),\n };\n if (request.n !== undefined) {\n body.n = request.n;\n }\n return { ...body, ...options };\n }\n throw unsupportedImageEditProvider(resolved.provider);\n};\n\n/**\n * Build provider image-edit request bodies for every batch item. Each item\n * maps to a single edit call, correlated by `customId`.\n */\nexport const buildImageEditBodies = (\n resolved: ResolvedModel,\n requests: readonly BatchImageEditRequest[],\n defaults: BatchImageEditDefaults | undefined,\n rawLimits?: BatchLimits | ResolvedBatchLimits\n): BuiltRequest[] => {\n const limits = resolveBatchLimits(rawLimits);\n if (requests.length > limits.maxRequests) {\n throw new BatchworkError(\n `batchwork: requests length ${requests.length} exceeds the ${limits.maxRequests} request limit.`\n );\n }\n return assignCustomIds(requests).map((item) => {\n const body = imageEditBody(\n resolved,\n mergeDefaults(item.request, defaults),\n item.customId\n );\n assertByteLength(\n `request \"${item.customId}\"`,\n JSON.stringify(body),\n limits.maxRequestBytes\n );\n return { body, customId: item.customId, endpoint: IMAGE_EDIT_ENDPOINT };\n });\n};\n\nconst captureVideoOne = async (\n model: VideoModel,\n request: BatchVideoRequest,\n customId: string,\n maxRequestBytes: number\n): Promise<BuiltRequest> => {\n try {\n // The provider's first network call is the JSON job-creation POST (polling\n // only starts afterwards), so the capturing `fetch` intercepts the exact\n // body a batch line needs. Edit/extend modes (via `providerOptions`) are\n // captured against their own endpoints, which xAI batch also accepts.\n await experimental_generateVideo({\n aspectRatio: request.aspectRatio,\n duration: request.duration,\n // `maxRetries: 0` is load-bearing: with retries enabled the capture error\n // is wrapped in a `RetryError` (under `.errors`, not `.cause`) and\n // `findCapture`'s cause walk would miss it.\n maxRetries: 0,\n model,\n prompt: request.prompt,\n providerOptions: request.providerOptions,\n resolution: request.resolution,\n });\n } catch (error) {\n // A genuine failure (one that never reached the capturing `fetch`, e.g. an\n // invalid prompt) carries no capture signal and is rethrown.\n const capture = findCapture(error);\n if (!capture) {\n throw error;\n }\n return bodyFromCapture(capture, customId, maxRequestBytes);\n }\n throw new BatchworkError(\n \"batchwork: the request was not intercepted while building the video body.\"\n );\n};\n\n/**\n * Derive provider video-generation request bodies for every batch item by\n * running each through the AI SDK `generateVideo` with a capturing `fetch`.\n * Mirrors {@link buildRequestBodies} for the video endpoints; each item maps to\n * a single video job, correlated by `customId`.\n */\nexport const buildVideoBodies = async (\n resolved: ResolvedModel,\n requests: readonly BatchVideoRequest[],\n defaults: BatchVideoDefaults | undefined,\n credentials: ProviderCredentials,\n rawLimits?: BatchLimits | ResolvedBatchLimits\n): Promise<BuiltRequest[]> => {\n const limits = resolveBatchLimits(rawLimits);\n if (requests.length > limits.maxRequests) {\n throw new BatchworkError(\n `batchwork: requests length ${requests.length} exceeds the ${limits.maxRequests} request limit.`\n );\n }\n const model = await createCaptureVideoModel(\n resolved,\n credentials,\n captureFetch\n );\n const items = assignCustomIds(requests);\n\n return await pMap(\n items,\n async (item) => {\n const built = await captureVideoOne(\n model,\n mergeDefaults(item.request, defaults),\n item.customId,\n limits.maxRequestBytes\n );\n assertByteLength(\n `request \"${item.customId}\"`,\n JSON.stringify(built.body),\n limits.maxRequestBytes\n );\n return built;\n },\n { concurrency: limits.captureConcurrency }\n );\n};\n",
7
+ "import {\n buildEmbeddingBodies,\n buildImageBodies,\n buildImageEditBodies,\n buildModerationBodies,\n buildRequestBodies,\n buildTranscriptionBodies,\n buildTranslationBodies,\n buildVideoBodies,\n} from \"./body\";\nimport { BatchworkError } from \"./errors\";\nimport { BatchJob } from \"./job\";\nimport { resolveBatchLimits } from \"./limits\";\nimport {\n EMBEDDING_PROVIDERS,\n IMAGE_EDIT_PROVIDERS,\n IMAGE_PROVIDERS,\n MODERATION_PROVIDERS,\n resolveModel,\n TRANSCRIPTION_PROVIDERS,\n TRANSLATION_PROVIDERS,\n unsupportedEmbeddingProvider,\n unsupportedImageEditProvider,\n unsupportedImageProvider,\n unsupportedModerationProvider,\n unsupportedTranscriptionProvider,\n unsupportedTranslationProvider,\n unsupportedVideoProvider,\n VIDEO_PROVIDERS,\n} from \"./model\";\nimport { getAdapter } from \"./providers\";\nimport type {\n BatchEmbeddingsOptions,\n BatchImageEditOptions,\n BatchImageOptions,\n BatchModerationOptions,\n BatchOptions,\n BatchProvider,\n BatchRef,\n BatchResult,\n BatchTranscriptionOptions,\n BatchTranslationOptions,\n BatchVideoOptions,\n ProviderCredentials,\n} from \"./types\";\n\nconst EMPTY_REQUESTS_MESSAGE = \"batchwork: `requests` must not be empty.\";\n\nconst pickCredentials = (source: ProviderCredentials): ProviderCredentials => ({\n apiKey: source.apiKey,\n baseURL: source.baseURL,\n headers: source.headers,\n});\n\nconst providerFromRef = (ref: BatchRef): BatchProvider => {\n if (ref.provider) {\n return ref.provider;\n }\n if (ref.model !== undefined) {\n return resolveModel(ref.model).provider;\n }\n throw new BatchworkError(\n \"batchwork: provide `provider` or `model` to identify the batch.\"\n );\n};\n\n/**\n * Submit a batch of text/chat requests to the model's provider and return a\n * handle. Reachable as both `batch()` (shorthand) and `batch.text()`.\n *\n * Resolves immediately once the batch is accepted — it does not wait for\n * processing. Use the returned {@link BatchJob} to poll, wait, or stream\n * results.\n *\n * @example\n * const job = await batch({\n * model: openai(\"gpt-5.5\"),\n * requests: [{ customId: \"a\", prompt: \"Say hi\" }],\n * });\n * const results = await job.wait().then(() => job.collect());\n */\nconst submitText = async (options: BatchOptions): Promise<BatchJob> => {\n if (options.requests.length === 0) {\n throw new BatchworkError(EMPTY_REQUESTS_MESSAGE);\n }\n\n const resolved = resolveModel(options.model);\n const credentials = pickCredentials(options);\n const limits = resolveBatchLimits(options.limits);\n const adapter = getAdapter(resolved.provider);\n\n const built = await buildRequestBodies(\n resolved,\n options.requests,\n options.defaults,\n credentials,\n limits\n );\n const snapshot = await adapter.submit({\n built,\n credentials,\n endpoint: built[0]?.endpoint ?? \"\",\n limits,\n metadata: options.metadata,\n modelId: resolved.modelId,\n });\n\n return new BatchJob(adapter, credentials, snapshot);\n};\n\n/**\n * Submit a batch of embedding requests to the model's provider and return a\n * handle. Each request's `value` produces one vector, correlated by `customId`\n * via {@link BatchJob.results}. Supported for OpenAI, Mistral, Together, and\n * Google; other providers throw {@link UnsupportedProviderError}.\n *\n * @example\n * const job = await batch.embeddings({\n * model: openai.embeddingModel(\"text-embedding-3-small\"),\n * requests: [{ customId: \"a\", value: \"hello world\" }],\n * });\n * const results = await job.wait().then(() => job.collect());\n * for (const r of results) {\n * console.log(r.customId, r.embedding?.length);\n * }\n */\nconst submitEmbeddings = async (\n options: BatchEmbeddingsOptions\n): Promise<BatchJob> => {\n if (options.requests.length === 0) {\n throw new BatchworkError(EMPTY_REQUESTS_MESSAGE);\n }\n\n const resolved = resolveModel(options.model);\n if (!EMBEDDING_PROVIDERS.has(resolved.provider)) {\n throw unsupportedEmbeddingProvider(resolved.provider);\n }\n const credentials = pickCredentials(options);\n const limits = resolveBatchLimits(options.limits);\n const adapter = getAdapter(resolved.provider);\n\n const built = await buildEmbeddingBodies(\n resolved,\n options.requests,\n credentials,\n limits\n );\n const snapshot = await adapter.submit({\n built,\n credentials,\n endpoint: built[0]?.endpoint ?? \"\",\n limits,\n metadata: options.metadata,\n modelId: resolved.modelId,\n });\n\n return new BatchJob(adapter, credentials, snapshot);\n};\n\n/**\n * Submit a batch of image-generation requests to the model's provider and\n * return a handle. Each request's `prompt` produces one or more images,\n * correlated by `customId` via {@link BatchJob.results}. Supported for OpenAI\n * and Google; other providers throw {@link UnsupportedProviderError}.\n *\n * @example\n * const job = await batch.images({\n * model: openai.image(\"gpt-image-2\"),\n * requests: [{ customId: \"a\", prompt: \"a red bicycle\" }],\n * });\n * const results = await job.wait().then(() => job.collect());\n * for (const r of results) {\n * console.log(r.customId, r.images?.length);\n * }\n */\nconst submitImages = async (options: BatchImageOptions): Promise<BatchJob> => {\n if (options.requests.length === 0) {\n throw new BatchworkError(EMPTY_REQUESTS_MESSAGE);\n }\n\n const resolved = resolveModel(options.model);\n if (!IMAGE_PROVIDERS.has(resolved.provider)) {\n throw unsupportedImageProvider(resolved.provider);\n }\n const credentials = pickCredentials(options);\n const limits = resolveBatchLimits(options.limits);\n const adapter = getAdapter(resolved.provider);\n\n const built = await buildImageBodies(\n resolved,\n options.requests,\n options.defaults,\n credentials,\n limits\n );\n const snapshot = await adapter.submit({\n built,\n credentials,\n endpoint: built[0]?.endpoint ?? \"\",\n limits,\n metadata: options.metadata,\n modelId: resolved.modelId,\n });\n\n return new BatchJob(adapter, credentials, snapshot);\n};\n\n/**\n * Submit a batch of image-edit requests to the model's provider and return a\n * handle. Each request's `prompt` is applied to its source `images` (uploaded\n * file ids or hosted URLs — batch bodies are JSON, so raw uploads aren't\n * possible), producing edited images on `result.images`, correlated by\n * `customId` via {@link BatchJob.results}. Supported for OpenAI and xAI; other\n * providers throw {@link UnsupportedProviderError}.\n *\n * @example\n * const job = await batch.images.edit({\n * model: openai.image(\"gpt-image-2\"),\n * requests: [\n * {\n * customId: \"a\",\n * prompt: \"Make the bicycle blue.\",\n * images: [{ imageUrl: \"https://example.com/bicycle.png\" }],\n * },\n * ],\n * });\n * const results = await job.wait().then(() => job.collect());\n */\nconst submitImageEdits = async (\n options: BatchImageEditOptions\n): Promise<BatchJob> => {\n if (options.requests.length === 0) {\n throw new BatchworkError(EMPTY_REQUESTS_MESSAGE);\n }\n\n const resolved = resolveModel(options.model);\n if (!IMAGE_EDIT_PROVIDERS.has(resolved.provider)) {\n throw unsupportedImageEditProvider(resolved.provider);\n }\n const credentials = pickCredentials(options);\n const limits = resolveBatchLimits(options.limits);\n const adapter = getAdapter(resolved.provider);\n\n const built = buildImageEditBodies(\n resolved,\n options.requests,\n options.defaults,\n limits\n );\n const snapshot = await adapter.submit({\n built,\n credentials,\n endpoint: built[0]?.endpoint ?? \"\",\n limits,\n metadata: options.metadata,\n modelId: resolved.modelId,\n });\n\n return new BatchJob(adapter, credentials, snapshot);\n};\n\n/**\n * Submit a batch of moderation requests to the model's provider and return a\n * handle. Each request's `value` (and/or `imageUrls`, OpenAI omni moderation\n * only) produces one verdict on `result.moderation`, correlated by `customId`\n * via {@link BatchJob.results}. Supported for OpenAI and Mistral; other\n * providers throw {@link UnsupportedProviderError}. Pass the model as a\n * `\"provider/model\"` string — the AI SDK has no moderation model type.\n *\n * @example\n * const job = await batch.moderations({\n * model: \"openai/omni-moderation-latest\",\n * requests: [{ customId: \"a\", value: \"…user-generated content…\" }],\n * });\n * const results = await job.wait().then(() => job.collect());\n * for (const r of results) {\n * console.log(r.customId, r.moderation?.flagged);\n * }\n */\nconst submitModerations = async (\n options: BatchModerationOptions\n): Promise<BatchJob> => {\n if (options.requests.length === 0) {\n throw new BatchworkError(EMPTY_REQUESTS_MESSAGE);\n }\n\n const resolved = resolveModel(options.model);\n if (!MODERATION_PROVIDERS.has(resolved.provider)) {\n throw unsupportedModerationProvider(resolved.provider);\n }\n const credentials = pickCredentials(options);\n const limits = resolveBatchLimits(options.limits);\n const adapter = getAdapter(resolved.provider);\n\n const built = buildModerationBodies(resolved, options.requests, limits);\n const snapshot = await adapter.submit({\n built,\n credentials,\n endpoint: built[0]?.endpoint ?? \"\",\n limits,\n metadata: options.metadata,\n modelId: resolved.modelId,\n });\n\n return new BatchJob(adapter, credentials, snapshot);\n};\n\n/**\n * Submit a batch of audio-transcription requests to the model's provider and\n * return a handle. Each request's `audioUrl` (a hosted audio file — batch\n * audio endpoints accept URLs, not file uploads) produces one transcript,\n * correlated by `customId` via {@link BatchJob.results}. Supported for Groq\n * and Mistral; other providers throw {@link UnsupportedProviderError}.\n *\n * @example\n * const job = await batch.transcriptions({\n * model: groq.transcription(\"whisper-large-v3\"),\n * requests: [{ customId: \"a\", audioUrl: \"https://example.com/call.wav\" }],\n * });\n * const results = await job.wait().then(() => job.collect());\n * for (const r of results) {\n * console.log(r.customId, r.text);\n * }\n */\nconst submitTranscriptions = async (\n options: BatchTranscriptionOptions\n): Promise<BatchJob> => {\n if (options.requests.length === 0) {\n throw new BatchworkError(EMPTY_REQUESTS_MESSAGE);\n }\n\n const resolved = resolveModel(options.model);\n if (!TRANSCRIPTION_PROVIDERS.has(resolved.provider)) {\n throw unsupportedTranscriptionProvider(resolved.provider);\n }\n const credentials = pickCredentials(options);\n const limits = resolveBatchLimits(options.limits);\n const adapter = getAdapter(resolved.provider);\n\n const built = buildTranscriptionBodies(\n resolved,\n options.requests,\n options.defaults,\n limits\n );\n const snapshot = await adapter.submit({\n built,\n credentials,\n endpoint: built[0]?.endpoint ?? \"\",\n limits,\n metadata: options.metadata,\n modelId: resolved.modelId,\n });\n\n return new BatchJob(adapter, credentials, snapshot);\n};\n\n/**\n * Submit a batch of video-generation requests to the model's provider and\n * return a handle. Each request's `prompt` produces one video, correlated by\n * `customId` via {@link BatchJob.results}. Supported for xAI (Grok Imagine);\n * other providers throw {@link UnsupportedProviderError} — OpenAI's Videos API\n * (Sora) is deprecated and Google's Veo models are not batch-compatible.\n *\n * Results come back as signed URLs on `result.videos` that **expire ~1h**\n * after completion — download promptly.\n *\n * @example\n * const job = await batch.videos({\n * model: xai.video(\"grok-imagine-video\"),\n * requests: [{ customId: \"a\", prompt: \"A red bicycle rolling downhill.\" }],\n * });\n * const results = await job.wait().then(() => job.collect());\n * for (const r of results) {\n * console.log(r.customId, r.videos?.[0]?.url);\n * }\n */\nconst submitVideos = async (options: BatchVideoOptions): Promise<BatchJob> => {\n if (options.requests.length === 0) {\n throw new BatchworkError(EMPTY_REQUESTS_MESSAGE);\n }\n\n const resolved = resolveModel(options.model);\n if (!VIDEO_PROVIDERS.has(resolved.provider)) {\n throw unsupportedVideoProvider(resolved.provider);\n }\n const credentials = pickCredentials(options);\n const limits = resolveBatchLimits(options.limits);\n const adapter = getAdapter(resolved.provider);\n\n const built = await buildVideoBodies(\n resolved,\n options.requests,\n options.defaults,\n credentials,\n limits\n );\n const snapshot = await adapter.submit({\n built,\n credentials,\n endpoint: built[0]?.endpoint ?? \"\",\n limits,\n metadata: options.metadata,\n modelId: resolved.modelId,\n });\n\n return new BatchJob(adapter, credentials, snapshot);\n};\n\n/**\n * Submit a batch of audio-translation requests (Whisper's translate task —\n * audio in any language, English text out) and return a handle. Mirrors\n * {@link batch.transcriptions} minus `language`: each request's `audioUrl`\n * produces one English transcript on `result.text`, correlated by `customId`.\n * Supported for Groq and Together; other providers throw\n * {@link UnsupportedProviderError} — Mistral batches transcriptions but not\n * translations.\n *\n * @example\n * const job = await batch.translations({\n * model: groq.transcription(\"whisper-large-v3\"),\n * requests: [{ customId: \"a\", audioUrl: \"https://example.com/french.wav\" }],\n * });\n * const results = await job.wait().then(() => job.collect());\n */\nconst submitTranslations = async (\n options: BatchTranslationOptions\n): Promise<BatchJob> => {\n if (options.requests.length === 0) {\n throw new BatchworkError(EMPTY_REQUESTS_MESSAGE);\n }\n\n const resolved = resolveModel(options.model);\n if (!TRANSLATION_PROVIDERS.has(resolved.provider)) {\n throw unsupportedTranslationProvider(resolved.provider);\n }\n const credentials = pickCredentials(options);\n const limits = resolveBatchLimits(options.limits);\n const adapter = getAdapter(resolved.provider);\n\n const built = buildTranslationBodies(\n resolved,\n options.requests,\n options.defaults,\n limits\n );\n const snapshot = await adapter.submit({\n built,\n credentials,\n endpoint: built[0]?.endpoint ?? \"\",\n limits,\n metadata: options.metadata,\n modelId: resolved.modelId,\n });\n\n return new BatchJob(adapter, credentials, snapshot);\n};\n\n/**\n * Submit a batch of requests and return a {@link BatchJob} handle.\n *\n * Callable directly as a shorthand for text/chat batches, with one method per\n * modality:\n *\n * - `batch()` / {@link batch.text} — text & chat completions\n * - {@link batch.embeddings} — embedding vectors\n * - {@link batch.images} / {@link batch.images.create} — image generation\n * - {@link batch.images.edit} — image editing\n * - {@link batch.transcriptions} — audio transcription\n * - {@link batch.translations} — audio translation to English\n * - {@link batch.moderations} — content moderation\n * - {@link batch.videos} — video generation\n *\n * @example\n * const job = await batch({\n * model: openai(\"gpt-5.5\"),\n * requests: [{ customId: \"a\", prompt: \"Say hi\" }],\n * });\n */\nexport const batch = Object.assign(submitText, {\n /** Submit a batch of embedding requests. */\n embeddings: submitEmbeddings,\n /**\n * Submit a batch of image-generation requests. Also exposes\n * {@link batch.images.create} (an alias of calling it directly) and\n * {@link batch.images.edit} for editing existing images.\n */\n images: Object.assign(submitImages, {\n /** Submit a batch of image-generation requests. Equivalent to `batch.images()`. */\n create: submitImages,\n /** Submit a batch of image-edit requests. */\n edit: submitImageEdits,\n }),\n /** Submit a batch of moderation requests. */\n moderations: submitModerations,\n /** Submit a batch of text/chat requests. Equivalent to calling `batch()`. */\n text: submitText,\n /** Submit a batch of audio-transcription requests. */\n transcriptions: submitTranscriptions,\n /** Submit a batch of audio-translation (to English) requests. */\n translations: submitTranslations,\n /** Submit a batch of video-generation requests. */\n videos: submitVideos,\n});\n\n/**\n * @deprecated Use {@link batch.embeddings} instead. Kept as a standalone alias\n * for backward compatibility; it will be removed in a future major.\n */\nexport const batchEmbeddings = submitEmbeddings;\n\n/**\n * @deprecated Use {@link batch.images} instead. Kept as a standalone alias for\n * backward compatibility; it will be removed in a future major.\n */\nexport const batchImages = submitImages;\n\n/**\n * Rehydrate a {@link BatchJob} for an existing batch id (e.g. one persisted\n * after submission). Identify the provider with `provider` or `model`.\n */\nexport const getBatch = async (ref: BatchRef): Promise<BatchJob> => {\n const adapter = getAdapter(providerFromRef(ref));\n const credentials = pickCredentials(ref);\n const snapshot = await adapter.retrieve(ref.id, credentials);\n return new BatchJob(adapter, credentials, snapshot);\n};\n\n/** Stream the results of an existing batch by id, without a handle. */\nexport const getBatchResults = (ref: BatchRef): AsyncGenerator<BatchResult> => {\n const adapter = getAdapter(providerFromRef(ref));\n return adapter.results(ref.id, pickCredentials(ref));\n};\n\n/** Request cancellation of an existing batch by id. */\nexport const cancelBatch = async (ref: BatchRef): Promise<void> => {\n const adapter = getAdapter(providerFromRef(ref));\n await adapter.cancel(ref.id, pickCredentials(ref));\n};\n"
8
+ ],
9
+ "mappings": ";;;;;;;;;;;;;;;;;AAqFA,IAAM,kBAAkB;AAExB,IAAM,sBAAsB,CAC1B,YACuB;AAAA,EACvB,IAAI,CAAC,SAAS;AAAA,IACZ;AAAA,EACF;AAAA,EACA,MAAM,aAAa,oBAAoB,OAAO;AAAA,EAC9C,IAAI;AAAA,IACF,IAAI,IAAI,IAAI,UAAU,EAAE,SAAS,SAAS,mBAAmB,GAAG;AAAA,MAG9D,MAAM,OAAO,WAAW,QAAQ,UAAU,EAAE;AAAA,MAC5C,OAAO,KAAK,SAAS,SAAS,IAAI,OAAO,GAAG;AAAA,IAC9C;AAAA,IACA,MAAM;AAAA,EAGR,OAAO;AAAA;AAIT,IAAM,sBAGF;AAAA,EACF,WAAW,EAAE,OAAO,aAAa,WAAW,oBAAoB;AAAA,EAChE,OAAO,E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4F0C86CA964756E2164756E21",
11
+ "names": []
12
+ }
@@ -0,0 +1,5 @@
1
+ /** Primitive type guards: the narrowing primitives for values of unknown origin. */
2
+ export declare const isString: (value: unknown) => value is string;
3
+ export declare const isNumber: (value: unknown) => value is number;
4
+ export declare const isBoolean: (value: unknown) => value is boolean;
5
+ //# sourceMappingURL=guards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":"AAAA,oFAAoF;AAEpF,eAAO,MAAM,QAAQ,UAAW,OAAO,KAAG,KAAK,IAAI,MACxB,CAAC;AAE5B,eAAO,MAAM,QAAQ,UAAW,OAAO,KAAG,KAAK,IAAI,MACxB,CAAC;AAE5B,eAAO,MAAM,SAAS,UAAW,OAAO,KAAG,KAAK,IAAI,OACxB,CAAC"}
package/dist/http.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- /** Make a request and parse a JSON response, throwing on non-2xx. */
2
- export declare const requestJson: <T>(url: string, init: RequestInit) => Promise<T>;
1
+ import type { JsonValue } from "./types";
2
+ /** Make a request and parse its JSON response body, throwing on non-2xx. */
3
+ export declare const requestJson: (url: string, init: RequestInit) => Promise<JsonValue>;
3
4
  /** Make a request and return the raw body stream, throwing on non-2xx. */
4
5
  export declare const requestStream: (url: string, init: RequestInit) => Promise<ReadableStream<Uint8Array>>;
5
6
  //# sourceMappingURL=http.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAUA,qEAAqE;AACrE,eAAO,MAAM,WAAW,GAAU,CAAC,OAC5B,MAAM,QACL,WAAW,KAChB,OAAO,CAAC,CAAC,CAIX,CAAC;AAEF,0EAA0E;AAC1E,eAAO,MAAM,aAAa,QACnB,MAAM,QACL,WAAW,KAChB,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAOpC,CAAC"}
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAWzC,4EAA4E;AAC5E,eAAO,MAAM,WAAW,QACjB,MAAM,QACL,WAAW,KAChB,OAAO,CAAC,SAAS,CAInB,CAAC;AAEF,0EAA0E;AAC1E,eAAO,MAAM,aAAa,QACnB,MAAM,QACL,WAAW,KAChB,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAOpC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -2,5 +2,5 @@ export { batch, batchEmbeddings, batchImages, cancelBatch, getBatch, getBatchRes
2
2
  export { BatchworkError, MissingDependencyError, UnsupportedProviderError, } from "./errors";
3
3
  export { BatchJob, isTerminalStatus } from "./job";
4
4
  export { resolveModel } from "./model";
5
- export type { BatchDefaults, BatchEmbeddingRequest, BatchEmbeddingsOptions, BatchImage, BatchImageDefaults, BatchImageEditDefaults, BatchImageEditOptions, BatchImageEditRequest, BatchImageOptions, BatchImageRef, BatchImageRequest, BatchLimits, BatchModeration, BatchModerationOptions, BatchModerationRequest, BatchOptions, BatchProvider, BatchRef, BatchRequest, BatchRequestCounts, BatchRequestSettings, BatchResult, BatchResultError, BatchResultStatus, BatchSnapshot, BatchStatus, BatchTranscriptionDefaults, BatchTranscriptionOptions, BatchTranscriptionRequest, BatchTranscriptionSegment, BatchTranslationDefaults, BatchTranslationOptions, BatchTranslationRequest, BatchUsage, BatchVideo, BatchVideoDefaults, BatchVideoOptions, BatchVideoRequest, ProviderCredentials, ProviderOptions, VideoModel, WaitOptions, } from "./types";
5
+ export type { BatchDefaults, BatchEmbeddingRequest, BatchEmbeddingsOptions, BatchImage, BatchImageDefaults, BatchImageEditDefaults, BatchImageEditOptions, BatchImageEditRequest, BatchImageOptions, BatchImageRef, BatchImageRequest, BatchLimits, BatchModeration, BatchModerationOptions, BatchModerationRequest, BatchOptions, BatchProvider, BatchRef, BatchRequest, BatchRequestCounts, BatchRequestSettings, BatchResult, BatchResultError, BatchResultStatus, BatchSnapshot, BatchStatus, BatchTranscriptionDefaults, BatchTranscriptionOptions, BatchTranscriptionRequest, BatchTranscriptionSegment, BatchTranslationDefaults, BatchTranslationOptions, BatchTranslationRequest, BatchUsage, BatchVideo, BatchVideoDefaults, BatchVideoOptions, BatchVideoRequest, HttpHeaders, JsonObject, JsonValue, ProviderCredentials, ProviderOptions, VideoModel, WaitOptions, } from "./types";
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,eAAe,EACf,WAAW,EACX,WAAW,EACX,QAAQ,EACR,eAAe,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,YAAY,EACV,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,0BAA0B,EAC1B,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,UAAU,EACV,WAAW,GACZ,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,eAAe,EACf,WAAW,EACX,WAAW,EACX,QAAQ,EACR,eAAe,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,YAAY,EACV,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,0BAA0B,EAC1B,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,eAAe,EACf,UAAU,EACV,WAAW,GACZ,MAAM,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -1,34 +1,33 @@
1
1
  import {
2
- batch,
3
- batchEmbeddings,
4
- batchImages,
5
- cancelBatch,
6
- getBatch,
7
- getBatchResults,
8
- resolveModel
9
- } from "./chunk-14qcscwd.js";
2
+ BatchworkError2,
3
+ UnsupportedProviderError2,
4
+ MissingDependencyError2,
5
+ isTerminalStatus2,
6
+ BatchJob2
7
+ } from "./chunk-7y95mhvm.js";
10
8
  import {
11
- BatchJob,
12
- BatchworkError,
13
- MissingDependencyError,
14
- UnsupportedProviderError,
15
- isTerminalStatus
16
- } from "./chunk-n50t31ca.js";
17
- import"./chunk-v0bahtg2.js";
9
+ resolveModel2,
10
+ batch2,
11
+ batchEmbeddings2,
12
+ batchImages2,
13
+ getBatch2,
14
+ getBatchResults2,
15
+ cancelBatch2
16
+ } from "./chunk-zss8h417.js";
18
17
  export {
19
- resolveModel,
20
- isTerminalStatus,
21
- getBatchResults,
22
- getBatch,
23
- cancelBatch,
24
- batchImages,
25
- batchEmbeddings,
26
- batch,
27
- UnsupportedProviderError,
28
- MissingDependencyError,
29
- BatchworkError,
30
- BatchJob
18
+ BatchJob2 as BatchJob,
19
+ BatchworkError2 as BatchworkError,
20
+ MissingDependencyError2 as MissingDependencyError,
21
+ UnsupportedProviderError2 as UnsupportedProviderError,
22
+ batch2 as batch,
23
+ batchEmbeddings2 as batchEmbeddings,
24
+ batchImages2 as batchImages,
25
+ cancelBatch2 as cancelBatch,
26
+ getBatch2 as getBatch,
27
+ getBatchResults2 as getBatchResults,
28
+ isTerminalStatus2 as isTerminalStatus,
29
+ resolveModel2 as resolveModel
31
30
  };
32
31
 
33
- //# debugId=403BD62DE792A0F964756E2164756E21
32
+ //# debugId=29D595E8154D659B64756E2164756E21
34
33
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -4,6 +4,6 @@
4
4
  "sourcesContent": [
5
5
  ],
6
6
  "mappings": "",
7
- "debugId": "403BD62DE792A0F964756E2164756E21",
7
+ "debugId": "29D595E8154D659B64756E2164756E21",
8
8
  "names": []
9
9
  }
package/dist/jsonl.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { JsonValue } from "./types";
1
2
  export interface JsonlParseOptions {
2
3
  maxLineBytes?: number;
3
4
  }
@@ -6,6 +7,6 @@ export interface JsonlEncodeOptions {
6
7
  maxBytes?: number;
7
8
  }
8
9
  export declare const encodeJsonl: (items: readonly unknown[], options?: JsonlEncodeOptions) => string;
9
- export declare const parseJsonl: <T = unknown>(text: string, options?: JsonlParseOptions) => T[];
10
- export declare function streamJsonl<T = unknown>(source: ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>, options?: JsonlParseOptions): AsyncGenerator<T>;
10
+ export declare const parseJsonl: (text: string, options?: JsonlParseOptions) => JsonValue[];
11
+ export declare function streamJsonl(source: ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>, options?: JsonlParseOptions): AsyncGenerator<JsonValue>;
11
12
  //# sourceMappingURL=jsonl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsonl.d.ts","sourceRoot":"","sources":["../src/jsonl.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAyDD,eAAO,MAAM,WAAW,UACf,SAAS,OAAO,EAAE,YACf,kBAAkB,KAC3B,MAsBF,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,CAAC,GAAG,OAAO,QAC9B,MAAM,YACF,iBAAiB,KAC1B,CAAC,EAWH,CAAC;AAmCF,wBAAuB,WAAW,CAAC,CAAC,GAAG,OAAO,EAC5C,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,EAC9D,OAAO,CAAC,EAAE,iBAAiB,GAC1B,cAAc,CAAC,CAAC,CAAC,CA2BnB"}
1
+ {"version":3,"file":"jsonl.d.ts","sourceRoot":"","sources":["../src/jsonl.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAMzC,MAAM,WAAW,iBAAiB;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAyDD,eAAO,MAAM,WAAW,UACf,SAAS,OAAO,EAAE,YACf,kBAAkB,KAC3B,MAsBF,CAAC;AAEF,eAAO,MAAM,UAAU,SACf,MAAM,YACF,iBAAiB,KAC1B,SAAS,EAWX,CAAC;AAkCF,wBAAuB,WAAW,CAChC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,EAC9D,OAAO,CAAC,EAAE,iBAAiB,GAC1B,cAAc,CAAC,SAAS,CAAC,CA2B3B"}
package/dist/model.d.ts CHANGED
@@ -1,6 +1,52 @@
1
+ import type { createAnthropic } from "@ai-sdk/anthropic";
2
+ import type { createAzure } from "@ai-sdk/azure";
3
+ import type { createGoogleGenerativeAI } from "@ai-sdk/google";
4
+ import type { createGroq } from "@ai-sdk/groq";
5
+ import type { createMistral } from "@ai-sdk/mistral";
6
+ import type { createOpenAI } from "@ai-sdk/openai";
7
+ import type { createTogetherAI } from "@ai-sdk/togetherai";
8
+ import type { createXai } from "@ai-sdk/xai";
1
9
  import type { EmbeddingModel, ImageModel, LanguageModel, TranscriptionModel } from "ai";
2
10
  import { UnsupportedProviderError } from "./errors";
3
11
  import type { BatchProvider, ProviderCredentials, VideoModel } from "./types";
12
+ /** The shape `loadProvider` expects from each optional `@ai-sdk/*` package. */
13
+ interface AnthropicModule {
14
+ createAnthropic: typeof createAnthropic;
15
+ }
16
+ interface AzureModule {
17
+ createAzure: typeof createAzure;
18
+ }
19
+ interface GoogleModule {
20
+ createGoogleGenerativeAI: typeof createGoogleGenerativeAI;
21
+ }
22
+ interface GroqModule {
23
+ createGroq: typeof createGroq;
24
+ }
25
+ interface MistralModule {
26
+ createMistral: typeof createMistral;
27
+ }
28
+ interface OpenAIModule {
29
+ createOpenAI: typeof createOpenAI;
30
+ }
31
+ interface TogetherModule {
32
+ createTogetherAI: typeof createTogetherAI;
33
+ }
34
+ interface XaiModule {
35
+ createXai: typeof createXai;
36
+ }
37
+ /** The module each provider's `@ai-sdk/*` package resolves to. */
38
+ interface ProviderModules {
39
+ anthropic: AnthropicModule;
40
+ azure: AzureModule;
41
+ google: GoogleModule;
42
+ groq: GroqModule;
43
+ mistral: MistralModule;
44
+ openai: OpenAIModule;
45
+ together: TogetherModule;
46
+ xai: XaiModule;
47
+ }
48
+ /** Imports the `@ai-sdk/*` package backing a provider. */
49
+ export type ProviderLoader = <P extends BatchProvider>(provider: P) => Promise<ProviderModules[P]>;
4
50
  /** A fetch implementation compatible with the AI SDK provider `fetch` option. */
5
51
  export type CapturingFetch = typeof globalThis.fetch;
6
52
  /** OpenAI exposes several request shapes; we mirror the one the model implies. */
@@ -24,7 +70,7 @@ export declare const resolveModel: (model: LanguageModel | EmbeddingModel | Imag
24
70
  * the capturing `fetch`) so tests can drive the failure paths without
25
71
  * uninstalling a package. Exported for testing; not part of the public API.
26
72
  */
27
- export declare const loadProvider: <T>(provider: BatchProvider, load?: (target: BatchProvider) => Promise<unknown>) => Promise<T>;
73
+ export declare const loadProvider: <P extends BatchProvider>(provider: P, load?: ProviderLoader) => Promise<ProviderModules[P]>;
28
74
  /**
29
75
  * Construct an AI SDK model wired to a capturing `fetch`, used to derive the
30
76
  * provider request body for each batch item without making a network call.
@@ -105,4 +151,5 @@ export declare const unsupportedImageProvider: (provider: BatchProvider) => Unsu
105
151
  * a network call. Throws for providers without batch image support.
106
152
  */
107
153
  export declare const createCaptureImageModel: (resolved: ResolvedModel, credentials: ProviderCredentials, fetchImpl: CapturingFetch) => Promise<ImageModel>;
154
+ export {};
108
155
  //# sourceMappingURL=model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,aAAa,EACb,kBAAkB,EACnB,MAAM,IAAI,CAAC;AAEZ,OAAO,EAA0B,wBAAwB,E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AqB,oBAGhC,CAAC;AAEH,eAAO,MAAM,8BAA8B,aAC/B,aAAa,KACtB,wBAIA,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,oBAG/B,CAAC;AAEH,eAAO,MAAM,6BAA6B,aAC9B,aAAa,KACtB,wBAIA,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,oBAIlC,CAAC;AAEH,eAAO,MAAM,gCAAgC,aACjC,aAAa,KACtB,wBAIA,CAAC;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,oBAI1B,CAAC;AAEH,eAAO,MAAM,wBAAwB,aACzB,aAAa,KACtB,wBAIA,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,aACxB,aAAa,eACV,mBAAmB,aACrB,cAAc,KACxB,OAAO,CAAC,UAAU,CAyBpB,CAAC"}
@@ -29,7 +29,7 @@ export interface BatchRoutesOptions {
29
29
  /** When set, mounts an OpenAI native-webhook handler on `POST`. */
30
30
  openaiSigningSecret?: string;
31
31
  /** Observe per-batch processing errors during a tick; the tick continues. */
32
- onError?: (record: TrackedBatch, error: unknown) => void;
32
+ onError?: (record: TrackedBatch, cause: unknown) => void;
33
33
  }
34
34
  export interface BatchRoutes {
35
35
  /** Cron-triggered poll tick. Wire to Vercel Cron (or any scheduler). */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/next/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,kBAAkB,EAClB,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,YAAY,EACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAiB,WAAW,EAAuB,MAAM,UAAU,CAAC;AAEhF,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,Y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IAC5E,KAAK,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;CACvD;AAQD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,iBAAiB,YAAa,kBAAkB,KAAG,WAgD/D,CAAC"}
@@ -1,33 +1,27 @@
1
+ import"../chunk-7y95mhvm.js";
1
2
  import {
2
- getBatchResults
3
- } from "../chunk-14qcscwd.js";
3
+ getBatchResults2
4
+ } from "../chunk-zss8h417.js";
4
5
  import {
5
- createBatchPoller,
6
- createMemoryStore,
7
- toEvent
8
- } from "../chunk-mathjpg6.js";
9
- import"../chunk-n50t31ca.js";
10
- import"../chunk-v0bahtg2.js";
6
+ toEvent,
7
+ resolveProviderCredentials,
8
+ createBatchPoller2,
9
+ createMemoryStore2
10
+ } from "../chunk-k7n7k3et.js";
11
11
 
12
12
  // src/next/index.ts
13
13
  async function* emptyResults() {}
14
14
  var createBatchRoutes = (options) => {
15
- const resolveCredentials = (provider) => {
16
- if (typeof options.credentials === "function") {
17
- return options.credentials(provider);
18
- }
19
- return options.credentials ?? {};
20
- };
21
15
  const sink = async (record, snapshot) => {
22
16
  const event = toEvent(record.provider, snapshot);
23
- const results = event.type === "batch.completed" ? getBatchResults({
17
+ const results = event.type === "batch.completed" ? getBatchResults2({
24
18
  id: record.id,
25
19
  provider: record.provider,
26
- ...resolveCredentials(record.provider)
20
+ ...resolveProviderCredentials(options.credentials, record.provider)
27
21
  }) : emptyResults();
28
22
  await options.onComplete(event, results);
29
23
  };
30
- const poller = createBatchPoller({
24
+ const poller = createBatchPoller2({
31
25
  credentials: options.credentials,
32
26
  onComplete: sink,
33
27
  onError: (record, error) => options.onError?.(record, error),
@@ -52,9 +46,9 @@ var createBatchRoutes = (options) => {
52
46
  return routes;
53
47
  };
54
48
  export {
55
- createMemoryStore,
56
- createBatchRoutes
49
+ createBatchRoutes,
50
+ createMemoryStore2 as createMemoryStore
57
51
  };
58
52
 
59
- //# debugId=50B909DB46860B1964756E2164756E21
53
+ //# debugId=4D275CE9C121083364756E2164756E21
60
54
  //# sourceMappingURL=index.js.map
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/next/index.ts"],
4
4
  "sourcesContent": [
5
- "import { getBatchResults } from \"../batch\";\nimport { toEvent } from \"../server/events\";\nimport { createBatchPoller } from \"../server/poller\";\nimport type {\n CompletionSink,\n CredentialResolver,\n TrackTarget,\n} from \"../server/poller\";\nimport type {\n BatchStore,\n BatchWebhookEvent,\n TrackedBatch,\n} from \"../server/types\";\nimport type { BatchProvider, BatchResult, ProviderCredentials } from \"../types\";\n\nexport type { TrackTarget } from \"../server/poller\";\nexport { createMemoryStore } from \"../server/store\";\nexport type {\n BatchStore,\n BatchWebhookEvent,\n TrackedBatch,\n} from \"../server/types\";\nexport type { BatchResult } from \"../types\";\n\n/**\n * Invoked once per batch when it reaches a terminal status. Persist the results\n * to your database here. `results` streams the parsed result lines for a\n * completed batch and is empty for failure events (`batch.failed` /\n * `batch.expired` / `batch.cancelled`) — inspect `event.type`.\n *\n * May fire more than once for the same batch (a cron tick racing the OpenAI\n * native webhook, or a retry after a partial save), so make persistence\n * idempotent — upsert keyed by `(provider, batchId, customId)`.\n */\nexport type OnBatchComplete = (\n event: BatchWebhookEvent,\n results: AsyncIterable<BatchResult>\n) => void | Promise<void>;\n\nexport interface BatchRoutesOptions {\n store: BatchStore;\n /** Called when each batch finishes; persist results here. */\n onComplete: OnBatchComplete;\n /** Falls back to provider env vars (e.g. `OPENAI_API_KEY`) when omitted. */\n credentials?: CredentialResolver;\n /** Requires `Authorization: Bearer <cronSecret>` on the cron `GET`. */\n cronSecret?: string;\n /** Allow unauthenticated cron ticks. Intended only for private/local routes. */\n allowUnauthenticatedCron?: boolean;\n /** When set, mounts an OpenAI native-webhook handler on `POST`. */\n openaiSigningSecret?: string;\n /** Observe per-batch processing errors during a tick; the tick continues. */\n onError?: (record: TrackedBatch, error: unknown) => void;\n}\n\nexport interface BatchRoutes {\n /** Cron-triggered poll tick. Wire to Vercel Cron (or any scheduler). */\n GET: (request: Request) => Promise<Response>;\n /** OpenAI native-webhook handler. Present only with `openaiSigningSecret`. */\n POST?: (request: Request) => Promise<Response>;\n /** Register a submitted batch so the cron polls it (a `BatchJob` works). */\n track: (target: TrackTarget) => Promise<TrackedBatch>;\n}\n\n/** An already-exhausted result stream, for non-completed events. */\n// oxlint-disable-next-line func-style, require-yield -- generators cannot be arrow functions; this one is intentionally empty.\nasync function* emptyResults(): AsyncGenerator<BatchResult> {\n // Failure events carry no results.\n}\n\n/**\n * Build Next.js App Router route handlers that poll your in-flight batches on a\n * cron tick and invoke `onComplete` directly when each finishes — persist\n * results to your DB without round-tripping an HTTP webhook back to your app.\n *\n * @example\n * import { createBatchRoutes, createMemoryStore } from \"batchwork/next\";\n *\n * export const { GET, POST } = createBatchRoutes({\n * store: createMemoryStore(),\n * cronSecret: process.env.CRON_SECRET,\n * openaiSigningSecret: process.env.OPENAI_WEBHOOK_SECRET,\n * onComplete: async (event, results) => {\n * for await (const r of results) {\n * await db.insert({ id: r.customId, status: r.status, text: r.text });\n * }\n * },\n * });\n */\nexport const createBatchRoutes = (options: BatchRoutesOptions): BatchRoutes => {\n const resolveCredentials = (provider: BatchProvider): ProviderCredentials => {\n if (typeof options.credentials === \"function\") {\n return options.credentials(provider);\n }\n return options.credentials ?? {};\n };\n\n const sink: CompletionSink = async (record, snapshot) => {\n const event = toEvent(record.provider, snapshot);\n // Only completed batches have results to fetch — the adapter throws when a\n // terminal batch has no output/error file (failed/expired/cancelled).\n const results =\n event.type === \"batch.completed\"\n ? getBatchResults({\n id: record.id,\n provider: record.provider,\n ...resolveCredentials(record.provider),\n })\n : emptyResults();\n await options.onComplete(event, results);\n };\n\n const poller = createBatchPoller({\n credentials: options.credentials,\n onComplete: sink,\n // Always supply an `onError` so one failing batch can't abort the whole\n // tick; forward to the caller's handler when they provided one.\n onError: (record, error) => options.onError?.(record, error),\n store: options.store,\n });\n\n const handleCronTick = async (request: Request): Promise<Response> => {\n if (!(options.cronSecret || options.allowUnauthenticatedCron)) {\n return new Response(\"unauthorized\", { status: 401 });\n }\n if (\n options.cronSecret &&\n request.headers.get(\"authorization\") !== `Bearer ${options.cronSecret}`\n ) {\n return new Response(\"unauthorized\", { status: 401 });\n }\n return Response.json(await poller.tick());\n };\n\n const track = (target: TrackTarget): Promise<TrackedBatch> =>\n poller.track(target, {});\n\n const routes: BatchRoutes = { GET: handleCronTick, track };\n if (options.openaiSigningSecret) {\n routes.POST = poller.openaiWebhookHandler({\n signingSecret: options.openaiSigningSecret,\n });\n }\n return routes;\n};\n"
5
+ "import { getBatchResults } from \"../batch\";\nimport { toEvent } from \"../server/events\";\nimport {\n createBatchPoller,\n resolveProviderCredentials,\n} from \"../server/poller\";\nimport type {\n CompletionSink,\n CredentialResolver,\n TrackTarget,\n} from \"../server/poller\";\nimport type {\n BatchStore,\n BatchWebhookEvent,\n TrackedBatch,\n} from \"../server/types\";\nimport type { BatchResult } from \"../types\";\n\nexport type { TrackTarget } from \"../server/poller\";\nexport { createMemoryStore } from \"../server/store\";\nexport type {\n BatchStore,\n BatchWebhookEvent,\n TrackedBatch,\n} from \"../server/types\";\nexport type { BatchResult } from \"../types\";\n\n/**\n * Invoked once per batch when it reaches a terminal status. Persist the results\n * to your database here. `results` streams the parsed result lines for a\n * completed batch and is empty for failure events (`batch.failed` /\n * `batch.expired` / `batch.cancelled`) — inspect `event.type`.\n *\n * May fire more than once for the same batch (a cron tick racing the OpenAI\n * native webhook, or a retry after a partial save), so make persistence\n * idempotent — upsert keyed by `(provider, batchId, customId)`.\n */\nexport type OnBatchComplete = (\n event: BatchWebhookEvent,\n results: AsyncIterable<BatchResult>\n) => void | Promise<void>;\n\nexport interface BatchRoutesOptions {\n store: BatchStore;\n /** Called when each batch finishes; persist results here. */\n onComplete: OnBatchComplete;\n /** Falls back to provider env vars (e.g. `OPENAI_API_KEY`) when omitted. */\n credentials?: CredentialResolver;\n /** Requires `Authorization: Bearer <cronSecret>` on the cron `GET`. */\n cronSecret?: string;\n /** Allow unauthenticated cron ticks. Intended only for private/local routes. */\n allowUnauthenticatedCron?: boolean;\n /** When set, mounts an OpenAI native-webhook handler on `POST`. */\n openaiSigningSecret?: string;\n /** Observe per-batch processing errors during a tick; the tick continues. */\n onError?: (record: TrackedBatch, cause: unknown) => void;\n}\n\nexport interface BatchRoutes {\n /** Cron-triggered poll tick. Wire to Vercel Cron (or any scheduler). */\n GET: (request: Request) => Promise<Response>;\n /** OpenAI native-webhook handler. Present only with `openaiSigningSecret`. */\n POST?: (request: Request) => Promise<Response>;\n /** Register a submitted batch so the cron polls it (a `BatchJob` works). */\n track: (target: TrackTarget) => Promise<TrackedBatch>;\n}\n\n/** An already-exhausted result stream, for non-completed events. */\n// oxlint-disable-next-line func-style, require-yield -- generators cannot be arrow functions; this one is intentionally empty.\nasync function* emptyResults(): AsyncGenerator<BatchResult> {\n // Failure events carry no results.\n}\n\n/**\n * Build Next.js App Router route handlers that poll your in-flight batches on a\n * cron tick and invoke `onComplete` directly when each finishes — persist\n * results to your DB without round-tripping an HTTP webhook back to your app.\n *\n * @example\n * import { createBatchRoutes, createMemoryStore } from \"batchwork/next\";\n *\n * export const { GET, POST } = createBatchRoutes({\n * store: createMemoryStore(),\n * cronSecret: process.env.CRON_SECRET,\n * openaiSigningSecret: process.env.OPENAI_WEBHOOK_SECRET,\n * onComplete: async (event, results) => {\n * for await (const r of results) {\n * await db.insert({ id: r.customId, status: r.status, text: r.text });\n * }\n * },\n * });\n */\nexport const createBatchRoutes = (options: BatchRoutesOptions): BatchRoutes => {\n const sink: CompletionSink = async (record, snapshot) => {\n const event = toEvent(record.provider, snapshot);\n // Only completed batches have results to fetch — the adapter throws when a\n // terminal batch has no output/error file (failed/expired/cancelled).\n const results =\n event.type === \"batch.completed\"\n ? getBatchResults({\n id: record.id,\n provider: record.provider,\n ...resolveProviderCredentials(options.credentials, record.provider),\n })\n : emptyResults();\n await options.onComplete(event, results);\n };\n\n const poller = createBatchPoller({\n credentials: options.credentials,\n onComplete: sink,\n // Always supply an `onError` so one failing batch can't abort the whole\n // tick; forward to the caller's handler when they provided one.\n onError: (record, error) => options.onError?.(record, error),\n store: options.store,\n });\n\n const handleCronTick = async (request: Request): Promise<Response> => {\n if (!(options.cronSecret || options.allowUnauthenticatedCron)) {\n return new Response(\"unauthorized\", { status: 401 });\n }\n if (\n options.cronSecret &&\n request.headers.get(\"authorization\") !== `Bearer ${options.cronSecret}`\n ) {\n return new Response(\"unauthorized\", { status: 401 });\n }\n return Response.json(await poller.tick());\n };\n\n const track = (target: TrackTarget): Promise<TrackedBatch> =>\n poller.track(target, {});\n\n const routes: BatchRoutes = { GET: handleCronTick, track };\n if (options.openaiSigningSecret) {\n routes.POST = poller.openaiWebhookHandler({\n signingSecret: options.openaiSigningSecret,\n });\n }\n return routes;\n};\n"
6
6
  ],
7
- "mappings": ";;;;;;;;;;;;AAkEA,gBAAgB,YAAY,GAAgC;AAuBrD,IAAM,oBAAoB,CAAC,YAA6C;AAAA,EAC7E,MAAM,qBAAqB,CAAC,aAAiD;AAAA,IAC3E,IAAI,OAAO,QAAQ,gBAAgB,YAAY;AAAA,MAC7C,OAAO,QAAQ,YAAY,QAAQ;AAAA,IACrC;AAAA,IACA,OAAO,QAAQ,eAAe,CAAC;AAAA;AAAA,EAGjC,MAAM,OAAuB,OAAO,QAAQ,aAAa;AAAA,IACvD,MAAM,QAAQ,QAAQ,OAAO,UAAU,QAAQ;AAAA,IAG/C,MAAM,UACJ,MAAM,SAAS,oBACX,gBAAgB;AAAA,MACd,IAAI,OAAO;AAAA,MACX,UAAU,OAAO;AAAA,SACd,mBAAmB,OAAO,QAAQ;AAAA,IACvC,CAAC,IACD,aAAa;AAAA,IACnB,MAAM,QAAQ,WAAW,OAAO,OAAO;AAAA;AAAA,EAGzC,MAAM,SAAS,kBAAkB;AAAA,IAC/B,aAAa,QAAQ;AAAA,IACrB,YAAY;AAAA,IAGZ,SAAS,CAAC,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CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,YACrB,yBAAyB,KACjC,UAkDF,CAAC"}
1
+ {"version":3,"file":"batch-store.d.ts","sourceRoot":"","sources":["../../src/postgres/batch-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAgB,MAAM,iBAAiB,CAAC;AAGhE,OAAO,KAAK,EAAE,oBAAoB,EAAe,MAAM,SAAS,CAAC;AAEjE,+CAA+C;AAC/C,MAAM,WAAW,yBAA0B,SAAQ,oBAAoB;IACrE,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAmCD,uFAAuF;AACvF,eAAO,MAAM,aAAa,sBAAkC,MAc3D,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,YACrB,yBAAyB,KACjC,UAkDF,CAAC"}