oda-engine 0.0.0-stage → 0.1.0

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 (204) hide show
  1. package/README.md +151 -2
  2. package/bin/nowhere.mjs +352 -0
  3. package/lib/account.mjs +57 -0
  4. package/lib/agentModules.mjs +57 -0
  5. package/lib/devServer.mjs +351 -0
  6. package/lib/headless.mjs +231 -0
  7. package/lib/headlessPreview.mjs +212 -0
  8. package/lib/keys.mjs +517 -0
  9. package/lib/make.mjs +855 -0
  10. package/lib/mcp.mjs +537 -0
  11. package/lib/open.mjs +22 -0
  12. package/lib/preview.mjs +87 -0
  13. package/lib/previewRpc.mjs +134 -0
  14. package/lib/project.mjs +359 -0
  15. package/lib/publishFlow.mjs +90 -0
  16. package/lib/resources.mjs +50 -0
  17. package/lib/rules.mjs +60 -0
  18. package/lib/scaffold.mjs +42 -0
  19. package/lib/setup.mjs +59 -0
  20. package/lib/tools.mjs +668 -0
  21. package/package.json +51 -4
  22. package/template/game.config.json +9 -0
  23. package/template/scene.json +4 -0
  24. package/template/src/main.ts +11 -0
  25. package/vendor/DOCS.md +447 -0
  26. package/vendor/agent/appRun.mjs +520 -0
  27. package/vendor/agent/assets/brief.mjs +242 -0
  28. package/vendor/agent/assets/collider.mjs +531 -0
  29. package/vendor/agent/assets/environments/index.mjs +12 -0
  30. package/vendor/agent/assets/environments/worldlabs.mjs +161 -0
  31. package/vendor/agent/assets/fetch.mjs +168 -0
  32. package/vendor/agent/assets/footprint.mjs +13 -0
  33. package/vendor/agent/assets/gltf.mjs +547 -0
  34. package/vendor/agent/assets/hdr.mjs +269 -0
  35. package/vendor/agent/assets/imageOps.mjs +171 -0
  36. package/vendor/agent/assets/images/codex.mjs +307 -0
  37. package/vendor/agent/assets/images/fal.mjs +75 -0
  38. package/vendor/agent/assets/images/gemini.mjs +84 -0
  39. package/vendor/agent/assets/images/index.mjs +25 -0
  40. package/vendor/agent/assets/images/openai.mjs +75 -0
  41. package/vendor/agent/assets/images/stability.mjs +71 -0
  42. package/vendor/agent/assets/images/views.mjs +31 -0
  43. package/vendor/agent/assets/import.mjs +1352 -0
  44. package/vendor/agent/assets/inspect.mjs +465 -0
  45. package/vendor/agent/assets/jobs.mjs +196 -0
  46. package/vendor/agent/assets/ktx2.mjs +290 -0
  47. package/vendor/agent/assets/ledger.mjs +466 -0
  48. package/vendor/agent/assets/net.mjs +254 -0
  49. package/vendor/agent/assets/prices.json +39 -0
  50. package/vendor/agent/assets/providers/fal.mjs +115 -0
  51. package/vendor/agent/assets/providers/index.mjs +22 -0
  52. package/vendor/agent/assets/providers/meshy.mjs +119 -0
  53. package/vendor/agent/assets/providers/tripo.mjs +188 -0
  54. package/vendor/agent/assets/sources/ambientcg.mjs +129 -0
  55. package/vendor/agent/assets/sources/index.mjs +23 -0
  56. package/vendor/agent/assets/sources/polyhaven.mjs +237 -0
  57. package/vendor/agent/assets/sources/polypizza.mjs +121 -0
  58. package/vendor/agent/assets/splat.mjs +631 -0
  59. package/vendor/agent/assets/targets.mjs +122 -0
  60. package/vendor/agent/assets/tile.mjs +261 -0
  61. package/vendor/agent/assets/unzip.mjs +180 -0
  62. package/vendor/agent/blender/cleanup.py +360 -0
  63. package/vendor/agent/blender/convert.py +167 -0
  64. package/vendor/agent/blender/find.mjs +192 -0
  65. package/vendor/agent/blender/nw_export.py +104 -0
  66. package/vendor/agent/blender/nw_rubric.py +426 -0
  67. package/vendor/agent/blender/run.mjs +193 -0
  68. package/vendor/agent/blender/runner.py +252 -0
  69. package/vendor/agent/blender/sheet.py +743 -0
  70. package/vendor/agent/depth.mjs +134 -0
  71. package/vendor/agent/director/board.mjs +451 -0
  72. package/vendor/agent/director/contracts.mjs +663 -0
  73. package/vendor/agent/director/director.mjs +2365 -0
  74. package/vendor/agent/director/estimate.mjs +200 -0
  75. package/vendor/agent/director/gate.mjs +802 -0
  76. package/vendor/agent/director/limits.json +16 -0
  77. package/vendor/agent/director/methods.mjs +457 -0
  78. package/vendor/agent/director/policy.json +33 -0
  79. package/vendor/agent/director/prompts.mjs +244 -0
  80. package/vendor/agent/director/reading.mjs +341 -0
  81. package/vendor/agent/director/router.mjs +184 -0
  82. package/vendor/agent/director/seams.mjs +243 -0
  83. package/vendor/agent/director/session.mjs +643 -0
  84. package/vendor/agent/director/store.mjs +119 -0
  85. package/vendor/agent/director/taskGate.mjs +110 -0
  86. package/vendor/agent/director/teamLedger.mjs +118 -0
  87. package/vendor/agent/director/triage.mjs +63 -0
  88. package/vendor/agent/downloads.cjs +363 -0
  89. package/vendor/agent/flow.mjs +78 -0
  90. package/vendor/agent/guard.mjs +613 -0
  91. package/vendor/agent/host.mjs +1736 -0
  92. package/vendor/agent/language.mjs +58 -0
  93. package/vendor/agent/ledger.mjs +360 -0
  94. package/vendor/agent/locale.cjs +186 -0
  95. package/vendor/agent/loop/capacity.mjs +74 -0
  96. package/vendor/agent/loop/compose.mjs +127 -0
  97. package/vendor/agent/loop/gate.mjs +205 -0
  98. package/vendor/agent/loop/judge.mjs +189 -0
  99. package/vendor/agent/loop/levels.mjs +273 -0
  100. package/vendor/agent/loop/state.mjs +358 -0
  101. package/vendor/agent/notes.cjs +278 -0
  102. package/vendor/agent/pace.mjs +258 -0
  103. package/vendor/agent/panels.mjs +431 -0
  104. package/vendor/agent/prompt.mjs +342 -0
  105. package/vendor/agent/reference/board.mjs +410 -0
  106. package/vendor/agent/reference/compose.mjs +364 -0
  107. package/vendor/agent/reference/decode.mjs +56 -0
  108. package/vendor/agent/reference/facts.mjs +1874 -0
  109. package/vendor/agent/reference/png.mjs +107 -0
  110. package/vendor/agent/reference/records.mjs +63 -0
  111. package/vendor/agent/reference/web.mjs +252 -0
  112. package/vendor/agent/roles/artist.mjs +69 -0
  113. package/vendor/agent/roles/builder.mjs +79 -0
  114. package/vendor/agent/roles/checks.mjs +223 -0
  115. package/vendor/agent/roles/common.mjs +188 -0
  116. package/vendor/agent/roles/critic.mjs +171 -0
  117. package/vendor/agent/roles/index.mjs +39 -0
  118. package/vendor/agent/roles/modeller.mjs +142 -0
  119. package/vendor/agent/roles/qa.mjs +58 -0
  120. package/vendor/agent/roles/rubrics.mjs +79 -0
  121. package/vendor/agent/roles/sound.mjs +69 -0
  122. package/vendor/agent/rounds.cjs +333 -0
  123. package/vendor/agent/shared.mjs +284 -0
  124. package/vendor/agent/stopGate.mjs +574 -0
  125. package/vendor/agent/subagents.mjs +129 -0
  126. package/vendor/agent/tools/assets.mjs +499 -0
  127. package/vendor/agent/tools/blender.mjs +754 -0
  128. package/vendor/agent/tools/cards.mjs +479 -0
  129. package/vendor/agent/tools/choices.mjs +479 -0
  130. package/vendor/agent/tools/compose.mjs +74 -0
  131. package/vendor/agent/tools/environment.mjs +488 -0
  132. package/vendor/agent/tools/eyes.mjs +733 -0
  133. package/vendor/agent/tools/generate.mjs +338 -0
  134. package/vendor/agent/tools/guide.mjs +46 -0
  135. package/vendor/agent/tools/harness.mjs +193 -0
  136. package/vendor/agent/tools/image.mjs +643 -0
  137. package/vendor/agent/tools/index.mjs +162 -0
  138. package/vendor/agent/tools/look.mjs +578 -0
  139. package/vendor/agent/tools/loop.mjs +858 -0
  140. package/vendor/agent/tools/others.mjs +123 -0
  141. package/vendor/agent/tools/pictures.mjs +535 -0
  142. package/vendor/agent/tools/reference.mjs +366 -0
  143. package/vendor/agent/transcripts.mjs +118 -0
  144. package/vendor/agent-loop.mjs +602 -0
  145. package/vendor/agent-plugin/.claude-plugin/plugin.json +5 -0
  146. package/vendor/agent-plugin/skills/art-direction/SKILL.md +82 -0
  147. package/vendor/agent-plugin/skills/asset-legality/SKILL.md +101 -0
  148. package/vendor/agent-plugin/skills/asset-sources/SKILL.md +111 -0
  149. package/vendor/agent-plugin/skills/blender-modeling/SKILL.md +97 -0
  150. package/vendor/agent-plugin/skills/look-dev/SKILL.md +104 -0
  151. package/vendor/agent-plugin/skills/playtesting/SKILL.md +74 -0
  152. package/vendor/agent-plugin/skills/reference-loop/SKILL.md +102 -0
  153. package/vendor/agent-plugin/skills/sound-design/SKILL.md +60 -0
  154. package/vendor/agent-plugin/skills/style/SKILL.md +35 -0
  155. package/vendor/agent-plugin/skills/tsl-r185/SKILL.md +107 -0
  156. package/vendor/auth.cjs +570 -0
  157. package/vendor/build.cjs +953 -0
  158. package/vendor/catalog.json +455 -0
  159. package/vendor/connectors.cjs +688 -0
  160. package/vendor/eyes.mjs +733 -0
  161. package/vendor/gameExports.json +1390 -0
  162. package/vendor/git.cjs +222 -0
  163. package/vendor/models.json +57 -0
  164. package/vendor/publish.cjs +1018 -0
  165. package/vendor/refBoard.cjs +301 -0
  166. package/vendor/schema/dist/assets.d.ts +335 -0
  167. package/vendor/schema/dist/assets.js +439 -0
  168. package/vendor/schema/dist/brief.d.ts +357 -0
  169. package/vendor/schema/dist/brief.js +302 -0
  170. package/vendor/schema/dist/common.d.ts +9 -0
  171. package/vendor/schema/dist/common.js +13 -0
  172. package/vendor/schema/dist/config.d.ts +406 -0
  173. package/vendor/schema/dist/config.js +355 -0
  174. package/vendor/schema/dist/contract.d.ts +599 -0
  175. package/vendor/schema/dist/contract.js +1146 -0
  176. package/vendor/schema/dist/index.d.ts +14 -0
  177. package/vendor/schema/dist/index.js +21 -0
  178. package/vendor/schema/dist/look.d.ts +463 -0
  179. package/vendor/schema/dist/look.js +681 -0
  180. package/vendor/schema/dist/lookStats.d.ts +230 -0
  181. package/vendor/schema/dist/lookStats.js +768 -0
  182. package/vendor/schema/dist/pilot.d.ts +32 -0
  183. package/vendor/schema/dist/pilot.js +44 -0
  184. package/vendor/schema/dist/publish.d.ts +214 -0
  185. package/vendor/schema/dist/publish.js +291 -0
  186. package/vendor/schema/dist/scene.d.ts +75 -0
  187. package/vendor/schema/dist/scene.js +120 -0
  188. package/vendor/schema/dist/skyLight.d.ts +141 -0
  189. package/vendor/schema/dist/skyLight.js +436 -0
  190. package/vendor/schema/dist/style.d.ts +131 -0
  191. package/vendor/schema/dist/style.js +155 -0
  192. package/vendor/schema/package.json +1 -0
  193. package/vendor/selectionPrompt.mjs +51 -0
  194. package/vendor/useTools.mjs +195 -0
  195. package/vendor/userMessage.mjs +26 -0
  196. package/web-dist/assets/GaussianSplatUtils-CB77cP9U.js +1 -0
  197. package/web-dist/assets/KTX2Loader-6OIWUF7s.js +2 -0
  198. package/web-dist/assets/SPZLoader-zYj0Alfv.js +1 -0
  199. package/web-dist/assets/gaussianSplat-CJTI1sEh.js +1 -0
  200. package/web-dist/assets/index-CcjyyQco.css +1 -0
  201. package/web-dist/assets/index-DMyJcoZJ.js +693 -0
  202. package/web-dist/assets/meshopt_decoder.module-BvwdjiD3.js +1 -0
  203. package/web-dist/assets/zstddec.module-CfFeQW7d.js +1 -0
  204. package/web-dist/index.html +34 -0
