@playdrop/playdrop-cli 0.16.5 → 0.16.12
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/bin/playdrop +1 -2
- package/config/client-meta.json +4 -4
- package/dist/apiClient.d.ts +2 -2
- package/dist/apiClient.js +16 -20
- package/dist/appUrls.d.ts +2 -2
- package/dist/appUrls.js +31 -33
- package/dist/apps/build.d.ts +2 -2
- package/dist/apps/build.js +83 -83
- package/dist/apps/index.d.ts +7 -7
- package/dist/apps/index.js +8 -8
- package/dist/apps/loadCheck.d.ts +28 -16
- package/dist/apps/loadCheck.js +411 -279
- package/dist/apps/registration.d.ts +3 -3
- package/dist/apps/registration.js +1 -1
- package/dist/apps/staticHtml.d.ts +3 -3
- package/dist/apps/staticHtml.js +90 -91
- package/dist/apps/surfaceProfiles.d.ts +2 -2
- package/dist/apps/surfaceProfiles.js +6 -6
- package/dist/apps/upload.d.ts +5 -5
- package/dist/apps/upload.js +75 -81
- package/dist/apps/validate.d.ts +2 -2
- package/dist/apps/validate.js +18 -22
- package/dist/assetSpecs.d.ts +2 -2
- package/dist/assetSpecs.js +35 -35
- package/dist/assets/model-artifacts.d.ts +1 -1
- package/dist/assets/model-artifacts.js +81 -77
- package/dist/assets/model-worker.d.ts +1 -1
- package/dist/assets/model-worker.js +6 -6
- package/dist/browser.js +9 -9
- package/dist/catalogue-utils.d.ts +1 -1
- package/dist/catalogue-utils.js +26 -26
- package/dist/catalogue.d.ts +21 -16
- package/dist/catalogue.js +509 -413
- package/dist/clientInfo.d.ts +1 -1
- package/dist/clientInfo.js +28 -28
- package/dist/commandContext.d.ts +5 -5
- package/dist/commandContext.js +19 -23
- package/dist/commands/accounts.js +6 -6
- package/dist/commands/ads.js +16 -16
- package/dist/commands/agents.d.ts +2 -2
- package/dist/commands/agents.js +131 -127
- package/dist/commands/boosts.js +41 -31
- package/dist/commands/browse.d.ts +2 -2
- package/dist/commands/browse.js +168 -128
- package/dist/commands/build.js +9 -9
- package/dist/commands/captureListing.d.ts +8 -8
- package/dist/commands/captureListing.js +292 -332
- package/dist/commands/changelog.js +1 -1
- package/dist/commands/chat.js +51 -53
- package/dist/commands/check.d.ts +1 -1
- package/dist/commands/check.js +44 -44
- package/dist/commands/clients.d.ts +3 -3
- package/dist/commands/clients.js +67 -64
- package/dist/commands/comments.js +36 -29
- package/dist/commands/create.js +305 -312
- package/dist/commands/createRemixContent.d.ts +1 -1
- package/dist/commands/createRemixContent.js +65 -60
- package/dist/commands/creations.js +205 -135
- package/dist/commands/credits.js +37 -27
- package/dist/commands/detail.js +40 -34
- package/dist/commands/dev.js +103 -126
- package/dist/commands/devBrowser.js +74 -65
- package/dist/commands/devRuntimeAssets.d.ts +4 -4
- package/dist/commands/devRuntimeAssets.js +38 -40
- package/dist/commands/devServer.d.ts +4 -4
- package/dist/commands/devServer.js +183 -174
- package/dist/commands/devShared.d.ts +3 -3
- package/dist/commands/devShared.js +31 -31
- package/dist/commands/doctor.d.ts +5 -5
- package/dist/commands/doctor.js +63 -57
- package/dist/commands/documentation.js +42 -32
- package/dist/commands/feedback.js +59 -42
- package/dist/commands/format.js +9 -9
- package/dist/commands/generation.d.ts +2 -2
- package/dist/commands/generation.js +344 -326
- package/dist/commands/init.d.ts +4 -4
- package/dist/commands/init.js +64 -61
- package/dist/commands/login.d.ts +2 -2
- package/dist/commands/login.js +42 -62
- package/dist/commands/logout.js +4 -4
- package/dist/commands/marketing.d.ts +8 -8
- package/dist/commands/marketing.js +246 -297
- package/dist/commands/notes.js +19 -19
- package/dist/commands/notifications.js +34 -22
- package/dist/commands/npmProcess.js +3 -3
- package/dist/commands/ownedRuntimeImageValidation.d.ts +1 -1
- package/dist/commands/ownedRuntimeImageValidation.js +19 -17
- package/dist/commands/play.js +12 -21
- package/dist/commands/publicPages.js +8 -4
- package/dist/commands/review.js +123 -110
- package/dist/commands/search.js +107 -88
- package/dist/commands/tags.js +10 -12
- package/dist/commands/taskCaptureSession.d.ts +3 -3
- package/dist/commands/taskCaptureSession.js +3 -3
- package/dist/commands/tweaks.js +25 -23
- package/dist/commands/upgrade.js +40 -31
- package/dist/commands/upload-content.d.ts +5 -5
- package/dist/commands/upload-content.js +130 -122
- package/dist/commands/upload-graph.d.ts +1 -1
- package/dist/commands/upload-graph.js +7 -11
- package/dist/commands/upload.d.ts +7 -7
- package/dist/commands/upload.js +196 -217
- package/dist/commands/validate.js +33 -32
- package/dist/commands/versionsBrowse.js +61 -51
- package/dist/commands/whoami.js +11 -14
- package/dist/commands/worker/archive-staging.d.ts +9 -0
- package/dist/commands/worker/archive-staging.js +257 -0
- package/dist/commands/worker/instrument-evidence.d.ts +1 -1
- package/dist/commands/worker/instrument-evidence.js +41 -43
- package/dist/commands/worker/provider-telemetry.d.ts +2 -1
- package/dist/commands/worker/provider-telemetry.js +181 -64
- package/dist/commands/worker/runtime.d.ts +18 -3
- package/dist/commands/worker/runtime.js +291 -239
- package/dist/commands/worker.d.ts +83 -22
- package/dist/commands/worker.js +1980 -1411
- package/dist/commands/workspaces.d.ts +2 -2
- package/dist/commands/workspaces.js +57 -57
- package/dist/config.js +23 -20
- package/dist/devAuth.d.ts +3 -3
- package/dist/devAuth.js +20 -17
- package/dist/environment.d.ts +1 -1
- package/dist/environment.js +34 -34
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +7 -7
- package/dist/externalAssetPackValidation.d.ts +1 -1
- package/dist/externalAssetPackValidation.js +9 -9
- package/dist/http.d.ts +1 -1
- package/dist/http.js +9 -9
- package/dist/index.js +657 -664
- package/dist/listingCaptureLease.js +23 -23
- package/dist/listingPreflight.d.ts +2 -2
- package/dist/listingPreflight.js +33 -33
- package/dist/messages.js +6 -14
- package/dist/output.js +9 -9
- package/dist/playwright.d.ts +1 -1
- package/dist/playwright.js +35 -40
- package/dist/proxyFetch.js +30 -27
- package/dist/recorderRelease.js +8 -8
- package/dist/refs.d.ts +5 -5
- package/dist/refs.js +40 -37
- package/dist/sessionCookie.js +15 -21
- package/dist/shellProbe.js +5 -5
- package/dist/taskSelection.d.ts +3 -3
- package/dist/taskSelection.js +67 -62
- package/dist/taskUtils.d.ts +1 -1
- package/dist/taskUtils.js +4 -4
- package/dist/tweakStaleness.d.ts +3 -3
- package/dist/tweakStaleness.js +8 -8
- package/dist/uploadLog.d.ts +3 -3
- package/dist/uploadLog.js +51 -51
- package/dist/versionCompare.js +3 -3
- package/dist/workerAppProject.d.ts +1 -1
- package/dist/workerAppProject.js +10 -17
- package/dist/workspaceAuth.d.ts +1 -1
- package/dist/workspaceAuth.js +28 -22
- package/node_modules/@playdrop/ai-client/dist/index.d.ts +35 -35
- package/node_modules/@playdrop/ai-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/client.d.ts +34 -33
- package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/core/errors.d.ts +1 -1
- package/node_modules/@playdrop/api-client/dist/core/errors.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/core/request.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/core/request.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/admin.js +4 -1
- package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.d.ts +4 -3
- 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 +12 -0
- package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts +4 -4
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/asset-packs.d.ts +4 -4
- package/node_modules/@playdrop/api-client/dist/domains/asset-packs.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts +4 -4
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/auth.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/auth.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/chat.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/chat.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/comments.d.ts +3 -3
- package/node_modules/@playdrop/api-client/dist/domains/comments.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/free-credits.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/free-credits.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/me.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/me.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/player-meta.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/player-meta.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/playtrade.d.ts +3 -3
- package/node_modules/@playdrop/api-client/dist/domains/playtrade.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/playtrade.js +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/search.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/search.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/tags.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/tags.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/index.d.ts +19 -18
- package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/index.js +7 -2
- package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.js +47 -47
- package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.d.ts +3 -3
- package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.js +32 -47
- package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/format-utils.js +16 -18
- package/node_modules/@playdrop/boxel-core/dist/src/format-utils.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/geometry.d.ts +2 -2
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/index.d.ts +4 -4
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/common.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/index.d.ts +3 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.d.ts +2 -2
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.js +44 -45
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/types.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.d.ts +2 -2
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.js +40 -44
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.d.ts +2 -2
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.js +30 -34
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/index.d.ts +4 -4
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/index.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.d.ts +3 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.js +23 -20
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/artifacts.d.ts +3 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/artifacts.js +3 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.js +21 -21
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/index.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/index.js +2 -2
- package/node_modules/@playdrop/boxel-core/dist/src/index.d.ts +19 -19
- package/node_modules/@playdrop/boxel-core/dist/src/materials.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/materials.js +12 -16
- package/node_modules/@playdrop/boxel-core/dist/src/materials.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.js +38 -41
- package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/serialization.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/serialization.js +54 -56
- package/node_modules/@playdrop/boxel-core/dist/src/serialization.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/textures.d.ts +3 -3
- package/node_modules/@playdrop/boxel-core/dist/src/textures.js +39 -45
- package/node_modules/@playdrop/boxel-core/dist/src/textures.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.d.ts +2 -2
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.js +39 -43
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.d.ts +3 -3
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.js +35 -35
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.js +18 -18
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.d.ts +3 -3
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.js +50 -48
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.js +22 -26
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.d.ts +2 -2
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.js +8 -8
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.d.ts +2 -2
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.js +23 -28
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/types.d.ts +8 -8
- package/node_modules/@playdrop/boxel-core/dist/src/validation.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/validation.js +93 -95
- package/node_modules/@playdrop/boxel-core/dist/src/validation.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.js +2 -2
- package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/voxels.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/voxels.js +2 -7
- package/node_modules/@playdrop/boxel-core/dist/src/voxels.js.map +1 -1
- package/node_modules/@playdrop/boxel-three/dist/src/animations.d.ts +3 -3
- package/node_modules/@playdrop/boxel-three/dist/src/builders.d.ts +4 -4
- package/node_modules/@playdrop/boxel-three/dist/src/context.d.ts +3 -3
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/glb.d.ts +6 -6
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/glb.js +9 -1
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/image.d.ts +3 -3
- package/node_modules/@playdrop/boxel-three/dist/src/index.d.ts +17 -17
- package/node_modules/@playdrop/boxel-three/dist/src/instantiate.d.ts +9 -9
- package/node_modules/@playdrop/boxel-three/dist/src/nodes.d.ts +3 -3
- package/node_modules/@playdrop/boxel-three/dist/src/nodes.js +1 -1
- package/node_modules/@playdrop/boxel-three/dist/src/overlays.d.ts +2 -2
- package/node_modules/@playdrop/boxel-three/dist/src/primitives.d.ts +1 -1
- package/node_modules/@playdrop/boxel-three/dist/src/scene.d.ts +1 -1
- package/node_modules/@playdrop/boxel-three/dist/src/skinned-mesh.d.ts +2 -2
- package/node_modules/@playdrop/boxel-three/dist/src/texture-atlas.d.ts +1 -1
- package/node_modules/@playdrop/boxel-three/dist/src/textures.d.ts +3 -3
- package/node_modules/@playdrop/boxel-three/dist/src/types.d.ts +4 -4
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/faces.d.ts +2 -2
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/mesher.d.ts +1 -1
- package/node_modules/@playdrop/boxel-three/dist/test/fixtures/render-worker.d.ts +1 -1
- package/node_modules/@playdrop/config/client-meta.json +4 -4
- package/node_modules/@playdrop/config/dist/src/client-meta.d.ts +1 -1
- package/node_modules/@playdrop/config/dist/src/client-meta.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/client-meta.js +10 -10
- package/node_modules/@playdrop/config/dist/src/constants.js +10 -10
- package/node_modules/@playdrop/config/dist/src/creator-plans.d.ts +1 -1
- package/node_modules/@playdrop/config/dist/src/creator-plans.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/creator-plans.js +27 -28
- package/node_modules/@playdrop/config/dist/src/deployment.d.ts +4 -4
- package/node_modules/@playdrop/config/dist/src/deployment.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/deployment.js +42 -41
- package/node_modules/@playdrop/config/dist/src/game-arena.js +12 -12
- package/node_modules/@playdrop/config/dist/src/index.d.ts +9 -9
- package/node_modules/@playdrop/config/dist/src/index.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/index.js +24 -25
- package/node_modules/@playdrop/config/dist/src/public-deployment.d.ts +4 -4
- package/node_modules/@playdrop/config/dist/src/public-deployment.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/public-deployment.js +41 -39
- package/node_modules/@playdrop/config/dist/src/runtime-client-meta.js +1 -3
- package/node_modules/@playdrop/config/dist/src/runtime-service-origins.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/runtime-service-origins.js +23 -25
- package/node_modules/@playdrop/config/dist/src/server/fastify.d.ts +5 -5
- package/node_modules/@playdrop/config/dist/src/server/fastify.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/server/fastify.js +44 -46
- package/node_modules/@playdrop/config/dist/src/server/logging.d.ts +1 -1
- package/node_modules/@playdrop/config/dist/src/server/logging.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/server/logging.js +6 -8
- package/node_modules/@playdrop/config/dist/src/types.d.ts +2 -2
- package/node_modules/@playdrop/config/dist/test/creator-plans.test.js +12 -12
- package/node_modules/@playdrop/config/dist/test/deployment.test.js +59 -59
- package/node_modules/@playdrop/config/dist/test/fastify.test.js +4 -4
- package/node_modules/@playdrop/config/dist/test/game-arena.test.js +8 -8
- package/node_modules/@playdrop/config/dist/test/logging.test.js +6 -6
- package/node_modules/@playdrop/config/dist/test/validateClientEnvironment.test.js +57 -57
- package/node_modules/@playdrop/config/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@playdrop/types/dist/agent-task-playtest.d.ts.map +1 -1
- 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/api.d.ts +314 -250
- package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/api.js +40 -59
- package/node_modules/@playdrop/types/dist/app-capability-filters.d.ts +2 -2
- package/node_modules/@playdrop/types/dist/app-playtest-tape.d.ts +6 -6
- package/node_modules/@playdrop/types/dist/app-playtest-tape.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/app-review.d.ts +2 -2
- package/node_modules/@playdrop/types/dist/app-review.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/app-review.js +1 -6
- package/node_modules/@playdrop/types/dist/app.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts +5 -5
- package/node_modules/@playdrop/types/dist/asset-spec.d.ts +4 -4
- package/node_modules/@playdrop/types/dist/asset.d.ts +11 -11
- package/node_modules/@playdrop/types/dist/attachment-policy.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/chat.d.ts +3 -3
- package/node_modules/@playdrop/types/dist/creator-public-image.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/graph.d.ts +4 -4
- package/node_modules/@playdrop/types/dist/index.d.ts +25 -25
- package/node_modules/@playdrop/types/dist/instrument-evidence.d.ts +2 -2
- package/node_modules/@playdrop/types/dist/instrument-evidence.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/instrument-evidence.js +2 -11
- package/node_modules/@playdrop/types/dist/locale.d.ts +2 -2
- package/node_modules/@playdrop/types/dist/locale.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/locale.js +2 -17
- package/node_modules/@playdrop/types/dist/owned-assets.d.ts +2 -2
- package/node_modules/@playdrop/types/dist/owned-assets.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/player-meta.d.ts +3 -3
- package/node_modules/@playdrop/types/dist/player-meta.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/playtest-notes.d.ts +11 -11
- package/node_modules/@playdrop/types/dist/playtest-notes.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/playtrade.d.ts +8 -5
- package/node_modules/@playdrop/types/dist/playtrade.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/realtime.d.ts +1 -1
- package/node_modules/@playdrop/types/dist/tweaks.d.ts +4 -4
- package/node_modules/@playdrop/types/dist/tweaks.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/tweaks.js +12 -2
- package/node_modules/@playdrop/types/dist/version.d.ts +14 -14
- package/node_modules/@playdrop/types/dist/version.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/version.js +4 -1
- package/node_modules/@playdrop/vox-three/dist/src/index.d.ts +1 -1
- package/node_modules/@playdrop/vox-three/dist/src/vox.d.ts +2 -2
- package/node_modules/@playdrop/vox-three/dist/src/vox.js +20 -18
- package/node_modules/@playdrop/vox-three/dist/src/vox.js.map +1 -1
- package/node_modules/@playdrop/vox-three/dist/test/vox.test.js +11 -14
- package/node_modules/@playdrop/vox-three/dist/test/vox.test.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,257 @@
|
|
|
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.extractZipArchive = extractZipArchive;
|
|
7
|
+
exports.stageWorkspaceArchiveInChild = stageWorkspaceArchiveInChild;
|
|
8
|
+
const node_child_process_1 = require("node:child_process");
|
|
9
|
+
const node_fs_1 = require("node:fs");
|
|
10
|
+
const promises_1 = require("node:fs/promises");
|
|
11
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
12
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
13
|
+
const node_process_1 = __importDefault(require("node:process"));
|
|
14
|
+
const node_util_1 = require("node:util");
|
|
15
|
+
const fflate_1 = require("fflate");
|
|
16
|
+
const WORKSPACE_ARCHIVE_MAX_ENTRIES = 1000;
|
|
17
|
+
const WORKSPACE_ARCHIVE_MAX_DOWNLOAD_BYTES = 256 * 1024 * 1024;
|
|
18
|
+
const WORKSPACE_ARCHIVE_MAX_UNCOMPRESSED_BYTES = 100 * 1024 * 1024;
|
|
19
|
+
const WORKSPACE_ARCHIVE_STAGER_MAX_OLD_SPACE_MB = 256;
|
|
20
|
+
const WORKSPACE_ARCHIVE_STAGER_EXIT_GRACE_MS = 60000;
|
|
21
|
+
const ZIP_CENTRAL_DIRECTORY_SIGNATURE = 0x02014b50;
|
|
22
|
+
const ZIP_END_OF_CENTRAL_DIRECTORY_SIGNATURE = 0x06054b50;
|
|
23
|
+
const ZIP_END_OF_CENTRAL_DIRECTORY_MIN_BYTES = 22;
|
|
24
|
+
const ZIP_MAX_COMMENT_BYTES = 0xffff;
|
|
25
|
+
const execFileAsync = (0, node_util_1.promisify)(node_child_process_1.execFile);
|
|
26
|
+
function normalizeStageInput(value) {
|
|
27
|
+
const input = value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
28
|
+
const downloadUrl = typeof input?.downloadUrl === "string" ? input.downloadUrl.trim() : "";
|
|
29
|
+
const expectedSize = Number(input?.expectedSize);
|
|
30
|
+
const targetDir = typeof input?.targetDir === "string" ? input.targetDir.trim() : "";
|
|
31
|
+
const timeoutMs = Number(input?.timeoutMs);
|
|
32
|
+
if (!downloadUrl || !Number.isInteger(expectedSize) || expectedSize <= 0 || !node_path_1.default.isAbsolute(targetDir)) {
|
|
33
|
+
throw new Error("agent_task_workspace_archive_stager_input_invalid");
|
|
34
|
+
}
|
|
35
|
+
if (expectedSize > WORKSPACE_ARCHIVE_MAX_DOWNLOAD_BYTES) {
|
|
36
|
+
throw new Error(`agent_task_workspace_archive_download_too_large:${expectedSize}>${WORKSPACE_ARCHIVE_MAX_DOWNLOAD_BYTES}`);
|
|
37
|
+
}
|
|
38
|
+
if (!Number.isInteger(timeoutMs) || timeoutMs <= 0) {
|
|
39
|
+
throw new Error("agent_task_workspace_archive_download_timeout_invalid");
|
|
40
|
+
}
|
|
41
|
+
return { downloadUrl, expectedSize, targetDir, timeoutMs };
|
|
42
|
+
}
|
|
43
|
+
function assertWorkspaceArchiveExtractionBounds(buffer) {
|
|
44
|
+
if (buffer.length < ZIP_END_OF_CENTRAL_DIRECTORY_MIN_BYTES) {
|
|
45
|
+
throw new Error("agent_task_workspace_archive_invalid_zip");
|
|
46
|
+
}
|
|
47
|
+
const earliestEndRecordOffset = Math.max(0, buffer.length - ZIP_END_OF_CENTRAL_DIRECTORY_MIN_BYTES - ZIP_MAX_COMMENT_BYTES);
|
|
48
|
+
let endRecordOffset = -1;
|
|
49
|
+
for (let offset = buffer.length - ZIP_END_OF_CENTRAL_DIRECTORY_MIN_BYTES; offset >= earliestEndRecordOffset; offset -= 1) {
|
|
50
|
+
if (buffer.readUInt32LE(offset) === ZIP_END_OF_CENTRAL_DIRECTORY_SIGNATURE &&
|
|
51
|
+
offset + ZIP_END_OF_CENTRAL_DIRECTORY_MIN_BYTES + buffer.readUInt16LE(offset + 20) === buffer.length) {
|
|
52
|
+
endRecordOffset = offset;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (endRecordOffset < 0) {
|
|
57
|
+
throw new Error("agent_task_workspace_archive_invalid_zip");
|
|
58
|
+
}
|
|
59
|
+
const diskNumber = buffer.readUInt16LE(endRecordOffset + 4);
|
|
60
|
+
const centralDirectoryDisk = buffer.readUInt16LE(endRecordOffset + 6);
|
|
61
|
+
const diskEntryCount = buffer.readUInt16LE(endRecordOffset + 8);
|
|
62
|
+
const entryCount = buffer.readUInt16LE(endRecordOffset + 10);
|
|
63
|
+
const centralDirectorySize = buffer.readUInt32LE(endRecordOffset + 12);
|
|
64
|
+
const centralDirectoryOffset = buffer.readUInt32LE(endRecordOffset + 16);
|
|
65
|
+
if (diskNumber !== 0 ||
|
|
66
|
+
centralDirectoryDisk !== 0 ||
|
|
67
|
+
diskEntryCount !== entryCount ||
|
|
68
|
+
entryCount === 0xffff ||
|
|
69
|
+
centralDirectorySize === 0xffffffff ||
|
|
70
|
+
centralDirectoryOffset === 0xffffffff) {
|
|
71
|
+
throw new Error("agent_task_workspace_archive_unsupported_zip");
|
|
72
|
+
}
|
|
73
|
+
if (entryCount === 0) {
|
|
74
|
+
throw new Error("agent_task_workspace_archive_empty");
|
|
75
|
+
}
|
|
76
|
+
if (entryCount > WORKSPACE_ARCHIVE_MAX_ENTRIES) {
|
|
77
|
+
throw new Error(`agent_task_workspace_archive_too_many_entries:${entryCount}>${WORKSPACE_ARCHIVE_MAX_ENTRIES}`);
|
|
78
|
+
}
|
|
79
|
+
if (centralDirectoryOffset + centralDirectorySize !== endRecordOffset) {
|
|
80
|
+
throw new Error("agent_task_workspace_archive_invalid_zip");
|
|
81
|
+
}
|
|
82
|
+
let cursor = centralDirectoryOffset;
|
|
83
|
+
let uncompressedBytes = 0;
|
|
84
|
+
for (let entryIndex = 0; entryIndex < entryCount; entryIndex += 1) {
|
|
85
|
+
if (cursor + 46 > endRecordOffset || buffer.readUInt32LE(cursor) !== ZIP_CENTRAL_DIRECTORY_SIGNATURE) {
|
|
86
|
+
throw new Error("agent_task_workspace_archive_invalid_zip");
|
|
87
|
+
}
|
|
88
|
+
const compressedSize = buffer.readUInt32LE(cursor + 20);
|
|
89
|
+
const uncompressedSize = buffer.readUInt32LE(cursor + 24);
|
|
90
|
+
const fileNameLength = buffer.readUInt16LE(cursor + 28);
|
|
91
|
+
const extraFieldLength = buffer.readUInt16LE(cursor + 30);
|
|
92
|
+
const fileCommentLength = buffer.readUInt16LE(cursor + 32);
|
|
93
|
+
if (compressedSize === 0xffffffff || uncompressedSize === 0xffffffff) {
|
|
94
|
+
throw new Error("agent_task_workspace_archive_unsupported_zip");
|
|
95
|
+
}
|
|
96
|
+
const nextCursor = cursor + 46 + fileNameLength + extraFieldLength + fileCommentLength;
|
|
97
|
+
if (nextCursor > endRecordOffset) {
|
|
98
|
+
throw new Error("agent_task_workspace_archive_invalid_zip");
|
|
99
|
+
}
|
|
100
|
+
uncompressedBytes += uncompressedSize;
|
|
101
|
+
if (uncompressedBytes > WORKSPACE_ARCHIVE_MAX_UNCOMPRESSED_BYTES) {
|
|
102
|
+
throw new Error(`agent_task_workspace_archive_too_large:${uncompressedBytes}>${WORKSPACE_ARCHIVE_MAX_UNCOMPRESSED_BYTES}`);
|
|
103
|
+
}
|
|
104
|
+
cursor = nextCursor;
|
|
105
|
+
}
|
|
106
|
+
if (cursor !== endRecordOffset) {
|
|
107
|
+
throw new Error("agent_task_workspace_archive_invalid_zip");
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// This synchronous work is intentionally executed only by the disposable archive
|
|
111
|
+
// child. A malformed ZIP can terminate that child without blocking or terminating
|
|
112
|
+
// the long-lived worker process that owns presence and task heartbeats.
|
|
113
|
+
function extractZipArchive(zipBuffer, targetDir) {
|
|
114
|
+
assertWorkspaceArchiveExtractionBounds(Buffer.from(zipBuffer.buffer, zipBuffer.byteOffset, zipBuffer.byteLength));
|
|
115
|
+
const files = (0, fflate_1.unzipSync)(zipBuffer);
|
|
116
|
+
const names = Object.keys(files);
|
|
117
|
+
if (names.length === 0) {
|
|
118
|
+
throw new Error("agent_task_workspace_archive_empty");
|
|
119
|
+
}
|
|
120
|
+
if (names.length > WORKSPACE_ARCHIVE_MAX_ENTRIES) {
|
|
121
|
+
throw new Error(`agent_task_workspace_archive_too_many_entries:${names.length}>${WORKSPACE_ARCHIVE_MAX_ENTRIES}`);
|
|
122
|
+
}
|
|
123
|
+
const resolvedTarget = node_path_1.default.resolve(targetDir);
|
|
124
|
+
const written = [];
|
|
125
|
+
let uncompressedBytes = 0;
|
|
126
|
+
for (const originalName of names) {
|
|
127
|
+
const name = originalName.replace(/\\/g, "/");
|
|
128
|
+
if (!name || name.startsWith("/") || name.split("/").includes("..")) {
|
|
129
|
+
throw new Error(`agent_task_workspace_archive_unsafe_entry:${originalName}`);
|
|
130
|
+
}
|
|
131
|
+
const destination = node_path_1.default.resolve(resolvedTarget, name);
|
|
132
|
+
if (destination !== resolvedTarget && !destination.startsWith(resolvedTarget + node_path_1.default.sep)) {
|
|
133
|
+
throw new Error(`agent_task_workspace_archive_unsafe_entry:${originalName}`);
|
|
134
|
+
}
|
|
135
|
+
if (name.endsWith("/")) {
|
|
136
|
+
(0, node_fs_1.mkdirSync)(destination, { recursive: true });
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
uncompressedBytes += files[originalName].byteLength;
|
|
140
|
+
if (uncompressedBytes > WORKSPACE_ARCHIVE_MAX_UNCOMPRESSED_BYTES) {
|
|
141
|
+
throw new Error(`agent_task_workspace_archive_too_large:${uncompressedBytes}>${WORKSPACE_ARCHIVE_MAX_UNCOMPRESSED_BYTES}`);
|
|
142
|
+
}
|
|
143
|
+
(0, node_fs_1.mkdirSync)(node_path_1.default.dirname(destination), { recursive: true });
|
|
144
|
+
(0, node_fs_1.writeFileSync)(destination, Buffer.from(files[originalName]));
|
|
145
|
+
written.push(name);
|
|
146
|
+
}
|
|
147
|
+
return written;
|
|
148
|
+
}
|
|
149
|
+
async function downloadAndExtractWorkspaceArchive(input) {
|
|
150
|
+
const controller = new AbortController();
|
|
151
|
+
const timeout = setTimeout(() => controller.abort(), input.timeoutMs);
|
|
152
|
+
const stagingRoot = await (0, promises_1.mkdtemp)(node_path_1.default.join(node_os_1.default.tmpdir(), "playdrop-workspace-archive-"));
|
|
153
|
+
const archivePath = node_path_1.default.join(stagingRoot, "archive.zip");
|
|
154
|
+
const extractedDir = node_path_1.default.join(stagingRoot, "contents");
|
|
155
|
+
try {
|
|
156
|
+
const response = await fetch(input.downloadUrl, { signal: controller.signal });
|
|
157
|
+
if (!response.ok) {
|
|
158
|
+
throw new Error(`agent_task_workspace_archive_http_error:${response.status}`);
|
|
159
|
+
}
|
|
160
|
+
const contentLength = response.headers.get("content-length");
|
|
161
|
+
if (contentLength !== null && Number(contentLength) !== input.expectedSize) {
|
|
162
|
+
throw new Error(`agent_task_workspace_archive_size_mismatch:${contentLength}!=${input.expectedSize}`);
|
|
163
|
+
}
|
|
164
|
+
if (!response.body) {
|
|
165
|
+
throw new Error("agent_task_workspace_archive_body_missing");
|
|
166
|
+
}
|
|
167
|
+
const reader = response.body.getReader();
|
|
168
|
+
const file = await (0, promises_1.open)(archivePath, "wx");
|
|
169
|
+
let receivedBytes = 0;
|
|
170
|
+
try {
|
|
171
|
+
while (true) {
|
|
172
|
+
const chunk = await reader.read();
|
|
173
|
+
if (chunk.done) {
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
const buffer = Buffer.from(chunk.value);
|
|
177
|
+
if (receivedBytes + buffer.length > input.expectedSize) {
|
|
178
|
+
throw new Error(`agent_task_workspace_archive_size_mismatch:${receivedBytes + buffer.length}>${input.expectedSize}`);
|
|
179
|
+
}
|
|
180
|
+
let chunkOffset = 0;
|
|
181
|
+
while (chunkOffset < buffer.length) {
|
|
182
|
+
const result = await file.write(buffer, chunkOffset, buffer.length - chunkOffset, receivedBytes + chunkOffset);
|
|
183
|
+
if (result.bytesWritten <= 0) {
|
|
184
|
+
throw new Error("agent_task_workspace_archive_write_failed");
|
|
185
|
+
}
|
|
186
|
+
chunkOffset += result.bytesWritten;
|
|
187
|
+
}
|
|
188
|
+
receivedBytes += buffer.length;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
finally {
|
|
192
|
+
await file.close();
|
|
193
|
+
}
|
|
194
|
+
if (receivedBytes !== input.expectedSize) {
|
|
195
|
+
throw new Error(`agent_task_workspace_archive_size_mismatch:${receivedBytes}!=${input.expectedSize}`);
|
|
196
|
+
}
|
|
197
|
+
const buffer = await (0, promises_1.readFile)(archivePath);
|
|
198
|
+
await (0, promises_1.mkdir)(extractedDir, { recursive: true });
|
|
199
|
+
extractZipArchive(new Uint8Array(buffer), extractedDir);
|
|
200
|
+
await (0, promises_1.mkdir)(node_path_1.default.dirname(input.targetDir), { recursive: true });
|
|
201
|
+
await (0, promises_1.rm)(input.targetDir, { recursive: true, force: true });
|
|
202
|
+
await (0, promises_1.rename)(extractedDir, input.targetDir);
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
if (controller.signal.aborted) {
|
|
206
|
+
throw new Error("agent_task_workspace_archive_download_timeout");
|
|
207
|
+
}
|
|
208
|
+
throw error;
|
|
209
|
+
}
|
|
210
|
+
finally {
|
|
211
|
+
clearTimeout(timeout);
|
|
212
|
+
await (0, promises_1.rm)(stagingRoot, { recursive: true, force: true });
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function childFailureDetail(error) {
|
|
216
|
+
if (!error || typeof error !== "object") {
|
|
217
|
+
return String(error);
|
|
218
|
+
}
|
|
219
|
+
const detail = error;
|
|
220
|
+
const stderr = typeof detail.stderr === "string" ? detail.stderr.trim() : "";
|
|
221
|
+
if (stderr) {
|
|
222
|
+
return stderr.slice(0, 500);
|
|
223
|
+
}
|
|
224
|
+
if (typeof detail.signal === "string" && detail.signal) {
|
|
225
|
+
return `child_signal:${detail.signal}`;
|
|
226
|
+
}
|
|
227
|
+
return typeof detail.message === "string" ? detail.message : "archive_stager_failed";
|
|
228
|
+
}
|
|
229
|
+
async function stageWorkspaceArchiveInChild(input) {
|
|
230
|
+
const normalized = normalizeStageInput(input);
|
|
231
|
+
try {
|
|
232
|
+
await execFileAsync(node_process_1.default.execPath, [
|
|
233
|
+
`--max-old-space-size=${WORKSPACE_ARCHIVE_STAGER_MAX_OLD_SPACE_MB}`,
|
|
234
|
+
__filename,
|
|
235
|
+
JSON.stringify(normalized),
|
|
236
|
+
], {
|
|
237
|
+
timeout: normalized.timeoutMs + WORKSPACE_ARCHIVE_STAGER_EXIT_GRACE_MS,
|
|
238
|
+
maxBuffer: 64 * 1024,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
throw new Error(`agent_task_workspace_archive_stager_failed:${childFailureDetail(error)}`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
async function runArchiveStagerChild() {
|
|
246
|
+
const rawInput = node_process_1.default.argv[2];
|
|
247
|
+
if (!rawInput) {
|
|
248
|
+
throw new Error("agent_task_workspace_archive_stager_input_missing");
|
|
249
|
+
}
|
|
250
|
+
await downloadAndExtractWorkspaceArchive(normalizeStageInput(JSON.parse(rawInput)));
|
|
251
|
+
}
|
|
252
|
+
if (require.main === module) {
|
|
253
|
+
void runArchiveStagerChild().catch((error) => {
|
|
254
|
+
node_process_1.default.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
255
|
+
node_process_1.default.exitCode = 1;
|
|
256
|
+
});
|
|
257
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type InstrumentEvidenceCapture, type InstrumentEvidenceManifest } from
|
|
1
|
+
import { type InstrumentEvidenceCapture, type InstrumentEvidenceManifest } from "@playdrop/types";
|
|
2
2
|
export declare const INSTRUMENT_EVIDENCE_MANIFEST_FILE = "instrument-evidence.json";
|
|
3
3
|
export declare function createWorkerInstrumentScreenshotCollector(workspaceDir: string): {
|
|
4
4
|
push: (chunk: string) => number;
|
|
@@ -12,33 +12,33 @@ const node_crypto_1 = require("node:crypto");
|
|
|
12
12
|
const node_fs_1 = require("node:fs");
|
|
13
13
|
const node_path_1 = __importDefault(require("node:path"));
|
|
14
14
|
const sharp_1 = __importDefault(require("sharp"));
|
|
15
|
-
const SCREENSHOT_STORE_DIR =
|
|
16
|
-
const SCREENSHOT_INDEX_FILE =
|
|
17
|
-
exports.INSTRUMENT_EVIDENCE_MANIFEST_FILE =
|
|
15
|
+
const SCREENSHOT_STORE_DIR = ".playdrop-instrument-screenshots";
|
|
16
|
+
const SCREENSHOT_INDEX_FILE = "index.json";
|
|
17
|
+
exports.INSTRUMENT_EVIDENCE_MANIFEST_FILE = "instrument-evidence.json";
|
|
18
18
|
const GROUP_ID_PATTERN = /^[a-z0-9][a-z0-9_-]{0,63}$/;
|
|
19
19
|
const SHA256_PATTERN = /^[a-f0-9]{64}$/;
|
|
20
20
|
function sha256(buffer) {
|
|
21
|
-
return (0, node_crypto_1.createHash)(
|
|
21
|
+
return (0, node_crypto_1.createHash)("sha256").update(buffer).digest("hex");
|
|
22
22
|
}
|
|
23
23
|
function isPathInside(parent, child) {
|
|
24
24
|
const relative = node_path_1.default.relative(parent, child);
|
|
25
|
-
return relative ===
|
|
25
|
+
return relative === "" || (!!relative && !relative.startsWith("..") && !node_path_1.default.isAbsolute(relative));
|
|
26
26
|
}
|
|
27
27
|
function writeJsonAtomic(filePath, value) {
|
|
28
28
|
(0, node_fs_1.mkdirSync)(node_path_1.default.dirname(filePath), { recursive: true });
|
|
29
29
|
const tempPath = `${filePath}.${process.pid}.tmp`;
|
|
30
|
-
(0, node_fs_1.writeFileSync)(tempPath, `${JSON.stringify(value, null, 2)}\n`,
|
|
30
|
+
(0, node_fs_1.writeFileSync)(tempPath, `${JSON.stringify(value, null, 2)}\n`, "utf8");
|
|
31
31
|
(0, node_fs_1.renameSync)(tempPath, filePath);
|
|
32
32
|
}
|
|
33
33
|
function readJsonRecord(filePath, code) {
|
|
34
34
|
let parsed;
|
|
35
35
|
try {
|
|
36
|
-
parsed = JSON.parse((0, node_fs_1.readFileSync)(filePath,
|
|
36
|
+
parsed = JSON.parse((0, node_fs_1.readFileSync)(filePath, "utf8"));
|
|
37
37
|
}
|
|
38
38
|
catch (error) {
|
|
39
39
|
throw new Error(`${code}:${error instanceof Error ? error.message : String(error)}`);
|
|
40
40
|
}
|
|
41
|
-
if (!parsed || typeof parsed !==
|
|
41
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
42
42
|
throw new Error(code);
|
|
43
43
|
}
|
|
44
44
|
return parsed;
|
|
@@ -54,20 +54,20 @@ function readScreenshotIndex(workspaceDir) {
|
|
|
54
54
|
if (!(0, node_fs_1.existsSync)(filePath)) {
|
|
55
55
|
return { version: 1, screenshots: {} };
|
|
56
56
|
}
|
|
57
|
-
const parsed = readJsonRecord(filePath,
|
|
58
|
-
const screenshots = parsed[
|
|
59
|
-
if (parsed[
|
|
60
|
-
throw new Error(
|
|
57
|
+
const parsed = readJsonRecord(filePath, "invalid_instrument_screenshot_index");
|
|
58
|
+
const screenshots = parsed["screenshots"];
|
|
59
|
+
if (parsed["version"] !== 1 || !screenshots || typeof screenshots !== "object" || Array.isArray(screenshots)) {
|
|
60
|
+
throw new Error("invalid_instrument_screenshot_index");
|
|
61
61
|
}
|
|
62
62
|
return parsed;
|
|
63
63
|
}
|
|
64
64
|
function extensionForMediaType(mediaType) {
|
|
65
|
-
return mediaType ===
|
|
65
|
+
return mediaType === "image/jpeg" ? "jpg" : "png";
|
|
66
66
|
}
|
|
67
67
|
function createWorkerInstrumentScreenshotCollector(workspaceDir) {
|
|
68
68
|
const resolvedWorkspace = node_path_1.default.resolve(workspaceDir);
|
|
69
69
|
const store = (screenshot) => {
|
|
70
|
-
const buffer = Buffer.from(screenshot.dataBase64,
|
|
70
|
+
const buffer = Buffer.from(screenshot.dataBase64, "base64");
|
|
71
71
|
if (buffer.length <= 0) {
|
|
72
72
|
throw new Error(`invalid_claude_screenshot_payload:${screenshot.screenshotId}`);
|
|
73
73
|
}
|
|
@@ -109,7 +109,7 @@ function resolveLatestUnusedScreenshotId(workspaceDir, index) {
|
|
|
109
109
|
walk(entryPath);
|
|
110
110
|
}
|
|
111
111
|
else if (entry.name === exports.INSTRUMENT_EVIDENCE_MANIFEST_FILE) {
|
|
112
|
-
const manifest = readJsonRecord(entryPath,
|
|
112
|
+
const manifest = readJsonRecord(entryPath, "invalid_instrument_evidence_manifest");
|
|
113
113
|
for (const capture of Object.values(manifest.captures ?? {})) {
|
|
114
114
|
if (capture?.screenshotId) {
|
|
115
115
|
used.add(capture.screenshotId);
|
|
@@ -124,7 +124,7 @@ function resolveLatestUnusedScreenshotId(workspaceDir, index) {
|
|
|
124
124
|
.sort((a, b) => a.capturedAt.localeCompare(b.capturedAt));
|
|
125
125
|
const latest = candidates.at(-1);
|
|
126
126
|
if (!latest) {
|
|
127
|
-
throw new Error(
|
|
127
|
+
throw new Error("instrument_screenshot_none_available");
|
|
128
128
|
}
|
|
129
129
|
return latest.screenshotId;
|
|
130
130
|
}
|
|
@@ -146,7 +146,7 @@ function resolveEvidenceDir(workspaceDir, evidenceDir) {
|
|
|
146
146
|
const resolvedWorkspace = node_path_1.default.resolve(workspaceDir);
|
|
147
147
|
const resolvedEvidenceDir = node_path_1.default.resolve(evidenceDir);
|
|
148
148
|
if (!isPathInside(resolvedWorkspace, resolvedEvidenceDir)) {
|
|
149
|
-
throw new Error(
|
|
149
|
+
throw new Error("instrument_evidence_dir_outside_workspace");
|
|
150
150
|
}
|
|
151
151
|
return resolvedEvidenceDir;
|
|
152
152
|
}
|
|
@@ -155,13 +155,13 @@ function readManifestIfPresent(evidenceDir) {
|
|
|
155
155
|
if (!(0, node_fs_1.existsSync)(filePath)) {
|
|
156
156
|
return null;
|
|
157
157
|
}
|
|
158
|
-
return readJsonRecord(filePath,
|
|
158
|
+
return readJsonRecord(filePath, "invalid_instrument_evidence_manifest");
|
|
159
159
|
}
|
|
160
160
|
async function saveInstrumentEvidenceCapture(input) {
|
|
161
161
|
const evidenceName = normalizeEvidenceName(input.name);
|
|
162
162
|
const groupId = normalizeGroupId(input.groupId);
|
|
163
163
|
const index = readScreenshotIndex(input.workspaceDir);
|
|
164
|
-
const requestedId = input.screenshotId?.trim() ??
|
|
164
|
+
const requestedId = input.screenshotId?.trim() ?? "";
|
|
165
165
|
// With no id, persist the capture the judge just took: the most recent one not already used as
|
|
166
166
|
// evidence. The judge never has to track ids, and a failed capture simply is not there to pick.
|
|
167
167
|
const screenshotId = requestedId || resolveLatestUnusedScreenshotId(input.workspaceDir, index);
|
|
@@ -207,28 +207,26 @@ async function saveInstrumentEvidenceCapture(input) {
|
|
|
207
207
|
return capture;
|
|
208
208
|
}
|
|
209
209
|
function normalizeCapture(value, name) {
|
|
210
|
-
const capture = value && typeof value ===
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const
|
|
214
|
-
const
|
|
215
|
-
const
|
|
216
|
-
const
|
|
217
|
-
const
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
||
|
|
223
|
-
||
|
|
224
|
-
|
|
225
|
-
||
|
|
226
|
-
||
|
|
227
|
-
|
|
228
|
-
||
|
|
229
|
-
|
|
230
|
-
|| !SHA256_PATTERN.test(hash)
|
|
231
|
-
|| !capturedAt) {
|
|
210
|
+
const capture = value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
211
|
+
const screenshotId = typeof capture?.["screenshotId"] === "string" ? capture["screenshotId"].trim() : "";
|
|
212
|
+
const tabId = Number(capture?.["tabId"]);
|
|
213
|
+
const toolUseId = typeof capture?.["toolUseId"] === "string" ? capture["toolUseId"].trim() : "";
|
|
214
|
+
const mediaType = capture?.["mediaType"];
|
|
215
|
+
const fileName = typeof capture?.["fileName"] === "string" ? capture["fileName"].trim() : "";
|
|
216
|
+
const hash = typeof capture?.["sha256"] === "string" ? capture["sha256"].trim().toLowerCase() : "";
|
|
217
|
+
const sourceHash = typeof capture?.["sourceSha256"] === "string" ? capture["sourceSha256"].trim().toLowerCase() : "";
|
|
218
|
+
const capturedAt = typeof capture?.["capturedAt"] === "string" ? capture["capturedAt"].trim() : "";
|
|
219
|
+
if (capture?.["name"] !== name ||
|
|
220
|
+
!screenshotId ||
|
|
221
|
+
!Number.isInteger(tabId) ||
|
|
222
|
+
tabId <= 0 ||
|
|
223
|
+
!toolUseId ||
|
|
224
|
+
(mediaType !== "image/jpeg" && mediaType !== "image/png") ||
|
|
225
|
+
node_path_1.default.basename(fileName) !== fileName ||
|
|
226
|
+
!fileName ||
|
|
227
|
+
!SHA256_PATTERN.test(sourceHash) ||
|
|
228
|
+
!SHA256_PATTERN.test(hash) ||
|
|
229
|
+
!capturedAt) {
|
|
232
230
|
throw new Error(`invalid_instrument_evidence_capture:${name}`);
|
|
233
231
|
}
|
|
234
232
|
return {
|
|
@@ -247,12 +245,12 @@ function readAndValidateInstrumentEvidenceManifest(input) {
|
|
|
247
245
|
const evidenceDir = resolveEvidenceDir(input.workspaceDir, input.evidenceDir);
|
|
248
246
|
const parsed = readManifestIfPresent(evidenceDir);
|
|
249
247
|
if (!parsed || parsed.version !== 1) {
|
|
250
|
-
throw new Error(
|
|
248
|
+
throw new Error("missing_instrument_evidence_manifest");
|
|
251
249
|
}
|
|
252
250
|
const groupId = normalizeGroupId(parsed.groupId);
|
|
253
251
|
const controlledTabId = Number(parsed.controlledTabId);
|
|
254
252
|
if (!Number.isInteger(controlledTabId) || controlledTabId <= 0) {
|
|
255
|
-
throw new Error(
|
|
253
|
+
throw new Error("invalid_instrument_evidence_tab");
|
|
256
254
|
}
|
|
257
255
|
const captures = {};
|
|
258
256
|
const screenshotIds = new Set();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentRuntime, AgentWorkerCapabilities, AgentWorkerWeeklyUsage, AgentWorkerWeeklyUsageStatus } from
|
|
1
|
+
import type { AgentRuntime, AgentWorkerCapabilities, AgentWorkerWeeklyUsage, AgentWorkerWeeklyUsageStatus } from "@playdrop/types";
|
|
2
2
|
export interface WorkerAgentProviderTelemetry {
|
|
3
3
|
account: string | null;
|
|
4
4
|
plan: string | null;
|
|
@@ -12,6 +12,7 @@ export declare function calculateWeeklyUsageRouting(remainingPercent: number, re
|
|
|
12
12
|
} | null;
|
|
13
13
|
export declare function buildCodexProviderTelemetry(accountResult: unknown, rateLimitsResult: unknown, checkedAt: string): WorkerAgentProviderTelemetry;
|
|
14
14
|
export declare function buildClaudeProviderTelemetry(authStatus: unknown, credentialMetadata: unknown, usageResult: unknown, checkedAt: string): WorkerAgentProviderTelemetry;
|
|
15
|
+
export declare function buildGrokProviderTelemetry(authEntryValue: unknown, billingResult: unknown, checkedAt: string): WorkerAgentProviderTelemetry;
|
|
15
16
|
export declare function probeWorkerProviderTelemetry(capabilities: AgentWorkerCapabilities): Promise<Partial<Record<AgentRuntime, WorkerAgentProviderTelemetry>>>;
|
|
16
17
|
export declare function mergeWorkerProviderTelemetry(capabilities: AgentWorkerCapabilities, telemetry: Partial<Record<AgentRuntime, WorkerAgentProviderTelemetry>>): AgentWorkerCapabilities;
|
|
17
18
|
export declare function preserveWorkerProviderTelemetry(capabilities: AgentWorkerCapabilities, previous: AgentWorkerCapabilities): AgentWorkerCapabilities;
|