@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.
- package/GUIDE.md +790 -0
- package/README.md +13 -5
- package/bin/wildshard.mjs +38 -0
- package/lint/declaration-config.d.mts +2 -0
- package/lint/declaration-config.mjs +19 -0
- package/lint/engine-plugin.d.mts +2 -0
- package/lint/engine-plugin.mjs +40 -0
- package/lint/host-callbacks.d.mts +6 -0
- package/lint/host-callbacks.mjs +123 -0
- package/lint/host-files.d.mts +1 -0
- package/lint/host-files.mjs +7 -0
- package/lint/layer-exports.d.mts +2 -0
- package/lint/layer-exports.mjs +21 -0
- package/lint/legacy-line-basis.json +995 -0
- package/lint/nine-tiling-baseline.json +35 -0
- package/lint/ratchet.json +11 -0
- package/lint/runtime-files.d.mts +12 -0
- package/lint/runtime-files.json +16 -0
- package/lint/runtime-files.mjs +69 -0
- package/lint/runtime-performance.d.mts +6 -0
- package/lint/runtime-performance.mjs +184 -0
- package/lint/sdk-plugin.d.mts +4 -0
- package/lint/sdk-plugin.mjs +134 -0
- package/lint/shardfile-boundaries.d.mts +10 -0
- package/lint/shardfile-boundaries.mjs +122 -0
- package/lint/tile-bake-debt.json +556 -0
- package/package.json +365 -3
- package/scripts/agent-parity.mjs +1524 -0
- package/scripts/agent-sync.mjs +518 -0
- package/scripts/apfs-clone.mjs +67 -0
- package/scripts/assert-store-layout.mjs +23 -0
- package/scripts/astc6-phone-cap.d.mts +3 -0
- package/scripts/astc6-phone-cap.mjs +137 -0
- package/scripts/audit-assets.d.mts +10 -0
- package/scripts/audit-assets.mjs +151 -0
- package/scripts/bake/coatFiles.d.mts +6 -0
- package/scripts/bake/coatFiles.mjs +37 -0
- package/scripts/bake/environment.d.mts +2 -0
- package/scripts/bake/environment.mjs +58 -0
- package/scripts/bake/far-proxies.mjs +45 -0
- package/scripts/bake/keyed-sky.d.mts +4 -0
- package/scripts/bake/keyed-sky.mjs +34 -0
- package/scripts/bake/movers.mjs +56 -0
- package/scripts/bake/nativeWorld.d.mts +6 -0
- package/scripts/bake/nativeWorld.mjs +43 -0
- package/scripts/bake/navmeshGround.ts +22 -0
- package/scripts/bake/near-placeholder.mjs +331 -0
- package/scripts/bake/placeholderShards.mjs +41 -0
- package/scripts/bake/skins.mjs +15 -0
- package/scripts/bake/template-skins.mjs +33 -0
- package/scripts/bake/viewmodelBytes.ts +26 -0
- package/scripts/bake/viewmodelPage.ts +11 -0
- package/scripts/bake/worldHost.d.mts +35 -0
- package/scripts/bake/worldHost.mjs +110 -0
- package/scripts/bake-astc6.cache.json +80 -0
- package/scripts/bake-astc6.far-reach.cache.json +23 -0
- package/scripts/bake-astc6.list.json +111 -0
- package/scripts/bake-astc6.mjs +279 -0
- package/scripts/bake-astc6.nalati-grasslands.cache.json +42 -0
- package/scripts/bake-catalogue.mjs +44 -0
- package/scripts/bake-check.mjs +54 -0
- package/scripts/bake-chunk.mjs +124 -0
- package/scripts/bake-cloud-field.mjs +24 -0
- package/scripts/bake-coats.mjs +110 -0
- package/scripts/bake-data-maps.d.mts +24 -0
- package/scripts/bake-data-maps.mjs +72 -0
- package/scripts/bake-entry-programs.mjs +117 -0
- package/scripts/bake-geometry.mjs +106 -0
- package/scripts/bake-hybrid-tiles.mjs +28 -0
- package/scripts/bake-ktx2.cache.json +276 -0
- package/scripts/bake-ktx2.list.json +365 -0
- package/scripts/bake-ktx2.mjs +477 -0
- package/scripts/bake-map-glb.mjs +127 -0
- package/scripts/bake-map-rest.d.mts +7 -0
- package/scripts/bake-map-rest.mjs +50 -0
- package/scripts/bake-maps.mjs +200 -0
- package/scripts/bake-navmesh.mjs +259 -0
- package/scripts/bake-packs.mjs +129 -0
- package/scripts/bake-pickups.mjs +102 -0
- package/scripts/bake-query-terrain.mjs +64 -0
- package/scripts/bake-recurve-pool.mjs +16 -0
- package/scripts/bake-section-schemas.d.mts +3 -0
- package/scripts/bake-template-shardfile.mjs +32 -0
- package/scripts/bake-textures.mjs +80 -0
- package/scripts/bake-viewmodel-sets.json +45 -0
- package/scripts/bake-viewmodel-sets.mjs +137 -0
- package/scripts/bake-voxel-ao.mjs +119 -0
- package/scripts/bake-water-ripples.mjs +25 -0
- package/scripts/blender/README.md +129 -0
- package/scripts/blender/build.sh +166 -0
- package/scripts/blender/lib/export-scene.mjs +129 -0
- package/scripts/blender/lib/glb-digest.mjs +188 -0
- package/scripts/blender/lib/glb.py +68 -0
- package/scripts/blender/lib/save_blend.py +17 -0
- package/scripts/blender/lib/world_fixture.py +55 -0
- package/scripts/blender/targets.json +591 -0
- package/scripts/build-sdk.mjs +95 -0
- package/scripts/build-shardfiles.d.mts +7 -0
- package/scripts/build-shardfiles.mjs +206 -0
- package/scripts/capture-hero.mjs +137 -0
- package/scripts/check-lift-review.mjs +23 -0
- package/scripts/chromium-keychain-check.mjs +139 -0
- package/scripts/chromium-keychain.d.mts +1 -0
- package/scripts/chromium-keychain.mjs +5 -0
- package/scripts/compile-script.d.mts +3 -0
- package/scripts/compile-script.mjs +8 -0
- package/scripts/creature-color.mjs +255 -0
- package/scripts/decide/calibrate.py +127 -0
- package/scripts/decide/calibration/2026-10-03/labels-s1.tsv +281 -0
- package/scripts/decide/calibration/2026-10-03/labels-s2.tsv +97 -0
- package/scripts/decide/calibration/2026-10-03/labels-s3.tsv +48 -0
- package/scripts/decide/calibration/2026-10-03/labels-s3b.tsv +26 -0
- package/scripts/decide/calibration/2026-10-03/res-capture-status-v1.jsonl +376 -0
- package/scripts/decide/calibration/2026-10-03/res-text-garbled-strings.jsonl +48 -0
- package/scripts/decide/calibration/2026-10-03/res-text-garbled-v1.jsonl +73 -0
- package/scripts/decide/decide.py +262 -0
- package/scripts/decide/decide.sh +50 -0
- package/scripts/decide/layer-purity-pilot.mjs +41 -0
- package/scripts/decide/sets/capture-status.json +46 -0
- package/scripts/decide/sets/layer-purity.json +28 -0
- package/scripts/decide/sets/text-garbled.json +17 -0
- package/scripts/decide/test_decide.py +37 -0
- package/scripts/docs.mjs +15 -0
- package/scripts/entry-reads/crawl.ts +152 -0
- package/scripts/entry-reads/tsconfig.json +25 -0
- package/scripts/gen-format-schema.d.mts +2 -0
- package/scripts/gen-format-schema.mjs +21 -0
- package/scripts/gen-host-catalogue.d.mts +14 -0
- package/scripts/gen-host-catalogue.mjs +108 -0
- package/scripts/gen-shard-layout-doc.d.mts +4 -0
- package/scripts/gen-shard-layout-doc.mjs +55 -0
- package/scripts/gen-shards.d.mts +17 -0
- package/scripts/gen-shards.mjs +311 -0
- package/scripts/goldens/capture-inputs.d.mts +4 -0
- package/scripts/goldens/capture-inputs.mjs +34 -0
- package/scripts/goldens/colour_shift.py +27 -0
- package/scripts/goldens/native-residency.d.mts +10 -0
- package/scripts/goldens/native-residency.mjs +104 -0
- package/scripts/goldens/plot-inputs.d.mts +12 -0
- package/scripts/goldens/plot-inputs.mjs +46 -0
- package/scripts/gpu-texmem.mjs +98 -0
- package/scripts/horizon-matte/config.py +24 -0
- package/scripts/horizon-matte/encode.py +91 -0
- package/scripts/horizon-matte/key.py +141 -0
- package/scripts/horizon-matte/mkjobs.py +33 -0
- package/scripts/horizon-matte/mkjobs_day2.py +11 -0
- package/scripts/horizon-matte/overlap.py +80 -0
- package/scripts/horizon-matte/run_codex.py +57 -0
- package/scripts/horizon-matte/stitch.py +133 -0
- package/scripts/img2mesh/CC0.md +105 -0
- package/scripts/img2mesh/README.md +209 -0
- package/scripts/img2mesh/ab_board.py +102 -0
- package/scripts/img2mesh/birds/birds.json +255 -0
- package/scripts/img2mesh/birds/birds_atlas.py +150 -0
- package/scripts/img2mesh/birds/birds_fix_preview.mjs +103 -0
- package/scripts/img2mesh/birds/birds_fix_render.py +75 -0
- package/scripts/img2mesh/birds/birds_pack.py +110 -0
- package/scripts/img2mesh/birds/birds_phone_b.py +112 -0
- package/scripts/img2mesh/birds/birds_post.py +550 -0
- package/scripts/img2mesh/birds/birds_render.py +125 -0
- package/scripts/img2mesh/birds/birds_sheet.py +33 -0
- package/scripts/img2mesh/birds/birds_view.py +60 -0
- package/scripts/img2mesh/board.py +100 -0
- package/scripts/img2mesh/build_cc0.sh +52 -0
- package/scripts/img2mesh/build_driftwood.sh +12 -0
- package/scripts/img2mesh/build_faces.sh +53 -0
- package/scripts/img2mesh/build_props.py +81 -0
- package/scripts/img2mesh/cc0_export.py +186 -0
- package/scripts/img2mesh/driftwood_post.py +571 -0
- package/scripts/img2mesh/e304_faces.sh +67 -0
- package/scripts/img2mesh/face_remaster.py +911 -0
- package/scripts/img2mesh/face_views.py +95 -0
- package/scripts/img2mesh/faces-e304.json +9 -0
- package/scripts/img2mesh/faces.json +30 -0
- package/scripts/img2mesh/head_cut.py +100 -0
- package/scripts/img2mesh/hi3d_paint.py +94 -0
- package/scripts/img2mesh/hi3d_refine.py +161 -0
- package/scripts/img2mesh/hunyuan_cpu_rasterizer.sh +42 -0
- package/scripts/img2mesh/pine_hollow_phone.sh +13 -0
- package/scripts/img2mesh/props/coral-arch.json +32 -0
- package/scripts/img2mesh/props/ember-furnace.json +30 -0
- package/scripts/img2mesh/props/night-market-gate.json +10 -0
- package/scripts/img2mesh/render_still.py +86 -0
- package/scripts/img2mesh/rig_strip.mjs +46 -0
- package/scripts/img2mesh/rig_transfer.mjs +104 -0
- package/scripts/img2mesh/split_sheet.py +48 -0
- package/scripts/img2mesh/trellis_batch.py +110 -0
- package/scripts/img2mesh/versus_board.py +114 -0
- package/scripts/import-bundle.d.mts +2 -0
- package/scripts/import-bundle.mjs +20 -0
- package/scripts/ktx2-ab-board.py +133 -0
- package/scripts/ktx2-ab.mjs +111 -0
- package/scripts/ktx2-settings.mjs +18 -0
- package/scripts/land.d.mts +14 -0
- package/scripts/land.mjs +809 -0
- package/scripts/lint-dispatch.mjs +14 -0
- package/scripts/map-bake-frames.d.mts +4 -0
- package/scripts/map-bake-frames.mjs +23 -0
- package/scripts/map-geometry.d.mts +9 -0
- package/scripts/map-geometry.mjs +29 -0
- package/scripts/map-world.mjs +162 -0
- package/scripts/mockup-local.sh +46 -0
- package/scripts/music/export-midi.mjs +68 -0
- package/scripts/music/gen/analyze.py +308 -0
- package/scripts/music/gen/audio_jobs.py +46 -0
- package/scripts/music/gen/briefs.json +51 -0
- package/scripts/music/gen/build_page.py +334 -0
- package/scripts/music/gen/folk.json +3187 -0
- package/scripts/music/gen/gen_ace_step.py +156 -0
- package/scripts/music/gen/gen_heartmula.py +187 -0
- package/scripts/music/gen/gen_minimax.py +143 -0
- package/scripts/music/gen/gen_sao.py +122 -0
- package/scripts/music/gen/gen_sao_small.py +104 -0
- package/scripts/music/gen/gen_sfx.py +98 -0
- package/scripts/music/gen/gen_sfx_ezaudio.py +112 -0
- package/scripts/music/gen/gen_sfx_moss.py +112 -0
- package/scripts/music/gen/models.json +61 -0
- package/scripts/music/gen/nalati-jobs.json +104 -0
- package/scripts/music/gen/nalati-score-build.json +119 -0
- package/scripts/music/gen/nalati-score.json +3448 -0
- package/scripts/music/gen/ob7-fit-decisions.json +38 -0
- package/scripts/music/gen/ob7-score-jobs.json +152 -0
- package/scripts/music/gen/ob7-sfx-jobs.json +897 -0
- package/scripts/music/gen/ob7_build.py +469 -0
- package/scripts/music/gen/ob7_generate.py +67 -0
- package/scripts/music/gen/ob7_run.sh +42 -0
- package/scripts/music/gen/orchestral.json +3187 -0
- package/scripts/music/gen/own_score.py +486 -0
- package/scripts/music/gen/ph-jobs.json +27 -0
- package/scripts/music/gen/ph_page.py +222 -0
- package/scripts/music/gen/piano.json +3175 -0
- package/scripts/music/gen/rank_v3.py +248 -0
- package/scripts/music/gen/sfx-best.json +2486 -0
- package/scripts/music/gen/sfx-ezaudio.json +4082 -0
- package/scripts/music/gen/sfx-jobs.json +57 -0
- package/scripts/music/gen/sfx-minimax-jobs.json +16 -0
- package/scripts/music/gen/sfx-minimax.json +289 -0
- package/scripts/music/gen/sfx-moss.json +4082 -0
- package/scripts/music/gen/sfx-nalati-b3-jobs.json +17 -0
- package/scripts/music/gen/sfx-nalati-jobs.json +338 -0
- package/scripts/music/gen/sfx-nalati.json +11202 -0
- package/scripts/music/gen/sfx-nd-jobs.json +57 -0
- package/scripts/music/gen/sfx-nd-moss.json +2097 -0
- package/scripts/music/gen/sfx-nd-sa3-medium.json +2097 -0
- package/scripts/music/gen/sfx-nd-summary.json +38 -0
- package/scripts/music/gen/sfx-peaks.json +7 -0
- package/scripts/music/gen/sfx-ph-jobs.json +169 -0
- package/scripts/music/gen/sfx-ph-moss.json +6564 -0
- package/scripts/music/gen/sfx-ph-sa3-medium.json +7239 -0
- package/scripts/music/gen/sfx-ph-summary.json +63 -0
- package/scripts/music/gen/sfx-sa3-medium.json +4082 -0
- package/scripts/music/gen/sfx-sa3.json +4082 -0
- package/scripts/music/gen/sfx-summary.json +107 -0
- package/scripts/music/gen/sfx_build.py +332 -0
- package/scripts/music/gen/sfx_merge.py +255 -0
- package/scripts/music/gen/sfx_minimax.py +61 -0
- package/scripts/music/gen/sfx_nalati.py +331 -0
- package/scripts/music/gen/sfx_sprite.py +424 -0
- package/scripts/music/gen/stems.py +539 -0
- package/scripts/music/gen/test_loop_meter.py +29 -0
- package/scripts/music/gen/test_ob7_provenance.py +77 -0
- package/scripts/music/gen/v3-folk-build.json +148 -0
- package/scripts/music/gen/v3-folk.json +1818 -0
- package/scripts/music/gen/v3-jobs.json +145 -0
- package/scripts/music/gen/v3-orchestral-build.json +148 -0
- package/scripts/music/gen/v3-orchestral.json +1813 -0
- package/scripts/music/gen/v3-ph-folk-build.json +94 -0
- package/scripts/music/gen/v3-ph-folk.json +1806 -0
- package/scripts/music/gen/v3-ph-orchestral-build.json +94 -0
- package/scripts/music/gen/v3-ph-orchestral.json +1824 -0
- package/scripts/music/gen/v3-ph-piano-build.json +94 -0
- package/scripts/music/gen/v3-ph-piano.json +1818 -0
- package/scripts/music/gen/v3-piano-build.json +148 -0
- package/scripts/music/gen/v3-piano.json +1813 -0
- package/scripts/music/wildshard-theme.mid +0 -0
- package/scripts/music/wildshard-trailer30.mid +0 -0
- package/scripts/named-blob-output.d.mts +8 -0
- package/scripts/named-blob-output.mjs +48 -0
- package/scripts/pack-all.mjs +15 -0
- package/scripts/pid-lock.d.mts +1 -0
- package/scripts/pid-lock.mjs +63 -0
- package/scripts/practice/bake_dummy.py +53 -0
- package/scripts/practice/build_dummies.sh +43 -0
- package/scripts/practice/dummy_parts.py +568 -0
- package/scripts/practice/dummy_rig_gate.py +139 -0
- package/scripts/practice/gate_sheet.py +36 -0
- package/scripts/practice/generate_dummy_unimate.py +132 -0
- package/scripts/practice/pack_dummy.mjs +59 -0
- package/scripts/practice/repair_dummy_weights.mjs +68 -0
- package/scripts/practice/rig_dummy.py +828 -0
- package/scripts/practice/verify_unimate_skin.mjs +356 -0
- package/scripts/preparation-seed.mjs +15 -0
- package/scripts/prepare-basis-tool.mjs +6 -0
- package/scripts/prepare-product.d.mts +14 -0
- package/scripts/prepare-product.mjs +101 -0
- package/scripts/product-build-tools.d.mts +3 -0
- package/scripts/product-build-tools.json +3 -0
- package/scripts/product-build-tools.mjs +31 -0
- package/scripts/publish-public.mjs +7 -0
- package/scripts/push-tables.d.mts +1 -0
- package/scripts/push-tables.mjs +28 -0
- package/scripts/record-shard-mounts.mjs +133 -0
- package/scripts/sdk-externals.d.mts +2 -0
- package/scripts/sdk-externals.mjs +2 -0
- package/scripts/section-inventory.ts +209 -0
- package/scripts/select-candidate.mjs +15 -0
- package/scripts/shard-build-pool.d.mts +4 -0
- package/scripts/shard-build-pool.mjs +53 -0
- package/scripts/shard-line-baseline.json +17 -0
- package/scripts/shard-milestones.d.mts +15 -0
- package/scripts/shard-milestones.mjs +105 -0
- package/scripts/shard-output-report.d.mts +9 -0
- package/scripts/shard-output-report.mjs +85 -0
- package/scripts/shard-platform-cli.mjs +93 -0
- package/scripts/shard-progress.mjs +212 -0
- package/scripts/shard-timelapse.py +102 -0
- package/scripts/shardfile-cold-boot.mjs +79 -0
- package/scripts/shardfile-vite.d.mts +4 -0
- package/scripts/shardfile-vite.mjs +20 -0
- package/scripts/simplify-models.mjs +24 -0
- package/scripts/site-facts.mjs +88 -0
- package/scripts/test-template-gate.mjs +44 -0
- package/scripts/test_golden_compare.py +68 -0
- package/scripts/tex-tiers.cache.json +181 -0
- package/scripts/tex-tiers.mjs +240 -0
- package/scripts/texmem-probe.mjs +184 -0
- package/scripts/unused-assets.mjs +173 -0
- package/scripts/vite-tmp.d.mts +23 -0
- package/scripts/vite-tmp.mjs +157 -0
- package/scripts/wave-line-baselines.json +32 -0
- package/scripts/wildshard.d.mts +4 -0
- package/scripts/wildshard.mjs +105 -0
- package/scripts/witness-checkpoints.d.mts +10 -0
- package/scripts/witness-checkpoints.mjs +84 -0
- package/scripts/witness-generation.d.mts +10 -0
- package/scripts/witness-generation.mjs +45 -0
- package/scripts/witness-manifests.d.mts +8 -0
- package/scripts/witness-manifests.mjs +157 -0
- package/scripts/worktree-ignore.d.mts +4 -0
- package/scripts/worktree-ignore.mjs +36 -0
- package/scripts/worktree-reap.mjs +214 -0
- package/scripts/worktree.mjs +396 -0
- package/scripts/worldclaw/capture-front.sh +28 -0
- package/scripts/worldclaw/design-template.md +62 -0
- package/scripts/worldclaw/spec-map.py +92 -0
- package/scripts/worldclaw/spec.ts +96 -0
- package/skills/wildshard/SKILL.md +50 -0
- package/skills/wildshard-goldens/SKILL.md +54 -0
- package/skills/wildshard-mockup-to-model/SKILL.md +56 -0
- package/skills/wildshard-upgrade/SKILL.md +46 -0
- package/src/.oxfmtrc.json +50 -0
- package/src/.oxlintrc.json +173 -0
- package/src/cli/account/account.ts +199 -0
- package/src/cli/account/command.ts +193 -0
- package/src/cli/account/key.ts +154 -0
- package/src/cli/args.ts +97 -0
- package/src/cli/audio/audio.ts +24 -0
- package/src/cli/bin.mjs +8 -0
- package/src/cli/delete/delete.ts +258 -0
- package/src/cli/help.ts +196 -0
- package/src/cli/hero/adopt.ts +103 -0
- package/src/cli/hero/hero.ts +112 -0
- package/src/cli/hero/stamp.ts +298 -0
- package/src/cli/main.ts +292 -0
- package/src/cli/report.ts +16 -0
- package/src/cli/shardfile/command.ts +50 -0
- package/src/cli/shardfile/shardfile.ts +192 -0
- package/src/cli/upload/api.ts +246 -0
- package/src/cli/upload/compress.ts +55 -0
- package/src/cli/upload/hero.ts +62 -0
- package/src/cli/upload/placement.ts +115 -0
- package/src/cli/upload/provenance.ts +192 -0
- package/src/cli/upload/signature.ts +30 -0
- package/src/cli/upload/upload.ts +269 -0
- package/src/cli/upload/validate.ts +74 -0
- package/src/cli/upload/wire.ts +147 -0
- package/src/cli/version.ts +63 -0
- package/src/commons/bake/portableMath.ts +187 -0
- package/src/commons/catalogue.ts +10 -0
- package/src/commons/courseProgram.ts +32 -0
- package/src/commons/practiceCourse.ts +16 -0
- package/src/commons/scripts/abi.as +14 -0
- package/src/commons/scripts/bridge.as +14 -0
- package/src/commons/scripts/course.as +63 -0
- package/src/scripts/ask-new.sh +29 -0
- package/src/scripts/asks.mjs +141 -0
- package/src/scripts/herdr-prompt.sh +34 -0
- package/src/scripts/herdr-question-open.sh +67 -0
- package/src/scripts/md-wrap.mjs +229 -0
- package/src/server/app.ts +19 -0
- package/src/server/serve.ts +49 -0
- package/src/sharddev/admission.ts +7 -0
- package/src/sharddev/arenaView.ts +15 -0
- package/src/sharddev/as/groupBankV2.ts +36 -0
- package/src/sharddev/as/groupStepV2.ts +13 -0
- package/src/sharddev/as/ws.ts +30 -0
- package/src/sharddev/as/wsV2.ts +180 -0
- package/src/sharddev/assemblyscriptCompiler.d.mts +5 -0
- package/src/sharddev/assemblyscriptCompiler.mjs +14 -0
- package/src/sharddev/assetHandle.ts +84 -0
- package/src/sharddev/assetOwner.ts +70 -0
- package/src/sharddev/assetScope.ts +30 -0
- package/src/sharddev/assets.ts +21 -0
- package/src/sharddev/audio.ts +9 -0
- package/src/sharddev/audioEncode.ts +211 -0
- package/src/sharddev/author.ts +3 -0
- package/src/sharddev/authorError.ts +28 -0
- package/src/sharddev/authorManifest.ts +39 -0
- package/src/sharddev/bake/annulus.ts +19 -0
- package/src/sharddev/bake/assemblyscriptMemo.ts +76 -0
- package/src/sharddev/bake/assemblyscriptMemoPort.ts +4 -0
- package/src/sharddev/bake/authoredWorld.ts +201 -0
- package/src/sharddev/bake/basisEncoder.ts +95 -0
- package/src/sharddev/bake/basisGlb.ts +85 -0
- package/src/sharddev/bake/basisTool.ts +74 -0
- package/src/sharddev/bake/basisToolInputs.ts +476 -0
- package/src/sharddev/bake/byteCodec.ts +33 -0
- package/src/sharddev/bake/canvasAtlas.ts +406 -0
- package/src/sharddev/bake/coarseCopy.ts +59 -0
- package/src/sharddev/bake/colliders.ts +87 -0
- package/src/sharddev/bake/compactGlb.ts +224 -0
- package/src/sharddev/bake/compileScript.ts +119 -0
- package/src/sharddev/bake/compileScriptV2.ts +75 -0
- package/src/sharddev/bake/contactRows.ts +84 -0
- package/src/sharddev/bake/creaturePlacement.ts +117 -0
- package/src/sharddev/bake/export.ts +67 -0
- package/src/sharddev/bake/facetedGeometry.ts +379 -0
- package/src/sharddev/bake/farImpostor.ts +120 -0
- package/src/sharddev/bake/forest.ts +100 -0
- package/src/sharddev/bake/format-hook.mjs +2 -0
- package/src/sharddev/bake/generatorGlb.ts +23 -0
- package/src/sharddev/bake/geometryBounds.ts +77 -0
- package/src/sharddev/bake/geometryError.ts +48 -0
- package/src/sharddev/bake/glb.ts +355 -0
- package/src/sharddev/bake/glbCompression.ts +143 -0
- package/src/sharddev/bake/gltfSource.ts +59 -0
- package/src/sharddev/bake/groundMap.ts +142 -0
- package/src/sharddev/bake/image.ts +20 -0
- package/src/sharddev/bake/isleMap.ts +64 -0
- package/src/sharddev/bake/json.mjs +84 -0
- package/src/sharddev/bake/keyedSky.ts +47 -0
- package/src/sharddev/bake/keyedSkyMemo.ts +39 -0
- package/src/sharddev/bake/kinds.ts +137 -0
- package/src/sharddev/bake/lightSources.ts +31 -0
- package/src/sharddev/bake/mapAssembly.ts +84 -0
- package/src/sharddev/bake/mapRaster.ts +173 -0
- package/src/sharddev/bake/mapRest.ts +57 -0
- package/src/sharddev/bake/mapScenes.ts +234 -0
- package/src/sharddev/bake/materialGraph.ts +32 -0
- package/src/sharddev/bake/meadow.ts +27 -0
- package/src/sharddev/bake/meshoptChoiceMemo.ts +34 -0
- package/src/sharddev/bake/nativeInteractionFacts.ts +5 -0
- package/src/sharddev/bake/nativeLattice.ts +178 -0
- package/src/sharddev/bake/nativeRaster.ts +106 -0
- package/src/sharddev/bake/nativeTerrainField.ts +11 -0
- package/src/sharddev/bake/navigation-json.mjs +38 -0
- package/src/sharddev/bake/navigation.ts +113 -0
- package/src/sharddev/bake/navigationAsset.ts +18 -0
- package/src/sharddev/bake/nearPlaceholder.ts +206 -0
- package/src/sharddev/bake/normalizeRig.ts +80 -0
- package/src/sharddev/bake/phoneAstc.ts +93 -0
- package/src/sharddev/bake/placeholders.ts +581 -0
- package/src/sharddev/bake/placement.ts +80 -0
- package/src/sharddev/bake/portableBytes.ts +18 -0
- package/src/sharddev/bake/portableBytesMemo.ts +50 -0
- package/src/sharddev/bake/practiceCourse.ts +49 -0
- package/src/sharddev/bake/primitives.ts +96 -0
- package/src/sharddev/bake/props.ts +443 -0
- package/src/sharddev/bake/questPlacement.ts +98 -0
- package/src/sharddev/bake/rawTexture.ts +26 -0
- package/src/sharddev/bake/riderArms.ts +97 -0
- package/src/sharddev/bake/rig.ts +95 -0
- package/src/sharddev/bake/riggedHullRecipes.ts +40 -0
- package/src/sharddev/bake/signPlacements.ts +25 -0
- package/src/sharddev/bake/simplifier.ts +52 -0
- package/src/sharddev/bake/skinned.ts +312 -0
- package/src/sharddev/bake/slabChunks.ts +149 -0
- package/src/sharddev/bake/slabs.ts +263 -0
- package/src/sharddev/bake/source-loader.mjs +55 -0
- package/src/sharddev/bake/sourceMetadata.ts +54 -0
- package/src/sharddev/bake/species.ts +368 -0
- package/src/sharddev/bake/specimenCatalogue.ts +47 -0
- package/src/sharddev/bake/splatGround.ts +141 -0
- package/src/sharddev/bake/staticMaterials.ts +171 -0
- package/src/sharddev/bake/terrain.ts +195 -0
- package/src/sharddev/bake/texture.ts +33 -0
- package/src/sharddev/bake/textureWasm.ts +81 -0
- package/src/sharddev/bake/tileEncoder.ts +11 -0
- package/src/sharddev/bake/tileGrid.ts +62 -0
- package/src/sharddev/bake/v2Finite.ts +160 -0
- package/src/sharddev/bake/v2Fuel.ts +71 -0
- package/src/sharddev/bake/wholePartition.ts +74 -0
- package/src/sharddev/bake/wholePieceJoin.ts +147 -0
- package/src/sharddev/bake/world.ts +173 -0
- package/src/sharddev/bake/worldCollision.ts +128 -0
- package/src/sharddev/bake/worldGeometry.ts +237 -0
- package/src/sharddev/bake/worldGlb.ts +123 -0
- package/src/sharddev/bake/worldImage.ts +12 -0
- package/src/sharddev/bake/worldLod.ts +128 -0
- package/src/sharddev/bake/worldRows.ts +102 -0
- package/src/sharddev/bake/worldTextureMemo.ts +63 -0
- package/src/sharddev/bake/zstdBytesMemo.ts +52 -0
- package/src/sharddev/bake.ts +193 -0
- package/src/sharddev/bakePublication.ts +31 -0
- package/src/sharddev/behaviourSource.ts +94 -0
- package/src/sharddev/bin/wildshard.mjs +7 -0
- package/src/sharddev/blobBytes.ts +65 -0
- package/src/sharddev/blobs.ts +138 -0
- package/src/sharddev/bootInventory.ts +129 -0
- package/src/sharddev/bossProfiles.ts +18 -0
- package/src/sharddev/buildBehaviour.ts +77 -0
- package/src/sharddev/buildCacheMetrics.ts +17 -0
- package/src/sharddev/buildDecisionScripts.ts +122 -0
- package/src/sharddev/check.ts +117 -0
- package/src/sharddev/checkProject.ts +126 -0
- package/src/sharddev/cli.ts +191 -0
- package/src/sharddev/clientChannels.ts +169 -0
- package/src/sharddev/clientScripts.ts +10 -0
- package/src/sharddev/commons.ts +77 -0
- package/src/sharddev/commonsCosts.ts +11 -0
- package/src/sharddev/compileMovers.ts +11 -0
- package/src/sharddev/configBoundary.ts +6 -0
- package/src/sharddev/cookInput.ts +40 -0
- package/src/sharddev/crowds.ts +6 -0
- package/src/sharddev/decisionBindingMap.ts +11 -0
- package/src/sharddev/decisionScriptBindings.ts +117 -0
- package/src/sharddev/decisionScripts.ts +28 -0
- package/src/sharddev/decisionSource.ts +51 -0
- package/src/sharddev/dev.ts +113 -0
- package/src/sharddev/director.ts +26 -0
- package/src/sharddev/directorAbi.ts +77 -0
- package/src/sharddev/discoveryDocument.ts +97 -0
- package/src/sharddev/draft.ts +11 -0
- package/src/sharddev/eliteEntryRows.ts +29 -0
- package/src/sharddev/entries.ts +76 -0
- package/src/sharddev/entryReads.ts +73 -0
- package/src/sharddev/executeBundle.ts +55 -0
- package/src/sharddev/finds.ts +5 -0
- package/src/sharddev/formatJsonSchema.ts +3 -0
- package/src/sharddev/generationCache.ts +257 -0
- package/src/sharddev/generationRecipe.ts +94 -0
- package/src/sharddev/handwritten.ts +110 -0
- package/src/sharddev/immutable.ts +14 -0
- package/src/sharddev/interactions.ts +38 -0
- package/src/sharddev/kit/bakedGeometry.ts +16 -0
- package/src/sharddev/kit/geometryPack.ts +110 -0
- package/src/sharddev/ledger.ts +13 -0
- package/src/sharddev/looks/tileField.ts +67 -0
- package/src/sharddev/materialGraphFiles.ts +57 -0
- package/src/sharddev/materials.ts +574 -0
- package/src/sharddev/measure.ts +18 -0
- package/src/sharddev/modes.ts +115 -0
- package/src/sharddev/moverPrograms.ts +213 -0
- package/src/sharddev/movers.ts +75 -0
- package/src/sharddev/nativePopulationRows.ts +46 -0
- package/src/sharddev/newProject.ts +247 -0
- package/src/sharddev/noise.ts +54 -0
- package/src/sharddev/outputProduct.ts +188 -0
- package/src/sharddev/outputRuntime.ts +66 -0
- package/src/sharddev/performancePolicy.ts +18 -0
- package/src/sharddev/phasedBoss.ts +34 -0
- package/src/sharddev/physics.ts +194 -0
- package/src/sharddev/platformSections.ts +42 -0
- package/src/sharddev/plumbing.ts +8 -0
- package/src/sharddev/productOutput.ts +128 -0
- package/src/sharddev/project.ts +337 -0
- package/src/sharddev/projectCompilerIdentity.ts +94 -0
- package/src/sharddev/projectDecisions.ts +66 -0
- package/src/sharddev/projectEntryProof.ts +32 -0
- package/src/sharddev/projectGeneration.ts +219 -0
- package/src/sharddev/projectInputFiles.ts +47 -0
- package/src/sharddev/projectManifest.ts +108 -0
- package/src/sharddev/projectMap.ts +35 -0
- package/src/sharddev/projectOutput.ts +242 -0
- package/src/sharddev/projectPolicy.ts +17 -0
- package/src/sharddev/projectSections.ts +27 -0
- package/src/sharddev/questGraph.ts +25 -0
- package/src/sharddev/quests.ts +65 -0
- package/src/sharddev/random.ts +61 -0
- package/src/sharddev/refusals.ts +234 -0
- package/src/sharddev/reportCard.ts +13 -0
- package/src/sharddev/returnProjectionV2.ts +81 -0
- package/src/sharddev/rows.ts +192 -0
- package/src/sharddev/runtimeImports.ts +38 -0
- package/src/sharddev/runtimeMirrors.ts +39 -0
- package/src/sharddev/runtimePerformance.ts +38 -0
- package/src/sharddev/scene.ts +321 -0
- package/src/sharddev/sceneAnimation.ts +54 -0
- package/src/sharddev/sceneAudio.ts +64 -0
- package/src/sharddev/sceneDeclarations.ts +100 -0
- package/src/sharddev/sceneGraph.ts +139 -0
- package/src/sharddev/sceneTransform.ts +12 -0
- package/src/sharddev/schemaValidation.ts +61 -0
- package/src/sharddev/sections.ts +47 -0
- package/src/sharddev/shardSource.ts +59 -0
- package/src/sharddev/sourceReader.ts +26 -0
- package/src/sharddev/spawns.ts +38 -0
- package/src/sharddev/species/clips.ts +24 -0
- package/src/sharddev/species.ts +29 -0
- package/src/sharddev/speciesBrains.ts +19 -0
- package/src/sharddev/synth.ts +66 -0
- package/src/sharddev/test/compileDualScriptV2.ts +71 -0
- package/src/sharddev/test/compileSimV2.ts +21 -0
- package/src/sharddev/test/diskScriptScenario.ts +86 -0
- package/src/sharddev/test/scriptScenario.ts +249 -0
- package/src/sharddev/test/scriptSource.ts +12 -0
- package/src/sharddev/version.ts +4 -0
- package/src/sharddev/weapons/bowProfile.ts +20 -0
- package/src/sharddev/weapons/firearmRows.ts +11 -0
- package/src/sharddev/weapons/meleeProfile.ts +71 -0
- package/src/sharddev/weapons/thrownProfile.ts +10 -0
- package/src/sharddev/worldScenes.ts +308 -0
- package/src/sharddev/worldSource.ts +82 -0
- package/src/shards/_template/README.md +78 -0
- package/src/shards/_template/assets/2bf489fdb15f1734ddb4c4f32d500ec6da85c765ec7a4eb28dc6781160e7ec8c +0 -0
- package/src/shards/_template/assets/97ec4d8f75f5fa6239ee919444d6dc19fd35896bb305930c1f050ac6e0e0e6a6 +1 -0
- package/src/shards/_template/assets/a6a587a31327f936b1b04c05ade818c73fc8964260918662db43539465e27586 +0 -0
- package/src/shards/_template/assets/b4fbde0422e125b498c3dc8b9a5cc2516c8598f09e9d0e5f6b639b32f98179e6 +0 -0
- package/src/shards/_template/assets/bfa4dfc9c18979f904557ee8deab0058b8a399be10266f5fb1578b403f482fd4 +1 -0
- package/src/shards/_template/assets/ef3b7ff4fd22715771cb7d68a3977a903c5e7c3dc293542687d04b3ef3ace2cb +0 -0
- package/src/shards/_template/assets/f2db05998615ce1cb79ea96be32c168842eb6a2b34ec01feb86d36404603ee54 +0 -0
- package/src/shards/_template/assets/fef98ebb7fce6f66b26e78ac699e5c90f9bdcfaf8cabeb2b58125347eea8b4ab +0 -0
- package/src/shards/_template/behaviour/boss.as +39 -0
- package/src/shards/_template/behaviour/door.as +32 -0
- package/src/shards/_template/behaviour/hooks.json +129 -0
- package/src/shards/_template/behaviour/idle.as +75 -0
- package/src/shards/_template/behaviour/items.as +22 -0
- package/src/shards/_template/card/landscape.jpg +0 -0
- package/src/shards/_template/card/portrait.jpg +0 -0
- package/src/shards/_template/card/thumb.jpg +0 -0
- package/src/shards/_template/data/audio.json +45 -0
- package/src/shards/_template/data/bossDecision.json +83 -0
- package/src/shards/_template/data/budgets.json +70 -0
- package/src/shards/_template/data/card.json +281 -0
- package/src/shards/_template/data/clientScripts.json +987 -0
- package/src/shards/_template/data/creatures.json +65 -0
- package/src/shards/_template/data/director.json +39 -0
- package/src/shards/_template/data/encounters.json +96 -0
- package/src/shards/_template/data/items.json +172 -0
- package/src/shards/_template/data/layout.json +66 -0
- package/src/shards/_template/data/ledger.json +32 -0
- package/src/shards/_template/data/look.json +521 -0
- package/src/shards/_template/data/map.json +64 -0
- package/src/shards/_template/data/moves.json +16 -0
- package/src/shards/_template/data/placeholder.json +8 -0
- package/src/shards/_template/data/plumbing.json +32 -0
- package/src/shards/_template/data/quests.json +223 -0
- package/src/shards/_template/data/rows.json +423 -0
- package/src/shards/_template/data/skins.json +66 -0
- package/src/shards/_template/data/spawn.json +6 -0
- package/src/shards/_template/data/targets.json +150 -0
- package/src/shards/_template/data/text.json +12 -0
- package/src/shards/_template/data/ui.json +33 -0
- package/src/shards/_template/data/water.json +13 -0
- package/src/shards/_template/generators/behaviour.ts +34 -0
- package/src/shards/_template/generators/boss.ts +29 -0
- package/src/shards/_template/generators/buildOptions.ts +2 -0
- package/src/shards/_template/generators/cell.ts +224 -0
- package/src/shards/_template/generators/districts.ts +215 -0
- package/src/shards/_template/generators/farLook.ts +15 -0
- package/src/shards/_template/generators/generate.ts +27 -0
- package/src/shards/_template/generators/ground.ts +15 -0
- package/src/shards/_template/generators/kit.ts +69 -0
- package/src/shards/_template/generators/landscape.ts +59 -0
- package/src/shards/_template/generators/landscapeNoise.ts +62 -0
- package/src/shards/_template/generators/mapInputs.ts +10 -0
- package/src/shards/_template/generators/product.ts +100 -0
- package/src/shards/_template/generators/productOutput.ts +18 -0
- package/src/shards/_template/generators/props.ts +9 -0
- package/src/shards/_template/generators/templatePropsSource.ts +58 -0
- package/src/shards/_template/generators/terrain.ts +17 -0
- package/src/shards/_template/generators/world.ts +630 -0
- package/src/shards/_template/hero.json +10 -0
- package/src/shards/_template/look/entry-reads.json +20 -0
- package/src/shards/_template/manifest.json +281 -0
- package/src/shards/_template/shard.config.ts +10 -0
- package/src/shared/health.ts +10 -0
- package/src/tools/build-web.ts +59 -0
- package/src/tsconfig.json +30 -0
- package/src/web/app.tsx +53 -0
- package/src/web/index.html +12 -0
- package/src/web/main.tsx +10 -0
- package/src/web/tsconfig.json +13 -0
- package/tsconfig.author.json +23 -0
- package/tsconfig.commons.json +21 -0
- package/tsconfig.json +47 -0
- package/tsconfig.sharddev.json +20 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
// SHARD-AUTHORING SA21 (J317, "the first ten minutes"): every refusal an author can hit in `wildshard` (lint, build,
|
|
2
|
+
// validate, prove, the report card, new, the shard file build writes (and `pack`, its deprecated alias, SA3) and upload's
|
|
3
|
+
// local checks) names a stable rule id, a one-line fix and a
|
|
4
|
+
// GUIDE.md section. This file is the one table. GUIDE.md (SA13) writes one heading per anchor below, so
|
|
5
|
+
// `GUIDE.md#<anchor>` lands on it; refusals.test.ts fails a row with no fix or anchor and a wildshard lint rule with no
|
|
6
|
+
// row. Rule ids are stable: rename one only together with its GUIDE.md heading. A message takes the first row (in table
|
|
7
|
+
// order) for its step whose pattern matches, else its step's catch-all (the row with no pattern), wherever that sits.
|
|
8
|
+
//
|
|
9
|
+
// Messages stay as the refusing code (and shard-format) words them: a row matches them, it never rewrites them.
|
|
10
|
+
|
|
11
|
+
/** Where a refusal came from: `check`'s five steps, then the other verbs. `shardfile` is the shard file build writes (SA3). */
|
|
12
|
+
export type RefusalStep = 'lint' | 'build' | 'validate' | 'prove' | 'report' | 'new' | 'shardfile' | 'pack' | 'upload' | 'account' | 'delete';
|
|
13
|
+
/** One rule: its id, its GUIDE.md anchor, the fix, and the refusal messages it names (none: the step's catch-all). */
|
|
14
|
+
export interface RefusalRule {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly anchor: string;
|
|
17
|
+
readonly fix: string;
|
|
18
|
+
readonly steps: readonly RefusalStep[] | 'any';
|
|
19
|
+
readonly match?: RegExp;
|
|
20
|
+
}
|
|
21
|
+
/** What a printed refusal carries besides its message. `guide` is `GUIDE.md#<anchor>`. */
|
|
22
|
+
export interface RefusalNote { readonly rule: string; readonly fix: string; readonly guide: string }
|
|
23
|
+
|
|
24
|
+
/** The author's manual: shipped in the package and written into a project by `wildshard new` (SA13). */
|
|
25
|
+
export const GUIDE_FILE = 'GUIDE.md';
|
|
26
|
+
|
|
27
|
+
/** The refusals that are not lint rules, most specific first; each step has one catch-all (no `match`). */
|
|
28
|
+
export const REFUSAL_RULES: readonly RefusalRule[] = [
|
|
29
|
+
{ id: 'usage', anchor: 'usage', steps: 'any', match: /^usage: |^unknown (?:wildshard command|build flag|command)|unknown or incomplete build map flag|^Unknown schema root|accepts no pointer|^dev port must be|^invalid --port\b|^(?:validate|prove) requires a format-2 shard\.json or (?:shard source|author project)/u,
|
|
30
|
+
fix: 'Run `wildshard --help` and give the verb the arguments and flags it lists.' },
|
|
31
|
+
// new
|
|
32
|
+
{ id: 'new-target', anchor: 'new-target', steps: ['new'], match: /new requires a fresh directory and kebab-case slug/u,
|
|
33
|
+
fix: 'Name a folder that does not exist yet and a kebab-case slug: `wildshard new my-isle`.' },
|
|
34
|
+
{ id: 'new-template', anchor: 'new-template', steps: ['new'], match: /^new: unknown template /u,
|
|
35
|
+
fix: 'Leave out --template, or pass `--template sdk` (the reference world) or `--template blender` (the hand-written Blender template).' },
|
|
36
|
+
{ id: 'new-refused', anchor: 'new-refused', steps: ['new'],
|
|
37
|
+
fix: 'Reinstall @wildshard/sdk (`pnpm install`); `new` copies the reference world shipped with it.' },
|
|
38
|
+
// build
|
|
39
|
+
{ id: 'source-file-missing', anchor: 'source-file-missing', steps: ['build', 'validate', 'prove'], match: /ENOENT: no such file or directory|Cannot resolve entry module/u,
|
|
40
|
+
fix: 'Check the path shown: the shard source or shard file folder, or a file it names, is not there.' },
|
|
41
|
+
{ id: 'source-import-missing', anchor: 'source-import-missing', steps: ['build'], match: /Could not resolve|Cannot find (?:module|package)|Failed to resolve import/u,
|
|
42
|
+
fix: 'Fix the import path, or add the package to package.json and run `pnpm install`.' },
|
|
43
|
+
{ id: 'json-syntax', anchor: 'json-syntax', steps: ['build'], match: /builtin:vite-json|while parsing|is not valid JSON|in JSON at position/u,
|
|
44
|
+
fix: 'Fix the JSON at the line and column shown: usually a missing comma, bracket or quote.' },
|
|
45
|
+
{ id: 'source-syntax', anchor: 'source-syntax', steps: ['build'], match: /builtin:vite-transform|SyntaxError|Unexpected token|Expected .* but found/u,
|
|
46
|
+
fix: 'Fix the syntax error at the file and line shown; your editor\'s TypeScript check marks it too.' },
|
|
47
|
+
{ id: 'config-default-export', anchor: 'config-default-export', steps: ['build'], match: /config has no default export|config generate export must be a build function|Author module has no exports/u,
|
|
48
|
+
fix: 'shard.config.ts must `export default generate;`, the function `wildshard new` wrote there.' },
|
|
49
|
+
{ id: 'config-file-access', anchor: 'config-file-access', steps: ['build'], match: /must use injected build capabilities for file access/u,
|
|
50
|
+
fix: 'Read files through the build context (`ctx.cached`), not node:fs, in code shard.config.ts imports.' },
|
|
51
|
+
{ id: 'project-folder-slug', anchor: 'project-folder-slug', steps: ['build'], match: /Manifest identity differs from its folder/u,
|
|
52
|
+
fix: 'Name the shard source folder after the shard\'s slug (data/identity.json), or change the slug to the folder\'s name.' },
|
|
53
|
+
{ id: 'source-schema', anchor: 'source-schema', steps: ['build'], match: /(?:^|: |; )Invalid [a-z]+: /u,
|
|
54
|
+
fix: 'Give the field at the path shown the value it expects; `wildshard schema shardfile <pointer>` prints its shape.' },
|
|
55
|
+
{ id: 'build-refused', anchor: 'build-refused', steps: ['build'],
|
|
56
|
+
fix: 'Fix what the message names (a file, field or generator) and run `wildshard check` again.' },
|
|
57
|
+
// validate
|
|
58
|
+
{ id: 'validate-refused', anchor: 'validate-refused', steps: ['validate'],
|
|
59
|
+
fix: 'Rebuild with `wildshard check`; if a fresh build of unedited output still fails, report it with this message.' },
|
|
60
|
+
// prove
|
|
61
|
+
{ id: 'proof-tape-invalid', anchor: 'proof-tape-invalid', steps: ['prove'], match: /^[^\s/]+\.json: /u,
|
|
62
|
+
fix: 'Fix the proof tape (proof.json) where the message says; its shape is the author proof plan.' },
|
|
63
|
+
{ id: 'proof-failed', anchor: 'proof-failed', steps: ['prove'],
|
|
64
|
+
fix: 'Walk the quest in `wildshard dev`, then fix the data or the tape step that did not happen.' },
|
|
65
|
+
// the report card (budgets, J303); a metric is shard-format's name for it
|
|
66
|
+
{ id: 'budget-unmeasured', anchor: 'budget-unmeasured', steps: ['report'], match: /measurement required|missing execution samples|^invalid measured/u,
|
|
67
|
+
fix: 'Run the shard long enough to measure: `wildshard check` measures it headlessly; native gameplay needs a browser proof.' },
|
|
68
|
+
{ id: 'budget-download', anchor: 'budget-download', steps: ['report'], match: /download (?:budget )?bytes/u,
|
|
69
|
+
fix: 'Shrink or drop assets on the named download tier, or move them to a later tier.' },
|
|
70
|
+
{ id: 'budget-draws', anchor: 'budget-draws', steps: ['report'], match: /\bdraws\b/u,
|
|
71
|
+
fix: 'Merge meshes that share a material, or cut objects from the named view.' },
|
|
72
|
+
{ id: 'budget-triangles', anchor: 'budget-triangles', steps: ['report'], match: /\btriangles\b/u,
|
|
73
|
+
fix: 'Lower the mesh detail (LODs, fewer props) in the named view.' },
|
|
74
|
+
{ id: 'budget-memory', anchor: 'budget-memory', steps: ['report'], match: /resident target|loading total bytes|playing total bytes/u,
|
|
75
|
+
fix: 'Cut texture size or count and mesh bytes until the named total fits.' },
|
|
76
|
+
{ id: 'budget-script-cpu', anchor: 'budget-script-cpu', steps: ['report'], match: /^script CPU/u,
|
|
77
|
+
fix: 'Do less work per tick in behaviour scripts: spread it over ticks or run it on events.' },
|
|
78
|
+
{ id: 'budget-script-fuel', anchor: 'budget-script-fuel', steps: ['report'], match: /^script fuel/u,
|
|
79
|
+
fix: 'Shorten the hottest behaviour script loops; fuel counts instructions per tick.' },
|
|
80
|
+
{ id: 'budget-over', anchor: 'budget-over', steps: ['report'],
|
|
81
|
+
fix: 'Run `wildshard check`: its report step names each budget over its limit and the row here for each.' },
|
|
82
|
+
{ id: 'budget-refused', anchor: 'budget-refused', steps: ['build', 'validate'], match: /Performance report refused/u,
|
|
83
|
+
fix: 'Run `wildshard check`: its report step names each budget over its limit and the row here for each.' },
|
|
84
|
+
// the shard file build writes (SA3; `pack` is its deprecated alias) and upload, before a byte is sent. `shardfile-draft` is
|
|
85
|
+
// a warning from build and check and a refusal from upload (draft.ts).
|
|
86
|
+
{ id: 'hero-stale', anchor: 'hero-stale', steps: ['shardfile', 'pack', 'upload'], match: /the hero (?:of .* is older than its content|of .* has no .* stamp)|the hero files of .* are not the ones stamped/u,
|
|
87
|
+
fix: 'Capture the hero again from a served build: `wildshard hero src/shards/<name> --base <url>`.' },
|
|
88
|
+
{ id: 'hero-not-in-product', anchor: 'hero-not-in-product', steps: ['shardfile', 'pack', 'upload'], match: /does not carry the captured hero/u,
|
|
89
|
+
fix: 'Build again after the hero capture: `wildshard build` writes a shard file that carries it.' },
|
|
90
|
+
{ id: 'hero-unchanged', anchor: 'hero-unchanged', steps: ['upload'], match: /the hero is unchanged since/u,
|
|
91
|
+
fix: 'Capture a new hero (`wildshard hero`), then build and upload again.' },
|
|
92
|
+
{ id: 'audio-refused', anchor: 'audio-refused', steps: ['pack', 'upload'], match: /^Audio rules \(AU5\) refuse/u,
|
|
93
|
+
fix: 'Fix each red audio finding listed, or waive it in the shard\'s audio-waiver.json.' },
|
|
94
|
+
{ id: 'shardfile-draft', anchor: 'shardfile-draft', steps: ['shardfile', 'upload'], match: /is an unprepared draft \(sdk 0\.2\)/u,
|
|
95
|
+
fix: 'Run `wildshard prepare <folder> --base <url>`, then `wildshard build <folder>`; a shard repo\'s `pack:shards` does both (WILDSHARD_PREPARATION_URL).' },
|
|
96
|
+
{ id: 'shardfile-link', anchor: 'shardfile-link', steps: ['shardfile', 'pack'], match: /not a regular file|link is refused/u,
|
|
97
|
+
fix: 'Replace links in the shard file folder with real files, then build again.' },
|
|
98
|
+
{ id: 'shardfile-folder-missing', anchor: 'shardfile-folder-missing', steps: ['shardfile', 'pack'], match: /(?:build|pack) needs a shard file folder|ENOENT/u,
|
|
99
|
+
fix: 'Build the shard source: `wildshard build <source>` writes public/shardfiles/<slug>.shardfile.' },
|
|
100
|
+
{ id: 'shardfile-invalid', anchor: 'shardfile-invalid', steps: ['shardfile', 'pack', 'upload'], match: /^no \S+ in the shard ?file|is larger than \d+ bytes|Invalid [a-z]+: /u,
|
|
101
|
+
fix: 'Upload the shard file `wildshard build` wrote, unedited: the format checks refuse this one.' },
|
|
102
|
+
{ id: 'shardfile-refused', anchor: 'shardfile-refused', steps: ['shardfile', 'pack'],
|
|
103
|
+
fix: 'Build the shard source again with `wildshard build`: it writes and checks the shard file.' },
|
|
104
|
+
{ id: 'upload-shardfile-missing', anchor: 'upload-shardfile-missing', steps: ['upload'], match: /upload needs a shard ?file|ENOENT/u,
|
|
105
|
+
fix: 'Pass the shard file `wildshard build` wrote: `wildshard upload public/shardfiles/<slug>.shardfile --channel staging`.' },
|
|
106
|
+
{ id: 'upload-channel', anchor: 'upload-channel', steps: ['upload'], match: /upload needs --channel/u,
|
|
107
|
+
fix: 'Add `--channel staging` (try it there first) or `--channel prod`.' },
|
|
108
|
+
{ id: 'upload-credentials', anchor: 'upload-credentials', steps: ['upload'], match: /upload needs --server/u,
|
|
109
|
+
fix: 'Set WILDSHARD_API_URL (or pass --server) and WILDSHARD_CREATOR_PRIVATE_KEY in your shell.' },
|
|
110
|
+
// the account key (meta SHARD-DELETE DEL6): upload sends it on the ticket and the commit; account and whoami
|
|
111
|
+
{ id: 'account-key-missing', anchor: 'account-key-missing', steps: ['upload', 'account', 'delete'], match: /needs an account key|^no account key/u,
|
|
112
|
+
fix: 'Run `wildshard account <email>` once, or set WILDSHARD_API_KEY to your account key.' },
|
|
113
|
+
{ id: 'account-exists', anchor: 'account-exists', steps: ['account'], match: /already has an account/u,
|
|
114
|
+
fix: 'Use the key you saved for this email; a lost key needs an operator reset by the Wildshard team.' },
|
|
115
|
+
{ id: 'account-key-file', anchor: 'account-key-file', steps: ['account'], match: /already holds a key/u,
|
|
116
|
+
fix: 'Keep the key you have, or pass `--force` to replace the file; the old key keeps working.' },
|
|
117
|
+
{ id: 'account-refused', anchor: 'account-refused', steps: ['account'],
|
|
118
|
+
fix: 'Read the reason: a bad email is 400, and 429 means wait a minute and try again.' },
|
|
119
|
+
// delete (meta SHARD-DELETE DEL10): start, the typed slug, finalize; account-key-missing above covers no key
|
|
120
|
+
{ id: 'delete-not-confirmed', anchor: 'delete-not-confirmed', steps: ['delete'], match: /not confirmed: you typed/u,
|
|
121
|
+
fix: 'Nothing was deleted. Run `wildshard delete <slug>` again and type the slug exactly, or pass `--yes`.' },
|
|
122
|
+
{ id: 'delete-expired', anchor: 'delete-expired', steps: ['delete'], match: /waits for this confirm token/u,
|
|
123
|
+
fix: 'Nothing was deleted: run `wildshard delete <slug>` again and confirm within 10 minutes.' },
|
|
124
|
+
{ id: 'delete-not-owner', anchor: 'delete-not-owner', steps: ['delete'], match: /belongs to another account|only the admin token can delete|(?:start|finalize) answered 401:/u,
|
|
125
|
+
fix: 'Delete with the account key that first uploaded the shard; `wildshard whoami` shows which key you send.' },
|
|
126
|
+
{ id: 'delete-unknown', anchor: 'delete-unknown', steps: ['delete'], match: /(?:start|finalize) answered 40[04]:/u,
|
|
127
|
+
fix: 'Check the slug: the API has no shard by that name (the catalogue lists every live one).' },
|
|
128
|
+
{ id: 'delete-refused', anchor: 'delete-refused', steps: ['delete'],
|
|
129
|
+
fix: 'Read the reason: the API answered with what it wants, or the server is not https.' },
|
|
130
|
+
{ id: 'upload-level', anchor: 'upload-level', steps: ['upload'], match: /^invalid --level/u,
|
|
131
|
+
fix: 'Pass `--level` 0 to 11, or leave it out for the default.' },
|
|
132
|
+
{ id: 'upload-version', anchor: 'upload-version', steps: ['upload'], match: /pass --version X\.Y\.Z|^--version \S+ is not X\.Y\.Z/u,
|
|
133
|
+
fix: 'Set `version` (X.Y.Z) in the shard source\'s package.json, or pass `--version X.Y.Z`.' },
|
|
134
|
+
{ id: 'upload-commit', anchor: 'upload-commit', steps: ['upload'], match: /is not a git checkout|^--commit \S+ is not a full 40-hex sha/u,
|
|
135
|
+
fix: 'Upload from the shard repo\'s git checkout, or pass `--commit <sha>` (40 hex) of the bytes\' commit.' },
|
|
136
|
+
{ id: 'upload-uncommitted', anchor: 'upload-uncommitted', steps: ['upload'], match: /has uncommitted changes/u,
|
|
137
|
+
fix: 'Commit your changes, build again, then upload: the commit names the bytes.' },
|
|
138
|
+
{ id: 'upload-sdk-missing', anchor: 'upload-sdk-missing', steps: ['upload'], match: /is not installed at or above|\(.*package\.json\) is not X\.Y\.Z/u,
|
|
139
|
+
fix: 'Run `pnpm install` in the shard repo.' },
|
|
140
|
+
{ id: 'upload-refused', anchor: 'upload-refused', steps: ['upload'],
|
|
141
|
+
fix: 'Read the reason: a format refusal means build again (`wildshard build`); a server refusal names what it wants.' },
|
|
142
|
+
// lint, besides the rules below
|
|
143
|
+
{ id: 'lint-not-run', anchor: 'lint-not-run', steps: ['lint'], match: /^oxlint (?:did not run|exited|report has no)/u,
|
|
144
|
+
fix: 'Reinstall @wildshard/sdk (`pnpm install`): the author lint ships with it.' },
|
|
145
|
+
{ id: 'lint-refused', anchor: 'lint-refused', steps: ['lint'],
|
|
146
|
+
fix: 'Fix what the message names at the file and line shown.' },
|
|
147
|
+
];
|
|
148
|
+
|
|
149
|
+
/** Wildshard's lint rules an author's source can hit (`.oxlintrc.author.json`), with the fix for each. */
|
|
150
|
+
const LINT_FIXES: Readonly<Record<string, string>> = {
|
|
151
|
+
'wildshard-sdk/generator-imports': 'Import Wildshard code only through @wildshard/sdk\'s exports; copy what another shard has instead of importing it.',
|
|
152
|
+
'wildshard/engine-internal': 'Use the shard-facing SDK export instead of the game-only engine export.',
|
|
153
|
+
'wildshard/engine-sides': 'Keep client, server and shared code apart: import the shared module, not the other side\'s.',
|
|
154
|
+
'wildshard/engine-words': 'Move Wildshard words (shard and game names) out of engine code into content data.',
|
|
155
|
+
'wildshard/exec-max-buffer': 'Pass an explicit `maxBuffer` to the exec call that captures output.',
|
|
156
|
+
'wildshard/layer': 'Import downward through the public index; a shard never imports another shard.',
|
|
157
|
+
'wildshard/no-active-chunk': 'Read current content through the game layer, not the active chunk.',
|
|
158
|
+
'wildshard/no-active-singleton': 'Take the service from your context instead of the active singleton.',
|
|
159
|
+
'wildshard/no-authored-html': 'Set text with `textContent`, never HTML.',
|
|
160
|
+
'wildshard/no-base64': 'Keep binary content binary: ship the bytes as an asset, never base64.',
|
|
161
|
+
'wildshard/no-build-time-import': 'Runtime code must not import build-time code: move the shared part to a runtime module.',
|
|
162
|
+
'wildshard/no-client-plan-reflection': 'Pass data to the client feature; do not reflect into shard TypeScript.',
|
|
163
|
+
'wildshard/no-generated-import': 'Call the authoring function or read the built shard file folder, not a generated file.',
|
|
164
|
+
'wildshard/no-generated-json-import': 'Read generated JSON as data at build time, not with an import.',
|
|
165
|
+
'wildshard/no-global-listener-patch': 'Register listeners through your scope, not on globals.',
|
|
166
|
+
'wildshard/no-hook-chain': 'Subscribe to the typed event instead of chaining hooks.',
|
|
167
|
+
'wildshard/no-inline-ui-string': 'Put player-facing text in the shard\'s string table (data/text.json).',
|
|
168
|
+
'wildshard/no-level-identity': 'Move level and style choices into content data instead of branching on identity.',
|
|
169
|
+
'wildshard/no-module-mock': 'Test through a seam (pass the dependency in) instead of a module mock.',
|
|
170
|
+
'wildshard/no-production-test-import': 'Move what production needs out of the test module.',
|
|
171
|
+
'wildshard/no-raw-animation-mixer': 'Use the engine\'s animation API instead of a raw three.js mixer.',
|
|
172
|
+
'wildshard/no-raw-hud': 'Mount HUD through the numbered HUD slots your scope owns.',
|
|
173
|
+
'wildshard/no-raw-input': 'Read input through the input service, not DOM listeners.',
|
|
174
|
+
'wildshard/no-raw-random-time': 'Use the engine\'s seeded random and clock, not Math.random or Date.',
|
|
175
|
+
'wildshard/no-raw-save': 'Save through the saves service, not localStorage.',
|
|
176
|
+
'wildshard/no-raw-shader-patch': 'Patch shaders through the shader registry.',
|
|
177
|
+
'wildshard/no-reexport': 'Import from the module that defines the name; do not re-export it.',
|
|
178
|
+
'wildshard/no-renderer-type': 'Keep renderer types inside rendering code; pass plain data out.',
|
|
179
|
+
'wildshard/no-runtime-generator': 'Import generators only from shard.config.ts, bakers and other generators.',
|
|
180
|
+
'wildshard/no-runtime-in-build': 'Build code must not import runtime code: share a plain data module instead.',
|
|
181
|
+
'wildshard/no-shard-branch': 'Move the shard-specific choice into the shard\'s data or plugin.',
|
|
182
|
+
'wildshard/no-shard-host-callback': 'Give host APIs data, not TypeScript callbacks.',
|
|
183
|
+
'wildshard/no-shard-runtime': 'Keep the shard to authoring and declarations: gameplay goes in behaviour/ scripts.',
|
|
184
|
+
'wildshard/no-url-switch': 'Drop the URL query switch; read settings from the shard\'s data.',
|
|
185
|
+
'wildshard/public-index': 'Import the package by its public export, not a file path inside it.',
|
|
186
|
+
'wildshard/runtime-commons': 'Runtime code must not import build-time commons; use the runtime export.',
|
|
187
|
+
'wildshard/runtime-performance': 'Bound the work: no per-frame allocation, raw rendering, DOM, timers or fetch.',
|
|
188
|
+
'wildshard/runtime-standalone': 'Runtime code must stand alone: import only the runtime surface.',
|
|
189
|
+
'wildshard/sdk-no-facade': 'Import the SDK\'s own export; do not alias a game or engine binding.',
|
|
190
|
+
'wildshard/shard-engine-imports': 'Import @wildshard/sdk, not engine internals, from shard source.',
|
|
191
|
+
'wildshard/shard-game-imports': 'Import @wildshard/sdk, not the game, from shard source.',
|
|
192
|
+
'wildshard/shard-game-plugins': 'Import only the game plugin exports that define your runtime.',
|
|
193
|
+
'wildshard/shard-names': 'Name no particular shard outside its own folder.',
|
|
194
|
+
'wildshard/shard-sandbox': 'Keep services, globals, settings and assets inside the shard\'s context.',
|
|
195
|
+
'wildshard/shard-services': 'Get engine services from ShardContext.',
|
|
196
|
+
'wildshard/sim-no-render': 'Keep rendering out of code the headless simulation imports.',
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
/** Every wildshard lint rule as a row: id is the config's `plugin/rule`, anchor `lint-<rule>`. */
|
|
200
|
+
export const LINT_RULES: readonly RefusalRule[] = Object.entries(LINT_FIXES).map(([id, fix]) => ({ id, fix, steps: ['lint'], anchor: `lint-${id.slice(id.indexOf('/') + 1)}` }));
|
|
201
|
+
/** Any other lint rule (oxlint's own, by its code): oxlint's help when it gives one. */
|
|
202
|
+
export const LINT_OTHER: RefusalRule = { id: 'lint-other', anchor: 'lint-rules', steps: ['lint'],
|
|
203
|
+
fix: 'Fix what the rule names at the file and line shown; `oxlint --rules` lists it.' };
|
|
204
|
+
|
|
205
|
+
/** Every anchor GUIDE.md must have a heading for (SA13). */
|
|
206
|
+
export const REFUSAL_ANCHORS: readonly string[] = [...REFUSAL_RULES, ...LINT_RULES, LINT_OTHER].map(rule => rule.anchor);
|
|
207
|
+
|
|
208
|
+
const note = (rule: RefusalRule, id = rule.id, fix = rule.fix): RefusalNote => ({ rule: id, fix, guide: `${GUIDE_FILE}#${rule.anchor}` });
|
|
209
|
+
const appliesTo = (rule: RefusalRule, step: RefusalStep): boolean => rule.steps === 'any' || rule.steps.includes(step);
|
|
210
|
+
const LINT_BY_ID = new Map(LINT_RULES.map(rule => [rule.id, rule]));
|
|
211
|
+
|
|
212
|
+
/** oxlint's code (`wildshard(no-raw-save)`) as the config spells the rule (`wildshard/no-raw-save`). */
|
|
213
|
+
export function lintRuleId(code: string): string {
|
|
214
|
+
const match = /^([\w-]+)\(([\w/-]+)\)$/u.exec(code);
|
|
215
|
+
return match === null ? code : `${match[1] ?? ''}/${match[2] ?? ''}`;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** The rule, fix and guide link for a refusal message from `step`. A known lint rule's code wins over the message. */
|
|
219
|
+
export function refusalNote(step: RefusalStep, message: string, lint?: { readonly code: string | null; readonly help: string | null }): RefusalNote {
|
|
220
|
+
if (lint?.code !== undefined && lint.code !== null) {
|
|
221
|
+
const id = lintRuleId(lint.code), known = LINT_BY_ID.get(id);
|
|
222
|
+
const help = lint.help?.split('\n')[0]?.trim() ?? '';
|
|
223
|
+
return known === undefined ? note(LINT_OTHER, id, help === '' ? LINT_OTHER.fix : help) : note(known);
|
|
224
|
+
}
|
|
225
|
+
const rule = REFUSAL_RULES.find(row => appliesTo(row, step) && row.match?.test(message) === true)
|
|
226
|
+
?? REFUSAL_RULES.find(row => appliesTo(row, step) && row.match === undefined);
|
|
227
|
+
if (rule === undefined) throw new Error(`no refusal rule for step ${step}`);
|
|
228
|
+
return note(rule);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/** The line printed under a refusal: `[rule] fix: ... (GUIDE.md#anchor)`. */
|
|
232
|
+
export function refusalHint(refusal: RefusalNote): string {
|
|
233
|
+
return `[${refusal.rule}] fix: ${refusal.fix} (${refusal.guide})`;
|
|
234
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { performanceReport as report, performanceReportLines as lines, performanceTargetIssues as targets, type PerformanceReport as GameReport, type PerformanceObservations as GameObservations } from '@wildshard/format/product';
|
|
2
|
+
import type { Shardfile } from '@wildshard/engine/host/shardfile';
|
|
3
|
+
|
|
4
|
+
/** Author-facing report: declared bounds, measured scripts and explicit cold-network assumptions. */
|
|
5
|
+
export type PerformanceReport = GameReport;
|
|
6
|
+
/** Trusted native tick observations used by the author CLI, separate from declared costs. */
|
|
7
|
+
export type PerformanceObservations = GameObservations;
|
|
8
|
+
/** Evaluate complete performance with refusal by default; author identity never selects legacy warnings. */
|
|
9
|
+
export function performanceReport(source: Shardfile, observed: PerformanceObservations, policy: 'refuse' | 'warn' = 'refuse'): PerformanceReport { return report(source, observed, policy); }
|
|
10
|
+
/** Format every measured or estimated report field without claiming it is a phone reading. */
|
|
11
|
+
export function performanceReportLines(card: PerformanceReport): string[] { return lines(card); }
|
|
12
|
+
/** Check wire and render targets before immutable asset reads or execution. */
|
|
13
|
+
export function performanceTargetIssues(source: Shardfile, policy: 'refuse' | 'warn' = 'refuse'): ReturnType<typeof targets> { return targets(source, policy); }
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/** Dual compile stateless AS numeric rules. The candidate uses
|
|
2
|
+
* ws_project and the defining v2 SDK, while the public v1 artifact is retained.
|
|
3
|
+
* With `groups`, the same programme also serves group steps (ReturnProgram.prepareGroup): the selected project entry
|
|
4
|
+
* exports groupStep() beside onSignal, and a call that lends group state runs it.
|
|
5
|
+
* `binary` is the exact selected module for file producers; `witness` retains the original ABI1 bytes for binary sidecars. */
|
|
6
|
+
import { parseDecisionScripts,scriptV1Identifier } from '@wildshard/format/decisionScripts';
|
|
7
|
+
import { parseReturnProjectionV2,returnProjectionV2Layout,type ReturnProjectionV2Rows } from '@wildshard/format/returnProjectionV2';
|
|
8
|
+
import type { GroupStepRowsV2 } from '@wildshard/format/scriptGroupStepV2';
|
|
9
|
+
import { compileDecisionScripts,captureDecisionSources,type DecisionBuildOptions } from './buildDecisionScripts';
|
|
10
|
+
import type { DecisionRegistries } from './decisionBindingMap';
|
|
11
|
+
import { compileScriptV2 } from './bake/compileScriptV2';
|
|
12
|
+
import { SCRIPT_V2_REVISIONS } from '@wildshard/format/scriptAdmissionV2';
|
|
13
|
+
import { v2CoreSource } from './as/wsV2';
|
|
14
|
+
import { hashImmutableBytes } from './immutable';
|
|
15
|
+
import { decisionBindingsPath } from './decisionScriptBindings';
|
|
16
|
+
|
|
17
|
+
export async function compileReturnProjectionV2(input:unknown,registries:DecisionRegistries,authored:ReadonlyMap<string,string>,options:DecisionBuildOptions & {readonly projectSource?:string;readonly outputCapacity?:number;readonly worldActions?:boolean;readonly additional?:{readonly fields:readonly string[];readonly signals:readonly string[];readonly channels:readonly string[]};readonly capture?:{readonly fields:readonly string[];readonly channels:readonly string[]};readonly groups?:{readonly rows:GroupStepRowsV2;readonly helpers:Readonly<Record<string,string>>}}):Promise<{
|
|
18
|
+
readonly legacy:{readonly script:ReturnType<typeof parseDecisionScripts>[number];readonly bytes:string};readonly candidate:ReturnProjectionV2Rows;readonly binary:Uint8Array;readonly witness:Uint8Array;
|
|
19
|
+
}> {
|
|
20
|
+
const row=parseDecisionScripts([input])[0];
|
|
21
|
+
if(row?.side!=='sim'||row.state.length>0||row.tick!==null||row.timers.length>0||row.on.length!==1||row.on[0]!=='signal'
|
|
22
|
+
||row.reads.some(read=>read!=='field'&&read!=='random'&&read!=='radial')||row.commands.some(command=>command!=='channel')||Object.keys(row.params).length>0)throw new Error('Not a numeric return projection');
|
|
23
|
+
const old=await compileDecisionScripts([row],registries,authored,{...options,singleSignal:true}),script=old.rows[0],blob=old.blobs[0];
|
|
24
|
+
if(script===undefined||blob===undefined)throw new Error('Missing legacy projection');
|
|
25
|
+
// An additive project entry is admitted through the original source budget,
|
|
26
|
+
// handler and captured-import checks; it cannot replace the ABI1 witness.
|
|
27
|
+
const selected=options.projectSource??row.source;
|
|
28
|
+
const captured=await captureDecisionSources(authored,options);
|
|
29
|
+
const additional=options.additional;
|
|
30
|
+
const projectionNames=(kind:'fields'|'signals'|'channels'):string[]=>{
|
|
31
|
+
const base=Object.values(row[kind]).sort(),extra=[...(additional?.[kind]??[])];
|
|
32
|
+
if(extra.some((name,index)=>name<=(base.at(-1)??'')||index>0&&(extra[index-1]??'')>=name)
|
|
33
|
+
||new Set([...Object.keys(row[kind]),...extra].map(scriptV1Identifier)).size!==Object.keys(row[kind]).length+extra.length)throw new Error('Invalid additional projection names');
|
|
34
|
+
return [...base,...extra];
|
|
35
|
+
};
|
|
36
|
+
const fields=projectionNames('fields'),signals=projectionNames('signals'),channels=projectionNames('channels');
|
|
37
|
+
const groups=options.groups,layout=returnProjectionV2Layout(fields.length,row.pages,options.outputCapacity,groups?.rows),path=decisionBindingsPath(row);
|
|
38
|
+
const lines=["import * as core from '../../sdk/as/wsV2';"];
|
|
39
|
+
for(const [kind,namespace,names]of [['fields','Field',fields],['signals','Signal',signals],['channels','Channel',channels]] as const){
|
|
40
|
+
lines.push(`export namespace ${namespace}{`,...[...Object.entries(row[kind]),...(additional?.[kind]??[]).map(name=>[name,name])].map(([alias='',name=''])=>`export const ${scriptV1Identifier(alias)}:i32=${names.indexOf(name)+1};`),'}');
|
|
41
|
+
}
|
|
42
|
+
const capture=options.capture;
|
|
43
|
+
const capturedIds=(kind:'fields'|'channels'):number[]=>{const names=capture?.[kind]??[];if(new Set(names).size!==names.length||names.some(name=>!Object.hasOwn(row[kind],name)))throw new Error('Undeclared projection capture');return names.map(name=>(kind==='fields'?fields:channels).indexOf(row[kind][name]??'')+1);};
|
|
44
|
+
const cf=capturedIds('fields'),co=capturedIds('channels');
|
|
45
|
+
if(capture!==undefined)lines.push(`let capturing:bool=false;const CF:usize=memory.data(${cf.length*16},8),CO:usize=memory.data(${co.length*16},8);`);
|
|
46
|
+
lines.push(`export class Read{
|
|
47
|
+
static field(actor:i32,id:i32):f64{assert(actor>=0&&actor<=8&&id>0&&id<=${fields.length});${capture===undefined?'':`if(actor==0)switch(id){${cf.map((id,i)=>`case ${id}:if(load<u32>(CF+${i*16}))return load<f64>(CF+${i*16+8});break;`).join('')}}`}return core.field(actor*${fields.length}+id-1);}
|
|
48
|
+
static random():f64{return core.random(1);}
|
|
49
|
+
static radial(yaw:f64,radius:f64):i32{assert(radius>=0&&radius<=10000);radialX=core.radialX(yaw,radius);radialZ=core.radialZ(yaw,radius);return 2;}
|
|
50
|
+
${capture===undefined?'':`static captureField(id:i32,value:f64):void{switch(id){${cf.map((id,i)=>`case ${id}:store<f64>(CF+${i*16+8},value);store<u32>(CF+${i*16},1);return;`).join('')}default:unreachable();}}`}
|
|
51
|
+
}
|
|
52
|
+
let radialX:f64=0,radialZ:f64=0;
|
|
53
|
+
export class List{static at(index:i32):f64{assert(index==0||index==1);return index==0?radialX:radialZ;}}
|
|
54
|
+
export class Do{
|
|
55
|
+
static channel(id:i32,value:f64):void{assert(id>0&&id<=${channels.length});${capture===undefined?'':`if(capturing){switch(id){${co.map((id,i)=>`case ${id}:store<f64>(CO+${i*16+8},value);store<u32>(CO+${i*16},1);return;`).join('')}default:unreachable();}}`}core.pageOutput(id,value);}
|
|
56
|
+
${capture===undefined?'':`static capture():void{capturing=true;for(let i:i32=0;i<${cf.length};i++)store<u32>(CF+usize(i)*16,0);for(let i:i32=0;i<${co.length};i++)store<u32>(CO+usize(i)*16,0);}
|
|
57
|
+
static captured(id:i32,fallback:f64):f64{switch(id){${co.map((id,i)=>`case ${id}:return load<u32>(CO+${i*16})?load<f64>(CO+${i*16+8}):fallback;`).join('')}default:unreachable();}return fallback;}
|
|
58
|
+
static release():void{capturing=false;}`}
|
|
59
|
+
${options.worldActions===true?`static ignite(target:i32,x:f64,z:f64):void{core.ignite(target,x,z);}
|
|
60
|
+
static dismount(target:i32,thrown:bool):void{core.dismount(target,thrown);}
|
|
61
|
+
static taming(op:i32,target:i32,a:f64=0,b:f64=0,c:f64=0,d:f64=0,e:f64=0,f:f64=0):void{core.taming(op,target,a,b,c,d,e,f);}`:''}
|
|
62
|
+
}`);
|
|
63
|
+
// The legacy compiler has already checked the entire source budget and the
|
|
64
|
+
// selected entry's captured import closure. Supply only admitted author texts.
|
|
65
|
+
const sources:Record<string,string>={[path]:lines.join('\n'),'sdk/as/wsV2.ts':v2CoreSource(0)};
|
|
66
|
+
if(groups!==undefined)for(const [name,text]of Object.entries(groups.helpers)){
|
|
67
|
+
if(!/^sdk\/as\/group(?:Bank|Step)V2\.[a-z][a-z0-9-]*\.ts$/u.test(name)||Object.hasOwn(sources,name))throw new Error('Invalid group helper source');sources[name]=text;
|
|
68
|
+
}
|
|
69
|
+
// a group program's sources may import its helpers and the v2 core the module already carries
|
|
70
|
+
Object.assign(sources,captured.entry({...row,source:selected},path,groups===undefined?undefined:new Set([...Object.keys(groups.helpers),'sdk/as/wsV2.ts'])));
|
|
71
|
+
const source=`import {onSignal${groups===undefined?'':',groupStep'}} from './${selected.slice(0,-3)}';
|
|
72
|
+
import * as core from './sdk/as/wsV2';
|
|
73
|
+
export function ws_abi():i32{return 2;}
|
|
74
|
+
export function ws_io():i32{return 0;}
|
|
75
|
+
export function ws_init(lo:i32,hi:i32,fuel:i32):i32{return fuel;}
|
|
76
|
+
export function ws_project(fuel:i32):i32{core.beginState();assert(core.beginBinding(0));${groups===undefined?'':'if(core.count(2)>0)groupStep();else '}onSignal(i32(core.parameter(0)),0,0);core.endBinding();return fuel;}`;
|
|
77
|
+
const bytes=await compileScriptV2(source,{maximumPages:row.pages,ioBytes:layout.bytes,lane:'project',sources,...(options.compileMemo===undefined?{}:{compileMemo:options.compileMemo})});
|
|
78
|
+
const candidate=parseReturnProjectionV2({artifact:{abi:2,minor:0,compilerRevision:SCRIPT_V2_REVISIONS.compiler,admissionRevision:SCRIPT_V2_REVISIONS.admission,
|
|
79
|
+
hash:hashImmutableBytes(bytes),lane:'project',pages:row.pages,ioBytes:layout.bytes},fields,signals,channels,...(additional===undefined?{}:{additional}),...(options.outputCapacity===undefined?{}:{outputCapacity:options.outputCapacity}),bytes:btoa(Array.from(bytes,byte=>String.fromCodePoint(byte)).join('')),...(groups===undefined?{}:{groups:groups.rows})});
|
|
80
|
+
return {legacy:{script,bytes:btoa(Array.from(blob.bytes,byte=>String.fromCodePoint(byte)).join(''))},candidate,binary:bytes,witness:blob.bytes};
|
|
81
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { RowsSchema as GameRowsSchema, parseRows as gameParseRows, type ShardRows as GameShardRows } from '@wildshard/format/rows';
|
|
2
|
+
import type { DayClockRow } from '@wildshard/format/dayCycle';
|
|
3
|
+
import type { DayLookRow, DayLookSchema } from '@wildshard/format/dayLook';
|
|
4
|
+
import { isJsonData as gameIsJsonData } from '@wildshard/format/json';
|
|
5
|
+
import { parseItems as gameParseItems, type ShardItems as GameShardItems } from '@wildshard/format/items';
|
|
6
|
+
import { parseClientChannels as gameParseClientChannels, type ClientChannelProgram as GameClientChannelProgram } from '@wildshard/format/clientChannels';
|
|
7
|
+
import { parseEliteFeature as gameParseEliteFeature, type EliteFeatureRows as GameEliteFeatureRows, type ExternalEliteData } from '@wildshard/format/eliteFeature';
|
|
8
|
+
import { parseSpawnScript as gameParseSpawnScript, spawnScriptRegistries as gameSpawnScriptRegistries, type SpawnScriptRows as GameSpawnScriptRows } from '@wildshard/format/spawnScripts';
|
|
9
|
+
import type { DecisionRegistries as GameDecisionRegistries } from '@wildshard/format/decisionBindings';
|
|
10
|
+
import { JournalRowSchema as GameJournalRowSchema, journalRowRules as gameJournalRowRules, type JournalRow as GameJournalRow } from '@wildshard/format/compendiumRows';
|
|
11
|
+
import { parseContractCatalogue as gameParseContractCatalogue, parseContractBoardPage, type ContractCatalogue as GameContractCatalogue } from '@wildshard/format/contracts';
|
|
12
|
+
import { parseAmbientLife as gameParseAmbientLife, type AmbientLifeData as GameAmbientLife } from '@wildshard/format/ambientLife';
|
|
13
|
+
import { parsePageLife as gameParsePageLife, type PageLifeRows as GamePageLifeRows } from '@wildshard/format/pageLife';
|
|
14
|
+
import { PopulationEnvironmentSchema as GamePopulationEnvironmentSchema, type PopulationEnvironmentRows as GamePopulationEnvironment } from '@wildshard/format/populationEnvironment';
|
|
15
|
+
import { FigureCatalogueSchema as GameFigureCatalogueSchema, NpcFigureRowsSchema, type FigureCatalogueRow as GameFigureCatalogue, type FigureAtlasRow } from '@wildshard/format/figures';
|
|
16
|
+
import { RangedPageSchema, ForestWeatherObservationSchema } from '@wildshard/format/rangedPage';
|
|
17
|
+
import { RainPresentationSchema } from '@wildshard/format/rainPresentation';
|
|
18
|
+
import { parseAchievementCounterData } from '@wildshard/format/achievementCounters';
|
|
19
|
+
import { parseQuestStepRows, parseQuestHintRows, parseQuestServiceActions, parseCarriedQuest } from '@wildshard/format/questSteps';
|
|
20
|
+
import { parseQuestPageInteractions } from '@wildshard/format/questInteractions';
|
|
21
|
+
import { parseNativeQuestServiceSpots } from '@wildshard/format/nativeQuestComposition';
|
|
22
|
+
import { parseCoverAppearance } from '@wildshard/format/coverAppearance';
|
|
23
|
+
import { parseWeatherProgram } from '@wildshard/format/weatherProgram';
|
|
24
|
+
import { QuestPageCompositionSchema } from '@wildshard/format/questPageComposition';
|
|
25
|
+
import { CoverCompositionSchema } from '@wildshard/format/streamedCover';
|
|
26
|
+
import { ManifestMetadataSchema } from '@wildshard/format/minimap';
|
|
27
|
+
import * as v from 'valibot';
|
|
28
|
+
import { ItemCatalogue } from '@wildshard/engine/game/loadout/itemCatalogue';
|
|
29
|
+
import { parseExplorerCatalogue } from '@wildshard/format/explorerCatalogue';
|
|
30
|
+
import { QuestTraderSchema } from '@wildshard/format/namedJsonContracts';
|
|
31
|
+
import { parseBarterEconomy } from '@wildshard/format/lootEconomy';
|
|
32
|
+
import type { ExchangeRows } from '@wildshard/format/exchange';
|
|
33
|
+
import { parseGraphArms } from '@wildshard/format/graphArmsRows';
|
|
34
|
+
import { MountedLoadoutSchema } from '@wildshard/format/loadout';
|
|
35
|
+
import { BowVariantSchema } from '@wildshard/format/bowVariantRows';
|
|
36
|
+
import { parseHeldSlots, HeldArmsSchema } from '@wildshard/format/heldArms';
|
|
37
|
+
import { parseCollectionDisplays } from '@wildshard/format/collectionDisplay';
|
|
38
|
+
|
|
39
|
+
/** Admit complete authored collection mounts, ranges and drop geometry before publication. */
|
|
40
|
+
export function collectionDisplayRows(input: unknown): ReturnType<typeof parseCollectionDisplays> { return parseCollectionDisplays(input); }
|
|
41
|
+
|
|
42
|
+
/** Complete authored day clock, including readonly schedules and fixed/preset selections. */
|
|
43
|
+
export type AuthorDayClock = DayClockRow;
|
|
44
|
+
/** Complete merged-atlas metadata; no skin, texture or figure is allocated. */
|
|
45
|
+
export type AuthorFigureAtlas = FigureAtlasRow;
|
|
46
|
+
/** Complete external elite declaration, including the script/herd discriminant. */
|
|
47
|
+
export type AuthorExternalElite = ExternalEliteData;
|
|
48
|
+
/** Native keyed-look grammar and its recursive, readonly value mapping. */
|
|
49
|
+
export type AuthorDayLook<Schema extends DayLookSchema> = DayLookRow<Schema>;
|
|
50
|
+
|
|
51
|
+
/** Admit the complete native mounted arsenal declaration before compiling its slot rows. */
|
|
52
|
+
export function mountedLoadoutRows(input: unknown): v.InferOutput<typeof MountedLoadoutSchema> { return v.parse(MountedLoadoutSchema, input); }
|
|
53
|
+
/** Admit the complete bounded reward-bow tuning, bindings and presentation policy. */
|
|
54
|
+
export function bowVariantRows(input: unknown): v.InferOutput<typeof BowVariantSchema> { return v.parse(BowVariantSchema, input); }
|
|
55
|
+
/** Admit JSON-only held slots with the original registration/equipment/refill/upgrade ownership checks. */
|
|
56
|
+
export function heldSlotsRows(input: unknown): ReturnType<typeof parseHeldSlots> { return parseHeldSlots(input); }
|
|
57
|
+
/** Admit the complete original toon rig, Explorer cards and world claims through their defining grammar. */
|
|
58
|
+
export function toonHeldArmsRows(input: unknown): v.InferOutput<(typeof HeldArmsSchema)['options'][0]> { return v.parse(HeldArmsSchema.options[0], input); }
|
|
59
|
+
|
|
60
|
+
const numberTriple = v.tuple([v.number(), v.number(), v.number()]);
|
|
61
|
+
const numberQuad = v.tuple([v.number(), v.number(), v.number(), v.number()]);
|
|
62
|
+
const numberFive = v.tuple([v.number(), v.number(), v.number(), v.number(), v.number()]);
|
|
63
|
+
const numberArray = v.array(v.number());
|
|
64
|
+
/** Admit native numeric record words; finiteness and geometry bounds remain the enclosing grammar's policy. */
|
|
65
|
+
export function numberArrayRows(input: unknown): number[] { return v.parse(numberArray, input); }
|
|
66
|
+
/** Admit native three/four/five-word author values, preserving signed zero and the tuple's extra-word policy. */
|
|
67
|
+
export function numberTupleRows(input: unknown, width: 3): [number, number, number];
|
|
68
|
+
export function numberTupleRows(input: unknown, width: 4): [number, number, number, number];
|
|
69
|
+
export function numberTupleRows(input: unknown, width: 5): [number, number, number, number, number];
|
|
70
|
+
export function numberTupleRows(input: unknown, width: 3 | 4 | 5): [number, number, number] | [number, number, number, number] | [number, number, number, number, number];
|
|
71
|
+
export function numberTupleRows(input: unknown, width: 3 | 4 | 5): number[] {
|
|
72
|
+
if (width === 3) return v.parse(numberTriple, input);
|
|
73
|
+
if (width === 4) return v.parse(numberQuad, input);
|
|
74
|
+
if (width === 5) return v.parse(numberFive, input);
|
|
75
|
+
throw new Error('Unsupported author numeric tuple width');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Admit ordered model references without installing a species, scene or Explorer owner. */
|
|
79
|
+
export function explorerCatalogueRows(input: unknown): ReturnType<typeof parseExplorerCatalogue> { return parseExplorerCatalogue(input); }
|
|
80
|
+
|
|
81
|
+
/** Admit authored NPC figure motion without creating a figure or loading a skeleton. */
|
|
82
|
+
export function npcFigureRows(input: unknown): v.InferOutput<typeof NpcFigureRowsSchema> { return v.parse(NpcFigureRowsSchema, input); }
|
|
83
|
+
/** Admit complete trader page policy before any shop or inventory owner exists. */
|
|
84
|
+
export function questTraderRows(input: unknown): v.InferOutput<typeof QuestTraderSchema> { return v.parse(QuestTraderSchema, input); }
|
|
85
|
+
/** Admit the native bounded barter grammar and its original cross-row checks. */
|
|
86
|
+
export function barterEconomyRows(input: unknown): ReturnType<typeof parseBarterEconomy> { return parseBarterEconomy(input); }
|
|
87
|
+
/** Complete author exchange tables; no affordability, storage or transaction service is lent. */
|
|
88
|
+
export type AuthorExchangeRows = ExchangeRows;
|
|
89
|
+
/** Admit held graph/rig bindings and native resource checks without constructing a view or material. */
|
|
90
|
+
export function graphArmsRows(input: unknown): ReturnType<typeof parseGraphArms> { return parseGraphArms(input); }
|
|
91
|
+
|
|
92
|
+
/** Resolve admitted equipment presentation without lending a catalogue or weapon service. */
|
|
93
|
+
export function equipmentRows(input: unknown, id: string): ReturnType<ItemCatalogue['equipment']> { return new ItemCatalogue(input).equipment(id); }
|
|
94
|
+
|
|
95
|
+
/** Numeric row declarations and registered view/presentation recipes. */
|
|
96
|
+
export type ShardRows = GameShardRows;
|
|
97
|
+
/** Validate row declarations without renderer or runtime code. */
|
|
98
|
+
export const RowsSchema: typeof GameRowsSchema = GameRowsSchema;
|
|
99
|
+
/** Parse author rows before JSON serialization can erase invalid closures. */
|
|
100
|
+
export function parseRows(input: unknown): ShardRows { return gameParseRows(input); }
|
|
101
|
+
/** Independent data-only check for functions, accessors, cycles and lossy JSON values. */
|
|
102
|
+
export function isJsonData(input: unknown): boolean { return gameIsJsonData(input); }
|
|
103
|
+
/** An admitted item catalogue (the `items` section). */
|
|
104
|
+
export type ShardItems = GameShardItems;
|
|
105
|
+
/** Validate an item catalogue before it is serialized (GR8: a shard program calls this instead of a bake script). */
|
|
106
|
+
export function parseItems(input: unknown): ShardItems { return gameParseItems(input); }
|
|
107
|
+
/** One admitted client channel program. */
|
|
108
|
+
export type ClientChannelProgram = GameClientChannelProgram;
|
|
109
|
+
/** Validate client channel programs before they are serialized. */
|
|
110
|
+
export function parseClientChannels(input: unknown): ClientChannelProgram[] { return gameParseClientChannels(input); }
|
|
111
|
+
/** One admitted elite encounter feature (its fights and their spawn programs). */
|
|
112
|
+
export type EliteFeature = GameEliteFeatureRows;
|
|
113
|
+
/** Validate an elite feature before it is serialized or its fights compiled. */
|
|
114
|
+
export function parseEliteFeature(input: unknown): EliteFeature { return gameParseEliteFeature(input); }
|
|
115
|
+
/** The registry ids a spawn program's generated ABI header uses (GR8: a shard program compiles its guests with them). */
|
|
116
|
+
export function spawnRegistries(program: Parameters<typeof gameSpawnScriptRegistries>[0]): DecisionRegistries { return gameSpawnScriptRegistries(program); }
|
|
117
|
+
/** A spawn script's admitted rows (its ABI-1 script, slots, sites, strikes and moves), as the decision compiler reads them. */
|
|
118
|
+
export type SpawnScript = GameSpawnScriptRows;
|
|
119
|
+
/** Admit an authored spawn script; the decision compiler builds its module from these rows (spawnRegistries). */
|
|
120
|
+
export function parseSpawnScript(input: unknown): SpawnScript { return gameParseSpawnScript(input); }
|
|
121
|
+
/** A decision script's registry ids by kind. */
|
|
122
|
+
export type DecisionRegistries = GameDecisionRegistries;
|
|
123
|
+
/** One admitted compendium journal row. */
|
|
124
|
+
export type JournalRow = GameJournalRow;
|
|
125
|
+
/** Validate a journal row and its cross references before it is serialized (GR8: a shard program calls this). */
|
|
126
|
+
export function parseJournalRow(input: unknown): JournalRow {
|
|
127
|
+
const row = v.parse(GameJournalRowSchema, input), errors = gameJournalRowRules(row);
|
|
128
|
+
if (errors.length > 0) throw new Error(errors.join(', '));
|
|
129
|
+
return row;
|
|
130
|
+
}
|
|
131
|
+
/** One admitted contract catalogue (the board's rows and its programme row). */
|
|
132
|
+
export type ContractCatalogue = GameContractCatalogue;
|
|
133
|
+
/** Validate a contract catalogue before it is serialized (GR8: a shard program calls this instead of a bake script). */
|
|
134
|
+
export function parseContractCatalogue(input: unknown): ContractCatalogue { return gameParseContractCatalogue(input); }
|
|
135
|
+
/** Admit board catalogue, panel and store ownership through every defining cross-row check. */
|
|
136
|
+
export function contractBoardPageRows(input: unknown): ReturnType<typeof parseContractBoardPage> { return parseContractBoardPage(input); }
|
|
137
|
+
/** One admitted forest community (a shard's ambient life policy). */
|
|
138
|
+
export type AmbientLife = GameAmbientLife;
|
|
139
|
+
/** Validate an ambient life policy before its page rows are built. */
|
|
140
|
+
export function parseAmbientLife(input: unknown): AmbientLife { return gameParseAmbientLife(input); }
|
|
141
|
+
/** One page's admitted life rows (flocks, foragers, carcasses, guide, harvest). */
|
|
142
|
+
export type PageLifeRows = GamePageLifeRows;
|
|
143
|
+
/** Validate a page's life rows before they are serialized (GR8: a shard program calls this). */
|
|
144
|
+
export function parsePageLife(input: unknown): PageLifeRows { return gameParsePageLife(input); }
|
|
145
|
+
/** One admitted population environment (the habitat a roster's herds read). */
|
|
146
|
+
export type PopulationEnvironment = GamePopulationEnvironment;
|
|
147
|
+
/** Validate a population environment before it is serialized (GR8: a shard program calls this). */
|
|
148
|
+
export function parsePopulationEnvironment(input: unknown): PopulationEnvironment { return v.parse(GamePopulationEnvironmentSchema, input); }
|
|
149
|
+
/** One admitted figure catalogue (people's figures, anchors, skins and cards). */
|
|
150
|
+
export type FigureCatalogue = GameFigureCatalogue;
|
|
151
|
+
/** Validate a figure catalogue before it is serialized (GR8: a shard program calls this). */
|
|
152
|
+
export function parseFigureCatalogue(input: unknown): FigureCatalogue { return v.parse(GameFigureCatalogueSchema, input); }
|
|
153
|
+
|
|
154
|
+
/** Admit data-only equipment, collection and ambience page composition. */
|
|
155
|
+
export function parseRangedPage(input: unknown): v.InferOutput<typeof RangedPageSchema> { return v.parse(RangedPageSchema, input); }
|
|
156
|
+
|
|
157
|
+
/** Admit a declared page/audio/guide observation binding without installing a service. */
|
|
158
|
+
export function parseForestWeatherObservation(input: unknown): v.InferOutput<typeof ForestWeatherObservationSchema> { return v.parse(ForestWeatherObservationSchema, input); }
|
|
159
|
+
|
|
160
|
+
/** Admit bounded rain presentation, ordered roof polygons and native bake rows. */
|
|
161
|
+
export function parseRainPresentation(input: unknown): v.InferOutput<typeof RainPresentationSchema> { return v.parse(RainPresentationSchema, input); }
|
|
162
|
+
|
|
163
|
+
/** Admit bounded achievement policy without borrowing progress or storage. */
|
|
164
|
+
export function achievementCounterRows(input: unknown): ReturnType<typeof parseAchievementCounterData> { return parseAchievementCounterData(input); }
|
|
165
|
+
/** Admit portable ordered quest steps with their defining cross-row checks. */
|
|
166
|
+
export function questStepRows(input: unknown): ReturnType<typeof parseQuestStepRows> { return parseQuestStepRows(input); }
|
|
167
|
+
/** Admit bounded control hints and their existing observation grammar. */
|
|
168
|
+
export function questHintRows(input: unknown): ReturnType<typeof parseQuestHintRows> { return parseQuestHintRows(input); }
|
|
169
|
+
/** Admit quest service actions without installing page services. */
|
|
170
|
+
export function questServiceRows(input: unknown): ReturnType<typeof parseQuestServiceActions> { return parseQuestServiceActions(input); }
|
|
171
|
+
/** Admit borrowed page interaction identities and their original restore rules. */
|
|
172
|
+
export function questPageInteractionRows(input: unknown): ReturnType<typeof parseQuestPageInteractions> { return parseQuestPageInteractions(input); }
|
|
173
|
+
/** Admit native quest service spots through their defining composition grammar. */
|
|
174
|
+
export function nativeQuestServiceSpotRows(input: unknown): ReturnType<typeof parseNativeQuestServiceSpots> { return parseNativeQuestServiceSpots(input); }
|
|
175
|
+
/** Admit cover appearance rows without constructing a material. */
|
|
176
|
+
export function coverAppearanceRows(input: unknown): ReturnType<typeof parseCoverAppearance> { return parseCoverAppearance(input); }
|
|
177
|
+
/** Admit a weather program's detached rows without starting weather. */
|
|
178
|
+
export function weatherProgramRows(input: unknown): ReturnType<typeof parseWeatherProgram> { return parseWeatherProgram(input); }
|
|
179
|
+
/** Admit complete quest composition data, including caller-owned entry resources. */
|
|
180
|
+
export function questPageCompositionRows(input: unknown): v.InferOutput<typeof QuestPageCompositionSchema> { return v.parse(QuestPageCompositionSchema, input); }
|
|
181
|
+
/** Admit cover ownership references without constructing ground or geometry. */
|
|
182
|
+
export function coverCompositionRows(input: unknown): v.InferOutput<typeof CoverCompositionSchema> { return v.parse(CoverCompositionSchema, input); }
|
|
183
|
+
|
|
184
|
+
/** Admit a complete carried-quest continuation with native state/event ownership checks. */
|
|
185
|
+
export function carriedQuestRows(input: unknown): ReturnType<typeof parseCarriedQuest> { return parseCarriedQuest(input); }
|
|
186
|
+
|
|
187
|
+
/** Admit only explicitly selected native manifest fields, retaining their full
|
|
188
|
+
* defaults, nested grammars and issue paths without lending unrelated metadata. */
|
|
189
|
+
export function manifestFieldRows<const Keys extends v.ObjectKeys<typeof ManifestMetadataSchema>>(keys: Keys, input: unknown):
|
|
190
|
+
v.InferOutput<ReturnType<typeof v.pick<typeof ManifestMetadataSchema, Keys>>> {
|
|
191
|
+
return v.parse(v.pick(ManifestMetadataSchema, keys), input);
|
|
192
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Author-side closed-runtime import validation, shared by output validation. */
|
|
2
|
+
// oxlint-disable-next-line import/no-nodejs-modules -- Resolve installed public exports without executing packages.
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
// oxlint-disable-next-line import/no-nodejs-modules -- Resolve runtime-local imports inside the copied output.
|
|
5
|
+
import { dirname, resolve, sep } from 'node:path';
|
|
6
|
+
// oxlint-disable-next-line import/no-nodejs-modules -- Confirm a relative import names an inventoried TypeScript file.
|
|
7
|
+
import { existsSync } from 'node:fs';
|
|
8
|
+
import { parseSync } from 'vite';
|
|
9
|
+
|
|
10
|
+
const resolver = createRequire(resolve(import.meta.dirname,'package.json'));
|
|
11
|
+
/** Exact package families: public engine/game/SDK/format exports, three's
|
|
12
|
+
* exported JavaScript modules, and valibot's root. Never Node or commons. */
|
|
13
|
+
export function runtimePackageAllowed(specifier: string): boolean {
|
|
14
|
+
if (/[?#]/u.test(specifier) || !/^(?:@wildshard\/(?:engine|game|sdk|sharddev|format)\/[^.][a-zA-Z0-9_./-]*|three(?:\/[^.][a-zA-Z0-9_./-]*)?|valibot)$/u.test(specifier)) return false;
|
|
15
|
+
try { return /\.[cm]?[jt]s$/u.test(resolver.resolve(specifier)); } catch { return false; }
|
|
16
|
+
}
|
|
17
|
+
function object(input: unknown): Record<string,unknown>|null { return typeof input==='object'&&input!==null&&!Array.isArray(input)?input as Record<string,unknown>:null; }
|
|
18
|
+
function literal(input:unknown):string|null { const node=object(input);if(node?.['type']==='Literal'&&typeof node['value']==='string')return node['value'];const expressions=node?.['expressions'],quasis=node?.['quasis'];if(node?.['type']==='TemplateLiteral'&&Array.isArray(expressions)&&expressions.length===0&&Array.isArray(quasis)){const value=object(object(quasis[0])?.['value'])?.['cooked'];if(typeof value==='string')return value;}return null; }
|
|
19
|
+
/** Refuse unresolved, computed, asset and escaping imports on the actual copy.
|
|
20
|
+
* This check executes no runtime module and grants no private-binary credit. */
|
|
21
|
+
export function validateRuntimeImports(directory:string,path:string,source:string):void {
|
|
22
|
+
const parsed=parseSync(path,source);if(parsed.errors.length>0)throw new Error('Invalid runtime TypeScript');
|
|
23
|
+
const root=resolve(directory,'runtime');
|
|
24
|
+
const check=(input:unknown,glob=false):void=>{const specifier=literal(input);if(specifier===null)throw new Error('Runtime import must be a literal');if(glob&&specifier.startsWith('!'))return;
|
|
25
|
+
if(specifier.startsWith('.')){const target=resolve(directory,dirname(path),specifier);if(!target.startsWith(`${root}${sep}`)||/[?#]/u.test(specifier)||/\.[^/]+$/u.test(specifier)&&!specifier.endsWith('.ts'))throw new Error('Runtime import escapes its TypeScript copy');
|
|
26
|
+
if(!glob&&![target,`${target}.ts`,resolve(target,'index.ts')].some(file=>file.endsWith('.ts')&&existsSync(file)))throw new Error('Runtime import has no copied TypeScript target');
|
|
27
|
+
}else if(!runtimePackageAllowed(specifier))throw new Error(`Runtime package is not a public runtime export: ${specifier}`);
|
|
28
|
+
};
|
|
29
|
+
const walk=(input:unknown):void=>{if(Array.isArray(input)){for(const child of input)walk(child);return;}const node=object(input);if(node===null)return;
|
|
30
|
+
const type=node['type'];if(type==='ImportDeclaration'||type==='ImportExpression'||type==='TSImportType')check(node['source']);
|
|
31
|
+
if((type==='ExportNamedDeclaration'||type==='ExportAllDeclaration')&&node['source']!==null&&node['source']!==undefined)check(node['source']);
|
|
32
|
+
if(type==='TSExternalModuleReference')check(node['expression']);
|
|
33
|
+
if(type==='CallExpression'){const callee=object(node['callee']);if(callee?.['type']==='Identifier'&&callee['name']==='require'){const args=node['arguments'];check(Array.isArray(args)?args[0]:undefined);}
|
|
34
|
+
if(callee?.['type']==='MemberExpression'){const property=object(callee['property']);if(property?.['name']==='glob'||property?.['name']==='globEager'){const args=node['arguments'];if(!Array.isArray(args))throw new Error('Missing runtime glob');const array=object(args[0]);const patterns=array?.['type']==='ArrayExpression'?array['elements']:[args[0]];if(!Array.isArray(patterns))throw new Error('Invalid runtime glob');for(const pattern of patterns)check(pattern,true);const properties=object(args[1])?.['properties'];if(Array.isArray(properties)&&properties.some(value=>{const key=object(object(value)?.['key']);return key?.['name']==='query'||key?.['name']==='as';}))throw new Error('Runtime globs cannot import assets');}}}
|
|
35
|
+
if(type==='NewExpression'&&object(node['callee'])?.['name']==='URL'){const args=node['arguments'];if(Array.isArray(args)&&object(object(args[1])?.['object'])?.['type']==='MetaProperty')check(args[0]);}
|
|
36
|
+
for(const [key,child]of Object.entries(node))if(key!=='comments'&&key!=='parent')walk(child);
|
|
37
|
+
};walk(parsed.program);
|
|
38
|
+
}
|