@wildshard/sdk 0.0.1 → 0.2.3

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 (687) hide show
  1. package/GUIDE.md +790 -0
  2. package/README.md +13 -5
  3. package/bin/wildshard.mjs +38 -0
  4. package/lint/declaration-config.d.mts +2 -0
  5. package/lint/declaration-config.mjs +19 -0
  6. package/lint/engine-plugin.d.mts +2 -0
  7. package/lint/engine-plugin.mjs +40 -0
  8. package/lint/host-callbacks.d.mts +6 -0
  9. package/lint/host-callbacks.mjs +123 -0
  10. package/lint/host-files.d.mts +1 -0
  11. package/lint/host-files.mjs +7 -0
  12. package/lint/layer-exports.d.mts +2 -0
  13. package/lint/layer-exports.mjs +21 -0
  14. package/lint/legacy-line-basis.json +995 -0
  15. package/lint/nine-tiling-baseline.json +35 -0
  16. package/lint/ratchet.json +11 -0
  17. package/lint/runtime-files.d.mts +12 -0
  18. package/lint/runtime-files.json +16 -0
  19. package/lint/runtime-files.mjs +69 -0
  20. package/lint/runtime-performance.d.mts +6 -0
  21. package/lint/runtime-performance.mjs +184 -0
  22. package/lint/sdk-plugin.d.mts +4 -0
  23. package/lint/sdk-plugin.mjs +134 -0
  24. package/lint/shardfile-boundaries.d.mts +10 -0
  25. package/lint/shardfile-boundaries.mjs +122 -0
  26. package/lint/tile-bake-debt.json +556 -0
  27. package/package.json +365 -3
  28. package/scripts/agent-parity.mjs +1524 -0
  29. package/scripts/agent-sync.mjs +518 -0
  30. package/scripts/apfs-clone.mjs +67 -0
  31. package/scripts/assert-store-layout.mjs +23 -0
  32. package/scripts/astc6-phone-cap.d.mts +3 -0
  33. package/scripts/astc6-phone-cap.mjs +137 -0
  34. package/scripts/audit-assets.d.mts +10 -0
  35. package/scripts/audit-assets.mjs +151 -0
  36. package/scripts/bake/coatFiles.d.mts +6 -0
  37. package/scripts/bake/coatFiles.mjs +37 -0
  38. package/scripts/bake/environment.d.mts +2 -0
  39. package/scripts/bake/environment.mjs +58 -0
  40. package/scripts/bake/far-proxies.mjs +45 -0
  41. package/scripts/bake/keyed-sky.d.mts +4 -0
  42. package/scripts/bake/keyed-sky.mjs +34 -0
  43. package/scripts/bake/movers.mjs +56 -0
  44. package/scripts/bake/nativeWorld.d.mts +6 -0
  45. package/scripts/bake/nativeWorld.mjs +43 -0
  46. package/scripts/bake/navmeshGround.ts +22 -0
  47. package/scripts/bake/near-placeholder.mjs +331 -0
  48. package/scripts/bake/placeholderShards.mjs +41 -0
  49. package/scripts/bake/skins.mjs +15 -0
  50. package/scripts/bake/template-skins.mjs +33 -0
  51. package/scripts/bake/viewmodelBytes.ts +26 -0
  52. package/scripts/bake/viewmodelPage.ts +11 -0
  53. package/scripts/bake/worldHost.d.mts +35 -0
  54. package/scripts/bake/worldHost.mjs +110 -0
  55. package/scripts/bake-astc6.cache.json +80 -0
  56. package/scripts/bake-astc6.far-reach.cache.json +23 -0
  57. package/scripts/bake-astc6.list.json +111 -0
  58. package/scripts/bake-astc6.mjs +279 -0
  59. package/scripts/bake-astc6.nalati-grasslands.cache.json +42 -0
  60. package/scripts/bake-catalogue.mjs +44 -0
  61. package/scripts/bake-check.mjs +54 -0
  62. package/scripts/bake-chunk.mjs +124 -0
  63. package/scripts/bake-cloud-field.mjs +24 -0
  64. package/scripts/bake-coats.mjs +110 -0
  65. package/scripts/bake-data-maps.d.mts +24 -0
  66. package/scripts/bake-data-maps.mjs +72 -0
  67. package/scripts/bake-entry-programs.mjs +117 -0
  68. package/scripts/bake-geometry.mjs +106 -0
  69. package/scripts/bake-hybrid-tiles.mjs +28 -0
  70. package/scripts/bake-ktx2.cache.json +276 -0
  71. package/scripts/bake-ktx2.list.json +365 -0
  72. package/scripts/bake-ktx2.mjs +477 -0
  73. package/scripts/bake-map-glb.mjs +127 -0
  74. package/scripts/bake-map-rest.d.mts +7 -0
  75. package/scripts/bake-map-rest.mjs +50 -0
  76. package/scripts/bake-maps.mjs +200 -0
  77. package/scripts/bake-navmesh.mjs +259 -0
  78. package/scripts/bake-packs.mjs +129 -0
  79. package/scripts/bake-pickups.mjs +102 -0
  80. package/scripts/bake-query-terrain.mjs +64 -0
  81. package/scripts/bake-recurve-pool.mjs +16 -0
  82. package/scripts/bake-section-schemas.d.mts +3 -0
  83. package/scripts/bake-template-shardfile.mjs +32 -0
  84. package/scripts/bake-textures.mjs +80 -0
  85. package/scripts/bake-viewmodel-sets.json +45 -0
  86. package/scripts/bake-viewmodel-sets.mjs +137 -0
  87. package/scripts/bake-voxel-ao.mjs +119 -0
  88. package/scripts/bake-water-ripples.mjs +25 -0
  89. package/scripts/blender/README.md +129 -0
  90. package/scripts/blender/build.sh +166 -0
  91. package/scripts/blender/lib/export-scene.mjs +129 -0
  92. package/scripts/blender/lib/glb-digest.mjs +188 -0
  93. package/scripts/blender/lib/glb.py +68 -0
  94. package/scripts/blender/lib/save_blend.py +17 -0
  95. package/scripts/blender/lib/world_fixture.py +55 -0
  96. package/scripts/blender/targets.json +591 -0
  97. package/scripts/build-sdk.mjs +95 -0
  98. package/scripts/build-shardfiles.d.mts +7 -0
  99. package/scripts/build-shardfiles.mjs +206 -0
  100. package/scripts/capture-hero.mjs +137 -0
  101. package/scripts/check-lift-review.mjs +23 -0
  102. package/scripts/chromium-keychain-check.mjs +139 -0
  103. package/scripts/chromium-keychain.d.mts +1 -0
  104. package/scripts/chromium-keychain.mjs +5 -0
  105. package/scripts/compile-script.d.mts +3 -0
  106. package/scripts/compile-script.mjs +8 -0
  107. package/scripts/creature-color.mjs +255 -0
  108. package/scripts/decide/calibrate.py +127 -0
  109. package/scripts/decide/calibration/2026-10-03/labels-s1.tsv +281 -0
  110. package/scripts/decide/calibration/2026-10-03/labels-s2.tsv +97 -0
  111. package/scripts/decide/calibration/2026-10-03/labels-s3.tsv +48 -0
  112. package/scripts/decide/calibration/2026-10-03/labels-s3b.tsv +26 -0
  113. package/scripts/decide/calibration/2026-10-03/res-capture-status-v1.jsonl +376 -0
  114. package/scripts/decide/calibration/2026-10-03/res-text-garbled-strings.jsonl +48 -0
  115. package/scripts/decide/calibration/2026-10-03/res-text-garbled-v1.jsonl +73 -0
  116. package/scripts/decide/decide.py +262 -0
  117. package/scripts/decide/decide.sh +50 -0
  118. package/scripts/decide/layer-purity-pilot.mjs +41 -0
  119. package/scripts/decide/sets/capture-status.json +46 -0
  120. package/scripts/decide/sets/layer-purity.json +28 -0
  121. package/scripts/decide/sets/text-garbled.json +17 -0
  122. package/scripts/decide/test_decide.py +37 -0
  123. package/scripts/docs.mjs +15 -0
  124. package/scripts/entry-reads/crawl.ts +152 -0
  125. package/scripts/entry-reads/tsconfig.json +25 -0
  126. package/scripts/gen-format-schema.d.mts +2 -0
  127. package/scripts/gen-format-schema.mjs +21 -0
  128. package/scripts/gen-host-catalogue.d.mts +14 -0
  129. package/scripts/gen-host-catalogue.mjs +108 -0
  130. package/scripts/gen-shard-layout-doc.d.mts +4 -0
  131. package/scripts/gen-shard-layout-doc.mjs +55 -0
  132. package/scripts/gen-shards.d.mts +17 -0
  133. package/scripts/gen-shards.mjs +311 -0
  134. package/scripts/goldens/capture-inputs.d.mts +4 -0
  135. package/scripts/goldens/capture-inputs.mjs +34 -0
  136. package/scripts/goldens/colour_shift.py +27 -0
  137. package/scripts/goldens/native-residency.d.mts +10 -0
  138. package/scripts/goldens/native-residency.mjs +104 -0
  139. package/scripts/goldens/plot-inputs.d.mts +12 -0
  140. package/scripts/goldens/plot-inputs.mjs +46 -0
  141. package/scripts/gpu-texmem.mjs +98 -0
  142. package/scripts/horizon-matte/config.py +24 -0
  143. package/scripts/horizon-matte/encode.py +91 -0
  144. package/scripts/horizon-matte/key.py +141 -0
  145. package/scripts/horizon-matte/mkjobs.py +33 -0
  146. package/scripts/horizon-matte/mkjobs_day2.py +11 -0
  147. package/scripts/horizon-matte/overlap.py +80 -0
  148. package/scripts/horizon-matte/run_codex.py +57 -0
  149. package/scripts/horizon-matte/stitch.py +133 -0
  150. package/scripts/img2mesh/CC0.md +105 -0
  151. package/scripts/img2mesh/README.md +209 -0
  152. package/scripts/img2mesh/ab_board.py +102 -0
  153. package/scripts/img2mesh/birds/birds.json +255 -0
  154. package/scripts/img2mesh/birds/birds_atlas.py +150 -0
  155. package/scripts/img2mesh/birds/birds_fix_preview.mjs +103 -0
  156. package/scripts/img2mesh/birds/birds_fix_render.py +75 -0
  157. package/scripts/img2mesh/birds/birds_pack.py +110 -0
  158. package/scripts/img2mesh/birds/birds_phone_b.py +112 -0
  159. package/scripts/img2mesh/birds/birds_post.py +550 -0
  160. package/scripts/img2mesh/birds/birds_render.py +125 -0
  161. package/scripts/img2mesh/birds/birds_sheet.py +33 -0
  162. package/scripts/img2mesh/birds/birds_view.py +60 -0
  163. package/scripts/img2mesh/board.py +100 -0
  164. package/scripts/img2mesh/build_cc0.sh +52 -0
  165. package/scripts/img2mesh/build_driftwood.sh +12 -0
  166. package/scripts/img2mesh/build_faces.sh +53 -0
  167. package/scripts/img2mesh/build_props.py +81 -0
  168. package/scripts/img2mesh/cc0_export.py +186 -0
  169. package/scripts/img2mesh/driftwood_post.py +571 -0
  170. package/scripts/img2mesh/e304_faces.sh +67 -0
  171. package/scripts/img2mesh/face_remaster.py +911 -0
  172. package/scripts/img2mesh/face_views.py +95 -0
  173. package/scripts/img2mesh/faces-e304.json +9 -0
  174. package/scripts/img2mesh/faces.json +30 -0
  175. package/scripts/img2mesh/head_cut.py +100 -0
  176. package/scripts/img2mesh/hi3d_paint.py +94 -0
  177. package/scripts/img2mesh/hi3d_refine.py +161 -0
  178. package/scripts/img2mesh/hunyuan_cpu_rasterizer.sh +42 -0
  179. package/scripts/img2mesh/pine_hollow_phone.sh +13 -0
  180. package/scripts/img2mesh/props/coral-arch.json +32 -0
  181. package/scripts/img2mesh/props/ember-furnace.json +30 -0
  182. package/scripts/img2mesh/props/night-market-gate.json +10 -0
  183. package/scripts/img2mesh/render_still.py +86 -0
  184. package/scripts/img2mesh/rig_strip.mjs +46 -0
  185. package/scripts/img2mesh/rig_transfer.mjs +104 -0
  186. package/scripts/img2mesh/split_sheet.py +48 -0
  187. package/scripts/img2mesh/trellis_batch.py +110 -0
  188. package/scripts/img2mesh/versus_board.py +114 -0
  189. package/scripts/import-bundle.d.mts +2 -0
  190. package/scripts/import-bundle.mjs +20 -0
  191. package/scripts/ktx2-ab-board.py +133 -0
  192. package/scripts/ktx2-ab.mjs +111 -0
  193. package/scripts/ktx2-settings.mjs +18 -0
  194. package/scripts/land.d.mts +14 -0
  195. package/scripts/land.mjs +809 -0
  196. package/scripts/lint-dispatch.mjs +14 -0
  197. package/scripts/map-bake-frames.d.mts +4 -0
  198. package/scripts/map-bake-frames.mjs +23 -0
  199. package/scripts/map-geometry.d.mts +9 -0
  200. package/scripts/map-geometry.mjs +29 -0
  201. package/scripts/map-world.mjs +162 -0
  202. package/scripts/mockup-local.sh +46 -0
  203. package/scripts/music/export-midi.mjs +68 -0
  204. package/scripts/music/gen/analyze.py +308 -0
  205. package/scripts/music/gen/audio_jobs.py +46 -0
  206. package/scripts/music/gen/briefs.json +51 -0
  207. package/scripts/music/gen/build_page.py +334 -0
  208. package/scripts/music/gen/folk.json +3187 -0
  209. package/scripts/music/gen/gen_ace_step.py +156 -0
  210. package/scripts/music/gen/gen_heartmula.py +187 -0
  211. package/scripts/music/gen/gen_minimax.py +143 -0
  212. package/scripts/music/gen/gen_sao.py +122 -0
  213. package/scripts/music/gen/gen_sao_small.py +104 -0
  214. package/scripts/music/gen/gen_sfx.py +98 -0
  215. package/scripts/music/gen/gen_sfx_ezaudio.py +112 -0
  216. package/scripts/music/gen/gen_sfx_moss.py +112 -0
  217. package/scripts/music/gen/models.json +61 -0
  218. package/scripts/music/gen/nalati-jobs.json +104 -0
  219. package/scripts/music/gen/nalati-score-build.json +119 -0
  220. package/scripts/music/gen/nalati-score.json +3448 -0
  221. package/scripts/music/gen/ob7-fit-decisions.json +38 -0
  222. package/scripts/music/gen/ob7-score-jobs.json +152 -0
  223. package/scripts/music/gen/ob7-sfx-jobs.json +897 -0
  224. package/scripts/music/gen/ob7_build.py +469 -0
  225. package/scripts/music/gen/ob7_generate.py +67 -0
  226. package/scripts/music/gen/ob7_run.sh +42 -0
  227. package/scripts/music/gen/orchestral.json +3187 -0
  228. package/scripts/music/gen/own_score.py +486 -0
  229. package/scripts/music/gen/ph-jobs.json +27 -0
  230. package/scripts/music/gen/ph_page.py +222 -0
  231. package/scripts/music/gen/piano.json +3175 -0
  232. package/scripts/music/gen/rank_v3.py +248 -0
  233. package/scripts/music/gen/sfx-best.json +2486 -0
  234. package/scripts/music/gen/sfx-ezaudio.json +4082 -0
  235. package/scripts/music/gen/sfx-jobs.json +57 -0
  236. package/scripts/music/gen/sfx-minimax-jobs.json +16 -0
  237. package/scripts/music/gen/sfx-minimax.json +289 -0
  238. package/scripts/music/gen/sfx-moss.json +4082 -0
  239. package/scripts/music/gen/sfx-nalati-b3-jobs.json +17 -0
  240. package/scripts/music/gen/sfx-nalati-jobs.json +338 -0
  241. package/scripts/music/gen/sfx-nalati.json +11202 -0
  242. package/scripts/music/gen/sfx-nd-jobs.json +57 -0
  243. package/scripts/music/gen/sfx-nd-moss.json +2097 -0
  244. package/scripts/music/gen/sfx-nd-sa3-medium.json +2097 -0
  245. package/scripts/music/gen/sfx-nd-summary.json +38 -0
  246. package/scripts/music/gen/sfx-peaks.json +7 -0
  247. package/scripts/music/gen/sfx-ph-jobs.json +169 -0
  248. package/scripts/music/gen/sfx-ph-moss.json +6564 -0
  249. package/scripts/music/gen/sfx-ph-sa3-medium.json +7239 -0
  250. package/scripts/music/gen/sfx-ph-summary.json +63 -0
  251. package/scripts/music/gen/sfx-sa3-medium.json +4082 -0
  252. package/scripts/music/gen/sfx-sa3.json +4082 -0
  253. package/scripts/music/gen/sfx-summary.json +107 -0
  254. package/scripts/music/gen/sfx_build.py +332 -0
  255. package/scripts/music/gen/sfx_merge.py +255 -0
  256. package/scripts/music/gen/sfx_minimax.py +61 -0
  257. package/scripts/music/gen/sfx_nalati.py +331 -0
  258. package/scripts/music/gen/sfx_sprite.py +424 -0
  259. package/scripts/music/gen/stems.py +539 -0
  260. package/scripts/music/gen/test_loop_meter.py +29 -0
  261. package/scripts/music/gen/test_ob7_provenance.py +77 -0
  262. package/scripts/music/gen/v3-folk-build.json +148 -0
  263. package/scripts/music/gen/v3-folk.json +1818 -0
  264. package/scripts/music/gen/v3-jobs.json +145 -0
  265. package/scripts/music/gen/v3-orchestral-build.json +148 -0
  266. package/scripts/music/gen/v3-orchestral.json +1813 -0
  267. package/scripts/music/gen/v3-ph-folk-build.json +94 -0
  268. package/scripts/music/gen/v3-ph-folk.json +1806 -0
  269. package/scripts/music/gen/v3-ph-orchestral-build.json +94 -0
  270. package/scripts/music/gen/v3-ph-orchestral.json +1824 -0
  271. package/scripts/music/gen/v3-ph-piano-build.json +94 -0
  272. package/scripts/music/gen/v3-ph-piano.json +1818 -0
  273. package/scripts/music/gen/v3-piano-build.json +148 -0
  274. package/scripts/music/gen/v3-piano.json +1813 -0
  275. package/scripts/music/wildshard-theme.mid +0 -0
  276. package/scripts/music/wildshard-trailer30.mid +0 -0
  277. package/scripts/named-blob-output.d.mts +8 -0
  278. package/scripts/named-blob-output.mjs +48 -0
  279. package/scripts/pack-all.mjs +15 -0
  280. package/scripts/pid-lock.d.mts +1 -0
  281. package/scripts/pid-lock.mjs +63 -0
  282. package/scripts/practice/bake_dummy.py +53 -0
  283. package/scripts/practice/build_dummies.sh +43 -0
  284. package/scripts/practice/dummy_parts.py +568 -0
  285. package/scripts/practice/dummy_rig_gate.py +139 -0
  286. package/scripts/practice/gate_sheet.py +36 -0
  287. package/scripts/practice/generate_dummy_unimate.py +132 -0
  288. package/scripts/practice/pack_dummy.mjs +59 -0
  289. package/scripts/practice/repair_dummy_weights.mjs +68 -0
  290. package/scripts/practice/rig_dummy.py +828 -0
  291. package/scripts/practice/verify_unimate_skin.mjs +356 -0
  292. package/scripts/preparation-seed.mjs +15 -0
  293. package/scripts/prepare-basis-tool.mjs +6 -0
  294. package/scripts/prepare-product.d.mts +14 -0
  295. package/scripts/prepare-product.mjs +101 -0
  296. package/scripts/product-build-tools.d.mts +3 -0
  297. package/scripts/product-build-tools.json +3 -0
  298. package/scripts/product-build-tools.mjs +31 -0
  299. package/scripts/publish-public.mjs +7 -0
  300. package/scripts/push-tables.d.mts +1 -0
  301. package/scripts/push-tables.mjs +28 -0
  302. package/scripts/record-shard-mounts.mjs +133 -0
  303. package/scripts/sdk-externals.d.mts +2 -0
  304. package/scripts/sdk-externals.mjs +2 -0
  305. package/scripts/section-inventory.ts +209 -0
  306. package/scripts/select-candidate.mjs +15 -0
  307. package/scripts/shard-build-pool.d.mts +4 -0
  308. package/scripts/shard-build-pool.mjs +53 -0
  309. package/scripts/shard-line-baseline.json +17 -0
  310. package/scripts/shard-milestones.d.mts +15 -0
  311. package/scripts/shard-milestones.mjs +105 -0
  312. package/scripts/shard-output-report.d.mts +9 -0
  313. package/scripts/shard-output-report.mjs +85 -0
  314. package/scripts/shard-platform-cli.mjs +93 -0
  315. package/scripts/shard-progress.mjs +212 -0
  316. package/scripts/shard-timelapse.py +102 -0
  317. package/scripts/shardfile-cold-boot.mjs +79 -0
  318. package/scripts/shardfile-vite.d.mts +4 -0
  319. package/scripts/shardfile-vite.mjs +20 -0
  320. package/scripts/simplify-models.mjs +24 -0
  321. package/scripts/site-facts.mjs +88 -0
  322. package/scripts/test-template-gate.mjs +44 -0
  323. package/scripts/test_golden_compare.py +68 -0
  324. package/scripts/tex-tiers.cache.json +181 -0
  325. package/scripts/tex-tiers.mjs +240 -0
  326. package/scripts/texmem-probe.mjs +184 -0
  327. package/scripts/unused-assets.mjs +173 -0
  328. package/scripts/vite-tmp.d.mts +23 -0
  329. package/scripts/vite-tmp.mjs +157 -0
  330. package/scripts/wave-line-baselines.json +32 -0
  331. package/scripts/wildshard.d.mts +4 -0
  332. package/scripts/wildshard.mjs +105 -0
  333. package/scripts/witness-checkpoints.d.mts +10 -0
  334. package/scripts/witness-checkpoints.mjs +84 -0
  335. package/scripts/witness-generation.d.mts +10 -0
  336. package/scripts/witness-generation.mjs +45 -0
  337. package/scripts/witness-manifests.d.mts +8 -0
  338. package/scripts/witness-manifests.mjs +157 -0
  339. package/scripts/worktree-ignore.d.mts +4 -0
  340. package/scripts/worktree-ignore.mjs +36 -0
  341. package/scripts/worktree-reap.mjs +214 -0
  342. package/scripts/worktree.mjs +396 -0
  343. package/scripts/worldclaw/capture-front.sh +28 -0
  344. package/scripts/worldclaw/design-template.md +62 -0
  345. package/scripts/worldclaw/spec-map.py +92 -0
  346. package/scripts/worldclaw/spec.ts +96 -0
  347. package/skills/wildshard/SKILL.md +50 -0
  348. package/skills/wildshard-goldens/SKILL.md +54 -0
  349. package/skills/wildshard-mockup-to-model/SKILL.md +56 -0
  350. package/skills/wildshard-upgrade/SKILL.md +46 -0
  351. package/src/.oxfmtrc.json +50 -0
  352. package/src/.oxlintrc.json +173 -0
  353. package/src/cli/account/account.ts +199 -0
  354. package/src/cli/account/command.ts +193 -0
  355. package/src/cli/account/key.ts +154 -0
  356. package/src/cli/args.ts +97 -0
  357. package/src/cli/audio/audio.ts +24 -0
  358. package/src/cli/bin.mjs +8 -0
  359. package/src/cli/delete/delete.ts +258 -0
  360. package/src/cli/help.ts +196 -0
  361. package/src/cli/hero/adopt.ts +103 -0
  362. package/src/cli/hero/hero.ts +112 -0
  363. package/src/cli/hero/stamp.ts +298 -0
  364. package/src/cli/main.ts +292 -0
  365. package/src/cli/report.ts +16 -0
  366. package/src/cli/shardfile/command.ts +50 -0
  367. package/src/cli/shardfile/shardfile.ts +192 -0
  368. package/src/cli/upload/api.ts +246 -0
  369. package/src/cli/upload/compress.ts +55 -0
  370. package/src/cli/upload/hero.ts +62 -0
  371. package/src/cli/upload/placement.ts +115 -0
  372. package/src/cli/upload/provenance.ts +192 -0
  373. package/src/cli/upload/signature.ts +30 -0
  374. package/src/cli/upload/upload.ts +269 -0
  375. package/src/cli/upload/validate.ts +74 -0
  376. package/src/cli/upload/wire.ts +147 -0
  377. package/src/cli/version.ts +63 -0
  378. package/src/commons/bake/portableMath.ts +187 -0
  379. package/src/commons/catalogue.ts +10 -0
  380. package/src/commons/courseProgram.ts +32 -0
  381. package/src/commons/practiceCourse.ts +16 -0
  382. package/src/commons/scripts/abi.as +14 -0
  383. package/src/commons/scripts/bridge.as +14 -0
  384. package/src/commons/scripts/course.as +63 -0
  385. package/src/scripts/ask-new.sh +29 -0
  386. package/src/scripts/asks.mjs +141 -0
  387. package/src/scripts/herdr-prompt.sh +34 -0
  388. package/src/scripts/herdr-question-open.sh +67 -0
  389. package/src/scripts/md-wrap.mjs +229 -0
  390. package/src/server/app.ts +19 -0
  391. package/src/server/serve.ts +49 -0
  392. package/src/sharddev/admission.ts +7 -0
  393. package/src/sharddev/arenaView.ts +15 -0
  394. package/src/sharddev/as/groupBankV2.ts +36 -0
  395. package/src/sharddev/as/groupStepV2.ts +13 -0
  396. package/src/sharddev/as/ws.ts +30 -0
  397. package/src/sharddev/as/wsV2.ts +180 -0
  398. package/src/sharddev/assemblyscriptCompiler.d.mts +5 -0
  399. package/src/sharddev/assemblyscriptCompiler.mjs +14 -0
  400. package/src/sharddev/assetHandle.ts +84 -0
  401. package/src/sharddev/assetOwner.ts +70 -0
  402. package/src/sharddev/assetScope.ts +30 -0
  403. package/src/sharddev/assets.ts +21 -0
  404. package/src/sharddev/audio.ts +9 -0
  405. package/src/sharddev/audioEncode.ts +211 -0
  406. package/src/sharddev/author.ts +3 -0
  407. package/src/sharddev/authorError.ts +28 -0
  408. package/src/sharddev/authorManifest.ts +39 -0
  409. package/src/sharddev/bake/annulus.ts +19 -0
  410. package/src/sharddev/bake/assemblyscriptMemo.ts +76 -0
  411. package/src/sharddev/bake/assemblyscriptMemoPort.ts +4 -0
  412. package/src/sharddev/bake/authoredWorld.ts +201 -0
  413. package/src/sharddev/bake/basisEncoder.ts +95 -0
  414. package/src/sharddev/bake/basisGlb.ts +85 -0
  415. package/src/sharddev/bake/basisTool.ts +74 -0
  416. package/src/sharddev/bake/basisToolInputs.ts +476 -0
  417. package/src/sharddev/bake/byteCodec.ts +33 -0
  418. package/src/sharddev/bake/canvasAtlas.ts +406 -0
  419. package/src/sharddev/bake/coarseCopy.ts +59 -0
  420. package/src/sharddev/bake/colliders.ts +87 -0
  421. package/src/sharddev/bake/compactGlb.ts +224 -0
  422. package/src/sharddev/bake/compileScript.ts +119 -0
  423. package/src/sharddev/bake/compileScriptV2.ts +75 -0
  424. package/src/sharddev/bake/contactRows.ts +84 -0
  425. package/src/sharddev/bake/creaturePlacement.ts +117 -0
  426. package/src/sharddev/bake/export.ts +67 -0
  427. package/src/sharddev/bake/facetedGeometry.ts +379 -0
  428. package/src/sharddev/bake/farImpostor.ts +120 -0
  429. package/src/sharddev/bake/forest.ts +100 -0
  430. package/src/sharddev/bake/format-hook.mjs +2 -0
  431. package/src/sharddev/bake/generatorGlb.ts +23 -0
  432. package/src/sharddev/bake/geometryBounds.ts +77 -0
  433. package/src/sharddev/bake/geometryError.ts +48 -0
  434. package/src/sharddev/bake/glb.ts +355 -0
  435. package/src/sharddev/bake/glbCompression.ts +143 -0
  436. package/src/sharddev/bake/gltfSource.ts +59 -0
  437. package/src/sharddev/bake/groundMap.ts +142 -0
  438. package/src/sharddev/bake/image.ts +20 -0
  439. package/src/sharddev/bake/isleMap.ts +64 -0
  440. package/src/sharddev/bake/json.mjs +84 -0
  441. package/src/sharddev/bake/keyedSky.ts +47 -0
  442. package/src/sharddev/bake/keyedSkyMemo.ts +39 -0
  443. package/src/sharddev/bake/kinds.ts +137 -0
  444. package/src/sharddev/bake/lightSources.ts +31 -0
  445. package/src/sharddev/bake/mapAssembly.ts +84 -0
  446. package/src/sharddev/bake/mapRaster.ts +173 -0
  447. package/src/sharddev/bake/mapRest.ts +57 -0
  448. package/src/sharddev/bake/mapScenes.ts +234 -0
  449. package/src/sharddev/bake/materialGraph.ts +32 -0
  450. package/src/sharddev/bake/meadow.ts +27 -0
  451. package/src/sharddev/bake/meshoptChoiceMemo.ts +34 -0
  452. package/src/sharddev/bake/nativeInteractionFacts.ts +5 -0
  453. package/src/sharddev/bake/nativeLattice.ts +178 -0
  454. package/src/sharddev/bake/nativeRaster.ts +106 -0
  455. package/src/sharddev/bake/nativeTerrainField.ts +11 -0
  456. package/src/sharddev/bake/navigation-json.mjs +38 -0
  457. package/src/sharddev/bake/navigation.ts +113 -0
  458. package/src/sharddev/bake/navigationAsset.ts +18 -0
  459. package/src/sharddev/bake/nearPlaceholder.ts +206 -0
  460. package/src/sharddev/bake/normalizeRig.ts +80 -0
  461. package/src/sharddev/bake/phoneAstc.ts +93 -0
  462. package/src/sharddev/bake/placeholders.ts +581 -0
  463. package/src/sharddev/bake/placement.ts +80 -0
  464. package/src/sharddev/bake/portableBytes.ts +18 -0
  465. package/src/sharddev/bake/portableBytesMemo.ts +50 -0
  466. package/src/sharddev/bake/practiceCourse.ts +49 -0
  467. package/src/sharddev/bake/primitives.ts +96 -0
  468. package/src/sharddev/bake/props.ts +443 -0
  469. package/src/sharddev/bake/questPlacement.ts +98 -0
  470. package/src/sharddev/bake/rawTexture.ts +26 -0
  471. package/src/sharddev/bake/riderArms.ts +97 -0
  472. package/src/sharddev/bake/rig.ts +95 -0
  473. package/src/sharddev/bake/riggedHullRecipes.ts +40 -0
  474. package/src/sharddev/bake/signPlacements.ts +25 -0
  475. package/src/sharddev/bake/simplifier.ts +52 -0
  476. package/src/sharddev/bake/skinned.ts +312 -0
  477. package/src/sharddev/bake/slabChunks.ts +149 -0
  478. package/src/sharddev/bake/slabs.ts +263 -0
  479. package/src/sharddev/bake/source-loader.mjs +55 -0
  480. package/src/sharddev/bake/sourceMetadata.ts +54 -0
  481. package/src/sharddev/bake/species.ts +368 -0
  482. package/src/sharddev/bake/specimenCatalogue.ts +47 -0
  483. package/src/sharddev/bake/splatGround.ts +141 -0
  484. package/src/sharddev/bake/staticMaterials.ts +171 -0
  485. package/src/sharddev/bake/terrain.ts +195 -0
  486. package/src/sharddev/bake/texture.ts +33 -0
  487. package/src/sharddev/bake/textureWasm.ts +81 -0
  488. package/src/sharddev/bake/tileEncoder.ts +11 -0
  489. package/src/sharddev/bake/tileGrid.ts +62 -0
  490. package/src/sharddev/bake/v2Finite.ts +160 -0
  491. package/src/sharddev/bake/v2Fuel.ts +71 -0
  492. package/src/sharddev/bake/wholePartition.ts +74 -0
  493. package/src/sharddev/bake/wholePieceJoin.ts +147 -0
  494. package/src/sharddev/bake/world.ts +173 -0
  495. package/src/sharddev/bake/worldCollision.ts +128 -0
  496. package/src/sharddev/bake/worldGeometry.ts +237 -0
  497. package/src/sharddev/bake/worldGlb.ts +123 -0
  498. package/src/sharddev/bake/worldImage.ts +12 -0
  499. package/src/sharddev/bake/worldLod.ts +128 -0
  500. package/src/sharddev/bake/worldRows.ts +102 -0
  501. package/src/sharddev/bake/worldTextureMemo.ts +63 -0
  502. package/src/sharddev/bake/zstdBytesMemo.ts +52 -0
  503. package/src/sharddev/bake.ts +193 -0
  504. package/src/sharddev/bakePublication.ts +31 -0
  505. package/src/sharddev/behaviourSource.ts +94 -0
  506. package/src/sharddev/bin/wildshard.mjs +7 -0
  507. package/src/sharddev/blobBytes.ts +65 -0
  508. package/src/sharddev/blobs.ts +138 -0
  509. package/src/sharddev/bootInventory.ts +129 -0
  510. package/src/sharddev/bossProfiles.ts +18 -0
  511. package/src/sharddev/buildBehaviour.ts +77 -0
  512. package/src/sharddev/buildCacheMetrics.ts +17 -0
  513. package/src/sharddev/buildDecisionScripts.ts +122 -0
  514. package/src/sharddev/check.ts +117 -0
  515. package/src/sharddev/checkProject.ts +126 -0
  516. package/src/sharddev/cli.ts +191 -0
  517. package/src/sharddev/clientChannels.ts +169 -0
  518. package/src/sharddev/clientScripts.ts +10 -0
  519. package/src/sharddev/commons.ts +77 -0
  520. package/src/sharddev/commonsCosts.ts +11 -0
  521. package/src/sharddev/compileMovers.ts +11 -0
  522. package/src/sharddev/configBoundary.ts +6 -0
  523. package/src/sharddev/cookInput.ts +40 -0
  524. package/src/sharddev/crowds.ts +6 -0
  525. package/src/sharddev/decisionBindingMap.ts +11 -0
  526. package/src/sharddev/decisionScriptBindings.ts +117 -0
  527. package/src/sharddev/decisionScripts.ts +28 -0
  528. package/src/sharddev/decisionSource.ts +51 -0
  529. package/src/sharddev/dev.ts +113 -0
  530. package/src/sharddev/director.ts +26 -0
  531. package/src/sharddev/directorAbi.ts +77 -0
  532. package/src/sharddev/discoveryDocument.ts +97 -0
  533. package/src/sharddev/draft.ts +11 -0
  534. package/src/sharddev/eliteEntryRows.ts +29 -0
  535. package/src/sharddev/entries.ts +76 -0
  536. package/src/sharddev/entryReads.ts +73 -0
  537. package/src/sharddev/executeBundle.ts +55 -0
  538. package/src/sharddev/finds.ts +5 -0
  539. package/src/sharddev/formatJsonSchema.ts +3 -0
  540. package/src/sharddev/generationCache.ts +257 -0
  541. package/src/sharddev/generationRecipe.ts +94 -0
  542. package/src/sharddev/handwritten.ts +110 -0
  543. package/src/sharddev/immutable.ts +14 -0
  544. package/src/sharddev/interactions.ts +38 -0
  545. package/src/sharddev/kit/bakedGeometry.ts +16 -0
  546. package/src/sharddev/kit/geometryPack.ts +110 -0
  547. package/src/sharddev/ledger.ts +13 -0
  548. package/src/sharddev/looks/tileField.ts +67 -0
  549. package/src/sharddev/materialGraphFiles.ts +57 -0
  550. package/src/sharddev/materials.ts +574 -0
  551. package/src/sharddev/measure.ts +18 -0
  552. package/src/sharddev/modes.ts +115 -0
  553. package/src/sharddev/moverPrograms.ts +213 -0
  554. package/src/sharddev/movers.ts +75 -0
  555. package/src/sharddev/nativePopulationRows.ts +46 -0
  556. package/src/sharddev/newProject.ts +247 -0
  557. package/src/sharddev/noise.ts +54 -0
  558. package/src/sharddev/outputProduct.ts +188 -0
  559. package/src/sharddev/outputRuntime.ts +66 -0
  560. package/src/sharddev/performancePolicy.ts +18 -0
  561. package/src/sharddev/phasedBoss.ts +34 -0
  562. package/src/sharddev/physics.ts +194 -0
  563. package/src/sharddev/platformSections.ts +42 -0
  564. package/src/sharddev/plumbing.ts +8 -0
  565. package/src/sharddev/productOutput.ts +128 -0
  566. package/src/sharddev/project.ts +337 -0
  567. package/src/sharddev/projectCompilerIdentity.ts +94 -0
  568. package/src/sharddev/projectDecisions.ts +66 -0
  569. package/src/sharddev/projectEntryProof.ts +32 -0
  570. package/src/sharddev/projectGeneration.ts +219 -0
  571. package/src/sharddev/projectInputFiles.ts +47 -0
  572. package/src/sharddev/projectManifest.ts +108 -0
  573. package/src/sharddev/projectMap.ts +35 -0
  574. package/src/sharddev/projectOutput.ts +242 -0
  575. package/src/sharddev/projectPolicy.ts +17 -0
  576. package/src/sharddev/projectSections.ts +27 -0
  577. package/src/sharddev/questGraph.ts +25 -0
  578. package/src/sharddev/quests.ts +65 -0
  579. package/src/sharddev/random.ts +61 -0
  580. package/src/sharddev/refusals.ts +234 -0
  581. package/src/sharddev/reportCard.ts +13 -0
  582. package/src/sharddev/returnProjectionV2.ts +81 -0
  583. package/src/sharddev/rows.ts +192 -0
  584. package/src/sharddev/runtimeImports.ts +38 -0
  585. package/src/sharddev/runtimeMirrors.ts +39 -0
  586. package/src/sharddev/runtimePerformance.ts +38 -0
  587. package/src/sharddev/scene.ts +321 -0
  588. package/src/sharddev/sceneAnimation.ts +54 -0
  589. package/src/sharddev/sceneAudio.ts +64 -0
  590. package/src/sharddev/sceneDeclarations.ts +100 -0
  591. package/src/sharddev/sceneGraph.ts +139 -0
  592. package/src/sharddev/sceneTransform.ts +12 -0
  593. package/src/sharddev/schemaValidation.ts +61 -0
  594. package/src/sharddev/sections.ts +47 -0
  595. package/src/sharddev/shardSource.ts +59 -0
  596. package/src/sharddev/sourceReader.ts +26 -0
  597. package/src/sharddev/spawns.ts +38 -0
  598. package/src/sharddev/species/clips.ts +24 -0
  599. package/src/sharddev/species.ts +29 -0
  600. package/src/sharddev/speciesBrains.ts +19 -0
  601. package/src/sharddev/synth.ts +66 -0
  602. package/src/sharddev/test/compileDualScriptV2.ts +71 -0
  603. package/src/sharddev/test/compileSimV2.ts +21 -0
  604. package/src/sharddev/test/diskScriptScenario.ts +86 -0
  605. package/src/sharddev/test/scriptScenario.ts +249 -0
  606. package/src/sharddev/test/scriptSource.ts +12 -0
  607. package/src/sharddev/version.ts +4 -0
  608. package/src/sharddev/weapons/bowProfile.ts +20 -0
  609. package/src/sharddev/weapons/firearmRows.ts +11 -0
  610. package/src/sharddev/weapons/meleeProfile.ts +71 -0
  611. package/src/sharddev/weapons/thrownProfile.ts +10 -0
  612. package/src/sharddev/worldScenes.ts +308 -0
  613. package/src/sharddev/worldSource.ts +82 -0
  614. package/src/shards/_template/README.md +78 -0
  615. package/src/shards/_template/assets/2bf489fdb15f1734ddb4c4f32d500ec6da85c765ec7a4eb28dc6781160e7ec8c +0 -0
  616. package/src/shards/_template/assets/97ec4d8f75f5fa6239ee919444d6dc19fd35896bb305930c1f050ac6e0e0e6a6 +1 -0
  617. package/src/shards/_template/assets/a6a587a31327f936b1b04c05ade818c73fc8964260918662db43539465e27586 +0 -0
  618. package/src/shards/_template/assets/b4fbde0422e125b498c3dc8b9a5cc2516c8598f09e9d0e5f6b639b32f98179e6 +0 -0
  619. package/src/shards/_template/assets/bfa4dfc9c18979f904557ee8deab0058b8a399be10266f5fb1578b403f482fd4 +1 -0
  620. package/src/shards/_template/assets/ef3b7ff4fd22715771cb7d68a3977a903c5e7c3dc293542687d04b3ef3ace2cb +0 -0
  621. package/src/shards/_template/assets/f2db05998615ce1cb79ea96be32c168842eb6a2b34ec01feb86d36404603ee54 +0 -0
  622. package/src/shards/_template/assets/fef98ebb7fce6f66b26e78ac699e5c90f9bdcfaf8cabeb2b58125347eea8b4ab +0 -0
  623. package/src/shards/_template/behaviour/boss.as +39 -0
  624. package/src/shards/_template/behaviour/door.as +32 -0
  625. package/src/shards/_template/behaviour/hooks.json +129 -0
  626. package/src/shards/_template/behaviour/idle.as +75 -0
  627. package/src/shards/_template/behaviour/items.as +22 -0
  628. package/src/shards/_template/card/landscape.jpg +0 -0
  629. package/src/shards/_template/card/portrait.jpg +0 -0
  630. package/src/shards/_template/card/thumb.jpg +0 -0
  631. package/src/shards/_template/data/audio.json +45 -0
  632. package/src/shards/_template/data/bossDecision.json +83 -0
  633. package/src/shards/_template/data/budgets.json +70 -0
  634. package/src/shards/_template/data/card.json +281 -0
  635. package/src/shards/_template/data/clientScripts.json +987 -0
  636. package/src/shards/_template/data/creatures.json +65 -0
  637. package/src/shards/_template/data/director.json +39 -0
  638. package/src/shards/_template/data/encounters.json +96 -0
  639. package/src/shards/_template/data/items.json +172 -0
  640. package/src/shards/_template/data/layout.json +66 -0
  641. package/src/shards/_template/data/ledger.json +32 -0
  642. package/src/shards/_template/data/look.json +521 -0
  643. package/src/shards/_template/data/map.json +64 -0
  644. package/src/shards/_template/data/moves.json +16 -0
  645. package/src/shards/_template/data/placeholder.json +8 -0
  646. package/src/shards/_template/data/plumbing.json +32 -0
  647. package/src/shards/_template/data/quests.json +223 -0
  648. package/src/shards/_template/data/rows.json +423 -0
  649. package/src/shards/_template/data/skins.json +66 -0
  650. package/src/shards/_template/data/spawn.json +6 -0
  651. package/src/shards/_template/data/targets.json +150 -0
  652. package/src/shards/_template/data/text.json +12 -0
  653. package/src/shards/_template/data/ui.json +33 -0
  654. package/src/shards/_template/data/water.json +13 -0
  655. package/src/shards/_template/generators/behaviour.ts +34 -0
  656. package/src/shards/_template/generators/boss.ts +29 -0
  657. package/src/shards/_template/generators/buildOptions.ts +2 -0
  658. package/src/shards/_template/generators/cell.ts +224 -0
  659. package/src/shards/_template/generators/districts.ts +215 -0
  660. package/src/shards/_template/generators/farLook.ts +15 -0
  661. package/src/shards/_template/generators/generate.ts +27 -0
  662. package/src/shards/_template/generators/ground.ts +15 -0
  663. package/src/shards/_template/generators/kit.ts +69 -0
  664. package/src/shards/_template/generators/landscape.ts +59 -0
  665. package/src/shards/_template/generators/landscapeNoise.ts +62 -0
  666. package/src/shards/_template/generators/mapInputs.ts +10 -0
  667. package/src/shards/_template/generators/product.ts +100 -0
  668. package/src/shards/_template/generators/productOutput.ts +18 -0
  669. package/src/shards/_template/generators/props.ts +9 -0
  670. package/src/shards/_template/generators/templatePropsSource.ts +58 -0
  671. package/src/shards/_template/generators/terrain.ts +17 -0
  672. package/src/shards/_template/generators/world.ts +630 -0
  673. package/src/shards/_template/hero.json +10 -0
  674. package/src/shards/_template/look/entry-reads.json +20 -0
  675. package/src/shards/_template/manifest.json +281 -0
  676. package/src/shards/_template/shard.config.ts +10 -0
  677. package/src/shared/health.ts +10 -0
  678. package/src/tools/build-web.ts +59 -0
  679. package/src/tsconfig.json +30 -0
  680. package/src/web/app.tsx +53 -0
  681. package/src/web/index.html +12 -0
  682. package/src/web/main.tsx +10 -0
  683. package/src/web/tsconfig.json +13 -0
  684. package/tsconfig.author.json +23 -0
  685. package/tsconfig.commons.json +21 -0
  686. package/tsconfig.json +47 -0
  687. package/tsconfig.sharddev.json +20 -0
