@quenty/studio-bridge 0.7.1 → 0.9.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 +14 -42
- 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 +119 -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 +40 -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 +171 -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 +59 -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,336 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for BridgeSession -- validates action delegation to
|
|
3
|
+
* TransportHandle, disconnect error handling, and event forwarding.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
7
|
+
import { EventEmitter } from 'events';
|
|
8
|
+
import { BridgeSession } from './bridge-session.js';
|
|
9
|
+
import type { SessionInfo } from './types.js';
|
|
10
|
+
import { SessionDisconnectedError } from './types.js';
|
|
11
|
+
import type {
|
|
12
|
+
PluginMessage,
|
|
13
|
+
ServerMessage,
|
|
14
|
+
} from '../server/web-socket-protocol.js';
|
|
15
|
+
|
|
16
|
+
// Mock loadActionSourcesAsync to return empty array so _ensureActionsAsync
|
|
17
|
+
// is a no-op in unit tests (no syncActions round-trip needed).
|
|
18
|
+
vi.mock('../commands/framework/action-loader.js', () => ({
|
|
19
|
+
loadActionSourcesAsync: vi.fn(async () => []),
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
class MockTransportHandle extends EventEmitter {
|
|
23
|
+
private _isConnected: boolean;
|
|
24
|
+
|
|
25
|
+
sendActionAsync = vi.fn(async () => ({})) as any;
|
|
26
|
+
sendMessage = vi.fn();
|
|
27
|
+
|
|
28
|
+
constructor(connected = true) {
|
|
29
|
+
super();
|
|
30
|
+
this._isConnected = connected;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
get isConnected(): boolean {
|
|
34
|
+
return this._isConnected;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
simulateDisconnect(): void {
|
|
38
|
+
this._isConnected = false;
|
|
39
|
+
this.emit('disconnected');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
simulateMessage(msg: PluginMessage): void {
|
|
43
|
+
this.emit('message', msg);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function createSessionInfo(overrides: Partial<SessionInfo> = {}): SessionInfo {
|
|
48
|
+
return {
|
|
49
|
+
sessionId: 'session-1',
|
|
50
|
+
placeName: 'TestPlace',
|
|
51
|
+
state: 'Edit',
|
|
52
|
+
pluginVersion: '1.0.0',
|
|
53
|
+
capabilities: ['execute', 'queryState'],
|
|
54
|
+
connectedAt: new Date(),
|
|
55
|
+
origin: 'user',
|
|
56
|
+
context: 'edit',
|
|
57
|
+
instanceId: 'inst-1',
|
|
58
|
+
placeId: 123,
|
|
59
|
+
gameId: 456,
|
|
60
|
+
...overrides,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
describe('BridgeSession', () => {
|
|
65
|
+
describe('properties', () => {
|
|
66
|
+
it('exposes session info', () => {
|
|
67
|
+
const info = createSessionInfo({
|
|
68
|
+
sessionId: 'my-session',
|
|
69
|
+
context: 'server',
|
|
70
|
+
});
|
|
71
|
+
const handle = new MockTransportHandle();
|
|
72
|
+
const session = new BridgeSession(info, handle);
|
|
73
|
+
|
|
74
|
+
expect(session.info.sessionId).toBe('my-session');
|
|
75
|
+
expect(session.context).toBe('server');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('reflects connection state from handle', () => {
|
|
79
|
+
const handle = new MockTransportHandle(true);
|
|
80
|
+
const session = new BridgeSession(createSessionInfo(), handle);
|
|
81
|
+
|
|
82
|
+
expect(session.isConnected).toBe(true);
|
|
83
|
+
|
|
84
|
+
handle.simulateDisconnect();
|
|
85
|
+
|
|
86
|
+
expect(session.isConnected).toBe(false);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
describe('disconnect handling', () => {
|
|
91
|
+
it('emits disconnected event when handle disconnects', () => {
|
|
92
|
+
const handle = new MockTransportHandle();
|
|
93
|
+
const session = new BridgeSession(createSessionInfo(), handle);
|
|
94
|
+
const listener = vi.fn();
|
|
95
|
+
|
|
96
|
+
session.on('disconnected', listener);
|
|
97
|
+
handle.simulateDisconnect();
|
|
98
|
+
|
|
99
|
+
expect(listener).toHaveBeenCalledTimes(1);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('throws SessionDisconnectedError when action called after disconnect', async () => {
|
|
103
|
+
const handle = new MockTransportHandle(false);
|
|
104
|
+
const session = new BridgeSession(
|
|
105
|
+
createSessionInfo({ sessionId: 'disc-session' }),
|
|
106
|
+
handle
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
await expect(session.execAsync('print("hi")')).rejects.toThrow(
|
|
110
|
+
SessionDisconnectedError
|
|
111
|
+
);
|
|
112
|
+
await expect(session.queryStateAsync()).rejects.toThrow(
|
|
113
|
+
SessionDisconnectedError
|
|
114
|
+
);
|
|
115
|
+
await expect(session.captureScreenshotAsync()).rejects.toThrow(
|
|
116
|
+
SessionDisconnectedError
|
|
117
|
+
);
|
|
118
|
+
await expect(session.queryLogsAsync()).rejects.toThrow(
|
|
119
|
+
SessionDisconnectedError
|
|
120
|
+
);
|
|
121
|
+
await expect(
|
|
122
|
+
session.queryDataModelAsync({ path: 'game' })
|
|
123
|
+
).rejects.toThrow(SessionDisconnectedError);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
describe('execAsync', () => {
|
|
128
|
+
it('delegates to handle.sendActionAsync with execute message', async () => {
|
|
129
|
+
const handle = new MockTransportHandle();
|
|
130
|
+
handle.sendActionAsync.mockResolvedValueOnce({
|
|
131
|
+
type: 'scriptComplete',
|
|
132
|
+
sessionId: 'session-1',
|
|
133
|
+
payload: { success: true },
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const session = new BridgeSession(createSessionInfo(), handle);
|
|
137
|
+
const result = await session.execAsync('print("hello")');
|
|
138
|
+
|
|
139
|
+
expect(handle.sendActionAsync).toHaveBeenCalledTimes(1);
|
|
140
|
+
const [msg, timeout] = handle.sendActionAsync.mock.calls[0];
|
|
141
|
+
expect((msg as ServerMessage).type).toBe('execute');
|
|
142
|
+
expect((msg as any).payload.script).toBe('print("hello")');
|
|
143
|
+
expect(timeout).toBe(120_000);
|
|
144
|
+
|
|
145
|
+
expect(result.success).toBe(true);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('uses custom timeout when provided', async () => {
|
|
149
|
+
const handle = new MockTransportHandle();
|
|
150
|
+
handle.sendActionAsync.mockResolvedValueOnce({
|
|
151
|
+
type: 'scriptComplete',
|
|
152
|
+
sessionId: 'session-1',
|
|
153
|
+
payload: { success: true },
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
const session = new BridgeSession(createSessionInfo(), handle);
|
|
157
|
+
await session.execAsync('print("hello")', 5_000);
|
|
158
|
+
|
|
159
|
+
const [, timeout] = handle.sendActionAsync.mock.calls[0];
|
|
160
|
+
expect(timeout).toBe(5_000);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it('returns error info from error response', async () => {
|
|
164
|
+
const handle = new MockTransportHandle();
|
|
165
|
+
handle.sendActionAsync.mockResolvedValueOnce({
|
|
166
|
+
type: 'error',
|
|
167
|
+
sessionId: 'session-1',
|
|
168
|
+
payload: { code: 'SCRIPT_RUNTIME_ERROR', message: 'boom' },
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
const session = new BridgeSession(createSessionInfo(), handle);
|
|
172
|
+
const result = await session.execAsync('error("boom")');
|
|
173
|
+
|
|
174
|
+
expect(result.success).toBe(false);
|
|
175
|
+
expect(result.error).toBe('boom');
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
describe('queryStateAsync', () => {
|
|
180
|
+
it('returns state result from handle response', async () => {
|
|
181
|
+
const handle = new MockTransportHandle();
|
|
182
|
+
handle.sendActionAsync.mockResolvedValueOnce({
|
|
183
|
+
type: 'stateResult',
|
|
184
|
+
sessionId: 'session-1',
|
|
185
|
+
requestId: 'r-1',
|
|
186
|
+
payload: {
|
|
187
|
+
state: 'Play',
|
|
188
|
+
placeId: 100,
|
|
189
|
+
placeName: 'Test',
|
|
190
|
+
gameId: 200,
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
const session = new BridgeSession(createSessionInfo(), handle);
|
|
195
|
+
const result = await session.queryStateAsync();
|
|
196
|
+
|
|
197
|
+
expect(result.state).toBe('Play');
|
|
198
|
+
expect(result.placeId).toBe(100);
|
|
199
|
+
expect(result.placeName).toBe('Test');
|
|
200
|
+
expect(result.gameId).toBe(200);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it('sends queryState message type', async () => {
|
|
204
|
+
const handle = new MockTransportHandle();
|
|
205
|
+
handle.sendActionAsync.mockResolvedValueOnce({
|
|
206
|
+
type: 'stateResult',
|
|
207
|
+
sessionId: 'session-1',
|
|
208
|
+
requestId: 'r-1',
|
|
209
|
+
payload: { state: 'Edit', placeId: 0, placeName: 'Test', gameId: 0 },
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
const session = new BridgeSession(createSessionInfo(), handle);
|
|
213
|
+
await session.queryStateAsync();
|
|
214
|
+
|
|
215
|
+
const [msg] = handle.sendActionAsync.mock.calls[0];
|
|
216
|
+
expect((msg as ServerMessage).type).toBe('queryState');
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
describe('captureScreenshotAsync', () => {
|
|
221
|
+
it('returns screenshot result', async () => {
|
|
222
|
+
const handle = new MockTransportHandle();
|
|
223
|
+
handle.sendActionAsync.mockResolvedValueOnce({
|
|
224
|
+
type: 'screenshotResult',
|
|
225
|
+
sessionId: 'session-1',
|
|
226
|
+
requestId: 'r-1',
|
|
227
|
+
payload: { data: 'base64data', format: 'png', width: 800, height: 600 },
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
const session = new BridgeSession(createSessionInfo(), handle);
|
|
231
|
+
const result = await session.captureScreenshotAsync();
|
|
232
|
+
|
|
233
|
+
expect(result.data).toBe('base64data');
|
|
234
|
+
expect(result.format).toBe('png');
|
|
235
|
+
expect(result.width).toBe(800);
|
|
236
|
+
expect(result.height).toBe(600);
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
describe('queryLogsAsync', () => {
|
|
241
|
+
it('returns logs result', async () => {
|
|
242
|
+
const handle = new MockTransportHandle();
|
|
243
|
+
handle.sendActionAsync.mockResolvedValueOnce({
|
|
244
|
+
type: 'logsResult',
|
|
245
|
+
sessionId: 'session-1',
|
|
246
|
+
requestId: 'r-1',
|
|
247
|
+
payload: {
|
|
248
|
+
entries: [{ level: 'Print', body: 'hello', timestamp: 12345 }],
|
|
249
|
+
total: 1,
|
|
250
|
+
bufferCapacity: 1000,
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
const session = new BridgeSession(createSessionInfo(), handle);
|
|
255
|
+
const result = await session.queryLogsAsync({
|
|
256
|
+
count: 10,
|
|
257
|
+
direction: 'tail',
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
expect(result.entries).toHaveLength(1);
|
|
261
|
+
expect(result.total).toBe(1);
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
it('passes options to payload', async () => {
|
|
265
|
+
const handle = new MockTransportHandle();
|
|
266
|
+
handle.sendActionAsync.mockResolvedValueOnce({
|
|
267
|
+
type: 'logsResult',
|
|
268
|
+
sessionId: 'session-1',
|
|
269
|
+
requestId: 'r-1',
|
|
270
|
+
payload: { entries: [], total: 0, bufferCapacity: 1000 },
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
const session = new BridgeSession(createSessionInfo(), handle);
|
|
274
|
+
await session.queryLogsAsync({ count: 5, levels: ['Error', 'Warning'] });
|
|
275
|
+
|
|
276
|
+
const [msg] = handle.sendActionAsync.mock.calls[0];
|
|
277
|
+
expect((msg as any).payload.count).toBe(5);
|
|
278
|
+
expect((msg as any).payload.levels).toEqual(['Error', 'Warning']);
|
|
279
|
+
});
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
describe('queryDataModelAsync', () => {
|
|
283
|
+
it('returns data model result', async () => {
|
|
284
|
+
const handle = new MockTransportHandle();
|
|
285
|
+
handle.sendActionAsync.mockResolvedValueOnce({
|
|
286
|
+
type: 'dataModelResult',
|
|
287
|
+
sessionId: 'session-1',
|
|
288
|
+
requestId: 'r-1',
|
|
289
|
+
payload: {
|
|
290
|
+
instance: {
|
|
291
|
+
name: 'Workspace',
|
|
292
|
+
className: 'Workspace',
|
|
293
|
+
path: 'game.Workspace',
|
|
294
|
+
properties: {},
|
|
295
|
+
attributes: {},
|
|
296
|
+
childCount: 5,
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
const session = new BridgeSession(createSessionInfo(), handle);
|
|
302
|
+
const result = await session.queryDataModelAsync({
|
|
303
|
+
path: 'game.Workspace',
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
expect(result.instance.name).toBe('Workspace');
|
|
307
|
+
expect(result.instance.className).toBe('Workspace');
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
describe('state change events', () => {
|
|
312
|
+
it('emits state-changed and updates info on stateChange message', () => {
|
|
313
|
+
const handle = new MockTransportHandle();
|
|
314
|
+
const session = new BridgeSession(
|
|
315
|
+
createSessionInfo({ state: 'Edit' }),
|
|
316
|
+
handle
|
|
317
|
+
);
|
|
318
|
+
const listener = vi.fn();
|
|
319
|
+
|
|
320
|
+
session.on('state-changed', listener);
|
|
321
|
+
|
|
322
|
+
handle.simulateMessage({
|
|
323
|
+
type: 'stateChange',
|
|
324
|
+
sessionId: 'session-1',
|
|
325
|
+
payload: {
|
|
326
|
+
previousState: 'Edit',
|
|
327
|
+
newState: 'Play',
|
|
328
|
+
timestamp: Date.now(),
|
|
329
|
+
},
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
expect(listener).toHaveBeenCalledWith('Play');
|
|
333
|
+
expect(session.info.state).toBe('Play');
|
|
334
|
+
});
|
|
335
|
+
});
|
|
336
|
+
});
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public session handle that delegates to a TransportHandle. Provides
|
|
3
|
+
* typed action methods for interacting with a connected Studio plugin.
|
|
4
|
+
* Works identically whether backed by a direct WebSocket connection
|
|
5
|
+
* (host) or a relayed connection through the host (client).
|
|
6
|
+
*
|
|
7
|
+
* Consumers get BridgeSession instances from BridgeConnection -- they
|
|
8
|
+
* never construct them directly.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { randomUUID } from 'crypto';
|
|
12
|
+
import { EventEmitter } from 'events';
|
|
13
|
+
import type { TransportHandle } from './internal/session-tracker.js';
|
|
14
|
+
import type {
|
|
15
|
+
SessionInfo,
|
|
16
|
+
SessionContext,
|
|
17
|
+
ExecResult,
|
|
18
|
+
StateResult,
|
|
19
|
+
ScreenshotResult,
|
|
20
|
+
LogsResult,
|
|
21
|
+
DataModelResult,
|
|
22
|
+
LogOptions,
|
|
23
|
+
QueryDataModelOptions,
|
|
24
|
+
} from './types.js';
|
|
25
|
+
import { SessionDisconnectedError } from './types.js';
|
|
26
|
+
import type {
|
|
27
|
+
PluginMessage,
|
|
28
|
+
OutputLevel,
|
|
29
|
+
} from '../server/web-socket-protocol.js';
|
|
30
|
+
import {
|
|
31
|
+
loadActionSourcesAsync,
|
|
32
|
+
type ActionSource,
|
|
33
|
+
} from '../commands/framework/action-loader.js';
|
|
34
|
+
import { OutputHelper } from '@quenty/cli-output-helpers';
|
|
35
|
+
|
|
36
|
+
const DEFAULT_TIMEOUTS: Record<string, number> = {
|
|
37
|
+
execute: 120_000,
|
|
38
|
+
queryState: 5_000,
|
|
39
|
+
captureScreenshot: 30_000,
|
|
40
|
+
queryDataModel: 10_000,
|
|
41
|
+
queryLogs: 10_000,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Build a descriptive error from a plugin response that didn't match the
|
|
46
|
+
* expected type. Extracts error details from error-typed responses.
|
|
47
|
+
*/
|
|
48
|
+
function pluginError(expectedType: string, result: PluginMessage): Error {
|
|
49
|
+
if (result.type === 'error') {
|
|
50
|
+
const code = result.payload?.code ?? 'UNKNOWN';
|
|
51
|
+
const message = result.payload?.message ?? 'Unknown plugin error';
|
|
52
|
+
return new Error(`Plugin error (${code}): ${message}`);
|
|
53
|
+
}
|
|
54
|
+
return new Error(
|
|
55
|
+
`Expected '${expectedType}' response from plugin, got '${result.type}'`
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export class BridgeSession extends EventEmitter {
|
|
60
|
+
private _info: SessionInfo;
|
|
61
|
+
private _handle: TransportHandle;
|
|
62
|
+
private _actionsReady = false;
|
|
63
|
+
private _actionSources: ActionSource[] | undefined;
|
|
64
|
+
|
|
65
|
+
constructor(info: SessionInfo, handle: TransportHandle) {
|
|
66
|
+
super();
|
|
67
|
+
this._info = info;
|
|
68
|
+
this._handle = handle;
|
|
69
|
+
|
|
70
|
+
this._handle.on('disconnected', () => {
|
|
71
|
+
this.emit('disconnected');
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
this._handle.on('message', (msg: PluginMessage) => {
|
|
75
|
+
if (msg.type === 'stateChange') {
|
|
76
|
+
this._info = { ...this._info, state: msg.payload.newState };
|
|
77
|
+
this.emit('state-changed', msg.payload.newState);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Read-only metadata about this session. */
|
|
83
|
+
get info(): SessionInfo {
|
|
84
|
+
return this._info;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Which Studio VM this session represents (edit, client, or server). */
|
|
88
|
+
get context(): SessionContext {
|
|
89
|
+
return this._info.context;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Whether the session's plugin is still connected. */
|
|
93
|
+
get isConnected(): boolean {
|
|
94
|
+
return this._handle.isConnected;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async execAsync(code: string, timeout?: number): Promise<ExecResult> {
|
|
98
|
+
this._assertConnected();
|
|
99
|
+
await this._ensureActionsAsync();
|
|
100
|
+
|
|
101
|
+
const timeoutMs = timeout ?? DEFAULT_TIMEOUTS.execute;
|
|
102
|
+
const result = await this._handle.sendActionAsync<PluginMessage>(
|
|
103
|
+
{
|
|
104
|
+
type: 'execute',
|
|
105
|
+
sessionId: this._info.sessionId,
|
|
106
|
+
requestId: randomUUID(),
|
|
107
|
+
payload: { script: code },
|
|
108
|
+
},
|
|
109
|
+
timeoutMs
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
if (result.type === 'scriptComplete') {
|
|
113
|
+
const output = (result.payload.output ?? []).map((entry) => ({
|
|
114
|
+
level: entry.level as OutputLevel,
|
|
115
|
+
body: entry.body,
|
|
116
|
+
}));
|
|
117
|
+
return {
|
|
118
|
+
success: result.payload.success,
|
|
119
|
+
output,
|
|
120
|
+
error: result.payload.error,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (result.type === 'error') {
|
|
125
|
+
return {
|
|
126
|
+
success: false,
|
|
127
|
+
output: [],
|
|
128
|
+
error: result.payload?.message ?? 'Unknown plugin error',
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return {
|
|
133
|
+
success: false,
|
|
134
|
+
output: [],
|
|
135
|
+
error: pluginError('scriptComplete', result).message,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
async queryStateAsync(): Promise<StateResult> {
|
|
140
|
+
this._assertConnected();
|
|
141
|
+
await this._ensureActionsAsync();
|
|
142
|
+
|
|
143
|
+
const timeoutMs = DEFAULT_TIMEOUTS.queryState;
|
|
144
|
+
const result = await this._handle.sendActionAsync<PluginMessage>(
|
|
145
|
+
{
|
|
146
|
+
type: 'queryState',
|
|
147
|
+
sessionId: this._info.sessionId,
|
|
148
|
+
requestId: randomUUID(),
|
|
149
|
+
payload: {} as Record<string, never>,
|
|
150
|
+
},
|
|
151
|
+
timeoutMs
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
if (result.type === 'stateResult') {
|
|
155
|
+
return {
|
|
156
|
+
state: result.payload.state,
|
|
157
|
+
placeId: result.payload.placeId,
|
|
158
|
+
placeName: result.payload.placeName,
|
|
159
|
+
gameId: result.payload.gameId,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
throw pluginError('stateResult', result);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async captureScreenshotAsync(): Promise<ScreenshotResult> {
|
|
167
|
+
this._assertConnected();
|
|
168
|
+
await this._ensureActionsAsync();
|
|
169
|
+
|
|
170
|
+
const timeoutMs = DEFAULT_TIMEOUTS.captureScreenshot;
|
|
171
|
+
const result = await this._handle.sendActionAsync<PluginMessage>(
|
|
172
|
+
{
|
|
173
|
+
type: 'captureScreenshot',
|
|
174
|
+
sessionId: this._info.sessionId,
|
|
175
|
+
requestId: randomUUID(),
|
|
176
|
+
payload: { format: 'png' },
|
|
177
|
+
},
|
|
178
|
+
timeoutMs
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
if (result.type === 'screenshotResult') {
|
|
182
|
+
return {
|
|
183
|
+
data: result.payload.data,
|
|
184
|
+
format: result.payload.format,
|
|
185
|
+
width: result.payload.width,
|
|
186
|
+
height: result.payload.height,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
throw pluginError('screenshotResult', result);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
async queryLogsAsync(options?: LogOptions): Promise<LogsResult> {
|
|
194
|
+
this._assertConnected();
|
|
195
|
+
await this._ensureActionsAsync();
|
|
196
|
+
|
|
197
|
+
const timeoutMs = DEFAULT_TIMEOUTS.queryLogs;
|
|
198
|
+
const result = await this._handle.sendActionAsync<PluginMessage>(
|
|
199
|
+
{
|
|
200
|
+
type: 'queryLogs',
|
|
201
|
+
sessionId: this._info.sessionId,
|
|
202
|
+
requestId: randomUUID(),
|
|
203
|
+
payload: {
|
|
204
|
+
count: options?.count,
|
|
205
|
+
direction: options?.direction,
|
|
206
|
+
levels: options?.levels,
|
|
207
|
+
includeInternal: options?.includeInternal,
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
timeoutMs
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
if (result.type === 'logsResult') {
|
|
214
|
+
return {
|
|
215
|
+
entries: result.payload.entries,
|
|
216
|
+
total: result.payload.total,
|
|
217
|
+
bufferCapacity: result.payload.bufferCapacity,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
throw pluginError('logsResult', result);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
async queryDataModelAsync(
|
|
225
|
+
options: QueryDataModelOptions
|
|
226
|
+
): Promise<DataModelResult> {
|
|
227
|
+
this._assertConnected();
|
|
228
|
+
await this._ensureActionsAsync();
|
|
229
|
+
|
|
230
|
+
const timeoutMs = DEFAULT_TIMEOUTS.queryDataModel;
|
|
231
|
+
const result = await this._handle.sendActionAsync<PluginMessage>(
|
|
232
|
+
{
|
|
233
|
+
type: 'queryDataModel',
|
|
234
|
+
sessionId: this._info.sessionId,
|
|
235
|
+
requestId: randomUUID(),
|
|
236
|
+
payload: {
|
|
237
|
+
path: options.path,
|
|
238
|
+
depth: options.depth,
|
|
239
|
+
properties: options.properties,
|
|
240
|
+
includeAttributes: options.includeAttributes,
|
|
241
|
+
find: options.find,
|
|
242
|
+
listServices: options.listServices,
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
timeoutMs
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
if (result.type === 'dataModelResult') {
|
|
249
|
+
return {
|
|
250
|
+
instance: result.payload.instance,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
throw pluginError('dataModelResult', result);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
private _assertConnected(): void {
|
|
258
|
+
if (!this._handle.isConnected) {
|
|
259
|
+
throw new SessionDisconnectedError(this._info.sessionId);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Ensure action modules are synced to the plugin before first use.
|
|
265
|
+
* Uses syncActions to determine which actions need updating, then
|
|
266
|
+
* registers only those that are missing or have changed hashes.
|
|
267
|
+
*/
|
|
268
|
+
private async _ensureActionsAsync(): Promise<void> {
|
|
269
|
+
if (this._actionsReady) return;
|
|
270
|
+
|
|
271
|
+
// Lazy-load action sources from this process's disk
|
|
272
|
+
if (!this._actionSources) {
|
|
273
|
+
this._actionSources = await loadActionSourcesAsync();
|
|
274
|
+
OutputHelper.verbose(
|
|
275
|
+
`[actions] Loaded ${this._actionSources.length} action source(s): ${
|
|
276
|
+
this._actionSources.map((a) => a.name).join(', ') || '(none)'
|
|
277
|
+
}`
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (this._actionSources.length === 0) {
|
|
282
|
+
OutputHelper.verbose('[actions] No action sources found — skipping sync');
|
|
283
|
+
this._actionsReady = true;
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const actions: Record<string, string> = {};
|
|
288
|
+
for (const action of this._actionSources) {
|
|
289
|
+
actions[action.name] = action.hash;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
OutputHelper.verbose(
|
|
293
|
+
`[actions] Sending syncActions (${
|
|
294
|
+
Object.keys(actions).length
|
|
295
|
+
} hashes) to session ${this._info.sessionId}`
|
|
296
|
+
);
|
|
297
|
+
const syncResult = await this._handle.sendActionAsync<PluginMessage>(
|
|
298
|
+
{
|
|
299
|
+
type: 'syncActions',
|
|
300
|
+
sessionId: this._info.sessionId,
|
|
301
|
+
requestId: randomUUID(),
|
|
302
|
+
payload: { actions },
|
|
303
|
+
},
|
|
304
|
+
10_000
|
|
305
|
+
);
|
|
306
|
+
|
|
307
|
+
if (syncResult.type === 'syncActionsResult') {
|
|
308
|
+
const needed = syncResult.payload.needed as string[];
|
|
309
|
+
OutputHelper.verbose(
|
|
310
|
+
`[actions] syncActions response: ${
|
|
311
|
+
needed.length
|
|
312
|
+
} action(s) need updating${
|
|
313
|
+
needed.length > 0 ? ': ' + needed.join(', ') : ''
|
|
314
|
+
}`
|
|
315
|
+
);
|
|
316
|
+
|
|
317
|
+
for (const actionName of needed) {
|
|
318
|
+
const action = this._actionSources.find((a) => a.name === actionName);
|
|
319
|
+
if (!action) continue;
|
|
320
|
+
|
|
321
|
+
OutputHelper.verbose(`[actions] Registering action: ${actionName}`);
|
|
322
|
+
const regResult = await this._handle.sendActionAsync<PluginMessage>(
|
|
323
|
+
{
|
|
324
|
+
type: 'registerAction',
|
|
325
|
+
sessionId: this._info.sessionId,
|
|
326
|
+
requestId: randomUUID(),
|
|
327
|
+
payload: {
|
|
328
|
+
name: action.name,
|
|
329
|
+
source: action.source,
|
|
330
|
+
hash: action.hash,
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
10_000
|
|
334
|
+
);
|
|
335
|
+
if (regResult.type === 'registerActionResult') {
|
|
336
|
+
const p = regResult.payload;
|
|
337
|
+
OutputHelper.verbose(
|
|
338
|
+
`[actions] ${actionName}: ${
|
|
339
|
+
p.success
|
|
340
|
+
? p.skipped
|
|
341
|
+
? 'skipped (same hash)'
|
|
342
|
+
: 'registered'
|
|
343
|
+
: `FAILED: ${p.error}`
|
|
344
|
+
}`
|
|
345
|
+
);
|
|
346
|
+
} else if (regResult.type === 'error') {
|
|
347
|
+
OutputHelper.verbose(
|
|
348
|
+
`[actions] ${actionName}: plugin error: ${
|
|
349
|
+
(regResult as any).payload?.message ?? regResult.type
|
|
350
|
+
}`
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
} else {
|
|
355
|
+
OutputHelper.verbose(
|
|
356
|
+
`[actions] syncActions returned unexpected type '${
|
|
357
|
+
syncResult.type
|
|
358
|
+
}': ${JSON.stringify((syncResult as any).payload ?? {}).slice(0, 200)}`
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
this._actionsReady = true;
|
|
363
|
+
OutputHelper.verbose('[actions] Action sync complete');
|
|
364
|
+
}
|
|
365
|
+
}
|