@taj-special/dravix-code 1.3.6 → 1.3.8
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/commands.js +2 -0
- package/dist/cli/repl.js +32 -2
- package/package.json +1 -1
package/dist/cli/commands.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
1
2
|
import { execFileSync } from 'child_process';
|
|
2
3
|
import { buildContext } from '../services/context.js';
|
|
3
4
|
import { banner, printHelp, printInfo, colors } from '../utils/display.js';
|
|
@@ -37,6 +38,7 @@ export async function handleCommand(cmd, cwd, clearHistory, addFileToContext, ge
|
|
|
37
38
|
}
|
|
38
39
|
if (name === '/clear' || name === '/new') {
|
|
39
40
|
clearHistory();
|
|
41
|
+
process.stdout.write(`\x1b]0;Dravix Code — ${path.basename(cwd)}\x07`);
|
|
40
42
|
console.clear();
|
|
41
43
|
banner();
|
|
42
44
|
const { name: userName } = getSavedUser();
|
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)
|
|
@@ -2133,6 +2145,11 @@ async function showDesignModeLoader(skills) {
|
|
|
2133
2145
|
}
|
|
2134
2146
|
export async function startRepl(cwd) {
|
|
2135
2147
|
const alwaysAllowed = new Set();
|
|
2148
|
+
// ── Terminal title helper ─────────────────────────────────────
|
|
2149
|
+
function setTerminalTitle(title) {
|
|
2150
|
+
process.stdout.write(`\x1b]0;Dravix Code — ${title}\x07`);
|
|
2151
|
+
}
|
|
2152
|
+
setTerminalTitle(path.basename(cwd));
|
|
2136
2153
|
const token = getToken() ?? '';
|
|
2137
2154
|
let SYSTEM_PROMPT = `You are Dravix Code, an interactive CLI coding agent powered by DeepSeek that helps users with software engineering tasks. Use the instructions below and the tools available to you to assist the user.
|
|
2138
2155
|
|
|
@@ -2330,8 +2347,8 @@ The summary should feel like a natural conversation close — informative, brief
|
|
|
2330
2347
|
process.on('exit', resetTerminal);
|
|
2331
2348
|
process.on('SIGINT', () => { resetTerminal(); process.exit(0); });
|
|
2332
2349
|
process.on('SIGTERM', () => { resetTerminal(); process.exit(0); });
|
|
2333
|
-
process.on('unhandledRejection', (reason) => { logError('unhandledRejection', reason);
|
|
2334
|
-
process.on('uncaughtException', (err) => { logError('uncaughtException', err);
|
|
2350
|
+
process.on('unhandledRejection', (reason) => { logError('unhandledRejection', reason); /* don't kill — let process continue */ });
|
|
2351
|
+
process.on('uncaughtException', (err) => { logError('uncaughtException', err); /* don't kill — let process continue */ });
|
|
2335
2352
|
// Set raw mode ONCE — never toggle it during the session to avoid CMD getting stuck
|
|
2336
2353
|
process.stdin.setRawMode(true);
|
|
2337
2354
|
process.stdin.resume();
|
|
@@ -2415,6 +2432,7 @@ The summary should feel like a natural conversation close — informative, brief
|
|
|
2415
2432
|
});
|
|
2416
2433
|
sessionId = convId;
|
|
2417
2434
|
conversationTitle = conv.title;
|
|
2435
|
+
setTerminalTitle(conv.title);
|
|
2418
2436
|
printConversationHistory(conv.messages);
|
|
2419
2437
|
}
|
|
2420
2438
|
}
|
|
@@ -2524,6 +2542,7 @@ The summary should feel like a natural conversation close — informative, brief
|
|
|
2524
2542
|
}
|
|
2525
2543
|
// ── Ctrl+C cancel during streaming ──────────────────────────
|
|
2526
2544
|
let streamCancelled = false;
|
|
2545
|
+
let streamInputBuffer = '';
|
|
2527
2546
|
const streamAbort = new AbortController();
|
|
2528
2547
|
const onStreamKey = (data) => {
|
|
2529
2548
|
try {
|
|
@@ -2531,6 +2550,10 @@ The summary should feel like a natural conversation close — informative, brief
|
|
|
2531
2550
|
streamCancelled = true;
|
|
2532
2551
|
streamAbort.abort();
|
|
2533
2552
|
}
|
|
2553
|
+
else {
|
|
2554
|
+
// Capture user input during stream — will be queued for next turn
|
|
2555
|
+
streamInputBuffer += data;
|
|
2556
|
+
}
|
|
2534
2557
|
}
|
|
2535
2558
|
catch { /* ignore */ }
|
|
2536
2559
|
};
|
|
@@ -2915,6 +2938,7 @@ The summary should feel like a natural conversation close — informative, brief
|
|
|
2915
2938
|
if (_u && _a) {
|
|
2916
2939
|
generateAITitle(String(_u.content), String(_a.content), token).then(t => {
|
|
2917
2940
|
conversationTitle = t;
|
|
2941
|
+
setTerminalTitle(t);
|
|
2918
2942
|
saveConversation(sessionId, t, activeCwd, history.slice(1));
|
|
2919
2943
|
}).catch(() => { });
|
|
2920
2944
|
}
|
|
@@ -3381,6 +3405,12 @@ The summary should feel like a natural conversation close — informative, brief
|
|
|
3381
3405
|
});
|
|
3382
3406
|
// ── Remove streaming key listener ─────────────────────────
|
|
3383
3407
|
process.stdin.removeListener('data', onStreamKey);
|
|
3408
|
+
// ── Queue captured input for next user turn ─────────────────
|
|
3409
|
+
const captured = streamInputBuffer.trim();
|
|
3410
|
+
if (captured && !queuedResult) {
|
|
3411
|
+
queuedResult = { text: captured, lines: [captured] };
|
|
3412
|
+
}
|
|
3413
|
+
streamInputBuffer = '';
|
|
3384
3414
|
// ── Accumulate token usage (deferred — report on next user turn) ──
|
|
3385
3415
|
if (cliTok && fullResponse) {
|
|
3386
3416
|
pendingOutputTokens += estimateTokens(normalizeResponse(fullResponse));
|