@quenty/studio-bridge 0.7.0 → 0.8.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 +15 -39
- package/README.md +166 -115
- package/dist/src/bridge/bridge-connection-remote.test.d.ts +7 -0
- package/dist/src/bridge/bridge-connection-remote.test.d.ts.map +1 -0
- package/dist/src/bridge/bridge-connection-remote.test.js +144 -0
- package/dist/src/bridge/bridge-connection-remote.test.js.map +1 -0
- package/dist/src/bridge/bridge-connection.d.ts +112 -0
- package/dist/src/bridge/bridge-connection.d.ts.map +1 -0
- package/dist/src/bridge/bridge-connection.js +528 -0
- package/dist/src/bridge/bridge-connection.js.map +1 -0
- package/dist/src/bridge/bridge-connection.test.d.ts +6 -0
- package/dist/src/bridge/bridge-connection.test.d.ts.map +1 -0
- package/dist/src/bridge/bridge-connection.test.js +773 -0
- package/dist/src/bridge/bridge-connection.test.js.map +1 -0
- package/dist/src/bridge/bridge-session.d.ts +38 -0
- package/dist/src/bridge/bridge-session.d.ts.map +1 -0
- package/dist/src/bridge/bridge-session.js +259 -0
- package/dist/src/bridge/bridge-session.js.map +1 -0
- package/dist/src/bridge/bridge-session.test.d.ts +6 -0
- package/dist/src/bridge/bridge-session.test.d.ts.map +1 -0
- package/dist/src/bridge/bridge-session.test.js +264 -0
- package/dist/src/bridge/bridge-session.test.js.map +1 -0
- package/dist/src/bridge/index.d.ts +13 -0
- package/dist/src/bridge/index.d.ts.map +1 -0
- package/dist/src/bridge/index.js +13 -0
- package/dist/src/bridge/index.js.map +1 -0
- package/dist/src/bridge/internal/__tests__/failover-crash.test.d.ts +9 -0
- package/dist/src/bridge/internal/__tests__/failover-crash.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/__tests__/failover-crash.test.js +159 -0
- package/dist/src/bridge/internal/__tests__/failover-crash.test.js.map +1 -0
- package/dist/src/bridge/internal/__tests__/failover-graceful.test.d.ts +9 -0
- package/dist/src/bridge/internal/__tests__/failover-graceful.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/__tests__/failover-graceful.test.js +218 -0
- package/dist/src/bridge/internal/__tests__/failover-graceful.test.js.map +1 -0
- package/dist/src/bridge/internal/__tests__/failover-inflight.test.d.ts +9 -0
- package/dist/src/bridge/internal/__tests__/failover-inflight.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/__tests__/failover-inflight.test.js +246 -0
- package/dist/src/bridge/internal/__tests__/failover-inflight.test.js.map +1 -0
- package/dist/src/bridge/internal/__tests__/host-client-integration.test.d.ts +10 -0
- package/dist/src/bridge/internal/__tests__/host-client-integration.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/__tests__/host-client-integration.test.js +298 -0
- package/dist/src/bridge/internal/__tests__/host-client-integration.test.js.map +1 -0
- package/dist/src/bridge/internal/bridge-client.d.ts +70 -0
- package/dist/src/bridge/internal/bridge-client.d.ts.map +1 -0
- package/dist/src/bridge/internal/bridge-client.js +344 -0
- package/dist/src/bridge/internal/bridge-client.js.map +1 -0
- package/dist/src/bridge/internal/bridge-client.test.d.ts +7 -0
- package/dist/src/bridge/internal/bridge-client.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/bridge-client.test.js +301 -0
- package/dist/src/bridge/internal/bridge-client.test.js.map +1 -0
- package/dist/src/bridge/internal/bridge-host.d.ts +78 -0
- package/dist/src/bridge/internal/bridge-host.d.ts.map +1 -0
- package/dist/src/bridge/internal/bridge-host.js +383 -0
- package/dist/src/bridge/internal/bridge-host.js.map +1 -0
- package/dist/src/bridge/internal/bridge-host.test.d.ts +7 -0
- package/dist/src/bridge/internal/bridge-host.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/bridge-host.test.js +377 -0
- package/dist/src/bridge/internal/bridge-host.test.js.map +1 -0
- package/dist/src/bridge/internal/environment-detection.d.ts +44 -0
- package/dist/src/bridge/internal/environment-detection.d.ts.map +1 -0
- package/dist/src/bridge/internal/environment-detection.js +91 -0
- package/dist/src/bridge/internal/environment-detection.js.map +1 -0
- package/dist/src/bridge/internal/environment-detection.test.d.ts +7 -0
- package/dist/src/bridge/internal/environment-detection.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/environment-detection.test.js +150 -0
- package/dist/src/bridge/internal/environment-detection.test.js.map +1 -0
- package/dist/src/bridge/internal/hand-off.d.ts +69 -0
- package/dist/src/bridge/internal/hand-off.d.ts.map +1 -0
- package/dist/src/bridge/internal/hand-off.js +178 -0
- package/dist/src/bridge/internal/hand-off.js.map +1 -0
- package/dist/src/bridge/internal/hand-off.test.d.ts +7 -0
- package/dist/src/bridge/internal/hand-off.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/hand-off.test.js +325 -0
- package/dist/src/bridge/internal/hand-off.test.js.map +1 -0
- package/dist/src/bridge/internal/health-endpoint.d.ts +32 -0
- package/dist/src/bridge/internal/health-endpoint.d.ts.map +1 -0
- package/dist/src/bridge/internal/health-endpoint.js +73 -0
- package/dist/src/bridge/internal/health-endpoint.js.map +1 -0
- package/dist/src/bridge/internal/health-endpoint.test.d.ts +6 -0
- package/dist/src/bridge/internal/health-endpoint.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/health-endpoint.test.js +122 -0
- package/dist/src/bridge/internal/health-endpoint.test.js.map +1 -0
- package/dist/src/bridge/internal/host-protocol.d.ts +60 -0
- package/dist/src/bridge/internal/host-protocol.d.ts.map +1 -0
- package/dist/src/bridge/internal/host-protocol.js +184 -0
- package/dist/src/bridge/internal/host-protocol.js.map +1 -0
- package/dist/src/bridge/internal/host-protocol.test.d.ts +6 -0
- package/dist/src/bridge/internal/host-protocol.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/host-protocol.test.js +307 -0
- package/dist/src/bridge/internal/host-protocol.test.js.map +1 -0
- package/dist/src/bridge/internal/session-tracker.d.ts +67 -0
- package/dist/src/bridge/internal/session-tracker.d.ts.map +1 -0
- package/dist/src/bridge/internal/session-tracker.js +138 -0
- package/dist/src/bridge/internal/session-tracker.js.map +1 -0
- package/dist/src/bridge/internal/session-tracker.test.d.ts +6 -0
- package/dist/src/bridge/internal/session-tracker.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/session-tracker.test.js +342 -0
- package/dist/src/bridge/internal/session-tracker.test.js.map +1 -0
- package/dist/src/bridge/internal/transport-client.d.ts +43 -0
- package/dist/src/bridge/internal/transport-client.d.ts.map +1 -0
- package/dist/src/bridge/internal/transport-client.js +146 -0
- package/dist/src/bridge/internal/transport-client.js.map +1 -0
- package/dist/src/bridge/internal/transport-client.test.d.ts +6 -0
- package/dist/src/bridge/internal/transport-client.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/transport-client.test.js +176 -0
- package/dist/src/bridge/internal/transport-client.test.js.map +1 -0
- package/dist/src/bridge/internal/transport-server.d.ts +59 -0
- package/dist/src/bridge/internal/transport-server.d.ts.map +1 -0
- package/dist/src/bridge/internal/transport-server.js +189 -0
- package/dist/src/bridge/internal/transport-server.js.map +1 -0
- package/dist/src/bridge/internal/transport-server.test.d.ts +6 -0
- package/dist/src/bridge/internal/transport-server.test.d.ts.map +1 -0
- package/dist/src/bridge/internal/transport-server.test.js +171 -0
- package/dist/src/bridge/internal/transport-server.test.js.map +1 -0
- package/dist/src/bridge/types.d.ts +117 -0
- package/dist/src/bridge/types.d.ts.map +1 -0
- package/dist/src/bridge/types.js +68 -0
- package/dist/src/bridge/types.js.map +1 -0
- package/dist/src/cli/adapters/cli-command-adapter-handler.test.d.ts +6 -0
- package/dist/src/cli/adapters/cli-command-adapter-handler.test.d.ts.map +1 -0
- package/dist/src/cli/adapters/cli-command-adapter-handler.test.js +260 -0
- package/dist/src/cli/adapters/cli-command-adapter-handler.test.js.map +1 -0
- package/dist/src/cli/adapters/cli-command-adapter.d.ts +39 -0
- package/dist/src/cli/adapters/cli-command-adapter.d.ts.map +1 -0
- package/dist/src/cli/adapters/cli-command-adapter.js +241 -0
- package/dist/src/cli/adapters/cli-command-adapter.js.map +1 -0
- package/dist/src/cli/adapters/cli-command-adapter.test.d.ts +5 -0
- package/dist/src/cli/adapters/cli-command-adapter.test.d.ts.map +1 -0
- package/dist/src/cli/adapters/cli-command-adapter.test.js +188 -0
- package/dist/src/cli/adapters/cli-command-adapter.test.js.map +1 -0
- package/dist/src/cli/adapters/group-builder.d.ts +29 -0
- package/dist/src/cli/adapters/group-builder.d.ts.map +1 -0
- package/dist/src/cli/adapters/group-builder.js +54 -0
- package/dist/src/cli/adapters/group-builder.js.map +1 -0
- package/dist/src/cli/adapters/group-builder.test.d.ts +5 -0
- package/dist/src/cli/adapters/group-builder.test.d.ts.map +1 -0
- package/dist/src/cli/adapters/group-builder.test.js +108 -0
- package/dist/src/cli/adapters/group-builder.test.js.map +1 -0
- package/dist/src/cli/adapters/help-formatter.d.ts +11 -0
- package/dist/src/cli/adapters/help-formatter.d.ts.map +1 -0
- package/dist/src/cli/adapters/help-formatter.js +78 -0
- package/dist/src/cli/adapters/help-formatter.js.map +1 -0
- package/dist/src/cli/adapters/help-formatter.test.d.ts +5 -0
- package/dist/src/cli/adapters/help-formatter.test.d.ts.map +1 -0
- package/dist/src/cli/adapters/help-formatter.test.js +79 -0
- package/dist/src/cli/adapters/help-formatter.test.js.map +1 -0
- package/dist/src/cli/adapters/target-resolver.d.ts +54 -0
- package/dist/src/cli/adapters/target-resolver.d.ts.map +1 -0
- package/dist/src/cli/adapters/target-resolver.js +90 -0
- package/dist/src/cli/adapters/target-resolver.js.map +1 -0
- package/dist/src/cli/adapters/target-resolver.test.d.ts +5 -0
- package/dist/src/cli/adapters/target-resolver.test.d.ts.map +1 -0
- package/dist/src/cli/adapters/target-resolver.test.js +169 -0
- package/dist/src/cli/adapters/target-resolver.test.js.map +1 -0
- package/dist/src/cli/args/global-args.d.ts +2 -0
- package/dist/src/cli/args/global-args.d.ts.map +1 -1
- package/dist/src/cli/cli.d.ts +6 -3
- package/dist/src/cli/cli.d.ts.map +1 -1
- package/dist/src/cli/cli.js +82 -20
- package/dist/src/cli/cli.js.map +1 -1
- package/dist/src/cli/resolve-script-content.d.ts +19 -0
- package/dist/src/cli/resolve-script-content.d.ts.map +1 -0
- package/dist/src/cli/resolve-script-content.js +22 -0
- package/dist/src/cli/resolve-script-content.js.map +1 -0
- package/dist/src/cli/resolve-session.d.ts +21 -0
- package/dist/src/cli/resolve-session.d.ts.map +1 -0
- package/dist/src/cli/resolve-session.js +40 -0
- package/dist/src/cli/resolve-session.js.map +1 -0
- package/dist/src/cli/resolve-session.test.d.ts +5 -0
- package/dist/src/cli/resolve-session.test.d.ts.map +1 -0
- package/dist/src/cli/resolve-session.test.js +112 -0
- package/dist/src/cli/resolve-session.test.js.map +1 -0
- package/dist/src/cli/script-executor.d.ts +1 -0
- package/dist/src/cli/script-executor.d.ts.map +1 -1
- package/dist/src/cli/script-executor.js +7 -1
- package/dist/src/cli/script-executor.js.map +1 -1
- package/dist/src/cli/types.d.ts +11 -0
- package/dist/src/cli/types.d.ts.map +1 -0
- package/dist/src/cli/types.js +5 -0
- package/dist/src/cli/types.js.map +1 -0
- package/dist/src/commands/connect.d.ts +16 -0
- package/dist/src/commands/connect.d.ts.map +1 -0
- package/dist/src/commands/connect.js +15 -0
- package/dist/src/commands/connect.js.map +1 -0
- package/dist/src/commands/connect.test.d.ts +5 -0
- package/dist/src/commands/connect.test.d.ts.map +1 -0
- package/dist/src/commands/connect.test.js +46 -0
- package/dist/src/commands/connect.test.js.map +1 -0
- package/dist/src/commands/console/exec/exec.d.ts +43 -0
- package/dist/src/commands/console/exec/exec.d.ts.map +1 -0
- package/dist/src/commands/console/exec/exec.js +79 -0
- package/dist/src/commands/console/exec/exec.js.map +1 -0
- package/dist/src/commands/console/exec/exec.test.d.ts +5 -0
- package/dist/src/commands/console/exec/exec.test.d.ts.map +1 -0
- package/dist/src/commands/console/exec/exec.test.js +191 -0
- package/dist/src/commands/console/exec/exec.test.js.map +1 -0
- package/dist/src/commands/console/logs/logs.d.ts +23 -0
- package/dist/src/commands/console/logs/logs.d.ts.map +1 -0
- package/dist/src/commands/console/logs/logs.js +80 -0
- package/dist/src/commands/console/logs/logs.js.map +1 -0
- package/dist/src/commands/console/logs/logs.test.d.ts +5 -0
- package/dist/src/commands/console/logs/logs.test.d.ts.map +1 -0
- package/dist/src/commands/console/logs/logs.test.js +111 -0
- package/dist/src/commands/console/logs/logs.test.js.map +1 -0
- package/dist/src/commands/disconnect.d.ts +9 -0
- package/dist/src/commands/disconnect.d.ts.map +1 -0
- package/dist/src/commands/disconnect.js +8 -0
- package/dist/src/commands/disconnect.js.map +1 -0
- package/dist/src/commands/disconnect.test.d.ts +5 -0
- package/dist/src/commands/disconnect.test.d.ts.map +1 -0
- package/dist/src/commands/disconnect.test.js +17 -0
- package/dist/src/commands/disconnect.test.js.map +1 -0
- package/dist/src/commands/explorer/query/query.d.ts +31 -0
- package/dist/src/commands/explorer/query/query.d.ts.map +1 -0
- package/dist/src/commands/explorer/query/query.js +106 -0
- package/dist/src/commands/explorer/query/query.js.map +1 -0
- package/dist/src/commands/explorer/query/query.test.d.ts +5 -0
- package/dist/src/commands/explorer/query/query.test.d.ts.map +1 -0
- package/dist/src/commands/explorer/query/query.test.js +228 -0
- package/dist/src/commands/explorer/query/query.test.js.map +1 -0
- package/dist/src/commands/formatters.test.d.ts +6 -0
- package/dist/src/commands/formatters.test.d.ts.map +1 -0
- package/dist/src/commands/formatters.test.js +211 -0
- package/dist/src/commands/formatters.test.js.map +1 -0
- package/dist/src/commands/framework/action-loader.d.ts +25 -0
- package/dist/src/commands/framework/action-loader.d.ts.map +1 -0
- package/dist/src/commands/framework/action-loader.js +46 -0
- package/dist/src/commands/framework/action-loader.js.map +1 -0
- package/dist/src/commands/framework/action-loader.test.d.ts +5 -0
- package/dist/src/commands/framework/action-loader.test.d.ts.map +1 -0
- package/dist/src/commands/framework/action-loader.test.js +89 -0
- package/dist/src/commands/framework/action-loader.test.js.map +1 -0
- package/dist/src/commands/framework/arg-builder.d.ts +92 -0
- package/dist/src/commands/framework/arg-builder.d.ts.map +1 -0
- package/dist/src/commands/framework/arg-builder.js +137 -0
- package/dist/src/commands/framework/arg-builder.js.map +1 -0
- package/dist/src/commands/framework/arg-builder.test.d.ts +5 -0
- package/dist/src/commands/framework/arg-builder.test.d.ts.map +1 -0
- package/dist/src/commands/framework/arg-builder.test.js +246 -0
- package/dist/src/commands/framework/arg-builder.test.js.map +1 -0
- package/dist/src/commands/framework/command-registry.d.ts +23 -0
- package/dist/src/commands/framework/command-registry.d.ts.map +1 -0
- package/dist/src/commands/framework/command-registry.js +42 -0
- package/dist/src/commands/framework/command-registry.js.map +1 -0
- package/dist/src/commands/framework/command-registry.test.d.ts +5 -0
- package/dist/src/commands/framework/command-registry.test.d.ts.map +1 -0
- package/dist/src/commands/framework/command-registry.test.js +158 -0
- package/dist/src/commands/framework/command-registry.test.js.map +1 -0
- package/dist/src/commands/framework/define-command.d.ts +76 -0
- package/dist/src/commands/framework/define-command.d.ts.map +1 -0
- package/dist/src/commands/framework/define-command.js +28 -0
- package/dist/src/commands/framework/define-command.js.map +1 -0
- package/dist/src/commands/framework/define-command.test.d.ts +5 -0
- package/dist/src/commands/framework/define-command.test.d.ts.map +1 -0
- package/dist/src/commands/framework/define-command.test.js +135 -0
- package/dist/src/commands/framework/define-command.test.js.map +1 -0
- package/dist/src/commands/framework/index.d.ts +8 -0
- package/dist/src/commands/framework/index.d.ts.map +1 -0
- package/dist/src/commands/framework/index.js +8 -0
- package/dist/src/commands/framework/index.js.map +1 -0
- package/dist/src/commands/index.d.ts +20 -0
- package/dist/src/commands/index.d.ts.map +1 -0
- package/dist/src/commands/index.js +20 -0
- package/dist/src/commands/index.js.map +1 -0
- package/dist/src/commands/linux/inject-credentials/inject-credentials.d.ts +15 -0
- package/dist/src/commands/linux/inject-credentials/inject-credentials.d.ts.map +1 -0
- package/dist/src/commands/linux/inject-credentials/inject-credentials.js +88 -0
- package/dist/src/commands/linux/inject-credentials/inject-credentials.js.map +1 -0
- package/dist/src/commands/linux/setup/setup.d.ts +19 -0
- package/dist/src/commands/linux/setup/setup.d.ts.map +1 -0
- package/dist/src/commands/linux/setup/setup.js +107 -0
- package/dist/src/commands/linux/setup/setup.js.map +1 -0
- package/dist/src/commands/linux/status/status.d.ts +34 -0
- package/dist/src/commands/linux/status/status.d.ts.map +1 -0
- package/dist/src/commands/linux/status/status.js +134 -0
- package/dist/src/commands/linux/status/status.js.map +1 -0
- package/dist/src/commands/plugin/install/install.d.ts +10 -0
- package/dist/src/commands/plugin/install/install.d.ts.map +1 -0
- package/dist/src/commands/plugin/install/install.js +23 -0
- package/dist/src/commands/plugin/install/install.js.map +1 -0
- package/dist/src/commands/plugin/uninstall/uninstall.d.ts +9 -0
- package/dist/src/commands/plugin/uninstall/uninstall.d.ts.map +1 -0
- package/dist/src/commands/plugin/uninstall/uninstall.js +41 -0
- package/dist/src/commands/plugin/uninstall/uninstall.js.map +1 -0
- package/dist/src/commands/process/close/close.d.ts +22 -0
- package/dist/src/commands/process/close/close.d.ts.map +1 -0
- package/dist/src/commands/process/close/close.js +34 -0
- package/dist/src/commands/process/close/close.js.map +1 -0
- package/dist/src/commands/process/format-state.d.ts +7 -0
- package/dist/src/commands/process/format-state.d.ts.map +1 -0
- package/dist/src/commands/process/format-state.js +19 -0
- package/dist/src/commands/process/format-state.js.map +1 -0
- package/dist/src/commands/process/info/info.d.ts +17 -0
- package/dist/src/commands/process/info/info.d.ts.map +1 -0
- package/dist/src/commands/process/info/info.js +38 -0
- package/dist/src/commands/process/info/info.js.map +1 -0
- package/dist/src/commands/process/info/info.test.d.ts +5 -0
- package/dist/src/commands/process/info/info.test.d.ts.map +1 -0
- package/dist/src/commands/process/info/info.test.js +58 -0
- package/dist/src/commands/process/info/info.test.js.map +1 -0
- package/dist/src/commands/process/launch/launch.d.ts +17 -0
- package/dist/src/commands/process/launch/launch.d.ts.map +1 -0
- package/dist/src/commands/process/launch/launch.js +26 -0
- package/dist/src/commands/process/launch/launch.js.map +1 -0
- package/dist/src/commands/process/launch/launch.test.d.ts +5 -0
- package/dist/src/commands/process/launch/launch.test.d.ts.map +1 -0
- package/dist/src/commands/process/launch/launch.test.js +49 -0
- package/dist/src/commands/process/launch/launch.test.js.map +1 -0
- package/dist/src/commands/process/list/list.d.ts +16 -0
- package/dist/src/commands/process/list/list.d.ts.map +1 -0
- package/dist/src/commands/process/list/list.js +56 -0
- package/dist/src/commands/process/list/list.js.map +1 -0
- package/dist/src/commands/process/list/list.test.d.ts +5 -0
- package/dist/src/commands/process/list/list.test.d.ts.map +1 -0
- package/dist/src/commands/process/list/list.test.js +71 -0
- package/dist/src/commands/process/list/list.test.js.map +1 -0
- package/dist/src/commands/process/run/run.d.ts +31 -0
- package/dist/src/commands/process/run/run.d.ts.map +1 -0
- package/dist/src/commands/process/run/run.js +63 -0
- package/dist/src/commands/process/run/run.js.map +1 -0
- package/dist/src/commands/rgba-to-png.d.ts +17 -0
- package/dist/src/commands/rgba-to-png.d.ts.map +1 -0
- package/dist/src/commands/rgba-to-png.js +85 -0
- package/dist/src/commands/rgba-to-png.js.map +1 -0
- package/dist/src/commands/serve/serve.d.ts +17 -0
- package/dist/src/commands/serve/serve.d.ts.map +1 -0
- package/dist/src/commands/serve/serve.js +128 -0
- package/dist/src/commands/serve/serve.js.map +1 -0
- package/dist/src/commands/serve/serve.test.d.ts +5 -0
- package/dist/src/commands/serve/serve.test.d.ts.map +1 -0
- package/dist/src/commands/serve/serve.test.js +100 -0
- package/dist/src/commands/serve/serve.test.js.map +1 -0
- package/dist/src/commands/viewport/screenshot/screenshot.d.ts +17 -0
- package/dist/src/commands/viewport/screenshot/screenshot.d.ts.map +1 -0
- package/dist/src/commands/viewport/screenshot/screenshot.js +45 -0
- package/dist/src/commands/viewport/screenshot/screenshot.js.map +1 -0
- package/dist/src/commands/viewport/screenshot/screenshot.test.d.ts +5 -0
- package/dist/src/commands/viewport/screenshot/screenshot.test.d.ts.map +1 -0
- package/dist/src/commands/viewport/screenshot/screenshot.test.js +143 -0
- package/dist/src/commands/viewport/screenshot/screenshot.test.js.map +1 -0
- package/dist/src/docker/docker-delegator.d.ts +30 -0
- package/dist/src/docker/docker-delegator.d.ts.map +1 -0
- package/dist/src/docker/docker-delegator.js +201 -0
- package/dist/src/docker/docker-delegator.js.map +1 -0
- package/dist/src/docker/docker-delegator.test.d.ts +2 -0
- package/dist/src/docker/docker-delegator.test.d.ts.map +1 -0
- package/dist/src/docker/docker-delegator.test.js +132 -0
- package/dist/src/docker/docker-delegator.test.js.map +1 -0
- package/dist/src/index.d.ts +9 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +6 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.test.d.ts +2 -0
- package/dist/src/index.test.d.ts.map +1 -0
- package/dist/src/index.test.js +51 -0
- package/dist/src/index.test.js.map +1 -0
- package/dist/src/linux/index.d.ts +12 -0
- package/dist/src/linux/index.d.ts.map +1 -0
- package/dist/src/linux/index.js +11 -0
- package/dist/src/linux/index.js.map +1 -0
- package/dist/src/linux/linux-config.d.ts +37 -0
- package/dist/src/linux/linux-config.d.ts.map +1 -0
- package/dist/src/linux/linux-config.js +70 -0
- package/dist/src/linux/linux-config.js.map +1 -0
- package/dist/src/linux/linux-config.test.d.ts +2 -0
- package/dist/src/linux/linux-config.test.d.ts.map +1 -0
- package/dist/src/linux/linux-config.test.js +54 -0
- package/dist/src/linux/linux-config.test.js.map +1 -0
- package/dist/src/linux/linux-credential-writer.d.ts +35 -0
- package/dist/src/linux/linux-credential-writer.d.ts.map +1 -0
- package/dist/src/linux/linux-credential-writer.js +300 -0
- package/dist/src/linux/linux-credential-writer.js.map +1 -0
- package/dist/src/linux/linux-display-manager.d.ts +24 -0
- package/dist/src/linux/linux-display-manager.d.ts.map +1 -0
- package/dist/src/linux/linux-display-manager.js +92 -0
- package/dist/src/linux/linux-display-manager.js.map +1 -0
- package/dist/src/linux/linux-env-guard.d.ts +13 -0
- package/dist/src/linux/linux-env-guard.d.ts.map +1 -0
- package/dist/src/linux/linux-env-guard.js +31 -0
- package/dist/src/linux/linux-env-guard.js.map +1 -0
- package/dist/src/linux/linux-env-guard.test.d.ts +2 -0
- package/dist/src/linux/linux-env-guard.test.d.ts.map +1 -0
- package/dist/src/linux/linux-env-guard.test.js +48 -0
- package/dist/src/linux/linux-env-guard.test.js.map +1 -0
- package/dist/src/linux/linux-fflags.d.ts +17 -0
- package/dist/src/linux/linux-fflags.d.ts.map +1 -0
- package/dist/src/linux/linux-fflags.js +33 -0
- package/dist/src/linux/linux-fflags.js.map +1 -0
- package/dist/src/linux/linux-fflags.test.d.ts +2 -0
- package/dist/src/linux/linux-fflags.test.d.ts.map +1 -0
- package/dist/src/linux/linux-fflags.test.js +55 -0
- package/dist/src/linux/linux-fflags.test.js.map +1 -0
- package/dist/src/linux/linux-prerequisites.d.ts +24 -0
- package/dist/src/linux/linux-prerequisites.d.ts.map +1 -0
- package/dist/src/linux/linux-prerequisites.js +118 -0
- package/dist/src/linux/linux-prerequisites.js.map +1 -0
- package/dist/src/linux/linux-shader-patcher.d.ts +17 -0
- package/dist/src/linux/linux-shader-patcher.d.ts.map +1 -0
- package/dist/src/linux/linux-shader-patcher.js +48 -0
- package/dist/src/linux/linux-shader-patcher.js.map +1 -0
- package/dist/src/linux/linux-shader-patcher.test.d.ts +2 -0
- package/dist/src/linux/linux-shader-patcher.test.d.ts.map +1 -0
- package/dist/src/linux/linux-shader-patcher.test.js +55 -0
- package/dist/src/linux/linux-shader-patcher.test.js.map +1 -0
- package/dist/src/linux/linux-studio-installer.d.ts +10 -0
- package/dist/src/linux/linux-studio-installer.d.ts.map +1 -0
- package/dist/src/linux/linux-studio-installer.js +79 -0
- package/dist/src/linux/linux-studio-installer.js.map +1 -0
- package/dist/src/linux/linux-studio-launcher.d.ts +10 -0
- package/dist/src/linux/linux-studio-launcher.d.ts.map +1 -0
- package/dist/src/linux/linux-studio-launcher.js +73 -0
- package/dist/src/linux/linux-studio-launcher.js.map +1 -0
- package/dist/src/linux/linux-version-resolver.d.ts +18 -0
- package/dist/src/linux/linux-version-resolver.d.ts.map +1 -0
- package/dist/src/linux/linux-version-resolver.js +49 -0
- package/dist/src/linux/linux-version-resolver.js.map +1 -0
- package/dist/src/linux/linux-wine-env.d.ts +11 -0
- package/dist/src/linux/linux-wine-env.d.ts.map +1 -0
- package/dist/src/linux/linux-wine-env.js +33 -0
- package/dist/src/linux/linux-wine-env.js.map +1 -0
- package/dist/src/linux/linux-wine-env.test.d.ts +2 -0
- package/dist/src/linux/linux-wine-env.test.d.ts.map +1 -0
- package/dist/src/linux/linux-wine-env.test.js +47 -0
- package/dist/src/linux/linux-wine-env.test.js.map +1 -0
- package/dist/src/plugin/persistent-plugin-installer.d.ts +21 -0
- package/dist/src/plugin/persistent-plugin-installer.d.ts.map +1 -0
- package/dist/src/plugin/persistent-plugin-installer.js +69 -0
- package/dist/src/plugin/persistent-plugin-installer.js.map +1 -0
- package/dist/src/plugin/persistent-plugin-installer.test.d.ts +5 -0
- package/dist/src/plugin/persistent-plugin-installer.test.d.ts.map +1 -0
- package/dist/src/plugin/persistent-plugin-installer.test.js +109 -0
- package/dist/src/plugin/persistent-plugin-installer.test.js.map +1 -0
- package/dist/src/plugin/plugin-discovery.d.ts +7 -0
- package/dist/src/plugin/plugin-discovery.d.ts.map +1 -0
- package/dist/src/plugin/plugin-discovery.js +18 -0
- package/dist/src/plugin/plugin-discovery.js.map +1 -0
- package/dist/src/plugin/plugin-discovery.test.d.ts +5 -0
- package/dist/src/plugin/plugin-discovery.test.d.ts.map +1 -0
- package/dist/src/plugin/plugin-discovery.test.js +55 -0
- package/dist/src/plugin/plugin-discovery.test.js.map +1 -0
- package/dist/src/plugin/plugin-injector.js +1 -1
- package/dist/src/plugin/plugin-injector.js.map +1 -1
- package/dist/src/process/studio-process-manager.d.ts +7 -3
- package/dist/src/process/studio-process-manager.d.ts.map +1 -1
- package/dist/src/process/studio-process-manager.js +38 -11
- package/dist/src/process/studio-process-manager.js.map +1 -1
- package/dist/src/process/studio-process-manager.test.js +18 -1
- package/dist/src/process/studio-process-manager.test.js.map +1 -1
- package/dist/src/server/action-dispatcher.d.ts +35 -0
- package/dist/src/server/action-dispatcher.d.ts.map +1 -0
- package/dist/src/server/action-dispatcher.js +67 -0
- package/dist/src/server/action-dispatcher.js.map +1 -0
- package/dist/src/server/action-dispatcher.test.d.ts +6 -0
- package/dist/src/server/action-dispatcher.test.d.ts.map +1 -0
- package/dist/src/server/action-dispatcher.test.js +173 -0
- package/dist/src/server/action-dispatcher.test.js.map +1 -0
- package/dist/src/server/index.d.ts +1 -1
- package/dist/src/server/index.d.ts.map +1 -1
- package/dist/src/server/pending-request-map.d.ts +33 -0
- package/dist/src/server/pending-request-map.d.ts.map +1 -0
- package/dist/src/server/pending-request-map.js +69 -0
- package/dist/src/server/pending-request-map.js.map +1 -0
- package/dist/src/server/pending-request-map.test.d.ts +2 -0
- package/dist/src/server/pending-request-map.test.d.ts.map +1 -0
- package/dist/src/server/pending-request-map.test.js +192 -0
- package/dist/src/server/pending-request-map.test.js.map +1 -0
- package/dist/src/server/plugin-detection.test.d.ts +7 -0
- package/dist/src/server/plugin-detection.test.d.ts.map +1 -0
- package/dist/src/server/plugin-detection.test.js +154 -0
- package/dist/src/server/plugin-detection.test.js.map +1 -0
- package/dist/src/server/studio-bridge-server.d.ts +44 -7
- package/dist/src/server/studio-bridge-server.d.ts.map +1 -1
- package/dist/src/server/studio-bridge-server.js +341 -91
- package/dist/src/server/studio-bridge-server.js.map +1 -1
- package/dist/src/server/studio-bridge-server.test.js +231 -207
- package/dist/src/server/studio-bridge-server.test.js.map +1 -1
- package/dist/src/server/web-socket-protocol-basic.test.d.ts +2 -0
- package/dist/src/server/web-socket-protocol-basic.test.d.ts.map +1 -0
- package/dist/src/server/web-socket-protocol-basic.test.js +98 -0
- package/dist/src/server/web-socket-protocol-basic.test.js.map +1 -0
- package/dist/src/server/web-socket-protocol.d.ts +218 -20
- package/dist/src/server/web-socket-protocol.d.ts.map +1 -1
- package/dist/src/server/web-socket-protocol.js +346 -20
- package/dist/src/server/web-socket-protocol.js.map +1 -1
- package/dist/src/server/web-socket-protocol.test.js +572 -146
- package/dist/src/server/web-socket-protocol.test.js.map +1 -1
- package/dist/src/test/e2e/hand-off.test.d.ts +9 -0
- package/dist/src/test/e2e/hand-off.test.d.ts.map +1 -0
- package/dist/src/test/e2e/hand-off.test.js +274 -0
- package/dist/src/test/e2e/hand-off.test.js.map +1 -0
- package/dist/src/test/e2e/persistent-session.test.d.ts +11 -0
- package/dist/src/test/e2e/persistent-session.test.d.ts.map +1 -0
- package/dist/src/test/e2e/persistent-session.test.js +367 -0
- package/dist/src/test/e2e/persistent-session.test.js.map +1 -0
- package/dist/src/test/e2e/split-server.test.d.ts +14 -0
- package/dist/src/test/e2e/split-server.test.d.ts.map +1 -0
- package/dist/src/test/e2e/split-server.test.js +230 -0
- package/dist/src/test/e2e/split-server.test.js.map +1 -0
- package/dist/src/test/helpers/mock-plugin-client.d.ts +69 -0
- package/dist/src/test/helpers/mock-plugin-client.d.ts.map +1 -0
- package/dist/src/test/helpers/mock-plugin-client.js +213 -0
- package/dist/src/test/helpers/mock-plugin-client.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docker/.dockerignore +2 -0
- package/docker/Dockerfile +113 -0
- package/docker/docker-compose.yml +20 -0
- package/docker/entrypoint.sh +19 -0
- package/package.json +8 -6
- package/src/bridge/bridge-connection-remote.test.ts +189 -0
- package/src/bridge/bridge-connection.test.ts +1076 -0
- package/src/bridge/bridge-connection.ts +718 -0
- package/src/bridge/bridge-session.test.ts +336 -0
- package/src/bridge/bridge-session.ts +365 -0
- package/src/bridge/index.ts +42 -0
- package/src/bridge/internal/__tests__/failover-crash.test.ts +191 -0
- package/src/bridge/internal/__tests__/failover-graceful.test.ts +268 -0
- package/src/bridge/internal/__tests__/failover-inflight.test.ts +329 -0
- package/src/bridge/internal/__tests__/host-client-integration.test.ts +387 -0
- package/src/bridge/internal/bridge-client.test.ts +399 -0
- package/src/bridge/internal/bridge-client.ts +434 -0
- package/src/bridge/internal/bridge-host.test.ts +501 -0
- package/src/bridge/internal/bridge-host.ts +531 -0
- package/src/bridge/internal/environment-detection.test.ts +180 -0
- package/src/bridge/internal/environment-detection.ts +119 -0
- package/src/bridge/internal/hand-off.test.ts +408 -0
- package/src/bridge/internal/hand-off.ts +275 -0
- package/src/bridge/internal/health-endpoint.test.ts +147 -0
- package/src/bridge/internal/health-endpoint.ts +100 -0
- package/src/bridge/internal/host-protocol.test.ts +415 -0
- package/src/bridge/internal/host-protocol.ts +255 -0
- package/src/bridge/internal/session-tracker.test.ts +535 -0
- package/src/bridge/internal/session-tracker.ts +198 -0
- package/src/bridge/internal/transport-client.test.ts +241 -0
- package/src/bridge/internal/transport-client.ts +194 -0
- package/src/bridge/internal/transport-server.test.ts +220 -0
- package/src/bridge/internal/transport-server.ts +242 -0
- package/src/bridge/types.ts +161 -0
- package/src/cli/adapters/cli-command-adapter-handler.test.ts +318 -0
- package/src/cli/adapters/cli-command-adapter.test.ts +221 -0
- package/src/cli/adapters/cli-command-adapter.ts +342 -0
- package/src/cli/adapters/group-builder.test.ts +146 -0
- package/src/cli/adapters/group-builder.ts +81 -0
- package/src/cli/adapters/help-formatter.test.ts +97 -0
- package/src/cli/adapters/help-formatter.ts +86 -0
- package/src/cli/adapters/target-resolver.test.ts +222 -0
- package/src/cli/adapters/target-resolver.ts +144 -0
- package/src/cli/args/global-args.ts +2 -0
- package/src/cli/cli.ts +100 -21
- package/src/cli/resolve-script-content.ts +36 -0
- package/src/cli/resolve-session.test.ts +141 -0
- package/src/cli/resolve-session.ts +66 -0
- package/src/cli/script-executor.ts +22 -4
- package/src/cli/types.ts +11 -0
- package/src/commands/connect.test.ts +61 -0
- package/src/commands/connect.ts +32 -0
- package/src/commands/console/exec/exec.test.ts +258 -0
- package/src/commands/console/exec/exec.ts +130 -0
- package/src/commands/console/exec/execute.luau +202 -0
- package/src/commands/console/logs/logs.test.ts +138 -0
- package/src/commands/console/logs/logs.ts +115 -0
- package/src/commands/console/logs/query-logs.luau +76 -0
- package/src/commands/disconnect.test.ts +21 -0
- package/src/commands/disconnect.ts +12 -0
- package/src/commands/explorer/query/query-data-model.luau +206 -0
- package/src/commands/explorer/query/query.test.ts +297 -0
- package/src/commands/explorer/query/query.ts +157 -0
- package/src/commands/formatters.test.ts +237 -0
- package/src/commands/framework/action-loader.test.ts +118 -0
- package/src/commands/framework/action-loader.ts +65 -0
- package/src/commands/framework/arg-builder.test.ts +298 -0
- package/src/commands/framework/arg-builder.ts +203 -0
- package/src/commands/framework/command-registry.test.ts +204 -0
- package/src/commands/framework/command-registry.ts +51 -0
- package/src/commands/framework/define-command.test.ts +161 -0
- package/src/commands/framework/define-command.ts +114 -0
- package/src/commands/framework/index.ts +33 -0
- package/src/commands/index.ts +72 -0
- package/src/commands/linux/inject-credentials/inject-credentials.ts +118 -0
- package/src/commands/linux/setup/setup.ts +145 -0
- package/src/commands/linux/status/status.ts +180 -0
- package/src/commands/plugin/install/install.ts +31 -0
- package/src/commands/plugin/uninstall/uninstall.ts +54 -0
- package/src/commands/process/close/close.ts +52 -0
- package/src/commands/process/format-state.ts +21 -0
- package/src/commands/process/info/info.test.ts +76 -0
- package/src/commands/process/info/info.ts +54 -0
- package/src/commands/process/info/query-state.luau +48 -0
- package/src/commands/process/launch/launch.test.ts +65 -0
- package/src/commands/process/launch/launch.ts +45 -0
- package/src/commands/process/list/list.test.ts +82 -0
- package/src/commands/process/list/list.ts +75 -0
- package/src/commands/process/run/run.ts +98 -0
- package/src/commands/rgba-to-png.ts +98 -0
- package/src/commands/serve/serve.test.ts +139 -0
- package/src/commands/serve/serve.ts +161 -0
- package/src/commands/viewport/screenshot/capture-screenshot.luau +247 -0
- package/src/commands/viewport/screenshot/screenshot.test.ts +181 -0
- package/src/commands/viewport/screenshot/screenshot.ts +71 -0
- package/src/docker/docker-delegator.test.ts +159 -0
- package/src/docker/docker-delegator.ts +240 -0
- package/src/index.test.ts +58 -0
- package/src/index.ts +104 -3
- package/src/linux/README.md +130 -0
- package/src/linux/index.ts +25 -0
- package/src/linux/linux-config.test.ts +66 -0
- package/src/linux/linux-config.ts +102 -0
- package/src/linux/linux-credential-writer.ts +421 -0
- package/src/linux/linux-display-manager.ts +106 -0
- package/src/linux/linux-env-guard.test.ts +62 -0
- package/src/linux/linux-env-guard.ts +38 -0
- package/src/linux/linux-fflags.test.ts +78 -0
- package/src/linux/linux-fflags.ts +48 -0
- package/src/linux/linux-prerequisites.ts +152 -0
- package/src/linux/linux-shader-patcher.test.ts +76 -0
- package/src/linux/linux-shader-patcher.ts +56 -0
- package/src/linux/linux-studio-installer.ts +113 -0
- package/src/linux/linux-studio-launcher.ts +90 -0
- package/src/linux/linux-version-resolver.ts +74 -0
- package/src/linux/linux-wine-env.test.ts +56 -0
- package/src/linux/linux-wine-env.ts +38 -0
- package/src/linux/write-cred.c +48 -0
- package/src/plugin/persistent-plugin-installer.test.ts +168 -0
- package/src/plugin/persistent-plugin-installer.ts +90 -0
- package/src/plugin/plugin-discovery.test.ts +70 -0
- package/src/plugin/plugin-discovery.ts +21 -0
- package/src/plugin/plugin-injector.ts +1 -1
- package/src/process/studio-process-manager.test.ts +22 -1
- package/src/process/studio-process-manager.ts +57 -18
- package/src/server/action-dispatcher.test.ts +240 -0
- package/src/server/action-dispatcher.ts +89 -0
- package/src/server/index.ts +0 -3
- package/src/server/pending-request-map.test.ts +261 -0
- package/src/server/pending-request-map.ts +87 -0
- package/src/server/plugin-detection.test.ts +195 -0
- package/src/server/studio-bridge-server.test.ts +321 -283
- package/src/server/studio-bridge-server.ts +469 -111
- package/src/server/web-socket-protocol-basic.test.ts +131 -0
- package/src/server/web-socket-protocol.test.ts +658 -159
- package/src/server/web-socket-protocol.ts +668 -58
- package/src/test/e2e/hand-off.test.ts +338 -0
- package/src/test/e2e/persistent-session.test.ts +442 -0
- package/src/test/e2e/split-server.test.ts +290 -0
- package/src/test/helpers/mock-plugin-client.ts +276 -0
- package/templates/studio-bridge-plugin/src/Shared/ActionRouter.luau +245 -0
- package/templates/studio-bridge-plugin/src/Shared/DiscoveryStateMachine.luau +203 -0
- package/templates/studio-bridge-plugin/src/Shared/MessageBuffer.luau +144 -0
- package/templates/studio-bridge-plugin/src/Shared/Protocol.luau +132 -0
- package/templates/studio-bridge-plugin/src/StudioBridgePlugin.server.lua +364 -133
- package/templates/studio-bridge-plugin/src/Vendor/png.luau +1247 -0
- package/templates/studio-bridge-plugin-test/test/actions.test.luau +580 -0
- package/templates/studio-bridge-plugin-test/test/discovery.test.luau +622 -0
- package/templates/studio-bridge-plugin-test/test/execute-handler.test.luau +406 -0
- package/templates/studio-bridge-plugin-test/test/hash-lifecycle.test.luau +814 -0
- package/templates/studio-bridge-plugin-test/test/integration.test.luau +1020 -0
- package/templates/studio-bridge-plugin-test/test/new-actions.test.luau +339 -0
- package/templates/studio-bridge-plugin-test/test/plugin-entry.test.luau +493 -0
- package/templates/studio-bridge-plugin-test/test/protocol.test.luau +506 -0
- package/templates/studio-bridge-plugin-test/test/roblox-mocks.luau +108 -0
- package/templates/studio-bridge-plugin-test/test/test-runner.luau +112 -0
- package/dist/src/cli/commands/exec-command.d.ts +0 -15
- package/dist/src/cli/commands/exec-command.d.ts.map +0 -1
- package/dist/src/cli/commands/exec-command.js +0 -35
- package/dist/src/cli/commands/exec-command.js.map +0 -1
- package/dist/src/cli/commands/run-command.d.ts +0 -15
- package/dist/src/cli/commands/run-command.d.ts.map +0 -1
- package/dist/src/cli/commands/run-command.js +0 -47
- package/dist/src/cli/commands/run-command.js.map +0 -1
- package/dist/src/cli/commands/terminal/terminal-command.d.ts +0 -17
- package/dist/src/cli/commands/terminal/terminal-command.d.ts.map +0 -1
- package/dist/src/cli/commands/terminal/terminal-command.js +0 -41
- package/dist/src/cli/commands/terminal/terminal-command.js.map +0 -1
- package/dist/src/cli/commands/terminal/terminal-editor.d.ts +0 -43
- package/dist/src/cli/commands/terminal/terminal-editor.d.ts.map +0 -1
- package/dist/src/cli/commands/terminal/terminal-editor.js +0 -430
- package/dist/src/cli/commands/terminal/terminal-editor.js.map +0 -1
- package/dist/src/cli/commands/terminal/terminal-mode.d.ts +0 -13
- package/dist/src/cli/commands/terminal/terminal-mode.d.ts.map +0 -1
- package/dist/src/cli/commands/terminal/terminal-mode.js +0 -141
- package/dist/src/cli/commands/terminal/terminal-mode.js.map +0 -1
- package/dist/src/server/web-socket-protocol.smoke.test.d.ts +0 -6
- package/dist/src/server/web-socket-protocol.smoke.test.d.ts.map +0 -1
- package/dist/src/server/web-socket-protocol.smoke.test.js +0 -196
- package/dist/src/server/web-socket-protocol.smoke.test.js.map +0 -1
- package/src/cli/commands/exec-command.ts +0 -48
- package/src/cli/commands/run-command.ts +0 -63
- package/src/cli/commands/terminal/terminal-command.ts +0 -54
- package/src/cli/commands/terminal/terminal-editor.ts +0 -500
- package/src/cli/commands/terminal/terminal-mode.ts +0 -184
- package/src/server/web-socket-protocol.smoke.test.ts +0 -255
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* End-to-end tests for split-server mode. A BridgeHost accepts plugin
|
|
3
|
+
* connections on /plugin and CLI client connections on /client. Verifies
|
|
4
|
+
* that multiple clients can coexist with the host without interfering
|
|
5
|
+
* with plugin sessions.
|
|
6
|
+
*
|
|
7
|
+
* Note: The current BridgeHost does not implement full host-protocol
|
|
8
|
+
* message routing (list-sessions, host-envelope relay). These tests
|
|
9
|
+
* exercise the real transport layer and connection lifecycle, not the
|
|
10
|
+
* relay protocol. Split-server relay is tested via BridgeConnection
|
|
11
|
+
* with a mock host (see bridge-connection-remote.test.ts).
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { describe, it, expect, afterEach } from 'vitest';
|
|
15
|
+
import { WebSocket } from 'ws';
|
|
16
|
+
import { BridgeHost } from '../../bridge/internal/bridge-host.js';
|
|
17
|
+
import { MockPluginClient } from '../helpers/mock-plugin-client.js';
|
|
18
|
+
import type { PluginSessionInfo } from '../../bridge/internal/bridge-host.js';
|
|
19
|
+
|
|
20
|
+
function connectClient(port: number): Promise<WebSocket> {
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
const ws = new WebSocket(`ws://localhost:${port}/client`);
|
|
23
|
+
ws.on('open', () => resolve(ws));
|
|
24
|
+
ws.on('error', reject);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
describe('split-server e2e', () => {
|
|
29
|
+
let host: BridgeHost | undefined;
|
|
30
|
+
const plugins: MockPluginClient[] = [];
|
|
31
|
+
const clients: WebSocket[] = [];
|
|
32
|
+
|
|
33
|
+
afterEach(async () => {
|
|
34
|
+
for (const plugin of plugins) {
|
|
35
|
+
await plugin.disconnectAsync();
|
|
36
|
+
}
|
|
37
|
+
plugins.length = 0;
|
|
38
|
+
|
|
39
|
+
for (const ws of clients) {
|
|
40
|
+
if (
|
|
41
|
+
ws.readyState === WebSocket.OPEN ||
|
|
42
|
+
ws.readyState === WebSocket.CONNECTING
|
|
43
|
+
) {
|
|
44
|
+
ws.close();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
clients.length = 0;
|
|
48
|
+
|
|
49
|
+
if (host) {
|
|
50
|
+
await host.stopAsync();
|
|
51
|
+
host = undefined;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('client connects to existing host', async () => {
|
|
56
|
+
host = new BridgeHost();
|
|
57
|
+
const port = await host.startAsync({ port: 0 });
|
|
58
|
+
expect(port).toBeGreaterThan(0);
|
|
59
|
+
|
|
60
|
+
// Connect a plugin
|
|
61
|
+
const plugin = new MockPluginClient({
|
|
62
|
+
port,
|
|
63
|
+
instanceId: 'inst-split-1',
|
|
64
|
+
placeName: 'SplitPlace',
|
|
65
|
+
});
|
|
66
|
+
plugins.push(plugin);
|
|
67
|
+
await plugin.connectAndRegisterAsync();
|
|
68
|
+
await new Promise((r) => setTimeout(r, 50));
|
|
69
|
+
|
|
70
|
+
expect(host.pluginCount).toBe(1);
|
|
71
|
+
|
|
72
|
+
// Connect a client on /client path
|
|
73
|
+
const clientWs = await connectClient(port);
|
|
74
|
+
clients.push(clientWs);
|
|
75
|
+
|
|
76
|
+
expect(clientWs.readyState).toBe(WebSocket.OPEN);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('client can list sessions from host via plugin-connected events', async () => {
|
|
80
|
+
host = new BridgeHost();
|
|
81
|
+
const port = await host.startAsync({ port: 0 });
|
|
82
|
+
|
|
83
|
+
// Track plugin-connected events
|
|
84
|
+
const connectedSessions: PluginSessionInfo[] = [];
|
|
85
|
+
host.on('plugin-connected', (info: PluginSessionInfo) => {
|
|
86
|
+
connectedSessions.push(info);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Connect two plugins
|
|
90
|
+
const pluginA = new MockPluginClient({
|
|
91
|
+
port,
|
|
92
|
+
instanceId: 'inst-list-A',
|
|
93
|
+
placeName: 'PlaceA',
|
|
94
|
+
});
|
|
95
|
+
plugins.push(pluginA);
|
|
96
|
+
await pluginA.connectAndRegisterAsync();
|
|
97
|
+
|
|
98
|
+
const pluginB = new MockPluginClient({
|
|
99
|
+
port,
|
|
100
|
+
instanceId: 'inst-list-B',
|
|
101
|
+
placeName: 'PlaceB',
|
|
102
|
+
});
|
|
103
|
+
plugins.push(pluginB);
|
|
104
|
+
await pluginB.connectAndRegisterAsync();
|
|
105
|
+
await new Promise((r) => setTimeout(r, 50));
|
|
106
|
+
|
|
107
|
+
expect(host.pluginCount).toBe(2);
|
|
108
|
+
expect(connectedSessions).toHaveLength(2);
|
|
109
|
+
|
|
110
|
+
const sessionIds = connectedSessions.map((s) => s.sessionId).sort();
|
|
111
|
+
expect(sessionIds).toContain(pluginA.sessionId);
|
|
112
|
+
expect(sessionIds).toContain(pluginB.sessionId);
|
|
113
|
+
|
|
114
|
+
// Verify instance metadata
|
|
115
|
+
const sessionA = connectedSessions.find(
|
|
116
|
+
(s) => s.sessionId === pluginA.sessionId
|
|
117
|
+
);
|
|
118
|
+
expect(sessionA!.placeName).toBe('PlaceA');
|
|
119
|
+
expect(sessionA!.instanceId).toBe('inst-list-A');
|
|
120
|
+
|
|
121
|
+
const sessionB = connectedSessions.find(
|
|
122
|
+
(s) => s.sessionId === pluginB.sessionId
|
|
123
|
+
);
|
|
124
|
+
expect(sessionB!.placeName).toBe('PlaceB');
|
|
125
|
+
expect(sessionB!.instanceId).toBe('inst-list-B');
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('plugin and client coexist on the same host without interference', async () => {
|
|
129
|
+
host = new BridgeHost();
|
|
130
|
+
const port = await host.startAsync({ port: 0 });
|
|
131
|
+
|
|
132
|
+
// Connect plugin with execute capability
|
|
133
|
+
const plugin = new MockPluginClient({
|
|
134
|
+
port,
|
|
135
|
+
instanceId: 'inst-relay',
|
|
136
|
+
capabilities: ['execute', 'queryState'],
|
|
137
|
+
});
|
|
138
|
+
plugins.push(plugin);
|
|
139
|
+
await plugin.connectAndRegisterAsync();
|
|
140
|
+
await new Promise((r) => setTimeout(r, 50));
|
|
141
|
+
|
|
142
|
+
// Connect a client
|
|
143
|
+
const clientWs = await connectClient(port);
|
|
144
|
+
clients.push(clientWs);
|
|
145
|
+
|
|
146
|
+
// Both connections should be active
|
|
147
|
+
expect(host.pluginCount).toBe(1);
|
|
148
|
+
expect(plugin.isConnected).toBe(true);
|
|
149
|
+
expect(clientWs.readyState).toBe(WebSocket.OPEN);
|
|
150
|
+
|
|
151
|
+
// Plugin can send heartbeats without affecting the client
|
|
152
|
+
plugin.sendMessage({
|
|
153
|
+
type: 'heartbeat',
|
|
154
|
+
sessionId: plugin.sessionId,
|
|
155
|
+
payload: {
|
|
156
|
+
uptimeMs: 5000,
|
|
157
|
+
state: 'Edit',
|
|
158
|
+
pendingRequests: 0,
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
await new Promise((r) => setTimeout(r, 50));
|
|
163
|
+
|
|
164
|
+
// Client can send data without affecting the plugin
|
|
165
|
+
clientWs.send(JSON.stringify({ type: 'ping' }));
|
|
166
|
+
|
|
167
|
+
await new Promise((r) => setTimeout(r, 50));
|
|
168
|
+
|
|
169
|
+
// Both should still be connected
|
|
170
|
+
expect(plugin.isConnected).toBe(true);
|
|
171
|
+
expect(clientWs.readyState).toBe(WebSocket.OPEN);
|
|
172
|
+
expect(host.pluginCount).toBe(1);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it('client disconnect does not affect host or plugin', async () => {
|
|
176
|
+
host = new BridgeHost();
|
|
177
|
+
const port = await host.startAsync({ port: 0 });
|
|
178
|
+
|
|
179
|
+
const plugin = new MockPluginClient({
|
|
180
|
+
port,
|
|
181
|
+
instanceId: 'inst-client-dc',
|
|
182
|
+
});
|
|
183
|
+
plugins.push(plugin);
|
|
184
|
+
await plugin.connectAndRegisterAsync();
|
|
185
|
+
await new Promise((r) => setTimeout(r, 50));
|
|
186
|
+
|
|
187
|
+
// Connect client
|
|
188
|
+
const clientWs = await connectClient(port);
|
|
189
|
+
clients.push(clientWs);
|
|
190
|
+
|
|
191
|
+
expect(host.pluginCount).toBe(1);
|
|
192
|
+
|
|
193
|
+
// Disconnect the client
|
|
194
|
+
clientWs.close();
|
|
195
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
196
|
+
|
|
197
|
+
// Host should still be running
|
|
198
|
+
expect(host.isRunning).toBe(true);
|
|
199
|
+
expect(host.pluginCount).toBe(1);
|
|
200
|
+
|
|
201
|
+
// Plugin should still be connected
|
|
202
|
+
expect(plugin.isConnected).toBe(true);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it('plugin disconnect does not affect connected clients', async () => {
|
|
206
|
+
host = new BridgeHost();
|
|
207
|
+
const port = await host.startAsync({ port: 0 });
|
|
208
|
+
|
|
209
|
+
const plugin = new MockPluginClient({
|
|
210
|
+
port,
|
|
211
|
+
instanceId: 'inst-plugin-dc',
|
|
212
|
+
});
|
|
213
|
+
plugins.push(plugin);
|
|
214
|
+
await plugin.connectAndRegisterAsync();
|
|
215
|
+
await new Promise((r) => setTimeout(r, 50));
|
|
216
|
+
|
|
217
|
+
// Connect a client
|
|
218
|
+
const clientWs = await connectClient(port);
|
|
219
|
+
clients.push(clientWs);
|
|
220
|
+
|
|
221
|
+
// Track plugin disconnect
|
|
222
|
+
const disconnectedPromise = new Promise<string>((resolve) => {
|
|
223
|
+
host!.on('plugin-disconnected', resolve);
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
// Disconnect the plugin
|
|
227
|
+
await plugin.disconnectAsync();
|
|
228
|
+
|
|
229
|
+
const disconnectedId = await disconnectedPromise;
|
|
230
|
+
expect(disconnectedId).toBe(plugin.sessionId);
|
|
231
|
+
|
|
232
|
+
// Host still running
|
|
233
|
+
expect(host.isRunning).toBe(true);
|
|
234
|
+
expect(host.pluginCount).toBe(0);
|
|
235
|
+
|
|
236
|
+
// Client still connected
|
|
237
|
+
expect(clientWs.readyState).toBe(WebSocket.OPEN);
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
it('health endpoint returns correct data with active connections', async () => {
|
|
241
|
+
host = new BridgeHost();
|
|
242
|
+
const port = await host.startAsync({ port: 0 });
|
|
243
|
+
|
|
244
|
+
// Connect a plugin
|
|
245
|
+
const plugin = new MockPluginClient({
|
|
246
|
+
port,
|
|
247
|
+
instanceId: 'inst-health',
|
|
248
|
+
});
|
|
249
|
+
plugins.push(plugin);
|
|
250
|
+
await plugin.connectAndRegisterAsync();
|
|
251
|
+
await new Promise((r) => setTimeout(r, 50));
|
|
252
|
+
|
|
253
|
+
// Check health endpoint
|
|
254
|
+
const res = await fetch(`http://localhost:${port}/health`);
|
|
255
|
+
expect(res.status).toBe(200);
|
|
256
|
+
|
|
257
|
+
const body = (await res.json()) as Record<string, unknown>;
|
|
258
|
+
expect(body.status).toBe('ok');
|
|
259
|
+
expect(body.port).toBe(port);
|
|
260
|
+
expect(body.sessions).toBe(1);
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it('graceful shutdown sends host-transfer notice to clients', async () => {
|
|
264
|
+
host = new BridgeHost();
|
|
265
|
+
const port = await host.startAsync({ port: 0 });
|
|
266
|
+
|
|
267
|
+
// Connect a client
|
|
268
|
+
const clientWs = await connectClient(port);
|
|
269
|
+
clients.push(clientWs);
|
|
270
|
+
|
|
271
|
+
// Listen for host-transfer message
|
|
272
|
+
const transferPromise = new Promise<Record<string, unknown>>((resolve) => {
|
|
273
|
+
clientWs.on('message', (raw) => {
|
|
274
|
+
const data = JSON.parse(
|
|
275
|
+
typeof raw === 'string' ? raw : raw.toString('utf-8')
|
|
276
|
+
);
|
|
277
|
+
if (data.type === 'host-transfer') {
|
|
278
|
+
resolve(data);
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
// Graceful shutdown
|
|
284
|
+
await host.shutdownAsync();
|
|
285
|
+
|
|
286
|
+
// The client should have received the host-transfer notice
|
|
287
|
+
const transferMsg = await transferPromise;
|
|
288
|
+
expect(transferMsg.type).toBe('host-transfer');
|
|
289
|
+
});
|
|
290
|
+
});
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reusable mock plugin client for E2E tests. Connects to a bridge host
|
|
3
|
+
* on the /plugin WebSocket path, sends the register handshake, and
|
|
4
|
+
* supports receiving and responding to action requests from the host.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { randomUUID } from 'crypto';
|
|
8
|
+
import { WebSocket } from 'ws';
|
|
9
|
+
import type {
|
|
10
|
+
Capability,
|
|
11
|
+
StudioState,
|
|
12
|
+
} from '../../server/web-socket-protocol.js';
|
|
13
|
+
|
|
14
|
+
export interface MockPluginClientOptions {
|
|
15
|
+
port: number;
|
|
16
|
+
instanceId?: string;
|
|
17
|
+
context?: 'edit' | 'client' | 'server';
|
|
18
|
+
placeName?: string;
|
|
19
|
+
capabilities?: Capability[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class MockPluginClient {
|
|
23
|
+
private _ws: WebSocket | undefined;
|
|
24
|
+
private _options: Required<MockPluginClientOptions>;
|
|
25
|
+
private _sessionId: string;
|
|
26
|
+
private _isConnected = false;
|
|
27
|
+
private _messageHandlers = new Map<
|
|
28
|
+
string,
|
|
29
|
+
Array<(msg: Record<string, unknown>) => void>
|
|
30
|
+
>();
|
|
31
|
+
private _allMessageHandlers: Array<(msg: Record<string, unknown>) => void> =
|
|
32
|
+
[];
|
|
33
|
+
|
|
34
|
+
constructor(options: MockPluginClientOptions) {
|
|
35
|
+
this._sessionId = randomUUID();
|
|
36
|
+
this._options = {
|
|
37
|
+
port: options.port,
|
|
38
|
+
instanceId: options.instanceId ?? randomUUID(),
|
|
39
|
+
context: options.context ?? 'edit',
|
|
40
|
+
placeName: options.placeName ?? 'TestPlace',
|
|
41
|
+
capabilities: options.capabilities ?? ['execute', 'queryState'],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Connect to the bridge host WebSocket endpoint.
|
|
47
|
+
*/
|
|
48
|
+
async connectAsync(): Promise<void> {
|
|
49
|
+
const url = `ws://localhost:${this._options.port}/plugin`;
|
|
50
|
+
this._ws = new WebSocket(url);
|
|
51
|
+
|
|
52
|
+
await new Promise<void>((resolve, reject) => {
|
|
53
|
+
this._ws!.on('open', () => {
|
|
54
|
+
this._isConnected = true;
|
|
55
|
+
resolve();
|
|
56
|
+
});
|
|
57
|
+
this._ws!.on('error', reject);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Set up message routing
|
|
61
|
+
this._ws.on('message', (raw) => {
|
|
62
|
+
const data = typeof raw === 'string' ? raw : raw.toString('utf-8');
|
|
63
|
+
let msg: Record<string, unknown>;
|
|
64
|
+
try {
|
|
65
|
+
msg = JSON.parse(data) as Record<string, unknown>;
|
|
66
|
+
} catch {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const type = msg.type as string;
|
|
71
|
+
|
|
72
|
+
// Dispatch to type-specific handlers
|
|
73
|
+
const handlers = this._messageHandlers.get(type);
|
|
74
|
+
if (handlers) {
|
|
75
|
+
for (const handler of [...handlers]) {
|
|
76
|
+
handler(msg);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Dispatch to all-message handlers
|
|
81
|
+
for (const handler of [...this._allMessageHandlers]) {
|
|
82
|
+
handler(msg);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
this._ws.on('close', () => {
|
|
87
|
+
this._isConnected = false;
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
this._ws.on('error', () => {
|
|
91
|
+
// Errors handled via close
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Send a v2 register message to the bridge host.
|
|
97
|
+
*/
|
|
98
|
+
async sendRegisterAsync(): Promise<void> {
|
|
99
|
+
if (!this._ws || !this._isConnected) {
|
|
100
|
+
throw new Error('MockPluginClient is not connected');
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const stateMap: Record<string, StudioState> = {
|
|
104
|
+
edit: 'Edit',
|
|
105
|
+
client: 'Client',
|
|
106
|
+
server: 'Server',
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
this._ws.send(
|
|
110
|
+
JSON.stringify({
|
|
111
|
+
type: 'register',
|
|
112
|
+
sessionId: this._sessionId,
|
|
113
|
+
payload: {
|
|
114
|
+
pluginVersion: '2.0.0-test',
|
|
115
|
+
instanceId: this._options.instanceId,
|
|
116
|
+
placeName: this._options.placeName,
|
|
117
|
+
state: stateMap[this._options.context] ?? 'Edit',
|
|
118
|
+
capabilities: this._options.capabilities,
|
|
119
|
+
},
|
|
120
|
+
})
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Wait for a specific message type from the host. Returns the full message.
|
|
126
|
+
*/
|
|
127
|
+
async waitForMessageAsync(
|
|
128
|
+
type: string,
|
|
129
|
+
timeoutMs = 5_000
|
|
130
|
+
): Promise<Record<string, unknown>> {
|
|
131
|
+
return new Promise<Record<string, unknown>>((resolve, reject) => {
|
|
132
|
+
const timer = setTimeout(() => {
|
|
133
|
+
cleanup();
|
|
134
|
+
reject(
|
|
135
|
+
new Error(
|
|
136
|
+
`Timed out waiting for '${type}' message after ${timeoutMs}ms`
|
|
137
|
+
)
|
|
138
|
+
);
|
|
139
|
+
}, timeoutMs);
|
|
140
|
+
|
|
141
|
+
const handler = (msg: Record<string, unknown>) => {
|
|
142
|
+
clearTimeout(timer);
|
|
143
|
+
cleanup();
|
|
144
|
+
resolve(msg);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const cleanup = () => {
|
|
148
|
+
const handlers = this._messageHandlers.get(type);
|
|
149
|
+
if (handlers) {
|
|
150
|
+
const idx = handlers.indexOf(handler);
|
|
151
|
+
if (idx >= 0) handlers.splice(idx, 1);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
this._addHandler(type, handler);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Send a raw JSON message to the host.
|
|
161
|
+
*/
|
|
162
|
+
sendMessage(msg: Record<string, unknown>): void {
|
|
163
|
+
if (!this._ws || !this._isConnected) {
|
|
164
|
+
throw new Error('MockPluginClient is not connected');
|
|
165
|
+
}
|
|
166
|
+
this._ws.send(JSON.stringify(msg));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Register a one-time handler for a specific message type.
|
|
171
|
+
*/
|
|
172
|
+
onMessage(
|
|
173
|
+
type: string,
|
|
174
|
+
handler: (msg: Record<string, unknown>) => void
|
|
175
|
+
): void {
|
|
176
|
+
this._addHandler(type, handler);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Register a handler called for every incoming message.
|
|
181
|
+
*/
|
|
182
|
+
onAnyMessage(handler: (msg: Record<string, unknown>) => void): void {
|
|
183
|
+
this._allMessageHandlers.push(handler);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Auto-respond to action requests from the host. Sets up a handler
|
|
188
|
+
* that replies with the given response when an action of the specified
|
|
189
|
+
* type is received. The requestId is automatically copied from the
|
|
190
|
+
* incoming request.
|
|
191
|
+
*/
|
|
192
|
+
autoRespond(
|
|
193
|
+
actionType: string,
|
|
194
|
+
responseFactory: (
|
|
195
|
+
request: Record<string, unknown>
|
|
196
|
+
) => Record<string, unknown>
|
|
197
|
+
): void {
|
|
198
|
+
this.onAnyMessage((msg) => {
|
|
199
|
+
if (msg.type === actionType) {
|
|
200
|
+
const response = responseFactory(msg);
|
|
201
|
+
// Copy requestId from the incoming request
|
|
202
|
+
if (msg.requestId) {
|
|
203
|
+
response.requestId = msg.requestId;
|
|
204
|
+
}
|
|
205
|
+
if (!response.sessionId) {
|
|
206
|
+
response.sessionId = this._sessionId;
|
|
207
|
+
}
|
|
208
|
+
this.sendMessage(response);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Disconnect from the host.
|
|
215
|
+
*/
|
|
216
|
+
async disconnectAsync(): Promise<void> {
|
|
217
|
+
if (this._ws) {
|
|
218
|
+
if (
|
|
219
|
+
this._ws.readyState === WebSocket.OPEN ||
|
|
220
|
+
this._ws.readyState === WebSocket.CONNECTING
|
|
221
|
+
) {
|
|
222
|
+
this._ws.close();
|
|
223
|
+
// Wait for close to complete
|
|
224
|
+
await new Promise<void>((resolve) => {
|
|
225
|
+
this._ws!.on('close', resolve);
|
|
226
|
+
// If already closed, resolve immediately
|
|
227
|
+
if (this._ws!.readyState === WebSocket.CLOSED) {
|
|
228
|
+
resolve();
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
this._ws = undefined;
|
|
233
|
+
}
|
|
234
|
+
this._isConnected = false;
|
|
235
|
+
this._messageHandlers.clear();
|
|
236
|
+
this._allMessageHandlers = [];
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/** Whether the client is currently connected. */
|
|
240
|
+
get isConnected(): boolean {
|
|
241
|
+
return this._isConnected;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/** The auto-generated session ID for this mock plugin. */
|
|
245
|
+
get sessionId(): string {
|
|
246
|
+
return this._sessionId;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/** The instance ID. */
|
|
250
|
+
get instanceId(): string {
|
|
251
|
+
return this._options.instanceId;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Connect and send register. Returns the session ID assigned to this client.
|
|
256
|
+
*/
|
|
257
|
+
async connectAndRegisterAsync(): Promise<string> {
|
|
258
|
+
await this.connectAsync();
|
|
259
|
+
await this.sendRegisterAsync();
|
|
260
|
+
// Yield to let the host process the register before the test continues
|
|
261
|
+
await new Promise((r) => setTimeout(r, 20));
|
|
262
|
+
return this._sessionId;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
private _addHandler(
|
|
266
|
+
type: string,
|
|
267
|
+
handler: (msg: Record<string, unknown>) => void
|
|
268
|
+
): void {
|
|
269
|
+
let handlers = this._messageHandlers.get(type);
|
|
270
|
+
if (!handlers) {
|
|
271
|
+
handlers = [];
|
|
272
|
+
this._messageHandlers.set(type, handlers);
|
|
273
|
+
}
|
|
274
|
+
handlers.push(handler);
|
|
275
|
+
}
|
|
276
|
+
}
|