@quenty/studio-bridge 0.21.1 → 0.22.1

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.
Files changed (482) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +109 -17
  3. package/build-scripts/transform-add-session-attribute.lua +1 -0
  4. package/deploy.nevermore.json +10 -0
  5. package/dist/src/bridge/bridge-connection.d.ts +26 -2
  6. package/dist/src/bridge/bridge-connection.d.ts.map +1 -1
  7. package/dist/src/bridge/bridge-connection.js +159 -14
  8. package/dist/src/bridge/bridge-connection.js.map +1 -1
  9. package/dist/src/bridge/bridge-connection.test.js +81 -0
  10. package/dist/src/bridge/bridge-connection.test.js.map +1 -1
  11. package/dist/src/bridge/bridge-session.d.ts +35 -2
  12. package/dist/src/bridge/bridge-session.d.ts.map +1 -1
  13. package/dist/src/bridge/bridge-session.js +185 -28
  14. package/dist/src/bridge/bridge-session.js.map +1 -1
  15. package/dist/src/bridge/bridge-session.test.js +6 -4
  16. package/dist/src/bridge/bridge-session.test.js.map +1 -1
  17. package/dist/src/bridge/index.d.ts +1 -1
  18. package/dist/src/bridge/index.d.ts.map +1 -1
  19. package/dist/src/bridge/index.js.map +1 -1
  20. package/dist/src/bridge/internal/bridge-client.d.ts +4 -0
  21. package/dist/src/bridge/internal/bridge-client.d.ts.map +1 -1
  22. package/dist/src/bridge/internal/bridge-client.js +20 -7
  23. package/dist/src/bridge/internal/bridge-client.js.map +1 -1
  24. package/dist/src/bridge/internal/bridge-client.test.js +18 -0
  25. package/dist/src/bridge/internal/bridge-client.test.js.map +1 -1
  26. package/dist/src/bridge/internal/bridge-host.d.ts +13 -1
  27. package/dist/src/bridge/internal/bridge-host.d.ts.map +1 -1
  28. package/dist/src/bridge/internal/bridge-host.js +35 -0
  29. package/dist/src/bridge/internal/bridge-host.js.map +1 -1
  30. package/dist/src/bridge/internal/bridge-host.test.js +31 -0
  31. package/dist/src/bridge/internal/bridge-host.test.js.map +1 -1
  32. package/dist/src/bridge/internal/hand-off.d.ts.map +1 -1
  33. package/dist/src/bridge/internal/hand-off.js +4 -1
  34. package/dist/src/bridge/internal/hand-off.js.map +1 -1
  35. package/dist/src/bridge/internal/host-protocol.d.ts +8 -0
  36. package/dist/src/bridge/internal/host-protocol.d.ts.map +1 -1
  37. package/dist/src/bridge/internal/host-protocol.js +120 -13
  38. package/dist/src/bridge/internal/host-protocol.js.map +1 -1
  39. package/dist/src/bridge/internal/host-protocol.test.js +13 -0
  40. package/dist/src/bridge/internal/host-protocol.test.js.map +1 -1
  41. package/dist/src/bridge/internal/instance-state.d.ts +9 -0
  42. package/dist/src/bridge/internal/instance-state.d.ts.map +1 -0
  43. package/dist/src/bridge/internal/instance-state.js +28 -0
  44. package/dist/src/bridge/internal/instance-state.js.map +1 -0
  45. package/dist/src/bridge/internal/transport-client.d.ts.map +1 -1
  46. package/dist/src/bridge/internal/transport-client.js +2 -1
  47. package/dist/src/bridge/internal/transport-client.js.map +1 -1
  48. package/dist/src/bridge/internal/transport-server.d.ts.map +1 -1
  49. package/dist/src/bridge/internal/transport-server.js +5 -1
  50. package/dist/src/bridge/internal/transport-server.js.map +1 -1
  51. package/dist/src/bridge/types.d.ts +43 -4
  52. package/dist/src/bridge/types.d.ts.map +1 -1
  53. package/dist/src/bridge/types.js.map +1 -1
  54. package/dist/src/cli/adapters/cli-command-adapter-handler.test.js +24 -0
  55. package/dist/src/cli/adapters/cli-command-adapter-handler.test.js.map +1 -1
  56. package/dist/src/cli/adapters/cli-command-adapter.d.ts +6 -0
  57. package/dist/src/cli/adapters/cli-command-adapter.d.ts.map +1 -1
  58. package/dist/src/cli/adapters/cli-command-adapter.js +107 -11
  59. package/dist/src/cli/adapters/cli-command-adapter.js.map +1 -1
  60. package/dist/src/cli/adapters/group-builder.d.ts +3 -0
  61. package/dist/src/cli/adapters/group-builder.d.ts.map +1 -1
  62. package/dist/src/cli/adapters/group-builder.js +34 -15
  63. package/dist/src/cli/adapters/group-builder.js.map +1 -1
  64. package/dist/src/cli/adapters/group-builder.test.js +26 -2
  65. package/dist/src/cli/adapters/group-builder.test.js.map +1 -1
  66. package/dist/src/cli/adapters/help-formatter.d.ts.map +1 -1
  67. package/dist/src/cli/adapters/help-formatter.js +4 -3
  68. package/dist/src/cli/adapters/help-formatter.js.map +1 -1
  69. package/dist/src/cli/adapters/help-formatter.test.js +1 -1
  70. package/dist/src/cli/adapters/help-formatter.test.js.map +1 -1
  71. package/dist/src/cli/adapters/playtest-edit-guard.test.d.ts +2 -0
  72. package/dist/src/cli/adapters/playtest-edit-guard.test.d.ts.map +1 -0
  73. package/dist/src/cli/adapters/playtest-edit-guard.test.js +28 -0
  74. package/dist/src/cli/adapters/playtest-edit-guard.test.js.map +1 -0
  75. package/dist/src/cli/args/global-args.d.ts +1 -1
  76. package/dist/src/cli/args/global-args.d.ts.map +1 -1
  77. package/dist/src/cli/cli-output-context.d.ts +14 -0
  78. package/dist/src/cli/cli-output-context.d.ts.map +1 -0
  79. package/dist/src/cli/cli-output-context.js +39 -0
  80. package/dist/src/cli/cli-output-context.js.map +1 -0
  81. package/dist/src/cli/cli-output-context.test.d.ts +2 -0
  82. package/dist/src/cli/cli-output-context.test.d.ts.map +1 -0
  83. package/dist/src/cli/cli-output-context.test.js +38 -0
  84. package/dist/src/cli/cli-output-context.test.js.map +1 -0
  85. package/dist/src/cli/cli.js +40 -17
  86. package/dist/src/cli/cli.js.map +1 -1
  87. package/dist/src/cli/managed-studio-run.d.ts +21 -0
  88. package/dist/src/cli/managed-studio-run.d.ts.map +1 -0
  89. package/dist/src/cli/managed-studio-run.js +75 -0
  90. package/dist/src/cli/managed-studio-run.js.map +1 -0
  91. package/dist/src/cli/managed-studio-run.test.d.ts +2 -0
  92. package/dist/src/cli/managed-studio-run.test.d.ts.map +1 -0
  93. package/dist/src/cli/managed-studio-run.test.js +52 -0
  94. package/dist/src/cli/managed-studio-run.test.js.map +1 -0
  95. package/dist/src/cli/resolve-session.js +1 -1
  96. package/dist/src/cli/resolve-session.js.map +1 -1
  97. package/dist/src/cli/resolve-session.test.js +1 -1
  98. package/dist/src/cli/resolve-session.test.js.map +1 -1
  99. package/dist/src/cli/script-executor.d.ts +13 -1
  100. package/dist/src/cli/script-executor.d.ts.map +1 -1
  101. package/dist/src/cli/script-executor.js +77 -47
  102. package/dist/src/cli/script-executor.js.map +1 -1
  103. package/dist/src/commands/console/exec/exec.d.ts +17 -0
  104. package/dist/src/commands/console/exec/exec.d.ts.map +1 -1
  105. package/dist/src/commands/console/exec/exec.js +39 -7
  106. package/dist/src/commands/console/exec/exec.js.map +1 -1
  107. package/dist/src/commands/console/exec/exec.test.js +62 -3
  108. package/dist/src/commands/console/exec/exec.test.js.map +1 -1
  109. package/dist/src/commands/console/logs/logs.d.ts +30 -2
  110. package/dist/src/commands/console/logs/logs.d.ts.map +1 -1
  111. package/dist/src/commands/console/logs/logs.js +82 -7
  112. package/dist/src/commands/console/logs/logs.js.map +1 -1
  113. package/dist/src/commands/console/logs/logs.test.js +63 -4
  114. package/dist/src/commands/console/logs/logs.test.js.map +1 -1
  115. package/dist/src/commands/explorer/export/export.d.ts +19 -0
  116. package/dist/src/commands/explorer/export/export.d.ts.map +1 -0
  117. package/dist/src/commands/explorer/export/export.js +37 -0
  118. package/dist/src/commands/explorer/export/export.js.map +1 -0
  119. package/dist/src/commands/explorer/export/export.test.d.ts +2 -0
  120. package/dist/src/commands/explorer/export/export.test.d.ts.map +1 -0
  121. package/dist/src/commands/explorer/export/export.test.js +25 -0
  122. package/dist/src/commands/explorer/export/export.test.js.map +1 -0
  123. package/dist/src/commands/explorer/find/find.d.ts +28 -0
  124. package/dist/src/commands/explorer/find/find.d.ts.map +1 -0
  125. package/dist/src/commands/explorer/find/find.js +75 -0
  126. package/dist/src/commands/explorer/find/find.js.map +1 -0
  127. package/dist/src/commands/explorer/find/find.test.d.ts +2 -0
  128. package/dist/src/commands/explorer/find/find.test.d.ts.map +1 -0
  129. package/dist/src/commands/explorer/find/find.test.js +44 -0
  130. package/dist/src/commands/explorer/find/find.test.js.map +1 -0
  131. package/dist/src/commands/explorer/grep/grep.d.ts +24 -0
  132. package/dist/src/commands/explorer/grep/grep.d.ts.map +1 -0
  133. package/dist/src/commands/explorer/grep/grep.js +63 -0
  134. package/dist/src/commands/explorer/grep/grep.js.map +1 -0
  135. package/dist/src/commands/explorer/grep/grep.test.d.ts +2 -0
  136. package/dist/src/commands/explorer/grep/grep.test.d.ts.map +1 -0
  137. package/dist/src/commands/explorer/grep/grep.test.js +42 -0
  138. package/dist/src/commands/explorer/grep/grep.test.js.map +1 -0
  139. package/dist/src/commands/explorer/import/import.d.ts +21 -0
  140. package/dist/src/commands/explorer/import/import.d.ts.map +1 -0
  141. package/dist/src/commands/explorer/import/import.js +37 -0
  142. package/dist/src/commands/explorer/import/import.js.map +1 -0
  143. package/dist/src/commands/explorer/import/import.test.d.ts +2 -0
  144. package/dist/src/commands/explorer/import/import.test.d.ts.map +1 -0
  145. package/dist/src/commands/explorer/import/import.test.js +45 -0
  146. package/dist/src/commands/explorer/import/import.test.js.map +1 -0
  147. package/dist/src/commands/formatters.test.js +7 -1
  148. package/dist/src/commands/formatters.test.js.map +1 -1
  149. package/dist/src/commands/framework/action-loader.d.ts +5 -1
  150. package/dist/src/commands/framework/action-loader.d.ts.map +1 -1
  151. package/dist/src/commands/framework/action-loader.js +9 -2
  152. package/dist/src/commands/framework/action-loader.js.map +1 -1
  153. package/dist/src/commands/framework/action-loader.test.js +23 -0
  154. package/dist/src/commands/framework/action-loader.test.js.map +1 -1
  155. package/dist/src/commands/framework/arg-builder.d.ts +15 -2
  156. package/dist/src/commands/framework/arg-builder.d.ts.map +1 -1
  157. package/dist/src/commands/framework/arg-builder.js +22 -2
  158. package/dist/src/commands/framework/arg-builder.js.map +1 -1
  159. package/dist/src/commands/framework/define-command.d.ts +19 -3
  160. package/dist/src/commands/framework/define-command.d.ts.map +1 -1
  161. package/dist/src/commands/framework/define-command.js.map +1 -1
  162. package/dist/src/commands/framework/index.d.ts +1 -1
  163. package/dist/src/commands/framework/index.d.ts.map +1 -1
  164. package/dist/src/commands/framework/index.js.map +1 -1
  165. package/dist/src/commands/index.d.ts +11 -0
  166. package/dist/src/commands/index.d.ts.map +1 -1
  167. package/dist/src/commands/index.js +11 -0
  168. package/dist/src/commands/index.js.map +1 -1
  169. package/dist/src/commands/linux/inject-credentials/inject-credentials.d.ts.map +1 -1
  170. package/dist/src/commands/linux/inject-credentials/inject-credentials.js +1 -3
  171. package/dist/src/commands/linux/inject-credentials/inject-credentials.js.map +1 -1
  172. package/dist/src/commands/linux/setup/setup.d.ts.map +1 -1
  173. package/dist/src/commands/linux/setup/setup.js +1 -3
  174. package/dist/src/commands/linux/setup/setup.js.map +1 -1
  175. package/dist/src/commands/linux/status/status.d.ts +9 -1
  176. package/dist/src/commands/linux/status/status.d.ts.map +1 -1
  177. package/dist/src/commands/linux/status/status.js +66 -86
  178. package/dist/src/commands/linux/status/status.js.map +1 -1
  179. package/dist/src/commands/playtest/player/add/add.d.ts +17 -0
  180. package/dist/src/commands/playtest/player/add/add.d.ts.map +1 -0
  181. package/dist/src/commands/playtest/player/add/add.js +45 -0
  182. package/dist/src/commands/playtest/player/add/add.js.map +1 -0
  183. package/dist/src/commands/playtest/player/list/list.d.ts +13 -0
  184. package/dist/src/commands/playtest/player/list/list.d.ts.map +1 -0
  185. package/dist/src/commands/playtest/player/list/list.js +33 -0
  186. package/dist/src/commands/playtest/player/list/list.js.map +1 -0
  187. package/dist/src/commands/playtest/player/playtest-players.d.ts +36 -0
  188. package/dist/src/commands/playtest/player/playtest-players.d.ts.map +1 -0
  189. package/dist/src/commands/playtest/player/playtest-players.js +187 -0
  190. package/dist/src/commands/playtest/player/playtest-players.js.map +1 -0
  191. package/dist/src/commands/playtest/player/playtest-players.test.d.ts +2 -0
  192. package/dist/src/commands/playtest/player/playtest-players.test.d.ts.map +1 -0
  193. package/dist/src/commands/playtest/player/playtest-players.test.js +89 -0
  194. package/dist/src/commands/playtest/player/playtest-players.test.js.map +1 -0
  195. package/dist/src/commands/playtest/player/remove/remove.d.ts +17 -0
  196. package/dist/src/commands/playtest/player/remove/remove.d.ts.map +1 -0
  197. package/dist/src/commands/playtest/player/remove/remove.js +42 -0
  198. package/dist/src/commands/playtest/player/remove/remove.js.map +1 -0
  199. package/dist/src/commands/playtest/playtest-sessions.d.ts +49 -0
  200. package/dist/src/commands/playtest/playtest-sessions.d.ts.map +1 -0
  201. package/dist/src/commands/playtest/playtest-sessions.js +283 -0
  202. package/dist/src/commands/playtest/playtest-sessions.js.map +1 -0
  203. package/dist/src/commands/playtest/playtest-sessions.test.d.ts +2 -0
  204. package/dist/src/commands/playtest/playtest-sessions.test.d.ts.map +1 -0
  205. package/dist/src/commands/playtest/playtest-sessions.test.js +87 -0
  206. package/dist/src/commands/playtest/playtest-sessions.test.js.map +1 -0
  207. package/dist/src/commands/playtest/restart/restart.d.ts +23 -0
  208. package/dist/src/commands/playtest/restart/restart.d.ts.map +1 -0
  209. package/dist/src/commands/playtest/restart/restart.js +105 -0
  210. package/dist/src/commands/playtest/restart/restart.js.map +1 -0
  211. package/dist/src/commands/playtest/run/run.d.ts +47 -0
  212. package/dist/src/commands/playtest/run/run.d.ts.map +1 -0
  213. package/dist/src/commands/playtest/run/run.js +137 -0
  214. package/dist/src/commands/playtest/run/run.js.map +1 -0
  215. package/dist/src/commands/playtest/start/start.d.ts +42 -0
  216. package/dist/src/commands/playtest/start/start.d.ts.map +1 -0
  217. package/dist/src/commands/playtest/start/start.js +70 -0
  218. package/dist/src/commands/playtest/start/start.js.map +1 -0
  219. package/dist/src/commands/playtest/stop/stop.d.ts +15 -0
  220. package/dist/src/commands/playtest/stop/stop.d.ts.map +1 -0
  221. package/dist/src/commands/playtest/stop/stop.js +24 -0
  222. package/dist/src/commands/playtest/stop/stop.js.map +1 -0
  223. package/dist/src/commands/process/close/close.d.ts +19 -10
  224. package/dist/src/commands/process/close/close.d.ts.map +1 -1
  225. package/dist/src/commands/process/close/close.js +118 -15
  226. package/dist/src/commands/process/close/close.js.map +1 -1
  227. package/dist/src/commands/process/close/close.test.d.ts +2 -0
  228. package/dist/src/commands/process/close/close.test.d.ts.map +1 -0
  229. package/dist/src/commands/process/close/close.test.js +190 -0
  230. package/dist/src/commands/process/close/close.test.js.map +1 -0
  231. package/dist/src/commands/process/info/info.d.ts +45 -5
  232. package/dist/src/commands/process/info/info.d.ts.map +1 -1
  233. package/dist/src/commands/process/info/info.js +117 -13
  234. package/dist/src/commands/process/info/info.js.map +1 -1
  235. package/dist/src/commands/process/info/info.test.js +140 -38
  236. package/dist/src/commands/process/info/info.test.js.map +1 -1
  237. package/dist/src/commands/process/launch/launch.d.ts +11 -1
  238. package/dist/src/commands/process/launch/launch.d.ts.map +1 -1
  239. package/dist/src/commands/process/launch/launch.js +37 -7
  240. package/dist/src/commands/process/launch/launch.js.map +1 -1
  241. package/dist/src/commands/process/launch/launch.test.js +99 -20
  242. package/dist/src/commands/process/launch/launch.test.js.map +1 -1
  243. package/dist/src/commands/process/list/list.d.ts +2 -1
  244. package/dist/src/commands/process/list/list.d.ts.map +1 -1
  245. package/dist/src/commands/process/list/list.js +9 -6
  246. package/dist/src/commands/process/list/list.js.map +1 -1
  247. package/dist/src/commands/process/list/list.test.js +1 -0
  248. package/dist/src/commands/process/list/list.test.js.map +1 -1
  249. package/dist/src/commands/process/run/run.d.ts +9 -0
  250. package/dist/src/commands/process/run/run.d.ts.map +1 -1
  251. package/dist/src/commands/process/run/run.js +15 -5
  252. package/dist/src/commands/process/run/run.js.map +1 -1
  253. package/dist/src/commands/serve/serve.d.ts +2 -0
  254. package/dist/src/commands/serve/serve.d.ts.map +1 -1
  255. package/dist/src/commands/serve/serve.js +17 -4
  256. package/dist/src/commands/serve/serve.js.map +1 -1
  257. package/dist/src/commands/serve/serve.test.js +9 -2
  258. package/dist/src/commands/serve/serve.test.js.map +1 -1
  259. package/dist/src/commands/viewport/screenshot/screenshot.d.ts.map +1 -1
  260. package/dist/src/commands/viewport/screenshot/screenshot.js +4 -1
  261. package/dist/src/commands/viewport/screenshot/screenshot.js.map +1 -1
  262. package/dist/src/commands/viewport/screenshot/screenshot.test.js +5 -9
  263. package/dist/src/commands/viewport/screenshot/screenshot.test.js.map +1 -1
  264. package/dist/src/deploy/deploy-places.d.ts +39 -0
  265. package/dist/src/deploy/deploy-places.d.ts.map +1 -0
  266. package/dist/src/deploy/deploy-places.js +162 -0
  267. package/dist/src/deploy/deploy-places.js.map +1 -0
  268. package/dist/src/deploy/deploy-places.test.d.ts +2 -0
  269. package/dist/src/deploy/deploy-places.test.d.ts.map +1 -0
  270. package/dist/src/deploy/deploy-places.test.js +96 -0
  271. package/dist/src/deploy/deploy-places.test.js.map +1 -0
  272. package/dist/src/index.d.ts +2 -2
  273. package/dist/src/index.d.ts.map +1 -1
  274. package/dist/src/index.js +1 -1
  275. package/dist/src/index.js.map +1 -1
  276. package/dist/src/plugin/persistent-plugin-installer.d.ts.map +1 -1
  277. package/dist/src/plugin/persistent-plugin-installer.js +2 -1
  278. package/dist/src/plugin/persistent-plugin-installer.js.map +1 -1
  279. package/dist/src/plugin/persistent-plugin-installer.test.js +3 -0
  280. package/dist/src/plugin/persistent-plugin-installer.test.js.map +1 -1
  281. package/dist/src/plugin/plugin-build-version.d.ts +7 -0
  282. package/dist/src/plugin/plugin-build-version.d.ts.map +1 -0
  283. package/dist/src/plugin/plugin-build-version.js +42 -0
  284. package/dist/src/plugin/plugin-build-version.js.map +1 -0
  285. package/dist/src/plugin/plugin-build-version.test.d.ts +2 -0
  286. package/dist/src/plugin/plugin-build-version.test.d.ts.map +1 -0
  287. package/dist/src/plugin/plugin-build-version.test.js +41 -0
  288. package/dist/src/plugin/plugin-build-version.test.js.map +1 -0
  289. package/dist/src/plugin/plugin-injector.d.ts.map +1 -1
  290. package/dist/src/plugin/plugin-injector.js +7 -1
  291. package/dist/src/plugin/plugin-injector.js.map +1 -1
  292. package/dist/src/process/studio-process-closer.d.ts +35 -0
  293. package/dist/src/process/studio-process-closer.d.ts.map +1 -0
  294. package/dist/src/process/studio-process-closer.js +129 -0
  295. package/dist/src/process/studio-process-closer.js.map +1 -0
  296. package/dist/src/process/studio-process-closer.test.d.ts +2 -0
  297. package/dist/src/process/studio-process-closer.test.d.ts.map +1 -0
  298. package/dist/src/process/studio-process-closer.test.js +80 -0
  299. package/dist/src/process/studio-process-closer.test.js.map +1 -0
  300. package/dist/src/process/studio-settings.d.ts +14 -0
  301. package/dist/src/process/studio-settings.d.ts.map +1 -0
  302. package/dist/src/process/studio-settings.js +50 -0
  303. package/dist/src/process/studio-settings.js.map +1 -0
  304. package/dist/src/process/studio-settings.test.d.ts +2 -0
  305. package/dist/src/process/studio-settings.test.d.ts.map +1 -0
  306. package/dist/src/process/studio-settings.test.js +16 -0
  307. package/dist/src/process/studio-settings.test.js.map +1 -0
  308. package/dist/src/process/studio-window-state.d.ts +13 -0
  309. package/dist/src/process/studio-window-state.d.ts.map +1 -0
  310. package/dist/src/process/studio-window-state.js +48 -0
  311. package/dist/src/process/studio-window-state.js.map +1 -0
  312. package/dist/src/server/studio-bridge-server.d.ts +3 -1
  313. package/dist/src/server/studio-bridge-server.d.ts.map +1 -1
  314. package/dist/src/server/studio-bridge-server.js +12 -4
  315. package/dist/src/server/studio-bridge-server.js.map +1 -1
  316. package/dist/src/server/web-socket-protocol.d.ts +173 -6
  317. package/dist/src/server/web-socket-protocol.d.ts.map +1 -1
  318. package/dist/src/server/web-socket-protocol.js +244 -1
  319. package/dist/src/server/web-socket-protocol.js.map +1 -1
  320. package/dist/src/server/web-socket-protocol.test.js +48 -0
  321. package/dist/src/server/web-socket-protocol.test.js.map +1 -1
  322. package/dist/src/test/e2e/persistent-session.test.js +121 -0
  323. package/dist/src/test/e2e/persistent-session.test.js.map +1 -1
  324. package/dist/src/test/e2e/split-server.test.d.ts +3 -5
  325. package/dist/src/test/e2e/split-server.test.d.ts.map +1 -1
  326. package/dist/src/test/e2e/split-server.test.js +3 -5
  327. package/dist/src/test/e2e/split-server.test.js.map +1 -1
  328. package/dist/tsconfig.tsbuildinfo +1 -1
  329. package/docker/Dockerfile +3 -0
  330. package/package.json +8 -6
  331. package/src/bridge/bridge-connection.test.ts +126 -0
  332. package/src/bridge/bridge-connection.ts +217 -22
  333. package/src/bridge/bridge-session.test.ts +6 -4
  334. package/src/bridge/bridge-session.ts +273 -28
  335. package/src/bridge/index.ts +3 -0
  336. package/src/bridge/internal/bridge-client.test.ts +23 -0
  337. package/src/bridge/internal/bridge-client.ts +25 -7
  338. package/src/bridge/internal/bridge-host.test.ts +38 -0
  339. package/src/bridge/internal/bridge-host.ts +47 -0
  340. package/src/bridge/internal/hand-off.ts +4 -1
  341. package/src/bridge/internal/host-protocol.test.ts +15 -0
  342. package/src/bridge/internal/host-protocol.ts +148 -37
  343. package/src/bridge/internal/instance-state.ts +34 -0
  344. package/src/bridge/internal/transport-client.ts +2 -1
  345. package/src/bridge/internal/transport-server.ts +5 -1
  346. package/src/bridge/types.ts +47 -2
  347. package/src/cli/adapters/cli-command-adapter-handler.test.ts +28 -0
  348. package/src/cli/adapters/cli-command-adapter.ts +150 -18
  349. package/src/cli/adapters/group-builder.test.ts +34 -2
  350. package/src/cli/adapters/group-builder.ts +52 -20
  351. package/src/cli/adapters/help-formatter.test.ts +1 -1
  352. package/src/cli/adapters/help-formatter.ts +4 -3
  353. package/src/cli/adapters/playtest-edit-guard.test.ts +54 -0
  354. package/src/cli/args/global-args.ts +1 -1
  355. package/src/cli/cli-output-context.test.ts +55 -0
  356. package/src/cli/cli-output-context.ts +50 -0
  357. package/src/cli/cli.ts +49 -17
  358. package/src/cli/managed-studio-run.test.ts +71 -0
  359. package/src/cli/managed-studio-run.ts +135 -0
  360. package/src/cli/resolve-session.test.ts +1 -1
  361. package/src/cli/resolve-session.ts +1 -1
  362. package/src/cli/script-executor.ts +99 -51
  363. package/src/commands/console/exec/exec.test.ts +96 -3
  364. package/src/commands/console/exec/exec.ts +59 -6
  365. package/src/commands/console/exec/execute.lua +356 -240
  366. package/src/commands/console/exec/execute.spec.lua +286 -0
  367. package/src/commands/console/logs/logs.test.ts +76 -4
  368. package/src/commands/console/logs/logs.ts +132 -17
  369. package/src/commands/console/logs/query-logs.lua +85 -52
  370. package/src/commands/console/logs/query-logs.spec.lua +132 -0
  371. package/src/commands/explorer/export/export-instances.lua +108 -0
  372. package/src/commands/explorer/export/export-instances.spec.lua +87 -0
  373. package/src/commands/explorer/export/export.test.ts +27 -0
  374. package/src/commands/explorer/export/export.ts +60 -0
  375. package/src/commands/explorer/find/find-instances.lua +174 -0
  376. package/src/commands/explorer/find/find-instances.spec.lua +122 -0
  377. package/src/commands/explorer/find/find.test.ts +53 -0
  378. package/src/commands/explorer/find/find.ts +113 -0
  379. package/src/commands/explorer/grep/grep-scripts.lua +214 -0
  380. package/src/commands/explorer/grep/grep-scripts.spec.lua +130 -0
  381. package/src/commands/explorer/grep/grep.test.ts +45 -0
  382. package/src/commands/explorer/grep/grep.ts +93 -0
  383. package/src/commands/explorer/import/import-instances.lua +106 -0
  384. package/src/commands/explorer/import/import-instances.spec.lua +84 -0
  385. package/src/commands/explorer/import/import.test.ts +60 -0
  386. package/src/commands/explorer/import/import.ts +66 -0
  387. package/src/commands/explorer/query/query-data-model.lua +124 -152
  388. package/src/commands/explorer/query/query-data-model.spec.lua +150 -0
  389. package/src/commands/formatters.test.ts +7 -1
  390. package/src/commands/framework/action-loader.test.ts +28 -0
  391. package/src/commands/framework/action-loader.ts +10 -2
  392. package/src/commands/framework/arg-builder.ts +26 -3
  393. package/src/commands/framework/define-command.ts +32 -3
  394. package/src/commands/framework/index.ts +1 -0
  395. package/src/commands/index.ts +50 -0
  396. package/src/commands/linux/inject-credentials/inject-credentials.ts +1 -3
  397. package/src/commands/linux/setup/setup.ts +1 -3
  398. package/src/commands/linux/status/status.ts +105 -98
  399. package/src/commands/playtest/player/add/add.ts +85 -0
  400. package/src/commands/playtest/player/list/list.ts +57 -0
  401. package/src/commands/playtest/player/playtest-players.test.ts +146 -0
  402. package/src/commands/playtest/player/playtest-players.ts +270 -0
  403. package/src/commands/playtest/player/remove/remove.ts +78 -0
  404. package/src/commands/playtest/playtest-sessions.test.ts +143 -0
  405. package/src/commands/playtest/playtest-sessions.ts +417 -0
  406. package/src/commands/playtest/restart/restart.ts +199 -0
  407. package/src/commands/playtest/run/playtest-runner.luau +264 -0
  408. package/src/commands/playtest/run/playtest-runner.spec.lua +71 -0
  409. package/src/commands/playtest/run/run-playtest-script.lua +139 -0
  410. package/src/commands/playtest/run/run-playtest-script.spec.lua +43 -0
  411. package/src/commands/playtest/run/run.ts +239 -0
  412. package/src/commands/playtest/start/start-playtest.lua +108 -0
  413. package/src/commands/playtest/start/start.ts +138 -0
  414. package/src/commands/playtest/stop/end-playtest.lua +47 -0
  415. package/src/commands/playtest/stop/stop.ts +51 -0
  416. package/src/commands/process/close/close.test.ts +250 -0
  417. package/src/commands/process/close/close.ts +183 -17
  418. package/src/commands/process/info/info.test.ts +198 -44
  419. package/src/commands/process/info/info.ts +204 -15
  420. package/src/commands/process/info/query-state.lua +42 -29
  421. package/src/commands/process/info/query-state.spec.lua +39 -0
  422. package/src/commands/process/launch/launch.test.ts +138 -21
  423. package/src/commands/process/launch/launch.ts +69 -9
  424. package/src/commands/process/list/list.test.ts +1 -0
  425. package/src/commands/process/list/list.ts +14 -6
  426. package/src/commands/process/run/run.ts +26 -5
  427. package/src/commands/serve/serve.test.ts +17 -2
  428. package/src/commands/serve/serve.ts +25 -6
  429. package/src/commands/viewport/screenshot/capture-screenshot.lua +175 -182
  430. package/src/commands/viewport/screenshot/capture-screenshot.spec.lua +129 -0
  431. package/src/commands/viewport/screenshot/screenshot.test.ts +7 -10
  432. package/src/commands/viewport/screenshot/screenshot.ts +6 -1
  433. package/src/deploy/deploy-places.test.ts +127 -0
  434. package/src/deploy/deploy-places.ts +229 -0
  435. package/src/index.ts +11 -0
  436. package/src/plugin/persistent-plugin-installer.test.ts +4 -0
  437. package/src/plugin/persistent-plugin-installer.ts +2 -1
  438. package/src/plugin/plugin-build-version.test.ts +55 -0
  439. package/src/plugin/plugin-build-version.ts +53 -0
  440. package/src/plugin/plugin-injector.ts +7 -1
  441. package/src/process/studio-process-closer.test.ts +107 -0
  442. package/src/process/studio-process-closer.ts +187 -0
  443. package/src/process/studio-settings.test.ts +18 -0
  444. package/src/process/studio-settings.ts +61 -0
  445. package/src/process/studio-window-state.ts +65 -0
  446. package/src/server/studio-bridge-server.ts +15 -4
  447. package/src/server/web-socket-protocol.test.ts +55 -0
  448. package/src/server/web-socket-protocol.ts +468 -8
  449. package/src/test/e2e/persistent-session.test.ts +137 -0
  450. package/src/test/e2e/split-server.test.ts +3 -5
  451. package/templates/studio-bridge-plugin/default.project.json +3 -0
  452. package/templates/studio-bridge-plugin/src/Shared/ActionRouter.lua +208 -159
  453. package/templates/studio-bridge-plugin/src/Shared/ActionRouter.spec.lua +418 -0
  454. package/templates/studio-bridge-plugin/src/Shared/BuiltInActions.lua +94 -0
  455. package/templates/studio-bridge-plugin/src/Shared/BuiltInActions.spec.lua +166 -0
  456. package/templates/studio-bridge-plugin/src/Shared/DiscoveryStateMachine.lua +118 -137
  457. package/templates/studio-bridge-plugin/src/Shared/DiscoveryStateMachine.spec.lua +228 -0
  458. package/templates/studio-bridge-plugin/src/Shared/MessageBuffer.lua +80 -109
  459. package/templates/studio-bridge-plugin/src/Shared/MessageBuffer.spec.lua +116 -0
  460. package/templates/studio-bridge-plugin/src/Shared/StudioBridgeConnection.lua +233 -0
  461. package/templates/studio-bridge-plugin/src/Shared/StudioBridgeConnection.spec.lua +239 -0
  462. package/templates/studio-bridge-plugin/src/Shared/StudioBridgeLogUtils.lua +53 -0
  463. package/templates/studio-bridge-plugin/src/Shared/StudioBridgeLogUtils.spec.lua +27 -0
  464. package/templates/studio-bridge-plugin/src/Shared/StudioBridgeSessionUtils.lua +164 -0
  465. package/templates/studio-bridge-plugin/src/Shared/StudioBridgeSessionUtils.spec.lua +159 -0
  466. package/templates/studio-bridge-plugin/src/StudioBridgePlugin.server.lua +266 -368
  467. package/templates/studio-bridge-plugin/src/Vendor/png.lua +8 -2
  468. package/test/default.project.json +41 -0
  469. package/test/jest.config.lua +3 -0
  470. package/test/scripts/Server/ServerMain.server.lua +10 -0
  471. package/tsconfig.json +1 -0
  472. package/templates/studio-bridge-plugin/src/Shared/Protocol.lua +0 -132
  473. package/templates/studio-bridge-plugin-test/test/actions.test.lua +0 -580
  474. package/templates/studio-bridge-plugin-test/test/discovery.test.lua +0 -622
  475. package/templates/studio-bridge-plugin-test/test/execute-handler.test.lua +0 -517
  476. package/templates/studio-bridge-plugin-test/test/hash-lifecycle.test.lua +0 -814
  477. package/templates/studio-bridge-plugin-test/test/integration.test.lua +0 -1020
  478. package/templates/studio-bridge-plugin-test/test/new-actions.test.lua +0 -339
  479. package/templates/studio-bridge-plugin-test/test/plugin-entry.test.lua +0 -493
  480. package/templates/studio-bridge-plugin-test/test/protocol.test.lua +0 -506
  481. package/templates/studio-bridge-plugin-test/test/roblox-mocks.lua +0 -108
  482. package/templates/studio-bridge-plugin-test/test/test-runner.lua +0 -112
