@blockrun/runcode 1.5.10 → 1.5.11
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/dist/agent/loop.js +29 -0
- package/package.json +1 -1
package/dist/agent/loop.js
CHANGED
|
@@ -222,6 +222,35 @@ export async function interactiveSession(config, getUserInput, onEvent, onAbortR
|
|
|
222
222
|
break; // User wants to exit
|
|
223
223
|
if (input === '')
|
|
224
224
|
continue; // Empty input → re-prompt
|
|
225
|
+
// Handle /stash and /unstash — git stash management
|
|
226
|
+
if (input === '/stash') {
|
|
227
|
+
try {
|
|
228
|
+
const { execSync } = await import('node:child_process');
|
|
229
|
+
const result = execSync('git stash push -m "runcode auto-stash"', {
|
|
230
|
+
cwd: config.workingDir || process.cwd(), encoding: 'utf-8', timeout: 10000
|
|
231
|
+
}).trim();
|
|
232
|
+
onEvent({ kind: 'text_delta', text: result || 'No changes to stash.\n' });
|
|
233
|
+
}
|
|
234
|
+
catch (e) {
|
|
235
|
+
onEvent({ kind: 'text_delta', text: `Stash error: ${e.message?.split('\n')[0]}\n` });
|
|
236
|
+
}
|
|
237
|
+
onEvent({ kind: 'turn_done', reason: 'completed' });
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
if (input === '/unstash') {
|
|
241
|
+
try {
|
|
242
|
+
const { execSync } = await import('node:child_process');
|
|
243
|
+
const result = execSync('git stash pop', {
|
|
244
|
+
cwd: config.workingDir || process.cwd(), encoding: 'utf-8', timeout: 10000
|
|
245
|
+
}).trim();
|
|
246
|
+
onEvent({ kind: 'text_delta', text: result || 'Stash applied.\n' });
|
|
247
|
+
}
|
|
248
|
+
catch (e) {
|
|
249
|
+
onEvent({ kind: 'text_delta', text: `Unstash error: ${e.message?.split('\n')[0]}\n` });
|
|
250
|
+
}
|
|
251
|
+
onEvent({ kind: 'turn_done', reason: 'completed' });
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
225
254
|
// Handle /branch — show current branch or create new
|
|
226
255
|
if (input === '/branch' || input.startsWith('/branch ')) {
|
|
227
256
|
try {
|