@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,85 @@
|
|
|
1
|
+
// P4 orchestration is deliberately separate from gen: no build -> gen -> build cycle.
|
|
2
|
+
import {resolve} from 'node:path';
|
|
3
|
+
import {readFileSync} from 'node:fs';
|
|
4
|
+
import * as v from 'valibot';
|
|
5
|
+
import {runtimeClosures} from '@wildshard/engine/scripts/shard-runtime-closure.mjs';
|
|
6
|
+
import {outputCensus,portHeadline,codeLines,shaderCodeLines} from '@wildshard/engine/scripts/shard-platform.mjs';
|
|
7
|
+
import {outputContent} from '@wildshard/engine/scripts/shard-output-content.mjs';
|
|
8
|
+
import {customSectionFailures} from '@wildshard/engine/scripts/shard-platform-sections.mjs';
|
|
9
|
+
import {createOutputReader} from '@wildshard/engine/scripts/shard-platform-output.mjs';
|
|
10
|
+
import {gridReady,m3Progress,planProgress,unknownGridReady,M2_GRID_PLOT_CELLS} from './shard-milestones.mjs';
|
|
11
|
+
import {decisionLegacyLines} from '@wildshard/engine/scripts/decision-legacy-lines.mjs';
|
|
12
|
+
import {runtimeReceiptPaths} from '@wildshard/engine/scripts/grid-runtime-evidence.mjs';
|
|
13
|
+
import {netLineReport,platformLineTotals,sourceLineDelta} from '@wildshard/engine/scripts/shard-net-lines.mjs';
|
|
14
|
+
import {productScriptMetrics,scriptReceiptPaths} from '@wildshard/engine/scripts/script-scenario-metrics.mjs';
|
|
15
|
+
|
|
16
|
+
const sourceBaseline=v.strictObject({since:v.string(),revision:v.string(),basis:v.literal('source'),customLines:v.record(v.string(),v.pipe(v.number(),v.integer(),v.minValue(0)))});
|
|
17
|
+
const baseline=v.array(v.strictObject({wave:v.string(),revision:v.string(),record:v.string(),customLines:v.record(v.string(),v.number()),platformLines:v.record(v.string(),v.number())}));
|
|
18
|
+
|
|
19
|
+
/** Caller holds the heavy build lane (or measures the gate's exact HEAD output).
|
|
20
|
+
* Each closed shard is copied strictly; an unclosed shard never gets a percent.
|
|
21
|
+
* `sourceProgress` keeps the admin's historical source ruler in one unit even
|
|
22
|
+
* when some runtimes close. Output closure and canonical output credit do not change.
|
|
23
|
+
* `reportOnly` isolates product failures without inventing ownership credit.
|
|
24
|
+
* @param {string} root @param {{build?:boolean,sourceProgress?:boolean,products?:string,revision?:string|null,receipts?:readonly string[],scriptReceipts?:readonly string[],reportOnly?:boolean,buildProduct?:(args:string[])=>Promise<void>}} options */
|
|
25
|
+
export async function outputReport(root,{build=true,sourceProgress=false,products=resolve(root,'out'),revision=process.env.VERCEL_GIT_COMMIT_SHA??null,receipts=runtimeReceiptPaths(root),scriptReceipts=scriptReceiptPaths(root),reportOnly=false,buildProduct}={}) {
|
|
26
|
+
const closure=runtimeClosures(root);
|
|
27
|
+
/** @type {Record<string,string>} */
|
|
28
|
+
const productFailures={};
|
|
29
|
+
/** @param {string} slug @param {unknown} error */
|
|
30
|
+
const failed=(slug,error)=>{productFailures[slug]=error instanceof Error?error.message:String(error);};
|
|
31
|
+
if(build) {
|
|
32
|
+
if(products!==resolve(root,'out'))throw new Error('Build reports publish only to out/');
|
|
33
|
+
const {buildShardfiles}=await import('./build-shardfiles.mjs');
|
|
34
|
+
// Preparation copies raw-closed runtimes strictly and emits
|
|
35
|
+
// unclosed products without copies. All receive actual byte-validation evidence.
|
|
36
|
+
await buildShardfiles(root,{strict:false,copyRuntime:'closed',reuse:true,...(reportOnly?{onFailure:failed}:{}),...(buildProduct===undefined?{}:{build:buildProduct})});
|
|
37
|
+
}
|
|
38
|
+
const sections={},contents={},reader=createOutputReader(root,products);
|
|
39
|
+
for(const [slug,state] of Object.entries(closure)) {
|
|
40
|
+
if(Object.hasOwn(productFailures,slug))continue;
|
|
41
|
+
try {
|
|
42
|
+
sections[slug]=reader.sections(slug);
|
|
43
|
+
if(state.status==='closed')contents[slug]=outputContent(root,slug,products,reader);
|
|
44
|
+
} catch(error) {if(!reportOnly)throw error;failed(slug,error);}
|
|
45
|
+
}
|
|
46
|
+
const measurementError=Object.keys(productFailures).length===0?null:`Cross-shard ownership unavailable: ${Object.entries(productFailures).map(([slug,error])=>`${slug}: ${error}`).join('; ')}`;
|
|
47
|
+
// G294 needs every verified section inventory to count shared users. Partial
|
|
48
|
+
// output never supplies zeros, stale users, or a newly granted percentage.
|
|
49
|
+
const census=measurementError===null?outputCensus(root,products,reader):{measures:{},inventory:{},source:{}};
|
|
50
|
+
const {measures,inventory,source}=census;
|
|
51
|
+
// G496: data debt applies even before a shard's runtime closes. Its budget
|
|
52
|
+
// findings are report-only here (G514): the ruler always measures.
|
|
53
|
+
const dailyLines=sourceLineDelta(source,v.parse(sourceBaseline,JSON.parse(readFileSync(resolve(import.meta.dirname,'shard-line-baseline.json'),'utf8'))));
|
|
54
|
+
const rows=Object.fromEntries(Object.entries(closure).map(([slug,state])=>{
|
|
55
|
+
const failure=Object.hasOwn(productFailures,slug)?productFailures[slug]:undefined;
|
|
56
|
+
if(measurementError!==null) {
|
|
57
|
+
const ready=failure===undefined?gridReady(root,slug,products,{revision,receipts,reader}):unknownGridReady(failure);
|
|
58
|
+
if(failure!==undefined){ready.verdict='fail';ready.criteria.productBuild={verdict:'fail',evidence:failure};ready.frameFloor={verdict:'unknown',evidence:failure};}
|
|
59
|
+
return [slug,{...state,customPercent:null,port:null,m3:null,measurementError,
|
|
60
|
+
legacyLines:decisionLegacyLines(root,slug)??null,linesRemovedSince12Z:dailyLines.shards[slug]??null,
|
|
61
|
+
gridReady:ready,scriptMetrics:failure===undefined?productScriptMetrics(root,slug,products,scriptReceipts):{status:'unknown',scripts:[],scenarios:[]},
|
|
62
|
+
...(sections[slug]===undefined?{}:{customSections:sections[slug].customSections,customSectionBytes:sections[slug].customSectionBytes}),
|
|
63
|
+
...(contents[slug]===undefined?{}:{content:contents[slug]}),...(failure===undefined?{}:{productFailure:failure})}];
|
|
64
|
+
}
|
|
65
|
+
const ready=gridReady(root,slug,products,{revision,receipts,reader});
|
|
66
|
+
const scriptMetrics=productScriptMetrics(root,slug,products,scriptReceipts);
|
|
67
|
+
if(state.status==='unclosed') {
|
|
68
|
+
const progress=source[slug];
|
|
69
|
+
return [slug,{...state,customPercent:null,port:null,linesRemovedSince12Z:dailyLines.shards[slug]??null,gridReady:ready,scriptMetrics,m3:m3Progress(slug,progress),
|
|
70
|
+
customSections:sections[slug].customSections,customSectionBytes:sections[slug].customSectionBytes,
|
|
71
|
+
assemblyScriptLines:progress.assemblyScriptLines,assemblyScriptBudget:progress.assemblyScriptBudget,
|
|
72
|
+
listedView:inventory[slug]?.listedView}];
|
|
73
|
+
}
|
|
74
|
+
if(!Object.hasOwn(measures,slug))throw new Error(`${slug}: closed runtime has no output measure`);
|
|
75
|
+
const measured=measures[slug];
|
|
76
|
+
const content=contents[slug],customPercent=measured.conversion.runtimeShare===null?null:100*measured.conversion.runtimeShare;
|
|
77
|
+
return [slug,{...state,...measured,customPercent,content,linesRemovedSince12Z:dailyLines.shards[slug]??null,port:portHeadline(customPercent,content),gridReady:ready,scriptMetrics,
|
|
78
|
+
m3:m3Progress(slug,sourceProgress?source[slug]:{basis:'output',customLines:measured.conversion.customRuntimeLines,legacyLines:measured.conversion.legacyLines})}];
|
|
79
|
+
}));
|
|
80
|
+
const current=Object.fromEntries(Object.entries(rows).flatMap(([slug,row])=>row.m3===null?[]:[[slug,{customLines:row.m3.customLines,basis:row.m3.basis}]]));
|
|
81
|
+
const baselines=v.parse(baseline,JSON.parse(readFileSync(resolve(import.meta.dirname,'wave-line-baselines.json'),'utf8')));
|
|
82
|
+
const platform=platformLineTotals(root,(text,path)=>path.endsWith('.glsl')?shaderCodeLines(text):codeLines(text,path));
|
|
83
|
+
const plots=Object.fromEntries([...new Set(M2_GRID_PLOT_CELLS.map(cell=>cell.slug))].map(slug=>[slug,gridReady(root,slug,products,{revision,receipts})]));
|
|
84
|
+
return {rows,measures,inventory,dailyLines,netLines:netLineReport(current,baselines,platform),progress:planProgress(rows,plots),sectionFailures:customSectionFailures(root,sections),productFailures,measurementError};
|
|
85
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// P4 command orchestration stays outside the importable census to avoid an async cycle.
|
|
3
|
+
import {readFileSync} from 'node:fs';
|
|
4
|
+
import {resolve} from 'node:path';
|
|
5
|
+
import {pathToFileURL} from 'node:url';
|
|
6
|
+
import {checkShares} from '@wildshard/engine/scripts/shard-platform.mjs';
|
|
7
|
+
import {outputReport} from './shard-output-report.mjs';
|
|
8
|
+
import {componentStates,componentWave,SHARD_WAVES} from '@wildshard/engine/scripts/shard-components.mjs';
|
|
9
|
+
import {closedComponentFailures} from '@wildshard/engine/scripts/check-closed-components.mjs';
|
|
10
|
+
import {componentSpanReports} from '@wildshard/engine/scripts/shard-component-spans.mjs';
|
|
11
|
+
|
|
12
|
+
const ROOT=resolve(import.meta.dirname,'..'),LIST='lint/shard-platform.json';
|
|
13
|
+
/** Run after the importable census has finished evaluating, without loading a
|
|
14
|
+
* second copy of the complete module graph in another Node process. */
|
|
15
|
+
export async function runShardPlatformCli() {
|
|
16
|
+
process.env.WS_SHARD_PARSE_CACHE ??= resolve(ROOT,'.cache/shard-parse');
|
|
17
|
+
const build = !process.argv.includes('--no-build');
|
|
18
|
+
const sourceProgress = process.argv.includes('--source-progress');
|
|
19
|
+
if (build && !process.env.WS_HEAVY_TOKEN) {
|
|
20
|
+
const {spawnSync} = await import('node:child_process');
|
|
21
|
+
const result = spawnSync('python3', ['scripts/heavy-lane.py', 'build', '--', process.execPath, ...process.argv.slice(1)], {cwd:ROOT, stdio:'inherit'});
|
|
22
|
+
process.exitCode = result.status ?? 1;
|
|
23
|
+
} else {
|
|
24
|
+
if (build) {
|
|
25
|
+
// The copied product needs the same official cheap inputs as an app build.
|
|
26
|
+
const {execFileSync}=await import('node:child_process');
|
|
27
|
+
execFileSync(process.execPath,['scripts/gen.mjs','--proof'],{cwd:ROOT,stdio:['inherit',2,2]});
|
|
28
|
+
}
|
|
29
|
+
const productArg = process.argv.find(value => value.startsWith('--products='));
|
|
30
|
+
const products = productArg === undefined ? resolve(ROOT, 'out') : resolve(ROOT, productArg.slice('--products='.length));
|
|
31
|
+
const log=console.log,info=console.info;
|
|
32
|
+
if(process.argv.includes('--json')){console.log=console.error;console.info=console.error;}
|
|
33
|
+
let report;
|
|
34
|
+
const receipts=process.argv.filter(value=>value.startsWith('--grid-receipt=')).map(value=>value.slice('--grid-receipt='.length));
|
|
35
|
+
const scriptReceipts=process.argv.filter(value=>value.startsWith('--script-receipt=')).map(value=>value.slice('--script-receipt='.length));
|
|
36
|
+
try {report=await outputReport(ROOT,{build,sourceProgress,products,reportOnly:!process.argv.includes('--check'),...(receipts.length===0?{}:{receipts}),...(scriptReceipts.length===0?{}:{scriptReceipts})});}
|
|
37
|
+
finally {console.log=log;console.info=info;}
|
|
38
|
+
const {rows,measures,sectionFailures,progress,netLines,dailyLines}=report;
|
|
39
|
+
// Component closure in the labelled source-progress ruler must include
|
|
40
|
+
// transitional shards whose standalone output has not closed yet.
|
|
41
|
+
const componentMeasures=report.measurementError!==null?{}:sourceProgress?report.inventory:measures;
|
|
42
|
+
const policy=JSON.parse(readFileSync(resolve(ROOT,'lint/ratchet.json'),'utf8'));
|
|
43
|
+
const lockedShards=Object.keys(policy.closedComponents??{});
|
|
44
|
+
// G514: custom-section budgets never stop the ruler; --check keeps them hard.
|
|
45
|
+
const failures=process.argv.includes('--check')?[...sectionFailures]:[];
|
|
46
|
+
if (failures.length===0) for (const failure of sectionFailures) console.error(`shard-platform: FAIL (report-only) ${failure}`);
|
|
47
|
+
if (process.argv.includes('--json')) console.log(JSON.stringify({...rows,_summary:{metric:sourceProgress?'source-progress':'built-output',revision:process.env.VERCEL_GIT_COMMIT_SHA??null,closed:Object.keys(measures).length,total:Object.keys(rows).length,progress,netLines,dailyLines,customSectionFailures:sectionFailures,productFailures:report.productFailures,measurementError:report.measurementError,componentBasis:sourceProgress?'source':'built-output',sourceSpans:componentSpanReports(ROOT,report.inventory,Object.keys(rows),report.measurementError),components:componentStates(componentMeasures,lockedShards),waves:SHARD_WAVES.map(wave=>componentWave(componentMeasures,wave.id))}},null,2));
|
|
48
|
+
else {
|
|
49
|
+
console.log('shard closure custom / frozen escapes M3 / basis grid-ready private JSON / bytes AS / 10% legacy private bin bytes one-user build lines');
|
|
50
|
+
for (const [slug,row] of Object.entries(rows)) {
|
|
51
|
+
if(row.measurementError!==undefined){console.log(`${slug}: custom percentage unknown; ${row.measurementError}`);console.log(` grid-ready ${row.gridReady.verdict}; ${JSON.stringify(row.gridReady.criteria)}; frame floor ${row.gridReady.frameFloor?.verdict??'unknown'}`);continue;}
|
|
52
|
+
if(row.listedView!==undefined)console.log(` ${slug} listed view ${row.listedView.listedViewLines}; other custom ${row.listedView.otherCustomLines}; total custom ${row.listedView.totalCustomLines} (unchanged, ${row.status==='unclosed'?'source':'built-output'} basis)`);
|
|
53
|
+
const m3=row.m3===null?'native':`${(100*row.m3.fraction).toFixed(1)}% ${row.m3.basis}`;
|
|
54
|
+
const ready=Object.entries(row.gridReady.criteria).map(([name,value])=>`${name}:${value.verdict}`).join(', ');
|
|
55
|
+
const metrics=row.scriptMetrics,delta=row.linesRemovedSince12Z;
|
|
56
|
+
console.log(` ${slug} custom lines removed since ${dailyLines.since}: ${delta?.removed??'unknown'} (source ruler ${delta?.before??'unknown'} -> ${delta?.after??'unknown'}; baseline ${dailyLines.revision})`);
|
|
57
|
+
console.log(` ${slug} scripts: ${metrics.status}; AS ${row.assemblyScriptLines}/${row.assemblyScriptBudget?.ceiling??'native'}`);
|
|
58
|
+
for(const scenario of metrics.scenarios)console.log(` ${scenario.script} / ${scenario.scenario}: calls ${scenario.calls}, coarse fuel total/max ${scenario.fuel}/${scenario.maxFuel}, refusals ${scenario.refusals}; ${scenario.path} sha256:${scenario.receiptHash}`);
|
|
59
|
+
for(const script of metrics.scripts.filter(value=>!value.measured))console.log(` ${script.id}: fuel/calls unknown (no matching scenario receipt)`);
|
|
60
|
+
if (row.status==='unclosed') {
|
|
61
|
+
console.log(`${slug.padEnd(22)} unclosed — ${row.escapes} M3 ${m3}; grid ${row.gridReady.verdict}; JSON ${row.customSections?.length}/${row.customSectionBytes}; AS ${row.assemblyScriptLines}/${row.assemblyScriptBudget?.ceiling??'native'}`);
|
|
62
|
+
console.log(` grid-ready ${ready}; frame floor ${row.gridReady.frameFloor?.verdict??'unknown'}`);
|
|
63
|
+
for (const file of row.files.slice(0,5)) console.log(` ${file.path}: ${file.count} escapes; ${file.messages.join('; ')}`);
|
|
64
|
+
if (row.refusal) console.log(` strict copy: ${row.refusal}`);
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const pct=row.customPercent===null?'native':`${row.customPercent.toFixed(2)} %`;
|
|
68
|
+
console.log(`${slug.padEnd(22)} closed ${pct.padEnd(17)} 0 M3 ${m3}; grid ${row.gridReady.verdict}; ${row.customSections?.length}/${row.customSectionBytes} AS ${row.assemblyScriptLines}/${row.assemblyScriptBudget?.ceiling??'native'} bin ${row.content?.privateBinaryBytes} build ${row.oneUserBuildTools?.lines}`);
|
|
69
|
+
console.log(` grid-ready ${ready}; frame floor ${row.gridReady.frameFloor?.verdict??'unknown'}`);
|
|
70
|
+
}
|
|
71
|
+
const percent=value=>`${(100*value).toFixed(1)} %`;
|
|
72
|
+
console.log(`M3 six-shard total: ${progress.m3.fraction===null?'unknown':percent(progress.m3.fraction)}; ${progress.m3.cut}/${progress.m3.mustGo} must-go lines cut`);
|
|
73
|
+
console.log(`M2 grid-ready: ${progress.m2.ready}/${progress.m2.total} pass, ${progress.m2.unknown}/${progress.m2.total} unknown; ${progress.m2.plots} plot cells counted separately`);
|
|
74
|
+
console.log(`Frame floor (separate): ${progress.frameFloor.ready}/${progress.frameFloor.total} pass, ${progress.frameFloor.fail}/${progress.frameFloor.total} fail, ${progress.frameFloor.unknown}/${progress.frameFloor.total} unknown`);
|
|
75
|
+
console.log(`Plan (60% M3 + 40% M2): ${progress.plan===null?'unknown':progress.plan.lower===progress.plan.upper?percent(progress.plan.lower):`${percent(progress.plan.lower)}–${percent(progress.plan.upper)} (M2 evidence incomplete)`}`);
|
|
76
|
+
for(const wave of netLines) {
|
|
77
|
+
console.log(`${wave.wave} net lines (report-only, historical source M0 ${wave.revision}): custom cut ${wave.customCut??'unknown'} - platform growth ${wave.platformGrowth} = ${wave.netCut??'unknown'}`);
|
|
78
|
+
for(const [slug,row] of Object.entries(wave.shards))console.log(` ${slug}: ${row.before} -> ${row.after??'unknown'} (${row.basis}), cut ${row.cut??'unknown'}`);
|
|
79
|
+
for(const [layer,row] of Object.entries(wave.layers))console.log(` ${layer}: ${row.before} -> ${row.after}, growth ${row.growth}`);
|
|
80
|
+
}
|
|
81
|
+
console.log('Since-noon counts use the source ruler on both dates, including ownership/ruler corrections. Output closure never supplies a cut; negative removed lines mean growth.');
|
|
82
|
+
console.log('Platform growth includes all concurrent engine/game/SDK work and build tools, once per wave; historical source and current output/source units differ. Net lines never change custom % or gate.');
|
|
83
|
+
}
|
|
84
|
+
if (process.argv.includes('--check')) {
|
|
85
|
+
const recorded=JSON.parse(readFileSync(resolve(ROOT,LIST),'utf8'));
|
|
86
|
+
failures.push(...checkShares(recorded,measures));
|
|
87
|
+
if(lockedShards.length>0)failures.push(...closedComponentFailures(report.inventory,policy.closedComponents));
|
|
88
|
+
}
|
|
89
|
+
for (const failure of failures) console.error(`shard-platform: ${failure}`);
|
|
90
|
+
if (failures.length>0) process.exitCode=1;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (import.meta.url === pathToFileURL(process.argv[1] ?? '').href) await runShardPlatformCli();
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { KEYCHAIN_ARGS } from './chromium-keychain.mjs';
|
|
3
|
+
// shard-progress.mjs — one progress capture of a shard (E387, Jake 2026-10-02: "progress photos and progress videos and
|
|
4
|
+
// time lapse videos of shard five and shard six being built … we definitely should").
|
|
5
|
+
//
|
|
6
|
+
// Shoots the shard's fixed progress cameras (`art/<slug>/progress/cameras.json`) on a served build, iPhone portrait
|
|
7
|
+
// (390×844 @3, phone tier, touch HUD), and records one short real-resolution clip (canvas.captureStream, the memory note
|
|
8
|
+
// "game video capture"): a slow orbit around the clip's centre. Every run writes the same frames, so
|
|
9
|
+
// `scripts/shard-timelapse.py <slug>` can line them up into time-lapses.
|
|
10
|
+
//
|
|
11
|
+
// scripts/serve-build.sh --name prog # → http://127.0.0.1:<port>/ (or serve an export of an older SHA)
|
|
12
|
+
// scripts/browser-lane.sh --max 20 node scripts/shard-progress.mjs --shard=sunscar-dunes --url=http://127.0.0.1:<port> \
|
|
13
|
+
// --sha=<sha the build is> [--label="loop 3"] [--no-clip] [--no-qa] [--qa-wait=120] [--qa-force=<shot id>]
|
|
14
|
+
//
|
|
15
|
+
// Capture QA (E394): after the shots, scripts/decide/decide.sh asks the local Clef-flash model whether each frame shows
|
|
16
|
+
// the 3D world or a loading screen, title card, menu or blank frame (~1 s a frame, under the model lock). A flagged shot is
|
|
17
|
+
// re-taken once with a longer settle and checked again; meta.json's `qa` records each shot's answer and the re-takes.
|
|
18
|
+
// The check is skipped (and says so in meta.json) when the model or its venv is missing or the lock stays busy past
|
|
19
|
+
// --qa-wait seconds. --qa-force=<id> treats one shot as flagged, to exercise the re-take path.
|
|
20
|
+
//
|
|
21
|
+
// Output: progress/<slug>/<YYYYMMDD-HHMM>-<sha8>/<shot>.jpg (780×1688, ≤ ~300 KB), clip.mp4 (540 px wide), meta.json.
|
|
22
|
+
// The stamp is the commit's date (git), so a back-filled old SHA sorts where it belongs.
|
|
23
|
+
import { execFileSync, spawnSync } from 'node:child_process';
|
|
24
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, writeFileSync, rmSync } from 'node:fs';
|
|
25
|
+
import { resolve as resolvePath, join } from 'node:path';
|
|
26
|
+
import { saveFixture } from '@wildshard/engine/scripts/debug-settings.mjs';
|
|
27
|
+
import { browserBakeBytes } from '@wildshard/engine/scripts/bake-output.mjs';
|
|
28
|
+
import { recordProgressClip } from '@wildshard/engine/scripts/progress-recording.mjs';
|
|
29
|
+
import { uploadRecordedClip } from '@wildshard/engine/scripts/model-spin-recording.mjs';
|
|
30
|
+
|
|
31
|
+
const { chromium } = await import('playwright');
|
|
32
|
+
const ROOT = resolvePath(new URL('..', import.meta.url).pathname);
|
|
33
|
+
const argv = process.argv.slice(2);
|
|
34
|
+
const flag = (n, d) => { const a = argv.find((x) => x.startsWith(`--${n}=`)); return a ? a.slice(n.length + 3) : d; };
|
|
35
|
+
const SLUG = flag('shard', '');
|
|
36
|
+
const URL_BASE = flag('url', '');
|
|
37
|
+
if (!SLUG || !URL_BASE) { console.error('usage: shard-progress.mjs --shard=<slug> --url=<served build> --sha=<sha> [--label=…] [--no-clip]'); process.exit(2); }
|
|
38
|
+
const SHA = execFileSync('git', ['rev-parse', flag('sha', 'HEAD')], { cwd: ROOT, encoding: 'utf8' }).trim();
|
|
39
|
+
const LABEL = flag('label', '');
|
|
40
|
+
const CLIP = !argv.includes('--no-clip');
|
|
41
|
+
const QA = !argv.includes('--no-qa');
|
|
42
|
+
const QA_WAIT = Number(flag('qa-wait', '120'));
|
|
43
|
+
const QA_FORCE = argv.filter((a) => a.startsWith('--qa-force=')).map((a) => a.slice('--qa-force='.length));
|
|
44
|
+
/** --cameras=<file>: another cameras file (a test of the harness); default the shard's committed one */
|
|
45
|
+
const CAMS = JSON.parse(readFileSync(flag('cameras', join(ROOT, 'art', SLUG, 'progress', 'cameras.json')), 'utf8'));
|
|
46
|
+
const when = execFileSync('git', ['show', '-s', '--format=%cd', '--date=format:%Y%m%d-%H%M', SHA], { cwd: ROOT, encoding: 'utf8' }).trim();
|
|
47
|
+
/** --root=<dir>: write the capture there instead of the repo's progress/ (a scratch comparison, E397) */
|
|
48
|
+
const OUT = join(flag('root', join(ROOT, 'progress')), SLUG, `${when}-${SHA.slice(0, 8)}`);
|
|
49
|
+
mkdirSync(OUT, { recursive: true });
|
|
50
|
+
// one temp folder per run: two runs of the same shard at the same SHA (the lead's and a builder's) shared one, and the
|
|
51
|
+
// first to finish deleted it under the other (two council captures stopped half-way, E399)
|
|
52
|
+
mkdirSync(join(ROOT, 'tmp'), { recursive: true });
|
|
53
|
+
const TMP = mkdtempSync(join(ROOT, 'tmp', `shard-progress-${SLUG}-${SHA.slice(0, 8)}-`));
|
|
54
|
+
const sleep = (ms) => new Promise((resolve) => { setTimeout(resolve, ms); });
|
|
55
|
+
const D = Math.PI / 180;
|
|
56
|
+
|
|
57
|
+
/** a full-res PNG → a 780 px wide JPEG in the progress folder */
|
|
58
|
+
const store = (png, name) => {
|
|
59
|
+
const src = join(TMP, `${name}.png`); writeFileSync(src, png);
|
|
60
|
+
execFileSync('sips', ['-Z', '1688', '-s', 'format', 'jpeg', '-s', 'formatOptions', '80', src, '--out', join(OUT, `${name}.jpg`)], { stdio: 'ignore' });
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Capture QA (E394): decide.sh's `qa` over the named frames. Returns per-shot answers, or a reason the check was skipped.
|
|
65
|
+
* The sidecars it writes (<shot>.qa.json) are folded into meta.json and removed, so the progress folder keeps its shape.
|
|
66
|
+
* @param {string[]} ids @param {string[]} force
|
|
67
|
+
* @returns {{ skipped: string | null, shots: Record<string, { screen: string, pWorld: number, flagged: boolean }> }}
|
|
68
|
+
*/
|
|
69
|
+
const checkFrames = (ids, force) => {
|
|
70
|
+
const decide = join(ROOT, 'scripts', 'decide', 'decide.sh');
|
|
71
|
+
const args = ['qa', ...force.flatMap((id) => ['--force-flag', id]), ...ids.map((id) => join(OUT, `${id}.jpg`))];
|
|
72
|
+
const r = spawnSync(decide, args, { encoding: 'utf8', env: { ...process.env, DECIDE_LOCK_WAIT: String(QA_WAIT) } });
|
|
73
|
+
if (r.status !== 0 && r.status !== 3) {
|
|
74
|
+
return { skipped: r.status === 75 ? `the model lock stayed busy for ${QA_WAIT} s` : `decide.sh exited ${String(r.status)}: ${r.stderr.trim().slice(0, 200)}`, shots: {} };
|
|
75
|
+
}
|
|
76
|
+
/** @type {Record<string, { screen: string, pWorld: number, flagged: boolean }>} */
|
|
77
|
+
const shots = {};
|
|
78
|
+
for (const id of ids) {
|
|
79
|
+
const side = join(OUT, `${id}.qa.json`);
|
|
80
|
+
if (!existsSync(side)) continue;
|
|
81
|
+
const q = JSON.parse(readFileSync(side, 'utf8'));
|
|
82
|
+
shots[id] = { screen: q.answers.screen.choice, pWorld: q.answers.screen.probabilities.world, flagged: q.flagged };
|
|
83
|
+
rmSync(side);
|
|
84
|
+
}
|
|
85
|
+
return { skipped: null, shots };
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/** @type {import('playwright').Browser|undefined} */
|
|
89
|
+
let browser;
|
|
90
|
+
const errors = [], shots = [];
|
|
91
|
+
try {
|
|
92
|
+
browser = await chromium.launch({ args: [...KEYCHAIN_ARGS, '--mute-audio', '--use-angle=metal', '--ignore-gpu-blocklist'] });
|
|
93
|
+
const ctx = await browser.newContext({ viewport: { width: 390, height: 844 }, deviceScaleFactor: 3, isMobile: true, hasTouch: true,
|
|
94
|
+
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1' });
|
|
95
|
+
await saveFixture(ctx, { scope: 'device', key: 'devMode', data: true }); // experimental shards enter only in developer mode
|
|
96
|
+
// the probe's `pose` control needs the harness object (as the parity runner installs it)
|
|
97
|
+
await ctx.addInitScript(() => { window.__wildshardHarness = { seed: 0x2545f491, capture: null, lane: 'local', sha: '', browser: 'chromium', errors: [], saves: { read: [], written: [] }, audioRequests: [], gpuBytes: () => ({ textures: 0, renderbuffers: 0, buffers: 0, total: 0 }) }; });
|
|
98
|
+
const page = await ctx.newPage();
|
|
99
|
+
page.on('pageerror', (e) => errors.push(e.message.slice(0, 200)));
|
|
100
|
+
const t0 = Date.now();
|
|
101
|
+
await page.goto(`${URL_BASE}/?chunk=${SLUG}&tier=phone&touch=1&mute=1&nolock=1&sw=0&skipintro=1`, { waitUntil: 'domcontentloaded' });
|
|
102
|
+
await page.waitForFunction(() => document.documentElement.dataset.wsState === 'error'
|
|
103
|
+
|| (Boolean(window.__wildshard?.world?.player && window.__wildshard?.world?.game) && document.querySelector('.ws-load') === null),
|
|
104
|
+
undefined, { timeout: 480000, polling: 1000 });
|
|
105
|
+
// the game showed its error modal (a caught boot error leaves the load screen up): stop now with its text, not at 480 s
|
|
106
|
+
if (await page.evaluate(() => document.documentElement.dataset.wsState === 'error')) {
|
|
107
|
+
const text = await page.evaluate(() => document.body.textContent.slice(0, 600));
|
|
108
|
+
throw new Error(`the game failed to load (app state 'error'):\n${text}`);
|
|
109
|
+
}
|
|
110
|
+
const loadS = Math.round((Date.now() - t0) / 1000);
|
|
111
|
+
await sleep(6000);
|
|
112
|
+
store(await page.screenshot({ type: 'png' }), 'first-frame'); shots.push('first-frame');
|
|
113
|
+
// a free camera posed last in the frame (after the player's), the viewmodel hidden; null = the player's own view
|
|
114
|
+
await page.evaluate(() => {
|
|
115
|
+
const w = window.__wildshard.world, cam = w.game.camera;
|
|
116
|
+
try { w.animals.calm = true; } catch { /* a shard without animals */ }
|
|
117
|
+
window.__prog = null;
|
|
118
|
+
// what a free-camera shot changed, put back when the player's view returns (sky-reach, E399: after an aerial the
|
|
119
|
+
// viewmodel stayed hidden and the fov stayed 72 for every later first-person shot)
|
|
120
|
+
const hidden = new Set(); let fov = null;
|
|
121
|
+
w.game.onLate(() => {
|
|
122
|
+
const v = window.__prog;
|
|
123
|
+
if (!v) {
|
|
124
|
+
if (hidden.size > 0) { for (const c of hidden) c.visible = true; hidden.clear(); }
|
|
125
|
+
if (fov !== null) { cam.fov = fov; cam.updateProjectionMatrix(); fov = null; }
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (fov === null) fov = cam.fov;
|
|
129
|
+
cam.position.set(v.pos[0], v.pos[1], v.pos[2]); cam.up.set(0, 1, 0); cam.lookAt(v.look[0], v.look[1], v.look[2]);
|
|
130
|
+
if (Math.abs(cam.fov - v.fov) > 0.01) { cam.fov = v.fov; cam.updateProjectionMatrix(); }
|
|
131
|
+
for (const c of cam.children) if (c.visible) { c.visible = false; hidden.add(c); }
|
|
132
|
+
cam.updateMatrixWorld(true);
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
const hud = (on) => page.evaluate((v) => { const h = document.getElementById('hud'); if (h) h.style.visibility = v ? '' : 'hidden'; }, on);
|
|
136
|
+
const staged = {};
|
|
137
|
+
// each shot's real camera (round 4: a new knoll lifted a view 1.1 m with no cameras.json change, so the round's camera
|
|
138
|
+
// list missed it); the council's camera diff compares these, not only the requested poses
|
|
139
|
+
const camAt = {};
|
|
140
|
+
/** one progress shot: stage, pose (or a free camera), settle, check the floor, store; a re-take passes a longer settle
|
|
141
|
+
* @param {any} s @param {number} [settle] */
|
|
142
|
+
const shoot = async (s, settle) => {
|
|
143
|
+
// creatures are calmed so they don't fill the frame; a shot whose subject IS a creature in action (a boss's stalk)
|
|
144
|
+
// sets `"calm": false`, since calm cancels the behaviour (mockup council round 1, seat A)
|
|
145
|
+
await page.evaluate((calm) => { try { window.__wildshard.world.animals.calm = calm; } catch { /* no animals */ } }, s.calm !== false);
|
|
146
|
+
// E399: a shot may stage real quest state first (`stage`), through the shard's exposed handle (`expose` at the top of
|
|
147
|
+
// cameras.json): e.g. the waymarks lit, the state a player reaches. Recorded in meta.json for the council to check.
|
|
148
|
+
if (s.stage !== undefined) {
|
|
149
|
+
const ok = await page.evaluate(([name, stage]) => {
|
|
150
|
+
const h = window.__wildshard.shard?.[name];
|
|
151
|
+
if (typeof h?.stage !== 'function') return false;
|
|
152
|
+
h.stage(stage); return true;
|
|
153
|
+
}, [CAMS.expose, s.stage]);
|
|
154
|
+
if (!ok) errors.push(`shot ${s.id}: no stage() on __wildshard.shard.${String(CAMS.expose)}`);
|
|
155
|
+
staged[s.id] = s.stage;
|
|
156
|
+
}
|
|
157
|
+
if (s.god) {
|
|
158
|
+
await page.evaluate((g) => { window.__prog = g; }, { fov: 72, ...s.god }); await hud(false);
|
|
159
|
+
} else {
|
|
160
|
+
await page.evaluate(async (p) => { window.__prog = null; const pl = window.__wildshard.world.player; try { pl.health = pl.maxHealth ?? 100; } catch { /* */ } await window.__wildshard.pose(p); },
|
|
161
|
+
{ x: s.x, z: s.z, yaw: s.yaw * D, pitch: (s.pitch ?? -4) * D, ...(s.y === undefined ? {} : { y: s.y }) });
|
|
162
|
+
await hud(true);
|
|
163
|
+
}
|
|
164
|
+
await sleep(settle ?? s.settle ?? 3000);
|
|
165
|
+
if (!s.god) { // a pose with no floor under it falls and respawns: flag it rather than store a wrong frame silently
|
|
166
|
+
const at = await page.evaluate(() => { const q = window.__wildshard.world.player.position; return [q.x, q.z]; });
|
|
167
|
+
if (Math.hypot(at[0] - s.x, at[1] - s.z) > 4) errors.push(`shot ${s.id}: the player is at (${at.map((v) => v.toFixed(1)).join(', ')}), not (${s.x}, ${s.z}): no floor there?`);
|
|
168
|
+
}
|
|
169
|
+
camAt[s.id] = await page.evaluate(() => { const c = window.__wildshard.world.game.camera, d = c.getWorldDirection(c.position.clone()); return { pos: [c.position.x, c.position.y, c.position.z].map((v) => Math.round(v * 100) / 100), dir: [d.x, d.y, d.z].map((v) => Math.round(v * 1000) / 1000), fov: Math.round(c.fov * 10) / 10 }; }).catch(() => null);
|
|
170
|
+
store(await page.screenshot({ type: 'png' }), s.id);
|
|
171
|
+
};
|
|
172
|
+
for (const s of CAMS.shots) { await shoot(s); shots.push(s.id); }
|
|
173
|
+
// capture QA (E394): a frame that is not the 3D world is re-taken once, with a longer settle
|
|
174
|
+
/** @type {{ set: string, skipped: string | null, retaken: string[], shots: Record<string, any> }} */
|
|
175
|
+
const qa = { set: 'capture-status', skipped: QA ? null : '--no-qa', retaken: [], shots: {} };
|
|
176
|
+
if (QA) {
|
|
177
|
+
const first = checkFrames(shots, QA_FORCE);
|
|
178
|
+
qa.skipped = first.skipped; qa.shots = first.shots;
|
|
179
|
+
// first-frame is the spawn view before any pose, so it is recorded but not re-taken
|
|
180
|
+
const again = CAMS.shots.filter((/** @type {any} */ x) => first.shots[x.id]?.flagged);
|
|
181
|
+
for (const s of again) { await shoot(s, (s.settle ?? 3000) * 2 + 3000); qa.retaken.push(s.id); }
|
|
182
|
+
if (again.length > 0) {
|
|
183
|
+
const second = checkFrames(qa.retaken, []);
|
|
184
|
+
for (const id of qa.retaken) qa.shots[id] = { ...second.shots[id], firstTake: first.shots[id] };
|
|
185
|
+
if (second.skipped) qa.skipped = `re-take check: ${second.skipped}`;
|
|
186
|
+
}
|
|
187
|
+
const still = Object.entries(qa.shots).filter(([, v]) => v.flagged).map(([k]) => k);
|
|
188
|
+
if (still.length > 0) errors.push(`capture QA: not the 3D world after a re-take: ${still.join(', ')}`);
|
|
189
|
+
}
|
|
190
|
+
// the clip: a slow orbit, recorded from the canvas at its real resolution
|
|
191
|
+
if (CLIP && CAMS.clip) {
|
|
192
|
+
await hud(false);
|
|
193
|
+
const clip = await page.evaluate(recordProgressClip, CAMS.clip), webm = join(TMP, 'clip.webm');
|
|
194
|
+
try {
|
|
195
|
+
const sink = await browserBakeBytes(page, { maxBytes: Math.max(1, clip.bytes), maxFiles: 1 });
|
|
196
|
+
try {
|
|
197
|
+
await page.evaluate(uploadRecordedClip, { source: clip.url, destination: `${sink.url}clip` });
|
|
198
|
+
const bytes = sink.take('clip');
|
|
199
|
+
if (bytes.byteLength !== clip.bytes) throw new Error('Recorded clip byte count changed');
|
|
200
|
+
writeFileSync(webm, bytes);
|
|
201
|
+
} finally { await sink.dispose(); }
|
|
202
|
+
} finally { await page.evaluate(source => { URL.revokeObjectURL(source); }, clip.url); }
|
|
203
|
+
execFileSync('ffmpeg', ['-v', 'error', '-y', '-i', webm, '-vf', 'scale=540:-2,format=yuv420p', '-c:v', 'libx264', '-b:v', '900k', '-maxrate', '1200k', '-bufsize', '2400k', '-r', '30', '-movflags', '+faststart', join(OUT, 'clip.mp4')]);
|
|
204
|
+
}
|
|
205
|
+
// the compiled programs after every view was drawn (E397: a program-key collision shows up as a lower count)
|
|
206
|
+
const programs = await page.evaluate(() => window.__wildshard.world.game.renderer?.info?.programs?.length ?? null).catch(() => null);
|
|
207
|
+
writeFileSync(join(OUT, 'meta.json'), `${JSON.stringify({ shard: SLUG, sha: SHA, when, label: LABEL, loadSeconds: loadS, shots, clip: CLIP && Boolean(CAMS.clip), programs, staged, camAt, qa, active: CAMS.shots.filter((x) => x.calm === false).map((x) => x.id), cameras: execFileSync('git', ['hash-object', flag('cameras', join(ROOT, 'art', SLUG, 'progress', 'cameras.json'))], { encoding: 'utf8' }).trim(), pageErrors: errors }, null, 1)}\n`);
|
|
208
|
+
console.log(`progress: ${OUT.slice(ROOT.length + 1)} · ${shots.length} shots${CLIP && CAMS.clip ? ' + clip' : ''} · load ${loadS} s · qa ${qa.skipped ? `skipped (${qa.skipped})` : `${Object.values(qa.shots).filter((v) => v.flagged).length} flagged, re-taken: ${qa.retaken.join(', ') || 'none'}`}${errors.length > 0 ? ` · ${errors.length} page errors` : ''}`);
|
|
209
|
+
} finally {
|
|
210
|
+
try { await browser?.close(); }
|
|
211
|
+
finally { rmSync(TMP, { recursive: true, force: true }); }
|
|
212
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""shard-timelapse.py — the time-lapses of a shard being built (E387), from scripts/shard-progress.mjs captures.
|
|
3
|
+
|
|
4
|
+
python3 scripts/shard-timelapse.py <slug> [--secs=0.9]
|
|
5
|
+
|
|
6
|
+
Reads every progress/<slug>/<YYYYMMDD-HHMM>-<sha8>/ (oldest first) and writes, in progress/<slug>/:
|
|
7
|
+
timelapse-heroes.mp4 the four hero views (h1..h4) as a 2x2 grid per capture, captioned date · sha · label
|
|
8
|
+
timelapse-<shot>.mp4 one per shot id (first frame, each hero, the aerials)
|
|
9
|
+
clips.mp4 every capture's orbit clip, one after another, captioned
|
|
10
|
+
All 540 px wide portrait H.264 (Claude iOS plays them inline; ~1 Mb/s, the memory note on SendUserFile sizes).
|
|
11
|
+
A frame the capture's QA still flagged after its re-take (meta.json `qa`, E394: a loading screen, title card, menu or
|
|
12
|
+
blank frame) is left out.
|
|
13
|
+
"""
|
|
14
|
+
import glob, json, os, subprocess, sys, tempfile
|
|
15
|
+
from PIL import Image, ImageDraw, ImageFont
|
|
16
|
+
|
|
17
|
+
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
|
18
|
+
args = [a for a in sys.argv[1:] if not a.startswith('--')]
|
|
19
|
+
if not args:
|
|
20
|
+
sys.exit('usage: shard-timelapse.py <slug> [--secs=0.9]')
|
|
21
|
+
SLUG = args[0]
|
|
22
|
+
SECS = float(next((a.split('=', 1)[1] for a in sys.argv if a.startswith('--secs=')), '0.9'))
|
|
23
|
+
BASE = os.path.join(ROOT, 'progress', SLUG)
|
|
24
|
+
caps = sorted(d for d in glob.glob(os.path.join(BASE, '*-*')) if os.path.isdir(d) and os.path.exists(os.path.join(d, 'meta.json')))
|
|
25
|
+
if not caps:
|
|
26
|
+
sys.exit(f'no captures in progress/{SLUG}/ (run scripts/shard-progress.mjs first)')
|
|
27
|
+
metas = [json.load(open(os.path.join(d, 'meta.json'))) for d in caps]
|
|
28
|
+
FONT = '/System/Library/Fonts/Supplemental/Arial Bold.ttf'
|
|
29
|
+
font, small = ImageFont.truetype(FONT, 26), ImageFont.truetype(FONT, 20)
|
|
30
|
+
W, H = 540, 1168 # 390x844 portrait at 540 wide (even)
|
|
31
|
+
|
|
32
|
+
def flagged(m, s):
|
|
33
|
+
"""capture QA (E394): shard-progress.mjs could not get this shot to show the 3D world, even after a re-take"""
|
|
34
|
+
return bool(((m.get('qa') or {}).get('shots') or {}).get(s, {}).get('flagged'))
|
|
35
|
+
|
|
36
|
+
def caption(m, extra=''):
|
|
37
|
+
w = m['when']
|
|
38
|
+
return f"{w[0:4]}-{w[4:6]}-{w[6:8]} {w[9:11]}:{w[11:13]} · {m['sha'][:8]}" + (f" · {m['label']}" if m.get('label') else '') + (f' · {extra}' if extra else '')
|
|
39
|
+
|
|
40
|
+
def frame(img, m, i, n, title):
|
|
41
|
+
out = Image.new('RGB', (W, H), '#05070c')
|
|
42
|
+
im = img.copy(); im.thumbnail((W, H - 70))
|
|
43
|
+
out.paste(im, ((W - im.width) // 2, 0))
|
|
44
|
+
d = ImageDraw.Draw(out)
|
|
45
|
+
d.text((14, H - 62), title, font=font, fill='white')
|
|
46
|
+
d.text((14, H - 30), caption(m), font=small, fill=(170, 200, 225))
|
|
47
|
+
d.text((W - 14, H - 30), f'{i + 1}/{n}', font=small, fill=(170, 200, 225), anchor='ra')
|
|
48
|
+
return out
|
|
49
|
+
|
|
50
|
+
def encode(frames, out, secs=SECS):
|
|
51
|
+
with tempfile.TemporaryDirectory() as t:
|
|
52
|
+
lst = os.path.join(t, 'list.txt')
|
|
53
|
+
with open(lst, 'w') as f:
|
|
54
|
+
for k, fr in enumerate(frames):
|
|
55
|
+
p = os.path.join(t, f'{k:04d}.png'); fr.save(p)
|
|
56
|
+
f.write(f"file '{p}'\nduration {secs if k < len(frames) - 1 else 2.5}\n")
|
|
57
|
+
f.write(f"file '{p}'\n")
|
|
58
|
+
subprocess.run(['ffmpeg', '-v', 'error', '-y', '-f', 'concat', '-safe', '0', '-i', lst, '-vf', 'fps=30,format=yuv420p',
|
|
59
|
+
'-c:v', 'libx264', '-b:v', '900k', '-maxrate', '1200k', '-bufsize', '2400k', '-movflags', '+faststart', out], check=True)
|
|
60
|
+
print('wrote', os.path.relpath(out, ROOT), f'({len(frames)} frames)')
|
|
61
|
+
|
|
62
|
+
shot_ids = []
|
|
63
|
+
for m in metas:
|
|
64
|
+
for s in m['shots']:
|
|
65
|
+
if s not in shot_ids: shot_ids.append(s)
|
|
66
|
+
heroes = [s for s in shot_ids if s[:2] in ('h1', 'h2', 'h3', 'h4')][:4]
|
|
67
|
+
|
|
68
|
+
# the 2x2 hero grid
|
|
69
|
+
grid = []
|
|
70
|
+
for i, (d, m) in enumerate(zip(caps, metas)):
|
|
71
|
+
g = Image.new('RGB', (W, H - 70), '#05070c'); cw, ch = W // 2, (H - 70) // 2
|
|
72
|
+
for k, s in enumerate(heroes):
|
|
73
|
+
p = os.path.join(d, f'{s}.jpg')
|
|
74
|
+
if os.path.exists(p) and not flagged(m, s):
|
|
75
|
+
im = Image.open(p).convert('RGB'); im.thumbnail((cw, ch)); g.paste(im, ((k % 2) * cw + (cw - im.width) // 2, (k // 2) * ch))
|
|
76
|
+
grid.append(frame(g, m, i, len(caps), f'{SLUG} · the four hero views'))
|
|
77
|
+
encode(grid, os.path.join(BASE, 'timelapse-heroes.mp4'))
|
|
78
|
+
# one per shot
|
|
79
|
+
for s in shot_ids:
|
|
80
|
+
frames = [frame(Image.open(os.path.join(d, f'{s}.jpg')).convert('RGB'), m, i, len(caps), f'{SLUG} · {s}')
|
|
81
|
+
for i, (d, m) in enumerate(zip(caps, metas)) if os.path.exists(os.path.join(d, f'{s}.jpg')) and not flagged(m, s)]
|
|
82
|
+
if frames: encode(frames, os.path.join(BASE, f'timelapse-{s}.mp4'))
|
|
83
|
+
# the clips, captioned, one after another
|
|
84
|
+
clips = [(d, m) for d, m in zip(caps, metas) if os.path.exists(os.path.join(d, 'clip.mp4'))]
|
|
85
|
+
if clips:
|
|
86
|
+
with tempfile.TemporaryDirectory() as t:
|
|
87
|
+
parts = []
|
|
88
|
+
for k, (d, m) in enumerate(clips):
|
|
89
|
+
p = os.path.join(t, f'{k:03d}.mp4')
|
|
90
|
+
# the caption is a PIL overlay (this ffmpeg has no drawtext)
|
|
91
|
+
cap = Image.new('RGBA', (540, 44), (0, 0, 0, 140))
|
|
92
|
+
ImageDraw.Draw(cap).text((12, 11), caption(m), font=small, fill='white')
|
|
93
|
+
cp = os.path.join(t, f'{k:03d}.png'); cap.save(cp)
|
|
94
|
+
subprocess.run(['ffmpeg', '-v', 'error', '-y', '-i', os.path.join(d, 'clip.mp4'), '-i', cp, '-filter_complex',
|
|
95
|
+
'[0]scale=540:-2[v];[v][1]overlay=0:main_h-overlay_h,format=yuv420p',
|
|
96
|
+
'-an', '-c:v', 'libx264', '-b:v', '900k', '-r', '30', p], check=True)
|
|
97
|
+
parts.append(p)
|
|
98
|
+
lst = os.path.join(t, 'clips.txt')
|
|
99
|
+
with open(lst, 'w') as f: f.write(''.join(f"file '{p}'\n" for p in parts))
|
|
100
|
+
subprocess.run(['ffmpeg', '-v', 'error', '-y', '-f', 'concat', '-safe', '0', '-i', lst, '-c', 'copy', '-movflags', '+faststart',
|
|
101
|
+
os.path.join(BASE, 'clips.mp4')], check=True)
|
|
102
|
+
print('wrote', os.path.relpath(os.path.join(BASE, 'clips.mp4'), ROOT), f'({len(parts)} clips)')
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// C0 (J137): prove a real boot needs nothing shard-owned from the tree. A built output is served with its product folders
|
|
3
|
+
// and every mount answered from the shard's tarball alone; a request for any other file a shard's name owns is refused with
|
|
4
|
+
// a 404 and counted as a leak. Each shard then cold boots on the phone profile, to control, in a fresh context.
|
|
5
|
+
// scripts/browser-lane.sh node --import ./scripts/bake-loader.mjs scripts/shardfile-cold-boot.mjs \
|
|
6
|
+
// --dist=<built output> --tars=<folder of <slug>.tar> [--engine=webkit|chromium] <slug> …
|
|
7
|
+
import { KEYCHAIN_ARGS } from './chromium-keychain.mjs';
|
|
8
|
+
import { createServer } from 'node:http';
|
|
9
|
+
import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
|
10
|
+
import { brotliDecompressSync } from 'node:zlib';
|
|
11
|
+
import { extname, join, resolve as resolvePath } from 'node:path';
|
|
12
|
+
import { chromium, devices, webkit } from 'playwright';
|
|
13
|
+
import { readTar } from '@wildshard/format/tar';
|
|
14
|
+
|
|
15
|
+
const flag = name => process.argv.find(row => row.startsWith(`--${name}=`))?.slice(name.length + 3);
|
|
16
|
+
const dist = resolvePath(flag('dist') ?? 'dist'), tars = resolvePath(flag('tars') ?? 'tmp/shardfiles'), engine = flag('engine') ?? 'chromium';
|
|
17
|
+
const slugs = process.argv.slice(2).filter(row => !row.startsWith('--'));
|
|
18
|
+
const TYPES = { '.html': 'text/html', '.js': 'text/javascript', '.mjs': 'text/javascript', '.css': 'text/css', '.json': 'application/json', '.wasm': 'application/wasm', '.webmanifest': 'application/json' };
|
|
19
|
+
/** The names a shard's own files carry under /assets. A file directly in /assets is the bundle's own (thumbs, boot tables):
|
|
20
|
+
* those are the app's until C3's catalogue. */
|
|
21
|
+
const OWNED = /^\/assets\/(?:(?:gpu\/(?:baked\/)?|music\/|sfx\/|lut\/|baked\/|models\/)?(?:driftwood|far-reach|nalati|nine-dragon|pine-hollow|sunscar|open-plot))/u;
|
|
22
|
+
|
|
23
|
+
const shards = new Map();
|
|
24
|
+
for (const name of readdirSync(tars).filter(row => row.endsWith('.tar'))) {
|
|
25
|
+
const files = readTar(readFileSync(join(tars, name))), slug = name.slice(0, -4);
|
|
26
|
+
const data = files.get('cook.json'), mounts = data === undefined ? [] : JSON.parse(new TextDecoder().decode(data)).mounts;
|
|
27
|
+
shards.set(slug, { files, mounts: new Map(mounts.map(row => [row.url, row.path])) });
|
|
28
|
+
}
|
|
29
|
+
const tally = { tar: new Map(), leaks: [] };
|
|
30
|
+
const count = (slug) => { tally.tar.set(slug, (tally.tar.get(slug) ?? 0) + 1); };
|
|
31
|
+
/** The tarball that answers a path, if one does. */
|
|
32
|
+
function fromTarball(path) {
|
|
33
|
+
const product = /^\/(?:shardfiles|server-class)\/([^/]+)\/(.+)$/u.exec(path);
|
|
34
|
+
if (product !== null) {
|
|
35
|
+
const shard = shards.get(product[1] ?? ''), bytes = shard?.files.get(product[2] ?? '');
|
|
36
|
+
if (bytes !== undefined) { count(product[1]); return bytes; }
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
for (const [slug, shard] of shards) {
|
|
40
|
+
const held = shard.mounts.get(path);
|
|
41
|
+
if (held !== undefined) { count(slug); return shard.files.get(held); }
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
const server = createServer((request, response) => {
|
|
46
|
+
const path = decodeURIComponent(new URL(request.url ?? '/', 'http://localhost').pathname);
|
|
47
|
+
const held = fromTarball(path);
|
|
48
|
+
if (held !== undefined) { response.writeHead(200, { 'content-type': TYPES[extname(path)] ?? 'application/octet-stream' }).end(held); return; }
|
|
49
|
+
if (OWNED.test(path) && !/^\/assets\/[^/]+\.[a-z0-9]+$/u.test(path)) { tally.leaks.push(path); response.writeHead(404).end(); return; }
|
|
50
|
+
const file = join(dist, path === '/' ? 'index.html' : path.slice(1));
|
|
51
|
+
if (!file.startsWith(dist) || !existsSync(file) || !statSync(file).isFile()) { response.writeHead(404).end(); return; }
|
|
52
|
+
// A part is stored as its q11 body; the test browser accepts br, and a plain read keeps this server small.
|
|
53
|
+
const body = readFileSync(file), part = file.endsWith('.pack.br');
|
|
54
|
+
response.writeHead(200, { 'content-type': TYPES[extname(file)] ?? 'application/octet-stream', 'cache-control': 'no-store' }).end(part ? brotliDecompressSync(body) : body);
|
|
55
|
+
});
|
|
56
|
+
await new Promise(resolve => { server.listen(0, '127.0.0.1', resolve); });
|
|
57
|
+
const address = server.address(), origin = `http://127.0.0.1:${typeof address === 'object' && address !== null ? address.port : 0}`;
|
|
58
|
+
const browser = await (engine === 'webkit' ? webkit : chromium).launch({ headless: true, args: engine === 'webkit' ? [] : [...KEYCHAIN_ARGS, '--mute-audio'] });
|
|
59
|
+
const rows = [];
|
|
60
|
+
try {
|
|
61
|
+
for (const slug of slugs) {
|
|
62
|
+
tally.leaks.length = 0; tally.tar.delete(slug);
|
|
63
|
+
const context = await browser.newContext({ ...devices['iPhone 16 Pro'], serviceWorkers: 'block', ...(engine === 'webkit' ? {} : { isMobile: false, defaultBrowserType: 'chromium' }) });
|
|
64
|
+
const page = await context.newPage(), errors = [], started = Date.now();
|
|
65
|
+
page.on('pageerror', error => { errors.push(String(error).slice(0, 200)); });
|
|
66
|
+
page.on('response', response => { if (response.status() >= 400) errors.push(`${response.status()} ${new URL(response.url()).pathname}`); });
|
|
67
|
+
page.on('console', message => { if (message.type() === 'error') errors.push(message.text().slice(0, 200)); });
|
|
68
|
+
let control = false;
|
|
69
|
+
try {
|
|
70
|
+
await page.goto(`${origin}/?chunk=${slug}&tier=phone&skipintro=1&nolock=1&mute=1`, { waitUntil: 'load' });
|
|
71
|
+
await page.waitForFunction(() => window.__wildshard?.world?.hud?.entered === true, undefined, { timeout: Number(flag('timeout') ?? 150_000) });
|
|
72
|
+
control = true;
|
|
73
|
+
} catch (error) { errors.push(String(error).slice(0, 160)); }
|
|
74
|
+
rows.push({ slug, control, seconds: Math.round((Date.now() - started) / 1000), fromTarball: tally.tar.get(slug) ?? 0, leaks: [...new Set(tally.leaks)], errors: [...new Set(errors)].slice(0, 6) });
|
|
75
|
+
console.log(JSON.stringify(rows.at(-1)));
|
|
76
|
+
await context.close();
|
|
77
|
+
}
|
|
78
|
+
} finally { await browser.close(); server.close(); }
|
|
79
|
+
if (rows.some(row => !row.control || row.leaks.length > 0)) process.exitCode = 1;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Trusted compiler bridge: Rolldown reads source in Rust, outside Node fs hooks.
|
|
2
|
+
import { build as viteBuild } from 'vite';
|
|
3
|
+
import { recordBundle, inputRecorderPlugin } from '@wildshard/engine/scripts/shardfile-inputs.mjs';
|
|
4
|
+
import * as v from 'valibot';
|
|
5
|
+
|
|
6
|
+
// Explicit compiler intent: this bundle executes in Node and its JavaScript
|
|
7
|
+
// is never copied into a product. Ordinary runtime bundles keep exact bytes.
|
|
8
|
+
const Execution = v.object({name:v.literal('wildshard-author-execution'),api:v.object({wildshardInputIdentity:v.literal('execution')})});
|
|
9
|
+
|
|
10
|
+
export { parseSync } from 'vite';
|
|
11
|
+
/** @param {import('vite').InlineConfig} options */
|
|
12
|
+
export async function build(options) {
|
|
13
|
+
const execution=options.plugins?.some(plugin=>v.is(Execution,plugin))===true;
|
|
14
|
+
const started = performance.now();
|
|
15
|
+
const result = await viteBuild({...options,plugins:[inputRecorderPlugin({execution}),...(options.plugins ?? [])]});
|
|
16
|
+
recordBundle(result,{execution});
|
|
17
|
+
const library = options.build?.lib;
|
|
18
|
+
if (process.env.GITHUB_ACTIONS === 'true') console.info(`author timing: ${JSON.stringify({ pid: process.pid, phase: 'project-bundle', entry: library === undefined || library === false ? null : library.entry, execution, seconds: Number(((performance.now() - started) / 1000).toFixed(3)) })}`);
|
|
19
|
+
return result;
|
|
20
|
+
}
|