@quenty/studio-bridge 0.21.1 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +109 -17
- package/build-scripts/transform-add-session-attribute.lua +1 -0
- package/deploy.nevermore.json +10 -0
- package/dist/src/bridge/bridge-connection.d.ts +26 -2
- package/dist/src/bridge/bridge-connection.d.ts.map +1 -1
- package/dist/src/bridge/bridge-connection.js +159 -14
- package/dist/src/bridge/bridge-connection.js.map +1 -1
- package/dist/src/bridge/bridge-connection.test.js +81 -0
- package/dist/src/bridge/bridge-connection.test.js.map +1 -1
- package/dist/src/bridge/bridge-session.d.ts +35 -2
- package/dist/src/bridge/bridge-session.d.ts.map +1 -1
- package/dist/src/bridge/bridge-session.js +185 -28
- package/dist/src/bridge/bridge-session.js.map +1 -1
- package/dist/src/bridge/bridge-session.test.js +6 -4
- package/dist/src/bridge/bridge-session.test.js.map +1 -1
- package/dist/src/bridge/index.d.ts +1 -1
- package/dist/src/bridge/index.d.ts.map +1 -1
- package/dist/src/bridge/index.js.map +1 -1
- package/dist/src/bridge/internal/bridge-client.d.ts +4 -0
- package/dist/src/bridge/internal/bridge-client.d.ts.map +1 -1
- package/dist/src/bridge/internal/bridge-client.js +20 -7
- package/dist/src/bridge/internal/bridge-client.js.map +1 -1
- package/dist/src/bridge/internal/bridge-client.test.js +18 -0
- package/dist/src/bridge/internal/bridge-client.test.js.map +1 -1
- package/dist/src/bridge/internal/bridge-host.d.ts +13 -1
- package/dist/src/bridge/internal/bridge-host.d.ts.map +1 -1
- package/dist/src/bridge/internal/bridge-host.js +35 -0
- package/dist/src/bridge/internal/bridge-host.js.map +1 -1
- package/dist/src/bridge/internal/bridge-host.test.js +31 -0
- package/dist/src/bridge/internal/bridge-host.test.js.map +1 -1
- package/dist/src/bridge/internal/hand-off.d.ts.map +1 -1
- package/dist/src/bridge/internal/hand-off.js +4 -1
- package/dist/src/bridge/internal/hand-off.js.map +1 -1
- package/dist/src/bridge/internal/host-protocol.d.ts +8 -0
- package/dist/src/bridge/internal/host-protocol.d.ts.map +1 -1
- package/dist/src/bridge/internal/host-protocol.js +120 -13
- package/dist/src/bridge/internal/host-protocol.js.map +1 -1
- package/dist/src/bridge/internal/host-protocol.test.js +13 -0
- package/dist/src/bridge/internal/host-protocol.test.js.map +1 -1
- package/dist/src/bridge/internal/instance-state.d.ts +9 -0
- package/dist/src/bridge/internal/instance-state.d.ts.map +1 -0
- package/dist/src/bridge/internal/instance-state.js +28 -0
- package/dist/src/bridge/internal/instance-state.js.map +1 -0
- package/dist/src/bridge/internal/transport-client.d.ts.map +1 -1
- package/dist/src/bridge/internal/transport-client.js +2 -1
- package/dist/src/bridge/internal/transport-client.js.map +1 -1
- package/dist/src/bridge/internal/transport-server.d.ts.map +1 -1
- package/dist/src/bridge/internal/transport-server.js +5 -1
- package/dist/src/bridge/internal/transport-server.js.map +1 -1
- package/dist/src/bridge/types.d.ts +43 -4
- package/dist/src/bridge/types.d.ts.map +1 -1
- package/dist/src/bridge/types.js.map +1 -1
- package/dist/src/cli/adapters/cli-command-adapter-handler.test.js +24 -0
- package/dist/src/cli/adapters/cli-command-adapter-handler.test.js.map +1 -1
- package/dist/src/cli/adapters/cli-command-adapter.d.ts +6 -0
- package/dist/src/cli/adapters/cli-command-adapter.d.ts.map +1 -1
- package/dist/src/cli/adapters/cli-command-adapter.js +107 -11
- package/dist/src/cli/adapters/cli-command-adapter.js.map +1 -1
- package/dist/src/cli/adapters/group-builder.d.ts +3 -0
- package/dist/src/cli/adapters/group-builder.d.ts.map +1 -1
- package/dist/src/cli/adapters/group-builder.js +34 -15
- package/dist/src/cli/adapters/group-builder.js.map +1 -1
- package/dist/src/cli/adapters/group-builder.test.js +26 -2
- package/dist/src/cli/adapters/group-builder.test.js.map +1 -1
- package/dist/src/cli/adapters/help-formatter.d.ts.map +1 -1
- package/dist/src/cli/adapters/help-formatter.js +4 -3
- package/dist/src/cli/adapters/help-formatter.js.map +1 -1
- package/dist/src/cli/adapters/help-formatter.test.js +1 -1
- package/dist/src/cli/adapters/help-formatter.test.js.map +1 -1
- package/dist/src/cli/adapters/playtest-edit-guard.test.d.ts +2 -0
- package/dist/src/cli/adapters/playtest-edit-guard.test.d.ts.map +1 -0
- package/dist/src/cli/adapters/playtest-edit-guard.test.js +28 -0
- package/dist/src/cli/adapters/playtest-edit-guard.test.js.map +1 -0
- package/dist/src/cli/args/global-args.d.ts +1 -1
- package/dist/src/cli/args/global-args.d.ts.map +1 -1
- package/dist/src/cli/cli-output-context.d.ts +14 -0
- package/dist/src/cli/cli-output-context.d.ts.map +1 -0
- package/dist/src/cli/cli-output-context.js +39 -0
- package/dist/src/cli/cli-output-context.js.map +1 -0
- package/dist/src/cli/cli-output-context.test.d.ts +2 -0
- package/dist/src/cli/cli-output-context.test.d.ts.map +1 -0
- package/dist/src/cli/cli-output-context.test.js +38 -0
- package/dist/src/cli/cli-output-context.test.js.map +1 -0
- package/dist/src/cli/cli.js +40 -17
- package/dist/src/cli/cli.js.map +1 -1
- package/dist/src/cli/managed-studio-run.d.ts +21 -0
- package/dist/src/cli/managed-studio-run.d.ts.map +1 -0
- package/dist/src/cli/managed-studio-run.js +75 -0
- package/dist/src/cli/managed-studio-run.js.map +1 -0
- package/dist/src/cli/managed-studio-run.test.d.ts +2 -0
- package/dist/src/cli/managed-studio-run.test.d.ts.map +1 -0
- package/dist/src/cli/managed-studio-run.test.js +52 -0
- package/dist/src/cli/managed-studio-run.test.js.map +1 -0
- package/dist/src/cli/resolve-session.js +1 -1
- package/dist/src/cli/resolve-session.js.map +1 -1
- package/dist/src/cli/resolve-session.test.js +1 -1
- package/dist/src/cli/resolve-session.test.js.map +1 -1
- package/dist/src/cli/script-executor.d.ts +13 -1
- package/dist/src/cli/script-executor.d.ts.map +1 -1
- package/dist/src/cli/script-executor.js +77 -47
- package/dist/src/cli/script-executor.js.map +1 -1
- package/dist/src/commands/console/exec/exec.d.ts +17 -0
- package/dist/src/commands/console/exec/exec.d.ts.map +1 -1
- package/dist/src/commands/console/exec/exec.js +39 -7
- package/dist/src/commands/console/exec/exec.js.map +1 -1
- package/dist/src/commands/console/exec/exec.test.js +62 -3
- package/dist/src/commands/console/exec/exec.test.js.map +1 -1
- package/dist/src/commands/console/logs/logs.d.ts +30 -2
- package/dist/src/commands/console/logs/logs.d.ts.map +1 -1
- package/dist/src/commands/console/logs/logs.js +82 -7
- package/dist/src/commands/console/logs/logs.js.map +1 -1
- package/dist/src/commands/console/logs/logs.test.js +63 -4
- package/dist/src/commands/console/logs/logs.test.js.map +1 -1
- package/dist/src/commands/explorer/export/export.d.ts +19 -0
- package/dist/src/commands/explorer/export/export.d.ts.map +1 -0
- package/dist/src/commands/explorer/export/export.js +37 -0
- package/dist/src/commands/explorer/export/export.js.map +1 -0
- package/dist/src/commands/explorer/export/export.test.d.ts +2 -0
- package/dist/src/commands/explorer/export/export.test.d.ts.map +1 -0
- package/dist/src/commands/explorer/export/export.test.js +25 -0
- package/dist/src/commands/explorer/export/export.test.js.map +1 -0
- package/dist/src/commands/explorer/find/find.d.ts +28 -0
- package/dist/src/commands/explorer/find/find.d.ts.map +1 -0
- package/dist/src/commands/explorer/find/find.js +75 -0
- package/dist/src/commands/explorer/find/find.js.map +1 -0
- package/dist/src/commands/explorer/find/find.test.d.ts +2 -0
- package/dist/src/commands/explorer/find/find.test.d.ts.map +1 -0
- package/dist/src/commands/explorer/find/find.test.js +44 -0
- package/dist/src/commands/explorer/find/find.test.js.map +1 -0
- package/dist/src/commands/explorer/grep/grep.d.ts +24 -0
- package/dist/src/commands/explorer/grep/grep.d.ts.map +1 -0
- package/dist/src/commands/explorer/grep/grep.js +63 -0
- package/dist/src/commands/explorer/grep/grep.js.map +1 -0
- package/dist/src/commands/explorer/grep/grep.test.d.ts +2 -0
- package/dist/src/commands/explorer/grep/grep.test.d.ts.map +1 -0
- package/dist/src/commands/explorer/grep/grep.test.js +42 -0
- package/dist/src/commands/explorer/grep/grep.test.js.map +1 -0
- package/dist/src/commands/explorer/import/import.d.ts +21 -0
- package/dist/src/commands/explorer/import/import.d.ts.map +1 -0
- package/dist/src/commands/explorer/import/import.js +37 -0
- package/dist/src/commands/explorer/import/import.js.map +1 -0
- package/dist/src/commands/explorer/import/import.test.d.ts +2 -0
- package/dist/src/commands/explorer/import/import.test.d.ts.map +1 -0
- package/dist/src/commands/explorer/import/import.test.js +45 -0
- package/dist/src/commands/explorer/import/import.test.js.map +1 -0
- package/dist/src/commands/formatters.test.js +7 -1
- package/dist/src/commands/formatters.test.js.map +1 -1
- package/dist/src/commands/framework/action-loader.d.ts +5 -1
- package/dist/src/commands/framework/action-loader.d.ts.map +1 -1
- package/dist/src/commands/framework/action-loader.js +9 -2
- package/dist/src/commands/framework/action-loader.js.map +1 -1
- package/dist/src/commands/framework/action-loader.test.js +23 -0
- package/dist/src/commands/framework/action-loader.test.js.map +1 -1
- package/dist/src/commands/framework/arg-builder.d.ts +15 -2
- package/dist/src/commands/framework/arg-builder.d.ts.map +1 -1
- package/dist/src/commands/framework/arg-builder.js +22 -2
- package/dist/src/commands/framework/arg-builder.js.map +1 -1
- package/dist/src/commands/framework/define-command.d.ts +19 -3
- package/dist/src/commands/framework/define-command.d.ts.map +1 -1
- package/dist/src/commands/framework/define-command.js.map +1 -1
- package/dist/src/commands/framework/index.d.ts +1 -1
- package/dist/src/commands/framework/index.d.ts.map +1 -1
- package/dist/src/commands/framework/index.js.map +1 -1
- package/dist/src/commands/index.d.ts +11 -0
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +11 -0
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/linux/inject-credentials/inject-credentials.d.ts.map +1 -1
- package/dist/src/commands/linux/inject-credentials/inject-credentials.js +1 -3
- package/dist/src/commands/linux/inject-credentials/inject-credentials.js.map +1 -1
- package/dist/src/commands/linux/setup/setup.d.ts.map +1 -1
- package/dist/src/commands/linux/setup/setup.js +1 -3
- package/dist/src/commands/linux/setup/setup.js.map +1 -1
- package/dist/src/commands/linux/status/status.d.ts +9 -1
- package/dist/src/commands/linux/status/status.d.ts.map +1 -1
- package/dist/src/commands/linux/status/status.js +66 -86
- package/dist/src/commands/linux/status/status.js.map +1 -1
- package/dist/src/commands/playtest/player/add/add.d.ts +17 -0
- package/dist/src/commands/playtest/player/add/add.d.ts.map +1 -0
- package/dist/src/commands/playtest/player/add/add.js +45 -0
- package/dist/src/commands/playtest/player/add/add.js.map +1 -0
- package/dist/src/commands/playtest/player/list/list.d.ts +13 -0
- package/dist/src/commands/playtest/player/list/list.d.ts.map +1 -0
- package/dist/src/commands/playtest/player/list/list.js +33 -0
- package/dist/src/commands/playtest/player/list/list.js.map +1 -0
- package/dist/src/commands/playtest/player/playtest-players.d.ts +36 -0
- package/dist/src/commands/playtest/player/playtest-players.d.ts.map +1 -0
- package/dist/src/commands/playtest/player/playtest-players.js +187 -0
- package/dist/src/commands/playtest/player/playtest-players.js.map +1 -0
- package/dist/src/commands/playtest/player/playtest-players.test.d.ts +2 -0
- package/dist/src/commands/playtest/player/playtest-players.test.d.ts.map +1 -0
- package/dist/src/commands/playtest/player/playtest-players.test.js +89 -0
- package/dist/src/commands/playtest/player/playtest-players.test.js.map +1 -0
- package/dist/src/commands/playtest/player/remove/remove.d.ts +17 -0
- package/dist/src/commands/playtest/player/remove/remove.d.ts.map +1 -0
- package/dist/src/commands/playtest/player/remove/remove.js +42 -0
- package/dist/src/commands/playtest/player/remove/remove.js.map +1 -0
- package/dist/src/commands/playtest/playtest-sessions.d.ts +49 -0
- package/dist/src/commands/playtest/playtest-sessions.d.ts.map +1 -0
- package/dist/src/commands/playtest/playtest-sessions.js +283 -0
- package/dist/src/commands/playtest/playtest-sessions.js.map +1 -0
- package/dist/src/commands/playtest/playtest-sessions.test.d.ts +2 -0
- package/dist/src/commands/playtest/playtest-sessions.test.d.ts.map +1 -0
- package/dist/src/commands/playtest/playtest-sessions.test.js +87 -0
- package/dist/src/commands/playtest/playtest-sessions.test.js.map +1 -0
- package/dist/src/commands/playtest/restart/restart.d.ts +23 -0
- package/dist/src/commands/playtest/restart/restart.d.ts.map +1 -0
- package/dist/src/commands/playtest/restart/restart.js +105 -0
- package/dist/src/commands/playtest/restart/restart.js.map +1 -0
- package/dist/src/commands/playtest/run/run.d.ts +47 -0
- package/dist/src/commands/playtest/run/run.d.ts.map +1 -0
- package/dist/src/commands/playtest/run/run.js +137 -0
- package/dist/src/commands/playtest/run/run.js.map +1 -0
- package/dist/src/commands/playtest/start/start.d.ts +42 -0
- package/dist/src/commands/playtest/start/start.d.ts.map +1 -0
- package/dist/src/commands/playtest/start/start.js +70 -0
- package/dist/src/commands/playtest/start/start.js.map +1 -0
- package/dist/src/commands/playtest/stop/stop.d.ts +15 -0
- package/dist/src/commands/playtest/stop/stop.d.ts.map +1 -0
- package/dist/src/commands/playtest/stop/stop.js +24 -0
- package/dist/src/commands/playtest/stop/stop.js.map +1 -0
- package/dist/src/commands/process/close/close.d.ts +19 -10
- package/dist/src/commands/process/close/close.d.ts.map +1 -1
- package/dist/src/commands/process/close/close.js +118 -15
- package/dist/src/commands/process/close/close.js.map +1 -1
- package/dist/src/commands/process/close/close.test.d.ts +2 -0
- package/dist/src/commands/process/close/close.test.d.ts.map +1 -0
- package/dist/src/commands/process/close/close.test.js +190 -0
- package/dist/src/commands/process/close/close.test.js.map +1 -0
- package/dist/src/commands/process/info/info.d.ts +45 -5
- package/dist/src/commands/process/info/info.d.ts.map +1 -1
- package/dist/src/commands/process/info/info.js +117 -13
- package/dist/src/commands/process/info/info.js.map +1 -1
- package/dist/src/commands/process/info/info.test.js +140 -38
- package/dist/src/commands/process/info/info.test.js.map +1 -1
- package/dist/src/commands/process/launch/launch.d.ts +11 -1
- package/dist/src/commands/process/launch/launch.d.ts.map +1 -1
- package/dist/src/commands/process/launch/launch.js +37 -7
- package/dist/src/commands/process/launch/launch.js.map +1 -1
- package/dist/src/commands/process/launch/launch.test.js +99 -20
- package/dist/src/commands/process/launch/launch.test.js.map +1 -1
- package/dist/src/commands/process/list/list.d.ts +2 -1
- package/dist/src/commands/process/list/list.d.ts.map +1 -1
- package/dist/src/commands/process/list/list.js +9 -6
- package/dist/src/commands/process/list/list.js.map +1 -1
- package/dist/src/commands/process/list/list.test.js +1 -0
- package/dist/src/commands/process/list/list.test.js.map +1 -1
- package/dist/src/commands/process/run/run.d.ts +9 -0
- package/dist/src/commands/process/run/run.d.ts.map +1 -1
- package/dist/src/commands/process/run/run.js +15 -5
- package/dist/src/commands/process/run/run.js.map +1 -1
- package/dist/src/commands/serve/serve.d.ts +2 -0
- package/dist/src/commands/serve/serve.d.ts.map +1 -1
- package/dist/src/commands/serve/serve.js +17 -4
- package/dist/src/commands/serve/serve.js.map +1 -1
- package/dist/src/commands/serve/serve.test.js +9 -2
- package/dist/src/commands/serve/serve.test.js.map +1 -1
- package/dist/src/commands/viewport/screenshot/screenshot.d.ts.map +1 -1
- package/dist/src/commands/viewport/screenshot/screenshot.js +4 -1
- package/dist/src/commands/viewport/screenshot/screenshot.js.map +1 -1
- package/dist/src/commands/viewport/screenshot/screenshot.test.js +5 -9
- package/dist/src/commands/viewport/screenshot/screenshot.test.js.map +1 -1
- package/dist/src/deploy/deploy-places.d.ts +39 -0
- package/dist/src/deploy/deploy-places.d.ts.map +1 -0
- package/dist/src/deploy/deploy-places.js +162 -0
- package/dist/src/deploy/deploy-places.js.map +1 -0
- package/dist/src/deploy/deploy-places.test.d.ts +2 -0
- package/dist/src/deploy/deploy-places.test.d.ts.map +1 -0
- package/dist/src/deploy/deploy-places.test.js +96 -0
- package/dist/src/deploy/deploy-places.test.js.map +1 -0
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/plugin/persistent-plugin-installer.d.ts.map +1 -1
- package/dist/src/plugin/persistent-plugin-installer.js +2 -1
- package/dist/src/plugin/persistent-plugin-installer.js.map +1 -1
- package/dist/src/plugin/persistent-plugin-installer.test.js +3 -0
- package/dist/src/plugin/persistent-plugin-installer.test.js.map +1 -1
- package/dist/src/plugin/plugin-build-version.d.ts +7 -0
- package/dist/src/plugin/plugin-build-version.d.ts.map +1 -0
- package/dist/src/plugin/plugin-build-version.js +42 -0
- package/dist/src/plugin/plugin-build-version.js.map +1 -0
- package/dist/src/plugin/plugin-build-version.test.d.ts +2 -0
- package/dist/src/plugin/plugin-build-version.test.d.ts.map +1 -0
- package/dist/src/plugin/plugin-build-version.test.js +41 -0
- package/dist/src/plugin/plugin-build-version.test.js.map +1 -0
- package/dist/src/plugin/plugin-injector.d.ts.map +1 -1
- package/dist/src/plugin/plugin-injector.js +7 -1
- package/dist/src/plugin/plugin-injector.js.map +1 -1
- package/dist/src/process/studio-process-closer.d.ts +35 -0
- package/dist/src/process/studio-process-closer.d.ts.map +1 -0
- package/dist/src/process/studio-process-closer.js +129 -0
- package/dist/src/process/studio-process-closer.js.map +1 -0
- package/dist/src/process/studio-process-closer.test.d.ts +2 -0
- package/dist/src/process/studio-process-closer.test.d.ts.map +1 -0
- package/dist/src/process/studio-process-closer.test.js +80 -0
- package/dist/src/process/studio-process-closer.test.js.map +1 -0
- package/dist/src/process/studio-settings.d.ts +14 -0
- package/dist/src/process/studio-settings.d.ts.map +1 -0
- package/dist/src/process/studio-settings.js +50 -0
- package/dist/src/process/studio-settings.js.map +1 -0
- package/dist/src/process/studio-settings.test.d.ts +2 -0
- package/dist/src/process/studio-settings.test.d.ts.map +1 -0
- package/dist/src/process/studio-settings.test.js +16 -0
- package/dist/src/process/studio-settings.test.js.map +1 -0
- package/dist/src/process/studio-window-state.d.ts +13 -0
- package/dist/src/process/studio-window-state.d.ts.map +1 -0
- package/dist/src/process/studio-window-state.js +48 -0
- package/dist/src/process/studio-window-state.js.map +1 -0
- package/dist/src/server/studio-bridge-server.d.ts +3 -1
- package/dist/src/server/studio-bridge-server.d.ts.map +1 -1
- package/dist/src/server/studio-bridge-server.js +12 -4
- package/dist/src/server/studio-bridge-server.js.map +1 -1
- package/dist/src/server/web-socket-protocol.d.ts +173 -6
- package/dist/src/server/web-socket-protocol.d.ts.map +1 -1
- package/dist/src/server/web-socket-protocol.js +244 -1
- package/dist/src/server/web-socket-protocol.js.map +1 -1
- package/dist/src/server/web-socket-protocol.test.js +48 -0
- package/dist/src/server/web-socket-protocol.test.js.map +1 -1
- package/dist/src/test/e2e/persistent-session.test.js +121 -0
- package/dist/src/test/e2e/persistent-session.test.js.map +1 -1
- package/dist/src/test/e2e/split-server.test.d.ts +3 -5
- package/dist/src/test/e2e/split-server.test.d.ts.map +1 -1
- package/dist/src/test/e2e/split-server.test.js +3 -5
- package/dist/src/test/e2e/split-server.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docker/Dockerfile +3 -0
- package/package.json +8 -6
- package/src/bridge/bridge-connection.test.ts +126 -0
- package/src/bridge/bridge-connection.ts +217 -22
- package/src/bridge/bridge-session.test.ts +6 -4
- package/src/bridge/bridge-session.ts +273 -28
- package/src/bridge/index.ts +3 -0
- package/src/bridge/internal/bridge-client.test.ts +23 -0
- package/src/bridge/internal/bridge-client.ts +25 -7
- package/src/bridge/internal/bridge-host.test.ts +38 -0
- package/src/bridge/internal/bridge-host.ts +47 -0
- package/src/bridge/internal/hand-off.ts +4 -1
- package/src/bridge/internal/host-protocol.test.ts +15 -0
- package/src/bridge/internal/host-protocol.ts +148 -37
- package/src/bridge/internal/instance-state.ts +34 -0
- package/src/bridge/internal/transport-client.ts +2 -1
- package/src/bridge/internal/transport-server.ts +5 -1
- package/src/bridge/types.ts +47 -2
- package/src/cli/adapters/cli-command-adapter-handler.test.ts +28 -0
- package/src/cli/adapters/cli-command-adapter.ts +150 -18
- package/src/cli/adapters/group-builder.test.ts +34 -2
- package/src/cli/adapters/group-builder.ts +52 -20
- package/src/cli/adapters/help-formatter.test.ts +1 -1
- package/src/cli/adapters/help-formatter.ts +4 -3
- package/src/cli/adapters/playtest-edit-guard.test.ts +54 -0
- package/src/cli/args/global-args.ts +1 -1
- package/src/cli/cli-output-context.test.ts +55 -0
- package/src/cli/cli-output-context.ts +50 -0
- package/src/cli/cli.ts +49 -17
- package/src/cli/managed-studio-run.test.ts +71 -0
- package/src/cli/managed-studio-run.ts +135 -0
- package/src/cli/resolve-session.test.ts +1 -1
- package/src/cli/resolve-session.ts +1 -1
- package/src/cli/script-executor.ts +99 -51
- package/src/commands/console/exec/exec.test.ts +96 -3
- package/src/commands/console/exec/exec.ts +59 -6
- package/src/commands/console/exec/execute.lua +356 -240
- package/src/commands/console/exec/execute.spec.lua +286 -0
- package/src/commands/console/logs/logs.test.ts +76 -4
- package/src/commands/console/logs/logs.ts +132 -17
- package/src/commands/console/logs/query-logs.lua +85 -52
- package/src/commands/console/logs/query-logs.spec.lua +132 -0
- package/src/commands/explorer/export/export-instances.lua +108 -0
- package/src/commands/explorer/export/export-instances.spec.lua +87 -0
- package/src/commands/explorer/export/export.test.ts +27 -0
- package/src/commands/explorer/export/export.ts +60 -0
- package/src/commands/explorer/find/find-instances.lua +174 -0
- package/src/commands/explorer/find/find-instances.spec.lua +122 -0
- package/src/commands/explorer/find/find.test.ts +53 -0
- package/src/commands/explorer/find/find.ts +113 -0
- package/src/commands/explorer/grep/grep-scripts.lua +214 -0
- package/src/commands/explorer/grep/grep-scripts.spec.lua +130 -0
- package/src/commands/explorer/grep/grep.test.ts +45 -0
- package/src/commands/explorer/grep/grep.ts +93 -0
- package/src/commands/explorer/import/import-instances.lua +106 -0
- package/src/commands/explorer/import/import-instances.spec.lua +84 -0
- package/src/commands/explorer/import/import.test.ts +60 -0
- package/src/commands/explorer/import/import.ts +66 -0
- package/src/commands/explorer/query/query-data-model.lua +124 -152
- package/src/commands/explorer/query/query-data-model.spec.lua +150 -0
- package/src/commands/formatters.test.ts +7 -1
- package/src/commands/framework/action-loader.test.ts +28 -0
- package/src/commands/framework/action-loader.ts +10 -2
- package/src/commands/framework/arg-builder.ts +26 -3
- package/src/commands/framework/define-command.ts +32 -3
- package/src/commands/framework/index.ts +1 -0
- package/src/commands/index.ts +50 -0
- package/src/commands/linux/inject-credentials/inject-credentials.ts +1 -3
- package/src/commands/linux/setup/setup.ts +1 -3
- package/src/commands/linux/status/status.ts +105 -98
- package/src/commands/playtest/player/add/add.ts +85 -0
- package/src/commands/playtest/player/list/list.ts +57 -0
- package/src/commands/playtest/player/playtest-players.test.ts +146 -0
- package/src/commands/playtest/player/playtest-players.ts +270 -0
- package/src/commands/playtest/player/remove/remove.ts +78 -0
- package/src/commands/playtest/playtest-sessions.test.ts +143 -0
- package/src/commands/playtest/playtest-sessions.ts +417 -0
- package/src/commands/playtest/restart/restart.ts +199 -0
- package/src/commands/playtest/run/playtest-runner.luau +264 -0
- package/src/commands/playtest/run/playtest-runner.spec.lua +71 -0
- package/src/commands/playtest/run/run-playtest-script.lua +139 -0
- package/src/commands/playtest/run/run-playtest-script.spec.lua +43 -0
- package/src/commands/playtest/run/run.ts +239 -0
- package/src/commands/playtest/start/start-playtest.lua +108 -0
- package/src/commands/playtest/start/start.ts +138 -0
- package/src/commands/playtest/stop/end-playtest.lua +47 -0
- package/src/commands/playtest/stop/stop.ts +51 -0
- package/src/commands/process/close/close.test.ts +250 -0
- package/src/commands/process/close/close.ts +183 -17
- package/src/commands/process/info/info.test.ts +198 -44
- package/src/commands/process/info/info.ts +204 -15
- package/src/commands/process/info/query-state.lua +42 -29
- package/src/commands/process/info/query-state.spec.lua +39 -0
- package/src/commands/process/launch/launch.test.ts +138 -21
- package/src/commands/process/launch/launch.ts +69 -9
- package/src/commands/process/list/list.test.ts +1 -0
- package/src/commands/process/list/list.ts +14 -6
- package/src/commands/process/run/run.ts +26 -5
- package/src/commands/serve/serve.test.ts +17 -2
- package/src/commands/serve/serve.ts +25 -6
- package/src/commands/viewport/screenshot/capture-screenshot.lua +175 -182
- package/src/commands/viewport/screenshot/capture-screenshot.spec.lua +129 -0
- package/src/commands/viewport/screenshot/screenshot.test.ts +7 -10
- package/src/commands/viewport/screenshot/screenshot.ts +6 -1
- package/src/deploy/deploy-places.test.ts +127 -0
- package/src/deploy/deploy-places.ts +229 -0
- package/src/index.ts +11 -0
- package/src/plugin/persistent-plugin-installer.test.ts +4 -0
- package/src/plugin/persistent-plugin-installer.ts +2 -1
- package/src/plugin/plugin-build-version.test.ts +55 -0
- package/src/plugin/plugin-build-version.ts +53 -0
- package/src/plugin/plugin-injector.ts +7 -1
- package/src/process/studio-process-closer.test.ts +107 -0
- package/src/process/studio-process-closer.ts +187 -0
- package/src/process/studio-settings.test.ts +18 -0
- package/src/process/studio-settings.ts +61 -0
- package/src/process/studio-window-state.ts +65 -0
- package/src/server/studio-bridge-server.ts +15 -4
- package/src/server/web-socket-protocol.test.ts +55 -0
- package/src/server/web-socket-protocol.ts +468 -8
- package/src/test/e2e/persistent-session.test.ts +137 -0
- package/src/test/e2e/split-server.test.ts +3 -5
- package/templates/studio-bridge-plugin/default.project.json +3 -0
- package/templates/studio-bridge-plugin/src/Shared/ActionRouter.lua +208 -159
- package/templates/studio-bridge-plugin/src/Shared/ActionRouter.spec.lua +418 -0
- package/templates/studio-bridge-plugin/src/Shared/BuiltInActions.lua +94 -0
- package/templates/studio-bridge-plugin/src/Shared/BuiltInActions.spec.lua +166 -0
- package/templates/studio-bridge-plugin/src/Shared/DiscoveryStateMachine.lua +118 -137
- package/templates/studio-bridge-plugin/src/Shared/DiscoveryStateMachine.spec.lua +228 -0
- package/templates/studio-bridge-plugin/src/Shared/MessageBuffer.lua +80 -109
- package/templates/studio-bridge-plugin/src/Shared/MessageBuffer.spec.lua +116 -0
- package/templates/studio-bridge-plugin/src/Shared/StudioBridgeConnection.lua +233 -0
- package/templates/studio-bridge-plugin/src/Shared/StudioBridgeConnection.spec.lua +239 -0
- package/templates/studio-bridge-plugin/src/Shared/StudioBridgeLogUtils.lua +53 -0
- package/templates/studio-bridge-plugin/src/Shared/StudioBridgeLogUtils.spec.lua +27 -0
- package/templates/studio-bridge-plugin/src/Shared/StudioBridgeSessionUtils.lua +164 -0
- package/templates/studio-bridge-plugin/src/Shared/StudioBridgeSessionUtils.spec.lua +159 -0
- package/templates/studio-bridge-plugin/src/StudioBridgePlugin.server.lua +266 -368
- package/templates/studio-bridge-plugin/src/Vendor/png.lua +8 -2
- package/test/default.project.json +41 -0
- package/test/jest.config.lua +3 -0
- package/test/scripts/Server/ServerMain.server.lua +10 -0
- package/tsconfig.json +1 -0
- package/templates/studio-bridge-plugin/src/Shared/Protocol.lua +0 -132
- package/templates/studio-bridge-plugin-test/test/actions.test.lua +0 -580
- package/templates/studio-bridge-plugin-test/test/discovery.test.lua +0 -622
- package/templates/studio-bridge-plugin-test/test/execute-handler.test.lua +0 -517
- package/templates/studio-bridge-plugin-test/test/hash-lifecycle.test.lua +0 -814
- package/templates/studio-bridge-plugin-test/test/integration.test.lua +0 -1020
- package/templates/studio-bridge-plugin-test/test/new-actions.test.lua +0 -339
- package/templates/studio-bridge-plugin-test/test/plugin-entry.test.lua +0 -493
- package/templates/studio-bridge-plugin-test/test/protocol.test.lua +0 -506
- package/templates/studio-bridge-plugin-test/test/roblox-mocks.lua +0 -108
- package/templates/studio-bridge-plugin-test/test/test-runner.lua +0 -112
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Starting, finding, and ending StudioTestService playtests.
|
|
3
|
+
*
|
|
4
|
+
* A playtest opens fresh server (and, in play mode, client) DataModels, and
|
|
5
|
+
* each connects to the bridge as its own session. Those sessions can't be
|
|
6
|
+
* matched to the Studio that started them by instance id, since unpublished
|
|
7
|
+
* places give every DataModel its own. Instead, `startPlaytestAsync` passes a
|
|
8
|
+
* playtest id as the StudioTestService test args, and each new session is
|
|
9
|
+
* asked for it back through `GetTestArgs`.
|
|
10
|
+
*/
|
|
11
|
+
import { randomUUID } from 'crypto';
|
|
12
|
+
import { ContextNotFoundError } from '../../bridge/index.js';
|
|
13
|
+
import { getPluginBuildVersionAsync } from '../../plugin/plugin-build-version.js';
|
|
14
|
+
import { tryReadLoadUserPluginsOnPlaytestAsync } from '../../process/studio-settings.js';
|
|
15
|
+
/** How long a started playtest may run before its pending start request is dropped. */
|
|
16
|
+
const PLAYTEST_MAX_DURATION_MS = 24 * 60 * 60 * 1000;
|
|
17
|
+
const SESSION_WAIT_TIMEOUT_MS = 30_000;
|
|
18
|
+
/** Each player of a multiplayer test boots its own Studio process. */
|
|
19
|
+
const MULTIPLAYER_SESSION_WAIT_TIMEOUT_MS = 90_000;
|
|
20
|
+
const SESSION_CLOSE_TIMEOUT_MS = 10_000;
|
|
21
|
+
const READ_RETRY_DELAY_MS = 1_000;
|
|
22
|
+
const PLAYTEST_PLUGINS_OFF_MESSAGE = `Studio's "Load user plugins on playtest" setting is off, so the studio-bridge plugin doesn't load into playtests and their sessions can't connect. Turn it on in Studio Settings, or run a script in a playtest's server with 'studio-bridge playtest run', which works without it.`;
|
|
23
|
+
const READ_PLAYTEST_ID_SCRIPT = [
|
|
24
|
+
'local ok, args = pcall(function()',
|
|
25
|
+
'\treturn game:GetService("StudioTestService"):GetTestArgs()',
|
|
26
|
+
'end)',
|
|
27
|
+
'return if ok and type(args) == "table" then args.studioBridgePlaytestId else nil',
|
|
28
|
+
].join('\n');
|
|
29
|
+
/** The sessions a playtest opens, by mode. Run mode has no player, so no client. */
|
|
30
|
+
export function getPlaytestContexts(mode) {
|
|
31
|
+
return mode === 'play' ? ['server', 'client'] : ['server'];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Start a playtest from `editSession` and resolve once every session it opens
|
|
35
|
+
* has connected. With `players`, it is a multiplayer test with a client per
|
|
36
|
+
* player. Rejects if Studio refuses to start it, e.g. because a playtest is
|
|
37
|
+
* already running.
|
|
38
|
+
*/
|
|
39
|
+
export async function startPlaytestAsync(connection, editSession, mode, players) {
|
|
40
|
+
if (editSession.context !== 'edit') {
|
|
41
|
+
throw new Error(`Playtests start from an edit session, but '${editSession.info.sessionId}' is a ${editSession.context} session`);
|
|
42
|
+
}
|
|
43
|
+
if (await isPlaytestPluginsOffAsync(connection)) {
|
|
44
|
+
throw new Error(PLAYTEST_PLUGINS_OFF_MESSAGE);
|
|
45
|
+
}
|
|
46
|
+
if (players !== undefined) {
|
|
47
|
+
await assertCanStartMultiplayerAsync(editSession, mode, players);
|
|
48
|
+
}
|
|
49
|
+
const playtestId = randomUUID();
|
|
50
|
+
const ended = editSession
|
|
51
|
+
.runPlaytestAsync(mode, playtestId, connection.port, PLAYTEST_MAX_DURATION_MS, players)
|
|
52
|
+
.catch((err) => ({
|
|
53
|
+
playtestId,
|
|
54
|
+
success: false,
|
|
55
|
+
error: err instanceof Error ? err.message : String(err),
|
|
56
|
+
}));
|
|
57
|
+
const clientCount = players ?? (mode === 'play' ? 1 : 0);
|
|
58
|
+
const waitTimeoutMs = players !== undefined
|
|
59
|
+
? MULTIPLAYER_SESSION_WAIT_TIMEOUT_MS
|
|
60
|
+
: SESSION_WAIT_TIMEOUT_MS;
|
|
61
|
+
const abort = new AbortController();
|
|
62
|
+
let outcome;
|
|
63
|
+
try {
|
|
64
|
+
outcome = await Promise.race([
|
|
65
|
+
waitForPlaytestSessionsAsync(connection, playtestId, clientCount, waitTimeoutMs, abort.signal).then((sessions) => ({ sessions })),
|
|
66
|
+
ended.then((result) => ({ result })),
|
|
67
|
+
]);
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
abort.abort();
|
|
71
|
+
}
|
|
72
|
+
if ('result' in outcome) {
|
|
73
|
+
throw new Error(outcome.result.success
|
|
74
|
+
? 'Playtest ended before its sessions connected'
|
|
75
|
+
: `Playtest failed to start: ${outcome.result.error}`);
|
|
76
|
+
}
|
|
77
|
+
const { server, clients } = outcome.sessions;
|
|
78
|
+
const missing = [
|
|
79
|
+
...(server ? [] : ['server']),
|
|
80
|
+
...(clients.length < clientCount
|
|
81
|
+
? [`${clientCount - clients.length} client`]
|
|
82
|
+
: []),
|
|
83
|
+
];
|
|
84
|
+
if (server && missing.length === 0) {
|
|
85
|
+
return {
|
|
86
|
+
playtestId,
|
|
87
|
+
mode,
|
|
88
|
+
players,
|
|
89
|
+
sessions: { server, client: clients[0] },
|
|
90
|
+
clients,
|
|
91
|
+
ended,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
const waited = `its ${missing.join(' and ')} session${missing.length > 1 || clientCount - clients.length > 1 ? 's' : ''} did not connect within ${waitTimeoutMs / 1000}s`;
|
|
95
|
+
// Without its server session the playtest can't be ended from here
|
|
96
|
+
if (!server?.isConnected) {
|
|
97
|
+
throw new Error(`Playtest started, but ${waited}, so stop it in Studio. Play sessions only connect with Studio's "Load user plugins on playtest" setting on.`);
|
|
98
|
+
}
|
|
99
|
+
await endPlaytestAsync(connection, server);
|
|
100
|
+
throw new Error(`Playtest started, but ${waited}, so it was stopped.`);
|
|
101
|
+
}
|
|
102
|
+
async function assertCanStartMultiplayerAsync(editSession, mode, players) {
|
|
103
|
+
if (!Number.isInteger(players) || players < 1) {
|
|
104
|
+
throw new Error(`--players must be a whole number of at least 1, not ${players}`);
|
|
105
|
+
}
|
|
106
|
+
if (mode !== 'play') {
|
|
107
|
+
throw new Error('A multiplayer test runs in play mode');
|
|
108
|
+
}
|
|
109
|
+
// Older plugins give every client the same session id, so all but one drop off
|
|
110
|
+
const expected = await getPluginBuildVersionAsync();
|
|
111
|
+
if (editSession.info.pluginVersion !== expected) {
|
|
112
|
+
throw new Error(`Multiplayer tests need the current studio-bridge plugin, but '${editSession.info.placeName}' has an older one. Run 'studio-bridge plugin install' first.`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Resolve the server session of a running playtest. `target` names it or
|
|
117
|
+
* any session of its Studio; otherwise there must be exactly one connected.
|
|
118
|
+
*/
|
|
119
|
+
export async function resolvePlaytestServerSessionAsync(connection, target) {
|
|
120
|
+
if (target) {
|
|
121
|
+
try {
|
|
122
|
+
return await connection.resolveSessionAsync(target, 'server');
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
throw await explainMissingPlaytestContextAsync(connection, err);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const servers = connection
|
|
129
|
+
.listSessions()
|
|
130
|
+
.filter((info) => info.context === 'server');
|
|
131
|
+
if (servers.length === 0) {
|
|
132
|
+
throw new Error(await explainNoPlaytestAsync(connection));
|
|
133
|
+
}
|
|
134
|
+
if (servers.length > 1) {
|
|
135
|
+
const list = servers
|
|
136
|
+
.map((info) => ` - ${info.sessionId}: ${info.placeName}`)
|
|
137
|
+
.join('\n');
|
|
138
|
+
throw new Error(`Multiple playtests are running. Use --target <id> to pick a server session.\n${list}`);
|
|
139
|
+
}
|
|
140
|
+
const session = connection.getSession(servers[0].sessionId);
|
|
141
|
+
if (!session) {
|
|
142
|
+
throw new Error(`Session '${servers[0].sessionId}' disconnected`);
|
|
143
|
+
}
|
|
144
|
+
return session;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Explains a missing `server` or `client` session: no playtest is running, a
|
|
148
|
+
* run-mode playtest has no client, or the playtest's sessions can't connect.
|
|
149
|
+
* Other errors pass through unchanged.
|
|
150
|
+
*/
|
|
151
|
+
export async function explainMissingPlaytestContextAsync(connection, err) {
|
|
152
|
+
if (!(err instanceof ContextNotFoundError) ||
|
|
153
|
+
(err.context !== 'server' && err.context !== 'client')) {
|
|
154
|
+
return err;
|
|
155
|
+
}
|
|
156
|
+
const placeName = connection
|
|
157
|
+
.listSessions()
|
|
158
|
+
.find((info) => info.instanceId === err.instanceId)?.placeName;
|
|
159
|
+
const studio = placeName ? `'${placeName}'` : `instance '${err.instanceId}'`;
|
|
160
|
+
if (err.context === 'client' && err.availableContexts.includes('server')) {
|
|
161
|
+
return new Error(`The playtest of ${studio} runs in run mode, which has no client. Restart it in play mode with 'studio-bridge playtest restart --mode play'.`);
|
|
162
|
+
}
|
|
163
|
+
return new Error(await explainNoPlaytestAsync(connection, studio, err.context));
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Whether this machine's Studio has "Load user plugins on playtest" off. A
|
|
167
|
+
* remote Studio's settings aren't on this machine, so they count as unknown.
|
|
168
|
+
*/
|
|
169
|
+
async function isPlaytestPluginsOffAsync(connection) {
|
|
170
|
+
return (!connection.isRemote &&
|
|
171
|
+
(await tryReadLoadUserPluginsOnPlaytestAsync()) === false);
|
|
172
|
+
}
|
|
173
|
+
async function explainNoPlaytestAsync(connection, studio, context) {
|
|
174
|
+
const of = studio ? ` of ${studio}` : '';
|
|
175
|
+
if (await isPlaytestPluginsOffAsync(connection)) {
|
|
176
|
+
return `No playtest${of} is connected. ${PLAYTEST_PLUGINS_OFF_MESSAGE}`;
|
|
177
|
+
}
|
|
178
|
+
const missing = context ? `, so there is no ${context} session` : '';
|
|
179
|
+
return `No playtest${of} is running${missing}. Start one with 'studio-bridge playtest start'.`;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* End the playtest `serverSession` belongs to, resolving once the session has
|
|
183
|
+
* closed with what the playtest reported about itself.
|
|
184
|
+
*/
|
|
185
|
+
export async function endPlaytestAsync(connection, serverSession) {
|
|
186
|
+
const ended = await serverSession.endPlaytestAsync();
|
|
187
|
+
await waitForSessionCloseAsync(connection, serverSession.info.sessionId);
|
|
188
|
+
return ended;
|
|
189
|
+
}
|
|
190
|
+
async function waitForPlaytestSessionsAsync(connection, playtestId, clientCount, timeoutMs, signal) {
|
|
191
|
+
return new Promise((resolve) => {
|
|
192
|
+
const found = { clients: [] };
|
|
193
|
+
const checked = new Set();
|
|
194
|
+
const cleanup = () => {
|
|
195
|
+
clearTimeout(timer);
|
|
196
|
+
connection.off('session-connected', onSession);
|
|
197
|
+
signal.removeEventListener('abort', cleanup);
|
|
198
|
+
};
|
|
199
|
+
const onSession = (session) => {
|
|
200
|
+
const { sessionId } = session.info;
|
|
201
|
+
if (session.context === 'edit' || checked.has(sessionId)) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
checked.add(sessionId);
|
|
205
|
+
void readPlaytestIdAsync(connection, sessionId, signal).then((read) => {
|
|
206
|
+
if (signal.aborted || !read)
|
|
207
|
+
return;
|
|
208
|
+
if (read.id !== playtestId) {
|
|
209
|
+
// The last playtest's session can linger under the same id; read its replacement too
|
|
210
|
+
checked.delete(sessionId);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (read.session.context === 'server') {
|
|
214
|
+
found.server = read.session;
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
found.clients.push(read.session);
|
|
218
|
+
}
|
|
219
|
+
if (found.server && found.clients.length >= clientCount) {
|
|
220
|
+
cleanup();
|
|
221
|
+
resolve(found);
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
// Resolves with whichever sessions connected; the caller reports the rest
|
|
226
|
+
const timer = setTimeout(() => {
|
|
227
|
+
cleanup();
|
|
228
|
+
resolve(found);
|
|
229
|
+
}, timeoutMs);
|
|
230
|
+
signal.addEventListener('abort', cleanup);
|
|
231
|
+
connection.on('session-connected', onSession);
|
|
232
|
+
for (const info of connection.listSessions()) {
|
|
233
|
+
const session = connection.getSession(info.sessionId);
|
|
234
|
+
if (session)
|
|
235
|
+
onSession(session);
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Reads the playtest id a session was started under, retrying while the read
|
|
241
|
+
* fails: a playtest's DataModels are slow to answer while their Studio boots,
|
|
242
|
+
* and a session that reconnects is read again under the same id.
|
|
243
|
+
*/
|
|
244
|
+
async function readPlaytestIdAsync(connection, sessionId, signal) {
|
|
245
|
+
while (!signal.aborted) {
|
|
246
|
+
const session = connection.getSession(sessionId);
|
|
247
|
+
if (session) {
|
|
248
|
+
try {
|
|
249
|
+
const result = await session.execAsync(READ_PLAYTEST_ID_SCRIPT, 5_000);
|
|
250
|
+
if (result.success) {
|
|
251
|
+
const value = result.returnValues?.[0];
|
|
252
|
+
return { session, id: typeof value === 'string' ? value : undefined };
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
catch {
|
|
256
|
+
// Retried below
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
await new Promise((resolve) => setTimeout(resolve, READ_RETRY_DELAY_MS));
|
|
260
|
+
}
|
|
261
|
+
return undefined;
|
|
262
|
+
}
|
|
263
|
+
async function waitForSessionCloseAsync(connection, sessionId) {
|
|
264
|
+
return new Promise((resolve, reject) => {
|
|
265
|
+
if (!connection.getSession(sessionId)) {
|
|
266
|
+
resolve();
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
const onDisconnected = (disconnectedId) => {
|
|
270
|
+
if (disconnectedId !== sessionId)
|
|
271
|
+
return;
|
|
272
|
+
clearTimeout(timer);
|
|
273
|
+
connection.off('session-disconnected', onDisconnected);
|
|
274
|
+
resolve();
|
|
275
|
+
};
|
|
276
|
+
const timer = setTimeout(() => {
|
|
277
|
+
connection.off('session-disconnected', onDisconnected);
|
|
278
|
+
reject(new Error(`Playtest did not close within ${SESSION_CLOSE_TIMEOUT_MS / 1000}s`));
|
|
279
|
+
}, SESSION_CLOSE_TIMEOUT_MS);
|
|
280
|
+
connection.on('session-disconnected', onDisconnected);
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=playtest-sessions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playtest-sessions.js","sourceRoot":"","sources":["../../../../src/commands/playtest/playtest-sessions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AASpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,qCAAqC,EAAE,MAAM,kCAAkC,CAAC;AAEzF,uFAAuF;AACvF,MAAM,wBAAwB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,I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,UAA4B,EAC5B,SAAiB;IAEjB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YACtC,OAAO,EAAE,CAAC;YACV,OAAO;QACT,CAAC;QAED,MAAM,cAAc,GAAG,CAAC,cAAsB,EAAE,EAAE;YAChD,IAAI,cAAc,KAAK,SAAS;gBAAE,OAAO;YACzC,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,UAAU,CAAC,GAAG,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;YACvD,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;QAEF,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,UAAU,CAAC,GAAG,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;YACvD,MAAM,CACJ,IAAI,KAAK,CACP,iCAAiC,wBAAwB,GAAG,IAAI,GAAG,CACpE,CACF,CAAC;QACJ,CAAC,EAAE,wBAAwB,CAAC,CAAC;QAE7B,UAAU,CAAC,EAAE,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playtest-sessions.test.d.ts","sourceRoot":"","sources":["../../../../src/commands/playtest/playtest-sessions.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
vi.mock('../../plugin/plugin-build-version.js', () => ({
|
|
3
|
+
getPluginBuildVersionAsync: async () => 'current',
|
|
4
|
+
}));
|
|
5
|
+
const settings = vi.hoisted(() => ({
|
|
6
|
+
loadUserPluginsOnPlaytest: undefined,
|
|
7
|
+
}));
|
|
8
|
+
vi.mock('../../process/studio-settings.js', () => ({
|
|
9
|
+
tryReadLoadUserPluginsOnPlaytestAsync: async () => settings.loadUserPluginsOnPlaytest,
|
|
10
|
+
}));
|
|
11
|
+
import { ContextNotFoundError } from '../../bridge/index.js';
|
|
12
|
+
import { explainMissingPlaytestContextAsync, resolvePlaytestServerSessionAsync, startPlaytestAsync, } from './playtest-sessions.js';
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
settings.loadUserPluginsOnPlaytest = undefined;
|
|
15
|
+
});
|
|
16
|
+
function createEditSession(pluginVersion) {
|
|
17
|
+
return {
|
|
18
|
+
context: 'edit',
|
|
19
|
+
info: {
|
|
20
|
+
sessionId: 'place-1a2b-edit',
|
|
21
|
+
placeName: 'place.rbxl',
|
|
22
|
+
pluginVersion,
|
|
23
|
+
},
|
|
24
|
+
runPlaytestAsync: vi.fn(),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
describe('startPlaytestAsync multiplayer checks', () => {
|
|
28
|
+
it('refuses a player count that is not a whole number of at least 1', async () => {
|
|
29
|
+
for (const players of [0, 2.5, -1]) {
|
|
30
|
+
const editSession = createEditSession('current');
|
|
31
|
+
await expect(startPlaytestAsync({}, editSession, 'play', players)).rejects.toThrow('--players must be a whole number of at least 1');
|
|
32
|
+
expect(editSession.runPlaytestAsync).not.toHaveBeenCalled();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
it('refuses run mode', async () => {
|
|
36
|
+
await expect(startPlaytestAsync({}, createEditSession('current'), 'run', 2)).rejects.toThrow('A multiplayer test runs in play mode');
|
|
37
|
+
});
|
|
38
|
+
it('refuses a Studio with an older plugin before starting anything', async () => {
|
|
39
|
+
const editSession = createEditSession('old');
|
|
40
|
+
await expect(startPlaytestAsync({}, editSession, 'play', 2)).rejects.toThrow("Run 'studio-bridge plugin install' first");
|
|
41
|
+
expect(editSession.runPlaytestAsync).not.toHaveBeenCalled();
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
describe('with "Load user plugins on playtest" off', () => {
|
|
45
|
+
it('refuses to start a playtest whose sessions could never connect', async () => {
|
|
46
|
+
settings.loadUserPluginsOnPlaytest = false;
|
|
47
|
+
const editSession = createEditSession('current');
|
|
48
|
+
await expect(startPlaytestAsync({}, editSession, 'play')).rejects.toThrow(`Studio's "Load user plugins on playtest" setting is off`);
|
|
49
|
+
expect(editSession.runPlaytestAsync).not.toHaveBeenCalled();
|
|
50
|
+
});
|
|
51
|
+
it('names the setting when no server session is connected', async () => {
|
|
52
|
+
settings.loadUserPluginsOnPlaytest = false;
|
|
53
|
+
const connection = { listSessions: () => [] };
|
|
54
|
+
await expect(resolvePlaytestServerSessionAsync(connection)).rejects.toThrow(`No playtest is connected. Studio's "Load user plugins on playtest" setting is off`);
|
|
55
|
+
});
|
|
56
|
+
it("ignores this machine's setting when Studio is remote", async () => {
|
|
57
|
+
settings.loadUserPluginsOnPlaytest = false;
|
|
58
|
+
const connection = { listSessions: () => [], isRemote: true };
|
|
59
|
+
await expect(resolvePlaytestServerSessionAsync(connection)).rejects.toThrow("No playtest is running. Start one with 'studio-bridge playtest start'.");
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
describe('explainMissingPlaytestContextAsync', () => {
|
|
63
|
+
const connection = {
|
|
64
|
+
listSessions: () => [
|
|
65
|
+
{ instanceId: 'inst-1', placeName: 'place.rbxl', context: 'edit' },
|
|
66
|
+
],
|
|
67
|
+
};
|
|
68
|
+
it('says no playtest is running when the setting is on', async () => {
|
|
69
|
+
settings.loadUserPluginsOnPlaytest = true;
|
|
70
|
+
const err = await explainMissingPlaytestContextAsync(connection, new ContextNotFoundError('server', 'inst-1', ['edit']));
|
|
71
|
+
expect(err.message).toBe("No playtest of 'place.rbxl' is running, so there is no server session. Start one with 'studio-bridge playtest start'.");
|
|
72
|
+
});
|
|
73
|
+
it('names the setting when it is off', async () => {
|
|
74
|
+
settings.loadUserPluginsOnPlaytest = false;
|
|
75
|
+
const err = await explainMissingPlaytestContextAsync(connection, new ContextNotFoundError('client', 'inst-1', ['edit']));
|
|
76
|
+
expect(err.message).toContain(`No playtest of 'place.rbxl' is connected. Studio's "Load user plugins on playtest" setting is off`);
|
|
77
|
+
});
|
|
78
|
+
it('points a client request at play mode when a run-mode playtest is running', async () => {
|
|
79
|
+
const err = await explainMissingPlaytestContextAsync(connection, new ContextNotFoundError('client', 'inst-1', ['edit', 'server']));
|
|
80
|
+
expect(err.message).toContain('runs in run mode');
|
|
81
|
+
});
|
|
82
|
+
it('passes other errors through', async () => {
|
|
83
|
+
const original = new ContextNotFoundError('edit', 'inst-1', ['server']);
|
|
84
|
+
expect(await explainMissingPlaytestContextAsync(connection, original)).toBe(original);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
//# sourceMappingURL=playtest-sessions.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playtest-sessions.test.js","sourceRoot":"","sources":["../../../../src/commands/playtest/playtest-sessions.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE9D,EAAE,CAAC,IAAI,CAAC,sCAAsC,EAAE,GAAG,EAAE,CAAC,CAAC;IACrD,0BAA0B,EAAE,KAAK,IAAI,EAAE,CAAC,SAAS;CAClD,CAAC,CAAC,CAAC;AAEJ,MAAM,QAAQ,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACjC,yBAAyB,EAAE,SAAgC;CAC5D,CAAC,CAAC,CAAC;AACJ,EAAE,CAAC,IAAI,CAAC,kCAAkC,EAAE,GAAG,EAAE,CAAC,CAAC;IACjD,qCAAqC,EAAE,KAAK,IAAI,EAAE,CAChD,QAAQ,CAAC,yBAAyB;CACrC,CAAC,CAAC,CAAC;AAEJ,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EACL,kCAAkC,EAClC,iCAAiC,EACjC,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAEhC,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AkB,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC3C,MAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;QACxE,MAAM,CAAC,MAAM,kCAAkC,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CACzE,QAAQ,CACT,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `playtest restart` — stop the running playtest and start a new one in the
|
|
3
|
+
* same mode, so it picks up code changed since it started. Starts one when
|
|
4
|
+
* none is running.
|
|
5
|
+
*/
|
|
6
|
+
import type { BridgeConnection, PlaytestMode } from '../../../bridge/index.js';
|
|
7
|
+
import { type PlaytestStartResult } from '../start/start.js';
|
|
8
|
+
export interface PlaytestRestartOptions {
|
|
9
|
+
/** Defaults to the running playtest's mode, or play when none is running. */
|
|
10
|
+
mode?: PlaytestMode;
|
|
11
|
+
/** Defaults to the running multiplayer test's player count. */
|
|
12
|
+
players?: number;
|
|
13
|
+
/** Picks the Studio: any of its sessions. */
|
|
14
|
+
target?: string;
|
|
15
|
+
}
|
|
16
|
+
interface PlaytestRestartArgs {
|
|
17
|
+
mode?: PlaytestMode;
|
|
18
|
+
players?: number;
|
|
19
|
+
}
|
|
20
|
+
export declare function playtestRestartHandlerAsync(connection: BridgeConnection, options?: PlaytestRestartOptions): Promise<PlaytestStartResult>;
|
|
21
|
+
export declare const playtestRestartCommand: import("../../framework/define-command.js").CommandDefinition<PlaytestRestartArgs, PlaytestStartResult>;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=restart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restart.d.ts","sourceRoot":"","sources":["../../../../../src/commands/playtest/restart/restart.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EACV,gBAAgB,EAEhB,YAAY,EACb,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,mBAAmB,CAAC;AAM3B,MAAM,WAAW,sBAAsB;IACrC,6EAA6E;IAC7E,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,mBAAmB;IAC3B,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAsB,2BAA2B,CAC/C,UAAU,EAAE,gBAAgB,EAC5B,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,mBAAmB,CAAC,CA0D9B;AA6DD,eAAO,MAAM,sBAAsB,yGAgCjC,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `playtest restart` — stop the running playtest and start a new one in the
|
|
3
|
+
* same mode, so it picks up code changed since it started. Starts one when
|
|
4
|
+
* none is running.
|
|
5
|
+
*/
|
|
6
|
+
import { defineCommand } from '../../framework/define-command.js';
|
|
7
|
+
import { arg } from '../../framework/arg-builder.js';
|
|
8
|
+
import { endPlaytestAsync, startPlaytestAsync, } from '../playtest-sessions.js';
|
|
9
|
+
import { listPlaytestPlayersAsync } from '../player/playtest-players.js';
|
|
10
|
+
import { describePlaytest, formatPlaytestStartText, toPlaytestStartResult, } from '../start/start.js';
|
|
11
|
+
/** Studio refuses a new playtest until the old one has fully wound down. */
|
|
12
|
+
const START_ATTEMPTS = 5;
|
|
13
|
+
const START_RETRY_DELAY_MS = 1_000;
|
|
14
|
+
export async function playtestRestartHandlerAsync(connection, options = {}) {
|
|
15
|
+
const targetSession = options.target
|
|
16
|
+
? await connection.resolveSessionAsync(options.target)
|
|
17
|
+
: undefined;
|
|
18
|
+
const serverSession = findServerSession(connection, targetSession?.info.instanceId);
|
|
19
|
+
if (!serverSession) {
|
|
20
|
+
const editSession = targetSession?.context === 'edit'
|
|
21
|
+
? targetSession
|
|
22
|
+
: await connection.resolveSessionAsync(undefined, 'edit', targetSession?.info.instanceId);
|
|
23
|
+
const playtest = await startWithRetryAsync(connection, editSession, options.mode ?? 'play', options.players);
|
|
24
|
+
return toPlaytestStartResult(playtest, `No playtest was running; started one (${describePlaytest(playtest)})`);
|
|
25
|
+
}
|
|
26
|
+
const editSession = await connection.resolveSessionAsync(undefined, 'edit', serverSession.info.instanceId);
|
|
27
|
+
// Players added since the start count too, so read who is in the test now
|
|
28
|
+
const livePlayers = options.players === undefined && options.mode === undefined
|
|
29
|
+
? await tryCountMultiplayerPlayersAsync(connection, serverSession)
|
|
30
|
+
: undefined;
|
|
31
|
+
const ended = await endPlaytestAsync(connection, serverSession);
|
|
32
|
+
const mode = options.mode ?? ended.mode ?? 'play';
|
|
33
|
+
const players = options.players ??
|
|
34
|
+
(options.mode === undefined && ended.players !== undefined
|
|
35
|
+
? livePlayers || ended.players
|
|
36
|
+
: undefined);
|
|
37
|
+
const playtest = await startWithRetryAsync(connection, editSession, mode, players);
|
|
38
|
+
return toPlaytestStartResult(playtest, `Playtest restarted (${describePlaytest(playtest)})`);
|
|
39
|
+
}
|
|
40
|
+
/** How many players the running test has, or undefined when it can't tell. */
|
|
41
|
+
async function tryCountMultiplayerPlayersAsync(connection, serverSession) {
|
|
42
|
+
try {
|
|
43
|
+
return (await listPlaytestPlayersAsync(connection, serverSession)).length;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** The running playtest's server session, within `instanceId` when given. */
|
|
50
|
+
function findServerSession(connection, instanceId) {
|
|
51
|
+
const servers = connection
|
|
52
|
+
.listSessions()
|
|
53
|
+
.filter((info) => info.context === 'server' &&
|
|
54
|
+
(instanceId === undefined || info.instanceId === instanceId));
|
|
55
|
+
if (servers.length > 1) {
|
|
56
|
+
const list = servers
|
|
57
|
+
.map((info) => ` - ${info.sessionId}: ${info.placeName}`)
|
|
58
|
+
.join('\n');
|
|
59
|
+
throw new Error(`Multiple playtests are running. Use --target <id> to pick one.\n${list}`);
|
|
60
|
+
}
|
|
61
|
+
return servers.length === 1
|
|
62
|
+
? connection.getSession(servers[0].sessionId)
|
|
63
|
+
: undefined;
|
|
64
|
+
}
|
|
65
|
+
async function startWithRetryAsync(connection, editSession, mode, players) {
|
|
66
|
+
for (let attempt = 1;; attempt++) {
|
|
67
|
+
try {
|
|
68
|
+
return await startPlaytestAsync(connection, editSession, mode, players);
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
const stillWindingDown = err instanceof Error && err.message.includes('still in progress');
|
|
72
|
+
if (!stillWindingDown || attempt >= START_ATTEMPTS) {
|
|
73
|
+
throw err;
|
|
74
|
+
}
|
|
75
|
+
await new Promise((resolve) => setTimeout(resolve, START_RETRY_DELAY_MS));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export const playtestRestartCommand = defineCommand({
|
|
80
|
+
group: 'playtest',
|
|
81
|
+
name: 'restart',
|
|
82
|
+
description: 'Stop the running playtest and start a new one in the same mode, to pick up code changes',
|
|
83
|
+
category: 'execution',
|
|
84
|
+
safety: 'mutate',
|
|
85
|
+
scope: 'connection',
|
|
86
|
+
args: {
|
|
87
|
+
mode: arg.option({
|
|
88
|
+
description: "Start in this mode instead of the running playtest's (play or run)",
|
|
89
|
+
choices: ['play', 'run'],
|
|
90
|
+
}),
|
|
91
|
+
players: arg.option({
|
|
92
|
+
description: "Start a multiplayer test with this many players instead of the running playtest's",
|
|
93
|
+
type: 'number',
|
|
94
|
+
}),
|
|
95
|
+
},
|
|
96
|
+
cli: {
|
|
97
|
+
format: formatPlaytestStartText,
|
|
98
|
+
},
|
|
99
|
+
handler: async (connection, args, targeting) => playtestRestartHandlerAsync(connection, {
|
|
100
|
+
mode: args.mode,
|
|
101
|
+
players: args.players,
|
|
102
|
+
target: targeting.target,
|
|
103
|
+
}),
|
|
104
|
+
});
|
|
105
|
+
//# sourceMappingURL=restart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restart.js","sourceRoot":"","sources":["../../../../../src/commands/playtest/restart/restart.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAMrD,OAAO,EACL,gBAAgB,EAChB,kBAAkB,GAEnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,qBAAqB,GAEtB,MAAM,mBAAmB,CAAC;AAE3B,4EAA4E;AAC5E,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAgBnC,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,UAA4B,EAC5B,UAAkC,EAAE;IAEpC,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM;QAClC,CAAC,CAAC,MAAM,UAAU,CAAC,mBAAmB,CAAC,OAAO,CAAC,MAAM,CAAC;QACtD,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,aAAa,GAAG,iBAAiB,CACrC,UAAU,EACV,aAAa,EAAE,IAAI,CAAC,UAAU,CAC/B,CAAC;IAEF,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,WAAW,GACf,aAAa,EAAE,OAAO,KAAK,MAAM;YAC/B,CAAC,CAAC,aAAa;YACf,CAAC,CAAC,MAAM,UAAU,CAAC,mBAAmB,CAClC,SAAS,EACT,MAAM,EACN,aAAa,EAAE,IAAI,CAAC,UAAU,CAC/B,CA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AG,CAAC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;YACpE,IAAI,CAAC,gBAAgB,IAAI,OAAO,IAAI,cAAc,EAAE,CAAC;gBACnD,MAAM,GAAG,CAAC;YACZ,CAAC;YACD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAGjD;IACA,KAAK,EAAE,UAAU;IACjB,IAAI,EAAE,SAAS;IACf,WAAW,EACT,yFAAyF;IAC3F,QAAQ,EAAE,WAAW;IACrB,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE;QACJ,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC;YACf,WAAW,EACT,oEAAoE;YACtE,OAAO,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;SACzB,CAAC;QACF,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC;YAClB,WAAW,EACT,mFAAmF;YACrF,IAAI,EAAE,QAAQ;SACf,CAAC;KACH;IACD,GAAG,EAAE;QACH,MAAM,EAAE,uBAAuB;KAChC;IACD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAC7C,2BAA2B,CAAC,UAAU,EAAE;QACtC,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,MAAM,EAAE,SAAS,CAAC,MAAM;KACzB,CAAC;CACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `playtest run` — start a playtest, execute Luau inside it, then stop it.
|
|
3
|
+
*
|
|
4
|
+
* The code runs in the playtest's server by default, or its client with
|
|
5
|
+
* `--context client`. Its output and return values come back the same way as
|
|
6
|
+
* `console exec`.
|
|
7
|
+
*
|
|
8
|
+
* In the server, the edit session plants a runner script in the playtest
|
|
9
|
+
* (playtest-runner.luau), so this works even when Studio does not load user
|
|
10
|
+
* plugins into playtests. The client has no such path: it needs the
|
|
11
|
+
* playtest's client session, so it needs that Studio setting on.
|
|
12
|
+
*/
|
|
13
|
+
import type { BridgeConnection, PlaytestMode, SessionContext } from '../../../bridge/index.js';
|
|
14
|
+
import type { SerializedReturnValue } from '../../../server/web-socket-protocol.js';
|
|
15
|
+
export interface PlaytestRunOptions {
|
|
16
|
+
scriptContent: string;
|
|
17
|
+
mode: PlaytestMode;
|
|
18
|
+
/** Which playtest DataModel runs the code. */
|
|
19
|
+
context: SessionContext;
|
|
20
|
+
/** Picks the edit session to start the playtest from. */
|
|
21
|
+
target?: string;
|
|
22
|
+
timeout?: number;
|
|
23
|
+
/** Passed to the script as `...`. */
|
|
24
|
+
args?: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface PlaytestRunResult {
|
|
27
|
+
success: boolean;
|
|
28
|
+
/** Absent when the script ran through the planted runner. */
|
|
29
|
+
playtestId?: string;
|
|
30
|
+
output: string[];
|
|
31
|
+
error?: string;
|
|
32
|
+
returnValues?: SerializedReturnValue[];
|
|
33
|
+
/** Set when the script ran but the playtest could not be stopped. */
|
|
34
|
+
stopError?: string;
|
|
35
|
+
summary: string;
|
|
36
|
+
}
|
|
37
|
+
interface PlaytestRunArgs {
|
|
38
|
+
code?: string;
|
|
39
|
+
file?: string;
|
|
40
|
+
mode?: PlaytestMode;
|
|
41
|
+
timeout?: number;
|
|
42
|
+
scriptArgs?: string[];
|
|
43
|
+
}
|
|
44
|
+
export declare function playtestRunHandlerAsync(connection: BridgeConnection, options: PlaytestRunOptions): Promise<PlaytestRunResult>;
|
|
45
|
+
export declare const playtestRunCommand: import("../../framework/define-command.js").CommandDefinition<PlaytestRunArgs, PlaytestRunResult>;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0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