ropilot 0.1.44 → 0.1.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/proxy.js +24 -2
- package/package.json +1 -1
package/lib/proxy.js
CHANGED
|
@@ -5,13 +5,25 @@
|
|
|
5
5
|
* all requests to the Ropilot edge server.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
|
|
8
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync, readdirSync } from 'fs';
|
|
9
9
|
import { join } from 'path';
|
|
10
10
|
import { homedir, tmpdir } from 'os';
|
|
11
11
|
import { randomUUID } from 'crypto';
|
|
12
12
|
import { spawn } from 'child_process';
|
|
13
13
|
import { getApiKey, EDGE_URL, loadGlobalConfig, saveGlobalConfig } from './config.js';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Check if current directory has a Rojo project (*.project.json)
|
|
17
|
+
*/
|
|
18
|
+
function hasRojoProject() {
|
|
19
|
+
try {
|
|
20
|
+
const files = readdirSync(process.cwd());
|
|
21
|
+
return files.some(f => f.endsWith('.project.json'));
|
|
22
|
+
} catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
15
27
|
// Plugin version check URL (served from ropilot.ai main server)
|
|
16
28
|
const PLUGIN_VERSION_URL = 'https://ropilot.ai/plugin/version';
|
|
17
29
|
const PLUGIN_DOWNLOAD_URL = 'https://ropilot.ai/plugin/StudioPlugin.lua';
|
|
@@ -100,10 +112,20 @@ let cachedKeyError = null;
|
|
|
100
112
|
/**
|
|
101
113
|
* Handle MCP tools/list request
|
|
102
114
|
* If key is invalid, return a helper tool that explains the error
|
|
115
|
+
* If Rojo project detected, filter out sourcecontrol tools
|
|
103
116
|
*/
|
|
104
117
|
async function handleToolsList(apiKey, request) {
|
|
105
118
|
try {
|
|
106
|
-
|
|
119
|
+
const response = await forwardToEdge(apiKey, request);
|
|
120
|
+
|
|
121
|
+
// If Rojo project detected, filter out sourcecontrol tools (use normal file editing instead)
|
|
122
|
+
if (hasRojoProject() && response?.result?.tools) {
|
|
123
|
+
response.result.tools = response.result.tools.filter(
|
|
124
|
+
t => !t.name.includes('sourcecontrol')
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return response;
|
|
107
129
|
} catch (err) {
|
|
108
130
|
cachedKeyError = err.message;
|
|
109
131
|
// Return a single tool that explains the error when called
|