@neta-art/generation 0.1.1 → 0.1.3

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.
@@ -0,0 +1,265 @@
1
+ schema: neta.generation.model.v1
2
+ model: suno_music
3
+ title: Suno Music
4
+ description: Suno music model for songs, lyrics, sound effects, and integrated music tasks.
5
+ adapter:
6
+ type: suno.tasks
7
+ content:
8
+ input:
9
+ - type: text
10
+ required: false
11
+ max: 16
12
+ merge: newline
13
+ description: Optional prompt text. The adapter maps merged text to the operation's text field when that field is not provided.
14
+ - type: audio
15
+ required: false
16
+ max: 1
17
+ sources:
18
+ - url
19
+ - base64
20
+ description: Optional reference audio. The adapter maps it to url when url is not provided.
21
+ - type: image
22
+ required: false
23
+ max: 1
24
+ sources:
25
+ - url
26
+ - base64
27
+ description: Optional image source. The adapter maps it to image_url when image_url is not provided.
28
+ - type: video
29
+ required: false
30
+ max: 1
31
+ sources:
32
+ - url
33
+ - base64
34
+ description: Optional video source. The adapter maps it to video_url when video_url is not provided.
35
+ parameters:
36
+ operation:
37
+ type: string
38
+ optional: true
39
+ default: music
40
+ enum:
41
+ - music
42
+ - lyrics
43
+ description: Stable Suno endpoint operation. Provider-specific fields such as task, mv, title, tags, metadataParams, and clip_id belong in request meta.
44
+ poll_interval:
45
+ type: integer
46
+ optional: true
47
+ default: 5
48
+ min: 1
49
+ max: 60
50
+ description: Seconds between task status checks.
51
+ max_wait:
52
+ type: integer
53
+ optional: true
54
+ default: 600
55
+ min: 30
56
+ max: 3600
57
+ description: Maximum seconds to wait for task completion.
58
+ meta:
59
+ taskField: task
60
+ fields:
61
+ task:
62
+ type: string
63
+ optional: true
64
+ enum:
65
+ - extend
66
+ - upload_extend
67
+ - infill
68
+ - fixed_infill
69
+ - infill_intro
70
+ - infill_outro
71
+ - cover_infill
72
+ - cover_extend
73
+ - artist_infill
74
+ - artist_consistency
75
+ - cover
76
+ - image_to_song
77
+ - video_to_song
78
+ - concat
79
+ - sound
80
+ - underpainting
81
+ - remaster
82
+ - vox
83
+ - mashup_condition
84
+ description: Integrated Suno music task for operation=music.
85
+ mv:
86
+ type: string
87
+ optional: true
88
+ description: Suno music model version.
89
+ task_id:
90
+ type: string
91
+ optional: true
92
+ description: Existing Suno task id used for continuation-style tasks.
93
+ clip_id:
94
+ type: string
95
+ optional: true
96
+ description: Existing Suno clip id used for continuation-style tasks.
97
+ continue_clip_id:
98
+ type: string
99
+ optional: true
100
+ description: Clip id to continue from.
101
+ continue_at:
102
+ type: number
103
+ optional: true
104
+ description: Continue position in seconds.
105
+ model_name:
106
+ type: string
107
+ optional: true
108
+ description: Suno model name used by remaster.
109
+ variation_category:
110
+ type: string
111
+ optional: true
112
+ description: Remaster variation category.
113
+ metadata_params:
114
+ type: object
115
+ optional: true
116
+ description: Yunwu/Suno task-specific metadata payload.
117
+ taskVariants:
118
+ extend:
119
+ required:
120
+ - task_id
121
+ - clip_id
122
+ - continue_clip_id
123
+ upload_extend:
124
+ required:
125
+ - task_id
126
+ - clip_id
127
+ - continue_clip_id
128
+ infill:
129
+ required:
130
+ - task_id
131
+ - clip_id
132
+ - continue_clip_id
133
+ fixed_infill:
134
+ required:
135
+ - task_id
136
+ - clip_id
137
+ - continue_clip_id
138
+ infill_intro:
139
+ required:
140
+ - task_id
141
+ - clip_id
142
+ - continue_clip_id
143
+ infill_outro:
144
+ required:
145
+ - task_id
146
+ - clip_id
147
+ - continue_clip_id
148
+ cover_infill:
149
+ required:
150
+ - task_id
151
+ - clip_id
152
+ - continue_clip_id
153
+ cover_extend:
154
+ required:
155
+ - task_id
156
+ - clip_id
157
+ - continue_clip_id
158
+ artist_infill:
159
+ required:
160
+ - task_id
161
+ - clip_id
162
+ - continue_clip_id
163
+ artist_consistency:
164
+ required:
165
+ - task_id
166
+ - clip_id
167
+ - continue_clip_id
168
+ cover:
169
+ required:
170
+ - task_id
171
+ - clip_id
172
+ - continue_clip_id
173
+ image_to_song:
174
+ requiredContent:
175
+ - image
176
+ required:
177
+ - metadata_params
178
+ video_to_song:
179
+ requiredContent:
180
+ - video
181
+ required:
182
+ - metadata_params
183
+ concat:
184
+ required:
185
+ - task_id
186
+ - clip_id
187
+ - continue_clip_id
188
+ sound:
189
+ required:
190
+ - metadata_params
191
+ underpainting:
192
+ required:
193
+ - metadata_params
194
+ remaster:
195
+ sendTask: false
196
+ required:
197
+ - clip_id
198
+ - model_name
199
+ - variation_category
200
+ vox:
201
+ required:
202
+ - task_id
203
+ - clip_id
204
+ - continue_clip_id
205
+ mashup_condition:
206
+ required:
207
+ - task_id
208
+ - clip_id
209
+ - continue_clip_id
210
+ examples:
211
+ - title: Music generation
212
+ request:
213
+ model: suno_music
214
+ content:
215
+ - type: text
216
+ text: uplifting cinematic pop with warm piano and clear chorus
217
+ parameters:
218
+ operation: music
219
+ meta:
220
+ mv: chirp-v5-5
221
+ title: Warm Horizon
222
+ tags: cinematic pop, warm piano
223
+ make_instrumental: false
224
+ - title: Lyrics
225
+ request:
226
+ model: suno_music
227
+ content:
228
+ - type: text
229
+ text: write a hopeful chorus about sunrise after a storm
230
+ parameters:
231
+ operation: lyrics
232
+ - title: Sound effect
233
+ request:
234
+ model: suno_music
235
+ content:
236
+ - type: text
237
+ text: ambient music with gentle rain and distant thunder
238
+ parameters:
239
+ operation: music
240
+ meta:
241
+ task: sound
242
+ mv: chirp-v5-5
243
+ metadata_params:
244
+ sound: gentle rain ambience with distant thunder
245
+ title: Gentle Rain
246
+ tags: ambient, rain, cinematic
247
+ make_instrumental: true
248
+ - title: Image to song
249
+ request:
250
+ model: suno_music
251
+ content:
252
+ - type: text
253
+ text: turn this image into a short hopeful pop song
254
+ - type: image
255
+ source:
256
+ type: url
257
+ url: https://picsum.photos/512/512
258
+ parameters:
259
+ operation: music
260
+ meta:
261
+ task: image_to_song
262
+ mv: chirp-v5-5
263
+ metadata_params:
264
+ image_url: https://picsum.photos/512/512
265
+ prompt: turn this image into a short hopeful pop song
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neta-art/generation",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "A lightweight multimodal generation SDK with built-in model presets and adapter-based provider calls.",
5
5
  "keywords": [
6
6
  "ai",
@@ -41,19 +41,6 @@
41
41
  "models",
42
42
  "README.md"
43
43
  ],
44
- "scripts": {
45
- "build": "tsdown",
46
- "example:basic-image": "node --env-file=.env --experimental-strip-types examples/basic-image.ts",
47
- "example:image-editing": "node --env-file=.env --experimental-strip-types examples/image-editing.ts",
48
- "example:text-to-video": "node --env-file=.env --experimental-strip-types examples/text-to-video.ts",
49
- "typecheck": "tsc -p tsconfig.json --noEmit",
50
- "test": "vitest run",
51
- "test:watch": "vitest",
52
- "lint": "biome check .",
53
- "lint:fix": "biome check --write .",
54
- "format": "biome format --write .",
55
- "prepublishOnly": "pnpm lint && pnpm typecheck && pnpm test && pnpm build"
56
- },
57
44
  "dependencies": {
58
45
  "yaml": "^2.8.3"
59
46
  },
