ropilot 0.1.45 → 0.1.47
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 +12 -6
- package/package.json +1 -1
package/lib/proxy.js
CHANGED
|
@@ -217,6 +217,7 @@ async function handleToolsCall(apiKey, request) {
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
// Handle sourcecontrol_commitscript - inject file content before forwarding
|
|
220
|
+
let commitScriptPath = null;
|
|
220
221
|
if (request.params?.name === 'ropilot_sourcecontrol_commitscript') {
|
|
221
222
|
const scriptPath = request.params?.arguments?.path;
|
|
222
223
|
const localFile = getLocalFileForScript(scriptPath);
|
|
@@ -226,7 +227,7 @@ async function handleToolsCall(apiKey, request) {
|
|
|
226
227
|
jsonrpc: '2.0',
|
|
227
228
|
id: request.id,
|
|
228
229
|
result: {
|
|
229
|
-
content: [{ type: 'text', text: `Error:
|
|
230
|
+
content: [{ type: 'text', text: `Error: Cannot commit "${scriptPath}" - you must request it first with ropilot_sourcecontrol_requestscript.` }],
|
|
230
231
|
isError: true
|
|
231
232
|
}
|
|
232
233
|
};
|
|
@@ -246,11 +247,17 @@ async function handleToolsCall(apiKey, request) {
|
|
|
246
247
|
// Read the file and inject content into the request
|
|
247
248
|
const content = readFileSync(localFile, 'utf-8');
|
|
248
249
|
request.params.arguments.content = content;
|
|
250
|
+
commitScriptPath = scriptPath; // Track for clearing after successful commit
|
|
249
251
|
}
|
|
250
252
|
|
|
251
253
|
// Forward to edge
|
|
252
254
|
const response = await forwardToEdge(apiKey, request);
|
|
253
255
|
|
|
256
|
+
// Clear the mapping after successful commit (prevents double commits)
|
|
257
|
+
if (commitScriptPath && !response?.result?.isError) {
|
|
258
|
+
scriptLocalFiles.delete(commitScriptPath);
|
|
259
|
+
}
|
|
260
|
+
|
|
254
261
|
// Check if this is a readScript response with large content
|
|
255
262
|
if (request.params?.name === 'ropilot_onboard_action' &&
|
|
256
263
|
request.params?.arguments?.action === 'readScript') {
|
|
@@ -291,7 +298,7 @@ async function handleToolsCall(apiKey, request) {
|
|
|
291
298
|
}
|
|
292
299
|
}
|
|
293
300
|
|
|
294
|
-
// Handle sourcecontrol_createscript - auto-write to src/ folder
|
|
301
|
+
// Handle sourcecontrol_createscript - auto-write empty file to src/ folder
|
|
295
302
|
if (request.params?.name === 'ropilot_sourcecontrol_createscript') {
|
|
296
303
|
const content = response?.result?.content;
|
|
297
304
|
if (content && Array.isArray(content) && content[0]?.text) {
|
|
@@ -300,13 +307,12 @@ async function handleToolsCall(apiKey, request) {
|
|
|
300
307
|
// Check for CREATED: prefix
|
|
301
308
|
if (responseText.startsWith('CREATED:')) {
|
|
302
309
|
const scriptPath = responseText.replace('CREATED:', '').trim();
|
|
303
|
-
const source = request.params.arguments.source || '';
|
|
304
310
|
|
|
305
|
-
// Write to src/ folder
|
|
306
|
-
const localFile = writeScriptToLocalFile(scriptPath,
|
|
311
|
+
// Write empty file to src/ folder
|
|
312
|
+
const localFile = writeScriptToLocalFile(scriptPath, '');
|
|
307
313
|
response.result.content = [{
|
|
308
314
|
type: 'text',
|
|
309
|
-
text: `Created script: ${scriptPath}\nLocal file: ${localFile}\n\
|
|
315
|
+
text: `Created empty script: ${scriptPath}\nLocal file: ${localFile}\n\nWrite your code to this file, then call ropilot_sourcecontrol_commitscript with path: "${scriptPath}"`
|
|
310
316
|
}];
|
|
311
317
|
}
|
|
312
318
|
}
|