@bitmagic/cli 0.1.53-dev.5 → 0.1.53-dev.7
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 +34 -8
- package/dist/assets/revoxelize.d.ts +27 -1
- package/dist/assets/revoxelize.js +78 -12
- package/dist/assets/revoxelize.js.map +1 -1
- package/dist/commands/assets.js +2 -1
- package/dist/commands/assets.js.map +1 -1
- package/dist/commands/generate.d.ts +22 -0
- package/dist/commands/generate.js +59 -1
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/publish.d.ts +7 -2
- package/dist/commands/publish.js +39 -7
- package/dist/commands/publish.js.map +1 -1
- 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 +31 -0
- package/dist/editor/server.js.map +1 -1
- package/dist/editor/shell-page.js +90 -2
- package/dist/editor/shell-page.js.map +1 -1
- package/dist/generate/model.d.ts +5 -0
- package/dist/generate/model.js +7 -2
- package/dist/generate/model.js.map +1 -1
- package/dist/generate/prop.d.ts +18 -0
- package/dist/generate/prop.js +21 -1
- package/dist/generate/prop.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 +8 -1
- package/dist/render/qr-terminal.js +8 -1
- package/dist/render/qr-terminal.js.map +1 -1
- package/dist/scaffold/project-files.js +5 -0
- package/dist/scaffold/project-files.js.map +1 -1
- package/dist/update/check.js +2 -1
- package/dist/update/check.js.map +1 -1
- package/package.json +4 -4
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
import { decodeForgeMapHeights, renderForgeMapRgba, } from '@bitmagic/world-forger/pipeline/forge-map-render.js';
|
|
52
52
|
import { FORGE_MAP_PALETTE } from '@bitmagic/world-forger/pipeline/layout-map.js';
|
|
53
53
|
import { ASSET_DETAIL_CSS, ASSET_DETAIL_HTML } from './asset-detail-panel.js';
|
|
54
|
+
import { PUBLISH_PANEL_CSS, PUBLISH_PANEL_HTML } from './publish-panel.js';
|
|
54
55
|
import { BOOT_LOADER_CSS, BOOT_LOADER_HTML } from './boot-loader.js';
|
|
55
56
|
import { BITMAGIC_CONTROLS_CSS, BITMAGIC_FONT_LINK, BITMAGIC_TOKENS_CSS } from './design.js';
|
|
56
57
|
/** How often the shell asks the engine whether anything changed. A `Set` read; effectively free. */
|
|
@@ -228,6 +229,7 @@ ${BITMAGIC_CONTROLS_CSS}
|
|
|
228
229
|
#hq-note code { display: block; margin-top: 6px; color: var(--bm-aqua);
|
|
229
230
|
font-family: var(--bm-font-mono); word-break: break-all; }
|
|
230
231
|
${ASSET_DETAIL_CSS}
|
|
232
|
+
${PUBLISH_PANEL_CSS}
|
|
231
233
|
${BOOT_LOADER_CSS}
|
|
232
234
|
</style>
|
|
233
235
|
</head>
|
|
@@ -244,7 +246,8 @@ ${BOOT_LOADER_CSS}
|
|
|
244
246
|
<input id="auto-toggle" type="checkbox" checked> Auto-reload
|
|
245
247
|
</label>
|
|
246
248
|
<span id="status"><span id="dot"></span><span id="status-text">Loading…</span></span>
|
|
247
|
-
<button id="
|
|
249
|
+
<button id="publish-toggle" class="bm-pill" type="button" title="Where this game is published" disabled>Published</button>
|
|
250
|
+
<button id="assets-toggle" class="bm-pill" type="button" title="Show the assets in this project and what is being made">Assets</button>
|
|
248
251
|
<button id="shot" class="bm-pill" type="button" title="Copy the current frame to the clipboard">Screenshot</button>
|
|
249
252
|
<button id="reload" class="bm-pill" type="button">Reload</button>
|
|
250
253
|
</div>
|
|
@@ -293,6 +296,7 @@ ${BOOT_LOADER_HTML}
|
|
|
293
296
|
</div>
|
|
294
297
|
</div>
|
|
295
298
|
</div>
|
|
299
|
+
${PUBLISH_PANEL_HTML}
|
|
296
300
|
${ASSET_DETAIL_HTML}
|
|
297
301
|
<script>
|
|
298
302
|
(function () {
|
|
@@ -311,6 +315,16 @@ ${ASSET_DETAIL_HTML}
|
|
|
311
315
|
var dot = document.getElementById('dot');
|
|
312
316
|
var statusText = document.getElementById('status-text');
|
|
313
317
|
var banner = document.getElementById('banner');
|
|
318
|
+
var publishToggle = document.getElementById('publish-toggle');
|
|
319
|
+
var publishOverlay = document.getElementById('publish-overlay');
|
|
320
|
+
var publishUrl = document.getElementById('publish-url');
|
|
321
|
+
var publishVisibility = document.getElementById('publish-visibility');
|
|
322
|
+
var publishVersion = document.getElementById('publish-version');
|
|
323
|
+
var publishManage = document.getElementById('publish-manage');
|
|
324
|
+
var publishQr = document.getElementById('publish-qr');
|
|
325
|
+
var publishClose = document.getElementById('publish-close');
|
|
326
|
+
/** The last publish the poll saw, or null until this project has had one. */
|
|
327
|
+
var lastPublish = null;
|
|
314
328
|
var terrainBanner = document.getElementById('terrain-banner');
|
|
315
329
|
var buildBanner = document.getElementById('build-banner');
|
|
316
330
|
var cliBanner = document.getElementById('cli-banner');
|
|
@@ -947,10 +961,17 @@ ${ASSET_DETAIL_HTML}
|
|
|
947
961
|
* there is no replay. This poll is what closes that hole, and it costs one stat() per tick.
|
|
948
962
|
*/
|
|
949
963
|
async function checkExternalEdits() {
|
|
950
|
-
if (
|
|
964
|
+
if (saving) return;
|
|
951
965
|
try {
|
|
952
966
|
var state = await (await fetch('/api/state')).json();
|
|
953
967
|
showCliUpdate(state.cliUpdate);
|
|
968
|
+
showPublish(state.publish);
|
|
969
|
+
// Only the mtime comparison below needs the game to have booted — it is what establishes
|
|
970
|
+
// lastKnownMtime, and without it every tick would read as someone else's edit. The two
|
|
971
|
+
// surfaces above need nothing from the game, and a game that will not boot is exactly when
|
|
972
|
+
// a creator most wants the published link and the update banner: the last good build is
|
|
973
|
+
// still live at that URL, and this is where they can reach it.
|
|
974
|
+
if (!loaded) return;
|
|
954
975
|
// Anything other than the mtime our own last write produced is someone else's edit — most
|
|
955
976
|
// likely the creator's agent.
|
|
956
977
|
if (state.worldMtimeMs && state.worldMtimeMs !== lastKnownMtime
|
|
@@ -978,6 +999,67 @@ ${ASSET_DETAIL_HTML}
|
|
|
978
999
|
cliBanner.classList.add('show');
|
|
979
1000
|
}
|
|
980
1001
|
|
|
1002
|
+
/**
|
|
1003
|
+
* Where this game is published, if it is.
|
|
1004
|
+
*
|
|
1005
|
+
* Driven by the poll for the same reason the banner above is: this page is rendered once when the
|
|
1006
|
+
* server starts, and the publish it should show almost always happens later, in another terminal
|
|
1007
|
+
* \u2014 often an agent's, which the creator never looks at. Polling means the pill lights up on
|
|
1008
|
+
* its own within a tick of the publish finishing, with no reload.
|
|
1009
|
+
*
|
|
1010
|
+
* The record is only stored, never rendered here, so a session that never opens the dialog never
|
|
1011
|
+
* asks the sidecar to encode a QR.
|
|
1012
|
+
*/
|
|
1013
|
+
function showPublish(record) {
|
|
1014
|
+
lastPublish = record || null;
|
|
1015
|
+
publishToggle.disabled = !lastPublish;
|
|
1016
|
+
publishToggle.title = lastPublish
|
|
1017
|
+
? 'Where this game is published'
|
|
1018
|
+
: 'Publish the game to get a link and a QR code';
|
|
1019
|
+
if (!lastPublish && publishOverlay.classList.contains('show')) closePublish();
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
function openPublish() {
|
|
1023
|
+
if (!lastPublish) return;
|
|
1024
|
+
publishUrl.textContent = lastPublish.url;
|
|
1025
|
+
publishUrl.href = lastPublish.url;
|
|
1026
|
+
publishVisibility.textContent = lastPublish.visibility;
|
|
1027
|
+
// Public is the state a creator chose and can be pleased about; private is the honest
|
|
1028
|
+
// reminder that nobody else can find it yet.
|
|
1029
|
+
publishVisibility.className = lastPublish.visibility === 'public'
|
|
1030
|
+
? 'bm-badge bm-badge--success'
|
|
1031
|
+
: 'bm-badge';
|
|
1032
|
+
publishVersion.textContent = 'publish ' + lastPublish.publishVersion + describeAge(lastPublish.at);
|
|
1033
|
+
publishManage.style.display = lastPublish.manageUrl ? '' : 'none';
|
|
1034
|
+
if (lastPublish.manageUrl) publishManage.href = lastPublish.manageUrl;
|
|
1035
|
+
// Cache-busted per open: a later publish keeps the same URL for an alias but not for a
|
|
1036
|
+
// versioned one, and a browser holding the old code would send a phone to the previous build.
|
|
1037
|
+
publishQr.src = '/api/publish/qr.png?v=' + encodeURIComponent(lastPublish.at);
|
|
1038
|
+
publishOverlay.classList.add('show');
|
|
1039
|
+
publishClose.focus();
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
function closePublish() {
|
|
1043
|
+
publishOverlay.classList.remove('show');
|
|
1044
|
+
// Drop the image so a session that publishes repeatedly does not keep every code it drew.
|
|
1045
|
+
publishQr.removeAttribute('src');
|
|
1046
|
+
publishToggle.focus();
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
/** ', 4 minutes ago' and so on. Empty when the stamp is unreadable rather than a wrong claim. */
|
|
1050
|
+
function describeAge(at) {
|
|
1051
|
+
var then = Date.parse(at);
|
|
1052
|
+
if (!then) return '';
|
|
1053
|
+
var seconds = Math.max(0, Math.round((Date.now() - then) / 1000));
|
|
1054
|
+
if (seconds < 90) return ', just now';
|
|
1055
|
+
var minutes = Math.round(seconds / 60);
|
|
1056
|
+
if (minutes < 60) return ', ' + minutes + ' minutes ago';
|
|
1057
|
+
var hours = Math.round(minutes / 60);
|
|
1058
|
+
if (hours < 24) return hours === 1 ? ', an hour ago' : ', ' + hours + ' hours ago';
|
|
1059
|
+
var days = Math.round(hours / 24);
|
|
1060
|
+
return days === 1 ? ', yesterday' : ', ' + days + ' days ago';
|
|
1061
|
+
}
|
|
1062
|
+
|
|
981
1063
|
/**
|
|
982
1064
|
* Something changed on disk. Reload, or explain why we did not.
|
|
983
1065
|
*
|
|
@@ -1939,6 +2021,12 @@ ${ASSET_DETAIL_HTML}
|
|
|
1939
2021
|
if (autoReload) banner.classList.remove('show');
|
|
1940
2022
|
});
|
|
1941
2023
|
|
|
2024
|
+
publishToggle.addEventListener('click', openPublish);
|
|
2025
|
+
publishClose.addEventListener('click', closePublish);
|
|
2026
|
+
// Click the backdrop to dismiss, like every other dialog on this page.
|
|
2027
|
+
publishOverlay.addEventListener('click', function (event) {
|
|
2028
|
+
if (event.target === publishOverlay) closePublish();
|
|
2029
|
+
});
|
|
1942
2030
|
assetsToggle.addEventListener('click', function () { setAssetsOpen(!assetsOpen); });
|
|
1943
2031
|
|
|
1944
2032
|
autoReload = readPref(AUTO_KEY, '1') !== '0';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell-page.js","sourceRoot":"","sources":["../../src/editor/shell-page.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,EACL,qBAAqB,EAAE,kBAAkB,GAC1C,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE7F,oGAAoG;AACpG,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B;;;;;;GAMG;AACH,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B;;;;;;;;;;;;GAYG;AACH,SAAS,sBAAsB;IAC7B,OAAO;QACL,6BAA6B,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,GAAG;QACjE,iCAAiC,qBAAqB,CAAC,QAAQ,EAAE,GAAG;QACpE,8BAA8B,kBAAkB,CAAC,QAAQ,EAAE,GAAG;KAC/D,CAAC,IAAI,CAAC,MA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11 @@ export interface GenerateModelOptions {
|
|
|
23
23
|
* only when the vendored engine can bake a master.
|
|
24
24
|
*/
|
|
25
25
|
directVoxels?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Grid to forge the master at (`--voxel-grid`). Only meaningful alongside `directVoxels`;
|
|
28
|
+
* defaults to `DEFAULT_MASTER_GRID`.
|
|
29
|
+
*/
|
|
30
|
+
voxelGrid?: number;
|
|
26
31
|
now?: () => Date;
|
|
27
32
|
log: (message: string) => void;
|
|
28
33
|
}
|
package/dist/generate/model.js
CHANGED
|
@@ -4,7 +4,7 @@ import { assertEngineHonouredId, bakeSourceUrl, voxelizeGlbIntoAsset, } from '..
|
|
|
4
4
|
import { applyModificationsToWorld } from '../forge/apply-modifications.js';
|
|
5
5
|
import { projectWorldJsonPath } from '../forge/run-pipeline.js';
|
|
6
6
|
import { requestGeneration } from './stream.js';
|
|
7
|
-
import { engineSupportsVxlMaster, messageOf } from './prop.js';
|
|
7
|
+
import { DEFAULT_MASTER_GRID, engineSupportsVxlMaster, messageOf } from './prop.js';
|
|
8
8
|
import { isJsonObject, readWorldJson } from '../project/world-json.js';
|
|
9
9
|
/**
|
|
10
10
|
* The wire types. `prop` is the api-server generator that turns a prompt into a mesh; see the file
|
|
@@ -48,6 +48,7 @@ export async function generateAndInstallModel(options) {
|
|
|
48
48
|
context, environment, token, prompt, fetchImpl, log,
|
|
49
49
|
...(options.creatorPrompt !== undefined ? { creatorPrompt: options.creatorPrompt } : {}),
|
|
50
50
|
directVoxels: options.directVoxels === true,
|
|
51
|
+
...(options.voxelGrid !== undefined ? { voxelGrid: options.voxelGrid } : {}),
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
54
|
// From here the source is PAID FOR, so every failure names the command that resumes without
|
|
@@ -114,7 +115,11 @@ async function generateSource(options) {
|
|
|
114
115
|
if (options.directVoxels && environment.name === 'dev' && engineSupportsVxlMaster(context.root)) {
|
|
115
116
|
let outcome = null;
|
|
116
117
|
try {
|
|
117
|
-
|
|
118
|
+
// `body` plus the grid, never `body` itself: it is reused for the mesh fallback below, and
|
|
119
|
+
// `prop`'s schema is `.strict()` like every asset-core schema — a stray `grid` would turn
|
|
120
|
+
// the fallback into a 400.
|
|
121
|
+
const voxelBody = { ...body, grid: options.voxelGrid ?? DEFAULT_MASTER_GRID };
|
|
122
|
+
outcome = await requestGeneration(environment, token, VOXEL_GENERATOR_TYPE, voxelBody, { fetch: fetchImpl, onProgress: log });
|
|
118
123
|
}
|
|
119
124
|
catch (error) {
|
|
120
125
|
// A non-2xx THROWS rather than returning an unsuccessful outcome, so this catch IS the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/generate/model.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EACL,sBAAsB,EAAE,aAAa,EAAE,oBAAoB,GAE5D,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAA0B,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/generate/model.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EACL,sBAAsB,EAAE,aAAa,EAAE,oBAAoB,GAE5D,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EA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AAC;IAED,MAAM,OAAO,GAAG,MAAM,iBAAiB,CAAC,WAAW,EAAE,KAAK,EAAE,mBAAmB,EAAE,IAAI,EACnF,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;IACzC,IAAI,CAAC,OAAO,CAAC,OAAO;QAAE,MAAM,IAAI,QAAQ,CAAC,GAAG,OAAO,CAAC,OAAO,2BAA2B,CAAC,CAAC;IACxF,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,IAAI,QAAQ,CAAC,+EAA+E,CAAC,CAAC;IACtG,CAAC;IACD,GAAG,CAAC,mBAAmB,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACzC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;AACjD,CAAC"}
|
package/dist/generate/prop.d.ts
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import type { Environment } from '../config/environments.js';
|
|
2
2
|
import { withVoxelizeSession } from '../forge/voxelize-session.js';
|
|
3
3
|
import type { ProjectContext } from '../project/context.js';
|
|
4
|
+
/**
|
|
5
|
+
* The grid a voxel MASTER is forged at, deliberately far finer than any size it is baked to.
|
|
6
|
+
*
|
|
7
|
+
* The master is the stored original, and the engine's `resampleMaster` only ever merges cells —
|
|
8
|
+
* it refuses to upsample rather than inventing detail. So this number is the ceiling on every
|
|
9
|
+
* later `bitmagic assets revoxelize`, and forging at the working size (0.1 m, ~20 cells for a 2 m
|
|
10
|
+
* prop) would permanently cap the asset at the one size nobody had judged yet.
|
|
11
|
+
*
|
|
12
|
+
* 512 rather than "whatever TRELLIS emits" (`grid: 0`) so the stored size is predictable and does
|
|
13
|
+
* not move when a pipeline type changes. It is the top of the allowlist, and the engine's
|
|
14
|
+
* `MASTER_MAX_LEAVES` budget was set to clear a 512³ forge without coarsening.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DEFAULT_MASTER_GRID = 512;
|
|
4
17
|
/**
|
|
5
18
|
* What the bake was handed: a mesh to voxelize, or a voxel master to compile.
|
|
6
19
|
*
|
|
@@ -67,6 +80,11 @@ export interface GenerateAndInstallOptions {
|
|
|
67
80
|
* rather than failing when either is untrue.
|
|
68
81
|
*/
|
|
69
82
|
directVoxels?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Grid to forge the master at (`--voxel-grid`). Only meaningful alongside `directVoxels`;
|
|
85
|
+
* defaults to {@link DEFAULT_MASTER_GRID}.
|
|
86
|
+
*/
|
|
87
|
+
voxelGrid?: number;
|
|
70
88
|
}
|
|
71
89
|
/**
|
|
72
90
|
* What the asset was made from, reported so callers do not have to guess.
|
package/dist/generate/prop.js
CHANGED
|
@@ -48,6 +48,19 @@ import { requestGeneration } from './stream.js';
|
|
|
48
48
|
*/
|
|
49
49
|
const MIN_VOXEL_SIZE = 0.1;
|
|
50
50
|
const MAX_VOXEL_SIZE = 0.5;
|
|
51
|
+
/**
|
|
52
|
+
* The grid a voxel MASTER is forged at, deliberately far finer than any size it is baked to.
|
|
53
|
+
*
|
|
54
|
+
* The master is the stored original, and the engine's `resampleMaster` only ever merges cells —
|
|
55
|
+
* it refuses to upsample rather than inventing detail. So this number is the ceiling on every
|
|
56
|
+
* later `bitmagic assets revoxelize`, and forging at the working size (0.1 m, ~20 cells for a 2 m
|
|
57
|
+
* prop) would permanently cap the asset at the one size nobody had judged yet.
|
|
58
|
+
*
|
|
59
|
+
* 512 rather than "whatever TRELLIS emits" (`grid: 0`) so the stored size is predictable and does
|
|
60
|
+
* not move when a pipeline type changes. It is the top of the allowlist, and the engine's
|
|
61
|
+
* `MASTER_MAX_LEAVES` budget was set to clear a 512³ forge without coarsening.
|
|
62
|
+
*/
|
|
63
|
+
export const DEFAULT_MASTER_GRID = 512;
|
|
51
64
|
/** The api-server generator types this command can ask for. */
|
|
52
65
|
const MESH_GENERATOR_TYPE = 'prop';
|
|
53
66
|
const VOXEL_GENERATOR_TYPE = 'prop-voxel';
|
|
@@ -180,7 +193,14 @@ async function tryVoxelMasterPath(options) {
|
|
|
180
193
|
const { context, environment, token, assetId, prompt, log, fetchImpl } = options;
|
|
181
194
|
let outcome;
|
|
182
195
|
try {
|
|
183
|
-
outcome = await requestGeneration(environment, token, VOXEL_GENERATOR_TYPE, {
|
|
196
|
+
outcome = await requestGeneration(environment, token, VOXEL_GENERATOR_TYPE, {
|
|
197
|
+
gameId: context.metadata.gameId,
|
|
198
|
+
prompt,
|
|
199
|
+
// Only on this request. `prop`'s schema is `.strict()` like every asset-core schema, so a
|
|
200
|
+
// `grid` on the mesh fallback would turn the fallback itself into a 400.
|
|
201
|
+
grid: options.voxelGrid ?? DEFAULT_MASTER_GRID,
|
|
202
|
+
...(options.creatorPrompt !== undefined ? { creatorPrompt: options.creatorPrompt } : {}),
|
|
203
|
+
}, { fetch: fetchImpl, onProgress: log });
|
|
184
204
|
}
|
|
185
205
|
catch (error) {
|
|
186
206
|
// A non-2xx THROWS rather than returning an unsuccessful outcome, so catching is not belt and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prop.js","sourceRoot":"","sources":["../../src/generate/prop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAA0B,MAAM,aAAa,CAAC;AAGxE;;;;GAIG;AACH,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,cAAc,GAAG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AQ,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACvE,aAAa,EAAE,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC;SAC9C,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare function publishRecordPath(root: string): string;
|
|
2
|
+
export interface PublishRecord {
|
|
3
|
+
/** The public URL of the game, exactly as api-server issued it. */
|
|
4
|
+
url: string;
|
|
5
|
+
visibility: string;
|
|
6
|
+
publishVersion: number;
|
|
7
|
+
gameId: string;
|
|
8
|
+
/** ISO 8601, so a reader can say how long ago without a second field. */
|
|
9
|
+
at: string;
|
|
10
|
+
/** The My games page. Absent against an older api-server that does not send one. */
|
|
11
|
+
manageUrl?: string;
|
|
12
|
+
/** The name this publish shipped under, when the publish knew it. */
|
|
13
|
+
name?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function writePublishRecord(root: string, record: PublishRecord): void;
|
|
16
|
+
/**
|
|
17
|
+
* The last publish, or null when there has not been one this reader can trust.
|
|
18
|
+
*
|
|
19
|
+
* Every field is checked rather than assumed: this file survives across CLI versions, and a reader
|
|
20
|
+
* that trusted a half-written or older-shaped record would put a broken link in front of a creator.
|
|
21
|
+
*/
|
|
22
|
+
export declare function readPublishRecord(root: string): PublishRecord | null;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The on-disk record of the last successful `bitmagic publish`.
|
|
3
|
+
*
|
|
4
|
+
* Publishing used to print the game's URL and forget it. That was fine while the terminal was the
|
|
5
|
+
* only place the URL was ever wanted, and stopped being fine as soon as anything else needed to
|
|
6
|
+
* answer "where is this game?" — the `bitmagic dev` view being the first, since it is the window
|
|
7
|
+
* the creator already has open while they work.
|
|
8
|
+
*
|
|
9
|
+
* Lives at `.bitmagic/publish/last.json`, beside `source.zip`, which is where the rest of a
|
|
10
|
+
* publish's local artifacts already are. Inside `.bitmagic` means gitignored and excluded from the
|
|
11
|
+
* publish fingerprint (`EXCLUDED_DIRS` in `@bitmagic/asset-core/publish-source`), so recording a
|
|
12
|
+
* publish cannot invalidate the verify that gated it — the same reason the QR image lives there.
|
|
13
|
+
*
|
|
14
|
+
* Written only after `complete`, so its presence means the game really is live at that URL. It is
|
|
15
|
+
* NOT a cache and nothing gates on it: a missing or unreadable record costs a link in a panel, and
|
|
16
|
+
* every reader here treats that as normal rather than as an error.
|
|
17
|
+
*/
|
|
18
|
+
import * as fs from 'fs';
|
|
19
|
+
import * as path from 'path';
|
|
20
|
+
const PUBLISH_RECORD_FILE = path.join('.bitmagic', 'publish', 'last.json');
|
|
21
|
+
export function publishRecordPath(root) {
|
|
22
|
+
return path.join(root, PUBLISH_RECORD_FILE);
|
|
23
|
+
}
|
|
24
|
+
export function writePublishRecord(root, record) {
|
|
25
|
+
fs.mkdirSync(path.dirname(publishRecordPath(root)), { recursive: true });
|
|
26
|
+
fs.writeFileSync(publishRecordPath(root), `${JSON.stringify(record, null, 2)}\n`);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The last publish, or null when there has not been one this reader can trust.
|
|
30
|
+
*
|
|
31
|
+
* Every field is checked rather than assumed: this file survives across CLI versions, and a reader
|
|
32
|
+
* that trusted a half-written or older-shaped record would put a broken link in front of a creator.
|
|
33
|
+
*/
|
|
34
|
+
export function readPublishRecord(root) {
|
|
35
|
+
let parsed;
|
|
36
|
+
try {
|
|
37
|
+
parsed = JSON.parse(fs.readFileSync(publishRecordPath(root), 'utf-8'));
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
if (typeof parsed !== 'object' || parsed === null)
|
|
43
|
+
return null;
|
|
44
|
+
const record = parsed;
|
|
45
|
+
if (typeof record.url !== 'string'
|
|
46
|
+
|| typeof record.visibility !== 'string'
|
|
47
|
+
|| typeof record.publishVersion !== 'number'
|
|
48
|
+
|| typeof record.gameId !== 'string'
|
|
49
|
+
|| typeof record.at !== 'string') {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
url: record.url,
|
|
54
|
+
visibility: record.visibility,
|
|
55
|
+
publishVersion: record.publishVersion,
|
|
56
|
+
gameId: record.gameId,
|
|
57
|
+
at: record.at,
|
|
58
|
+
...(typeof record.manageUrl === 'string' ? { manageUrl: record.manageUrl } : {}),
|
|
59
|
+
...(typeof record.name === 'string' ? { name: record.name } : {}),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/publish/record.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AAE3E,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;AAC9C,CAAC;AAgBD,MAAM,UAAU,kBAAkB,CAAC,IAAY,EAAE,MAAqB;IACpE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzE,EAAE,CAAC,aAAa,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AACpF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IACzE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC/D,MAAM,MAAM,GAAG,MAAiC,CAAC;IACjD,IACE,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;WAC3B,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ;WACrC,OAAO,MAAM,CAAC,cAAc,KAAK,QAAQ;WACzC,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ;WACjC,OAAO,MAAM,CAAC,EAAE,KAAK,QAAQ,EAChC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO;QACL,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,GAAG,CAAC,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChF,GAAG,CAAC,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a publish's QR code goes: the terminal when someone is looking at it, a file when nobody
|
|
3
|
+
* is.
|
|
4
|
+
*
|
|
5
|
+
* This module exists because the two are one decision, not two. `qr-terminal.ts` refuses a
|
|
6
|
+
* non-TTY for a good reason — escape sequences in a captured stream are noise — but refusing to
|
|
7
|
+
* DRAW is not the same as having nothing to offer, and for this CLI the captured stream is the
|
|
8
|
+
* common case. The pro lane is driven by an agent, so stdout is a pipe on almost every real
|
|
9
|
+
* publish, and the creator who would scan the code never sees the terminal at all. Gating the
|
|
10
|
+
* feature on `isTTY` alone turned it off exactly where the URL is most worth handing over.
|
|
11
|
+
*
|
|
12
|
+
* So: draw it if it can be drawn, and write `.bitmagic/publish-qr.png` whenever it cannot. That
|
|
13
|
+
* covers the pipe, and also the two smaller cases with the same shape — `TERM=dumb`, and a
|
|
14
|
+
* terminal too narrow to hold the code unwrapped — where a person is present but still has nothing
|
|
15
|
+
* to scan. A terminal that draws successfully writes no file: it already did the job.
|
|
16
|
+
*
|
|
17
|
+
* `.bitmagic/` is excluded from the publish fingerprint (`EXCLUDED_DIRS` in
|
|
18
|
+
* `@bitmagic/asset-core/publish-source`), so writing here cannot invalidate the verify the gate
|
|
19
|
+
* just checked.
|
|
20
|
+
*/
|
|
21
|
+
import { type TerminalQrEnv } from './qr-terminal.js';
|
|
22
|
+
/** Where a publish leaves its QR image. One per project, overwritten each publish. */
|
|
23
|
+
export declare function publishQrPath(root: string): string;
|
|
24
|
+
export interface EmitQrOptions {
|
|
25
|
+
/** The project root. The image lands in its `.bitmagic/`. */
|
|
26
|
+
root: string;
|
|
27
|
+
/** `--json`: stdout carries exactly one document, so nothing is ever drawn. */
|
|
28
|
+
json: boolean;
|
|
29
|
+
/** `--no-qr`. Suppresses the drawing AND the file — it means "not this time", not "not here". */
|
|
30
|
+
disabled: boolean;
|
|
31
|
+
env?: TerminalQrEnv;
|
|
32
|
+
isTTY?: boolean;
|
|
33
|
+
columns?: number | undefined;
|
|
34
|
+
write?: (chunk: string) => void;
|
|
35
|
+
/** Seam for the test; production writes to disk. */
|
|
36
|
+
writeFile?: (file: string, bytes: Buffer) => void;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Show `url` as a QR code however this run can, and return the image path when one was written.
|
|
40
|
+
*
|
|
41
|
+
* Never throws and never reports failure as an error: the caller has already printed the URL, and
|
|
42
|
+
* a code that could not be produced costs the creator a retype, not a publish.
|
|
43
|
+
*/
|
|
44
|
+
export declare function emitQr(url: string, options: EmitQrOptions): string | null;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a publish's QR code goes: the terminal when someone is looking at it, a file when nobody
|
|
3
|
+
* is.
|
|
4
|
+
*
|
|
5
|
+
* This module exists because the two are one decision, not two. `qr-terminal.ts` refuses a
|
|
6
|
+
* non-TTY for a good reason — escape sequences in a captured stream are noise — but refusing to
|
|
7
|
+
* DRAW is not the same as having nothing to offer, and for this CLI the captured stream is the
|
|
8
|
+
* common case. The pro lane is driven by an agent, so stdout is a pipe on almost every real
|
|
9
|
+
* publish, and the creator who would scan the code never sees the terminal at all. Gating the
|
|
10
|
+
* feature on `isTTY` alone turned it off exactly where the URL is most worth handing over.
|
|
11
|
+
*
|
|
12
|
+
* So: draw it if it can be drawn, and write `.bitmagic/publish-qr.png` whenever it cannot. That
|
|
13
|
+
* covers the pipe, and also the two smaller cases with the same shape — `TERM=dumb`, and a
|
|
14
|
+
* terminal too narrow to hold the code unwrapped — where a person is present but still has nothing
|
|
15
|
+
* to scan. A terminal that draws successfully writes no file: it already did the job.
|
|
16
|
+
*
|
|
17
|
+
* `.bitmagic/` is excluded from the publish fingerprint (`EXCLUDED_DIRS` in
|
|
18
|
+
* `@bitmagic/asset-core/publish-source`), so writing here cannot invalidate the verify the gate
|
|
19
|
+
* just checked.
|
|
20
|
+
*/
|
|
21
|
+
import * as fs from 'fs';
|
|
22
|
+
import * as path from 'path';
|
|
23
|
+
import { encodeQr } from './qr.js';
|
|
24
|
+
import { encodeQrPng } from './qr-png.js';
|
|
25
|
+
import { renderTerminalQr } from './qr-terminal.js';
|
|
26
|
+
/** Where a publish leaves its QR image. One per project, overwritten each publish. */
|
|
27
|
+
export function publishQrPath(root) {
|
|
28
|
+
return path.join(root, '.bitmagic', 'publish-qr.png');
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Show `url` as a QR code however this run can, and return the image path when one was written.
|
|
32
|
+
*
|
|
33
|
+
* Never throws and never reports failure as an error: the caller has already printed the URL, and
|
|
34
|
+
* a code that could not be produced costs the creator a retype, not a publish.
|
|
35
|
+
*/
|
|
36
|
+
export function emitQr(url, options) {
|
|
37
|
+
const env = options.env ?? process.env;
|
|
38
|
+
if (options.disabled || env.BITMAGIC_NO_QR)
|
|
39
|
+
return null;
|
|
40
|
+
// Drawing is tried first and, when it works, is the whole answer — a file nobody opens is
|
|
41
|
+
// clutter in a directory the creator does read.
|
|
42
|
+
if (!options.json) {
|
|
43
|
+
const drawn = renderTerminalQr(url, {
|
|
44
|
+
env,
|
|
45
|
+
...(options.isTTY === undefined ? {} : { isTTY: options.isTTY }),
|
|
46
|
+
columns: options.columns,
|
|
47
|
+
...(options.write === undefined ? {} : { write: options.write }),
|
|
48
|
+
});
|
|
49
|
+
if (drawn)
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
const matrix = encodeQr(url);
|
|
53
|
+
if (matrix === null)
|
|
54
|
+
return null;
|
|
55
|
+
const file = publishQrPath(options.root);
|
|
56
|
+
try {
|
|
57
|
+
if (options.writeFile) {
|
|
58
|
+
options.writeFile(file, encodeQrPng(matrix));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
62
|
+
fs.writeFileSync(file, encodeQrPng(matrix));
|
|
63
|
+
}
|
|
64
|
+
return file;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
// A read-only or full disk is not worth failing a successful publish over.
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=qr-output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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AAG,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAEjC,MAAM,IAAI,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,CAAC;QACH,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;QAC/C,CAAC;aAAM,CAAC;YACN,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YACtD,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,2EAA2E;QAC3E,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A QR code as PNG bytes, for the creator who cannot scan the terminal.
|
|
3
|
+
*
|
|
4
|
+
* `qr-terminal.ts` covers the case where a person is looking at the output. That is not the common
|
|
5
|
+
* case for this CLI: the pro lane is driven by an agent, so stdout is a pipe, and the human who
|
|
6
|
+
* would do the scanning is on the far side of it. A file crosses that boundary where escape
|
|
7
|
+
* sequences cannot — an agent can hand an image to its creator, and cannot hand them a repainted
|
|
8
|
+
* terminal.
|
|
9
|
+
*
|
|
10
|
+
* Greyscale, one byte per pixel. A QR carries one bit per module, so colour would be three bytes of
|
|
11
|
+
* nothing; and at this size the whole image deflates to a few hundred bytes either way. The
|
|
12
|
+
* encoder is hand-rolled for the same reason `qr.ts` is — `@bitmagic/cli` ships four runtime
|
|
13
|
+
* dependencies on purpose, and node's own `zlib` (already used in `publish/` and `assets/`) does
|
|
14
|
+
* the only part that is genuinely hard.
|
|
15
|
+
*
|
|
16
|
+
* Two other hand-rolled PNG encoders exist in this repo — `world-forger-internal`'s vehicle atlas
|
|
17
|
+
* and `game-play-agent`'s solid-colour tile — and neither is reachable from here: the first is in a
|
|
18
|
+
* `private: true` package the CLI does not depend on, the second is server code. A shared home
|
|
19
|
+
* would have to be `@bitmagic/asset-core`; that is worth doing when something needs the third copy,
|
|
20
|
+
* not for the second.
|
|
21
|
+
*/
|
|
22
|
+
import { Buffer } from 'buffer';
|
|
23
|
+
export interface QrPngOptions {
|
|
24
|
+
/** Pixels per module. Defaults to `MODULE_PIXELS`. */
|
|
25
|
+
scale?: number;
|
|
26
|
+
/** Quiet zone in modules. Defaults to `QUIET_MODULES`. */
|
|
27
|
+
quietZone?: number;
|
|
28
|
+
}
|
|
29
|
+
/** The pixel width (and height) `encodeQrPng` produces for a matrix of this size. */
|
|
30
|
+
export declare function qrPngDimension(matrix: boolean[][], options?: QrPngOptions): number;
|
|
31
|
+
/**
|
|
32
|
+
* Encode a module matrix as a greyscale PNG: dark modules black, everything else white.
|
|
33
|
+
*
|
|
34
|
+
* White is 0xff and dark is 0x00, never inverted — a scanner wants dark on light, and unlike the
|
|
35
|
+
* terminal there is no theme here to fight about it.
|
|
36
|
+
*/
|
|
37
|
+
export declare function encodeQrPng(matrix: boolean[][], options?: QrPngOptions): Buffer;
|