@quenty/studio-bridge 0.23.0 → 0.24.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 +21 -0
- package/README.md +36 -8
- package/dist/src/bridge/bridge-connection.d.ts.map +1 -1
- package/dist/src/bridge/bridge-connection.js +1 -0
- package/dist/src/bridge/bridge-connection.js.map +1 -1
- package/dist/src/bridge/bridge-session.d.ts +11 -16
- package/dist/src/bridge/bridge-session.d.ts.map +1 -1
- package/dist/src/bridge/bridge-session.js +37 -29
- package/dist/src/bridge/bridge-session.js.map +1 -1
- package/dist/src/bridge/bridge-session.test.js +35 -0
- package/dist/src/bridge/bridge-session.test.js.map +1 -1
- package/dist/src/bridge/internal/bridge-host.d.ts +2 -0
- package/dist/src/bridge/internal/bridge-host.d.ts.map +1 -1
- package/dist/src/bridge/internal/bridge-host.js +1 -0
- package/dist/src/bridge/internal/bridge-host.js.map +1 -1
- package/dist/src/bridge/internal/host-protocol.d.ts.map +1 -1
- package/dist/src/bridge/internal/host-protocol.js +23 -10
- package/dist/src/bridge/internal/host-protocol.js.map +1 -1
- package/dist/src/bridge/types.d.ts +5 -2
- package/dist/src/bridge/types.d.ts.map +1 -1
- package/dist/src/bridge/types.js.map +1 -1
- package/dist/src/commands/console/exec/exec.d.ts +13 -3
- package/dist/src/commands/console/exec/exec.d.ts.map +1 -1
- package/dist/src/commands/console/exec/exec.js +82 -7
- package/dist/src/commands/console/exec/exec.js.map +1 -1
- package/dist/src/commands/console/exec/exec.test.js +63 -1
- package/dist/src/commands/console/exec/exec.test.js.map +1 -1
- package/dist/src/commands/framework/action-loader.test.js +1 -1
- package/dist/src/commands/framework/action-loader.test.js.map +1 -1
- package/dist/src/commands/playtest/player/playtest-players.d.ts.map +1 -1
- package/dist/src/commands/playtest/player/playtest-players.js +15 -93
- package/dist/src/commands/playtest/player/playtest-players.js.map +1 -1
- package/dist/src/commands/playtest/player/playtest-players.test.js +34 -21
- package/dist/src/commands/playtest/player/playtest-players.test.js.map +1 -1
- package/dist/src/commands/playtest/playtest-sessions.d.ts +19 -3
- package/dist/src/commands/playtest/playtest-sessions.d.ts.map +1 -1
- package/dist/src/commands/playtest/playtest-sessions.js +54 -74
- package/dist/src/commands/playtest/playtest-sessions.js.map +1 -1
- package/dist/src/commands/playtest/playtest-sessions.test.js +74 -8
- package/dist/src/commands/playtest/playtest-sessions.test.js.map +1 -1
- package/dist/src/commands/playtest/run/run.d.ts +9 -7
- package/dist/src/commands/playtest/run/run.d.ts.map +1 -1
- package/dist/src/commands/playtest/run/run.js +33 -38
- package/dist/src/commands/playtest/run/run.js.map +1 -1
- package/dist/src/commands/process/close/close.d.ts +4 -0
- package/dist/src/commands/process/close/close.d.ts.map +1 -1
- package/dist/src/commands/process/close/close.js +54 -4
- package/dist/src/commands/process/close/close.js.map +1 -1
- package/dist/src/commands/process/close/close.test.js +36 -3
- package/dist/src/commands/process/close/close.test.js.map +1 -1
- package/dist/src/commands/process/info/info.d.ts +15 -2
- package/dist/src/commands/process/info/info.d.ts.map +1 -1
- package/dist/src/commands/process/info/info.js +44 -4
- package/dist/src/commands/process/info/info.js.map +1 -1
- package/dist/src/commands/process/info/info.test.js +48 -0
- package/dist/src/commands/process/info/info.test.js.map +1 -1
- package/dist/src/commands/process/launch/launch.d.ts.map +1 -1
- package/dist/src/commands/process/launch/launch.js +22 -3
- package/dist/src/commands/process/launch/launch.js.map +1 -1
- package/dist/src/commands/process/launch/launch.test.js +27 -5
- package/dist/src/commands/process/launch/launch.test.js.map +1 -1
- package/dist/src/commands/process/list/list.d.ts +49 -6
- package/dist/src/commands/process/list/list.d.ts.map +1 -1
- package/dist/src/commands/process/list/list.js +185 -18
- package/dist/src/commands/process/list/list.js.map +1 -1
- package/dist/src/commands/process/list/list.test.js +92 -1
- package/dist/src/commands/process/list/list.test.js.map +1 -1
- package/dist/src/commands/process/run/run.d.ts +1 -1
- package/dist/src/commands/process/run/run.d.ts.map +1 -1
- package/dist/src/commands/process/run/run.js +3 -3
- package/dist/src/commands/process/run/run.js.map +1 -1
- package/dist/src/docker/docker-delegator.js +1 -1
- package/dist/src/docker/docker-delegator.js.map +1 -1
- package/dist/src/docker/docker-delegator.test.js +1 -1
- package/dist/src/docker/docker-delegator.test.js.map +1 -1
- package/dist/src/plugin/playtest-bridge.d.ts +36 -0
- package/dist/src/plugin/playtest-bridge.d.ts.map +1 -0
- package/dist/src/plugin/playtest-bridge.js +65 -0
- package/dist/src/plugin/playtest-bridge.js.map +1 -0
- package/dist/src/plugin/playtest-bridge.test.d.ts +2 -0
- package/dist/src/plugin/playtest-bridge.test.d.ts.map +1 -0
- package/dist/src/plugin/playtest-bridge.test.js +35 -0
- package/dist/src/plugin/playtest-bridge.test.js.map +1 -0
- package/dist/src/process/studio-launch-registry.d.ts +14 -0
- package/dist/src/process/studio-launch-registry.d.ts.map +1 -0
- package/dist/src/process/studio-launch-registry.js +37 -0
- package/dist/src/process/studio-launch-registry.js.map +1 -0
- package/dist/src/process/studio-launch-registry.test.d.ts +2 -0
- package/dist/src/process/studio-launch-registry.test.d.ts.map +1 -0
- package/dist/src/process/studio-launch-registry.test.js +38 -0
- package/dist/src/process/studio-launch-registry.test.js.map +1 -0
- package/dist/src/process/studio-process-closer.d.ts +3 -1
- package/dist/src/process/studio-process-closer.d.ts.map +1 -1
- package/dist/src/process/studio-process-closer.js +29 -11
- package/dist/src/process/studio-process-closer.js.map +1 -1
- package/dist/src/process/studio-process-identity.d.ts +10 -0
- package/dist/src/process/studio-process-identity.d.ts.map +1 -0
- package/dist/src/process/studio-process-identity.js +63 -0
- package/dist/src/process/studio-process-identity.js.map +1 -0
- package/dist/src/process/studio-process-identity.test.d.ts +2 -0
- package/dist/src/process/studio-process-identity.test.d.ts.map +1 -0
- package/dist/src/process/studio-process-identity.test.js +30 -0
- package/dist/src/process/studio-process-identity.test.js.map +1 -0
- package/dist/src/roblox-mcp/index.d.ts +3 -0
- package/dist/src/roblox-mcp/index.d.ts.map +1 -0
- package/dist/src/roblox-mcp/index.js +3 -0
- package/dist/src/roblox-mcp/index.js.map +1 -0
- package/dist/src/roblox-mcp/mcp/mcp-stdio-client.d.ts +60 -0
- package/dist/src/roblox-mcp/mcp/mcp-stdio-client.d.ts.map +1 -0
- package/dist/src/roblox-mcp/mcp/mcp-stdio-client.js +171 -0
- package/dist/src/roblox-mcp/mcp/mcp-stdio-client.js.map +1 -0
- package/dist/src/roblox-mcp/mcp/mcp-stdio-client.test.d.ts +2 -0
- package/dist/src/roblox-mcp/mcp/mcp-stdio-client.test.d.ts.map +1 -0
- package/dist/src/roblox-mcp/mcp/mcp-stdio-client.test.js +104 -0
- package/dist/src/roblox-mcp/mcp/mcp-stdio-client.test.js.map +1 -0
- package/dist/src/roblox-mcp/mcp/repair-list-result.d.ts +2 -0
- package/dist/src/roblox-mcp/mcp/repair-list-result.d.ts.map +1 -0
- package/dist/src/roblox-mcp/mcp/repair-list-result.js +22 -0
- package/dist/src/roblox-mcp/mcp/repair-list-result.js.map +1 -0
- package/dist/src/roblox-mcp/mcp/repair-list-result.test.d.ts +2 -0
- package/dist/src/roblox-mcp/mcp/repair-list-result.test.d.ts.map +1 -0
- package/dist/src/roblox-mcp/mcp/repair-list-result.test.js +42 -0
- package/dist/src/roblox-mcp/mcp/repair-list-result.test.js.map +1 -0
- package/dist/src/roblox-mcp/roblox-studio-mcp.d.ts +34 -0
- package/dist/src/roblox-mcp/roblox-studio-mcp.d.ts.map +1 -0
- package/dist/src/roblox-mcp/roblox-studio-mcp.js +190 -0
- package/dist/src/roblox-mcp/roblox-studio-mcp.js.map +1 -0
- package/dist/src/roblox-mcp/roblox-studio-mcp.test.d.ts +2 -0
- package/dist/src/roblox-mcp/roblox-studio-mcp.test.d.ts.map +1 -0
- package/dist/src/roblox-mcp/roblox-studio-mcp.test.js +123 -0
- package/dist/src/roblox-mcp/roblox-studio-mcp.test.js.map +1 -0
- package/dist/src/roblox-mcp/studio/studio-session.d.ts +39 -0
- package/dist/src/roblox-mcp/studio/studio-session.d.ts.map +1 -0
- package/dist/src/roblox-mcp/studio/studio-session.js +175 -0
- package/dist/src/roblox-mcp/studio/studio-session.js.map +1 -0
- package/dist/src/roblox-mcp/studio/studio-session.test.d.ts +2 -0
- package/dist/src/roblox-mcp/studio/studio-session.test.d.ts.map +1 -0
- package/dist/src/roblox-mcp/studio/studio-session.test.js +213 -0
- package/dist/src/roblox-mcp/studio/studio-session.test.js.map +1 -0
- package/dist/src/roblox-mcp/studio-mcp-locator.d.ts +19 -0
- package/dist/src/roblox-mcp/studio-mcp-locator.d.ts.map +1 -0
- package/dist/src/roblox-mcp/studio-mcp-locator.js +121 -0
- package/dist/src/roblox-mcp/studio-mcp-locator.js.map +1 -0
- package/dist/src/roblox-mcp/studio-mcp-locator.test.d.ts +2 -0
- package/dist/src/roblox-mcp/studio-mcp-locator.test.d.ts.map +1 -0
- package/dist/src/roblox-mcp/studio-mcp-locator.test.js +107 -0
- package/dist/src/roblox-mcp/studio-mcp-locator.test.js.map +1 -0
- package/dist/src/roblox-mcp/studio-mcp-snapshot.d.ts +23 -0
- package/dist/src/roblox-mcp/studio-mcp-snapshot.d.ts.map +1 -0
- package/dist/src/roblox-mcp/studio-mcp-snapshot.js +65 -0
- package/dist/src/roblox-mcp/studio-mcp-snapshot.js.map +1 -0
- package/dist/src/roblox-mcp/studio-mcp-snapshot.test.d.ts +2 -0
- package/dist/src/roblox-mcp/studio-mcp-snapshot.test.d.ts.map +1 -0
- package/dist/src/roblox-mcp/studio-mcp-snapshot.test.js +81 -0
- package/dist/src/roblox-mcp/studio-mcp-snapshot.test.js.map +1 -0
- package/dist/src/roblox-mcp/test/fake-mcp-server.d.ts +27 -0
- package/dist/src/roblox-mcp/test/fake-mcp-server.d.ts.map +1 -0
- package/dist/src/roblox-mcp/test/fake-mcp-server.js +55 -0
- package/dist/src/roblox-mcp/test/fake-mcp-server.js.map +1 -0
- package/dist/src/server/web-socket-protocol.d.ts +50 -15
- package/dist/src/server/web-socket-protocol.d.ts.map +1 -1
- package/dist/src/server/web-socket-protocol.js +63 -13
- package/dist/src/server/web-socket-protocol.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/playtest-bridge.md +21 -0
- package/package.json +2 -2
- package/src/bridge/bridge-connection.ts +1 -0
- package/src/bridge/bridge-session.test.ts +51 -0
- package/src/bridge/bridge-session.ts +66 -47
- package/src/bridge/internal/bridge-host.ts +3 -0
- package/src/bridge/internal/host-protocol.ts +22 -9
- package/src/bridge/types.ts +5 -0
- package/src/commands/console/exec/exec.test.ts +94 -0
- package/src/commands/console/exec/exec.ts +130 -16
- package/src/commands/console/exec/execute.lua +147 -5
- package/src/commands/console/exec/execute.spec.lua +22 -2
- package/src/commands/framework/action-loader.test.ts +1 -1
- package/src/commands/playtest/player/playtest-players.lua +127 -0
- package/src/commands/playtest/player/playtest-players.spec.lua +48 -0
- package/src/commands/playtest/player/playtest-players.test.ts +40 -21
- package/src/commands/playtest/player/playtest-players.ts +30 -110
- package/src/commands/playtest/playtest-sessions.test.ts +116 -14
- package/src/commands/playtest/playtest-sessions.ts +77 -88
- package/src/commands/playtest/run/run.ts +44 -58
- package/src/commands/playtest/start/start-playtest.lua +105 -6
- package/src/commands/process/close/close.test.ts +52 -3
- package/src/commands/process/close/close.ts +78 -4
- package/src/commands/process/info/info.test.ts +76 -0
- package/src/commands/process/info/info.ts +74 -6
- package/src/commands/process/launch/launch.test.ts +33 -5
- package/src/commands/process/launch/launch.ts +41 -3
- package/src/commands/process/list/list.test.ts +130 -1
- package/src/commands/process/list/list.ts +290 -22
- package/src/commands/process/run/run.ts +4 -4
- package/src/docker/docker-delegator.test.ts +1 -1
- package/src/docker/docker-delegator.ts +1 -1
- package/src/plugin/playtest-bridge.test.ts +53 -0
- package/src/plugin/playtest-bridge.ts +98 -0
- package/src/process/studio-launch-registry.test.ts +56 -0
- package/src/process/studio-launch-registry.ts +63 -0
- package/src/process/studio-process-closer.ts +36 -11
- package/src/process/studio-process-identity.test.ts +45 -0
- package/src/process/studio-process-identity.ts +90 -0
- package/src/roblox-mcp/index.ts +17 -0
- package/src/roblox-mcp/mcp/mcp-stdio-client.test.ts +148 -0
- package/src/roblox-mcp/mcp/mcp-stdio-client.ts +270 -0
- package/src/roblox-mcp/mcp/repair-list-result.test.ts +52 -0
- package/src/roblox-mcp/mcp/repair-list-result.ts +23 -0
- package/src/roblox-mcp/roblox-studio-mcp.test.ts +168 -0
- package/src/roblox-mcp/roblox-studio-mcp.ts +330 -0
- package/src/roblox-mcp/studio/studio-session.test.ts +284 -0
- package/src/roblox-mcp/studio/studio-session.ts +279 -0
- package/src/roblox-mcp/studio-mcp-locator.test.ts +186 -0
- package/src/roblox-mcp/studio-mcp-locator.ts +180 -0
- package/src/roblox-mcp/studio-mcp-snapshot.test.ts +113 -0
- package/src/roblox-mcp/studio-mcp-snapshot.ts +104 -0
- package/src/roblox-mcp/test/fake-mcp-server.ts +74 -0
- package/src/server/web-socket-protocol.ts +119 -29
- package/templates/studio-bridge-plugin/playtest/StudioBridgePlaytest.client.lua +32 -0
- package/templates/studio-bridge-plugin/playtest/StudioBridgePlaytest.server.lua +40 -0
- package/templates/studio-bridge-plugin/src/Shared/ActionRouter.lua +25 -3
- package/templates/studio-bridge-plugin/src/Shared/PrecompiledSources.lua +47 -0
- package/templates/studio-bridge-plugin/src/Shared/PrecompiledSources.spec.lua +57 -0
- package/templates/studio-bridge-plugin/src/Shared/StudioBridgeClient.lua +357 -0
- package/templates/studio-bridge-plugin/src/Shared/StudioBridgeSessionUtils.lua +29 -3
- package/templates/studio-bridge-plugin/src/Shared/StudioBridgeSessionUtils.spec.lua +35 -2
- package/templates/studio-bridge-plugin/src/StudioBridgePlugin.server.lua +16 -292
- package/src/commands/playtest/run/playtest-runner.luau +0 -264
- package/src/commands/playtest/run/playtest-runner.spec.lua +0 -71
- package/src/commands/playtest/run/run-playtest-script.lua +0 -139
- package/src/commands/playtest/run/run-playtest-script.spec.lua +0 -43
|
@@ -5,12 +5,19 @@
|
|
|
5
5
|
* each connects to the bridge as its own session. Those sessions can't be
|
|
6
6
|
* matched to the Studio that started them by instance id, since unpublished
|
|
7
7
|
* places give every DataModel its own. Instead, `startPlaytestAsync` passes a
|
|
8
|
-
* playtest id as the StudioTestService test args, and each
|
|
9
|
-
*
|
|
8
|
+
* playtest id as the StudioTestService test args, and each session registers
|
|
9
|
+
* with it.
|
|
10
|
+
*
|
|
11
|
+
* The playtest's server session is the plugin when Studio loads user plugins
|
|
12
|
+
* into playtests. Otherwise the edit session plants the same client into the
|
|
13
|
+
* playtest as an ordinary Script (see plugin/playtest-bridge.ts). That one can
|
|
14
|
+
* only run code compiled when the playtest started: the actions, and the
|
|
15
|
+
* scripts `startPlaytestAsync` is given.
|
|
10
16
|
*/
|
|
11
17
|
import { randomUUID } from 'crypto';
|
|
12
18
|
import { ContextNotFoundError } from '../../bridge/index.js';
|
|
13
19
|
import { getPluginBuildVersionAsync } from '../../plugin/plugin-build-version.js';
|
|
20
|
+
import { buildPlaytestBridgeAsync } from '../../plugin/playtest-bridge.js';
|
|
14
21
|
import { tryReadLoadUserPluginsOnPlaytestAsync } from '../../process/studio-settings.js';
|
|
15
22
|
/** How long a started playtest may run before its pending start request is dropped. */
|
|
16
23
|
const PLAYTEST_MAX_DURATION_MS = 24 * 60 * 60 * 1000;
|
|
@@ -18,14 +25,7 @@ const SESSION_WAIT_TIMEOUT_MS = 30_000;
|
|
|
18
25
|
/** Each player of a multiplayer test boots its own Studio process. */
|
|
19
26
|
const MULTIPLAYER_SESSION_WAIT_TIMEOUT_MS = 90_000;
|
|
20
27
|
const SESSION_CLOSE_TIMEOUT_MS = 10_000;
|
|
21
|
-
const
|
|
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');
|
|
28
|
+
const PLAYTEST_PLUGINS_OFF_MESSAGE = `Studio's "Load user plugins on playtest" setting is off, so the studio-bridge plugin doesn't load into a playtest's client. A playtest started with 'studio-bridge playtest start' gets a planted client session instead, which runs only code compiled when it started; turn the setting on to run any code.`;
|
|
29
29
|
/** The sessions a playtest opens, by mode. Run mode has no player, so no client. */
|
|
30
30
|
export function getPlaytestContexts(mode) {
|
|
31
31
|
return mode === 'play' ? ['server', 'client'] : ['server'];
|
|
@@ -36,25 +36,37 @@ export function getPlaytestContexts(mode) {
|
|
|
36
36
|
* player. Rejects if Studio refuses to start it, e.g. because a playtest is
|
|
37
37
|
* already running.
|
|
38
38
|
*/
|
|
39
|
-
export async function startPlaytestAsync(connection, editSession, mode, players) {
|
|
39
|
+
export async function startPlaytestAsync(connection, editSession, mode, players, options = {}) {
|
|
40
40
|
if (editSession.context !== 'edit') {
|
|
41
41
|
throw new Error(`Playtests start from an edit session, but '${editSession.info.sessionId}' is a ${editSession.context} session`);
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
throw new Error(PLAYTEST_PLUGINS_OFF_MESSAGE);
|
|
45
|
-
}
|
|
43
|
+
const pluginsOnPlaytest = await tryReadPlaytestPluginsAsync(connection);
|
|
46
44
|
if (players !== undefined) {
|
|
47
|
-
|
|
45
|
+
assertValidMultiplayer(mode, players);
|
|
48
46
|
}
|
|
47
|
+
// Plugin sessions in the playtest register with its id, which older plugins leave out
|
|
48
|
+
if (pluginsOnPlaytest !== false) {
|
|
49
|
+
await assertCurrentPluginAsync(editSession);
|
|
50
|
+
}
|
|
51
|
+
// A server plugin, when Studio does load one, stands down for a planted bridge
|
|
52
|
+
const bridge = pluginsOnPlaytest === true
|
|
53
|
+
? undefined
|
|
54
|
+
: await buildPlaytestBridgeAsync(options.scripts, {
|
|
55
|
+
withClient: pluginsOnPlaytest === false &&
|
|
56
|
+
mode === 'play' &&
|
|
57
|
+
!options.serverOnly,
|
|
58
|
+
});
|
|
49
59
|
const playtestId = randomUUID();
|
|
50
60
|
const ended = editSession
|
|
51
|
-
.runPlaytestAsync(mode, playtestId, connection.port, PLAYTEST_MAX_DURATION_MS, players)
|
|
61
|
+
.runPlaytestAsync(mode, playtestId, connection.port, PLAYTEST_MAX_DURATION_MS, players, bridge)
|
|
52
62
|
.catch((err) => ({
|
|
53
63
|
playtestId,
|
|
54
64
|
success: false,
|
|
55
65
|
error: err instanceof Error ? err.message : String(err),
|
|
56
66
|
}));
|
|
57
|
-
const clientCount =
|
|
67
|
+
const clientCount = options.serverOnly
|
|
68
|
+
? 0
|
|
69
|
+
: players ?? (mode === 'play' ? 1 : 0);
|
|
58
70
|
const waitTimeoutMs = players !== undefined
|
|
59
71
|
? MULTIPLAYER_SESSION_WAIT_TIMEOUT_MS
|
|
60
72
|
: SESSION_WAIT_TIMEOUT_MS;
|
|
@@ -94,22 +106,23 @@ export async function startPlaytestAsync(connection, editSession, mode, players)
|
|
|
94
106
|
const waited = `its ${missing.join(' and ')} session${missing.length > 1 || clientCount - clients.length > 1 ? 's' : ''} did not connect within ${waitTimeoutMs / 1000}s`;
|
|
95
107
|
// Without its server session the playtest can't be ended from here
|
|
96
108
|
if (!server?.isConnected) {
|
|
97
|
-
throw new Error(`Playtest started, but ${waited}, so stop it in Studio
|
|
109
|
+
throw new Error(`Playtest started, but ${waited}, so stop it in Studio.`);
|
|
98
110
|
}
|
|
99
111
|
await endPlaytestAsync(connection, server);
|
|
100
112
|
throw new Error(`Playtest started, but ${waited}, so it was stopped.`);
|
|
101
113
|
}
|
|
102
|
-
|
|
114
|
+
function assertValidMultiplayer(mode, players) {
|
|
103
115
|
if (!Number.isInteger(players) || players < 1) {
|
|
104
116
|
throw new Error(`--players must be a whole number of at least 1, not ${players}`);
|
|
105
117
|
}
|
|
106
118
|
if (mode !== 'play') {
|
|
107
119
|
throw new Error('A multiplayer test runs in play mode');
|
|
108
120
|
}
|
|
109
|
-
|
|
121
|
+
}
|
|
122
|
+
async function assertCurrentPluginAsync(editSession) {
|
|
110
123
|
const expected = await getPluginBuildVersionAsync();
|
|
111
124
|
if (editSession.info.pluginVersion !== expected) {
|
|
112
|
-
throw new Error(`
|
|
125
|
+
throw new Error(`Playtests with plugin sessions need the current studio-bridge plugin, but '${editSession.info.placeName}' has an older one. Run 'studio-bridge plugin install' first.`);
|
|
113
126
|
}
|
|
114
127
|
}
|
|
115
128
|
/**
|
|
@@ -163,16 +176,18 @@ export async function explainMissingPlaytestContextAsync(connection, err) {
|
|
|
163
176
|
return new Error(await explainNoPlaytestAsync(connection, studio, err.context));
|
|
164
177
|
}
|
|
165
178
|
/**
|
|
166
|
-
* Whether this machine's Studio has "Load user plugins on playtest"
|
|
167
|
-
* remote Studio's settings aren't on this machine, so they
|
|
179
|
+
* Whether this machine's Studio has "Load user plugins on playtest" on. A
|
|
180
|
+
* remote Studio's settings aren't on this machine, so they are unknown.
|
|
168
181
|
*/
|
|
169
|
-
async function
|
|
170
|
-
return
|
|
171
|
-
|
|
182
|
+
async function tryReadPlaytestPluginsAsync(connection) {
|
|
183
|
+
return connection.isRemote
|
|
184
|
+
? undefined
|
|
185
|
+
: await tryReadLoadUserPluginsOnPlaytestAsync();
|
|
172
186
|
}
|
|
173
187
|
async function explainNoPlaytestAsync(connection, studio, context) {
|
|
174
188
|
const of = studio ? ` of ${studio}` : '';
|
|
175
|
-
if (
|
|
189
|
+
if (context === 'client' &&
|
|
190
|
+
(await tryReadPlaytestPluginsAsync(connection)) === false) {
|
|
176
191
|
return `No playtest${of} is connected. ${PLAYTEST_PLUGINS_OFF_MESSAGE}`;
|
|
177
192
|
}
|
|
178
193
|
const missing = context ? `, so there is no ${context} session` : '';
|
|
@@ -190,37 +205,26 @@ export async function endPlaytestAsync(connection, serverSession) {
|
|
|
190
205
|
async function waitForPlaytestSessionsAsync(connection, playtestId, clientCount, timeoutMs, signal) {
|
|
191
206
|
return new Promise((resolve) => {
|
|
192
207
|
const found = { clients: [] };
|
|
193
|
-
const checked = new Set();
|
|
194
208
|
const cleanup = () => {
|
|
195
209
|
clearTimeout(timer);
|
|
196
210
|
connection.off('session-connected', onSession);
|
|
197
211
|
signal.removeEventListener('abort', cleanup);
|
|
198
212
|
};
|
|
199
213
|
const onSession = (session) => {
|
|
200
|
-
|
|
201
|
-
if (session.context === 'edit' || checked.has(sessionId)) {
|
|
214
|
+
if (session.info.playtestId !== playtestId) {
|
|
202
215
|
return;
|
|
203
216
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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
|
-
});
|
|
217
|
+
if (session.context === 'server') {
|
|
218
|
+
found.server = session;
|
|
219
|
+
}
|
|
220
|
+
else if (session.context === 'client' &&
|
|
221
|
+
!found.clients.some((c) => c.info.sessionId === session.info.sessionId)) {
|
|
222
|
+
found.clients.push(session);
|
|
223
|
+
}
|
|
224
|
+
if (found.server && found.clients.length >= clientCount) {
|
|
225
|
+
cleanup();
|
|
226
|
+
resolve(found);
|
|
227
|
+
}
|
|
224
228
|
};
|
|
225
229
|
// Resolves with whichever sessions connected; the caller reports the rest
|
|
226
230
|
const timer = setTimeout(() => {
|
|
@@ -236,30 +240,6 @@ async function waitForPlaytestSessionsAsync(connection, playtestId, clientCount,
|
|
|
236
240
|
}
|
|
237
241
|
});
|
|
238
242
|
}
|
|
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
243
|
async function waitForSessionCloseAsync(connection, sessionId) {
|
|
264
244
|
return new Promise((resolve, reject) => {
|
|
265
245
|
if (!connection.getSession(sessionId)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playtest-sessions.js","sourceRoot":"","sources":["../../../../src/commands/playtest/playtest-sessions.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"playtest-sessions.js","sourceRoot":"","sources":["../../../../src/commands/playtest/playtest-sessions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;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,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,qCAAqC,EAAE,MAAM,kCAAkC,CAAC;AAEzF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|
vi.mock('../../process/studio-settings.js', () => ({
|
|
9
9
|
tryReadLoadUserPluginsOnPlaytestAsync: async () => settings.loadUserPluginsOnPlaytest,
|
|
10
10
|
}));
|
|
11
|
+
vi.mock('../../plugin/playtest-bridge.js', () => ({
|
|
12
|
+
buildPlaytestBridgeAsync: async (scripts, options) => ({
|
|
13
|
+
entrySource: 'entry',
|
|
14
|
+
...(options?.withClient ? { clientEntrySource: 'client entry' } : {}),
|
|
15
|
+
modules: {},
|
|
16
|
+
precompiled: scripts ?? [],
|
|
17
|
+
}),
|
|
18
|
+
}));
|
|
11
19
|
import { ContextNotFoundError } from '../../bridge/index.js';
|
|
12
20
|
import { explainMissingPlaytestContextAsync, resolvePlaytestServerSessionAsync, startPlaytestAsync, } from './playtest-sessions.js';
|
|
13
21
|
beforeEach(() => {
|
|
@@ -42,16 +50,10 @@ describe('startPlaytestAsync multiplayer checks', () => {
|
|
|
42
50
|
});
|
|
43
51
|
});
|
|
44
52
|
describe('with "Load user plugins on playtest" off', () => {
|
|
45
|
-
it('
|
|
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 () => {
|
|
53
|
+
it('does not blame the setting for a missing server session, which is planted', async () => {
|
|
52
54
|
settings.loadUserPluginsOnPlaytest = false;
|
|
53
55
|
const connection = { listSessions: () => [] };
|
|
54
|
-
await expect(resolvePlaytestServerSessionAsync(connection)).rejects.toThrow(
|
|
56
|
+
await expect(resolvePlaytestServerSessionAsync(connection)).rejects.toThrow("No playtest is running. Start one with 'studio-bridge playtest start'.");
|
|
55
57
|
});
|
|
56
58
|
it("ignores this machine's setting when Studio is remote", async () => {
|
|
57
59
|
settings.loadUserPluginsOnPlaytest = false;
|
|
@@ -84,4 +86,68 @@ describe('explainMissingPlaytestContextAsync', () => {
|
|
|
84
86
|
expect(await explainMissingPlaytestContextAsync(connection, original)).toBe(original);
|
|
85
87
|
});
|
|
86
88
|
});
|
|
89
|
+
describe('planting the server session', () => {
|
|
90
|
+
function createConnection() {
|
|
91
|
+
return {
|
|
92
|
+
port: 38741,
|
|
93
|
+
isRemote: false,
|
|
94
|
+
listSessions: () => [],
|
|
95
|
+
getSession: () => undefined,
|
|
96
|
+
on: vi.fn(),
|
|
97
|
+
off: vi.fn(),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
// The start fails at once, so the test sees what it was asked to start
|
|
101
|
+
function createFailingEditSession(pluginVersion) {
|
|
102
|
+
const editSession = createEditSession(pluginVersion);
|
|
103
|
+
editSession.runPlaytestAsync.mockResolvedValue({
|
|
104
|
+
playtestId: 'p',
|
|
105
|
+
success: false,
|
|
106
|
+
error: 'refused',
|
|
107
|
+
});
|
|
108
|
+
return editSession;
|
|
109
|
+
}
|
|
110
|
+
it('plants a bridge with the scripts to run when the setting is off', async () => {
|
|
111
|
+
settings.loadUserPluginsOnPlaytest = false;
|
|
112
|
+
const editSession = createFailingEditSession('old');
|
|
113
|
+
await expect(startPlaytestAsync(createConnection(), editSession, 'run', undefined, {
|
|
114
|
+
scripts: ['return 1'],
|
|
115
|
+
})).rejects.toThrow('Playtest failed to start: refused');
|
|
116
|
+
const bridge = editSession.runPlaytestAsync.mock.calls[0][5];
|
|
117
|
+
expect(bridge.precompiled).toEqual(['return 1']);
|
|
118
|
+
});
|
|
119
|
+
it('plants a client bridge too for a play mode playtest when the setting is off', async () => {
|
|
120
|
+
settings.loadUserPluginsOnPlaytest = false;
|
|
121
|
+
const editSession = createFailingEditSession('old');
|
|
122
|
+
await expect(startPlaytestAsync(createConnection(), editSession, 'play')).rejects.toThrow('Playtest failed to start: refused');
|
|
123
|
+
expect(editSession.runPlaytestAsync.mock.calls[0][5].clientEntrySource).toContain('client entry');
|
|
124
|
+
});
|
|
125
|
+
it('plants no client bridge in run mode, or when the setting is unknown', async () => {
|
|
126
|
+
settings.loadUserPluginsOnPlaytest = false;
|
|
127
|
+
const runMode = createFailingEditSession('old');
|
|
128
|
+
await expect(startPlaytestAsync(createConnection(), runMode, 'run')).rejects.toThrow('refused');
|
|
129
|
+
expect(runMode.runPlaytestAsync.mock.calls[0][5].clientEntrySource).toBeUndefined();
|
|
130
|
+
settings.loadUserPluginsOnPlaytest = undefined;
|
|
131
|
+
const unknown = createFailingEditSession('current');
|
|
132
|
+
await expect(startPlaytestAsync(createConnection(), unknown, 'play')).rejects.toThrow('refused');
|
|
133
|
+
expect(unknown.runPlaytestAsync.mock.calls[0][5].clientEntrySource).toBeUndefined();
|
|
134
|
+
});
|
|
135
|
+
it('plants a bridge when the setting is unknown', async () => {
|
|
136
|
+
const editSession = createFailingEditSession('current');
|
|
137
|
+
await expect(startPlaytestAsync(createConnection(), editSession, 'run')).rejects.toThrow('refused');
|
|
138
|
+
expect(editSession.runPlaytestAsync.mock.calls[0][5]).toBeDefined();
|
|
139
|
+
});
|
|
140
|
+
it('leaves the server to the plugin when the setting is on', async () => {
|
|
141
|
+
settings.loadUserPluginsOnPlaytest = true;
|
|
142
|
+
const editSession = createFailingEditSession('current');
|
|
143
|
+
await expect(startPlaytestAsync(createConnection(), editSession, 'run')).rejects.toThrow('refused');
|
|
144
|
+
expect(editSession.runPlaytestAsync.mock.calls[0][5]).toBeUndefined();
|
|
145
|
+
});
|
|
146
|
+
it('needs the current plugin when plugin sessions will connect', async () => {
|
|
147
|
+
settings.loadUserPluginsOnPlaytest = true;
|
|
148
|
+
const editSession = createFailingEditSession('old');
|
|
149
|
+
await expect(startPlaytestAsync(createConnection(), editSession, 'run')).rejects.toThrow("Run 'studio-bridge plugin install' first");
|
|
150
|
+
expect(editSession.runPlaytestAsync).not.toHaveBeenCalled();
|
|
151
|
+
});
|
|
152
|
+
});
|
|
87
153
|
//# sourceMappingURL=playtest-sessions.test.js.map
|
|
@@ -1 +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,UAAU,CAAC,GAAG,EAAE;IACd,QAAQ,CAAC,yBAAyB,GAAG,SAAS,CAAC;AACjD,CAAC,CAAC,CAAC;AAEH,SAAS,iBAAiB,CAAC,aAAqB;IAC9C,OAAO;QACL,OAAO,EAAE,MAAM;QACf,IAAI,EAAE;YACJ,SAAS,EAAE,iBAAiB;YAC5B,SAAS,EAAE,YAAY;YACvB,aAAa;SACd;QACD,gBAAgB,EAAE,EAAE,CAAC,EAAE,EAAE;KACnB,CAAC;AACX,CAAC;AAED,QAAQ,CAAC,uCAAuC,EAAE,GAAG,EAAE;IACrD,EAAE,CAAC,iEAAiE,EAAE,KAAK,IAAI,EAAE;QAC/E,KAAK,MAAM,OAAO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,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE,KAAK,IAAI,EAAE;QACtE,QAAQ,CAAC,yBAAyB,GAAG,IAAI,CAAC;QAC1C,MAAM,WAAW,GAAG,wBAAwB,CAAC,SAAS,CAAC,CAAC;QAExD,MAAM,MAAM,CACV,kBAAkB,CAAC,gBAAgB,EAAE,EAAE,WAAW,EAAE,KAAK,CAAC,CAC3D,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAE7B,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE,KAAK,IAAI,EAAE;QAC1E,QAAQ,CAAC,yBAAyB,GAAG,IAAI,CAAC;QAC1C,MAAM,WAAW,GAAG,wBAAwB,CAAC,KAAK,CAAC,CAAC;QAEpD,MAAM,MAAM,CACV,kBAAkB,CAAC,gBAAgB,EAAE,EAAE,WAAW,EAAE,KAAK,CAAC,CAC3D,CAAC,OAAO,CAAC,OAAO,CAAC,0CAA0C,CAAC,CAAC;QAC9D,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* `--context client`. Its output and return values come back the same way as
|
|
6
6
|
* `console exec`.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* playtest
|
|
8
|
+
* Both run through the playtest's sessions. The server session works even
|
|
9
|
+
* when Studio does not load user plugins into playtests, since the edit
|
|
10
|
+
* session then plants it, with this code compiled ahead of time (see
|
|
11
|
+
* playtest-sessions.ts). The client session needs that Studio setting on.
|
|
12
12
|
*/
|
|
13
13
|
import type { BridgeConnection, PlaytestMode, SessionContext } from '../../../bridge/index.js';
|
|
14
14
|
import type { SerializedReturnValue } from '../../../server/web-socket-protocol.js';
|
|
@@ -22,11 +22,12 @@ export interface PlaytestRunOptions {
|
|
|
22
22
|
timeout?: number;
|
|
23
23
|
/** Passed to the script as `...`. */
|
|
24
24
|
args?: string[];
|
|
25
|
+
/** Passed to the script as buffers in `...`, before `args`. */
|
|
26
|
+
inputs?: Buffer[];
|
|
25
27
|
}
|
|
26
28
|
export interface PlaytestRunResult {
|
|
27
29
|
success: boolean;
|
|
28
|
-
|
|
29
|
-
playtestId?: string;
|
|
30
|
+
playtestId: string;
|
|
30
31
|
output: string[];
|
|
31
32
|
error?: string;
|
|
32
33
|
returnValues?: SerializedReturnValue[];
|
|
@@ -38,8 +39,9 @@ interface PlaytestRunArgs {
|
|
|
38
39
|
code?: string;
|
|
39
40
|
file?: string;
|
|
40
41
|
mode?: PlaytestMode;
|
|
41
|
-
|
|
42
|
+
scriptTimeout?: number;
|
|
42
43
|
scriptArgs?: string[];
|
|
44
|
+
input?: string[];
|
|
43
45
|
}
|
|
44
46
|
export declare function playtestRunHandlerAsync(connection: BridgeConnection, options: PlaytestRunOptions): Promise<PlaytestRunResult>;
|
|
45
47
|
export declare const playtestRunCommand: import("../../framework/define-command.js").CommandDefinition<PlaytestRunArgs, PlaytestRunResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../../../src/commands/playtest/run/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../../../src/commands/playtest/run/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAWH,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back the same way as
|
|
6
6
|
* `console exec`.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* playtest
|
|
8
|
+
* Both run through the playtest's sessions. The server session works even
|
|
9
|
+
* when Studio does not load user plugins into playtests, since the edit
|
|
10
|
+
* session then plants it, with this code compiled ahead of time (see
|
|
11
|
+
* playtest-sessions.ts). The client session needs that Studio setting on.
|
|
12
12
|
*/
|
|
13
|
-
import * as fs from 'fs/promises';
|
|
14
|
-
import { resolvePackagePath } from '@quenty/nevermore-template-helpers';
|
|
15
13
|
import { defineCommand } from '../../framework/define-command.js';
|
|
16
14
|
import { arg } from '../../framework/arg-builder.js';
|
|
17
15
|
import { resolveScriptContentAsync } from '../../../cli/resolve-script-content.js';
|
|
18
|
-
import { execHandlerAsync, formatExecText, } from '../../console/exec/exec.js';
|
|
16
|
+
import { execHandlerAsync, formatExecText, INPUT_ARG_DESCRIPTION, readInputFilesAsync, } from '../../console/exec/exec.js';
|
|
19
17
|
import { endPlaytestAsync, getPlaytestContexts, startPlaytestAsync, } from '../playtest-sessions.js';
|
|
20
|
-
|
|
21
|
-
const DEFAULT_TIMEOUT_MS = 120_000;
|
|
18
|
+
const PLAYER_JOIN_TIMEOUT_MS = 30_000;
|
|
22
19
|
export async function playtestRunHandlerAsync(connection, options) {
|
|
23
20
|
if (!getPlaytestContexts(options.mode).includes(options.context)) {
|
|
24
21
|
throw new Error(`A ${options.mode} mode playtest has no ${options.context} session to run code in`);
|
|
25
22
|
}
|
|
26
23
|
const editSession = await connection.resolveSessionAsync(options.target, 'edit');
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
const playtest = await startPlaytestAsync(connection, editSession, options.mode, undefined, {
|
|
25
|
+
scripts: [options.scriptContent],
|
|
26
|
+
serverOnly: options.context === 'server',
|
|
27
|
+
});
|
|
31
28
|
let result;
|
|
32
29
|
try {
|
|
33
30
|
const session = playtest.sessions[options.context];
|
|
34
31
|
if (!session) {
|
|
35
32
|
throw new Error(`Playtest has no ${options.context} session`);
|
|
36
33
|
}
|
|
34
|
+
// In play mode the server's code expects the player, who joins a moment later
|
|
35
|
+
if (options.mode === 'play' && options.context === 'server') {
|
|
36
|
+
await waitForPlayerAsync(session);
|
|
37
|
+
}
|
|
37
38
|
result = {
|
|
38
39
|
...(await execHandlerAsync(session, {
|
|
39
40
|
scriptContent: options.scriptContent,
|
|
40
41
|
timeout: options.timeout,
|
|
41
42
|
args: options.args,
|
|
43
|
+
inputs: options.inputs,
|
|
42
44
|
})),
|
|
43
45
|
playtestId: playtest.playtestId,
|
|
44
46
|
};
|
|
@@ -51,28 +53,15 @@ export async function playtestRunHandlerAsync(connection, options) {
|
|
|
51
53
|
const stopError = await tryEndPlaytestAsync(connection, playtest.sessions.server);
|
|
52
54
|
return stopError ? { ...result, stopError } : result;
|
|
53
55
|
}
|
|
54
|
-
async function
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
});
|
|
63
|
-
return toCommandResult(result);
|
|
64
|
-
}
|
|
65
|
-
/** Shapes a bridge ExecResult the way `console exec` reports it. */
|
|
66
|
-
function toCommandResult(result) {
|
|
67
|
-
return {
|
|
68
|
-
success: result.success,
|
|
69
|
-
output: result.output.map((entry) => entry.body),
|
|
70
|
-
error: result.error,
|
|
71
|
-
returnValues: result.returnValues,
|
|
72
|
-
summary: result.success
|
|
73
|
-
? 'Script executed successfully'
|
|
74
|
-
: `Script failed: ${result.error}`,
|
|
75
|
-
};
|
|
56
|
+
async function waitForPlayerAsync(serverSession) {
|
|
57
|
+
const deadline = Date.now() + PLAYER_JOIN_TIMEOUT_MS;
|
|
58
|
+
while (Date.now() < deadline) {
|
|
59
|
+
const { players } = await serverSession.playtestPlayersAsync({ op: 'list' }, PLAYER_JOIN_TIMEOUT_MS);
|
|
60
|
+
if (players.length > 0)
|
|
61
|
+
return;
|
|
62
|
+
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
63
|
+
}
|
|
64
|
+
throw new Error(`No player joined the playtest within ${PLAYER_JOIN_TIMEOUT_MS / 1000}s`);
|
|
76
65
|
}
|
|
77
66
|
/** Ends the playtest, returning why it could not instead of throwing. */
|
|
78
67
|
async function tryEndPlaytestAsync(connection, serverSession) {
|
|
@@ -109,10 +98,14 @@ export const playtestRunCommand = defineCommand({
|
|
|
109
98
|
choices: ['play', 'run'],
|
|
110
99
|
default: 'play',
|
|
111
100
|
}),
|
|
112
|
-
|
|
113
|
-
description: '
|
|
101
|
+
scriptTimeout: arg.option({
|
|
102
|
+
description: 'Cancel the script after this many milliseconds',
|
|
114
103
|
type: 'number',
|
|
115
104
|
}),
|
|
105
|
+
input: arg.option({
|
|
106
|
+
description: INPUT_ARG_DESCRIPTION,
|
|
107
|
+
array: true,
|
|
108
|
+
}),
|
|
116
109
|
scriptArgs: arg.passthrough({
|
|
117
110
|
description: 'Arguments after --, passed to the script as ... (all strings)',
|
|
118
111
|
}),
|
|
@@ -124,13 +117,15 @@ export const playtestRunCommand = defineCommand({
|
|
|
124
117
|
},
|
|
125
118
|
handler: async (connection, args, targeting) => {
|
|
126
119
|
const { scriptContent } = await resolveScriptContentAsync(args);
|
|
120
|
+
const inputs = await readInputFilesAsync(args.input);
|
|
127
121
|
return playtestRunHandlerAsync(connection, {
|
|
128
122
|
scriptContent,
|
|
129
123
|
mode: args.mode ?? 'play',
|
|
130
124
|
context: targeting.context ?? 'server',
|
|
131
125
|
target: targeting.target,
|
|
132
|
-
timeout: args.
|
|
126
|
+
timeout: args.scriptTimeout,
|
|
133
127
|
args: args.scriptArgs,
|
|
128
|
+
inputs,
|
|
134
129
|
});
|
|
135
130
|
},
|
|
136
131
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../../../src/commands/playtest/run/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA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AAK,CAAC;YACxB,OAAO,EAAE,MAAM;SAChB,CAAC;QACF,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC;YACxB,WAAW,EAAE,gDAAgD;YAC7D,IAAI,EAAE,QAAQ;SACf,CAAC;QACF,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC;YAChB,WAAW,EAAE,qBAAqB;YAClC,KAAK,EAAE,IAAI;SACZ,CAAC;QACF,UAAU,EAAE,GAAG,CAAC,WAAW,CAAC;YAC1B,WAAW,EACT,+DAA+D;SAClE,CAAC;KACH;IACD,GAAG,EAAE;QACH,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CACjB,MAAM,CAAC,SAAS;YACd,CAAC,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,gCACvB,MAAM,CAAC,SACT,EAAE;YACJ,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC;KAC7B;IACD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;QAC7C,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,yBAAyB,CAAC,IAAI,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAErD,OAAO,uBAAuB,CAAC,UAAU,EAAE;YACzC,aAAa;YACb,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,MAAM;YACzB,OAAO,EAAE,SAAS,CAAC,OAAO,IAAI,QAAQ;YACtC,MAAM,EAAE,SAAS,CAAC,MAAM;YACxB,OAAO,EAAE,IAAI,CAAC,aAAa;YAC3B,IAAI,EAAE,IAAI,CAAC,UAAU;YACrB,MAAM;SACP,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -9,6 +9,7 @@ export interface ProcessCloseResult {
|
|
|
9
9
|
/** The `deploy.nevermore.json` target whose Studio was closed, if one was named. */
|
|
10
10
|
deployTarget?: string;
|
|
11
11
|
pid?: number;
|
|
12
|
+
pids?: number[];
|
|
12
13
|
summary: string;
|
|
13
14
|
}
|
|
14
15
|
export interface ProcessCloseOptions {
|
|
@@ -17,6 +18,8 @@ export interface ProcessCloseOptions {
|
|
|
17
18
|
}
|
|
18
19
|
interface ProcessCloseArgs {
|
|
19
20
|
deployTarget?: string;
|
|
21
|
+
all?: boolean;
|
|
22
|
+
askToSave?: boolean;
|
|
20
23
|
force?: boolean;
|
|
21
24
|
pid?: number;
|
|
22
25
|
}
|
|
@@ -26,6 +29,7 @@ export declare function processCloseHandlerAsync(session: BridgeSession, options
|
|
|
26
29
|
* `deploy.nevermore.json`: a connected one, or else one launched with it.
|
|
27
30
|
*/
|
|
28
31
|
export declare function closeDeployTargetAsync(connection: BridgeConnection, deployTarget: string, options?: ProcessCloseOptions, cwd?: string): Promise<ProcessCloseResult>;
|
|
32
|
+
export declare function closeAllStudiosAsync(options?: Pick<ProcessCloseOptions, 'force'>): Promise<ProcessCloseResult>;
|
|
29
33
|
export declare const processCloseCommand: import("../../framework/define-command.js").CommandDefinition<ProcessCloseArgs, ProcessCloseResult>;
|
|
30
34
|
export {};
|
|
31
35
|
//# sourceMappingURL=close.d.ts.map
|