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,357 @@
1
+ import { z } from 'zod';
2
+ import type { Finding } from './config.js';
3
+ export declare const BRIEF_FILE = "brief.json";
4
+ export declare const BRIEF_SCHEMA = "nowhere/brief@1";
5
+ /** The hero views a space is judged from, one per target picture (4 to 6
6
+ * in the reference loop, REFERENCE_LOOP.md 2.2). */
7
+ export declare const HERO_IDS: readonly ["H1", "H2", "H3", "H4", "H5", "H6"];
8
+ /** The speed levels the kickoff card offers (REFERENCE_LOOP.md 2.1). Their
9
+ * times, round caps and bars are process values the agent keeps
10
+ * (agent/loop/levels.mjs), never a look. */
11
+ export declare const LOOP_LEVELS: readonly ["quick", "standard", "deep"];
12
+ /** A request sent at a step of the quality gauge (the studio's composer,
13
+ * oda make --quality) has that step as its level instead. */
14
+ export declare const LOOP_QUALITY_LEVELS: readonly ["quality-1", "quality-2", "quality-3", "quality-4", "quality-5"];
15
+ /** One picture the space is measured from, and what was measured. The
16
+ * numbers are nw_reference's, copied over; keys it adds later fit beside
17
+ * them as numbers or strings. */
18
+ export declare const BriefReference: z.ZodObject<{
19
+ id: z.ZodString;
20
+ path: z.ZodOptional<z.ZodString>;
21
+ url: z.ZodOptional<z.ZodString>;
22
+ what: z.ZodString;
23
+ origin: z.ZodOptional<z.ZodEnum<{
24
+ target: "target";
25
+ attached: "attached";
26
+ }>>;
27
+ measured: z.ZodOptional<z.ZodObject<{
28
+ palette: z.ZodOptional<z.ZodArray<z.ZodObject<{
29
+ hex: z.ZodString;
30
+ share: z.ZodOptional<z.ZodNumber>;
31
+ where: z.ZodOptional<z.ZodString>;
32
+ }, z.core.$strict>>>;
33
+ valueKey: z.ZodOptional<z.ZodNumber>;
34
+ contrast: z.ZodOptional<z.ZodNumber>;
35
+ saturation: z.ZodOptional<z.ZodNumber>;
36
+ warmth: z.ZodOptional<z.ZodNumber>;
37
+ haze: z.ZodOptional<z.ZodNumber>;
38
+ horizonY: z.ZodOptional<z.ZodNumber>;
39
+ litHex: z.ZodOptional<z.ZodString>;
40
+ shadowHex: z.ZodOptional<z.ZodString>;
41
+ skyHex: z.ZodOptional<z.ZodString>;
42
+ }, z.core.$catchall<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>>;
43
+ }, z.core.$strict>;
44
+ export declare const BriefLight: z.ZodObject<{
45
+ sun: z.ZodObject<{
46
+ azimuthDeg: z.ZodNumber;
47
+ elevationDeg: z.ZodNumber;
48
+ color: z.ZodString;
49
+ illuminanceLux: z.ZodOptional<z.ZodNumber>;
50
+ }, z.core.$strict>;
51
+ sky: z.ZodObject<{
52
+ kind: z.ZodEnum<{
53
+ hdri: "hdri";
54
+ none: "none";
55
+ color: "color";
56
+ gradient: "gradient";
57
+ physical: "physical";
58
+ panorama: "panorama";
59
+ }>;
60
+ asset: z.ZodOptional<z.ZodString>;
61
+ top: z.ZodOptional<z.ZodString>;
62
+ bottom: z.ZodOptional<z.ZodString>;
63
+ }, z.core.$strict>;
64
+ shadowColor: z.ZodOptional<z.ZodString>;
65
+ fog: z.ZodOptional<z.ZodObject<{
66
+ color: z.ZodString;
67
+ near: z.ZodOptional<z.ZodNumber>;
68
+ far: z.ZodOptional<z.ZodNumber>;
69
+ density: z.ZodOptional<z.ZodNumber>;
70
+ }, z.core.$strict>>;
71
+ from: z.ZodOptional<z.ZodArray<z.ZodString>>;
72
+ }, z.core.$strict>;
73
+ /** The visitor's scale: how fast they walk and where their eyes are. The
74
+ * names are the config's player block's, so the values copy across. */
75
+ export declare const BriefScale: z.ZodObject<{
76
+ speed: z.ZodNumber;
77
+ run: z.ZodOptional<z.ZodNumber>;
78
+ eyeHeight: z.ZodNumber;
79
+ fov: z.ZodOptional<z.ZodNumber>;
80
+ }, z.core.$strict>;
81
+ /** A surface of the space and how sharp it has to be, at its real size. */
82
+ export declare const BriefMaterial: z.ZodObject<{
83
+ name: z.ZodString;
84
+ surface: z.ZodString;
85
+ texelDensity: z.ZodNumber;
86
+ tileMetres: z.ZodOptional<z.ZodNumber>;
87
+ asset: z.ZodOptional<z.ZodString>;
88
+ source: z.ZodOptional<z.ZodObject<{
89
+ id: z.ZodString;
90
+ resolution: z.ZodOptional<z.ZodEnum<{
91
+ "1k": "1k";
92
+ "2k": "2k";
93
+ "4k": "4k";
94
+ }>>;
95
+ }, z.core.$strict>>;
96
+ from: z.ZodOptional<z.ZodArray<z.ZodString>>;
97
+ }, z.core.$strict>;
98
+ /** A view the space is judged from: the comparisons are taken here. */
99
+ export declare const BriefHeroView: z.ZodObject<{
100
+ id: z.ZodEnum<{
101
+ H1: "H1";
102
+ H2: "H2";
103
+ H3: "H3";
104
+ H4: "H4";
105
+ H5: "H5";
106
+ H6: "H6";
107
+ }>;
108
+ position: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
109
+ lookAt: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
110
+ fov: z.ZodNumber;
111
+ what: z.ZodOptional<z.ZodString>;
112
+ reference: z.ZodOptional<z.ZodString>;
113
+ }, z.core.$strict>;
114
+ export declare const BriefBudget: z.ZodObject<{
115
+ assetsMb: z.ZodNumber;
116
+ gpuTextureMb: z.ZodOptional<z.ZodNumber>;
117
+ texelDensity: z.ZodOptional<z.ZodNumber>;
118
+ triangles: z.ZodOptional<z.ZodNumber>;
119
+ level: z.ZodOptional<z.ZodEnum<{
120
+ quick: "quick";
121
+ standard: "standard";
122
+ deep: "deep";
123
+ "quality-1": "quality-1";
124
+ "quality-2": "quality-2";
125
+ "quality-3": "quality-3";
126
+ "quality-4": "quality-4";
127
+ "quality-5": "quality-5";
128
+ }>>;
129
+ quality: z.ZodOptional<z.ZodNumber>;
130
+ minRounds: z.ZodOptional<z.ZodNumber>;
131
+ timeFloorMin: z.ZodOptional<z.ZodNumber>;
132
+ timeCapMin: z.ZodOptional<z.ZodNumber>;
133
+ roundCap: z.ZodOptional<z.ZodNumber>;
134
+ usdEstimate: z.ZodOptional<z.ZodObject<{
135
+ lo: z.ZodNumber;
136
+ hi: z.ZodNumber;
137
+ }, z.core.$strict>>;
138
+ }, z.core.$strict>;
139
+ /** The bar a round is held to: the zero-context judge's score out of 10,
140
+ * and the verdict look_compare should reach at the hero views. */
141
+ export declare const BriefBar: z.ZodObject<{
142
+ judge: z.ZodNumber;
143
+ compare: z.ZodEnum<{
144
+ matches: "matches";
145
+ close: "close";
146
+ }>;
147
+ }, z.core.$strict>;
148
+ /** The libraries this space draws from, and what it took from them, so one
149
+ * space keeps to one family of sources. asset_import adds each pick. */
150
+ export declare const BriefSources: z.ZodObject<{
151
+ libraries: z.ZodArray<z.ZodEnum<{
152
+ generated: "generated";
153
+ made: "made";
154
+ polyhaven: "polyhaven";
155
+ ambientcg: "ambientcg";
156
+ polypizza: "polypizza";
157
+ }>>;
158
+ picked: z.ZodOptional<z.ZodArray<z.ZodObject<{
159
+ id: z.ZodString;
160
+ kind: z.ZodEnum<{
161
+ model: "model";
162
+ texture: "texture";
163
+ hdri: "hdri";
164
+ material: "material";
165
+ }>;
166
+ as: z.ZodString;
167
+ resolution: z.ZodOptional<z.ZodEnum<{
168
+ "1k": "1k";
169
+ "2k": "2k";
170
+ "4k": "4k";
171
+ }>>;
172
+ at: z.ZodOptional<z.ZodString>;
173
+ }, z.core.$strict>>>;
174
+ }, z.core.$strict>;
175
+ export declare const SpaceBrief: z.ZodObject<{
176
+ schema: z.ZodLiteral<"nowhere/brief@1">;
177
+ place: z.ZodString;
178
+ references: z.ZodArray<z.ZodObject<{
179
+ id: z.ZodString;
180
+ path: z.ZodOptional<z.ZodString>;
181
+ url: z.ZodOptional<z.ZodString>;
182
+ what: z.ZodString;
183
+ origin: z.ZodOptional<z.ZodEnum<{
184
+ target: "target";
185
+ attached: "attached";
186
+ }>>;
187
+ measured: z.ZodOptional<z.ZodObject<{
188
+ palette: z.ZodOptional<z.ZodArray<z.ZodObject<{
189
+ hex: z.ZodString;
190
+ share: z.ZodOptional<z.ZodNumber>;
191
+ where: z.ZodOptional<z.ZodString>;
192
+ }, z.core.$strict>>>;
193
+ valueKey: z.ZodOptional<z.ZodNumber>;
194
+ contrast: z.ZodOptional<z.ZodNumber>;
195
+ saturation: z.ZodOptional<z.ZodNumber>;
196
+ warmth: z.ZodOptional<z.ZodNumber>;
197
+ haze: z.ZodOptional<z.ZodNumber>;
198
+ horizonY: z.ZodOptional<z.ZodNumber>;
199
+ litHex: z.ZodOptional<z.ZodString>;
200
+ shadowHex: z.ZodOptional<z.ZodString>;
201
+ skyHex: z.ZodOptional<z.ZodString>;
202
+ }, z.core.$catchall<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>>>;
203
+ }, z.core.$strict>>;
204
+ palette: z.ZodArray<z.ZodObject<{
205
+ hex: z.ZodString;
206
+ where: z.ZodString;
207
+ from: z.ZodOptional<z.ZodString>;
208
+ }, z.core.$strict>>;
209
+ light: z.ZodObject<{
210
+ sun: z.ZodObject<{
211
+ azimuthDeg: z.ZodNumber;
212
+ elevationDeg: z.ZodNumber;
213
+ color: z.ZodString;
214
+ illuminanceLux: z.ZodOptional<z.ZodNumber>;
215
+ }, z.core.$strict>;
216
+ sky: z.ZodObject<{
217
+ kind: z.ZodEnum<{
218
+ hdri: "hdri";
219
+ none: "none";
220
+ color: "color";
221
+ gradient: "gradient";
222
+ physical: "physical";
223
+ panorama: "panorama";
224
+ }>;
225
+ asset: z.ZodOptional<z.ZodString>;
226
+ top: z.ZodOptional<z.ZodString>;
227
+ bottom: z.ZodOptional<z.ZodString>;
228
+ }, z.core.$strict>;
229
+ shadowColor: z.ZodOptional<z.ZodString>;
230
+ fog: z.ZodOptional<z.ZodObject<{
231
+ color: z.ZodString;
232
+ near: z.ZodOptional<z.ZodNumber>;
233
+ far: z.ZodOptional<z.ZodNumber>;
234
+ density: z.ZodOptional<z.ZodNumber>;
235
+ }, z.core.$strict>>;
236
+ from: z.ZodOptional<z.ZodArray<z.ZodString>>;
237
+ }, z.core.$strict>;
238
+ scale: z.ZodObject<{
239
+ speed: z.ZodNumber;
240
+ run: z.ZodOptional<z.ZodNumber>;
241
+ eyeHeight: z.ZodNumber;
242
+ fov: z.ZodOptional<z.ZodNumber>;
243
+ }, z.core.$strict>;
244
+ materials: z.ZodArray<z.ZodObject<{
245
+ name: z.ZodString;
246
+ surface: z.ZodString;
247
+ texelDensity: z.ZodNumber;
248
+ tileMetres: z.ZodOptional<z.ZodNumber>;
249
+ asset: z.ZodOptional<z.ZodString>;
250
+ source: z.ZodOptional<z.ZodObject<{
251
+ id: z.ZodString;
252
+ resolution: z.ZodOptional<z.ZodEnum<{
253
+ "1k": "1k";
254
+ "2k": "2k";
255
+ "4k": "4k";
256
+ }>>;
257
+ }, z.core.$strict>>;
258
+ from: z.ZodOptional<z.ZodArray<z.ZodString>>;
259
+ }, z.core.$strict>>;
260
+ heroViews: z.ZodArray<z.ZodObject<{
261
+ id: z.ZodEnum<{
262
+ H1: "H1";
263
+ H2: "H2";
264
+ H3: "H3";
265
+ H4: "H4";
266
+ H5: "H5";
267
+ H6: "H6";
268
+ }>;
269
+ position: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
270
+ lookAt: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
271
+ fov: z.ZodNumber;
272
+ what: z.ZodOptional<z.ZodString>;
273
+ reference: z.ZodOptional<z.ZodString>;
274
+ }, z.core.$strict>>;
275
+ budget: z.ZodObject<{
276
+ assetsMb: z.ZodNumber;
277
+ gpuTextureMb: z.ZodOptional<z.ZodNumber>;
278
+ texelDensity: z.ZodOptional<z.ZodNumber>;
279
+ triangles: z.ZodOptional<z.ZodNumber>;
280
+ level: z.ZodOptional<z.ZodEnum<{
281
+ quick: "quick";
282
+ standard: "standard";
283
+ deep: "deep";
284
+ "quality-1": "quality-1";
285
+ "quality-2": "quality-2";
286
+ "quality-3": "quality-3";
287
+ "quality-4": "quality-4";
288
+ "quality-5": "quality-5";
289
+ }>>;
290
+ quality: z.ZodOptional<z.ZodNumber>;
291
+ minRounds: z.ZodOptional<z.ZodNumber>;
292
+ timeFloorMin: z.ZodOptional<z.ZodNumber>;
293
+ timeCapMin: z.ZodOptional<z.ZodNumber>;
294
+ roundCap: z.ZodOptional<z.ZodNumber>;
295
+ usdEstimate: z.ZodOptional<z.ZodObject<{
296
+ lo: z.ZodNumber;
297
+ hi: z.ZodNumber;
298
+ }, z.core.$strict>>;
299
+ }, z.core.$strict>;
300
+ sources: z.ZodOptional<z.ZodObject<{
301
+ libraries: z.ZodArray<z.ZodEnum<{
302
+ generated: "generated";
303
+ made: "made";
304
+ polyhaven: "polyhaven";
305
+ ambientcg: "ambientcg";
306
+ polypizza: "polypizza";
307
+ }>>;
308
+ picked: z.ZodOptional<z.ZodArray<z.ZodObject<{
309
+ id: z.ZodString;
310
+ kind: z.ZodEnum<{
311
+ model: "model";
312
+ texture: "texture";
313
+ hdri: "hdri";
314
+ material: "material";
315
+ }>;
316
+ as: z.ZodString;
317
+ resolution: z.ZodOptional<z.ZodEnum<{
318
+ "1k": "1k";
319
+ "2k": "2k";
320
+ "4k": "4k";
321
+ }>>;
322
+ at: z.ZodOptional<z.ZodString>;
323
+ }, z.core.$strict>>>;
324
+ }, z.core.$strict>>;
325
+ bar: z.ZodOptional<z.ZodObject<{
326
+ judge: z.ZodNumber;
327
+ compare: z.ZodEnum<{
328
+ matches: "matches";
329
+ close: "close";
330
+ }>;
331
+ }, z.core.$strict>>;
332
+ slop: z.ZodOptional<z.ZodArray<z.ZodString>>;
333
+ scoreHistory: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
334
+ }, z.core.$strict>;
335
+ export type SpaceBriefT = z.infer<typeof SpaceBrief>;
336
+ export type BriefMaterialT = z.infer<typeof BriefMaterial>;
337
+ export interface BriefResult {
338
+ ok: boolean;
339
+ brief?: SpaceBriefT;
340
+ findings: Finding[];
341
+ }
342
+ /** Validates a raw brief.json value: the schema, then what the schema alone
343
+ * cannot say (ids that repeat, a reference cited that is not there). */
344
+ export declare function validateBrief(raw: unknown): BriefResult;
345
+ /**
346
+ * The texel density the brief asks of one file, and why: the material whose
347
+ * asset is the file, or whose name the file is by (the material itself,
348
+ * assets/<name>; one of its maps, assets/<name>_color.jpg; or a picture
349
+ * named for it, assets/<name>.png), else the brief's budget for everything
350
+ * else. A model is held to a material only through that material's asset:
351
+ * a prop called stone_bench.glb is not the stone floor. Null when the brief
352
+ * gives neither.
353
+ */
354
+ export declare function briefDensityFor(brief: SpaceBriefT | null | undefined, file: string): {
355
+ target: number;
356
+ from: string;
357
+ } | null;
@@ -0,0 +1,302 @@
1
+ import { z } from 'zod';
2
+ import { Hex, Vec3 } from './common.js';
3
+ import { ASSETS_TOTAL_MB } from './assets.js';
4
+ // The space brief: what one space is, in numbers measured from its own
5
+ // references, written by the agent before anything visual is built and read
6
+ // back by the tools that judge the work (asset_inspect holds every texture to
7
+ // the brief's texel density; the hero views are where the comparisons are
8
+ // taken from). brief.json at the project's root is the record; brief.md is
9
+ // the same brief in words, for people.
10
+ //
11
+ // No field has a default value. Every colour, light, size and density comes
12
+ // from this space's request and references (the no-presets rule), so a value
13
+ // the brief does not give stays missing and the tools say so, instead of
14
+ // filling it in with the engine's taste. A brief from text alone has no
15
+ // references; everything else is still required.
16
+ export const BRIEF_FILE = 'brief.json';
17
+ export const BRIEF_SCHEMA = 'nowhere/brief@1';
18
+ /** A file inside the project, by its project-relative path. */
19
+ const ProjectFile = z
20
+ .string()
21
+ .min(1)
22
+ .max(300)
23
+ .refine((p) => !p.startsWith('/') && !p.includes('\\') && !p.split('/').includes('..') && !/^[A-Za-z]:/.test(p), 'must be a path inside the project');
24
+ const RefId = z.string().regex(/^R\d{1,3}$/, 'must be a reference id: R1, R2, ...');
25
+ const Resolution = z.enum(['1k', '2k', '4k']);
26
+ /** The hero views a space is judged from, one per target picture (4 to 6
27
+ * in the reference loop, REFERENCE_LOOP.md 2.2). */
28
+ export const HERO_IDS = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6'];
29
+ /** The speed levels the kickoff card offers (REFERENCE_LOOP.md 2.1). Their
30
+ * times, round caps and bars are process values the agent keeps
31
+ * (agent/loop/levels.mjs), never a look. */
32
+ export const LOOP_LEVELS = ['quick', 'standard', 'deep'];
33
+ /** A request sent at a step of the quality gauge (the studio's composer,
34
+ * oda make --quality) has that step as its level instead. */
35
+ export const LOOP_QUALITY_LEVELS = ['quality-1', 'quality-2', 'quality-3', 'quality-4', 'quality-5'];
36
+ /** One picture the space is measured from, and what was measured. The
37
+ * numbers are nw_reference's, copied over; keys it adds later fit beside
38
+ * them as numbers or strings. */
39
+ export const BriefReference = z
40
+ .object({
41
+ id: RefId,
42
+ /** The picture in the project: .nowhere/refs/<file> or refs/<file>. */
43
+ path: ProjectFile.optional(),
44
+ /** Where it came from, when it came from the web. */
45
+ url: z.string().url().optional(),
46
+ /** What it shows and what the space takes from it. */
47
+ what: z.string().min(1).max(400),
48
+ /** A target picture of the reference loop: one made for this space
49
+ * (image_generate kind target) or one the creator attached. */
50
+ origin: z.enum(['target', 'attached']).optional(),
51
+ measured: z
52
+ .object({
53
+ palette: z.array(z.object({ hex: Hex, share: z.number().min(0).max(1).optional(), where: z.string().max(160).optional() }).strict()).max(16).optional(),
54
+ /** Mean lightness, 0 (black) to 1 (white). */
55
+ valueKey: z.number().min(0).max(1).optional(),
56
+ contrast: z.number().min(0).optional(),
57
+ saturation: z.number().min(0).optional(),
58
+ warmth: z.number().optional(),
59
+ haze: z.number().min(0).max(1).optional(),
60
+ /** The horizon's row, 0 at the top of the picture, 1 at the bottom. */
61
+ horizonY: z.number().min(0).max(1).optional(),
62
+ litHex: Hex.optional(),
63
+ shadowHex: Hex.optional(),
64
+ skyHex: Hex.optional(),
65
+ })
66
+ .catchall(z.union([z.number(), z.string()]))
67
+ .optional(),
68
+ })
69
+ .strict()
70
+ .refine((r) => !!r.path || !!r.url, 'needs a path in the project or a url');
71
+ export const BriefLight = z
72
+ .object({
73
+ sun: z
74
+ .object({
75
+ /** Degrees clockwise from north (-z), looking down. */
76
+ azimuthDeg: z.number().min(0).max(360),
77
+ /** Degrees above the horizon; below 0 is a sun that has set. */
78
+ elevationDeg: z.number().min(-90).max(90),
79
+ color: Hex,
80
+ /** Lux at noon is about 100,000; overcast about 10,000. */
81
+ illuminanceLux: z.number().positive().optional(),
82
+ })
83
+ .strict(),
84
+ sky: z
85
+ .object({
86
+ kind: z.enum(['hdri', 'physical', 'gradient', 'color', 'panorama', 'none']),
87
+ /** hdri and panorama: the picture, under assets/. */
88
+ asset: ProjectFile.optional(),
89
+ top: Hex.optional(),
90
+ bottom: Hex.optional(),
91
+ })
92
+ .strict(),
93
+ /** The colour shadows take, measured where the references show one. */
94
+ shadowColor: Hex.optional(),
95
+ fog: z
96
+ .object({ color: Hex, near: z.number().min(0).optional(), far: z.number().positive().optional(), density: z.number().min(0).optional() })
97
+ .strict()
98
+ .optional(),
99
+ /** The references these values were measured from. */
100
+ from: z.array(RefId).max(16).optional(),
101
+ })
102
+ .strict();
103
+ /** The visitor's scale: how fast they walk and where their eyes are. The
104
+ * names are the config's player block's, so the values copy across. */
105
+ export const BriefScale = z
106
+ .object({
107
+ /** Walking speed, metres per second. */
108
+ speed: z.number().min(0.3).max(20),
109
+ /** Running speed as a multiple of walking. */
110
+ run: z.number().min(1).max(5).optional(),
111
+ /** Eye height above the ground, metres. */
112
+ eyeHeight: z.number().min(0.2).max(5),
113
+ /** Vertical field of view, degrees. */
114
+ fov: z.number().min(20).max(120).optional(),
115
+ })
116
+ .strict();
117
+ /** A surface of the space and how sharp it has to be, at its real size. */
118
+ export const BriefMaterial = z
119
+ .object({
120
+ /** The name it is imported as: assets/<name> (its maps <name>_color, ...). */
121
+ name: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/, 'must be the assets/<name> it is imported as: letters, digits, _ and -'),
122
+ /** What it is and where it goes. */
123
+ surface: z.string().min(1).max(300),
124
+ /** Pixels per metre at its real size, from how close the visitor comes. */
125
+ texelDensity: z.number().positive().max(16384),
126
+ /** How many metres one tile covers, when the brief decides it. */
127
+ tileMetres: z.number().positive().max(200).optional(),
128
+ /** Another file this target is for: a model (assets/x.glb), or a texture. */
129
+ asset: ProjectFile.optional(),
130
+ /** The library item it comes from, once one is chosen. */
131
+ source: z.object({ id: z.string().regex(/^[a-z]+:[\w.-]{1,120}$/), resolution: Resolution.optional() }).strict().optional(),
132
+ from: z.array(RefId).max(16).optional(),
133
+ })
134
+ .strict();
135
+ /** A view the space is judged from: the comparisons are taken here. */
136
+ export const BriefHeroView = z
137
+ .object({
138
+ id: z.enum(HERO_IDS),
139
+ /** Where the camera stands, metres. */
140
+ position: Vec3,
141
+ /** The point it looks at, metres. */
142
+ lookAt: Vec3,
143
+ /** Vertical field of view, degrees. */
144
+ fov: z.number().min(10).max(120),
145
+ what: z.string().max(300).optional(),
146
+ /** The reference this view is compared with. */
147
+ reference: RefId.optional(),
148
+ })
149
+ .strict();
150
+ export const BriefBudget = z
151
+ .object({
152
+ /** What the space's files may weigh in all, at most the planet's cap. */
153
+ assetsMb: z.number().positive().max(ASSETS_TOTAL_MB),
154
+ /** Texture memory on the GPU the space may use, MB. */
155
+ gpuTextureMb: z.number().positive().optional(),
156
+ /** The texel density a texture without its own target is held to, px/m. */
157
+ texelDensity: z.number().positive().max(16384).optional(),
158
+ triangles: z.number().int().positive().optional(),
159
+ // The reference loop's time and rounds, from the kickoff card's answer
160
+ // (agent/loop/levels.mjs): process values, the same for every space at
161
+ // a level, never a look.
162
+ /** The speed level the creator chose, or the quality step the request
163
+ * was sent at. */
164
+ level: z.enum([...LOOP_LEVELS, ...LOOP_QUALITY_LEVELS]).optional(),
165
+ /** The quality step, 1 to 5, when the request was sent at one. */
166
+ quality: z.number().int().min(1).max(5).optional(),
167
+ /** A quality step ends at its bar only after this many judged rounds. */
168
+ minRounds: z.number().int().min(0).max(100).optional(),
169
+ /** The work does not end before this many minutes. */
170
+ timeFloorMin: z.number().min(0).max(24 * 60).optional(),
171
+ /** Nor goes on past this many. */
172
+ timeCapMin: z.number().positive().max(24 * 60).optional(),
173
+ /** Nor past this many rounds. */
174
+ roundCap: z.number().int().min(1).max(100).optional(),
175
+ /** What the kickoff card said the level would cost, US dollars. */
176
+ usdEstimate: z.object({ lo: z.number().min(0), hi: z.number().min(0) }).strict().optional(),
177
+ })
178
+ .strict();
179
+ /** The bar a round is held to: the zero-context judge's score out of 10,
180
+ * and the verdict look_compare should reach at the hero views. */
181
+ export const BriefBar = z
182
+ .object({
183
+ judge: z.number().min(0).max(10),
184
+ compare: z.enum(['close', 'matches']),
185
+ })
186
+ .strict();
187
+ /** The libraries this space draws from, and what it took from them, so one
188
+ * space keeps to one family of sources. asset_import adds each pick. */
189
+ export const BriefSources = z
190
+ .object({
191
+ libraries: z.array(z.enum(['polyhaven', 'ambientcg', 'polypizza', 'generated', 'made'])).min(1).max(5),
192
+ picked: z
193
+ .array(z
194
+ .object({
195
+ id: z.string().regex(/^[a-z]+:[\w.-]{1,120}$/),
196
+ kind: z.enum(['model', 'material', 'hdri', 'texture']),
197
+ as: ProjectFile,
198
+ resolution: Resolution.optional(),
199
+ at: z.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional(),
200
+ })
201
+ .strict())
202
+ .max(400)
203
+ .optional(),
204
+ })
205
+ .strict();
206
+ export const SpaceBrief = z
207
+ .object({
208
+ schema: z.literal(BRIEF_SCHEMA),
209
+ /** What the space is, in a few sentences. */
210
+ place: z.string().min(1).max(800),
211
+ references: z.array(BriefReference).max(64),
212
+ palette: z.array(z.object({ hex: Hex, where: z.string().min(1).max(160), from: RefId.optional() }).strict()).min(1).max(24),
213
+ light: BriefLight,
214
+ scale: BriefScale,
215
+ materials: z.array(BriefMaterial).max(64),
216
+ heroViews: z.array(BriefHeroView).min(1).max(HERO_IDS.length),
217
+ budget: BriefBudget,
218
+ sources: BriefSources.optional(),
219
+ /** The reference loop's bar, from the kickoff card. */
220
+ bar: BriefBar.optional(),
221
+ /** What this space avoids besides the loop's own list (on-screen text,
222
+ * glowing orbs, greyed-out colour...), in words. */
223
+ slop: z.array(z.string().min(1).max(200)).max(24).optional(),
224
+ /** The judge's overall score after each round, oldest first. */
225
+ scoreHistory: z.array(z.number().min(0).max(10)).max(200).optional(),
226
+ })
227
+ .strict();
228
+ const finding = (path, message) => ({
229
+ path: `${BRIEF_FILE}${path ? ':' + path : ''}`,
230
+ code: 'brief',
231
+ message,
232
+ hint: 'Call nw_schema with kind "brief" to see the exact shape.',
233
+ });
234
+ /** Validates a raw brief.json value: the schema, then what the schema alone
235
+ * cannot say (ids that repeat, a reference cited that is not there). */
236
+ export function validateBrief(raw) {
237
+ const parsed = SpaceBrief.safeParse(raw);
238
+ if (!parsed.success)
239
+ return { ok: false, findings: parsed.error.issues.map((i) => finding(i.path.join('.'), i.message)) };
240
+ const brief = parsed.data;
241
+ const findings = [];
242
+ const twice = (list, what, at) => {
243
+ const seen = new Set();
244
+ for (const v of list) {
245
+ if (seen.has(v))
246
+ findings.push(finding(at, `${what} ${v} is there twice`));
247
+ seen.add(v);
248
+ }
249
+ };
250
+ twice(brief.references.map((r) => r.id), 'reference', 'references');
251
+ twice(brief.heroViews.map((v) => v.id), 'hero view', 'heroViews');
252
+ twice(brief.materials.map((m) => m.name), 'material', 'materials');
253
+ const refs = new Set(brief.references.map((r) => r.id));
254
+ const cited = [
255
+ ...brief.palette.map((p, i) => [`palette.${i}.from`, p.from]),
256
+ ...(brief.light.from ?? []).map((id, i) => [`light.from.${i}`, id]),
257
+ ...brief.materials.flatMap((m, i) => (m.from ?? []).map((id, k) => [`materials.${i}.from.${k}`, id])),
258
+ ...brief.heroViews.map((v, i) => [`heroViews.${i}.reference`, v.reference]),
259
+ ];
260
+ for (const [at, id] of cited)
261
+ if (id && !refs.has(id))
262
+ findings.push(finding(at, `cites ${id}, which is not one of the references`));
263
+ const { timeFloorMin, timeCapMin } = brief.budget;
264
+ if (timeFloorMin !== undefined && timeCapMin !== undefined && timeFloorMin > timeCapMin) {
265
+ findings.push(finding('budget.timeFloorMin', `the time floor (${timeFloorMin} min) is past the cap (${timeCapMin} min)`));
266
+ }
267
+ if ((brief.light.sky.kind === 'hdri' || brief.light.sky.kind === 'panorama') && !brief.light.sky.asset) {
268
+ findings.push(finding('light.sky.asset', `a ${brief.light.sky.kind} sky names its picture under assets/`));
269
+ }
270
+ return findings.length ? { ok: false, findings } : { ok: true, brief, findings: [] };
271
+ }
272
+ /** The maps a material's name carries in assets/ (<name>_color.jpg, ...). */
273
+ const MAP_ROLES = ['color', 'normal', 'rough', 'ao', 'metal', 'displacement', 'opacity'];
274
+ const PICTURE = /\.(png|jpe?g|webp|ktx2)$/i;
275
+ /**
276
+ * The texel density the brief asks of one file, and why: the material whose
277
+ * asset is the file, or whose name the file is by (the material itself,
278
+ * assets/<name>; one of its maps, assets/<name>_color.jpg; or a picture
279
+ * named for it, assets/<name>.png), else the brief's budget for everything
280
+ * else. A model is held to a material only through that material's asset:
281
+ * a prop called stone_bench.glb is not the stone floor. Null when the brief
282
+ * gives neither.
283
+ */
284
+ export function briefDensityFor(brief, file) {
285
+ if (!brief)
286
+ return null;
287
+ const rel = String(file ?? '').replace(/\\/g, '/');
288
+ const name = rel.slice(rel.lastIndexOf('/') + 1);
289
+ const ext = /\.[^.]+$/.exec(name)?.[0] ?? '';
290
+ const base = ext ? name.slice(0, -ext.length) : name;
291
+ const picture = !ext || PICTURE.test(ext);
292
+ for (const m of brief.materials) {
293
+ const stem = m.asset ? m.asset.replace(/\.[^./]+$/, '') : null;
294
+ const byAsset = !!m.asset && (m.asset === rel || stem === rel.replace(/\.[^./]+$/, ''));
295
+ const byName = picture && (base === m.name || (!!ext && MAP_ROLES.some((role) => base === `${m.name}_${role}`)));
296
+ if (byAsset || byName)
297
+ return { target: m.texelDensity, from: `the brief's material ${m.name}` };
298
+ }
299
+ if (brief.budget.texelDensity)
300
+ return { target: brief.budget.texelDensity, from: "the brief's budget" };
301
+ return null;
302
+ }
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ /** Stable, filename-safe identifier. Also what the agent types by hand. */
3
+ export declare const Id: z.ZodString;
4
+ export declare const Vec3: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
5
+ export declare const Vec2: z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
6
+ export declare const Hex: z.ZodString;
7
+ /** Path inside the project's assets/ directory. */
8
+ export declare const AssetPath: z.ZodString;
9
+ export type Vec3T = z.infer<typeof Vec3>;
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ /** Stable, filename-safe identifier. Also what the agent types by hand. */
3
+ export const Id = z
4
+ .string()
5
+ .regex(/^[a-z0-9][a-z0-9_-]{2,47}$/, 'must be 3-48 chars, lowercase letters/digits/_/-, starting alphanumeric');
6
+ export const Vec3 = z.tuple([z.number(), z.number(), z.number()]);
7
+ export const Vec2 = z.tuple([z.number(), z.number()]);
8
+ export const Hex = z.string().regex(/^#[0-9a-fA-F]{6}$/, 'must be a #rrggbb hex colour');
9
+ /** Path inside the project's assets/ directory. */
10
+ export const AssetPath = z
11
+ .string()
12
+ .regex(/^assets\/[\w./-]+$/, 'must be a path under assets/')
13
+ .refine((p) => !p.includes('..'), 'must not traverse out of assets/');