@chrrxs/robloxstudio-mcp-inspector 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/index.js +4483 -0
  2. package/package.json +50 -0
  3. package/studio-plugin/INSTALLATION.md +150 -0
  4. package/studio-plugin/MCPInspectorPlugin.rbxmx +9074 -0
  5. package/studio-plugin/MCPPlugin.rbxmx +9074 -0
  6. package/studio-plugin/default.project.json +19 -0
  7. package/studio-plugin/dev.project.json +23 -0
  8. package/studio-plugin/inspector-icon.png +0 -0
  9. package/studio-plugin/package-lock.json +706 -0
  10. package/studio-plugin/package.json +19 -0
  11. package/studio-plugin/plugin.json +10 -0
  12. package/studio-plugin/src/modules/ClientBroker.ts +221 -0
  13. package/studio-plugin/src/modules/Communication.ts +399 -0
  14. package/studio-plugin/src/modules/Recording.ts +28 -0
  15. package/studio-plugin/src/modules/State.ts +94 -0
  16. package/studio-plugin/src/modules/UI.ts +725 -0
  17. package/studio-plugin/src/modules/Utils.ts +318 -0
  18. package/studio-plugin/src/modules/handlers/AssetHandlers.ts +241 -0
  19. package/studio-plugin/src/modules/handlers/BuildHandlers.ts +481 -0
  20. package/studio-plugin/src/modules/handlers/CaptureHandlers.ts +128 -0
  21. package/studio-plugin/src/modules/handlers/InputHandlers.ts +102 -0
  22. package/studio-plugin/src/modules/handlers/InstanceHandlers.ts +380 -0
  23. package/studio-plugin/src/modules/handlers/MetadataHandlers.ts +391 -0
  24. package/studio-plugin/src/modules/handlers/PropertyHandlers.ts +191 -0
  25. package/studio-plugin/src/modules/handlers/QueryHandlers.ts +827 -0
  26. package/studio-plugin/src/modules/handlers/ScriptHandlers.ts +530 -0
  27. package/studio-plugin/src/modules/handlers/TestHandlers.ts +277 -0
  28. package/studio-plugin/src/server/index.server.ts +63 -0
  29. package/studio-plugin/src/types/index.d.ts +44 -0
  30. package/studio-plugin/tsconfig.json +20 -0
@@ -0,0 +1,94 @@
1
+ import { Connection } from "../types";
2
+
3
+ const CURRENT_VERSION = "__VERSION__";
4
+ const MAX_CONNECTIONS = 5;
5
+ const BASE_PORT = 58741;
6
+ let activeTabIndex = 0;
7
+
8
+ function createConnection(port: number): Connection {
9
+ return {
10
+ port,
11
+ serverUrl: `http://localhost:${port}`,
12
+ isActive: false,
13
+ pollInterval: 0.5,
14
+ lastPoll: 0,
15
+ consecutiveFailures: 0,
16
+ maxFailuresBeforeError: 50,
17
+ lastSuccessfulConnection: 0,
18
+ currentRetryDelay: 0.5,
19
+ maxRetryDelay: 5,
20
+ retryBackoffMultiplier: 1.2,
21
+ lastHttpOk: false,
22
+ lastMcpOk: false,
23
+ mcpWaitStartTime: undefined,
24
+ isPolling: false,
25
+ heartbeatConnection: undefined,
26
+ };
27
+ }
28
+
29
+ const connections: Connection[] = [createConnection(BASE_PORT)];
30
+
31
+ function addConnection(port?: number): number | undefined {
32
+ if (connections.size() >= MAX_CONNECTIONS) {
33
+ return undefined;
34
+ }
35
+ if (port === undefined) {
36
+ let maxPort = BASE_PORT - 1;
37
+ for (const conn of connections) {
38
+ if (conn.port > maxPort) maxPort = conn.port;
39
+ }
40
+ port = maxPort + 1;
41
+ }
42
+ const conn = createConnection(port);
43
+ connections.push(conn);
44
+ return connections.size() - 1;
45
+ }
46
+
47
+ function removeConnection(index: number): boolean {
48
+ if (connections.size() <= 1) return false;
49
+ if (index < 0 || index >= connections.size()) return false;
50
+ if (connections[index].isActive) return false;
51
+
52
+ connections.remove(index);
53
+
54
+ if (activeTabIndex >= connections.size()) {
55
+ activeTabIndex = connections.size() - 1;
56
+ } else if (activeTabIndex > index) {
57
+ activeTabIndex -= 1;
58
+ }
59
+ return true;
60
+ }
61
+
62
+ function getActiveConnection(): Connection {
63
+ return connections[activeTabIndex];
64
+ }
65
+
66
+ function getConnection(index: number): Connection | undefined {
67
+ return connections[index];
68
+ }
69
+
70
+ function getActiveTabIndex(): number {
71
+ return activeTabIndex;
72
+ }
73
+
74
+ function setActiveTabIndex(index: number): void {
75
+ activeTabIndex = index;
76
+ }
77
+
78
+ function getConnections(): Connection[] {
79
+ return connections;
80
+ }
81
+
82
+ export = {
83
+ CURRENT_VERSION,
84
+ MAX_CONNECTIONS,
85
+ BASE_PORT,
86
+ connections,
87
+ addConnection,
88
+ removeConnection,
89
+ getActiveConnection,
90
+ getConnection,
91
+ getActiveTabIndex,
92
+ setActiveTabIndex,
93
+ getConnections,
94
+ };