@bitmagic/asset-core 0.2.20-dev.2 → 0.2.20-dev.21
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 +159 -31
- package/dist/generators/character-library.d.ts.map +1 -1
- package/dist/generators/character-library.js +166 -56
- package/dist/generators/character-library.js.map +1 -1
- package/dist/generators/character.d.ts +31 -0
- package/dist/generators/character.d.ts.map +1 -1
- package/dist/generators/character.js +121 -19
- package/dist/generators/character.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/managed-hosts.d.ts +29 -0
- package/dist/managed-hosts.d.ts.map +1 -0
- package/dist/managed-hosts.js +49 -0
- package/dist/managed-hosts.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,31 +1,46 @@
|
|
|
1
1
|
import type { CoreLogger, ForgerClient } from '../types.js';
|
|
2
2
|
/**
|
|
3
|
-
* Search the Asset Forger's library of ready-made rigged
|
|
3
|
+
* Search the Asset Forger's library of ready-made rigged 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
|
-
*
|
|
7
|
+
* This module answers two questions and nothing else: "is there one close
|
|
8
|
+
* enough?" ({@link findLibraryCharacter}) and "what are the options?"
|
|
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.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* Both are ONE request to the same route — it has always returned a ranked list
|
|
13
|
+
* and selection has always thrown all but one row away. The difference is only
|
|
14
|
+
* whether the shelf's floor is applied (find) or merely reported (search), because
|
|
15
|
+
* a creator choosing for themselves needs the bar as information, not as a filter.
|
|
16
|
+
*
|
|
17
|
+
* NEITHER throws or rejects. Every failure — no credentials, a network error, a
|
|
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.
|
|
16
33
|
*
|
|
17
34
|
* ## The upstream contract, as measured against the live service
|
|
18
35
|
*
|
|
19
|
-
* `GET /ai/v1/find-
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* `species` / `hasTail`.
|
|
36
|
+
* `GET /ai/v1/find-character`, Basic auth, query params: `prompt` (required;
|
|
37
|
+
* blank is a 400), `representation` (**required**; anything but `voxel` or
|
|
38
|
+
* `lowpoly` is a 400), `threshold` (0-1, **400** when malformed or out of
|
|
39
|
+
* range), `limit` (**400** when malformed), and optional `species` / `hasTail`.
|
|
23
40
|
*
|
|
24
|
-
* - **`
|
|
25
|
-
*
|
|
26
|
-
*
|
|
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.
|
|
41
|
+
* - **`assetUrl` always belongs to the representation asked for**, and so does
|
|
42
|
+
* the similarity: low-poly ranks on its own vector and never borrows the
|
|
43
|
+
* voxel caption's.
|
|
29
44
|
* - **`assetUrl` is nullable.** The `/seed` bootstrap path indexes captions with
|
|
30
45
|
* no files, so a row can be findable but not usable. Candidates without one
|
|
31
46
|
* are skipped in favour of the next.
|
|
@@ -34,6 +49,11 @@ import type { CoreLogger, ForgerClient } from '../types.js';
|
|
|
34
49
|
* derived guess would silently collapse the result set to zero and look
|
|
35
50
|
* exactly like an empty index — so it is deliberately never sent, and neither
|
|
36
51
|
* 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.
|
|
37
57
|
*/
|
|
38
58
|
/**
|
|
39
59
|
* How the library participates in character generation.
|
|
@@ -58,8 +78,16 @@ export type LibraryMissReason =
|
|
|
58
78
|
| 'no-asset-url'
|
|
59
79
|
/** The response was not the shape the route documents. */
|
|
60
80
|
| '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';
|
|
61
89
|
/** The subset of a library row this package consumes. */
|
|
62
|
-
export interface
|
|
90
|
+
export interface LibraryCharacterMatch {
|
|
63
91
|
/** Corpus id, e.g. `b0009` — the only field that makes a pick auditable. */
|
|
64
92
|
sid: string;
|
|
65
93
|
/** Non-null by construction: rows without one are filtered out before selection. */
|
|
@@ -70,22 +98,61 @@ export interface VoxelCharacterMatch {
|
|
|
70
98
|
subject: string | null;
|
|
71
99
|
similarity: number;
|
|
72
100
|
}
|
|
101
|
+
/** @deprecated Named for when the library held voxels only. Use {@link LibraryCharacterMatch}. */
|
|
102
|
+
export type VoxelCharacterMatch = LibraryCharacterMatch;
|
|
73
103
|
export interface LibrarySearchOutcome {
|
|
74
|
-
match:
|
|
104
|
+
match: LibraryCharacterMatch | null;
|
|
75
105
|
reason?: LibraryMissReason;
|
|
76
106
|
/** Best similarity seen even when it lost — this is what `shadow` mode reports. */
|
|
77
107
|
topSimilarity?: number;
|
|
78
108
|
}
|
|
79
109
|
/**
|
|
80
|
-
* The usable-match floor.
|
|
110
|
+
* The usable-match floor for the voxel shelf.
|
|
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.
|
|
81
144
|
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
145
|
+
* A floor can only trade coverage against precision, and the right trade differs
|
|
146
|
+
* by shelf SIZE. With 2,261 bodies a strong score is usually a real match; with
|
|
147
|
+
* 197 it is more often the nearest of too few. So low-poly starts conservative:
|
|
148
|
+
* at 0.65 only 2 of 10 unanswerable humanoid prompts substitute, against 9 of 10
|
|
149
|
+
* at 0.45, while genuine matches at 0.673-0.801 still land. Forging is the
|
|
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`.
|
|
87
154
|
*/
|
|
88
|
-
export declare const
|
|
155
|
+
export declare const DEFAULT_LOWPOLY_LIBRARY_THRESHOLD = 0.65;
|
|
89
156
|
/**
|
|
90
157
|
* Ask for a handful, not one.
|
|
91
158
|
*
|
|
@@ -94,7 +161,14 @@ export declare const DEFAULT_LIBRARY_THRESHOLD = 0.45;
|
|
|
94
161
|
* no meaningful cost.
|
|
95
162
|
*/
|
|
96
163
|
export declare const LIBRARY_CANDIDATE_LIMIT = 5;
|
|
97
|
-
/**
|
|
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
|
+
*/
|
|
98
172
|
export declare const MAX_SAFE_LIMIT = 16;
|
|
99
173
|
/**
|
|
100
174
|
* Read the mode per call rather than at module load, so a test or a CLI run can
|
|
@@ -102,9 +176,12 @@ export declare const MAX_SAFE_LIMIT = 16;
|
|
|
102
176
|
* for `ANIMATION_MODEL`. Unrecognised values fail CLOSED: an env typo must not
|
|
103
177
|
* be what turns library substitution on.
|
|
104
178
|
*/
|
|
105
|
-
export declare function getCharacterLibraryMode(): CharacterLibraryMode;
|
|
179
|
+
export declare function getCharacterLibraryMode(representation: LibraryRepresentation): CharacterLibraryMode;
|
|
106
180
|
/**
|
|
107
|
-
* The floor, overridable by `CHARACTER_LIBRARY_THRESHOLD
|
|
181
|
+
* The floor for one shelf, overridable by `CHARACTER_LIBRARY_THRESHOLD` — or, for
|
|
182
|
+
* the low-poly corpus alone, by `CHARACTER_LIBRARY_THRESHOLD_LOWPOLY`.
|
|
183
|
+
*
|
|
184
|
+
* The two shelves default differently; see {@link DEFAULT_LOWPOLY_LIBRARY_THRESHOLD}.
|
|
108
185
|
*
|
|
109
186
|
* An env var rather than a request field: it is an operations dial for tuning
|
|
110
187
|
* against a growing corpus, not a creative choice, and an agent asked to pick a
|
|
@@ -114,17 +191,68 @@ export declare function getCharacterLibraryMode(): CharacterLibraryMode;
|
|
|
114
191
|
* 0-1 or one that will not parse, so an unclamped typo would turn every
|
|
115
192
|
* character generation into a hard failure instead of a fallback.
|
|
116
193
|
*/
|
|
117
|
-
export declare function getCharacterLibraryThreshold(): number;
|
|
194
|
+
export declare function getCharacterLibraryThreshold(representation: LibraryRepresentation): number;
|
|
118
195
|
export interface FindLibraryCharacterDeps {
|
|
119
196
|
forger: ForgerClient;
|
|
120
197
|
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;
|
|
121
214
|
}
|
|
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>;
|
|
122
246
|
/**
|
|
123
247
|
* Find the closest usable library character for a prompt.
|
|
124
248
|
*
|
|
125
249
|
* Selection is the highest-ranked row that has BOTH a usable `assetUrl` and a
|
|
126
250
|
* similarity at or above the floor — walking the list rather than taking the
|
|
127
251
|
* 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.
|
|
128
256
|
*/
|
|
129
257
|
export declare function findLibraryCharacter(prompt: string, deps: FindLibraryCharacterDeps): Promise<LibrarySearchOutcome>;
|
|
130
258
|
//# 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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* The
|
|
2
|
+
* The representation-aware route, used for BOTH mediums.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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.
|
|
4
|
+
* `find-voxel-character` still works and still answers with voxels, but it makes
|
|
5
|
+
* the representation implicit — and an implicit default is exactly what must not
|
|
6
|
+
* decide which medium a creator's game gets.
|
|
10
7
|
*/
|
|
11
|
-
|
|
8
|
+
const ENDPOINT = '/ai/v1/find-character';
|
|
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;
|
|
12
56
|
/**
|
|
13
57
|
* Ask for a handful, not one.
|
|
14
58
|
*
|
|
@@ -17,7 +61,14 @@ export const DEFAULT_LIBRARY_THRESHOLD = 0.45;
|
|
|
17
61
|
* no meaningful cost.
|
|
18
62
|
*/
|
|
19
63
|
export const LIBRARY_CANDIDATE_LIMIT = 5;
|
|
20
|
-
/**
|
|
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
|
+
*/
|
|
21
72
|
export const MAX_SAFE_LIMIT = 16;
|
|
22
73
|
/**
|
|
23
74
|
* Read the mode per call rather than at module load, so a test or a CLI run can
|
|
@@ -25,12 +76,24 @@ export const MAX_SAFE_LIMIT = 16;
|
|
|
25
76
|
* for `ANIMATION_MODEL`. Unrecognised values fail CLOSED: an env typo must not
|
|
26
77
|
* be what turns library substitution on.
|
|
27
78
|
*/
|
|
28
|
-
export function getCharacterLibraryMode() {
|
|
29
|
-
|
|
79
|
+
export function getCharacterLibraryMode(representation) {
|
|
80
|
+
// Two dials, because the two corpora are not equally proven. Voxel has 2,261
|
|
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();
|
|
30
90
|
return raw === 'on' || raw === 'shadow' ? raw : 'off';
|
|
31
91
|
}
|
|
32
92
|
/**
|
|
33
|
-
* The floor, overridable by `CHARACTER_LIBRARY_THRESHOLD
|
|
93
|
+
* The floor for one shelf, overridable by `CHARACTER_LIBRARY_THRESHOLD` — or, for
|
|
94
|
+
* the low-poly corpus alone, by `CHARACTER_LIBRARY_THRESHOLD_LOWPOLY`.
|
|
95
|
+
*
|
|
96
|
+
* The two shelves default differently; see {@link DEFAULT_LOWPOLY_LIBRARY_THRESHOLD}.
|
|
34
97
|
*
|
|
35
98
|
* An env var rather than a request field: it is an operations dial for tuning
|
|
36
99
|
* against a growing corpus, not a creative choice, and an agent asked to pick a
|
|
@@ -40,30 +103,71 @@ export function getCharacterLibraryMode() {
|
|
|
40
103
|
* 0-1 or one that will not parse, so an unclamped typo would turn every
|
|
41
104
|
* character generation into a hard failure instead of a fallback.
|
|
42
105
|
*/
|
|
43
|
-
export function getCharacterLibraryThreshold() {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
106
|
+
export function getCharacterLibraryThreshold(representation) {
|
|
107
|
+
// The two shelves default differently because they cover the space differently;
|
|
108
|
+
// falling back to the shared dial keeps one knob for operators who do not care.
|
|
109
|
+
const lowpoly = representation === 'lowpoly';
|
|
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
|
+
}
|
|
47
118
|
return Math.min(1, Math.max(0, parsed));
|
|
48
119
|
}
|
|
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
|
+
}
|
|
49
146
|
/**
|
|
50
|
-
*
|
|
147
|
+
* Every usable library character for a prompt, ranked, with the shelf's floor.
|
|
51
148
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
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.
|
|
154
|
+
*
|
|
155
|
+
* Never throws, for the same structural reason `findLibraryCharacter` does not:
|
|
156
|
+
* every failure resolves to an empty `candidates` with a `reason`.
|
|
55
157
|
*/
|
|
56
|
-
export async function
|
|
57
|
-
const { forger, logger } = deps;
|
|
158
|
+
export async function searchLibraryCharacters(prompt, deps) {
|
|
159
|
+
const { forger, logger, representation } = deps;
|
|
160
|
+
const threshold = getCharacterLibraryThreshold(representation);
|
|
58
161
|
if (!forger.hasCredentials()) {
|
|
59
|
-
return {
|
|
162
|
+
return { candidates: [], threshold, reason: 'disabled' };
|
|
60
163
|
}
|
|
61
|
-
const threshold = getCharacterLibraryThreshold();
|
|
62
164
|
let body;
|
|
63
165
|
try {
|
|
64
166
|
body = await forger.get(ENDPOINT, {
|
|
65
167
|
prompt,
|
|
66
|
-
|
|
168
|
+
representation,
|
|
169
|
+
// Deliberately 0, so the FLOOR is applied by the caller and not by the
|
|
170
|
+
// route.
|
|
67
171
|
//
|
|
68
172
|
// Sending the real floor looks tidier and is worse: the route filters the
|
|
69
173
|
// rows out before we see them, so every miss comes back as an empty list.
|
|
@@ -73,48 +177,54 @@ export async function findLibraryCharacter(prompt, deps) {
|
|
|
73
177
|
// mode was added to collect. Omitting it is not an option either: the route
|
|
74
178
|
// defaults to 0.3, which is its own silent filter.
|
|
75
179
|
threshold: 0,
|
|
76
|
-
limit: Math.min(LIBRARY_CANDIDATE_LIMIT, MAX_SAFE_LIMIT),
|
|
180
|
+
limit: Math.min(deps.limit ?? LIBRARY_CANDIDATE_LIMIT, MAX_SAFE_LIMIT),
|
|
77
181
|
}, 'CharacterLibrary');
|
|
78
182
|
}
|
|
79
183
|
catch (error) {
|
|
80
184
|
// Includes the route's own 500s, which surface as a non-2xx throw.
|
|
81
|
-
logger.warn({ err: error }, '[character-library] Search failed
|
|
82
|
-
return {
|
|
185
|
+
logger.warn({ err: error }, '[character-library] Search failed');
|
|
186
|
+
return { candidates: [], threshold, reason: 'unreachable' };
|
|
83
187
|
}
|
|
84
188
|
if (!Array.isArray(body?.items)) {
|
|
85
|
-
logger.warn({ error: body?.error }, '[character-library] Unexpected search response
|
|
86
|
-
return {
|
|
189
|
+
logger.warn({ error: body?.error }, '[character-library] Unexpected search response');
|
|
190
|
+
return { candidates: [], threshold, reason: 'malformed' };
|
|
87
191
|
}
|
|
88
192
|
const items = body.items;
|
|
89
193
|
if (items.length === 0) {
|
|
90
|
-
return {
|
|
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
|
-
};
|
|
194
|
+
return { candidates: [], threshold, reason: 'empty' };
|
|
115
195
|
}
|
|
196
|
+
const { candidates, topSimilarity } = normaliseCandidates(items);
|
|
116
197
|
// Separating these two is what tells an operator which half is missing: rows
|
|
117
198
|
// with no files need PUBLISHING, an empty index needs SEEDING.
|
|
118
|
-
|
|
199
|
+
if (candidates.length === 0) {
|
|
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 };
|
|
119
229
|
}
|
|
120
230
|
//# 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":"AAoHA;;;;;;GAMG;AACH,MAAM,QAAQ,GAAG,uBAAuB,CAAC;AAEzC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,IAAI,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAEzC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,cAAqC;IAC3E,6EAA6E;IAC7E,8EAA8E;IAC9E,yEAAyE;IACzE,8EAA8E;IAC9E,6EAA6E;IAC7E,6DAA6D;IAC7D,MAAM,U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ema: 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
|
+
}>>;
|
|
25
42
|
useLibrary: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
26
43
|
voxelize: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
27
44
|
meshModel: z.ZodOptional<z.ZodString>;
|
|
@@ -30,9 +47,16 @@ export declare const characterParamsSchema: z.ZodObject<{
|
|
|
30
47
|
prompt: string;
|
|
31
48
|
applyToPlayer: boolean;
|
|
32
49
|
headScale: number;
|
|
50
|
+
libraryOnly: boolean;
|
|
33
51
|
useLibrary: boolean;
|
|
34
52
|
voxelize: boolean;
|
|
35
53
|
assetId?: string | undefined;
|
|
54
|
+
libraryPick?: {
|
|
55
|
+
sid: string;
|
|
56
|
+
assetUrl: string;
|
|
57
|
+
similarity: number;
|
|
58
|
+
description?: string | undefined;
|
|
59
|
+
} | undefined;
|
|
36
60
|
meshModel?: string | undefined;
|
|
37
61
|
}, {
|
|
38
62
|
name: string;
|
|
@@ -40,6 +64,13 @@ export declare const characterParamsSchema: z.ZodObject<{
|
|
|
40
64
|
assetId?: string | undefined;
|
|
41
65
|
applyToPlayer?: boolean | undefined;
|
|
42
66
|
headScale?: number | undefined;
|
|
67
|
+
libraryOnly?: boolean | undefined;
|
|
68
|
+
libraryPick?: {
|
|
69
|
+
sid: string;
|
|
70
|
+
assetUrl: string;
|
|
71
|
+
similarity: number;
|
|
72
|
+
description?: string | undefined;
|
|
73
|
+
} | undefined;
|
|
43
74
|
useLibrary?: boolean | undefined;
|
|
44
75
|
voxelize?: boolean | undefined;
|
|
45
76
|
meshModel?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"character.d.ts","sourceRoot":"","sources":["../../src/generators/character.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAc,YAAY,EAAc,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"character.d.ts","sourceRoot":"","sources":["../../src/generators/character.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAc,YAAY,EAAc,MAAM,aAAa,CAAC;AAWzF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC;;;;;;;;GAQG;AACH,wBAAgB,+BAA+B,IAAI,OAAO,CAEzD;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6CvB,CAAC;AA4CZ;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gFAAgF;IAChF,OAAO,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/C,CAAC;AAWF;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AAEzD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,GAAG,SAAS,CAGjG;AAsBD,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEtE;AA6CD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,YAAY,GACjB,OAAO,CAAC,eAAe,CAAC,CAyM1B"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { fail, ok } from '../result.js';
|
|
3
|
+
import { isManagedAssetUrl } from '../managed-hosts.js';
|
|
3
4
|
import { formatZodIssues } from '../validation.js';
|
|
4
|
-
import { findLibraryCharacter, getCharacterLibraryMode } from './character-library.js';
|
|
5
|
+
import { findLibraryCharacter, getCharacterLibraryMode, getCharacterLibraryThreshold, } from './character-library.js';
|
|
5
6
|
/**
|
|
6
7
|
* The chibi house style every library body is built at. Named because the
|
|
7
8
|
* library search keys off it: a stored body has its head scale baked in, so a
|
|
@@ -41,6 +42,18 @@ export const characterParamsSchema = z.object({
|
|
|
41
42
|
assetId: z.string()
|
|
42
43
|
.optional()
|
|
43
44
|
.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.'),
|
|
44
57
|
useLibrary: z.boolean()
|
|
45
58
|
.optional()
|
|
46
59
|
.default(true)
|
|
@@ -48,12 +61,54 @@ export const characterParamsSchema = z.object({
|
|
|
48
61
|
voxelize: z.boolean()
|
|
49
62
|
.optional()
|
|
50
63
|
.default(true)
|
|
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
|
|
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 then searched for a low-poly body rather than a voxel one.'),
|
|
52
65
|
meshModel: z.string()
|
|
53
66
|
.min(1)
|
|
54
67
|
.optional()
|
|
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 —
|
|
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 — in ~3 minutes, and bills 60 sparks. Pass 'unified-trellis' to put one back on the cheap lane at 15 sparks; voxel characters use the Forger default."),
|
|
56
69
|
}).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
|
+
}
|
|
57
112
|
const ENDPOINT = '/ai/v1/generate-rigged-character/jobs';
|
|
58
113
|
/**
|
|
59
114
|
* The Asset Forger mesh model that forges a true low-poly body: an even quad
|
|
@@ -156,6 +211,23 @@ export async function generateCharacter(params, deps) {
|
|
|
156
211
|
return fail(formatZodIssues(parsed.error));
|
|
157
212
|
}
|
|
158
213
|
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
|
+
}
|
|
159
231
|
if (!forger.hasCredentials()) {
|
|
160
232
|
logger.error('[character] Missing Asset Forger credentials');
|
|
161
233
|
return fail(forger.getMissingCredentialsMessage());
|
|
@@ -170,36 +242,66 @@ export async function generateCharacter(params, deps) {
|
|
|
170
242
|
// worse than forging. (zod fills the default, so "explicitly 150" and
|
|
171
243
|
// "omitted" are indistinguishable here — and identical in effect.)
|
|
172
244
|
//
|
|
173
|
-
//
|
|
174
|
-
//
|
|
245
|
+
// The art style picks the shelf, it does not decide whether to look: the
|
|
246
|
+
// catalogue holds a voxel body AND a textured low-poly rig per character, and
|
|
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.
|
|
175
249
|
//
|
|
176
250
|
// An explicit meshModel suppresses it for the same reason a non-default
|
|
177
251
|
// headScale does: a library body was forged by whatever model made it, so
|
|
178
252
|
// handing one back would silently ignore the model the caller asked for --
|
|
179
253
|
// and on a paid mesh lane that is the entire point of the request.
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
254
|
+
//
|
|
255
|
+
// `libraryOnly` is none of the above. It is an explicit "give me the closest
|
|
256
|
+
// thing you already have, and do not spend anything", so it consults neither
|
|
257
|
+
// the substitution dial nor the guards that protect a forge -- there is no
|
|
258
|
+
// forge to protect. It suppresses only what it cannot honour: a head scale is
|
|
259
|
+
// baked into a stored body, so a non-default one is reported and dropped.
|
|
260
|
+
const representation = input.voxelize ? 'voxel' : 'lowpoly';
|
|
261
|
+
const libraryMode = getCharacterLibraryMode(representation);
|
|
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.`);
|
|
188
268
|
}
|
|
189
269
|
if (librarySearchable) {
|
|
190
|
-
onProgress(
|
|
191
|
-
|
|
270
|
+
onProgress(input.libraryOnly
|
|
271
|
+
? 'Taking the closest ready-made character…'
|
|
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
|
+
});
|
|
192
279
|
const percent = (value) => `${Math.round(value * 100)}%`;
|
|
193
|
-
if (outcome.match && libraryMode === 'on') {
|
|
280
|
+
if (outcome.match && (libraryMode === 'on' || input.libraryOnly)) {
|
|
194
281
|
const { sid, similarity, subject, description, assetUrl } = outcome.match;
|
|
195
|
-
onProgress(
|
|
196
|
-
|
|
282
|
+
onProgress(input.libraryOnly && similarity < getCharacterLibraryThreshold(representation)
|
|
283
|
+
? `Closest ready-made character: ${subject ?? sid} — only a ${percent(similarity)} match,`
|
|
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');
|
|
197
287
|
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 } });
|
|
198
288
|
}
|
|
199
289
|
// `shadow` observes without substituting, and a miss falls through to the
|
|
200
290
|
// forge either way. The best score is logged even when it lost — that is the
|
|
201
291
|
// number that says whether the floor is set right.
|
|
202
|
-
logger.info({ mode: libraryMode, sid: outcome.match?.sid, reason: outcome.reason, topSimilarity: outcome.topSimilarity }, '[character] Library did not supply this character');
|
|
292
|
+
logger.info({ mode: libraryMode, representation, sid: outcome.match?.sid, reason: outcome.reason, topSimilarity: outcome.topSimilarity }, '[character] Library did not supply this character');
|
|
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
|
+
}
|
|
203
305
|
if (outcome.topSimilarity !== undefined && !outcome.match) {
|
|
204
306
|
onProgress(`No close library match (best ${percent(outcome.topSimilarity)}) — making a new character.`);
|
|
205
307
|
}
|
|
@@ -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,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEvF;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC;;;;;;;;GAQG;AACH,MAAM,UAAU,+BAA+B;IAC7C,OAAO,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC;AAC/E,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;SACb,GAAG,CAAC,CAAC,CAAC;SACN,KAAK,CAAC,yBAAyB,EAAE,2EAA2E,CAAC;SAC7G,QAAQ,CAAC,kEAAkE,CAAC;IAC/E,MAAM,EAAE,CAAC,CAAC,MAAM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C,CAAC,EAAE,CAAC;aACtC;SACF,CAAC,CAAC;IACL,CAAC;IAED,mEAAmE;IACnE,wEAAwE;IACxE,8EAA8E;IAC9E,2EAA2E;IAC3E,gBAAgB;IAChB,EAAE;IACF,8EAA8E;IAC9E,iFAAiF;IACjF,6EAA6E;IAC7E,+EAA+E;IAC/E,4EAA4E;IAC5E,4EAA4E;IAC5E,mBAAmB;IACnB,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;QACxB,OAAO,CAAC,IAAI,CACV,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,qBAAqB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,EAC7E,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,CAC7D,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -22,8 +22,9 @@ export { generateReferenceImage, referenceImageParamsSchema, 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, 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';
|
|
25
|
+
export { findLibraryCharacter, searchLibraryCharacters, getCharacterLibraryMode, getCharacterLibraryThreshold, DEFAULT_LIBRARY_THRESHOLD, DEFAULT_LOWPOLY_LIBRARY_THRESHOLD, LIBRARY_CANDIDATE_LIMIT, MAX_SAFE_LIMIT, } from './generators/character-library.js';
|
|
26
|
+
export type { CharacterLibraryMode, LibraryCharacterMatch, LibraryMissReason, LibraryRepresentation, LibrarySearchOutcome, LibrarySearchResults, SearchLibraryCharactersDeps, VoxelCharacterMatch, } from './generators/character-library.js';
|
|
27
|
+
export { isManagedAssetHost, isManagedAssetUrl, MANAGED_HOST_SUFFIXES } from './managed-hosts.js';
|
|
27
28
|
export { generateProp, propParamsSchema } from './generators/prop.js';
|
|
28
29
|
export type { PropParams, PropResult } from './generators/prop.js';
|
|
29
30
|
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,EAAE,MAAM,wBAAwB,CAAC;AAC5E,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACxF,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAA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AAyB,EAAE,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC/F,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,6BAA6B,EAC7B,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EACL,kCAAkC,EAClC,yBAAyB,EACzB,+BAA+B,EAC/B,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,6BAA6B,EAC7B,8BAA8B,EAC9B,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,uBAAuB,EACvB,eAAe,EACf,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,aAAa,EACb,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,SAAS,EACT,WAAW,EACX,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAM1B,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,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,8 @@ 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, getCharacterLibraryMode, getCharacterLibraryThreshold, DEFAULT_LIBRARY_THRESHOLD, LIBRARY_CANDIDATE_LIMIT, } from './generators/character-library.js';
|
|
14
|
+
export { findLibraryCharacter, searchLibraryCharacters, getCharacterLibraryMode, getCharacterLibraryThreshold, DEFAULT_LIBRARY_THRESHOLD, DEFAULT_LOWPOLY_LIBRARY_THRESHOLD, LIBRARY_CANDIDATE_LIMIT, MAX_SAFE_LIMIT, } from './generators/character-library.js';
|
|
15
|
+
export { isManagedAssetHost, isManagedAssetUrl, MANAGED_HOST_SUFFIXES } from './managed-hosts.js';
|
|
15
16
|
export { generateProp, propParamsSchema } from './generators/prop.js';
|
|
16
17
|
export { generatePropVoxels, propVoxelParamsSchema, propVoxelGrids } from './generators/prop-voxel.js';
|
|
17
18
|
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,EAA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6BAA6B,EAC7B,8BAA8B,EAC9B,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAOlC,4EAA4E;AAC5E,gFAAgF;AAChF,6EAA6E;AAC7E,8EAA8E;AAC9E,YAAY;AACZ,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,aAAa,EACb,YAAY,GACb,MAAM,kBAAkB,CAAC;AAO1B,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,29 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|