castle-web-cli 0.4.237 → 0.4.238
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/bundle.d.ts +24 -0
- package/dist/bundle.js +447 -4
- package/dist/bundleLatin1.d.ts +6 -0
- package/dist/bundleLatin1.js +333 -0
- package/dist/castle-host/host.d.ts +10 -1
- package/dist/castle-host/host.js +78 -9
- package/dist/castleJson.d.ts +2 -0
- package/dist/castleJson.js +1 -0
- package/dist/deckExports.d.ts +35 -0
- package/dist/deckExports.js +365 -0
- package/dist/importCheckHook.d.ts +1 -0
- package/dist/importCheckHook.js +1 -1
- package/dist/index.js +5 -0
- package/dist/init.js +2 -1
- package/dist/save-deck.js +4 -0
- package/kits/base/castle.json +1 -1
- package/kits/base/sdk/README.md +47 -0
- package/kits/base/sdk/castle.d.ts +3 -1
- package/kits/base/sdk/castle.js +1 -0
- package/kits/base/sdk/commands.d.ts +25 -1
- package/kits/base/sdk/commands.js +29 -1
- package/kits/base/sdk/hub.d.ts +17 -0
- package/kits/base/sdk/hub.js +33 -9
- package/kits/base/sdk/localCache.d.ts +27 -0
- package/kits/base/sdk/localCache.js +115 -0
- package/kits/base/sdk/localCacheStore.d.ts +15 -0
- package/kits/base/sdk/localCacheStore.js +358 -0
- package/kits/base/sdk/transport.d.ts +1 -0
- package/kits/base/sdk/transport.js +4 -5
- package/kits/hub-game/CLAUDE.md +22 -2
- package/kits/hub-game/castle.json +4 -1
- package/kits/hub-game/code/client/act.js +66 -91
- package/kits/hub-game/code/client/actCore.js +134 -0
- package/kits/hub-game/code/client/car.js +35 -0
- package/kits/hub-game/code/client/chrome.js +207 -381
- package/kits/hub-game/code/client/crowdNames.js +2 -2
- package/kits/hub-game/code/client/emoteWheel.js +109 -0
- package/kits/hub-game/code/client/hats.js +2 -0
- package/kits/hub-game/code/client/hookLayer.js +99 -48
- package/kits/hub-game/code/client/hostGo.js +77 -0
- package/kits/hub-game/code/client/hubControls.js +125 -0
- package/kits/hub-game/code/client/hubEntry.js +187 -0
- package/kits/hub-game/code/client/hudSurface.js +148 -0
- package/kits/hub-game/code/client/hudTree.js +96 -0
- package/kits/hub-game/code/client/idle.js +59 -13
- package/kits/hub-game/code/client/invites.js +13 -4
- package/kits/hub-game/code/client/menuIcons.js +8 -0
- package/kits/hub-game/code/client/noTrips.js +38 -0
- package/kits/hub-game/code/client/qualityEntry.js +6 -1
- package/kits/hub-game/code/client/rehello.js +3 -1
- package/kits/hub-game/code/client/riders.js +26 -0
- package/kits/hub-game/code/client/role.js +79 -0
- package/kits/hub-game/code/client/safeLayout.js +32 -3
- package/kits/hub-game/code/client/sound.js +10 -3
- package/kits/hub-game/code/client/soundscape.js +2 -2
- package/kits/hub-game/code/client/soundscapeAmbience.js +38 -8
- package/kits/hub-game/code/client/soundscapeBaked.js +24 -5
- package/kits/hub-game/code/client/soundscapeCues.js +2 -1
- package/kits/hub-game/code/client/state.js +19 -0
- package/kits/hub-game/code/client/stuck.js +2 -1
- package/kits/hub-game/code/client/talkSurface.js +178 -0
- package/kits/hub-game/code/client/talkTree.js +238 -0
- package/kits/hub-game/code/client/tiers.js +8 -5
- package/kits/hub-game/code/client/uiDom.js +600 -0
- package/kits/hub-game/code/client/uiTree.js +359 -0
- package/kits/hub-game/code/client/vehicle.js +154 -0
- package/kits/hub-game/code/client/wear.js +27 -5
- package/kits/hub-game/code/client/worldLabels.js +3 -2
- package/kits/hub-game/code/client/yours.js +10 -3
- package/kits/hub-game/code/server/actors.js +4 -3
- package/kits/hub-game/code/server/analytics.js +56 -6
- package/kits/hub-game/code/server/decor.js +56 -16
- package/kits/hub-game/code/server/hub.js +258 -46
- package/kits/hub-game/code/server/idle.js +118 -5
- package/kits/hub-game/code/server/manifest.js +46 -4
- package/kits/hub-game/code/server/npcs.js +4 -2
- package/kits/hub-game/code/server/players.js +3 -0
- package/kits/hub-game/code/server/role.js +142 -0
- package/kits/hub-game/code/server/standing.js +6 -4
- package/kits/hub-game/code/server/vehicle.js +126 -0
- package/kits/hub-game/code/shared/car.js +52 -0
- package/kits/hub-game/code/shared/deckFlags.js +34 -0
- package/kits/hub-game/code/shared/deviceClass.js +39 -0
- package/kits/hub-game/code/shared/expression.js +9 -0
- package/kits/hub-game/code/systems/hub.js +272 -84
- package/kits/hub-game/docs/analytics.md +11 -2
- package/kits/hub-game/docs/contract.md +352 -14
- package/kits/hub-game/docs/vehicle-preset.md +132 -0
- package/kits/hub-game/models/hats/baker-cap.pxmodel +89 -0
- package/kits/hub-game/models/hats/chef-toque.pxmodel +60 -0
- package/kits/hub-game/models/hats/delivery-cap.pxmodel +105 -0
- package/kits/hub-game/models/hats/fire-helmet.pxmodel +87 -0
- package/kits/hub-game/models/hats/hard-hat.pxmodel +71 -0
- package/kits/hub-game/models/hats/nurse-cap.pxmodel +61 -0
- package/kits/hub-game/models/hats/police-cap.pxmodel +105 -0
- package/kits/hub-game/models/hats/teacher-beret.pxmodel +52 -0
- package/kits/hub-game/models/role/square/top-apron.pxmodel +109 -0
- package/kits/hub-game/models/role/square/top-cardigan.pxmodel +141 -0
- package/kits/hub-game/models/role/square/top-coat.pxmodel +157 -0
- package/kits/hub-game/models/role/square/top-scrubs.pxmodel +93 -0
- package/kits/hub-game/models/role/square/top-tabard.pxmodel +109 -0
- package/kits/hub-game/models/role/square/top-vest.pxmodel +109 -0
- package/kits/hub-game/models/role/tool-bag.pxmodel +75 -0
- package/kits/hub-game/models/role/tool-bell.pxmodel +71 -0
- package/kits/hub-game/models/role/tool-hose.pxmodel +60 -0
- package/kits/hub-game/models/role/tool-parcel.pxmodel +61 -0
- package/kits/hub-game/models/role/tool-torch.pxmodel +55 -0
- package/kits/hub-game/models/role/tool-tray.pxmodel +75 -0
- package/kits/hub-game/models/role/top-apron.pxmodel +70 -0
- package/kits/hub-game/models/role/top-cardigan.pxmodel +102 -0
- package/kits/hub-game/models/role/top-coat.pxmodel +79 -0
- package/kits/hub-game/models/role/top-scrubs.pxmodel +54 -0
- package/kits/hub-game/models/role/top-tabard.pxmodel +70 -0
- package/kits/hub-game/models/role/top-vest.pxmodel +70 -0
- package/kits/hub-game/package-lock.json +1 -1
- package/kits/hub-game/package.json +1 -1
- package/kits/hub-game/scripts/check.mjs +7 -4
- package/kits/hub-game/scripts/fixtures/car-vectors.json +279 -0
- package/kits/hub-game/scripts/fixtures/decor-keyless-draw.json +2 -1
- package/kits/hub-game/scripts/fixtures/hud-surface.json +670 -0
- package/kits/hub-game/scripts/fixtures/talk-surface.json +3930 -0
- package/kits/hub-game/scripts/gen-hats.mjs +46 -2
- package/kits/hub-game/scripts/gen-role.mjs +80 -0
- package/kits/hub-game/scripts/test-act-core.mjs +167 -0
- package/kits/hub-game/scripts/test-actions-client.mjs +34 -0
- package/kits/hub-game/scripts/test-actors.mjs +48 -0
- package/kits/hub-game/scripts/test-analytics.mjs +99 -5
- package/kits/hub-game/scripts/test-apply-deck.mjs +122 -0
- package/kits/hub-game/scripts/test-back-visibility.mjs +3 -1
- package/kits/hub-game/scripts/test-ballot.mjs +2 -0
- package/kits/hub-game/scripts/test-car.mjs +43 -0
- package/kits/hub-game/scripts/test-decor-client.mjs +2 -1
- package/kits/hub-game/scripts/test-decor.mjs +77 -0
- package/kits/hub-game/scripts/test-device-class.mjs +83 -0
- package/kits/hub-game/scripts/test-emote-wheel.mjs +374 -0
- package/kits/hub-game/scripts/test-hats.mjs +5 -4
- package/kits/hub-game/scripts/test-host-go.mjs +265 -0
- package/kits/hub-game/scripts/test-hub-controls.mjs +108 -0
- package/kits/hub-game/scripts/test-hub-entry.mjs +531 -0
- package/kits/hub-game/scripts/test-hub-ops.mjs +75 -0
- package/kits/hub-game/scripts/test-hud-clear.mjs +12 -2
- package/kits/hub-game/scripts/test-hud-rate.mjs +6 -2
- package/kits/hub-game/scripts/test-hud-surface.mjs +272 -0
- package/kits/hub-game/scripts/test-idle.mjs +347 -1
- package/kits/hub-game/scripts/test-interest-cells.mjs +8 -1
- package/kits/hub-game/scripts/test-invites-client.mjs +42 -1
- package/kits/hub-game/scripts/test-manifest.mjs +30 -0
- package/kits/hub-game/scripts/test-no-trips.mjs +42 -0
- package/kits/hub-game/scripts/test-placement-cache.mjs +1 -1
- package/kits/hub-game/scripts/test-quality.mjs +13 -0
- package/kits/hub-game/scripts/test-rehello.mjs +258 -3
- package/kits/hub-game/scripts/test-resume-pose-server.mjs +203 -0
- package/kits/hub-game/scripts/test-resync.mjs +183 -0
- package/kits/hub-game/scripts/test-role-client.mjs +421 -0
- package/kits/hub-game/scripts/test-role.mjs +350 -0
- package/kits/hub-game/scripts/test-safe-layout.mjs +50 -1
- package/kits/hub-game/scripts/test-soundscape.mjs +124 -7
- package/kits/hub-game/scripts/test-standing.mjs +15 -1
- package/kits/hub-game/scripts/test-talk-surface.mjs +296 -0
- package/kits/hub-game/scripts/test-tiers.mjs +13 -0
- package/kits/hub-game/scripts/test-ui-dom-dom.mjs +96 -0
- package/kits/hub-game/scripts/test-ui-tree.mjs +711 -0
- package/kits/hub-game/scripts/test-vehicle-client.mjs +159 -0
- package/kits/hub-game/scripts/test-vehicle.mjs +135 -0
- package/kits/hub-game/scripts/test-yours.mjs +33 -0
- package/kits/hub-game/tools/hubScene/export.mjs +613 -0
- package/kits/hub-game/tools/hubScene/hubdata.mjs +921 -0
- package/kits/hub-game/tools/hubScene/merge-root.mjs +39 -0
- package/kits/hub-game/tools/hubScene/nodeworld.mjs +227 -0
- package/kits/hub-game/tools/hubScene/test/export-fixture.mjs +798 -0
- package/kits/hub-game/tools/hubScene/test/fixture.json +637 -0
- package/kits/hub-game/tools/hubScene/test/paint-export.mjs +40 -0
- package/kits/hub-game/tools/hubScene/test/upload.test.mjs +655 -0
- package/kits/hub-game/tools/hubScene/upload.mjs +636 -0
- package/kits/hub-game/tools/hubScene/validate-manifest.mjs +291 -0
- package/kits/multiplayer-3d/castle.json +4 -4
- package/kits/multiplayer-3d/code/client/resumeGate.js +30 -2
- package/kits/multiplayer-3d/code/client/steer.js +3 -1
- package/kits/multiplayer-3d/code/systems/multiplayer.js +30 -2
- package/kits/multiplayer-3d/package-lock.json +1 -1
- package/kits/multiplayer-3d/scripts/test-resume-gate.mjs +74 -2
- package/kits/physics-3d/CLAUDE.md +1 -1
- package/kits/physics-3d/behaviors/Player.jsx +37 -27
- package/kits/physics-3d/castle.json +2 -2
- package/kits/physics-3d/docs/engine-geometry-memory.md +23 -0
- package/kits/physics-3d/engine3d/memoryprofile.js +17 -0
- package/kits/physics-3d/engine3d/playerRun.js +6 -1
- package/kits/physics-3d/engine3d/pxmodel.js +6 -1
- package/kits/physics-3d/engine3d/world3d.js +6 -3
- package/kits/physics-3d/package.json +1 -1
- package/kits/physics-3d/play/behaviors/Player.js +40 -28
- package/kits/physics-3d/scripts/test-memory-profile.mjs +237 -0
- package/kits/physics-3d/systems/physics3d.js +5 -2
- package/kits/real-time/castle.json +2 -2
- package/kits/real-time/code/client/messages.js +5 -0
- package/kits/real-time/code/server/session.js +28 -1
- package/kits/real-time/package-lock.json +1 -1
- package/package.json +5 -4
- package/vendor/three/LICENSE +21 -0
- package/vendor/three/build/three.core.js +58773 -0
- package/vendor/three/build/three.module.js +18251 -0
- package/vendor/three/examples/jsm/controls/OrbitControls.js +1860 -0
- package/vendor/three/examples/jsm/controls/TransformControls.js +1918 -0
- package/vendor/three/examples/jsm/exporters/GLTFExporter.js +3595 -0
- package/vendor/three/examples/jsm/geometries/RoundedBoxGeometry.js +216 -0
- package/vendor/three/examples/jsm/math/MeshSurfaceSampler.js +315 -0
- package/vendor/three/examples/jsm/postprocessing/EffectComposer.js +363 -0
- package/vendor/three/examples/jsm/postprocessing/MaskPass.js +195 -0
- package/vendor/three/examples/jsm/postprocessing/OutputPass.js +139 -0
- package/vendor/three/examples/jsm/postprocessing/Pass.js +191 -0
- package/vendor/three/examples/jsm/postprocessing/RenderPass.js +183 -0
- package/vendor/three/examples/jsm/postprocessing/ShaderPass.js +135 -0
- package/vendor/three/examples/jsm/shaders/CopyShader.js +52 -0
- package/vendor/three/examples/jsm/shaders/OutputShader.js +103 -0
- package/vendor/three/examples/jsm/utils/BufferGeometryUtils.js +1435 -0
- package/vendor/three/package.json +134 -0
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { parseAst } from 'vite';
|
|
2
|
+
const wide = /[\u0100-\u{10ffff}]/u;
|
|
3
|
+
const wideGlobal = /[\u0100-\u{10ffff}]/gu;
|
|
4
|
+
const unitEscape = (s) => s.split('').map((c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, '0')}`).join('');
|
|
5
|
+
const pointEscape = (s) => `\\u{${s.codePointAt(0).toString(16)}}`;
|
|
6
|
+
export function countWideCharacters(source) {
|
|
7
|
+
return source.match(wideGlobal)?.length ?? 0;
|
|
8
|
+
}
|
|
9
|
+
// Consume existing escapes first: replacing only the character in `\漢`
|
|
10
|
+
// would turn an identity escape into a literal backslash followed by "u6f22".
|
|
11
|
+
function escapeRaw(source, escape, lineContinuations = false) {
|
|
12
|
+
return source.replace(/\\[\s\S]|[\u0100-\u{10ffff}]/gu, (token) => {
|
|
13
|
+
const c = token.startsWith('\\') ? token.slice(1) : token;
|
|
14
|
+
if (lineContinuations && token.startsWith('\\') && /[\u2028\u2029]/.test(c))
|
|
15
|
+
return '\\\n';
|
|
16
|
+
return wide.test(c) ? escape(c) : token;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/** Preserve unknown syntax and tagged-template raw text; callers count leftovers. */
|
|
20
|
+
export function latin1JavaScript(source) {
|
|
21
|
+
if (!wide.test(source))
|
|
22
|
+
return source;
|
|
23
|
+
try {
|
|
24
|
+
const ast = parseAst(source);
|
|
25
|
+
const protectedRanges = [];
|
|
26
|
+
const pending = [{ value: ast, tagged: false }];
|
|
27
|
+
while (pending.length) {
|
|
28
|
+
const { value, tagged } = pending.pop();
|
|
29
|
+
if (Array.isArray(value)) {
|
|
30
|
+
for (const child of value)
|
|
31
|
+
pending.push({ value: child, tagged });
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (!value || typeof value !== 'object')
|
|
35
|
+
continue;
|
|
36
|
+
const node = value;
|
|
37
|
+
if (typeof node.type !== 'string')
|
|
38
|
+
continue;
|
|
39
|
+
const raw = source.slice(node.start, node.end);
|
|
40
|
+
let text = raw;
|
|
41
|
+
if (node.type === 'Literal') {
|
|
42
|
+
const regex = node.regex;
|
|
43
|
+
if (wide.test(raw)) {
|
|
44
|
+
if (regex)
|
|
45
|
+
text = escapeRaw(raw, /[uv]/.test(regex.flags) ? pointEscape : unitEscape);
|
|
46
|
+
else if (typeof node.value === 'string')
|
|
47
|
+
text = escapeRaw(raw, unitEscape, true);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else if (node.type === 'Identifier' || node.type === 'PrivateIdentifier') {
|
|
51
|
+
// Supplementary identifier characters require a code-point escape;
|
|
52
|
+
// adjacent surrogate escapes are not legal identifier syntax.
|
|
53
|
+
text = raw.replace(wideGlobal, (c) => c.length === 2 ? pointEscape(c) : unitEscape(c));
|
|
54
|
+
}
|
|
55
|
+
else if (node.type === 'TemplateElement') {
|
|
56
|
+
if (!tagged && wide.test(raw)) {
|
|
57
|
+
text = escapeRaw(raw, unitEscape, true);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
for (const [key, child] of Object.entries(node)) {
|
|
62
|
+
pending.push({ value: child, tagged: (node.type === 'TaggedTemplateExpression' && key === 'quasi') ||
|
|
63
|
+
(node.type === 'TemplateLiteral' && key === 'quasis' && tagged) });
|
|
64
|
+
}
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
protectedRanges.push({ start: node.start, end: node.end, text });
|
|
68
|
+
}
|
|
69
|
+
// A hashbang is a comment through its first line terminator, even if it
|
|
70
|
+
// contains what looks like a block-comment opener.
|
|
71
|
+
if (source.startsWith('#!')) {
|
|
72
|
+
const lineEnd = source.search(/[\r\n\u2028\u2029]/);
|
|
73
|
+
const end = lineEnd < 0 ? source.length : lineEnd;
|
|
74
|
+
protectedRanges.push({ start: 0, end, text: source.slice(0, end).replace(wideGlobal, '?') });
|
|
75
|
+
}
|
|
76
|
+
protectedRanges.sort((a, b) => a.start - b.start || b.end - a.end);
|
|
77
|
+
// Everything between literal/identifier/quasi tokens is code or a comment.
|
|
78
|
+
// Only touch comments and JS whitespace there, preserving line boundaries.
|
|
79
|
+
const gap = (s) => s.replace(/\/\/[^\r\n\u2028\u2029]*|\/\*[\s\S]*?\*\/|[\u0100-\u{10ffff}]/gu, (token) => token.startsWith('/')
|
|
80
|
+
? token.replace(wideGlobal, (c) => /[\u2028\u2029]/.test(c) ? '\n' : '?')
|
|
81
|
+
: /\s/u.test(token) ? (/[\u2028\u2029]/.test(token) ? '\n' : ' ') : token);
|
|
82
|
+
const parts = [];
|
|
83
|
+
let offset = 0;
|
|
84
|
+
for (const edit of protectedRanges) {
|
|
85
|
+
if (edit.start < offset)
|
|
86
|
+
continue; // e.g. shorthand property key/value
|
|
87
|
+
parts.push(gap(source.slice(offset, edit.start)), edit.text);
|
|
88
|
+
offset = edit.end;
|
|
89
|
+
}
|
|
90
|
+
parts.push(gap(source.slice(offset)));
|
|
91
|
+
return parts.join('');
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
// Parsing and AST materialization/traversal can both fail on deep syntax.
|
|
95
|
+
// Keep the original bytes so the caller's leftover warning accounts for it.
|
|
96
|
+
return source;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
export function latin1Css(source) {
|
|
100
|
+
return escapeRaw(source, (c) => `\\${c.codePointAt(0).toString(16).padStart(6, '0')} `);
|
|
101
|
+
}
|
|
102
|
+
const htmlReferences = (s) => s.replace(wideGlobal, (c) => {
|
|
103
|
+
const point = c.codePointAt(0);
|
|
104
|
+
// HTML references cannot represent isolated surrogates.
|
|
105
|
+
return point >= 0xd800 && point <= 0xdfff ? c : `&#${point};`;
|
|
106
|
+
});
|
|
107
|
+
const asciiLower = (s) => s.replace(/[A-Z]/g, (c) => c.toLowerCase());
|
|
108
|
+
const htmlText = (s) => /<[a-zA-Z!/?]/.test(s) ? s : htmlReferences(s);
|
|
109
|
+
function dataScript(source) {
|
|
110
|
+
try {
|
|
111
|
+
JSON.parse(source);
|
|
112
|
+
return source.replace(/"(?:[^"\\]|\\[\s\S])*"/g, (s) => s.replace(wideGlobal, unitEscape));
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
return source;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const htmlSpace = (c) => /[\t\n\f\r ]/.test(c);
|
|
119
|
+
// Each character belongs to exactly one name/value scan. In particular, a
|
|
120
|
+
// quoted value cannot also be retried as an unquoted one on an incomplete tag.
|
|
121
|
+
function scanTag(source, start) {
|
|
122
|
+
let i = start + 1;
|
|
123
|
+
const closing = source[i] === '/';
|
|
124
|
+
if (closing)
|
|
125
|
+
i++;
|
|
126
|
+
const nameStart = i;
|
|
127
|
+
while (i < source.length && !htmlSpace(source[i]) && source[i] !== '/' && source[i] !== '>')
|
|
128
|
+
i++;
|
|
129
|
+
const tagName = asciiLower(source.slice(nameStart, i));
|
|
130
|
+
const name = closing ? undefined : tagName;
|
|
131
|
+
let selfClosing = false;
|
|
132
|
+
const attrs = new Map();
|
|
133
|
+
const values = [];
|
|
134
|
+
while (i < source.length) {
|
|
135
|
+
const spaceStart = i;
|
|
136
|
+
while (i < source.length && htmlSpace(source[i]))
|
|
137
|
+
i++;
|
|
138
|
+
if (source[i] === '/') {
|
|
139
|
+
// The tokenizer self-closes only on "/>"; "/ >" is an ignored solidus.
|
|
140
|
+
selfClosing = source[i + 1] === '>';
|
|
141
|
+
i++;
|
|
142
|
+
while (i < source.length && htmlSpace(source[i]))
|
|
143
|
+
i++;
|
|
144
|
+
if (source[i] !== '>')
|
|
145
|
+
return { end: i };
|
|
146
|
+
}
|
|
147
|
+
if (source[i] === '>') {
|
|
148
|
+
const parts = [];
|
|
149
|
+
let offset = start;
|
|
150
|
+
for (const value of values) {
|
|
151
|
+
parts.push(source.slice(offset, value.start), value.text);
|
|
152
|
+
offset = value.end;
|
|
153
|
+
}
|
|
154
|
+
parts.push(source.slice(offset, i + 1));
|
|
155
|
+
return { end: i + 1, name, closeName: closing ? tagName : undefined, selfClosing, attrs, text: parts.join('') };
|
|
156
|
+
}
|
|
157
|
+
if (i === spaceStart || i === source.length)
|
|
158
|
+
return { end: i };
|
|
159
|
+
const keyStart = i;
|
|
160
|
+
while (i < source.length && !htmlSpace(source[i]) && !'=/>'.includes(source[i]))
|
|
161
|
+
i++;
|
|
162
|
+
if (i === keyStart)
|
|
163
|
+
return { end: i };
|
|
164
|
+
const key = asciiLower(source.slice(keyStart, i));
|
|
165
|
+
const keyEnd = i;
|
|
166
|
+
while (i < source.length && htmlSpace(source[i]))
|
|
167
|
+
i++;
|
|
168
|
+
if (source[i] !== '=') {
|
|
169
|
+
i = keyEnd; // Let the next iteration consume the attribute separator.
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
i++;
|
|
173
|
+
while (i < source.length && htmlSpace(source[i]))
|
|
174
|
+
i++;
|
|
175
|
+
const valueStart = i;
|
|
176
|
+
const quote = source[i] === '"' || source[i] === "'" ? source[i++] : undefined;
|
|
177
|
+
const bareStart = i;
|
|
178
|
+
if (quote) {
|
|
179
|
+
while (i < source.length && source[i] !== quote)
|
|
180
|
+
i++;
|
|
181
|
+
if (i === source.length)
|
|
182
|
+
return { end: i };
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
while (i < source.length && !htmlSpace(source[i]) && source[i] !== '>')
|
|
186
|
+
i++;
|
|
187
|
+
if (i === valueStart)
|
|
188
|
+
return { end: i };
|
|
189
|
+
}
|
|
190
|
+
if (!attrs.has(key))
|
|
191
|
+
attrs.set(key, source.slice(bareStart, i));
|
|
192
|
+
if (quote)
|
|
193
|
+
i++;
|
|
194
|
+
values.push({ start: valueStart, end: i, text: htmlReferences(source.slice(valueStart, i)) });
|
|
195
|
+
}
|
|
196
|
+
return { end: i };
|
|
197
|
+
}
|
|
198
|
+
function commentEnd(source, start) {
|
|
199
|
+
// The comment-start states also accept abrupt empty-comment endings.
|
|
200
|
+
if (source[start + 4] === '>')
|
|
201
|
+
return start + 5;
|
|
202
|
+
if (source.startsWith('->', start + 4))
|
|
203
|
+
return start + 6;
|
|
204
|
+
let i = start + 4;
|
|
205
|
+
while ((i = source.indexOf('>', i)) !== -1) {
|
|
206
|
+
if ((i >= start + 6 && source.slice(i - 2, i) === '--') ||
|
|
207
|
+
(i >= start + 7 && source.slice(i - 3, i) === '--!'))
|
|
208
|
+
return i + 1;
|
|
209
|
+
i++;
|
|
210
|
+
}
|
|
211
|
+
return source.length;
|
|
212
|
+
}
|
|
213
|
+
// Inside svg/math, raw-text names are ordinary elements (a self-closing
|
|
214
|
+
// <style/> opens nothing). These start tags break out of foreign content or
|
|
215
|
+
// switch back to HTML rules there; the scanner preserves the rest instead.
|
|
216
|
+
const foreignExits = new Set(['b', 'big', 'blockquote', 'body', 'br', 'center', 'code', 'dd', 'div', 'dl', 'dt',
|
|
217
|
+
'em', 'embed', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'hr', 'i', 'img', 'li', 'listing', 'menu', 'meta',
|
|
218
|
+
'nobr', 'ol', 'p', 'pre', 'ruby', 's', 'small', 'span', 'strong', 'strike', 'sub', 'sup', 'table', 'tt', 'u',
|
|
219
|
+
'ul', 'var', 'font', 'foreignobject', 'desc', 'title', 'mi', 'mo', 'mn', 'ms', 'mtext', 'annotation-xml']);
|
|
220
|
+
// A source-preserving HTML scanner: only attribute VALUES and text support
|
|
221
|
+
// character references. Names, declarations and unknown raw-text bodies stay
|
|
222
|
+
// intact. No DOM serialization, so Latin-1-only bundles retain their bytes.
|
|
223
|
+
export function latin1Html(source) {
|
|
224
|
+
if (!wide.test(source))
|
|
225
|
+
return source;
|
|
226
|
+
const parts = [];
|
|
227
|
+
let offset = 0;
|
|
228
|
+
let cursor = 0;
|
|
229
|
+
let plaintext = false;
|
|
230
|
+
const foreign = []; // open elements inside svg/math
|
|
231
|
+
// Frameset and select insertion modes drop an svg/math start tag, so what
|
|
232
|
+
// follows it is HTML. Seeing either makes a later svg/math unmodelled.
|
|
233
|
+
let dropsForeign = false;
|
|
234
|
+
while ((cursor = source.indexOf('<', cursor)) !== -1) {
|
|
235
|
+
const start = cursor;
|
|
236
|
+
if (source.startsWith('<!', start) || source.startsWith('<?', start)) {
|
|
237
|
+
const comment = source.startsWith('<!--', start);
|
|
238
|
+
// CDATA exists only in foreign content; in HTML it is a bogus comment.
|
|
239
|
+
const cdata = foreign.length > 0 && source.startsWith('<![CDATA[', start);
|
|
240
|
+
const terminator = cdata ? ']]>' : '>';
|
|
241
|
+
const end = comment ? commentEnd(source, start) : source.indexOf(terminator, start + 2);
|
|
242
|
+
cursor = comment ? end : end < 0 ? source.length : end + terminator.length;
|
|
243
|
+
// Incomplete declarations were not recognized by the original scanner.
|
|
244
|
+
if (!comment && !cdata && end < 0)
|
|
245
|
+
break;
|
|
246
|
+
parts.push(htmlText(source.slice(offset, start)));
|
|
247
|
+
const tag = source.slice(start, cursor);
|
|
248
|
+
parts.push(comment ? tag.replace(wideGlobal, '?') : tag);
|
|
249
|
+
offset = cursor;
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
if (!/^<\/?[a-zA-Z]/.test(source.slice(start, start + 3))) {
|
|
253
|
+
// "</" before anything but a letter is a bogus comment through ">".
|
|
254
|
+
if (source[start + 1] === '/') {
|
|
255
|
+
const end = source.indexOf('>', start + 2);
|
|
256
|
+
cursor = end < 0 ? source.length : end + 1;
|
|
257
|
+
parts.push(htmlText(source.slice(offset, start)), source.slice(start, cursor).replace(wideGlobal, '?'));
|
|
258
|
+
offset = cursor;
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
cursor++;
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
const tag = scanTag(source, start);
|
|
265
|
+
cursor = tag.end;
|
|
266
|
+
// Do not look for apparent tags inside an incomplete/unsupported tag: they
|
|
267
|
+
// may belong to an attribute value. Preserve the rest rather than guess.
|
|
268
|
+
if (tag.text === undefined)
|
|
269
|
+
return parts.join('') + source.slice(offset);
|
|
270
|
+
const { name, closeName, selfClosing, attrs } = tag;
|
|
271
|
+
if (foreign.length) {
|
|
272
|
+
// Only a balanced svg/math subtree is followed; anything else may
|
|
273
|
+
// change the tokenizer's context in ways this scanner does not model.
|
|
274
|
+
if (name ? foreignExits.has(name) : closeName !== foreign.at(-1))
|
|
275
|
+
return parts.join('') + source.slice(offset);
|
|
276
|
+
parts.push(htmlText(source.slice(offset, start)), tag.text);
|
|
277
|
+
offset = cursor;
|
|
278
|
+
if (name && !selfClosing)
|
|
279
|
+
foreign.push(name);
|
|
280
|
+
else if (!name)
|
|
281
|
+
foreign.pop();
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
parts.push(htmlText(source.slice(offset, start)), tag.text);
|
|
285
|
+
offset = cursor;
|
|
286
|
+
if (name === 'frameset' || name === 'select')
|
|
287
|
+
dropsForeign = true;
|
|
288
|
+
if ((name === 'svg' || name === 'math') && !selfClosing) {
|
|
289
|
+
if (dropsForeign)
|
|
290
|
+
return parts.join('') + source.slice(offset);
|
|
291
|
+
foreign.push(name);
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
if (name === 'plaintext') {
|
|
295
|
+
plaintext = true;
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
if (!name || !['script', 'style', 'xmp', 'iframe', 'noembed', 'noframes', 'noscript', 'textarea', 'title'].includes(name))
|
|
299
|
+
continue;
|
|
300
|
+
const close = new RegExp(`</${name}[\\t\\n\\f\\r />]`, 'gi');
|
|
301
|
+
close.lastIndex = offset;
|
|
302
|
+
const end = close.exec(source)?.index ?? source.length;
|
|
303
|
+
const body = source.slice(offset, end);
|
|
304
|
+
let text = body;
|
|
305
|
+
if (name === 'style')
|
|
306
|
+
text = latin1Css(body);
|
|
307
|
+
else if (name === 'textarea' || name === 'title')
|
|
308
|
+
text = htmlReferences(body);
|
|
309
|
+
else if (name === 'script') {
|
|
310
|
+
const declaredType = attrs.get('type') ?? (attrs.get('language') ? `text/${attrs.get('language')}` : '');
|
|
311
|
+
const type = asciiLower(declaredType.replace(/^[\t\n\f\r ]+|[\t\n\f\r ]+$/g, ''));
|
|
312
|
+
// Script's escaped/double-escaped HTML tokenizer states need more than
|
|
313
|
+
// an end-tag search. Leave such unusual markup alone rather than guess.
|
|
314
|
+
if (body.includes('<!--'))
|
|
315
|
+
return parts.join('') + source.slice(offset);
|
|
316
|
+
if (!type || type === 'module' || /^(?:text|application)\/(?:java|ecma)script$/.test(type)) {
|
|
317
|
+
text = latin1JavaScript(body);
|
|
318
|
+
}
|
|
319
|
+
else if (/^(?:application\/(?:[\w.-]+\+)?json|importmap|speculationrules)$/.test(type)) {
|
|
320
|
+
text = dataScript(body);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
parts.push(text);
|
|
324
|
+
offset = end;
|
|
325
|
+
cursor = end;
|
|
326
|
+
}
|
|
327
|
+
parts.push(plaintext ? source.slice(offset) : htmlText(source.slice(offset)));
|
|
328
|
+
return parts.join('');
|
|
329
|
+
}
|
|
330
|
+
export function warnWideCharacters(count) {
|
|
331
|
+
if (count)
|
|
332
|
+
console.warn(`Warning: deck bundle retains ${count} characters above U+00FF that could not be safely escaped.`);
|
|
333
|
+
}
|
|
@@ -8,6 +8,7 @@ import type { CastleLeaderboardPayload } from './leaderboardPanel.js';
|
|
|
8
8
|
|
|
9
9
|
export interface HostContext {
|
|
10
10
|
deckId: string | null;
|
|
11
|
+
runningDeckId?: string | null;
|
|
11
12
|
sessionId: string | null;
|
|
12
13
|
userId: string | null;
|
|
13
14
|
username: string | null;
|
|
@@ -73,6 +74,13 @@ export interface HostCapabilities {
|
|
|
73
74
|
signal?: AbortSignal,
|
|
74
75
|
) => Promise<MultiplayerJoinDestinationResult>;
|
|
75
76
|
hub?: HostHub;
|
|
77
|
+
localCache?: HostLocalCache;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface HostLocalCache {
|
|
81
|
+
get(deckId: string, key: string): Promise<ArrayBuffer | string | null>;
|
|
82
|
+
set(deckId: string, key: string, value: ArrayBuffer | string): Promise<void>;
|
|
83
|
+
remove(deckId: string, key: string): Promise<void>;
|
|
76
84
|
}
|
|
77
85
|
|
|
78
86
|
export type OracleStream = (url: string, body: string, sink: OracleStreamSink) => () => void;
|
|
@@ -238,7 +246,8 @@ export interface HostHub {
|
|
|
238
246
|
reportChat?(messageId: string, ctx: HostContext, block?: boolean, confirmBlock?: HubChatBlockConfirmation, signal?: AbortSignal): Promise<HubReportResult>;
|
|
239
247
|
commit(sessionId: string, ctx: HostContext): Promise<HubCommitResult>;
|
|
240
248
|
cancel(sessionId: string | null, ctx: HostContext): Promise<HubCancelResult>;
|
|
241
|
-
|
|
249
|
+
sessionAcquisitionStarted?(ctx: HostContext): number;
|
|
250
|
+
sessionAcquired?(sessionId: string, ctx: HostContext, acquisition?: number): void;
|
|
242
251
|
}
|
|
243
252
|
|
|
244
253
|
export interface LeaderboardStreakCredit {
|
package/dist/castle-host/host.js
CHANGED
|
@@ -100,6 +100,9 @@ const COMMAND_NAMES = [
|
|
|
100
100
|
"cauldronStorage.boardGet",
|
|
101
101
|
"cauldronStorage.usage",
|
|
102
102
|
"lifecycle.restoreState",
|
|
103
|
+
"localCache.get",
|
|
104
|
+
"localCache.set",
|
|
105
|
+
"localCache.remove",
|
|
103
106
|
];
|
|
104
107
|
// Platform/capability commands: NOT serviced by graphqlFetch. They're dispatched
|
|
105
108
|
// to the host's optional platformHandler (mobile renders native UI; web shows an
|
|
@@ -171,10 +174,13 @@ export async function executeCommand(ctx, command, params, capabilities, options
|
|
|
171
174
|
},
|
|
172
175
|
};
|
|
173
176
|
}
|
|
177
|
+
const acquisition = isSessionAcquisition(command)
|
|
178
|
+
? capabilities.hub?.sessionAcquisitionStarted?.(ctx)
|
|
179
|
+
: undefined;
|
|
174
180
|
try {
|
|
175
181
|
const data = await dispatchCommand(ctx, command, (params ?? {}), capabilities, options);
|
|
176
182
|
capabilities.hub?.assertActive?.();
|
|
177
|
-
noteAcquiredSession(ctx, command, data, capabilities);
|
|
183
|
+
noteAcquiredSession(ctx, command, data, capabilities, acquisition);
|
|
178
184
|
return { ok: true, data };
|
|
179
185
|
}
|
|
180
186
|
catch (error) {
|
|
@@ -185,17 +191,21 @@ function dispatchCommand(ctx, command, params, caps, options) {
|
|
|
185
191
|
if (isTrustedDataCommand(command)) {
|
|
186
192
|
return runTrustedDataCommand(ctx, command, params, caps.graphqlFetch);
|
|
187
193
|
}
|
|
194
|
+
if (isLocalCacheCommand(command)) {
|
|
195
|
+
return runLocalCacheCommand(ctx, command, params, caps.localCache);
|
|
196
|
+
}
|
|
188
197
|
return runCommand(ctx, command, params, caps, options);
|
|
189
198
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
199
|
+
function isSessionAcquisition(command) {
|
|
200
|
+
return command === "multiplayer.getSession" || command === "multiplayer.joinDestination";
|
|
201
|
+
}
|
|
202
|
+
// A door's source is the session of the acquisition the deck started last in its place.
|
|
203
|
+
function noteAcquiredSession(ctx, command, data, caps, acquisition) {
|
|
204
|
+
if (!caps.hub?.sessionAcquired || !isSessionAcquisition(command))
|
|
194
205
|
return;
|
|
195
|
-
}
|
|
196
206
|
const result = data;
|
|
197
207
|
if (result?.status === "ok" && typeof result.sessionId === "string" && result.sessionId) {
|
|
198
|
-
caps.hub.sessionAcquired(result.sessionId, ctx);
|
|
208
|
+
caps.hub.sessionAcquired(result.sessionId, ctx, acquisition);
|
|
199
209
|
}
|
|
200
210
|
}
|
|
201
211
|
const HUB_VISIT_COMMANDS = new Set([
|
|
@@ -369,6 +379,32 @@ function runTrustedDataCommand(ctx, command, params, gql) {
|
|
|
369
379
|
return partySay(params, gql);
|
|
370
380
|
}
|
|
371
381
|
}
|
|
382
|
+
function isLocalCacheCommand(command) {
|
|
383
|
+
return command.startsWith("localCache.");
|
|
384
|
+
}
|
|
385
|
+
async function runLocalCacheCommand(ctx, command, params, store) {
|
|
386
|
+
const deckId = ctx.runningDeckId;
|
|
387
|
+
if (!deckId) {
|
|
388
|
+
throw new HostCommandError("MISSING_DECK_ID", "Save this deck to Castle before using this API.", command);
|
|
389
|
+
}
|
|
390
|
+
const key = asBoundedText(params.key, "key", command, 1_024, 4_096);
|
|
391
|
+
switch (command) {
|
|
392
|
+
case "localCache.get":
|
|
393
|
+
return { value: store ? await store.get(deckId, key) : null };
|
|
394
|
+
case "localCache.set":
|
|
395
|
+
await store?.set(deckId, key, asLocalCacheValue(params.value, command));
|
|
396
|
+
return {};
|
|
397
|
+
case "localCache.remove":
|
|
398
|
+
await store?.remove(deckId, key);
|
|
399
|
+
return {};
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
function asLocalCacheValue(value, command) {
|
|
403
|
+
if (typeof value === "string" || value instanceof ArrayBuffer) {
|
|
404
|
+
return value;
|
|
405
|
+
}
|
|
406
|
+
throw new HostCommandError("INVALID_ARGUMENT", `Castle command ${command} requires a value that is an ArrayBuffer or a string.`, command);
|
|
407
|
+
}
|
|
372
408
|
async function multiplayerGetSession(ctx, params, caps) {
|
|
373
409
|
const request = multiplayerSessionRequest(params);
|
|
374
410
|
const deckId = requireDeckId(ctx, "multiplayer.getSession");
|
|
@@ -3319,6 +3355,23 @@ function invalidPartyArgument(command, detail) {
|
|
|
3319
3355
|
export function hubBackEnvelope() {
|
|
3320
3356
|
return { castleSdk: 1, hub: { type: "back" } };
|
|
3321
3357
|
}
|
|
3358
|
+
// What a host posts to the deck to take the player through a door of the place
|
|
3359
|
+
// it shows, e.g. a trip begun outside this page. The deck answers it like a
|
|
3360
|
+
// fired pad (Hub.go behind its door animation); a deck that does not know the
|
|
3361
|
+
// door, or an older deck, ignores it. `owner` is the user id whose House a
|
|
3362
|
+
// House door leads to.
|
|
3363
|
+
export function hubGoEnvelope(go) {
|
|
3364
|
+
return {
|
|
3365
|
+
castleSdk: 1,
|
|
3366
|
+
hub: {
|
|
3367
|
+
type: "go",
|
|
3368
|
+
doorId: go.doorId,
|
|
3369
|
+
...(go.owner !== undefined ? { owner: go.owner } : {}),
|
|
3370
|
+
...(go.title !== undefined ? { title: go.title } : {}),
|
|
3371
|
+
...(go.party !== undefined ? { party: go.party } : {}),
|
|
3372
|
+
},
|
|
3373
|
+
};
|
|
3374
|
+
}
|
|
3322
3375
|
// Ghost's source check reads the session's heartbeat roster, which can lag an
|
|
3323
3376
|
// arrival by up to 15 s: a door used in that window answers `forbidden`.
|
|
3324
3377
|
const HUB_ROSTER_LAG_MS = 16_000;
|
|
@@ -3472,7 +3525,8 @@ export function createGhostHubVisit(options) {
|
|
|
3472
3525
|
reportChat: (messageId, _ctx, block, confirmBlock, signal) => visit.reportChat(messageId, block, confirmBlock, signal),
|
|
3473
3526
|
commit: (nonce) => visit.commit(nonce),
|
|
3474
3527
|
cancel: (nonce) => visit.cancel(nonce),
|
|
3475
|
-
|
|
3528
|
+
sessionAcquisitionStarted: () => visit.sessionAcquisitionStarted(),
|
|
3529
|
+
sessionAcquired: (sessionId, _ctx, acquisition) => visit.sessionAcquired(sessionId, acquisition),
|
|
3476
3530
|
placeDeckId: () => visit.place,
|
|
3477
3531
|
state: () => visit.state(),
|
|
3478
3532
|
};
|
|
@@ -3561,6 +3615,8 @@ class GhostHubVisitImpl {
|
|
|
3561
3615
|
arrivalDoorId = null;
|
|
3562
3616
|
placeKind = "place";
|
|
3563
3617
|
session = null;
|
|
3618
|
+
sessionAcquisitions = 0;
|
|
3619
|
+
acceptedSessionAcquisition = 0;
|
|
3564
3620
|
chatSenders = new Map();
|
|
3565
3621
|
chatBlockPending = null;
|
|
3566
3622
|
chatBlockNextAt = 0;
|
|
@@ -3604,8 +3660,21 @@ class GhostHubVisitImpl {
|
|
|
3604
3660
|
: null,
|
|
3605
3661
|
};
|
|
3606
3662
|
}
|
|
3607
|
-
|
|
3663
|
+
// The deck keeps the connection of the join it started last that succeeded,
|
|
3664
|
+
// so an earlier join that answers after a later one (ghost placed it in another
|
|
3665
|
+
// shard) must not replace its session as the door source, or the player stands
|
|
3666
|
+
// in one session while every door names the other. A later join that failed
|
|
3667
|
+
// replaces nothing: the deck keeps its earlier connection then.
|
|
3668
|
+
sessionAcquisitionStarted() {
|
|
3669
|
+
return ++this.sessionAcquisitions;
|
|
3670
|
+
}
|
|
3671
|
+
sessionAcquired(sessionId, acquisition) {
|
|
3608
3672
|
this.assertActive();
|
|
3673
|
+
if (acquisition !== undefined) {
|
|
3674
|
+
if (acquisition < this.acceptedSessionAcquisition)
|
|
3675
|
+
return;
|
|
3676
|
+
this.acceptedSessionAcquisition = acquisition;
|
|
3677
|
+
}
|
|
3609
3678
|
this.chatBlockPending?.abort();
|
|
3610
3679
|
this.chatSenders.clear();
|
|
3611
3680
|
this.session = { sessionId, at: this.now() };
|
package/dist/castleJson.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export interface CastleJson {
|
|
|
39
39
|
starterConfig?: Record<string, unknown>;
|
|
40
40
|
onCheck?: string;
|
|
41
41
|
onPack?: string;
|
|
42
|
+
exports?: Record<string, string>;
|
|
42
43
|
devDecks?: Record<string, string>;
|
|
43
44
|
experiments?: Record<string, ExperimentConfig>;
|
|
44
45
|
devExperiments?: Record<string, string>;
|
|
@@ -129,6 +130,7 @@ export interface ServerHubPlaceConfig {
|
|
|
129
130
|
title?: unknown;
|
|
130
131
|
result?: unknown;
|
|
131
132
|
maxDurationSec?: unknown;
|
|
133
|
+
houseResume?: unknown;
|
|
132
134
|
}
|
|
133
135
|
export interface ServerHubConfig extends ServerHubPlaceConfig {
|
|
134
136
|
analytics?: boolean;
|
package/dist/castleJson.js
CHANGED
|
@@ -267,6 +267,7 @@ function hubPlaceConfig(place) {
|
|
|
267
267
|
...(place.title === undefined ? {} : { title: place.title }),
|
|
268
268
|
...(place.result === undefined ? {} : { result: place.result }),
|
|
269
269
|
...(place.maxDurationSec === undefined ? {} : { maxDurationSec: place.maxDurationSec }),
|
|
270
|
+
...(place.houseResume === undefined ? {} : { houseResume: place.houseResume }),
|
|
270
271
|
};
|
|
271
272
|
}
|
|
272
273
|
function pushConfig(value) {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** The env var that turns exporters on for `save-deck`. */
|
|
2
|
+
export declare const SAVE_EXPORTS_ENV = "CASTLE_SAVE_EXPORTS";
|
|
3
|
+
export interface ExportTarget {
|
|
4
|
+
alias: string;
|
|
5
|
+
name: string;
|
|
6
|
+
modulePath: string;
|
|
7
|
+
outDir: string;
|
|
8
|
+
cacheDir: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ExportOutcome {
|
|
11
|
+
alias: string;
|
|
12
|
+
name: string;
|
|
13
|
+
ok: boolean;
|
|
14
|
+
/** The JSON the exporter printed last, or null when it printed none. */
|
|
15
|
+
summary: unknown;
|
|
16
|
+
error?: string;
|
|
17
|
+
}
|
|
18
|
+
/** `~/.castle/export-cache/<name>/`, shared by every deck on this machine. */
|
|
19
|
+
export declare function exportCacheRoot(): string;
|
|
20
|
+
export declare function exportCacheDir(name: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Every exporter that applies to this deck and may run here: each import's, in
|
|
23
|
+
* pin order, then the deck's own (only for a kit this CLI ships, as with
|
|
24
|
+
* `onCheck`). The first to claim a name keeps it.
|
|
25
|
+
*/
|
|
26
|
+
export declare function exportTargets(deckDir: string, log: (message: string) => void): ExportTarget[];
|
|
27
|
+
/** Run every applicable exporter, one at a time. */
|
|
28
|
+
export declare function runDeckExports(deckDir: string, log?: (message: string) => void): Promise<ExportOutcome[]>;
|
|
29
|
+
/** `castle-web export [dir]`: prints each summary; exits 1 when one failed. */
|
|
30
|
+
export declare function exportCommand(dir: string): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* After a successful save, under CASTLE_SAVE_EXPORTS=1 only. Never throws:
|
|
33
|
+
* whatever an exporter does, the save already happened and stands.
|
|
34
|
+
*/
|
|
35
|
+
export declare function runSaveExports(deckDir: string): Promise<void>;
|