@@ -67,9 +54,21 @@
67
54
  "engines": {
68
55
  "node": ">=20.0.0"
69
56
  },
70
- "packageManager": "pnpm@10.32.1",
71
57
  "publishConfig": {
72
58
  "access": "public",
73
59
  "registry": "https://registry.npmjs.org/"
60
+ },
61
+ "scripts": {
62
+ "build": "tsdown",
63
+ "example:basic-image": "node --env-file=.env --experimental-strip-types examples/basic-image.ts",
64
+ "example:image-editing": "node --env-file=.env --experimental-strip-types examples/image-editing.ts",
65
+ "example:music-generation": "node --env-file=.env --experimental-strip-types examples/music-generation.ts",
66
+ "example:text-to-video": "node --env-file=.env --experimental-strip-types examples/text-to-video.ts",
67
+ "typecheck": "tsc -p tsconfig.json --noEmit",
68
+ "test": "vitest run",
69
+ "test:watch": "vitest",
70
+ "lint": "biome check .",
71
+ "lint:fix": "biome check --write .",
72
+ "format": "biome format --write ."
74
73
  }
75
- }
74
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"builtins-B1AheaEa.js","names":["builtinGenerationModels: GenerationModelDeclaration[]"],"sources":["../src/types.ts","../src/utils.ts","../src/builtins.ts"],"sourcesContent":["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 GenerationModelDeclaration = {\n schema: typeof MODEL_SCHEMA;\n model: string;\n title?: string;\n description?: string;\n adapter: {\n type: string;\n };\n content: {\n input: GenerationContentSpec[];\n };\n parameters?: Record<string, GenerationParameterSpec>;\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 apiKey?: string;\n baseUrl?: string;\n metadata?: Record<string, unknown>;\n};\n\nexport type ResolvedGenerationRequest = {\n declaration: GenerationModelDeclaration;\n request: GenerateRequest;\n parameters: Record<string, unknown>;\n};\n\nexport type GenerationSourceResolver = (source: GenerationSource) => Promise<string> | string;\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};\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 { 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","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\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\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: \"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: \"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 },\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 },\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":";AAAA,MAAa,eAAe;;;;ACE5B,SAAgB,UAAa,OAAa;AACxC,QAAO,KAAK,MAAM,KAAK,UAAU,MAAM,CAAC;;AAG1C,SAAgB,gBAAgB,OAAuB;AACrD,QACE,MACG,MAAM,CACN,aAAa,CACb,QAAQ,kBAAkB,IAAI,CAC9B,QAAQ,YAAY,GAAG,IAAI;;AAI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ACT,MAAM;KAAC;KAAO;KAAM;KAAM;KAAK;IAC/B,aAAa;IACd;GACF;EACD,UAAU,CACR;GACE,OAAO;GACP,SAAS;IACP,OAAO;IACP,SAAS,CACP;KAAE,MAAM;KAAQ,MAAM;KAA8E,CACrG;IACD,YAAY;KAAE,cAAc;KAAQ,YAAY;KAAM;IACvD;GACF,CACF;EACF;CACD;EACE,QAAQ;EACR,OAAO;EACP,OAAO;EACP,aAAa;EACb,SAAS,EAAE,MAAM,wBAAwB;EACzC,SAAS,EACP,OAAO,CACL;GAAE,MAAM;GAAQ,UAAU;GAAM,KAAK;GAAG,KAAK;GAAI,OAAO;GAAW,aAAa;GAAiB,EACjG;GACE,MAAM;GACN,UAAU;GACV,KAAK;GACL,SAAS,CAAC,OAAO,SAAS;GAC1B,aAAa;GACd,CACF,EACF;EACD,YAAY,gBAAgB;GAAE,YAAY;GAAS,SAAS;GAAK,CAAC;EACnE;CACD;EACE,QAAQ;EACR,OAAO;EACP,OAAO;EACP,aACE;EACF,SAAS,EAAE,MAAM,wBAAwB;EACzC,SAAS,EACP,OAAO,CACL;GAAE,MAAM;GAAQ,UAAU;GAAM,KAAK;GAAG,KAAK;GAAI,OAAO;GAAW,aAAa;GAAiB,EACjG;GACE,MAAM;GACN,UAAU;GACV,KAAK;GACL,SAAS,CAAC,OAAO,SAAS;GAC1B,aAAa;GACd,CACF,EACF;EACD,YAAY,gBAAgB;GAAE,YAAY;GAAQ,SAAS;GAAK,CAAC;EAClE;CACF;AAED,MAAaA,0BAAwD,UAAU,cAAc;AAE7F,SAAgB,0BAA0B,OAAkD;AAC1F,QAAO,UAAU,cAAc,MAAM,gBAAgB,YAAY,UAAU,MAAM,IAAI,KAAK;;AAG5F,SAAgB,8BAA4D;AAC1E,QAAO,UAAU,cAAc"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"builtins-BuI-rf8X.d.ts","names":[],"sources":["../src/types.ts","../src/builtins.ts"],"sourcesContent":[],"mappings":";cAAa;AAAA,KAED,g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slugifyFileName, i as cloneJson, l as MODEL_SCHEMA, n as getBuiltinGenerationModel, r as listBuiltinGenerationModels } from "./builtins-B1AheaEa.js";
2
- import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
3
- import { extname, join } from "node:path";
4
- import { parse, stringify } from "yaml";
5
-
6
- //#region src/errors.ts
7
- var GenerationError = class extends Error {
8
- constructor(message) {
9
- super(message);
10
- this.name = "GenerationError";
11
- }
12
- };
13
- var GenerationConfigError = class extends GenerationError {
14
- constructor(message) {
15
- super(message);
16
- this.name = "GenerationConfigError";
17
- }
18
- };
19
- var GenerationValidationError = class extends GenerationError {
20
- constructor(message) {
21
- super(message);
22
- this.name = "GenerationValidationError";
23
- }
24
- };
25
- var GenerationUnsupportedAdapterError = class extends GenerationError {
26
- constructor(adapterType) {
27
- super(`Unsupported generation adapter: ${adapterType}`);
28
- this.name = "GenerationUnsupportedAdapterError";
29
- }
30
- };
31
- var GenerationProviderError = class extends GenerationError {
32
- status;
33
- body;
34
- details;
35
- constructor(message = "Generation provider request failed", options) {
36
- super(message);
37
- this.name = "GenerationProviderError";
38
- this.status = options?.status;
39
- this.body = options?.body;
40
- this.details = options?.details;
41
- }
42
- };
43
- var GenerationTimeoutError = class extends GenerationProviderError {
44
- constructor(message = "Generation request timed out", details) {
45
- super(message, details ? { details } : void 0);
46
- this.name = "GenerationTimeoutError";
47
- }
48
- };
49
-
50
- //#endregion
51
- //#region src/config.ts
52
- const DECLARATION_EXTENSIONS = new Set([
53
- ".yaml",
54
- ".yml",
55
- ".json"
56
- ]);
57
- function isRecord(value) {
58
- return !!value && typeof value === "object" && !Array.isArray(value);
59
- }
60
- function isParameterSpec(value) {
61
- if (!isRecord(value)) return false;
62
- return [
63
- "string",
64
- "number",
65
- "integer",
66
- "boolean"
67
- ].includes(String(value.type));
68
- }
69
- function isGenerationModelDeclaration(value) {
70
- if (!isRecord(value)) return false;
71
- const adapter = value.adapter;
72
- const content = value.content;
73
- const parameters = value.parameters;
74
- const examples = value.examples;
75
- return value.schema === MODEL_SCHEMA && typeof value.model === "string" && value.model.trim().length > 0 && isRecord(adapter) && typeof adapter.type === "string" && isRecord(content) && Array.isArray(content.input) && (parameters === void 0 || isRecord(parameters) && Object.values(parameters).every(isParameterSpec)) && (examples === void 0 || Array.isArray(examples));
76
- }
77
- function parseGenerationModelDeclaration(rawText, filePath = "model.yaml") {
78
- const parsed = extname(filePath) === ".json" ? JSON.parse(rawText) : parse(rawText);
79
- if (!isGenerationModelDeclaration(parsed)) throw new GenerationConfigError(`Invalid model declaration: ${filePath}`);
80
- return parsed;
81
- }
82
- function stringifyGenerationModelDeclaration(declaration, options = {}) {
83
- const value = cloneJson(declaration);
84
- if (options.format === "json") return `${JSON.stringify(value, null, 2)}\n`;
85
- return stringify(value, { lineWidth: 120 });
86
- }
87
- async function readGenerationModelDeclaration(filePath) {
88
- return parseGenerationModelDeclaration(await readFile(filePath, "utf-8"), filePath);
89
- }
90
- async function readGenerationModelDeclarationsFromFiles(filePaths) {
91
- return mergeGenerationModelDeclarations(await Promise.all(filePaths.map((filePath) => readGenerationModelDeclaration(filePath))));
92
- }
93
- async function readGenerationModelDeclarationsFromDirectory(directory) {
94
- return readGenerationModelDeclarationsFromFiles((await readdir(directory)).filter((entry) => DECLARATION_EXTENSIONS.has(extname(entry))).sort().map((entry) => join(directory, entry)));
95
- }
96
- function mergeGenerationModelDeclarations(declarations) {
97
- const byModel = /* @__PURE__ */ new Map();
98
- for (const declaration of declarations) byModel.set(declaration.model, declaration);
99
- return [...byModel.values()].sort((a, b) => a.model.localeCompare(b.model));
100
- }
101
- async function writeGenerationModelDeclaration(declaration, filePath, options = {}) {
102
- await writeFile(filePath, stringifyGenerationModelDeclaration(declaration, options));
103
- }
104
- async function writeGenerationModelDeclarations(declarations, directory, options = {}) {
105
- await mkdir(directory, { recursive: true });
106
- const ext = options.format === "json" ? "json" : "yaml";
107
- await Promise.all(declarations.map((declaration) => writeGenerationModelDeclaration(declaration, join(directory, `${slugifyFileName(declaration.model)}.${ext}`), options)));
108
- }
109
-
110
- //#endregion
111
- //#region src/export-config.ts
112
- function stringifyBuiltinModelConfig(model, options = {}) {
113
- const declaration = getBuiltinGenerationModel(model);
114
- if (!declaration) throw new GenerationConfigError(`Built-in model is unavailable: ${model}`);
115
- return stringifyGenerationModelDeclaration(declaration, options);
116
- }
117
- async function exportBuiltinModelConfig(model, filePath) {
118
- const declaration = getBuiltinGenerationModel(model);
119
- if (!declaration) throw new GenerationConfigError(`Built-in model is unavailable: ${model}`);
120
- await writeGenerationModelDeclaration(declaration, filePath);
121
- }
122
- async function exportBuiltinModelConfigs(directory) {
123
- await writeGenerationModelDeclarations(listBuiltinGenerationModels(), directory);
124
- }
125
-
126
- //#endregion
127
- export { GenerationUnsupportedAdapterError as _, mergeGenerationModelDeclarations as a, readGenerationModelDeclarationsFromDirectory as c, writeGenerationModelDeclaration as d, writeGenerationModelDeclarations as f, GenerationTimeoutError as g, GenerationProviderError as h, isGenerationModelDeclaration as i, readGenerationModelDeclarationsFromFiles as l, GenerationError as m, exportBuiltinModelConfigs as n, parseGenerationModelDeclaration as o, GenerationConfigError as p, stringifyBuiltinModelConfig as r, readGenerationModelDeclaration as s, exportBuiltinModelConfig as t, stringifyGenerationModelDeclaration as u, GenerationValidationError as v };
128
- //# sourceMappingURL=export-config-Bwqnn7Vs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"export-config-Bwqnn7Vs.js","names":["parseYaml","stringifyYaml"],"sources":["../src/errors.ts","../src/config.ts","../src/export-config.ts"],"sourcesContent":["export class GenerationError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"GenerationError\";\n }\n}\n\nexport class GenerationConfigError extends GenerationError {\n constructor(message: string) {\n super(message);\n this.name = \"GenerationConfigError\";\n }\n}\n\nexport class GenerationValidationError extends GenerationError {\n constructor(message: string) {\n super(message);\n this.name = \"GenerationValidationError\";\n }\n}\n\nexport class GenerationUnsupportedAdapterError extends GenerationError {\n constructor(adapterType: string) {\n super(`Unsupported generation adapter: ${adapterType}`);\n this.name = \"GenerationUnsupportedAdapterError\";\n }\n}\n\nexport class GenerationProviderError extends GenerationError {\n readonly status: number | undefined;\n readonly body: string | undefined;\n readonly details: Record<string, unknown> | undefined;\n\n constructor(\n message = \"Generation provider request failed\",\n options?: { status?: number; body?: string; details?: Record<string, unknown> },\n ) {\n super(message);\n this.name = \"GenerationProviderError\";\n this.status = options?.status;\n this.body = options?.body;\n this.details = options?.details;\n }\n}\n\nexport class GenerationTimeoutError extends GenerationProviderError {\n constructor(message = \"Generation request timed out\", details?: Record<string, unknown>) {\n super(message, details ? { details } : undefined);\n this.name = \"GenerationTimeoutError\";\n }\n}\n","import { mkdir, readdir, readFile, writeFile } from \"node:fs/promises\";\nimport { extname, join } from \"node:path\";\nimport { parse as parseYaml, stringify as stringifyYaml } from \"yaml\";\nimport { GenerationConfigError } from \"./errors.js\";\nimport { type GenerationModelDeclaration, MODEL_SCHEMA } from \"./types.js\";\nimport { cloneJson, slugifyFileName } from \"./utils.js\";\n\nconst DECLARATION_EXTENSIONS = new Set([\".yaml\", \".yml\", \".json\"]);\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction isParameterSpec(value: unknown): boolean {\n if (!isRecord(value)) return false;\n return [\"string\", \"number\", \"integer\", \"boolean\"].includes(String(value.type));\n}\n\nexport function isGenerationModelDeclaration(value: unknown): value is GenerationModelDeclaration {\n if (!isRecord(value)) return false;\n const adapter = value.adapter;\n const content = value.content;\n const parameters = value.parameters;\n const examples = value.examples;\n return (\n value.schema === MODEL_SCHEMA &&\n typeof value.model === \"string\" &&\n value.model.trim().length > 0 &&\n isRecord(adapter) &&\n typeof adapter.type === \"string\" &&\n isRecord(content) &&\n Array.isArray(content.input) &&\n (parameters === undefined || (isRecord(parameters) && Object.values(parameters).every(isParameterSpec))) &&\n (examples === undefined || Array.isArray(examples))\n );\n}\n\nexport function parseGenerationModelDeclaration(rawText: string, filePath = \"model.yaml\"): GenerationModelDeclaration {\n const parsed = extname(filePath) === \".json\" ? JSON.parse(rawText) : parseYaml(rawText);\n if (!isGenerationModelDeclaration(parsed)) throw new GenerationConfigError(`Invalid model declaration: ${filePath}`);\n return parsed;\n}\n\nexport function stringifyGenerationModelDeclaration(\n declaration: GenerationModelDeclaration,\n options: { format?: \"yaml\" | \"json\" } = {},\n): string {\n const value = cloneJson(declaration);\n if (options.format === \"json\") return `${JSON.stringify(value, null, 2)}\\n`;\n return stringifyYaml(value, { lineWidth: 120 });\n}\n\nexport async function readGenerationModelDeclaration(filePath: string): Promise<GenerationModelDeclaration> {\n return parseGenerationModelDeclaration(await readFile(filePath, \"utf-8\"), filePath);\n}\n\nexport async function readGenerationModelDeclarationsFromFiles(\n filePaths: string[],\n): Promise<GenerationModelDeclaration[]> {\n const declarations = await Promise.all(filePaths.map((filePath) => readGenerationModelDeclaration(filePath)));\n return mergeGenerationModelDeclarations(declarations);\n}\n\nexport async function readGenerationModelDeclarationsFromDirectory(\n directory: string,\n): Promise<GenerationModelDeclaration[]> {\n const entries = await readdir(directory);\n const files = entries\n .filter((entry) => DECLARATION_EXTENSIONS.has(extname(entry)))\n .sort()\n .map((entry) => join(directory, entry));\n return readGenerationModelDeclarationsFromFiles(files);\n}\n\nexport function mergeGenerationModelDeclarations(\n declarations: GenerationModelDeclaration[],\n): GenerationModelDeclaration[] {\n const byModel = new Map<string, GenerationModelDeclaration>();\n for (const declaration of declarations) byModel.set(declaration.model, declaration);\n return [...byModel.values()].sort((a, b) => a.model.localeCompare(b.model));\n}\n\nexport async function writeGenerationModelDeclaration(\n declaration: GenerationModelDeclaration,\n filePath: string,\n options: { format?: \"yaml\" | \"json\" } = {},\n): Promise<void> {\n await writeFile(filePath, stringifyGenerationModelDeclaration(declaration, options));\n}\n\nexport async function writeGenerationModelDeclarations(\n declarations: GenerationModelDeclaration[],\n directory: string,\n options: { format?: \"yaml\" | \"json\" } = {},\n): Promise<void> {\n await mkdir(directory, { recursive: true });\n const ext = options.format === \"json\" ? \"json\" : \"yaml\";\n await Promise.all(\n declarations.map((declaration) =>\n writeGenerationModelDeclaration(\n declaration,\n join(directory, `${slugifyFileName(declaration.model)}.${ext}`),\n options,\n ),\n ),\n );\n}\n","import { getBuiltinGenerationModel, listBuiltinGenerationModels } from \"./builtins.js\";\nimport {\n stringifyGenerationModelDeclaration,\n writeGenerationModelDeclaration,\n writeGenerationModelDeclarations,\n} from \"./config.js\";\nimport { GenerationConfigError } from \"./errors.js\";\n\nexport function stringifyBuiltinModelConfig(model: string, options: { format?: \"yaml\" | \"json\" } = {}): string {\n const declaration = getBuiltinGenerationModel(model);\n if (!declaration) throw new GenerationConfigError(`Built-in model is unavailable: ${model}`);\n return stringifyGenerationModelDeclaration(declaration, options);\n}\n\nexport async function exportBuiltinModelConfig(model: string, filePath: string): Promise<void> {\n const declaration = getBuiltinGenerationModel(model);\n if (!declaration) throw new GenerationConfigError(`Built-in model is unavailable: ${model}`);\n await writeGenerationModelDeclaration(declaration, filePath);\n}\n\nexport async function exportBuiltinModelConfigs(directory: string): Promise<void> {\n await writeGenerationModelDeclarations(listBuiltinGenerationModels(), directory);\n}\n"],"mappings":";;;;;;AAAA,IAAa,kBAAb,cAAqC,MAAM;CACzC,YAAY,SAAiB;AAC3B,QAAM,QAAQ;AACd,OAAK,OAAO;;;AAIhB,IAAa,wBAAb,cAA2C,gBAAgB;CACzD,YAAY,SAAiB;AAC3B,QAAM,QAAQ;AACd,OAAK,OAAO;;;AAIhB,IAAa,4BAAb,cAA+C,gBAAgB;CAC7D,YAAY,SAAiB;AAC3B,QAAM,QAAQ;AACd,OAAK,OAAO;;;AAIhB,IAAa,oCAAb,cAAuD,gBAAgB;CACrE,YAAY,aAAqB;AAC/B,QAAM,mCAAmC,cAAc;AACvD,OAAK,OAAO;;;AAIhB,IAAa,0BAAb,cAA6C,gBAAgB;CAC3D,AAAS;CACT,AAAS;CACT,AAAS;CAET,YACE,UAAU,sCACV,SACA;AACA,QAA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,4BAA4B,OAAe,UAAwC,EAAE,EAAU;CAC7G,MAAM,cAAc,0BAA0B,MAAM;AACpD,KAAI,CAAC,YAAa,OAAM,IAAI,sBAAsB,kCAAkC,QAAQ;AAC5F,QAAO,oCAAoC,aAAa,QAAQ;;AAGlE,eAAsB,yBAAyB,OAAe,UAAiC;CAC7F,MAAM,cAAc,0BAA0B,MAAM;AACpD,KAAI,CAAC,YAAa,OAAM,IAAI,sBAAsB,kCAAkC,QAAQ;AAC5F,OAAM,gCAAgC,aAAa,SAAS;;AAG9D,eAAsB,0BAA0B,WAAkC;AAChF,OAAM,iCAAiC,6BAA6B,EAAE,UAAU"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["resolved: Record<string, unknown>","REQUEST_TIMEOUT_MS","RESOLUTION_SHORT_EDGE: Record<string, number>","ASPECT_RATIOS: Record<string, [number, number] | null>","content: Array<Record<string, unknown>>","metadata: Record<string, unknown>","payload: Record<string, unknown>","output: GenerationContentBlock[]","REQUEST_TIMEOUT_MS","generationConfig: Record<string, unknown>","image: Record<string, string>","output: GenerationContentBlock[]","payload: Record<string, unknown>","output: GenerationContentBlock[]","builtinGenerationAdapters: Record<string, GenerationAdapter>","defaultGenerationSourceResolver: GenerationSourceResolver"],"sources":["../src/http.ts","../src/validation.ts","../src/adapters/ark-video-generations.ts","../src/adapters/gemini-generate-content.ts","../src/adapters/openai-images.ts","../src/adapters/index.ts","../src/source.ts","../src/client.ts"],"sourcesContent":["import { GenerationTimeoutError } from \"./errors.js\";\n\nexport async function fetchWithTimeout(\n fetchFn: typeof fetch,\n url: string,\n init: RequestInit,\n timeoutMs: number,\n): Promise<Response> {\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), timeoutMs);\n try {\n return await fetchFn(url, { ...init, signal: controller.signal });\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") throw new GenerationTimeoutError();\n throw error;\n } finally {\n clearTimeout(timeout);\n }\n}\n\nexport function joinUrl(baseUrl: string, path: string): string {\n return `${baseUrl.replace(/\\/+$/, \"\")}/${path.replace(/^\\/+/, \"\")}`;\n}\n","import { GenerationValidationError } from \"./errors.js\";\nimport type { GenerationContentBlock, GenerationContentSpec, GenerationModelDeclaration } from \"./types.js\";\n\nfunction specsByType(specs: GenerationContentSpec[]) {\n const map = new Map<GenerationContentSpec[\"type\"], GenerationContentSpec>();\n for (const spec of specs) map.set(spec.type, spec);\n return map;\n}\n\nexport function validateGenerationContent(\n declaration: GenerationModelDeclaration,\n content: GenerationContentBlock[],\n): void {\n const inputSpecs = specsByType(declaration.content.input);\n const counts = new Map<GenerationContentSpec[\"type\"], number>();\n\n for (const block of content) {\n const spec = inputSpecs.get(block.type);\n if (!spec)\n throw new GenerationValidationError(`Content block type is not supported by ${declaration.model}: ${block.type}`);\n counts.set(block.type, (counts.get(block.type) ?? 0) + 1);\n\n if (\"source\" in block && spec.sources && !spec.sources.includes(block.source.type)) {\n throw new GenerationValidationError(\n `${block.type} source is not supported by ${declaration.model}: ${block.source.type}`,\n );\n }\n }\n\n for (const spec of declaration.content.input) {\n const count = counts.get(spec.type) ?? 0;\n if (spec.required && count === 0)\n throw new GenerationValidationError(`Missing required ${spec.type} content block`);\n if (spec.min !== undefined && count < spec.min)\n throw new GenerationValidationError(`Expected at least ${spec.min} ${spec.type} content block(s)`);\n if (spec.max !== undefined && count > spec.max)\n throw new GenerationValidationError(`Expected at most ${spec.max} ${spec.type} content block(s)`);\n }\n}\n\nexport function resolveGenerationParameters(\n declaration: GenerationModelDeclaration,\n parameters: Record<string, unknown> | undefined,\n): Record<string, unknown> {\n const specs = declaration.parameters ?? {};\n const resolved: Record<string, unknown> = {};\n\n for (const key of Object.keys(parameters ?? {})) {\n if (!specs[key]) throw new GenerationValidationError(`Unknown parameter: ${key}`);\n }\n\n for (const [key, spec] of Object.entries(specs)) {\n const value = parameters?.[key];\n if (value === undefined) {\n if (spec.default !== undefined) resolved[key] = spec.default;\n else if (!spec.optional) throw new GenerationValidationError(`Missing required parameter: ${key}`);\n continue;\n }\n\n switch (spec.type) {\n case \"string\":\n if (typeof value !== \"string\") throw new GenerationValidationError(`Parameter ${key} must be a string`);\n if (spec.enum && !spec.enum.includes(value))\n throw new GenerationValidationError(`Parameter ${key} must be one of: ${spec.enum.join(\", \")}`);\n break;\n case \"number\":\n if (typeof value !== \"number\" || !Number.isFinite(value))\n throw new GenerationValidationError(`Parameter ${key} must be a number`);\n if (spec.min !== undefined && value < spec.min)\n throw new GenerationValidationError(`Parameter ${key} must be >= ${spec.min}`);\n if (spec.max !== undefined && value > spec.max)\n throw new GenerationValidationError(`Parameter ${key} must be <= ${spec.max}`);\n break;\n case \"integer\":\n if (typeof value !== \"number\" || !Number.isInteger(value))\n throw new GenerationValidationError(`Parameter ${key} must be an integer`);\n if (spec.min !== undefined && value < spec.min)\n throw new GenerationValidationError(`Parameter ${key} must be >= ${spec.min}`);\n if (spec.max !== undefined && value > spec.max)\n throw new GenerationValidationError(`Parameter ${key} must be <= ${spec.max}`);\n break;\n case \"boolean\":\n if (typeof value !== \"boolean\") throw new GenerationValidationError(`Parameter ${key} must be a boolean`);\n break;\n }\n resolved[key] = value;\n }\n\n return resolved;\n}\n\nexport function mergeTextBlocks(declaration: GenerationModelDeclaration, content: GenerationContentBlock[]): string {\n const textSpec = declaration.content.input.find((spec) => spec.type === \"text\");\n const separator = textSpec?.merge === \"space\" ? \" \" : textSpec?.merge === \"concat\" ? \"\" : \"\\n\";\n return content\n .filter((block): block is Extract<GenerationContentBlock, { type: \"text\" }> => block.type === \"text\")\n .map((block) => block.text)\n .join(separator)\n .trim();\n}\n","import { GenerationProviderError, GenerationTimeoutError, GenerationValidationError } from \"../errors.js\";\nimport { fetchWithTimeout, joinUrl } from \"../http.js\";\nimport type { GenerationAdapterInput, GenerationContentBlock } from \"../types.js\";\nimport { compactObject, getBlockMeta } from \"../utils.js\";\nimport { mergeTextBlocks } from \"../validation.js\";\n\nconst REQUEST_TIMEOUT_MS = 60_000;\nconst DEFAULT_POLL_INTERVAL_SEC = 2;\nconst DEFAULT_MAX_WAIT_SEC = 600;\n\nconst RESOLUTION_SHORT_EDGE: Record<string, number> = {\n \"480p\": 480,\n \"720p\": 720,\n \"1080p\": 1080,\n \"2K\": 1440,\n};\n\nconst ASPECT_RATIOS: Record<string, [number, number] | null> = {\n \"16:9\": [16, 9],\n \"9:16\": [9, 16],\n \"1:1\": [1, 1],\n \"4:3\": [4, 3],\n \"3:2\": [3, 2],\n \"2:3\": [2, 3],\n \"3:4\": [3, 4],\n \"21:9\": [21, 9],\n adaptive: null,\n};\n\ntype ArkCreateTaskResponse = { id?: unknown; task_id?: unknown; status?: unknown };\n\ntype ArkTaskStatusResponse = {\n data?: {\n task_id?: unknown;\n status?: unknown;\n result_url?: unknown;\n progress?: unknown;\n data?: {\n status?: unknown;\n content?: { video_url?: unknown; last_frame_url?: unknown };\n resolution?: unknown;\n ratio?: unknown;\n duration?: unknown;\n framespersecond?: unknown;\n seed?: unknown;\n generate_audio?: unknown;\n model?: unknown;\n usage?: unknown;\n };\n };\n status?: unknown;\n url?: unknown;\n last_frame_url?: unknown;\n metadata?: unknown;\n};\n\ntype ImageMode = \"image\" | \"frame\" | \"reference\";\ntype ResolvedImage = { url: string; role: string | undefined };\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nfunction asString(value: unknown): string | undefined {\n return typeof value === \"string\" && value ? value : undefined;\n}\n\nfunction asNumber(value: unknown): number | undefined {\n return typeof value === \"number\" && Number.isFinite(value) ? value : undefined;\n}\n\nfunction asBoolean(value: unknown): boolean | undefined {\n return typeof value === \"boolean\" ? value : undefined;\n}\n\nfunction getIntegerParameter(parameters: Record<string, unknown>, key: string, fallback: number): number {\n const value = parameters[key];\n return typeof value === \"number\" && Number.isInteger(value) ? value : fallback;\n}\n\nfunction resolveSize(resolution: string, aspectRatio: string): { width: number; height: number } | null {\n const ratio = ASPECT_RATIOS[aspectRatio];\n if (!ratio) return null;\n\n const shortEdge = RESOLUTION_SHORT_EDGE[resolution];\n if (!shortEdge) throw new GenerationValidationError(`Unsupported resolution: ${resolution}`);\n\n const [wRatio, hRatio] = ratio;\n const width = wRatio >= hRatio ? Math.round((shortEdge * wRatio) / hRatio) : shortEdge;\n const height = wRatio >= hRatio ? shortEdge : Math.round((shortEdge * hRatio) / wRatio);\n return { width: width % 2 === 0 ? width : width + 1, height: height % 2 === 0 ? height : height + 1 };\n}\n\nfunction getImageRole(block: Extract<GenerationContentBlock, { type: \"image\" }>): string | undefined {\n const role = getBlockMeta(block)?.role;\n return typeof role === \"string\" && role ? role : undefined;\n}\n\nfunction classifyImages(images: ResolvedImage[]): ImageMode | null {\n if (images.length === 0) return null;\n const hasFirstOrLast = images.some((image) => image.role === \"first_frame\" || image.role === \"last_frame\");\n const hasReference = images.some((image) => image.role === \"reference_image\");\n const hasPlain = images.some((image) => !image.role);\n const modes = [hasPlain, hasFirstOrLast, hasReference].filter(Boolean).length;\n if (modes > 1)\n throw new GenerationValidationError(\n \"Cannot mix video image modes: use only plain image, first_frame/last_frame, or reference_image\",\n );\n if (hasReference) return \"reference\";\n if (hasFirstOrLast) return \"frame\";\n return \"image\";\n}\n\nfunction buildMetadataContent(prompt: string, images: ResolvedImage[], mode: Exclude<ImageMode, \"image\">) {\n const content: Array<Record<string, unknown>> = [{ type: \"text\", text: prompt }];\n for (const image of images) {\n if (mode === \"frame\" && image.role !== \"first_frame\" && image.role !== \"last_frame\") {\n throw new GenerationValidationError(\"Frame mode images must use meta.role first_frame or last_frame\");\n }\n if (mode === \"reference\" && image.role !== \"reference_image\") {\n throw new GenerationValidationError(\"Reference mode images must use meta.role reference_image\");\n }\n content.push({ type: \"image_url\", image_url: { url: image.url }, role: image.role });\n }\n return content;\n}\n\nfunction extractTaskId(response: ArkCreateTaskResponse): string {\n const taskId = asString(response.task_id) ?? asString(response.id);\n if (!taskId) {\n throw new GenerationProviderError(\"Video generation provider did not return a task id\", {\n details: { response },\n });\n }\n return taskId;\n}\n\nfunction normalizeTaskStatus(response: ArkTaskStatusResponse) {\n if (response.data) {\n const wrapper = response.data;\n const native = wrapper.data;\n const status = (asString(native?.status) ?? asString(wrapper.status) ?? \"unknown\").toLowerCase();\n const videoUrl = asString(wrapper.result_url) ?? asString(native?.content?.video_url);\n const lastFrameUrl = asString(native?.content?.last_frame_url);\n const metadata: Record<string, unknown> = {\n progress: wrapper.progress,\n resolution: native?.resolution,\n ratio: native?.ratio,\n duration: native?.duration,\n framespersecond: native?.framespersecond,\n seed: native?.seed,\n generate_audio: native?.generate_audio,\n model: native?.model,\n usage: native?.usage,\n };\n for (const key of Object.keys(metadata)) if (metadata[key] === undefined) delete metadata[key];\n return { status, videoUrl, lastFrameUrl, metadata };\n }\n return {\n status: (asString(response.status) ?? \"unknown\").toLowerCase(),\n videoUrl: asString(response.url),\n lastFrameUrl: asString(response.last_frame_url),\n metadata:\n response.metadata && typeof response.metadata === \"object\" ? (response.metadata as Record<string, unknown>) : {},\n };\n}\n\nasync function requestJson(input: GenerationAdapterInput, path: string, init: RequestInit): Promise<unknown> {\n const response = await fetchWithTimeout(\n input.context.fetch,\n joinUrl(input.context.baseUrl, path),\n {\n ...init,\n headers: {\n Authorization: `Bearer ${input.context.apiKey}`,\n \"Content-Type\": \"application/json\",\n ...init.headers,\n },\n },\n REQUEST_TIMEOUT_MS,\n );\n\n if (!response.ok) {\n const body = await response.text().catch(() => response.statusText);\n throw new GenerationProviderError(\"Video generation provider request failed\", { status: response.status, body });\n }\n return response.json();\n}\n\nexport async function arkVideoGenerationsAdapter(input: GenerationAdapterInput): Promise<GenerationContentBlock[]> {\n const prompt = mergeTextBlocks(input.declaration, input.request.content);\n if (!prompt) throw new GenerationValidationError(\"Prompt text is required\");\n\n const imageBlocks = input.request.content.filter(\n (block): block is Extract<GenerationContentBlock, { type: \"image\" }> => block.type === \"image\",\n );\n const images = await Promise.all(\n imageBlocks.map(async (block) => ({\n url: await input.context.resolveSource(block.source),\n role: getImageRole(block),\n })),\n );\n\n const mode = classifyImages(images);\n const resolution = asString(input.parameters.resolution) ?? \"720p\";\n const aspectRatio = asString(input.parameters.aspect_ratio) ?? \"16:9\";\n const duration = getIntegerParameter(input.parameters, \"duration\", 5);\n const fps = getIntegerParameter(input.parameters, \"fps\", 30);\n const pollIntervalSec = getIntegerParameter(input.parameters, \"poll_interval\", DEFAULT_POLL_INTERVAL_SEC);\n const maxWaitSec = getIntegerParameter(input.parameters, \"max_wait\", DEFAULT_MAX_WAIT_SEC);\n const generateAudio = asBoolean(input.parameters.generate_audio) ?? true;\n const returnLastFrame = asBoolean(input.parameters.return_last_frame) ?? true;\n const cameraFixed = asBoolean(input.parameters.camera_fixed) ?? false;\n const watermark = asBoolean(input.parameters.watermark) ?? false;\n const seed = asNumber(input.parameters.seed);\n\n const payload: Record<string, unknown> = { model: input.declaration.model, prompt };\n const metadata: Record<string, unknown> = { duration, fps, generate_audio: generateAudio };\n if (seed !== undefined) metadata.seed = seed;\n if (returnLastFrame) metadata.return_last_frame = true;\n if (cameraFixed) metadata.camera_fixed = true;\n if (watermark) metadata.watermark = true;\n\n if (mode === \"frame\" || mode === \"reference\") {\n metadata.content = buildMetadataContent(prompt, images, mode);\n metadata.resolution = resolution;\n metadata.ratio = aspectRatio;\n } else {\n const size = resolveSize(resolution, aspectRatio);\n if (size) {\n payload.width = size.width;\n payload.height = size.height;\n }\n if (images[0]) payload.image = images[0].url;\n }\n payload.metadata = metadata;\n\n const task = (await requestJson(input, \"/v1/video/generations\", {\n method: \"POST\",\n body: JSON.stringify(payload),\n })) as ArkCreateTaskResponse;\n const taskId = extractTaskId(task);\n const startedAt = Date.now();\n\n while (Date.now() - startedAt <= maxWaitSec * 1000) {\n await sleep(pollIntervalSec * 1000);\n const rawStatus = (await requestJson(input, `/v1/video/generations/${encodeURIComponent(taskId)}`, {\n method: \"GET\",\n })) as ArkTaskStatusResponse;\n const status = normalizeTaskStatus(rawStatus);\n\n if (status.status === \"succeeded\") {\n if (!status.videoUrl) {\n throw new GenerationProviderError(\"Video generation succeeded but returned no video URL\", {\n details: compactObject({ taskId, rawStatus, metadata: status.metadata }),\n });\n }\n const output: GenerationContentBlock[] = [\n {\n type: \"video\",\n source: { type: \"url\", url: status.videoUrl },\n meta: { task_id: taskId, status: status.status, ...status.metadata },\n },\n ];\n if (status.lastFrameUrl)\n output.push({\n type: \"image\",\n source: { type: \"url\", url: status.lastFrameUrl },\n meta: { role: \"last_frame\", task_id: taskId },\n });\n return output;\n }\n\n if ([\"failed\", \"expired\", \"cancelled\"].includes(status.status)) {\n throw new GenerationProviderError(`Video generation ${status.status}`, { details: { taskId, rawStatus } });\n }\n }\n\n throw new GenerationTimeoutError(\"Timed out waiting for video generation\", { taskId });\n}\n","import { GenerationProviderError, GenerationValidationError } from \"../errors.js\";\nimport { fetchWithTimeout, joinUrl } from \"../http.js\";\nimport type { GenerationAdapterInput, GenerationContentBlock } from \"../types.js\";\nimport { compactArray, compactObject } from \"../utils.js\";\nimport { mergeTextBlocks } from \"../validation.js\";\n\nconst REQUEST_TIMEOUT_MS = 300_000;\nconst IMAGE_FETCH_TIMEOUT_MS = 60_000;\nconst MAX_REFERENCE_IMAGE_BYTES = 10 * 1024 * 1024;\n\nconst DATA_URI_PATTERN = /^data:([^;]+);base64,(.+)$/s;\nconst MARKDOWN_IMAGE_DATA_URI_PATTERN = /!\\[[^\\]]*\\]\\(data:([^;]+);base64,([^)]+)\\)/;\n\ntype GeminiPart = { text: string } | { inlineData: { mimeType: string; data: string } };\n\ntype GeminiResponsePart = {\n text?: unknown;\n inlineData?: { mimeType?: unknown; data?: unknown };\n inline_data?: { mime_type?: unknown; mimeType?: unknown; data?: unknown };\n};\n\ntype GeminiCandidate = {\n content?: { role?: unknown; parts?: GeminiResponsePart[] };\n finishReason?: unknown;\n finishMessage?: unknown;\n safetyRatings?: unknown;\n citationMetadata?: unknown;\n groundingMetadata?: unknown;\n avgLogprobs?: unknown;\n index?: unknown;\n};\n\ntype GeminiGenerateContentResponse = {\n candidates?: GeminiCandidate[];\n promptFeedback?: unknown;\n usageMetadata?: unknown;\n modelVersion?: unknown;\n responseId?: unknown;\n};\n\nfunction dataUriToInlineData(value: string): GeminiPart | null {\n const match = DATA_URI_PATTERN.exec(value);\n if (!match) return null;\n const [, mimeType, data] = match;\n if (!mimeType || !data) return null;\n return { inlineData: { mimeType, data } };\n}\n\nasync function urlToInlineData(fetchFn: typeof fetch, url: string): Promise<GeminiPart> {\n const response = await fetchWithTimeout(\n fetchFn,\n url,\n { method: \"GET\", headers: { \"User-Agent\": \"NetaGeneration/1.0\" } },\n IMAGE_FETCH_TIMEOUT_MS,\n );\n if (!response.ok) throw new GenerationProviderError(\"Failed to fetch reference image\", { status: response.status });\n\n const contentLength = response.headers.get(\"content-length\");\n if (contentLength && Number(contentLength) > MAX_REFERENCE_IMAGE_BYTES) {\n throw new GenerationValidationError(\"Reference image is too large\");\n }\n\n const bytes = Buffer.from(await response.arrayBuffer());\n if (bytes.byteLength > MAX_REFERENCE_IMAGE_BYTES) throw new GenerationValidationError(\"Reference image is too large\");\n\n const contentType = response.headers.get(\"content-type\")?.split(\";\")[0]?.trim();\n const mimeType = contentType?.startsWith(\"image/\") ? contentType : \"image/png\";\n return { inlineData: { mimeType, data: bytes.toString(\"base64\") } };\n}\n\nasync function sourceToInlineData(input: GenerationAdapterInput, value: string): Promise<GeminiPart> {\n const inline = dataUriToInlineData(value);\n if (inline) return inline;\n if (value.startsWith(\"http://\") || value.startsWith(\"https://\")) return urlToInlineData(input.context.fetch, value);\n throw new GenerationValidationError(\"Unsupported image source for Gemini image generation\");\n}\n\nfunction extractMarkdownDataUriImage(text: string): GenerationContentBlock | null {\n const match = MARKDOWN_IMAGE_DATA_URI_PATTERN.exec(text);\n if (!match) return null;\n const [, mediaType, data] = match;\n if (!mediaType || !data) return null;\n return { type: \"image\", source: { type: \"base64\", mediaType, data } };\n}\n\nfunction collectGeminiNoOutputDetails(raw: GeminiGenerateContentResponse): Record<string, unknown> {\n const candidates = raw.candidates ?? [];\n return compactObject({\n finishReasons: compactArray(\n candidates.map((candidate) => candidate.finishReason).filter((value) => value !== undefined),\n ),\n finishMessages: compactArray(\n candidates.map((candidate) => candidate.finishMessage).filter((value) => value !== undefined),\n ),\n safetyRatings: compactArray(candidates.flatMap((candidate) => candidate.safetyRatings ?? [])),\n promptFeedback: raw.promptFeedback,\n usageMetadata: raw.usageMetadata,\n modelVersion: raw.modelVersion,\n responseId: raw.responseId,\n candidateCount: candidates.length,\n candidates: compactArray(\n candidates.map((candidate) =>\n compactObject({\n index: candidate.index,\n finishReason: candidate.finishReason,\n finishMessage: candidate.finishMessage,\n safetyRatings: candidate.safetyRatings,\n citationMetadata: candidate.citationMetadata,\n groundingMetadata: candidate.groundingMetadata,\n avgLogprobs: candidate.avgLogprobs,\n contentRole: candidate.content?.role,\n partCount: candidate.content?.parts?.length,\n }),\n ),\n ),\n });\n}\n\nfunction appendGeminiPartOutput(output: GenerationContentBlock[], part: GeminiResponsePart): void {\n if (typeof part.text === \"string\" && part.text.trim()) {\n const image = extractMarkdownDataUriImage(part.text);\n if (image) {\n output.push(image);\n return;\n }\n output.push({ type: \"text\", text: part.text });\n return;\n }\n\n if (part.inlineData && typeof part.inlineData.data === \"string\" && part.inlineData.data) {\n output.push({\n type: \"image\",\n source: {\n type: \"base64\",\n mediaType: typeof part.inlineData.mimeType === \"string\" ? part.inlineData.mimeType : \"image/png\",\n data: part.inlineData.data,\n },\n });\n return;\n }\n\n const inline = part.inline_data;\n if (!inline || typeof inline.data !== \"string\" || !inline.data) return;\n const mediaType =\n typeof inline.mime_type === \"string\"\n ? inline.mime_type\n : typeof inline.mimeType === \"string\"\n ? inline.mimeType\n : \"image/png\";\n output.push({ type: \"image\", source: { type: \"base64\", mediaType, data: inline.data } });\n}\n\nexport async function geminiGenerateContentAdapter(input: GenerationAdapterInput): Promise<GenerationContentBlock[]> {\n const prompt = mergeTextBlocks(input.declaration, input.request.content);\n if (!prompt) throw new GenerationValidationError(\"Prompt text is required\");\n\n const imageParts = await Promise.all(\n input.request.content\n .filter((block): block is Extract<GenerationContentBlock, { type: \"image\" }> => block.type === \"image\")\n .map(async (block) => sourceToInlineData(input, await input.context.resolveSource(block.source))),\n );\n\n const generationConfig: Record<string, unknown> = { responseModalities: [\"IMAGE\"] };\n const aspectRatio = input.parameters.aspect_ratio;\n const imageSize = input.parameters.image_size;\n if (typeof aspectRatio === \"string\" || typeof imageSize === \"string\") {\n const image: Record<string, string> = {};\n if (typeof aspectRatio === \"string\") image.aspectRatio = aspectRatio;\n if (typeof imageSize === \"string\") image.imageSize = imageSize;\n generationConfig.responseFormat = { image };\n }\n\n const payload = {\n contents: [{ parts: [{ text: prompt }, ...imageParts] satisfies GeminiPart[] }],\n generationConfig,\n };\n\n const response = await fetchWithTimeout(\n input.context.fetch,\n joinUrl(input.context.baseUrl, `/v1beta/models/${encodeURIComponent(input.declaration.model)}:generateContent`),\n {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${input.context.apiKey}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(payload),\n },\n REQUEST_TIMEOUT_MS,\n );\n\n if (!response.ok) {\n const body = await response.text().catch(() => response.statusText);\n throw new GenerationProviderError(\"Gemini generation provider request failed\", { status: response.status, body });\n }\n\n const raw = (await response.json()) as GeminiGenerateContentResponse;\n const output: GenerationContentBlock[] = [];\n for (const candidate of raw.candidates ?? []) {\n for (const part of candidate.content?.parts ?? []) appendGeminiPartOutput(output, part);\n }\n if (output.length === 0) {\n throw new GenerationProviderError(\"Gemini generation returned no output\", {\n details: collectGeminiNoOutputDetails(raw),\n });\n }\n return output;\n}\n","import { GenerationProviderError, GenerationValidationError } from \"../errors.js\";\nimport { fetchWithTimeout, joinUrl } from \"../http.js\";\nimport type { GenerationAdapterInput, GenerationContentBlock } from \"../types.js\";\nimport { compactArray, compactObject } from \"../utils.js\";\nimport { mergeTextBlocks } from \"../validation.js\";\n\nconst REQUEST_TIMEOUT_MS = 300_000;\n\ntype OpenAiImagesResponse = {\n data?: Array<{\n url?: unknown;\n b64_json?: unknown;\n revised_prompt?: unknown;\n }>;\n created?: unknown;\n usage?: unknown;\n background?: unknown;\n output_format?: unknown;\n quality?: unknown;\n size?: unknown;\n};\n\nfunction collectOpenAiImagesNoOutputDetails(raw: OpenAiImagesResponse): Record<string, unknown> {\n const data = raw.data ?? [];\n return compactObject({\n created: raw.created,\n usage: raw.usage,\n background: raw.background,\n outputFormat: raw.output_format,\n quality: raw.quality,\n size: raw.size,\n dataCount: data.length,\n data: compactArray(\n data.map((item) =>\n compactObject({\n hasUrl: typeof item.url === \"string\" && item.url.length > 0,\n hasBase64Json: typeof item.b64_json === \"string\" && item.b64_json.length > 0,\n revisedPrompt: item.revised_prompt,\n }),\n ),\n ),\n });\n}\n\nexport async function openAiImagesAdapter(input: GenerationAdapterInput): Promise<GenerationContentBlock[]> {\n const prompt = mergeTextBlocks(input.declaration, input.request.content);\n if (!prompt) throw new GenerationValidationError(\"Prompt text is required\");\n\n const images = await Promise.all(\n input.request.content\n .filter((block): block is Extract<GenerationContentBlock, { type: \"image\" }> => block.type === \"image\")\n .map((block) => input.context.resolveSource(block.source)),\n );\n\n const payload: Record<string, unknown> = {\n model: input.declaration.model,\n prompt,\n ...input.parameters,\n };\n if (images.length > 0) payload.image = images;\n\n const response = await fetchWithTimeout(\n input.context.fetch,\n joinUrl(input.context.baseUrl, \"/v1/images/generations\"),\n {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${input.context.apiKey}`,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(payload),\n },\n REQUEST_TIMEOUT_MS,\n );\n\n if (!response.ok) {\n const body = await response.text().catch(() => response.statusText);\n throw new GenerationProviderError(\"Image generation provider request failed\", { status: response.status, body });\n }\n\n const raw = (await response.json()) as OpenAiImagesResponse;\n const output: GenerationContentBlock[] = [];\n for (const item of raw.data ?? []) {\n if (typeof item.url === \"string\" && item.url) {\n output.push({ type: \"image\", source: { type: \"url\", url: item.url } });\n }\n if (typeof item.b64_json === \"string\" && item.b64_json) {\n output.push({ type: \"image\", source: { type: \"base64\", mediaType: \"image/png\", data: item.b64_json } });\n }\n if (typeof item.revised_prompt === \"string\" && item.revised_prompt.trim()) {\n output.push({ type: \"text\", text: item.revised_prompt, meta: { role: \"revised_prompt\" } });\n }\n }\n if (output.length === 0) {\n throw new GenerationProviderError(\"Image generation returned no output\", {\n details: collectOpenAiImagesNoOutputDetails(raw),\n });\n }\n return output;\n}\n","import { GenerationUnsupportedAdapterError } from \"../errors.js\";\nimport type { GenerationAdapter } from \"../types.js\";\nimport { arkVideoGenerationsAdapter } from \"./ark-video-generations.js\";\nimport { geminiGenerateContentAdapter } from \"./gemini-generate-content.js\";\nimport { openAiImagesAdapter } from \"./openai-images.js\";\n\nexport const builtinGenerationAdapters: Record<string, GenerationAdapter> = {\n \"ark.videoGenerations\": arkVideoGenerationsAdapter,\n \"gemini.generateContent\": geminiGenerateContentAdapter,\n \"openai.images\": openAiImagesAdapter,\n};\n\nexport function getGenerationAdapter(\n type: string,\n adapters: Record<string, GenerationAdapter> = {},\n): GenerationAdapter {\n const adapter = adapters[type] ?? builtinGenerationAdapters[type];\n if (!adapter) throw new GenerationUnsupportedAdapterError(type);\n return adapter;\n}\n\nexport * from \"./ark-video-generations.js\";\nexport * from \"./gemini-generate-content.js\";\nexport * from \"./openai-images.js\";\n","import type { GenerationSource, GenerationSourceResolver } from \"./types.js\";\n\nexport const defaultGenerationSourceResolver: GenerationSourceResolver = (source: GenerationSource) => {\n switch (source.type) {\n case \"url\":\n return source.url;\n case \"base64\":\n return `data:${source.mediaType};base64,${source.data}`;\n }\n};\n","import { getGenerationAdapter } from \"./adapters/index.js\";\nimport { builtinGenerationModels } from \"./builtins.js\";\nimport {\n readGenerationModelDeclarationsFromDirectory,\n readGenerationModelDeclarationsFromFiles,\n stringifyGenerationModelDeclaration,\n writeGenerationModelDeclaration,\n writeGenerationModelDeclarations,\n} from \"./config.js\";\nimport { GenerationConfigError } from \"./errors.js\";\nimport { defaultGenerationSourceResolver } from \"./source.js\";\nimport type {\n CreateGenerationClientOptions,\n GenerateRequest,\n GenerationClient,\n GenerationModelDeclaration,\n} from \"./types.js\";\nimport { cloneJson } from \"./utils.js\";\nimport { resolveGenerationParameters, validateGenerationContent } from \"./validation.js\";\n\nconst DEFAULT_BASE_URL = \"https://router.neta.art\";\n\nfunction resolveModels(options: CreateGenerationClientOptions): GenerationModelDeclaration[] {\n const includeBuiltinModels = options.includeBuiltinModels ?? !options.models;\n const models = [...(includeBuiltinModels ? builtinGenerationModels : []), ...(options.models ?? [])];\n const byModel = new Map<string, GenerationModelDeclaration>();\n for (const model of models) byModel.set(model.model, cloneJson(model));\n return [...byModel.values()].sort((a, b) => a.model.localeCompare(b.model));\n}\n\nexport function createGenerationClient(options: CreateGenerationClientOptions = {}): GenerationClient {\n const models = resolveModels(options);\n const byModel = new Map(models.map((declaration) => [declaration.model, declaration]));\n const fetchFn = options.fetch ?? globalThis.fetch;\n if (!fetchFn) throw new GenerationConfigError(\"A fetch implementation is required\");\n\n function requireModel(model: string): GenerationModelDeclaration {\n const declaration = byModel.get(model);\n if (!declaration) throw new GenerationConfigError(`Generation model is unavailable: ${model}`);\n return declaration;\n }\n\n return {\n validate(request: GenerateRequest) {\n const declaration = requireModel(request.model);\n validateGenerationContent(declaration, request.content);\n const parameters = resolveGenerationParameters(declaration, request.parameters);\n return { declaration: cloneJson(declaration), request: cloneJson(request), parameters };\n },\n\n async generate(request: GenerateRequest) {\n const resolved = this.validate(request);\n const apiKey = request.apiKey ?? options.apiKey;\n if (!apiKey) throw new GenerationConfigError(\"apiKey is required\");\n const adapter = getGenerationAdapter(resolved.declaration.adapter.type, options.adapters);\n return adapter({\n ...resolved,\n context: {\n apiKey,\n baseUrl: request.baseUrl ?? options.baseUrl ?? DEFAULT_BASE_URL,\n fetch: fetchFn,\n resolveSource: options.sourceResolver ?? defaultGenerationSourceResolver,\n },\n });\n },\n\n listModels() {\n return cloneJson(models);\n },\n\n getModel(model: string) {\n const declaration = byModel.get(model);\n return declaration ? cloneJson(declaration) : null;\n },\n\n stringifyModelConfig(model: string, stringifyOptions = {}) {\n return stringifyGenerationModelDeclaration(requireModel(model), stringifyOptions);\n },\n\n exportModelConfig(model: string, filePath: string) {\n return writeGenerationModelDeclaration(requireModel(model), filePath);\n },\n\n exportModelConfigs(directory: string) {\n return writeGenerationModelDeclarations(models, directory);\n },\n };\n}\n\nexport async function createGenerationClientFromFiles(\n filePaths: string[],\n options: Omit<CreateGenerationClientOptions, \"models\"> = {},\n): Promise<GenerationClient> {\n const models = await readGenerationModelDeclarationsFromFiles(filePaths);\n return createGenerationClient({ ...options, models, includeBuiltinModels: options.includeBuiltinModels ?? true });\n}\n\nexport async function createGenerationClientFromDirectory(\n directory: string,\n options: Omit<CreateGenerationClientOptions, \"models\"> = {},\n): Promise<GenerationClient> {\n const models = await readGenerationModelDeclarationsFromDirectory(directory);\n return createGenerationClient({ ...options, models, includeBuiltinModels: options.includeBuiltinModels ?? true });\n}\n\nexport async function createGenerationClientFromFile(\n filePath: string,\n options: Omit<CreateGenerationClientOptions, \"models\"> = {},\n): Promise<GenerationClient> {\n return createGenerationClientFromFiles([filePath], options);\n}\n"],"mappings":";;;;AAEA,eAAsB,iBACpB,SACA,KACA,MACA,WACmB;CACnB,MAAM,aAAa,IAAI,iBAAiB;CACxC,MAAM,UAAU,iBAAiB,WAAW,OAAO,EAAE,UAAU;AAC/D,KAAI;AACF,SAAO,MAAM,QAAQ,KAAK;GAAE,GAAG;GAAM,QAAQ,WAAW;GAAQ,CAAC;UAC1D,OAAO;AACd,MAAI,iBAAiB,SAAS,MAAM,SAAS,aAAc,OAAM,IAAI,wBAAwB;AAC7F,QAAM;WACE;AACR,eAAa,QAAQ;;;AAIzB,SAAgB,QAAQ,SAAiB,MAAsB;AAC7D,QAAO,GAAG,QAAQ,QAAQ,QAAQ,GAAG,CAAC,GAAG,KAAK,QAAQ,QAAQ,GAAG;;;;;AClB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