@oxecli/oxe 1.0.9 → 1.0.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/cli.js +13 -1
- package/dist/config.js +2 -2
- package/dist/ui.js +2 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -290,6 +290,9 @@ export class CLI {
|
|
|
290
290
|
break;
|
|
291
291
|
}
|
|
292
292
|
this.interruptPending = true;
|
|
293
|
+
// clearBox leaves the cursor on the leading blank row; the newline
|
|
294
|
+
// below places the message one row lower, giving one blank above it
|
|
295
|
+
// (mirrors Python's console.print()).
|
|
293
296
|
process.stdout.write("\n");
|
|
294
297
|
process.stdout.write(wasActive
|
|
295
298
|
? "\x1b[2mInterrupted. Press Ctrl+C again to exit, or type a new prompt.\x1b[0m\n"
|
|
@@ -310,7 +313,11 @@ export async function main() {
|
|
|
310
313
|
}
|
|
311
314
|
catch (err) {
|
|
312
315
|
if (err?.message === "interrupt" || err?.message === "eof") {
|
|
316
|
+
// cleanup() already moved to a fresh line; the leading newline below
|
|
317
|
+
// leaves that row as a blank, giving exactly one blank under the prompt,
|
|
318
|
+
// and the trailing newline gives one blank under the goodbye message.
|
|
313
319
|
process.stdout.write("\nClosing terminal session. Goodbye!\n");
|
|
320
|
+
process.exit(0);
|
|
314
321
|
return;
|
|
315
322
|
}
|
|
316
323
|
throw err;
|
|
@@ -322,6 +329,11 @@ export async function main() {
|
|
|
322
329
|
}
|
|
323
330
|
finally {
|
|
324
331
|
await engine.cleanupStoredResponses();
|
|
325
|
-
|
|
332
|
+
const client = engine.client;
|
|
333
|
+
if (typeof client?.close === "function")
|
|
334
|
+
await client.close();
|
|
326
335
|
}
|
|
336
|
+
// The prompt's readline keypress listener is never removed and stdin remains
|
|
337
|
+
// resumed, so Node won't exit on its own after the loop ends. Exit explicitly.
|
|
338
|
+
process.exit(0);
|
|
327
339
|
}
|
package/dist/config.js
CHANGED
|
@@ -236,9 +236,8 @@ export async function promptApiKey(prompt) {
|
|
|
236
236
|
const onData = (buf) => {
|
|
237
237
|
for (const b of buf) {
|
|
238
238
|
if (b === 3) {
|
|
239
|
-
// Ctrl+C
|
|
239
|
+
// Ctrl+C: cleanup() already writes the terminating newline.
|
|
240
240
|
cleanup();
|
|
241
|
-
process.stdout.write("\n");
|
|
242
241
|
reject(new Error("interrupt"));
|
|
243
242
|
return;
|
|
244
243
|
}
|
|
@@ -276,6 +275,7 @@ export async function promptApiKey(prompt) {
|
|
|
276
275
|
catch {
|
|
277
276
|
/* ignore */
|
|
278
277
|
}
|
|
278
|
+
process.stdin.pause();
|
|
279
279
|
process.stdout.write("\n");
|
|
280
280
|
};
|
|
281
281
|
process.stdin.on("data", onData);
|
package/dist/ui.js
CHANGED
|
@@ -611,6 +611,8 @@ export function askBottomPrompt(label = "You", prefix = "❯", history = []) {
|
|
|
611
611
|
process.stdin.setRawMode(false);
|
|
612
612
|
showCursor();
|
|
613
613
|
clearBox();
|
|
614
|
+
process.stdin.removeListener("keypress", onKeypress);
|
|
615
|
+
process.stdin.pause();
|
|
614
616
|
if (isErr)
|
|
615
617
|
reject(value);
|
|
616
618
|
else
|