@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
|
@@ -1,500 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Raw-mode multi-line terminal editor with ANSI rendering.
|
|
3
|
-
*
|
|
4
|
-
* Provides a Claude Code-inspired input UI with:
|
|
5
|
-
* - Multi-line editing (Enter = newline, Ctrl+Enter = submit)
|
|
6
|
-
* - Cursor movement (arrows, Home/End)
|
|
7
|
-
* - Dot-commands (.help, .exit, .run <file>, .clear)
|
|
8
|
-
* - Status bar with keybinding hints
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { EventEmitter } from 'events';
|
|
12
|
-
import * as fs from 'fs/promises';
|
|
13
|
-
import * as path from 'path';
|
|
14
|
-
|
|
15
|
-
// ---------------------------------------------------------------------------
|
|
16
|
-
// Types
|
|
17
|
-
// ---------------------------------------------------------------------------
|
|
18
|
-
|
|
19
|
-
export interface TerminalEditorEvents {
|
|
20
|
-
submit: [buffer: string];
|
|
21
|
-
exit: [];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// ---------------------------------------------------------------------------
|
|
25
|
-
// ANSI helpers
|
|
26
|
-
// ---------------------------------------------------------------------------
|
|
27
|
-
|
|
28
|
-
const ESC = '\x1b[';
|
|
29
|
-
const CLEAR_LINE = `${ESC}2K`;
|
|
30
|
-
const CURSOR_TO_COL1 = `${ESC}1G`;
|
|
31
|
-
const DIM = `${ESC}2m`;
|
|
32
|
-
const RESET = `${ESC}0m`;
|
|
33
|
-
const HIDE_CURSOR = `${ESC}?25l`;
|
|
34
|
-
const SHOW_CURSOR = `${ESC}?25h`;
|
|
35
|
-
|
|
36
|
-
function moveUp(n: number): string {
|
|
37
|
-
return n > 0 ? `${ESC}${n}A` : '';
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function moveToCol(col: number): string {
|
|
41
|
-
return `${ESC}${col}G`;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// ---------------------------------------------------------------------------
|
|
45
|
-
// TerminalEditor
|
|
46
|
-
// ---------------------------------------------------------------------------
|
|
47
|
-
|
|
48
|
-
export class TerminalEditor extends EventEmitter {
|
|
49
|
-
private _lines: string[] = [''];
|
|
50
|
-
private _cursorRow = 0;
|
|
51
|
-
private _cursorCol = 0;
|
|
52
|
-
private _renderedLineCount = 0;
|
|
53
|
-
/** Terminal row (0-indexed from top of rendered block) where the cursor sits */
|
|
54
|
-
private _cursorTerminalRow = 0;
|
|
55
|
-
private _active = false;
|
|
56
|
-
private _onKeypress: ((data: Buffer) => void) | undefined;
|
|
57
|
-
private _onResize: (() => void) | undefined;
|
|
58
|
-
|
|
59
|
-
constructor() {
|
|
60
|
-
super();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// -----------------------------------------------------------------------
|
|
64
|
-
// Public API
|
|
65
|
-
// -----------------------------------------------------------------------
|
|
66
|
-
|
|
67
|
-
start(): void {
|
|
68
|
-
if (this._active) return;
|
|
69
|
-
this._active = true;
|
|
70
|
-
|
|
71
|
-
process.stdin.setRawMode(true);
|
|
72
|
-
process.stdin.resume();
|
|
73
|
-
process.stdin.setEncoding('utf-8');
|
|
74
|
-
|
|
75
|
-
this._onKeypress = (data: Buffer) => this._handleInput(data.toString());
|
|
76
|
-
// In raw mode with utf-8 encoding, data arrives as strings via 'data' event
|
|
77
|
-
process.stdin.on('data', this._onKeypress as any);
|
|
78
|
-
|
|
79
|
-
this._onResize = () => this._render();
|
|
80
|
-
process.stdout.on('resize', this._onResize);
|
|
81
|
-
|
|
82
|
-
this._render();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
stop(): void {
|
|
86
|
-
if (!this._active) return;
|
|
87
|
-
|
|
88
|
-
// Erase the rendered editor UI before restoring the terminal
|
|
89
|
-
this._eraseRendered();
|
|
90
|
-
this._renderedLineCount = 0;
|
|
91
|
-
|
|
92
|
-
this._active = false;
|
|
93
|
-
|
|
94
|
-
if (this._onKeypress) {
|
|
95
|
-
process.stdin.off('data', this._onKeypress as any);
|
|
96
|
-
this._onKeypress = undefined;
|
|
97
|
-
}
|
|
98
|
-
if (this._onResize) {
|
|
99
|
-
process.stdout.off('resize', this._onResize);
|
|
100
|
-
this._onResize = undefined;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
process.stdout.write(SHOW_CURSOR);
|
|
104
|
-
|
|
105
|
-
try {
|
|
106
|
-
process.stdin.setRawMode(false);
|
|
107
|
-
} catch {
|
|
108
|
-
// may fail if stdin is already closed
|
|
109
|
-
}
|
|
110
|
-
process.stdin.pause();
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// -----------------------------------------------------------------------
|
|
114
|
-
// Input handling
|
|
115
|
-
// -----------------------------------------------------------------------
|
|
116
|
-
|
|
117
|
-
private _handleInput(data: string): void {
|
|
118
|
-
// Ctrl+C
|
|
119
|
-
if (data === '\x03') {
|
|
120
|
-
if (this._bufferText().length > 0) {
|
|
121
|
-
this._lines = [''];
|
|
122
|
-
this._cursorRow = 0;
|
|
123
|
-
this._cursorCol = 0;
|
|
124
|
-
this._render();
|
|
125
|
-
} else {
|
|
126
|
-
this.emit('exit');
|
|
127
|
-
}
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Ctrl+D
|
|
132
|
-
if (data === '\x04') {
|
|
133
|
-
this.emit('exit');
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// Ctrl+Enter (various terminal representations)
|
|
138
|
-
// Most terminals: \x1b[13;5u or \x1b\r or similar
|
|
139
|
-
// Windows Terminal sends \x0a for Ctrl+Enter in raw mode
|
|
140
|
-
if (data === '\x0a' || data === '\x1b\r' || data === '\x1b\n') {
|
|
141
|
-
this._submit();
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// Check for CSI sequences with modifiers (e.g., \x1b[1;5A for Ctrl+Up)
|
|
146
|
-
const csiMatch = data.match(/^\x1b\[(\d+)?;?(\d+)?([A-Z~u])/);
|
|
147
|
-
if (csiMatch) {
|
|
148
|
-
const [, param1, param2, code] = csiMatch;
|
|
149
|
-
const modifier = param2 ? parseInt(param2, 10) : 0;
|
|
150
|
-
const isCtrl = modifier === 5;
|
|
151
|
-
|
|
152
|
-
// Ctrl+Enter via CSI u encoding: \x1b[13;5u
|
|
153
|
-
if (code === 'u' && param1 === '13' && isCtrl) {
|
|
154
|
-
this._submit();
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
switch (code) {
|
|
159
|
-
case 'A': // Up
|
|
160
|
-
this._moveCursorVertical(-1);
|
|
161
|
-
this._render();
|
|
162
|
-
return;
|
|
163
|
-
case 'B': // Down
|
|
164
|
-
this._moveCursorVertical(1);
|
|
165
|
-
this._render();
|
|
166
|
-
return;
|
|
167
|
-
case 'C': // Right
|
|
168
|
-
this._moveCursorHorizontal(1);
|
|
169
|
-
this._render();
|
|
170
|
-
return;
|
|
171
|
-
case 'D': // Left
|
|
172
|
-
this._moveCursorHorizontal(-1);
|
|
173
|
-
this._render();
|
|
174
|
-
return;
|
|
175
|
-
case 'H': // Home
|
|
176
|
-
this._cursorCol = 0;
|
|
177
|
-
this._render();
|
|
178
|
-
return;
|
|
179
|
-
case 'F': // End
|
|
180
|
-
this._cursorCol = this._lines[this._cursorRow].length;
|
|
181
|
-
this._render();
|
|
182
|
-
return;
|
|
183
|
-
case '~': {
|
|
184
|
-
const keyCode = param1 ? parseInt(param1, 10) : 0;
|
|
185
|
-
if (keyCode === 3) {
|
|
186
|
-
// Delete key
|
|
187
|
-
this._deleteForward();
|
|
188
|
-
this._render();
|
|
189
|
-
} else if (keyCode === 1) {
|
|
190
|
-
// Home
|
|
191
|
-
this._cursorCol = 0;
|
|
192
|
-
this._render();
|
|
193
|
-
} else if (keyCode === 4) {
|
|
194
|
-
// End
|
|
195
|
-
this._cursorCol = this._lines[this._cursorRow].length;
|
|
196
|
-
this._render();
|
|
197
|
-
}
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// Plain escape sequence (Alt or other)
|
|
205
|
-
if (data.startsWith('\x1b')) {
|
|
206
|
-
// Ignore unrecognized escape sequences
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// Enter (carriage return) — insert newline
|
|
211
|
-
if (data === '\r') {
|
|
212
|
-
this._insertNewline();
|
|
213
|
-
this._render();
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// Backspace
|
|
218
|
-
if (data === '\x7f' || data === '\b') {
|
|
219
|
-
this._deleteBackward();
|
|
220
|
-
this._render();
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// Tab
|
|
225
|
-
if (data === '\t') {
|
|
226
|
-
this._insertText(' ');
|
|
227
|
-
this._render();
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// Printable characters
|
|
232
|
-
if (data.length > 0 && data.charCodeAt(0) >= 32) {
|
|
233
|
-
this._insertText(data);
|
|
234
|
-
this._render();
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// -----------------------------------------------------------------------
|
|
239
|
-
// Buffer operations
|
|
240
|
-
// -----------------------------------------------------------------------
|
|
241
|
-
|
|
242
|
-
private _bufferText(): string {
|
|
243
|
-
return this._lines.join('\n');
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
private _insertText(text: string): void {
|
|
247
|
-
const line = this._lines[this._cursorRow];
|
|
248
|
-
this._lines[this._cursorRow] =
|
|
249
|
-
line.slice(0, this._cursorCol) + text + line.slice(this._cursorCol);
|
|
250
|
-
this._cursorCol += text.length;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
private _insertNewline(): void {
|
|
254
|
-
const line = this._lines[this._cursorRow];
|
|
255
|
-
const before = line.slice(0, this._cursorCol);
|
|
256
|
-
const after = line.slice(this._cursorCol);
|
|
257
|
-
this._lines[this._cursorRow] = before;
|
|
258
|
-
this._lines.splice(this._cursorRow + 1, 0, after);
|
|
259
|
-
this._cursorRow++;
|
|
260
|
-
this._cursorCol = 0;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
private _deleteBackward(): void {
|
|
264
|
-
if (this._cursorCol > 0) {
|
|
265
|
-
const line = this._lines[this._cursorRow];
|
|
266
|
-
this._lines[this._cursorRow] =
|
|
267
|
-
line.slice(0, this._cursorCol - 1) + line.slice(this._cursorCol);
|
|
268
|
-
this._cursorCol--;
|
|
269
|
-
} else if (this._cursorRow > 0) {
|
|
270
|
-
// Merge with previous line
|
|
271
|
-
const prevLine = this._lines[this._cursorRow - 1];
|
|
272
|
-
this._lines[this._cursorRow - 1] =
|
|
273
|
-
prevLine + this._lines[this._cursorRow];
|
|
274
|
-
this._lines.splice(this._cursorRow, 1);
|
|
275
|
-
this._cursorRow--;
|
|
276
|
-
this._cursorCol = prevLine.length;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
private _deleteForward(): void {
|
|
281
|
-
const line = this._lines[this._cursorRow];
|
|
282
|
-
if (this._cursorCol < line.length) {
|
|
283
|
-
this._lines[this._cursorRow] =
|
|
284
|
-
line.slice(0, this._cursorCol) + line.slice(this._cursorCol + 1);
|
|
285
|
-
} else if (this._cursorRow < this._lines.length - 1) {
|
|
286
|
-
// Merge with next line
|
|
287
|
-
this._lines[this._cursorRow] =
|
|
288
|
-
line + this._lines[this._cursorRow + 1];
|
|
289
|
-
this._lines.splice(this._cursorRow + 1, 1);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
private _moveCursorHorizontal(delta: number): void {
|
|
294
|
-
if (delta > 0) {
|
|
295
|
-
const line = this._lines[this._cursorRow];
|
|
296
|
-
if (this._cursorCol < line.length) {
|
|
297
|
-
this._cursorCol++;
|
|
298
|
-
} else if (this._cursorRow < this._lines.length - 1) {
|
|
299
|
-
this._cursorRow++;
|
|
300
|
-
this._cursorCol = 0;
|
|
301
|
-
}
|
|
302
|
-
} else {
|
|
303
|
-
if (this._cursorCol > 0) {
|
|
304
|
-
this._cursorCol--;
|
|
305
|
-
} else if (this._cursorRow > 0) {
|
|
306
|
-
this._cursorRow--;
|
|
307
|
-
this._cursorCol = this._lines[this._cursorRow].length;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
private _moveCursorVertical(delta: number): void {
|
|
313
|
-
const newRow = this._cursorRow + delta;
|
|
314
|
-
if (newRow >= 0 && newRow < this._lines.length) {
|
|
315
|
-
this._cursorRow = newRow;
|
|
316
|
-
this._cursorCol = Math.min(
|
|
317
|
-
this._cursorCol,
|
|
318
|
-
this._lines[this._cursorRow].length
|
|
319
|
-
);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
// -----------------------------------------------------------------------
|
|
324
|
-
// Submit / dot-commands
|
|
325
|
-
// -----------------------------------------------------------------------
|
|
326
|
-
|
|
327
|
-
private _submit(): void {
|
|
328
|
-
const text = this._bufferText().trimEnd();
|
|
329
|
-
|
|
330
|
-
// Dot-commands
|
|
331
|
-
if (text.startsWith('.')) {
|
|
332
|
-
this._handleDotCommand(text);
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
if (text.length === 0) return;
|
|
337
|
-
|
|
338
|
-
this._clearEditor();
|
|
339
|
-
this.emit('submit', text);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
private _handleDotCommand(text: string): void {
|
|
343
|
-
const parts = text.split(/\s+/);
|
|
344
|
-
const cmd = parts[0].toLowerCase();
|
|
345
|
-
|
|
346
|
-
switch (cmd) {
|
|
347
|
-
case '.help':
|
|
348
|
-
this._clearEditor();
|
|
349
|
-
console.log(
|
|
350
|
-
[
|
|
351
|
-
'',
|
|
352
|
-
`${DIM}Commands:${RESET}`,
|
|
353
|
-
` .help Show this help message`,
|
|
354
|
-
` .exit Exit terminal mode`,
|
|
355
|
-
` .run <file> Read and execute a Luau file`,
|
|
356
|
-
` .clear Clear the editor buffer`,
|
|
357
|
-
'',
|
|
358
|
-
`${DIM}Keybindings:${RESET}`,
|
|
359
|
-
` Enter New line`,
|
|
360
|
-
` Ctrl+Enter Execute buffer`,
|
|
361
|
-
` Ctrl+C Clear buffer (or exit if empty)`,
|
|
362
|
-
` Ctrl+D Exit`,
|
|
363
|
-
` Tab Insert 2 spaces`,
|
|
364
|
-
` Arrow keys Move cursor`,
|
|
365
|
-
'',
|
|
366
|
-
].join('\n')
|
|
367
|
-
);
|
|
368
|
-
this._render();
|
|
369
|
-
break;
|
|
370
|
-
|
|
371
|
-
case '.exit':
|
|
372
|
-
this._clearEditor();
|
|
373
|
-
this.emit('exit');
|
|
374
|
-
break;
|
|
375
|
-
|
|
376
|
-
case '.run': {
|
|
377
|
-
const filePath = parts.slice(1).join(' ').trim();
|
|
378
|
-
if (!filePath) {
|
|
379
|
-
this._clearEditor();
|
|
380
|
-
console.log(`${DIM}Usage: .run <file.lua>${RESET}\n`);
|
|
381
|
-
this._render();
|
|
382
|
-
return;
|
|
383
|
-
}
|
|
384
|
-
this._clearEditor();
|
|
385
|
-
this._runFile(filePath);
|
|
386
|
-
break;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
case '.clear':
|
|
390
|
-
this._lines = [''];
|
|
391
|
-
this._cursorRow = 0;
|
|
392
|
-
this._cursorCol = 0;
|
|
393
|
-
this._render();
|
|
394
|
-
break;
|
|
395
|
-
|
|
396
|
-
default:
|
|
397
|
-
this._clearEditor();
|
|
398
|
-
console.log(
|
|
399
|
-
`${DIM}Unknown command: ${cmd} (type .help for available commands)${RESET}\n`
|
|
400
|
-
);
|
|
401
|
-
this._render();
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
private async _runFile(filePath: string): Promise<void> {
|
|
406
|
-
try {
|
|
407
|
-
const resolved = path.resolve(filePath);
|
|
408
|
-
const content = await fs.readFile(resolved, 'utf-8');
|
|
409
|
-
this.emit('submit', content);
|
|
410
|
-
} catch (err) {
|
|
411
|
-
console.log(
|
|
412
|
-
`Error reading file: ${err instanceof Error ? err.message : String(err)}\n`
|
|
413
|
-
);
|
|
414
|
-
this._render();
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
// -----------------------------------------------------------------------
|
|
419
|
-
// Rendering
|
|
420
|
-
// -----------------------------------------------------------------------
|
|
421
|
-
|
|
422
|
-
private _clearEditor(): void {
|
|
423
|
-
// Move to start of rendered area and clear it
|
|
424
|
-
this._eraseRendered();
|
|
425
|
-
this._renderedLineCount = 0;
|
|
426
|
-
this._lines = [''];
|
|
427
|
-
this._cursorRow = 0;
|
|
428
|
-
this._cursorCol = 0;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
private _eraseRendered(): void {
|
|
432
|
-
if (this._renderedLineCount === 0) return;
|
|
433
|
-
|
|
434
|
-
let out = '';
|
|
435
|
-
// Move cursor from its current terminal row up to the first rendered line
|
|
436
|
-
out += moveUp(this._cursorTerminalRow);
|
|
437
|
-
// Clear each line top-to-bottom
|
|
438
|
-
for (let i = 0; i < this._renderedLineCount; i++) {
|
|
439
|
-
out += CURSOR_TO_COL1 + CLEAR_LINE;
|
|
440
|
-
if (i < this._renderedLineCount - 1) {
|
|
441
|
-
out += `${ESC}1B`; // move down
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
// Move back to top
|
|
445
|
-
if (this._renderedLineCount > 1) {
|
|
446
|
-
out += moveUp(this._renderedLineCount - 1);
|
|
447
|
-
}
|
|
448
|
-
out += CURSOR_TO_COL1;
|
|
449
|
-
process.stdout.write(out);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
_render(): void {
|
|
453
|
-
if (!this._active) return;
|
|
454
|
-
|
|
455
|
-
const width = process.stdout.columns || 80;
|
|
456
|
-
const divider = '\u2500'.repeat(width);
|
|
457
|
-
|
|
458
|
-
// Erase previous render
|
|
459
|
-
this._eraseRendered();
|
|
460
|
-
|
|
461
|
-
let out = HIDE_CURSOR;
|
|
462
|
-
|
|
463
|
-
// Top divider
|
|
464
|
-
out += `${DIM}${divider}${RESET}\n`;
|
|
465
|
-
|
|
466
|
-
// Buffer lines with prompt
|
|
467
|
-
for (let i = 0; i < this._lines.length; i++) {
|
|
468
|
-
const prefix = i === 0 ? '\u276F ' : ' ';
|
|
469
|
-
out += `${prefix}${this._lines[i]}\n`;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
// Bottom divider
|
|
473
|
-
out += `${DIM}${divider}${RESET}\n`;
|
|
474
|
-
|
|
475
|
-
// Status bar
|
|
476
|
-
const lineInfo =
|
|
477
|
-
this._lines.length > 1 ? ` \u00B7 ${this._lines.length} lines` : '';
|
|
478
|
-
const statusText = ` ctrl+enter to run \u00B7 ctrl+c to clear \u00B7 .help for commands${lineInfo}`;
|
|
479
|
-
out += `${DIM}${statusText}${RESET}`;
|
|
480
|
-
|
|
481
|
-
// Total rendered lines: 1 (top divider) + lines.length + 1 (bottom divider) + 1 (status)
|
|
482
|
-
const totalLines = this._lines.length + 3;
|
|
483
|
-
|
|
484
|
-
// Position cursor: move up from status bar to the correct buffer line,
|
|
485
|
-
// then move to the correct column.
|
|
486
|
-
// Cursor's target terminal row (0-indexed): top divider(0) + cursorRow+1
|
|
487
|
-
const cursorTermRow = this._cursorRow + 1; // +1 for top divider
|
|
488
|
-
const linesFromBottom = totalLines - 1 - cursorTermRow;
|
|
489
|
-
if (linesFromBottom > 0) {
|
|
490
|
-
out += moveUp(linesFromBottom);
|
|
491
|
-
}
|
|
492
|
-
const prefix = 2; // "❯ " or " " both 2 chars
|
|
493
|
-
out += moveToCol(prefix + this._cursorCol + 1);
|
|
494
|
-
out += SHOW_CURSOR;
|
|
495
|
-
|
|
496
|
-
process.stdout.write(out);
|
|
497
|
-
this._renderedLineCount = totalLines;
|
|
498
|
-
this._cursorTerminalRow = cursorTermRow;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Terminal mode for studio-bridge — keeps Studio alive and provides
|
|
3
|
-
* an interactive REPL for executing Luau scripts repeatedly.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import * as fs from 'fs/promises';
|
|
7
|
-
import * as path from 'path';
|
|
8
|
-
import { OutputHelper } from '@quenty/cli-output-helpers';
|
|
9
|
-
import {
|
|
10
|
-
StudioBridgeServer,
|
|
11
|
-
type StudioBridgePhase,
|
|
12
|
-
} from '../../../server/studio-bridge-server.js';
|
|
13
|
-
import { TerminalEditor } from './terminal-editor.js';
|
|
14
|
-
|
|
15
|
-
// ---------------------------------------------------------------------------
|
|
16
|
-
// Types
|
|
17
|
-
// ---------------------------------------------------------------------------
|
|
18
|
-
|
|
19
|
-
export interface TerminalModeOptions {
|
|
20
|
-
placePath?: string;
|
|
21
|
-
scriptPath?: string;
|
|
22
|
-
scriptText?: string;
|
|
23
|
-
timeoutMs: number;
|
|
24
|
-
verbose: boolean;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// ---------------------------------------------------------------------------
|
|
28
|
-
// Helpers
|
|
29
|
-
// ---------------------------------------------------------------------------
|
|
30
|
-
|
|
31
|
-
const DIM = '\x1b[2m';
|
|
32
|
-
const RED = '\x1b[31m';
|
|
33
|
-
const YELLOW = '\x1b[33m';
|
|
34
|
-
const CYAN = '\x1b[36m';
|
|
35
|
-
const RESET = '\x1b[0m';
|
|
36
|
-
|
|
37
|
-
function printSubmittedCode(code: string): void {
|
|
38
|
-
const lines = code.split('\n');
|
|
39
|
-
for (let i = 0; i < lines.length; i++) {
|
|
40
|
-
const prefix = i === 0 ? `${CYAN}\u276F${RESET} ` : ' ';
|
|
41
|
-
console.log(`${prefix}${DIM}${lines[i]}${RESET}`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function printOutput(level: string, body: string): void {
|
|
46
|
-
// Filter internal plugin messages
|
|
47
|
-
if (body.startsWith('[StudioBridge]')) return;
|
|
48
|
-
|
|
49
|
-
switch (level) {
|
|
50
|
-
case 'Warning':
|
|
51
|
-
console.log(`${YELLOW}${body}${RESET}`);
|
|
52
|
-
break;
|
|
53
|
-
case 'Error':
|
|
54
|
-
console.log(`${RED}${body}${RESET}`);
|
|
55
|
-
break;
|
|
56
|
-
default:
|
|
57
|
-
console.log(body);
|
|
58
|
-
break;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// ---------------------------------------------------------------------------
|
|
63
|
-
// Main
|
|
64
|
-
// ---------------------------------------------------------------------------
|
|
65
|
-
|
|
66
|
-
export async function runTerminalMode(
|
|
67
|
-
options: TerminalModeOptions
|
|
68
|
-
): Promise<void> {
|
|
69
|
-
const { placePath, timeoutMs, verbose } = options;
|
|
70
|
-
|
|
71
|
-
OutputHelper.setVerbose(verbose);
|
|
72
|
-
|
|
73
|
-
// Phase progress — single line that updates in place
|
|
74
|
-
const phaseLabels: Record<string, string> = {
|
|
75
|
-
building: 'Building place...',
|
|
76
|
-
launching: 'Launching Studio...',
|
|
77
|
-
connecting: 'Waiting for plugin...',
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const server = new StudioBridgeServer({
|
|
81
|
-
placePath,
|
|
82
|
-
timeoutMs,
|
|
83
|
-
onPhase: (phase: StudioBridgePhase) => {
|
|
84
|
-
const label = phaseLabels[phase];
|
|
85
|
-
if (label) {
|
|
86
|
-
process.stdout.write(`\r\x1b[2K${DIM}${label}${RESET}`);
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
// Start the bridge
|
|
92
|
-
try {
|
|
93
|
-
await server.startAsync();
|
|
94
|
-
} catch (err) {
|
|
95
|
-
process.stdout.write(`\r\x1b[2K`);
|
|
96
|
-
OutputHelper.error(
|
|
97
|
-
`Failed to start: ${err instanceof Error ? err.message : String(err)}`
|
|
98
|
-
);
|
|
99
|
-
process.exit(1);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
process.stdout.write(`\r\x1b[2K${DIM}Studio connected.${RESET}\n\n`);
|
|
103
|
-
|
|
104
|
-
// Run initial script if provided
|
|
105
|
-
if (options.scriptPath || options.scriptText) {
|
|
106
|
-
let initialScript: string;
|
|
107
|
-
if (options.scriptText) {
|
|
108
|
-
initialScript = options.scriptText;
|
|
109
|
-
} else {
|
|
110
|
-
const resolved = path.resolve(options.scriptPath!);
|
|
111
|
-
try {
|
|
112
|
-
initialScript = await fs.readFile(resolved, 'utf-8');
|
|
113
|
-
} catch {
|
|
114
|
-
OutputHelper.error(`Could not read script file: ${resolved}`);
|
|
115
|
-
await server.stopAsync();
|
|
116
|
-
process.exit(1);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
await executeAndPrint(server, initialScript, timeoutMs);
|
|
121
|
-
console.log('');
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Enter REPL
|
|
125
|
-
const editor = new TerminalEditor();
|
|
126
|
-
|
|
127
|
-
const cleanup = async () => {
|
|
128
|
-
editor.stop();
|
|
129
|
-
console.log(`${DIM}Shutting down...${RESET}`);
|
|
130
|
-
await server.stopAsync();
|
|
131
|
-
process.exit(0);
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
editor.on('exit', () => {
|
|
135
|
-
cleanup();
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
editor.on('submit', async (buffer: string) => {
|
|
139
|
-
printSubmittedCode(buffer);
|
|
140
|
-
try {
|
|
141
|
-
await executeAndPrint(server, buffer, timeoutMs);
|
|
142
|
-
} catch (err) {
|
|
143
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
144
|
-
if (
|
|
145
|
-
msg.includes('no connected client') ||
|
|
146
|
-
msg.includes("expected state 'ready'")
|
|
147
|
-
) {
|
|
148
|
-
console.log(
|
|
149
|
-
`\n${RED}Studio disconnected.${RESET}`
|
|
150
|
-
);
|
|
151
|
-
editor.stop();
|
|
152
|
-
await server.stopAsync();
|
|
153
|
-
process.exit(1);
|
|
154
|
-
}
|
|
155
|
-
console.log(`${RED}Error: ${msg}${RESET}`);
|
|
156
|
-
}
|
|
157
|
-
console.log('');
|
|
158
|
-
editor._render();
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
editor.start();
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
async function executeAndPrint(
|
|
165
|
-
server: StudioBridgeServer,
|
|
166
|
-
script: string,
|
|
167
|
-
timeoutMs: number
|
|
168
|
-
): Promise<void> {
|
|
169
|
-
const result = await server.executeAsync({
|
|
170
|
-
scriptContent: script,
|
|
171
|
-
timeoutMs,
|
|
172
|
-
onOutput: (level, body) => printOutput(level, body),
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
if (!result.success && result.logs) {
|
|
176
|
-
// Print any error info not already printed via onOutput
|
|
177
|
-
const lines = result.logs.split('\n');
|
|
178
|
-
for (const line of lines) {
|
|
179
|
-
if (line.startsWith('[StudioBridge]')) {
|
|
180
|
-
console.log(`${RED}${line}${RESET}`);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|