@quenty/studio-bridge 0.7.1 → 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 +12 -44
- 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
|
@@ -1,83 +1,188 @@
|
|
|
1
1
|
--[[
|
|
2
|
-
StudioBridge plugin —
|
|
2
|
+
StudioBridge unified plugin entry point — Layer 2 Roblox glue.
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
Supports two boot modes:
|
|
5
|
+
- Ephemeral: build constants substituted by the CLI, connects directly.
|
|
6
|
+
- Persistent: template strings intact, uses DiscoveryStateMachine to
|
|
7
|
+
scan ports and auto-connect to a running studio-bridge server.
|
|
8
|
+
|
|
9
|
+
All protocol logic, state machine logic, action routing, and message
|
|
10
|
+
buffering live in Layer 1 modules under Shared/. This file is thin
|
|
11
|
+
glue that wires those modules to Roblox services.
|
|
7
12
|
]]
|
|
8
13
|
|
|
9
14
|
local HttpService = game:GetService("HttpService")
|
|
10
15
|
local LogService = game:GetService("LogService")
|
|
11
16
|
local RunService = game:GetService("RunService")
|
|
12
|
-
local Workspace = game:GetService("Workspace")
|
|
13
17
|
|
|
18
|
+
-- Layer 1 modules (pure logic, no Roblox deps)
|
|
19
|
+
local ActionRouter = require(script.Parent.Shared.ActionRouter)
|
|
20
|
+
local DiscoveryStateMachine = require(script.Parent.Shared.DiscoveryStateMachine)
|
|
21
|
+
local MessageBuffer = require(script.Parent.Shared.MessageBuffer)
|
|
22
|
+
|
|
23
|
+
-- Actions are pushed dynamically over the wire via registerAction.
|
|
24
|
+
-- No static action requires needed.
|
|
25
|
+
|
|
26
|
+
-- Build constants (Handlebars templates substituted at build time)
|
|
14
27
|
local PORT = "{{PORT}}"
|
|
15
28
|
local SESSION_ID = "{{SESSION_ID}}"
|
|
29
|
+
local IS_EPHEMERAL = ("{{EPHEMERAL}}" == "true")
|
|
16
30
|
|
|
17
|
-
-- Only run inside Studio
|
|
31
|
+
-- Only run inside Studio edit context. Plugin instances spawned by play
|
|
32
|
+
-- mode (client/server) cannot make HTTP requests, so they cannot discover
|
|
33
|
+
-- the bridge. The edit-context instance stays alive during play mode.
|
|
18
34
|
if not RunService:IsStudio() or RunService:IsRunning() then
|
|
19
35
|
return
|
|
20
36
|
end
|
|
21
37
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
38
|
+
-- ---------------------------------------------------------------------------
|
|
39
|
+
-- Context detection
|
|
40
|
+
-- ---------------------------------------------------------------------------
|
|
41
|
+
|
|
42
|
+
local function detectContext()
|
|
43
|
+
if RunService:IsRunning() then
|
|
44
|
+
if RunService:IsClient() then
|
|
45
|
+
return "client"
|
|
46
|
+
else
|
|
47
|
+
return "server"
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
return "edit"
|
|
25
51
|
end
|
|
26
52
|
|
|
27
|
-
|
|
53
|
+
-- ---------------------------------------------------------------------------
|
|
54
|
+
-- Instance / session ID helpers
|
|
55
|
+
-- ---------------------------------------------------------------------------
|
|
56
|
+
|
|
57
|
+
-- Short unique nonce for disambiguating unpublished places with the same name.
|
|
58
|
+
-- Generated once per plugin lifecycle so the session ID stays stable across reconnects.
|
|
59
|
+
local _nonce: string = string.sub(HttpService:GenerateGUID(false), 1, 8)
|
|
60
|
+
|
|
61
|
+
local function getInstanceId()
|
|
62
|
+
if game.GameId ~= 0 or game.PlaceId ~= 0 then
|
|
63
|
+
return `{game.GameId}-{game.PlaceId}`
|
|
64
|
+
end
|
|
65
|
+
-- Unpublished place: use sanitized place name + nonce for uniqueness
|
|
66
|
+
local name = string.lower(game.Name or "untitled")
|
|
67
|
+
name = string.gsub(name, "%s+", "-")
|
|
68
|
+
name = string.gsub(name, "[^%w%-]", "")
|
|
69
|
+
if name == "" then
|
|
70
|
+
name = "untitled"
|
|
71
|
+
end
|
|
72
|
+
return `local-{name}-{_nonce}`
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
local function getSessionId()
|
|
76
|
+
return `{getInstanceId()}-{detectContext()}`
|
|
77
|
+
end
|
|
28
78
|
|
|
29
79
|
-- ---------------------------------------------------------------------------
|
|
30
|
-
--
|
|
80
|
+
-- JSON helpers (HttpService wrappers for Roblox environment)
|
|
31
81
|
-- ---------------------------------------------------------------------------
|
|
32
82
|
|
|
33
83
|
local function jsonEncode(tbl)
|
|
34
84
|
return HttpService:JSONEncode(tbl)
|
|
35
85
|
end
|
|
36
86
|
|
|
37
|
-
local function jsonDecode(
|
|
38
|
-
local ok, result = pcall(
|
|
39
|
-
return HttpService:JSONDecode(str)
|
|
40
|
-
end)
|
|
87
|
+
local function jsonDecode(raw)
|
|
88
|
+
local ok, result = pcall(HttpService.JSONDecode, HttpService, raw)
|
|
41
89
|
if ok then
|
|
42
90
|
return result
|
|
43
91
|
end
|
|
44
92
|
return nil
|
|
45
93
|
end
|
|
46
94
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
95
|
+
-- ---------------------------------------------------------------------------
|
|
96
|
+
-- Shared state
|
|
97
|
+
-- ---------------------------------------------------------------------------
|
|
98
|
+
|
|
99
|
+
local router = ActionRouter.new()
|
|
100
|
+
local logBuffer = MessageBuffer.new(1000)
|
|
101
|
+
|
|
102
|
+
-- Pre-load the PNG encoder and expose it to dynamically loaded actions
|
|
103
|
+
-- via router._vendorPng. The screenshot action reads this in its register().
|
|
104
|
+
local _pngOk, _pngModule = pcall(function()
|
|
105
|
+
return require(script.Parent.Vendor.png)
|
|
106
|
+
end)
|
|
107
|
+
if _pngOk and _pngModule then
|
|
108
|
+
router._vendorPng = _pngModule
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
-- Wire outgoing messages (set after WebSocket is connected)
|
|
112
|
+
local sendMessageFn = nil
|
|
113
|
+
|
|
114
|
+
-- Callback that forwards messages through the active WebSocket
|
|
115
|
+
local function sendMessage(msg)
|
|
116
|
+
if sendMessageFn then
|
|
117
|
+
sendMessageFn(msg)
|
|
57
118
|
end
|
|
58
119
|
end
|
|
59
120
|
|
|
60
|
-
--
|
|
61
|
-
--
|
|
62
|
-
|
|
121
|
+
-- Register the built-in registerAction handler. This allows the bridge
|
|
122
|
+
-- server to push Luau action modules over the wire after a plugin connects.
|
|
123
|
+
router:register("registerAction", function(payload, requestId, sessionId)
|
|
124
|
+
local name = payload.name
|
|
125
|
+
local source = payload.source
|
|
126
|
+
local responseType = payload.responseType
|
|
127
|
+
local hash = payload.hash -- optional content hash for skip-on-same-hash
|
|
128
|
+
|
|
129
|
+
if type(name) ~= "string" or type(source) ~= "string" then
|
|
130
|
+
return {
|
|
131
|
+
name = name or "unknown",
|
|
132
|
+
success = false,
|
|
133
|
+
error = "Invalid registerAction payload: name and source are required strings",
|
|
134
|
+
}
|
|
135
|
+
end
|
|
63
136
|
|
|
64
|
-
|
|
65
|
-
|
|
137
|
+
-- Check for hash-based skip before full registration
|
|
138
|
+
if type(hash) == "string" and router._actions[name] and router._actions[name].hash == hash then
|
|
139
|
+
return {
|
|
140
|
+
name = name,
|
|
141
|
+
success = true,
|
|
142
|
+
skipped = true,
|
|
143
|
+
hash = hash,
|
|
144
|
+
handlers = router._actions[name].handlerNames,
|
|
145
|
+
}
|
|
146
|
+
end
|
|
66
147
|
|
|
67
|
-
local
|
|
68
|
-
|
|
69
|
-
|
|
148
|
+
local success, err = router:registerAction(name, source, sendMessage, logBuffer, responseType, hash)
|
|
149
|
+
|
|
150
|
+
-- Build response with handler list from _actions if available
|
|
151
|
+
local handlers = {}
|
|
152
|
+
if success and router._actions[name] then
|
|
153
|
+
handlers = router._actions[name].handlerNames
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
return {
|
|
157
|
+
name = name,
|
|
158
|
+
success = success,
|
|
159
|
+
skipped = false,
|
|
160
|
+
hash = hash,
|
|
161
|
+
handlers = handlers,
|
|
162
|
+
error = err,
|
|
163
|
+
}
|
|
164
|
+
end)
|
|
165
|
+
router:setResponseType("registerAction", "registerActionResult")
|
|
166
|
+
|
|
167
|
+
-- Register the built-in syncActions handler. This allows the bridge server
|
|
168
|
+
-- to query which actions need updating by comparing content hashes.
|
|
169
|
+
router:register("syncActions", function(payload, requestId, sessionId)
|
|
170
|
+
local clientActions = payload.actions or {}
|
|
171
|
+
local installed = router:getInstalledActions()
|
|
172
|
+
local needed = {}
|
|
173
|
+
|
|
174
|
+
for name, clientHash in clientActions do
|
|
175
|
+
if installed[name] ~= clientHash then
|
|
176
|
+
table.insert(needed, name)
|
|
177
|
+
end
|
|
70
178
|
end
|
|
71
179
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
bufferLock = false
|
|
180
|
+
return { needed = needed, installed = installed }
|
|
181
|
+
end)
|
|
182
|
+
router:setResponseType("syncActions", "syncActionsResult")
|
|
76
183
|
|
|
77
|
-
|
|
78
|
-
end
|
|
184
|
+
local connected = false
|
|
79
185
|
|
|
80
|
-
-- Map Roblox MessageType enum to string levels
|
|
81
186
|
local LEVEL_MAP = {
|
|
82
187
|
[Enum.MessageType.MessageOutput] = "Print",
|
|
83
188
|
[Enum.MessageType.MessageInfo] = "Info",
|
|
@@ -85,124 +190,250 @@ local LEVEL_MAP = {
|
|
|
85
190
|
[Enum.MessageType.MessageError] = "Error",
|
|
86
191
|
}
|
|
87
192
|
|
|
88
|
-
--
|
|
89
|
-
|
|
90
|
-
|
|
193
|
+
-- Hybrid clock: os.time() for absolute wall-clock, os.clock() deltas for sub-second precision
|
|
194
|
+
local clockBase = os.clock()
|
|
195
|
+
local timeBase = os.time()
|
|
91
196
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if
|
|
95
|
-
send(client, "scriptComplete", {
|
|
96
|
-
success = false,
|
|
97
|
-
error = "loadstring failed: " .. tostring(loadErr),
|
|
98
|
-
})
|
|
197
|
+
-- Capture logs from the moment the plugin loads, regardless of WebSocket state
|
|
198
|
+
LogService.MessageOut:Connect(function(message, messageType)
|
|
199
|
+
if string.sub(message, 1, 14) == "[StudioBridge]" then
|
|
99
200
|
return
|
|
100
201
|
end
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
task.wait(0.2)
|
|
106
|
-
flushOutput(client)
|
|
107
|
-
|
|
108
|
-
send(client, "scriptComplete", {
|
|
109
|
-
success = ok,
|
|
110
|
-
error = if ok then nil else tostring(runErr),
|
|
202
|
+
logBuffer:push({
|
|
203
|
+
level = LEVEL_MAP[messageType] or "Print",
|
|
204
|
+
body = message,
|
|
205
|
+
timestamp = timeBase + (os.clock() - clockBase),
|
|
111
206
|
})
|
|
112
|
-
end
|
|
207
|
+
end)
|
|
113
208
|
|
|
114
209
|
-- ---------------------------------------------------------------------------
|
|
115
|
-
-- WebSocket connection
|
|
210
|
+
-- Wire a WebSocket connection
|
|
116
211
|
-- ---------------------------------------------------------------------------
|
|
117
212
|
|
|
118
|
-
local function
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
local ok, err = pcall(function()
|
|
122
|
-
client = HttpService:CreateWebStreamClient(Enum.WebStreamClientType.WebSocket, { Url = WS_URL })
|
|
123
|
-
end)
|
|
213
|
+
local function wireConnection(ws, sessionId, connectLabel)
|
|
214
|
+
connected = true
|
|
124
215
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
216
|
+
-- Wire the sendMessage callback for action handlers
|
|
217
|
+
sendMessageFn = function(msg)
|
|
218
|
+
pcall(function()
|
|
219
|
+
ws:Send(jsonEncode(msg))
|
|
220
|
+
end)
|
|
128
221
|
end
|
|
129
222
|
|
|
130
|
-
--
|
|
131
|
-
--
|
|
132
|
-
--
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
223
|
+
-- Send register message. The plugin only runs in edit context (the
|
|
224
|
+
-- early-return at top of file rejects play-mode instances), so state
|
|
225
|
+
-- is always "Edit". Capabilities include the dynamically-dispatchable
|
|
226
|
+
-- actions — the bridge pushes their source via registerAction after
|
|
227
|
+
-- this register completes, but the plugin is capable of handling any
|
|
228
|
+
-- of them.
|
|
229
|
+
ws:Send(jsonEncode({
|
|
230
|
+
type = "register",
|
|
231
|
+
sessionId = sessionId,
|
|
232
|
+
payload = {
|
|
233
|
+
pluginVersion = "0.7.0",
|
|
234
|
+
instanceId = getInstanceId(),
|
|
235
|
+
context = detectContext(),
|
|
236
|
+
placeName = game.Name or "Unknown",
|
|
237
|
+
placeId = game.PlaceId,
|
|
238
|
+
gameId = game.GameId,
|
|
239
|
+
state = "Edit",
|
|
240
|
+
capabilities = {
|
|
241
|
+
"registerAction",
|
|
242
|
+
"syncActions",
|
|
243
|
+
"heartbeat",
|
|
244
|
+
"execute",
|
|
245
|
+
"queryState",
|
|
246
|
+
"captureScreenshot",
|
|
247
|
+
"queryDataModel",
|
|
248
|
+
"queryLogs",
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
}))
|
|
252
|
+
|
|
253
|
+
-- Incoming messages -> ActionRouter dispatch
|
|
254
|
+
ws.MessageReceived:Connect(function(rawData)
|
|
255
|
+
local ok, err = pcall(function()
|
|
256
|
+
local msg = jsonDecode(rawData)
|
|
257
|
+
if not msg or type(msg.type) ~= "string" then
|
|
258
|
+
print(`[StudioBridge] Failed to decode message: {tostring(rawData):sub(1, 200)}`)
|
|
259
|
+
return
|
|
260
|
+
end
|
|
137
261
|
|
|
138
|
-
|
|
139
|
-
table.insert(outputBuffer, {
|
|
140
|
-
level = level,
|
|
141
|
-
body = message,
|
|
142
|
-
})
|
|
143
|
-
end)
|
|
262
|
+
print(`[StudioBridge] Received: {msg.type} (requestId={tostring(msg.requestId):sub(1, 8)}...)`)
|
|
144
263
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
264
|
+
if msg.type == "shutdown" then
|
|
265
|
+
connected = false
|
|
266
|
+
pcall(function()
|
|
267
|
+
ws:Close()
|
|
268
|
+
end)
|
|
269
|
+
return
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
local response = router:dispatch(msg)
|
|
273
|
+
if response then
|
|
274
|
+
local encoded = jsonEncode(response)
|
|
275
|
+
print(`[StudioBridge] Sending: {response.type} ({#encoded} bytes)`)
|
|
276
|
+
ws:Send(encoded)
|
|
277
|
+
else
|
|
278
|
+
print(`[StudioBridge] No response for: {msg.type}`)
|
|
279
|
+
end
|
|
280
|
+
end)
|
|
281
|
+
if not ok then
|
|
282
|
+
warn(`[StudioBridge] MessageReceived handler error: {tostring(err)}`)
|
|
149
283
|
end
|
|
150
284
|
end)
|
|
151
285
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
client.Opened:Connect(function(_responseStatusCode, _headers)
|
|
155
|
-
print("[StudioBridge] WebSocket opened, sending hello (session: " .. SESSION_ID .. ")")
|
|
156
|
-
send(client, "hello", {
|
|
157
|
-
sessionId = SESSION_ID,
|
|
158
|
-
})
|
|
286
|
+
ws.Closed:Connect(function()
|
|
287
|
+
connected = false
|
|
159
288
|
end)
|
|
160
289
|
|
|
161
|
-
--
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
290
|
+
-- Heartbeat coroutine
|
|
291
|
+
local heartbeatStart = os.clock()
|
|
292
|
+
task.spawn(function()
|
|
293
|
+
while connected do
|
|
294
|
+
pcall(function()
|
|
295
|
+
ws:Send(jsonEncode({
|
|
296
|
+
type = "heartbeat",
|
|
297
|
+
sessionId = sessionId,
|
|
298
|
+
payload = {
|
|
299
|
+
uptimeMs = math.floor((os.clock() - heartbeatStart) * 1000),
|
|
300
|
+
state = detectContext() == "edit" and "Edit" or detectContext(),
|
|
301
|
+
pendingRequests = 0,
|
|
302
|
+
},
|
|
303
|
+
}))
|
|
304
|
+
end)
|
|
305
|
+
task.wait(15)
|
|
166
306
|
end
|
|
307
|
+
end)
|
|
167
308
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
309
|
+
print(`[StudioBridge] Connected to {connectLabel} as {sessionId}`)
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
-- ---------------------------------------------------------------------------
|
|
313
|
+
-- Boot
|
|
314
|
+
-- ---------------------------------------------------------------------------
|
|
173
315
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
316
|
+
if IS_EPHEMERAL then
|
|
317
|
+
-- Ephemeral mode: CLI substituted PORT and SESSION_ID, connect directly
|
|
318
|
+
local wsUrl = `ws://localhost:{PORT}/{SESSION_ID}`
|
|
319
|
+
local ok, ws = pcall(function()
|
|
320
|
+
return HttpService:CreateWebStreamClient(Enum.WebStreamClientType.WebSocket, { Url = wsUrl })
|
|
321
|
+
end)
|
|
322
|
+
if ok and ws then
|
|
323
|
+
ws.Opened:Connect(function()
|
|
324
|
+
wireConnection(ws, SESSION_ID, `localhost:{PORT} (ephemeral)`)
|
|
325
|
+
end)
|
|
326
|
+
ws.Error:Connect(function(status, err)
|
|
327
|
+
warn(`[StudioBridge] WebSocket error ({status}): {err}`)
|
|
328
|
+
end)
|
|
329
|
+
else
|
|
330
|
+
warn("[StudioBridge] Failed to create WebSocket client")
|
|
331
|
+
end
|
|
332
|
+
else
|
|
333
|
+
-- Persistent mode: discover server via port scanning
|
|
334
|
+
local POLL_INTERVAL_SEC = 2
|
|
335
|
+
|
|
336
|
+
-- Forward-declare so closures inside the callback table can reference it.
|
|
337
|
+
local discovery
|
|
338
|
+
discovery = DiscoveryStateMachine.new(nil, {
|
|
339
|
+
scanPortsAsync = function(ports, timeoutSec)
|
|
340
|
+
-- Scan all ports in parallel using task.spawn. The calling thread
|
|
341
|
+
-- yields and is resumed as soon as any port succeeds, all fail,
|
|
342
|
+
-- or the timeout expires. Use task.defer (not task.spawn) to resume
|
|
343
|
+
-- the caller so it has time to reach coroutine.yield() first.
|
|
344
|
+
local callerThread = coroutine.running()
|
|
345
|
+
local foundPort = nil
|
|
346
|
+
local foundBody = nil
|
|
347
|
+
local remaining = #ports
|
|
348
|
+
local settled = false
|
|
349
|
+
local threads = {}
|
|
350
|
+
|
|
351
|
+
for _, port in ports do
|
|
352
|
+
local thread = task.spawn(function()
|
|
353
|
+
local url = `http://localhost:{port}/health`
|
|
354
|
+
local ok2, body = pcall(HttpService.GetAsync, HttpService, url)
|
|
355
|
+
if ok2 and not settled then
|
|
356
|
+
foundPort = port
|
|
357
|
+
foundBody = body
|
|
358
|
+
settled = true
|
|
359
|
+
task.defer(callerThread)
|
|
360
|
+
return
|
|
361
|
+
end
|
|
362
|
+
remaining -= 1
|
|
363
|
+
if remaining <= 0 and not settled then
|
|
364
|
+
settled = true
|
|
365
|
+
task.defer(callerThread)
|
|
366
|
+
end
|
|
182
367
|
end)
|
|
368
|
+
table.insert(threads, thread)
|
|
183
369
|
end
|
|
184
|
-
|
|
185
|
-
--
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
370
|
+
|
|
371
|
+
-- Timeout: use the deadline from the poll loop
|
|
372
|
+
local timeoutThread = task.delay(timeoutSec, function()
|
|
373
|
+
if not settled then
|
|
374
|
+
settled = true
|
|
375
|
+
task.defer(callerThread)
|
|
376
|
+
end
|
|
191
377
|
end)
|
|
192
|
-
end
|
|
193
|
-
end)
|
|
194
378
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
379
|
+
coroutine.yield()
|
|
380
|
+
|
|
381
|
+
-- Cancel remaining HTTP threads and the timeout
|
|
382
|
+
pcall(task.cancel, timeoutThread)
|
|
383
|
+
for _, thread in threads do
|
|
384
|
+
pcall(task.cancel, thread)
|
|
385
|
+
end
|
|
199
386
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
387
|
+
return foundPort, foundBody
|
|
388
|
+
end,
|
|
389
|
+
connectWebSocket = function(url)
|
|
390
|
+
local ok2, ws = pcall(function()
|
|
391
|
+
return HttpService:CreateWebStreamClient(Enum.WebStreamClientType.WebSocket, { Url = url })
|
|
392
|
+
end)
|
|
393
|
+
return ok2, ws
|
|
394
|
+
end,
|
|
395
|
+
onStateChange = function(oldState, newState)
|
|
396
|
+
if newState == "searching" and oldState == "idle" then
|
|
397
|
+
print("[StudioBridge] Searching for host on ports 38741-38744...")
|
|
398
|
+
end
|
|
399
|
+
end,
|
|
400
|
+
onConnected = function(ws, port)
|
|
401
|
+
local sessionId = getSessionId()
|
|
402
|
+
ws.Opened:Connect(function()
|
|
403
|
+
wireConnection(ws, sessionId, `localhost:{port}`)
|
|
404
|
+
end)
|
|
405
|
+
ws.Error:Connect(function(status, err)
|
|
406
|
+
warn(`[StudioBridge] WebSocket error ({status}): {err}`)
|
|
407
|
+
end)
|
|
408
|
+
ws.Closed:Connect(function()
|
|
409
|
+
connected = false
|
|
410
|
+
discovery:onDisconnect("closed")
|
|
411
|
+
end)
|
|
412
|
+
end,
|
|
413
|
+
onDisconnected = function(reason)
|
|
414
|
+
connected = false
|
|
415
|
+
print(`[StudioBridge] Disconnected ({reason}), searching...`)
|
|
416
|
+
end,
|
|
417
|
+
})
|
|
418
|
+
print(`[StudioBridge] Session ID: {getSessionId()}`)
|
|
419
|
+
discovery:start()
|
|
420
|
+
|
|
421
|
+
-- Drive the state machine with a simple polling loop.
|
|
422
|
+
-- Each iteration has a fixed time budget (POLL_INTERVAL_SEC). The
|
|
423
|
+
-- remaining time threads through pollAsync → scanPortsAsync so all
|
|
424
|
+
-- async operations complete within the budget.
|
|
425
|
+
task.spawn(function()
|
|
426
|
+
while true do
|
|
427
|
+
local startTime = os.clock()
|
|
428
|
+
discovery:pollAsync(POLL_INTERVAL_SEC)
|
|
429
|
+
-- Sleep for the remainder of the cycle
|
|
430
|
+
local elapsed = os.clock() - startTime
|
|
431
|
+
local remaining = POLL_INTERVAL_SEC - elapsed
|
|
432
|
+
if remaining > 0 then
|
|
433
|
+
task.wait(remaining)
|
|
434
|
+
else
|
|
435
|
+
task.wait() -- yield at least one frame
|
|
436
|
+
end
|
|
437
|
+
end
|
|
204
438
|
end)
|
|
205
439
|
end
|
|
206
|
-
|
|
207
|
-
-- Run
|
|
208
|
-
task.spawn(connectAsync)
|