@bitmagic/asset-core 0.2.10-dev.0 → 0.2.10-dev.1
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/generators/reference.d.ts +36 -0
- package/dist/generators/reference.d.ts.map +1 -0
- package/dist/generators/reference.js +62 -0
- package/dist/generators/reference.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/reference-prompt.d.ts +12 -0
- package/dist/reference-prompt.d.ts.map +1 -0
- package/dist/reference-prompt.js +42 -0
- package/dist/reference-prompt.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `reference` generator — one concept image of the game's world, returned as a URL and
|
|
3
|
+
* NOTHING else.
|
|
4
|
+
*
|
|
5
|
+
* Deliberately not `generateImageAsset` with a fixed name: that generator upserts the picture into
|
|
6
|
+
* world.json's `assets[]`, and a reference image is not a game asset. It is a candidate the
|
|
7
|
+
* creator looks at, iterates on and may accept (`bitmagic reference`), and until accepted it must
|
|
8
|
+
* leave the project untouched — so this returns no patches, and the host writes nothing. The
|
|
9
|
+
* dimensions are fixed here rather than taken from the caller: a reference is consumed by
|
|
10
|
+
* img2img generators and a multimodal designer, both of which want a landscape shot, and a
|
|
11
|
+
* caller choosing a square would silently get a worse reference.
|
|
12
|
+
*/
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
import type { AssetResultBase, GenerateDeps } from '../types.js';
|
|
15
|
+
export declare const referenceImageParamsSchema: z.ZodObject<{
|
|
16
|
+
prompt: z.ZodString;
|
|
17
|
+
referenceImageUrl: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, "strict", z.ZodTypeAny, {
|
|
19
|
+
prompt: string;
|
|
20
|
+
referenceImageUrl?: string | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
prompt: string;
|
|
23
|
+
referenceImageUrl?: string | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
export type ReferenceImageParams = z.input<typeof referenceImageParamsSchema>;
|
|
26
|
+
/** Landscape, 16:9, multiples of 64 — an establishing shot, not a square cover. */
|
|
27
|
+
export declare const REFERENCE_IMAGE_WIDTH = 1536;
|
|
28
|
+
export declare const REFERENCE_IMAGE_HEIGHT = 864;
|
|
29
|
+
export type ReferenceImageResult = AssetResultBase & {
|
|
30
|
+
/** The generated image's URL — the whole output of this generator. */
|
|
31
|
+
imageUrl?: string;
|
|
32
|
+
/** True once the Forger has answered — chargeable even when the response carried no URL. */
|
|
33
|
+
billable?: boolean;
|
|
34
|
+
};
|
|
35
|
+
export declare function generateReferenceImage(params: ReferenceImageParams, deps: GenerateDeps): Promise<ReferenceImageResult>;
|
|
36
|
+
//# sourceMappingURL=reference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../src/generators/reference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIjE,eAAO,MAAM,0BAA0B;;;;;;;;;EAI5B,CAAC;AAEZ,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,mFAAmF;AACnF,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAC1C,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,MAAM,MAAM,oBAAoB,GAAG,eAAe,GAAG;IACnD,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4FAA4F;IAC5F,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAQF,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,oBAAoB,EAC5B,IAAI,EAAE,YAAY,GACjB,OAAO,CAAC,oBAAoB,CAAC,CA6C/B"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `reference` generator — one concept image of the game's world, returned as a URL and
|
|
3
|
+
* NOTHING else.
|
|
4
|
+
*
|
|
5
|
+
* Deliberately not `generateImageAsset` with a fixed name: that generator upserts the picture into
|
|
6
|
+
* world.json's `assets[]`, and a reference image is not a game asset. It is a candidate the
|
|
7
|
+
* creator looks at, iterates on and may accept (`bitmagic reference`), and until accepted it must
|
|
8
|
+
* leave the project untouched — so this returns no patches, and the host writes nothing. The
|
|
9
|
+
* dimensions are fixed here rather than taken from the caller: a reference is consumed by
|
|
10
|
+
* img2img generators and a multimodal designer, both of which want a landscape shot, and a
|
|
11
|
+
* caller choosing a square would silently get a worse reference.
|
|
12
|
+
*/
|
|
13
|
+
import { z } from 'zod';
|
|
14
|
+
import { fail, ok } from '../result.js';
|
|
15
|
+
import { formatZodIssues } from '../validation.js';
|
|
16
|
+
export const referenceImageParamsSchema = z.object({
|
|
17
|
+
prompt: z.string().min(1).describe('The composed reference-image prompt (see buildReferenceImagePrompt)'),
|
|
18
|
+
referenceImageUrl: z.string().optional()
|
|
19
|
+
.describe('A previous candidate to iterate from, forwarded to the image model as img2img'),
|
|
20
|
+
}).strict();
|
|
21
|
+
/** Landscape, 16:9, multiples of 64 — an establishing shot, not a square cover. */
|
|
22
|
+
export const REFERENCE_IMAGE_WIDTH = 1536;
|
|
23
|
+
export const REFERENCE_IMAGE_HEIGHT = 864;
|
|
24
|
+
const ENDPOINT = '/ai/v1/generate-image-as-webp-url';
|
|
25
|
+
export async function generateReferenceImage(params, deps) {
|
|
26
|
+
const { forger, logger, onProgress } = deps;
|
|
27
|
+
const parsed = referenceImageParamsSchema.safeParse(params);
|
|
28
|
+
if (!parsed.success) {
|
|
29
|
+
logger.warn({ err: parsed.error }, '[reference] Invalid parameters');
|
|
30
|
+
return fail(formatZodIssues(parsed.error));
|
|
31
|
+
}
|
|
32
|
+
const input = parsed.data;
|
|
33
|
+
if (!forger.hasCredentials()) {
|
|
34
|
+
logger.error('[reference] Missing Asset Forger credentials');
|
|
35
|
+
return fail(forger.getMissingCredentialsMessage());
|
|
36
|
+
}
|
|
37
|
+
onProgress('Generating reference image');
|
|
38
|
+
logger.info({ iteratesFrom: input.referenceImageUrl ?? null }, '[reference] Starting generation');
|
|
39
|
+
let response;
|
|
40
|
+
try {
|
|
41
|
+
response = await forger.post(ENDPOINT, {
|
|
42
|
+
prompt: input.prompt,
|
|
43
|
+
width: REFERENCE_IMAGE_WIDTH,
|
|
44
|
+
height: REFERENCE_IMAGE_HEIGHT,
|
|
45
|
+
numImages: 1,
|
|
46
|
+
guidanceScale: 1.0,
|
|
47
|
+
...(input.referenceImageUrl ? { referenceImageUrl: input.referenceImageUrl } : {}),
|
|
48
|
+
}, 'reference');
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
const message = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
52
|
+
logger.error({ err: error }, '[reference] Error during generation');
|
|
53
|
+
return fail(message);
|
|
54
|
+
}
|
|
55
|
+
const imageUrl = response.imageUrl;
|
|
56
|
+
if (!imageUrl) {
|
|
57
|
+
return { ...fail('Asset Forger returned no image URL'), billable: true };
|
|
58
|
+
}
|
|
59
|
+
logger.info(`[reference] Generated ${imageUrl}`);
|
|
60
|
+
return ok(`Reference image generated: ${imageUrl}`, [], { imageUrl, billable: true });
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=reference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference.js","sourceRoot":"","sources":["../../src/generators/reference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AA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export type { SoundEffectParams, SoundEffectResult } from './generators/sound-effect.js';
|
|
14
14
|
export { generateImageAsset, imageAssetParamsSchema } from './generators/image.js';
|
|
15
15
|
export type { ImageAssetParams, ImageAssetResult } from './generators/image.js';
|
|
16
|
+
export { generateReferenceImage, referenceImageParamsSchema, REFERENCE_IMAGE_WIDTH, REFERENCE_IMAGE_HEIGHT, } from './generators/reference.js';
|
|
17
|
+
export type { ReferenceImageParams, ReferenceImageResult } from './generators/reference.js';
|
|
16
18
|
export { generateCharacter, characterParamsSchema } from './generators/character.js';
|
|
17
19
|
export type { CharacterParams, CharacterResult } from './generators/character.js';
|
|
18
20
|
export { generateProp, propParamsSchema } from './generators/prop.js';
|
|
@@ -23,6 +25,7 @@ export { generateAnimationAsset, animationParamsSchema, getConfiguredAnimationMo
|
|
|
23
25
|
export type { AnimationParams, AnimationResult } from './generators/animation.js';
|
|
24
26
|
export { fetchContentLength } from './http.js';
|
|
25
27
|
export { PIXAR_VOXEL_STYLE, MAX_COVER_DESIGN_CHARS, buildCoverArtPrompt } from './cover-prompt.js';
|
|
28
|
+
export { MAX_REFERENCE_DESIGN_CHARS, buildReferenceImagePrompt } from './reference-prompt.js';
|
|
26
29
|
export { JUDGE_DIMENSIONS, judgeScorecardSchema } from './judge-scorecard.js';
|
|
27
30
|
export type { JudgeDimension, JudgeScorecard } from './judge-scorecard.js';
|
|
28
31
|
export { JUDGE_GENRE_HINTS, JUDGE_MOBILE_HINT, JUDGE_RUBRIC, MAX_JUDGE_DESIGN_CHARS, MAX_JUDGE_SCENE_FACTS_CHARS, MAX_JUDGE_VERIFY_CHARS, buildJudgeRubric, } from './judge-prompt.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,UAAU,EACV,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,UAAU,G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E,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACvG,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,EAC3B,gCAAgC,EAChC,gCAAgC,EAChC,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACnG,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAM1D,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,yBAAyB,EACzB,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,12 +6,14 @@ export { generateBackground, backgroundParamsSchema } from './generators/backgro
|
|
|
6
6
|
export { generateBlockType, blockTypeParamsSchema } from './generators/block-type.js';
|
|
7
7
|
export { generateSoundEffect, soundEffectParamsSchema } from './generators/sound-effect.js';
|
|
8
8
|
export { generateImageAsset, imageAssetParamsSchema } from './generators/image.js';
|
|
9
|
+
export { generateReferenceImage, referenceImageParamsSchema, REFERENCE_IMAGE_WIDTH, REFERENCE_IMAGE_HEIGHT, } from './generators/reference.js';
|
|
9
10
|
export { generateCharacter, characterParamsSchema } from './generators/character.js';
|
|
10
11
|
export { generateProp, propParamsSchema } from './generators/prop.js';
|
|
11
12
|
export { generatePropVoxels, propVoxelParamsSchema, propVoxelGrids } from './generators/prop-voxel.js';
|
|
12
13
|
export { generateAnimationAsset, animationParamsSchema, getConfiguredAnimationModel, ANIMATION_MODEL_TEXT_TO_MOTION_3, ANIMATION_MODEL_TEXT_TO_MOTION_2, ANIMATION_MODEL_OLDER, } from './generators/animation.js';
|
|
13
14
|
export { fetchContentLength } from './http.js';
|
|
14
15
|
export { PIXAR_VOXEL_STYLE, MAX_COVER_DESIGN_CHARS, buildCoverArtPrompt } from './cover-prompt.js';
|
|
16
|
+
export { MAX_REFERENCE_DESIGN_CHARS, buildReferenceImagePrompt } from './reference-prompt.js';
|
|
15
17
|
export { JUDGE_DIMENSIONS, judgeScorecardSchema } from './judge-scorecard.js';
|
|
16
18
|
export { JUDGE_GENRE_HINTS, JUDGE_MOBILE_HINT, JUDGE_RUBRIC, MAX_JUDGE_DESIGN_CHARS, MAX_JUDGE_SCENE_FACTS_CHARS, MAX_JUDGE_VERIFY_CHARS, buildJudgeRubric, } from './judge-prompt.js';
|
|
17
19
|
// The agent↔client terminal-failure contract. Also published as the
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,IAAI,EAAE,EAAE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,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAG3B,oEAAoE;AACpE,gFAAgF;AAChF,gFAAgF;AAChF,oEAAoE;AACpE,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** How much of the design text reaches the image model; the rest is dropped. Same cap as covers. */
|
|
2
|
+
export declare const MAX_REFERENCE_DESIGN_CHARS = 1500;
|
|
3
|
+
/**
|
|
4
|
+
* Compose the image prompt for a reference image from a game's design text
|
|
5
|
+
* (GAME-DESIGN.md content or a one-off `--prompt`). Falls back to a generic
|
|
6
|
+
* voxel world when none is present.
|
|
7
|
+
*
|
|
8
|
+
* As with covers, the game NAME is never injected: image models render a name
|
|
9
|
+
* as on-image text.
|
|
10
|
+
*/
|
|
11
|
+
export declare function buildReferenceImagePrompt(gameDesign: string): string;
|
|
12
|
+
//# sourceMappingURL=reference-prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference-prompt.d.ts","sourceRoot":"","sources":["../src/reference-prompt.ts"],"names":[],"mappings":"AAsBA,oGAAoG;AACpG,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAO/C;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAQpE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reference-image prompt composition — the concept shot of a game's WORLD that
|
|
3
|
+
* `bitmagic reference make` generates and, once the creator accepts one, every
|
|
4
|
+
* later image generation and world forge takes as its visual reference.
|
|
5
|
+
*
|
|
6
|
+
* Beside `cover-prompt.ts` on purpose: a reference and a cover are the two
|
|
7
|
+
* pictures a game is judged by, and they must read as the same product. Both
|
|
8
|
+
* therefore end in `PIXAR_VOXEL_STYLE`, which also carries the no-text
|
|
9
|
+
* directive — a reference with a caption baked in would teach every skybox
|
|
10
|
+
* and block texture downstream to render letters.
|
|
11
|
+
*
|
|
12
|
+
* What differs is the framing. A cover is a composed illustration of the game
|
|
13
|
+
* (a hero, a moment, a mood). A reference is an ESTABLISHING SHOT of the place
|
|
14
|
+
* — the terrain, landmarks, vegetation, architecture, palette and weather —
|
|
15
|
+
* because that is what a skybox, a block texture and the world-forger's
|
|
16
|
+
* designer can actually take from it. Characters in focus would pull the
|
|
17
|
+
* img2img generators towards figures the assets do not want.
|
|
18
|
+
*
|
|
19
|
+
* No network, no credentials: this module composes strings.
|
|
20
|
+
*/
|
|
21
|
+
import { PIXAR_VOXEL_STYLE } from './cover-prompt.js';
|
|
22
|
+
/** How much of the design text reaches the image model; the rest is dropped. Same cap as covers. */
|
|
23
|
+
export const MAX_REFERENCE_DESIGN_CHARS = 1500;
|
|
24
|
+
const ESTABLISHING_SHOT = "Concept art: a wide establishing shot of the game's world — the place itself, seen from a " +
|
|
25
|
+
'slightly elevated vantage. Show its terrain, landmarks, vegetation, architecture, colour ' +
|
|
26
|
+
'palette, weather and time of day. No characters in focus, no framing devices, no UI.';
|
|
27
|
+
/**
|
|
28
|
+
* Compose the image prompt for a reference image from a game's design text
|
|
29
|
+
* (GAME-DESIGN.md content or a one-off `--prompt`). Falls back to a generic
|
|
30
|
+
* voxel world when none is present.
|
|
31
|
+
*
|
|
32
|
+
* As with covers, the game NAME is never injected: image models render a name
|
|
33
|
+
* as on-image text.
|
|
34
|
+
*/
|
|
35
|
+
export function buildReferenceImagePrompt(gameDesign) {
|
|
36
|
+
const excerpt = gameDesign.trim().slice(0, MAX_REFERENCE_DESIGN_CHARS);
|
|
37
|
+
if (!excerpt) {
|
|
38
|
+
return `${ESTABLISHING_SHOT} A charming voxel world full of character. ${PIXAR_VOXEL_STYLE}`;
|
|
39
|
+
}
|
|
40
|
+
return `${ESTABLISHING_SHOT}\nThe game:\n${excerpt}\n\n${PIXAR_VOXEL_STYLE}`;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=reference-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference-prompt.js","sourceRoot":"","sources":["../src/reference-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,oGAAoG;AACpG,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAE/C,MAAM,iBAAiB,GACrB,4FAA4F;IAC5F,2FAA2F;IAC3F,sFAAsF,CAAC;AAEzF;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB,CAAC,UAAkB;IAC1D,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,0BAA0B,CAAC,CAAC;IAEvE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,iBAAiB,8CAA8C,iBAAiB,EAAE,CAAC;IAC/F,CAAC;IAED,OAAO,GAAG,iBAAiB,gBAAgB,OAAO,OAAO,iBAAiB,EAAE,CAAC;AAC/E,CAAC"}
|