castle-web-cli 0.4.236 → 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.
Files changed (218) hide show
  1. package/dist/api.d.ts +2 -0
  2. package/dist/bundle.d.ts +24 -0
  3. package/dist/bundle.js +447 -4
  4. package/dist/bundleLatin1.d.ts +6 -0
  5. package/dist/bundleLatin1.js +333 -0
  6. package/dist/castle-host/host.d.ts +10 -1
  7. package/dist/castle-host/host.js +78 -9
  8. package/dist/castleJson.d.ts +20 -0
  9. package/dist/castleJson.js +40 -0
  10. package/dist/deckExports.d.ts +35 -0
  11. package/dist/deckExports.js +365 -0
  12. package/dist/importCheckHook.d.ts +1 -0
  13. package/dist/importCheckHook.js +1 -1
  14. package/dist/index.js +5 -0
  15. package/dist/init.js +2 -1
  16. package/dist/save-deck.js +18 -13
  17. package/kits/base/castle.json +1 -1
  18. package/kits/base/sdk/README.md +47 -0
  19. package/kits/base/sdk/castle.d.ts +3 -1
  20. package/kits/base/sdk/castle.js +1 -0
  21. package/kits/base/sdk/commands.d.ts +25 -1
  22. package/kits/base/sdk/commands.js +29 -1
  23. package/kits/base/sdk/hub.d.ts +17 -0
  24. package/kits/base/sdk/hub.js +33 -9
  25. package/kits/base/sdk/localCache.d.ts +27 -0
  26. package/kits/base/sdk/localCache.js +115 -0
  27. package/kits/base/sdk/localCacheStore.d.ts +15 -0
  28. package/kits/base/sdk/localCacheStore.js +358 -0
  29. package/kits/base/sdk/transport.d.ts +1 -0
  30. package/kits/base/sdk/transport.js +4 -5
  31. package/kits/hub-game/CLAUDE.md +22 -2
  32. package/kits/hub-game/castle.json +4 -1
  33. package/kits/hub-game/code/client/act.js +66 -91
  34. package/kits/hub-game/code/client/actCore.js +134 -0
  35. package/kits/hub-game/code/client/car.js +35 -0
  36. package/kits/hub-game/code/client/chrome.js +207 -381
  37. package/kits/hub-game/code/client/crowdNames.js +2 -2
  38. package/kits/hub-game/code/client/emoteWheel.js +109 -0
  39. package/kits/hub-game/code/client/hats.js +2 -0
  40. package/kits/hub-game/code/client/hookLayer.js +99 -48
  41. package/kits/hub-game/code/client/hostGo.js +77 -0
  42. package/kits/hub-game/code/client/hubControls.js +125 -0
  43. package/kits/hub-game/code/client/hubEntry.js +187 -0
  44. package/kits/hub-game/code/client/hudSurface.js +148 -0
  45. package/kits/hub-game/code/client/hudTree.js +96 -0
  46. package/kits/hub-game/code/client/idle.js +59 -13
  47. package/kits/hub-game/code/client/invites.js +13 -4
  48. package/kits/hub-game/code/client/menuIcons.js +8 -0
  49. package/kits/hub-game/code/client/noTrips.js +38 -0
  50. package/kits/hub-game/code/client/qualityEntry.js +6 -1
  51. package/kits/hub-game/code/client/rehello.js +3 -1
  52. package/kits/hub-game/code/client/riders.js +26 -0
  53. package/kits/hub-game/code/client/role.js +79 -0
  54. package/kits/hub-game/code/client/safeLayout.js +32 -3
  55. package/kits/hub-game/code/client/sound.js +10 -3
  56. package/kits/hub-game/code/client/soundscape.js +2 -2
  57. package/kits/hub-game/code/client/soundscapeAmbience.js +38 -8
  58. package/kits/hub-game/code/client/soundscapeBaked.js +24 -5
  59. package/kits/hub-game/code/client/soundscapeCues.js +2 -1
  60. package/kits/hub-game/code/client/state.js +19 -0
  61. package/kits/hub-game/code/client/stuck.js +2 -1
  62. package/kits/hub-game/code/client/talkSurface.js +178 -0
  63. package/kits/hub-game/code/client/talkTree.js +238 -0
  64. package/kits/hub-game/code/client/tiers.js +8 -5
  65. package/kits/hub-game/code/client/uiDom.js +600 -0
  66. package/kits/hub-game/code/client/uiTree.js +359 -0
  67. package/kits/hub-game/code/client/vehicle.js +154 -0
  68. package/kits/hub-game/code/client/wear.js +27 -5
  69. package/kits/hub-game/code/client/worldLabels.js +3 -2
  70. package/kits/hub-game/code/client/yours.js +10 -3
  71. package/kits/hub-game/code/server/actors.js +4 -3
  72. package/kits/hub-game/code/server/analytics.js +56 -6
  73. package/kits/hub-game/code/server/decor.js +56 -16
  74. package/kits/hub-game/code/server/hub.js +258 -46
  75. package/kits/hub-game/code/server/idle.js +118 -5
  76. package/kits/hub-game/code/server/manifest.js +46 -4
  77. package/kits/hub-game/code/server/npcs.js +4 -2
  78. package/kits/hub-game/code/server/players.js +3 -0
  79. package/kits/hub-game/code/server/role.js +142 -0
  80. package/kits/hub-game/code/server/standing.js +6 -4
  81. package/kits/hub-game/code/server/vehicle.js +126 -0
  82. package/kits/hub-game/code/shared/car.js +52 -0
  83. package/kits/hub-game/code/shared/deckFlags.js +34 -0
  84. package/kits/hub-game/code/shared/deviceClass.js +39 -0
  85. package/kits/hub-game/code/shared/expression.js +9 -0
  86. package/kits/hub-game/code/systems/hub.js +300 -85
  87. package/kits/hub-game/docs/analytics.md +11 -2
  88. package/kits/hub-game/docs/contract.md +353 -14
  89. package/kits/hub-game/docs/vehicle-preset.md +132 -0
  90. package/kits/hub-game/models/hats/baker-cap.pxmodel +89 -0
  91. package/kits/hub-game/models/hats/chef-toque.pxmodel +60 -0
  92. package/kits/hub-game/models/hats/delivery-cap.pxmodel +105 -0
  93. package/kits/hub-game/models/hats/fire-helmet.pxmodel +87 -0
  94. package/kits/hub-game/models/hats/hard-hat.pxmodel +71 -0
  95. package/kits/hub-game/models/hats/nurse-cap.pxmodel +61 -0
  96. package/kits/hub-game/models/hats/police-cap.pxmodel +105 -0
  97. package/kits/hub-game/models/hats/teacher-beret.pxmodel +52 -0
  98. package/kits/hub-game/models/role/square/top-apron.pxmodel +109 -0
  99. package/kits/hub-game/models/role/square/top-cardigan.pxmodel +141 -0
  100. package/kits/hub-game/models/role/square/top-coat.pxmodel +157 -0
  101. package/kits/hub-game/models/role/square/top-scrubs.pxmodel +93 -0
  102. package/kits/hub-game/models/role/square/top-tabard.pxmodel +109 -0
  103. package/kits/hub-game/models/role/square/top-vest.pxmodel +109 -0
  104. package/kits/hub-game/models/role/tool-bag.pxmodel +75 -0
  105. package/kits/hub-game/models/role/tool-bell.pxmodel +71 -0
  106. package/kits/hub-game/models/role/tool-hose.pxmodel +60 -0
  107. package/kits/hub-game/models/role/tool-parcel.pxmodel +61 -0
  108. package/kits/hub-game/models/role/tool-torch.pxmodel +55 -0
  109. package/kits/hub-game/models/role/tool-tray.pxmodel +75 -0
  110. package/kits/hub-game/models/role/top-apron.pxmodel +70 -0
  111. package/kits/hub-game/models/role/top-cardigan.pxmodel +102 -0
  112. package/kits/hub-game/models/role/top-coat.pxmodel +79 -0
  113. package/kits/hub-game/models/role/top-scrubs.pxmodel +54 -0
  114. package/kits/hub-game/models/role/top-tabard.pxmodel +70 -0
  115. package/kits/hub-game/models/role/top-vest.pxmodel +70 -0
  116. package/kits/hub-game/package-lock.json +1 -1
  117. package/kits/hub-game/package.json +1 -1
  118. package/kits/hub-game/scripts/check.mjs +7 -4
  119. package/kits/hub-game/scripts/fixtures/car-vectors.json +279 -0
  120. package/kits/hub-game/scripts/fixtures/decor-keyless-draw.json +2 -1
  121. package/kits/hub-game/scripts/fixtures/hud-surface.json +670 -0
  122. package/kits/hub-game/scripts/fixtures/talk-surface.json +3930 -0
  123. package/kits/hub-game/scripts/gen-hats.mjs +46 -2
  124. package/kits/hub-game/scripts/gen-role.mjs +80 -0
  125. package/kits/hub-game/scripts/test-act-core.mjs +167 -0
  126. package/kits/hub-game/scripts/test-actions-client.mjs +34 -0
  127. package/kits/hub-game/scripts/test-actors.mjs +48 -0
  128. package/kits/hub-game/scripts/test-analytics.mjs +99 -5
  129. package/kits/hub-game/scripts/test-apply-deck.mjs +122 -0
  130. package/kits/hub-game/scripts/test-back-visibility.mjs +3 -1
  131. package/kits/hub-game/scripts/test-ballot.mjs +2 -0
  132. package/kits/hub-game/scripts/test-car.mjs +43 -0
  133. package/kits/hub-game/scripts/test-decor-client.mjs +2 -1
  134. package/kits/hub-game/scripts/test-decor.mjs +77 -0
  135. package/kits/hub-game/scripts/test-device-class.mjs +83 -0
  136. package/kits/hub-game/scripts/test-emote-wheel.mjs +374 -0
  137. package/kits/hub-game/scripts/test-hats.mjs +5 -4
  138. package/kits/hub-game/scripts/test-host-go.mjs +265 -0
  139. package/kits/hub-game/scripts/test-hub-controls.mjs +108 -0
  140. package/kits/hub-game/scripts/test-hub-entry.mjs +531 -0
  141. package/kits/hub-game/scripts/test-hub-ops.mjs +75 -0
  142. package/kits/hub-game/scripts/test-hub-trip.mjs +85 -0
  143. package/kits/hub-game/scripts/test-hud-clear.mjs +12 -2
  144. package/kits/hub-game/scripts/test-hud-rate.mjs +6 -2
  145. package/kits/hub-game/scripts/test-hud-surface.mjs +272 -0
  146. package/kits/hub-game/scripts/test-idle.mjs +347 -1
  147. package/kits/hub-game/scripts/test-interest-cells.mjs +8 -1
  148. package/kits/hub-game/scripts/test-invites-client.mjs +42 -1
  149. package/kits/hub-game/scripts/test-manifest.mjs +30 -0
  150. package/kits/hub-game/scripts/test-no-trips.mjs +42 -0
  151. package/kits/hub-game/scripts/test-placement-cache.mjs +1 -1
  152. package/kits/hub-game/scripts/test-quality.mjs +13 -0
  153. package/kits/hub-game/scripts/test-rehello.mjs +258 -3
  154. package/kits/hub-game/scripts/test-resume-pose-server.mjs +203 -0
  155. package/kits/hub-game/scripts/test-resync.mjs +183 -0
  156. package/kits/hub-game/scripts/test-role-client.mjs +421 -0
  157. package/kits/hub-game/scripts/test-role.mjs +350 -0
  158. package/kits/hub-game/scripts/test-safe-layout.mjs +50 -1
  159. package/kits/hub-game/scripts/test-soundscape.mjs +124 -7
  160. package/kits/hub-game/scripts/test-standing.mjs +15 -1
  161. package/kits/hub-game/scripts/test-talk-surface.mjs +296 -0
  162. package/kits/hub-game/scripts/test-tiers.mjs +13 -0
  163. package/kits/hub-game/scripts/test-ui-dom-dom.mjs +96 -0
  164. package/kits/hub-game/scripts/test-ui-tree.mjs +711 -0
  165. package/kits/hub-game/scripts/test-vehicle-client.mjs +159 -0
  166. package/kits/hub-game/scripts/test-vehicle.mjs +135 -0
  167. package/kits/hub-game/scripts/test-yours.mjs +33 -0
  168. package/kits/hub-game/tools/hubScene/export.mjs +613 -0
  169. package/kits/hub-game/tools/hubScene/hubdata.mjs +921 -0
  170. package/kits/hub-game/tools/hubScene/merge-root.mjs +39 -0
  171. package/kits/hub-game/tools/hubScene/nodeworld.mjs +227 -0
  172. package/kits/hub-game/tools/hubScene/test/export-fixture.mjs +798 -0
  173. package/kits/hub-game/tools/hubScene/test/fixture.json +637 -0
  174. package/kits/hub-game/tools/hubScene/test/paint-export.mjs +40 -0
  175. package/kits/hub-game/tools/hubScene/test/upload.test.mjs +655 -0
  176. package/kits/hub-game/tools/hubScene/upload.mjs +636 -0
  177. package/kits/hub-game/tools/hubScene/validate-manifest.mjs +291 -0
  178. package/kits/multiplayer-3d/castle.json +4 -4
  179. package/kits/multiplayer-3d/code/client/resumeGate.js +30 -2
  180. package/kits/multiplayer-3d/code/client/steer.js +3 -1
  181. package/kits/multiplayer-3d/code/systems/multiplayer.js +30 -2
  182. package/kits/multiplayer-3d/package-lock.json +1 -1
  183. package/kits/multiplayer-3d/scripts/test-resume-gate.mjs +74 -2
  184. package/kits/physics-3d/CLAUDE.md +1 -1
  185. package/kits/physics-3d/behaviors/Player.jsx +37 -27
  186. package/kits/physics-3d/castle.json +2 -2
  187. package/kits/physics-3d/docs/engine-geometry-memory.md +23 -0
  188. package/kits/physics-3d/engine3d/memoryprofile.js +17 -0
  189. package/kits/physics-3d/engine3d/playerRun.js +6 -1
  190. package/kits/physics-3d/engine3d/pxmodel.js +6 -1
  191. package/kits/physics-3d/engine3d/world3d.js +6 -3
  192. package/kits/physics-3d/package.json +1 -1
  193. package/kits/physics-3d/play/behaviors/Player.js +40 -28
  194. package/kits/physics-3d/scripts/test-memory-profile.mjs +237 -0
  195. package/kits/physics-3d/systems/physics3d.js +5 -2
  196. package/kits/real-time/castle.json +2 -2
  197. package/kits/real-time/code/client/messages.js +5 -0
  198. package/kits/real-time/code/server/session.js +28 -1
  199. package/kits/real-time/package-lock.json +1 -1
  200. package/package.json +5 -4
  201. package/vendor/three/LICENSE +21 -0
  202. package/vendor/three/build/three.core.js +58773 -0
  203. package/vendor/three/build/three.module.js +18251 -0
  204. package/vendor/three/examples/jsm/controls/OrbitControls.js +1860 -0
  205. package/vendor/three/examples/jsm/controls/TransformControls.js +1918 -0
  206. package/vendor/three/examples/jsm/exporters/GLTFExporter.js +3595 -0
  207. package/vendor/three/examples/jsm/geometries/RoundedBoxGeometry.js +216 -0
  208. package/vendor/three/examples/jsm/math/MeshSurfaceSampler.js +315 -0
  209. package/vendor/three/examples/jsm/postprocessing/EffectComposer.js +363 -0
  210. package/vendor/three/examples/jsm/postprocessing/MaskPass.js +195 -0
  211. package/vendor/three/examples/jsm/postprocessing/OutputPass.js +139 -0
  212. package/vendor/three/examples/jsm/postprocessing/Pass.js +191 -0
  213. package/vendor/three/examples/jsm/postprocessing/RenderPass.js +183 -0
  214. package/vendor/three/examples/jsm/postprocessing/ShaderPass.js +135 -0
  215. package/vendor/three/examples/jsm/shaders/CopyShader.js +52 -0
  216. package/vendor/three/examples/jsm/shaders/OutputShader.js +103 -0
  217. package/vendor/three/examples/jsm/utils/BufferGeometryUtils.js +1435 -0
  218. package/vendor/three/package.json +134 -0
