@playdrop/playdrop-cli 0.16.12 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/client-meta.json +4 -4
- package/dist/apiClient.d.ts +1 -2
- package/dist/apiClient.js +1 -16
- package/dist/appUrls.js +4 -0
- package/dist/apps/build.d.ts +12 -4
- package/dist/apps/build.js +55 -22
- package/dist/apps/index.d.ts +2 -1
- package/dist/apps/index.js +4 -1
- package/dist/apps/loadCheck.d.ts +5 -1
- package/dist/apps/loadCheck.js +52 -18
- package/dist/apps/serverBuild.d.ts +17 -0
- package/dist/apps/serverBuild.js +155 -0
- package/dist/apps/staticHtml.d.ts +1 -0
- package/dist/apps/staticHtml.js +19 -10
- package/dist/apps/upload.d.ts +12 -2
- package/dist/apps/upload.js +127 -46
- package/dist/catalogue.d.ts +23 -1
- package/dist/catalogue.js +126 -100
- package/dist/commandContext.d.ts +6 -3
- package/dist/commandContext.js +108 -18
- package/dist/commands/build.js +0 -7
- package/dist/commands/captureListing.d.ts +3 -0
- package/dist/commands/captureListing.js +48 -4
- package/dist/commands/chat.d.ts +4 -7
- package/dist/commands/chat.js +165 -77
- package/dist/commands/check.js +34 -1
- package/dist/commands/create.js +30 -263
- package/dist/commands/dev.js +37 -3
- package/dist/commands/devBrowser.js +2 -2
- package/dist/commands/devGameServer.d.ts +16 -0
- package/dist/commands/devGameServer.js +237 -0
- package/dist/commands/devRuntimeAssets.d.ts +1 -0
- package/dist/commands/devRuntimeAssets.js +2 -0
- package/dist/commands/devServer.d.ts +3 -0
- package/dist/commands/devServer.js +111 -5
- package/dist/commands/generation.d.ts +33 -4
- package/dist/commands/generation.js +304 -115
- package/dist/commands/login.js +23 -7
- package/dist/commands/review.d.ts +1 -1
- package/dist/commands/review.js +68 -95
- package/dist/commands/source.d.ts +19 -0
- package/dist/commands/source.js +142 -0
- package/dist/commands/tweaks.js +5 -11
- package/dist/commands/upload-content.d.ts +1 -1
- package/dist/commands/upload-content.js +16 -12
- package/dist/commands/upload.d.ts +17 -1
- package/dist/commands/upload.js +47 -10
- package/dist/commands/worker/archive-staging.d.ts +1 -0
- package/dist/commands/worker/archive-staging.js +13 -2
- package/dist/commands/worker/e2e-fixtures.d.ts +32 -0
- package/dist/commands/worker/e2e-fixtures.js +466 -0
- package/dist/commands/worker/game-server-infra.d.ts +80 -0
- package/dist/commands/worker/game-server-infra.js +595 -0
- package/dist/commands/worker/game-source-git.d.ts +126 -0
- package/dist/commands/worker/game-source-git.js +780 -0
- package/dist/commands/worker/generation.d.ts +94 -0
- package/dist/commands/worker/generation.js +1458 -0
- package/dist/commands/worker/provider-telemetry.js +1 -1
- package/dist/commands/worker/runtime.d.ts +8 -10
- package/dist/commands/worker/runtime.js +53 -48
- package/dist/commands/worker.d.ts +79 -19
- package/dist/commands/worker.js +1796 -419
- package/dist/config.d.ts +2 -0
- package/dist/config.js +16 -3
- package/dist/environment.d.ts +0 -1
- package/dist/environment.js +0 -8
- package/dist/index.js +92 -22
- package/dist/workerAppProject.d.ts +1 -1
- package/dist/workerAppProject.js +15 -2
- package/node_modules/@playdrop/api-client/dist/client.d.ts +143 -39
- package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/client.js +33 -0
- package/node_modules/@playdrop/api-client/dist/core/request.d.ts +1 -0
- package/node_modules/@playdrop/api-client/dist/core/request.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/core/request.js +17 -11
- package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.d.ts +51 -6
- package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.js +338 -41
- package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts +24 -1
- package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/ai.js +20 -0
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts +13 -8
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/apps.js +158 -90
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts +4 -0
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/assets.js +27 -0
- package/node_modules/@playdrop/api-client/dist/domains/chat.d.ts +152 -21
- package/node_modules/@playdrop/api-client/dist/domains/chat.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/chat.js +477 -100
- package/node_modules/@playdrop/api-client/dist/domains/player-meta.d.ts +2 -1
- package/node_modules/@playdrop/api-client/dist/domains/player-meta.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/player-meta.js +9 -0
- package/node_modules/@playdrop/api-client/dist/domains/playtrade.d.ts +1 -2
- package/node_modules/@playdrop/api-client/dist/domains/playtrade.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/playtrade.js +0 -11
- package/node_modules/@playdrop/api-client/dist/domains/social.d.ts +29 -0
- package/node_modules/@playdrop/api-client/dist/domains/social.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/social.js +79 -0
- package/node_modules/@playdrop/api-client/dist/index.d.ts +81 -30
- package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/index.js +217 -56
- package/node_modules/@playdrop/api-client/dist/runtime.d.ts +18 -0
- package/node_modules/@playdrop/api-client/dist/runtime.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/runtime.js +54 -0
- package/node_modules/@playdrop/api-client/package.json +7 -0
- package/node_modules/@playdrop/config/client-meta.json +4 -4
- package/node_modules/@playdrop/config/dist/src/creator-plans.d.ts +11 -0
- package/node_modules/@playdrop/config/dist/src/creator-plans.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/creator-plans.js +13 -1
- package/node_modules/@playdrop/config/dist/src/deployment.d.ts +0 -1
- package/node_modules/@playdrop/config/dist/src/deployment.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/deployment.js +0 -8
- package/node_modules/@playdrop/config/dist/src/public-deployment.d.ts +0 -1
- package/node_modules/@playdrop/config/dist/src/public-deployment.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/public-deployment.js +0 -8
- package/node_modules/@playdrop/config/dist/src/runtime-service-origins.d.ts +1 -1
- package/node_modules/@playdrop/config/dist/src/runtime-service-origins.js +2 -2
- package/node_modules/@playdrop/config/dist/src/server/logging.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/server/logging.js +31 -2
- package/node_modules/@playdrop/config/dist/test/creator-plans.test.js +10 -0
- package/node_modules/@playdrop/config/dist/test/deployment.test.js +0 -4
- package/node_modules/@playdrop/config/dist/test/runtime-service-origins.test.js +2 -0
- package/node_modules/@playdrop/config/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@playdrop/config/package.json +6 -0
- package/node_modules/@playdrop/game-source-git/dist/src/archive.d.ts +9 -0
- package/node_modules/@playdrop/game-source-git/dist/src/archive.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/archive.js +107 -0
- package/node_modules/@playdrop/game-source-git/dist/src/bundle-storage.d.ts +29 -0
- package/node_modules/@playdrop/game-source-git/dist/src/bundle-storage.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/bundle-storage.js +64 -0
- package/node_modules/@playdrop/game-source-git/dist/src/export.d.ts +8 -0
- package/node_modules/@playdrop/game-source-git/dist/src/export.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/export.js +25 -0
- package/node_modules/@playdrop/game-source-git/dist/src/git.d.ts +39 -0
- package/node_modules/@playdrop/game-source-git/dist/src/git.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/git.js +195 -0
- package/node_modules/@playdrop/game-source-git/dist/src/ignore.d.ts +6 -0
- package/node_modules/@playdrop/game-source-git/dist/src/ignore.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/ignore.js +51 -0
- package/node_modules/@playdrop/game-source-git/dist/src/index.d.ts +10 -0
- package/node_modules/@playdrop/game-source-git/dist/src/index.d.ts.map +1 -0
- package/node_modules/@playdrop/{boxel-core/dist/src/humanoid/r15 → game-source-git/dist/src}/index.js +9 -4
- package/node_modules/@playdrop/game-source-git/dist/src/lock.d.ts +17 -0
- package/node_modules/@playdrop/game-source-git/dist/src/lock.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/lock.js +72 -0
- package/node_modules/@playdrop/game-source-git/dist/src/materialize.d.ts +10 -0
- package/node_modules/@playdrop/game-source-git/dist/src/materialize.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/materialize.js +99 -0
- package/node_modules/@playdrop/game-source-git/dist/src/paths.d.ts +24 -0
- package/node_modules/@playdrop/game-source-git/dist/src/paths.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/paths.js +207 -0
- package/node_modules/@playdrop/game-source-git/dist/src/repository.d.ts +66 -0
- package/node_modules/@playdrop/game-source-git/dist/src/repository.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/repository.js +213 -0
- package/node_modules/@playdrop/game-source-git/dist/test/core.test.d.ts +2 -0
- package/node_modules/@playdrop/game-source-git/dist/test/core.test.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/test/core.test.js +441 -0
- package/node_modules/@playdrop/game-source-git/dist/tsconfig.tsbuildinfo +1 -0
- package/node_modules/@playdrop/game-source-git/package.json +28 -0
- package/node_modules/@playdrop/types/dist/agent-task-terminal.d.ts +2 -2
- package/node_modules/@playdrop/types/dist/agent-task-terminal.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/agent-task-terminal.js +15 -9
- package/node_modules/@playdrop/types/dist/api.d.ts +730 -166
- package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/api.js +65 -18
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts +2 -0
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/asset.d.ts +22 -8
- package/node_modules/@playdrop/types/dist/asset.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/asset.js +26 -26
- package/node_modules/@playdrop/types/dist/chat.d.ts +273 -31
- package/node_modules/@playdrop/types/dist/chat.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/chat.js +38 -4
- package/node_modules/@playdrop/types/dist/index.d.ts +3 -0
- package/node_modules/@playdrop/types/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/index.js +7 -1
- package/node_modules/@playdrop/types/dist/public-cache-tags.d.ts +11 -0
- package/node_modules/@playdrop/types/dist/public-cache-tags.d.ts.map +1 -0
- package/node_modules/@playdrop/types/dist/public-cache-tags.js +78 -0
- package/node_modules/@playdrop/types/dist/realtime.d.ts +3 -15
- package/node_modules/@playdrop/types/dist/realtime.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/social.d.ts +64 -0
- package/node_modules/@playdrop/types/dist/social.d.ts.map +1 -0
- package/node_modules/@playdrop/{boxel-three/dist/src/types.js → types/dist/social.js} +14 -2
- package/node_modules/@playdrop/types/dist/spritesheet.d.ts +51 -0
- package/node_modules/@playdrop/types/dist/spritesheet.d.ts.map +1 -0
- package/node_modules/@playdrop/types/dist/spritesheet.js +73 -0
- package/node_modules/@playdrop/types/dist/version.d.ts +86 -58
- package/node_modules/@playdrop/types/dist/version.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/version.js +111 -0
- package/node_modules/@playdrop/types/package.json +14 -0
- package/node_modules/@playdrop/vox-three/dist/src/index.d.ts +1 -1
- package/node_modules/@playdrop/vox-three/dist/src/index.js +1 -1
- package/node_modules/@playdrop/vox-three/dist/src/index.js.map +1 -1
- package/node_modules/@playdrop/vox-three/dist/src/vox.d.ts +0 -3
- package/node_modules/@playdrop/vox-three/dist/src/vox.js +0 -110
- package/node_modules/@playdrop/vox-three/dist/src/vox.js.map +1 -1
- package/node_modules/@playdrop/vox-three/dist/test/vox.test.js +0 -18
- package/node_modules/@playdrop/vox-three/dist/test/vox.test.js.map +1 -1
- package/node_modules/@playdrop/vox-three/package.json +8 -4
- package/package.json +9 -11
- package/dist/assets/model-artifacts.d.ts +0 -8
- package/dist/assets/model-artifacts.js +0 -382
- package/dist/assets/model-worker.d.ts +0 -22
- package/dist/assets/model-worker.js +0 -123
- package/node_modules/@playdrop/ai-client/dist/index.d.ts +0 -441
- package/node_modules/@playdrop/ai-client/dist/index.d.ts.map +0 -1
- package/node_modules/@playdrop/ai-client/dist/index.js +0 -499
- package/node_modules/@playdrop/ai-client/package.json +0 -22
- package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.d.ts +0 -13
- package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.js +0 -141
- package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.d.ts +0 -47
- package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.js +0 -313
- package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/format-utils.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/format-utils.js +0 -36
- package/node_modules/@playdrop/boxel-core/dist/src/format-utils.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/geometry.d.ts +0 -23
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/geometry.js +0 -11
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/geometry.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/index.d.ts +0 -4
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/index.js +0 -21
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/common.d.ts +0 -4
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/common.js +0 -24
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/common.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/index.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.js +0 -387
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/types.d.ts +0 -6
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/types.js +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/types.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.js +0 -373
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.d.ts +0 -12
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.js +0 -215
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/index.d.ts +0 -4
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/index.js +0 -18
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.d.ts +0 -42
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.js +0 -145
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/artifacts.d.ts +0 -26
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/artifacts.js +0 -65
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/artifacts.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.d.ts +0 -33
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.js +0 -175
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/humanoid_r15.json +0 -1517
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/humanoid_r6.json +0 -61
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/index.d.ts +0 -10
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/index.js +0 -23
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/index.d.ts +0 -19
- package/node_modules/@playdrop/boxel-core/dist/src/index.js +0 -36
- package/node_modules/@playdrop/boxel-core/dist/src/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/materials.d.ts +0 -26
- package/node_modules/@playdrop/boxel-core/dist/src/materials.js +0 -184
- package/node_modules/@playdrop/boxel-core/dist/src/materials.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.d.ts +0 -68
- package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.js +0 -488
- package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/serialization.d.ts +0 -4
- package/node_modules/@playdrop/boxel-core/dist/src/serialization.js +0 -380
- package/node_modules/@playdrop/boxel-core/dist/src/serialization.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/textures.d.ts +0 -29
- package/node_modules/@playdrop/boxel-core/dist/src/textures.js +0 -208
- package/node_modules/@playdrop/boxel-core/dist/src/textures.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.d.ts +0 -9
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.js +0 -312
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.d.ts +0 -9
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.js +0 -154
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.d.ts +0 -2
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.js +0 -121
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.d.ts +0 -20
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.js +0 -389
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.js +0 -206
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.d.ts +0 -12
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.js +0 -81
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.d.ts +0 -12
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.js +0 -318
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/types.d.ts +0 -168
- package/node_modules/@playdrop/boxel-core/dist/src/types.js +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/types.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/validation.d.ts +0 -24
- package/node_modules/@playdrop/boxel-core/dist/src/validation.js +0 -620
- package/node_modules/@playdrop/boxel-core/dist/src/validation.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.d.ts +0 -11
- package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.js +0 -135
- package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/voxels.d.ts +0 -23
- package/node_modules/@playdrop/boxel-core/dist/src/voxels.js +0 -52
- package/node_modules/@playdrop/boxel-core/dist/src/voxels.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/package.json +0 -19
- package/node_modules/@playdrop/boxel-three/dist/src/animations.d.ts +0 -4
- package/node_modules/@playdrop/boxel-three/dist/src/animations.js +0 -92
- package/node_modules/@playdrop/boxel-three/dist/src/builders.d.ts +0 -8
- package/node_modules/@playdrop/boxel-three/dist/src/builders.js +0 -363
- package/node_modules/@playdrop/boxel-three/dist/src/context.d.ts +0 -24
- package/node_modules/@playdrop/boxel-three/dist/src/context.js +0 -58
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/glb.d.ts +0 -100
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/glb.js +0 -927
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/image.d.ts +0 -18
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/image.js +0 -294
- package/node_modules/@playdrop/boxel-three/dist/src/index.d.ts +0 -17
- package/node_modules/@playdrop/boxel-three/dist/src/index.js +0 -64
- package/node_modules/@playdrop/boxel-three/dist/src/instantiate.d.ts +0 -40
- package/node_modules/@playdrop/boxel-three/dist/src/instantiate.js +0 -96
- package/node_modules/@playdrop/boxel-three/dist/src/nodes.d.ts +0 -8
- package/node_modules/@playdrop/boxel-three/dist/src/nodes.js +0 -88
- package/node_modules/@playdrop/boxel-three/dist/src/overlays.d.ts +0 -7
- package/node_modules/@playdrop/boxel-three/dist/src/overlays.js +0 -123
- package/node_modules/@playdrop/boxel-three/dist/src/primitives.d.ts +0 -4
- package/node_modules/@playdrop/boxel-three/dist/src/primitives.js +0 -48
- package/node_modules/@playdrop/boxel-three/dist/src/scene.d.ts +0 -3
- package/node_modules/@playdrop/boxel-three/dist/src/scene.js +0 -168
- package/node_modules/@playdrop/boxel-three/dist/src/skinned-mesh.d.ts +0 -29
- package/node_modules/@playdrop/boxel-three/dist/src/skinned-mesh.js +0 -623
- package/node_modules/@playdrop/boxel-three/dist/src/texture-atlas.d.ts +0 -13
- package/node_modules/@playdrop/boxel-three/dist/src/texture-atlas.js +0 -133
- package/node_modules/@playdrop/boxel-three/dist/src/textures.d.ts +0 -17
- package/node_modules/@playdrop/boxel-three/dist/src/textures.js +0 -216
- package/node_modules/@playdrop/boxel-three/dist/src/types.d.ts +0 -112
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/faces.d.ts +0 -28
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/faces.js +0 -344
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/mesher.d.ts +0 -24
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/mesher.js +0 -113
- package/node_modules/@playdrop/boxel-three/dist/test/export-image.playwright.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/export-image.playwright.test.js +0 -137
- package/node_modules/@playdrop/boxel-three/dist/test/fixtures/render-worker.d.ts +0 -20
- package/node_modules/@playdrop/boxel-three/dist/test/fixtures/render-worker.js +0 -85
- package/node_modules/@playdrop/boxel-three/dist/test/glb-skinned.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/glb-skinned.test.js +0 -104
- package/node_modules/@playdrop/boxel-three/dist/test/index.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/index.test.js +0 -30
- package/node_modules/@playdrop/boxel-three/dist/test/instantiate.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/instantiate.test.js +0 -88
- package/node_modules/@playdrop/boxel-three/dist/test/overlays.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/overlays.test.js +0 -42
- package/node_modules/@playdrop/boxel-three/dist/test/scene-filter.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/scene-filter.test.js +0 -73
- package/node_modules/@playdrop/boxel-three/dist/test/scene-smoke.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/scene-smoke.test.js +0 -85
- package/node_modules/@playdrop/boxel-three/dist/test/skinned-mesh.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/skinned-mesh.test.js +0 -73
- package/node_modules/@playdrop/boxel-three/dist/test/textured-overlay.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/textured-overlay.test.js +0 -136
- package/node_modules/@playdrop/boxel-three/dist/test/voxels.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/voxels.test.js +0 -42
- package/node_modules/@playdrop/boxel-three/package.json +0 -28
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.WORKER_REDIS_RUNTIME_COMMANDS = exports.WORKER_MONGODB_VERSION = exports.WORKER_REDIS_VERSION = void 0;
|
|
7
|
+
exports.resolveManagedWorkerGameServerPaths = resolveManagedWorkerGameServerPaths;
|
|
8
|
+
exports.installManagedWorkerGameServerToolchains = installManagedWorkerGameServerToolchains;
|
|
9
|
+
exports.writeManagedWorkerGameServerConfiguration = writeManagedWorkerGameServerConfiguration;
|
|
10
|
+
exports.buildManagedWorkerGameServerLaunchAgents = buildManagedWorkerGameServerLaunchAgents;
|
|
11
|
+
exports.syncManagedWorkerGameServerLaunchAgents = syncManagedWorkerGameServerLaunchAgents;
|
|
12
|
+
exports.setupManagedWorkerGameServerInfrastructure = setupManagedWorkerGameServerInfrastructure;
|
|
13
|
+
exports.probeManagedWorkerGameServerInfrastructure = probeManagedWorkerGameServerInfrastructure;
|
|
14
|
+
exports.cleanupStaleWorkerGameServerDevResources = cleanupStaleWorkerGameServerDevResources;
|
|
15
|
+
exports.provisionWorkerGameServerDevLease = provisionWorkerGameServerDevLease;
|
|
16
|
+
const node_child_process_1 = require("node:child_process");
|
|
17
|
+
const node_crypto_1 = require("node:crypto");
|
|
18
|
+
const node_fs_1 = require("node:fs");
|
|
19
|
+
const node_os_1 = require("node:os");
|
|
20
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
21
|
+
const mongodb_1 = require("mongodb");
|
|
22
|
+
const ioredis_1 = require("ioredis");
|
|
23
|
+
exports.WORKER_REDIS_VERSION = "7.4.5";
|
|
24
|
+
exports.WORKER_MONGODB_VERSION = "8.0.26";
|
|
25
|
+
const WORKER_REDIS_ARCHIVE_SHA256 = "00bb280528f5d7934bec8ab309b8125088c209131e10609cb1563b91365633bb";
|
|
26
|
+
const WORKER_MONGODB_ARCHIVE_SHA256 = "49f93af3935632d8ca460584166e07fb7d00fb1c2173544851df453edfdb14a3";
|
|
27
|
+
const WORKER_REDIS_ARCHIVE_URL = `https://download.redis.io/releases/redis-${exports.WORKER_REDIS_VERSION}.tar.gz`;
|
|
28
|
+
const WORKER_MONGODB_ARCHIVE_URL = `https://fastdl.mongodb.org/osx/mongodb-macos-arm64-${exports.WORKER_MONGODB_VERSION}.tgz`;
|
|
29
|
+
const WORKER_REDIS_PORT = 6390;
|
|
30
|
+
const WORKER_MONGODB_PORT = 27018;
|
|
31
|
+
const WORKER_MONGODB_REPLICA_SET = "playdrop-worker-rs0";
|
|
32
|
+
const WORKER_INFRA_SCHEMA_VERSION = 1;
|
|
33
|
+
exports.WORKER_REDIS_RUNTIME_COMMANDS = [
|
|
34
|
+
"+auth",
|
|
35
|
+
"+select",
|
|
36
|
+
"+ping",
|
|
37
|
+
"+quit",
|
|
38
|
+
"+info",
|
|
39
|
+
"+client|setinfo",
|
|
40
|
+
"+client|setname",
|
|
41
|
+
"+publish",
|
|
42
|
+
"+subscribe",
|
|
43
|
+
"+unsubscribe",
|
|
44
|
+
"+pubsub",
|
|
45
|
+
"+get",
|
|
46
|
+
"+set",
|
|
47
|
+
"+setex",
|
|
48
|
+
"+expire",
|
|
49
|
+
"+del",
|
|
50
|
+
"+exists",
|
|
51
|
+
"+sadd",
|
|
52
|
+
"+smembers",
|
|
53
|
+
"+sismember",
|
|
54
|
+
"+srem",
|
|
55
|
+
"+scard",
|
|
56
|
+
"+sinter",
|
|
57
|
+
"+hset",
|
|
58
|
+
"+hincrby",
|
|
59
|
+
"+hget",
|
|
60
|
+
"+hgetall",
|
|
61
|
+
"+hdel",
|
|
62
|
+
"+hlen",
|
|
63
|
+
"+hexists",
|
|
64
|
+
"+incr",
|
|
65
|
+
"+decr",
|
|
66
|
+
"+llen",
|
|
67
|
+
"+rpush",
|
|
68
|
+
"+lpush",
|
|
69
|
+
"+rpop",
|
|
70
|
+
"+lpop",
|
|
71
|
+
"+brpop",
|
|
72
|
+
"+multi",
|
|
73
|
+
"+exec",
|
|
74
|
+
];
|
|
75
|
+
;
|
|
76
|
+
;
|
|
77
|
+
function requireAbsoluteWorkerHome(workerHomeDir) {
|
|
78
|
+
const normalized = workerHomeDir.trim();
|
|
79
|
+
if (!normalized || !node_path_1.default.isAbsolute(normalized))
|
|
80
|
+
throw new Error("worker_game_server_home_invalid");
|
|
81
|
+
return normalized;
|
|
82
|
+
}
|
|
83
|
+
function resolveManagedWorkerGameServerPaths(workerHomeDir) {
|
|
84
|
+
const workerHome = requireAbsoluteWorkerHome(workerHomeDir);
|
|
85
|
+
const root = node_path_1.default.join(workerHome, "game-server");
|
|
86
|
+
const toolchainsRoot = node_path_1.default.join(workerHome, "toolchains");
|
|
87
|
+
const redisRoot = node_path_1.default.join(toolchainsRoot, `redis-${exports.WORKER_REDIS_VERSION}`);
|
|
88
|
+
const mongoRoot = node_path_1.default.join(toolchainsRoot, `mongodb-macos-aarch64--${exports.WORKER_MONGODB_VERSION}`);
|
|
89
|
+
return {
|
|
90
|
+
root,
|
|
91
|
+
toolchainsRoot,
|
|
92
|
+
redisRoot,
|
|
93
|
+
redisBinary: node_path_1.default.join(redisRoot, "src", "redis-server"),
|
|
94
|
+
redisCliBinary: node_path_1.default.join(redisRoot, "src", "redis-cli"),
|
|
95
|
+
mongoRoot,
|
|
96
|
+
mongodBinary: node_path_1.default.join(mongoRoot, "bin", "mongod"),
|
|
97
|
+
credentialsPath: node_path_1.default.join(root, "credentials.json"),
|
|
98
|
+
redisConfigPath: node_path_1.default.join(root, "redis.conf"),
|
|
99
|
+
redisAclPath: node_path_1.default.join(root, "redis.acl"),
|
|
100
|
+
mongoConfigPath: node_path_1.default.join(root, "mongod.conf"),
|
|
101
|
+
mongoKeyFilePath: node_path_1.default.join(root, "mongodb-keyfile"),
|
|
102
|
+
redisDataPath: node_path_1.default.join(root, "redis"),
|
|
103
|
+
mongoDataPath: node_path_1.default.join(root, "mongodb"),
|
|
104
|
+
logsPath: node_path_1.default.join(root, "logs"),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function sha256(bytes) {
|
|
108
|
+
return (0, node_crypto_1.createHash)("sha256").update(bytes).digest("hex");
|
|
109
|
+
}
|
|
110
|
+
async function downloadVerifiedArchive(input) {
|
|
111
|
+
const response = await fetch(input.url, { signal: AbortSignal.timeout(5 * 60000) });
|
|
112
|
+
if (!response.ok)
|
|
113
|
+
throw new Error(`worker_game_server_toolchain_download_failed:${response.status}`);
|
|
114
|
+
const bytes = Buffer.from(await response.arrayBuffer());
|
|
115
|
+
const actual = sha256(bytes);
|
|
116
|
+
if (actual !== input.sha256) {
|
|
117
|
+
throw new Error(`worker_game_server_toolchain_hash_mismatch:expected=${input.sha256}:actual=${actual}`);
|
|
118
|
+
}
|
|
119
|
+
(0, node_fs_1.writeFileSync)(input.destination, bytes, { mode: 0o600 });
|
|
120
|
+
}
|
|
121
|
+
function readRedisVersion(binary) {
|
|
122
|
+
const result = (0, node_child_process_1.spawnSync)(binary, ["--version"], { encoding: "utf8" });
|
|
123
|
+
if (result.status !== 0)
|
|
124
|
+
return null;
|
|
125
|
+
return /\bv=([^\s]+)/u.exec(result.stdout)?.[1] ?? null;
|
|
126
|
+
}
|
|
127
|
+
function readMongoVersion(binary) {
|
|
128
|
+
const result = (0, node_child_process_1.spawnSync)(binary, ["--version"], { encoding: "utf8" });
|
|
129
|
+
if (result.status !== 0)
|
|
130
|
+
return null;
|
|
131
|
+
return /db version v([^\s]+)/u.exec(result.stdout)?.[1] ?? null;
|
|
132
|
+
}
|
|
133
|
+
async function installManagedWorkerGameServerToolchains(input) {
|
|
134
|
+
const platform = input.platform ?? process.platform;
|
|
135
|
+
const architecture = input.architecture ?? process.arch;
|
|
136
|
+
if (platform !== "darwin" || architecture !== "arm64") {
|
|
137
|
+
throw new Error("worker_game_server_toolchain_unsupported: managed game-server workers require Apple silicon macOS");
|
|
138
|
+
}
|
|
139
|
+
const paths = resolveManagedWorkerGameServerPaths(input.workerHomeDir);
|
|
140
|
+
(0, node_fs_1.mkdirSync)(paths.toolchainsRoot, { recursive: true, mode: 0o700 });
|
|
141
|
+
if (readRedisVersion(paths.redisBinary) !== exports.WORKER_REDIS_VERSION) {
|
|
142
|
+
const temporaryRoot = node_path_1.default.join((0, node_os_1.tmpdir)(), `playdrop-worker-redis-${process.pid}-${Date.now()}`);
|
|
143
|
+
const archive = `${temporaryRoot}.tar.gz`;
|
|
144
|
+
(0, node_fs_1.rmSync)(temporaryRoot, { recursive: true, force: true });
|
|
145
|
+
try {
|
|
146
|
+
await downloadVerifiedArchive({
|
|
147
|
+
url: WORKER_REDIS_ARCHIVE_URL,
|
|
148
|
+
sha256: WORKER_REDIS_ARCHIVE_SHA256,
|
|
149
|
+
destination: archive,
|
|
150
|
+
});
|
|
151
|
+
(0, node_fs_1.mkdirSync)(temporaryRoot, { recursive: true, mode: 0o700 });
|
|
152
|
+
(0, node_child_process_1.execFileSync)("/usr/bin/tar", ["-xzf", archive, "-C", temporaryRoot], { stdio: "inherit" });
|
|
153
|
+
const extracted = node_path_1.default.join(temporaryRoot, `redis-${exports.WORKER_REDIS_VERSION}`);
|
|
154
|
+
(0, node_child_process_1.execFileSync)("/usr/bin/make", ["-C", extracted, "-j4", "BUILD_TLS=no"], { stdio: "inherit" });
|
|
155
|
+
(0, node_fs_1.rmSync)(paths.redisRoot, { recursive: true, force: true });
|
|
156
|
+
(0, node_fs_1.renameSync)(extracted, paths.redisRoot);
|
|
157
|
+
}
|
|
158
|
+
finally {
|
|
159
|
+
(0, node_fs_1.rmSync)(archive, { force: true });
|
|
160
|
+
(0, node_fs_1.rmSync)(temporaryRoot, { recursive: true, force: true });
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (readMongoVersion(paths.mongodBinary) !== exports.WORKER_MONGODB_VERSION) {
|
|
164
|
+
const temporaryRoot = node_path_1.default.join((0, node_os_1.tmpdir)(), `playdrop-worker-mongodb-${process.pid}-${Date.now()}`);
|
|
165
|
+
const archive = `${temporaryRoot}.tgz`;
|
|
166
|
+
(0, node_fs_1.rmSync)(temporaryRoot, { recursive: true, force: true });
|
|
167
|
+
try {
|
|
168
|
+
await downloadVerifiedArchive({
|
|
169
|
+
url: WORKER_MONGODB_ARCHIVE_URL,
|
|
170
|
+
sha256: WORKER_MONGODB_ARCHIVE_SHA256,
|
|
171
|
+
destination: archive,
|
|
172
|
+
});
|
|
173
|
+
(0, node_fs_1.mkdirSync)(temporaryRoot, { recursive: true, mode: 0o700 });
|
|
174
|
+
(0, node_child_process_1.execFileSync)("/usr/bin/tar", ["-xzf", archive, "-C", temporaryRoot], { stdio: "inherit" });
|
|
175
|
+
const extracted = node_path_1.default.join(temporaryRoot, `mongodb-macos-aarch64--${exports.WORKER_MONGODB_VERSION}`);
|
|
176
|
+
(0, node_fs_1.rmSync)(paths.mongoRoot, { recursive: true, force: true });
|
|
177
|
+
(0, node_fs_1.renameSync)(extracted, paths.mongoRoot);
|
|
178
|
+
}
|
|
179
|
+
finally {
|
|
180
|
+
(0, node_fs_1.rmSync)(archive, { force: true });
|
|
181
|
+
(0, node_fs_1.rmSync)(temporaryRoot, { recursive: true, force: true });
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (readRedisVersion(paths.redisBinary) !== exports.WORKER_REDIS_VERSION) {
|
|
185
|
+
throw new Error(`worker_game_server_redis_version_mismatch:expected=${exports.WORKER_REDIS_VERSION}`);
|
|
186
|
+
}
|
|
187
|
+
if (readMongoVersion(paths.mongodBinary) !== exports.WORKER_MONGODB_VERSION) {
|
|
188
|
+
throw new Error(`worker_game_server_mongodb_version_mismatch:expected=${exports.WORKER_MONGODB_VERSION}`);
|
|
189
|
+
}
|
|
190
|
+
return paths;
|
|
191
|
+
}
|
|
192
|
+
function loadOrCreateCredentials(paths) {
|
|
193
|
+
if ((0, node_fs_1.existsSync)(paths.credentialsPath)) {
|
|
194
|
+
const parsed = JSON.parse((0, node_fs_1.readFileSync)(paths.credentialsPath, "utf8"));
|
|
195
|
+
if (parsed.schemaVersion !== WORKER_INFRA_SCHEMA_VERSION ||
|
|
196
|
+
typeof parsed.redisAdminPassword !== "string" ||
|
|
197
|
+
parsed.redisAdminPassword.length < 32 ||
|
|
198
|
+
typeof parsed.mongoAdminPassword !== "string" ||
|
|
199
|
+
parsed.mongoAdminPassword.length < 32) {
|
|
200
|
+
throw new Error("worker_game_server_credentials_invalid");
|
|
201
|
+
}
|
|
202
|
+
return parsed;
|
|
203
|
+
}
|
|
204
|
+
const credentials = {
|
|
205
|
+
schemaVersion: WORKER_INFRA_SCHEMA_VERSION,
|
|
206
|
+
redisAdminPassword: (0, node_crypto_1.randomBytes)(32).toString("base64url"),
|
|
207
|
+
mongoAdminPassword: (0, node_crypto_1.randomBytes)(32).toString("base64url"),
|
|
208
|
+
};
|
|
209
|
+
(0, node_fs_1.writeFileSync)(paths.credentialsPath, `${JSON.stringify(credentials, null, 2)}\n`, { mode: 0o600 });
|
|
210
|
+
return credentials;
|
|
211
|
+
}
|
|
212
|
+
function writeManagedWorkerGameServerConfiguration(input) {
|
|
213
|
+
const paths = resolveManagedWorkerGameServerPaths(input.workerHomeDir);
|
|
214
|
+
for (const directory of [paths.root, paths.redisDataPath, paths.mongoDataPath, paths.logsPath]) {
|
|
215
|
+
(0, node_fs_1.mkdirSync)(directory, { recursive: true, mode: 0o700 });
|
|
216
|
+
(0, node_fs_1.chmodSync)(directory, 0o700);
|
|
217
|
+
}
|
|
218
|
+
if (!(0, node_fs_1.existsSync)(paths.mongoKeyFilePath)) {
|
|
219
|
+
(0, node_fs_1.writeFileSync)(paths.mongoKeyFilePath, `${(0, node_crypto_1.randomBytes)(48).toString("base64")}\n`, { mode: 0o600 });
|
|
220
|
+
}
|
|
221
|
+
(0, node_fs_1.chmodSync)(paths.mongoKeyFilePath, 0o600);
|
|
222
|
+
const credentials = loadOrCreateCredentials(paths);
|
|
223
|
+
(0, node_fs_1.writeFileSync)(paths.redisAclPath, [
|
|
224
|
+
"user default off",
|
|
225
|
+
`user worker-admin on >${credentials.redisAdminPassword} ~* &* +@all`,
|
|
226
|
+
"",
|
|
227
|
+
].join("\n"), { mode: 0o600 });
|
|
228
|
+
(0, node_fs_1.writeFileSync)(paths.redisConfigPath, [
|
|
229
|
+
"bind 127.0.0.1",
|
|
230
|
+
"protected-mode yes",
|
|
231
|
+
`port ${WORKER_REDIS_PORT}`,
|
|
232
|
+
`dir ${paths.redisDataPath}`,
|
|
233
|
+
`aclfile ${paths.redisAclPath}`,
|
|
234
|
+
'save ""',
|
|
235
|
+
"appendonly no",
|
|
236
|
+
"maxmemory 256mb",
|
|
237
|
+
"maxmemory-policy noeviction",
|
|
238
|
+
`logfile ${node_path_1.default.join(paths.logsPath, "redis.log")}`,
|
|
239
|
+
"",
|
|
240
|
+
].join("\n"));
|
|
241
|
+
(0, node_fs_1.writeFileSync)(paths.mongoConfigPath, [
|
|
242
|
+
"storage:",
|
|
243
|
+
` dbPath: ${paths.mongoDataPath}`,
|
|
244
|
+
" wiredTiger:",
|
|
245
|
+
" engineConfig:",
|
|
246
|
+
" cacheSizeGB: 0.25",
|
|
247
|
+
"net:",
|
|
248
|
+
" bindIp: 127.0.0.1",
|
|
249
|
+
` port: ${WORKER_MONGODB_PORT}`,
|
|
250
|
+
"replication:",
|
|
251
|
+
` replSetName: ${WORKER_MONGODB_REPLICA_SET}`,
|
|
252
|
+
"security:",
|
|
253
|
+
" authorization: enabled",
|
|
254
|
+
` keyFile: ${paths.mongoKeyFilePath}`,
|
|
255
|
+
"systemLog:",
|
|
256
|
+
" destination: file",
|
|
257
|
+
` path: ${node_path_1.default.join(paths.logsPath, "mongod.log")}`,
|
|
258
|
+
" logAppend: true",
|
|
259
|
+
"",
|
|
260
|
+
].join("\n"));
|
|
261
|
+
return {
|
|
262
|
+
redisAdminUrl: `redis://worker-admin:${credentials.redisAdminPassword}@127.0.0.1:${WORKER_REDIS_PORT}`,
|
|
263
|
+
mongoAdminUrl: `mongodb://worker-admin:${credentials.mongoAdminPassword}@127.0.0.1:${WORKER_MONGODB_PORT}/admin` +
|
|
264
|
+
`?replicaSet=${WORKER_MONGODB_REPLICA_SET}&directConnection=true&authSource=admin`,
|
|
265
|
+
redisVersion: exports.WORKER_REDIS_VERSION,
|
|
266
|
+
mongoVersion: exports.WORKER_MONGODB_VERSION,
|
|
267
|
+
paths,
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
function buildManagedWorkerGameServerLaunchAgents(input) {
|
|
271
|
+
const paths = resolveManagedWorkerGameServerPaths(input.workerHomeDir);
|
|
272
|
+
const launchAgentsRoot = node_path_1.default.join(node_path_1.default.dirname(requireAbsoluteWorkerHome(input.workerHomeDir)), "Library", "LaunchAgents");
|
|
273
|
+
const definitions = [
|
|
274
|
+
{
|
|
275
|
+
label: "ai.playdrop.worker.redis",
|
|
276
|
+
args: [paths.redisBinary, paths.redisConfigPath],
|
|
277
|
+
stdout: node_path_1.default.join(paths.logsPath, "redis-launch.out.log"),
|
|
278
|
+
stderr: node_path_1.default.join(paths.logsPath, "redis-launch.err.log"),
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
label: "ai.playdrop.worker.mongodb",
|
|
282
|
+
args: [paths.mongodBinary, "--config", paths.mongoConfigPath],
|
|
283
|
+
stdout: node_path_1.default.join(paths.logsPath, "mongodb-launch.out.log"),
|
|
284
|
+
stderr: node_path_1.default.join(paths.logsPath, "mongodb-launch.err.log"),
|
|
285
|
+
},
|
|
286
|
+
];
|
|
287
|
+
return definitions.map((definition) => ({
|
|
288
|
+
label: definition.label,
|
|
289
|
+
plistPath: node_path_1.default.join(launchAgentsRoot, `${definition.label}.plist`),
|
|
290
|
+
contents: `<?xml version="1.0" encoding="UTF-8"?>
|
|
291
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
292
|
+
<plist version="1.0">
|
|
293
|
+
<dict>
|
|
294
|
+
<key>Label</key><string>${definition.label}</string>
|
|
295
|
+
<key>ProgramArguments</key>
|
|
296
|
+
<array>${definition.args.map((argument) => `\n <string>${argument.replace(/&/g, "&").replace(/</g, "<")}</string>`).join("")}\n </array>
|
|
297
|
+
<key>RunAtLoad</key><true/>
|
|
298
|
+
<key>KeepAlive</key><true/>
|
|
299
|
+
<key>ProcessType</key><string>Background</string>
|
|
300
|
+
<key>StandardOutPath</key><string>${definition.stdout}</string>
|
|
301
|
+
<key>StandardErrorPath</key><string>${definition.stderr}</string>
|
|
302
|
+
</dict>
|
|
303
|
+
</plist>
|
|
304
|
+
`,
|
|
305
|
+
}));
|
|
306
|
+
}
|
|
307
|
+
function syncManagedWorkerGameServerLaunchAgents(definitions, deps = { spawn: node_child_process_1.spawnSync }) {
|
|
308
|
+
const domain = `gui/${process.getuid?.() ?? -1}`;
|
|
309
|
+
for (const definition of definitions) {
|
|
310
|
+
(0, node_fs_1.mkdirSync)(node_path_1.default.dirname(definition.plistPath), { recursive: true, mode: 0o700 });
|
|
311
|
+
const current = (0, node_fs_1.existsSync)(definition.plistPath) ? (0, node_fs_1.readFileSync)(definition.plistPath, "utf8") : null;
|
|
312
|
+
const changed = current !== definition.contents;
|
|
313
|
+
if (changed) {
|
|
314
|
+
(0, node_fs_1.writeFileSync)(definition.plistPath, definition.contents, { mode: 0o600 });
|
|
315
|
+
}
|
|
316
|
+
const status = deps.spawn("/bin/launchctl", ["print", `${domain}/${definition.label}`], { stdio: "ignore" });
|
|
317
|
+
const loaded = status.status === 0;
|
|
318
|
+
if (loaded && changed) {
|
|
319
|
+
const result = deps.spawn("/bin/launchctl", ["bootout", `${domain}/${definition.label}`], { encoding: "utf8" });
|
|
320
|
+
if (result.status !== 0) {
|
|
321
|
+
throw new Error(`worker_game_server_launchagent_reload_failed:${definition.label}:${String(result.stderr).trim()}`);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
if (!loaded || changed) {
|
|
325
|
+
const result = deps.spawn("/bin/launchctl", ["bootstrap", domain, definition.plistPath], { encoding: "utf8" });
|
|
326
|
+
if (result.status !== 0) {
|
|
327
|
+
throw new Error(`worker_game_server_launchagent_failed:${definition.label}:${String(result.stderr).trim()}`);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
async function waitForRedis(url) {
|
|
333
|
+
const deadline = Date.now() + 30000;
|
|
334
|
+
while (Date.now() < deadline) {
|
|
335
|
+
const redis = new ioredis_1.Redis(url, { lazyConnect: true, connectTimeout: 500, maxRetriesPerRequest: 1 });
|
|
336
|
+
redis.on("error", () => undefined);
|
|
337
|
+
try {
|
|
338
|
+
await redis.connect();
|
|
339
|
+
const info = await redis.info("server");
|
|
340
|
+
const version = /^redis_version:([^\r\n]+)/mu.exec(info)?.[1]?.trim() ?? "unknown";
|
|
341
|
+
if (version !== exports.WORKER_REDIS_VERSION) {
|
|
342
|
+
throw new Error(`worker_game_server_redis_version_mismatch:expected=${exports.WORKER_REDIS_VERSION}:actual=${version}`);
|
|
343
|
+
}
|
|
344
|
+
await redis.quit();
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
catch (error) {
|
|
348
|
+
await redis.disconnect();
|
|
349
|
+
if (error instanceof Error && error.message.startsWith("worker_game_server_redis_version_mismatch"))
|
|
350
|
+
throw error;
|
|
351
|
+
await new Promise((resolveWait) => setTimeout(resolveWait, 250));
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
throw new Error("worker_game_server_redis_start_timeout");
|
|
355
|
+
}
|
|
356
|
+
async function waitForMongoAndInitialize(url) {
|
|
357
|
+
const parsed = new URL(url);
|
|
358
|
+
const password = decodeURIComponent(parsed.password);
|
|
359
|
+
const directUrl = `mongodb://127.0.0.1:${WORKER_MONGODB_PORT}/admin?directConnection=true`;
|
|
360
|
+
const deadline = Date.now() + 30000;
|
|
361
|
+
let control = null;
|
|
362
|
+
let authenticated = false;
|
|
363
|
+
while (Date.now() < deadline && !control) {
|
|
364
|
+
for (const candidate of [{ url, authenticated: true }, { url: directUrl, authenticated: false }]) {
|
|
365
|
+
const client = new mongodb_1.MongoClient(candidate.url, { serverSelectionTimeoutMS: 500, maxPoolSize: 1 });
|
|
366
|
+
try {
|
|
367
|
+
await client.connect();
|
|
368
|
+
await client.db("admin").command({ ping: 1 });
|
|
369
|
+
control = client;
|
|
370
|
+
authenticated = candidate.authenticated;
|
|
371
|
+
break;
|
|
372
|
+
}
|
|
373
|
+
catch {
|
|
374
|
+
await client.close().catch(() => undefined);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
if (!control)
|
|
378
|
+
await new Promise((resolveWait) => setTimeout(resolveWait, 250));
|
|
379
|
+
}
|
|
380
|
+
if (!control)
|
|
381
|
+
throw new Error("worker_game_server_mongodb_start_timeout");
|
|
382
|
+
try {
|
|
383
|
+
const admin = control.db("admin");
|
|
384
|
+
const buildInfo = (await admin.command({ buildInfo: 1 }));
|
|
385
|
+
if (buildInfo.version !== exports.WORKER_MONGODB_VERSION) {
|
|
386
|
+
throw new Error(`worker_game_server_mongodb_version_mismatch:expected=${exports.WORKER_MONGODB_VERSION}:actual=${String(buildInfo.version)}`);
|
|
387
|
+
}
|
|
388
|
+
try {
|
|
389
|
+
await admin.command({ replSetGetStatus: 1 });
|
|
390
|
+
}
|
|
391
|
+
catch (error) {
|
|
392
|
+
if (error && typeof error === "object" && "code" in error && error.code === 94) {
|
|
393
|
+
await admin.command({
|
|
394
|
+
replSetInitiate: {
|
|
395
|
+
_id: WORKER_MONGODB_REPLICA_SET,
|
|
396
|
+
members: [{ _id: 0, host: `127.0.0.1:${WORKER_MONGODB_PORT}` }],
|
|
397
|
+
},
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
throw error;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
for (let attempt = 0; attempt < 120; attempt += 1) {
|
|
405
|
+
const hello = (await admin.command({ hello: 1 }));
|
|
406
|
+
if (hello.isWritablePrimary === true)
|
|
407
|
+
break;
|
|
408
|
+
if (attempt === 119)
|
|
409
|
+
throw new Error("worker_game_server_mongodb_primary_timeout");
|
|
410
|
+
await new Promise((resolveWait) => setTimeout(resolveWait, 250));
|
|
411
|
+
}
|
|
412
|
+
if (!authenticated) {
|
|
413
|
+
await admin.command({
|
|
414
|
+
createUser: "worker-admin",
|
|
415
|
+
pwd: password,
|
|
416
|
+
roles: [{ role: "root", db: "admin" }],
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
finally {
|
|
421
|
+
await control.close();
|
|
422
|
+
}
|
|
423
|
+
const verified = new mongodb_1.MongoClient(url, { serverSelectionTimeoutMS: 1000, maxPoolSize: 1 });
|
|
424
|
+
try {
|
|
425
|
+
await verified.connect();
|
|
426
|
+
const hello = (await verified.db("admin").command({ hello: 1 }));
|
|
427
|
+
if (hello.setName !== WORKER_MONGODB_REPLICA_SET || hello.isWritablePrimary !== true) {
|
|
428
|
+
throw new Error("worker_game_server_mongodb_primary_timeout");
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
finally {
|
|
432
|
+
await verified.close();
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
async function setupManagedWorkerGameServerInfrastructure(input) {
|
|
436
|
+
await installManagedWorkerGameServerToolchains(input);
|
|
437
|
+
const infrastructure = writeManagedWorkerGameServerConfiguration(input);
|
|
438
|
+
if (input.startLaunchAgents !== false) {
|
|
439
|
+
syncManagedWorkerGameServerLaunchAgents(buildManagedWorkerGameServerLaunchAgents(input));
|
|
440
|
+
await Promise.all([
|
|
441
|
+
waitForRedis(infrastructure.redisAdminUrl),
|
|
442
|
+
waitForMongoAndInitialize(infrastructure.mongoAdminUrl),
|
|
443
|
+
]);
|
|
444
|
+
}
|
|
445
|
+
return infrastructure;
|
|
446
|
+
}
|
|
447
|
+
async function probeManagedWorkerGameServerInfrastructure(input) {
|
|
448
|
+
await Promise.all([waitForRedis(input.redisAdminUrl), waitForMongoAndInitialize(input.mongoAdminUrl)]);
|
|
449
|
+
}
|
|
450
|
+
function buildScopedUrl(baseUrl, username, password) {
|
|
451
|
+
const scoped = new URL(baseUrl);
|
|
452
|
+
scoped.username = username;
|
|
453
|
+
scoped.password = password;
|
|
454
|
+
return scoped.toString();
|
|
455
|
+
}
|
|
456
|
+
function normalizeTaskScope(taskId, attempt) {
|
|
457
|
+
if (!Number.isInteger(taskId) || taskId <= 0 || !Number.isInteger(attempt) || attempt <= 0) {
|
|
458
|
+
throw new Error("worker_game_server_dev_scope_invalid");
|
|
459
|
+
}
|
|
460
|
+
return `task-${taskId}-attempt-${attempt}`;
|
|
461
|
+
}
|
|
462
|
+
async function deleteRedisKeys(redis, pattern) {
|
|
463
|
+
let cursor = "0";
|
|
464
|
+
let deleted = 0;
|
|
465
|
+
do {
|
|
466
|
+
const [nextCursor, keys] = await redis.scan(cursor, "MATCH", pattern, "COUNT", 200);
|
|
467
|
+
cursor = nextCursor;
|
|
468
|
+
if (keys.length > 0) {
|
|
469
|
+
deleted += await redis.unlink(...keys);
|
|
470
|
+
}
|
|
471
|
+
} while (cursor !== "0");
|
|
472
|
+
return deleted;
|
|
473
|
+
}
|
|
474
|
+
async function removeRedisLease(input) {
|
|
475
|
+
await deleteRedisKeys(input.redis, `${input.namespace}*`);
|
|
476
|
+
await input.redis.call("ACL", "DELUSER", input.username);
|
|
477
|
+
await input.redis.call("ACL", "SAVE");
|
|
478
|
+
}
|
|
479
|
+
async function cleanupStaleWorkerGameServerDevResources(input) {
|
|
480
|
+
const redis = new ioredis_1.Redis(input.redisAdminUrl, { lazyConnect: true, connectTimeout: 2000, maxRetriesPerRequest: 1 });
|
|
481
|
+
redis.on("error", () => undefined);
|
|
482
|
+
const mongo = new mongodb_1.MongoClient(input.mongoAdminUrl, { serverSelectionTimeoutMS: 2000, maxPoolSize: 1 });
|
|
483
|
+
try {
|
|
484
|
+
await Promise.all([redis.connect(), mongo.connect()]);
|
|
485
|
+
const rawUsers = await redis.call("ACL", "USERS");
|
|
486
|
+
const users = Array.isArray(rawUsers)
|
|
487
|
+
? rawUsers.map(String).filter((value) => /^playdrop-task-[1-9]\d*-attempt-[1-9]\d*$/u.test(value))
|
|
488
|
+
: [];
|
|
489
|
+
let redisKeys = 0;
|
|
490
|
+
for (const username of users) {
|
|
491
|
+
const scope = username.slice("playdrop-".length);
|
|
492
|
+
redisKeys += await deleteRedisKeys(redis, `colyseus:*:dev-${scope}:*`);
|
|
493
|
+
await redis.call("ACL", "DELUSER", username);
|
|
494
|
+
}
|
|
495
|
+
if (users.length > 0)
|
|
496
|
+
await redis.call("ACL", "SAVE");
|
|
497
|
+
const databases = (await mongo.db("admin").admin().listDatabases({ nameOnly: true })).databases
|
|
498
|
+
.map(({ name }) => name)
|
|
499
|
+
.filter((name) => /^dev_task_[1-9]\d*_attempt_[1-9]\d*$/u.test(name));
|
|
500
|
+
for (const database of databases)
|
|
501
|
+
await mongo.db(database).dropDatabase();
|
|
502
|
+
return { redisUsers: users.length, redisKeys, mongoDatabases: databases.length };
|
|
503
|
+
}
|
|
504
|
+
finally {
|
|
505
|
+
await Promise.allSettled([redis.quit(), mongo.close()]);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
async function provisionWorkerGameServerDevLease(input) {
|
|
509
|
+
const scope = normalizeTaskScope(input.taskId, input.attempt);
|
|
510
|
+
const environment = input.environment.trim().toLowerCase().replace(/[^a-z0-9_-]/gu, "-");
|
|
511
|
+
if (!environment)
|
|
512
|
+
throw new Error("worker_game_server_dev_environment_invalid");
|
|
513
|
+
const redisNamespace = `colyseus:${environment}:dev-${scope}:`;
|
|
514
|
+
const redisUsername = `playdrop-${scope}`;
|
|
515
|
+
const redisPassword = (0, node_crypto_1.randomBytes)(24).toString("base64url");
|
|
516
|
+
const mongoDatabase = `dev_${scope.replace(/-/gu, "_")}`;
|
|
517
|
+
const mongoUsername = `playdrop-${scope}`;
|
|
518
|
+
const mongoPassword = (0, node_crypto_1.randomBytes)(24).toString("base64url");
|
|
519
|
+
const redisAdmin = new ioredis_1.Redis(input.redisAdminUrl, { lazyConnect: true, connectTimeout: 2000, maxRetriesPerRequest: 1 });
|
|
520
|
+
redisAdmin.on("error", () => undefined);
|
|
521
|
+
const mongoAdmin = new mongodb_1.MongoClient(input.mongoAdminUrl, { serverSelectionTimeoutMS: 2000, maxPoolSize: 1 });
|
|
522
|
+
let redisUserCreated = false;
|
|
523
|
+
let mongoUserCreated = false;
|
|
524
|
+
try {
|
|
525
|
+
await Promise.all([redisAdmin.connect(), mongoAdmin.connect()]);
|
|
526
|
+
try {
|
|
527
|
+
await redisAdmin.call("ACL", "SETUSER", redisUsername, "reset", "on", `>${redisPassword}`, "resetkeys", "resetchannels", `~${redisNamespace}*`, `&${redisNamespace}*`, ...exports.WORKER_REDIS_RUNTIME_COMMANDS);
|
|
528
|
+
redisUserCreated = true;
|
|
529
|
+
await redisAdmin.call("ACL", "SAVE");
|
|
530
|
+
}
|
|
531
|
+
catch (error) {
|
|
532
|
+
if (input.requireRedisAcl !== false)
|
|
533
|
+
throw error;
|
|
534
|
+
}
|
|
535
|
+
const database = mongoAdmin.db(mongoDatabase);
|
|
536
|
+
const existing = (await database.command({ usersInfo: mongoUsername }));
|
|
537
|
+
if (Array.isArray(existing.users) && existing.users.length > 0) {
|
|
538
|
+
await database.command({
|
|
539
|
+
updateUser: mongoUsername,
|
|
540
|
+
pwd: mongoPassword,
|
|
541
|
+
roles: [{ role: "readWrite", db: mongoDatabase }],
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
else {
|
|
545
|
+
await database.command({
|
|
546
|
+
createUser: mongoUsername,
|
|
547
|
+
pwd: mongoPassword,
|
|
548
|
+
roles: [{ role: "readWrite", db: mongoDatabase }],
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
mongoUserCreated = true;
|
|
552
|
+
const redisUrl = redisUserCreated
|
|
553
|
+
? buildScopedUrl(input.redisAdminUrl, redisUsername, redisPassword)
|
|
554
|
+
: input.redisAdminUrl;
|
|
555
|
+
const mongoUrlValue = new URL(input.mongoAdminUrl);
|
|
556
|
+
mongoUrlValue.username = mongoUsername;
|
|
557
|
+
mongoUrlValue.password = mongoPassword;
|
|
558
|
+
mongoUrlValue.pathname = `/${mongoDatabase}`;
|
|
559
|
+
mongoUrlValue.searchParams.set("authSource", mongoDatabase);
|
|
560
|
+
mongoUrlValue.searchParams.set("maxPoolSize", "5");
|
|
561
|
+
return {
|
|
562
|
+
scope,
|
|
563
|
+
redisNamespace,
|
|
564
|
+
redisUrl,
|
|
565
|
+
mongoUrl: mongoUrlValue.toString(),
|
|
566
|
+
async cleanup() {
|
|
567
|
+
await Promise.allSettled([
|
|
568
|
+
redisUserCreated
|
|
569
|
+
? removeRedisLease({ redis: redisAdmin, username: redisUsername, namespace: redisNamespace })
|
|
570
|
+
: Promise.resolve(),
|
|
571
|
+
mongoUserCreated
|
|
572
|
+
? mongoAdmin
|
|
573
|
+
.db(mongoDatabase)
|
|
574
|
+
.command({ dropUser: mongoUsername })
|
|
575
|
+
.catch(() => undefined)
|
|
576
|
+
.then(() => mongoAdmin.db(mongoDatabase).dropDatabase())
|
|
577
|
+
: Promise.resolve(),
|
|
578
|
+
]);
|
|
579
|
+
await Promise.allSettled([redisAdmin.quit(), mongoAdmin.close()]);
|
|
580
|
+
},
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
catch (error) {
|
|
584
|
+
if (redisUserCreated) {
|
|
585
|
+
await removeRedisLease({ redis: redisAdmin, username: redisUsername, namespace: redisNamespace })
|
|
586
|
+
.catch(() => undefined);
|
|
587
|
+
}
|
|
588
|
+
if (mongoUserCreated) {
|
|
589
|
+
await mongoAdmin.db(mongoDatabase).command({ dropUser: mongoUsername }).catch(() => undefined);
|
|
590
|
+
await mongoAdmin.db(mongoDatabase).dropDatabase().catch(() => undefined);
|
|
591
|
+
}
|
|
592
|
+
await Promise.allSettled([redisAdmin.quit(), mongoAdmin.close()]);
|
|
593
|
+
throw error;
|
|
594
|
+
}
|
|
595
|
+
}
|