@ai-game-assets/dev 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/asset-store.d.ts +33 -0
- package/dist/asset-store.d.ts.map +1 -0
- package/dist/asset-store.js +235 -0
- package/dist/asset-store.js.map +1 -0
- package/dist/audio-provider.d.ts +27 -0
- package/dist/audio-provider.d.ts.map +1 -0
- package/dist/audio-provider.js +290 -0
- package/dist/audio-provider.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +4 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +2 -0
- package/dist/internal.js.map +1 -0
- package/dist/provider-image-processing.d.ts +83 -0
- package/dist/provider-image-processing.d.ts.map +1 -0
- package/dist/provider-image-processing.js +503 -0
- package/dist/provider-image-processing.js.map +1 -0
- package/dist/provider.d.ts +43 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +435 -0
- package/dist/provider.js.map +1 -0
- package/dist/server.d.ts +21 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +450 -0
- package/dist/server.js.map +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { AiAssetAnimation, AiAssetDefinition, AiAssetDimensions, AiAssetFrameGrid, AiAudioGenerationSettings, AiVoiceGenerationSettings, AiAssetGenerationSettings } from "@ai-game-assets/core";
|
|
2
|
+
export type GenerateAssetRequest = {
|
|
3
|
+
asset: AiAssetDefinition;
|
|
4
|
+
prompt?: string;
|
|
5
|
+
count?: number;
|
|
6
|
+
settings?: AiAssetGenerationSettings;
|
|
7
|
+
references?: GenerateAssetReference[];
|
|
8
|
+
stylePrompt?: string;
|
|
9
|
+
styleReferences?: GenerateAssetReference[];
|
|
10
|
+
};
|
|
11
|
+
export type GenerateAssetReference = {
|
|
12
|
+
image: Uint8Array;
|
|
13
|
+
mimeType: string;
|
|
14
|
+
fileName: string;
|
|
15
|
+
};
|
|
16
|
+
export type GeneratedAssetOption = {
|
|
17
|
+
image: Uint8Array;
|
|
18
|
+
mimeType: string;
|
|
19
|
+
prompt: string;
|
|
20
|
+
model?: string;
|
|
21
|
+
revisedPrompt?: string;
|
|
22
|
+
settings?: AiAssetGenerationSettings;
|
|
23
|
+
audioSettings?: AiAudioGenerationSettings;
|
|
24
|
+
audioPlayback?: AiAssetDefinition["audioPlayback"];
|
|
25
|
+
voiceSettings?: AiVoiceGenerationSettings;
|
|
26
|
+
durationSeconds?: number;
|
|
27
|
+
dimensions?: AiAssetDimensions;
|
|
28
|
+
frameGrid?: AiAssetFrameGrid;
|
|
29
|
+
animations?: AiAssetAnimation[];
|
|
30
|
+
};
|
|
31
|
+
export type GeneratedAssetOptionCallback = (option: GeneratedAssetOption, index: number) => void | Promise<void>;
|
|
32
|
+
export type AiImageProvider = {
|
|
33
|
+
generate(request: GenerateAssetRequest, onOption?: GeneratedAssetOptionCallback): Promise<GeneratedAssetOption[]>;
|
|
34
|
+
};
|
|
35
|
+
export type OpenAiImageProviderOptions = {
|
|
36
|
+
apiKey?: string;
|
|
37
|
+
model?: string;
|
|
38
|
+
svgModel?: string;
|
|
39
|
+
quality?: AiAssetGenerationSettings["quality"];
|
|
40
|
+
background?: AiAssetGenerationSettings["background"];
|
|
41
|
+
};
|
|
42
|
+
export declare function createOpenAiImageProvider(options?: OpenAiImageProviderOptions): AiImageProvider;
|
|
43
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EAEjB,gBAAgB,EAChB,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,sBAAsB,CAAC;AAe9B,MAAM,MAAM,oBAA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,EAAE,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,yBAAyB,CAAC,SAAS,CAAC,CAAC;IAC/C,UAAU,CAAC,EAAE,yBAAyB,CAAC,YAAY,CAAC,CAAC;CACtD,CAAC;AAEF,wBAAgB,yBAAyB,CACvC,OAAO,GAAE,0BAA+B,GACvC,eAAe,CA2HjB"}
|
package/dist/provider.js
ADDED
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { hexColor, referenceLockPromptLines, removeChromaBackground, resizePngToDimensions, resolveRequestedBackground, selectChromaKey, shouldPostprocessTransparency, shouldRequestRgbaPng, variationDirectionPromptLine } from "./provider-image-processing.js";
|
|
3
|
+
export function createOpenAiImageProvider(options = {}) {
|
|
4
|
+
return {
|
|
5
|
+
async generate(request, onOption) {
|
|
6
|
+
const dimensions = requireAssetDimensions(request.asset);
|
|
7
|
+
const apiKey = options.apiKey ?? process.env.OPENAI_API_KEY;
|
|
8
|
+
if (!apiKey) {
|
|
9
|
+
throw new Error("OPENAI_API_KEY is required to generate AI game assets.");
|
|
10
|
+
}
|
|
11
|
+
const model = request.settings?.model ??
|
|
12
|
+
request.asset.settings?.model ??
|
|
13
|
+
options.model ??
|
|
14
|
+
"gpt-image-2";
|
|
15
|
+
const prompt = request.prompt ?? request.asset.prompt;
|
|
16
|
+
const requestedFormat = request.settings?.format ?? request.asset.settings?.format ?? "png";
|
|
17
|
+
if (requestedFormat === "svg") {
|
|
18
|
+
return generateSvgAssets(request, {
|
|
19
|
+
apiKey,
|
|
20
|
+
model: request.settings?.model ?? options.svgModel ?? process.env.OPENAI_SVG_MODEL ?? "gpt-5",
|
|
21
|
+
prompt,
|
|
22
|
+
count: request.count ?? 1
|
|
23
|
+
}, onOption);
|
|
24
|
+
}
|
|
25
|
+
const outputFormat = normalizeOutputFormat(requestedFormat);
|
|
26
|
+
const requestedBackground = resolveRequestedBackground(request, options);
|
|
27
|
+
const background = normalizeBackgroundForModel(model, requestedBackground);
|
|
28
|
+
const chromaKey = selectChromaKey(request);
|
|
29
|
+
const allReferences = [
|
|
30
|
+
...(request.references ?? []),
|
|
31
|
+
...(request.styleReferences ?? []).map((reference, index) => ({
|
|
32
|
+
...reference,
|
|
33
|
+
fileName: `style-reference-${index + 1}-${reference.fileName}`
|
|
34
|
+
}))
|
|
35
|
+
];
|
|
36
|
+
const count = request.count ?? 1;
|
|
37
|
+
const requestBodies = Array.from({ length: count }, (_, index) => ({
|
|
38
|
+
model,
|
|
39
|
+
prompt: gameAssetPrompt(request, {
|
|
40
|
+
prompt,
|
|
41
|
+
model,
|
|
42
|
+
outputFormat,
|
|
43
|
+
requestedBackground,
|
|
44
|
+
chromaKey,
|
|
45
|
+
variation: count > 1 ? createVariationSeed(index) : undefined,
|
|
46
|
+
variationIndex: index,
|
|
47
|
+
variationCount: count
|
|
48
|
+
}),
|
|
49
|
+
n: 1,
|
|
50
|
+
size: request.settings?.size ?? request.asset.settings?.size ?? "1024x1024",
|
|
51
|
+
quality: request.settings?.quality ??
|
|
52
|
+
request.asset.settings?.quality ??
|
|
53
|
+
options.quality ??
|
|
54
|
+
"auto",
|
|
55
|
+
background,
|
|
56
|
+
output_format: outputFormat,
|
|
57
|
+
moderation: request.settings?.moderation ?? request.asset.settings?.moderation
|
|
58
|
+
}));
|
|
59
|
+
const generatedByIndex = await Promise.all(requestBodies.map(async (requestBody, index) => {
|
|
60
|
+
const response = allReferences.length
|
|
61
|
+
? await createImageEdit(apiKey, requestBody, allReferences)
|
|
62
|
+
: await createImageGeneration(apiKey, requestBody);
|
|
63
|
+
if (!response.ok) {
|
|
64
|
+
const body = await response.text();
|
|
65
|
+
throw new Error(`OpenAI image generation failed (${response.status}): ${openAiErrorMessage(body)}`);
|
|
66
|
+
}
|
|
67
|
+
const payload = await readImagePayload(response);
|
|
68
|
+
const generatedForRequest = [];
|
|
69
|
+
for (const item of payload.data ?? []) {
|
|
70
|
+
if (!item.b64_json) {
|
|
71
|
+
throw new Error("OpenAI image generation response did not include b64_json.");
|
|
72
|
+
}
|
|
73
|
+
const image = Buffer.from(item.b64_json, "base64");
|
|
74
|
+
const processedImage = resizePngToDimensions(shouldPostprocessTransparency(request, {
|
|
75
|
+
prompt,
|
|
76
|
+
model,
|
|
77
|
+
outputFormat,
|
|
78
|
+
requestedBackground
|
|
79
|
+
})
|
|
80
|
+
? removeChromaBackground(image, chromaKey)
|
|
81
|
+
: image, dimensions);
|
|
82
|
+
const option = {
|
|
83
|
+
image: processedImage,
|
|
84
|
+
mimeType: mimeTypeFromOutputFormat(outputFormat),
|
|
85
|
+
prompt,
|
|
86
|
+
model,
|
|
87
|
+
revisedPrompt: item.revised_prompt,
|
|
88
|
+
dimensions,
|
|
89
|
+
frameGrid: request.asset.frameGrid,
|
|
90
|
+
animations: request.asset.animations,
|
|
91
|
+
settings: {
|
|
92
|
+
...request.asset.settings,
|
|
93
|
+
...request.settings,
|
|
94
|
+
model,
|
|
95
|
+
background,
|
|
96
|
+
format: outputFormat === "jpeg" ? "jpg" : outputFormat
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
generatedForRequest.push(option);
|
|
100
|
+
await onOption?.(option, index);
|
|
101
|
+
}
|
|
102
|
+
return generatedForRequest;
|
|
103
|
+
}));
|
|
104
|
+
return generatedByIndex.flat();
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
async function generateSvgAssets(request, context, onOption) {
|
|
109
|
+
const dimensions = requireAssetDimensions(request.asset);
|
|
110
|
+
const references = [
|
|
111
|
+
...(request.references ?? []),
|
|
112
|
+
...(request.styleReferences ?? []).map((reference, index) => ({
|
|
113
|
+
...reference,
|
|
114
|
+
fileName: `style-reference-${index + 1}-${reference.fileName}`
|
|
115
|
+
}))
|
|
116
|
+
];
|
|
117
|
+
return Promise.all(Array.from({ length: context.count }, async (_, index) => {
|
|
118
|
+
const prompt = svgAssetPrompt(request, {
|
|
119
|
+
prompt: context.prompt,
|
|
120
|
+
variation: context.count > 1 ? createVariationSeed(index) : undefined,
|
|
121
|
+
variationIndex: index,
|
|
122
|
+
variationCount: context.count
|
|
123
|
+
});
|
|
124
|
+
const response = await createSvgResponse(context.apiKey, {
|
|
125
|
+
model: context.model,
|
|
126
|
+
prompt,
|
|
127
|
+
references
|
|
128
|
+
});
|
|
129
|
+
if (!response.ok) {
|
|
130
|
+
const body = await response.text();
|
|
131
|
+
throw new Error(`OpenAI SVG generation failed (${response.status}): ${openAiErrorMessage(body)}`);
|
|
132
|
+
}
|
|
133
|
+
const payload = await response.json();
|
|
134
|
+
const svg = normalizeSvgOutput(extractResponseText(payload), dimensions);
|
|
135
|
+
const option = {
|
|
136
|
+
image: Buffer.from(svg, "utf8"),
|
|
137
|
+
mimeType: "image/svg+xml",
|
|
138
|
+
prompt: context.prompt,
|
|
139
|
+
model: context.model,
|
|
140
|
+
dimensions,
|
|
141
|
+
frameGrid: request.asset.frameGrid,
|
|
142
|
+
animations: request.asset.animations,
|
|
143
|
+
settings: {
|
|
144
|
+
...request.asset.settings,
|
|
145
|
+
...request.settings,
|
|
146
|
+
model: context.model,
|
|
147
|
+
format: "svg"
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
await onOption?.(option, index);
|
|
151
|
+
return option;
|
|
152
|
+
}));
|
|
153
|
+
}
|
|
154
|
+
function svgAssetPrompt(request, context) {
|
|
155
|
+
const dimensions = requireAssetDimensions(request.asset);
|
|
156
|
+
const lines = [
|
|
157
|
+
context.prompt,
|
|
158
|
+
"",
|
|
159
|
+
"Generate a single valid SVG file as XML markup for a 2D game asset.",
|
|
160
|
+
"Return only the <svg>...</svg> document. Do not wrap it in Markdown, do not add commentary, and do not output raster images or base64 data.",
|
|
161
|
+
`The root <svg> must use xmlns="http://www.w3.org/2000/svg", width="${dimensions.width}", height="${dimensions.height}", and viewBox="0 0 ${dimensions.width} ${dimensions.height}".`,
|
|
162
|
+
`Asset kind: ${request.asset.kind}.`,
|
|
163
|
+
`Target canvas: ${dimensions.width}x${dimensions.height}.`,
|
|
164
|
+
"Use vector primitives such as paths, polygons, circles, ellipses, rects, gradients, masks, and groups. Keep IDs unique and descriptive.",
|
|
165
|
+
"Do not include scripts, external URLs, foreignObject, CSS imports, font imports, animation tags, or event handlers."
|
|
166
|
+
];
|
|
167
|
+
if (request.stylePrompt?.trim()) {
|
|
168
|
+
lines.push(`Style guide: ${request.stylePrompt.trim()}`);
|
|
169
|
+
}
|
|
170
|
+
if (referencesNeedIdentity(request)) {
|
|
171
|
+
lines.push("Use the provided non-style reference image as the character identity reference. Preserve its silhouette, palette distribution, proportions, markings, and distinctive details while drawing it as clean SVG.");
|
|
172
|
+
}
|
|
173
|
+
if (request.asset.frameGrid) {
|
|
174
|
+
const frameCount = request.asset.frameGrid.frameCount ??
|
|
175
|
+
request.asset.frameGrid.columns * request.asset.frameGrid.rows;
|
|
176
|
+
lines.push(`Spritesheet contract: create exactly ${frameCount} animation frames arranged in the first ${frameCount} cells of a fixed grid with ${request.asset.frameGrid.columns} columns and ${request.asset.frameGrid.rows} rows.`, `Each frame cell is exactly ${request.asset.frameGrid.frameWidth}x${request.asset.frameGrid.frameHeight}. The full SVG canvas is ${dimensions.width}x${dimensions.height}.`, `Use one complete frame per grid cell, ordered left-to-right then top-to-bottom. Cell rectangles are: ${gridCellRectangles(request)}.`, "Keep the background transparent by leaving empty areas unpainted. Do not draw visible grid lines, labels, frame numbers, or cell borders.");
|
|
177
|
+
}
|
|
178
|
+
else if (request.asset.settings?.background === "opaque") {
|
|
179
|
+
lines.push("Create one continuous opaque scene covering the full SVG canvas. Do not create a spritesheet, contact sheet, labels, or panels.");
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
lines.push("Create exactly one complete transparent-background sprite on the canvas. Leave empty areas unpainted; do not draw a white, black, gray, checkerboard, or colored background.");
|
|
183
|
+
}
|
|
184
|
+
if (context.variation) {
|
|
185
|
+
lines.push(context.variation, variationDirectionPromptLine(context.variationIndex ?? 0));
|
|
186
|
+
}
|
|
187
|
+
return lines.join("\n");
|
|
188
|
+
}
|
|
189
|
+
function referencesNeedIdentity(request) {
|
|
190
|
+
return Boolean(request.references?.length);
|
|
191
|
+
}
|
|
192
|
+
async function createSvgResponse(apiKey, body) {
|
|
193
|
+
const content = [{ type: "input_text", text: body.prompt }];
|
|
194
|
+
for (const reference of body.references) {
|
|
195
|
+
if (!isSupportedResponseImageMimeType(reference.mimeType))
|
|
196
|
+
continue;
|
|
197
|
+
content.push({
|
|
198
|
+
type: "input_image",
|
|
199
|
+
image_url: `data:${reference.mimeType};base64,${Buffer.from(reference.image).toString("base64")}`
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
return fetch("https://api.openai.com/v1/responses", {
|
|
203
|
+
method: "POST",
|
|
204
|
+
headers: {
|
|
205
|
+
Authorization: `Bearer ${apiKey}`,
|
|
206
|
+
"Content-Type": "application/json"
|
|
207
|
+
},
|
|
208
|
+
body: JSON.stringify({
|
|
209
|
+
model: body.model,
|
|
210
|
+
input: [
|
|
211
|
+
{
|
|
212
|
+
role: "user",
|
|
213
|
+
content
|
|
214
|
+
}
|
|
215
|
+
]
|
|
216
|
+
})
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function isSupportedResponseImageMimeType(mimeType) {
|
|
220
|
+
return mimeType === "image/png" ||
|
|
221
|
+
mimeType === "image/jpeg" ||
|
|
222
|
+
mimeType === "image/webp" ||
|
|
223
|
+
mimeType === "image/gif";
|
|
224
|
+
}
|
|
225
|
+
function gameAssetPrompt(request, context) {
|
|
226
|
+
const dimensions = requireAssetDimensions(request.asset);
|
|
227
|
+
const lines = [
|
|
228
|
+
context.prompt,
|
|
229
|
+
"",
|
|
230
|
+
"Create this as a clean 2D game asset sprite.",
|
|
231
|
+
`Asset kind: ${request.asset.kind}.`,
|
|
232
|
+
`Target canvas: ${dimensions.width}x${dimensions.height}.`
|
|
233
|
+
];
|
|
234
|
+
if (shouldRequestRgbaPng(request, context)) {
|
|
235
|
+
lines.push("Use a transparent background, centered subject, no text, no watermark, no cast shadow, no floor shadow, no ground plane, no reflection. Keep the sprite readable through its shape and pose; do not darken or recolor the character to create contrast.", "Clean it into a real RGBA PNG: the final game asset needs actual alpha transparency, not white, black, gray, checkerboard, or any matte color.", `For local transparency processing, render every background and empty padding pixel as the flat chroma-key color ${hexColor(context.chromaKey)}. Do not use that exact chroma-key color inside the game asset itself.`, "Keep the asset edges crisp against the chroma-key background so it can be removed cleanly.");
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
lines.push("Fill the entire canvas edge-to-edge with an opaque image. Do not use transparency, empty padding, borders, text, or watermarks.");
|
|
239
|
+
}
|
|
240
|
+
if (request.asset.frameGrid) {
|
|
241
|
+
const frameCount = request.asset.frameGrid.frameCount ??
|
|
242
|
+
request.asset.frameGrid.columns * request.asset.frameGrid.rows;
|
|
243
|
+
const rowLabel = request.asset.frameGrid.rows === 1 ? "row" : "rows";
|
|
244
|
+
const columnLabel = request.asset.frameGrid.columns === 1 ? "column" : "columns";
|
|
245
|
+
lines.push(`Spritesheet contract: exactly ${frameCount} animation frames arranged in the first ${frameCount} cells of a fixed grid with ${request.asset.frameGrid.columns} ${columnLabel} and ${request.asset.frameGrid.rows} ${rowLabel}.`, `The final image must be one ${dimensions.width}x${dimensions.height} spritesheet, not separate images and not a different grid.`, `Use one frame per grid cell, ordered left-to-right then top-to-bottom. If the grid has more cells than ${frameCount}, leave the extra trailing cells fully transparent and empty.`, `Each cell is exactly ${request.asset.frameGrid.frameWidth}x${request.asset.frameGrid.frameHeight}; do not merge cells, crop cells, add extra frames beyond ${frameCount}, or change the grid layout.`, `Cell rectangles are: ${gridCellRectangles(request)}.`, `Frame centers must be at these cell centers: ${gridCellCenters(request)}.`, "Each grid cell must contain exactly one complete frame of the subject. Do not place a nested spritesheet, turnaround sheet, contact sheet, labels, thumbnails, or multiple mini-poses inside any single cell.", "Keep the character centered at a consistent scale in every cell, leaving transparent padding inside the cell.", "The grid layout is mandatory even if the animation would look nicer in another arrangement.");
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
if (shouldRequestRgbaPng(request, context)) {
|
|
249
|
+
lines.push("Single-image asset contract: create exactly one complete sprite on the canvas.", "Do not create a spritesheet, turnaround sheet, contact sheet, sequence, grid, multiple poses, multiple variants, panels, labels, or frame divisions.", "Keep the full subject visible with transparent padding on all sides. The subject must not touch the canvas edges and must not be cropped.");
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
lines.push("Single-image background contract: create exactly one continuous scene covering the complete canvas.", "Do not create a spritesheet, contact sheet, sequence, grid, panels, labels, frame divisions, or isolated cutout sprite.");
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if (request.references?.length) {
|
|
256
|
+
lines.push("The generated asset must depict the same exact character as the provided character reference image. Character reference filenames do not begin with style-reference-. Preserve the silhouette, body proportions, face or head shape, colors, materials, markings, costume, and distinctive details. Do not redesign the character, change species, swap materials, alter the palette, or simplify it into a different character.", ...referenceLockPromptLines(request.references), "For animation spritesheets, every frame must show that same exact character performing only the requested motion or state change.");
|
|
257
|
+
}
|
|
258
|
+
if (request.stylePrompt || request.styleReferences?.length) {
|
|
259
|
+
lines.push("Style guide: apply the following visual language consistently without copying the subject matter, characters, composition, or objects from the style reference images.", request.stylePrompt?.trim() || "Match the visual style shown by the style reference images.", "Style reference image filenames begin with style-reference-.", "Use the style references only for rendering style: line quality, shape language, palette character, shading, material treatment, texture, and level of detail. The asset prompt and character references still determine what the asset depicts.");
|
|
260
|
+
}
|
|
261
|
+
if (context.variation) {
|
|
262
|
+
lines.push(`Variation seed: ${context.variation}. Use this seed to make this option visually distinct from sibling options, not a near-duplicate. Vary the animation timing, pose rhythm, secondary motion, and effect shape while preserving the asset brief, frame grid, transparency instructions, and same exact character identity.`, variationDirectionPromptLine(context.variationIndex ?? 0));
|
|
263
|
+
}
|
|
264
|
+
return lines.join("\n");
|
|
265
|
+
}
|
|
266
|
+
function createVariationSeed(index) {
|
|
267
|
+
return `option-${index + 1}-${randomUUID()}`;
|
|
268
|
+
}
|
|
269
|
+
function gridCellCenters(request) {
|
|
270
|
+
const frameGrid = request.asset.frameGrid;
|
|
271
|
+
if (!frameGrid)
|
|
272
|
+
return "";
|
|
273
|
+
const centers = [];
|
|
274
|
+
const frameCount = frameGrid.frameCount ?? frameGrid.columns * frameGrid.rows;
|
|
275
|
+
for (let index = 0; index < frameCount; index += 1) {
|
|
276
|
+
const column = index % frameGrid.columns;
|
|
277
|
+
const row = Math.floor(index / frameGrid.columns);
|
|
278
|
+
const x = column * frameGrid.frameWidth + frameGrid.frameWidth / 2;
|
|
279
|
+
const y = row * frameGrid.frameHeight + frameGrid.frameHeight / 2;
|
|
280
|
+
centers.push(`frame ${index + 1}=(${x},${y})`);
|
|
281
|
+
}
|
|
282
|
+
return centers.join("; ");
|
|
283
|
+
}
|
|
284
|
+
function gridCellRectangles(request) {
|
|
285
|
+
const frameGrid = request.asset.frameGrid;
|
|
286
|
+
if (!frameGrid)
|
|
287
|
+
return "";
|
|
288
|
+
const rectangles = [];
|
|
289
|
+
const frameCount = frameGrid.frameCount ?? frameGrid.columns * frameGrid.rows;
|
|
290
|
+
for (let index = 0; index < frameCount; index += 1) {
|
|
291
|
+
const column = index % frameGrid.columns;
|
|
292
|
+
const row = Math.floor(index / frameGrid.columns);
|
|
293
|
+
const x1 = column * frameGrid.frameWidth;
|
|
294
|
+
const y1 = row * frameGrid.frameHeight;
|
|
295
|
+
const x2 = x1 + frameGrid.frameWidth - 1;
|
|
296
|
+
const y2 = y1 + frameGrid.frameHeight - 1;
|
|
297
|
+
rectangles.push(`frame ${index + 1}=x${x1}-${x2},y${y1}-${y2}`);
|
|
298
|
+
}
|
|
299
|
+
return rectangles.join("; ");
|
|
300
|
+
}
|
|
301
|
+
async function createImageGeneration(apiKey, body) {
|
|
302
|
+
return fetch("https://api.openai.com/v1/images/generations", {
|
|
303
|
+
method: "POST",
|
|
304
|
+
headers: {
|
|
305
|
+
Authorization: `Bearer ${apiKey}`,
|
|
306
|
+
"Content-Type": "application/json"
|
|
307
|
+
},
|
|
308
|
+
body: JSON.stringify(body)
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
async function createImageEdit(apiKey, body, references) {
|
|
312
|
+
const form = new FormData();
|
|
313
|
+
for (const [key, value] of Object.entries(body)) {
|
|
314
|
+
if (value !== undefined) {
|
|
315
|
+
form.append(key, String(value));
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
for (const reference of references) {
|
|
319
|
+
form.append("image[]", new Blob([arrayBufferFromBytes(reference.image)], { type: reference.mimeType }), reference.fileName);
|
|
320
|
+
}
|
|
321
|
+
return fetch("https://api.openai.com/v1/images/edits", {
|
|
322
|
+
method: "POST",
|
|
323
|
+
headers: {
|
|
324
|
+
Authorization: `Bearer ${apiKey}`
|
|
325
|
+
},
|
|
326
|
+
body: form
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
async function readImagePayload(response) {
|
|
330
|
+
return await response.json();
|
|
331
|
+
}
|
|
332
|
+
function extractResponseText(payload) {
|
|
333
|
+
if (payload &&
|
|
334
|
+
typeof payload === "object" &&
|
|
335
|
+
"output_text" in payload &&
|
|
336
|
+
typeof payload.output_text === "string") {
|
|
337
|
+
return payload.output_text;
|
|
338
|
+
}
|
|
339
|
+
if (payload &&
|
|
340
|
+
typeof payload === "object" &&
|
|
341
|
+
"output" in payload &&
|
|
342
|
+
Array.isArray(payload.output)) {
|
|
343
|
+
const chunks = [];
|
|
344
|
+
for (const item of payload.output) {
|
|
345
|
+
if (item &&
|
|
346
|
+
typeof item === "object" &&
|
|
347
|
+
"content" in item &&
|
|
348
|
+
Array.isArray(item.content)) {
|
|
349
|
+
for (const content of item.content) {
|
|
350
|
+
if (content &&
|
|
351
|
+
typeof content === "object" &&
|
|
352
|
+
"text" in content &&
|
|
353
|
+
typeof content.text === "string") {
|
|
354
|
+
chunks.push(content.text);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
if (chunks.length > 0) {
|
|
360
|
+
return chunks.join("\n");
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
throw new Error("OpenAI SVG generation response did not include text output.");
|
|
364
|
+
}
|
|
365
|
+
function normalizeSvgOutput(svgText, dimensions) {
|
|
366
|
+
const match = /<svg\b[\s\S]*<\/svg>/i.exec(svgText);
|
|
367
|
+
const svg = (match?.[0] ?? svgText).trim();
|
|
368
|
+
if (!/^<svg\b/i.test(svg) || !/<\/svg>$/i.test(svg)) {
|
|
369
|
+
throw new Error("SVG generation did not return a valid <svg> document.");
|
|
370
|
+
}
|
|
371
|
+
return sanitizeSvgMarkup(ensureSvgRootAttributes(svg, dimensions));
|
|
372
|
+
}
|
|
373
|
+
function ensureSvgRootAttributes(svg, dimensions) {
|
|
374
|
+
return svg.replace(/<svg\b([^>]*)>/i, (_match, attributes) => {
|
|
375
|
+
const cleanedAttributes = String(attributes)
|
|
376
|
+
.replace(/\s+xmlns=(["']).*?\1/i, "")
|
|
377
|
+
.replace(/\s+width=(["']).*?\1/i, "")
|
|
378
|
+
.replace(/\s+height=(["']).*?\1/i, "")
|
|
379
|
+
.replace(/\s+viewBox=(["']).*?\1/i, "")
|
|
380
|
+
.trim();
|
|
381
|
+
const prefix = cleanedAttributes ? ` ${cleanedAttributes}` : "";
|
|
382
|
+
return `<svg${prefix} xmlns="http://www.w3.org/2000/svg" width="${dimensions.width}" height="${dimensions.height}" viewBox="0 0 ${dimensions.width} ${dimensions.height}">`;
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
function sanitizeSvgMarkup(svg) {
|
|
386
|
+
return svg
|
|
387
|
+
.replace(/<script\b[\s\S]*?<\/script>/gi, "")
|
|
388
|
+
.replace(/<foreignObject\b[\s\S]*?<\/foreignObject>/gi, "")
|
|
389
|
+
.replace(/\s+on[a-z]+\s*=\s*(["']).*?\1/gi, "")
|
|
390
|
+
.replace(/\s+(?:href|xlink:href)\s*=\s*(["'])\s*(?:javascript:|https?:|data:)[\s\S]*?\1/gi, "");
|
|
391
|
+
}
|
|
392
|
+
function arrayBufferFromBytes(bytes) {
|
|
393
|
+
return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
|
|
394
|
+
}
|
|
395
|
+
function normalizeOutputFormat(format) {
|
|
396
|
+
if (format === "webp")
|
|
397
|
+
return "webp";
|
|
398
|
+
if (format === "jpg")
|
|
399
|
+
return "jpeg";
|
|
400
|
+
return "png";
|
|
401
|
+
}
|
|
402
|
+
function requireAssetDimensions(asset) {
|
|
403
|
+
if (!asset.dimensions) {
|
|
404
|
+
throw new Error(`AI asset "${asset.id}" requires dimensions for image generation.`);
|
|
405
|
+
}
|
|
406
|
+
return asset.dimensions;
|
|
407
|
+
}
|
|
408
|
+
function normalizeBackgroundForModel(model, background) {
|
|
409
|
+
if (model.startsWith("gpt-image-2") && background === "transparent") {
|
|
410
|
+
return "auto";
|
|
411
|
+
}
|
|
412
|
+
return background;
|
|
413
|
+
}
|
|
414
|
+
function mimeTypeFromOutputFormat(format) {
|
|
415
|
+
switch (format) {
|
|
416
|
+
case "webp":
|
|
417
|
+
return "image/webp";
|
|
418
|
+
case "jpeg":
|
|
419
|
+
return "image/jpeg";
|
|
420
|
+
case "png":
|
|
421
|
+
return "image/png";
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
function openAiErrorMessage(body) {
|
|
425
|
+
try {
|
|
426
|
+
const parsed = JSON.parse(body);
|
|
427
|
+
const message = parsed.error?.message ?? body;
|
|
428
|
+
const code = parsed.error?.code ?? parsed.error?.type;
|
|
429
|
+
return code ? `${message} (${code})` : message;
|
|
430
|
+
}
|
|
431
|
+
catch {
|
|
432
|
+
return body;
|
|
433
|
+
}
|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AAK,CAAC,aAAa,KAAK,CAAC,EAAE,6CAA6C,CAAC,CAAC;IACtF,CAAC;IAED,OAAO,KAAK,CAAC,UAAU,CAAC;AAC1B,CAAC;AAED,SAAS,2BAA2B,CAClC,KAAa,EACb,UAA+D;IAE/D,IAAI,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,UAAU,KAAK,aAAa,EAAE,CAAC;QACpE,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,wBAAwB,CAAC,MAA+B;IAC/D,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,MAAM;YACT,OAAO,YAAY,CAAC;QACtB,KAAK,MAAM;YACT,OAAO,YAAY,CAAC;QACtB,KAAK,KAAK;YACR,OAAO,WAAW,CAAC;IACvB,CAAC;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAY;IACtC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAM7B,CAAC;QACF,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,EAAE,OAAO,IAAI,IAAI,CAAC;QAC9C,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,EAAE,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC;QACtD,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,OAAO,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type IncomingMessage, type ServerResponse } from "node:http";
|
|
2
|
+
import { type AiAssetManifest } from "@ai-game-assets/core";
|
|
3
|
+
import type { AiImageProvider } from "./provider.js";
|
|
4
|
+
import type { AiAudioProvider } from "./audio-provider.js";
|
|
5
|
+
import { type AssetStoreOptions } from "./asset-store.js";
|
|
6
|
+
export type AiAssetDevServerOptions = AssetStoreOptions & {
|
|
7
|
+
provider?: AiImageProvider;
|
|
8
|
+
audioProvider?: AiAudioProvider;
|
|
9
|
+
host?: string;
|
|
10
|
+
port?: number;
|
|
11
|
+
};
|
|
12
|
+
export declare function createAiAssetDevServer(options: AiAssetDevServerOptions): {
|
|
13
|
+
listen(): Promise<{
|
|
14
|
+
port: number;
|
|
15
|
+
host: string;
|
|
16
|
+
}>;
|
|
17
|
+
close(): Promise<void>;
|
|
18
|
+
server: import("http").Server<typeof IncomingMessage, typeof ServerResponse>;
|
|
19
|
+
};
|
|
20
|
+
export declare function planFirstDraftGeneration(manifest: AiAssetManifest, requestedAssetIds: string[]): string[];
|
|
21
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AACpF,OAAO,EAOL,KAAK,eAAe,EAGrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EACL,KAAK,iBAAiB,EAIvB,MAAM,kBAAkB,CAAC;AAI1B,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GAAG;IACxD,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,aAAa,CAAC,EAAE,eAAe,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB;;cAgBtC,MAAM;cAAQ,MAAM;;;;EAWpD;AA2UD,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,eAAe,EACzB,iBAAiB,EAAE,MAAM,EAAE,GAC1B,MAAM,EAAE,CAkCV"}
|