From 0927cf9de256e4a25fe5e2197008cb0510ea2415 Mon Sep 17 00:00:00 2001 From: Kevin van Zonneveld Date: Tue, 16 Dec 2025 14:45:15 +0100 Subject: [PATCH 1/2] w --- package.json | 1 + yarn.lock | 1 + 2 files changed, 2 insertions(+) diff --git a/package.json b/package.json index ab2fe22..06a51a9 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "badge-maker": "^5.0.2", "execa": "9.6.0", "image-size": "^2.0.2", + "minimatch": "^10.1.1", "nock": "^14.0.10", "npm-run-all": "^4.1.5", "p-retry": "^7.0.0", diff --git a/yarn.lock b/yarn.lock index 608edba..a6f5971 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5389,6 +5389,7 @@ __metadata: image-size: "npm:^2.0.2" into-stream: "npm:^9.0.0" is-stream: "npm:^4.0.1" + minimatch: "npm:^10.1.1" nock: "npm:^14.0.10" node-watch: "npm:^0.7.4" npm-run-all: "npm:^4.1.5" From 731ffb6dcc6888d0b158ecb7205b54ada1204a17 Mon Sep 17 00:00:00 2001 From: Kevin van Zonneveld Date: Tue, 16 Dec 2025 16:14:59 +0100 Subject: [PATCH 2/2] w --- .cursor/rules/coding-style.mdc | 3 + package.json | 4 +- src/alphalib/mcache.ts | 8 +- src/alphalib/types/robots/_index.ts | 15 +- .../types/robots/_instructions-primitives.ts | 36 ++- src/alphalib/types/robots/ai-chat.ts | 276 ++++++++++++++++ src/alphalib/types/robots/audio-waveform.ts | 151 ++++++++- src/alphalib/types/robots/image-bgremove.ts | 6 + src/alphalib/types/robots/image-generate.ts | 9 +- src/alphalib/types/templateCredential.ts | 1 + yarn.lock | 303 +++++++++++++++++- 11 files changed, 762 insertions(+), 50 deletions(-) create mode 100644 src/alphalib/types/robots/ai-chat.ts diff --git a/.cursor/rules/coding-style.mdc b/.cursor/rules/coding-style.mdc index 5fc81a2..a8cea4c 100644 --- a/.cursor/rules/coding-style.mdc +++ b/.cursor/rules/coding-style.mdc @@ -30,3 +30,6 @@ Coding style: - Alphabetize imports, group by source type (built-in/external/internal) - Favor US English over UK English, so `summarizeError` over `summarise Error` - Favor `.replaceAll('a', 'b)` over `.replace(/a/g, 'b')` or `.replace(new RegExp('a', 'g'), 'b')` when the only need for regeses was replacing all strings. That's usually both easier to read and more performant. +- Use typographic characters: ellipsis (`…`) instead of `...`, curly quotes (`'` `"`) instead of straight quotes in user-facing text +- Put API keys and secrets in `.env` files, not hardcoded in components +- Check for existing hooks before creating new ones (e.g., `useUppy()` for Uppy functionality) diff --git a/package.json b/package.json index 06a51a9..847562e 100644 --- a/package.json +++ b/package.json @@ -50,8 +50,8 @@ "p-retry": "^7.0.0", "rimraf": "^6.1.2", "temp": "^0.9.4", - "tsx": "4.20.5", - "typescript": "5.9.2", + "tsx": "4.21.0", + "typescript": "5.9.3", "vitest": "^3.2.4" }, "repository": { diff --git a/src/alphalib/mcache.ts b/src/alphalib/mcache.ts index 0bd0c45..852a7df 100644 --- a/src/alphalib/mcache.ts +++ b/src/alphalib/mcache.ts @@ -1,7 +1,7 @@ import type { SevLogger } from '@transloadit/sev-logger' import type { Schema } from 'zod' -export interface McacheOpts { +export interface McacheOpts { ttlMs?: number zodSchema?: Schema logger?: SevLogger @@ -37,10 +37,10 @@ interface CacheEntry { */ export class Mcache { #cache: Map> - #opts: Required, 'logger' | 'zodSchema' | 'keyFn'>> & - Pick, 'logger' | 'zodSchema' | 'keyFn'> + #opts: Required> & + Pick - constructor(opts: McacheOpts = {}) { + constructor(opts: McacheOpts = {}) { this.#cache = new Map() this.#opts = { ttlMs: opts.ttlMs ?? Number.POSITIVE_INFINITY, diff --git a/src/alphalib/types/robots/_index.ts b/src/alphalib/types/robots/_index.ts index 11b3ed4..7cc47a2 100644 --- a/src/alphalib/types/robots/_index.ts +++ b/src/alphalib/types/robots/_index.ts @@ -1,5 +1,9 @@ import { z } from 'zod' - +import { + meta as aiChatMeta, + interpolatableRobotAiChatInstructionsSchema, + interpolatableRobotAiChatInstructionsWithHiddenFieldsSchema, +} from './ai-chat.ts' import { meta as audioArtworkMeta, interpolatableRobotAudioArtworkInstructionsSchema, @@ -474,6 +478,7 @@ const robotStepsInstructions = [ interpolatableRobotSwiftStoreInstructionsSchema, interpolatableRobotTextSpeakInstructionsSchema, interpolatableRobotTextTranslateInstructionsSchema, + interpolatableRobotAiChatInstructionsSchema, interpolatableRobotTigrisImportInstructionsSchema, interpolatableRobotTigrisStoreInstructionsSchema, interpolatableRobotTlcdnDeliverInstructionsSchema, @@ -558,6 +563,7 @@ const robotStepsInstructionsWithHiddenFields = [ interpolatableRobotSwiftStoreInstructionsWithHiddenFieldsSchema, interpolatableRobotTextSpeakInstructionsWithHiddenFieldsSchema, interpolatableRobotTextTranslateInstructionsWithHiddenFieldsSchema, + interpolatableRobotAiChatInstructionsWithHiddenFieldsSchema, interpolatableRobotTigrisImportInstructionsWithHiddenFieldsSchema, interpolatableRobotTigrisStoreInstructionsWithHiddenFieldsSchema, interpolatableRobotTlcdnDeliverInstructionsWithHiddenFieldsSchema, @@ -605,6 +611,7 @@ export type RobotsWithHiddenBots = z.infer export type RobotsWithHiddenBotsAndFields = z.infer export const robotsMeta = { + aiChatMeta, audioArtworkMeta, audioConcatMeta, audioEncodeMeta, @@ -687,6 +694,12 @@ export const robotsMeta = { youtubeStoreMeta, } +export type { + InterpolatableRobotAiChatInstructions, + InterpolatableRobotAiChatInstructionsInput, + InterpolatableRobotAiChatInstructionsWithHiddenFields, + InterpolatableRobotAiChatInstructionsWithHiddenFieldsInput, +} from './ai-chat.ts' export type { InterpolatableRobotAssemblySavejsonInstructions, InterpolatableRobotAssemblySavejsonInstructionsInput, diff --git a/src/alphalib/types/robots/_instructions-primitives.ts b/src/alphalib/types/robots/_instructions-primitives.ts index 166738e..5005819 100644 --- a/src/alphalib/types/robots/_instructions-primitives.ts +++ b/src/alphalib/types/robots/_instructions-primitives.ts @@ -4,6 +4,7 @@ import { z } from 'zod' import { stackVersions } from '../stackVersions.ts' export const robotNames = z.enum([ + 'AiChatRobot', 'UploadHandleRobot', 'FileServeRobot', 'FileWatermarkRobot', @@ -395,21 +396,18 @@ export function interpolateRecursive( */ const uninterpolatableKeys = ['robot', 'use'] as const -type InterpolatableRobot> = Schema extends z.ZodObject< - infer T, - infer UnknownKeys, - infer Catchall -> - ? z.ZodObject< - { - [Key in keyof T]: Key extends (typeof uninterpolatableKeys)[number] - ? T[Key] - : InterpolatableSchema - }, - UnknownKeys, - Catchall - > - : never +type InterpolatableRobot> = + Schema extends z.ZodObject + ? z.ZodObject< + { + [Key in keyof T]: Key extends (typeof uninterpolatableKeys)[number] + ? T[Key] + : InterpolatableSchema + }, + UnknownKeys, + Catchall + > + : never export function interpolateRobot>( schema: Schema, @@ -1762,3 +1760,11 @@ Delta to apply to segment duration. This is optional and allows fine-tuning of s `), }) .strict() + +/** + * Type for the normalized use parameter from AssemblyNormalizer + * The steps array can contain either strings or objects with name property + */ +export interface NormalizedUse { + steps: Array<{ name: string; as?: string; fields?: string }> +} diff --git a/src/alphalib/types/robots/ai-chat.ts b/src/alphalib/types/robots/ai-chat.ts new file mode 100644 index 0000000..523f524 --- /dev/null +++ b/src/alphalib/types/robots/ai-chat.ts @@ -0,0 +1,276 @@ +import { z } from 'zod' +import type { RobotMetaInput } from './_instructions-primitives.ts' +import { interpolateRobot, robotBase, robotUse } from './_instructions-primitives.ts' + +// We duplicate coreMessageSchema (and its related types) from structuredAiVercel.ts here +// so that we do not need to distribute structuredAiVercel.ts to for instance +// the node-sdk, which does rely on this ai-chat file to determine +// support Robot parameters. + +// Define JSONValue schema for proper type matching with AI SDK +const jsonValueSchema: z.ZodType = z.lazy(() => + z.union([ + z.string(), + z.number(), + z.boolean(), + z.null(), + z.array(jsonValueSchema), + z.record(jsonValueSchema), + ]), +) + +// Define provider metadata schema to match the AI SDK v5 +const providerMetadataSchema = z.record(z.record(jsonValueSchema)).optional() + +const textPartSchema = z.object({ + type: z.literal('text'), + text: z.string(), + experimental_providerMetadata: providerMetadataSchema, +}) +const imagePartSchema = z.object({ + type: z.literal('image'), + image: z.union([ + z.string(), + z.instanceof(Uint8Array), + z.instanceof(ArrayBuffer), + z.instanceof(Buffer), + z.instanceof(URL), + ]), + mimeType: z.string().optional(), + experimental_providerMetadata: providerMetadataSchema, +}) +const filePartSchema = z.object({ + type: z.literal('file'), + data: z.union([ + z.string(), + z.instanceof(Uint8Array), + z.instanceof(ArrayBuffer), + z.instanceof(Buffer), + z.instanceof(URL), + ]), + mediaType: z.string(), + experimental_providerMetadata: providerMetadataSchema, +}) +const toolCallPartSchema = z.object({ + type: z.literal('tool-call'), + toolCallId: z.string(), + toolName: z.string(), + args: z.record(jsonValueSchema), + experimental_providerMetadata: providerMetadataSchema, +}) +const toolResultPartSchema = z.object({ + type: z.literal('tool-result'), + toolCallId: z.string(), + toolName: z.string(), + result: z.unknown(), + experimental_content: z + .array( + z.union([ + z.object({ + type: z.literal('text'), + text: z.string(), + }), + z.object({ + type: z.literal('image'), + data: z.string(), + mimeType: z.string().optional(), + }), + ]), + ) + .optional(), + isError: z.boolean().optional(), + experimental_providerMetadata: providerMetadataSchema, +}) +const coreSystemMessageSchema = z.object({ + role: z.literal('system'), + content: z.string(), + experimental_providerMetadata: providerMetadataSchema, +}) +const coreUserMessageSchema = z.object({ + role: z.literal('user'), + content: z.union([ + z.string(), + z.array(z.union([textPartSchema, imagePartSchema, filePartSchema])), + ]), + experimental_providerMetadata: providerMetadataSchema, +}) +const coreAssistantMessageSchema = z.object({ + role: z.literal('assistant'), + content: z.union([z.string(), z.array(z.union([textPartSchema, toolCallPartSchema]))]), + experimental_providerMetadata: providerMetadataSchema, +}) +const coreToolMessageSchema = z.object({ + role: z.literal('tool'), + content: z.array(toolResultPartSchema), + experimental_providerMetadata: providerMetadataSchema, +}) +const coreMessageSchema = z.discriminatedUnion('role', [ + coreSystemMessageSchema, + coreUserMessageSchema, + coreAssistantMessageSchema, + coreToolMessageSchema, +]) + +export const meta: RobotMetaInput = { + name: 'AiChatRobot', + allowed_for_url_transform: true, + bytescount: 1, + discount_factor: 1, + discount_pct: 0, + minimum_charge: 0, + output_factor: 0.6, + purpose_sentence: 'generates AI chat responses from prompts', + purpose_verb: 'generate', + purpose_word: 'generate', + purpose_words: 'Generate AI chat responses', + service_slug: 'artificial-intelligence', + slot_count: 10, + title: 'Generate AI chat responses', + typical_file_size_mb: 0.01, + typical_file_type: 'document', + priceFactor: 1, + queueSlotCount: 10, + // Is this a sensbile minimum charge? What if the customer supplies their own keys? Is it low enough for these cases? + minimumChargeUsd: 0.06, + isAllowedForUrlTransform: true, + trackOutputFileSize: true, + isInternal: false, + removeJobResultFilesFromDiskRightAfterStoringOnS3: false, + stage: 'ga', +} + +export const vendorModelSchema = z + .string() + .regex(/^[a-z]+\/[a-z0-9.-]+$/, 'Must be in format "vendor/model"') + .refine( + (val) => { + const [vendor, model] = val.split('/') + if (vendor === 'anthropic') { + return model === 'claude-4-sonnet-20250514' || model === 'claude-4-opus-20250514' + } + if (vendor === 'openai') { + return ( + model === 'gpt-4.1-2025-04-14' || + model === 'chatgpt-4o-latest' || + model === 'o3-2025-04-16' || + model === 'gpt-4o-audio-preview' + ) + } + if (vendor === 'google') { + return model === 'gemini-2.5-pro' + } + if (vendor === 'moonshot') { + return model === 'kimi-k2' + } + return false + }, + { + message: + 'Invalid vendor/model combination. Supported: anthropic/claude-4-sonnet-20250514, anthropic/claude-4-opus-20250514, openai/gpt-4.1-2025-04-14, openai/chatgpt-4o-latest, openai/o3-2025-04-16, openai/gpt-4o-audio-preview, google/gemini-2.5-pro, moonshot/kimi-k2', + }, + ) + +export type VendorModel = z.infer + +/** + * Model capabilities for /ai/chat. This centralizes which models support which input types. + * Key format: 'vendor/model' + */ +export const MODEL_CAPABILITIES: Record = { + 'anthropic/claude-4-sonnet-20250514': { pdf: true, image: true }, + 'anthropic/claude-4-opus-20250514': { pdf: true, image: true }, + 'google/gemini-2.5-pro': { pdf: true, image: true }, + 'openai/gpt-4.1-2025-04-14': { pdf: false, image: true }, + 'openai/chatgpt-4o-latest': { pdf: false, image: true }, + 'openai/o3-2025-04-16': { pdf: false, image: true }, + 'openai/gpt-4o-audio-preview': { pdf: false, image: false }, + 'moonshot/kimi-k2': { pdf: false, image: false }, +} + +export const robotAiChatInstructionsSchema = robotBase + .merge(robotUse) + .extend({ + robot: z.literal('/ai/chat'), + // TODO: Is the auto mode yet implemented? + model: z + .union([vendorModelSchema, z.literal('auto')]) + .default('auto') + .describe( + 'The model to use. Transloadit can pick the best model for the job if you set this to "auto".', + ), + format: z.enum(['json', 'text', 'meta']).default('json'), + return_messages: z.enum(['all', 'last']).default('last'), + schema: z.string().optional().describe('The JSON Schema that the LLM should output'), + messages: z + .union([z.string(), z.array(coreMessageSchema)]) + .describe('The prompt, or message history to send to the LLM.'), + system_message: z + .string() + .optional() + .describe('Set the system/developer prompt, if the model allows it'), + credentials: z + .union([z.string(), z.array(z.string())]) + .optional() + .describe('Names of template credentials to make available to the robot.'), + mcp_servers: z + .array( + z.object({ + type: z.enum(['sse', 'http']), + url: z.string(), + headers: z.record(z.string()).optional(), + }), + ) + .optional() + .describe('The MCP servers to use. This is used to call tools from the LLM.'), + }) + .strict() + +export const robotAiChatInstructionsWithHiddenFieldsSchema = robotAiChatInstructionsSchema.extend({ + result: z.union([z.literal('debug'), robotAiChatInstructionsSchema.shape.result]), + provider: z + .string() + .optional() + .describe( + 'Where to run the model. By the default, it is the vendor. For instance, anthropic:claude* runs on the Anthropic API. But, Claude could also be run on AWS Bedrock. This is a hidden placeholder for now, but will be used in the future to allow for more flexibility in where to run models. ', + ), + // These are listed here because we don't have these properties in the public documentation. + // They should set these keys using template credentials. + openai_api_key: z.string().optional().describe('The API key to use for the OpenAI API.'), + anthropic_api_key: z.string().optional().describe('The API key to use for the Anthropic API.'), + deepseek_api_key: z.string().optional().describe('The API key to use for the DeepSeek API.'), + google_generative_ai_api_key: z + .string() + .optional() + .describe('The API key to use for the Google Generative AI API.'), + xai_api_key: z.string().optional().describe('The API key to use for the xAI API.'), +}) + +export type RobotAiChatInstructions = z.infer + +export type RobotAiChatInstructionsWithHiddenFields = z.infer< + typeof robotAiChatInstructionsWithHiddenFieldsSchema +> + +export type RobotAiChatInstructionsWithHiddenFieldsInput = z.input< + typeof robotAiChatInstructionsWithHiddenFieldsSchema +> + +export const interpolatableRobotAiChatInstructionsSchema = interpolateRobot( + robotAiChatInstructionsSchema, +) +export type InterpolatableRobotAiChatInstructions = z.infer< + typeof interpolatableRobotAiChatInstructionsSchema +> +export type InterpolatableRobotAiChatInstructionsInput = z.input< + typeof interpolatableRobotAiChatInstructionsSchema +> + +export const interpolatableRobotAiChatInstructionsWithHiddenFieldsSchema = interpolateRobot( + robotAiChatInstructionsWithHiddenFieldsSchema, +) +export type InterpolatableRobotAiChatInstructionsWithHiddenFields = z.infer< + typeof interpolatableRobotAiChatInstructionsWithHiddenFieldsSchema +> +export type InterpolatableRobotAiChatInstructionsWithHiddenFieldsInput = z.input< + typeof interpolatableRobotAiChatInstructionsWithHiddenFieldsSchema +> diff --git a/src/alphalib/types/robots/audio-waveform.ts b/src/alphalib/types/robots/audio-waveform.ts index 2fe5e37..a48c879 100644 --- a/src/alphalib/types/robots/audio-waveform.ts +++ b/src/alphalib/types/robots/audio-waveform.ts @@ -59,7 +59,8 @@ Here is an example waveform image: stage: 'ga', } -export const robotAudioWaveformInstructionsSchema = robotBase +// Base schema with common fields +const robotAudioWaveformInstructionsBaseSchema = robotBase .merge(robotUse) .merge(robotFFmpeg) .extend({ @@ -89,12 +90,6 @@ The width of the resulting image if the format \`"image"\` was selected. .default(64) .describe(` The height of the resulting image if the format \`"image"\` was selected. -`), - style: z - .union([z.literal(0), z.literal(1)]) - .default(0) - .describe(` -Either a value of \`0\` or \`1\`, corresponding to using either the legacy waveform tool, or the new tool respectively, with the new tool offering an improved style. Other Robot parameters still function as described, with either tool. `), antialiasing: z .union([z.literal(0), z.literal(1), z.boolean()]) @@ -110,6 +105,142 @@ The color used in the center of the gradient. The format is "rrggbbaa" (red, gre `), outer_color: color_with_alpha.default('000000ff').describe(` The color used in the outer parts of the gradient. The format is "rrggbbaa" (red, green, blue, alpha). +`), + }) + +const styleSchema = z.preprocess( + (val) => { + // Backwards compatibility: historically this robot used numeric styles 0/1/2. + // The new API is `style: "v0" | "v1"`. Old v2 values are mapped to v1. + if (val === 'v1' || val === 1 || val === '1') return 'v1' + if (val === 'v0' || val === 0 || val === '0') return 'v0' + return val + }, + z.enum(['v0', 'v1']).default('v0'), +) + +// Unified schema: all parameters exist for both styles, but v1-only parameters only apply when +// `style` is `v1` (they are accepted for v0 but have no effect). +export const robotAudioWaveformInstructionsSchema = robotAudioWaveformInstructionsBaseSchema + .extend({ + style: styleSchema.describe(` +Waveform style version. + +- \`"v0"\`: Legacy waveform generation (default). +- \`"v1"\`: Advanced waveform generation with additional parameters. + +For backwards compatibility, numeric values \`0\`, \`1\`, \`2\` are also accepted and mapped to \`"v0"\` (0) and \`"v1"\` (1/2). +`), + + // v1-only parameters (accepted for v0 but have no effect) + split_channels: z + .boolean() + .optional() + .describe(` +Available when style is \`"v1"\`. If set to \`true\`, outputs multi-channel waveform data or image files, one per channel. +`), + zoom: z + .number() + .int() + .min(1) + .optional() + .describe(` +Available when style is \`"v1"\`. Zoom level in samples per pixel. This parameter cannot be used together with \`pixels_per_second\`. +`), + pixels_per_second: z + .number() + .positive() + .optional() + .describe(` +Available when style is \`"v1"\`. Zoom level in pixels per second. This parameter cannot be used together with \`zoom\`. +`), + bits: z + .union([z.literal(8), z.literal(16)]) + .optional() + .describe(` +Available when style is \`"v1"\`. Bit depth for waveform data. Can be 8 or 16. +`), + start: z + .number() + .min(0) + .optional() + .describe(` +Available when style is \`"v1"\`. Start time in seconds. +`), + end: z + .number() + .min(0) + .optional() + .describe(` +Available when style is \`"v1"\`. End time in seconds (0 means end of audio). +`), + colors: z + .enum(['audition', 'audacity']) + .optional() + .describe(` +Available when style is \`"v1"\`. Color scheme to use. Can be "audition" or "audacity". +`), + border_color: color_with_alpha.optional().describe(` +Available when style is \`"v1"\`. Border color in "rrggbbaa" format. +`), + waveform_style: z + .enum(['normal', 'bars']) + .optional() + .describe(` +Available when style is \`"v1"\`. Waveform style. Can be "normal" or "bars". +`), + bar_width: z + .number() + .int() + .positive() + .optional() + .describe(` +Available when style is \`"v1"\`. Width of bars in pixels when waveform_style is "bars". +`), + bar_gap: z + .number() + .int() + .min(0) + .optional() + .describe(` +Available when style is \`"v1"\`. Gap between bars in pixels when waveform_style is "bars". +`), + bar_style: z + .enum(['square', 'rounded']) + .optional() + .describe(` +Available when style is \`"v1"\`. Bar style when waveform_style is "bars". +`), + axis_label_color: color_with_alpha.optional().describe(` +Available when style is \`"v1"\`. Color for axis labels in "rrggbbaa" format. +`), + no_axis_labels: z + .boolean() + .optional() + .describe(` +Available when style is \`"v1"\`. If set to \`true\`, renders waveform image without axis labels. +`), + with_axis_labels: z + .boolean() + .optional() + .describe(` +Available when style is \`"v1"\`. If set to \`true\`, renders waveform image with axis labels. +`), + amplitude_scale: z + .number() + .positive() + .optional() + .describe(` +Available when style is \`"v1"\`. Amplitude scale factor. +`), + compression: z + .number() + .int() + .min(-1) + .max(9) + .optional() + .describe(` +Available when style is \`"v1"\`. PNG compression level: 0 (none) to 9 (best), or -1 (default). Only applicable when format is "image". `), }) .strict() @@ -129,9 +260,10 @@ export type RobotAudioWaveformInstructionsWithHiddenFields = z.infer< export const interpolatableRobotAudioWaveformInstructionsSchema = interpolateRobot( robotAudioWaveformInstructionsSchema, ) -export type InterpolatableRobotAudioWaveformInstructions = - InterpolatableRobotAudioWaveformInstructionsInput +export type InterpolatableRobotAudioWaveformInstructions = z.input< + typeof interpolatableRobotAudioWaveformInstructionsSchema +> export type InterpolatableRobotAudioWaveformInstructionsInput = z.input< typeof interpolatableRobotAudioWaveformInstructionsSchema > @@ -139,6 +271,7 @@ export type InterpolatableRobotAudioWaveformInstructionsInput = z.input< export const interpolatableRobotAudioWaveformInstructionsWithHiddenFieldsSchema = interpolateRobot( robotAudioWaveformInstructionsWithHiddenFieldsSchema, ) + export type InterpolatableRobotAudioWaveformInstructionsWithHiddenFields = z.infer< typeof interpolatableRobotAudioWaveformInstructionsWithHiddenFieldsSchema > diff --git a/src/alphalib/types/robots/image-bgremove.ts b/src/alphalib/types/robots/image-bgremove.ts index 522fd1a..178a052 100644 --- a/src/alphalib/types/robots/image-bgremove.ts +++ b/src/alphalib/types/robots/image-bgremove.ts @@ -53,6 +53,12 @@ export const robotImageBgremoveInstructionsSchema = robotBase .enum(['transloadit', 'replicate', 'fal']) .optional() .describe('Provider to use for removing the background.'), + model: z + .string() + .optional() + .describe( + 'Provider-specific model to use for removing the background. Mostly intended for testing and evaluation.', + ), }) .strict() diff --git a/src/alphalib/types/robots/image-generate.ts b/src/alphalib/types/robots/image-generate.ts index 7aea1b3..2b12009 100644 --- a/src/alphalib/types/robots/image-generate.ts +++ b/src/alphalib/types/robots/image-generate.ts @@ -34,10 +34,13 @@ export const robotImageGenerateInstructionsSchema = robotBase .merge(robotUse) .extend({ robot: z.literal('/image/generate'), - model: z.string(), + model: z + .string() + .optional() + .describe('The AI model to use for image generation. Defaults to google/nano-banana.'), prompt: z.string().describe('The prompt describing the desired image content.'), format: z - .enum(['jpeg', 'png', 'gif', 'webp', 'svg']) + .enum(['jpeg', 'jpg', 'png', 'gif', 'webp', 'svg']) .optional() .describe('Format of the generated image.'), seed: z.number().optional().describe('Seed for the random number generator.'), @@ -69,7 +72,7 @@ export type RobotImageGenerateInstructionsWithHiddenFields = z.infer< > export const interpolatableRobotImageGenerateInstructionsSchema = interpolateRobot( - robotImageGenerateInstructionsSchema, + robotImageGenerateInstructionsWithHiddenFieldsSchema, ) export type InterpolatableRobotImageGenerateInstructions = InterpolatableRobotImageGenerateInstructionsInput diff --git a/src/alphalib/types/templateCredential.ts b/src/alphalib/types/templateCredential.ts index 1294743..b43a7f8 100644 --- a/src/alphalib/types/templateCredential.ts +++ b/src/alphalib/types/templateCredential.ts @@ -20,6 +20,7 @@ export const templateCredentialsSchema = z ), type: z .enum([ + 'ai', 'azure', 'backblaze', 'cloudflare', diff --git a/yarn.lock b/yarn.lock index a6f5971..b400b8b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -837,6 +837,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/aix-ppc64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/aix-ppc64@npm:0.27.1" + conditions: os=aix & cpu=ppc64 + languageName: node + linkType: hard + "@esbuild/android-arm64@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/android-arm64@npm:0.25.6" @@ -844,6 +851,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-arm64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/android-arm64@npm:0.27.1" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/android-arm@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/android-arm@npm:0.25.6" @@ -851,6 +865,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-arm@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/android-arm@npm:0.27.1" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + "@esbuild/android-x64@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/android-x64@npm:0.25.6" @@ -858,6 +879,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-x64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/android-x64@npm:0.27.1" + conditions: os=android & cpu=x64 + languageName: node + linkType: hard + "@esbuild/darwin-arm64@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/darwin-arm64@npm:0.25.6" @@ -865,6 +893,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/darwin-arm64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/darwin-arm64@npm:0.27.1" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/darwin-x64@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/darwin-x64@npm:0.25.6" @@ -872,6 +907,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/darwin-x64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/darwin-x64@npm:0.27.1" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + "@esbuild/freebsd-arm64@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/freebsd-arm64@npm:0.25.6" @@ -879,6 +921,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/freebsd-arm64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/freebsd-arm64@npm:0.27.1" + conditions: os=freebsd & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/freebsd-x64@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/freebsd-x64@npm:0.25.6" @@ -886,6 +935,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/freebsd-x64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/freebsd-x64@npm:0.27.1" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/linux-arm64@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/linux-arm64@npm:0.25.6" @@ -893,6 +949,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-arm64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/linux-arm64@npm:0.27.1" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/linux-arm@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/linux-arm@npm:0.25.6" @@ -900,6 +963,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-arm@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/linux-arm@npm:0.27.1" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + "@esbuild/linux-ia32@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/linux-ia32@npm:0.25.6" @@ -907,6 +977,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-ia32@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/linux-ia32@npm:0.27.1" + conditions: os=linux & cpu=ia32 + languageName: node + linkType: hard + "@esbuild/linux-loong64@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/linux-loong64@npm:0.25.6" @@ -914,6 +991,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-loong64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/linux-loong64@npm:0.27.1" + conditions: os=linux & cpu=loong64 + languageName: node + linkType: hard + "@esbuild/linux-mips64el@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/linux-mips64el@npm:0.25.6" @@ -921,6 +1005,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-mips64el@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/linux-mips64el@npm:0.27.1" + conditions: os=linux & cpu=mips64el + languageName: node + linkType: hard + "@esbuild/linux-ppc64@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/linux-ppc64@npm:0.25.6" @@ -928,6 +1019,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-ppc64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/linux-ppc64@npm:0.27.1" + conditions: os=linux & cpu=ppc64 + languageName: node + linkType: hard + "@esbuild/linux-riscv64@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/linux-riscv64@npm:0.25.6" @@ -935,6 +1033,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-riscv64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/linux-riscv64@npm:0.27.1" + conditions: os=linux & cpu=riscv64 + languageName: node + linkType: hard + "@esbuild/linux-s390x@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/linux-s390x@npm:0.25.6" @@ -942,6 +1047,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-s390x@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/linux-s390x@npm:0.27.1" + conditions: os=linux & cpu=s390x + languageName: node + linkType: hard + "@esbuild/linux-x64@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/linux-x64@npm:0.25.6" @@ -949,6 +1061,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-x64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/linux-x64@npm:0.27.1" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + "@esbuild/netbsd-arm64@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/netbsd-arm64@npm:0.25.6" @@ -956,6 +1075,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/netbsd-arm64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/netbsd-arm64@npm:0.27.1" + conditions: os=netbsd & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/netbsd-x64@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/netbsd-x64@npm:0.25.6" @@ -963,6 +1089,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/netbsd-x64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/netbsd-x64@npm:0.27.1" + conditions: os=netbsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/openbsd-arm64@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/openbsd-arm64@npm:0.25.6" @@ -970,6 +1103,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/openbsd-arm64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/openbsd-arm64@npm:0.27.1" + conditions: os=openbsd & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/openbsd-x64@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/openbsd-x64@npm:0.25.6" @@ -977,6 +1117,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/openbsd-x64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/openbsd-x64@npm:0.27.1" + conditions: os=openbsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/openharmony-arm64@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/openharmony-arm64@npm:0.25.6" @@ -984,6 +1131,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/openharmony-arm64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/openharmony-arm64@npm:0.27.1" + conditions: os=openharmony & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/sunos-x64@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/sunos-x64@npm:0.25.6" @@ -991,6 +1145,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/sunos-x64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/sunos-x64@npm:0.27.1" + conditions: os=sunos & cpu=x64 + languageName: node + linkType: hard + "@esbuild/win32-arm64@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/win32-arm64@npm:0.25.6" @@ -998,6 +1159,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-arm64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/win32-arm64@npm:0.27.1" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/win32-ia32@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/win32-ia32@npm:0.25.6" @@ -1005,6 +1173,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-ia32@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/win32-ia32@npm:0.27.1" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + "@esbuild/win32-x64@npm:0.25.6": version: 0.25.6 resolution: "@esbuild/win32-x64@npm:0.25.6" @@ -1012,6 +1187,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-x64@npm:0.27.1": + version: 0.27.1 + resolution: "@esbuild/win32-x64@npm:0.27.1" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@isaacs/balanced-match@npm:^4.0.1": version: 4.0.1 resolution: "@isaacs/balanced-match@npm:4.0.1" @@ -2862,7 +3044,7 @@ __metadata: languageName: node linkType: hard -"esbuild@npm:^0.25.0, esbuild@npm:~0.25.0": +"esbuild@npm:^0.25.0": version: 0.25.6 resolution: "esbuild@npm:0.25.6" dependencies: @@ -2951,6 +3133,95 @@ __metadata: languageName: node linkType: hard +"esbuild@npm:~0.27.0": + version: 0.27.1 + resolution: "esbuild@npm:0.27.1" + dependencies: + "@esbuild/aix-ppc64": "npm:0.27.1" + "@esbuild/android-arm": "npm:0.27.1" + "@esbuild/android-arm64": "npm:0.27.1" + "@esbuild/android-x64": "npm:0.27.1" + "@esbuild/darwin-arm64": "npm:0.27.1" + "@esbuild/darwin-x64": "npm:0.27.1" + "@esbuild/freebsd-arm64": "npm:0.27.1" + "@esbuild/freebsd-x64": "npm:0.27.1" + "@esbuild/linux-arm": "npm:0.27.1" + "@esbuild/linux-arm64": "npm:0.27.1" + "@esbuild/linux-ia32": "npm:0.27.1" + "@esbuild/linux-loong64": "npm:0.27.1" + "@esbuild/linux-mips64el": "npm:0.27.1" + "@esbuild/linux-ppc64": "npm:0.27.1" + "@esbuild/linux-riscv64": "npm:0.27.1" + "@esbuild/linux-s390x": "npm:0.27.1" + "@esbuild/linux-x64": "npm:0.27.1" + "@esbuild/netbsd-arm64": "npm:0.27.1" + "@esbuild/netbsd-x64": "npm:0.27.1" + "@esbuild/openbsd-arm64": "npm:0.27.1" + "@esbuild/openbsd-x64": "npm:0.27.1" + "@esbuild/openharmony-arm64": "npm:0.27.1" + "@esbuild/sunos-x64": "npm:0.27.1" + "@esbuild/win32-arm64": "npm:0.27.1" + "@esbuild/win32-ia32": "npm:0.27.1" + "@esbuild/win32-x64": "npm:0.27.1" + dependenciesMeta: + "@esbuild/aix-ppc64": + optional: true + "@esbuild/android-arm": + optional: true + "@esbuild/android-arm64": + optional: true + "@esbuild/android-x64": + optional: true + "@esbuild/darwin-arm64": + optional: true + "@esbuild/darwin-x64": + optional: true + "@esbuild/freebsd-arm64": + optional: true + "@esbuild/freebsd-x64": + optional: true + "@esbuild/linux-arm": + optional: true + "@esbuild/linux-arm64": + optional: true + "@esbuild/linux-ia32": + optional: true + "@esbuild/linux-loong64": + optional: true + "@esbuild/linux-mips64el": + optional: true + "@esbuild/linux-ppc64": + optional: true + "@esbuild/linux-riscv64": + optional: true + "@esbuild/linux-s390x": + optional: true + "@esbuild/linux-x64": + optional: true + "@esbuild/netbsd-arm64": + optional: true + "@esbuild/netbsd-x64": + optional: true + "@esbuild/openbsd-arm64": + optional: true + "@esbuild/openbsd-x64": + optional: true + "@esbuild/openharmony-arm64": + optional: true + "@esbuild/sunos-x64": + optional: true + "@esbuild/win32-arm64": + optional: true + "@esbuild/win32-ia32": + optional: true + "@esbuild/win32-x64": + optional: true + bin: + esbuild: bin/esbuild + checksum: 10c0/8bfcf13a499a9e7b7da4b68273e12b453c7d7a5e39c944c2e5a4c64a0594d6df1391fc168a5353c22bc94eeae38dd9897199ddbbc4973525b0aae18186e996bd + languageName: node + linkType: hard + "escape-string-regexp@npm:^1.0.5": version: 1.0.5 resolution: "escape-string-regexp@npm:1.0.5" @@ -5399,10 +5670,10 @@ __metadata: recursive-readdir: "npm:^2.2.3" rimraf: "npm:^6.1.2" temp: "npm:^0.9.4" - tsx: "npm:4.20.5" + tsx: "npm:4.21.0" tus-js-client: "npm:^4.3.1" type-fest: "npm:^4.41.0" - typescript: "npm:5.9.2" + typescript: "npm:5.9.3" vitest: "npm:^3.2.4" zod: "npm:3.25.76" bin: @@ -5417,11 +5688,11 @@ __metadata: languageName: node linkType: hard -"tsx@npm:4.20.5": - version: 4.20.5 - resolution: "tsx@npm:4.20.5" +"tsx@npm:4.21.0": + version: 4.21.0 + resolution: "tsx@npm:4.21.0" dependencies: - esbuild: "npm:~0.25.0" + esbuild: "npm:~0.27.0" fsevents: "npm:~2.3.3" get-tsconfig: "npm:^4.7.5" dependenciesMeta: @@ -5429,7 +5700,7 @@ __metadata: optional: true bin: tsx: dist/cli.mjs - checksum: 10c0/70f9bf746be69281312a369c712902dbf9bcbdd9db9184a4859eb4859c36ef0c5a6d79b935c1ec429158ee73fd6584089400ae8790345dae34c5b0222bdb94f3 + checksum: 10c0/f5072923cd8459a1f9a26df87823a2ab5754641739d69df2a20b415f61814322b751fa6be85db7c6ec73cf68ba8fac2fd1cfc76bdb0aa86ded984d84d5d2126b languageName: node linkType: hard @@ -5515,23 +5786,23 @@ __metadata: languageName: node linkType: hard -"typescript@npm:5.9.2": - version: 5.9.2 - resolution: "typescript@npm:5.9.2" +"typescript@npm:5.9.3": + version: 5.9.3 + resolution: "typescript@npm:5.9.3" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10c0/cd635d50f02d6cf98ed42de2f76289701c1ec587a363369255f01ed15aaf22be0813226bff3c53e99d971f9b540e0b3cc7583dbe05faded49b1b0bed2f638a18 + checksum: 10c0/6bd7552ce39f97e711db5aa048f6f9995b53f1c52f7d8667c1abdc1700c68a76a308f579cd309ce6b53646deb4e9a1be7c813a93baaf0a28ccd536a30270e1c5 languageName: node linkType: hard -"typescript@patch:typescript@npm%3A5.9.2#optional!builtin": - version: 5.9.2 - resolution: "typescript@patch:typescript@npm%3A5.9.2#optional!builtin::version=5.9.2&hash=5786d5" +"typescript@patch:typescript@npm%3A5.9.3#optional!builtin": + version: 5.9.3 + resolution: "typescript@patch:typescript@npm%3A5.9.3#optional!builtin::version=5.9.3&hash=5786d5" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10c0/34d2a8e23eb8e0d1875072064d5e1d9c102e0bdce56a10a25c0b917b8aa9001a9cf5c225df12497e99da107dc379360bc138163c66b55b95f5b105b50578067e + checksum: 10c0/ad09fdf7a756814dce65bc60c1657b40d44451346858eea230e10f2e95a289d9183b6e32e5c11e95acc0ccc214b4f36289dcad4bf1886b0adb84d711d336a430 languageName: node linkType: hard