@@ -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>;
@@ -0,0 +1,365 @@
1
+ // Running every import's save-time exporters (castle.json `exports`, see
2
+ // castleJson.ts for the contract): derived artifacts a kit writes for the decks
3
+ // built on it, beside the save rather than inside it.
4
+ //
5
+ // The CLI knows nothing about what an exporter makes. An import names scripts
6
+ // of its own by export name; the CLI runs each in a child `node`, hands it the
7
+ // deck, an output folder of its own and a cache folder shared across decks, and
8
+ // reports the JSON summary it prints. Nothing it writes is published. The
9
+ // exporter writes into a fresh stage under the cache root; the CLI alone moves
10
+ // it into `<deck>/.castle/exports/<name>/`, through folders it proved are the
11
+ // deck's own. Cache garbage collection is out of scope.
12
+ //
13
+ // `castle-web export` runs them on demand. `save-deck` runs them after a
14
+ // successful save only when CASTLE_SAVE_EXPORTS=1: off by default, and a
15
+ // failure there is a warning -- an exporter can never cost a save.
16
+ //
17
+ // An exporter runs only from the kits this CLI ships (a builtin pin, or a
18
+ // shipped kit checked as itself), its entry point proven by real path to be one
19
+ // of their files. A fetched import's exporters never run.
20
+ import { spawn } from 'child_process';
21
+ import * as fs from 'fs';
22
+ import * as os from 'os';
23
+ import * as path from 'path';
24
+ import { IMPORTS_DIR, readCastleJson } from './castleJson.js';
25
+ import { isShippedKitDir } from './importCheckHook.js';
26
+ import { outputLines, resolveFileInside } from './importUpdateHook.js';
27
+ import { getKitsDir, getPackageRoot } from './localPaths.js';
28
+ /** The env var that turns exporters on for `save-deck`. */
29
+ export const SAVE_EXPORTS_ENV = 'CASTLE_SAVE_EXPORTS';
30
+ // An export name is a folder name under .castle/exports/ and the cache.
31
+ const EXPORT_NAME = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
32
+ const MAX_EXPORT_OUTPUT = 16 * 1024 * 1024;
33
+ // How long an exporter that ignores SIGTERM gets before its whole process group
34
+ // is killed outright.
35
+ function killGraceMs() {
36
+ const raw = Number(process.env.CASTLE_EXPORT_KILL_GRACE_MS);
37
+ return Number.isFinite(raw) && raw >= 0 ? raw : 5_000;
38
+ }
39
+ // Exporters build whole worlds; a wall clock still keeps one from hanging a
40
+ // save forever. The env override is for tests and unusually large decks.
41
+ function exportTimeoutMs() {
42
+ const raw = Number(process.env.CASTLE_EXPORT_TIMEOUT_MS);
43
+ return Number.isFinite(raw) && raw > 0 ? raw : 600_000;
44
+ }
45
+ /** `~/.castle/export-cache/<name>/`, shared by every deck on this machine. */
46
+ export function exportCacheRoot() {
47
+ return path.resolve(process.env.CASTLE_EXPORT_CACHE_ROOT ?? path.join(os.homedir(), '.castle', 'export-cache'));
48
+ }
49
+ export function exportCacheDir(name) {
50
+ return path.join(exportCacheRoot(), name);
51
+ }
52
+ // A real folder (made if missing) whose canonical path is `realParent/name`:
53
+ // never a symlink, never one that resolves elsewhere. Returns that canonical path.
54
+ function provenDir(parent, realParent, name) {
55
+ const dir = path.join(parent, name);
56
+ const real = path.join(realParent, name);
57
+ if (!lexists(dir))
58
+ fs.mkdirSync(dir);
59
+ const st = fs.lstatSync(dir);
60
+ if (st.isSymbolicLink() || !st.isDirectory())
61
+ throw new Error(`${dir} is a symlink or not a folder`);
62
+ if (fs.realpathSync(dir) !== real)
63
+ throw new Error(`${dir} resolves outside ${realParent}`);
64
+ return real;
65
+ }
66
+ function lexists(p) {
67
+ try {
68
+ fs.lstatSync(p);
69
+ return true;
70
+ }
71
+ catch {
72
+ return false;
73
+ }
74
+ }
75
+ /** `<deck>/.castle/exports`, proven a real folder of the canonical deck. */
76
+ function deckExportsDir(deckDir) {
77
+ const realDeck = fs.realpathSync(deckDir);
78
+ const castle = provenDir(deckDir, realDeck, '.castle');
79
+ return provenDir(castle, castle, 'exports');
80
+ }
81
+ // Moves the exporter's finished stage into `<exports>/<name>`: the old output is
82
+ // renamed aside first, the stage renamed in (across filesystems, copied into
83
+ // the exports folder and renamed from there), and the old one removed only once
84
+ // it is proven a real folder inside the exports folder.
85
+ function installStage(stage, exportsDir, name) {
86
+ const final = path.join(exportsDir, name);
87
+ const tag = `${process.pid}-${Date.now()}`;
88
+ let old = null;
89
+ if (lexists(final)) {
90
+ const st = fs.lstatSync(final);
91
+ if (st.isSymbolicLink() || !st.isDirectory())
92
+ throw new Error(`${final} is a symlink or not a folder`);
93
+ old = path.join(exportsDir, `.old-${name}-${tag}`);
94
+ fs.renameSync(final, old);
95
+ }
96
+ try {
97
+ try {
98
+ fs.renameSync(stage, final);
99
+ }
100
+ catch (e) {
101
+ if (e.code !== 'EXDEV')
102
+ throw e;
103
+ const incoming = path.join(exportsDir, `.incoming-${name}-${tag}`);
104
+ fs.cpSync(stage, incoming, { recursive: true });
105
+ fs.renameSync(incoming, final);
106
+ fs.rmSync(stage, { recursive: true, force: true });
107
+ }
108
+ }
109
+ catch (e) {
110
+ if (old)
111
+ fs.renameSync(old, final);
112
+ throw e;
113
+ }
114
+ if (old && !fs.lstatSync(old).isSymbolicLink() && path.dirname(fs.realpathSync(old)) === exportsDir) {
115
+ fs.rmSync(old, { recursive: true, force: true });
116
+ }
117
+ }
118
+ function declaredExports(dir) {
119
+ const declared = readCastleJson(dir)?.exports;
120
+ if (!declared || typeof declared !== 'object' || Array.isArray(declared))
121
+ return {};
122
+ return Object.fromEntries(Object.entries(declared).filter(([, v]) => typeof v === 'string' && v.trim()));
123
+ }
124
+ // The CLI's own copy of a builtin pin's kit, or null: exporters run only from
125
+ // the kits this CLI ships, never from an imports/ copy of anything.
126
+ function shippedKitOf(pin) {
127
+ if (pin.source !== 'builtin')
128
+ return null;
129
+ const kit = typeof pin.kit === 'string' ? pin.kit : '';
130
+ const kits = path.resolve(getKitsDir());
131
+ const kitDir = path.join(kits, kit);
132
+ if (!kit || path.dirname(kitDir) !== kits || !fs.existsSync(path.join(kitDir, 'castle.json')))
133
+ return null;
134
+ return kitDir;
135
+ }
136
+ // The entry point's real path, when it lies under the real shipped kits folder:
137
+ // a symlink leading anywhere else is not one of the CLI's files.
138
+ function shippedModule(dir, declared) {
139
+ const lexical = resolveFileInside(dir, declared);
140
+ if (!lexical)
141
+ return null;
142
+ const real = fs.realpathSync(lexical);
143
+ const kits = fs.realpathSync(getKitsDir());
144
+ return real.startsWith(kits + path.sep) ? real : null;
145
+ }
146
+ /**
147
+ * Every exporter that applies to this deck and may run here: each import's, in
148
+ * pin order, then the deck's own (only for a kit this CLI ships, as with
149
+ * `onCheck`). The first to claim a name keeps it.
150
+ */
151
+ export function exportTargets(deckDir, log) {
152
+ const config = readCastleJson(deckDir);
153
+ const sources = [];
154
+ for (const [alias, pin] of Object.entries(config?.imports ?? {})) {
155
+ if (!pin)
156
+ continue;
157
+ const dir = shippedKitOf(pin);
158
+ if (dir)
159
+ sources.push({ alias, dir });
160
+ else if (Object.keys(declaredExports(path.join(deckDir, IMPORTS_DIR, alias))).length > 0) {
161
+ log(`Warning: ${alias} declares exporters, which run only from a kit this CLI ships -- skipped.`);
162
+ }
163
+ }
164
+ if (isShippedKitDir(deckDir))
165
+ sources.push({ alias: 'self', dir: deckDir });
166
+ const targets = [];
167
+ const taken = new Set();
168
+ for (const { alias, dir } of sources) {
169
+ const declared = declaredExports(dir);
170
+ if (Object.keys(declared).length === 0)
171
+ continue;
172
+ for (const [name, declaredPath] of Object.entries(declared)) {
173
+ if (!EXPORT_NAME.test(name)) {
174
+ log(`Warning: ${alias} declares an export named ${JSON.stringify(name)}, which is not a usable name -- skipped.`);
175
+ continue;
176
+ }
177
+ if (taken.has(name)) {
178
+ log(`Warning: ${alias} declares export "${name}", which another import already declares -- skipped.`);
179
+ continue;
180
+ }
181
+ const modulePath = shippedModule(dir, declaredPath);
182
+ if (!modulePath) {
183
+ log(`Warning: ${alias} declares export "${name}" at "${declaredPath}", which is not a file of the kits this CLI ships -- skipped.`);
184
+ continue;
185
+ }
186
+ taken.add(name);
187
+ targets.push({ alias, name, modulePath, outDir: path.join(deckDir, '.castle', 'exports', name), cacheDir: exportCacheDir(name) });
188
+ }
189
+ }
190
+ return targets;
191
+ }
192
+ // The last stdout line that parses as JSON: an exporter's summary.
193
+ function lastJson(stdout) {
194
+ for (const line of outputLines(stdout).reverse()) {
195
+ if (!line.startsWith('{') && !line.startsWith('['))
196
+ continue;
197
+ try {
198
+ return JSON.parse(line);
199
+ }
200
+ catch {
201
+ // not the summary
202
+ }
203
+ }
204
+ return null;
205
+ }
206
+ // The exporter in a process group of its own, so a timeout reaches whatever it
207
+ // started too: SIGTERM to the group, then SIGKILL once the grace period is up.
208
+ // Settles when the group's leader exits (or on the SIGKILL), never later.
209
+ // Out of process: cancels nothing in the save that ran before it.
210
+ function runChild(args, cwd, env) {
211
+ return new Promise((resolve) => {
212
+ const child = spawn(process.execPath, args, { cwd, env, detached: true, stdio: ['ignore', 'pipe', 'pipe'] });
213
+ let stdout = '';
214
+ let stderr = '';
215
+ let timedOut = false;
216
+ let settled = false;
217
+ const take = (prev, chunk) => (prev.length >= MAX_EXPORT_OUTPUT ? prev : prev + chunk.toString('utf8'));
218
+ child.stdout.on('data', (c) => { stdout = take(stdout, c); });
219
+ child.stderr.on('data', (c) => { stderr = take(stderr, c); });
220
+ const signalGroup = (signal) => {
221
+ try {
222
+ if (child.pid)
223
+ process.kill(-child.pid, signal);
224
+ }
225
+ catch {
226
+ // the group is already gone
227
+ }
228
+ };
229
+ let killTimer;
230
+ const finish = (code) => {
231
+ if (settled)
232
+ return;
233
+ settled = true;
234
+ clearTimeout(termTimer);
235
+ clearTimeout(killTimer);
236
+ // Anything the exporter left running in its group goes with it.
237
+ signalGroup('SIGKILL');
238
+ resolve({ code, stdout, stderr, timedOut });
239
+ };
240
+ const termTimer = setTimeout(() => {
241
+ timedOut = true;
242
+ signalGroup('SIGTERM');
243
+ killTimer = setTimeout(() => {
244
+ signalGroup('SIGKILL');
245
+ finish(null);
246
+ }, killGraceMs());
247
+ }, exportTimeoutMs());
248
+ child.on('error', (e) => {
249
+ stderr += String(e);
250
+ finish(null);
251
+ });
252
+ // Output can still be in the pipes when the leader exits: wait for them to
253
+ // close, but not on a grandchild that kept them open.
254
+ child.on('exit', (code) => {
255
+ child.on('close', () => finish(code));
256
+ setTimeout(() => finish(code), 1_000).unref();
257
+ });
258
+ });
259
+ }
260
+ async function runOne(deckDir, target, log) {
261
+ const refuse = (error) => {
262
+ log(`${target.alias} export ${target.name} ${error}`);
263
+ return { alias: target.alias, name: target.name, ok: false, summary: null, error };
264
+ };
265
+ // The deck side is proven before anything runs; the exporter itself writes
266
+ // only into a fresh stage under the cache root and into the cache.
267
+ let exportsDir;
268
+ let cacheDir;
269
+ let stage;
270
+ try {
271
+ exportsDir = deckExportsDir(deckDir);
272
+ const prev = path.join(exportsDir, target.name);
273
+ if (lexists(prev) && (fs.lstatSync(prev).isSymbolicLink() || !fs.lstatSync(prev).isDirectory())) {
274
+ throw new Error(`${prev} is a symlink or not a folder`);
275
+ }
276
+ const root = exportCacheRoot();
277
+ fs.mkdirSync(root, { recursive: true });
278
+ cacheDir = provenDir(root, fs.realpathSync(root), target.name);
279
+ stage = fs.mkdtempSync(path.join(fs.realpathSync(root), `.stage-${target.name}-`));
280
+ }
281
+ catch (e) {
282
+ return refuse(`refused its output folders: ${e instanceof Error ? e.message : String(e)}`);
283
+ }
284
+ const prevDir = path.join(exportsDir, target.name);
285
+ const { getCliVersion } = await import('./init.js');
286
+ const args = [target.modulePath, '--deck', deckDir, '--stage', stage, '--cache', cacheDir];
287
+ const env = {
288
+ ...process.env,
289
+ CASTLE_EXPORT_NAME: target.name,
290
+ CASTLE_EXPORT_DECK_DIR: deckDir,
291
+ CASTLE_EXPORT_STAGE_DIR: stage,
292
+ CASTLE_EXPORT_CACHE_DIR: cacheDir,
293
+ CASTLE_EXPORT_PREV_DIR: lexists(prevDir) ? prevDir : '',
294
+ // The only kit code an exporter may load: this CLI's own kits.
295
+ CASTLE_EXPORT_SHIPPED_KITS: path.resolve(getKitsDir()),
296
+ // The kits' `three`, as this CLI ships it (../scripts/vendor-three.mjs), so an exporter never
297
+ // loads a deck's node_modules. Absent in a checkout that has not built the CLI.
298
+ CASTLE_EXPORT_THREE_DIR: fs.existsSync(path.join(getPackageRoot(), 'vendor/three/build/three.module.js')) ? path.join(getPackageRoot(), 'vendor/three') : '',
299
+ CASTLE_EXPORT_CLI_VERSION: getCliVersion(),
300
+ };
301
+ const result = await runChild(args, deckDir, env);
302
+ const summary = lastJson(result.stdout);
303
+ if (!result.timedOut && result.code === 0) {
304
+ try {
305
+ installStage(stage, deckExportsDir(deckDir), target.name);
306
+ return { alias: target.alias, name: target.name, ok: true, summary };
307
+ }
308
+ catch (e) {
309
+ fs.rmSync(stage, { recursive: true, force: true });
310
+ return refuse(`could not be put in place: ${e instanceof Error ? e.message : String(e)}`);
311
+ }
312
+ }
313
+ fs.rmSync(stage, { recursive: true, force: true });
314
+ const error = result.timedOut
315
+ ? `it did not finish in ${exportTimeoutMs()}ms and was stopped`
316
+ : outputLines(result.stderr).slice(-8).join('\n') || `it exited with code ${result.code}`;
317
+ log(`${target.alias} export ${target.name} failed: ${error}`);
318
+ return { alias: target.alias, name: target.name, ok: false, summary, error };
319
+ }
320
+ /** Run every applicable exporter, one at a time. */
321
+ export async function runDeckExports(deckDir, log = (message) => console.log(message)) {
322
+ const outcomes = [];
323
+ for (const target of exportTargets(deckDir, log)) {
324
+ outcomes.push(await runOne(deckDir, target, log));
325
+ }
326
+ return outcomes;
327
+ }
328
+ /** `castle-web export [dir]`: prints each summary; exits 1 when one failed. */
329
+ export async function exportCommand(dir) {
330
+ const deckDir = path.resolve(dir);
331
+ if (!fs.existsSync(path.join(deckDir, 'castle.json'))) {
332
+ console.error(`No castle.json in ${deckDir} -- is this a deck?`);
333
+ process.exit(1);
334
+ }
335
+ const outcomes = await runDeckExports(deckDir);
336
+ if (outcomes.length === 0) {
337
+ console.log('Nothing to export: no import of this deck declares an exporter.');
338
+ return;
339
+ }
340
+ for (const o of outcomes) {
341
+ console.log(`${o.ok ? 'Exported' : 'FAILED'} ${o.name} (${o.alias}): ${JSON.stringify(o.summary)}`);
342
+ }
343
+ if (outcomes.some((o) => !o.ok))
344
+ process.exit(1);
345
+ }
346
+ /**
347
+ * After a successful save, under CASTLE_SAVE_EXPORTS=1 only. Never throws:
348
+ * whatever an exporter does, the save already happened and stands.
349
+ */
350
+ export async function runSaveExports(deckDir) {
351
+ if (process.env[SAVE_EXPORTS_ENV] !== '1')
352
+ return;
353
+ try {
354
+ const outcomes = await runDeckExports(deckDir, (message) => console.warn(message));
355
+ for (const o of outcomes) {
356
+ if (o.ok)
357
+ console.log(`Exported ${o.name} (${o.alias}).`);
358
+ else
359
+ console.warn(`Warning: export ${o.name} (${o.alias}) failed; the save is unaffected.`);
360
+ }
361
+ }
362
+ catch (e) {
363
+ console.warn(`Warning: exporters did not run (${e instanceof Error ? e.message : String(e)}); the save is unaffected.`);
364
+ }
365
+ }
@@ -18,6 +18,7 @@ export interface CheckTarget {
18
18
  /** The import's pin, or null for the deck's own check. */
19
19
  pin: DeckImport | null;
20
20
  }
