@quenty/studio-bridge 0.23.0 → 0.24.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.
Files changed (231) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +36 -8
  3. package/dist/src/bridge/bridge-connection.d.ts.map +1 -1
  4. package/dist/src/bridge/bridge-connection.js +1 -0
  5. package/dist/src/bridge/bridge-connection.js.map +1 -1
  6. package/dist/src/bridge/bridge-session.d.ts +11 -16
  7. package/dist/src/bridge/bridge-session.d.ts.map +1 -1
  8. package/dist/src/bridge/bridge-session.js +37 -29
  9. package/dist/src/bridge/bridge-session.js.map +1 -1
  10. package/dist/src/bridge/bridge-session.test.js +35 -0
  11. package/dist/src/bridge/bridge-session.test.js.map +1 -1
  12. package/dist/src/bridge/internal/bridge-host.d.ts +2 -0
  13. package/dist/src/bridge/internal/bridge-host.d.ts.map +1 -1
  14. package/dist/src/bridge/internal/bridge-host.js +1 -0
  15. package/dist/src/bridge/internal/bridge-host.js.map +1 -1
  16. package/dist/src/bridge/internal/host-protocol.d.ts.map +1 -1
  17. package/dist/src/bridge/internal/host-protocol.js +23 -10
  18. package/dist/src/bridge/internal/host-protocol.js.map +1 -1
  19. package/dist/src/bridge/types.d.ts +5 -2
  20. package/dist/src/bridge/types.d.ts.map +1 -1
  21. package/dist/src/bridge/types.js.map +1 -1
  22. package/dist/src/commands/console/exec/exec.d.ts +13 -3
  23. package/dist/src/commands/console/exec/exec.d.ts.map +1 -1
  24. package/dist/src/commands/console/exec/exec.js +82 -7
  25. package/dist/src/commands/console/exec/exec.js.map +1 -1
  26. package/dist/src/commands/console/exec/exec.test.js +63 -1
  27. package/dist/src/commands/console/exec/exec.test.js.map +1 -1
  28. package/dist/src/commands/framework/action-loader.test.js +1 -1
  29. package/dist/src/commands/framework/action-loader.test.js.map +1 -1
  30. package/dist/src/commands/playtest/player/playtest-players.d.ts.map +1 -1
  31. package/dist/src/commands/playtest/player/playtest-players.js +15 -93
  32. package/dist/src/commands/playtest/player/playtest-players.js.map +1 -1
  33. package/dist/src/commands/playtest/player/playtest-players.test.js +34 -21
  34. package/dist/src/commands/playtest/player/playtest-players.test.js.map +1 -1
  35. package/dist/src/commands/playtest/playtest-sessions.d.ts +19 -3
  36. package/dist/src/commands/playtest/playtest-sessions.d.ts.map +1 -1
  37. package/dist/src/commands/playtest/playtest-sessions.js +54 -74
  38. package/dist/src/commands/playtest/playtest-sessions.js.map +1 -1
  39. package/dist/src/commands/playtest/playtest-sessions.test.js +74 -8
  40. package/dist/src/commands/playtest/playtest-sessions.test.js.map +1 -1
  41. package/dist/src/commands/playtest/run/run.d.ts +9 -7
  42. package/dist/src/commands/playtest/run/run.d.ts.map +1 -1
  43. package/dist/src/commands/playtest/run/run.js +33 -38
  44. package/dist/src/commands/playtest/run/run.js.map +1 -1
  45. package/dist/src/commands/process/close/close.d.ts +4 -0
  46. package/dist/src/commands/process/close/close.d.ts.map +1 -1
  47. package/dist/src/commands/process/close/close.js +54 -4
  48. package/dist/src/commands/process/close/close.js.map +1 -1
  49. package/dist/src/commands/process/close/close.test.js +36 -3
  50. package/dist/src/commands/process/close/close.test.js.map +1 -1
  51. package/dist/src/commands/process/info/info.d.ts +15 -2
  52. package/dist/src/commands/process/info/info.d.ts.map +1 -1
  53. package/dist/src/commands/process/info/info.js +44 -4
  54. package/dist/src/commands/process/info/info.js.map +1 -1
  55. package/dist/src/commands/process/info/info.test.js +48 -0
  56. package/dist/src/commands/process/info/info.test.js.map +1 -1
  57. package/dist/src/commands/process/launch/launch.d.ts.map +1 -1
  58. package/dist/src/commands/process/launch/launch.js +22 -3
  59. package/dist/src/commands/process/launch/launch.js.map +1 -1
  60. package/dist/src/commands/process/launch/launch.test.js +27 -5
  61. package/dist/src/commands/process/launch/launch.test.js.map +1 -1
  62. package/dist/src/commands/process/list/list.d.ts +49 -6
  63. package/dist/src/commands/process/list/list.d.ts.map +1 -1
  64. package/dist/src/commands/process/list/list.js +185 -18
  65. package/dist/src/commands/process/list/list.js.map +1 -1
  66. package/dist/src/commands/process/list/list.test.js +92 -1
  67. package/dist/src/commands/process/list/list.test.js.map +1 -1
  68. package/dist/src/commands/process/run/run.d.ts +1 -1
  69. package/dist/src/commands/process/run/run.d.ts.map +1 -1
  70. package/dist/src/commands/process/run/run.js +3 -3
  71. package/dist/src/commands/process/run/run.js.map +1 -1
  72. package/dist/src/docker/docker-delegator.js +1 -1
  73. package/dist/src/docker/docker-delegator.js.map +1 -1
  74. package/dist/src/docker/docker-delegator.test.js +1 -1
  75. package/dist/src/docker/docker-delegator.test.js.map +1 -1
  76. package/dist/src/plugin/playtest-bridge.d.ts +36 -0
  77. package/dist/src/plugin/playtest-bridge.d.ts.map +1 -0
  78. package/dist/src/plugin/playtest-bridge.js +65 -0
  79. package/dist/src/plugin/playtest-bridge.js.map +1 -0
  80. package/dist/src/plugin/playtest-bridge.test.d.ts +2 -0
  81. package/dist/src/plugin/playtest-bridge.test.d.ts.map +1 -0
  82. package/dist/src/plugin/playtest-bridge.test.js +35 -0
  83. package/dist/src/plugin/playtest-bridge.test.js.map +1 -0
  84. package/dist/src/process/studio-launch-registry.d.ts +14 -0
  85. package/dist/src/process/studio-launch-registry.d.ts.map +1 -0
  86. package/dist/src/process/studio-launch-registry.js +37 -0
  87. package/dist/src/process/studio-launch-registry.js.map +1 -0
  88. package/dist/src/process/studio-launch-registry.test.d.ts +2 -0
  89. package/dist/src/process/studio-launch-registry.test.d.ts.map +1 -0
  90. package/dist/src/process/studio-launch-registry.test.js +38 -0
  91. package/dist/src/process/studio-launch-registry.test.js.map +1 -0
  92. package/dist/src/process/studio-process-closer.d.ts +3 -1
  93. package/dist/src/process/studio-process-closer.d.ts.map +1 -1
  94. package/dist/src/process/studio-process-closer.js +29 -11
  95. package/dist/src/process/studio-process-closer.js.map +1 -1
  96. package/dist/src/process/studio-process-identity.d.ts +10 -0
  97. package/dist/src/process/studio-process-identity.d.ts.map +1 -0
  98. package/dist/src/process/studio-process-identity.js +63 -0
  99. package/dist/src/process/studio-process-identity.js.map +1 -0
  100. package/dist/src/process/studio-process-identity.test.d.ts +2 -0
  101. package/dist/src/process/studio-process-identity.test.d.ts.map +1 -0
  102. package/dist/src/process/studio-process-identity.test.js +30 -0
  103. package/dist/src/process/studio-process-identity.test.js.map +1 -0
  104. package/dist/src/roblox-mcp/index.d.ts +3 -0
  105. package/dist/src/roblox-mcp/index.d.ts.map +1 -0
  106. package/dist/src/roblox-mcp/index.js +3 -0
  107. package/dist/src/roblox-mcp/index.js.map +1 -0
  108. package/dist/src/roblox-mcp/mcp/mcp-stdio-client.d.ts +60 -0
  109. package/dist/src/roblox-mcp/mcp/mcp-stdio-client.d.ts.map +1 -0
  110. package/dist/src/roblox-mcp/mcp/mcp-stdio-client.js +171 -0
  111. package/dist/src/roblox-mcp/mcp/mcp-stdio-client.js.map +1 -0
  112. package/dist/src/roblox-mcp/mcp/mcp-stdio-client.test.d.ts +2 -0
  113. package/dist/src/roblox-mcp/mcp/mcp-stdio-client.test.d.ts.map +1 -0
  114. package/dist/src/roblox-mcp/mcp/mcp-stdio-client.test.js +104 -0
  115. package/dist/src/roblox-mcp/mcp/mcp-stdio-client.test.js.map +1 -0
  116. package/dist/src/roblox-mcp/mcp/repair-list-result.d.ts +2 -0
  117. package/dist/src/roblox-mcp/mcp/repair-list-result.d.ts.map +1 -0
  118. package/dist/src/roblox-mcp/mcp/repair-list-result.js +22 -0
  119. package/dist/src/roblox-mcp/mcp/repair-list-result.js.map +1 -0
  120. package/dist/src/roblox-mcp/mcp/repair-list-result.test.d.ts +2 -0
  121. package/dist/src/roblox-mcp/mcp/repair-list-result.test.d.ts.map +1 -0
  122. package/dist/src/roblox-mcp/mcp/repair-list-result.test.js +42 -0
  123. package/dist/src/roblox-mcp/mcp/repair-list-result.test.js.map +1 -0
  124. package/dist/src/roblox-mcp/roblox-studio-mcp.d.ts +34 -0
  125. package/dist/src/roblox-mcp/roblox-studio-mcp.d.ts.map +1 -0
  126. package/dist/src/roblox-mcp/roblox-studio-mcp.js +190 -0
  127. package/dist/src/roblox-mcp/roblox-studio-mcp.js.map +1 -0
  128. package/dist/src/roblox-mcp/roblox-studio-mcp.test.d.ts +2 -0
  129. package/dist/src/roblox-mcp/roblox-studio-mcp.test.d.ts.map +1 -0
  130. package/dist/src/roblox-mcp/roblox-studio-mcp.test.js +123 -0
  131. package/dist/src/roblox-mcp/roblox-studio-mcp.test.js.map +1 -0
  132. package/dist/src/roblox-mcp/studio/studio-session.d.ts +39 -0
  133. package/dist/src/roblox-mcp/studio/studio-session.d.ts.map +1 -0
  134. package/dist/src/roblox-mcp/studio/studio-session.js +175 -0
  135. package/dist/src/roblox-mcp/studio/studio-session.js.map +1 -0
  136. package/dist/src/roblox-mcp/studio/studio-session.test.d.ts +2 -0
  137. package/dist/src/roblox-mcp/studio/studio-session.test.d.ts.map +1 -0
  138. package/dist/src/roblox-mcp/studio/studio-session.test.js +213 -0
  139. package/dist/src/roblox-mcp/studio/studio-session.test.js.map +1 -0
  140. package/dist/src/roblox-mcp/studio-mcp-locator.d.ts +19 -0
  141. package/dist/src/roblox-mcp/studio-mcp-locator.d.ts.map +1 -0
  142. package/dist/src/roblox-mcp/studio-mcp-locator.js +121 -0
  143. package/dist/src/roblox-mcp/studio-mcp-locator.js.map +1 -0
  144. package/dist/src/roblox-mcp/studio-mcp-locator.test.d.ts +2 -0
  145. package/dist/src/roblox-mcp/studio-mcp-locator.test.d.ts.map +1 -0
  146. package/dist/src/roblox-mcp/studio-mcp-locator.test.js +107 -0
  147. package/dist/src/roblox-mcp/studio-mcp-locator.test.js.map +1 -0
  148. package/dist/src/roblox-mcp/studio-mcp-snapshot.d.ts +23 -0
  149. package/dist/src/roblox-mcp/studio-mcp-snapshot.d.ts.map +1 -0
  150. package/dist/src/roblox-mcp/studio-mcp-snapshot.js +65 -0
  151. package/dist/src/roblox-mcp/studio-mcp-snapshot.js.map +1 -0
  152. package/dist/src/roblox-mcp/studio-mcp-snapshot.test.d.ts +2 -0
  153. package/dist/src/roblox-mcp/studio-mcp-snapshot.test.d.ts.map +1 -0
  154. package/dist/src/roblox-mcp/studio-mcp-snapshot.test.js +81 -0
  155. package/dist/src/roblox-mcp/studio-mcp-snapshot.test.js.map +1 -0
  156. package/dist/src/roblox-mcp/test/fake-mcp-server.d.ts +27 -0
  157. package/dist/src/roblox-mcp/test/fake-mcp-server.d.ts.map +1 -0
  158. package/dist/src/roblox-mcp/test/fake-mcp-server.js +55 -0
  159. package/dist/src/roblox-mcp/test/fake-mcp-server.js.map +1 -0
  160. package/dist/src/server/web-socket-protocol.d.ts +50 -15
  161. package/dist/src/server/web-socket-protocol.d.ts.map +1 -1
  162. package/dist/src/server/web-socket-protocol.js +63 -13
  163. package/dist/src/server/web-socket-protocol.js.map +1 -1
  164. package/dist/tsconfig.tsbuildinfo +1 -1
  165. package/docs/playtest-bridge.md +21 -0
  166. package/package.json +2 -2
  167. package/src/bridge/bridge-connection.ts +1 -0
  168. package/src/bridge/bridge-session.test.ts +51 -0
  169. package/src/bridge/bridge-session.ts +66 -47
  170. package/src/bridge/internal/bridge-host.ts +3 -0
  171. package/src/bridge/internal/host-protocol.ts +22 -9
  172. package/src/bridge/types.ts +5 -0
  173. package/src/commands/console/exec/exec.test.ts +94 -0
  174. package/src/commands/console/exec/exec.ts +130 -16
  175. package/src/commands/console/exec/execute.lua +147 -5
  176. package/src/commands/console/exec/execute.spec.lua +22 -2
  177. package/src/commands/framework/action-loader.test.ts +1 -1
  178. package/src/commands/playtest/player/playtest-players.lua +127 -0
  179. package/src/commands/playtest/player/playtest-players.spec.lua +48 -0
  180. package/src/commands/playtest/player/playtest-players.test.ts +40 -21
  181. package/src/commands/playtest/player/playtest-players.ts +30 -110
  182. package/src/commands/playtest/playtest-sessions.test.ts +116 -14
  183. package/src/commands/playtest/playtest-sessions.ts +77 -88
  184. package/src/commands/playtest/run/run.ts +44 -58
  185. package/src/commands/playtest/start/start-playtest.lua +105 -6
  186. package/src/commands/process/close/close.test.ts +52 -3
  187. package/src/commands/process/close/close.ts +78 -4
  188. package/src/commands/process/info/info.test.ts +76 -0
  189. package/src/commands/process/info/info.ts +74 -6
  190. package/src/commands/process/launch/launch.test.ts +33 -5
  191. package/src/commands/process/launch/launch.ts +41 -3
  192. package/src/commands/process/list/list.test.ts +130 -1
  193. package/src/commands/process/list/list.ts +290 -22
  194. package/src/commands/process/run/run.ts +4 -4
  195. package/src/docker/docker-delegator.test.ts +1 -1
  196. package/src/docker/docker-delegator.ts +1 -1
  197. package/src/plugin/playtest-bridge.test.ts +53 -0
  198. package/src/plugin/playtest-bridge.ts +98 -0
  199. package/src/process/studio-launch-registry.test.ts +56 -0
  200. package/src/process/studio-launch-registry.ts +63 -0
  201. package/src/process/studio-process-closer.ts +36 -11
  202. package/src/process/studio-process-identity.test.ts +45 -0
  203. package/src/process/studio-process-identity.ts +90 -0
  204. package/src/roblox-mcp/index.ts +17 -0
  205. package/src/roblox-mcp/mcp/mcp-stdio-client.test.ts +148 -0
  206. package/src/roblox-mcp/mcp/mcp-stdio-client.ts +270 -0
  207. package/src/roblox-mcp/mcp/repair-list-result.test.ts +52 -0
  208. package/src/roblox-mcp/mcp/repair-list-result.ts +23 -0
  209. package/src/roblox-mcp/roblox-studio-mcp.test.ts +168 -0
  210. package/src/roblox-mcp/roblox-studio-mcp.ts +330 -0
  211. package/src/roblox-mcp/studio/studio-session.test.ts +284 -0
  212. package/src/roblox-mcp/studio/studio-session.ts +279 -0
  213. package/src/roblox-mcp/studio-mcp-locator.test.ts +186 -0
  214. package/src/roblox-mcp/studio-mcp-locator.ts +180 -0
  215. package/src/roblox-mcp/studio-mcp-snapshot.test.ts +113 -0
  216. package/src/roblox-mcp/studio-mcp-snapshot.ts +104 -0
  217. package/src/roblox-mcp/test/fake-mcp-server.ts +74 -0
  218. package/src/server/web-socket-protocol.ts +119 -29
  219. package/templates/studio-bridge-plugin/playtest/StudioBridgePlaytest.client.lua +32 -0
  220. package/templates/studio-bridge-plugin/playtest/StudioBridgePlaytest.server.lua +40 -0
  221. package/templates/studio-bridge-plugin/src/Shared/ActionRouter.lua +25 -3
  222. package/templates/studio-bridge-plugin/src/Shared/PrecompiledSources.lua +47 -0
  223. package/templates/studio-bridge-plugin/src/Shared/PrecompiledSources.spec.lua +57 -0
  224. package/templates/studio-bridge-plugin/src/Shared/StudioBridgeClient.lua +357 -0
  225. package/templates/studio-bridge-plugin/src/Shared/StudioBridgeSessionUtils.lua +29 -3
  226. package/templates/studio-bridge-plugin/src/Shared/StudioBridgeSessionUtils.spec.lua +35 -2
  227. package/templates/studio-bridge-plugin/src/StudioBridgePlugin.server.lua +16 -292
  228. package/src/commands/playtest/run/playtest-runner.luau +0 -264
  229. package/src/commands/playtest/run/playtest-runner.spec.lua +0 -71
  230. package/src/commands/playtest/run/run-playtest-script.lua +0 -139
  231. package/src/commands/playtest/run/run-playtest-script.spec.lua +0 -43
