@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
|
@@ -11,11 +11,13 @@ exports.extractAgentTokenUsage = extractAgentTokenUsage;
|
|
|
11
11
|
exports.extractCodexRolloutTokenUsage = extractCodexRolloutTokenUsage;
|
|
12
12
|
exports.extractCodexThreadId = extractCodexThreadId;
|
|
13
13
|
exports.extractClaudeSessionId = extractClaudeSessionId;
|
|
14
|
+
exports.extractGrokRunMetadata = extractGrokRunMetadata;
|
|
14
15
|
exports.readCodexRolloutTokenUsageForThread = readCodexRolloutTokenUsageForThread;
|
|
15
16
|
exports.extractCodexTokensUsed = extractCodexTokensUsed;
|
|
16
17
|
exports.assertWorkerTokenUsageWithinCap = assertWorkerTokenUsageWithinCap;
|
|
17
18
|
exports.runLoggedProcess = runLoggedProcess;
|
|
18
19
|
exports.buildCodexExecArgs = buildCodexExecArgs;
|
|
20
|
+
exports.buildGrokExecArgs = buildGrokExecArgs;
|
|
19
21
|
exports.readCodexSandboxMode = readCodexSandboxMode;
|
|
20
22
|
exports.buildClaudeExecArgs = buildClaudeExecArgs;
|
|
21
23
|
exports.resolvePlaywrightMcpCliPath = resolvePlaywrightMcpCliPath;
|
|
@@ -50,7 +52,7 @@ function throwLoggedProcessError(error) {
|
|
|
50
52
|
}
|
|
51
53
|
function resolveDescendantProcessIds(processTable, rootPid) {
|
|
52
54
|
if (!Number.isInteger(rootPid) || rootPid <= 0) {
|
|
53
|
-
throw new Error(
|
|
55
|
+
throw new Error("invalid_process_tree_root");
|
|
54
56
|
}
|
|
55
57
|
const childrenByParent = new Map();
|
|
56
58
|
for (const line of processTable.split(/\r?\n/)) {
|
|
@@ -75,18 +77,18 @@ function resolveDescendantProcessIds(processTable, rootPid) {
|
|
|
75
77
|
return descendants;
|
|
76
78
|
}
|
|
77
79
|
function collectProcessTreeIds(rootPid) {
|
|
78
|
-
if (process.platform ===
|
|
80
|
+
if (process.platform === "win32") {
|
|
79
81
|
return [rootPid];
|
|
80
82
|
}
|
|
81
|
-
const result = (0, node_child_process_1.spawnSync)(
|
|
82
|
-
encoding:
|
|
83
|
+
const result = (0, node_child_process_1.spawnSync)("ps", ["-axo", "pid=,ppid="], {
|
|
84
|
+
encoding: "utf8",
|
|
83
85
|
timeout: 5000,
|
|
84
86
|
});
|
|
85
87
|
if (result.status !== 0) {
|
|
86
|
-
console.error(`worker_process_tree_probe_failed:${result.stderr?.trim() || result.stdout?.trim() || result.error?.message ||
|
|
88
|
+
console.error(`worker_process_tree_probe_failed:${result.stderr?.trim() || result.stdout?.trim() || result.error?.message || "unknown"}`);
|
|
87
89
|
return [rootPid];
|
|
88
90
|
}
|
|
89
|
-
return [...resolveDescendantProcessIds(result.stdout ||
|
|
91
|
+
return [...resolveDescendantProcessIds(result.stdout || "", rootPid), rootPid];
|
|
90
92
|
}
|
|
91
93
|
function signalProcessIds(processIds, signal) {
|
|
92
94
|
for (const pid of processIds) {
|
|
@@ -94,7 +96,7 @@ function signalProcessIds(processIds, signal) {
|
|
|
94
96
|
process.kill(pid, signal);
|
|
95
97
|
}
|
|
96
98
|
catch (error) {
|
|
97
|
-
if (error.code !==
|
|
99
|
+
if (error.code !== "ESRCH") {
|
|
98
100
|
console.error(`worker_process_tree_signal_failed:${pid}:${signal}:${error instanceof Error ? error.message : String(error)}`);
|
|
99
101
|
}
|
|
100
102
|
}
|
|
@@ -105,7 +107,7 @@ function signalProcessGroup(rootPid, signal) {
|
|
|
105
107
|
process.kill(-rootPid, signal);
|
|
106
108
|
}
|
|
107
109
|
catch (error) {
|
|
108
|
-
if (error.code !==
|
|
110
|
+
if (error.code !== "ESRCH") {
|
|
109
111
|
console.error(`worker_process_group_signal_failed:${rootPid}:${signal}:${error instanceof Error ? error.message : String(error)}`);
|
|
110
112
|
}
|
|
111
113
|
}
|
|
@@ -126,16 +128,16 @@ function readEnvBoolean(name, fallback) {
|
|
|
126
128
|
if (!raw) {
|
|
127
129
|
return fallback;
|
|
128
130
|
}
|
|
129
|
-
if (raw ===
|
|
131
|
+
if (raw === "1" || raw === "true" || raw === "yes" || raw === "on") {
|
|
130
132
|
return true;
|
|
131
133
|
}
|
|
132
|
-
if (raw ===
|
|
134
|
+
if (raw === "0" || raw === "false" || raw === "no" || raw === "off") {
|
|
133
135
|
return false;
|
|
134
136
|
}
|
|
135
137
|
throw new Error(`invalid_${name.toLowerCase()}`);
|
|
136
138
|
}
|
|
137
139
|
function normalizeTokenCount(value) {
|
|
138
|
-
if (typeof value !==
|
|
140
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
139
141
|
return null;
|
|
140
142
|
}
|
|
141
143
|
return Math.ceil(value);
|
|
@@ -150,7 +152,7 @@ function normalizeFirstTokenCount(...values) {
|
|
|
150
152
|
return null;
|
|
151
153
|
}
|
|
152
154
|
function coerceRecord(value) {
|
|
153
|
-
if (!value || typeof value !==
|
|
155
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
154
156
|
return null;
|
|
155
157
|
}
|
|
156
158
|
return value;
|
|
@@ -183,7 +185,7 @@ function readStructuredUsage(parsed) {
|
|
|
183
185
|
}
|
|
184
186
|
function readCodexRolloutStructuredUsage(parsed) {
|
|
185
187
|
const root = coerceRecord(parsed);
|
|
186
|
-
if (!root || root.type !==
|
|
188
|
+
if (!root || root.type !== "token_count") {
|
|
187
189
|
return null;
|
|
188
190
|
}
|
|
189
191
|
const info = coerceRecord(root.info);
|
|
@@ -194,17 +196,10 @@ function normalizeAgentTokenUsageFromRecord(usage) {
|
|
|
194
196
|
const cacheCreationInputTokens = normalizeFirstTokenCount(usage.cache_creation_input_tokens, usage.cacheCreationInputTokens);
|
|
195
197
|
const cacheReadInputTokens = normalizeFirstTokenCount(usage.cache_read_input_tokens, usage.cached_input_tokens, usage.cacheReadInputTokens);
|
|
196
198
|
const rawInputTokens = normalizeFirstTokenCount(usage.input_tokens, usage.inputTokens);
|
|
197
|
-
const inputTokens = rawInputTokens !== null
|
|
198
|
-
&& cacheReadInputTokens !== null
|
|
199
|
-
&& usage.cached_input_tokens !== undefined
|
|
199
|
+
const inputTokens = rawInputTokens !== null && cacheReadInputTokens !== null && usage.cached_input_tokens !== undefined
|
|
200
200
|
? Math.max(0, rawInputTokens - cacheReadInputTokens)
|
|
201
201
|
: rawInputTokens;
|
|
202
|
-
const tokenParts = [
|
|
203
|
-
inputTokens,
|
|
204
|
-
outputTokens,
|
|
205
|
-
cacheCreationInputTokens,
|
|
206
|
-
cacheReadInputTokens,
|
|
207
|
-
];
|
|
202
|
+
const tokenParts = [inputTokens, outputTokens, cacheCreationInputTokens, cacheReadInputTokens];
|
|
208
203
|
const sawTokenValue = tokenParts.some((value) => value !== null);
|
|
209
204
|
if (!sawTokenValue) {
|
|
210
205
|
return null;
|
|
@@ -219,7 +214,7 @@ function normalizeAgentTokenUsageFromRecord(usage) {
|
|
|
219
214
|
usageParseError: null,
|
|
220
215
|
};
|
|
221
216
|
}
|
|
222
|
-
function missingAgentTokenUsage(reason =
|
|
217
|
+
function missingAgentTokenUsage(reason = "agent_usage_not_reported") {
|
|
223
218
|
return {
|
|
224
219
|
inputTokens: null,
|
|
225
220
|
outputTokens: null,
|
|
@@ -233,7 +228,7 @@ function missingAgentTokenUsage(reason = 'agent_usage_not_reported') {
|
|
|
233
228
|
function extractAgentTokenUsage(output) {
|
|
234
229
|
for (const line of output.split(/\r?\n/).reverse()) {
|
|
235
230
|
const trimmed = line.trim();
|
|
236
|
-
if (!trimmed.startsWith(
|
|
231
|
+
if (!trimmed.startsWith("{") || !trimmed.endsWith("}")) {
|
|
237
232
|
continue;
|
|
238
233
|
}
|
|
239
234
|
try {
|
|
@@ -256,7 +251,7 @@ function extractAgentTokenUsage(output) {
|
|
|
256
251
|
function extractCodexRolloutTokenUsage(output) {
|
|
257
252
|
for (const line of output.split(/\r?\n/).reverse()) {
|
|
258
253
|
const trimmed = line.trim();
|
|
259
|
-
if (!trimmed.startsWith(
|
|
254
|
+
if (!trimmed.startsWith("{") || !trimmed.endsWith("}")) {
|
|
260
255
|
continue;
|
|
261
256
|
}
|
|
262
257
|
try {
|
|
@@ -279,7 +274,7 @@ function extractCodexRolloutTokenUsage(output) {
|
|
|
279
274
|
function extractCodexThreadId(output) {
|
|
280
275
|
for (const line of output.split(/\r?\n/)) {
|
|
281
276
|
const trimmed = line.trim();
|
|
282
|
-
if (!trimmed.startsWith(
|
|
277
|
+
if (!trimmed.startsWith("{") || !trimmed.endsWith("}")) {
|
|
283
278
|
continue;
|
|
284
279
|
}
|
|
285
280
|
try {
|
|
@@ -287,13 +282,13 @@ function extractCodexThreadId(output) {
|
|
|
287
282
|
if (!root) {
|
|
288
283
|
continue;
|
|
289
284
|
}
|
|
290
|
-
const type = typeof root.type ===
|
|
291
|
-
const rawThreadId = type ===
|
|
292
|
-
? root.thread_id ?? root.threadId
|
|
293
|
-
: type ===
|
|
294
|
-
? root.session_id ?? root.sessionId
|
|
285
|
+
const type = typeof root.type === "string" ? root.type : "";
|
|
286
|
+
const rawThreadId = type === "thread.started"
|
|
287
|
+
? (root.thread_id ?? root.threadId)
|
|
288
|
+
: type === "session_meta"
|
|
289
|
+
? (root.session_id ?? root.sessionId)
|
|
295
290
|
: null;
|
|
296
|
-
if (typeof rawThreadId ===
|
|
291
|
+
if (typeof rawThreadId === "string" && rawThreadId.trim()) {
|
|
297
292
|
return rawThreadId.trim();
|
|
298
293
|
}
|
|
299
294
|
}
|
|
@@ -306,13 +301,13 @@ function extractCodexThreadId(output) {
|
|
|
306
301
|
function extractClaudeSessionId(output) {
|
|
307
302
|
for (const line of output.split(/\r?\n/)) {
|
|
308
303
|
const trimmed = line.trim();
|
|
309
|
-
if (!trimmed.startsWith(
|
|
304
|
+
if (!trimmed.startsWith("{") || !trimmed.endsWith("}")) {
|
|
310
305
|
continue;
|
|
311
306
|
}
|
|
312
307
|
try {
|
|
313
308
|
const root = coerceRecord(JSON.parse(trimmed));
|
|
314
309
|
const rawSessionId = root?.session_id ?? root?.sessionId;
|
|
315
|
-
if (typeof rawSessionId ===
|
|
310
|
+
if (typeof rawSessionId === "string" && rawSessionId.trim()) {
|
|
316
311
|
return rawSessionId.trim();
|
|
317
312
|
}
|
|
318
313
|
}
|
|
@@ -322,6 +317,45 @@ function extractClaudeSessionId(output) {
|
|
|
322
317
|
}
|
|
323
318
|
return null;
|
|
324
319
|
}
|
|
320
|
+
function extractGrokRunMetadata(output) {
|
|
321
|
+
const fallbackTokenUsage = extractAgentTokenUsage(output);
|
|
322
|
+
for (const line of output.split(/\r?\n/).reverse()) {
|
|
323
|
+
const trimmed = line.trim();
|
|
324
|
+
if (!trimmed.startsWith("{") || !trimmed.endsWith("}")) {
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
try {
|
|
328
|
+
const root = coerceRecord(JSON.parse(trimmed));
|
|
329
|
+
if (!root || (root.type !== "result" && root.type !== "end" && root.type !== "error")) {
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
const rawSessionId = root.sessionId ?? root.session_id;
|
|
333
|
+
const sessionId = typeof rawSessionId === "string" && rawSessionId.trim() ? rawSessionId.trim() : null;
|
|
334
|
+
const modelUsage = coerceRecord(root.modelUsage);
|
|
335
|
+
const resolvedRuntimeModel = modelUsage && Object.keys(modelUsage).length === 1
|
|
336
|
+
? Object.keys(modelUsage)[0]
|
|
337
|
+
: typeof root.model === "string" && root.model.trim()
|
|
338
|
+
? root.model.trim()
|
|
339
|
+
: null;
|
|
340
|
+
return {
|
|
341
|
+
sessionId,
|
|
342
|
+
resolvedRuntimeModel,
|
|
343
|
+
tokenUsage: {
|
|
344
|
+
...fallbackTokenUsage,
|
|
345
|
+
rawProviderUsage: root,
|
|
346
|
+
},
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
catch {
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return {
|
|
354
|
+
sessionId: null,
|
|
355
|
+
resolvedRuntimeModel: null,
|
|
356
|
+
tokenUsage: fallbackTokenUsage,
|
|
357
|
+
};
|
|
358
|
+
}
|
|
325
359
|
async function findCodexRolloutFileForThread(threadId, sessionsRoot) {
|
|
326
360
|
const stack = [{ dir: sessionsRoot, depth: 0 }];
|
|
327
361
|
const matches = [];
|
|
@@ -332,7 +366,7 @@ async function findCodexRolloutFileForThread(threadId, sessionsRoot) {
|
|
|
332
366
|
entries = await (0, promises_1.readdir)(current.dir, { withFileTypes: true });
|
|
333
367
|
}
|
|
334
368
|
catch (error) {
|
|
335
|
-
if (error.code ===
|
|
369
|
+
if (error.code === "ENOENT") {
|
|
336
370
|
continue;
|
|
337
371
|
}
|
|
338
372
|
throw error;
|
|
@@ -345,10 +379,10 @@ async function findCodexRolloutFileForThread(threadId, sessionsRoot) {
|
|
|
345
379
|
}
|
|
346
380
|
continue;
|
|
347
381
|
}
|
|
348
|
-
if (entry.isFile()
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
382
|
+
if (entry.isFile() &&
|
|
383
|
+
entry.name.startsWith("rollout-") &&
|
|
384
|
+
entry.name.endsWith(".jsonl") &&
|
|
385
|
+
entry.name.includes(threadId)) {
|
|
352
386
|
matches.push(entryPath);
|
|
353
387
|
}
|
|
354
388
|
}
|
|
@@ -362,14 +396,14 @@ async function findCodexRolloutFileForThread(threadId, sessionsRoot) {
|
|
|
362
396
|
async function readCodexRolloutTokenUsageForThread(threadId, options = {}) {
|
|
363
397
|
const normalizedThreadId = threadId.trim();
|
|
364
398
|
if (!normalizedThreadId) {
|
|
365
|
-
return missingAgentTokenUsage(
|
|
399
|
+
return missingAgentTokenUsage("codex_thread_id_missing");
|
|
366
400
|
}
|
|
367
|
-
const sessionsRoot = options.sessionsRoot ?? node_path_1.default.join(node_os_1.default.homedir(),
|
|
401
|
+
const sessionsRoot = options.sessionsRoot ?? node_path_1.default.join(node_os_1.default.homedir(), ".codex", "sessions");
|
|
368
402
|
const rolloutPath = await findCodexRolloutFileForThread(normalizedThreadId, sessionsRoot);
|
|
369
403
|
if (!rolloutPath) {
|
|
370
|
-
return missingAgentTokenUsage(
|
|
404
|
+
return missingAgentTokenUsage("codex_rollout_file_not_found");
|
|
371
405
|
}
|
|
372
|
-
const output = await (0, promises_1.readFile)(rolloutPath,
|
|
406
|
+
const output = await (0, promises_1.readFile)(rolloutPath, "utf8");
|
|
373
407
|
if (options.deleteAfterRead !== false) {
|
|
374
408
|
await (0, promises_1.rm)(rolloutPath, { force: true });
|
|
375
409
|
}
|
|
@@ -389,22 +423,22 @@ function assertWorkerTokenUsageWithinCap(input) {
|
|
|
389
423
|
}
|
|
390
424
|
async function runLoggedProcess(input) {
|
|
391
425
|
if (!input.command.trim()) {
|
|
392
|
-
throw new Error(
|
|
426
|
+
throw new Error("invalid_process_command");
|
|
393
427
|
}
|
|
394
428
|
if (!Number.isInteger(input.timeoutMs) || input.timeoutMs <= 0) {
|
|
395
|
-
throw new Error(
|
|
429
|
+
throw new Error("invalid_process_timeout");
|
|
396
430
|
}
|
|
397
431
|
if (!Number.isInteger(input.maxOutputChars) || input.maxOutputChars <= 0) {
|
|
398
|
-
throw new Error(
|
|
432
|
+
throw new Error("invalid_process_log_tail");
|
|
399
433
|
}
|
|
400
434
|
const transcriptFlushIntervalMs = input.transcriptFlushIntervalMs ?? exports.DEFAULT_TRANSCRIPT_FLUSH_INTERVAL_MS;
|
|
401
435
|
if (input.onTranscriptChunks && (!Number.isInteger(transcriptFlushIntervalMs) || transcriptFlushIntervalMs <= 0)) {
|
|
402
|
-
throw new Error(
|
|
436
|
+
throw new Error("invalid_process_transcript_flush_interval");
|
|
403
437
|
}
|
|
404
438
|
return await new Promise((resolve, reject) => {
|
|
405
|
-
let stdout =
|
|
406
|
-
let stderr =
|
|
407
|
-
let combined =
|
|
439
|
+
let stdout = "";
|
|
440
|
+
let stderr = "";
|
|
441
|
+
let combined = "";
|
|
408
442
|
let timedOut = false;
|
|
409
443
|
let closed = false;
|
|
410
444
|
let killTimer = null;
|
|
@@ -416,16 +450,16 @@ async function runLoggedProcess(input) {
|
|
|
416
450
|
const pendingTranscriptChunks = [];
|
|
417
451
|
const child = (0, node_child_process_1.spawn)(input.command, input.args, {
|
|
418
452
|
cwd: input.cwd,
|
|
419
|
-
stdio: [
|
|
453
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
420
454
|
env: input.env,
|
|
421
|
-
detached: process.platform !==
|
|
455
|
+
detached: process.platform !== "win32",
|
|
422
456
|
});
|
|
423
|
-
child.stdin?.end(input.stdin ??
|
|
457
|
+
child.stdin?.end(input.stdin ?? "");
|
|
424
458
|
const terminateProcessTree = (signal) => {
|
|
425
459
|
if (!child.pid) {
|
|
426
460
|
return;
|
|
427
461
|
}
|
|
428
|
-
if (process.platform !==
|
|
462
|
+
if (process.platform !== "win32") {
|
|
429
463
|
signalProcessGroup(child.pid, signal);
|
|
430
464
|
return;
|
|
431
465
|
}
|
|
@@ -440,9 +474,9 @@ async function runLoggedProcess(input) {
|
|
|
440
474
|
if (closed) {
|
|
441
475
|
return;
|
|
442
476
|
}
|
|
443
|
-
terminateProcessTree(
|
|
477
|
+
terminateProcessTree("SIGTERM");
|
|
444
478
|
terminateKillTimer = setTimeout(() => {
|
|
445
|
-
terminateProcessTree(
|
|
479
|
+
terminateProcessTree("SIGKILL");
|
|
446
480
|
}, CHILD_KILL_GRACE_MS);
|
|
447
481
|
},
|
|
448
482
|
});
|
|
@@ -468,7 +502,7 @@ async function runLoggedProcess(input) {
|
|
|
468
502
|
const handleTranscriptFlushError = (error) => {
|
|
469
503
|
transcriptFlushError = transcriptFlushError ?? (error instanceof Error ? error : new Error(String(error)));
|
|
470
504
|
if (!closed) {
|
|
471
|
-
terminateProcessTree(
|
|
505
|
+
terminateProcessTree("SIGTERM");
|
|
472
506
|
}
|
|
473
507
|
};
|
|
474
508
|
if (input.onTranscriptChunks) {
|
|
@@ -477,8 +511,8 @@ async function runLoggedProcess(input) {
|
|
|
477
511
|
}, transcriptFlushIntervalMs);
|
|
478
512
|
}
|
|
479
513
|
const append = (stream, chunk) => {
|
|
480
|
-
const text = chunk.toString(
|
|
481
|
-
if (stream ===
|
|
514
|
+
const text = chunk.toString("utf8");
|
|
515
|
+
if (stream === "stdout") {
|
|
482
516
|
process.stdout.write(text);
|
|
483
517
|
stdout = tailText(stdout + text, input.maxOutputChars);
|
|
484
518
|
}
|
|
@@ -489,7 +523,7 @@ async function runLoggedProcess(input) {
|
|
|
489
523
|
if (input.onTranscriptChunks) {
|
|
490
524
|
pendingTranscriptChunks.push({ stream, content: text });
|
|
491
525
|
}
|
|
492
|
-
if (stream ===
|
|
526
|
+
if (stream === "stdout" && input.onStdoutText) {
|
|
493
527
|
try {
|
|
494
528
|
const flushNow = input.onStdoutText(text) === true;
|
|
495
529
|
if (flushNow && input.onTranscriptChunks) {
|
|
@@ -504,19 +538,19 @@ async function runLoggedProcess(input) {
|
|
|
504
538
|
};
|
|
505
539
|
const timeout = setTimeout(() => {
|
|
506
540
|
timedOut = true;
|
|
507
|
-
terminateProcessTree(
|
|
541
|
+
terminateProcessTree("SIGTERM");
|
|
508
542
|
killTimer = setTimeout(() => {
|
|
509
|
-
terminateProcessTree(
|
|
543
|
+
terminateProcessTree("SIGKILL");
|
|
510
544
|
}, 5000);
|
|
511
545
|
}, input.timeoutMs);
|
|
512
|
-
child.stdout?.on(
|
|
513
|
-
child.stderr?.on(
|
|
514
|
-
child.on(
|
|
515
|
-
child.on(
|
|
546
|
+
child.stdout?.on("data", (chunk) => append("stdout", chunk));
|
|
547
|
+
child.stderr?.on("data", (chunk) => append("stderr", chunk));
|
|
548
|
+
child.on("error", reject);
|
|
549
|
+
child.on("close", (code, signal) => {
|
|
516
550
|
closed = true;
|
|
517
551
|
// The provider process may leave MCP servers, browsers, dev servers, or recorders behind.
|
|
518
552
|
// A task owns its whole process group, so no descendant survives terminal completion.
|
|
519
|
-
terminateProcessTree(
|
|
553
|
+
terminateProcessTree("SIGKILL");
|
|
520
554
|
clearTimeout(timeout);
|
|
521
555
|
if (killTimer) {
|
|
522
556
|
clearTimeout(killTimer);
|
|
@@ -556,50 +590,89 @@ async function runLoggedProcess(input) {
|
|
|
556
590
|
});
|
|
557
591
|
}
|
|
558
592
|
function buildCodexExecArgs(input) {
|
|
559
|
-
const sandboxMode = input.sandboxMode ??
|
|
560
|
-
const resumeSessionId = input.resumeSessionId?.trim() ??
|
|
593
|
+
const sandboxMode = input.sandboxMode ?? "danger-full-access";
|
|
594
|
+
const resumeSessionId = input.resumeSessionId?.trim() ?? "";
|
|
561
595
|
if (resumeSessionId) {
|
|
562
596
|
return [
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
597
|
+
"exec",
|
|
598
|
+
"resume",
|
|
599
|
+
"--json",
|
|
600
|
+
"--skip-git-repo-check",
|
|
601
|
+
"--model",
|
|
568
602
|
input.model,
|
|
569
|
-
|
|
603
|
+
"-c",
|
|
570
604
|
`model_reasoning_effort="${input.reasoningEffort}"`,
|
|
571
605
|
resumeSessionId,
|
|
572
|
-
|
|
606
|
+
"-",
|
|
573
607
|
];
|
|
574
608
|
}
|
|
575
609
|
const args = [
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
610
|
+
"exec",
|
|
611
|
+
"--json",
|
|
612
|
+
"--sandbox",
|
|
579
613
|
sandboxMode,
|
|
580
|
-
|
|
614
|
+
"--cd",
|
|
581
615
|
input.workspaceDir,
|
|
582
|
-
|
|
583
|
-
|
|
616
|
+
"--skip-git-repo-check",
|
|
617
|
+
"--model",
|
|
584
618
|
input.model,
|
|
585
|
-
|
|
619
|
+
"-c",
|
|
586
620
|
`model_reasoning_effort="${input.reasoningEffort}"`,
|
|
587
621
|
];
|
|
588
|
-
if (sandboxMode ===
|
|
589
|
-
args.push(
|
|
622
|
+
if (sandboxMode === "workspace-write") {
|
|
623
|
+
args.push("-c", `sandbox_workspace_write.network_access=${input.networkAccess ? "true" : "false"}`);
|
|
590
624
|
}
|
|
591
625
|
for (const imagePath of input.imagePaths ?? []) {
|
|
592
|
-
args.push(
|
|
626
|
+
args.push("--image", imagePath);
|
|
627
|
+
}
|
|
628
|
+
args.push("-");
|
|
629
|
+
return args;
|
|
630
|
+
}
|
|
631
|
+
function buildGrokExecArgs(input) {
|
|
632
|
+
const model = input.model.trim();
|
|
633
|
+
const reasoningEffort = input.reasoningEffort.trim();
|
|
634
|
+
if (!model) {
|
|
635
|
+
throw new Error("agent_task_assignment_model_missing");
|
|
636
|
+
}
|
|
637
|
+
if (!reasoningEffort) {
|
|
638
|
+
throw new Error("agent_task_assignment_reasoning_effort_missing");
|
|
639
|
+
}
|
|
640
|
+
const promptFile = input.promptFile?.trim() ?? "";
|
|
641
|
+
const promptJson = input.promptJson?.trim() ?? "";
|
|
642
|
+
if ((!promptFile && !promptJson) || (promptFile && promptJson)) {
|
|
643
|
+
throw new Error("worker_grok_prompt_source_invalid");
|
|
644
|
+
}
|
|
645
|
+
const args = [
|
|
646
|
+
promptJson ? "--prompt-json" : "--prompt-file",
|
|
647
|
+
promptJson || promptFile,
|
|
648
|
+
"--cwd",
|
|
649
|
+
input.workspaceDir,
|
|
650
|
+
"--model",
|
|
651
|
+
model,
|
|
652
|
+
"--reasoning-effort",
|
|
653
|
+
reasoningEffort,
|
|
654
|
+
"--output-format",
|
|
655
|
+
"streaming-messages-json",
|
|
656
|
+
"--always-approve",
|
|
657
|
+
"--sandbox",
|
|
658
|
+
"devbox",
|
|
659
|
+
"--no-subagents",
|
|
660
|
+
"--no-memory",
|
|
661
|
+
"--no-auto-update",
|
|
662
|
+
"--verbatim",
|
|
663
|
+
];
|
|
664
|
+
const resumeSessionId = input.resumeSessionId?.trim() ?? "";
|
|
665
|
+
if (resumeSessionId) {
|
|
666
|
+
args.push("--resume", resumeSessionId);
|
|
593
667
|
}
|
|
594
|
-
args.push('-');
|
|
595
668
|
return args;
|
|
596
669
|
}
|
|
597
670
|
function readCodexSandboxMode(env = process.env) {
|
|
598
671
|
const raw = env.PLAYDROP_WORKER_CODEX_SANDBOX?.trim();
|
|
599
672
|
if (!raw) {
|
|
600
|
-
return
|
|
673
|
+
return "danger-full-access";
|
|
601
674
|
}
|
|
602
|
-
if (raw ===
|
|
675
|
+
if (raw === "danger-full-access" || raw === "workspace-write" || raw === "read-only") {
|
|
603
676
|
return raw;
|
|
604
677
|
}
|
|
605
678
|
throw new Error(`invalid_playdrop_worker_codex_sandbox:${raw}`);
|
|
@@ -607,30 +680,28 @@ function readCodexSandboxMode(env = process.env) {
|
|
|
607
680
|
function buildClaudeExecArgs(input) {
|
|
608
681
|
const model = input.model.trim();
|
|
609
682
|
if (!model) {
|
|
610
|
-
throw new Error(
|
|
683
|
+
throw new Error("agent_task_assignment_model_missing");
|
|
611
684
|
}
|
|
612
685
|
if (input.chrome && input.playwrightMcp) {
|
|
613
|
-
throw new Error(
|
|
686
|
+
throw new Error("claude_exec_browser_mode_conflict");
|
|
614
687
|
}
|
|
615
|
-
const playwrightMcpConfigPath = typeof input.playwrightMcpConfigPath ===
|
|
616
|
-
? input.playwrightMcpConfigPath.trim()
|
|
617
|
-
: '';
|
|
688
|
+
const playwrightMcpConfigPath = typeof input.playwrightMcpConfigPath === "string" ? input.playwrightMcpConfigPath.trim() : "";
|
|
618
689
|
if (input.playwrightMcp && !playwrightMcpConfigPath) {
|
|
619
|
-
throw new Error(
|
|
690
|
+
throw new Error("playwright_mcp_config_path_missing");
|
|
620
691
|
}
|
|
621
692
|
const permissionSettings = buildClaudePermissionSettings({
|
|
622
693
|
workspaceDir: input.workspaceDir,
|
|
623
694
|
denyReadRoots: input.denyReadRoots ?? [],
|
|
624
695
|
playdropCliEnabled: input.playdropCliEnabled,
|
|
625
696
|
});
|
|
626
|
-
const permissionMode = input.chrome || input.playwrightMcp ?
|
|
697
|
+
const permissionMode = input.chrome || input.playwrightMcp ? "bypassPermissions" : "acceptEdits";
|
|
627
698
|
// MCP tools are deferred behind ToolSearch in the Claude CLI; without it in the toolset a
|
|
628
699
|
// session cannot reach any MCP server's tools no matter what --mcp-config provides.
|
|
629
700
|
const tools = input.chrome
|
|
630
|
-
? [...CLAUDE_BASE_TOOL_NAMES, ...CLAUDE_CHROME_TOOL_NAMES].join(
|
|
701
|
+
? [...CLAUDE_BASE_TOOL_NAMES, ...CLAUDE_CHROME_TOOL_NAMES].join(",")
|
|
631
702
|
: input.playwrightMcp
|
|
632
|
-
? [...CLAUDE_BASE_TOOL_NAMES,
|
|
633
|
-
: CLAUDE_BASE_TOOL_NAMES.join(
|
|
703
|
+
? [...CLAUDE_BASE_TOOL_NAMES, "ToolSearch"].join(",")
|
|
704
|
+
: CLAUDE_BASE_TOOL_NAMES.join(",");
|
|
634
705
|
const allowedPermissionRules = buildClaudeAllowedPermissionRules(input.workspaceDir, input.playdropCliEnabled);
|
|
635
706
|
const allowedTools = input.chrome
|
|
636
707
|
? [...allowedPermissionRules, ...CLAUDE_CHROME_TOOL_NAMES]
|
|
@@ -638,76 +709,69 @@ function buildClaudeExecArgs(input) {
|
|
|
638
709
|
? [...allowedPermissionRules, PLAYWRIGHT_MCP_ALLOWED_TOOL_RULE]
|
|
639
710
|
: allowedPermissionRules;
|
|
640
711
|
const args = [
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
712
|
+
"-p",
|
|
713
|
+
"--strict-mcp-config",
|
|
714
|
+
"--setting-sources",
|
|
715
|
+
"project",
|
|
716
|
+
"--input-format",
|
|
717
|
+
"stream-json",
|
|
718
|
+
"--model",
|
|
648
719
|
model,
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
720
|
+
"--output-format",
|
|
721
|
+
"stream-json",
|
|
722
|
+
"--verbose",
|
|
723
|
+
"--include-partial-messages",
|
|
724
|
+
"--permission-mode",
|
|
654
725
|
permissionMode,
|
|
655
|
-
|
|
726
|
+
"--tools",
|
|
656
727
|
tools,
|
|
657
|
-
|
|
728
|
+
"--allowedTools",
|
|
658
729
|
...allowedTools,
|
|
659
|
-
|
|
730
|
+
"--disallowedTools",
|
|
660
731
|
...buildClaudeDeniedPermissionRules(input.denyReadRoots ?? []),
|
|
661
|
-
|
|
732
|
+
"--settings",
|
|
662
733
|
JSON.stringify(permissionSettings),
|
|
663
734
|
];
|
|
664
735
|
if (input.chrome) {
|
|
665
|
-
args.unshift(
|
|
736
|
+
args.unshift("--chrome");
|
|
666
737
|
}
|
|
667
738
|
if (input.playwrightMcp) {
|
|
668
|
-
args.push(
|
|
739
|
+
args.push("--mcp-config", playwrightMcpConfigPath);
|
|
669
740
|
}
|
|
670
|
-
const pluginDir = typeof input.pluginDir ===
|
|
741
|
+
const pluginDir = typeof input.pluginDir === "string" ? input.pluginDir.trim() : "";
|
|
671
742
|
if (pluginDir) {
|
|
672
|
-
args.push(
|
|
743
|
+
args.push("--plugin-dir", pluginDir);
|
|
673
744
|
}
|
|
674
|
-
const effort = typeof input.effort ===
|
|
745
|
+
const effort = typeof input.effort === "string" ? input.effort.trim() : "";
|
|
675
746
|
if (effort) {
|
|
676
|
-
args.push(
|
|
747
|
+
args.push("--effort", effort);
|
|
677
748
|
}
|
|
678
|
-
const resumeSessionId = input.resumeSessionId?.trim() ??
|
|
749
|
+
const resumeSessionId = input.resumeSessionId?.trim() ?? "";
|
|
679
750
|
if (resumeSessionId) {
|
|
680
|
-
args.push(
|
|
751
|
+
args.push("--resume", resumeSessionId);
|
|
681
752
|
}
|
|
682
753
|
return args;
|
|
683
754
|
}
|
|
684
|
-
const CLAUDE_BASE_TOOL_NAMES = [
|
|
685
|
-
'Bash',
|
|
686
|
-
'Edit',
|
|
687
|
-
'Write',
|
|
688
|
-
'Read',
|
|
689
|
-
'Glob',
|
|
690
|
-
'Grep',
|
|
691
|
-
];
|
|
755
|
+
const CLAUDE_BASE_TOOL_NAMES = ["Bash", "Edit", "Write", "Read", "Glob", "Grep"];
|
|
692
756
|
// Pinned deliberately: agent-CLI and MCP versions on workers only change through releases,
|
|
693
757
|
// never through @latest drift (see the 2026-07-13 auto-update incident).
|
|
694
|
-
exports.PLAYWRIGHT_MCP_VERSION =
|
|
695
|
-
const PLAYWRIGHT_MCP_ALLOWED_TOOL_RULE =
|
|
758
|
+
exports.PLAYWRIGHT_MCP_VERSION = "0.0.78";
|
|
759
|
+
const PLAYWRIGHT_MCP_ALLOWED_TOOL_RULE = "mcp__playwright";
|
|
696
760
|
const requireFromWorkerRuntime = (0, node_module_1.createRequire)(__filename);
|
|
697
761
|
function resolvePlaywrightMcpCliPath() {
|
|
698
762
|
let packageJsonPath;
|
|
699
763
|
let packageJson;
|
|
700
764
|
try {
|
|
701
|
-
packageJsonPath = requireFromWorkerRuntime.resolve(
|
|
702
|
-
packageJson = requireFromWorkerRuntime(
|
|
765
|
+
packageJsonPath = requireFromWorkerRuntime.resolve("@playwright/mcp/package.json");
|
|
766
|
+
packageJson = requireFromWorkerRuntime("@playwright/mcp/package.json");
|
|
703
767
|
}
|
|
704
768
|
catch {
|
|
705
769
|
throw new Error(`worker_preflight_playwright_mcp_missing:@playwright/mcp@${exports.PLAYWRIGHT_MCP_VERSION}`);
|
|
706
770
|
}
|
|
707
771
|
if (packageJson.version !== exports.PLAYWRIGHT_MCP_VERSION) {
|
|
708
|
-
throw new Error(`worker_preflight_playwright_mcp_version:expected=${exports.PLAYWRIGHT_MCP_VERSION}:actual=${packageJson.version ??
|
|
772
|
+
throw new Error(`worker_preflight_playwright_mcp_version:expected=${exports.PLAYWRIGHT_MCP_VERSION}:actual=${packageJson.version ?? "missing"}`);
|
|
709
773
|
}
|
|
710
|
-
const cliPath = node_path_1.default.join(node_path_1.default.dirname(packageJsonPath),
|
|
774
|
+
const cliPath = node_path_1.default.join(node_path_1.default.dirname(packageJsonPath), "cli.js");
|
|
711
775
|
if (!(0, node_fs_1.existsSync)(cliPath)) {
|
|
712
776
|
throw new Error(`worker_preflight_playwright_mcp_missing:${cliPath}`);
|
|
713
777
|
}
|
|
@@ -717,13 +781,7 @@ function buildPlaywrightMcpCommand(surface) {
|
|
|
717
781
|
const surfaceArgs = surface ? (0, surfaceProfiles_1.buildPlaywrightMcpSurfaceArgs)(surface) : [];
|
|
718
782
|
return {
|
|
719
783
|
command: process.execPath,
|
|
720
|
-
args: [
|
|
721
|
-
resolvePlaywrightMcpCliPath(),
|
|
722
|
-
'--browser',
|
|
723
|
-
'chrome',
|
|
724
|
-
'--isolated',
|
|
725
|
-
...surfaceArgs,
|
|
726
|
-
],
|
|
784
|
+
args: [resolvePlaywrightMcpCliPath(), "--browser", "chrome", "--isolated", ...surfaceArgs],
|
|
727
785
|
};
|
|
728
786
|
}
|
|
729
787
|
function buildPlaywrightMcpServerConfig(surface) {
|
|
@@ -738,51 +796,51 @@ function buildPlaywrightMcpServerConfig(surface) {
|
|
|
738
796
|
};
|
|
739
797
|
}
|
|
740
798
|
const CLAUDE_CHROME_TOOL_NAMES = [
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
799
|
+
"mcp__claude-in-chrome__browser_batch",
|
|
800
|
+
"mcp__claude-in-chrome__computer",
|
|
801
|
+
"mcp__claude-in-chrome__file_upload",
|
|
802
|
+
"mcp__claude-in-chrome__find",
|
|
803
|
+
"mcp__claude-in-chrome__form_input",
|
|
804
|
+
"mcp__claude-in-chrome__get_page_text",
|
|
805
|
+
"mcp__claude-in-chrome__javascript_tool",
|
|
806
|
+
"mcp__claude-in-chrome__list_connected_browsers",
|
|
807
|
+
"mcp__claude-in-chrome__navigate",
|
|
808
|
+
"mcp__claude-in-chrome__read_console_messages",
|
|
809
|
+
"mcp__claude-in-chrome__read_network_requests",
|
|
810
|
+
"mcp__claude-in-chrome__read_page",
|
|
811
|
+
"mcp__claude-in-chrome__resize_window",
|
|
812
|
+
"mcp__claude-in-chrome__select_browser",
|
|
813
|
+
"mcp__claude-in-chrome__shortcuts_execute",
|
|
814
|
+
"mcp__claude-in-chrome__shortcuts_list",
|
|
815
|
+
"mcp__claude-in-chrome__switch_browser",
|
|
816
|
+
"mcp__claude-in-chrome__tabs_close_mcp",
|
|
817
|
+
"mcp__claude-in-chrome__tabs_context_mcp",
|
|
818
|
+
"mcp__claude-in-chrome__tabs_create_mcp",
|
|
819
|
+
"mcp__claude-in-chrome__upload_image",
|
|
762
820
|
];
|
|
763
821
|
const CLAUDE_BUILD_PERMISSION_RULES = [
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
822
|
+
"Glob",
|
|
823
|
+
"Grep",
|
|
824
|
+
"Bash(playdrop *)",
|
|
825
|
+
"Bash(codex *)",
|
|
826
|
+
"Bash(./bin/playdrop *)",
|
|
827
|
+
"Bash(../bin/playdrop *)",
|
|
828
|
+
"Bash(bin/playdrop *)",
|
|
829
|
+
"Bash(node *)",
|
|
830
|
+
"Bash(npm *)",
|
|
831
|
+
"Bash(mkdir *)",
|
|
832
|
+
"Bash(cp *)",
|
|
833
|
+
"Bash(mv *)",
|
|
834
|
+
"Bash(file *)",
|
|
835
|
+
"Bash(curl *)",
|
|
836
|
+
"Bash(sips *)",
|
|
837
|
+
"Bash(ls *)",
|
|
838
|
+
"Bash(pwd)",
|
|
839
|
+
"Bash(rg *)",
|
|
840
|
+
"Bash(which *)",
|
|
841
|
+
"Bash(wc *)",
|
|
842
|
+
"Bash(stat *)",
|
|
843
|
+
"Bash(du *)",
|
|
786
844
|
];
|
|
787
845
|
function normalizeClaudePermissionPath(value) {
|
|
788
846
|
const trimmed = value.trim();
|
|
@@ -790,29 +848,27 @@ function normalizeClaudePermissionPath(value) {
|
|
|
790
848
|
return null;
|
|
791
849
|
}
|
|
792
850
|
if (/^\/[^/]/.test(trimmed)) {
|
|
793
|
-
return node_path_1.default.posix.resolve(trimmed).replace(/\/+$/,
|
|
851
|
+
return node_path_1.default.posix.resolve(trimmed).replace(/\/+$/, "");
|
|
794
852
|
}
|
|
795
853
|
if (/^[A-Za-z]:[\\/]/.test(trimmed) || /^\\\\/.test(trimmed)) {
|
|
796
|
-
return node_path_1.default.win32.resolve(trimmed).replace(/\\/g,
|
|
854
|
+
return node_path_1.default.win32.resolve(trimmed).replace(/\\/g, "/").replace(/\/+$/, "");
|
|
797
855
|
}
|
|
798
|
-
return node_path_1.default.resolve(trimmed).replace(/\\/g,
|
|
856
|
+
return node_path_1.default.resolve(trimmed).replace(/\\/g, "/").replace(/\/+$/, "");
|
|
799
857
|
}
|
|
800
858
|
function buildClaudeAllowedPermissionRules(workspaceDir, playdropCliEnabled = true) {
|
|
801
|
-
const workspaceRoot = typeof workspaceDir ===
|
|
802
|
-
? normalizeClaudePermissionPath(workspaceDir)
|
|
803
|
-
: null;
|
|
859
|
+
const workspaceRoot = typeof workspaceDir === "string" && workspaceDir.trim() ? normalizeClaudePermissionPath(workspaceDir) : null;
|
|
804
860
|
if (!workspaceRoot) {
|
|
805
|
-
throw new Error(
|
|
861
|
+
throw new Error("worker_claude_workspace_missing");
|
|
806
862
|
}
|
|
807
|
-
const absoluteWorkspacePattern = `//${workspaceRoot.replace(/^\/+/,
|
|
808
|
-
const managedImagePython = node_path_1.default.join(node_os_1.default.homedir(),
|
|
863
|
+
const absoluteWorkspacePattern = `//${workspaceRoot.replace(/^\/+/, "")}/**`;
|
|
864
|
+
const managedImagePython = node_path_1.default.join(node_os_1.default.homedir(), ".cache", "playdrop", "make-2d-asset-pack", "venv-v1", "bin", "python");
|
|
809
865
|
return [
|
|
810
866
|
`Read(${absoluteWorkspacePattern})`,
|
|
811
867
|
`Edit(${absoluteWorkspacePattern})`,
|
|
812
868
|
`Write(${absoluteWorkspacePattern})`,
|
|
813
869
|
`Bash(${managedImagePython} *)`,
|
|
814
870
|
...(playdropCliEnabled ? [`Bash(${workspaceRoot}/bin/playdrop *)`] : []),
|
|
815
|
-
...CLAUDE_BUILD_PERMISSION_RULES.filter((rule) =>
|
|
871
|
+
...CLAUDE_BUILD_PERMISSION_RULES.filter((rule) => playdropCliEnabled || !rule.toLowerCase().includes("playdrop")),
|
|
816
872
|
];
|
|
817
873
|
}
|
|
818
874
|
function buildClaudePermissionSettings(input = {}) {
|
|
@@ -824,16 +880,13 @@ function buildClaudePermissionSettings(input = {}) {
|
|
|
824
880
|
};
|
|
825
881
|
}
|
|
826
882
|
function buildClaudeDeniedPermissionRules(denyReadRoots = []) {
|
|
827
|
-
const deny = new Set([
|
|
828
|
-
'Bash(rm *)',
|
|
829
|
-
'Bash(git *)',
|
|
830
|
-
]);
|
|
883
|
+
const deny = new Set(["Bash(rm *)", "Bash(git *)"]);
|
|
831
884
|
for (const rawRoot of denyReadRoots) {
|
|
832
885
|
const root = normalizeClaudePermissionPath(rawRoot);
|
|
833
886
|
if (!root) {
|
|
834
887
|
continue;
|
|
835
888
|
}
|
|
836
|
-
deny.add(`Read(//${root.replace(/^\/+/,
|
|
889
|
+
deny.add(`Read(//${root.replace(/^\/+/, "")}/**)`);
|
|
837
890
|
deny.add(`Bash(* ${root}*)`);
|
|
838
891
|
}
|
|
839
892
|
return [...deny];
|
|
@@ -841,40 +894,40 @@ function buildClaudeDeniedPermissionRules(denyReadRoots = []) {
|
|
|
841
894
|
function buildWorkerChildEnv(input) {
|
|
842
895
|
const base = input.baseEnv ?? process.env;
|
|
843
896
|
const child = {};
|
|
844
|
-
for (const key of [
|
|
897
|
+
for (const key of ["HOME", "USER", "SHELL", "TMPDIR", "LANG", "TERM"]) {
|
|
845
898
|
const value = base[key];
|
|
846
|
-
if (typeof value ===
|
|
899
|
+
if (typeof value === "string") {
|
|
847
900
|
child[key] = value;
|
|
848
901
|
}
|
|
849
902
|
}
|
|
850
903
|
for (const [key, value] of Object.entries(base)) {
|
|
851
|
-
if (key.startsWith(
|
|
904
|
+
if (key.startsWith("LC_") && typeof value === "string") {
|
|
852
905
|
child[key] = value;
|
|
853
906
|
}
|
|
854
907
|
}
|
|
855
908
|
if (input.homeDir !== undefined) {
|
|
856
909
|
const homeDir = input.homeDir.trim();
|
|
857
910
|
if (!homeDir || !node_path_1.default.isAbsolute(homeDir)) {
|
|
858
|
-
throw new Error(
|
|
911
|
+
throw new Error("invalid_worker_child_home_dir");
|
|
859
912
|
}
|
|
860
913
|
child.HOME = homeDir;
|
|
861
914
|
}
|
|
862
915
|
const workerHomeDir = input.workerHomeDir.trim();
|
|
863
916
|
if (!workerHomeDir || !node_path_1.default.isAbsolute(workerHomeDir)) {
|
|
864
|
-
throw new Error(
|
|
917
|
+
throw new Error("invalid_worker_child_worker_home_dir");
|
|
865
918
|
}
|
|
866
919
|
child.PLAYDROP_WORKER_HOME = workerHomeDir;
|
|
867
920
|
if (input.codexHomeDir !== undefined) {
|
|
868
921
|
const codexHomeDir = input.codexHomeDir.trim();
|
|
869
922
|
if (!codexHomeDir || !node_path_1.default.isAbsolute(codexHomeDir)) {
|
|
870
|
-
throw new Error(
|
|
923
|
+
throw new Error("invalid_worker_child_codex_home_dir");
|
|
871
924
|
}
|
|
872
925
|
child.CODEX_HOME = codexHomeDir;
|
|
873
926
|
}
|
|
874
927
|
if (input.claudeConfigDir !== undefined) {
|
|
875
928
|
const claudeConfigDir = input.claudeConfigDir.trim();
|
|
876
929
|
if (!claudeConfigDir || !node_path_1.default.isAbsolute(claudeConfigDir)) {
|
|
877
|
-
throw new Error(
|
|
930
|
+
throw new Error("invalid_worker_child_claude_config_dir");
|
|
878
931
|
}
|
|
879
932
|
child.CLAUDE_CONFIG_DIR = claudeConfigDir;
|
|
880
933
|
}
|
|
@@ -885,45 +938,44 @@ function buildWorkerChildEnv(input) {
|
|
|
885
938
|
if (input.playdropConfigPath !== undefined) {
|
|
886
939
|
const playdropConfigPath = input.playdropConfigPath.trim();
|
|
887
940
|
if (!playdropConfigPath || !node_path_1.default.isAbsolute(playdropConfigPath)) {
|
|
888
|
-
throw new Error(
|
|
941
|
+
throw new Error("invalid_worker_child_playdrop_config_path");
|
|
889
942
|
}
|
|
890
943
|
child.PLAYDROP_CONFIG_PATH = playdropConfigPath;
|
|
891
944
|
}
|
|
892
945
|
if (input.playwrightBrowsersPath !== undefined) {
|
|
893
946
|
const playwrightBrowsersPath = input.playwrightBrowsersPath.trim();
|
|
894
947
|
if (!playwrightBrowsersPath || !node_path_1.default.isAbsolute(playwrightBrowsersPath)) {
|
|
895
|
-
throw new Error(
|
|
948
|
+
throw new Error("invalid_worker_playwright_browsers_path");
|
|
896
949
|
}
|
|
897
950
|
child.PLAYWRIGHT_BROWSERS_PATH = playwrightBrowsersPath;
|
|
898
951
|
}
|
|
899
|
-
child.PATH =
|
|
900
|
-
? `${input.binDir}${node_path_1.default.delimiter}${base.PATH}`
|
|
901
|
-
: input.binDir;
|
|
952
|
+
child.PATH =
|
|
953
|
+
typeof base.PATH === "string" && base.PATH ? `${input.binDir}${node_path_1.default.delimiter}${base.PATH}` : input.binDir;
|
|
902
954
|
for (const key of [
|
|
903
|
-
|
|
955
|
+
"PLAYDROP_API_BASE",
|
|
904
956
|
`PLAYDROP_API_BASE_${input.envName.toUpperCase()}`,
|
|
905
|
-
|
|
957
|
+
"PLAYDROP_AI_BASE",
|
|
906
958
|
`PLAYDROP_AI_BASE_${input.envName.toUpperCase()}`,
|
|
907
959
|
]) {
|
|
908
960
|
const value = base[key];
|
|
909
|
-
if (typeof value ===
|
|
961
|
+
if (typeof value === "string") {
|
|
910
962
|
child[key] = value;
|
|
911
963
|
}
|
|
912
964
|
}
|
|
913
|
-
child.PLAYDROP_WORKER_CONTEXT =
|
|
965
|
+
child.PLAYDROP_WORKER_CONTEXT = "1";
|
|
914
966
|
const taskToken = input.taskToken.trim();
|
|
915
967
|
if (!taskToken) {
|
|
916
|
-
throw new Error(
|
|
968
|
+
throw new Error("invalid_worker_task_token");
|
|
917
969
|
}
|
|
918
970
|
if (!Number.isInteger(input.attempt) || input.attempt <= 0) {
|
|
919
|
-
throw new Error(
|
|
971
|
+
throw new Error("invalid_worker_task_attempt");
|
|
920
972
|
}
|
|
921
973
|
child.PLAYDROP_WORKER_TASK_ID = String(input.taskId);
|
|
922
974
|
child.PLAYDROP_WORKER_TASK_TOKEN = taskToken;
|
|
923
975
|
child.PLAYDROP_WORKER_TASK_ATTEMPT = String(input.attempt);
|
|
924
976
|
if (input.devPort !== undefined) {
|
|
925
977
|
if (!Number.isInteger(input.devPort) || input.devPort <= 0 || input.devPort > 65535) {
|
|
926
|
-
throw new Error(
|
|
978
|
+
throw new Error("invalid_worker_task_dev_port");
|
|
927
979
|
}
|
|
928
980
|
child.PLAYDROP_WORKER_TASK_DEV_PORT = String(input.devPort);
|
|
929
981
|
child.PLAYDROP_DEV_ROUTER_PORT = String(input.devPort);
|
|
@@ -937,43 +989,43 @@ function buildCleanRoomChildEnv(input) {
|
|
|
937
989
|
const base = input.baseEnv ?? process.env;
|
|
938
990
|
const child = {};
|
|
939
991
|
for (const key of [
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
992
|
+
"HOME",
|
|
993
|
+
"USER",
|
|
994
|
+
"SHELL",
|
|
995
|
+
"TMPDIR",
|
|
996
|
+
"LANG",
|
|
997
|
+
"TERM",
|
|
998
|
+
"ANTHROPIC_API_KEY",
|
|
999
|
+
"OPENAI_API_KEY",
|
|
1000
|
+
"HTTP_PROXY",
|
|
1001
|
+
"HTTPS_PROXY",
|
|
1002
|
+
"ALL_PROXY",
|
|
1003
|
+
"NO_PROXY",
|
|
952
1004
|
]) {
|
|
953
1005
|
const value = base[key];
|
|
954
|
-
if (typeof value ===
|
|
1006
|
+
if (typeof value === "string")
|
|
955
1007
|
child[key] = value;
|
|
956
1008
|
}
|
|
957
1009
|
for (const [key, value] of Object.entries(base)) {
|
|
958
|
-
if (key.startsWith(
|
|
1010
|
+
if (key.startsWith("LC_") && typeof value === "string")
|
|
959
1011
|
child[key] = value;
|
|
960
1012
|
}
|
|
961
1013
|
if (input.homeDir !== undefined) {
|
|
962
1014
|
const homeDir = input.homeDir.trim();
|
|
963
1015
|
if (!homeDir || !node_path_1.default.isAbsolute(homeDir))
|
|
964
|
-
throw new Error(
|
|
1016
|
+
throw new Error("invalid_worker_child_home_dir");
|
|
965
1017
|
child.HOME = homeDir;
|
|
966
1018
|
}
|
|
967
1019
|
if (input.codexHomeDir !== undefined) {
|
|
968
1020
|
const codexHomeDir = input.codexHomeDir.trim();
|
|
969
1021
|
if (!codexHomeDir || !node_path_1.default.isAbsolute(codexHomeDir))
|
|
970
|
-
throw new Error(
|
|
1022
|
+
throw new Error("invalid_worker_child_codex_home_dir");
|
|
971
1023
|
child.CODEX_HOME = codexHomeDir;
|
|
972
1024
|
}
|
|
973
|
-
const safeHostPath = (base.PATH ??
|
|
1025
|
+
const safeHostPath = (base.PATH ?? "").split(node_path_1.default.delimiter).filter((directory) => {
|
|
974
1026
|
if (!directory || !node_path_1.default.isAbsolute(directory))
|
|
975
1027
|
return false;
|
|
976
|
-
return !(0, node_fs_1.existsSync)(node_path_1.default.join(directory, process.platform ===
|
|
1028
|
+
return !(0, node_fs_1.existsSync)(node_path_1.default.join(directory, process.platform === "win32" ? "playdrop.exe" : "playdrop"));
|
|
977
1029
|
});
|
|
978
1030
|
child.PATH = [input.binDir, ...safeHostPath].join(node_path_1.default.delimiter);
|
|
979
1031
|
return child;
|