@neta-art/generation 0.1.7 → 0.1.8

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.
@@ -1,7 +1,3 @@
1
- //#region src/types.ts
2
- const MODEL_SCHEMA = "neta.generation.model.v1";
3
-
4
- //#endregion
5
1
  //#region src/utils.ts
6
2
  function cloneJson(value) {
7
3
  return JSON.parse(JSON.stringify(value));
@@ -19,7 +15,9 @@ function compactObject(value) {
19
15
  for (const key of Object.keys(value)) if (value[key] === void 0) delete value[key];
20
16
  return value;
21
17
  }
22
-
18
+ //#endregion
19
+ //#region src/types.ts
20
+ const MODEL_SCHEMA = "neta.generation.model.v1";
23
21
  //#endregion
24
22
  //#region src/builtins.ts
25
23
  const imageSizeParameters = {
@@ -1180,7 +1178,7 @@ function getBuiltinGenerationModel(model) {
1180
1178
  function listBuiltinGenerationModels() {
1181
1179
  return cloneJson(builtinModels);
1182
1180
  }
1183
-
1184
1181
  //#endregion
1185
- export { compactArray as a, slugifyFileName as c, cloneJson as i, MODEL_SCHEMA as l, getBuiltinGenerationModel as n, compactObject as o, listBuiltinGenerationModels as r, getBlockMeta as s, builtinGenerationModels as t };
1186
- //# sourceMappingURL=builtins-NAtI9FFU.js.map
1182
+ export { cloneJson as a, getBlockMeta as c, MODEL_SCHEMA as i, slugifyFileName as l, getBuiltinGenerationModel as n, compactArray as o, listBuiltinGenerationModels as r, compactObject as s, builtinGenerationModels as t };
1183
+
1184
+ //# sourceMappingURL=builtins--2dnc9UT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtins--2dnc9UT.js","names":[],"sources":["../src/utils.ts","../src/types.ts","../src/builtins.ts"],"sourcesContent":["import type { GenerationContentBlock } from \"./types.js\";\n\nexport function cloneJson<T>(value: T): T {\n return JSON.parse(JSON.stringify(value)) as T;\n}\n\nexport function slugifyFileName(value: string): string {\n return (\n value\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9._-]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\") || \"model\"\n );\n}\n\nexport function getBlockMeta(block: GenerationContentBlock): Record<string, unknown> | undefined {\n return \"meta\" in block ? block.meta : undefined;\n}\n\nexport function compactArray<T>(values: T[]): T[] | undefined {\n return values.length > 0 ? values : undefined;\n}\n\nexport function compactObject<T extends Record<string, unknown>>(value: T): T {\n for (const key of Object.keys(value)) if (value[key] === undefined) delete value[key];\n return value;\n}\n","export const MODEL_SCHEMA = \"neta.generation.model.v1\" as const;\n\nexport type GenerationSource = { type: \"url\"; url: string } | { type: \"base64\"; mediaType: string; data: string };\n\nexport type GenerationContentBlockMeta = Record<string, unknown>;\n\nexport type GenerationContentBlock =\n | { type: \"text\"; text: string; meta?: GenerationContentBlockMeta }\n | { type: \"image\"; source: GenerationSource; meta?: GenerationContentBlockMeta }\n | { type: \"video\"; source: GenerationSource; meta?: GenerationContentBlockMeta }\n | { type: \"audio\"; source: GenerationSource; meta?: GenerationContentBlockMeta };\n\nexport type GenerationContentSpec = {\n type: \"text\" | \"image\" | \"video\" | \"audio\";\n required?: boolean;\n min?: number;\n max?: number;\n sources?: Array<GenerationSource[\"type\"]>;\n merge?: \"newline\" | \"space\" | \"concat\";\n meta?: Record<string, unknown>;\n description?: string;\n};\n\nexport type GenerationParameterSpec =\n | {\n type: \"string\";\n optional?: boolean;\n default?: string;\n enum?: string[];\n description?: string;\n examples?: string[];\n }\n | {\n type: \"number\";\n optional?: boolean;\n default?: number;\n min?: number;\n max?: number;\n description?: string;\n examples?: number[];\n }\n | {\n type: \"integer\";\n optional?: boolean;\n default?: number;\n min?: number;\n max?: number;\n description?: string;\n examples?: number[];\n }\n | {\n type: \"boolean\";\n optional?: boolean;\n default?: boolean;\n description?: string;\n examples?: boolean[];\n };\n\nexport type GenerationMetaFieldSpec =\n | GenerationParameterSpec\n | { type: \"object\"; optional?: boolean; description?: string };\n\nexport type GenerationMetaTaskVariantSpec = {\n description?: string;\n required?: string[];\n requiredContent?: Array<GenerationContentSpec[\"type\"]>;\n sendTask?: boolean;\n};\n\nexport type GenerationMetaSpec = {\n fields?: Record<string, GenerationMetaFieldSpec>;\n taskField?: string;\n taskVariants?: Record<string, GenerationMetaTaskVariantSpec>;\n};\n\nexport type GenerationModelDeclaration = {\n schema: typeof MODEL_SCHEMA;\n model: string;\n title?: string;\n description?: string;\n allowUnknownParameters?: boolean;\n adapter: {\n type: string;\n } & Record<string, unknown>;\n content: {\n input: GenerationContentSpec[];\n };\n parameters?: Record<string, GenerationParameterSpec>;\n meta?: GenerationMetaSpec;\n examples?: Array<{\n title?: string;\n request: GenerateRequest;\n }>;\n};\n\nexport type GenerateRequest = {\n model: string;\n content: GenerationContentBlock[];\n parameters?: Record<string, unknown>;\n meta?: Record<string, unknown>;\n /** @deprecated Use meta. */\n metadata?: Record<string, unknown>;\n apiKey?: string;\n baseUrl?: string;\n};\n\nexport type ResolvedGenerationRequest = {\n declaration: GenerationModelDeclaration;\n request: GenerateRequest;\n parameters: Record<string, unknown>;\n meta: Record<string, unknown>;\n};\n\nexport type GenerationSourceResolver = (source: GenerationSource) => Promise<string> | string;\n\nexport type GenerationDebugEvent =\n | {\n type: \"request\";\n url: string;\n method: string;\n headers: Record<string, string>;\n body?: unknown;\n }\n | {\n type: \"response\";\n url: string;\n status: number;\n statusText: string;\n headers: Record<string, string>;\n trace: Record<string, string>;\n elapsedMs: number;\n body?: unknown;\n };\n\nexport type GenerationDebugLogger = (event: GenerationDebugEvent) => void;\n\nexport type GenerationDebugOptions = {\n enabled?: boolean;\n includeSensitive?: boolean;\n includeResponseBody?: boolean;\n logger?: GenerationDebugLogger;\n};\n\nexport type GenerationDebugConfig = GenerationDebugOptions & {\n enabled: boolean;\n includeSensitive: boolean;\n includeResponseBody: boolean;\n logger: GenerationDebugLogger;\n};\n\nexport type GenerationAdapterContext = {\n apiKey: string;\n baseUrl: string;\n fetch: typeof fetch;\n resolveSource: GenerationSourceResolver;\n};\n\nexport type GenerationAdapterInput = ResolvedGenerationRequest & {\n context: GenerationAdapterContext;\n};\n\nexport type GenerationAdapter = (input: GenerationAdapterInput) => Promise<GenerationContentBlock[]>;\n\nexport type CreateGenerationClientOptions = {\n apiKey?: string;\n baseUrl?: string;\n models?: GenerationModelDeclaration[];\n includeBuiltinModels?: boolean;\n fetch?: typeof fetch;\n sourceResolver?: GenerationSourceResolver;\n adapters?: Record<string, GenerationAdapter>;\n debug?: boolean | GenerationDebugOptions;\n};\n\nexport type GenerationClient = {\n generate(request: GenerateRequest): Promise<GenerationContentBlock[]>;\n validate(request: GenerateRequest): ResolvedGenerationRequest;\n listModels(): GenerationModelDeclaration[];\n getModel(model: string): GenerationModelDeclaration | null;\n stringifyModelConfig(model: string, options?: { format?: \"yaml\" | \"json\" }): string;\n exportModelConfig(model: string, filePath: string): Promise<void>;\n exportModelConfigs(directory: string): Promise<void>;\n};\n","import type { GenerationModelDeclaration } from \"./types.js\";\nimport { MODEL_SCHEMA } from \"./types.js\";\nimport { cloneJson } from \"./utils.js\";\n\nconst imageSizeParameters = {\n size: {\n type: \"string\",\n optional: true,\n default: \"1024x1024\",\n description: \"Output image size.\",\n examples: [\"auto\", \"1024x1024\", \"1536x1024\", \"1024x1536\", \"2048x2048\", \"2048x1152\", \"3840x2160\", \"2160x3840\"],\n },\n quality: {\n type: \"string\",\n optional: true,\n default: \"auto\",\n enum: [\"auto\", \"low\", \"medium\", \"high\"],\n description: \"Image quality.\",\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nconst zImageTurboParameters = {\n size: {\n type: \"string\",\n optional: true,\n default: \"1024*1024\",\n enum: [\"1024*1024\", \"1536*1024\", \"1024*1536\", \"2048*2048\"],\n description: \"Output image size.\",\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nconst qwenImageEditParameters = {\n size: {\n type: \"string\",\n optional: true,\n default: \"1024x1024\",\n description: \"Output image size.\",\n examples: [\"1024x1024\", \"768x1024\", \"1024x768\"],\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nconst noobxlImageParameters = {\n size: {\n type: \"string\",\n optional: true,\n default: \"1024x1024\",\n description: \"Output image size as WIDTHxHEIGHT.\",\n examples: [\"1024x1024\", \"768x1024\", \"1024x768\"],\n },\n negative_prompt: {\n type: \"string\",\n optional: true,\n description: \"Content to avoid in generated images.\",\n },\n seed: {\n type: \"integer\",\n optional: true,\n min: 0,\n description: \"Random seed for reproducibility.\",\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nconst noobxlImageToImageParameters = {\n ...noobxlImageParameters,\n controlnet_weight: {\n type: \"number\",\n optional: true,\n min: 0,\n max: 2,\n description: \"ControlNet tile weight. The provider default is 0.8.\",\n },\n ipadapter_face_image_ref: {\n type: \"string\",\n optional: true,\n description: \"Optional face reference image URL for IP-Adapter.\",\n },\n ipadapter_face_weight: {\n type: \"number\",\n optional: true,\n min: 0,\n max: 2,\n description: \"IP-Adapter face weight. The provider default is 0.6 when a face reference is supplied.\",\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nfunction videoParameters(defaults: { resolution: string; maxWait: number }) {\n return {\n duration: {\n type: \"integer\",\n optional: true,\n default: 5,\n min: 4,\n max: 15,\n description: \"Video duration in seconds.\",\n },\n resolution: {\n type: \"string\",\n optional: true,\n default: defaults.resolution,\n enum: [\"480p\", \"720p\", \"1080p\", \"2K\"],\n description: \"Output video resolution.\",\n },\n aspect_ratio: {\n type: \"string\",\n optional: true,\n default: \"16:9\",\n enum: [\"16:9\", \"9:16\", \"1:1\", \"4:3\", \"3:2\", \"2:3\", \"3:4\", \"21:9\", \"adaptive\"],\n description: \"Output aspect ratio. Use adaptive to let the model choose.\",\n },\n fps: { type: \"integer\", optional: true, default: 30, min: 1, max: 60, description: \"Frames per second.\" },\n seed: { type: \"integer\", optional: true, description: \"Random seed for reproducibility.\" },\n generate_audio: { type: \"boolean\", optional: true, default: true, description: \"Generate synchronized audio.\" },\n return_last_frame: {\n type: \"boolean\",\n optional: true,\n default: true,\n description: \"Return the last frame as an image for chaining video segments.\",\n },\n camera_fixed: {\n type: \"boolean\",\n optional: true,\n default: false,\n description: \"Fix camera position when supported.\",\n },\n watermark: { type: \"boolean\", optional: true, default: false, description: \"Add AI Generated watermark.\" },\n poll_interval: {\n type: \"integer\",\n optional: true,\n default: 2,\n min: 1,\n max: 30,\n description: \"Seconds between task status checks.\",\n },\n max_wait: {\n type: \"integer\",\n optional: true,\n default: defaults.maxWait,\n min: 30,\n max: 1800,\n description: \"Maximum seconds to wait for task completion.\",\n },\n } satisfies GenerationModelDeclaration[\"parameters\"];\n}\n\nfunction klingVideoParameters(options: {\n maxDuration: number;\n negativePrompt?: boolean;\n seed?: boolean;\n sound?: boolean;\n}) {\n const parameters: GenerationModelDeclaration[\"parameters\"] = {\n duration: {\n type: \"integer\",\n optional: true,\n default: 5,\n min: 5,\n max: options.maxDuration,\n description: \"Video duration in seconds.\",\n },\n aspect_ratio: {\n type: \"string\",\n optional: true,\n default: \"16:9\",\n enum: [\"16:9\", \"9:16\", \"1:1\"],\n description: \"Output aspect ratio.\",\n },\n mode: {\n type: \"string\",\n optional: true,\n default: \"std\",\n enum: [\"std\", \"pro\"],\n description: \"Kling generation mode.\",\n },\n cfg_scale: {\n type: \"number\",\n optional: true,\n default: 0.5,\n min: 0,\n max: 1,\n description: \"Prompt adherence scale.\",\n },\n poll_interval: {\n type: \"integer\",\n optional: true,\n default: 5,\n min: 1,\n max: 30,\n description: \"Seconds between task status checks.\",\n },\n max_wait: {\n type: \"integer\",\n optional: true,\n default: 900,\n min: 30,\n max: 1800,\n description: \"Maximum seconds to wait for task completion.\",\n },\n };\n if (options.negativePrompt) {\n parameters.negative_prompt = {\n type: \"string\",\n optional: true,\n description: \"Negative prompt.\",\n };\n }\n if (options.seed) {\n parameters.seed = {\n type: \"integer\",\n optional: true,\n description: \"Random seed for reproducibility.\",\n };\n }\n if (options.sound) {\n parameters.sound = {\n type: \"string\",\n optional: true,\n enum: [\"on\", \"off\"],\n description: \"Enable or disable generated sound when supported.\",\n };\n }\n return parameters;\n}\n\nconst sunoTaskParameters = {\n poll_interval: {\n type: \"integer\",\n optional: true,\n default: 5,\n min: 1,\n max: 60,\n description: \"Seconds between task status checks.\",\n },\n max_wait: {\n type: \"integer\",\n optional: true,\n default: 600,\n min: 30,\n max: 3600,\n description: \"Maximum seconds to wait for task completion.\",\n },\n} satisfies GenerationModelDeclaration[\"parameters\"];\n\nconst sunoCommonMetaFields = {\n title: { type: \"string\", optional: true, description: \"Suno song title.\" },\n tags: { type: \"string\", optional: true, description: \"Comma-separated Suno music style tags.\" },\n gpt_description_prompt: { type: \"string\", optional: true, description: \"Suno inspiration-mode prompt.\" },\n negative_tags: { type: \"string\", optional: true, description: \"Styles to avoid.\" },\n generation_type: { type: \"string\", optional: true, description: \"Suno generation type.\" },\n make_instrumental: { type: \"boolean\", optional: true, default: false, description: \"Generate instrumental music.\" },\n metadata: { type: \"object\", optional: true, description: \"Suno provider metadata payload.\" },\n metadata_params: {\n type: \"object\",\n optional: true,\n description: \"Suno task-specific metadata payload.\",\n },\n} satisfies NonNullable<GenerationModelDeclaration[\"meta\"]>[\"fields\"];\n\nconst sunoTaskVariants = {\n extend: { required: [\"continue_clip_id\"] },\n upload_extend: { required: [\"continue_clip_id\"] },\n infill: { required: [\"continue_clip_id\", \"metadata_params\"] },\n fixed_infill: { required: [\"continue_clip_id\", \"metadata_params\"] },\n infill_intro: { required: [\"continue_clip_id\", \"metadata_params\"] },\n infill_outro: { required: [\"continue_clip_id\", \"metadata_params\"] },\n cover_infill: { required: [\"continue_clip_id\", \"metadata_params\"] },\n cover_extend: { required: [\"continue_clip_id\"] },\n artist_infill: { required: [\"continue_clip_id\", \"metadata_params\"] },\n artist_consistency: { required: [\"persona_id\", \"artist_clip_id\"] },\n cover: { required: [\"task_id\", \"continue_clip_id\"] },\n image_to_song: { requiredContent: [\"image\"], required: [\"metadata_params\"] },\n video_to_song: { requiredContent: [\"video\"], required: [\"metadata_params\"] },\n concat: { required: [\"clip_id\"] },\n sound: { required: [\"metadata_params\"] },\n underpainting: { required: [\"metadata_params\"] },\n overpainting: { required: [\"metadata_params\"] },\n remaster: { required: [\"metadata_params\"] },\n vox: { required: [\"artist_clip_id\"] },\n chop_sample_condition: { required: [\"metadata_params\"] },\n mashup_condition: { required: [\"metadata_params\"] },\n playlist_condition: { required: [\"metadata_params\"] },\n} satisfies NonNullable<GenerationModelDeclaration[\"meta\"]>[\"taskVariants\"];\n\nfunction sunoContentInput(\n options: { text?: \"required\" | \"optional\" | \"none\"; audio?: boolean; image?: boolean; video?: boolean } = {},\n): GenerationModelDeclaration[\"content\"][\"input\"] {\n const input: GenerationModelDeclaration[\"content\"][\"input\"] = [];\n if (options.text !== \"none\") {\n input.push({\n type: \"text\",\n required: options.text === \"required\",\n max: 16,\n merge: \"newline\",\n description:\n \"Prompt text. The adapter maps merged text to the operation's text field when that field is not provided.\",\n });\n }\n if (options.audio) {\n input.push({\n type: \"audio\",\n required: true,\n max: 1,\n sources: [\"url\", \"base64\"],\n description: \"Reference audio.\",\n });\n }\n if (options.image) {\n input.push({\n type: \"image\",\n required: true,\n max: 1,\n sources: [\"url\", \"base64\"],\n description: \"Reference image.\",\n });\n }\n if (options.video) {\n input.push({\n type: \"video\",\n required: true,\n max: 1,\n sources: [\"url\", \"base64\"],\n description: \"Reference video.\",\n });\n }\n return input;\n}\n\nconst sunoVersions = [\n { model: \"suno_music_chirp_fenix\", title: \"Suno Music Chirp Fenix v5.5\", mv: \"chirp-fenix\" },\n] as const;\n\nconst sunoMusicExample = {\n title: \"Music generation\",\n request: {\n model: \"suno_music_chirp_fenix\",\n content: [{ type: \"text\", text: \"uplifting cinematic pop with warm piano and clear chorus\" }],\n meta: {\n title: \"Warm Horizon\",\n tags: \"cinematic pop, warm piano\",\n make_instrumental: false,\n },\n },\n} satisfies NonNullable<GenerationModelDeclaration[\"examples\"]>[number];\n\nfunction sunoVersionModel(version: (typeof sunoVersions)[number]): GenerationModelDeclaration {\n return {\n schema: MODEL_SCHEMA,\n model: version.model,\n title: version.title,\n description: \"Suno text-to-music model with a fixed Suno model version.\",\n adapter: { type: \"suno.tasks\", operation: \"music\", payload: { mv: version.mv } },\n content: {\n input: sunoContentInput({ text: \"required\" }),\n },\n parameters: sunoTaskParameters,\n meta: {\n fields: sunoCommonMetaFields,\n },\n ...(version.model === \"suno_music_chirp_fenix\" ? { examples: [sunoMusicExample] } : {}),\n };\n}\n\nfunction sunoTaskModel(options: {\n model: string;\n title: string;\n description: string;\n task: string;\n mv?: string;\n content?: Parameters<typeof sunoContentInput>[0];\n fields?: NonNullable<GenerationModelDeclaration[\"meta\"]>[\"fields\"];\n examples?: GenerationModelDeclaration[\"examples\"];\n}): GenerationModelDeclaration {\n return {\n schema: MODEL_SCHEMA,\n model: options.model,\n title: options.title,\n description: options.description,\n adapter: {\n type: \"suno.tasks\",\n operation: \"music\",\n task: options.task,\n payload: { mv: options.mv ?? \"chirp-v5\" },\n },\n content: {\n input: sunoContentInput(options.content ?? { text: \"optional\" }),\n },\n parameters: sunoTaskParameters,\n meta: {\n fields: {\n ...sunoCommonMetaFields,\n ...options.fields,\n },\n taskVariants: sunoTaskVariants,\n },\n ...(options.examples ? { examples: options.examples } : {}),\n };\n}\n\nconst sunoModels = [\n ...sunoVersions.map(sunoVersionModel),\n {\n schema: MODEL_SCHEMA,\n model: \"suno_style_tags\",\n title: \"Suno Style Tags\",\n description: \"Suno style tag upsampling model.\",\n adapter: { type: \"suno.tasks\", operation: \"upsample_tags\" },\n content: {\n input: sunoContentInput({ text: \"required\" }),\n },\n },\n {\n schema: MODEL_SCHEMA,\n model: \"suno_upload_audio\",\n title: \"Suno Upload Audio\",\n description: \"Suno reference-audio upload model.\",\n adapter: { type: \"suno.tasks\", operation: \"upload_audio\", defaults: { name: \"reference-audio\", timeout: 120 } },\n content: {\n input: sunoContentInput({ text: \"none\", audio: true }),\n },\n parameters: sunoTaskParameters,\n meta: {\n fields: {\n name: { type: \"string\", optional: true, description: \"Upload name.\" },\n timeout: { type: \"integer\", optional: true, description: \"Upload timeout in seconds.\" },\n },\n },\n },\n sunoTaskModel({\n model: \"suno_image_to_song_chirp_v5\",\n title: \"Suno Image to Song Chirp v5.0\",\n description: \"Suno image-to-song task with a fixed chirp-v5 engine.\",\n task: \"image_to_song\",\n content: { text: \"optional\", image: true },\n fields: {\n metadata_params: { type: \"object\", description: \"Image-to-song metadata payload.\" },\n },\n }),\n sunoTaskModel({\n model: \"suno_video_to_song_chirp_v5\",\n title: \"Suno Video to Song Chirp v5.0\",\n description: \"Suno video-to-song task with a fixed chirp-v5 engine.\",\n task: \"video_to_song\",\n content: { text: \"optional\", video: true },\n fields: {\n metadata_params: { type: \"object\", description: \"Video-to-song metadata payload.\" },\n },\n }),\n sunoTaskModel({\n model: \"suno_sound_chirp_v5\",\n title: \"Suno Sound Chirp v5.0\",\n description: \"Suno sound-effect generation task with a fixed chirp-v5 engine.\",\n task: \"sound\",\n content: { text: \"optional\" },\n fields: {\n metadata_params: { type: \"object\", description: \"Sound task metadata payload.\" },\n },\n }),\n sunoTaskModel({\n model: \"suno_cover_chirp_v5\",\n title: \"Suno Cover Chirp v5.0\",\n description: \"Suno cover task with a fixed chirp-v5 engine.\",\n task: \"cover\",\n content: { text: \"optional\" },\n fields: {\n cover_clip_id: { type: \"string\", description: \"Clip id to cover.\" },\n task_id: { type: \"string\", description: \"Source Suno task id used for cover routing.\" },\n continue_clip_id: { type: \"string\", description: \"Source clip id used for cover generation.\" },\n continue_at: { type: \"number\", optional: true, description: \"Source clip continuation position in seconds.\" },\n },\n }),\n sunoTaskModel({\n model: \"suno_infill_chirp_v5\",\n title: \"Suno Infill Chirp v5.0\",\n description: \"Suno local edit task with a fixed chirp-v5 engine.\",\n task: \"infill\",\n content: { text: \"optional\" },\n fields: {\n continue_clip_id: { type: \"string\", description: \"Clip id to edit.\" },\n metadata_params: { type: \"object\", description: \"Infill timing and replacement metadata.\" },\n },\n }),\n sunoTaskModel({\n model: \"suno_vox_chirp_v5\",\n title: \"Suno Vox Chirp v5.0\",\n description: \"Suno hum-to-song task with a fixed chirp-v5 engine.\",\n task: \"vox\",\n content: { text: \"optional\" },\n fields: {\n artist_clip_id: { type: \"string\", description: \"Reference hum or vocal clip id.\" },\n },\n }),\n] satisfies GenerationModelDeclaration[];\n\nconst builtinModels = [\n {\n schema: MODEL_SCHEMA,\n model: \"gpt-image-2\",\n title: \"GPT Image 2\",\n description:\n \"Image generation model with optional reference images. Good for photorealistic scenes, detailed images, and image editing with references.\",\n adapter: { type: \"openai.images\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Prompt text.\" },\n {\n type: \"image\",\n required: false,\n max: 16,\n sources: [\"url\", \"base64\"],\n description: \"Optional reference images.\",\n },\n ],\n },\n parameters: imageSizeParameters,\n examples: [\n {\n title: \"Basic image\",\n request: {\n model: \"gpt-image-2\",\n content: [{ type: \"text\", text: \"a cyberpunk cat in neon rain\" }],\n parameters: { size: \"1024x1024\", quality: \"auto\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"z-image-turbo\",\n title: \"Z-Image Turbo\",\n description:\n \"Fast text-to-image generation through Neta Router. Z-Image Turbo accepts prompt text only; it does not support reference images.\",\n adapter: { type: \"openai.images\" },\n content: {\n input: [{ type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Prompt text.\" }],\n },\n parameters: zImageTurboParameters,\n examples: [\n {\n title: \"Text to image\",\n request: {\n model: \"z-image-turbo\",\n content: [\n { type: \"text\", text: \"a clean product-style image of a small red toy robot standing on a white desk\" },\n ],\n parameters: { size: \"1024*1024\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"qwen-image-edit\",\n title: \"Qwen Image Edit\",\n description: \"Neta Qwen image editing with one source image URL and an edit instruction.\",\n adapter: { type: \"openai.imageEdits\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Edit instruction.\" },\n {\n type: \"image\",\n required: true,\n min: 1,\n max: 1,\n sources: [\"url\"],\n description: \"Source image URL to edit.\",\n },\n ],\n },\n parameters: qwenImageEditParameters,\n examples: [\n {\n title: \"Edit image\",\n request: {\n model: \"qwen-image-edit\",\n content: [\n { type: \"text\", text: \"change the background to a clean white studio backdrop\" },\n { type: \"image\", source: { type: \"url\", url: \"https://example.com/input.png\" } },\n ],\n parameters: { size: \"1024x1024\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"gemini-3.1-flash-image-preview\",\n title: \"Gemini 3.1 Flash Image Preview\",\n description:\n \"Gemini image generation and editing model. Good for text rendering, infographics, style transfer, and iterative image editing with references.\",\n adapter: { type: \"gemini.generateContent\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Prompt text.\" },\n {\n type: \"image\",\n required: false,\n max: 14,\n sources: [\"url\", \"base64\"],\n description: \"Optional reference images.\",\n },\n ],\n },\n parameters: {\n aspect_ratio: {\n type: \"string\",\n optional: true,\n default: \"1:1\",\n enum: [\"1:1\", \"16:9\", \"4:3\", \"3:2\", \"3:4\", \"2:3\", \"9:16\", \"5:4\", \"4:5\", \"21:9\", \"1:4\", \"4:1\", \"1:8\", \"8:1\"],\n description: \"Output aspect ratio.\",\n },\n image_size: {\n type: \"string\",\n optional: true,\n default: \"2K\",\n enum: [\"512\", \"1K\", \"2K\", \"4K\"],\n description: \"Output image resolution.\",\n },\n },\n examples: [\n {\n title: \"Basic image\",\n request: {\n model: \"gemini-3.1-flash-image-preview\",\n content: [\n { type: \"text\", text: \"a vibrant infographic explaining photosynthesis with clear readable labels\" },\n ],\n parameters: { aspect_ratio: \"16:9\", image_size: \"1K\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"kling-text-to-video\",\n title: \"Kling Text To Video\",\n description: \"Kling latest text-to-video generation through Neta Router.\",\n adapter: { type: \"kling.videoGenerations\" },\n content: {\n input: [{ type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Video prompt.\" }],\n },\n parameters: klingVideoParameters({ maxDuration: 10, negativePrompt: true, seed: true }),\n examples: [\n {\n title: \"Text to video\",\n request: {\n model: \"kling-text-to-video\",\n content: [{ type: \"text\", text: \"a small paper boat floating on calm water, cinematic motion\" }],\n parameters: { duration: 5, aspect_ratio: \"16:9\", mode: \"std\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"kling-image-to-video\",\n title: \"Kling Image To Video\",\n description: \"Kling latest image-to-video generation through Neta Router.\",\n adapter: { type: \"kling.videoGenerations\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Video prompt.\" },\n {\n type: \"image\",\n required: false,\n max: 2,\n sources: [\"url\", \"base64\"],\n description:\n \"First frame and optional tail frame image input. Provider-native image input may be passed in meta.\",\n },\n ],\n },\n parameters: klingVideoParameters({ maxDuration: 10, negativePrompt: true, seed: true }),\n examples: [\n {\n title: \"Image to video\",\n request: {\n model: \"kling-image-to-video\",\n content: [\n { type: \"text\", text: \"gently turn toward the camera with soft natural motion\" },\n { type: \"image\", source: { type: \"url\", url: \"https://example.com/input.png\" } },\n ],\n parameters: { duration: 5, aspect_ratio: \"16:9\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"kling-omni-video\",\n title: \"Kling Omni Video\",\n description: \"Kling latest Omni-Video generation through Neta Router.\",\n adapter: { type: \"kling.videoGenerations\" },\n content: {\n input: [\n {\n type: \"text\",\n required: false,\n max: 16,\n merge: \"newline\",\n description: \"Optional video prompt. Use Kling Omni placeholders such as <<<image_1>>> with image_list.\",\n },\n {\n type: \"image\",\n required: false,\n max: 2,\n sources: [\"url\", \"base64\"],\n description: \"Optional simple image input. Provider-native Omni media arrays belong in request meta.\",\n },\n ],\n },\n parameters: klingVideoParameters({ maxDuration: 15, sound: true }),\n meta: {\n fields: {\n multi_shot: {\n type: \"boolean\",\n optional: true,\n description: \"Enable Kling Omni multi-shot mode.\",\n },\n shot_type: {\n type: \"string\",\n optional: true,\n description: \"Kling Omni shot type.\",\n },\n },\n },\n examples: [\n {\n title: \"Omni text to video\",\n request: {\n model: \"kling-omni-video\",\n content: [{ type: \"text\", text: \"a small paper boat floating on calm water, cinematic motion\" }],\n parameters: { duration: 5, aspect_ratio: \"16:9\", mode: \"std\" },\n },\n },\n {\n title: \"Omni image to video\",\n request: {\n model: \"kling-omni-video\",\n content: [{ type: \"text\", text: \"<<<image_1>>> gently turns toward the camera with soft natural motion\" }],\n parameters: { duration: 5, aspect_ratio: \"16:9\" },\n meta: {\n image_list: [{ image_url: \"https://example.com/input.png\", type: \"first_frame\" }],\n },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"kling-multi-image-to-video\",\n title: \"Kling Multi-Image Reference To Video\",\n description: \"Kling latest multi-image reference video generation through Neta Router.\",\n adapter: { type: \"kling.videoGenerations\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Video prompt.\" },\n {\n type: \"image\",\n required: false,\n max: 4,\n sources: [\"url\", \"base64\"],\n description: \"Reference image inputs. Provider-native image_list input may be passed in meta.\",\n },\n ],\n },\n parameters: klingVideoParameters({ maxDuration: 10, negativePrompt: true, seed: true }),\n examples: [\n {\n title: \"Multi-image reference to video\",\n request: {\n model: \"kling-multi-image-to-video\",\n content: [\n { type: \"text\", text: \"combine the references into one cinematic shot\" },\n { type: \"image\", source: { type: \"url\", url: \"https://example.com/reference-1.png\" } },\n { type: \"image\", source: { type: \"url\", url: \"https://example.com/reference-2.png\" } },\n ],\n parameters: { duration: 5, aspect_ratio: \"16:9\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"noobxl-t2i-onediff\",\n title: \"NoobXL T2I OneDiff\",\n description: \"NoobXL text-to-image model.\",\n allowUnknownParameters: true,\n adapter: { type: \"openai.images\" },\n content: {\n input: [{ type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Prompt text.\" }],\n },\n parameters: noobxlImageParameters,\n examples: [\n {\n title: \"Text to image\",\n request: {\n model: \"noobxl-t2i-onediff\",\n content: [{ type: \"text\", text: \"anime key visual, luminous city at night, crisp linework\" }],\n parameters: { size: \"1024x1024\", negative_prompt: \"low quality, blurry\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"noobxl-i2i-ipa-onediff\",\n title: \"NoobXL I2I IPA OneDiff\",\n description: \"NoobXL image-to-image model with optional face reference controls.\",\n allowUnknownParameters: true,\n adapter: { type: \"openai.images\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Prompt text.\" },\n {\n type: \"image\",\n required: true,\n min: 1,\n max: 1,\n sources: [\"url\", \"base64\"],\n description: \"Single source image.\",\n },\n ],\n },\n parameters: noobxlImageToImageParameters,\n examples: [\n {\n title: \"Image to image\",\n request: {\n model: \"noobxl-i2i-ipa-onediff\",\n content: [\n { type: \"text\", text: \"keep the character identity, redraw as a polished anime illustration\" },\n { type: \"image\", source: { type: \"url\", url: \"https://example.com/reference.png\" } },\n ],\n parameters: { size: \"1024x1024\", controlnet_weight: 0.8 },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"birefnet-general\",\n title: \"BiRefNet General\",\n description: \"BiRefNet single-image segmentation and background removal model.\",\n adapter: { type: \"openai.images\" },\n content: {\n input: [\n {\n type: \"image\",\n required: true,\n min: 1,\n max: 1,\n sources: [\"url\", \"base64\"],\n description: \"Single source image.\",\n },\n ],\n },\n examples: [\n {\n title: \"Remove background\",\n request: {\n model: \"birefnet-general\",\n content: [{ type: \"image\", source: { type: \"url\", url: \"https://example.com/portrait.png\" } }],\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"seedance-2-0\",\n title: \"Seedance 2.0\",\n description: \"Higher quality Ark video generation model for final production outputs.\",\n adapter: { type: \"ark.videoGenerations\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Video prompt.\" },\n {\n type: \"image\",\n required: false,\n max: 9,\n sources: [\"url\", \"base64\"],\n description: \"Optional image input. Use meta.role as first_frame, last_frame, or reference_image.\",\n },\n ],\n },\n parameters: videoParameters({ resolution: \"1080p\", maxWait: 900 }),\n examples: [\n {\n title: \"Text to video\",\n request: {\n model: \"seedance-2-0\",\n content: [\n {\n type: \"text\",\n text: \"a cat playing piano in a cozy jazz club, cinematic lighting, smooth camera movement\",\n },\n ],\n parameters: { duration: 5, resolution: \"1080p\", aspect_ratio: \"16:9\" },\n },\n },\n ],\n },\n {\n schema: MODEL_SCHEMA,\n model: \"seedance-2-0-fast\",\n title: \"Seedance 2.0 Fast\",\n description:\n \"Fast Ark video generation model for drafts, rapid iteration, text-to-video, image-to-video, and reference-guided video generation.\",\n adapter: { type: \"ark.videoGenerations\" },\n content: {\n input: [\n { type: \"text\", required: true, min: 1, max: 16, merge: \"newline\", description: \"Video prompt.\" },\n {\n type: \"image\",\n required: false,\n max: 9,\n sources: [\"url\", \"base64\"],\n description: \"Optional image input. Use meta.role as first_frame, last_frame, or reference_image.\",\n },\n ],\n },\n parameters: videoParameters({ resolution: \"720p\", maxWait: 600 }),\n examples: [\n {\n title: \"Text to video\",\n request: {\n model: \"seedance-2-0-fast\",\n content: [\n {\n type: \"text\",\n text: \"a cat playing piano in a cozy jazz club, cinematic lighting, smooth camera movement\",\n },\n ],\n parameters: { duration: 5, resolution: \"720p\", aspect_ratio: \"16:9\" },\n },\n },\n ],\n },\n ...sunoModels,\n] satisfies GenerationModelDeclaration[];\n\nexport const builtinGenerationModels: GenerationModelDeclaration[] = cloneJson(builtinModels);\n\nexport function getBuiltinGenerationModel(model: string): GenerationModelDeclaration | null {\n return cloneJson(builtinModels.find((declaration) => declaration.model === model) ?? null);\n}\n\nexport function listBuiltinGenerationModels(): GenerationModelDeclaration[] {\n return cloneJson(builtinModels);\n}\n"],"mappings":";AAEA,SAAgB,UAAa,OAAa;CACxC,OAAO,KAAK,MAAM,KAAK,UAA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;EACjE,UAAU,CACR;GACE,OAAO;GACP,SAAS;IACP,OAAO;IACP,SAAS,CACP;KACE,MAAM;KACN,MAAM;IACR,CACF;IACA,YAAY;KAAE,UAAU;KAAG,YAAY;KAAS,cAAc;IAAO;GACvE;EACF,CACF;CACF;CACA;EACE,QAAQ;EACR,OAAO;EACP,OAAO;EACP,aACE;EACF,SAAS,EAAE,MAAM,uBAAuB;EACxC,SAAS,EACP,OAAO,CACL;GAAE,MAAM;GAAQ,UAAU;GAAM,KAAK;GAAG,KAAK;GAAI,OAAO;GAAW,aAAa;EAAgB,GAChG;GACE,MAAM;GACN,UAAU;GACV,KAAK;GACL,SAAS,CAAC,OAAO,QAAQ;GACzB,aAAa;EACf,CACF,EACF;EACA,YAAY,gBAAgB;GAAE,YAAY;GAAQ,SAAS;EAAI,CAAC;EAChE,UAAU,CACR;GACE,OAAO;GACP,SAAS;IACP,OAAO;IACP,SAAS,CACP;KACE,MAAM;KACN,MAAM;IACR,CACF;IACA,YAAY;KAAE,UAAU;KAAG,YAAY;KAAQ,cAAc;IAAO;GACtE;EACF,CACF;CACF;CACA,GAAG;AACL;AAEA,MAAa,0BAAwD,UAAU,aAAa;AAE5F,SAAgB,0BAA0B,OAAkD;CAC1F,OAAO,UAAU,cAAc,MAAM,gBAAgB,YAAY,UAAU,KAAK,KAAK,IAAI;AAC3F;AAEA,SAAgB,8BAA4D;CAC1E,OAAO,UAAU,aAAa;AAChC"}
@@ -105,8 +105,7 @@ type GenerateRequest = {
105
105
  model: string;
106
106
  content: GenerationContentBlock[];
107
107
  parameters?: Record<string, unknown>;
108
- meta?: Record<string, unknown>;
109
- /** @deprecated Use meta. */
108
+ meta?: Record<string, unknown>; /** @deprecated Use meta. */
110
109
  metadata?: Record<string, unknown>;
111
110
  apiKey?: string;
112
111
  baseUrl?: string;
@@ -185,4 +184,4 @@ declare function getBuiltinGenerationModel(model: string): GenerationModelDeclar
185
184
  declare function listBuiltinGenerationModels(): GenerationModelDeclaration[];
186
185
  //#endregion
187
186
  export { GenerationSourceResolver as C, GenerationSource as S, ResolvedGenerationRequest as T, GenerationMetaFieldSpec as _, GenerateRequest as a, GenerationModelDeclaration as b, GenerationAdapterInput as c, GenerationContentBlockMeta as d, GenerationContentSpec as f, GenerationDebugOptions as g, GenerationDebugLogger as h, CreateGenerationClientOptions as i, GenerationClient as l, GenerationDebugEvent as m, getBuiltinGenerationModel as n, GenerationAdapter as o, GenerationDebugConfig as p, listBuiltinGenerationModels as r, GenerationAdapterContext as s, builtinGenerationModels as t, GenerationContentBlock as u, GenerationMetaSpec as v, MODEL_SCHEMA as w, GenerationParameterSpec as x, GenerationMetaTaskVariantSpec as y };
188
- //# sourceMappingURL=builtins-C-_aGhT8.d.ts.map
187
+ //# sourceMappingURL=builtins-BdNYdtm9.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtins-BdNYdtm9.d.ts","names":[],"sources":["../src/types.ts","../src/builtins.ts"],"mappings":";cAAa,YAAA;AAAA,KAED,gBAAA;EAAqB,IAAA;EAAa,GAAA;AAAA;EAAkB,IAAA;EAAgB,SAAA;EAAmB,IAAA;AAAA;AAAA,KAEvF,0BAAA,GAA6B,MAAM;AAAA,KAEnC,sBAAA;EACN,IAAA;EAAc,IAAA;EAAc,IAAA,GAAO,0BAAA;AAAA;EACnC,IAAA;EAAe,MAAA,EAAQ,gBAAA;EAAkB,IAAA,GAAO,0BAAA;AAAA;EAChD,IAAA;EAAe,MAAA,EAAQ,gBAAA;EAAkB,IAAA,GAAO,0BAAA;AAAA;EAChD,IAAA;EAAe,MAAA,EAAQ,gBAAA;EAAkB,IAAA,GAAO,0BAAA;AAAA;AAAA,KAE1C,qBAAA;EACV,IAAA;EACA,QAAA;EACA,GAAA;EACA,GAAA;EACA,OAAA,GAAU,KAAA,CAAM,gBAAA;EAChB,KAAA;EACA,IAAA,GAAO,MAAA;EACP,WAAA;AAAA;AAAA,KAGU,uBAAA;EAEN,IAAA;EACA,QAAA;EACA,OAAA;EACA,IA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,yBAAA,CAA0B,KAAA,WAAgB,0BAA0B;AAAA,iBAIpE,2BAAA,IAA+B,0BAA0B"}
@@ -1,2 +1,2 @@
1
- import { n as getBuiltinGenerationModel, r as listBuiltinGenerationModels, t as builtinGenerationModels } from "./builtins-C-_aGhT8.js";
1
+ import { n as getBuiltinGenerationModel, r as listBuiltinGenerationModels, t as builtinGenerationModels } from "./builtins-BdNYdtm9.js";
2
2
  export { builtinGenerationModels, getBuiltinGenerationModel, listBuiltinGenerationModels };
package/dist/builtins.js CHANGED
@@ -1,3 +1,2 @@
1
- import { n as getBuiltinGenerationModel, r as listBuiltinGenerationModels, t as builtinGenerationModels } from "./builtins-NAtI9FFU.js";
2
-
3
- export { builtinGenerationModels, getBuiltinGenerationModel, listBuiltinGenerationModels };
1
+ import { n as getBuiltinGenerationModel, r as listBuiltinGenerationModels, t as builtinGenerationModels } from "./builtins--2dnc9UT.js";
2
+ export { builtinGenerationModels, getBuiltinGenerationModel, listBuiltinGenerationModels };
package/dist/cli/index.js CHANGED
@@ -1,9 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { r as listBuiltinGenerationModels } from "../builtins-NAtI9FFU.js";
3
- import { h as stringifyGenerationModelDeclaration, i as createGenerationClient, n as exportBuiltinModelConfigs, t as exportBuiltinModelConfig } from "../export-config-DvBXBq-8.js";
2
+ import { h as stringifyGenerationModelDeclaration, i as createGenerationClient, n as exportBuiltinModelConfigs, t as exportBuiltinModelConfig } from "../export-config-BuQ5Maoj.js";
3
+ import { r as listBuiltinGenerationModels } from "../builtins--2dnc9UT.js";
4
4
  import { mkdir, writeFile } from "node:fs/promises";
5
5
  import { dirname, join } from "node:path";
6
-
7
6
  //#region src/cli/index.ts
8
7
  function usage() {
9
8
  console.log(`neta-generation
@@ -141,7 +140,7 @@ main().catch((error) => {
141
140
  console.error(error instanceof Error ? error.message : String(error));
142
141
  process.exit(1);
143
142
  });
144
-
145
143
  //#endregion
146
- export { };
144
+ export {};
145
+
147
146
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["values: string[]","content: GenerationContentBlock[]"],"sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { mkdir, writeFile } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport { listBuiltinGenerationModels } from \"../builtins.js\";\nimport { createGenerationClient } from \"../client.js\";\nimport { stringifyGenerationModelDeclaration } from \"../config.js\";\nimport { exportBuiltinModelConfig, exportBuiltinModelConfigs } from \"../export-config.js\";\nimport type { GenerationContentBlock } from \"../types.js\";\n\nfunction usage(): never {\n console.log(`neta-generation\n\nUsage:\n neta-generation generate <model> --prompt <text> [--param key=value] [--image-url <url>] [--out <directory>] [--debug] [--debug-sensitive] [--no-debug-response-body]\n neta-generation models list\n neta-generation models export <model> --out <file>\n neta-generation models export-all --out <directory>\n\nEnvironment:\n NETA_ROUTER_API_KEY API key used by generate\n`);\n process.exit(1);\n}\n\nfunction readOption(args: string[], name: string): string | null {\n const index = args.indexOf(name);\n if (index < 0) return null;\n return args[index + 1] ?? null;\n}\n\nfunction readOptions(args: string[], name: string): string[] {\n const values: string[] = [];\n for (let index = 0; index < args.length; index += 1) {\n const value = args[index + 1];\n if (args[index] === name && value) values.push(value);\n }\n return values;\n}\n\nfunction hasFlag(args: string[], name: string): boolean {\n return args.includes(name);\n}\n\nfunction parseParameterValue(raw: string): unknown {\n if (raw.startsWith(\"json:\")) return JSON.parse(raw.slice(5));\n if (raw === \"true\") return true;\n if (raw === \"false\") return false;\n return raw;\n}\n\nfunction parseParameter(value: string): [string, unknown] {\n const separator = value.indexOf(\"=\");\n if (separator <= 0) throw new Error(`Invalid --param value: ${value}`);\n return [value.slice(0, separator), parseParameterValue(value.slice(separator + 1))];\n}\n\nfunction outputSummary(block: GenerationContentBlock): unknown {\n if (block.type === \"text\") return block;\n return {\n type: block.type,\n source:\n block.source.type === \"url\"\n ? block.source\n : {\n type: \"base64\",\n mediaType: block.source.mediaType,\n bytes: Buffer.byteLength(block.source.data, \"base64\"),\n },\n meta: block.meta,\n };\n}\n\nasync function writeOutputFiles(directory: string, output: GenerationContentBlock[]): Promise<void> {\n await mkdir(directory, { recursive: true });\n await Promise.all(\n output.map(async (block, index) => {\n if (\n (block.type !== \"image\" && block.type !== \"video\" && block.type !== \"audio\") ||\n block.source.type !== \"base64\"\n ) {\n return;\n }\n const extension = block.source.mediaType.split(\"/\")[1]?.split(\"+\")[0] || block.type;\n await writeFile(\n join(directory, `${String(index + 1).padStart(2, \"0\")}.${extension}`),\n Buffer.from(block.source.data, \"base64\"),\n );\n }),\n );\n}\n\nasync function main() {\n const args = process.argv.slice(2);\n if (args[0] === \"generate\") {\n const model = args[1];\n const prompt = readOption(args, \"--prompt\");\n const apiKey = process.env.NETA_ROUTER_API_KEY;\n if (!model || !prompt || !apiKey) usage();\n\n const outputDirectory = readOption(args, \"--out\");\n const content: GenerationContentBlock[] = [\n { type: \"text\", text: prompt },\n ...readOptions(args, \"--image-url\").map((url) => ({\n type: \"image\" as const,\n source: { type: \"url\" as const, url },\n })),\n ];\n const parameters = Object.fromEntries(readOptions(args, \"--param\").map(parseParameter));\n const baseUrl = readOption(args, \"--base-url\");\n const debug = hasFlag(args, \"--debug\")\n ? {\n enabled: true,\n includeSensitive: hasFlag(args, \"--debug-sensitive\"),\n includeResponseBody: !hasFlag(args, \"--no-debug-response-body\"),\n }\n : undefined;\n const client = createGenerationClient({\n apiKey,\n ...(baseUrl ? { baseUrl } : {}),\n ...(debug ? { debug } : {}),\n });\n const output = await client.generate({ model, content, parameters });\n if (outputDirectory) await writeOutputFiles(outputDirectory, output);\n console.log(JSON.stringify(output.map(outputSummary), null, 2));\n return;\n }\n\n if (args[0] !== \"models\") usage();\n\n switch (args[1]) {\n case \"list\": {\n for (const model of listBuiltinGenerationModels()) console.log(model.model);\n return;\n }\n case \"export\": {\n const model = args[2];\n const out = readOption(args, \"--out\");\n if (!model || !out) usage();\n await mkdir(dirname(out), { recursive: true });\n await exportBuiltinModelConfig(model, out);\n console.log(out);\n return;\n }\n case \"export-all\": {\n const out = readOption(args, \"--out\");\n if (!out) usage();\n await exportBuiltinModelConfigs(out);\n console.log(out);\n return;\n }\n case \"dump\": {\n const out = readOption(args, \"--out\");\n const models = listBuiltinGenerationModels();\n if (out) {\n await mkdir(out, { recursive: true });\n await Promise.all(\n models.map((model) =>\n writeFile(join(out, `${model.model}.yaml`), stringifyGenerationModelDeclaration(model)),\n ),\n );\n }\n return;\n }\n default:\n usage();\n }\n}\n\nmain().catch((error) => {\n console.error(error instanceof Error ? error.message : String(error));\n process.exit(1);\n});\n"],"mappings":";;;;;;;AASA,SAAS,QAAe;AACtB,SAAQ,IAAI;;;;;;;;;;EAUZ;AACA,SAAQ,KAAK,EAAE;;AAGjB,SAAS,WAAW,MAAgB,MAA6B;CAC/D,MAAM,QAAQ,KAAK,QAAQ,KAAK;AAChC,KAAI,QAAQ,EAAG,QAAO;AACtB,QAAO,KAAK,QAAQ,MAAM;;AAG5B,SAAS,YAAY,MAAgB,MAAwB;CAC3D,MAAMA,SAAmB,EAAE;AAC3B,MAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SAAS,GAAG;EACnD,MAAM,QAAQ,KAAK,QAAQ;AAC3B,MAAI,KAAK,WAAW,QAAQ,MAAO,QAAO,KAAK,MAAM;;AAEvD,QAAO;;AAGT,SAAS,QAAQ,MAAgB,MAAuB;AACtD,QAAO,KAAK,SAAS,KAAK;;AAG5B,SAAS,oBAAoB,KAAsB;AACjD,KAAI,IAAI,WAAW,QAAQ,CAAE,QAAO,KAAK,MAAM,IAAI,MAAM,EAAE,CAAC;AAC5D,KAAI,QAAQ,OAAQ,QAAO;AAC3B,KAAI,QAAQ,QAAS,QAAO;AAC5B,QAAO;;AAGT,SAAS,eAAe,OAAkC;CACxD,MAAM,YAAY,MAAM,QAAQ,IAAI;AACpC,KAAI,aAAa,EAAG,OAAM,IAAI,MAAM,0BAA0B,QAAQ;AACtE,QAAO,CAAC,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K;AACP,UAAM,MAAM,KAAK,EAAE,WAAW,MAAM,CAAC;AACrC,UAAM,QAAQ,IACZ,OAAO,KAAK,UACV,UAAU,KAAK,KAAK,GAAG,MAAM,MAAM,OAAO,EAAE,oCAAoC,MAAM,CAAC,CACxF,CACF;;AAEH;;EAEF,QACE,QAAO;;;AAIb,MAAM,CAAC,OAAO,UAAU;AACtB,SAAQ,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;AACrE,SAAQ,KAAK,EAAE;EACf"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { mkdir, writeFile } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport { listBuiltinGenerationModels } from \"../builtins.js\";\nimport { createGenerationClient } from \"../client.js\";\nimport { stringifyGenerationModelDeclaration } from \"../config.js\";\nimport { exportBuiltinModelConfig, exportBuiltinModelConfigs } from \"../export-config.js\";\nimport type { GenerationContentBlock } from \"../types.js\";\n\nfunction usage(): never {\n console.log(`neta-generation\n\nUsage:\n neta-generation generate <model> --prompt <text> [--param key=value] [--image-url <url>] [--out <directory>] [--debug] [--debug-sensitive] [--no-debug-response-body]\n neta-generation models list\n neta-generation models export <model> --out <file>\n neta-generation models export-all --out <directory>\n\nEnvironment:\n NETA_ROUTER_API_KEY API key used by generate\n`);\n process.exit(1);\n}\n\nfunction readOption(args: string[], name: string): string | null {\n const index = args.indexOf(name);\n if (index < 0) return null;\n return args[index + 1] ?? null;\n}\n\nfunction readOptions(args: string[], name: string): string[] {\n const values: string[] = [];\n for (let index = 0; index < args.length; index += 1) {\n const value = args[index + 1];\n if (args[index] === name && value) values.push(value);\n }\n return values;\n}\n\nfunction hasFlag(args: string[], name: string): boolean {\n return args.includes(name);\n}\n\nfunction parseParameterValue(raw: string): unknown {\n if (raw.startsWith(\"json:\")) return JSON.parse(raw.slice(5));\n if (raw === \"true\") return true;\n if (raw === \"false\") return false;\n return raw;\n}\n\nfunction parseParameter(value: string): [string, unknown] {\n const separator = value.indexOf(\"=\");\n if (separator <= 0) throw new Error(`Invalid --param value: ${value}`);\n return [value.slice(0, separator), parseParameterValue(value.slice(separator + 1))];\n}\n\nfunction outputSummary(block: GenerationContentBlock): unknown {\n if (block.type === \"text\") return block;\n return {\n type: block.type,\n source:\n block.source.type === \"url\"\n ? block.source\n : {\n type: \"base64\",\n mediaType: block.source.mediaType,\n bytes: Buffer.byteLength(block.source.data, \"base64\"),\n },\n meta: block.meta,\n };\n}\n\nasync function writeOutputFiles(directory: string, output: GenerationContentBlock[]): Promise<void> {\n await mkdir(directory, { recursive: true });\n await Promise.all(\n output.map(async (block, index) => {\n if (\n (block.type !== \"image\" && block.type !== \"video\" && block.type !== \"audio\") ||\n block.source.type !== \"base64\"\n ) {\n return;\n }\n const extension = block.source.mediaType.split(\"/\")[1]?.split(\"+\")[0] || block.type;\n await writeFile(\n join(directory, `${String(index + 1).padStart(2, \"0\")}.${extension}`),\n Buffer.from(block.source.data, \"base64\"),\n );\n }),\n );\n}\n\nasync function main() {\n const args = process.argv.slice(2);\n if (args[0] === \"generate\") {\n const model = args[1];\n const prompt = readOption(args, \"--prompt\");\n const apiKey = process.env.NETA_ROUTER_API_KEY;\n if (!model || !prompt || !apiKey) usage();\n\n const outputDirectory = readOption(args, \"--out\");\n const content: GenerationContentBlock[] = [\n { type: \"text\", text: prompt },\n ...readOptions(args, \"--image-url\").map((url) => ({\n type: \"image\" as const,\n source: { type: \"url\" as const, url },\n })),\n ];\n const parameters = Object.fromEntries(readOptions(args, \"--param\").map(parseParameter));\n const baseUrl = readOption(args, \"--base-url\");\n const debug = hasFlag(args, \"--debug\")\n ? {\n enabled: true,\n includeSensitive: hasFlag(args, \"--debug-sensitive\"),\n includeResponseBody: !hasFlag(args, \"--no-debug-response-body\"),\n }\n : undefined;\n const client = createGenerationClient({\n apiKey,\n ...(baseUrl ? { baseUrl } : {}),\n ...(debug ? { debug } : {}),\n });\n const output = await client.generate({ model, content, parameters });\n if (outputDirectory) await writeOutputFiles(outputDirectory, output);\n console.log(JSON.stringify(output.map(outputSummary), null, 2));\n return;\n }\n\n if (args[0] !== \"models\") usage();\n\n switch (args[1]) {\n case \"list\": {\n for (const model of listBuiltinGenerationModels()) console.log(model.model);\n return;\n }\n case \"export\": {\n const model = args[2];\n const out = readOption(args, \"--out\");\n if (!model || !out) usage();\n await mkdir(dirname(out), { recursive: true });\n await exportBuiltinModelConfig(model, out);\n console.log(out);\n return;\n }\n case \"export-all\": {\n const out = readOption(args, \"--out\");\n if (!out) usage();\n await exportBuiltinModelConfigs(out);\n console.log(out);\n return;\n }\n case \"dump\": {\n const out = readOption(args, \"--out\");\n const models = listBuiltinGenerationModels();\n if (out) {\n await mkdir(out, { recursive: true });\n await Promise.all(\n models.map((model) =>\n writeFile(join(out, `${model.model}.yaml`), stringifyGenerationModelDeclaration(model)),\n ),\n );\n }\n return;\n }\n default:\n usage();\n }\n}\n\nmain().catch((error) => {\n console.error(error instanceof Error ? error.message : String(error));\n process.exit(1);\n});\n"],"mappings":";;;;;;AASA,SAAS,QAAe;CACtB,QAAQ,IAAI;;;;;;;;;;CAUb;CACC,QAAQ,KAAK,CAAC;AAChB;AAEA,SAAS,WAAW,MAAgB,MAA6B;CAC/D,MAAM,QAAQ,KAAK,QAAQ,IAAI;CAC/B,IAAI,QAAQ,GAAG,OAAO;CACtB,OAAO,KAAK,QAAQ,MAAM;AAC5B;AAEA,SAAS,YAAY,MAAgB,MAAwB;CAC3D,MAAM,SAAmB,CAAC;CAC1B,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SAAS,GAAG;EACnD,MAAM,QAAQ,KAAK,QAAQ;EAC3B,IAAI,KAAK,WAAW,QAAQ,OAAO,OAAO,KAAK,KAAK;CACtD;CACA,OAAO;AACT;AAEA,SAAS,QAAQ,MAAgB,MAAuB;CACtD,OAAO,KAAK,SAAS,IAAI;AAC3B;AAEA,SAAS,oBAAoB,KAAsB;CAC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AM,MAAM,QAAQ,GAAG,GAAG,EAAE,WAAW,KAAK,CAAC;GAC7C,MAAM,yBAAyB,OAAO,GAAG;GACzC,QAAQ,IAAI,GAAG;GACf;EACF;EACA,KAAK,cAAc;GACjB,MAAM,MAAM,WAAW,MAAM,OAAO;GACpC,IAAI,CAAC,KAAK,MAAM;GAChB,MAAM,0BAA0B,GAAG;GACnC,QAAQ,IAAI,GAAG;GACf;EACF;EACA,KAAK,QAAQ;GACX,MAAM,MAAM,WAAW,MAAM,OAAO;GACpC,MAAM,SAAS,4BAA4B;GAC3C,IAAI,KAAK;IACP,MAAM,MAAM,KAAK,EAAE,WAAW,KAAK,CAAC;IACpC,MAAM,QAAQ,IACZ,OAAO,KAAK,UACV,UAAU,KAAK,KAAK,GAAG,MAAM,MAAM,MAAM,GAAG,oCAAoC,KAAK,CAAC,CACxF,CACF;GACF;GACA;EACF;EACA,SACE,MAAM;CACV;AACF;AAEA,KAAK,CAAC,CAAC,OAAO,UAAU;CACtB,QAAQ,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;CACpE,QAAQ,KAAK,CAAC;AAChB,CAAC"}
@@ -1,8 +1,7 @@
1
- import { a as compactArray, c as slugifyFileName, i as cloneJson, l as MODEL_SCHEMA, n as getBuiltinGenerationModel, o as compactObject, r as listBuiltinGenerationModels, s as getBlockMeta, t as builtinGenerationModels } from "./builtins-NAtI9FFU.js";
1
+ import { a as cloneJson, c as getBlockMeta, l as slugifyFileName, n as getBuiltinGenerationModel, o as compactArray, r as listBuiltinGenerationModels, s as compactObject, t as builtinGenerationModels } from "./builtins--2dnc9UT.js";
2
2
  import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
3
3
  import { extname, join } from "node:path";
4
4
  import { parse, stringify } from "yaml";
5
-
6
5
  //#region src/errors.ts
7
6
  var GenerationError = class extends Error {
8
7
  constructor(message) {
@@ -46,7 +45,6 @@ var GenerationTimeoutError = class extends GenerationProviderError {
46
45
  this.name = "GenerationTimeoutError";
47
46
  }
48
47
  };
49
-
50
48
  //#endregion
51
49
  //#region src/http.ts
52
50
  function headersToRecord(headers) {
@@ -134,7 +132,6 @@ async function fetchWithTimeout(fetchFn, url, init, timeoutMs) {
134
132
  function joinUrl(baseUrl, path) {
135
133
  return `${baseUrl.replace(/\/+$/, "")}/${path.replace(/^\/+/, "")}`;
136
134
  }
137
-
138
135
  //#endregion
139
136
  //#region src/validation.ts
140
137
  function specsByType(specs) {
@@ -248,7 +245,6 @@ function mergeTextBlocks(declaration, content) {
248
245
  const separator = textSpec?.merge === "space" ? " " : textSpec?.merge === "concat" ? "" : "\n";
249
246
  return content.filter((block) => block.type === "text").map((block) => block.text).join(separator).trim();
250
247
  }
251
-
252
248
  //#endregion
253
249
  //#region src/adapters/ark-video-generations.ts
254
250
  const REQUEST_TIMEOUT_MS$5 = 186e4;
@@ -490,45 +486,21 @@ async function arkVideoGenerationsAdapter(input) {
490
486
  }
491
487
  throw new GenerationTimeoutError("Timed out waiting for video generation", { taskId });
492
488
  }
493
-
494
489
  //#endregion
495
490
  //#region src/adapters/gemini-generate-content.ts
496
491
  const REQUEST_TIMEOUT_MS$4 = 3e5;
497
- const IMAGE_FETCH_TIMEOUT_MS = 6e4;
498
- const MAX_REFERENCE_IMAGE_BYTES = 10 * 1024 * 1024;
499
- const DATA_URI_PATTERN = /^data:([^;]+);base64,(.+)$/s;
500
492
  const MARKDOWN_IMAGE_DATA_URI_PATTERN = /!\[[^\]]*\]\(data:([^;]+);base64,([^)]+)\)/;
501
- function dataUriToInlineData(value) {
502
- const match = DATA_URI_PATTERN.exec(value);
503
- if (!match) return null;
504
- const [, mimeType, data] = match;
505
- if (!mimeType || !data) return null;
506
- return { inlineData: {
507
- mimeType,
508
- data
509
- } };
493
+ function isHttpUrl(value) {
494
+ return value.startsWith("http://") || value.startsWith("https://");
510
495
  }
511
- async function urlToInlineData(fetchFn, url) {
512
- const response = await fetchWithTimeout(fetchFn, url, {
513
- method: "GET",
514
- headers: { "User-Agent": "NetaGeneration/1.0" }
515
- }, IMAGE_FETCH_TIMEOUT_MS);
516
- if (!response.ok) throw new GenerationProviderError("Failed to fetch reference image", { status: response.status });
517
- const contentLength = response.headers.get("content-length");
518
- if (contentLength && Number(contentLength) > MAX_REFERENCE_IMAGE_BYTES) throw new GenerationValidationError("Reference image is too large");
519
- const bytes = Buffer.from(await response.arrayBuffer());
520
- if (bytes.byteLength > MAX_REFERENCE_IMAGE_BYTES) throw new GenerationValidationError("Reference image is too large");
521
- const contentType = response.headers.get("content-type")?.split(";")[0]?.trim();
522
- return { inlineData: {
523
- mimeType: contentType?.startsWith("image/") ? contentType : "image/png",
524
- data: bytes.toString("base64")
496
+ async function imageBlockToGeminiPart(input, block) {
497
+ if (block.source.type === "base64") return { inlineData: {
498
+ mimeType: block.source.mediaType,
499
+ data: block.source.data
525
500
  } };
526
- }
527
- async function sourceToInlineData(input, value) {
528
- const inline = dataUriToInlineData(value);
529
- if (inline) return inline;
530
- if (value.startsWith("http://") || value.startsWith("https://")) return urlToInlineData(input.context.fetch, value);
531
- throw new GenerationValidationError("Unsupported image source for Gemini image generation");
501
+ const fileUri = await input.context.resolveSource(block.source);
502
+ if (!isHttpUrl(fileUri)) throw new GenerationValidationError("Gemini image URL source must resolve to an HTTP(S) URL");
503
+ return { fileData: { fileUri } };
532
504
  }
533
505
  function extractMarkdownDataUriImage(text) {
534
506
  const match = MARKDOWN_IMAGE_DATA_URI_PATTERN.exec(text);
@@ -610,7 +582,7 @@ function appendGeminiPartOutput(output, part) {
610
582
  async function geminiGenerateContentAdapter(input) {
611
583
  const prompt = mergeTextBlocks(input.declaration, input.request.content);
612
584
  if (!prompt) throw new GenerationValidationError("Prompt text is required");
613
- const imageParts = await Promise.all(input.request.content.filter((block) => block.type === "image").map(async (block) => sourceToInlineData(input, await input.context.resolveSource(block.source))));
585
+ const imageParts = await Promise.all(input.request.content.filter((block) => block.type === "image").map((block) => imageBlockToGeminiPart(input, block)));
614
586
  const generationConfig = { responseModalities: ["IMAGE"] };
615
587
  const aspectRatio = input.parameters.aspect_ratio;
616
588
  const imageSize = input.parameters.image_size;
@@ -645,7 +617,6 @@ async function geminiGenerateContentAdapter(input) {
645
617
  if (output.length === 0) throw new GenerationProviderError("Gemini generation returned no output", { details: collectGeminiNoOutputDetails(raw) });
646
618
  return output;
647
619
  }
648
-
649
620
  //#endregion
650
621
  //#region src/adapters/kling-video-generations.ts
651
622
  const REQUEST_TIMEOUT_MS$3 = 186e4;
@@ -884,7 +855,6 @@ async function klingVideoGenerationsAdapter(input) {
884
855
  }
885
856
  throw new GenerationTimeoutError("Timed out waiting for Kling video generation", { taskId });
886
857
  }
887
-
888
858
  //#endregion
889
859
  //#region src/adapters/openai-image-edits.ts
890
860
  const REQUEST_TIMEOUT_MS$2 = 3e5;
@@ -954,7 +924,6 @@ async function openAiImageEditsAdapter(input) {
954
924
  if (output.length === 0) throw new GenerationProviderError("Image edit returned no output", { details: collectOpenAiImageEditsNoOutputDetails(raw) });
955
925
  return output;
956
926
  }
957
-
958
927
  //#endregion
959
928
  //#region src/adapters/openai-images.ts
960
929
  const REQUEST_TIMEOUT_MS$1 = 3e5;
@@ -1031,7 +1000,6 @@ async function openAiImagesAdapter(input) {
1031
1000
  if (output.length === 0) throw new GenerationProviderError("Image generation returned no output", { details: collectOpenAiImagesNoOutputDetails(raw) });
1032
1001
  return output;
1033
1002
  }
1034
-
1035
1003
  //#endregion
1036
1004
  //#region src/adapters/suno-tasks.ts
1037
1005
  const REQUEST_TIMEOUT_MS = 6e4;
@@ -1066,12 +1034,12 @@ const OPERATION_PATHS = {
1066
1034
  poll: true
1067
1035
  }
1068
1036
  };
1069
- const FINAL_SUCCESS_STATUSES = new Set([
1037
+ const FINAL_SUCCESS_STATUSES = /* @__PURE__ */ new Set([
1070
1038
  "success",
1071
1039
  "succeeded",
1072
1040
  "completed"
1073
1041
  ]);
1074
- const FINAL_FAILURE_STATUSES = new Set([
1042
+ const FINAL_FAILURE_STATUSES = /* @__PURE__ */ new Set([
1075
1043
  "failure",
1076
1044
  "failed",
1077
1045
  "error",
@@ -1390,7 +1358,6 @@ async function sunoTasksAdapter(input) {
1390
1358
  if (!taskId) return buildImmediateResult(operation, data, raw);
1391
1359
  return pollSunoTask(input, operation, taskId, asInteger(input.parameters.poll_interval, DEFAULT_POLL_INTERVAL_SEC), asInteger(input.parameters.max_wait, DEFAULT_MAX_WAIT_SEC));
1392
1360
  }
1393
-
1394
1361
  //#endregion
1395
1362
  //#region src/adapters/index.ts
1396
1363
  const builtinGenerationAdapters = {
@@ -1406,10 +1373,9 @@ function getGenerationAdapter(type, adapters = {}) {
1406
1373
  if (!adapter) throw new GenerationUnsupportedAdapterError(type);
1407
1374
  return adapter;
1408
1375
  }
1409
-
1410
1376
  //#endregion
1411
1377
  //#region src/config.ts
1412
- const DECLARATION_EXTENSIONS = new Set([
1378
+ const DECLARATION_EXTENSIONS = /* @__PURE__ */ new Set([
1413
1379
  ".yaml",
1414
1380
  ".yml",
1415
1381
  ".json"
@@ -1445,7 +1411,7 @@ function isGenerationModelDeclaration(value) {
1445
1411
  const parameters = value.parameters;
1446
1412
  const meta = value.meta;
1447
1413
  const examples = value.examples;
1448
- return value.schema === MODEL_SCHEMA && typeof value.model === "string" && value.model.trim().length > 0 && (value.allowUnknownParameters === void 0 || typeof value.allowUnknownParameters === "boolean") && isRecord(adapter) && typeof adapter.type === "string" && isRecord(content) && Array.isArray(content.input) && (parameters === void 0 || isRecord(parameters) && Object.values(parameters).every(isParameterSpec)) && (meta === void 0 || isMetaSpec(meta)) && (examples === void 0 || Array.isArray(examples));
1414
+ return value.schema === "neta.generation.model.v1" && typeof value.model === "string" && value.model.trim().length > 0 && (value.allowUnknownParameters === void 0 || typeof value.allowUnknownParameters === "boolean") && isRecord(adapter) && typeof adapter.type === "string" && isRecord(content) && Array.isArray(content.input) && (parameters === void 0 || isRecord(parameters) && Object.values(parameters).every(isParameterSpec)) && (meta === void 0 || isMetaSpec(meta)) && (examples === void 0 || Array.isArray(examples));
1449
1415
  }
1450
1416
  function parseGenerationModelDeclaration(rawText, filePath = "model.yaml") {
1451
1417
  const parsed = extname(filePath) === ".json" ? JSON.parse(rawText) : parse(rawText);
@@ -1479,7 +1445,6 @@ async function writeGenerationModelDeclarations(declarations, directory, options
1479
1445
  const ext = options.format === "json" ? "json" : "yaml";
1480
1446
  await Promise.all(declarations.map((declaration) => writeGenerationModelDeclaration(declaration, join(directory, `${slugifyFileName(declaration.model)}.${ext}`), options)));
1481
1447
  }
1482
-
1483
1448
  //#endregion
1484
1449
  //#region src/source.ts
1485
1450
  const defaultGenerationSourceResolver = (source) => {
@@ -1488,14 +1453,13 @@ const defaultGenerationSourceResolver = (source) => {
1488
1453
  case "base64": return `data:${source.mediaType};base64,${source.data}`;
1489
1454
  }
1490
1455
  };
1491
-
1492
1456
  //#endregion
1493
1457
  //#region src/client.ts
1494
1458
  const DEFAULT_BASE_URL = "https://router.neta.art";
1495
1459
  const REDACTED = "[REDACTED]";
1496
1460
  const SECRET_DEBUG_KEY_PATTERN = /^(authorization|api[-_]?key|token|thoughtSignature)$/i;
1497
1461
  const BASE64_DEBUG_KEY_PATTERN = /^(b64_json|data)$/i;
1498
- const MEDIA_PAYLOAD_KEYS = new Set([
1462
+ const MEDIA_PAYLOAD_KEYS = /* @__PURE__ */ new Set([
1499
1463
  "audio",
1500
1464
  "audio_url",
1501
1465
  "image",
@@ -1640,7 +1604,6 @@ async function createGenerationClientFromDirectory(directory, options = {}) {
1640
1604
  async function createGenerationClientFromFile(filePath, options = {}) {
1641
1605
  return createGenerationClientFromFiles([filePath], options);
1642
1606
  }
1643
-
1644
1607
  //#endregion
1645
1608
  //#region src/export-config.ts
1646
1609
  function stringifyBuiltinModelConfig(model, options = {}) {
@@ -1656,7 +1619,7 @@ async function exportBuiltinModelConfig(model, filePath) {
1656
1619
  async function exportBuiltinModelConfigs(directory) {
1657
1620
  await writeGenerationModelDeclarations(listBuiltinGenerationModels(), directory);
1658
1621
  }
1659
-
1660
1622
  //#endregion
1661
1623
  export { validateGenerationContent as A, klingVideoGenerationsAdapter as C, mergeTextBlocks as D, mergeGenerationMeta as E, GenerationUnsupportedAdapterError as F, GenerationValidationError as I, GenerationError as M, GenerationProviderError as N, resolveGenerationMeta as O, GenerationTimeoutError as P, openAiImageEditsAdapter as S, arkVideoGenerationsAdapter as T, writeGenerationModelDeclarations as _, createGenerationClientFromDirectory as a, sunoTasksAdapter as b, defaultGenerationSourceResolver as c, parseGenerationModelDeclaration as d, readGenerationModelDeclaration as f, writeGenerationModelDeclaration as g, stringifyGenerationModelDeclaration as h, createGenerationClient as i, GenerationConfigError as j, resolveGenerationParameters as k, isGenerationModelDeclaration as l, readGenerationModelDeclarationsFromFiles as m, exportBuiltinModelConfigs as n, createGenerationClientFromFile as o, readGenerationModelDeclarationsFromDirectory as p, stringifyBuiltinModelConfig as r, createGenerationClientFromFiles as s, exportBuiltinModelConfig as t, mergeGenerationModelDeclarations as u, builtinGenerationAdapters as v, geminiGenerateContentAdapter as w, openAiImagesAdapter as x, getGenerationAdapter as y };
1662
- //# sourceMappingURL=export-config-DvBXBq-8.js.map
1624
+
1625
+ //# sourceMappingURL=export-config-BuQ5Maoj.js.map