@taj-special/dravix-code 1.3.6 → 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 +25 -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)
|
|
@@ -2330,8 +2342,8 @@ The summary should feel like a natural conversation close — informative, brief
|
|
|
2330
2342
|
process.on('exit', resetTerminal);
|
|
2331
2343
|
process.on('SIGINT', () => { resetTerminal(); process.exit(0); });
|
|
2332
2344
|
process.on('SIGTERM', () => { resetTerminal(); process.exit(0); });
|
|
2333
|
-
process.on('unhandledRejection', (reason) => { logError('unhandledRejection', reason);
|
|
2334
|
-
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 */ });
|
|
2335
2347
|
// Set raw mode ONCE — never toggle it during the session to avoid CMD getting stuck
|
|
2336
2348
|
process.stdin.setRawMode(true);
|
|
2337
2349
|
process.stdin.resume();
|
|
@@ -2524,6 +2536,7 @@ The summary should feel like a natural conversation close — informative, brief
|
|
|
2524
2536
|
}
|
|
2525
2537
|
// ── Ctrl+C cancel during streaming ──────────────────────────
|
|
2526
2538
|
let streamCancelled = false;
|
|
2539
|
+
let streamInputBuffer = '';
|
|
2527
2540
|
const streamAbort = new AbortController();
|
|
2528
2541
|
const onStreamKey = (data) => {
|
|
2529
2542
|
try {
|
|
@@ -2531,6 +2544,10 @@ The summary should feel like a natural conversation close — informative, brief
|
|
|
2531
2544
|
streamCancelled = true;
|
|
2532
2545
|
streamAbort.abort();
|
|
2533
2546
|
}
|
|
2547
|
+
else {
|
|
2548
|
+
// Capture user input during stream — will be queued for next turn
|
|
2549
|
+
streamInputBuffer += data;
|
|
2550
|
+
}
|
|
2534
2551
|
}
|
|
2535
2552
|
catch { /* ignore */ }
|
|
2536
2553
|
};
|
|
@@ -3381,6 +3398,12 @@ The summary should feel like a natural conversation close — informative, brief
|
|
|
3381
3398
|
});
|
|
3382
3399
|
// ── Remove streaming key listener ─────────────────────────
|
|
3383
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 = '';
|
|
3384
3407
|
// ── Accumulate token usage (deferred — report on next user turn) ──
|
|
3385
3408
|
if (cliTok && fullResponse) {
|
|
3386
3409
|
pendingOutputTokens += estimateTokens(normalizeResponse(fullResponse));
|