@@ -1 +1 @@
1
- {"version":3,"file":"persistent-plugin-installer.test.js","sourceRoot":"","sources":["../../../src/plugin/persistent-plugin-installer.test.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE9D,wEAAwE;AACxE,2EAA2E;AAC3E,gCAAgC;AAChC,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAC9C,MAAM,eAAe,GAAG,mCAAmC,CAAC;AAC5D,MAAM,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AACxE,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,eAAe,OAAO,CA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BAA8B,EAAE,KAAK,IAAI,EAAE;YAC5C,UAAU,CAAC,qBAAqB,CAC9B,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CACvD,CAAC;YAEF,MAAM,MAAM,CAAC,8BAA8B,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC3E,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The plugin reports a hash of the template it was built from as its
3
+ * `pluginVersion`, so the CLI can tell when the installed plugin is stale.
4
+ */
5
+ export declare function getPluginBuildVersionAsync(): Promise<string>;
6
+ export declare function hashTemplateDirAsync(dir: string): Promise<string>;
7
+ //# sourceMappingURL=plugin-build-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-build-version.d.ts","sourceRoot":"","sources":["../../../src/plugin/plugin-build-version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,wBAAgB,0BAA0B,IAAI,OAAO,CAAC,MAAM,CAAC,CAG5D;AAED,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAavE"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The plugin reports a hash of the template it was built from as its
3
+ * `pluginVersion`, so the CLI can tell when the installed plugin is stale.
4
+ */
5
+ import { createHash } from 'crypto';
6
+ import * as fs from 'fs/promises';
7
+ import * as path from 'path';
8
+ import { resolveTemplatePath } from '@quenty/nevermore-template-helpers';
9
+ const templateDir = resolveTemplatePath(import.meta.url, 'studio-bridge-plugin');
10
+ let cachedVersion;
11
+ export function getPluginBuildVersionAsync() {
12
+ cachedVersion ??= hashTemplateDirAsync(templateDir);
13
+ return cachedVersion;
14
+ }
15
+ export async function hashTemplateDirAsync(dir) {
16
+ const files = await listTemplateFilesAsync(dir, dir);
17
+ files.sort();
18
+ const hash = createHash('sha256');
19
+ for (const relativePath of files) {
20
+ const contents = await fs.readFile(path.join(dir, relativePath), 'utf-8');
21
+ hash.update(relativePath.replace(/\\/g, '/'));
22
+ hash.update('\0');
23
+ hash.update(contents.replace(/\r\n/g, '\n'));
24
+ hash.update('\0');
25
+ }
26
+ return hash.digest('hex').slice(0, 12);
27
+ }
28
+ async function listTemplateFilesAsync(baseDir, currentDir) {
29
+ const entries = await fs.readdir(currentDir, { withFileTypes: true });
30
+ const files = [];
31
+ for (const entry of entries) {
32
+ const fullPath = path.join(currentDir, entry.name);
33
+ if (entry.isDirectory()) {
34
+ files.push(...(await listTemplateFilesAsync(baseDir, fullPath)));
35
+ }
36
+ else if (!entry.name.endsWith('.spec.lua')) {
37
+ files.push(path.relative(baseDir, fullPath));
38
+ }
39
+ }
40
+ return files;
41
+ }
42
+ //# sourceMappingURL=plugin-build-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-build-version.js","sourceRoot":"","sources":["../../../src/plugin/plugin-build-version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,MAAM,WAAW,GAAG,mBAAmB,CACrC,MAAM,CAAC,IAAI,CAAC,GAAG,EACf,sBAAsB,CACvB,CAAC;AAEF,IAAI,aAA0C,CAAC;AAE/C,MAAM,UAAU,0BAA0B;IACxC,aAAa,KAAK,oBAAoB,CAAC,WAAW,CAAC,CAAC;IACpD,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,GAAW;IACpD,MAAM,KAAK,GAAG,MAAM,sBAAsB,CAAC,GAAG,EAAE,GAAG,C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AAC,WAAW,CAAC,EAAE,CAAC;YAC7C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=plugin-build-version.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-build-version.test.d.ts","sourceRoot":"","sources":["../../../src/plugin/plugin-build-version.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,41 @@
1
+ import { describe, it, expect, afterEach } from 'vitest';
2
+ import * as fs from 'fs/promises';
3
+ import * as os from 'os';
4
+ import * as path from 'path';
5
+ import { hashTemplateDirAsync } from './plugin-build-version.js';
6
+ describe('hashTemplateDirAsync', () => {
7
+ const dirs = [];
8
+ afterEach(async () => {
9
+ for (const dir of dirs) {
10
+ await fs.rm(dir, { recursive: true, force: true });
11
+ }
12
+ dirs.length = 0;
13
+ });
14
+ async function makeTemplateAsync(files) {
15
+ const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'sb-template-'));
16
+ dirs.push(dir);
17
+ for (const [name, contents] of Object.entries(files)) {
18
+ await fs.mkdir(path.dirname(path.join(dir, name)), { recursive: true });
19
+ await fs.writeFile(path.join(dir, name), contents);
20
+ }
21
+ return dir;
22
+ }
23
+ it('changes when plugin source changes', async () => {
24
+ const before = await makeTemplateAsync({ 'src/Plugin.lua': 'print(1)' });
25
+ const after = await makeTemplateAsync({ 'src/Plugin.lua': 'print(2)' });
26
+ expect(await hashTemplateDirAsync(before)).not.toBe(await hashTemplateDirAsync(after));
27
+ });
28
+ it('ignores specs and line endings', async () => {
29
+ const plain = await makeTemplateAsync({ 'src/Plugin.lua': 'a\nb\n' });
30
+ const withSpec = await makeTemplateAsync({
31
+ 'src/Plugin.lua': 'a\r\nb\r\n',
32
+ 'src/Plugin.spec.lua': 'test',
33
+ });
34
+ expect(await hashTemplateDirAsync(plain)).toBe(await hashTemplateDirAsync(withSpec));
35
+ });
36
+ it('is a short hex string', async () => {
37
+ const dir = await makeTemplateAsync({ 'src/Plugin.lua': 'print(1)' });
38
+ expect(await hashTemplateDirAsync(dir)).toMatch(/^[0-9a-f]{12}$/);
39
+ });
40
+ });
41
+ //# sourceMappingURL=plugin-build-version.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-build-version.test.js","sourceRoot":"","sources":["../../../src/plugin/plugin-build-version.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,MAAM,IAAI,GAAa,EAAE,CAAC;IAE1B,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,MAAM,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACrD,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,KAAK,UAAU,iBAAiB,CAC9B,KAA6B;QAE7B,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACf,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,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AG,GAAG,MAAM,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAC,CAAC;QAEtE,MAAM,CAAC,MAAM,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-injector.d.ts","sourceRoot":"","sources":["../../../src/plugin/plugin-injector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,8CAA8C;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,cAAc,CAAC,CA8BzB"}
1
+ {"version":3,"file":"plugin-injector.d.ts","sourceRoot":"","sources":["../../../src/plugin/plugin-injector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,8CAA8C;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,cAAc,CAAC,CAmCzB"}
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { BuildContext, TemplateHelper, resolveTemplatePath, } from '@quenty/nevermore-template-helpers';
6
6
  import { findPluginsFolder } from '../process/studio-process-manager.js';
7
+ import { getPluginBuildVersionAsync } from './plugin-build-version.js';
7
8
  const templateDir = resolveTemplatePath(import.meta.url, 'studio-bridge-plugin');
8
9
  /**
9
10
  * Build and install the plugin .rbxm into Studio's plugins folder using rojo.
@@ -14,7 +15,12 @@ export async function injectPluginAsync(options) {
14
15
  prefix: 'studio-bridge-plugin-',
15
16
  });
16
17
  try {
17
- await TemplateHelper.createDirectoryContentsAsync(templateDir, buildContext.buildDir, { PORT: String(port), SESSION_ID: sessionId, EPHEMERAL: 'true' }, false);
18
+ await TemplateHelper.createDirectoryContentsAsync(templateDir, buildContext.buildDir, {
19
+ PORT: String(port),
20
+ SESSION_ID: sessionId,
21
+ EPHEMERAL: 'true',
22
+ PLUGIN_VERSION: await getPluginBuildVersionAsync(),
23
+ }, false);
18
24
  const pluginFileName = `studio-bridge-${sessionId}.rbxm`;
19
25
  const pluginPath = await buildContext.rojoBuildAsync({
20
26
  projectPath: buildContext.resolvePath('default.project.json'),
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-injector.js","sourceRoot":"","sources":["../../../src/plugin/plugin-injector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,YAAY,EACZ,cAAc,EACd,mBAAmB,GACpB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAEzE,MAAM,WAAW,GAAG,mBAAmB,CACrC,MAAM,CAAC,IAAI,CAAC,GAAG,EACf,sBAAsB,CACvB,CAAC;AAcF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,OAA4B;IAE5B,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAEpC,MAAM,YAAY,GAAG,MAAM,YAAY,CAAC,WAAW,CAAC;QAClD,MAAM,EAAE,uBAAuB;KAChC,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,MAAM,cAAc,CAAC,4BAA4B,CAC/C,WAAW,EACX,YAAY,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H,MAAM,cAAc,CAAC,4BAA4B,CAC/C,WAAW,EACX,YAAY,CAAC,QAAQ,EACrB;YACE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC;YAClB,UAAU,EAAE,SAAS;YACrB,SAAS,EAAE,MAAM;YACjB,cAAc,EAAE,MAAM,0BAA0B,EAAE;SACnD,EACD,KAAK,CACN,CAAC;QAEF,MAAM,cAAc,GAAG,iBAAiB,SAAS,OAAO,CAAC;QACzD,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,cAAc,CAAC;YACnD,WAAW,EAAE,YAAY,CAAC,WAAW,CAAC,sBAAsB,CAAC;YAC7D,MAAM,EAAE,cAAc;YACtB,aAAa,EAAE,iBAAiB,EAAE;SACnC,CAAC,CAAC;QAEH,OAAO;YACL,UAAU,EAAE,UAAW;YACvB,YAAY,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE;SAChD,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,YAAY,CAAC,YAAY,EAAE,CAAC;QAClC,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Finds running Roblox Studio processes and closes them. The plugin API has
3
+ * no process id, so a bridge session is matched to its process by the place
4
+ * name Studio shows in the window title, or by the place id a cloud place was
5
+ * launched with.
6
+ */
7
+ export interface RunningStudioProcess {
8
+ pid: number;
9
+ windowTitle: string;
10
+ commandLine?: string;
11
+ }
12
+ export interface CloseStudioOptions {
13
+ force?: boolean;
14
+ exitTimeoutMs?: number;
15
+ }
16
+ export declare function listStudioProcessesAsync(): Promise<RunningStudioProcess[]>;
17
+ export declare function parseWindowsProcessList(stdout: string): RunningStudioProcess[];
18
+ export declare function parseMacProcessList(stdout: string): RunningStudioProcess[];
19
+ /**
20
+ * Processes whose window shows the given place. Studio titles a local file
21
+ * by its full path and a cloud place by its name on the website, which the
22
+ * plugin can't see, so with no title match a cloud place is found by the
23
+ * `placeId` Studio was launched with.
24
+ */
25
+ export declare function matchStudioProcesses(processes: RunningStudioProcess[], placeName: string, placeId?: number): RunningStudioProcess[];
26
+ /** Processes Studio launched with `placeId`, as `process launch` and the website's "Edit in Studio" do. */
27
+ export declare function matchStudioProcessesByPlaceId(processes: RunningStudioProcess[], placeId: number): RunningStudioProcess[];
28
+ /**
29
+ * Close a Studio process. Without `force` Studio is asked to close its
30
+ * window, which it can refuse by prompting to save. Resolves whether the
31
+ * process exited within the timeout.
32
+ */
33
+ export declare function closeStudioProcessAsync(pid: number, options?: CloseStudioOptions): Promise<boolean>;
34
+ export declare function isProcessRunning(pid: number): boolean;
35
+ //# sourceMappingURL=studio-process-closer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"studio-process-closer.d.ts","sourceRoot":"","sources":["../../../src/process/studio-process-closer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAsB,wBAAwB,IAAI,OAAO,CACvD,oBAAoB,EAAE,CACvB,CAuBA;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,GACb,oBAAoB,EAAE,CAiBxB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,EAAE,CAgB1E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,oBAAoB,EAAE,EACjC,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,GACf,oBAAoB,EAAE,CAgBxB;AAED,2GAA2G;AAC3G,wBAAgB,6BAA6B,CAC3C,SAAS,EAAE,oBAAoB,EAAE,EACjC,OAAO,EAAE,MAAM,GACd,oBAAoB,EAAE,CAKxB;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,OAAO,CAAC,CA6BlB;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOrD"}
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Finds running Roblox Studio processes and closes them. The plugin API has
3
+ * no process id, so a bridge session is matched to its process by the place
4
+ * name Studio shows in the window title, or by the place id a cloud place was
5
+ * launched with.
6
+ */
7
+ import { execa } from 'execa';
8
+ const WINDOW_TITLE_SUFFIX = ' - Roblox Studio';
9
+ const EXIT_POLL_INTERVAL_MS = 250;
10
+ export async function listStudioProcessesAsync() {
11
+ if (process.platform === 'win32') {
12
+ const { stdout } = await execa('powershell.exe', [
13
+ '-NoProfile',
14
+ '-NonInteractive',
15
+ '-Command',
16
+ '@(Get-CimInstance Win32_Process -Filter "Name=\'RobloxStudioBeta.exe\'" | ForEach-Object { [pscustomobject]@{ Id = $_.ProcessId; MainWindowTitle = (Get-Process -Id $_.ProcessId -ErrorAction SilentlyContinue).MainWindowTitle; CommandLine = $_.CommandLine } }) | ConvertTo-Json -Compress',
17
+ ], { reject: false });
18
+ return parseWindowsProcessList(stdout);
19
+ }
20
+ if (process.platform === 'darwin') {
21
+ const { stdout } = await execa('ps', ['-axo', 'pid=,command='], {
22
+ reject: false,
23
+ });
24
+ return parseMacProcessList(stdout);
25
+ }
26
+ throw new Error(`Closing Studio is not supported on ${process.platform}`);
27
+ }
28
+ export function parseWindowsProcessList(stdout) {
29
+ const trimmed = stdout.trim();
30
+ if (!trimmed)
31
+ return [];
32
+ const parsed = JSON.parse(trimmed);
33
+ const entries = Array.isArray(parsed) ? parsed : [parsed];
34
+ return entries.map((entry) => ({
35
+ pid: entry.Id,
36
+ windowTitle: entry.MainWindowTitle ?? '',
37
+ commandLine: entry.CommandLine ?? undefined,
38
+ }));
39
+ }
40
+ export function parseMacProcessList(stdout) {
41
+ const processes = [];
42
+ for (const line of stdout.split('\n')) {
43
+ const match = /^\s*(\d+)\s+(.*RobloxStudio\.app\/Contents\/MacOS\/RobloxStudio.*)$/.exec(line);
44
+ if (match) {
45
+ processes.push({
46
+ pid: Number(match[1]),
47
+ windowTitle: match[2],
48
+ commandLine: match[2],
49
+ });
50
+ }
51
+ }
52
+ return processes;
53
+ }
54
+ /**
55
+ * Processes whose window shows the given place. Studio titles a local file
56
+ * by its full path and a cloud place by its name on the website, which the
57
+ * plugin can't see, so with no title match a cloud place is found by the
58
+ * `placeId` Studio was launched with.
59
+ */
60
+ export function matchStudioProcesses(processes, placeName, placeId) {
61
+ const byTitle = processes.filter((proc) => {
62
+ const title = proc.windowTitle.endsWith(WINDOW_TITLE_SUFFIX)
63
+ ? proc.windowTitle.slice(0, -WINDOW_TITLE_SUFFIX.length)
64
+ : proc.windowTitle;
65
+ return (title === placeName ||
66
+ title.endsWith(`\\${placeName}`) ||
67
+ title.endsWith(`/${placeName}`));
68
+ });
69
+ if (byTitle.length > 0 || !placeId) {
70
+ return byTitle;
71
+ }
72
+ return matchStudioProcessesByPlaceId(processes, placeId);
73
+ }
74
+ /** Processes Studio launched with `placeId`, as `process launch` and the website's "Edit in Studio" do. */
75
+ export function matchStudioProcessesByPlaceId(processes, placeId) {
76
+ const launchedPlaceId = new RegExp(`placeId:${placeId}(\\D|$)`);
77
+ return processes.filter((proc) => proc.commandLine && launchedPlaceId.test(proc.commandLine));
78
+ }
79
+ /**
80
+ * Close a Studio process. Without `force` Studio is asked to close its
81
+ * window, which it can refuse by prompting to save. Resolves whether the
82
+ * process exited within the timeout.
83
+ */
84
+ export async function closeStudioProcessAsync(pid, options = {}) {
85
+ const { force = false, exitTimeoutMs = 10_000 } = options;
86
+ if (process.platform === 'win32') {
87
+ if (force) {
88
+ await execa('taskkill', ['/F', '/T', '/PID', String(pid)], {
89
+ reject: false,
90
+ });
91
+ }
92
+ else {
93
+ await execa('powershell.exe', [
94
+ '-NoProfile',
95
+ '-NonInteractive',
96
+ '-Command',
97
+ `(Get-Process -Id ${pid} -ErrorAction SilentlyContinue).CloseMainWindow() | Out-Null`,
98
+ ], { reject: false });
99
+ }
100
+ }
101
+ else {
102
+ try {
103
+ process.kill(pid, force ? 'SIGKILL' : 'SIGTERM');
104
+ }
105
+ catch {
106
+ return !isProcessRunning(pid);
107
+ }
108
+ }
109
+ return waitForExitAsync(pid, exitTimeoutMs);
110
+ }
111
+ export function isProcessRunning(pid) {
112
+ try {
113
+ process.kill(pid, 0);
114
+ return true;
115
+ }
116
+ catch (err) {
117
+ return err.code === 'EPERM';
118
+ }
119
+ }
120
+ async function waitForExitAsync(pid, timeoutMs) {
121
+ const deadline = Date.now() + timeoutMs;
122
+ while (Date.now() < deadline) {
123
+ if (!isProcessRunning(pid))
124
+ return true;
125
+ await new Promise((resolve) => setTimeout(resolve, EXIT_POLL_INTERVAL_MS));
126
+ }
127
+ return !isProcessRunning(pid);
128
+ }
129
+ //# sourceMappingURL=studio-process-closer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"studio-process-closer.js","sourceRoot":"","sources":["../../../src/process/studio-process-closer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAC/C,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAalC,MAAM,CAAC,KAAK,UAAU,wBAAwB;IAG5C,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,KAAK,CAC5B,gBAAgB,EAChB;YACE,YAAY;YACZ,iBAAiB;YACjB,UAAU;YACV,+RAA+R;SAChS,EACD,EAAE,MAAM,EAAE,KAAK,EAAE,CAClB,CAAC;QACF,OAAO,uBAAuB,CAAC,MAAM,CAAC,CAAC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,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;IACxC,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;QAC7B,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QACxC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;AAChC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=studio-process-closer.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"studio-process-closer.test.d.ts","sourceRoot":"","sources":["../../../src/process/studio-process-closer.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,80 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { matchStudioProcesses, parseMacProcessList, parseWindowsProcessList, } from './studio-process-closer.js';
3
+ describe('parseWindowsProcessList', () => {
4
+ it('parses a single process object', () => {
5
+ expect(parseWindowsProcessList('{"Id":9792,"MainWindowTitle":"C:\\\\places\\\\test-place.rbxl - Roblox Studio"}')).toEqual([
6
+ { pid: 9792, windowTitle: 'C:\\places\\test-place.rbxl - Roblox Studio' },
7
+ ]);
8
+ });
9
+ it('parses an array and treats a null title as empty', () => {
10
+ expect(parseWindowsProcessList('[{"Id":1,"MainWindowTitle":"Map - Roblox Studio"},{"Id":2,"MainWindowTitle":null}]')).toEqual([
11
+ { pid: 1, windowTitle: 'Map - Roblox Studio' },
12
+ { pid: 2, windowTitle: '' },
13
+ ]);
14
+ });
15
+ it('returns nothing when no Studio is running', () => {
16
+ expect(parseWindowsProcessList('')).toEqual([]);
17
+ });
18
+ });
19
+ describe('parseMacProcessList', () => {
20
+ it('keeps only Studio processes', () => {
21
+ const stdout = [
22
+ ' 101 /Applications/RobloxStudio.app/Contents/MacOS/RobloxStudio /Users/me/test-place.rbxl',
23
+ ' 102 /usr/bin/zsh',
24
+ ].join('\n');
25
+ expect(parseMacProcessList(stdout)).toEqual([
26
+ {
27
+ pid: 101,
28
+ windowTitle: '/Applications/RobloxStudio.app/Contents/MacOS/RobloxStudio /Users/me/test-place.rbxl',
29
+ commandLine: '/Applications/RobloxStudio.app/Contents/MacOS/RobloxStudio /Users/me/test-place.rbxl',
30
+ },
31
+ ]);
32
+ });
33
+ });
34
+ describe('matchStudioProcesses', () => {
35
+ const processes = [
36
+ { pid: 1, windowTitle: 'C:\\places\\test-place.rbxl - Roblox Studio' },
37
+ { pid: 2, windowTitle: 'Map - Roblox Studio' },
38
+ { pid: 3, windowTitle: 'Other Map - Roblox Studio' },
39
+ { pid: 4, windowTitle: '' },
40
+ ];
41
+ it('matches a local file by its path', () => {
42
+ expect(matchStudioProcesses(processes, 'test-place.rbxl')).toEqual([
43
+ processes[0],
44
+ ]);
45
+ });
46
+ it('matches a cloud place by the place id it was launched with', () => {
47
+ const cloud = [
48
+ {
49
+ pid: 5,
50
+ windowTitle: 'My Game (abc123) - Roblox Studio',
51
+ commandLine: 'RobloxStudioBeta.exe roblox-studio:1+launchmode:edit+task:EditPlace+placeId:123+universeId:9',
52
+ },
53
+ {
54
+ pid: 6,
55
+ windowTitle: 'Other - Roblox Studio',
56
+ commandLine: 'RobloxStudioBeta.exe roblox-studio:1+placeId:1234',
57
+ },
58
+ ];
59
+ expect(matchStudioProcesses(cloud, 'Place1', 123)).toEqual([cloud[0]]);
60
+ expect(matchStudioProcesses(cloud, 'Place1')).toEqual([]);
61
+ });
62
+ it('prefers a title match over a launch place id', () => {
63
+ const cloud = [
64
+ {
65
+ pid: 5,
66
+ windowTitle: 'Other - Roblox Studio',
67
+ commandLine: 'RobloxStudioBeta.exe roblox-studio:1+placeId:123',
68
+ },
69
+ { pid: 6, windowTitle: 'Map - Roblox Studio' },
70
+ ];
71
+ expect(matchStudioProcesses(cloud, 'Map', 123)).toEqual([cloud[1]]);
72
+ });
73
+ it('matches a cloud place by its exact name', () => {
74
+ expect(matchStudioProcesses(processes, 'Map')).toEqual([processes[1]]);
75
+ });
76
+ it('matches nothing for an unknown place', () => {
77
+ expect(matchStudioProcesses(processes, 'Missing')).toEqual([]);
78
+ });
79
+ });
80
+ //# sourceMappingURL=studio-process-closer.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"studio-process-closer.test.js","sourceRoot":"","sources":["../../../src/process/studio-process-closer.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AAEpC,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,MAAM,CACJ,uBAAuB,CACrB,iFAAiF,CAClF,CACF,CAAC,OAAO,CAAC;YACR,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,6CAA6C,EAAE;SAC1E,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,MAAM,CACJ,uBAAuB,CACrB,oFAAoF,CACrF,CACF,CAAC,OAAO,CAAC;YACR,EAAE,GAAG,EAAE,CAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE;YAC9C,EAAE,GAAG,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE;SAC5B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAA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AE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvE,MAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,KAAK,GAAG;YACZ;gBACE,GAAG,EAAE,CAAC;gBACN,WAAW,EAAE,uBAAuB;gBACpC,WAAW,EAAE,kDAAkD;aAChE;YACD,EAAE,GAAG,EAAE,CAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE;SAC/C,CAAC;QAEF,MAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACjD,MAAM,CAAC,oBAAoB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,CAAC,oBAAoB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Reads Studio's own settings from the file it saves them to, for settings a
3
+ * plugin can't read.
4
+ */
5
+ /**
6
+ * Whether Studio's "Load user plugins on playtest" setting is on. Without it,
7
+ * the plugin doesn't load into a playtest's DataModels, so they never connect
8
+ * to the bridge. Undefined when the setting can't be read, e.g. on macOS,
9
+ * whose settings file isn't located here.
10
+ */
11
+ export declare function tryReadLoadUserPluginsOnPlaytestAsync(): Promise<boolean | undefined>;
12
+ /** Reads `<bool name="...">true|false</bool>` from a Studio settings file. */
13
+ export declare function parseBoolSetting(xml: string, name: string): boolean | undefined;
14
+ //# sourceMappingURL=studio-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"studio-settings.d.ts","sourceRoot":"","sources":["../../../src/process/studio-settings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH;;;;;GAKG;AACH,wBAAsB,qCAAqC,IAAI,OAAO,CACpE,OAAO,GAAG,SAAS,CACpB,CAaA;AAED,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GACX,OAAO,GAAG,SAAS,CAKrB"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Reads Studio's own settings from the file it saves them to, for settings a
3
+ * plugin can't read.
4
+ */
5
+ import * as fs from 'fs/promises';
6
+ import * as path from 'path';
7
+ import { findPluginsFolder } from './studio-process-manager.js';
8
+ /** The XML name of Studio's "Load user plugins on playtest" setting. */
9
+ const LOAD_USER_PLUGINS_ON_PLAYTEST = 'LoadUserPluginsInRunModes';
10
+ /**
11
+ * Whether Studio's "Load user plugins on playtest" setting is on. Without it,
12
+ * the plugin doesn't load into a playtest's DataModels, so they never connect
13
+ * to the bridge. Undefined when the setting can't be read, e.g. on macOS,
14
+ * whose settings file isn't located here.
15
+ */
16
+ export async function tryReadLoadUserPluginsOnPlaytestAsync() {
17
+ const settingsPath = findGlobalSettingsPath();
18
+ if (!settingsPath) {
19
+ return undefined;
20
+ }
21
+ let xml;
22
+ try {
23
+ xml = await fs.readFile(settingsPath, 'utf8');
24
+ }
25
+ catch {
26
+ return undefined;
27
+ }
28
+ return parseBoolSetting(xml, LOAD_USER_PLUGINS_ON_PLAYTEST);
29
+ }
30
+ /** Reads `<bool name="...">true|false</bool>` from a Studio settings file. */
31
+ export function parseBoolSetting(xml, name) {
32
+ const match = new RegExp(`<bool name="${name}">\\s*(true|false)\\s*</bool>`).exec(xml);
33
+ return match ? match[1] === 'true' : undefined;
34
+ }
35
+ /** Studio keeps its settings beside the plugins folder on Windows and under Wine. */
36
+ function findGlobalSettingsPath() {
37
+ if (process.platform !== 'win32' && process.platform !== 'linux') {
38
+ return undefined;
39
+ }
40
+ try {
41
+ const robloxDir = process.platform === 'linux'
42
+ ? path.posix.dirname(findPluginsFolder())
43
+ : path.dirname(findPluginsFolder());
44
+ return path.join(robloxDir, 'GlobalSettings_13.xml');
45
+ }
46
+ catch {
47
+ return undefined;
48
+ }
49
+ }
50
+ //# sourceMappingURL=studio-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"studio-settings.js","sourceRoot":"","sources":["../../../src/process/studio-settings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEhE,wEAAwE;AACxE,MAAM,6BAA6B,GAAG,2BAA2B,CAAC;AAElE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,qCAAqC;IAGzD,MAAM,YAAY,GAAG,sBAAsB,EAAE,CAAC;IAC9C,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,gBAAgB,CAAC,GAAG,EAAE,6BAA6B,CAAC,CAAC;AAC9D,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,gBAAgB,CAC9B,GAAW,EACX,IAAY;IAEZ,MAAM,KAAK,GAAG,IAAI,MAAM,CACtB,eAAe,IAAI,+BAA+B,CACnD,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACZ,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACjD,CAAC;AAED,qFAAqF;AACrF,SAAS,sBAAsB;IAC7B,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjE,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,CAAC;QACH,MAAM,SAAS,GACb,OAAO,CAAC,QAAQ,KAAK,OAAO;YAC1B,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC;YACzC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC;IACvD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=studio-settings.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"studio-settings.test.d.ts","sourceRoot":"","sources":["../../../src/process/studio-settings.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { parseBoolSetting } from './studio-settings.js';
3
+ describe('parseBoolSetting', () => {
4
+ const xml = `<Item class="UserSettings"><Properties>
5
+ <bool name="LoadAllBuiltinPluginsInRunModes">true</bool>
6
+ <bool name="LoadUserPluginsInRunModes">false</bool>
7
+ </Properties></Item>`;
8
+ it('reads the named setting, not one whose name contains it', () => {
9
+ expect(parseBoolSetting(xml, 'LoadUserPluginsInRunModes')).toBe(false);
10
+ expect(parseBoolSetting(xml, 'LoadAllBuiltinPluginsInRunModes')).toBe(true);
11
+ });
12
+ it('is undefined for a setting the file does not have', () => {
13
+ expect(parseBoolSetting(xml, 'Missing')).toBeUndefined();
14
+ });
15
+ });
16
+ //# sourceMappingURL=studio-settings.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"studio-settings.test.js","sourceRoot":"","sources":["../../../src/process/studio-settings.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,MAAM,GAAG,GAAG;;;uBAGS,CAAC;IAEtB,EAAE,CAAC,yDAAyD,EAAE,GAAG,EAAE;QACjE,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,2BAA2B,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACvE,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,iCAAiC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC3D,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;IAC3D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Reads whether a Studio window is focused or minimized. The plugin API
3
+ * cannot see either, so this asks the OS about the process the session's
4
+ * place is showing in.
5
+ */
6
+ export interface StudioWindowState {
7
+ focused: boolean;
8
+ minimized: boolean;
9
+ }
10
+ /** Undefined where the OS gives no answer, including outside Windows. */
11
+ export declare function tryGetStudioWindowStateAsync(pid: number): Promise<StudioWindowState | undefined>;
12
+ export declare function parseWindowState(stdout: string): StudioWindowState | undefined;
13
+ //# sourceMappingURL=studio-window-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"studio-window-state.d.ts","sourceRoot":"","sources":["../../../src/process/studio-window-state.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;CACpB;AAiBD,yEAAyE;AACzE,wBAAsB,4BAA4B,CAChD,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAgBxC;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,GACb,iBAAiB,GAAG,SAAS,CAa/B"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Reads whether a Studio window is focused or minimized. The plugin API
3
+ * cannot see either, so this asks the OS about the process the session's
4
+ * place is showing in.
5
+ */
6
+ import { execa } from 'execa';
7
+ const WINDOW_STATE_SCRIPT = `
8
+ Add-Type -Namespace StudioBridge -Name User32 -MemberDefinition @'
9
+ [DllImport("user32.dll")] public static extern bool IsIconic(IntPtr hWnd);
10
+ [DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow();
11
+ [DllImport("user32.dll")] public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint processId);
12
+ '@
13
+ $process = Get-Process -Id $args[0] -ErrorAction Stop
14
+ $foregroundPid = [uint32]0
15
+ [void][StudioBridge.User32]::GetWindowThreadProcessId([StudioBridge.User32]::GetForegroundWindow(), [ref]$foregroundPid)
16
+ @{
17
+ minimized = [StudioBridge.User32]::IsIconic($process.MainWindowHandle)
18
+ focused = ($foregroundPid -eq $process.Id)
19
+ } | ConvertTo-Json -Compress
20
+ `;
21
+ /** Undefined where the OS gives no answer, including outside Windows. */
22
+ export async function tryGetStudioWindowStateAsync(pid) {
23
+ if (process.platform !== 'win32')
24
+ return undefined;
25
+ const { stdout, failed } = await execa('powershell.exe', [
26
+ '-NoProfile',
27
+ '-NonInteractive',
28
+ '-Command',
29
+ `& { ${WINDOW_STATE_SCRIPT} } ${pid}`,
30
+ ], { reject: false });
31
+ if (failed)
32
+ return undefined;
33
+ return parseWindowState(stdout);
34
+ }
35
+ export function parseWindowState(stdout) {
36
+ try {
37
+ const parsed = JSON.parse(stdout.trim());
38
+ if (typeof parsed.focused !== 'boolean' ||
39
+ typeof parsed.minimized !== 'boolean') {
40
+ return undefined;
41
+ }
42
+ return { focused: parsed.focused, minimized: parsed.minimized };
43
+ }
44
+ catch {
45
+ return undefined;
46
+ }
47
+ }
48
+ //# sourceMappingURL=studio-window-state.js.map