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,230 @@
1
+ import type { ResolvedLook } from './look.js';
2
+ export type Lab = [number, number, number];
3
+ export interface LookStats {
4
+ /** Of the analysed picture: the long edge is at most 256 pixels. */
5
+ width: number;
6
+ height: number;
7
+ /** CIE L*, 0 to 100. */
8
+ meanL: number;
9
+ stdL: number;
10
+ p5: number;
11
+ p50: number;
12
+ p95: number;
13
+ /** Share of pixels with every channel at 250 or more, and at 5 or less. */
14
+ clipHigh: number;
15
+ clipLow: number;
16
+ /** Mean C*ab. */
17
+ meanChroma: number;
18
+ /** Mean b* (yellow is positive) and mean a* (magenta is positive). */
19
+ warmth: number;
20
+ tint: number;
21
+ /** Mean L* of the top, middle and bottom thirds. */
22
+ thirds: [number, number, number];
23
+ /** Mean L* of the outer 15% border over the centre's: below 1 is a vignette. */
24
+ edge: number;
25
+ /** k-means (k = 6) in Lab, largest share first. */
26
+ palette: {
27
+ hex: string;
28
+ share: number;
29
+ lab: Lab;
30
+ }[];
31
+ /** 16 bins of L*, as shares of the picture. */
32
+ histogram: number[];
33
+ /** The sky band (the top SKY_BAND of the rows) and the subject (the rest),
34
+ * each measured on its own. Absent from stats an older page measured. */
35
+ regions?: {
36
+ sky: RegionStats;
37
+ subject: RegionStats;
38
+ };
39
+ /** Mean Lab of the darkest SHADE_SHARE of the pixels (the shade) and of
40
+ * the brightest (the lit). */
41
+ shade?: Lab;
42
+ lit?: Lab;
43
+ /** Mean Sobel magnitude of L*, on an EDGE_GRID x EDGE_GRID grid of cells,
44
+ * row by row: where the picture's edges and silhouettes sit. */
45
+ edges?: number[];
46
+ /** Mean |L* - its 3 x 3 blur| (fine) and |7 x 7 blur - 19 x 19 blur| (coarse). */
47
+ detail?: {
48
+ fine: number;
49
+ coarse: number;
50
+ };
51
+ /** The uniform border cut off before measuring (uniformBorder), as shares
52
+ * of the analysed picture's sides; all 0 when it had none. width and
53
+ * height above are what was left. */
54
+ border?: {
55
+ top: number;
56
+ bottom: number;
57
+ left: number;
58
+ right: number;
59
+ };
60
+ }
61
+ /** One region of a picture: its brightness, spread, colourfulness and palette. */
62
+ export interface RegionStats {
63
+ meanL: number;
64
+ stdL: number;
65
+ meanChroma: number;
66
+ palette: {
67
+ hex: string;
68
+ share: number;
69
+ lab: Lab;
70
+ }[];
71
+ }
72
+ export type Verdict = 'matches' | 'close' | 'far';
73
+ /** One region against the reference's same region. */
74
+ export interface RegionComparison {
75
+ paletteDeltaE: number;
76
+ deltaMeanL: number;
77
+ verdict: Verdict;
78
+ }
79
+ export interface LookComparison {
80
+ /** Share-weighted mean, over the reference's palette, of each colour's nearest shot colour (deltaE2000). */
81
+ paletteDeltaE: number;
82
+ /** Shot minus reference. */
83
+ deltaMeanL: number;
84
+ /** Shot over reference: spread of L*, and mean chroma. */
85
+ contrastRatio: number;
86
+ chromaRatio: number;
87
+ /** Shot minus reference, in b* and a*. */
88
+ warmthDelta: number;
89
+ tintDelta: number;
90
+ clip: {
91
+ high: [number, number];
92
+ low: [number, number];
93
+ };
94
+ thirds: {
95
+ shot: [number, number, number];
96
+ ref: [number, number, number];
97
+ };
98
+ /** The worst of the judged statistics' own verdicts (verdicts). */
99
+ verdict: Verdict;
100
+ /** What each judged statistic says on its own: tone is the whole picture's
101
+ * palette, mean L* and contrast; shade is the shade's colour. */
102
+ verdicts: {
103
+ tone: Verdict;
104
+ shade?: Verdict;
105
+ };
106
+ /** The sky band and the subject against the reference's. Not judged. */
107
+ regions?: {
108
+ sky: RegionComparison;
109
+ subject: RegionComparison;
110
+ };
111
+ /** deltaE2000 between the shot's shade and the reference's. Judged. */
112
+ shade?: {
113
+ deltaE: number;
114
+ shot: Lab;
115
+ ref: Lab;
116
+ };
117
+ /** The same for the lit. Not judged. */
118
+ lit?: {
119
+ deltaE: number;
120
+ shot: Lab;
121
+ ref: Lab;
122
+ };
123
+ /** How far apart the two pictures' turns from lit to shade are: the
124
+ * distance, in a* and b*, between (shade - lit) in the shot and in the
125
+ * reference. Large when one picture's shadows go blue and the other's go
126
+ * grey. Not judged. */
127
+ shadeTurn?: number;
128
+ /** Correlation of the two edge grids: 1 when edges and silhouettes sit in
129
+ * the same places, 0 or below when they do not. Not judged. */
130
+ layout?: number;
131
+ /** The shot's fine-to-coarse detail over the reference's. Not judged. */
132
+ detailRatio?: number;
133
+ }
134
+ /** The analysed picture's long edge. */
135
+ export declare const STATS_LONG_EDGE = 256;
136
+ /** The sky band's share of the rows, from the top. A picture of a painting
137
+ * has no depth to find its sky by, so the top band stands in for it. */
138
+ export declare const SKY_BAND = 0.3;
139
+ /** The shade and the lit: this share of the pixels, darkest and brightest. */
140
+ export declare const SHADE_SHARE = 0.2;
141
+ /** The edge grid's cells on each side. */
142
+ export declare const EDGE_GRID = 8;
143
+ /**
144
+ * The statistics the verdict is made of. tone is the whole picture's
145
+ * palette, mean L* and contrast, the verdict there was; shade is the
146
+ * shade's colour, added because on the saved evidence
147
+ * (.fixtures-local/look-gate, rerun by scripts/look-gate-check.mts) its own
148
+ * verdict reproduced every expected one: the Red Arch against its request
149
+ * image far (where the tone says close), Laputa v1 against the film still
150
+ * far, laputa-v2 against it close or better, at 256 and 512 pixels and with
151
+ * the shade drawn anywhere from the darkest tenth to three tenths. The rest
152
+ * did not, and is only said: the sky band misses the arch at every cut, the
153
+ * subject at the higher sky line, the turn from lit to shade calls v2 far at
154
+ * a tenth, the edge layout parts the frames by 0.017 of correlation, too
155
+ * thin to hold, and the fine-to-coarse detail puts v2 further from the
156
+ * still than v1.
157
+ */
158
+ export declare const JUDGED: readonly ["tone", "shade"];
159
+ /** Linear sRGB (0 to 1) to Lab. */
160
+ export declare function linearToLab(r: number, g: number, b: number): Lab;
161
+ /** sRGB bytes to Lab. */
162
+ export declare function srgbToLab(r: number, g: number, b: number): Lab;
163
+ /** Lab to '#rrggbb', clamped into sRGB. */
164
+ export declare function labToHex(lab: Lab): string;
165
+ /** '#rrggbb' to Lab. */
166
+ export declare function hexToLab(hex: string): Lab;
167
+ /** CIEDE2000 (Sharma, Wu and Dalal 2005): the difference a person sees
168
+ * between two colours; about 1 is just noticeable, 10 is plainly another colour. */
169
+ export declare function deltaE2000(a: Lab, b: Lab): number;
170
+ /**
171
+ * A uniform border around a picture's art (a letterbox, a pillarbox, a mat),
172
+ * in rows and columns of `L` (L*, w x h, top row first). The rule
173
+ * nw_reference reads a reference's frame by (reference/facts.mjs frameOf):
174
+ * a border is lines of one value (spread under 2 L*, each within 3 of the
175
+ * first), at least 2 and at most 15% of the side (a flat sky or wall beyond
176
+ * that is content), and it ends in a step: the three lines after it differ
177
+ * from it by 8 L* or more, where a smooth sky would only drift. A crop that
178
+ * would leave less than 40% of either side is no crop.
179
+ */
180
+ export declare function uniformBorder(L: ArrayLike<number>, w: number, h: number): {
181
+ top: number;
182
+ bottom: number;
183
+ left: number;
184
+ right: number;
185
+ };
186
+ /** What a picture's look is, in numbers. `rgba` is width x height RGBA bytes,
187
+ * top row first; alpha is ignored (a shot is an opaque JPEG). A uniform
188
+ * border is cut off first (uniformBorder; `cuts.border` false keeps it).
189
+ * `cuts` also moves the sky band's and the shade's lines from SKY_BAND and
190
+ * SHADE_SHARE, for a check that asks how much a verdict depends on where
191
+ * they are drawn. */
192
+ export declare function lookStats(rgba: Uint8Array | Uint8ClampedArray, width: number, height: number, cuts?: {
193
+ sky?: number;
194
+ shade?: number;
195
+ border?: boolean;
196
+ }): LookStats;
197
+ /** Share-weighted mean, over the reference's colours, of the nearest shot colour's deltaE2000. */
198
+ export declare function paletteDistance(shot: LookStats['palette'], ref: LookStats['palette']): number;
199
+ /** The worse of verdicts. */
200
+ export declare const worstVerdict: (list: Verdict[]) => Verdict;
201
+ /** How a shot's look differs from a reference's. The verdict is the worst
202
+ * of the judged statistics (JUDGED): the tone (toneVerdict) and, when both
203
+ * pictures were measured by region, the shade's colour (colourVerdict).
204
+ * The rest is said and not judged. */
205
+ export declare function compareLook(shot: LookStats, ref: LookStats): LookComparison;
206
+ /**
207
+ * Which knobs would bring the shot toward the reference, as look_apply set
208
+ * values with the reason, largest first in the order exposure, contrast,
209
+ * saturation, white balance. Each step is a measured guess: the tone curve
210
+ * and the grade interact, so look again after applying it.
211
+ */
212
+ export declare function suggestLook(cmp: LookComparison, current: ResolvedLook): {
213
+ path: string;
214
+ from: number;
215
+ to: number;
216
+ why: string;
217
+ }[];
218
+ /** The white balance gain the look pipeline multiplies by (GPU and CPU alike):
219
+ * temperature trades red against blue, tint green against magenta, and the
220
+ * gain is divided by its own luminance, so grey keeps its brightness. */
221
+ export declare function whiteBalanceGain(temperature: number, tint: number): [number, number, number];
222
+ /**
223
+ * The look's grade on one colour, as the pipeline does it on the GPU, for what
224
+ * is coloured without it (the splat the universe shows from space): exposure,
225
+ * white balance, CDL, contrast, saturation, the tone curve and posterize, in
226
+ * that order. Linear light in, linear display light out (the sRGB transfer is
227
+ * the caller's). The LUT, vignette and grain are left out: a LUT is a file
228
+ * this cannot read, and the other two belong to the screen, not the colour.
229
+ */
230
+ export declare function gradeCpu(rgbLinear: [number, number, number], look: ResolvedLook): [number, number, number];