@@ -0,0 +1,3 @@
1
+ export { tryListStudiosAsync, tryExecuteLuauAsync, tryCallStudioToolAsync, closeStudioMcpAsync, } from './roblox-studio-mcp.js';
2
+ export { getStudioMcpSnapshotAsync, resetStudioMcpSnapshot, } from './studio-mcp-snapshot.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/roblox-mcp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,GAMpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,yBAAyB,EACzB,sBAAsB,GAGvB,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { type ChildProcessWithoutNullStreams } from 'child_process';
2
+ export declare const MCP_PROTOCOL_VERSION = "2025-06-18";
3
+ export declare class McpTimeoutError extends Error {
4
+ }
5
+ export interface McpTool {
6
+ name: string;
7
+ description?: string;
8
+ inputSchema?: Record<string, unknown>;
9
+ }
10
+ export interface McpContent {
11
+ type: string;
12
+ text?: string;
13
+ [key: string]: unknown;
14
+ }
15
+ export interface McpToolResult {
16
+ isError: boolean;
17
+ content: McpContent[];
18
+ text: string;
19
+ }
20
+ export type SpawnMcpProcess = (command: string, args: string[]) => ChildProcessWithoutNullStreams;
21
+ export interface McpStdioClientOptions {
22
+ args?: string[];
23
+ env?: Record<string, string>;
24
+ spawnProcess?: SpawnMcpProcess;
25
+ requestTimeoutMs?: number;
26
+ clientInfo?: {
27
+ name: string;
28
+ version: string;
29
+ };
30
+ }
31
+ export declare class McpStdioClient {
32
+ private _child;
33
+ private _pending;
34
+ private _nextId;
35
+ private _buffer;
36
+ private _stderrTail;
37
+ private _exitError;
38
+ private _exited;
39
+ private _requestTimeoutMs;
40
+ private _protocolVersion;
41
+ private _serverInfo;
42
+ private constructor();
43
+ static startAsync(command: string, options?: McpStdioClientOptions): Promise<McpStdioClient>;
44
+ get protocolVersion(): string | undefined;
45
+ get serverInfo(): {
46
+ name?: string;
47
+ version?: string;
48
+ } | undefined;
49
+ listToolsAsync(): Promise<McpTool[]>;
50
+ callToolAsync(name: string, args?: Record<string, unknown>, timeoutMs?: number): Promise<McpToolResult>;
51
+ requestAsync(method: string, params: unknown, timeoutMs?: number): Promise<unknown>;
52
+ get isRunning(): boolean;
53
+ closeAsync(): Promise<void>;
54
+ private _notify;
55
+ private _write;
56
+ private _onStdout;
57
+ private _onLine;
58
+ private _fail;
59
+ }
60
+ //# sourceMappingURL=mcp-stdio-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-stdio-client.d.ts","sourceRoot":"","sources":["../../../../src/roblox-mcp/mcp/mcp-stdio-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,8BAA8B,EAAE,MAAM,eAAe,CAAC;AAG3E,eAAO,MAAM,oBAAoB,eAAe,CAAC;AAMjD,qBAAa,eAAgB,SAAQ,KAAK;CAAG;AAE7C,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IAC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1B,IAAI,eAAe,IAAI,MAAM,GAAG,SAAS,CAExC;IAED,IAAI,UAAU,IAAI;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAEhE;IAEK,cAAc,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAOpC,aAAa,CACjB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EAClC,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,aAAa,CAAC;IAiBzB,YAAY,CACV,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,EACf,SAAS,SAAyB,GACjC,OAAO,CAAC,OAAO,CAAC;IAenB,IAAI,SAAS,IAAI,OAAO,CAEvB;IAEK,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAgBjC,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,MAAM;IAId,OAAO,CAAC,SAAS;IAYjB,OAAO,CAAC,OAAO;IAmCf,OAAO,CAAC,KAAK;CAQd"}
@@ -0,0 +1,171 @@
1
+ import { spawn } from 'child_process';
2
+ import { repairListResult } from './repair-list-result.js';
3
+ export const MCP_PROTOCOL_VERSION = '2025-06-18';
4
+ const DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
5
+ const STDERR_TAIL_BYTES = 4096;
6
+ const CLOSE_TIMEOUT_MS = 2000;
7
+ export class McpTimeoutError extends Error {
8
+ }
9
+ export class McpStdioClient {
10
+ _child;
11
+ _pending = new Map();
12
+ _nextId = 1;
13
+ _buffer = '';
14
+ _stderrTail = '';
15
+ _exitError;
16
+ _exited = false;
17
+ _requestTimeoutMs;
18
+ _protocolVersion;
19
+ _serverInfo;
20
+ constructor(child, requestTimeoutMs) {
21
+ this._child = child;
22
+ this._requestTimeoutMs = requestTimeoutMs;
23
+ child.stdout.setEncoding('utf8');
24
+ child.stdout.on('data', (chunk) => this._onStdout(chunk));
25
+ child.stderr.setEncoding('utf8');
26
+ child.stderr.on('data', (chunk) => {
27
+ this._stderrTail = (this._stderrTail + chunk).slice(-STDERR_TAIL_BYTES);
28
+ });
29
+ child.stdin.on('error', () => { });
30
+ child.unref?.();
31
+ for (const stream of [child.stdin, child.stdout, child.stderr]) {
32
+ stream.unref?.();
33
+ }
34
+ child.on('error', (err) => this._fail(err));
35
+ child.on('close', (code) => {
36
+ this._exited = true;
37
+ this._fail(new Error(`Studio's MCP server exited (code ${code ?? 'none'})${this._stderrTail.trim() ? `: ${this._stderrTail.trim()}` : ''}`));
38
+ });
39
+ }
40
+ static async startAsync(command, options = {}) {
41
+ const spawnProcess = options.spawnProcess ??
42
+ ((cmd, args) => spawn(cmd, args, {
43
+ stdio: 'pipe',
44
+ windowsHide: true,
45
+ ...(options.env ? { env: options.env } : {}),
46
+ }));
47
+ const client = new McpStdioClient(spawnProcess(command, options.args ?? []), options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS);
48
+ try {
49
+ const result = (await client.requestAsync('initialize', {
50
+ protocolVersion: MCP_PROTOCOL_VERSION,
51
+ capabilities: {},
52
+ clientInfo: options.clientInfo ?? {
53
+ name: 'studio-bridge',
54
+ version: '0.0.0',
55
+ },
56
+ }));
57
+ client._protocolVersion = result?.protocolVersion;
58
+ client._serverInfo = result?.serverInfo;
59
+ client._notify('notifications/initialized');
60
+ }
61
+ catch (err) {
62
+ await client.closeAsync();
63
+ throw err;
64
+ }
65
+ return client;
66
+ }
67
+ get protocolVersion() {
68
+ return this._protocolVersion;
69
+ }
70
+ get serverInfo() {
71
+ return this._serverInfo;
72
+ }
73
+ async listToolsAsync() {
74
+ const result = (await this.requestAsync('tools/list', {}));
75
+ return Array.isArray(result?.tools) ? result.tools : [];
76
+ }
77
+ async callToolAsync(name, args = {}, timeoutMs) {
78
+ const result = (await this.requestAsync('tools/call', { name, arguments: args }, timeoutMs));
79
+ const content = Array.isArray(result?.content) ? result.content : [];
80
+ return {
81
+ isError: result?.isError === true,
82
+ content,
83
+ text: content
84
+ .filter((c) => c.type === 'text' && typeof c.text === 'string')
85
+ .map((c) => c.text)
86
+ .join('\n'),
87
+ };
88
+ }
89
+ requestAsync(method, params, timeoutMs = this._requestTimeoutMs) {
90
+ if (this._exitError) {
91
+ return Promise.reject(this._exitError);
92
+ }
93
+ const id = this._nextId++;
94
+ return new Promise((resolve, reject) => {
95
+ const timer = setTimeout(() => {
96
+ this._pending.delete(id);
97
+ reject(new McpTimeoutError(`${method} timed out after ${timeoutMs}ms`));
98
+ }, timeoutMs);
99
+ this._pending.set(id, { method, resolve, reject, timer });
100
+ this._write({ jsonrpc: '2.0', id, method, params });
101
+ });
102
+ }
103
+ get isRunning() {
104
+ return !this._exited;
105
+ }
106
+ async closeAsync() {
107
+ this._fail(new Error("Studio's MCP client was closed"));
108
+ if (this._exited) {
109
+ return;
110
+ }
111
+ let timer;
112
+ const exited = new Promise((resolve) => {
113
+ this._child.once('close', () => resolve());
114
+ timer = setTimeout(resolve, CLOSE_TIMEOUT_MS);
115
+ });
116
+ this._child.stdin.end();
117
+ this._child.kill();
118
+ await exited;
119
+ clearTimeout(timer);
120
+ }
121
+ _notify(method, params) {
122
+ this._write({ jsonrpc: '2.0', method, ...(params ? { params } : {}) });
123
+ }
124
+ _write(message) {
125
+ this._child.stdin.write(JSON.stringify(message) + '\n');
126
+ }
127
+ _onStdout(chunk) {
128
+ this._buffer += chunk;
129
+ let newline;
130
+ while ((newline = this._buffer.indexOf('\n')) >= 0) {
131
+ const line = this._buffer.slice(0, newline).trim();
132
+ this._buffer = this._buffer.slice(newline + 1);
133
+ if (line) {
134
+ this._onLine(line);
135
+ }
136
+ }
137
+ }
138
+ _onLine(line) {
139
+ let message;
140
+ try {
141
+ message = JSON.parse(line);
142
+ }
143
+ catch {
144
+ return;
145
+ }
146
+ if (typeof message?.id !== 'number' || message.method !== undefined) {
147
+ return;
148
+ }
149
+ const pending = this._pending.get(message.id);
150
+ if (!pending) {
151
+ return;
152
+ }
153
+ this._pending.delete(message.id);
154
+ clearTimeout(pending.timer);
155
+ if (message.error) {
156
+ pending.reject(new Error(`${pending.method} failed: ${message.error.message ?? `error ${message.error.code ?? ''}`}`.trim()));
157
+ }
158
+ else {
159
+ pending.resolve(repairListResult(message.result));
160
+ }
161
+ }
162
+ _fail(err) {
163
+ this._exitError ??= err;
164
+ for (const pending of this._pending.values()) {
165
+ clearTimeout(pending.timer);
166
+ pending.reject(this._exitError);
167
+ }
168
+ this._pending.clear();
169
+ }
170
+ }
171
+ //# sourceMappingURL=mcp-stdio-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-stdio-client.js","sourceRoot":"","sources":["../../../../src/roblox-mcp/mcp/mcp-stdio-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAuC,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC;AAEjD,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAC1C,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAC/B,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAE9B,MAAM,OAAO,eAAgB,SAAQ,KAAK;CAAG;AAwC7C,MAAM,OAAO,cAAc;IACjB,MAAM,CAAiC;IACvC,QAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;IAC7C,OAAO,GAAG,CAAC,CAAC;IACZ,OAAO,GAAG,EAAE,CAAC;IACb,WAAW,GAAG,EAAE,CAAC;IACjB,UAAU,CAAoB;IAC9B,OAAO,GAAG,KAAK,CAAC;IAChB,iBAAiB,CAAS;IAC1B,gBAAgB,CAAqB;IACrC,WAAW,CAAkD;IAErE,YACE,KAAqC,EACrC,gBAAwB;QAExB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,iBAAiB,GAAG,gBAAgB,CAAC;QAE1C,KAAK,CAAC,MAA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ACT,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC9C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO;QACT,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACjC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAE5B,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAClB,OAAO,CAAC,MAAM,CACZ,IAAI,KAAK,CACP,GAAG,OAAO,CAAC,MAAM,YACf,OAAO,CAAC,KAAK,CAAC,OAAO,IAAI,SAAS,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,EAC5D,EAAE,CAAC,IAAI,EAAE,CACV,CACF,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,GAAU;QACtB,IAAI,CAAC,UAAU,KAAK,GAAG,CAAC;QACxB,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;YAC7C,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC5B,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAClC,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=mcp-stdio-client.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-stdio-client.test.d.ts","sourceRoot":"","sources":["../../../../src/roblox-mcp/mcp/mcp-stdio-client.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,104 @@
1
+ import { describe, expect, it, vi } from 'vitest';
2
+ import { McpStdioClient } from './mcp-stdio-client.js';
3
+ import { createFakeMcpServer, toolText, } from '../test/fake-mcp-server.js';
4
+ const initialize = (method) => method === 'initialize'
5
+ ? {
6
+ result: {
7
+ protocolVersion: '2025-06-18',
8
+ capabilities: { tools: {} },
9
+ serverInfo: { name: 'RobloxStudio', version: '1.0.0' },
10
+ },
11
+ }
12
+ : undefined;
13
+ async function startAsync(handler, requestTimeoutMs) {
14
+ const server = createFakeMcpServer((method, params) => initialize(method, params) ?? handler(method, params));
15
+ const client = await McpStdioClient.startAsync('StudioMCP.exe', {
16
+ spawnProcess: () => server.child,
17
+ requestTimeoutMs,
18
+ });
19
+ return { server, client };
20
+ }
21
+ describe('McpStdioClient', () => {
22
+ it('initializes, then says it is initialized', async () => {
23
+ const { server, client } = await startAsync(() => undefined);
24
+ expect(client.protocolVersion).toBe('2025-06-18');
25
+ expect(client.serverInfo?.name).toBe('RobloxStudio');
26
+ expect(server.requests.map((r) => r.method)).toEqual([
27
+ 'initialize',
28
+ 'notifications/initialized',
29
+ ]);
30
+ await client.closeAsync();
31
+ });
32
+ it('lists tools, repairing a list result without caching hints', async () => {
33
+ const { client } = await startAsync((method) => method === 'tools/list'
34
+ ? {
35
+ result: {
36
+ resultType: 'complete',
37
+ tools: [{ name: 'execute_luau' }],
38
+ },
39
+ }
40
+ : undefined);
41
+ expect(await client.listToolsAsync()).toEqual([{ name: 'execute_luau' }]);
42
+ await expect(client.requestAsync('tools/list', {})).resolves.toMatchObject({
43
+ ttlMs: 0,
44
+ cacheScope: 'private',
45
+ });
46
+ await client.closeAsync();
47
+ });
48
+ it('calls a tool and joins its text content', async () => {
49
+ const { server, client } = await startAsync((method) => method === 'tools/call' ? toolText('42') : undefined);
50
+ const result = await client.callToolAsync('execute_luau', { code: 'x' });
51
+ expect(result).toMatchObject({ isError: false, text: '42' });
52
+ expect(server.requests.at(-1)?.params).toEqual({
53
+ name: 'execute_luau',
54
+ arguments: { code: 'x' },
55
+ });
56
+ await client.closeAsync();
57
+ });
58
+ it('reports a tool error as isError rather than throwing', async () => {
59
+ const { client } = await startAsync(() => toolText('boom', true));
60
+ await expect(client.callToolAsync('execute_luau')).resolves.toMatchObject({
61
+ isError: true,
62
+ text: 'boom',
63
+ });
64
+ await client.closeAsync();
65
+ });
66
+ it('rejects a JSON-RPC error with its message', async () => {
67
+ const { client } = await startAsync(() => ({
68
+ error: { code: -32602, message: 'bad params' },
69
+ }));
70
+ await expect(client.requestAsync('tools/call', {})).rejects.toThrow('tools/call failed: bad params');
71
+ await client.closeAsync();
72
+ });
73
+ it('rejects requests in flight when the server exits, with its stderr', async () => {
74
+ const { server, client } = await startAsync(() => undefined);
75
+ const pending = client.callToolAsync('execute_luau');
76
+ server.exit(3, 'Studio went away');
77
+ await expect(pending).rejects.toThrow("Studio's MCP server exited (code 3): Studio went away");
78
+ await expect(client.callToolAsync('execute_luau')).rejects.toThrow('exited');
79
+ });
80
+ it('waits for the server to exit when closed', async () => {
81
+ const { server, client } = await startAsync(() => undefined);
82
+ await client.closeAsync();
83
+ expect(server.child.killed).toBe(true);
84
+ expect(client.isRunning).toBe(false);
85
+ await expect(client.callToolAsync('execute_luau')).rejects.toThrow('closed');
86
+ });
87
+ it('closes a server that already exited without killing it again', async () => {
88
+ const { server, client } = await startAsync(() => undefined);
89
+ server.exit(0);
90
+ await new Promise((resolve) => setImmediate(resolve));
91
+ await client.closeAsync();
92
+ expect(server.child.killed).toBe(false);
93
+ });
94
+ it('times out a request the server never answers', async () => {
95
+ const { client } = await startAsync(() => undefined);
96
+ vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout'] });
97
+ const pending = expect(client.callToolAsync('execute_luau')).rejects.toThrow('tools/call timed out after 30000ms');
98
+ await vi.advanceTimersByTimeAsync(30_000);
99
+ await pending;
100
+ vi.useRealTimers();
101
+ await client.closeAsync();
102
+ });
103
+ });
104
+ //# sourceMappingURL=mcp-stdio-client.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"m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AE,KAAK,IAAI,EAAE;QAC5E,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC7D,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACf,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;QAEtD,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;QAE1B,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAE,KAAK,IAAI,EAAE;QAC5D,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,UAAU,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QACrD,EAAE,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC,YAAY,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC;QAE7D,MAAM,OAAO,GAAG,MAAM,CACpB,MAAM,CAAC,aAAa,CAAC,cAAc,CAAC,CACrC,CAAC,OAAO,CAAC,OAAO,CAAC,oCAAoC,CAAC,CAAC;QACxD,MAAM,EAAE,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;QAC1C,MAAM,OAAO,CAAC;QACd,EAAE,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function repairListResult<T>(result: T): T;
2
+ //# sourceMappingURL=repair-list-result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repair-list-result.d.ts","sourceRoot":"","sources":["../../../../src/roblox-mcp/mcp/repair-list-result.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAoBhD"}
@@ -0,0 +1,22 @@
1
+ const LIST_KEYS = ['tools', 'prompts', 'resources', 'resourceTemplates'];
2
+ export function repairListResult(result) {
3
+ if (!result || typeof result !== 'object') {
4
+ return result;
5
+ }
6
+ const record = result;
7
+ if (record.resultType === undefined) {
8
+ return result;
9
+ }
10
+ if (!LIST_KEYS.some((key) => Array.isArray(record[key]))) {
11
+ return result;
12
+ }
13
+ if (record.ttlMs !== undefined && record.cacheScope !== undefined) {
14
+ return result;
15
+ }
16
+ return {
17
+ ...record,
18
+ ttlMs: record.ttlMs ?? 0,
19
+ cacheScope: record.cacheScope ?? 'private',
20
+ };
21
+ }
22
+ //# sourceMappingURL=repair-list-result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repair-list-result.js","sourceRoot":"","sources":["../../../../src/roblox-mcp/mcp/repair-list-result.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,mBAAmB,CAAC,CAAC;AAEzE,MAAM,UAAU,gBAAgB,CAAI,MAAS;IAC3C,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC1C,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,MAAM,MAAM,GAAG,MAAiC,CAAC;IACjD,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACpC,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACzD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QAClE,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO;QACL,GAAG,MAAM;QACT,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;QACxB,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,SAAS;KACtC,CAAC;AACT,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=repair-list-result.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repair-list-result.test.d.ts","sourceRoot":"","sources":["../../../../src/roblox-mcp/mcp/repair-list-result.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,42 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { repairListResult } from './repair-list-result.js';
3
+ describe('repairListResult', () => {
4
+ it('fills in the caching hints a 2026-07-28 list result left out', () => {
5
+ expect(repairListResult({ resultType: 'complete', tools: [] })).toEqual({
6
+ resultType: 'complete',
7
+ tools: [],
8
+ ttlMs: 0,
9
+ cacheScope: 'private',
10
+ });
11
+ });
12
+ it('keeps hints the server sent', () => {
13
+ const result = {
14
+ resultType: 'complete',
15
+ tools: [],
16
+ ttlMs: 500,
17
+ cacheScope: 'shared',
18
+ };
19
+ expect(repairListResult(result)).toBe(result);
20
+ });
21
+ it('fills only the hint that is missing', () => {
22
+ expect(repairListResult({ resultType: 'complete', prompts: [], ttlMs: 10 })).toEqual({
23
+ resultType: 'complete',
24
+ prompts: [],
25
+ ttlMs: 10,
26
+ cacheScope: 'private',
27
+ });
28
+ });
29
+ it('leaves an older protocol result alone', () => {
30
+ const result = { tools: [] };
31
+ expect(repairListResult(result)).toBe(result);
32
+ });
33
+ it('leaves a result that is not a list alone', () => {
34
+ const result = { resultType: 'complete', content: [] };
35
+ expect(repairListResult(result)).toBe(result);
36
+ });
37
+ it('passes non-objects through', () => {
38
+ expect(repairListResult(undefined)).toBeUndefined();
39
+ expect(repairListResult('text')).toBe('text');
40
+ });
41
+ });
42
+ //# sourceMappingURL=repair-list-result.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3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EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;QAE7B,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,MAAM,GAAG,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;QAEvD,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QACpD,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { SessionContext, SessionInfo } from '../bridge/types.js';
2
+ import { type SpawnMcpProcess } from './mcp/mcp-stdio-client.js';
3
+ import { type MatchedStudio, type StudioWindow } from './studio/studio-session.js';
4
+ export type StudioMcpTarget = MatchedStudio;
5
+ export type StudioMcpFailure = 'unsupported' | 'unavailable' | 'no-studio' | 'failed' | 'timeout';
6
+ export type StudioMcpResult<T> = {
7
+ success: true;
8
+ value: T;
9
+ studio?: StudioMcpTarget;
10
+ settled?: boolean;
11
+ } | {
12
+ success: false;
13
+ reason: StudioMcpFailure;
14
+ message: string;
15
+ studio?: StudioMcpTarget;
16
+ };
17
+ export interface StudioMcpOptions {
18
+ target?: string;
19
+ sessions?: SessionInfo[];
20
+ timeoutMs?: number;
21
+ executablePath?: string;
22
+ spawnProcess?: SpawnMcpProcess;
23
+ listWindowsAsync?: () => Promise<StudioWindow[]>;
24
+ readPlaceIds?: boolean;
25
+ sessionPids?: Map<string, number>;
26
+ }
27
+ export interface StudioMcpLuauOptions extends StudioMcpOptions {
28
+ context?: SessionContext;
29
+ }
30
+ export declare function tryListStudiosAsync(options?: StudioMcpOptions): Promise<StudioMcpResult<StudioMcpTarget[]>>;
31
+ export declare function tryExecuteLuauAsync(code: string, options?: StudioMcpLuauOptions): Promise<StudioMcpResult<string>>;
32
+ export declare function tryCallStudioToolAsync(tool: string, args?: Record<string, unknown>, options?: StudioMcpLuauOptions): Promise<StudioMcpResult<string>>;
33
+ export declare function closeStudioMcpAsync(): Promise<void>;
34
+ //# sourceMappingURL=roblox-studio-mcp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roblox-studio-mcp.d.ts","sourceRoot":"","sources":["../../../src/roblox-mcp/roblox-studio-mcp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAC;AAKnC,OAAO,EAOL,KAAK,aAAa,EAElB,KAAK,YAAY,EAClB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,eAAe,GAAG,aAAa,CAAC;AAE5C,MAAM,MAAM,gBAAgB,GACxB,aAAa,GACb,aAAa,GACb,WAAW,GACX,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,MAAM,eAAe,CAAC,CAAC,IACzB;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAC;IAAC,MAAM,CAAC,EAAE,eAAe,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GACxE;IACE,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B,CAAC;AAEN,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CA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