21
+ export declare function isShippedKitDir(dir: string): boolean;
21
22
  /**
22
23
  * Run every applicable `onCheck`, one at a time, and collect what they found.
23
24
  * Warnings are logged here; errors are returned for the caller to refuse on --
@@ -20,7 +20,7 @@ import { importIsOnTrustedAccount, TRUSTED_IMPORT_ACCOUNT } from './importTrust.
20
20
  /** The alias a deck's OWN `onCheck` is reported under. */
21
21
  export const SELF_CHECK_ALIAS = 'self';
22
22
  // Whether `dir` is one of the kits this CLI ships, checked as itself.
23
- function isShippedKitDir(dir) {
23
+ export function isShippedKitDir(dir) {
24
24
  const kits = path.resolve(getKitsDir());
25
25
  const rel = path.relative(kits, path.resolve(dir));
26
26
  return !!rel && !rel.startsWith('..') && !path.isAbsolute(rel) && !rel.includes(path.sep);
package/dist/index.js CHANGED
@@ -197,6 +197,7 @@ function usage() {
197
197
  castle-web update-import [alias] [dir] [--check] [--revert] (re-fetches imports; no alias means all)
198
198
  castle-web install [dir]
199
199
  castle-web check [dir] [--pin-installed-imports] (bundles the deck and its server, then runs each import's onCheck -- the same gates save-deck runs)
200
+ castle-web export [dir] (runs each import's save-time exporters (castle.json "exports") into .castle/exports/<name>/; save-deck runs them only with CASTLE_SAVE_EXPORTS=1)
200
201
  castle-web bundle-chunks [dir] --out DIR [--base-url URL] (writes the classic chunked bundle: index.html plus <sha256>.js chunks named at URL, default ./)
201
202
  castle-web save-version [-m MESSAGE] [paths...] [--dir DIR] (no paths saves the whole deck)
202
203
  castle-web list-versions [version] [--dir DIR] (defaults to the latest version)
@@ -640,6 +641,10 @@ async function main() {
640
641
  await check(findPositionalDir(), { pinInstalledImports: hasFlag('--pin-installed-imports') });
641
642
  break;
642
643
  }
644
+ case 'export': {
645
+ await (await import('./deckExports.js')).exportCommand(findPositionalDir());
646
+ break;
647
+ }
643
648
  case 'bundle-chunks':
644
649
  await (await import('./bundle.js')).bundleChunksCommand(findPositionalDir(), getFlagValue('--out'), getFlagValue('--base-url'));
645
650
  break;
package/dist/init.js CHANGED
@@ -64,7 +64,7 @@ const BARE_SCAFFOLDS = [
64
64
  // Registry version of castle-web-sdk to inject when scaffolding from a
65
65
  // globally-installed castle-web (not from inside the workspace). Bumped
66
66
  // alongside cli/sdk version bumps.
67
- const PUBLISHED_SDK_VERSION = '0.4.50';
67
+ const PUBLISHED_SDK_VERSION = '0.4.51';
68
68
  // Range, not a pin: `castle-web-fonts` is its own package precisely so a tenth
69
69
  // face can ship without a cli release, and a caret range means an existing
70
70
  // deck's next install picks it up. Nothing here has to move when it does.
@@ -398,6 +398,7 @@ const STARTER_CONFIG_RESERVED = new Set([
398
398
  'importWhenRemixed',
399
399
  'onUpdate',
400
400
  'onCheck',
401
+ 'exports',
401
402
  'main',
402
403
  'starterScene',
403
404
  'starterFiles',
package/dist/save-deck.js CHANGED
@@ -6,11 +6,12 @@ import { nanoid } from 'nanoid';
6
6
  import * as api from './api.js';
7
7
  import * as config from './config.js';
8
8
  import { bundleProject, bundleProjectChunked } from './bundle.js';
9
- import { resolveBundleChunks, resolveServerConfig, validateExperiments, } from './castleJson.js';
9
+ import { resolveBundleChunks, resolveServerConfig, serverBundleConfig, validateExperiments, } from './castleJson.js';
10
10
  import { importChecksFailedMessage, runImportChecks } from './importCheckHook.js';
11
11
  import { selectSaveCover } from './saveCover.js';
12
12
  import { COVER_FILE } from './localPaths.js';
13
13
  import { buildServerBundle } from './serverBundle.js';
14
+ import { runSaveExports } from './deckExports.js';
14
15
  import { buildContentPack } from './contentPack.js';
15
16
  import { importRegressionMessage, importRegressions, savedDeckImportPins } from './importRegression.js';
16
17
  import { isSandboxEnv } from './cloudGit.js';
@@ -276,18 +277,7 @@ async function publishServerBundle(projectDir, deckId, pack) {
276
277
  const uploadConfig = await api.createCauldronServerBundleUploadConfig(deckId);
277
278
  await uploadPresignedFile(uploadConfig, new Blob([bundle.code], { type: 'application/javascript' }), 'application/javascript', 60_000, 'Server bundle upload');
278
279
  const packUploadId = pack ? await uploadContentPack(deckId, pack) : null;
279
- const saved = await api.saveCauldronServerBundle(deckId, uploadConfig.uploadId, {
280
- tickRate: serverConfig.tickRate,
281
- maxPlayers: serverConfig.maxPlayers,
282
- voice: { enabled: serverConfig.voiceEnabled },
283
- ...(serverConfig.destinations ? { destinations: serverConfig.destinations } : {}),
284
- ...(serverConfig.worldNotifications
285
- ? { worldNotifications: serverConfig.worldNotifications }
286
- : {}),
287
- // Sent only for a deck whose castle.json declares a hub place, so every
288
- // other deck's config is exactly what it was.
289
- ...(serverConfig.hub ? { hub: serverConfig.hub } : {}),
290
- }, packUploadId ?? undefined);
280
+ const saved = await api.saveCauldronServerBundle(deckId, uploadConfig.uploadId, serverBundleConfig(serverConfig), packUploadId ?? undefined);
291
281
  // The server hashes what it actually stored. A mismatch means the bytes that
292
282
  // will run in sessions are not the bytes we bundled.
293
283
  if (saved && saved.sha256 !== bundle.sha256) {
@@ -313,6 +303,17 @@ function checkedExperiments(castleJson) {
313
303
  throw new Error(`castle.json ${e instanceof Error ? e.message : String(e)} Nothing was saved.`);
314
304
  }
315
305
  }
306
+ // The server block is read again when the bundle is published, after the deck is
307
+ // live; a value it refuses (server.placeMaxPlayers, server.destinations) stops
308
+ // the save here instead.
309
+ function checkedServerConfig(projectDir) {
310
+ try {
311
+ resolveServerConfig(projectDir);
312
+ }
313
+ catch (e) {
314
+ throw new Error(`${e instanceof Error ? e.message : String(e)} Nothing was saved.`);
315
+ }
316
+ }
316
317
  // castle.json `experiments` goes to Castle on every save, with or without a
317
318
  // server bundle. A declared block is awaited and fails the save loudly when it
318
319
  // cannot be stored. Exported for the tests.
@@ -625,6 +626,7 @@ async function saveDeckAfterValidation(dir, opts, projectDir, visibility) {
625
626
  const castleJson = readCastleJson(projectDir);
626
627
  const existingDeckId = typeof castleJson?.deckId === 'string' && castleJson.deckId ? castleJson.deckId : null;
627
628
  const experiments = checkedExperiments(castleJson);
629
+ checkedServerConfig(projectDir);
628
630
  const chunked = checkedBundleChunks(castleJson, opts);
629
631
  if (chunked && !existingDeckId) {
630
632
  // Ghost grants chunk uploads for a deck that exists; a new one is created
@@ -823,6 +825,9 @@ async function saveDeckAfterValidation(dir, opts, projectDir, visibility) {
823
825
  console.error(`Could not record the saved version: ${e instanceof Error ? e.message : String(e)}`);
824
826
  }
825
827
  await clearingExperiments?.settle();
828
+ // Save-time exporters (deckExports.ts): off unless CASTLE_SAVE_EXPORTS=1,
829
+ // and never able to fail the save that just happened.
830
+ await runSaveExports(projectDir);
826
831
  }
827
832
  catch (e) {
828
833
  const code = e?.extensions?.code ?? '';
@@ -82,7 +82,7 @@
82
82
  "title": "base",
83
83
  "deckId": "yRcmH4_aYllE",
84
84
  "cardId": "zkFdingmIm3m",
85
- "publishedVersion": "2026-10-18T10:34:27.709Z",
85
+ "publishedVersion": "2026-10-21T18:36:51.857Z",
86
86
  "provides": [
87
87
  "castle-web-sdk"
88
88
  ]
@@ -18,6 +18,7 @@ import { setup, initCard, Store, Leaderboard } from "castle-web-sdk";
18
18
  - [Store](#store)
19
19
  - [Storage](#storage)
20
20
  - [SharedStorage](#sharedstorage)
21
+ - [LocalCache](#localcache)
21
22
  - [Leaderboard](#leaderboard)
22
23
  - [Time](#time)
23
24
  - [User](#user)
@@ -853,6 +854,44 @@ const { color } = await Store.user(otherUserId).get(["color"]);
853
854
  await Store.me.set({ color: "red" });
854
855
  ```
855
856
 
857
+ ## LocalCache
858
+
859
+ `LocalCache` keeps bytes and text on the player's device, for things the
860
+ deck can rebuild: downloaded or unpacked assets, compiled data. Entries
861
+ belong to the deck whose code is running. A hub town's doors change the
862
+ place but not the code, so the games played through them use the town's
863
+ entries. In the app, decks loaded from the same web address share entries.
864
+
865
+ Any entry can be gone at any time. Each deck has 20 MB; past that, its own
866
+ least recently used entries are evicted. On the web all decks
867
+ together have 300 MB; past that, the least recently used entries of any
868
+ deck are evicted. Both are less when the device is short of space. The
869
+ browser or app may also clear the whole cache. Never keep anything here
870
+ that the deck cannot make again; use [`Store`](#store) for that.
871
+
872
+ - **`LocalCache.getBinary(key): Promise<ArrayBuffer | null>`** — the bytes
873
+ at `key`, or `null` if there are none. A text entry comes back as UTF-8.
874
+ - **`LocalCache.getText(key): Promise<string | null>`** — the text at
875
+ `key`. A bytes entry is decoded as UTF-8.
876
+ - **`LocalCache.set(key, value): Promise<void>`** — stores an
877
+ `ArrayBuffer`, a `Uint8Array` or a string. An `ArrayBuffer` is moved, not
878
+ copied, and is empty (detached) once `set` returns; pass `buffer.slice(0)`
879
+ to keep one. A `Uint8Array` that covers its whole buffer moves that buffer
880
+ the same way; one over part of a buffer is copied.
881
+ - **`LocalCache.remove(key): Promise<void>`** — removes `key`.
882
+
883
+ Keys are 1 to 1024 characters, without NUL; a bad key or value throws.
884
+ Nothing else does: a get that cannot read returns `null`, and a set that
885
+ cannot write stores nothing.
886
+
887
+ ```js
888
+ let bytes = await LocalCache.getBinary("town-v3");
889
+ if (!bytes) {
890
+ bytes = await unpackTown();
891
+ LocalCache.set("town-v3", bytes.slice(0));
892
+ }
893
+ ```
894
+
856
895
  ## Leaderboard
857
896
 
858
897
  `Leaderboard` ranks players by a numeric score, per deck and per
@@ -1361,6 +1400,14 @@ the signed-in account id. A new host without native sign-in support returns
1361
1400
  - `Hub.onBack(listener)` hears the host's Back control, which a game cannot hide.
1362
1401
  Answer it with `Hub.back()` behind the door animation; a host that hears
1363
1402
  nothing takes the player home itself. Returns an unsubscribe function.
1403
+ - `Hub.onGo(listener)` hears the host ask to take the player through a door,
1404
+ e.g. a trip begun outside this page. The listener gets
1405
+ `{ doorId, owner, title, party }`: `owner` is whose House a House door leads
1406
+ to (or null), `title` the host's name for the door (or null), `party` how many
1407
+ travel (1 when the host does not say). A hub kit answers it like a fired pad:
1408
+ `Hub.go(doorId)` (with `{ ownerUserId: owner }` when set) behind its door
1409
+ animation. Hosts that never send it are the norm. Returns an unsubscribe
1410
+ function.
1364
1411
 
1365
1412
  A player Castle has barred from the hub is refused at every hub door and at the
1366
1413
  town itself with `CastleError` code `CAULDRON_HUB_BANNED` (from `Hub.go`,
@@ -13,7 +13,7 @@ export { deckPrefixOf, IMPORTS_DIR, IMPORTS_PREFIX, isImportedFile, resolveDeckF
13
13
  export { Haptics } from "./haptics";
14
14
  export type { CastleHapticsApi, HapticsResult, HapticsStatus, HapticStyle } from "./haptics";
15
15
  export { Hub } from "./hub";
16
- export type { CastleHubApi, HubBackResult, HubCancelResult, HubCancelStatus, HubChatMessage, HubChatResult, HubDoor, HubDoorsResult, HubFriend, HubFriendsResult, HubInviteResult, HubCanInviteResult, HubInviteArrivalResult, HubHeartsResult, HubGoParams, HubSignInParams, HubSignInResult, HubGoResult, HubHandoffResult, HubHandoffStatus, HubJumpResult, HubPlacementKind, HubReportResult, HubSayResult, } from "./hub";
16
+ export type { CastleHubApi, HubBackResult, HubCancelResult, HubCancelStatus, HubChatMessage, HubChatResult, HubDoor, HubDoorsResult, HubFriend, HubFriendsResult, HubInviteResult, HubCanInviteResult, HubInviteArrivalResult, HubHeartsResult, HubGoParams, HubGoRequest, HubSignInParams, HubSignInResult, HubGoResult, HubHandoffResult, HubHandoffStatus, HubJumpResult, HubPlacementKind, HubReportResult, HubSayResult, } from "./hub";
17
17
  export { Social } from "./social";
18
18
  export type { CastleSocialApi, SocialFriend, SocialPresence } from "./social";
19
19
  export { Party } from "./party";
@@ -42,6 +42,8 @@ export { cardUnit, fitStage, fovForAspect, getDisplay } from "./display";
42
42
  export type { DeckDisplay, DeckLayout, DeckOrientation } from "./display";
43
43
  export { flushSaves, hasPendingSave, onSaveState, writeFile, } from "./saveQueue";
44
44
  export type { SaveState } from "./saveQueue";
45
+ export { LocalCache } from "./localCache";
46
+ export type { LocalCacheApi } from "./localCache";
45
47
  export { SharedStorage, Storage } from "./storage";
46
48
  export { Store } from "./store";
47
49
  export type { CastleStoreApi, StoreBoardApi, StoreBoardScore, StoreListEntry, StoreListOptions, StoreListPage, StoreAllowance, StoreScopeApi, StoreUsage, } from "./store";
@@ -22,6 +22,7 @@ export { Portal } from "./portal";
22
22
  export { CARD_RATIO, deleteFile, fileUrl, initCard, onBeforeRestart, onFilesChanged, onSaveReloadState, openFile, renameFile, requestReload, setup, takeReloadState, writeFileOnce, } from "./runtime";
23
23
  export { cardUnit, fitStage, fovForAspect, getDisplay } from "./display";
24
24
  export { flushSaves, hasPendingSave, onSaveState, writeFile, } from "./saveQueue";
25
+ export { LocalCache } from "./localCache";
25
26
  export { SharedStorage, Storage } from "./storage";
26
27
  export { Store } from "./store";
27
28
  export { Time } from "./time";