@@ -0,0 +1,41 @@
1
+ // LAYER-PURITY LP6 (E405): the labelled set for the `layer-purity` decision set, built from git — each engine file
2
+ // before its E405 move (content in the engine: label 1) and after it, plus untouched generic engine files (label 0).
3
+ // node scripts/decide/layer-purity-pilot.mjs <out.jsonl> write the items ({ state, label, id } per line)
4
+ // scripts/decide/decide.sh batch layer-purity --images <out.jsonl> --out <results.jsonl>
5
+ // node scripts/decide/layer-purity-pilot.mjs --score <out.jsonl> <results.jsonl>
6
+ import { execFileSync } from 'node:child_process';
7
+ import { readFileSync, writeFileSync } from 'node:fs';
8
+
9
+ const CONTENT = [ // [the commit that moved it out, the engine path before]
10
+ ['0802b3d00', 'src/client/engine/audio/gen.ts'], ['dd2e42a12', 'src/client/engine/ui/icons.ts'], ['4c50424b9', 'src/engine/entities/species/elk.ts'],
11
+ ['4c50424b9', 'src/engine/entities/species/deer.ts'], ['d47cbc07b', 'src/engine/ai/NightBrain.ts'], ['fab438d4a', 'src/client/engine/world/blenderArea.ts'],
12
+ ['49ffd9fd4', 'src/client/engine/ui/HurtArc.ts'], ['668484797', 'src/client/engine/world/forest/treeSpecies.ts'], ['b804b4395', 'src/engine/models/creatures.ts'],
13
+ ['bd2e547d2', 'src/engine/audio/score/wildshard-theme.ts'], ['4c42cca55', 'src/engine/world/interact/models.ts'], ['2c2e229f9', 'src/server/engine/entities/AnimalManager.ts'],
14
+ ];
15
+ const GENERIC = [ // at HEAD: the cleaned files, and engine files E405 never touched
16
+ 'src/client/engine/audio/gen.ts', 'src/client/engine/ui/icons.ts', 'src/client/engine/world/blenderArea.ts', 'src/client/engine/ui/HurtArc.ts',
17
+ 'src/client/engine/world/forest/treeSpecies.ts', 'src/client/engine/audio/score/score.ts', 'src/shared/engine/world/interact/types.ts', 'src/server/engine/entities/AnimalManager.ts',
18
+ 'src/shared/engine/physics/query.ts', 'src/shared/engine/core/rng.ts', 'src/client/engine/world/lowpolyKit.ts', 'src/client/engine/input/InputService.ts',
19
+ ];
20
+ const show = (rev, path) => execFileSync('git', ['show', `${rev}:${path}`], { encoding: 'utf8', maxBuffer: 1 << 26 });
21
+ const state = (path, code) => `Layer: engine. File: ${path}\n\n${code.slice(0, 13000)}`;
22
+
23
+ if (process.argv[2] === '--score') {
24
+ const items = readFileSync(process.argv[3], 'utf8').trim().split('\n').map((l) => JSON.parse(l));
25
+ const results = readFileSync(process.argv[4], 'utf8').trim().split('\n').map((l) => JSON.parse(l));
26
+ let tp = 0, fp = 0, fn = 0, tn = 0;
27
+ results.forEach((r, i) => {
28
+ const p = r.answers?.content?.noul ?? Number.NaN, label = items[i].label;
29
+ const flagged = p >= 0.5;
30
+ if (flagged && label) tp++; else if (flagged) fp++; else if (label) fn++; else tn++;
31
+ console.log(`${label ? 'content' : 'generic'} p=${Number(p).toFixed(3)} ${items[i].id}`);
32
+ });
33
+ console.log(`caught ${tp}/${tp + fn} content files, false alarms ${fp}/${fp + tn} generic files`);
34
+ } else {
35
+ const out = [
36
+ ...CONTENT.map(([commit, path]) => ({ id: `${path}@${commit}^`, label: 1, state: state(path, show(`${commit}^`, path)) })),
37
+ ...GENERIC.map((path) => ({ id: `${path}@HEAD`, label: 0, state: state(path, show('HEAD', path)) })),
38
+ ];
39
+ writeFileSync(process.argv[2], `${out.map((o) => JSON.stringify({ images: [], state: o.state, id: o.id, label: o.label })).join('\n')}\n`);
40
+ console.log(`${out.length} items → ${process.argv[2]}`);
41
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "capture-status",
3
+ "version": 2,
4
+ "ask": "E394",
5
+ "about": "A live game capture (agent-browser / Playwright screenshot, progress or timelapse frame): is it a usable frame of the 3D world, or did the capture catch a loading screen, a title card, a menu, a blank frame or an error? D3 (2026-10-03, project/archive/2026-10-03-decision-models.md): 376 hand-labelled real frames, 'not the world' AUC 0.998, 99 % of bad frames flagged at 3 % of good ones flagged. The 'corrupt' answer is logged but does not flag: it caught 1 of 4 real render glitches (AUC 0.88).",
6
+ "model": "clef-flash-4bit",
7
+ "state": "A screenshot taken by an automated test of Wildshard, a first-person 3D web game, at phone or desktop size. A good frame shows the 3D game world (terrain, sky, water, buildings, plants, creatures), usually with HUD buttons, a minimap and small labels drawn on top.",
8
+ "questions": {
9
+ "screen": {
10
+ "type": "choice",
11
+ "instructions": "What does this screenshot mostly show?",
12
+ "criteria": {
13
+ "world": "The 3D game world (terrain, sky, buildings, plants, characters), with or without HUD buttons and labels on top",
14
+ "loading": "A loading screen, splash or title card, a progress bar, or the game still starting up",
15
+ "blank": "An empty frame: all black, all white or one flat colour, with no scene",
16
+ "menu": "A menu, settings panel, pause screen, full-screen map or dialog covering most of the screen",
17
+ "error": "An error message, crash report or browser error page"
18
+ }
19
+ },
20
+ "corrupt": {
21
+ "type": "noul",
22
+ "instructions": "Do solid black squares or rectangles, or blocks of garbage pixels, break up the 3D scene? A rendering glitch, not a shadow, a dark object or a UI panel."
23
+ }
24
+ },
25
+ "flags": {
26
+ "screen": {
27
+ "choice_in": [
28
+ "loading",
29
+ "blank",
30
+ "menu",
31
+ "error"
32
+ ],
33
+ "min_probability": 0.5
34
+ }
35
+ },
36
+ "calibrated": {
37
+ "on": "2026-10-03",
38
+ "model": "clef-flash-4bit",
39
+ "items": 376,
40
+ "bad": 89,
41
+ "not_world_auc": 0.998,
42
+ "recall_at_0.5": 0.99,
43
+ "good_flagged_at_0.5": 0.03,
44
+ "note": "v1 flagged loading/blank/error only (recall 78 % at 0.5): the phone title cards read as 'menu'. v2's flag counts menu too; it was chosen after seeing v1's results, so its numbers are not yet confirmed on fresh frames."
45
+ }
46
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "layer-purity",
3
+ "version": 1,
4
+ "ask": "E405",
5
+ "about": "LAYER-PURITY LP6 pilot (project/archive/2026-10-03-layer-purity.md): an advisory check that an engine source file holds no game or content knowledge, for what the word-list lint (wildshard/engine-words) cannot see — a shard's data under generic names, a game's theme, one level's AI. Scored on a labelled set from the E405 moves (scripts/decide/layer-purity-pilot.mjs). Not a gate.",
6
+ "model": "clef-flash-4bit",
7
+ "state": "",
8
+ "max_state_chars": 14000,
9
+ "questions": {
10
+ "content": {
11
+ "type": "noul",
12
+ "instructions": "This is a source file from the ENGINE layer of a game codebase. The engine must be generic: rendering, physics, input, audio playback, boot, UI frameworks, and data structures any game could use. Does this file instead contain knowledge of a particular game's content — named creatures, items, weapons, places, levels, characters, quests, a specific soundtrack or tuned values and tables for specific content — rather than only generic mechanisms that receive such content as data?"
13
+ }
14
+ },
15
+ "flags": {
16
+ "content": {
17
+ "min_probability": 0.5
18
+ }
19
+ },
20
+ "calibrated": {
21
+ "on": "2026-10-03",
22
+ "model": "clef-flash-4bit",
23
+ "items": 24,
24
+ "content": 12,
25
+ "generic": 12,
26
+ "result": "threshold 0.5: 7/12 content caught, 0/12 false alarms; threshold 0.3: 9/12, 0/12; AUC ~0.93. Caught all three the word-list lint missed (Pine's NightBrain 0.59, Pine's tree set 0.82, the theme 0.72). Missed gen.ts, HurtArc and the pickup models (content past the 13k-character cut or explicit words the hard rule catches). ~1.6 s a file, lock free."
27
+ }
28
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "text-garbled",
3
+ "version": 1,
4
+ "ask": "E394",
5
+ "about": "An image-generated mockup of the game's HUD (codex image_gen or local Qwen-Image): is any UI text garbled, so the take needs a re-roll? Calibrated in D3 (project/archive/2026-10-03-decision-models.md).",
6
+ "model": "clef-flash-4bit",
7
+ "state": "A mockup screenshot of a 3D game's HUD on a phone or desktop. Every piece of UI text should be real, correctly spelled English: button labels like ATTACK, DODGE, JUMP, VITALS, place names, quest titles and short notes.",
8
+ "questions": {
9
+ "garbled": {
10
+ "type": "noul",
11
+ "instructions": "Is any of the on-screen UI text misspelled, garbled, smeared into unreadable shapes, or made of nonsense letters?"
12
+ }
13
+ },
14
+ "flags": {
15
+ "garbled": { "noul_at_least": 0.5 }
16
+ }
17
+ }
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env python3
2
+ """Model-free checks for decide.py: Jev-style confidence, flags, the sets' shape. `python3 scripts/decide/test_decide.py`"""
3
+ import json
4
+ import sys
5
+ from pathlib import Path
6
+
7
+ sys.path.insert(0, str(Path(__file__).parent))
8
+ import decide # noqa: E402 — the model is only imported inside Model()
9
+
10
+
11
+ def close(a: float, b: float) -> bool:
12
+ return abs(a - b) < 1e-9
13
+
14
+
15
+ # docs.typesafe.ai/confidence.md: a 3-option Choice at 0.85 → (3 × 0.85 − 1) / 2 = 0.775
16
+ assert close(decide.jev_confidence("choice", [0.85, 0.1, 0.05]), 0.775)
17
+ # a 60/40 two-way Choice is 0.2 in Jev's terms (Clef's reference code reports 0.6)
18
+ assert close(decide.jev_confidence("choice", [0.6, 0.4]), 0.2)
19
+ assert close(decide.jev_confidence("noul", [0.5]), 0.0) and close(decide.jev_confidence("noul", [0.0]), 1.0)
20
+ # Score: all mass on one level is 1; an even spread is 0
21
+ assert close(decide.jev_confidence("score", [0, 1, 0, 0]), 1.0)
22
+ assert close(decide.jev_confidence("score", [0.25, 0.25, 0.25, 0.25]), 0.0)
23
+
24
+ spec = {"flags": {"screen": {"choice_in": ["loading", "blank"], "min_probability": 0.5}, "bad": {"noul_at_least": 0.7}},
25
+ "questions": {"screen": {}, "bad": {}}}
26
+ answers = {"screen": {"probabilities": {"world": 0.5, "loading": 0.3, "blank": 0.2}}, "bad": {"noul": 0.69}}
27
+ assert decide.flags_for(spec, answers) == {"screen": True, "bad": False, "any": True}
28
+
29
+ for path in sorted((Path(__file__).parent / "sets").glob("*.json")):
30
+ s = decide.load_set(str(path))
31
+ assert s["name"] == path.stem, path
32
+ for qid, q in s["questions"].items():
33
+ assert q["type"] in ("noul", "choice", "score"), (path, qid)
34
+ json.dumps(s)
35
+
36
+ assert decide.tail_trim("abcdef", 3) == "…def"
37
+ print("decide: ok")
@@ -0,0 +1,15 @@
1
+ // Derived human/agent inventories run separately from game-input generation.
2
+ import { resolve } from 'node:path';
3
+ import { quietCli } from '@wildshard/engine/scripts/quiet-cli.mjs';
4
+
5
+ quietCli('docs');
6
+ await import('@wildshard/engine/scripts/bake-loader.mjs');
7
+ const root = resolve(import.meta.dirname, '..');
8
+ /** @param {string} name @param {()=>unknown} run */
9
+ async function step(name, run) {
10
+ const started = performance.now();
11
+ try { return await run(); }
12
+ finally { console.info(`docs-step ${name}: ${((performance.now() - started) / 1000).toFixed(3)}s`); }
13
+ }
14
+ await step('api', async () => (await import('@wildshard/engine/scripts/gen-api.mjs')).writeApiDocs(root));
15
+ await step('host-catalogue', async () => (await import('./gen-host-catalogue.mjs')).writeHostCatalogue(root));
@@ -0,0 +1,152 @@
1
+ #!/usr/bin/env node
2
+ import { KEYCHAIN_ARGS } from '../chromium-keychain.mjs';
3
+ // Plain post-build bake: browser-lane.sh node --experimental-transform-types
4
+ // --import ./scripts/shard-platform-format.mjs scripts/entry-reads/crawl.ts
5
+ // --base=http://127.0.0.1:4400 --pin=<landed full SHA> [--shards=a,b]
6
+ // A fresh context per region/tier walks the maintained declared entry. No new
7
+ // Vite plugin, constructor shortcut, admission root or readiness claim is used.
8
+ import { mkdir, writeFile } from 'node:fs/promises';
9
+ import { dirname, resolve } from 'node:path';
10
+ import { chromium, devices, type Browser, type BrowserContext, type Page } from 'playwright';
11
+ import * as v from 'valibot';
12
+ import { crawlEntryReadSet, entryDemandUrls, type EntryCrawlDemand, type EntryCrawlRegion } from '@wildshard/sdk/entryReads';
13
+ import { hashImmutableBytes } from '@wildshard/sdk/immutable';
14
+ import { parseOutputIndex } from '@wildshard/format/outputIndex';
15
+ import type { RegionEntryReads } from '@wildshard/format/entryReads';
16
+ import { saveFixture, harnessPins } from '@wildshard/engine/scripts/debug-settings.mjs';
17
+ import { entryReadsFile } from '@wildshard/engine/scripts/shard-public.mjs';
18
+ import { frameFloorSettingsCode } from '@wildshard/engine/scripts/frame-floor-settings.mjs';
19
+ import { floorGridBenchmarkUrl, FLOOR_GRID_ENTER } from '@wildshard/engine/scripts/frame-floor-navigation.mjs';
20
+ import { gridFloorPlans, gridFloorDeclaredPlan, gridFloorDocumentIdentity, stageFloorGrid, driveFloorGrid,
21
+ gridFloorWitnessFailures, floorGridEntryRoute, type FloorGridWitness, type FloorGridState } from '@wildshard/engine/scripts/frame-floor-grid.mjs';
22
+
23
+ const stateSchema = v.object({ home: v.string(), pitch: v.pipe(v.number(), v.finite(), v.minValue(501)),
24
+ cells: v.array(v.object({ instance: v.string(), slug: v.string(), cell: v.tuple([v.number(), v.number()]) })) });
25
+ const spansSchema = v.array(v.object({ name: v.string(), startTime: v.number(), duration: v.number() }));
26
+ const versionSchema = v.object({ build: v.string() });
27
+ const stateCode = 'window.__wildshard.shard.grid.state()';
28
+ const readyCode = 'window.__wildshard?.shard?.grid?.state().live?.live?.gameplayReady === true';
29
+ const arg = (key: string): string | undefined => process.argv.find(value => value.startsWith(`--${key}=`))?.slice(key.length + 3);
30
+ const base = arg('base'), pin = arg('pin'), network = arg('network') ?? 'local';
31
+ if (!['local', 'fast4g-crossing'].includes(network)) throw new Error('Unknown entry crawl network');
32
+ if (base === undefined || pin === undefined || !/^[a-f0-9]{40}$/u.test(pin)) throw new Error('Requires --base and --pin=<landed full SHA>');
33
+ const origin = new URL(base);
34
+ if (!['http:', 'https:'].includes(origin.protocol)) throw new Error('HTTP preview required');
35
+ const out = arg('out'), requested = arg('shards')?.split(',');
36
+ if (requested?.some(slug => !/^_?[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(slug))) throw new Error('Canonical shard names required');
37
+ const versionResponse = await fetch(new URL('/version.json', origin));
38
+ if (!versionResponse.ok) throw new Error('Preview identity unavailable');
39
+ const version = v.parse(versionSchema, await versionResponse.json());
40
+ if (!version.build.startsWith(pin.slice(0, 7))) throw new Error('Preview differs from the requested pin');
41
+ const browser = await chromium.launch({ channel: 'chromium', headless: true, args: [...KEYCHAIN_ARGS, '--mute-audio', '--use-angle=metal', '--ignore-gpu-blocklist'] });
42
+ const { defaultBrowserType: _type, ...phone } = devices['iPhone 16 Pro'];
43
+
44
+ async function contextFor(host: Browser, tier: RegionEntryReads['tier']): Promise<BrowserContext> {
45
+ const context = await host.newContext(phone);
46
+ await context.addInitScript({ content: frameFloorSettingsCode({ tier, fps: 'auto' }) });
47
+ await saveFixture(context, { scope: 'global', key: 'gfx', data: { dpr: '2', aa: 'auto' } });
48
+ await saveFixture(context, { scope: 'device', key: 'devMode', data: true });
49
+ await harnessPins(context, { seed: 357, browser: 'Chromium / iPhone 16 Pro', lane: 'entry-read-bake' });
50
+ // A previous optional hint must not prewarm the crawl and erase its own input.
51
+ // Actual asset, worker and product responses stay unchanged.
52
+ await context.route('**/assets/*/entry-reads.json', route => route.fulfill({ status: 404, body: '' }));
53
+ return context;
54
+ }
55
+ async function openGrid(page: Page, fresh: boolean): Promise<void> {
56
+ await page.goto(floorGridBenchmarkUrl(origin.href), { waitUntil: 'load' });
57
+ if (fresh) await page.locator('.ws-main-grid').click();
58
+ await page.waitForFunction(readyCode, undefined, { timeout: 240_000 });
59
+ await page.evaluate(FLOOR_GRID_ENTER);
60
+ await page.waitForFunction('!document.querySelector("#hud")?.classList.contains("ws-grid-revealing")', undefined, { timeout: 30_000 });
61
+ }
62
+ async function catalogue(): Promise<v.InferOutput<typeof stateSchema>> {
63
+ const context = await contextFor(browser, 'phone');
64
+ try { const page = await context.newPage(); await openGrid(page, true); return v.parse(stateSchema, await page.evaluate(stateCode)); }
65
+ finally { await context.close(); }
66
+ }
67
+ try {
68
+ const declared = await catalogue(), cells = declared.cells.filter(cell => requested === undefined || requested.includes(cell.slug));
69
+ if (cells.length === 0 || requested?.some(slug => !cells.some(cell => cell.slug === slug))) throw new Error('Requested entry missing from the served grid');
70
+ const entries: EntryCrawlRegion[] = cells.map(cell => ({ region: cell.instance, at: [0, 0] }));
71
+ const index = new Map<string, ReturnType<typeof parseOutputIndex>>();
72
+ for (const slug of new Set(cells.map(cell => cell.slug))) {
73
+ const response = await fetch(new URL(`/shardfiles/${slug}/shard.json`, origin));
74
+ if (!response.ok) throw new Error(`Entry descriptor unavailable: ${slug}`);
75
+ index.set(slug, parseOutputIndex(await response.json()));
76
+ }
77
+ const productFailures: unknown[] = [];
78
+ for (const productSlug of new Set(cells.map(cell => cell.slug))) {
79
+ const regions = new Set(cells.filter(cell => cell.slug === productSlug).map(cell => cell.instance));
80
+ try {
81
+ const rows = await crawlEntryReadSet(entries.filter(entry => regions.has(entry.region)), {
82
+ read: async url => {
83
+ const response = await fetch(new URL(url, origin), { headers: { 'accept-encoding': 'identity' } });
84
+ if (!response.ok) throw new Error(`Entry body refused: ${response.status} ${url}`);
85
+ const bytes = new Uint8Array(await response.arrayBuffer());
86
+ for (const [slug, product] of index) {
87
+ const file = product.files.find(row => url.split('?')[0] === `/shardfiles/${slug}/${row.path}`);
88
+ if (file !== undefined && (bytes.length !== file.compressed || hashImmutableBytes(bytes) !== file.hash)) throw new Error('Crawled product body differs from its descriptor');
89
+ }
90
+ return bytes;
91
+ },
92
+ visit: async (entry, tier, read) => {
93
+ const cell = cells.find(row => row.instance === entry.region), source = cell === undefined ? undefined : index.get(cell.slug);
94
+ if (cell === undefined || source === undefined) throw new Error('Crawl region lacks its descriptor');
95
+ const home = declared.cells.find(row => row.slug === '_template' && row.instance !== cell.instance)
96
+ ?? declared.cells.find(row => row.slug === 'driftwood-isle' && row.instance !== cell.instance);
97
+ if (home === undefined) throw new Error('Crawl requires a distinct cold source');
98
+ const context = await contextFor(browser, tier), demands: (EntryCrawlDemand & { readonly at: number })[] = [];
99
+ try {
100
+ const catalogueId = JSON.stringify({ pitch: declared.pitch, cells: declared.cells.map(row => [row.instance, row.slug, ...row.cell]).sort((a, b) => String(a[0]).localeCompare(String(b[0]))) });
101
+ await saveFixture(context, { scope: 'session', key: 'grid.recovery.once', once: 'entry-read-cold-source', data: {
102
+ instance: home.instance, slug: home.slug, catalogue: catalogueId, at: Date.now(), reason: 'reload',
103
+ road: { x: home.cell[0] * declared.pitch + declared.pitch / 2 + 3.6, z: home.cell[1] * declared.pitch, yaw: 0 } } });
104
+ const page = await context.newPage(), errors: string[] = [];
105
+ const cdp = await context.newCDPSession(page);
106
+ if (network === 'fast4g-crossing') await cdp.send('Emulation.setCPUThrottlingRate', { rate: 4 });
107
+ page.on('pageerror', error => { errors.push(error.stack ?? error.message); });
108
+ context.on('request', request => {
109
+ const url = new URL(request.url());
110
+ if (url.origin !== origin.origin || !['/assets/', `/shardfiles/${cell.slug}/blobs/`].some(prefix => url.pathname.startsWith(prefix))) return;
111
+ const { range } = request.headers();
112
+ demands.push({ url: `${url.pathname}${url.search}`, at: Date.now(), ...(range === undefined ? {} : { range }) });
113
+ });
114
+ await openGrid(page, false);
115
+ const state = await page.evaluate(stateCode) as FloorGridState;
116
+ if (state.home !== home.instance || state.live.live.residents.includes(cell.instance)) throw new Error('Crawl target is not a cold entry');
117
+ if (network === 'fast4g-crossing') {
118
+ await cdp.send('Network.enable');
119
+ await cdp.send('Network.emulateNetworkConditions', { offline: false, latency: 150, downloadThroughput: 9e6 / 8, uploadThroughput: 1.5e6 / 8 });
120
+ }
121
+ const identity = await page.evaluate(gridFloorDocumentIdentity), route = floorGridEntryRoute(gridFloorPlans(state, 'cell', { cell: cell.instance, roadApproach: true }), cell.instance);
122
+ for (const plan of [...route.setup, route.entry]) {
123
+ const live = await page.evaluate(stateCode) as FloorGridState, resolved = await gridFloorDeclaredPlan(page, live, plan);
124
+ await page.evaluate(`(${stageFloorGrid.toString()})(${JSON.stringify(resolved)},${JSON.stringify(identity)},(${driveFloorGrid.toString()}))`);
125
+ const witness = await page.evaluate<FloorGridWitness>(`(${driveFloorGrid.toString()})(${JSON.stringify(resolved)},${JSON.stringify(identity)})`);
126
+ const failures = gridFloorWitnessFailures(witness);
127
+ if (failures.length > 0) throw new Error(`Entry crawl refused: ${failures.join('; ')}`);
128
+ }
129
+ if (errors.length > 0) throw new Error(`Entry crawl page errors: ${errors.join('; ')}`);
130
+ const timeOrigin = v.parse(v.number(), await page.evaluate('performance.timeOrigin'));
131
+ const spans = v.parse(spansSchema, await page.evaluate('performance.getEntriesByType("measure").map(row=>({name:row.name,startTime:row.startTime,duration:row.duration}))'));
132
+ const spansForEntry = spans.filter(row => row.name === `wildshard.prepare:${cell.slug}:grid.prepare:${cell.instance}.create`);
133
+ if (spansForEntry.length !== 1) throw new Error(`Expected one completed cold entry span: ${cell.slug}`);
134
+ const hold = spansForEntry[0]; if (hold === undefined) throw new Error('Entry span missing');
135
+ const urls = entryDemandUrls(cell.slug, source, demands.filter(row => row.at >= timeOrigin + hold.startTime && row.at <= timeOrigin + hold.startTime + hold.duration));
136
+ for (const url of urls) await read(url);
137
+ console.log(JSON.stringify({ region: cell.instance, tier, pin, network, complete: true, errors, heldMs: hold.duration, files: urls.length }));
138
+ } finally { await context.close(); }
139
+ },
140
+ });
141
+ // Publish only a complete product: every selected region/tier and all its
142
+ // bodies succeeded. An independent product failure never erases this data.
143
+ const path = out === undefined ? entryReadsFile(process.cwd(), productSlug) : resolve(out, productSlug, 'entry-reads.json');
144
+ await mkdir(dirname(path), { recursive: true });
145
+ await writeFile(path, `${JSON.stringify(rows, null, 1)}\n`);
146
+ } catch (error: unknown) {
147
+ productFailures.push(error);
148
+ console.error({ product: productSlug, error: error instanceof Error ? error.stack ?? error.message : String(error) });
149
+ }
150
+ }
151
+ if (productFailures.length > 0) throw new AggregateError(productFailures, 'Entry crawl has refused products; completed tables are retained');
152
+ } finally { await browser.close(); }
@@ -0,0 +1,25 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "types": [
5
+ "node"
6
+ ],
7
+ "allowJs": true,
8
+ "checkJs": false,
9
+ "allowImportingTsExtensions": true
10
+ },
11
+ "include": [
12
+ "crawl.ts"
13
+ ],
14
+ "references": [
15
+ {
16
+ "path": "../../tsconfig.sdk.json"
17
+ },
18
+ {
19
+ "path": "../../tsconfig.sharddev.json"
20
+ },
21
+ {
22
+ "path": "../../tsconfig.engine.json"
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,2 @@
1
+ /** Build the migrated format documents into .wildshard/format with their defining semantic-check annotations. */
2
+ export function writeFormatJsonSchemas(root: string): void;
@@ -0,0 +1,21 @@
1
+ import { mkdirSync, writeFileSync } from 'node:fs';
2
+ import { resolve } from 'node:path';
3
+ import { pathToFileURL } from 'node:url';
4
+ import { formatJsonSchemas, namedFormatJsonSchemas } from '@wildshard/engine/host/formatJsonSchema';
5
+
6
+ /** Build the migrated format documents into an ignored authoring-output folder, never into committed source.
7
+ * @param {string} root
8
+ */
9
+ export function writeFormatJsonSchemas(root) {
10
+ const directory = resolve(root, '.wildshard/format');
11
+ mkdirSync(directory, { recursive: true });
12
+ writeFileSync(resolve(directory, 'named.json'), JSON.stringify(namedFormatJsonSchemas()));
13
+ for (const [name, schema] of Object.entries(formatJsonSchemas())) {
14
+ writeFileSync(resolve(directory, `${name}.schema.json`), `${JSON.stringify(schema, null, 2)}\n`);
15
+ }
16
+ }
17
+
18
+ const invoked = process.argv.at(1);
19
+ if (invoked !== undefined && import.meta.url === pathToFileURL(resolve(invoked)).href) {
20
+ writeFormatJsonSchemas(resolve(import.meta.dirname, '..'));
21
+ }
@@ -0,0 +1,14 @@
1
+ import type { HostCall, HostCallback } from '../lint/host-callbacks.mjs';
2
+
3
+ export interface HostVerdict { status: string; evidence: string }
4
+ export interface HostReview { sourceHash: string; evidence: string; verdicts: Record<string, string> }
5
+ export function hostVerdicts(users: string[], callbacks: HostCallback[], audited?: HostReview, sourceHash?: string | null): Record<string, HostVerdict>;
6
+ export interface HostCatalogue {
7
+ schema: string; coverage: string;
8
+ sections: { name: string; type: string; fields: { name: string; type: string }[]; readers: HostCall[]; hosts: string[]; users: string[] }[];
9
+ fields: unknown[]; wasm: { contract: unknown; signatures: unknown[] };
10
+ hosts: { module: string; export: string; calls: HostCall[]; callbacks: HostCallback[]; users: string[]; pendingUsers: { shard: string }[]; sourceHash: string | null; verdicts: Record<string, HostVerdict> }[];
11
+ }
12
+ export function hostCatalogue(root?: string, reference?: { fields: unknown[]; contract: unknown; abi: unknown[] }): HostCatalogue;
13
+ export function renderHostCatalogue(catalogue: HostCatalogue): string;
14
+ export function writeHostCatalogue(root?: string): HostCatalogue;
@@ -0,0 +1,108 @@
1
+ // G454: build output, not a hand-maintained list of supposedly shared hosts.
2
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
3
+ import { dirname, resolve } from 'node:path';
4
+ import { pathToFileURL } from 'node:url';
5
+ import { createHash } from 'node:crypto';
6
+ import ts from '@typescript/typescript6';
7
+ import { hostAnalysis } from '../lint/host-callbacks.mjs';
8
+ import { referenceData } from './docs/gen-shardfile-reference.mjs';
9
+ import { formatSource } from '@wildshard/engine/scripts/format-package.mjs';
10
+
11
+ const ROOT = resolve(import.meta.dirname, '..');
12
+ const AUDIT = 'progress/shard-platform/host-audit-2026-10-16/README.md';
13
+ const keyOf = row => `${row.module}#${row.export}`;
14
+ const hash = text => createHash('sha256').update(text).digest('hex');
15
+ const order = (a, b) => a.localeCompare(b);
16
+ const verdict = (status, evidence) => ({ status, evidence });
17
+ const review = reason => verdict('needs-review', reason);
18
+
19
+ /** Machine findings are evidence, never a substitute for the semantic host grill. */
20
+ export function hostVerdicts(users, callbacks, audited, sourceHash) {
21
+ const results = {
22
+ twoRealUsers: review(`${users.length} resolved calling shards; verify entry reach and live adoption before granting shared credit`),
23
+ noShardNouns: review(`Semantic review required; see ${AUDIT}`),
24
+ dataOnly: callbacks.length > 0 ? verdict('fail', `${callbacks.length} shard TS callback values cross this host`)
25
+ : review('No explicit shard callbacks found; host parameter semantics still require review'),
26
+ serverSafe: review('Import/DOM and server execution review required; client presentation is labelled separately'),
27
+ deletionTest: review('A reviewer must judge whether this survives deletion of its first shard'),
28
+ };
29
+ if (typeof sourceHash === 'string' && audited?.sourceHash === sourceHash && audited.evidence) for (const test of ['twoRealUsers', 'noShardNouns', 'dataOnly', 'serverSafe', 'deletionTest']) {
30
+ if (test === 'dataOnly' && callbacks.length > 0) continue;
31
+ const status = audited.verdicts?.[test];
32
+ if (status === 'pass' || status === 'fail') results[test] = verdict(status, audited.evidence);
33
+ }
34
+ return results;
35
+ }
36
+
37
+ /** Inventory resolved call targets plus pending hosts. Planned W3 users are never real-user evidence. */
38
+ export function hostCatalogue(root = ROOT, reference = referenceData(root)) {
39
+ const analysis = hostAnalysis(root), { program, checker } = analysis, hosts = new Map();
40
+ const get = identity => {
41
+ const key = keyOf(identity);
42
+ if (!hosts.has(key)) hosts.set(key, { module: identity.module, export: identity.export, calls: [], callbacks: [], pendingUsers: [] });
43
+ return hosts.get(key);
44
+ };
45
+ for (const file of analysis.files.toSorted(order)) {
46
+ const scan = analysis.scan(file);
47
+ for (const call of scan.calls) get(call).calls.push(call);
48
+ for (const callback of scan.callbacks) get(callback).callbacks.push(callback);
49
+ }
50
+ const pendingPath = resolve(root, 'lint/platform-pending-users.json');
51
+ const pending = existsSync(pendingPath) ? JSON.parse(readFileSync(pendingPath, 'utf8')).entries : [];
52
+ for (const row of pending) {
53
+ const host = get({ module: row.module, export: row.export ?? '*' });
54
+ host.pendingUsers.push(row);
55
+ if (row.export === undefined && host.calls.length === 0) for (const called of hosts.values()) {
56
+ if (called !== host && called.module === row.module) { host.calls.push(...called.calls); host.callbacks.push(...called.callbacks); }
57
+ }
58
+ }
59
+ const reviewsPath = resolve(root, 'lint/host-reviews.json');
60
+ const reviews = existsSync(reviewsPath) ? JSON.parse(readFileSync(reviewsPath, 'utf8')).entries : {};
61
+ const sectionFile = program.getSourceFile(formatSource(root, 'sections.ts'));
62
+ const registry = sectionFile?.statements.find(node => ts.isInterfaceDeclaration(node) && node.name.text === 'PlatformSections');
63
+ if (!registry) throw new Error('Host catalogue requires the public PlatformSections registry');
64
+ const sections = registry.members.filter(ts.isPropertySignature).map(member => {
65
+ const type = checker.getTypeAtLocation(member);
66
+ const readers = [...hosts.values()].filter(host => host.export !== '*').flatMap(host => host.calls.filter(call => call.strings.includes(member.name.text)));
67
+ return { name: member.name.text, type: member.type?.getText(sectionFile) ?? '', readers,
68
+ hosts: [...new Set(readers.map(keyOf))].sort(order), users: [...new Set(readers.map(call => call.file.split('/')[2]))].sort(order),
69
+ fields: checker.getPropertiesOfType(type).map(field => ({ name: field.name,
70
+ type: checker.typeToString(checker.getTypeOfSymbolAtLocation(field, member)) })).sort((a, b) => a.name.localeCompare(b.name)) };
71
+ }).sort((a, b) => a.name.localeCompare(b.name));
72
+ const rows = [...hosts.values()].map(row => {
73
+ const users = [...new Set(row.calls.map(call => call.file.split('/')[2]))].sort(order);
74
+ const source = program.getSourceFile(resolve(root, row.module));
75
+ const sourceHash = source ? hash(source.text) : null;
76
+ return { module: row.module, export: row.export, calls: row.calls, callbacks: row.callbacks,
77
+ pendingUsers: row.pendingUsers, users, sourceHash,
78
+ verdicts: hostVerdicts(users, row.callbacks, reviews[keyOf(row)] ?? reviews[`${row.module}#*`], sourceHash), review: { source: AUDIT, revision: '9160141e3',
79
+ status: 'Historical review; not silently promoted to a current five-test pass' } };
80
+ }).sort((a, b) => keyOf(a).localeCompare(keyOf(b)));
81
+ return { schema: 'wildshard.host-catalogue/1',
82
+ coverage: 'Resolved calls/new expressions in non-frozen play TS; aliases, inherited methods and named callbacks. Indirect/dynamic calls and semantic host tests require review. No imports or planned W3 users count as actual users.',
83
+ sections, fields: reference.fields, wasm: { contract: reference.contract, signatures: reference.abi }, hosts: rows };
84
+ }
85
+
86
+ export function renderHostCatalogue(catalogue) {
87
+ const cell = value => String(value).replaceAll('|', String.raw`\|`).replaceAll('\n', ' ');
88
+ const lines = ['# Host catalogue (generated)', '', catalogue.coverage, '',
89
+ 'Five verdicts: two real users / no shard nouns / data-only / server-safe / deletion test. `needs-review` grants no pass.', '',
90
+ '## Sections', '', 'Readers below are statically resolved literal section reads; dynamic/host-internal access still needs review.', '',
91
+ '| Section | Fields | Reading hosts | Calling shards |', '|---|---|---|---|',
92
+ ...catalogue.sections.map(row => `| ${cell(row.name)} | ${row.fields.map(field => cell(field.name)).join(', ')} | ${row.hosts.map(cell).join(', ')} | ${row.users.map(cell).join(', ')} |`), '',
93
+ 'Full schema field inventory and exact Wasm ABI: [SHARDFILE.md](SHARDFILE.md). Machine-readable detail: `lint/host-catalogue.generated.json`.', '',
94
+ '## Hosts', '', '| Host | Resolved calling shards | Planned W3 users | Five verdicts |', '|---|---|---|---|',
95
+ ...catalogue.hosts.map(row => `| ${cell(keyOf(row))} | ${row.users.length === 0 ? 'none proven' : row.users.map(cell).join(', ')} | ${[...new Set(row.pendingUsers.map(pending => pending.shard ?? `approved: ${pending.approvedFeature?.name ?? 'unknown'}`))].map(cell).join(', ')} | ${Object.values(row.verdicts).map(result => result.status).join(' / ')} |`)];
96
+ return `${lines.join('\n')}\n`;
97
+ }
98
+
99
+ /** pnpm docs publishes both the JSON retained in deploy trees and the human-readable generated page. */
100
+ export function writeHostCatalogue(root = ROOT) {
101
+ const catalogue = hostCatalogue(root);
102
+ const outputs = { 'lint/host-catalogue.generated.json': `${JSON.stringify(catalogue, null, 2)}\n`, 'docs/api/HOSTS.md': renderHostCatalogue(catalogue) };
103
+ for (const [file, text] of Object.entries(outputs)) { mkdirSync(dirname(resolve(root, file)), { recursive: true }); writeFileSync(resolve(root, file), text); }
104
+ console.info(`host-catalogue: ${catalogue.hosts.length} hosts, ${catalogue.sections.length} sections`);
105
+ return catalogue;
106
+ }
107
+
108
+ if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) writeHostCatalogue();
@@ -0,0 +1,4 @@
1
+ import type { ShardLayout } from '@wildshard/engine/scripts/check-shards.mjs';
2
+
3
+ export function layoutBlock(layout: ShardLayout & { describe?: Record<string, string> }): string;
4
+ export function withLayout(doc: string, layout: ShardLayout & { describe?: Record<string, string> }): string;
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env node
2
+ // E362 AG22: docs/SHARDS.md §2's tables (required files, allowed files, folders) are generated from
3
+ // lint/shard-layout.json — the rules scripts/check-shards.mjs enforces — so the how-to never drifts from the validator.
4
+ // node scripts/gen-shard-layout-doc.mjs rewrite the generated block
5
+ // node scripts/gen-shard-layout-doc.mjs --check fail when it is stale or an entry has no description
6
+ // A tree without docs/ (the Vercel tree) has nothing to check.
7
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
8
+ import { resolve } from 'node:path';
9
+ import { pathToFileURL } from 'node:url';
10
+
11
+ const ROOT = resolve(import.meta.dirname, '..');
12
+ const OPEN = '<!-- generated:shard-layout (node scripts/gen-shard-layout-doc.mjs, from lint/shard-layout.json) -->';
13
+ const CLOSE = '<!-- /generated:shard-layout -->';
14
+
15
+ /** the block for a layout: three tables, every entry with its description; throws when one has none */
16
+ export function layoutBlock(layout) {
17
+ const describe = layout.describe ?? {};
18
+ const row = (name) => {
19
+ const text = describe[name];
20
+ if (typeof text !== 'string' || text.trim() === '') throw new Error(`lint/shard-layout.json: ${name} has no description (describe["${name}"])`);
21
+ return `| \`${name}\` | ${text} |`;
22
+ };
23
+ const source = layout.sourceLayout;
24
+ return [OPEN, '**Primary shard source layout**', '',
25
+ 'All source is build-time or erased declarations. Shipped behaviour is admitted WASM and data; primary shards have no runtime TypeScript.', '',
26
+ '| Required file | What it holds |', '|---|---|', ...source.requiredFiles.map(row), '',
27
+ '| Allowed file | What it holds |', '|---|---|', ...source.allowedFiles.map(row), '',
28
+ '| Folder | What goes in it |', '|---|---|', ...source.folders.map(folder => row(`${folder}/`)), '',
29
+ 'Root erased `*.d.ts` / `*.d.json.ts` contracts and explicitly declared product discovery outputs are also admitted.', '',
30
+ 'Frozen legacy files keep their exact registered layout (**held for LD**). A `-legacy` suffix is not an exemption; the LEGACY entry and Developer buttons stay unchanged.', CLOSE].join('\n');
31
+ }
32
+
33
+ /** the doc with its block regenerated */
34
+ export function withLayout(doc, layout) {
35
+ const s = doc.indexOf(OPEN), e = doc.indexOf(CLOSE);
36
+ if (s === -1 || e === -1) throw new Error('docs/SHARDS.md: the generated:shard-layout markers are missing');
37
+ return doc.slice(0, s) + layoutBlock(layout) + doc.slice(e + CLOSE.length);
38
+ }
39
+
40
+ function main(check) {
41
+ const docPath = resolve(ROOT, 'docs/SHARDS.md');
42
+ if (!existsSync(docPath)) return 0;
43
+ const layout = JSON.parse(readFileSync(resolve(ROOT, 'lint/shard-layout.json'), 'utf8'));
44
+ const doc = readFileSync(docPath, 'utf8'), next = withLayout(doc, layout);
45
+ if (check) {
46
+ if (next !== doc) { console.error('docs/SHARDS.md §2 is stale: run node scripts/gen-shard-layout-doc.mjs'); return 1; }
47
+ return 0;
48
+ }
49
+ if (next !== doc) writeFileSync(docPath, next);
50
+ return 0;
51
+ }
52
+
53
+ if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) {
54
+ try { process.exitCode = main(process.argv.includes('--check')); } catch (error) { console.error(error instanceof Error ? error.message : String(error)); process.exitCode = 1; }
55
+ }
@@ -0,0 +1,17 @@
1
+ import type { ShardProduct } from '@wildshard/engine/scripts/shard-outputs.mjs';
2
+
3
+ export function shardFolders(root: string): string[];
4
+ /** Every product slug (SF88g: a folder's declared outputs, else the folder itself). */
5
+ export function shardSlugs(root: string): string[];
6
+ export function shardSource(root: string): string;
7
+ /** Type-only facade over generated identity data, including registered frozen copies. */
8
+ export function manifestClosure(root: string): Record<string, string[]>;
9
+ /** Core manifest/slug inputs for boot generation; full genShards publishes title tables afterward. */
10
+ export function genShardInputs(root?: string, check?: boolean, initializeMissing?: boolean, shard?: string): void;
11
+ export function genShards(root?: string, check?: boolean, initializeMissing?: boolean, shard?: string): void;
12
+ export function manifestContract(root: string, closure: Record<string, string[]>, fields?: boolean): string[];
13
+
14
+ /** Refresh identities before any consumer imports cached discovery modules. */
15
+ export function refreshDiscovery(root?: string): void;
16
+ /** Preserve every physical static/lazy module target when a discovery output leaves src. */
17
+ export function relocateDiscoverySource(root: string, product: Pick<ShardProduct, 'slug' | 'folder' | 'output'>, text: string): string;