@bitmagic/cli 0.1.53-dev.0 → 0.1.53-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +130 -29
- package/dist/assets/revoxelize.d.ts +116 -0
- package/dist/assets/revoxelize.js +343 -0
- package/dist/assets/revoxelize.js.map +1 -0
- package/dist/cli.d.ts +27 -1
- package/dist/cli.js +18 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/assets.d.ts +18 -0
- package/dist/commands/assets.js +110 -1
- package/dist/commands/assets.js.map +1 -1
- package/dist/commands/cover.d.ts +5 -0
- package/dist/commands/cover.js +3 -0
- package/dist/commands/cover.js.map +1 -1
- package/dist/commands/dev.js +1 -2
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/forge.d.ts +4 -0
- package/dist/commands/forge.js +9 -0
- package/dist/commands/forge.js.map +1 -1
- package/dist/commands/generate.d.ts +25 -0
- package/dist/commands/generate.js +80 -8
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/init.d.ts +4 -0
- package/dist/commands/init.js +12 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/publish.d.ts +31 -4
- package/dist/commands/publish.js +86 -15
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/reload.js +1 -3
- package/dist/commands/reload.js.map +1 -1
- package/dist/commands/reset-account.js +25 -8
- package/dist/commands/reset-account.js.map +1 -1
- package/dist/commands/self-update.d.ts +67 -0
- package/dist/commands/self-update.js +196 -0
- package/dist/commands/self-update.js.map +1 -0
- package/dist/commands/upgrade.js +5 -2
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/editor/asset-detail-panel.d.ts +2 -2
- package/dist/editor/asset-detail-panel.js +5 -2
- package/dist/editor/asset-detail-panel.js.map +1 -1
- package/dist/editor/cli-update.d.ts +32 -0
- package/dist/editor/cli-update.js +67 -0
- package/dist/editor/cli-update.js.map +1 -0
- package/dist/editor/publish-panel.d.ts +31 -0
- package/dist/editor/publish-panel.js +69 -0
- package/dist/editor/publish-panel.js.map +1 -0
- package/dist/editor/server.js +43 -1
- package/dist/editor/server.js.map +1 -1
- package/dist/editor/shell-page.js +249 -8
- package/dist/editor/shell-page.js.map +1 -1
- package/dist/forge/upload-proxy.d.ts +14 -0
- package/dist/forge/upload-proxy.js +28 -1
- package/dist/forge/upload-proxy.js.map +1 -1
- package/dist/generate/model.d.ts +7 -0
- package/dist/generate/model.js +13 -3
- package/dist/generate/model.js.map +1 -1
- package/dist/generate/prop.d.ts +20 -0
- package/dist/generate/prop.js +22 -2
- package/dist/generate/prop.js.map +1 -1
- package/dist/generate/vehicle.d.ts +2 -0
- package/dist/generate/vehicle.js +1 -0
- package/dist/generate/vehicle.js.map +1 -1
- package/dist/project/dev-handle.d.ts +28 -0
- package/dist/project/dev-handle.js +43 -0
- package/dist/project/dev-handle.js.map +1 -1
- package/dist/project/jobs.js +11 -9
- package/dist/project/jobs.js.map +1 -1
- package/dist/publish/client.d.ts +13 -2
- package/dist/publish/client.js.map +1 -1
- package/dist/publish/record.d.ts +22 -0
- package/dist/publish/record.js +62 -0
- package/dist/publish/record.js.map +1 -0
- package/dist/render/qr-output.d.ts +44 -0
- package/dist/render/qr-output.js +71 -0
- package/dist/render/qr-output.js.map +1 -0
- package/dist/render/qr-png.d.ts +37 -0
- package/dist/render/qr-png.js +111 -0
- package/dist/render/qr-png.js.map +1 -0
- package/dist/render/qr-terminal.d.ts +63 -0
- package/dist/render/qr-terminal.js +142 -0
- package/dist/render/qr-terminal.js.map +1 -0
- package/dist/render/qr.d.ts +51 -0
- package/dist/render/qr.js +516 -0
- package/dist/render/qr.js.map +1 -0
- package/dist/scaffold/project-files.js +44 -27
- package/dist/scaffold/project-files.js.map +1 -1
- package/dist/scaffold/suggest-template.d.ts +2 -0
- package/dist/scaffold/suggest-template.js +2 -1
- package/dist/scaffold/suggest-template.js.map +1 -1
- package/dist/telemetry/command-context.d.ts +12 -0
- package/dist/telemetry/command-context.js +7 -0
- package/dist/telemetry/command-context.js.map +1 -1
- package/dist/telemetry/creator-prompt.d.ts +35 -0
- package/dist/telemetry/creator-prompt.js +45 -0
- package/dist/telemetry/creator-prompt.js.map +1 -0
- package/dist/update/check.js +2 -1
- package/dist/update/check.js.map +1 -1
- package/dist/update/notice.d.ts +31 -1
- package/dist/update/notice.js +39 -5
- package/dist/update/notice.js.map +1 -1
- package/dist/update/self-install.d.ts +175 -0
- package/dist/update/self-install.js +335 -0
- package/dist/update/self-install.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-bake an existing asset at a different voxel size, without generating anything.
|
|
3
|
+
*
|
|
4
|
+
* Every voxelized asset keeps what it was made from, and either source can be baked again:
|
|
5
|
+
*
|
|
6
|
+
* - `sourceVxlMasterUrl` — the voxel master, written by the direct-voxel path. Cheap (a few
|
|
7
|
+
* megabytes) and already occupancy, so the engine only resamples and recompiles it. It can go
|
|
8
|
+
* finer than a previous bake, but never finer than the grid it was forged at — masters are
|
|
9
|
+
* resampled by merging cells, never by inventing them.
|
|
10
|
+
* - `sourceGlbUrl` — the mesh, written by the GLB path. Heavier (50-100 MB to refetch) and a full
|
|
11
|
+
* re-voxelization, but the mesh is resolution-independent, so it is the only source with no
|
|
12
|
+
* ceiling at all.
|
|
13
|
+
*
|
|
14
|
+
* One command over both, because "re-bake this at a different size" is one thing a creator wants
|
|
15
|
+
* and which pipeline produced the asset months ago is not something they should have to remember.
|
|
16
|
+
* The asset itself records the answer; this reads it.
|
|
17
|
+
*
|
|
18
|
+
* Nothing here is billable: no Asset Forger call, no sparks, no generation. What it costs is the
|
|
19
|
+
* browser bake, which is why it still needs the project's headless engine.
|
|
20
|
+
*
|
|
21
|
+
* Writes under the SAME id, so every placed instance changes with it — the same upgrade-in-place
|
|
22
|
+
* contract `generate prop` makes, and the reason this is not "add a second asset at a new size".
|
|
23
|
+
*/
|
|
24
|
+
import { propVoxelGrids } from '@bitmagic/asset-core';
|
|
25
|
+
import { CliError } from '../errors.js';
|
|
26
|
+
import { VOXELIZE_TIMEOUT_MS, withVoxelizeSession } from '../forge/voxelize-session.js';
|
|
27
|
+
import { applyModificationsToWorld } from '../forge/apply-modifications.js';
|
|
28
|
+
import { projectWorldJsonPath } from '../forge/run-pipeline.js';
|
|
29
|
+
import { uploadProjectFile } from '../http/signed-upload.js';
|
|
30
|
+
import { isJsonObject, readWorldJson } from '../project/world-json.js';
|
|
31
|
+
import { summarizeVxl } from './vxl-summary.js';
|
|
32
|
+
import { assertEngineHonouredId, voxelizeGlbIntoAsset } from './voxelize-glb.js';
|
|
33
|
+
/**
|
|
34
|
+
* The stored source to re-bake, preferring the master.
|
|
35
|
+
*
|
|
36
|
+
* The master is preferred when both are present because it is a hundredth of the bytes for the
|
|
37
|
+
* same answer at or below its own resolution. `assertCanGoFiner` is what catches the case where
|
|
38
|
+
* that preference would cost detail.
|
|
39
|
+
*/
|
|
40
|
+
export function chooseSource(asset) {
|
|
41
|
+
const masterUrl = asset.sourceVxlMasterUrl;
|
|
42
|
+
if (typeof masterUrl === 'string' && masterUrl !== '')
|
|
43
|
+
return { kind: 'master', masterUrl };
|
|
44
|
+
const glbUrl = asset.sourceGlbUrl;
|
|
45
|
+
if (typeof glbUrl === 'string' && glbUrl !== '')
|
|
46
|
+
return { kind: 'glb', glbUrl };
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
/** The asset to re-bake, refused before the browser starts if it cannot be. */
|
|
50
|
+
export function findRevoxelizableAsset(world, assetId) {
|
|
51
|
+
const assets = Array.isArray(world.assets) ? world.assets : [];
|
|
52
|
+
const asset = assets.find((item) => isJsonObject(item) && item.id === assetId);
|
|
53
|
+
if (!isJsonObject(asset)) {
|
|
54
|
+
throw new CliError(`No asset with id "${assetId}" in this project's world.json. `
|
|
55
|
+
+ 'Run `bitmagic assets list` to see the ids.');
|
|
56
|
+
}
|
|
57
|
+
const source = chooseSource(asset);
|
|
58
|
+
if (source === null) {
|
|
59
|
+
const name = typeof asset.name === 'string' ? asset.name : assetId;
|
|
60
|
+
throw new CliError(`"${name}" records neither a voxel master nor a source mesh, so there is nothing to re-bake `
|
|
61
|
+
+ 'from. Only assets produced by `bitmagic generate` or `bitmagic assets add <file.glb>` keep '
|
|
62
|
+
+ 'one; a `.vxl` uploaded directly is already its own final form.');
|
|
63
|
+
}
|
|
64
|
+
return { asset, source };
|
|
65
|
+
}
|
|
66
|
+
/** Placed instances pointing at this asset. */
|
|
67
|
+
function countInstances(world, assetId) {
|
|
68
|
+
const objects = Array.isArray(world.environmentObjects) ? world.environmentObjects : [];
|
|
69
|
+
return objects.filter((item) => isJsonObject(item) && item.assetId === assetId).length;
|
|
70
|
+
}
|
|
71
|
+
/** A positive number from an unknown field, or undefined. */
|
|
72
|
+
function positiveNumber(value) {
|
|
73
|
+
return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : undefined;
|
|
74
|
+
}
|
|
75
|
+
/** The finest grid the generator will forge a master at. */
|
|
76
|
+
const MAX_MASTER_GRID = Math.max(...propVoxelGrids);
|
|
77
|
+
/**
|
|
78
|
+
* Floating-point slack for "the engine baked what I asked for".
|
|
79
|
+
*
|
|
80
|
+
* The requested size round-trips through a float32 header, so an exact `===` would report a
|
|
81
|
+
* coarsening on every bake. A real one is a DOUBLING, so anything under a few percent is noise.
|
|
82
|
+
*/
|
|
83
|
+
const VOXEL_SIZE_EPSILON = 0.02;
|
|
84
|
+
/**
|
|
85
|
+
* A voxel size fit to show a person and to store.
|
|
86
|
+
*
|
|
87
|
+
* The `.vxl` header holds float32, so the size read back out of it is `0.019999999552965164` where
|
|
88
|
+
* the creator asked for `0.01` and got a doubling. Six significant figures is far beyond any
|
|
89
|
+
* resolution this means anything at, and it puts the number back in the vocabulary the flag uses —
|
|
90
|
+
* both in the note and in world.json, which would otherwise carry the artifact into every diff.
|
|
91
|
+
*/
|
|
92
|
+
export function tidyVoxelSize(value) {
|
|
93
|
+
return Number(value.toPrecision(6));
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* What the bake actually produced, when that is not what was asked for.
|
|
97
|
+
*
|
|
98
|
+
* The engine's compiler halves resolution until the model fits a leaf budget
|
|
99
|
+
* (`compileVoxelModelToVxlAsset`: `while (cells.size > maxLeaves) { downsample; vs *= 2 }`, budget
|
|
100
|
+
* 600k for a working asset). It says so — but only as a `console.warn` inside the headless Chrome
|
|
101
|
+
* the CLI drives, which reaches nobody, and `REVOXELIZE_FROM_VXL_MASTER_RESULT` did not carry it.
|
|
102
|
+
* So a request just under the knee came back at exactly twice the size, silently, with a zero exit
|
|
103
|
+
* code.
|
|
104
|
+
*
|
|
105
|
+
* The effect is worse than "not quite what you asked for", which is why this is said out loud
|
|
106
|
+
* rather than left to whoever compares two numbers in world.json: the result is NON-MONOTONIC.
|
|
107
|
+
* One step below the knee the asset is coarser than a COARSER request would have produced —
|
|
108
|
+
* measured on a 2.78 m stall with a 512³ master, 0.011 m gave 556k voxels and 0.0105 m gave 141k.
|
|
109
|
+
* Nothing about "I asked for finer voxels and got a blockier model" suggests looking at a budget.
|
|
110
|
+
*
|
|
111
|
+
* Detected from the .vxl header rather than from anything the engine says, deliberately: the
|
|
112
|
+
* header is what was actually written, and the CLI drives whatever engine the project vendored —
|
|
113
|
+
* including ones that predate any reply field carrying this.
|
|
114
|
+
*/
|
|
115
|
+
export function describeBudgetCoarsening(requested, achieved) {
|
|
116
|
+
const factor = achieved / requested;
|
|
117
|
+
if (!(factor > 1 + VOXEL_SIZE_EPSILON))
|
|
118
|
+
return { coarsened: false, factor: 1, note: '' };
|
|
119
|
+
return {
|
|
120
|
+
coarsened: true,
|
|
121
|
+
factor,
|
|
122
|
+
note: `note: baked at ${tidyVoxelSize(achieved)} m, not the ${requested} m requested — the model did not fit `
|
|
123
|
+
+ 'the renderer\'s 600,000-leaf budget, so the engine halved the resolution to make it fit. '
|
|
124
|
+
+ 'A slightly LARGER --voxel-size will come back finer than this one did; there is a knee '
|
|
125
|
+
+ 'just above the size you asked for.',
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* What to actually do about a master that cannot go finer — which is NOT the same advice at every
|
|
130
|
+
* resolution.
|
|
131
|
+
*
|
|
132
|
+
* "Re-generate at a higher --voxel-grid" is a dead end once the master is already at
|
|
133
|
+
* {@link MAX_MASTER_GRID}: that is the top of the generator's allowlist, so there is no higher
|
|
134
|
+
* value to pass and the reader is sent to look for one that does not exist. At the ceiling the two
|
|
135
|
+
* things that DO still work are a resolution-independent source (the mesh path keeps a GLB, which
|
|
136
|
+
* has no ceiling at all) and a shorter bake — the floor is `targetHeight / resolution`, so the same
|
|
137
|
+
* cells spread over less world buy proportionally finer voxels.
|
|
138
|
+
*/
|
|
139
|
+
function wayPastTheFloor(resolution) {
|
|
140
|
+
return resolution >= MAX_MASTER_GRID
|
|
141
|
+
? `${MAX_MASTER_GRID} is the finest grid the generator offers, so there is no higher `
|
|
142
|
+
+ '--voxel-grid to ask for: either bake it shorter (--height, which spreads the same cells '
|
|
143
|
+
+ 'over less world) or re-generate WITHOUT --direct-voxels, whose mesh source has no '
|
|
144
|
+
+ 'resolution ceiling.'
|
|
145
|
+
: `Re-generate it at a higher --voxel-grid (up to ${MAX_MASTER_GRID}) for more detail.`;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The height a master re-bake will be resampled to.
|
|
149
|
+
*
|
|
150
|
+
* `--height` wins. Otherwise the height the asset was BAKED at, which the master path records in
|
|
151
|
+
* `voxelizeSettings` for exactly this. Falling through to neither is the case worth naming: a
|
|
152
|
+
* master is a grid, not a size, so the engine has nothing to derive a height from and lands on its
|
|
153
|
+
* own `DEFAULT_TARGET_HEIGHT` of 2 m — silently returning a 10 m building as a 2 m one. The mesh
|
|
154
|
+
* branch has no such gap, which is why `--height`'s "omit to keep the source's own size" only ever
|
|
155
|
+
* described half of this command.
|
|
156
|
+
*/
|
|
157
|
+
export function resolveMasterTargetHeight(asset, requested) {
|
|
158
|
+
if (requested !== undefined)
|
|
159
|
+
return requested;
|
|
160
|
+
const settings = asset.voxelizeSettings;
|
|
161
|
+
return isJsonObject(settings) ? positiveNumber(settings.targetHeight) : undefined;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Refuse a master re-bake that asks for more detail than the master holds.
|
|
165
|
+
*
|
|
166
|
+
* The engine would refuse it too — `resampleMaster` throws "re-forge at a higher resolution rather
|
|
167
|
+
* than upsampling" — but only after the browser, vite and the page have started. Saying it here
|
|
168
|
+
* costs nothing and names the thing to do instead, which the engine's message cannot know.
|
|
169
|
+
*
|
|
170
|
+
* The floor is derived from the MASTER, not from the previous bake. Those are very different
|
|
171
|
+
* numbers: a 512³ master baked once at 0.1 m holds detail down to about `targetHeight / 512`, and
|
|
172
|
+
* refusing everything below 0.1 m would make that headroom unreachable from the CLI — which is the
|
|
173
|
+
* whole reason the master is stored rather than the working asset.
|
|
174
|
+
*
|
|
175
|
+
* Deliberately PERMISSIVE. The engine's real limit is the master's occupied span along the up
|
|
176
|
+
* axis, which is at most its resolution and usually less, so a request between
|
|
177
|
+
* `targetHeight / resolution` and `targetHeight / spanUp` still throws in the browser. That is the
|
|
178
|
+
* right way round: this pre-flight exists to avoid paying for a browser on a request that cannot
|
|
179
|
+
* work, never to refuse a size the master can serve. The engine stays the authority.
|
|
180
|
+
*
|
|
181
|
+
* Falls back to the old "no finer than the last bake" rule when either field is missing, so assets
|
|
182
|
+
* written before `sourceVxlMasterResolution` existed — or hand-edited ones — keep a guard rather
|
|
183
|
+
* than losing it.
|
|
184
|
+
*/
|
|
185
|
+
export function assertMasterCanGoFiner(asset, requestedVoxelSize, targetHeight, name) {
|
|
186
|
+
const resolution = positiveNumber(asset.sourceVxlMasterResolution);
|
|
187
|
+
if (resolution !== undefined && targetHeight !== undefined) {
|
|
188
|
+
const floor = targetHeight / resolution;
|
|
189
|
+
if (requestedVoxelSize >= floor)
|
|
190
|
+
return;
|
|
191
|
+
throw new CliError(`"${name}" has a ${resolution}³ voxel master, which at ${targetHeight} m holds detail down `
|
|
192
|
+
+ `to about ${floor.toPrecision(3)} m — ${requestedVoxelSize} m would be upsampling, and a `
|
|
193
|
+
+ `master is only ever resampled coarser. ${wayPastTheFloor(resolution)} `
|
|
194
|
+
+ 'world.json is unchanged.');
|
|
195
|
+
}
|
|
196
|
+
const existing = positiveNumber(asset.voxelSize);
|
|
197
|
+
if (existing === undefined || requestedVoxelSize >= existing)
|
|
198
|
+
return;
|
|
199
|
+
throw new CliError(`"${name}" was baked at ${existing} m and records no master resolution, so there is nothing `
|
|
200
|
+
+ `saying its master can be resampled finer than that — ${requestedVoxelSize} m may be `
|
|
201
|
+
+ 'upsampling. Re-generate it instead, or use a voxel size at or above the current one. '
|
|
202
|
+
+ 'world.json is unchanged.');
|
|
203
|
+
}
|
|
204
|
+
export async function revoxelizeAsset(options) {
|
|
205
|
+
const { context, assetId } = options;
|
|
206
|
+
const worldPath = projectWorldJsonPath(context.root);
|
|
207
|
+
const world = readWorldJson(worldPath);
|
|
208
|
+
const { asset, source } = findRevoxelizableAsset(world, assetId);
|
|
209
|
+
const assetName = typeof asset.name === 'string' ? asset.name : assetId;
|
|
210
|
+
const entry = source.kind === 'master'
|
|
211
|
+
? await rebakeFromMaster({ ...options, asset, assetName, source })
|
|
212
|
+
: await rebakeFromGlb({ ...options, assetName, glbUrl: source.glbUrl });
|
|
213
|
+
// MERGED over the existing record, never substituted for it. An asset accumulates authored state
|
|
214
|
+
// this command knows nothing about — `fitBox`, `vehicleFitment`, `collision`, `light`,
|
|
215
|
+
// `flattenTerrain` — and a fresh record over the top would silently discard all of it. The same
|
|
216
|
+
// rule `assets add` states for its own write.
|
|
217
|
+
const modification = {
|
|
218
|
+
type: 'upsertRoot',
|
|
219
|
+
path: ['assets'],
|
|
220
|
+
predicate: (item) => isJsonObject(item) && item.id === assetId,
|
|
221
|
+
value: { ...asset, ...entry },
|
|
222
|
+
};
|
|
223
|
+
applyModificationsToWorld(worldPath, [modification], { subject: 'The re-voxelized asset' });
|
|
224
|
+
return {
|
|
225
|
+
assetId,
|
|
226
|
+
assetName,
|
|
227
|
+
source: source.kind,
|
|
228
|
+
...(typeof entry.url === 'string' ? { assetUrl: entry.url } : {}),
|
|
229
|
+
...(typeof entry.voxelCount === 'number' ? { voxelCount: entry.voxelCount } : {}),
|
|
230
|
+
instanceCount: countInstances(world, assetId),
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* The master path. The engine returns BYTES, not an asset record — unlike every create path, where
|
|
235
|
+
* it uploads and hands back the record — so the upload and the record are this side's job.
|
|
236
|
+
*/
|
|
237
|
+
async function rebakeFromMaster(options) {
|
|
238
|
+
const { context, environment, token, assetId, voxel, assetName, source, log } = options;
|
|
239
|
+
const targetHeight = resolveMasterTargetHeight(options.asset, voxel.targetHeight);
|
|
240
|
+
assertMasterCanGoFiner(options.asset, voxel.minVoxelSize, targetHeight, assetName);
|
|
241
|
+
if (targetHeight === undefined) {
|
|
242
|
+
log(`note: "${assetName}" records no baked height, so the engine's 2 m default applies. `
|
|
243
|
+
+ 'Pass --height to keep it the size it is.');
|
|
244
|
+
}
|
|
245
|
+
const runSession = options.session ?? withVoxelizeSession;
|
|
246
|
+
const retryHint = `Nothing was spent — the master is still at ${source.masterUrl}, so this is `
|
|
247
|
+
+ 'safe to retry.';
|
|
248
|
+
const bytes = await runSession({
|
|
249
|
+
context, environment, token, log, subject: `"${assetName}"`, retryHint,
|
|
250
|
+
}, async ({ host, port }) => {
|
|
251
|
+
log(`Re-baking "${assetName}" from its voxel master at ${voxel.minVoxelSize}m…`);
|
|
252
|
+
const result = await host.transport.sendAndWait({
|
|
253
|
+
type: 'REVOXELIZE_FROM_VXL_MASTER',
|
|
254
|
+
requestId: `revoxelize-${assetId}-${port}`,
|
|
255
|
+
masterUrl: source.masterUrl,
|
|
256
|
+
options: {
|
|
257
|
+
minVoxelSize: voxel.minVoxelSize,
|
|
258
|
+
maxVoxelSize: voxel.maxVoxelSize,
|
|
259
|
+
// The RESOLVED height, not `voxel.targetHeight`: omitting it lands on the engine's 2 m
|
|
260
|
+
// default, which resizes every asset that is not 2 m tall.
|
|
261
|
+
...(targetHeight !== undefined ? { targetHeight } : {}),
|
|
262
|
+
},
|
|
263
|
+
}, 'REVOXELIZE_FROM_VXL_MASTER_RESULT', VOXELIZE_TIMEOUT_MS, { maxRetries: 1 });
|
|
264
|
+
if (!result)
|
|
265
|
+
throw new CliError(`Re-baking "${assetName}" timed out. ${retryHint}`);
|
|
266
|
+
if (result.success === false) {
|
|
267
|
+
const reason = typeof result.error === 'string' ? result.error : 'unknown error';
|
|
268
|
+
throw new CliError(`Re-baking "${assetName}" failed: ${reason}. ${retryHint}`);
|
|
269
|
+
}
|
|
270
|
+
const vxlBytes = result.vxlBytes;
|
|
271
|
+
if (!(vxlBytes instanceof Uint8Array) && !Array.isArray(vxlBytes)) {
|
|
272
|
+
throw new CliError(`The engine returned no voxels for "${assetName}". ${retryHint}`);
|
|
273
|
+
}
|
|
274
|
+
return vxlBytes instanceof Uint8Array ? vxlBytes : new Uint8Array(vxlBytes);
|
|
275
|
+
});
|
|
276
|
+
// Read the bake's own header BEFORE uploading. Two reasons, and the ordering matters for both:
|
|
277
|
+
// bytes that are not a readable .vxl should never reach storage under a name the engine will
|
|
278
|
+
// later try to load, and the record has to describe what was actually produced rather than what
|
|
279
|
+
// was asked for — the compiler picks the resolution it achieved. `boundingBoxInMeters` beside
|
|
280
|
+
// `voxelSize` is mandatory: without it the engine reads the box as grid units and shrinks the
|
|
281
|
+
// asset 10-20x.
|
|
282
|
+
const summary = summarizeVxl(bytes);
|
|
283
|
+
if (summary === null) {
|
|
284
|
+
throw new CliError(`The engine returned bytes that are not a readable .vxl for "${assetName}". ${retryHint}`);
|
|
285
|
+
}
|
|
286
|
+
const achieved = describeBudgetCoarsening(voxel.minVoxelSize, summary.minVoxelSize);
|
|
287
|
+
if (achieved.coarsened)
|
|
288
|
+
log(achieved.note);
|
|
289
|
+
const timestamp = Date.now();
|
|
290
|
+
const upload = await uploadProjectFile(environment, token, {
|
|
291
|
+
gameId: context.metadata.gameId,
|
|
292
|
+
filename: `${context.metadata.gameId}-${assetName}-${timestamp}.vxl`,
|
|
293
|
+
contentType: 'application/octet-stream',
|
|
294
|
+
bytes,
|
|
295
|
+
}, { fetch: options.fetchImpl ?? globalThis.fetch });
|
|
296
|
+
return {
|
|
297
|
+
url: upload.url,
|
|
298
|
+
type: 'vxl',
|
|
299
|
+
size: bytes.byteLength,
|
|
300
|
+
boundingBox: summary.boundingBox,
|
|
301
|
+
boundingBoxInMeters: true,
|
|
302
|
+
voxelSize: tidyVoxelSize(summary.minVoxelSize),
|
|
303
|
+
fragmentCount: summary.fragmentCount,
|
|
304
|
+
...(summary.voxelCount !== undefined ? { voxelCount: summary.voxelCount } : {}),
|
|
305
|
+
// Re-recorded from what the bake ACHIEVED, never from what was asked for. A `--height` re-bake
|
|
306
|
+
// that left the old height here would leave the next run computing its master floor against a
|
|
307
|
+
// size that no longer matches the asset — and recording the requested voxel size next to a
|
|
308
|
+
// `voxelSize` the compiler coarsened leaves world.json asserting two resolutions for one file.
|
|
309
|
+
// `fillInterior` is meaningless on this path: a master already carries its own occupancy.
|
|
310
|
+
voxelizeSettings: {
|
|
311
|
+
minVoxelSize: tidyVoxelSize(summary.minVoxelSize),
|
|
312
|
+
// Scaled by the same factor, so the ladder the creator asked for (a 5x spread, say) survives
|
|
313
|
+
// a coarsening rather than silently narrowing to 2.5x.
|
|
314
|
+
maxVoxelSize: tidyVoxelSize(voxel.maxVoxelSize * achieved.factor),
|
|
315
|
+
...(targetHeight !== undefined ? { targetHeight } : {}),
|
|
316
|
+
fillInterior: false,
|
|
317
|
+
},
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* The GLB path. A full re-voxelization through the shared bake, which is what `generate model
|
|
322
|
+
* --glb-url --asset-id` already does by hand; this only saves the creator digging the URL out of
|
|
323
|
+
* world.json and knowing to pass three flags.
|
|
324
|
+
*/
|
|
325
|
+
async function rebakeFromGlb(options) {
|
|
326
|
+
const { context, environment, token, assetId, voxel, assetName, glbUrl, log } = options;
|
|
327
|
+
const voxelize = options.voxelize ?? voxelizeGlbIntoAsset;
|
|
328
|
+
const engineAsset = await voxelize({
|
|
329
|
+
context,
|
|
330
|
+
environment,
|
|
331
|
+
token,
|
|
332
|
+
name: assetName,
|
|
333
|
+
source: { kind: 'glb', glbUrl },
|
|
334
|
+
assetId,
|
|
335
|
+
voxel,
|
|
336
|
+
retryHint: `Nothing was spent — the mesh is still at ${glbUrl}, so this is safe to retry.`,
|
|
337
|
+
requestPrefix: 'revoxelize',
|
|
338
|
+
log,
|
|
339
|
+
});
|
|
340
|
+
assertEngineHonouredId(engineAsset, assetId, assetName, `the mesh is kept at ${glbUrl}`);
|
|
341
|
+
return engineAsset;
|
|
342
|
+
}
|
|
343
|
+
//# sourceMappingURL=revoxelize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revoxelize.js","sourceRoot":"","sources":["../../src/assets/revoxelize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxF,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAwC,MAAM,mBAAmB,CAAC;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AE,SAAS;QACf,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE;QAC/B,OAAO;QACP,KAAK;QACL,SAAS,EAAE,4CAA4C,MAAM,6BAA6B;QAC1F,aAAa,EAAE,YAAY;QAC3B,GAAG;KACJ,CAAC,CAAC;IACH,sBAAsB,CAAC,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,uBAAuB,MAAM,EAAE,CAAC,CAAC;IACzF,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
package/dist/cli.d.ts
CHANGED
|
@@ -145,6 +145,10 @@ declare const rawCommands: {
|
|
|
145
145
|
readonly type: "string";
|
|
146
146
|
readonly description: "One-line pitch. Seeds GAME-DESIGN.md and picks the template whose camera and controls fit it. Optional — you can write it yourself.";
|
|
147
147
|
};
|
|
148
|
+
readonly 'original-prompt': {
|
|
149
|
+
readonly type: "string";
|
|
150
|
+
readonly description: string;
|
|
151
|
+
};
|
|
148
152
|
readonly env: {
|
|
149
153
|
readonly type: "string";
|
|
150
154
|
readonly description: "Environment (dev, prod, local).";
|
|
@@ -172,6 +176,16 @@ declare const rawCommands: {
|
|
|
172
176
|
readonly description: "Print the result as JSON on stdout; all progress goes to stderr.";
|
|
173
177
|
};
|
|
174
178
|
}>;
|
|
179
|
+
'self-update': CommandDef<{
|
|
180
|
+
readonly tag: {
|
|
181
|
+
readonly type: "string";
|
|
182
|
+
readonly description: string;
|
|
183
|
+
};
|
|
184
|
+
readonly json: {
|
|
185
|
+
readonly type: "boolean";
|
|
186
|
+
readonly description: "Print the result as JSON on stdout; all progress goes to stderr.";
|
|
187
|
+
};
|
|
188
|
+
}>;
|
|
175
189
|
check: CommandDef<{
|
|
176
190
|
readonly json: {
|
|
177
191
|
readonly type: "boolean";
|
|
@@ -254,6 +268,10 @@ declare const rawCommands: {
|
|
|
254
268
|
readonly type: "string";
|
|
255
269
|
readonly description: "Style/composition reference image URL forwarded to the image model.";
|
|
256
270
|
};
|
|
271
|
+
readonly 'original-prompt': {
|
|
272
|
+
readonly type: "string";
|
|
273
|
+
readonly description: string;
|
|
274
|
+
};
|
|
257
275
|
readonly json: {
|
|
258
276
|
readonly type: "boolean";
|
|
259
277
|
readonly description: "Print the result as JSON on stdout; all progress goes to stderr.";
|
|
@@ -282,6 +300,10 @@ declare const rawCommands: {
|
|
|
282
300
|
readonly type: "string";
|
|
283
301
|
readonly description: "Describe the level, e.g. \"a ruined desert temple with a central courtyard\".";
|
|
284
302
|
};
|
|
303
|
+
readonly 'original-prompt': {
|
|
304
|
+
readonly type: "string";
|
|
305
|
+
readonly description: string;
|
|
306
|
+
};
|
|
285
307
|
readonly name: {
|
|
286
308
|
readonly type: "string";
|
|
287
309
|
readonly description: "Name for the level. Derived from the prompt when omitted.";
|
|
@@ -318,7 +340,7 @@ declare const rawCommands: {
|
|
|
318
340
|
publish: CommandDef<{
|
|
319
341
|
readonly visibility: {
|
|
320
342
|
readonly type: "string";
|
|
321
|
-
readonly description:
|
|
343
|
+
readonly description: string;
|
|
322
344
|
};
|
|
323
345
|
readonly name: {
|
|
324
346
|
readonly type: "string";
|
|
@@ -336,6 +358,10 @@ declare const rawCommands: {
|
|
|
336
358
|
readonly type: "boolean";
|
|
337
359
|
readonly description: "Skip the post-publish render check. The game still publishes; it is simply not confirmed to render.";
|
|
338
360
|
};
|
|
361
|
+
readonly 'no-qr': {
|
|
362
|
+
readonly type: "boolean";
|
|
363
|
+
readonly description: "Do not draw the published URL as a QR code. `BITMAGIC_NO_QR` does the same for every run.";
|
|
364
|
+
};
|
|
339
365
|
readonly json: {
|
|
340
366
|
readonly type: "boolean";
|
|
341
367
|
readonly description: "Print the result as JSON on stdout; all progress goes to stderr.";
|
package/dist/cli.js
CHANGED
|
@@ -13,6 +13,7 @@ import { allowanceCommand } from './commands/allowance.js';
|
|
|
13
13
|
import { subscribeCommand } from './commands/subscribe.js';
|
|
14
14
|
import { initCommand } from './commands/init.js';
|
|
15
15
|
import { upgradeCommand } from './commands/upgrade.js';
|
|
16
|
+
import { selfUpdateCommand } from './commands/self-update.js';
|
|
16
17
|
import { checkCommand } from './commands/check.js';
|
|
17
18
|
import { devCommand } from './commands/dev.js';
|
|
18
19
|
import { reloadCommand } from './commands/reload.js';
|
|
@@ -71,6 +72,20 @@ function declaredExplicitEnv(command, args) {
|
|
|
71
72
|
const value = args?.env;
|
|
72
73
|
return typeof value === 'string' ? value : undefined;
|
|
73
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* The `--original-prompt` this command actually declares, or undefined.
|
|
77
|
+
*
|
|
78
|
+
* Gated on the declaration for the same reason as `declaredExplicitEnv` above: citty surfaces a
|
|
79
|
+
* flag the command never declared, so `--original-prompt=x` on a command without it would
|
|
80
|
+
* otherwise be captured and sent. The space form arrives as `true`, which the type check catches.
|
|
81
|
+
*/
|
|
82
|
+
function declaredCreatorPrompt(command, args) {
|
|
83
|
+
const declared = (command.args ?? {});
|
|
84
|
+
if (!Object.prototype.hasOwnProperty.call(declared, 'original-prompt'))
|
|
85
|
+
return undefined;
|
|
86
|
+
const value = args?.['original-prompt'];
|
|
87
|
+
return typeof value === 'string' ? value : undefined;
|
|
88
|
+
}
|
|
74
89
|
/**
|
|
75
90
|
* The name the wrapper reports for `command`, when the caller did not give one: its own
|
|
76
91
|
* `meta.name`, or `unknown` for a command that has none. Every entry in `rawCommands` is named
|
|
@@ -104,9 +119,10 @@ export function withCleanErrors(command, name = commandNameOf(command), deps = r
|
|
|
104
119
|
wrapped.run = async (context) => {
|
|
105
120
|
const json = context.args?.json === true;
|
|
106
121
|
const explicitEnv = declaredExplicitEnv(command, context.args);
|
|
122
|
+
const creatorPrompt = declaredCreatorPrompt(command, context.args);
|
|
107
123
|
const startedAt = deps.now();
|
|
108
124
|
// Before the run, so every api-server call the command makes is stamped with its name.
|
|
109
|
-
deps.begin({ name, json, explicitEnv, now: deps.now });
|
|
125
|
+
deps.begin({ name, json, explicitEnv, creatorPrompt, now: deps.now });
|
|
110
126
|
// Awaited, not fired: it is bounded (report.ts), and on the failure path process.exit
|
|
111
127
|
// comes next — a fire-and-forget request would be cut off mid-flight.
|
|
112
128
|
//
|
|
@@ -191,6 +207,7 @@ const rawCommands = {
|
|
|
191
207
|
allowance: allowanceCommand,
|
|
192
208
|
init: initCommand,
|
|
193
209
|
upgrade: upgradeCommand,
|
|
210
|
+
'self-update': selfUpdateCommand,
|
|
194
211
|
check: checkCommand,
|
|
195
212
|
dev: devCommand,
|
|
196
213
|
reload: reloadCommand,
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,YAAY,EAA0B,MAAM,gCAAgC,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAsB,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB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AC5E,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAC5D,CAC0C,CAAC;AAE9C,iGAAiG;AACjG,8FAA8F;AAC9F,uFAAuF;AACvF,4FAA4F;AAC5F,MAAM,CAAC,MAAM,IAAI,GAAG,aAAa,CAAC;IAChC,IAAI,EAAE;QACJ,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,gDAAgD;KAC9D;IACD,WAAW;CACZ,CAAC,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { type CommandRunDeps } from './run-deps.js';
|
|
|
2
2
|
import { type AddAssetResult } from '../assets/add.js';
|
|
3
3
|
import type { VoxelizeGlb } from '../assets/voxelize-glb.js';
|
|
4
4
|
import { type AssetRow } from '../assets/list.js';
|
|
5
|
+
import { type RevoxelizeResult } from '../assets/revoxelize.js';
|
|
5
6
|
/** The Creator's voxelize-dialog defaults (assetsVoxelizeDialog.ts), so a plain `add` bakes the same way. */
|
|
6
7
|
export declare const DEFAULT_MIN_VOXEL_SIZE = 0.1;
|
|
7
8
|
export declare const DEFAULT_MAX_VOXEL_SIZE = 0.5;
|
|
@@ -53,4 +54,21 @@ export interface RemoveResult {
|
|
|
53
54
|
remainingReferences: string[];
|
|
54
55
|
}
|
|
55
56
|
export declare function runAssetsRemove(options: RemoveOptions): Promise<RemoveResult>;
|
|
57
|
+
export interface RevoxelizeOptions {
|
|
58
|
+
assetId: string;
|
|
59
|
+
voxelSize?: string;
|
|
60
|
+
maxVoxelSize?: string;
|
|
61
|
+
height?: string;
|
|
62
|
+
hollow?: boolean;
|
|
63
|
+
solid?: boolean;
|
|
64
|
+
json: boolean;
|
|
65
|
+
deps?: AssetsRunDeps;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* `bitmagic assets revoxelize` — re-bake an existing asset at a different voxel size.
|
|
69
|
+
*
|
|
70
|
+
* No generation, so nothing is billed: it re-reads whichever source the asset already records.
|
|
71
|
+
* See assets/revoxelize.ts for which source that is and why the choice is the asset's to answer.
|
|
72
|
+
*/
|
|
73
|
+
export declare function runAssetsRevoxelize(options: RevoxelizeOptions): Promise<RevoxelizeResult>;
|
|
56
74
|
export declare const assetsCommand: import("citty").CommandDef<import("citty").ArgsDef>;
|