@taj-special/dravix-code 1.3.5 → 1.3.7
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/cli/repl.js +26 -2
- package/package.json +1 -1
package/dist/cli/repl.js
CHANGED
|
@@ -749,6 +749,16 @@ async function askPermission(label, key, alwaysAllowed, noAlways, diffShown, pre
|
|
|
749
749
|
if (!noAlways && alwaysAllowed.has(key))
|
|
750
750
|
return true;
|
|
751
751
|
return new Promise((resolve) => {
|
|
752
|
+
// Auto-resolve after 5 min — prevent hanging process
|
|
753
|
+
const timeout = setTimeout(() => {
|
|
754
|
+
cleanup();
|
|
755
|
+
clearMenu(menuLines);
|
|
756
|
+
for (let i = 0; i < previewLineCount - 1; i++) {
|
|
757
|
+
process.stdout.write('\x1b[1A\x1b[2K');
|
|
758
|
+
}
|
|
759
|
+
process.stdout.write(` ${colors.muted('○')} ${colors.muted('Timeout — skipped: ' + label)}\n`);
|
|
760
|
+
resolve(false);
|
|
761
|
+
}, 300_000);
|
|
752
762
|
let sel = 0;
|
|
753
763
|
let drawn = false;
|
|
754
764
|
const ci = label.indexOf(': ');
|
|
@@ -802,9 +812,11 @@ async function askPermission(label, key, alwaysAllowed, noAlways, diffShown, pre
|
|
|
802
812
|
}
|
|
803
813
|
printMenu();
|
|
804
814
|
function cleanup() {
|
|
815
|
+
clearTimeout(timeout);
|
|
805
816
|
process.stdin.removeListener('data', onData);
|
|
806
817
|
}
|
|
807
818
|
function confirm(idx) {
|
|
819
|
+
clearTimeout(timeout);
|
|
808
820
|
cleanup();
|
|
809
821
|
clearMenu(menuLines);
|
|
810
822
|
// Clear the diff preview lines (all except the first blank separator)
|
|
@@ -2261,6 +2273,7 @@ Find files by glob pattern.
|
|
|
2261
2273
|
- Multiple edit_file on the same file: order from BOTTOM to TOP (line numbers shift as you edit).
|
|
2262
2274
|
- DO NOT output <write_file> / <edit_file> / <run_command> tags inside markdown code blocks — they must be raw in the response.
|
|
2263
2275
|
- Execute ALL operations in ONE response when possible — do not split work across multiple turns.
|
|
2276
|
+
- ⚠️ CRITICAL: If you write "now I will run/start/execute/install X" — you MUST also include the <run_command> tag. Saying it is NOT enough. Always output the actual tag with the command.
|
|
2264
2277
|
|
|
2265
2278
|
## End-of-turn summary — REQUIRED after every task
|
|
2266
2279
|
|
|
@@ -2329,8 +2342,8 @@ The summary should feel like a natural conversation close — informative, brief
|
|
|
2329
2342
|
process.on('exit', resetTerminal);
|
|
2330
2343
|
process.on('SIGINT', () => { resetTerminal(); process.exit(0); });
|
|
2331
2344
|
process.on('SIGTERM', () => { resetTerminal(); process.exit(0); });
|
|
2332
|
-
process.on('unhandledRejection', (reason) => { logError('unhandledRejection', reason);
|
|
2333
|
-
process.on('uncaughtException', (err) => { logError('uncaughtException', err);
|
|
2345
|
+
process.on('unhandledRejection', (reason) => { logError('unhandledRejection', reason); /* don't kill — let process continue */ });
|
|
2346
|
+
process.on('uncaughtException', (err) => { logError('uncaughtException', err); /* don't kill — let process continue */ });
|
|
2334
2347
|
// Set raw mode ONCE — never toggle it during the session to avoid CMD getting stuck
|
|
2335
2348
|
process.stdin.setRawMode(true);
|
|
2336
2349
|
process.stdin.resume();
|
|
@@ -2523,6 +2536,7 @@ The summary should feel like a natural conversation close — informative, brief
|
|
|
2523
2536
|
}
|
|
2524
2537
|
// ── Ctrl+C cancel during streaming ──────────────────────────
|
|
2525
2538
|
let streamCancelled = false;
|
|
2539
|
+
let streamInputBuffer = '';
|
|
2526
2540
|
const streamAbort = new AbortController();
|
|
2527
2541
|
const onStreamKey = (data) => {
|
|
2528
2542
|
try {
|
|
@@ -2530,6 +2544,10 @@ The summary should feel like a natural conversation close — informative, brief
|
|
|
2530
2544
|
streamCancelled = true;
|
|
2531
2545
|
streamAbort.abort();
|
|
2532
2546
|
}
|
|
2547
|
+
else {
|
|
2548
|
+
// Capture user input during stream — will be queued for next turn
|
|
2549
|
+
streamInputBuffer += data;
|
|
2550
|
+
}
|
|
2533
2551
|
}
|
|
2534
2552
|
catch { /* ignore */ }
|
|
2535
2553
|
};
|
|
@@ -3380,6 +3398,12 @@ The summary should feel like a natural conversation close — informative, brief
|
|
|
3380
3398
|
});
|
|
3381
3399
|
// ── Remove streaming key listener ─────────────────────────
|
|
3382
3400
|
process.stdin.removeListener('data', onStreamKey);
|
|
3401
|
+
// ── Queue captured input for next user turn ─────────────────
|
|
3402
|
+
const captured = streamInputBuffer.trim();
|
|
3403
|
+
if (captured && !queuedResult) {
|
|
3404
|
+
queuedResult = { text: captured, lines: [captured] };
|
|
3405
|
+
}
|
|
3406
|
+
streamInputBuffer = '';
|
|
3383
3407
|
// ── Accumulate token usage (deferred — report on next user turn) ──
|
|
3384
3408
|
if (cliTok && fullResponse) {
|
|
3385
3409
|
pendingOutputTokens += estimateTokens(normalizeResponse(fullResponse));
|