@@ -0,0 +1,1146 @@
1
+ import { z } from 'zod';
2
+ import { GameConfig, validateConfig } from './config.js';
3
+ import { SceneDoc, validateScene } from './scene.js';
4
+ import { ASSET_KINDS, AssetLock, CREDITS_SHOWN, DECODERS_LIVE, LEDGER_FILE, assetKindOf, assetSizeProblems, checkLedger, collectConfigAssets, isPublishablePath, licenseVerdict, parsePublishLock, publishLock, } from './assets.js';
5
+ import { LIMITS, SPLAT_FILE, assetsBudgetBytes, checkBundle, collectSceneAssets, isAssetPath } from './publish.js';
6
+ // The publish contract: what a studio, the CLI, the `publish` Edge Function
7
+ // and the planet player have to agree on for a planet to go up and to play,
8
+ // and the one place each of them says how much of it it can do.
9
+ //
10
+ // The rules stay where they were written (publish.ts, assets.ts, config.ts,
11
+ // scene.ts). This file joins them up:
12
+ //
13
+ // PUBLISH_CONTRACT a number that goes up whenever what a planet may carry
14
+ // changes, so two sides can tell they disagree before a
15
+ // planet's files have crossed the wire, not after
16
+ // capabilities what a server or a player can do, by name; planetNeeds
17
+ // says which of them one planet uses, and the sentences
18
+ // below turn the difference into words for the creator
19
+ // admitUploads THE rule for which files travel with a publish, where
20
+ // the studio, the function and assets-check used to keep
21
+ // a copy each
22
+ // checkPublish everything the function checks on a request before it
23
+ // records anything, as one pure call: the function's
24
+ // verdict, its dry run, the studio's pre-flight and
25
+ // `nowhere check` all run it
26
+ // strippedKeys what a parse dropped, so a server older than a planet
27
+ // refuses it with a finding instead of publishing less
28
+ //
29
+ // Capabilities cover the kinds of file and the config's features. The SDK's
30
+ // surface is the other half of what a player has to offer: a planet's code
31
+ // that calls an @nowhere/sdk export the player's sdk@1.js does not have
32
+ // throws for every visitor. So a player also lists the names its SDK exports
33
+ // (PlayerInfo.sdk), the bundle's gates list the names its code reads
34
+ // (checkBundle's sdk), and a client compares the two before it uploads.
35
+ //
36
+ // The contract's history, for the record: 1 took models only (the function
37
+ // before the ledger); 2 added the ledger, textures, HDRIs, sounds, LUTs and
38
+ // the look block; 3 is this file: the info a server and a player give about
39
+ // themselves (a player's SDK exports among them), the dry run, and the needs
40
+ // a planet states. 4 adds what the player page decodes by WebAssembly (KTX2
41
+ // textures, as .ktx2 files or inside a model, and meshopt-compressed
42
+ // geometry: 'ktx2', 'meshopt'), config.player's scale (speed, run,
43
+ // eyeHeight, fov; 'player-scale'), splat environments (.spz files drawn as
44
+ // three's GaussianSplat; 'splats') and the credits a planet shows its
45
+ // visitors ('credits', which a CC BY file needs). SPEC_PUBLISH.md 13 and 14
46
+ // are the protocol in words, and the order a change to it ships in.
47
+ /** The publish contract this package speaks. */
48
+ export const PUBLISH_CONTRACT = 4;
49
+ /** The contract that first takes config.player's scale (speed, run,
50
+ * eyeHeight, fov). A server from before it refuses the fields as unknown,
51
+ * and a player from before it walks at its own 8 m/s whatever they say, so
52
+ * nobody offers 'player-scale' until PUBLISH_CONTRACT reaches it: until then
53
+ * a planet that sets them is refused before anything is uploaded, with words
54
+ * that say why, instead of by the function as a field it does not know. */
55
+ export const PLAYER_SCALE_CONTRACT = 4;
56
+ /** The fields of config.player that make a planet need 'player-scale'. */
57
+ export const PLAYER_SCALE_KEYS = ['speed', 'run', 'eyeHeight', 'fov'];
58
+ /** The contract that first takes a splat environment (a .spz file, which the
59
+ * game's code draws with ctx.assets.splat). A server from before it refuses
60
+ * the file as a kind it does not know, and a player from before it has no
61
+ * GaussianSplat to draw it with (three r186, in the player's loader@1.js),
62
+ * so nobody offers 'splats' until PUBLISH_CONTRACT reaches it: until then a
63
+ * planet that carries one is refused before anything is uploaded, in words
64
+ * that say why. */
65
+ export const SPLATS_CONTRACT = 4;
66
+ // ---------------------------------------------------------------------------
67
+ // capabilities
68
+ // ---------------------------------------------------------------------------
69
+ /** Everything a side of the contract may be able to do. A closed list: the
70
+ * kinds of file, and the decoders some of them need beyond the kind's own
71
+ * (meshopt beside models, KTX2 beside textures), the config features an
72
+ * older side drops, the physical sky, which an older side's schema refuses
73
+ * and its player cannot draw, the credits a CC BY file needs shown, and the
74
+ * server's dry run. */
75
+ export const CAPABILITIES = ['models', 'meshopt', 'textures', 'ktx2', 'hdri', 'audio', 'lut', 'splats', 'ledger', 'look', 'player-scale', 'physical-sky', 'open-world', 'drawn-look', 'items', 'credits', 'dry-run'];
76
+ /** The capability a file of each kind needs. A .ktx2 texture needs 'ktx2'
77
+ * as well, since it takes a transcoder the other textures do not, and a
78
+ * model that requires a decoder (GLTF_EXTENSION_CAPABILITY) needs that. */
79
+ export const KIND_CAPABILITY = {
80
+ model: 'models',
81
+ texture: 'textures',
82
+ hdri: 'hdri',
83
+ audio: 'audio',
84
+ lut: 'lut',
85
+ splat: 'splats',
86
+ };
87
+ // The words for each, written to sit in "it does not take ___ yet".
88
+ const CAPABILITY_NAMES = {
89
+ models: 'models',
90
+ meshopt: 'meshopt-compressed models',
91
+ textures: 'textures',
92
+ ktx2: 'KTX2 textures',
93
+ hdri: 'HDRIs',
94
+ audio: 'sounds',
95
+ lut: 'LUTs',
96
+ splats: 'Gaussian splats',
97
+ ledger: 'an asset ledger',
98
+ look: 'look settings',
99
+ 'player-scale': "the player's scale (walk speed, run, eye height, field of view)",
100
+ 'physical-sky': 'a physical sky',
101
+ 'open-world': 'a world with no edge',
102
+ 'drawn-look': 'a drawn look (outlines, shading in steps, strokes, dots, paint, paper, pixels)',
103
+ items: 'items a visitor can take away (config items)',
104
+ credits: 'files that need a visible credit (CC BY)',
105
+ 'dry-run': 'dry runs',
106
+ };
107
+ /** What a server built from this package takes. KTX2 and meshopt only where
108
+ * its player decodes them (DECODERS_LIVE, decision D1): without the decoder
109
+ * a planet of them would publish and draw nothing, so nobody offers them.
110
+ * The player's scale only from PLAYER_SCALE_CONTRACT on, and splats from
111
+ * SPLATS_CONTRACT on. Credits only where the planet page shows them
112
+ * (CREDITS_SHOWN, decision D2). A physical sky is offered by a server and a
113
+ * player built from this package, which draws it. A side built before any
114
+ * of these does not list it, and a client refuses a planet that needs it
115
+ * with the older-side sentence before anything is uploaded. */
116
+ export const SERVER_CAPABILITIES = Object.freeze([
117
+ 'models',
118
+ ...(DECODERS_LIVE.meshopt ? ['meshopt'] : []),
119
+ 'textures',
120
+ ...(DECODERS_LIVE.ktx2 ? ['ktx2'] : []),
121
+ 'hdri',
122
+ 'audio',
123
+ 'lut',
124
+ ...(PUBLISH_CONTRACT >= SPLATS_CONTRACT ? ['splats'] : []),
125
+ 'ledger',
126
+ 'look',
127
+ ...(PUBLISH_CONTRACT >= PLAYER_SCALE_CONTRACT ? ['player-scale'] : []),
128
+ 'physical-sky',
129
+ 'open-world',
130
+ 'drawn-look',
131
+ 'items',
132
+ ...(CREDITS_SHOWN ? ['credits'] : []),
133
+ 'dry-run',
134
+ ]);
135
+ /** What a player built from this package plays: everything the server takes
136
+ * but the dry run. 'ledger' here is the files the ledger lets travel, served
137
+ * to the game's own code (ctx.assets) from the manifest's list; 'credits'
138
+ * is the manifest's credit lines, shown on the planet's page. */
139
+ export const PLAYER_CAPABILITIES = Object.freeze(SERVER_CAPABILITIES.filter((c) => c !== 'dry-run'));
140
+ /** What to assume of a server or a player that says nothing about itself:
141
+ * one from before contract 3, which takes the models a scene places and
142
+ * nothing else for certain. */
143
+ export const LEGACY_CAPABILITIES = Object.freeze(['models']);
144
+ const isObj = (v) => v !== null && typeof v === 'object' && !Array.isArray(v);
145
+ // ---------------------------------------------------------------------------
146
+ // what a model asks of the player
147
+ // ---------------------------------------------------------------------------
148
+ /** The glTF extensions a player needs a decoder for, and the capability
149
+ * each one needs. KHR_meshopt_compression is EXT_meshopt_compression as
150
+ * Khronos ratified it; three's GLTFLoader reads both with the one decoder. */
151
+ export const GLTF_EXTENSION_CAPABILITY = Object.freeze({
152
+ KHR_texture_basisu: 'ktx2',
153
+ EXT_meshopt_compression: 'meshopt',
154
+ KHR_meshopt_compression: 'meshopt',
155
+ });
156
+ const GLB_MAGIC = 0x46546c67; // "glTF"
157
+ const GLB_JSON = 0x4e4f534a; // "JSON"
158
+ /** Bytes as text, a byte a character. A glTF's JSON is UTF-8, and only its
159
+ * structure and its ASCII extension names are read here: a multi-byte
160
+ * character inside a string becomes two to four characters that JSON still
161
+ * takes, so this parses whatever TextDecoder would, without needing it
162
+ * (this package runs in Deno, Node and the browser on ES2022 alone). */
163
+ function latin1(bytes, start, end) {
164
+ let out = '';
165
+ for (let i = start; i < end; i += 8192)
166
+ out += String.fromCharCode(...bytes.subarray(i, Math.min(end, i + 8192)));
167
+ return out;
168
+ }
169
+ /**
170
+ * The glTF extensions a model file requires (its extensionsRequired), read
171
+ * from a GLB's JSON chunk or a .gltf's text: what a player must decode to
172
+ * draw it at all. An extension a file only uses is not here: glTF says such
173
+ * a file carries a fallback (a PNG beside the KTX2, plain geometry beside
174
+ * the compressed), which a player without the decoder draws instead.
175
+ *
176
+ * A GLB needs only its first 20 bytes and its JSON chunk, so a caller may
177
+ * pass that much of it rather than the whole file. Answers null for bytes
178
+ * that are not glTF (an OBJ, an FBX, a GLB cut short inside its JSON), and
179
+ * the names it found, each once, for one that is: at most 32, those that
180
+ * need a decoder (GLTF_EXTENSION_CAPABILITY) first.
181
+ */
182
+ export function gltfExtensionsRequired(input) {
183
+ const bytes = input instanceof Uint8Array ? input : new Uint8Array(input);
184
+ let text;
185
+ if (bytes.length >= 20 && new DataView(bytes.buffer, bytes.byteOffset, 20).getUint32(0, true) === GLB_MAGIC) {
186
+ const view = new DataView(bytes.buffer, bytes.byteOffset, 20);
187
+ const length = view.getUint32(12, true);
188
+ if (view.getUint32(16, true) !== GLB_JSON || 20 + length > bytes.length)
189
+ return null;
190
+ text = latin1(bytes, 20, 20 + length);
191
+ }
192
+ else {
193
+ // A .gltf: its text, past a byte-order mark. Anything else that does
194
+ // not open as a JSON object is not glTF.
195
+ let start = 0;
196
+ if (bytes[0] === 0xef && bytes[1] === 0xbb && bytes[2] === 0xbf)
197
+ start = 3;
198
+ while (start < bytes.length && (bytes[start] === 0x20 || bytes[start] === 0x0a || bytes[start] === 0x0d || bytes[start] === 0x09))
199
+ start++;
200
+ if (bytes[start] !== 0x7b)
201
+ return null;
202
+ text = latin1(bytes, start, bytes.length);
203
+ }
204
+ let json;
205
+ try {
206
+ json = JSON.parse(text);
207
+ }
208
+ catch {
209
+ return null;
210
+ }
211
+ if (!isObj(json) || !isObj(json.asset))
212
+ return null;
213
+ const required = Array.isArray(json.extensionsRequired) ? json.extensionsRequired : [];
214
+ // A Set, since a crafted file may list any number of names.
215
+ const names = new Set();
216
+ for (const name of required)
217
+ if (typeof name === 'string' && name && name.length <= 64)
218
+ names.add(name);
219
+ // At most 32 travel (a dry run's descriptor holds no more), and the names
220
+ // a player needs a decoder for go first: cut in the file's own order, a
221
+ // decoder's name past the 32nd would be no need at all, and the player
222
+ // would get a planet it cannot draw.
223
+ const decoded = (name) => Object.prototype.hasOwnProperty.call(GLTF_EXTENSION_CAPABILITY, name);
224
+ return [...[...names].filter(decoded), ...[...names].filter((name) => !decoded(name))].slice(0, 32);
225
+ }
226
+ /** The capabilities a model's required extensions need, in CAPABILITIES
227
+ * order. An extension three's loader reads without a decoder of its own
228
+ * (KHR_mesh_quantization, KHR_texture_transform, the KHR_materials_*) is
229
+ * not one. */
230
+ export function extensionNeeds(extensionsRequired) {
231
+ const needs = new Set();
232
+ for (const name of extensionsRequired ?? []) {
233
+ const need = Object.prototype.hasOwnProperty.call(GLTF_EXTENSION_CAPABILITY, name) ? GLTF_EXTENSION_CAPABILITY[name] : undefined;
234
+ if (need)
235
+ needs.add(need);
236
+ }
237
+ return CAPABILITIES.filter((c) => needs.has(c));
238
+ }
239
+ /**
240
+ * What a planet needs of the server that takes it and the player that plays
241
+ * it, in CAPABILITIES order: one per kind of file it carries ('splats' for a
242
+ * .spz splat environment), 'ktx2' for a KTX2 texture, 'hdri' for an HDRI
243
+ * sky, 'lut' for a LUT, and:
244
+ *
245
+ * ledger a ledger travels with it and a file goes up because of it: one
246
+ * the scene does not place and the config does not name, or one
247
+ * the game's code loads. Those reach the code through ctx.assets,
248
+ * which a player from before contract 2 does not have, and a
249
+ * server from before it refuses them. A ledger beside nothing but
250
+ * placed models needs nothing of either side: an older server
251
+ * takes the models without reading it, and the player draws them
252
+ * without ctx.assets. An upload given as a bare path has no
253
+ * reason, so it counts.
254
+ * look a look block with anything in it, or a fog mode, density or
255
+ * height, which an older side would drop. An empty look block (the
256
+ * blank template's) is not a need: all it changes is the tone curve
257
+ * (AgX, where no block draws Neutral), and an older side shows the
258
+ * planet the way it shows every planet from before the look.
259
+ * player-scale config.player with a speed, run, eyeHeight or fov. A
260
+ * spawn and a yaw alone are not one: every side has taken those.
261
+ * physical-sky
262
+ * a sky of kind physical: a server from before it refuses the
263
+ * config, and a player from before it cannot draw it.
264
+ * drawn-look
265
+ * a look that draws with a technique of look.style (an outline,
266
+ * bands, hatching, halftone, paint, paper, pixels): a server from
267
+ * before it refuses the config, and a player from before it would
268
+ * show the planet as a photograph of itself.
269
+ * items
270
+ * a list of items a visitor can take away: a server from before it
271
+ * refuses the config, and a player from before it gives nothing.
272
+ * ktx2, meshopt
273
+ * a .ktx2 texture, or a model that requires KHR_texture_basisu
274
+ * (ktx2) or EXT_ or KHR_meshopt_compression (meshopt): a player
275
+ * from before contract 4 has no decoder for them and draws the
276
+ * model as nothing. A model's extensions are read from its bytes
277
+ * (gltfExtensionsRequired) by whoever has them: the client on its
278
+ * disk, the function on what it was sent; a path alone says none.
279
+ * credits a file that travels whose licence asks for a visible credit (CC
280
+ * BY), by the ledger that travels with it: a server from before
281
+ * contract 4 refuses the file, and a player from before it does
282
+ * not show the credit.
283
+ */
284
+ export function planetNeeds(input) {
285
+ const needs = new Set();
286
+ const paths = [];
287
+ let throughLedger = false;
288
+ for (const upload of input.uploads ?? []) {
289
+ const path = String((typeof upload === 'string' ? upload : upload?.path) ?? '');
290
+ const kind = assetKindOf(path);
291
+ if (!kind)
292
+ continue;
293
+ paths.push(path);
294
+ needs.add(KIND_CAPABILITY[kind]);
295
+ if (kind === 'texture' && path.toLowerCase().endsWith('.ktx2'))
296
+ needs.add('ktx2');
297
+ if (kind === 'model' && typeof upload !== 'string')
298
+ for (const need of extensionNeeds(upload?.extensionsRequired))
299
+ needs.add(need);
300
+ const reason = typeof upload === 'string' ? undefined : upload?.reason;
301
+ if (reason !== 'scene' && reason !== 'config')
302
+ throughLedger = true;
303
+ }
304
+ if (input.ledger !== undefined && input.ledger !== null && paths.length > 0) {
305
+ const loaded = new Set(input.code ? collectCodeAssets(input.code) : []);
306
+ if (throughLedger || paths.some((p) => loaded.has(p)))
307
+ needs.add('ledger');
308
+ const files = isObj(input.ledger) && isObj(input.ledger.files) ? input.ledger.files : {};
309
+ const credited = paths.some((p) => {
310
+ const entry = Object.prototype.hasOwnProperty.call(files, p) ? files[p] : null;
311
+ if (!isObj(entry) || !isObj(entry.license) || typeof entry.license.spdx !== 'string')
312
+ return false;
313
+ const verdict = licenseVerdict(entry.license);
314
+ return verdict.ok && verdict.credit;
315
+ });
316
+ if (credited)
317
+ needs.add('credits');
318
+ }
319
+ const config = isObj(input.config) ? input.config : {};
320
+ const look = isObj(config.look) ? config.look : null;
321
+ if (look && Object.keys(look).some((key) => look[key] !== undefined))
322
+ needs.add('look');
323
+ if (isObj(config.sky) && config.sky.kind === 'hdri')
324
+ needs.add('hdri');
325
+ if (isObj(config.sky) && config.sky.kind === 'physical')
326
+ needs.add('physical-sky');
327
+ if (isObj(input.config) && (config.tiles === undefined || config.tiles === null))
328
+ needs.add('open-world');
329
+ if (look && isObj(look.style) && Object.values(look.style).some((technique) => isObj(technique)))
330
+ needs.add('drawn-look');
331
+ if (Array.isArray(config.items) && config.items.length > 0)
332
+ needs.add('items');
333
+ const grade = look && isObj(look.grade) ? look.grade : null;
334
+ if (grade && isObj(grade.lut) && typeof grade.lut.asset === 'string')
335
+ needs.add('lut');
336
+ const fog = isObj(config.fog) ? config.fog : null;
337
+ if (fog && ['mode', 'density', 'height', 'heightDensity'].some((key) => fog[key] !== undefined))
338
+ needs.add('look');
339
+ const player = isObj(config.player) ? config.player : null;
340
+ if (player && PLAYER_SCALE_KEYS.some((key) => player[key] !== undefined))
341
+ needs.add('player-scale');
342
+ return CAPABILITIES.filter((c) => needs.has(c));
343
+ }
344
+ /** The needs the other side does not offer, in the order they were needed,
345
+ * each once. Strings, not Capability: a newer side may name one this
346
+ * package has never heard of, and that one is missing too. */
347
+ export function missingCapabilities(needs, offered) {
348
+ const out = [];
349
+ for (const need of needs) {
350
+ if (!offered.includes(need) && !out.includes(need))
351
+ out.push(need);
352
+ }
353
+ return out;
354
+ }
355
+ /** A capability in words ("textures", "an asset ledger"); one this package
356
+ * does not know is its own name. */
357
+ export function capabilityName(capability) {
358
+ return Object.prototype.hasOwnProperty.call(CAPABILITY_NAMES, capability)
359
+ ? CAPABILITY_NAMES[capability]
360
+ : capability;
361
+ }
362
+ function listed(items, conjunction) {
363
+ if (items.length <= 1)
364
+ return items[0] ?? '';
365
+ return `${items.slice(0, -1).join(', ')} ${conjunction} ${items[items.length - 1]}`;
366
+ }
367
+ /** The sentence a creator reads when the server or the player is older than
368
+ * what they are publishing with:
369
+ *
370
+ * The nowhere server is older than this studio: it does not take textures
371
+ * yet. Nothing was uploaded.
372
+ * The nowhere player is older than this studio: a planet with textures or
373
+ * look settings would not play there yet. Nothing was uploaded. */
374
+ export function olderSentence(side, missing, opts = {}) {
375
+ const than = opts.than ?? 'this studio';
376
+ const what = listed(missing.map(capabilityName), 'or');
377
+ const first = side === 'server'
378
+ ? `The Oda server is older than ${than}: it does not take ${what} yet.`
379
+ : `The Oda player is older than ${than}: a planet with ${what} would not play there yet.`;
380
+ return opts.nothingUploaded === false ? first : `${first} Nothing was uploaded.`;
381
+ }
382
+ /** What the player shows in place of a planet that needs more than it plays:
383
+ * "This planet needs a newer nowhere player: textures." */
384
+ export function playerNotice(missing) {
385
+ return `This planet needs a newer Oda player: ${missing.map(capabilityName).join(', ')}.`;
386
+ }
387
+ // ---------------------------------------------------------------------------
388
+ // the SDK a player hands a planet
389
+ // ---------------------------------------------------------------------------
390
+ /** What @nowhere/sdk exports in the player of a site from before contract 3:
391
+ * /play/sdk@1.js as world 0de0986 serves it (read 2026-10-23). It is what a
392
+ * player that says nothing about itself is taken to have, as
393
+ * LEGACY_CAPABILITIES is for what it plays. It lacks seven names the SDK
394
+ * has gained since (createAssetHost, createLook, listenToThree, pickTier,
395
+ * watchMaterials, LOOK_PIPELINE_VERSION, WEBGL_ONLY) and still has DAYLIGHT,
396
+ * which the SDK no longer exports: the surface shrinks as well as grows, so
397
+ * it is compared name by name, never by a count or a level. Marked pure so
398
+ * the player's sdk@1.js, which bundles this package, leaves it out. */
399
+ export const LEGACY_SDK_EXPORTS = /* @__PURE__ */ Object.freeze([
400
+ 'DAYLIGHT',
401
+ 'MAP_CURVE_SEGMENTS',
402
+ 'TRANSIT',
403
+ 'WORLD_KEY',
404
+ 'World',
405
+ 'boundsOf',
406
+ 'createLocalPilot',
407
+ 'disposeTree',
408
+ 'isOnMap',
409
+ 'loadCharacter',
410
+ 'mapClipPlanes',
411
+ 'mapCornerRadius',
412
+ 'mapEdgeAt',
413
+ 'mapSide',
414
+ 'normalizeGive',
415
+ 'normalizeTake',
416
+ 'roundedRectGridGeometry',
417
+ 'roundedRectShape',
418
+ 'skyEnvironment',
419
+ 'softShadowFilter',
420
+ ]);
421
+ /** The names a planet's code reads from @nowhere/sdk (checkBundle's sdk)
422
+ * that the player's SDK does not export, in the order they were read, each
423
+ * once. */
424
+ export function missingSdkExports(used, exported) {
425
+ return missingCapabilities(used, exported);
426
+ }
427
+ /** The sentence a creator reads when the player's SDK lacks names the
428
+ * planet's code reads:
429
+ *
430
+ * The nowhere player is older than this studio: its @nowhere/sdk has no
431
+ * listenToThree yet, which this planet's code uses. Nothing was uploaded. */
432
+ export function olderSdkSentence(missing, opts = {}) {
433
+ const than = opts.than ?? 'this studio';
434
+ const first = `The Oda player is older than ${than}: its @nowhere/sdk has no ${listed(missing, 'or')} yet, which this planet's code uses.`;
435
+ return opts.nothingUploaded === false ? first : `${first} Nothing was uploaded.`;
436
+ }
437
+ // ---------------------------------------------------------------------------
438
+ // what a server and a player say about themselves
439
+ // ---------------------------------------------------------------------------
440
+ const BuildStamp = z.object({
441
+ /** The engine commit the rules were built from ('-dirty' when they had
442
+ * uncommitted changes), or 'unknown'. */
443
+ engine: z.string().min(1).max(80),
444
+ /** The world commit that was deployed, or 'unknown'. */
445
+ world: z.string().min(1).max(80),
446
+ });
447
+ /** GET on the publish function. Capabilities are plain strings so a newer
448
+ * server's list still parses here; what this side does not know is simply
449
+ * never needed by it. */
450
+ export const PublishInfo = z.object({
451
+ schema: z.literal('nowhere/publish-info@1'),
452
+ contract: z.number().int().min(1),
453
+ capabilities: z.array(z.string().min(1).max(40)).max(64),
454
+ /** LIMITS, and each kind's ceiling on one file as <kind>FileMb. */
455
+ limits: z.record(z.string(), z.number()),
456
+ build: BuildStamp,
457
+ });
458
+ /** /play/capabilities.json on the site: what its player plays. */
459
+ export const PlayerInfo = z.object({
460
+ schema: z.literal('nowhere/player-info@1'),
461
+ contract: z.number().int().min(1),
462
+ capabilities: z.array(z.string().min(1).max(40)).max(64),
463
+ /** The names its /play/sdk@1.js exports, which a planet's code may read
464
+ * from @nowhere/sdk. Absent, they are not known, and not compared. */
465
+ sdk: z.array(z.string().min(1).max(80)).max(1024).optional(),
466
+ build: BuildStamp,
467
+ });
468
+ /** The numbers a server enforces, flat: LIMITS and every kind's ceiling. */
469
+ export function publishLimits() {
470
+ const out = { ...LIMITS };
471
+ for (const kind of Object.keys(ASSET_KINDS))
472
+ out[`${kind}FileMb`] = ASSET_KINDS[kind].fileMb;
473
+ return out;
474
+ }
475
+ const stamp = (build = {}) => ({
476
+ engine: build.engine?.trim() || 'unknown',
477
+ world: build.world?.trim() || 'unknown',
478
+ });
479
+ /** The publish function's answer to GET, for this contract. */
480
+ export function publishInfo(build = {}) {
481
+ return {
482
+ schema: 'nowhere/publish-info@1',
483
+ contract: PUBLISH_CONTRACT,
484
+ capabilities: [...SERVER_CAPABILITIES],
485
+ limits: publishLimits(),
486
+ build: stamp(build),
487
+ };
488
+ }
489
+ /** The site's /play/capabilities.json, for this contract. `sdk` is what the
490
+ * site's sdk@1.js exports (read from the chunk it serves), left out when
491
+ * not given. */
492
+ export function playerInfo(build = {}, extra = {}) {
493
+ return {
494
+ schema: 'nowhere/player-info@1',
495
+ contract: PUBLISH_CONTRACT,
496
+ capabilities: [...PLAYER_CAPABILITIES],
497
+ ...(extra.sdk ? { sdk: [...extra.sdk] } : {}),
498
+ build: stamp(build),
499
+ };
500
+ }
501
+ export function parsePublishInfo(raw) {
502
+ const parsed = PublishInfo.safeParse(raw);
503
+ return parsed.success ? parsed.data : null;
504
+ }
505
+ export function parsePlayerInfo(raw) {
506
+ const parsed = PlayerInfo.safeParse(raw);
507
+ return parsed.success ? parsed.data : null;
508
+ }
509
+ const LEGACY_STATUSES = [200, 400, 404, 405];
510
+ function readReply(status, body, parse) {
511
+ const info = status === 200 ? parse(body) : null;
512
+ if (info)
513
+ return { state: 'current', info, capabilities: info.capabilities };
514
+ if (LEGACY_STATUSES.includes(status))
515
+ return { state: 'legacy', capabilities: LEGACY_CAPABILITIES };
516
+ return { state: 'unknown', reason: `answered ${status}` };
517
+ }
518
+ /** A reply to GET on the publish function (status, and its JSON or null). */
519
+ export function readPublishInfoReply(status, body) {
520
+ return readReply(status, body, parsePublishInfo);
521
+ }
522
+ /** A reply to GET /play/capabilities.json (status, and its JSON or null). */
523
+ export function readPlayerInfoReply(status, body) {
524
+ return readReply(status, body, parsePlayerInfo);
525
+ }
526
+ /** What @nowhere/sdk exports in a player, by what it said about itself: its
527
+ * info's list, LEGACY_SDK_EXPORTS for a site from before contract 3, and
528
+ * null when it is not known (no answer, or a player that does not list
529
+ * them), which compares nothing. */
530
+ export function playerSdkOf(reading) {
531
+ if (!reading)
532
+ return null;
533
+ if (reading.state === 'legacy')
534
+ return LEGACY_SDK_EXPORTS;
535
+ if (reading.state === 'current')
536
+ return reading.info.sdk ?? null;
537
+ return null;
538
+ }
539
+ // ---------------------------------------------------------------------------
540
+ // which files travel
541
+ // ---------------------------------------------------------------------------
542
+ const SCENE_FILE = 'scene.json';
543
+ const CONFIG_FILE = 'game.config.json';
544
+ /** The files the game's code names as plain strings ('assets/grass.png'),
545
+ * which it loads through ctx.assets: paths a planet may carry, sorted, each
546
+ * once. A path the code builds while it runs is not seen here. */
547
+ export function collectCodeAssets(code) {
548
+ const named = new Set();
549
+ for (const m of String(code ?? '').matchAll(/["'`](assets\/[A-Za-z0-9_][A-Za-z0-9._-]*)["'`]/g)) {
550
+ if (isPublishablePath(m[1]))
551
+ named.add(m[1]);
552
+ }
553
+ return [...named].sort();
554
+ }
555
+ /**
556
+ * Which files travel with a publish: the one rule, for the client that picks
557
+ * them and the server that takes them.
558
+ *
559
+ * a model when the scene places it, or the ledger records it
560
+ * any other when the ledger records it, or the config names it
561
+ *
562
+ * A client picks, on top of that, every file the ledger lists for publishing
563
+ * (publish not false) except the 'legacy' ones, the files that sat in
564
+ * assets/ before the ledger began: those travel only when the scene, the
565
+ * config or the code names them, so starting a ledger never adds files an
566
+ * older planet did not use. A file the code names travels when the ledger
567
+ * records it; one it does not record is a problem (a project with no ledger
568
+ * at all starts one, which records it). A server takes what was sent when
569
+ * the rule above admits it, and refuses the rest: a part nothing names is a
570
+ * stranger's file in a public bucket.
571
+ *
572
+ * Both refuse a scene that places something other than a model, and a path
573
+ * that could climb out of assets/ (isPublishablePath). Sizes are
574
+ * assetSizeProblems' business and licences checkLedger's.
575
+ */
576
+ export function admitUploads(input) {
577
+ const mode = input.mode ?? 'pick';
578
+ const ledger = input.ledger ?? null;
579
+ const ledgerFiles = ledger?.files ?? {};
580
+ const recorded = (path) => Object.prototype.hasOwnProperty.call(ledgerFiles, path) && ledgerFiles[path] != null;
581
+ const hasScene = input.scene !== undefined;
582
+ const sceneAssets = collectSceneAssets(input.scene);
583
+ const problems = [];
584
+ const say = (code, path, message) => problems.push({ code, path, message });
585
+ const uploads = [];
586
+ const admit = (file, reason) => uploads.push({
587
+ path: file.path,
588
+ bytes: file.bytes,
589
+ ...(file.sha256 ? { sha256: file.sha256 } : {}),
590
+ ...(file.extensionsRequired ? { extensionsRequired: [...file.extensionsRequired] } : {}),
591
+ kind: assetKindOf(file.path),
592
+ reason,
593
+ });
594
+ if (mode === 'check') {
595
+ const sent = new Map();
596
+ for (const file of input.files) {
597
+ if (!isPublishablePath(file.path)) {
598
+ say('admit:path', file.path, `${file.path} is not a file a planet carries, directly inside assets/`);
599
+ continue;
600
+ }
601
+ // A repeated part would be weighed twice and uploaded twice; a client
602
+ // sends one part per file, so this is never an honest request.
603
+ if (sent.has(file.path)) {
604
+ say('admit:duplicate', file.path, `${file.path} was sent more than once`);
605
+ continue;
606
+ }
607
+ sent.set(file.path, file);
608
+ }
609
+ for (const path of sceneAssets) {
610
+ if (!isAssetPath(path))
611
+ say('admit:not-model', path, `${SCENE_FILE} places ${path}, which is not a model file directly inside assets/`);
612
+ else if (!sent.has(path))
613
+ say('admit:missing', path, `${SCENE_FILE} places ${path}, which was not sent`);
614
+ }
615
+ const placed = new Set(sceneAssets);
616
+ const named = new Set(collectConfigAssets(input.config));
617
+ for (const file of sent.values()) {
618
+ const model = assetKindOf(file.path) === 'model';
619
+ const reason = model
620
+ ? placed.has(file.path)
621
+ ? 'scene'
622
+ : recorded(file.path)
623
+ ? 'ledger'
624
+ : null
625
+ : recorded(file.path)
626
+ ? 'ledger'
627
+ : named.has(file.path)
628
+ ? 'config'
629
+ : null;
630
+ if (reason) {
631
+ admit(file, reason);
632
+ continue;
633
+ }
634
+ say('admit:unnamed', file.path, !model
635
+ ? `${file.path} was sent but neither ${LEDGER_FILE} nor ${CONFIG_FILE} names it`
636
+ : hasScene
637
+ ? `${file.path} was sent but ${SCENE_FILE} does not place it`
638
+ : `${file.path} was sent without a ${SCENE_FILE} to place it`);
639
+ }
640
+ return { uploads, problems, left: [], absent: [], sceneAssets };
641
+ }
642
+ const available = new Map();
643
+ for (const file of input.files)
644
+ if (!available.has(file.path))
645
+ available.set(file.path, file);
646
+ const wanted = new Map();
647
+ const absent = [];
648
+ for (const path of sceneAssets) {
649
+ if (!isAssetPath(path))
650
+ say('admit:not-model', path, `${SCENE_FILE} places "${path}", which is not a model file directly inside assets/.`);
651
+ else if (!available.has(path))
652
+ say('admit:missing', path, `${SCENE_FILE} places "${path}", but that file is not in the project.`);
653
+ else
654
+ wanted.set(path, 'scene');
655
+ }
656
+ for (const [path, entry] of Object.entries(ledgerFiles)) {
657
+ if (!entry || wanted.has(path) || !isPublishablePath(path) || entry.publish === false || entry.origin === 'legacy')
658
+ continue;
659
+ if (available.has(path))
660
+ wanted.set(path, 'ledger');
661
+ else
662
+ absent.push(path);
663
+ }
664
+ for (const path of collectConfigAssets(input.config)) {
665
+ if (wanted.has(path))
666
+ continue;
667
+ if (!isPublishablePath(path)) {
668
+ say('admit:path', path, `${CONFIG_FILE} names "${path}", which is not a file a planet may carry (one texture, HDRI, sound, LUT or model directly inside assets/).`);
669
+ }
670
+ else if (!available.has(path)) {
671
+ say('admit:missing', path, `${CONFIG_FILE} needs "${path}", but that file is not in the project.`);
672
+ }
673
+ else {
674
+ wanted.set(path, 'config');
675
+ }
676
+ }
677
+ for (const path of collectCodeAssets(input.code ?? '')) {
678
+ // Named but not there: the game says so itself when it loads it.
679
+ if (wanted.has(path) || !available.has(path))
680
+ continue;
681
+ if (!recorded(path)) {
682
+ say('admit:unrecorded', path, ledger
683
+ ? `The game's code loads ${path}, which is not in ${LEDGER_FILE}, so nothing records where it came from or its licence. Bring it in with asset_import, which records both.`
684
+ : `The game's code loads ${path}, which a planet carries only when ${LEDGER_FILE} records it, and this project keeps no ledger yet.`);
685
+ continue;
686
+ }
687
+ wanted.set(path, 'code');
688
+ }
689
+ for (const [path, reason] of wanted)
690
+ admit(available.get(path), reason);
691
+ const left = [...available.keys()].filter((path) => !wanted.has(path));
692
+ return { uploads, problems, left, absent, sceneAssets };
693
+ }
694
+ /** The publish view of a ledger (publishLock), cut to the files that travel:
695
+ * what the server is sent beside them. */
696
+ export function publishLockFor(lock, paths) {
697
+ const keep = new Set(paths);
698
+ const view = publishLock(lock);
699
+ view.files = Object.fromEntries(Object.entries(view.files).filter(([path]) => keep.has(path)));
700
+ return view;
701
+ }
702
+ // ---------------------------------------------------------------------------
703
+ // what a parse dropped
704
+ // ---------------------------------------------------------------------------
705
+ /** Keys the config schema once had and drops on purpose, so a project from
706
+ * before still opens: the deploy block, and look.preset from before there
707
+ * were no presets. Never reported as unknown. */
708
+ export const RETIRED_CONFIG_KEYS = Object.freeze(['deploy', 'look.preset']);
709
+ /** The keys a zod parse dropped: every key of an object in `raw` that is
710
+ * missing from the same object in `parsed`, at any depth (look, fog, sky,
711
+ * player, a scene's objects), as dotted paths ("look.toneMap",
712
+ * "objects.3.tint"). Keys the parse added (defaults) are not reported.
713
+ * `ignore` takes dotted paths, with * standing for any array index. */
714
+ export function strippedKeys(raw, parsed, opts = {}) {
715
+ const ignore = new Set(opts.ignore ?? []);
716
+ const out = [];
717
+ const skip = (path) => ignore.has(path) || ignore.has(path.replace(/(^|\.)\d+(?=\.|$)/g, '$1*'));
718
+ const walk = (a, b, prefix) => {
719
+ if (Array.isArray(a) && Array.isArray(b)) {
720
+ for (let i = 0; i < Math.min(a.length, b.length); i++)
721
+ walk(a[i], b[i], prefix ? `${prefix}.${i}` : String(i));
722
+ return;
723
+ }
724
+ if (!isObj(a) || !isObj(b))
725
+ return;
726
+ for (const key of Object.keys(a)) {
727
+ const path = prefix ? `${prefix}.${key}` : key;
728
+ if (!Object.prototype.hasOwnProperty.call(b, key)) {
729
+ if (!skip(path))
730
+ out.push(path);
731
+ continue;
732
+ }
733
+ walk(a[key], b[key], path);
734
+ }
735
+ };
736
+ walk(raw, parsed, '');
737
+ return out;
738
+ }
739
+ /** The keys of a game.config.json this schema does not know, retired ones
740
+ * aside. Empty for a config that does not parse: its findings say more. */
741
+ export function unknownConfigKeys(raw) {
742
+ const parsed = GameConfig.safeParse(raw);
743
+ return parsed.success ? strippedKeys(raw, parsed.data, { ignore: RETIRED_CONFIG_KEYS }) : [];
744
+ }
745
+ /** The same for scene.json, against the parse before validateScene fills in
746
+ * kinds and drops a normalize that is not false. One path per key, with *
747
+ * for the object's index, so two thousand placements say it once. */
748
+ export function unknownSceneKeys(raw) {
749
+ if (raw === undefined || raw === null)
750
+ return [];
751
+ const parsed = SceneDoc.safeParse(raw);
752
+ if (!parsed.success)
753
+ return [];
754
+ return [...new Set(strippedKeys(raw, parsed.data).map((p) => p.replace(/(^|\.)\d+(?=\.|$)/g, '$1*')))];
755
+ }
756
+ /** The UTF-8 length of a string, without TextEncoder (this package's lib is
757
+ * ES2022 alone, and it runs in Deno, Node and the browser). */
758
+ export function utf8Bytes(text) {
759
+ let n = 0;
760
+ for (let i = 0; i < text.length; i++) {
761
+ const c = text.charCodeAt(i);
762
+ if (c < 0x80)
763
+ n += 1;
764
+ else if (c < 0x800)
765
+ n += 2;
766
+ else if (c >= 0xd800 && c <= 0xdbff && i + 1 < text.length) {
767
+ const next = text.charCodeAt(i + 1);
768
+ if (next >= 0xdc00 && next <= 0xdfff) {
769
+ n += 4;
770
+ i++;
771
+ }
772
+ else
773
+ n += 3;
774
+ }
775
+ else
776
+ n += 3;
777
+ }
778
+ return n;
779
+ }
780
+ const kbOf = (bytes) => Math.max(1, Math.ceil(bytes / 1024));
781
+ /**
782
+ * Everything the publish function checks on a request before it records
783
+ * anything, in the order it checks it, as a pure function of the request.
784
+ * The function answers `refusal` when there is one, its dry run answers
785
+ * `findings`, and a client runs it on the request it is about to send. The
786
+ * sentences are the function's, word for word, so a studio from before this
787
+ * file reads the same answers it always has.
788
+ *
789
+ * needs the request states that this server does not offer contract_mismatch
790
+ * a part's path, a part sent twice bad_request
791
+ * one file over its kind's ceiling budget_exceeded
792
+ * main.js, game.config.json, preview.png, splat.bin sizes budget_exceeded
793
+ * splat.bin's header schema
794
+ * the config schema
795
+ * a config key this schema does not know unknown_fields
796
+ * the ledger's size and its publish view budget_exceeded, schema
797
+ * the scene, then a scene key it does not know schema, unknown_fields
798
+ * which files may travel (admitUploads) bad_request
799
+ * the ledger's verdict on each ledger
800
+ * the sounds and the files in total budget_exceeded
801
+ * the bundle's gates contract:*
802
+ * needs this planet has that this server does not offer contract_mismatch
803
+ */
804
+ export function checkPublish(req, opts = {}) {
805
+ const steps = [];
806
+ const detail = (status, error, code, message, path) => steps.push({ status, findings: [{ error, code, ...(path ? { path } : {}), message }], body: { error, detail: message } });
807
+ const listedFindings = (status, error, items, body, file) => steps.push({
808
+ status,
809
+ findings: items.map((f) => {
810
+ const path = file && f.path !== undefined && !f.path.startsWith(file) ? `${file}:${f.path}` : f.path;
811
+ return { error, code: f.code, ...(path ? { path } : {}), message: f.message };
812
+ }),
813
+ body,
814
+ });
815
+ const mismatch = (missing) => {
816
+ const message = `The Oda server does not take ${listed(missing.map(capabilityName), 'or')} yet (it speaks publish contract ${PUBLISH_CONTRACT}).`;
817
+ steps.push({
818
+ status: 400,
819
+ findings: missing.map((m) => ({ error: 'contract_mismatch', code: 'contract_mismatch', message: `This server does not take ${capabilityName(m)} yet.` })),
820
+ body: { error: 'contract_mismatch', missing, contract: PUBLISH_CONTRACT, detail: message },
821
+ });
822
+ };
823
+ const unknown = (fields) => {
824
+ const message = `${fields.join(', ')} ${fields.length === 1 ? 'is a field' : 'are fields'} this Oda server does not know, and publishing would drop ${fields.length === 1 ? 'it' : 'them'}.`;
825
+ steps.push({
826
+ status: 400,
827
+ findings: fields.map((f) => ({ error: 'unknown_fields', code: 'unknown_fields', path: f, message: `${f} is a field this Oda server does not know.` })),
828
+ body: { error: 'unknown_fields', fields, detail: message },
829
+ });
830
+ };
831
+ // 0) a planet that says it needs what this server cannot do
832
+ if (opts.offered && opts.declaredNeeds) {
833
+ const missing = missingCapabilities(opts.declaredNeeds, opts.offered);
834
+ if (missing.length > 0)
835
+ mismatch(missing);
836
+ }
837
+ // 1) the files' names, then each one's own ceiling. Whether the set is the
838
+ // right set waits for the scene and the ledger, below.
839
+ const sceneSent = req.scene !== undefined;
840
+ const ledgerSent = req.ledger !== undefined;
841
+ const sent = new Map();
842
+ for (const file of req.files) {
843
+ if (isPublishablePath(file.path) && !sent.has(file.path))
844
+ sent.set(file.path, file);
845
+ }
846
+ const names = admitUploads({ mode: 'check', files: req.files });
847
+ for (const p of names.problems) {
848
+ if (p.code === 'admit:path' || p.code === 'admit:duplicate')
849
+ detail(400, 'bad_request', p.code, p.message, p.path);
850
+ }
851
+ for (const file of sent.values()) {
852
+ const [tooBig] = assetSizeProblems([{ path: file.path, bytes: file.bytes }]);
853
+ if (tooBig)
854
+ detail(413, 'budget_exceeded', tooBig.code, tooBig.message, file.path);
855
+ }
856
+ // 2) the documents' sizes
857
+ const bundleBytes = req.bundleBytes ?? utf8Bytes(req.bundle);
858
+ if (bundleBytes > LIMITS.bundleKb * 1024) {
859
+ detail(413, 'budget_exceeded', 'budget:bundle', `main.js is ${kbOf(bundleBytes)} KB, limit ${LIMITS.bundleKb} KB`, 'main.js');
860
+ }
861
+ const checked = validateConfig(req.config);
862
+ const config = checked.ok && checked.config ? checked.config : null;
863
+ const configBytes = req.configBytes ?? utf8Bytes(JSON.stringify(config ?? req.config ?? null, null, 2));
864
+ if (configBytes > LIMITS.configKb * 1024) {
865
+ detail(413, 'budget_exceeded', 'budget:config', `${CONFIG_FILE} is ${kbOf(configBytes)} KB, limit ${LIMITS.configKb} KB`, CONFIG_FILE);
866
+ }
867
+ if (req.preview) {
868
+ if (req.preview.bytes > LIMITS.previewKb * 1024) {
869
+ detail(413, 'budget_exceeded', 'budget:preview', `preview.png is ${kbOf(req.preview.bytes)} KB, limit ${LIMITS.previewKb} KB`, 'preview.png');
870
+ }
871
+ if (req.preview.png === false)
872
+ detail(413, 'budget_exceeded', 'preview:png', 'preview.png is not a PNG', 'preview.png');
873
+ }
874
+ if (req.splat) {
875
+ if (req.splat.bytes > LIMITS.splatKb * 1024) {
876
+ detail(413, 'budget_exceeded', 'budget:splat', `${SPLAT_FILE} is ${kbOf(req.splat.bytes)} KB, limit ${LIMITS.splatKb} KB`, SPLAT_FILE);
877
+ }
878
+ const verdict = req.splat.verdict;
879
+ if (verdict && !verdict.ok) {
880
+ const finding = { path: SPLAT_FILE, code: 'schema', message: verdict.error ?? 'not an Oda splat' };
881
+ listedFindings(422, 'schema', [finding], { error: 'schema', findings: [finding] });
882
+ }
883
+ }
884
+ // 3) the config, and what this schema would drop from it
885
+ if (!config)
886
+ listedFindings(422, 'schema', checked.findings, { error: 'schema', findings: checked.findings });
887
+ const unknownFields = [];
888
+ if (config) {
889
+ const keys = unknownConfigKeys(req.config).map((k) => `${CONFIG_FILE}:${k}`);
890
+ unknownFields.push(...keys);
891
+ if (keys.length > 0 && opts.unknownFields !== 'ignore')
892
+ unknown(keys);
893
+ }
894
+ // 4) the ledger's publish view, when the project keeps one
895
+ let lock = null;
896
+ if (ledgerSent) {
897
+ if (req.ledgerBytes !== undefined && req.ledgerBytes > LIMITS.ledgerKb * 1024) {
898
+ detail(413, 'budget_exceeded', 'budget:ledger', `${LEDGER_FILE} is ${kbOf(req.ledgerBytes)} KB, limit ${LIMITS.ledgerKb} KB`, LEDGER_FILE);
899
+ }
900
+ const parsed = parsePublishLock(req.ledger);
901
+ if (parsed.ok)
902
+ lock = parsed.lock;
903
+ else {
904
+ const finding = { path: LEDGER_FILE, code: 'schema', message: parsed.error };
905
+ listedFindings(422, 'schema', [finding], { error: 'schema', findings: [finding] });
906
+ }
907
+ }
908
+ // 5) the scene
909
+ let scene = null;
910
+ if (sceneSent) {
911
+ const checkedScene = validateScene(req.scene);
912
+ if (checkedScene.ok)
913
+ scene = checkedScene.scene;
914
+ else
915
+ listedFindings(422, 'schema', checkedScene.findings, { error: 'schema', findings: checkedScene.findings }, SCENE_FILE);
916
+ if (checkedScene.ok) {
917
+ const keys = unknownSceneKeys(req.scene).map((k) => `${SCENE_FILE}:${k}`);
918
+ unknownFields.push(...keys);
919
+ if (keys.length > 0 && opts.unknownFields !== 'ignore')
920
+ unknown(keys);
921
+ }
922
+ }
923
+ // 6) which files may travel. A view that did not parse has been refused
924
+ // above; every file then counts as recorded, so it is not refused twice.
925
+ const everything = { files: Object.fromEntries([...sent.keys()].map((p) => [p, {}])) };
926
+ const admitted = admitUploads({
927
+ mode: 'check',
928
+ scene: sceneSent ? (scene ?? req.scene) : undefined,
929
+ config: config ?? req.config,
930
+ ledger: lock ?? (ledgerSent ? everything : null),
931
+ files: req.files,
932
+ });
933
+ for (const p of admitted.problems) {
934
+ if (p.code !== 'admit:path' && p.code !== 'admit:duplicate')
935
+ detail(400, 'bad_request', p.code, p.message, p.path);
936
+ }
937
+ // 7) the ledger's verdict on every file that travels: on sizes, and on
938
+ // hashes where the request gives them (a dry run's descriptors may)
939
+ if (lock) {
940
+ const findings = checkLedger(lock, admitted.uploads, { creditsShown: CREDITS_SHOWN });
941
+ if (findings.length > 0)
942
+ listedFindings(422, 'ledger', findings, { error: 'ledger', findings });
943
+ }
944
+ // 8) weight, as one total for the planet, and the sounds within it
945
+ const files = [...sent.values()];
946
+ const assetBytes = files.reduce((n, f) => n + f.bytes, 0);
947
+ const totals = assetSizeProblems(files).filter((f) => f.code === 'budget:audio' || f.code === 'budget:total');
948
+ for (const t of totals)
949
+ detail(413, 'budget_exceeded', t.code, t.message);
950
+ const budget = assetsBudgetBytes(config?.tiles);
951
+ if (assetBytes > budget && !totals.some((t) => t.code === 'budget:total')) {
952
+ detail(413, 'budget_exceeded', 'budget:total', `the files come to ${assetBytes} bytes; a planet carries ${budget} bytes`);
953
+ }
954
+ // 9) the bundle's gates
955
+ const gates = checkBundle(req.bundle);
956
+ if (!gates.ok)
957
+ listedFindings(422, gates.findings[0].code, gates.findings, { error: gates.findings[0].code, findings: gates.findings });
958
+ // 10) what this planet needs, from what was sent
959
+ const needs = planetNeeds({ uploads: admitted.uploads, config: config ?? req.config, ledger: ledgerSent ? req.ledger : undefined, code: req.bundle });
960
+ if (opts.offered) {
961
+ const already = opts.declaredNeeds ? missingCapabilities(opts.declaredNeeds, opts.offered) : [];
962
+ const missing = missingCapabilities(needs, opts.offered).filter((m) => !already.includes(m));
963
+ if (missing.length > 0)
964
+ mismatch(missing);
965
+ }
966
+ const first = steps[0];
967
+ return {
968
+ ok: steps.length === 0,
969
+ refusal: first ? { status: first.status, body: first.body } : null,
970
+ findings: steps.flatMap((s) => s.findings),
971
+ config,
972
+ scene,
973
+ sceneSent,
974
+ lock,
975
+ sceneAssets: admitted.sceneAssets,
976
+ uploads: admitted.uploads,
977
+ needs,
978
+ requires: gates.requires,
979
+ sdk: gates.sdk,
980
+ unknownFields,
981
+ assetBytes,
982
+ };
983
+ }
984
+ // ---------------------------------------------------------------------------
985
+ // the dry run
986
+ // ---------------------------------------------------------------------------
987
+ /** The 'files' part of a dry run: the files under assets/ as descriptors,
988
+ * so a client can ask whether a planet would be taken without sending it.
989
+ * A model's descriptor may say the glTF extensions it requires, which the
990
+ * dry run takes at its word, as it takes the bytes: a real publish reads
991
+ * them from the file. A server from before contract 4 drops the field. */
992
+ export const FileDescriptors = z
993
+ .array(z.object({
994
+ path: z.string().min(1).max(400),
995
+ bytes: z.number().int().nonnegative(),
996
+ sha256: z
997
+ .string()
998
+ .regex(/^[0-9a-f]{64}$/)
999
+ .optional(),
1000
+ extensionsRequired: z.array(z.string().min(1).max(64)).max(32).optional(),
1001
+ }))
1002
+ .max(1000);
1003
+ export function parseFileDescriptors(raw) {
1004
+ const parsed = FileDescriptors.safeParse(raw);
1005
+ if (parsed.success)
1006
+ return { ok: true, files: parsed.data };
1007
+ const first = parsed.error.issues[0];
1008
+ return { ok: false, error: `files${first?.path.length ? '.' + first.path.join('.') : ''}: ${first?.message ?? 'not valid'}` };
1009
+ }
1010
+ /** What the function answers a dry run: the verdict a real publish of the
1011
+ * same request would get, and nothing written. */
1012
+ export const DryRunAnswer = z.object({
1013
+ ok: z.boolean(),
1014
+ contract: z.number().int(),
1015
+ needs: z.array(z.string()),
1016
+ uploads: z.array(z.object({ path: z.string(), kind: z.string(), reason: z.string(), bytes: z.number() })),
1017
+ findings: z.array(z.object({ error: z.string(), code: z.string(), path: z.string().optional(), message: z.string() })),
1018
+ /** The answer the real publish would give, when it would refuse. */
1019
+ refusal: z.object({ status: z.number(), body: z.record(z.string(), z.unknown()) }).nullable(),
1020
+ });
1021
+ export function dryRunAnswer(verdict) {
1022
+ return {
1023
+ ok: verdict.ok,
1024
+ contract: PUBLISH_CONTRACT,
1025
+ needs: [...verdict.needs],
1026
+ uploads: verdict.uploads.map((u) => ({ path: u.path, kind: u.kind, reason: u.reason, bytes: u.bytes })),
1027
+ findings: verdict.findings.map((f) => ({ error: f.error, code: f.code, ...(f.path ? { path: f.path } : {}), message: f.message })),
1028
+ refusal: verdict.refusal ? { status: verdict.refusal.status, body: { ...verdict.refusal.body } } : null,
1029
+ };
1030
+ }
1031
+ export function parseDryRunAnswer(raw) {
1032
+ const parsed = DryRunAnswer.safeParse(raw);
1033
+ return parsed.success ? parsed.data : null;
1034
+ }
1035
+ /**
1036
+ * A client's pre-flight on a project: the documents, which files travel
1037
+ * (admitUploads), the request that would go up, and checkPublish on that
1038
+ * request, the very check the function will run. The studio's Publish
1039
+ * button and `nowhere check` both run this, so they cannot say different
1040
+ * things about the same project. Pure: reading the disk, hashing the files
1041
+ * and starting a ledger are the caller's.
1042
+ */
1043
+ export function preparePublish(project) {
1044
+ const findings = [];
1045
+ const result = (extra = {}) => ({
1046
+ ok: false,
1047
+ findings,
1048
+ config: null,
1049
+ configText: null,
1050
+ scene: null,
1051
+ sceneText: null,
1052
+ ledgerText: null,
1053
+ uploads: [],
1054
+ left: [],
1055
+ absent: [],
1056
+ needs: [],
1057
+ requires: [],
1058
+ sdk: [],
1059
+ unknownKeys: [],
1060
+ missing: { server: [], player: [], sdk: [] },
1061
+ needsLedger: false,
1062
+ verdict: null,
1063
+ ...extra,
1064
+ });
1065
+ const schemaFindings = (items) => findings.push(...items.map((f) => ({ error: 'schema', code: f.code, ...(f.path ? { path: f.path } : {}), message: f.message })));
1066
+ const checkedConfig = validateConfig(project.config);
1067
+ if (!checkedConfig.ok || !checkedConfig.config) {
1068
+ schemaFindings(checkedConfig.findings);
1069
+ return result();
1070
+ }
1071
+ const config = checkedConfig.config;
1072
+ const unknownKeys = unknownConfigKeys(project.config).map((k) => `${CONFIG_FILE}:${k}`);
1073
+ let scene = null;
1074
+ if (project.scene !== undefined) {
1075
+ const checkedScene = validateScene(project.scene);
1076
+ if (!checkedScene.ok) {
1077
+ schemaFindings(checkedScene.findings.map((f) => ({ ...f, path: `${SCENE_FILE}:${f.path}` })));
1078
+ return result({ config, unknownKeys });
1079
+ }
1080
+ scene = checkedScene.scene;
1081
+ unknownKeys.push(...unknownSceneKeys(project.scene).map((k) => `${SCENE_FILE}:${k}`));
1082
+ }
1083
+ let lock = null;
1084
+ if (project.ledger !== undefined && project.ledger !== null) {
1085
+ const parsed = AssetLock.safeParse(project.ledger);
1086
+ if (!parsed.success) {
1087
+ const first = parsed.error.issues[0];
1088
+ findings.push({ error: 'schema', code: 'schema', path: LEDGER_FILE, message: `${LEDGER_FILE} is not valid: ${first?.path.join('.') || 'the file'}: ${first?.message ?? 'not valid'}` });
1089
+ return result({ config, scene, unknownKeys });
1090
+ }
1091
+ lock = parsed.data;
1092
+ }
1093
+ const picked = admitUploads({ mode: 'pick', scene: scene ?? undefined, config, ledger: lock, code: project.bundle, files: project.files });
1094
+ for (const p of picked.problems)
1095
+ findings.push({ error: 'bad_request', code: p.code, path: p.path, message: p.message });
1096
+ const needsLedger = lock === null && picked.problems.some((p) => p.code === 'admit:unrecorded');
1097
+ const configText = JSON.stringify(config, null, 2);
1098
+ const sceneText = scene ? JSON.stringify(scene, null, 2) + '\n' : null;
1099
+ const view = lock ? publishLockFor(lock, picked.uploads.map((u) => u.path)) : null;
1100
+ const ledgerText = view ? JSON.stringify(view) : null;
1101
+ // The request exactly as it would go up, judged by this package's own
1102
+ // server check; what the live server and player offer is compared after,
1103
+ // since they may be older than this package.
1104
+ const verdict = checkPublish({
1105
+ config,
1106
+ configBytes: utf8Bytes(configText),
1107
+ bundle: project.bundle,
1108
+ ...(scene ? { scene } : {}),
1109
+ ...(view ? { ledger: view, ledgerBytes: utf8Bytes(ledgerText) } : {}),
1110
+ files: picked.uploads.map((u) => ({ path: u.path, bytes: u.bytes, ...(u.sha256 ? { sha256: u.sha256 } : {}), ...(u.extensionsRequired ? { extensionsRequired: u.extensionsRequired } : {}) })),
1111
+ });
1112
+ findings.push(...verdict.findings);
1113
+ const needs = verdict.needs;
1114
+ const missing = {
1115
+ server: project.server ? missingCapabilities(needs, project.server) : [],
1116
+ player: project.player ? missingCapabilities(needs, project.player) : [],
1117
+ sdk: project.playerSdk ? missingSdkExports(verdict.sdk, project.playerSdk) : [],
1118
+ };
1119
+ if (missing.server.length > 0) {
1120
+ findings.push({ error: 'contract_mismatch', code: 'contract_mismatch', message: olderSentence('server', missing.server, { nothingUploaded: false }) });
1121
+ }
1122
+ if (missing.player.length > 0) {
1123
+ findings.push({ error: 'player_mismatch', code: 'player_mismatch', message: olderSentence('player', missing.player, { nothingUploaded: false }) });
1124
+ }
1125
+ if (missing.sdk.length > 0) {
1126
+ findings.push({ error: 'player_mismatch', code: 'player_sdk', message: olderSdkSentence(missing.sdk, { nothingUploaded: false }) });
1127
+ }
1128
+ return result({
1129
+ ok: findings.length === 0,
1130
+ config,
1131
+ configText,
1132
+ scene,
1133
+ sceneText,
1134
+ ledgerText,
1135
+ uploads: picked.uploads,
1136
+ left: picked.left,
1137
+ absent: picked.absent,
1138
+ needs,
1139
+ requires: verdict.requires,
1140
+ sdk: verdict.sdk,
1141
+ unknownKeys,
1142
+ missing,
1143
+ needsLedger,
1144
+ verdict,
1145
+ });
1146
+ }