vexi-cli 0.5.2 → 0.5.3
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.js +23 -15
- package/dist/cli.js +1 -1
- package/package.json +1 -1
package/dist/agent.js
CHANGED
|
@@ -31,20 +31,29 @@ import { ARABIC_RTL_NOTE, getStrings, t } from './i18n/index.js';
|
|
|
31
31
|
import { accent, dim, err, ok, printBanner, printStatusLine, userPrompt, vexiLabel, warn } from './ui/index.js';
|
|
32
32
|
/**
|
|
33
33
|
* Read a user message with multi-line paste support.
|
|
34
|
-
*
|
|
35
|
-
*
|
|
34
|
+
* Creates a fresh readline interface per call so it never conflicts
|
|
35
|
+
* with inquirer's internal readline. Lines pasted together arrive
|
|
36
|
+
* within ms of each other; a 30 ms debounce collects them all.
|
|
36
37
|
*/
|
|
37
|
-
function readMessage(
|
|
38
|
+
function readMessage(prompt) {
|
|
38
39
|
return new Promise((resolve, reject) => {
|
|
40
|
+
// Inquirer may have paused stdin — resume before creating our interface.
|
|
41
|
+
process.stdin.resume();
|
|
39
42
|
const lines = [];
|
|
40
43
|
let settled = false;
|
|
41
44
|
let timer = null;
|
|
45
|
+
const iface = nodeRl.createInterface({
|
|
46
|
+
input: process.stdin,
|
|
47
|
+
output: process.stdout,
|
|
48
|
+
terminal: true,
|
|
49
|
+
});
|
|
42
50
|
const finish = () => {
|
|
43
51
|
if (settled)
|
|
44
52
|
return;
|
|
45
53
|
settled = true;
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
iface.removeListener('line', onLine);
|
|
55
|
+
iface.removeListener('close', onClose);
|
|
56
|
+
iface.close();
|
|
48
57
|
resolve(lines.join('\n'));
|
|
49
58
|
};
|
|
50
59
|
const onLine = (line) => {
|
|
@@ -56,12 +65,17 @@ function readMessage(rl, prompt) {
|
|
|
56
65
|
const onClose = () => {
|
|
57
66
|
if (!settled) {
|
|
58
67
|
settled = true;
|
|
59
|
-
|
|
68
|
+
iface.removeListener('line', onLine);
|
|
60
69
|
reject(Object.assign(new Error('stdin closed'), { name: 'ExitPromptError' }));
|
|
61
70
|
}
|
|
62
71
|
};
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
iface.on('SIGINT', () => {
|
|
73
|
+
settled = true;
|
|
74
|
+
iface.close();
|
|
75
|
+
reject(Object.assign(new Error('ExitPromptError'), { name: 'ExitPromptError' }));
|
|
76
|
+
});
|
|
77
|
+
iface.on('line', onLine);
|
|
78
|
+
iface.once('close', onClose);
|
|
65
79
|
process.stdout.write(prompt + ' ');
|
|
66
80
|
});
|
|
67
81
|
}
|
|
@@ -83,10 +97,6 @@ export async function runAgent(opts) {
|
|
|
83
97
|
}
|
|
84
98
|
let provider = createProvider(config.provider, config.apiKey, config.model);
|
|
85
99
|
const root = process.cwd();
|
|
86
|
-
// Create a persistent readline interface for the chat loop.
|
|
87
|
-
// Must be created AFTER all inquirer prompts (first-run setup) are done.
|
|
88
|
-
const chatRl = nodeRl.createInterface({ input: process.stdin, output: process.stdout, terminal: true });
|
|
89
|
-
chatRl.on('SIGINT', () => process.exit(0));
|
|
90
100
|
// ── Full project understanding: scan + load memory + load skills ──────
|
|
91
101
|
const scanSpinner = ora({ text: dim(s.scanning), spinner: 'dots' }).start();
|
|
92
102
|
let project = null;
|
|
@@ -170,12 +180,11 @@ export async function runAgent(opts) {
|
|
|
170
180
|
while (true) {
|
|
171
181
|
let line;
|
|
172
182
|
try {
|
|
173
|
-
line = await readMessage(
|
|
183
|
+
line = await readMessage(userPrompt);
|
|
174
184
|
}
|
|
175
185
|
catch {
|
|
176
186
|
// Ctrl+C / closed stdin
|
|
177
187
|
console.log('\n' + ok(s.goodbye));
|
|
178
|
-
chatRl.close();
|
|
179
188
|
return;
|
|
180
189
|
}
|
|
181
190
|
const text = line.trim();
|
|
@@ -188,7 +197,6 @@ export async function runAgent(opts) {
|
|
|
188
197
|
case '/exit':
|
|
189
198
|
case '/quit':
|
|
190
199
|
console.log(ok(s.goodbye));
|
|
191
|
-
chatRl.close();
|
|
192
200
|
await mcp.close();
|
|
193
201
|
return;
|
|
194
202
|
case '/help':
|
package/dist/cli.js
CHANGED
|
@@ -32,7 +32,7 @@ import { createProvider, PROVIDER_INFO } from './providers/index.js';
|
|
|
32
32
|
import { openInDefaultApp } from './utils/open.js';
|
|
33
33
|
import { detectSystemLang, getStrings, normalizeLang, t, SUPPORTED_LANGS } from './i18n/index.js';
|
|
34
34
|
import { accent, dim, err, ok } from './ui/index.js';
|
|
35
|
-
export const VERSION = '0.5.
|
|
35
|
+
export const VERSION = '0.5.2';
|
|
36
36
|
/** Resolve the active language: --lang flag > saved config > system locale. */
|
|
37
37
|
async function resolveLang(flag) {
|
|
38
38
|
if (flag) {
|