@wildshard/sdk 0.0.1 → 0.2.4
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 +895 -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 +47 -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 +39 -0
- package/src/cli/bin.mjs +8 -0
- package/src/cli/delete/delete.ts +258 -0
- package/src/cli/help.ts +204 -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 +291 -0
- package/src/cli/report.ts +20 -0
- package/src/cli/shardfile/command.ts +49 -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/agentFiles.ts +127 -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 +118 -0
- package/src/sharddev/checkProject.ts +127 -0
- package/src/sharddev/cli.ts +200 -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 +226 -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 +29 -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 +304 -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,147 @@
|
|
|
1
|
+
import { installFormatHook } from '@wildshard/format/formatHook'
|
|
2
|
+
import {
|
|
3
|
+
array,
|
|
4
|
+
intersect,
|
|
5
|
+
literal,
|
|
6
|
+
nullable,
|
|
7
|
+
number,
|
|
8
|
+
object,
|
|
9
|
+
optional,
|
|
10
|
+
string,
|
|
11
|
+
tuple,
|
|
12
|
+
unknown,
|
|
13
|
+
variant,
|
|
14
|
+
} from 'valibot'
|
|
15
|
+
|
|
16
|
+
import type { UploadResult } from '@wildshard/format/uploadWire'
|
|
17
|
+
import type { GenericSchema } from 'valibot'
|
|
18
|
+
|
|
19
|
+
// The replies `sharddev upload` reads from api-server (J61, J96), from
|
|
20
|
+
// format, which both depend on (J27). A wire change reaches both through a
|
|
21
|
+
// tag, and the upload fails on the parse rather than guess. Format ships raw
|
|
22
|
+
// .ts, so it loads here, behind the hook, and not by a static import.
|
|
23
|
+
|
|
24
|
+
installFormatHook()
|
|
25
|
+
|
|
26
|
+
const wire = await import('@wildshard/format/uploadWire')
|
|
27
|
+
|
|
28
|
+
const {
|
|
29
|
+
ErrorBodySchema,
|
|
30
|
+
ShardfileListSchema,
|
|
31
|
+
UploadResultSchema,
|
|
32
|
+
DirectUploadTicketSchema,
|
|
33
|
+
} = wire
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* SA30's `placement` (meta SHARD-AUTHORING, J314): the cell a new shard
|
|
37
|
+
* got and the channels whose grid now has it, or why it got none. Absent
|
|
38
|
+
* while api-server's `GRID_AUTOPLACE` is off, and for a shard not new.
|
|
39
|
+
*/
|
|
40
|
+
type Placement =
|
|
41
|
+
| Readonly<{
|
|
42
|
+
placed: true
|
|
43
|
+
cell: readonly [number, number]
|
|
44
|
+
channels: readonly string[]
|
|
45
|
+
}>
|
|
46
|
+
| Readonly<{ placed: false; reason: string }>
|
|
47
|
+
|
|
48
|
+
const CellSchema = tuple([number(), number()])
|
|
49
|
+
|
|
50
|
+
const PlacedSchema = object({
|
|
51
|
+
placed: literal(true),
|
|
52
|
+
cell: CellSchema,
|
|
53
|
+
channels: array(string()),
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const NotPlacedSchema = object({ placed: literal(false), reason: string() })
|
|
57
|
+
|
|
58
|
+
const PlacementSchema: GenericSchema<Placement> = variant('placed', [
|
|
59
|
+
PlacedSchema,
|
|
60
|
+
NotPlacedSchema,
|
|
61
|
+
])
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The J275 commit's answer (API-CLOUDFLARE AC6, AC16): format's
|
|
65
|
+
* `UploadResult` plus the shard version, the API's format version and the
|
|
66
|
+
* migrations that ran. Format's wire predates them, so sharddev reads the
|
|
67
|
+
* three itself until a format tag carries them.
|
|
68
|
+
*/
|
|
69
|
+
interface CommitAnswer extends UploadResult {
|
|
70
|
+
readonly version: string
|
|
71
|
+
readonly formatVersion: string
|
|
72
|
+
readonly migrations: readonly unknown[]
|
|
73
|
+
/** UP2's echo of the channel and the versions; absent before it. */
|
|
74
|
+
readonly channel?: string | null | undefined
|
|
75
|
+
readonly engine?: string | null | undefined
|
|
76
|
+
readonly sharddev?: string | null | undefined
|
|
77
|
+
readonly shardFormat?: string | null | undefined
|
|
78
|
+
/**
|
|
79
|
+
* SA30's grid step, read by placement.ts against `PlacementSchema`: the
|
|
80
|
+
* commit is recorded by now, so a shape the CLI can't read never fails
|
|
81
|
+
* the upload. Absent while placement is off.
|
|
82
|
+
*/
|
|
83
|
+
readonly placement?: unknown
|
|
84
|
+
/** DEL7: true when the commit brought a deleted shard back (preview only). */
|
|
85
|
+
readonly revived?: unknown
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const MigrationsSchema = array(unknown())
|
|
89
|
+
|
|
90
|
+
/** A string the API may leave out, or send as null. */
|
|
91
|
+
const EchoSchema = optional(nullable(string()))
|
|
92
|
+
|
|
93
|
+
const CommitFieldsSchema = object({
|
|
94
|
+
version: string(),
|
|
95
|
+
formatVersion: string(),
|
|
96
|
+
migrations: MigrationsSchema,
|
|
97
|
+
channel: EchoSchema,
|
|
98
|
+
engine: EchoSchema,
|
|
99
|
+
sharddev: EchoSchema,
|
|
100
|
+
shardFormat: EchoSchema,
|
|
101
|
+
placement: optional(unknown()),
|
|
102
|
+
revived: optional(unknown()),
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
const CommitAnswerSchema: GenericSchema<CommitAnswer> = intersect([
|
|
106
|
+
UploadResultSchema,
|
|
107
|
+
CommitFieldsSchema,
|
|
108
|
+
])
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* `GET /api/catalogue`, as far as the hero pre-check reads it: each slug's
|
|
112
|
+
* newest version and, once UP4 is live, its hero digest.
|
|
113
|
+
*/
|
|
114
|
+
interface CatalogueShard {
|
|
115
|
+
readonly slug: string
|
|
116
|
+
readonly version?: string | null | undefined
|
|
117
|
+
readonly heroHash?: string | null | undefined
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const CatalogueShardSchema = object({
|
|
121
|
+
slug: string(),
|
|
122
|
+
version: EchoSchema,
|
|
123
|
+
heroHash: EchoSchema,
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const CatalogueSchema: GenericSchema<{
|
|
127
|
+
readonly shards: readonly CatalogueShard[]
|
|
128
|
+
}> = object({ shards: array(CatalogueShardSchema) })
|
|
129
|
+
|
|
130
|
+
export {
|
|
131
|
+
type CatalogueShard,
|
|
132
|
+
type CommitAnswer,
|
|
133
|
+
type Placement,
|
|
134
|
+
CatalogueSchema,
|
|
135
|
+
PlacementSchema,
|
|
136
|
+
CommitAnswerSchema,
|
|
137
|
+
DirectUploadTicketSchema,
|
|
138
|
+
ErrorBodySchema,
|
|
139
|
+
ShardfileListSchema,
|
|
140
|
+
UploadResultSchema,
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export type {
|
|
144
|
+
DirectUploadTicket,
|
|
145
|
+
ShardfileSummary,
|
|
146
|
+
UploadResult,
|
|
147
|
+
} from '@wildshard/format/uploadWire'
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { access, readFile } from 'node:fs/promises'
|
|
2
|
+
import { createRequire } from 'node:module'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
import { fileURLToPath } from 'node:url'
|
|
5
|
+
|
|
6
|
+
import { object, parse, string } from 'valibot'
|
|
7
|
+
|
|
8
|
+
const PackageJsonSchema = object({ version: string() })
|
|
9
|
+
|
|
10
|
+
// The package root is the repo root: package.json beside src/.
|
|
11
|
+
const PACKAGE_JSON = fileURLToPath(
|
|
12
|
+
new URL('../../package.json', import.meta.url),
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
/** The packages `--version` names, in the order they build on each other (SA4). */
|
|
16
|
+
const CHAIN = ['@wildshard/engine', '@wildshard/format', 'three'] as const
|
|
17
|
+
|
|
18
|
+
async function versionAt(file: string): Promise<string> {
|
|
19
|
+
const raw: unknown = JSON.parse(await readFile(file, 'utf8'))
|
|
20
|
+
return parse(PackageJsonSchema, raw).version
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async function readVersion(): Promise<string> {
|
|
24
|
+
return await versionAt(PACKAGE_JSON)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async function exists(file: string): Promise<boolean> {
|
|
28
|
+
try {
|
|
29
|
+
await access(file)
|
|
30
|
+
return true
|
|
31
|
+
} catch {
|
|
32
|
+
return false
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Not every package exports ./package.json: walk node's own lookup dirs. */
|
|
37
|
+
async function manifestOf(name: string): Promise<string> {
|
|
38
|
+
const dirs = createRequire(PACKAGE_JSON).resolve.paths(name) ?? []
|
|
39
|
+
for (const dir of dirs) {
|
|
40
|
+
const file = path.join(dir, name, 'package.json')
|
|
41
|
+
// oxlint-disable-next-line no-await-in-loop -- the first hit wins, in order
|
|
42
|
+
if (await exists(file)) {
|
|
43
|
+
return file
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
throw new Error(`cannot find ${name}`)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The sdk, engine, shard-format and `three` chain this installed sdk
|
|
51
|
+
* resolves, one `<name> <version>` line each (meta SHARD-AUTHORING SA4).
|
|
52
|
+
*/
|
|
53
|
+
async function readVersionChain(): Promise<string[]> {
|
|
54
|
+
const rows = await Promise.all(
|
|
55
|
+
CHAIN.map(
|
|
56
|
+
async (name: string): Promise<string> =>
|
|
57
|
+
`${name} ${await versionAt(await manifestOf(name))}`,
|
|
58
|
+
),
|
|
59
|
+
)
|
|
60
|
+
return [`@wildshard/sdk ${await readVersion()}`, ...rows]
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { readVersion, readVersionChain }
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// Platform-stable transcendental Math for bit-exact oracles (E435, ci-green).
|
|
2
|
+
//
|
|
3
|
+
// V8 computes Math.sin / cos / tan / exp / atan2 / asin / pow / log… in C++ (fdlibm and glibc ports), and the compiled
|
|
4
|
+
// code rounds differently on arm64 (fused multiply-add) than on x64: the same Node version returns results that differ
|
|
5
|
+
// in the last bit on an Apple-silicon Mac and on the Linux x64 CI runner (measured over 2M inputs: every one of those
|
|
6
|
+
// functions differs; + - * / sqrt hypot floor never do, since IEEE 754 fixes them per operation). A digest over a
|
|
7
|
+
// long simulation amplifies one such bit into a different branch (the hunt oracle's hunter / crossbow charged 2590
|
|
8
|
+
// ticks on x64 vs 2708 on arm64), so an oracle that pins exact bits must not call the native ones.
|
|
9
|
+
//
|
|
10
|
+
// `installPortableMath()` / `withPortableMath(fn)` swap these in: pure JS over + - * / and sqrt only, so every
|
|
11
|
+
// platform computes the same bits. They are accurate to a few ulp (Cody–Waite reduction, fdlibm's kernel polynomials,
|
|
12
|
+
// Taylor series on reduced arguments): close enough that the game decides the same way, exact enough to digest.
|
|
13
|
+
// Special values (NaN, ±Infinity, ±0, out-of-domain) defer to the native function, whose results there are exact.
|
|
14
|
+
|
|
15
|
+
// captured before any install, so a special value can defer to the native function
|
|
16
|
+
const nativeSin = Math.sin, nativeCos = Math.cos, nativeTan = Math.tan, nativeExp = Math.exp, nativeLog = Math.log;
|
|
17
|
+
const nativeAtan = Math.atan, nativeAtan2 = Math.atan2, nativeAsin = Math.asin, nativeAcos = Math.acos, nativePow = Math.pow;
|
|
18
|
+
|
|
19
|
+
const PIO2_1 = 1.57079632673412561417e+00, PIO2_1T = 6.07710050650619224932e-11;
|
|
20
|
+
const PIO2_2 = 6.07710050630396597660e-11, PIO2_2T = 2.02226624879595063154e-21;
|
|
21
|
+
const INV_PIO2 = 6.36619772367581382433e-01;
|
|
22
|
+
const LN2_HI = 6.93147180369123816490e-01, LN2_LO = 1.90821492927058770002e-10, INV_LN2 = 1.44269504088896338700e+00;
|
|
23
|
+
const PI = 3.14159265358979311600e+00, PI_LO = 1.2246467991473532e-16;
|
|
24
|
+
|
|
25
|
+
const bits = new Float64Array(1), words = new Uint32Array(bits.buffer);
|
|
26
|
+
const f64 = (): number => bits[0] ?? Number.NaN;
|
|
27
|
+
/** 2^k exactly, for k in [-1022, 1023] (built from the exponent bits, no pow) */
|
|
28
|
+
function pow2(k: number): number {
|
|
29
|
+
words[0] = 0; words[1] = ((k + 1023) << 20) >>> 0;
|
|
30
|
+
return f64();
|
|
31
|
+
}
|
|
32
|
+
/** x * 2^k without overflowing the intermediate */
|
|
33
|
+
function scale(x: number, k: number): number {
|
|
34
|
+
let y = x, n = k;
|
|
35
|
+
while (n > 1023) { y *= pow2(1023); n -= 1023; }
|
|
36
|
+
while (n < -1022) { y *= pow2(-1022); n += 1022; }
|
|
37
|
+
return y * pow2(n);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** fdlibm __kernel_sin / __kernel_cos on |r| <= pi/4 (r = hi + lo) */
|
|
41
|
+
function kSin(x: number, y: number): number {
|
|
42
|
+
const z = x * x, v = z * x;
|
|
43
|
+
const r = 8.33333333332248946124e-03 + z * (-1.98412698298579493134e-04 + z * (2.75573137070700676789e-06 + z * (-2.50507602534068634195e-08 + z * 1.58969099521155010221e-10)));
|
|
44
|
+
return x - ((z * (0.5 * y - v * r) - y) - v * -1.66666666666666324348e-01);
|
|
45
|
+
}
|
|
46
|
+
function kCos(x: number, y: number): number {
|
|
47
|
+
const z = x * x;
|
|
48
|
+
const r = z * (4.16666666666666019037e-02 + z * (-1.38888888888741095749e-03 + z * (2.48015872894767294178e-05 + z * (-2.75573143513906633035e-07 + z * (2.08757232129817482790e-09 + z * -1.13596475577881948265e-11)))));
|
|
49
|
+
const hz = 0.5 * z, w = 1 - hz;
|
|
50
|
+
return w + (((1 - w) - hz) + (z * r - x * y));
|
|
51
|
+
}
|
|
52
|
+
/** x = n * pi/2 + (hi + lo): Cody–Waite reduction (fdlibm's first step, and its second for larger n) */
|
|
53
|
+
function reduced(x: number): [number, number, number] {
|
|
54
|
+
const n = Math.round(x * INV_PIO2);
|
|
55
|
+
const r0 = x - n * PIO2_1, w0 = n * PIO2_1T;
|
|
56
|
+
const y0 = r0 - w0;
|
|
57
|
+
if (Math.abs(n) < 32) return [n, y0, (r0 - y0) - w0];
|
|
58
|
+
// a second pass for larger n (fdlibm's 2nd iteration)
|
|
59
|
+
const t = r0, w = n * PIO2_2, r = t - w, w2 = n * PIO2_2T - ((t - r) - w);
|
|
60
|
+
const y = r - w2;
|
|
61
|
+
return [n, y, (r - y) - w2];
|
|
62
|
+
}
|
|
63
|
+
function sin(x: number): number {
|
|
64
|
+
if (!Number.isFinite(x) || x === 0 || Math.abs(x) >= 268435456) return nativeSin(x);
|
|
65
|
+
if (Math.abs(x) <= Math.PI / 4) return kSin(x, 0);
|
|
66
|
+
const [n, hi, lo] = reduced(x);
|
|
67
|
+
switch (((n % 4) + 4) % 4) {
|
|
68
|
+
case 0: return kSin(hi, lo);
|
|
69
|
+
case 1: return kCos(hi, lo);
|
|
70
|
+
case 2: return -kSin(hi, lo);
|
|
71
|
+
default: return -kCos(hi, lo);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function cos(x: number): number {
|
|
75
|
+
if (!Number.isFinite(x) || Math.abs(x) >= 268435456) return nativeCos(x);
|
|
76
|
+
if (Math.abs(x) <= Math.PI / 4) return kCos(x, 0);
|
|
77
|
+
const [n, hi, lo] = reduced(x);
|
|
78
|
+
switch (((n % 4) + 4) % 4) {
|
|
79
|
+
case 0: return kCos(hi, lo);
|
|
80
|
+
case 1: return -kSin(hi, lo);
|
|
81
|
+
case 2: return -kCos(hi, lo);
|
|
82
|
+
default: return kSin(hi, lo);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function tan(x: number): number {
|
|
86
|
+
if (!Number.isFinite(x) || x === 0 || Math.abs(x) >= 268435456) return nativeTan(x);
|
|
87
|
+
return sin(x) / cos(x);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function exp(x: number): number {
|
|
91
|
+
if (!Number.isFinite(x) || x === 0 || x > 709.78 || x < -745.14) return nativeExp(x);
|
|
92
|
+
const k = Math.round(x * INV_LN2);
|
|
93
|
+
const hi = x - k * LN2_HI, lo = k * LN2_LO, r = hi - lo;
|
|
94
|
+
// e^r on |r| <= ln2 / 2, Taylor to r^22 (relative error < 1e-20)
|
|
95
|
+
let term = 1, sum = 1;
|
|
96
|
+
for (let i = 1; i <= 22; i++) { term = term * r / i; sum += term; }
|
|
97
|
+
return scale(sum, k);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function log(x: number): number {
|
|
101
|
+
if (!(x > 0) || !Number.isFinite(x)) return nativeLog(x);
|
|
102
|
+
bits[0] = x;
|
|
103
|
+
let k = ((words[1] ?? 0) >>> 20) - 1023, m: number;
|
|
104
|
+
if (k === -1023) { // subnormal: renormalise
|
|
105
|
+
const y = x * pow2(54); bits[0] = y; k = ((words[1] ?? 0) >>> 20) - 1023 - 54;
|
|
106
|
+
}
|
|
107
|
+
words[1] = ((words[1] ?? 0) & 0x000fffff) | 0x3ff00000;
|
|
108
|
+
m = f64(); // m in [1, 2)
|
|
109
|
+
if (m > Math.SQRT2) { m /= 2; k += 1; }
|
|
110
|
+
// log m = 2 atanh(s), s = (m - 1) / (m + 1), |s| <= 0.1716
|
|
111
|
+
const s = (m - 1) / (m + 1), s2 = s * s;
|
|
112
|
+
let term = s, sum = 0;
|
|
113
|
+
for (let i = 1; i <= 41; i += 2) { sum += term / i; term *= s2; }
|
|
114
|
+
return k * LN2_HI + (2 * sum + k * LN2_LO);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** atan on any finite x: three half-angle reductions, then the series on |t| <= tan(pi/32) */
|
|
118
|
+
function atan(x: number): number {
|
|
119
|
+
if (!Number.isFinite(x) || x === 0) return nativeAtan(x);
|
|
120
|
+
const neg = x < 0, a = neg ? -x : x;
|
|
121
|
+
let t: number, base = 0;
|
|
122
|
+
if (a > 1) { t = 1 / a; base = Math.PI / 2; } else t = a;
|
|
123
|
+
for (let i = 0; i < 3; i++) t /= 1 + Math.sqrt(1 + t * t);
|
|
124
|
+
const t2 = t * t;
|
|
125
|
+
let term = t, sum = 0;
|
|
126
|
+
for (let i = 1; i <= 27; i += 2) { sum += (((i - 1) / 2) % 2 === 0 ? term : -term) / i; term *= t2; }
|
|
127
|
+
const small = 8 * sum, r = base === 0 ? small : (base - small) + 6.123233995736766e-17;
|
|
128
|
+
return neg ? -r : r;
|
|
129
|
+
}
|
|
130
|
+
function atan2(y: number, x: number): number {
|
|
131
|
+
if (!Number.isFinite(x) || !Number.isFinite(y) || x === 0 || y === 0) return nativeAtan2(y, x);
|
|
132
|
+
if (x > 0) return atan(y / x);
|
|
133
|
+
const r = atan(y / x);
|
|
134
|
+
return y >= 0 ? (r + PI) + PI_LO : (r - PI) - PI_LO;
|
|
135
|
+
}
|
|
136
|
+
function asin(x: number): number {
|
|
137
|
+
if (!(Math.abs(x) < 1) || x === 0) return nativeAsin(x);
|
|
138
|
+
return atan2(x, Math.sqrt((1 - x) * (1 + x)));
|
|
139
|
+
}
|
|
140
|
+
function acos(x: number): number {
|
|
141
|
+
if (!(Math.abs(x) < 1)) return nativeAcos(x);
|
|
142
|
+
return atan2(Math.sqrt((1 - x) * (1 + x)), x);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function pow(a: number, b: number): number {
|
|
146
|
+
if (!Number.isFinite(a) || !Number.isFinite(b) || a === 0 || b === 0 || a === 1) return nativePow(a, b);
|
|
147
|
+
if (Number.isInteger(b) && Math.abs(b) <= 64) {
|
|
148
|
+
let base = a, n = Math.abs(b), out = 1;
|
|
149
|
+
while (n > 0) { if (n % 2 === 1) out *= base; base *= base; n = Math.floor(n / 2); }
|
|
150
|
+
return b < 0 ? 1 / out : out;
|
|
151
|
+
}
|
|
152
|
+
if (a < 0) {
|
|
153
|
+
if (!Number.isInteger(b)) return Number.NaN;
|
|
154
|
+
const r = exp(b * log(-a));
|
|
155
|
+
return b % 2 === 0 ? r : -r;
|
|
156
|
+
}
|
|
157
|
+
return exp(b * log(a));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const PORTABLE: {
|
|
161
|
+
readonly sin: typeof sin;
|
|
162
|
+
readonly cos: typeof cos;
|
|
163
|
+
readonly tan: typeof tan;
|
|
164
|
+
readonly exp: typeof exp;
|
|
165
|
+
readonly log: typeof log;
|
|
166
|
+
readonly atan: typeof atan;
|
|
167
|
+
readonly atan2: typeof atan2;
|
|
168
|
+
readonly asin: typeof asin;
|
|
169
|
+
readonly acos: typeof acos;
|
|
170
|
+
readonly pow: typeof pow;
|
|
171
|
+
} = { sin, cos, tan, exp, log, atan, atan2, asin, acos, pow };
|
|
172
|
+
|
|
173
|
+
/** Install the platform-stable functions on the global Math (for a whole oracle file) and return the restore. */
|
|
174
|
+
export function installPortableMath(): () => void {
|
|
175
|
+
const saved = Object.keys(PORTABLE).map(k => [k, Reflect.get(Math, k)] as const);
|
|
176
|
+
for (const [k, f] of Object.entries(PORTABLE)) Reflect.set(Math, k, f);
|
|
177
|
+
return () => { for (const [k, f] of saved) Reflect.set(Math, k, f); };
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** run `fn` with the platform-stable Math functions installed, then put the native ones back */
|
|
181
|
+
export function withPortableMath<T>(fn: () => T): T {
|
|
182
|
+
const restore = installPortableMath();
|
|
183
|
+
try { return fn(); } finally { restore(); }
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Pure portable transcendental functions for synchronous authoring and native oracles. */
|
|
187
|
+
export const portableMath: typeof PORTABLE = PORTABLE;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { buildCommons, type BuiltCommons, type CommonsPack, type CommonsEntry } from '@wildshard/sdk/commons';
|
|
2
|
+
|
|
3
|
+
/** Build a versioned catalogue using only the SDK's author-tool contract. Nothing installs on import. */
|
|
4
|
+
export function createCatalogue(packs: readonly CommonsPack[]): BuiltCommons { return buildCommons(packs); }
|
|
5
|
+
/** Resolve a stable build-time entry to its immutable content reference and actual cost. */
|
|
6
|
+
export function catalogueRef(catalogue: BuiltCommons['catalogue'], id: string): { ref: `commons:${string}`; entry: CommonsEntry } {
|
|
7
|
+
const entry = catalogue.entries.find(row => row.id === id);
|
|
8
|
+
if (entry === undefined) throw new Error(`Unknown commons entry: ${id}`);
|
|
9
|
+
return { ref: `commons:${entry.hash}`, entry: structuredClone(entry) };
|
|
10
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { parseDecisionScripts, type DecisionScriptRow } from '@wildshard/format/decisionScripts';
|
|
2
|
+
import type { DecisionRegistries } from '@wildshard/sdk/decisionBindingMap';
|
|
3
|
+
|
|
4
|
+
/** The shared course's original aliases, handles, fixed page and author ceiling. */
|
|
5
|
+
export interface CourseProgramInputs {
|
|
6
|
+
readonly row: DecisionScriptRow;
|
|
7
|
+
readonly registries: DecisionRegistries;
|
|
8
|
+
readonly source: string;
|
|
9
|
+
readonly options: { readonly asLineCeiling: 256; readonly singleSignal: true };
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Construct the same complete course contract for either injected or retained Node compilation.
|
|
13
|
+
* A compiled identity binds the admitted metadata to the caller's actual source/module bytes. */
|
|
14
|
+
export function courseProgramInputs(kind: 'oval' | 'checkpoints', parameters: Readonly<Record<string, number>> = {},
|
|
15
|
+
compiled?: { readonly module: string; readonly sourceHash: string }): CourseProgramInputs {
|
|
16
|
+
const padFields = Array.from({ length: 11 }, (_, index) => ['Depth','Eligible','Pitch','StartPitch','StartYaw','Top','Width','X','Yaw','Z'].map(key => `pad${String(index).padStart(2,'0')}${key}`)).flat();
|
|
17
|
+
const state = ['lap','started','running','half','best','last','prevX','phase','elapsed','checkpoint','visited'];
|
|
18
|
+
const fields = [...state,'now','x','y','z','mounted','grounded','startPad','finishPad','padCount','fallY','lowest','courseX','courseY','courseZ','courseTime','courseMounted',...padFields];
|
|
19
|
+
const channels = [...state,'courseEvent','courseFell','reached','visit','finish','fell','pad','spawnX','spawnY','spawnZ','spawnYaw','spawnPitch'];
|
|
20
|
+
const signals = ['reset','step','restart','courseReset','courseStep'];
|
|
21
|
+
const aliases = (names: readonly string[]): Record<string,string> => Object.fromEntries(names.map(name => [name,name]));
|
|
22
|
+
const registry = (names: readonly string[]): Map<string,number> => new Map([...names].sort().map((name,index) => [name,index+1]));
|
|
23
|
+
const source = 'behaviour/course.as';
|
|
24
|
+
const rows = parseDecisionScripts([{ id: 'practice.course', abi:'1.0',side:'sim',module:compiled?.module ?? `blobs/wasm/${'0'.repeat(64)}.wasm`,source,
|
|
25
|
+
...(compiled === undefined ? {} : { sourceHash: compiled.sourceHash }),
|
|
26
|
+
binding:{shard:true},pages:1,onFail:'hold',on:['signal'],tick:null,stateVersion:1,state:[],
|
|
27
|
+
params:{ courseKind:kind==='oval'?0:1,courseRadius:0,courseWidth:0,courseLine:0,resetX:0,resetZ:0,resetYaw:0,resetPitch:0,resetPrevX:0,...parameters },
|
|
28
|
+
reads:['field'],commands:['channel'],fields:aliases(fields),channels:aliases(channels),signals:aliases(signals) }]);
|
|
29
|
+
const row = rows[0]; if (row === undefined) throw new Error('Missing shared course contract');
|
|
30
|
+
return { row, source, registries: { fields: registry(fields), channels: registry(channels), signals: registry(signals) },
|
|
31
|
+
options: { asLineCeiling: 256, singleSignal: true } };
|
|
32
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// oxlint-disable-next-line import/no-nodejs-modules -- Compile the shared build-only course source.
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
// oxlint-disable-next-line import/no-nodejs-modules -- Encode compiled immutable program bytes in the existing JSON envelope.
|
|
4
|
+
import { Buffer } from 'node:buffer';
|
|
5
|
+
import { compileDecisionScripts } from '@wildshard/sdk/buildDecisionScripts';
|
|
6
|
+
import type { DecisionScriptRow } from '@wildshard/format/decisionScripts';
|
|
7
|
+
import { courseProgramInputs } from './courseProgram';
|
|
8
|
+
|
|
9
|
+
/** One bounded course law; raw authoring returns the existing compiled binary instead of encoding it. Legacy defaults stay exact. */
|
|
10
|
+
export async function buildCourseProgram(kind: 'oval' | 'checkpoints', parameters: Readonly<Record<string, number>> = {}, raw=false): Promise<{ script: DecisionScriptRow; bytes: string; readonly binary?:Uint8Array }> {
|
|
11
|
+
const { row, registries, source, options } = courseProgramInputs(kind, parameters);
|
|
12
|
+
const built = await compileDecisionScripts([row], registries,
|
|
13
|
+
new Map([[source,readFileSync(new URL('scripts/course.as',import.meta.url),'utf8')]]), options);
|
|
14
|
+
const script=built.rows[0],blob=built.blobs[0];if(script===undefined||blob===undefined)throw new Error('Missing shared course program');
|
|
15
|
+
return raw?{script,bytes:'',binary:blob.bytes}:{ script,bytes:Buffer.from(blob.bytes).toString('base64') };
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Shared ABI-v0 setup: fixed request, parameter and four-effect buffers.
|
|
2
|
+
export function abi_version(): i32 { return 0; }
|
|
3
|
+
export function init(lo: i32, hi: i32): void {}
|
|
4
|
+
export function in_ptr(): i32 { return 16384; }
|
|
5
|
+
export function in_cap(): i32 { return 4096; }
|
|
6
|
+
export function out_ptr(): i32 { return 24576; }
|
|
7
|
+
export function out_cap(): i32 { return 4; }
|
|
8
|
+
let count: i32 = 0;
|
|
9
|
+
export function out_count(): i32 { return count; }
|
|
10
|
+
export function reset(): void { count = 0; }
|
|
11
|
+
@inline export function input(i: i32): f64 { return load<f64>(16384+i*8); }
|
|
12
|
+
@inline export function state(i: i32): f64 { return input(6+i); }
|
|
13
|
+
@inline export function param(i: i32): f64 { return load<f64>(8192+i*8); }
|
|
14
|
+
@inline export function field(id: f64, value: f64): void { const o = 24576+count*40; store<f64>(o,1); store<f64>(o+8,id); store<f64>(o+16,value); store<f64>(o+24,0); store<f64>(o+32,0); count++; }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Mode0 keeps a declared deck enabled; mode1 raises a winched deck after both locks.
|
|
2
|
+
import { reset, input, state, param, field } from './abi';
|
|
3
|
+
@external("env", "query") declare function query(kind: i32, request: i32, response: i32): i32;
|
|
4
|
+
export function on_tick(): void {
|
|
5
|
+
reset();
|
|
6
|
+
if (query(410, 4096, 8192) < 1) unreachable();
|
|
7
|
+
if (param(0) === 0) { field(4,1); return; }
|
|
8
|
+
let angle = state(0), raised = state(4), raising = state(5);
|
|
9
|
+
const action = input(2), unlocked = input(4) === 3;
|
|
10
|
+
if (action === 3) { angle = 0; raised = 1; raising = 0; }
|
|
11
|
+
else if ((action === 1 && unlocked) || action === 2) { if (raised === 0) raising = 1; }
|
|
12
|
+
if (raising === 1 && raised === 0) { angle = min(0, angle+input(1)*param(1)); if (angle >= 0) { raised = 1; raising = 0; } }
|
|
13
|
+
field(1,angle); field(4,raised); field(5,raised); field(6,raising);
|
|
14
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Signal, Field, Channel, Read, Do, Params } from './generated/practiceCourse';
|
|
2
|
+
@inline function f(id:i32):f64 { return Read.field(0,id); }
|
|
3
|
+
@inline function pad(index:i32,field:i32):f64 { return f(Field.pad00Depth+index*10+field); }
|
|
4
|
+
const DEPTH:i32=0,ELIGIBLE:i32=1,PITCH:i32=2,START_PITCH:i32=3,START_YAW:i32=4,TOP:i32=5,WIDTH:i32=6,X:i32=7,YAW:i32=8,Z:i32=9;
|
|
5
|
+
function place(index:i32,atStart:bool):void {
|
|
6
|
+
Do.channel(Channel.spawnX,pad(index,X));Do.channel(Channel.spawnZ,pad(index,Z)+(atStart?pad(index,DEPTH)/2-3:0));
|
|
7
|
+
Do.channel(Channel.spawnY,pad(index,TOP));Do.channel(Channel.spawnYaw,pad(index,atStart?START_YAW:YAW));Do.channel(Channel.spawnPitch,pad(index,atStart?START_PITCH:PITCH));
|
|
8
|
+
}
|
|
9
|
+
@inline function onPad(i:i32,x:f64,y:f64,z:f64):bool {
|
|
10
|
+
return Math.abs(x-pad(i,X))<=pad(i,WIDTH)/2&&Math.abs(z-pad(i,Z))<=pad(i,DEPTH)/2&&Math.abs(y-pad(i,TOP))<0.35;
|
|
11
|
+
}
|
|
12
|
+
function currentPad(count:i32,x:f64,y:f64,z:f64):i32 {
|
|
13
|
+
for(let i:i32=0;i<count;i+=2) { if(onPad(i,x,y,z))return i;if(i+1<count&&onPad(i+1,x,y,z))return i+1; }
|
|
14
|
+
return -1;
|
|
15
|
+
}
|
|
16
|
+
/** Stateless course observations and poses. Native owners keep bodies, UI and cadence. */
|
|
17
|
+
export function onSignal(signal:i32,value:f64,source:i32):void {
|
|
18
|
+
const reset=signal==Signal.reset||signal==Signal.courseReset||signal==Signal.restart;
|
|
19
|
+
if(!reset&&signal!=Signal.step&&signal!=Signal.courseStep)return;
|
|
20
|
+
const oval=Params.courseKind==0,legacy=signal==Signal.courseReset||signal==Signal.courseStep;
|
|
21
|
+
let started=f(Field.started),best=f(Field.best),elapsed=oval?0:f(Field.elapsed),running=oval?f(Field.running):0,phase=oval?running:f(Field.phase);
|
|
22
|
+
const now=f(legacy?Field.courseTime:Field.now),x=f(legacy?Field.courseX:Field.x),y=f(legacy?Field.courseY:Field.y),z=f(legacy?Field.courseZ:Field.z);
|
|
23
|
+
if(Params.courseKind==0) {
|
|
24
|
+
let lap=f(Field.lap),half=f(Field.half),last=f(Field.last),previous=f(Field.prevX),event=0.0;
|
|
25
|
+
// Legacy course aliases carry exactly their original observations.
|
|
26
|
+
const px=x;
|
|
27
|
+
const pz=z;
|
|
28
|
+
const py=y;
|
|
29
|
+
const time=now;
|
|
30
|
+
const mounted=signal==Signal.courseReset||signal==Signal.courseStep?f(Field.courseMounted):f(Field.mounted);
|
|
31
|
+
if(reset) { lap=0;started=0;running=0;half=0;last=-1; }
|
|
32
|
+
else {
|
|
33
|
+
if(Math.abs(pz-Params.courseRadius)<Params.courseWidth/2+2&&previous<Params.courseLine&&px>=Params.courseLine&&mounted!=0) {
|
|
34
|
+
if(running!=0&&half!=0) { last=time-started;best=best<0?last:Math.min(best,last);event=1; }
|
|
35
|
+
running=1;half=0;lap++;started=time;
|
|
36
|
+
}
|
|
37
|
+
if(Math.abs(pz+Params.courseRadius)<Params.courseWidth/2+2&&previous>Params.courseLine&&px<=Params.courseLine&&running!=0&&half==0) {half=1;event=2;}
|
|
38
|
+
}
|
|
39
|
+
if(signal==Signal.restart) {
|
|
40
|
+
Do.channel(Channel.spawnX,Params.resetX);Do.channel(Channel.spawnZ,Params.resetZ);Do.channel(Channel.spawnY,0);
|
|
41
|
+
Do.channel(Channel.spawnYaw,Params.resetYaw);Do.channel(Channel.spawnPitch,Params.resetPitch);
|
|
42
|
+
}
|
|
43
|
+
Do.channel(Channel.lap,lap);Do.channel(Channel.half,half);Do.channel(Channel.last,last);
|
|
44
|
+
Do.channel(Channel.prevX,signal==Signal.restart?Params.resetPrevX:px);
|
|
45
|
+
Do.channel(Channel.courseEvent,event);Do.channel(Channel.courseFell,py<-12?1:0);
|
|
46
|
+
phase=running;elapsed=0;
|
|
47
|
+
} else {
|
|
48
|
+
let checkpoint=f(Field.checkpoint),visited=i32(f(Field.visited)),finish=0.0,visit=-1.0;
|
|
49
|
+
const count=i32(f(Field.padCount)),start=i32(f(Field.startPad));
|
|
50
|
+
const at=!reset&&f(Field.grounded)!=0?currentPad(count,x,y,z):-1;
|
|
51
|
+
if(reset) {phase=0;elapsed=0;checkpoint=start;visited=0;place(start,true);}
|
|
52
|
+
else {
|
|
53
|
+
if(at>=0) {checkpoint=at;if(pad(at,ELIGIBLE)!=0) {visit=at;visited|=i32(pad(at,ELIGIBLE));}}
|
|
54
|
+
if(phase==0&&z<pad(start,Z)-pad(start,DEPTH)/2&&x>pad(start,X)-pad(start,WIDTH)/2-1) {phase=1;started=now;}
|
|
55
|
+
if(phase==1) {elapsed=now-started;if(at==i32(f(Field.finishPad))) {phase=2;best=best<0?elapsed:Math.min(best,elapsed);finish=1;}}
|
|
56
|
+
}
|
|
57
|
+
const fell=!reset&&y<f(Field.lowest)-f(Field.fallY);if(fell)place(i32(checkpoint),checkpoint==start);
|
|
58
|
+
Do.channel(Channel.checkpoint,checkpoint);Do.channel(Channel.visited,visited);Do.channel(Channel.visit,visit);Do.channel(Channel.reached,i32.popcnt(visited));
|
|
59
|
+
Do.channel(Channel.finish,finish);Do.channel(Channel.pad,at);Do.channel(Channel.fell,fell?1:0);running=phase==1?1:0;
|
|
60
|
+
}
|
|
61
|
+
Do.channel(Channel.phase,phase);Do.channel(Channel.elapsed,elapsed);Do.channel(Channel.running,running);
|
|
62
|
+
Do.channel(Channel.started,started);Do.channel(Channel.best,best);
|
|
63
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ask-new.sh — claim the next ask id and create docs/tasks/asks/<ID>.md
|
|
3
|
+
# (one file per request for work from Jake; rules in
|
|
4
|
+
# docs/tasks/asks/README.md). Ported from project-wildshard-singleplayer.
|
|
5
|
+
#
|
|
6
|
+
# src/scripts/ask-new.sh "<Jake's words>" [series letter, default A]
|
|
7
|
+
#
|
|
8
|
+
# The file IS the claim: it is created with noclobber (O_EXCL), so two
|
|
9
|
+
# agents asking at the same moment get two different ids. Prints the new
|
|
10
|
+
# file's path. Fill in the rest with Edit, then commit it by pathspec.
|
|
11
|
+
set -uo pipefail
|
|
12
|
+
cd "$(git rev-parse --show-toplevel)" || exit 1
|
|
13
|
+
ask="${1:?usage: src/scripts/ask-new.sh \"<the request, in Jake words>\" [series letter]}"
|
|
14
|
+
series="${2:-A}"
|
|
15
|
+
dir=docs/tasks/asks
|
|
16
|
+
mkdir -p "$dir"
|
|
17
|
+
max="$(ls "$dir" 2>/dev/null | grep -oE "^${series}[0-9]+\.md$" | grep -oE '[0-9]+' | sort -n | tail -1)"
|
|
18
|
+
n=$(( ${max:-0} + 1 ))
|
|
19
|
+
set -o noclobber
|
|
20
|
+
for _ in $(seq 1 50); do
|
|
21
|
+
f="$dir/${series}${n}.md"
|
|
22
|
+
if { printf '# %s%s\n\n**Status:** open (%s)\n**Ask:** %s\n' "$series" "$n" "$(date +%F)" "$ask" > "$f"; } 2>/dev/null; then
|
|
23
|
+
echo "$f"
|
|
24
|
+
exit 0
|
|
25
|
+
fi
|
|
26
|
+
n=$(( n + 1 ))
|
|
27
|
+
done
|
|
28
|
+
echo "ask-new: could not claim an id in series $series" >&2
|
|
29
|
+
exit 1
|