@bitmagic/asset-core 0.2.20-dev.19 → 0.2.20-dev.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/dist/generators/character-library.d.ts +31 -159
- package/dist/generators/character-library.d.ts.map +1 -1
- package/dist/generators/character-library.js +56 -166
- package/dist/generators/character-library.js.map +1 -1
- package/dist/generators/character.d.ts +0 -31
- package/dist/generators/character.d.ts.map +1 -1
- package/dist/generators/character.js +19 -121
- package/dist/generators/character.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/managed-hosts.d.ts +0 -29
- package/dist/managed-hosts.d.ts.map +0 -1
- package/dist/managed-hosts.js +0 -49
- package/dist/managed-hosts.js.map +0 -1
|
@@ -1,46 +1,31 @@
|
|
|
1
1
|
import type { CoreLogger, ForgerClient } from '../types.js';
|
|
2
2
|
/**
|
|
3
|
-
* Search the Asset Forger's library of ready-made rigged characters.
|
|
3
|
+
* Search the Asset Forger's library of ready-made rigged voxel characters.
|
|
4
4
|
*
|
|
5
5
|
* Most prompts a creator types already have a good body in the library, and
|
|
6
6
|
* using one is instant and free where forging costs minutes and a vendor call.
|
|
7
|
-
* This module answers
|
|
8
|
-
*
|
|
9
|
-
* ({@link searchLibraryCharacters}). The decision to use a result lives in
|
|
10
|
-
* `character.ts`; the decision to show one to a creator lives in the CLI.
|
|
7
|
+
* This module answers "is there one close enough?" and nothing else — the
|
|
8
|
+
* decision to use it lives in `character.ts`.
|
|
11
9
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* 500, an empty index, nothing above the floor — resolves to an empty result with
|
|
19
|
-
* a `reason`. That property is what makes "fall back to forging" structural
|
|
20
|
-
* instead of a `try/catch` somebody can forget.
|
|
21
|
-
*
|
|
22
|
-
* ## Two representations, one row
|
|
23
|
-
*
|
|
24
|
-
* The catalogue keys a character on `sid` and hangs BOTH representations off it:
|
|
25
|
-
* a voxel body (`.vxl`) and a textured low-poly rig (a KTX2 GLB). They are
|
|
26
|
-
* separate assets with separate vectors and separate publication state, and a
|
|
27
|
-
* character may have either or both — so the caller says which one it wants and
|
|
28
|
-
* an empty result NEVER falls back to the other medium. Feeding a voxel body to
|
|
29
|
-
* a low-poly game would defeat the point of the art style, and vice versa.
|
|
30
|
-
*
|
|
31
|
-
* Measured in production: 2,261 voxel bodies against 197 low-poly ones, so a
|
|
32
|
-
* low-poly miss is much likelier and the fallback-to-forge path matters more.
|
|
10
|
+
* `findLibraryCharacter` NEVER throws and never rejects. Every failure — no
|
|
11
|
+
* credentials, a network error, a 500, an empty index, nothing above the floor —
|
|
12
|
+
* resolves to `{ match: null, reason }`. That property is what makes "fall back
|
|
13
|
+
* to forging" structural instead of a `try/catch` somebody can forget, and it
|
|
14
|
+
* matters more than it looks: production's index is EMPTY today, so the empty
|
|
15
|
+
* case is the normal path at launch rather than an edge case.
|
|
33
16
|
*
|
|
34
17
|
* ## The upstream contract, as measured against the live service
|
|
35
18
|
*
|
|
36
|
-
* `GET /ai/v1/find-character`, Basic auth, query params:
|
|
37
|
-
* blank is a 400), `
|
|
38
|
-
*
|
|
39
|
-
*
|
|
19
|
+
* `GET /ai/v1/find-voxel-character`, Basic auth, query params:
|
|
20
|
+
* `prompt` (required; blank is a 400), `threshold` (0-1, **400** when malformed
|
|
21
|
+
* or out of range), `limit` (**400** when malformed), and optional
|
|
22
|
+
* `species` / `hasTail`.
|
|
40
23
|
*
|
|
41
|
-
* - **`
|
|
42
|
-
*
|
|
43
|
-
*
|
|
24
|
+
* - **`limit >= 17` fails every time**, with a 500 and
|
|
25
|
+
* `"Failed to parse search result"` — the Python subprocess output is
|
|
26
|
+
* truncated before the route parses it. Verified across prompts and repeats,
|
|
27
|
+
* with the boundary between 16 and 17. {@link LIBRARY_CANDIDATE_LIMIT} stays
|
|
28
|
+
* far below it, and {@link MAX_SAFE_LIMIT} documents the cliff.
|
|
44
29
|
* - **`assetUrl` is nullable.** The `/seed` bootstrap path indexes captions with
|
|
45
30
|
* no files, so a row can be findable but not usable. Candidates without one
|
|
46
31
|
* are skipped in favour of the next.
|
|
@@ -49,11 +34,6 @@ import type { CoreLogger, ForgerClient } from '../types.js';
|
|
|
49
34
|
* derived guess would silently collapse the result set to zero and look
|
|
50
35
|
* exactly like an empty index — so it is deliberately never sent, and neither
|
|
51
36
|
* is `hasTail`. The prompt embedding already carries both.
|
|
52
|
-
*
|
|
53
|
-
* The `limit >= 17` cliff this module used to guard against is GONE: both search
|
|
54
|
-
* routes now return through a result file rather than the Python subprocess's
|
|
55
|
-
* stdout, which is what the 20,000-character truncation used to eat.
|
|
56
|
-
* {@link MAX_SAFE_LIMIT} is kept as a cheap cap, no longer as a workaround.
|
|
57
37
|
*/
|
|
58
38
|
/**
|
|
59
39
|
* How the library participates in character generation.
|
|
@@ -78,16 +58,8 @@ export type LibraryMissReason =
|
|
|
78
58
|
| 'no-asset-url'
|
|
79
59
|
/** The response was not the shape the route documents. */
|
|
80
60
|
| 'malformed';
|
|
81
|
-
/**
|
|
82
|
-
* Which body a search is for.
|
|
83
|
-
*
|
|
84
|
-
* Not a boolean, and not derived from `voxelize` inside this module: the caller
|
|
85
|
-
* owns the art-style decision and this module owns the query. A mismatched
|
|
86
|
-
* default here would silently serve cubes to a low-poly game.
|
|
87
|
-
*/
|
|
88
|
-
export type LibraryRepresentation = 'voxel' | 'lowpoly';
|
|
89
61
|
/** The subset of a library row this package consumes. */
|
|
90
|
-
export interface
|
|
62
|
+
export interface VoxelCharacterMatch {
|
|
91
63
|
/** Corpus id, e.g. `b0009` — the only field that makes a pick auditable. */
|
|
92
64
|
sid: string;
|
|
93
65
|
/** Non-null by construction: rows without one are filtered out before selection. */
|
|
@@ -98,61 +70,22 @@ export interface LibraryCharacterMatch {
|
|
|
98
70
|
subject: string | null;
|
|
99
71
|
similarity: number;
|
|
100
72
|
}
|
|
101
|
-
/** @deprecated Named for when the library held voxels only. Use {@link LibraryCharacterMatch}. */
|
|
102
|
-
export type VoxelCharacterMatch = LibraryCharacterMatch;
|
|
103
73
|
export interface LibrarySearchOutcome {
|
|
104
|
-
match:
|
|
74
|
+
match: VoxelCharacterMatch | null;
|
|
105
75
|
reason?: LibraryMissReason;
|
|
106
76
|
/** Best similarity seen even when it lost — this is what `shadow` mode reports. */
|
|
107
77
|
topSimilarity?: number;
|
|
108
78
|
}
|
|
109
79
|
/**
|
|
110
|
-
* The usable-match floor
|
|
111
|
-
*
|
|
112
|
-
* Was 0.45, from `game/scripts/vxl-v10-search-selftest.mjs`, which ranked the
|
|
113
|
-
* corpus in memory and put realistic prompts at 0.62-0.80. Raised to 0.55 on
|
|
114
|
-
* 2026-09-09 after measuring against the live index with CONTROLS as well as
|
|
115
|
-
* matches — the half the original sweep did not have.
|
|
116
|
-
*
|
|
117
|
-
* At 0.45 two of eight non-humanoid controls substituted: "a red sports car"
|
|
118
|
-
* fetched a race-car driver at 0.492, "a sailing boat on open sea" an elderly man
|
|
119
|
-
* at 0.468. Both are noise, and 0.45 admitted them. 0.55 rejects both, rejects
|
|
120
|
-
* the 0.522 pick this corpus was already known to get wrong, and costs nothing:
|
|
121
|
-
* the weakest genuine match measured 0.624, so every real hit still clears it.
|
|
122
|
-
*
|
|
123
|
-
* What it does NOT fix, and no floor can: a humanoid prompt the corpus cannot
|
|
124
|
-
* answer scores 0.552-0.698 here, inside the genuine range. See
|
|
125
|
-
* {@link DEFAULT_LOWPOLY_LIBRARY_THRESHOLD} for the numbers and what that costs.
|
|
126
|
-
*/
|
|
127
|
-
export declare const DEFAULT_LIBRARY_THRESHOLD = 0.55;
|
|
128
|
-
/**
|
|
129
|
-
* The low-poly floor, set higher than the voxel one on purpose.
|
|
130
|
-
*
|
|
131
|
-
* Measured 2026-09-09 against the live production index, scoring prompts that
|
|
132
|
-
* should match against prompts that should not (the method that produced 0.45):
|
|
133
|
-
*
|
|
134
|
-
* | | voxel, 2,261 bodies | low-poly, 197 |
|
|
135
|
-
* | --- | --- | --- |
|
|
136
|
-
* | genuine matches | 0.624 - 0.831 | 0.613 - 0.801 |
|
|
137
|
-
* | non-humanoid controls (a chair, a boat) | up to 0.492 | up to 0.435 |
|
|
138
|
-
* | HUMANOID prompts the shelf cannot answer | 0.552 - 0.698 | 0.420 - 0.765 |
|
|
139
|
-
*
|
|
140
|
-
* That third row is the one that matters, and it is why no floor is a complete
|
|
141
|
-
* answer: a wrong-but-plausible person scores as high as a right one, so
|
|
142
|
-
* "beekeeper" fetching a humanoid bee (0.654) and "hazmat worker" fetching a boy
|
|
143
|
-
* mechanic (0.648) are not separable from a real hit by similarity alone.
|
|
80
|
+
* The usable-match floor.
|
|
144
81
|
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
* fallback, and forging is what happens today anyway — a missed hit costs money,
|
|
151
|
-
* a wrong hit costs the creator their character.
|
|
152
|
-
*
|
|
153
|
-
* Lower it as the shelf grows, via `CHARACTER_LIBRARY_THRESHOLD_LOWPOLY`.
|
|
82
|
+
* 0.45 is not invented here: `game/scripts/vxl-v10-search-selftest.mjs` already
|
|
83
|
+
* treats it as the line between a usable match and a coincidence, having ranked
|
|
84
|
+
* the corpus in memory against known queries. Measured top-1 similarities for
|
|
85
|
+
* realistic prompts run 0.62-0.80, so it accepts with margin — and it is well
|
|
86
|
+
* above the route's own 0.3 default, which is looser than we want.
|
|
154
87
|
*/
|
|
155
|
-
export declare const
|
|
88
|
+
export declare const DEFAULT_LIBRARY_THRESHOLD = 0.45;
|
|
156
89
|
/**
|
|
157
90
|
* Ask for a handful, not one.
|
|
158
91
|
*
|
|
@@ -161,14 +94,7 @@ export declare const DEFAULT_LOWPOLY_LIBRARY_THRESHOLD = 0.65;
|
|
|
161
94
|
* no meaningful cost.
|
|
162
95
|
*/
|
|
163
96
|
export declare const LIBRARY_CANDIDATE_LIMIT = 5;
|
|
164
|
-
/**
|
|
165
|
-
* A cap, no longer a workaround.
|
|
166
|
-
*
|
|
167
|
-
* This was the largest `limit` the route survived, back when results came out
|
|
168
|
-
* through a truncated stdout buffer. They come back through a result file now,
|
|
169
|
-
* and the API advertises 50 — but nothing here wants more than a handful, so the
|
|
170
|
-
* cap stays as cheap insurance rather than being raised for its own sake.
|
|
171
|
-
*/
|
|
97
|
+
/** The largest `limit` the route survives; see the module doc. The API advertises 50. */
|
|
172
98
|
export declare const MAX_SAFE_LIMIT = 16;
|
|
173
99
|
/**
|
|
174
100
|
* Read the mode per call rather than at module load, so a test or a CLI run can
|
|
@@ -176,12 +102,9 @@ export declare const MAX_SAFE_LIMIT = 16;
|
|
|
176
102
|
* for `ANIMATION_MODEL`. Unrecognised values fail CLOSED: an env typo must not
|
|
177
103
|
* be what turns library substitution on.
|
|
178
104
|
*/
|
|
179
|
-
export declare function getCharacterLibraryMode(
|
|
105
|
+
export declare function getCharacterLibraryMode(): CharacterLibraryMode;
|
|
180
106
|
/**
|
|
181
|
-
* The floor
|
|
182
|
-
* the low-poly corpus alone, by `CHARACTER_LIBRARY_THRESHOLD_LOWPOLY`.
|
|
183
|
-
*
|
|
184
|
-
* The two shelves default differently; see {@link DEFAULT_LOWPOLY_LIBRARY_THRESHOLD}.
|
|
107
|
+
* The floor, overridable by `CHARACTER_LIBRARY_THRESHOLD`.
|
|
185
108
|
*
|
|
186
109
|
* An env var rather than a request field: it is an operations dial for tuning
|
|
187
110
|
* against a growing corpus, not a creative choice, and an agent asked to pick a
|
|
@@ -191,68 +114,17 @@ export declare function getCharacterLibraryMode(representation: LibraryRepresent
|
|
|
191
114
|
* 0-1 or one that will not parse, so an unclamped typo would turn every
|
|
192
115
|
* character generation into a hard failure instead of a fallback.
|
|
193
116
|
*/
|
|
194
|
-
export declare function getCharacterLibraryThreshold(
|
|
117
|
+
export declare function getCharacterLibraryThreshold(): number;
|
|
195
118
|
export interface FindLibraryCharacterDeps {
|
|
196
119
|
forger: ForgerClient;
|
|
197
120
|
logger: CoreLogger;
|
|
198
|
-
/** Which body to search for. Required: there is no safe default across art styles. */
|
|
199
|
-
representation: LibraryRepresentation;
|
|
200
|
-
/**
|
|
201
|
-
* Override the shelf's floor. Omit for the tuned default, which is what
|
|
202
|
-
* automatic substitution wants; pass 0 for "give me the closest thing you
|
|
203
|
-
* have", which is what an explicit library-only request means.
|
|
204
|
-
*/
|
|
205
|
-
threshold?: number;
|
|
206
|
-
}
|
|
207
|
-
export interface SearchLibraryCharactersDeps {
|
|
208
|
-
forger: ForgerClient;
|
|
209
|
-
logger: CoreLogger;
|
|
210
|
-
/** Which shelf to search. Required: there is no safe default across art styles. */
|
|
211
|
-
representation: LibraryRepresentation;
|
|
212
|
-
/** How many rows to ask for. Clamped to {@link MAX_SAFE_LIMIT}; default {@link LIBRARY_CANDIDATE_LIMIT}. */
|
|
213
|
-
limit?: number;
|
|
214
121
|
}
|
|
215
|
-
export interface LibrarySearchResults {
|
|
216
|
-
/** Every usable row, in the order the route ranked them. Empty on any failure. */
|
|
217
|
-
candidates: LibraryCharacterMatch[];
|
|
218
|
-
/**
|
|
219
|
-
* The floor automatic substitution would have applied to this shelf.
|
|
220
|
-
*
|
|
221
|
-
* Returned rather than used, so a caller can SHOW which candidates clear the
|
|
222
|
-
* bar instead of silently dropping the ones that do not. That distinction is
|
|
223
|
-
* the whole point on this corpus: a humanoid prompt the shelf cannot answer
|
|
224
|
-
* scores inside the genuine range, so the number is information for a person,
|
|
225
|
-
* not a verdict (see {@link DEFAULT_LOWPOLY_LIBRARY_THRESHOLD}).
|
|
226
|
-
*/
|
|
227
|
-
threshold: number;
|
|
228
|
-
/** Why there are no candidates. Absent when there is at least one. */
|
|
229
|
-
reason?: LibraryMissReason;
|
|
230
|
-
/** Best similarity seen, INCLUDING rows dropped for having no file. */
|
|
231
|
-
topSimilarity?: number;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Every usable library character for a prompt, ranked, with the shelf's floor.
|
|
235
|
-
*
|
|
236
|
-
* The list form of {@link findLibraryCharacter}, and the same single request —
|
|
237
|
-
* the route has always returned candidates and selection has always thrown all
|
|
238
|
-
* but one away. Nothing here applies the floor: a caller that wants one body
|
|
239
|
-
* automatically wants `findLibraryCharacter`, and a caller that wants to show a
|
|
240
|
-
* creator their options wants every row plus the bar to mark them against.
|
|
241
|
-
*
|
|
242
|
-
* Never throws, for the same structural reason `findLibraryCharacter` does not:
|
|
243
|
-
* every failure resolves to an empty `candidates` with a `reason`.
|
|
244
|
-
*/
|
|
245
|
-
export declare function searchLibraryCharacters(prompt: string, deps: SearchLibraryCharactersDeps): Promise<LibrarySearchResults>;
|
|
246
122
|
/**
|
|
247
123
|
* Find the closest usable library character for a prompt.
|
|
248
124
|
*
|
|
249
125
|
* Selection is the highest-ranked row that has BOTH a usable `assetUrl` and a
|
|
250
126
|
* similarity at or above the floor — walking the list rather than taking the
|
|
251
127
|
* first, so an unpublished row costs a fallback instead of a forge.
|
|
252
|
-
*
|
|
253
|
-
* The floor is applied HERE rather than in the search, which is the only
|
|
254
|
-
* difference between the two: `deps.threshold` overrides it (0 for "the best
|
|
255
|
-
* available, whatever it scored"), and omitting it takes the shelf's own.
|
|
256
128
|
*/
|
|
257
129
|
export declare function findLibraryCharacter(prompt: string, deps: FindLibraryCharacterDeps): Promise<LibrarySearchOutcome>;
|
|
258
130
|
//# sourceMappingURL=character-library.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"character-library.d.ts","sourceRoot":"","sources":["../../src/generators/character-library.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5D
|
|
1
|
+
{"version":3,"file":"character-library.d.ts","sourceRoot":"","sources":["../../src/generators/character-library.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAA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,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,wBAAwB,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CA+D/B"}
|
|
@@ -1,58 +1,14 @@
|
|
|
1
|
+
const ENDPOINT = '/ai/v1/find-voxel-character';
|
|
1
2
|
/**
|
|
2
|
-
* The
|
|
3
|
+
* The usable-match floor.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* 0.45 is not invented here: `game/scripts/vxl-v10-search-selftest.mjs` already
|
|
6
|
+
* treats it as the line between a usable match and a coincidence, having ranked
|
|
7
|
+
* the corpus in memory against known queries. Measured top-1 similarities for
|
|
8
|
+
* realistic prompts run 0.62-0.80, so it accepts with margin — and it is well
|
|
9
|
+
* above the route's own 0.3 default, which is looser than we want.
|
|
7
10
|
*/
|
|
8
|
-
const
|
|
9
|
-
/**
|
|
10
|
-
* The usable-match floor for the voxel shelf.
|
|
11
|
-
*
|
|
12
|
-
* Was 0.45, from `game/scripts/vxl-v10-search-selftest.mjs`, which ranked the
|
|
13
|
-
* corpus in memory and put realistic prompts at 0.62-0.80. Raised to 0.55 on
|
|
14
|
-
* 2026-09-09 after measuring against the live index with CONTROLS as well as
|
|
15
|
-
* matches — the half the original sweep did not have.
|
|
16
|
-
*
|
|
17
|
-
* At 0.45 two of eight non-humanoid controls substituted: "a red sports car"
|
|
18
|
-
* fetched a race-car driver at 0.492, "a sailing boat on open sea" an elderly man
|
|
19
|
-
* at 0.468. Both are noise, and 0.45 admitted them. 0.55 rejects both, rejects
|
|
20
|
-
* the 0.522 pick this corpus was already known to get wrong, and costs nothing:
|
|
21
|
-
* the weakest genuine match measured 0.624, so every real hit still clears it.
|
|
22
|
-
*
|
|
23
|
-
* What it does NOT fix, and no floor can: a humanoid prompt the corpus cannot
|
|
24
|
-
* answer scores 0.552-0.698 here, inside the genuine range. See
|
|
25
|
-
* {@link DEFAULT_LOWPOLY_LIBRARY_THRESHOLD} for the numbers and what that costs.
|
|
26
|
-
*/
|
|
27
|
-
export const DEFAULT_LIBRARY_THRESHOLD = 0.55;
|
|
28
|
-
/**
|
|
29
|
-
* The low-poly floor, set higher than the voxel one on purpose.
|
|
30
|
-
*
|
|
31
|
-
* Measured 2026-09-09 against the live production index, scoring prompts that
|
|
32
|
-
* should match against prompts that should not (the method that produced 0.45):
|
|
33
|
-
*
|
|
34
|
-
* | | voxel, 2,261 bodies | low-poly, 197 |
|
|
35
|
-
* | --- | --- | --- |
|
|
36
|
-
* | genuine matches | 0.624 - 0.831 | 0.613 - 0.801 |
|
|
37
|
-
* | non-humanoid controls (a chair, a boat) | up to 0.492 | up to 0.435 |
|
|
38
|
-
* | HUMANOID prompts the shelf cannot answer | 0.552 - 0.698 | 0.420 - 0.765 |
|
|
39
|
-
*
|
|
40
|
-
* That third row is the one that matters, and it is why no floor is a complete
|
|
41
|
-
* answer: a wrong-but-plausible person scores as high as a right one, so
|
|
42
|
-
* "beekeeper" fetching a humanoid bee (0.654) and "hazmat worker" fetching a boy
|
|
43
|
-
* mechanic (0.648) are not separable from a real hit by similarity alone.
|
|
44
|
-
*
|
|
45
|
-
* A floor can only trade coverage against precision, and the right trade differs
|
|
46
|
-
* by shelf SIZE. With 2,261 bodies a strong score is usually a real match; with
|
|
47
|
-
* 197 it is more often the nearest of too few. So low-poly starts conservative:
|
|
48
|
-
* at 0.65 only 2 of 10 unanswerable humanoid prompts substitute, against 9 of 10
|
|
49
|
-
* at 0.45, while genuine matches at 0.673-0.801 still land. Forging is the
|
|
50
|
-
* fallback, and forging is what happens today anyway — a missed hit costs money,
|
|
51
|
-
* a wrong hit costs the creator their character.
|
|
52
|
-
*
|
|
53
|
-
* Lower it as the shelf grows, via `CHARACTER_LIBRARY_THRESHOLD_LOWPOLY`.
|
|
54
|
-
*/
|
|
55
|
-
export const DEFAULT_LOWPOLY_LIBRARY_THRESHOLD = 0.65;
|
|
11
|
+
export const DEFAULT_LIBRARY_THRESHOLD = 0.45;
|
|
56
12
|
/**
|
|
57
13
|
* Ask for a handful, not one.
|
|
58
14
|
*
|
|
@@ -61,14 +17,7 @@ export const DEFAULT_LOWPOLY_LIBRARY_THRESHOLD = 0.65;
|
|
|
61
17
|
* no meaningful cost.
|
|
62
18
|
*/
|
|
63
19
|
export const LIBRARY_CANDIDATE_LIMIT = 5;
|
|
64
|
-
/**
|
|
65
|
-
* A cap, no longer a workaround.
|
|
66
|
-
*
|
|
67
|
-
* This was the largest `limit` the route survived, back when results came out
|
|
68
|
-
* through a truncated stdout buffer. They come back through a result file now,
|
|
69
|
-
* and the API advertises 50 — but nothing here wants more than a handful, so the
|
|
70
|
-
* cap stays as cheap insurance rather than being raised for its own sake.
|
|
71
|
-
*/
|
|
20
|
+
/** The largest `limit` the route survives; see the module doc. The API advertises 50. */
|
|
72
21
|
export const MAX_SAFE_LIMIT = 16;
|
|
73
22
|
/**
|
|
74
23
|
* Read the mode per call rather than at module load, so a test or a CLI run can
|
|
@@ -76,24 +25,12 @@ export const MAX_SAFE_LIMIT = 16;
|
|
|
76
25
|
* for `ANIMATION_MODEL`. Unrecognised values fail CLOSED: an env typo must not
|
|
77
26
|
* be what turns library substitution on.
|
|
78
27
|
*/
|
|
79
|
-
export function getCharacterLibraryMode(
|
|
80
|
-
|
|
81
|
-
// reviewed bodies and is live; low-poly has 197 and wants a spell in `shadow`
|
|
82
|
-
// first. One switch would force turning voxel OFF to hold low-poly back.
|
|
83
|
-
// Note the low-poly dial does NOT inherit from CHARACTER_LIBRARY: an operator
|
|
84
|
-
// who turned the voxel library on months ago did not consent to substituting
|
|
85
|
-
// low-poly bodies, so this stays off until somebody sets it.
|
|
86
|
-
const configured = representation === 'lowpoly'
|
|
87
|
-
? process.env.CHARACTER_LIBRARY_LOWPOLY
|
|
88
|
-
: process.env.CHARACTER_LIBRARY;
|
|
89
|
-
const raw = configured?.trim().toLowerCase();
|
|
28
|
+
export function getCharacterLibraryMode() {
|
|
29
|
+
const raw = process.env.CHARACTER_LIBRARY?.trim().toLowerCase();
|
|
90
30
|
return raw === 'on' || raw === 'shadow' ? raw : 'off';
|
|
91
31
|
}
|
|
92
32
|
/**
|
|
93
|
-
* The floor
|
|
94
|
-
* the low-poly corpus alone, by `CHARACTER_LIBRARY_THRESHOLD_LOWPOLY`.
|
|
95
|
-
*
|
|
96
|
-
* The two shelves default differently; see {@link DEFAULT_LOWPOLY_LIBRARY_THRESHOLD}.
|
|
33
|
+
* The floor, overridable by `CHARACTER_LIBRARY_THRESHOLD`.
|
|
97
34
|
*
|
|
98
35
|
* An env var rather than a request field: it is an operations dial for tuning
|
|
99
36
|
* against a growing corpus, not a creative choice, and an agent asked to pick a
|
|
@@ -103,71 +40,30 @@ export function getCharacterLibraryMode(representation) {
|
|
|
103
40
|
* 0-1 or one that will not parse, so an unclamped typo would turn every
|
|
104
41
|
* character generation into a hard failure instead of a fallback.
|
|
105
42
|
*/
|
|
106
|
-
export function getCharacterLibraryThreshold(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// The shared dial still overrides both, so an operator who does not care about
|
|
111
|
-
// the split keeps one knob; only the DEFAULT differs per shelf.
|
|
112
|
-
const raw = (lowpoly ? process.env.CHARACTER_LIBRARY_THRESHOLD_LOWPOLY : undefined)
|
|
113
|
-
?? process.env.CHARACTER_LIBRARY_THRESHOLD;
|
|
114
|
-
const parsed = Number.parseFloat(raw ?? '');
|
|
115
|
-
if (!Number.isFinite(parsed)) {
|
|
116
|
-
return lowpoly ? DEFAULT_LOWPOLY_LIBRARY_THRESHOLD : DEFAULT_LIBRARY_THRESHOLD;
|
|
117
|
-
}
|
|
43
|
+
export function getCharacterLibraryThreshold() {
|
|
44
|
+
const parsed = Number.parseFloat(process.env.CHARACTER_LIBRARY_THRESHOLD ?? '');
|
|
45
|
+
if (!Number.isFinite(parsed))
|
|
46
|
+
return DEFAULT_LIBRARY_THRESHOLD;
|
|
118
47
|
return Math.min(1, Math.max(0, parsed));
|
|
119
48
|
}
|
|
120
|
-
/** The usable rows of a raw response, in the route's own order, plus what was seen. */
|
|
121
|
-
function normaliseCandidates(items) {
|
|
122
|
-
const candidates = [];
|
|
123
|
-
let topSimilarity = 0;
|
|
124
|
-
for (const item of items) {
|
|
125
|
-
const similarity = typeof item?.similarity === 'number' ? item.similarity : 0;
|
|
126
|
-
// Counted before the usability check on purpose: "how close did the shelf
|
|
127
|
-
// come" is a question about the corpus, and a strong row that has no file
|
|
128
|
-
// yet still answers it. That is what tells an operator the index needs
|
|
129
|
-
// PUBLISHING rather than seeding.
|
|
130
|
-
if (similarity > topSimilarity)
|
|
131
|
-
topSimilarity = similarity;
|
|
132
|
-
const assetUrl = typeof item?.assetUrl === 'string' ? item.assetUrl.trim() : '';
|
|
133
|
-
const sid = typeof item?.sid === 'string' ? item.sid : '';
|
|
134
|
-
if (!assetUrl || !sid)
|
|
135
|
-
continue;
|
|
136
|
-
candidates.push({
|
|
137
|
-
sid,
|
|
138
|
-
assetUrl,
|
|
139
|
-
description: typeof item.description === 'string' ? item.description : '',
|
|
140
|
-
subject: typeof item.subject === 'string' ? item.subject : null,
|
|
141
|
-
similarity,
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
return { candidates, topSimilarity };
|
|
145
|
-
}
|
|
146
49
|
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* The list form of {@link findLibraryCharacter}, and the same single request —
|
|
150
|
-
* the route has always returned candidates and selection has always thrown all
|
|
151
|
-
* but one away. Nothing here applies the floor: a caller that wants one body
|
|
152
|
-
* automatically wants `findLibraryCharacter`, and a caller that wants to show a
|
|
153
|
-
* creator their options wants every row plus the bar to mark them against.
|
|
50
|
+
* Find the closest usable library character for a prompt.
|
|
154
51
|
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
52
|
+
* Selection is the highest-ranked row that has BOTH a usable `assetUrl` and a
|
|
53
|
+
* similarity at or above the floor — walking the list rather than taking the
|
|
54
|
+
* first, so an unpublished row costs a fallback instead of a forge.
|
|
157
55
|
*/
|
|
158
|
-
export async function
|
|
159
|
-
const { forger, logger
|
|
160
|
-
const threshold = getCharacterLibraryThreshold(representation);
|
|
56
|
+
export async function findLibraryCharacter(prompt, deps) {
|
|
57
|
+
const { forger, logger } = deps;
|
|
161
58
|
if (!forger.hasCredentials()) {
|
|
162
|
-
return {
|
|
59
|
+
return { match: null, reason: 'disabled' };
|
|
163
60
|
}
|
|
61
|
+
const threshold = getCharacterLibraryThreshold();
|
|
164
62
|
let body;
|
|
165
63
|
try {
|
|
166
64
|
body = await forger.get(ENDPOINT, {
|
|
167
65
|
prompt,
|
|
168
|
-
|
|
169
|
-
// Deliberately 0, so the FLOOR is applied by the caller and not by the
|
|
170
|
-
// route.
|
|
66
|
+
// Deliberately 0, so the FLOOR is applied here and not by the route.
|
|
171
67
|
//
|
|
172
68
|
// Sending the real floor looks tidier and is worse: the route filters the
|
|
173
69
|
// rows out before we see them, so every miss comes back as an empty list.
|
|
@@ -177,54 +73,48 @@ export async function searchLibraryCharacters(prompt, deps) {
|
|
|
177
73
|
// mode was added to collect. Omitting it is not an option either: the route
|
|
178
74
|
// defaults to 0.3, which is its own silent filter.
|
|
179
75
|
threshold: 0,
|
|
180
|
-
limit: Math.min(
|
|
76
|
+
limit: Math.min(LIBRARY_CANDIDATE_LIMIT, MAX_SAFE_LIMIT),
|
|
181
77
|
}, 'CharacterLibrary');
|
|
182
78
|
}
|
|
183
79
|
catch (error) {
|
|
184
80
|
// Includes the route's own 500s, which surface as a non-2xx throw.
|
|
185
|
-
logger.warn({ err: error }, '[character-library] Search failed');
|
|
186
|
-
return {
|
|
81
|
+
logger.warn({ err: error }, '[character-library] Search failed; forging instead');
|
|
82
|
+
return { match: null, reason: 'unreachable' };
|
|
187
83
|
}
|
|
188
84
|
if (!Array.isArray(body?.items)) {
|
|
189
|
-
logger.warn({ error: body?.error }, '[character-library] Unexpected search response');
|
|
190
|
-
return {
|
|
85
|
+
logger.warn({ error: body?.error }, '[character-library] Unexpected search response; forging instead');
|
|
86
|
+
return { match: null, reason: 'malformed' };
|
|
191
87
|
}
|
|
192
88
|
const items = body.items;
|
|
193
89
|
if (items.length === 0) {
|
|
194
|
-
return {
|
|
90
|
+
return { match: null, reason: 'empty' };
|
|
91
|
+
}
|
|
92
|
+
let topSimilarity = 0;
|
|
93
|
+
let sawUsable = false;
|
|
94
|
+
for (const item of items) {
|
|
95
|
+
const similarity = typeof item?.similarity === 'number' ? item.similarity : 0;
|
|
96
|
+
if (similarity > topSimilarity)
|
|
97
|
+
topSimilarity = similarity;
|
|
98
|
+
const assetUrl = typeof item?.assetUrl === 'string' ? item.assetUrl.trim() : '';
|
|
99
|
+
const sid = typeof item?.sid === 'string' ? item.sid : '';
|
|
100
|
+
if (!assetUrl || !sid)
|
|
101
|
+
continue;
|
|
102
|
+
sawUsable = true;
|
|
103
|
+
if (similarity < threshold)
|
|
104
|
+
continue;
|
|
105
|
+
return {
|
|
106
|
+
match: {
|
|
107
|
+
sid,
|
|
108
|
+
assetUrl,
|
|
109
|
+
description: typeof item.description === 'string' ? item.description : '',
|
|
110
|
+
subject: typeof item.subject === 'string' ? item.subject : null,
|
|
111
|
+
similarity,
|
|
112
|
+
},
|
|
113
|
+
topSimilarity,
|
|
114
|
+
};
|
|
195
115
|
}
|
|
196
|
-
const { candidates, topSimilarity } = normaliseCandidates(items);
|
|
197
116
|
// Separating these two is what tells an operator which half is missing: rows
|
|
198
117
|
// with no files need PUBLISHING, an empty index needs SEEDING.
|
|
199
|
-
|
|
200
|
-
return { candidates, threshold, reason: 'no-asset-url', topSimilarity };
|
|
201
|
-
}
|
|
202
|
-
return { candidates, threshold, topSimilarity };
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Find the closest usable library character for a prompt.
|
|
206
|
-
*
|
|
207
|
-
* Selection is the highest-ranked row that has BOTH a usable `assetUrl` and a
|
|
208
|
-
* similarity at or above the floor — walking the list rather than taking the
|
|
209
|
-
* first, so an unpublished row costs a fallback instead of a forge.
|
|
210
|
-
*
|
|
211
|
-
* The floor is applied HERE rather than in the search, which is the only
|
|
212
|
-
* difference between the two: `deps.threshold` overrides it (0 for "the best
|
|
213
|
-
* available, whatever it scored"), and omitting it takes the shelf's own.
|
|
214
|
-
*/
|
|
215
|
-
export async function findLibraryCharacter(prompt, deps) {
|
|
216
|
-
const { candidates, reason, topSimilarity } = await searchLibraryCharacters(prompt, deps);
|
|
217
|
-
// Spread rather than assigned, because a caller distinguishes "no rows at all"
|
|
218
|
-
// (no score to report) from "rows, none close enough", and an explicit
|
|
219
|
-
// `topSimilarity: undefined` is not the same shape as an absent key.
|
|
220
|
-
const seen = topSimilarity !== undefined ? { topSimilarity } : {};
|
|
221
|
-
if (candidates.length === 0) {
|
|
222
|
-
return { match: null, reason, ...seen };
|
|
223
|
-
}
|
|
224
|
-
const threshold = deps.threshold ?? getCharacterLibraryThreshold(deps.representation);
|
|
225
|
-
const match = candidates.find((candidate) => candidate.similarity >= threshold);
|
|
226
|
-
return match
|
|
227
|
-
? { match, ...seen }
|
|
228
|
-
: { match: null, reason: 'below-threshold', ...seen };
|
|
118
|
+
return { match: null, reason: sawUsable ? 'below-threshold' : 'no-asset-url', topSimilarity };
|
|
229
119
|
}
|
|
230
120
|
//# sourceMappingURL=character-library.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"character-library.js","sourceRoot":"","sources":["../../src/generators/character-library.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"character-library.js","sourceRoot":"","sources":["../../src/generators/character-library.ts"],"names":[],"mappings":"AAoFA,MAAM,QAAQ,GAAG,6BAA6B,CAAC;AAE/C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAEzC,yFAAyF;AACzF,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB;IAC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AAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1D,IAAI,CAAC,QAAQ,IAAI,CAAC,GAAG;YAAE,SAAS;QAChC,SAAS,GAAG,IAAI,CAAC;QACjB,IAAI,UAAU,GAAG,SAAS;YAAE,SAAS;QACrC,OAAO;YACL,KAAK,EAAE;gBACL,GAAG;gBACH,QAAQ;gBACR,WAAW,EAAE,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;gBACzE,OAAO,EAAE,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;gBAC/D,UAAU;aACX;YACD,aAAa;SACd,CAAC;IACJ,CAAC;IAED,6EAA6E;IAC7E,+DAA+D;IAC/D,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,cAAc,EAAE,aAAa,EAAE,CAAC;AAChG,CAAC"}
|
|
@@ -22,23 +22,6 @@ export declare const characterParamsSchema: z.ZodObject<{
|
|
|
22
22
|
applyToPlayer: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
23
23
|
headScale: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
24
24
|
assetId: z.ZodOptional<z.ZodString>;
|
|
25
|
-
libraryOnly: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
26
|
-
libraryPick: z.ZodOptional<z.ZodObject<{
|
|
27
|
-
sid: z.ZodString;
|
|
28
|
-
assetUrl: z.ZodString;
|
|
29
|
-
description: z.ZodOptional<z.ZodString>;
|
|
30
|
-
similarity: z.ZodNumber;
|
|
31
|
-
}, "strict", z.ZodTypeAny, {
|
|
32
|
-
sid: string;
|
|
33
|
-
assetUrl: string;
|
|
34
|
-
similarity: number;
|
|
35
|
-
description?: string | undefined;
|
|
36
|
-
}, {
|
|
37
|
-
sid: string;
|
|
38
|
-
assetUrl: string;
|
|
39
|
-
similarity: number;
|
|
40
|
-
description?: string | undefined;
|
|
41
|
-
}>>;
|
|
42
25
|
useLibrary: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
43
26
|
voxelize: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
44
27
|
meshModel: z.ZodOptional<z.ZodString>;
|
|
@@ -47,16 +30,9 @@ export declare const characterParamsSchema: z.ZodObject<{
|
|
|
47
30
|
prompt: string;
|
|
48
31
|
applyToPlayer: boolean;
|
|
49
32
|
headScale: number;
|
|
50
|
-
libraryOnly: boolean;
|
|
51
33
|
useLibrary: boolean;
|
|
52
34
|
voxelize: boolean;
|
|
53
35
|
assetId?: string | undefined;
|
|
54
|
-
libraryPick?: {
|
|
55
|
-
sid: string;
|
|
56
|
-
assetUrl: string;
|
|
57
|
-
similarity: number;
|
|
58
|
-
description?: string | undefined;
|
|
59
|
-
} | undefined;
|
|
60
36
|
meshModel?: string | undefined;
|
|
61
37
|
}, {
|
|
62
38
|
name: string;
|
|
@@ -64,13 +40,6 @@ export declare const characterParamsSchema: z.ZodObject<{
|
|
|
64
40
|
assetId?: string | undefined;
|
|
65
41
|
applyToPlayer?: boolean | undefined;
|
|
66
42
|
headScale?: number | undefined;
|
|
67
|
-
libraryOnly?: boolean | undefined;
|
|
68
|
-
libraryPick?: {
|
|
69
|
-
sid: string;
|
|
70
|
-
assetUrl: string;
|
|
71
|
-
similarity: number;
|
|
72
|
-
description?: string | undefined;
|
|
73
|
-
} | undefined;
|
|
74
43
|
useLibrary?: boolean | undefined;
|
|
75
44
|
voxelize?: boolean | undefined;
|
|
76
45
|
meshModel?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"character.d.ts","sourceRoot":"","sources":["../../src/generators/character.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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AAe,EACvB,IAAI,EAAE,YAAY,GACjB,OAAO,CAAC,eAAe,CAAC,CAiJ1B"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { fail, ok } from '../result.js';
|
|
3
|
-
import { isManagedAssetUrl } from '../managed-hosts.js';
|
|
4
3
|
import { formatZodIssues } from '../validation.js';
|
|
5
|
-
import { findLibraryCharacter, getCharacterLibraryMode
|
|
4
|
+
import { findLibraryCharacter, getCharacterLibraryMode } from './character-library.js';
|
|
6
5
|
/**
|
|
7
6
|
* The chibi house style every library body is built at. Named because the
|
|
8
7
|
* library search keys off it: a stored body has its head scale baked in, so a
|
|
@@ -42,18 +41,6 @@ export const characterParamsSchema = z.object({
|
|
|
42
41
|
assetId: z.string()
|
|
43
42
|
.optional()
|
|
44
43
|
.describe('Pre-generated asset id from the manifest. The character is stored in world.json assets[] under this id so code can reference it via registerNpc({ characterAssetId }).'),
|
|
45
|
-
libraryOnly: z.boolean()
|
|
46
|
-
.optional()
|
|
47
|
-
.default(false)
|
|
48
|
-
.describe('Take the closest ready-made body the library has and never forge. Free and instant; fails if the library has nothing usable rather than falling back to a paid generation. Ignores the quality floor, so a weak match is still returned — the reply says how close it was.'),
|
|
49
|
-
libraryPick: z.object({
|
|
50
|
-
sid: z.string().min(1),
|
|
51
|
-
assetUrl: z.string().min(1),
|
|
52
|
-
description: z.string().optional(),
|
|
53
|
-
similarity: z.number().min(0).max(1),
|
|
54
|
-
}).strict()
|
|
55
|
-
.optional()
|
|
56
|
-
.describe('A library body the caller has ALREADY chosen, from a prior search. Skips the search and the floor entirely and adds exactly this one; free, and nothing is forged. Use it to honour a creator picking from ranked candidates rather than taking whatever ranked first.'),
|
|
57
44
|
useLibrary: z.boolean()
|
|
58
45
|
.optional()
|
|
59
46
|
.default(true)
|
|
@@ -61,54 +48,12 @@ export const characterParamsSchema = z.object({
|
|
|
61
48
|
voxelize: z.boolean()
|
|
62
49
|
.optional()
|
|
63
50
|
.default(true)
|
|
64
|
-
.describe('Voxelize the rigged body (default — the voxel house style). false keeps the textured low-poly rig the forger makes first, for a game whose artStyle is low-poly; the library is
|
|
51
|
+
.describe('Voxelize the rigged body (default — the voxel house style). false keeps the textured low-poly rig the forger makes first, for a game whose artStyle is low-poly; the voxel-only library is skipped.'),
|
|
65
52
|
meshModel: z.string()
|
|
66
53
|
.min(1)
|
|
67
54
|
.optional()
|
|
68
|
-
.describe("Asset Forger image-to-mesh model. Low-poly characters default to 'runware-rodin-gen-2', which forges a true low-poly body — an even quad remesh at a triangle count we chose —
|
|
55
|
+
.describe("Asset Forger image-to-mesh model. Low-poly characters default to 'runware-rodin-gen-2', which forges a true low-poly body — an even quad remesh at a triangle count we chose — for ~$0.40 and ~3 minutes. Pass 'unified-trellis' to put one back on the free lane; voxel characters use the Forger default."),
|
|
69
56
|
}).strict();
|
|
70
|
-
/**
|
|
71
|
-
* The combinations `libraryOnly` and `libraryPick` rule out.
|
|
72
|
-
*
|
|
73
|
-
* Checked here rather than as a `.superRefine` on the schema, because that turns
|
|
74
|
-
* `characterParamsSchema` into a `ZodEffects` and the exported object's `.shape`
|
|
75
|
-
* is what other packages build their own tool schemas out of —
|
|
76
|
-
* `game-play-agent/src/mastra/tools/character-generation-tool.ts` reads five
|
|
77
|
-
* fields off it. A refinement would be tidier and would break them.
|
|
78
|
-
*/
|
|
79
|
-
function contradiction(input) {
|
|
80
|
-
if (input.libraryPick) {
|
|
81
|
-
// The same three the automatic path rules out, for the same reasons -- a
|
|
82
|
-
// pick is a stored body too, and nothing about having chosen it makes a
|
|
83
|
-
// forge parameter applicable.
|
|
84
|
-
if (input.libraryOnly) {
|
|
85
|
-
return 'libraryPick and libraryOnly contradict each other — one names the body to use, the other asks us to choose.';
|
|
86
|
-
}
|
|
87
|
-
if (!input.useLibrary) {
|
|
88
|
-
return 'libraryPick and useLibrary:false contradict each other — one names a stored body, the other forbids one.';
|
|
89
|
-
}
|
|
90
|
-
if (input.meshModel !== undefined) {
|
|
91
|
-
return 'meshModel selects how a character is FORGED, and libraryPick never forges.';
|
|
92
|
-
}
|
|
93
|
-
if (!isManagedAssetUrl(input.libraryPick.assetUrl)) {
|
|
94
|
-
// Defence in depth rather than a load-bearing gate: a creator can already
|
|
95
|
-
// put any URL in their own world.json by hand. What it protects is the
|
|
96
|
-
// claim -- a patch that says `source: 'library'` should not be able to
|
|
97
|
-
// carry a stranger's host.
|
|
98
|
-
return 'libraryPick.assetUrl must be an https URL on a bitmagic asset host.';
|
|
99
|
-
}
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
if (!input.libraryOnly)
|
|
103
|
-
return null;
|
|
104
|
-
if (!input.useLibrary) {
|
|
105
|
-
return 'libraryOnly and useLibrary:false contradict each other — one asks for a stored body, the other forbids it.';
|
|
106
|
-
}
|
|
107
|
-
if (input.meshModel !== undefined) {
|
|
108
|
-
return 'meshModel selects how a character is FORGED, and libraryOnly never forges.';
|
|
109
|
-
}
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
57
|
const ENDPOINT = '/ai/v1/generate-rigged-character/jobs';
|
|
113
58
|
/**
|
|
114
59
|
* The Asset Forger mesh model that forges a true low-poly body: an even quad
|
|
@@ -211,23 +156,6 @@ export async function generateCharacter(params, deps) {
|
|
|
211
156
|
return fail(formatZodIssues(parsed.error));
|
|
212
157
|
}
|
|
213
158
|
const input = parsed.data;
|
|
214
|
-
const conflict = contradiction(input);
|
|
215
|
-
if (conflict !== null) {
|
|
216
|
-
logger.warn({ conflict }, '[character] Contradictory parameters');
|
|
217
|
-
return fail(conflict);
|
|
218
|
-
}
|
|
219
|
-
// A body the caller has already chosen needs NOTHING from the Forger: no
|
|
220
|
-
// search, no floor, no dial, and no credentials -- so it answers before the
|
|
221
|
-
// credentials guard rather than after it. It still goes through
|
|
222
|
-
// `buildCharacterPatches`, which is the point: the deliberate write order
|
|
223
|
-
// that path documents stays in one place across all three ways a character
|
|
224
|
-
// can arrive.
|
|
225
|
-
if (input.libraryPick) {
|
|
226
|
-
const { sid, assetUrl, description, similarity } = input.libraryPick;
|
|
227
|
-
onProgress(`Adding ready-made character ${sid} from the library…`);
|
|
228
|
-
logger.info({ sid, similarity }, '[character] Adding the library character the caller chose');
|
|
229
|
-
return ok(`Character "${input.name}" added from the library (${sid}, ${Math.round(similarity * 100)}% match): ${assetUrl}`, buildCharacterPatches(input, assetUrl, 'library', description, sid), { assetId: input.assetId, characterUrl: assetUrl, library: { sid, similarity } });
|
|
230
|
-
}
|
|
231
159
|
if (!forger.hasCredentials()) {
|
|
232
160
|
logger.error('[character] Missing Asset Forger credentials');
|
|
233
161
|
return fail(forger.getMissingCredentialsMessage());
|
|
@@ -242,66 +170,36 @@ export async function generateCharacter(params, deps) {
|
|
|
242
170
|
// worse than forging. (zod fills the default, so "explicitly 150" and
|
|
243
171
|
// "omitted" are indistinguishable here — and identical in effect.)
|
|
244
172
|
//
|
|
245
|
-
//
|
|
246
|
-
//
|
|
247
|
-
// asking for the wrong one would hand a low-poly game a pile of cubes. Each
|
|
248
|
-
// medium has its own dial, so low-poly can sit in `shadow` while voxel is live.
|
|
173
|
+
// An unvoxelized request skips it too: every stored body is a voxel one, so the
|
|
174
|
+
// closest match would be in the wrong medium.
|
|
249
175
|
//
|
|
250
176
|
// An explicit meshModel suppresses it for the same reason a non-default
|
|
251
177
|
// headScale does: a library body was forged by whatever model made it, so
|
|
252
178
|
// handing one back would silently ignore the model the caller asked for --
|
|
253
179
|
// and on a paid mesh lane that is the entire point of the request.
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
const libraryWanted = input.libraryOnly || (libraryMode !== 'off' && input.useLibrary);
|
|
263
|
-
const librarySearchable = input.libraryOnly
|
|
264
|
-
|| (libraryWanted && input.headScale === DEFAULT_HEAD_SCALE && input.meshModel === undefined);
|
|
265
|
-
if (input.libraryOnly && input.headScale !== DEFAULT_HEAD_SCALE) {
|
|
266
|
-
logger.info({ headScale: input.headScale }, '[character] libraryOnly: head scale is baked into a stored body and cannot be applied');
|
|
267
|
-
onProgress(`Head scale ${input.headScale} cannot be applied to a ready-made body — using it as built.`);
|
|
180
|
+
const libraryMode = getCharacterLibraryMode();
|
|
181
|
+
const libraryWanted = libraryMode !== 'off' && input.useLibrary;
|
|
182
|
+
const librarySearchable = libraryWanted
|
|
183
|
+
&& input.headScale === DEFAULT_HEAD_SCALE
|
|
184
|
+
&& input.voxelize
|
|
185
|
+
&& input.meshModel === undefined;
|
|
186
|
+
if (libraryWanted && !input.voxelize) {
|
|
187
|
+
logger.info('[character] Library skipped: it holds voxel bodies only and this request keeps the low-poly rig');
|
|
268
188
|
}
|
|
269
189
|
if (librarySearchable) {
|
|
270
|
-
onProgress(
|
|
271
|
-
|
|
272
|
-
: 'Searching the character library…');
|
|
273
|
-
const outcome = await findLibraryCharacter(input.prompt, {
|
|
274
|
-
forger, logger, representation,
|
|
275
|
-
// No floor: the caller asked for the best available, not for a body that
|
|
276
|
-
// clears the bar automatic substitution has to clear.
|
|
277
|
-
...(input.libraryOnly ? { threshold: 0 } : {}),
|
|
278
|
-
});
|
|
190
|
+
onProgress('Searching the character library…');
|
|
191
|
+
const outcome = await findLibraryCharacter(input.prompt, { forger, logger });
|
|
279
192
|
const percent = (value) => `${Math.round(value * 100)}%`;
|
|
280
|
-
if (outcome.match &&
|
|
193
|
+
if (outcome.match && libraryMode === 'on') {
|
|
281
194
|
const { sid, similarity, subject, description, assetUrl } = outcome.match;
|
|
282
|
-
onProgress(
|
|
283
|
-
|
|
284
|
-
+ ' below what automatic substitution would accept.'
|
|
285
|
-
: `Found a ready-made character: ${subject ?? sid} (${percent(similarity)} match) — no generation needed.`);
|
|
286
|
-
logger.info({ sid, similarity, representation }, '[character] Using a library character');
|
|
195
|
+
onProgress(`Found a ready-made character: ${subject ?? sid} (${percent(similarity)} match) — no generation needed.`);
|
|
196
|
+
logger.info({ sid, similarity }, '[character] Using a library character');
|
|
287
197
|
return ok(`Character "${input.name}" taken from the library (${sid}, ${percent(similarity)} match): ${assetUrl}`, buildCharacterPatches(input, assetUrl, 'library', description, sid), { assetId: input.assetId, characterUrl: assetUrl, library: { sid, similarity } });
|
|
288
198
|
}
|
|
289
199
|
// `shadow` observes without substituting, and a miss falls through to the
|
|
290
200
|
// forge either way. The best score is logged even when it lost — that is the
|
|
291
201
|
// number that says whether the floor is set right.
|
|
292
|
-
logger.info({ mode: libraryMode,
|
|
293
|
-
// Stop here rather than forging. The whole point of libraryOnly is not to
|
|
294
|
-
// spend, so falling through would turn a free request into a paid one; and a
|
|
295
|
-
// failed result is not billable, so this costs the creator nothing at all.
|
|
296
|
-
if (input.libraryOnly) {
|
|
297
|
-
const nearest = outcome.topSimilarity !== undefined
|
|
298
|
-
? ` The closest was ${percent(outcome.topSimilarity)}, which had no usable file.`
|
|
299
|
-
: '';
|
|
300
|
-
logger.info({ representation, reason: outcome.reason, topSimilarity: outcome.topSimilarity }, '[character] libraryOnly found nothing usable');
|
|
301
|
-
return fail(`The ${representation} library has no usable body for "${input.prompt}".${nearest}`
|
|
302
|
-
+ ' Nothing was generated and nothing was charged —'
|
|
303
|
-
+ ' Run `bitmagic character generate` to forge one.');
|
|
304
|
-
}
|
|
202
|
+
logger.info({ mode: libraryMode, sid: outcome.match?.sid, reason: outcome.reason, topSimilarity: outcome.topSimilarity }, '[character] Library did not supply this character');
|
|
305
203
|
if (outcome.topSimilarity !== undefined && !outcome.match) {
|
|
306
204
|
onProgress(`No close library match (best ${percent(outcome.topSimilarity)}) — making a new character.`);
|
|
307
205
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"character.js","sourceRoot":"","sources":["../../src/generators/character.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,iBAAiB,EA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REFERENCE_IMAGE_WID
|
|
|
22
22
|
export type { ReferenceImageParams, ReferenceImageResult } from './generators/reference.js';
|
|
23
23
|
export { generateCharacter, characterParamsSchema, meshModelFor, meshModelIsPaid, LOW_POLY_MESH_MODEL, } from './generators/character.js';
|
|
24
24
|
export type { CharacterParams, CharacterResult } from './generators/character.js';
|
|
25
|
-
export { findLibraryCharacter,
|
|
26
|
-
export type { CharacterLibraryMode,
|
|
27
|
-
export { isManagedAssetHost, isManagedAssetUrl, MANAGED_HOST_SUFFIXES } from './managed-hosts.js';
|
|
25
|
+
export { findLibraryCharacter, getCharacterLibraryMode, getCharacterLibraryThreshold, DEFAULT_LIBRARY_THRESHOLD, LIBRARY_CANDIDATE_LIMIT, } from './generators/character-library.js';
|
|
26
|
+
export type { CharacterLibraryMode, LibraryMissReason, LibrarySearchOutcome, VoxelCharacterMatch, } from './generators/character-library.js';
|
|
28
27
|
export { generateProp, propParamsSchema } from './generators/prop.js';
|
|
29
28
|
export type { PropParams, PropResult } from './generators/prop.js';
|
|
30
29
|
export { generatePropVoxels, propVoxelParamsSchema, propVoxelGrids } from './generators/prop-voxel.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,cAAc,EACd,eAAe,EACf,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,kBAAkB,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js
CHANGED
|
@@ -11,8 +11,7 @@ export { formatZodIssues } from './validation.js';
|
|
|
11
11
|
export { generateImageAsset, imageAssetParamsSchema } from './generators/image.js';
|
|
12
12
|
export { generateReferenceImage, referenceImageParamsSchema, REFERENCE_IMAGE_WIDTH, REFERENCE_IMAGE_HEIGHT, } from './generators/reference.js';
|
|
13
13
|
export { generateCharacter, characterParamsSchema, meshModelFor, meshModelIsPaid, LOW_POLY_MESH_MODEL, } from './generators/character.js';
|
|
14
|
-
export { findLibraryCharacter,
|
|
15
|
-
export { isManagedAssetHost, isManagedAssetUrl, MANAGED_HOST_SUFFIXES } from './managed-hosts.js';
|
|
14
|
+
export { findLibraryCharacter, getCharacterLibraryMode, getCharacterLibraryThreshold, DEFAULT_LIBRARY_THRESHOLD, LIBRARY_CANDIDATE_LIMIT, } from './generators/character-library.js';
|
|
16
15
|
export { generateProp, propParamsSchema } from './generators/prop.js';
|
|
17
16
|
export { generatePropVoxels, propVoxelParamsSchema, propVoxelGrids } from './generators/prop-voxel.js';
|
|
18
17
|
export { generateAnimationAsset, animationParamsSchema, getConfiguredAnimationModel, ANIMATION_MODEL_TEXT_TO_MOTION_3, ANIMATION_MODEL_TEXT_TO_MOTION_2, ANIMATION_MODEL_OLDER, } from './generators/animation.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5E,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AA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O1B,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"}
|
package/package.json
CHANGED
package/dist/managed-hosts.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Which hosts are bitmagic's own.
|
|
3
|
-
*
|
|
4
|
-
* The environment classification the whole platform shares: `bitmagic.ai` is
|
|
5
|
-
* production (`mini.bitmagic.ai`, `forged-assets.bitmagic.ai`, ...) and
|
|
6
|
-
* `bitmagic.cloud` is dev/sandbox (`beta.portal.bitmagic.cloud`,
|
|
7
|
-
* `magic-mesh-gen.sandbox.dev.bitmagic.cloud`, ...). Everything else is
|
|
8
|
-
* deliberately not ours: an unrecognised host is far likelier to be a creator's
|
|
9
|
-
* own endpoint than an asset we should be claiming.
|
|
10
|
-
*
|
|
11
|
-
* It lives in asset-core because two packages need the same answer and a second
|
|
12
|
-
* copy of a security-relevant allowlist is exactly the kind of thing that drifts:
|
|
13
|
-
* the CLI's mobile bridge decides which URLs it will fetch on a phone's behalf
|
|
14
|
-
* (`cli/src/mobile/asset-hosts.ts`, which re-exports this), and the character
|
|
15
|
-
* generator decides whether a caller-supplied `assetUrl` may be written into a
|
|
16
|
-
* project as a library body (`generators/character.ts`).
|
|
17
|
-
*/
|
|
18
|
-
/** Host suffixes that identify a bitmagic-controlled host. */
|
|
19
|
-
export declare const MANAGED_HOST_SUFFIXES: readonly ["bitmagic.ai", "bitmagic.cloud"];
|
|
20
|
-
export declare function isManagedAssetHost(hostname: string): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* True when `url` is an https URL on a bitmagic-controlled host.
|
|
23
|
-
*
|
|
24
|
-
* Stricter than {@link isManagedAssetHost} on purpose — it also refuses a port,
|
|
25
|
-
* embedded credentials and plain http — because its callers are deciding whether
|
|
26
|
-
* to STORE the URL, where the mobile bridge is only deciding whether to fetch it.
|
|
27
|
-
*/
|
|
28
|
-
export declare function isManagedAssetUrl(url: string): boolean;
|
|
29
|
-
//# sourceMappingURL=managed-hosts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"managed-hosts.d.ts","sourceRoot":"","sources":["../src/managed-hosts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,8DAA8D;AAC9D,eAAO,MAAM,qBAAqB,4CAA6C,CAAC;AAKhF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAI5D;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAUtD"}
|
package/dist/managed-hosts.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Which hosts are bitmagic's own.
|
|
3
|
-
*
|
|
4
|
-
* The environment classification the whole platform shares: `bitmagic.ai` is
|
|
5
|
-
* production (`mini.bitmagic.ai`, `forged-assets.bitmagic.ai`, ...) and
|
|
6
|
-
* `bitmagic.cloud` is dev/sandbox (`beta.portal.bitmagic.cloud`,
|
|
7
|
-
* `magic-mesh-gen.sandbox.dev.bitmagic.cloud`, ...). Everything else is
|
|
8
|
-
* deliberately not ours: an unrecognised host is far likelier to be a creator's
|
|
9
|
-
* own endpoint than an asset we should be claiming.
|
|
10
|
-
*
|
|
11
|
-
* It lives in asset-core because two packages need the same answer and a second
|
|
12
|
-
* copy of a security-relevant allowlist is exactly the kind of thing that drifts:
|
|
13
|
-
* the CLI's mobile bridge decides which URLs it will fetch on a phone's behalf
|
|
14
|
-
* (`cli/src/mobile/asset-hosts.ts`, which re-exports this), and the character
|
|
15
|
-
* generator decides whether a caller-supplied `assetUrl` may be written into a
|
|
16
|
-
* project as a library body (`generators/character.ts`).
|
|
17
|
-
*/
|
|
18
|
-
/** Host suffixes that identify a bitmagic-controlled host. */
|
|
19
|
-
export const MANAGED_HOST_SUFFIXES = ['bitmagic.ai', 'bitmagic.cloud'];
|
|
20
|
-
/** A hostname with no port and no credentials — what a proxy path's first segment may hold. */
|
|
21
|
-
const HOSTNAME = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/;
|
|
22
|
-
export function isManagedAssetHost(hostname) {
|
|
23
|
-
const host = hostname.toLowerCase();
|
|
24
|
-
if (!HOSTNAME.test(host))
|
|
25
|
-
return false;
|
|
26
|
-
return MANAGED_HOST_SUFFIXES.some((suffix) => host === suffix || host.endsWith(`.${suffix}`));
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* True when `url` is an https URL on a bitmagic-controlled host.
|
|
30
|
-
*
|
|
31
|
-
* Stricter than {@link isManagedAssetHost} on purpose — it also refuses a port,
|
|
32
|
-
* embedded credentials and plain http — because its callers are deciding whether
|
|
33
|
-
* to STORE the URL, where the mobile bridge is only deciding whether to fetch it.
|
|
34
|
-
*/
|
|
35
|
-
export function isManagedAssetUrl(url) {
|
|
36
|
-
let parsed;
|
|
37
|
-
try {
|
|
38
|
-
parsed = new URL(url);
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
if (parsed.protocol !== 'https:')
|
|
44
|
-
return false;
|
|
45
|
-
if (parsed.port !== '' || parsed.username !== '' || parsed.password !== '')
|
|
46
|
-
return false;
|
|
47
|
-
return isManagedAssetHost(parsed.hostname);
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=managed-hosts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"managed-hosts.js","sourceRoot":"","sources":["../src/managed-hosts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,8DAA8D;AAC9D,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,aAAa,EAAE,gBAAgB,CAAU,CAAC;AAEhF,+FAA+F;AAC/F,MAAM,QAAQ,GAAG,mEAAmE,CAAC;AAErF,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,MAAM,IAAI,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IACpC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACvC,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC;AAChG,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC/C,IAAI,MAAM,CAAC,IAAI,KAAK,EAAE,IAAI,MAAM,CAAC,QAAQ,KAAK,EAAE,IAAI,MAAM,CAAC,QAAQ,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC;IACzF,OAAO,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC7C,CAAC"}
|