@neta-art/generation 0.1.1 → 0.1.2
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.
- package/README.md +36 -0
- package/dist/builtins-B1AheaEa.js.map +1 -1
- package/dist/{builtins-BuI-rf8X.d.ts → builtins-BE6FhnwP.d.ts} +32 -2
- package/dist/builtins-BE6FhnwP.d.ts.map +1 -0
- package/dist/builtins.d.ts +1 -1
- package/dist/cli/index.js +83 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/export-config-BPnZYpmN.js +884 -0
- package/dist/export-config-BPnZYpmN.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -655
- package/package.json +14 -16
- package/dist/builtins-BuI-rf8X.d.ts.map +0 -1
- package/dist/export-config-Bwqnn7Vs.js +0 -128
- package/dist/export-config-Bwqnn7Vs.js.map +0 -1
- package/dist/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neta-art/generation",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
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,20 @@
|
|
|
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:text-to-video": "node --env-file=.env --experimental-strip-types examples/text-to-video.ts",
|
|
66
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
67
|
+
"test": "vitest run",
|
|
68
|
+
"test:watch": "vitest",
|
|
69
|
+
"lint": "biome check .",
|
|
70
|
+
"lint:fix": "biome check --write .",
|
|
71
|
+
"format": "biome format --write ."
|
|
74
72
|
}
|
|
75
|
-
}
|
|
73
|
+
}
|
|
@@ -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,gBAAA,GAFmD;EAEnD,IAAA,EAAA,KAAA;EAEA,GAAA,EAAA,MAAA;AAEZ,CAAA,GAAY;EAC6B,IAAA,EAAA,QAAA;EACZ,SAAA,EAAA,MAAA;EAAyB,IAAA,EAAA,MAAA;CACzB;AAAyB,KAL1C,0BAAA,GAA6B,MAKa,CAAA,MAAA,EAAA,OAAA,CAAA;AACzB,K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CAAA,EAAA,MAAA,EAAA;AAGnB,CAAA,GAAY;EACQ,IAAA,EAAA,SAAA;EAA0B,QAAA,CAAA,EAAA,OAAA;EAAR,OAAA,CAAA,EAAA,MAAA;EAClB,GAAA,CAAA,EAAA,MAAA;EAAkB,GAAA,CAAA,EAAA,MAAA;EACtB,WAAA,CAAA,EAAA,MAAA;EACW,QAAA,CAAA,EAAA,MAAA,EAAA;CAE2B,GAAA;EACb,IAAA,EAAA,SAAA;EAAO,QAAA,CAAA,EAAA,OAAA;;;;ACgFhD,CAAA;AAEgB,KDnJJ,0BAAA,GCmJ6B;EAIzB,MAAA,EAAA,ODtJC,YCsJD;;;;;;;;WD9IL;;eAEI,eAAe;aACjB;;aAEA;;;KAID,eAAA;;WAED;eACI;;;aAGF;;KAGD,yBAAA;eACG;WACJ;cACG;;KAGF,wBAAA,YAAoC,qBAAqB;KAEzD,wBAAA;;;gBAGI;iBACC;;KAGL,sBAAA,GAAyB;WAC1B;;KAGC,iBAAA,WAA4B,2BAA2B,QAAQ;KAE/D,6BAAA;;;WAGD;;iBAEM;mBACE;aACN,eAAe;;KAGhB,gBAAA;oBACQ,kBAAkB,QAAQ;oBAC1B,kBAAkB;gBACtB;2BACW;;;;sDAE2B;yCACb;;;;AA3H5B,cC2MA,uBD3MkD,EC2MzB,0BD3MyB,EAAA;AAEnD,iBC2MI,yBAAA,CD3MY,KAAA,EAAA,MAAA,CAAA,EC2M8B,0BD3M9B,GAAA,IAAA;AAEhB,iBC6MI,2BAAA,CAAA,CD7M+B,EC6MA,0BD7MA,EAAA"}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { c as 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,QAAM,QAAQ;AACd,OAAK,OAAO;AACZ,OAAK,SAAS,SAAS;AACvB,OAAK,OAAO,SAAS;AACrB,OAAK,UAAU,SAAS;;;AAI5B,IAAa,yBAAb,cAA4C,wBAAwB;CAClE,YAAY,UAAU,gCAAgC,SAAmC;AACvF,QAAM,SAAS,UAAU,EAAE,SAAS,GAAG,OAAU;AACjD,OAAK,OAAO;;;;;;ACzChB,MAAM,yBAAyB,IAAI,IAAI;CAAC;CAAS;CAAQ;CAAQ,CAAC;AAElE,SAAS,SAAS,OAAkD;AAClE,QAAO,CAAC,CAAC,SAAS,OAAO,UAAU,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iC,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;;;;;AClBnE,SAAS,YAAY,OAAgC;CACnD,MAAM,sBAAM,IAAI,KAA2D;AAC3E,MAAK,MAAM,QAAQ,MAAO,KAAI,IAAI,KAAK,MAAM,KAAK;AAClD,QAAO;;AAGT,SAAgB,0BACd,aACA,SACM;CACN,MAAM,aAAa,YAAY,YAAY,QAAQ,MAAM;CACzD,MAAM,yBAAS,IAAI,KAA4C;AAE/D,MAAK,MAAM,SAAS,SAAS;EAC3B,MAAM,OAAO,WAAW,IAAI,MAAM,KAAK;AACvC,MAAI,CAAC,KACH,OAAM,IAAI,0BAA0B,0CAA0C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