autoclaw 1.0.31 → 1.0.32
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/index.js +8 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8,8 +8,6 @@ import * as fs from 'fs';
|
|
|
8
8
|
import * as path from 'path';
|
|
9
9
|
import * as os from 'os';
|
|
10
10
|
import { fileURLToPath } from 'url';
|
|
11
|
-
import { createInterface } from 'node:readline/promises';
|
|
12
|
-
import { stdin as input, stdout as output } from 'node:process';
|
|
13
11
|
// Handle Ctrl+C gracefully
|
|
14
12
|
function handleExit() {
|
|
15
13
|
console.log(chalk.cyan("\n\nGoodbye! (Interrupted)"));
|
|
@@ -354,20 +352,16 @@ async function runChat(queryParts, options) {
|
|
|
354
352
|
}
|
|
355
353
|
}
|
|
356
354
|
// Main chat loop
|
|
357
|
-
const rl = createInterface({ input, output });
|
|
358
355
|
try {
|
|
359
356
|
while (true) {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
console.log(chalk.cyan("\nGoodbye!"));
|
|
367
|
-
break;
|
|
357
|
+
const { userInput } = await inquirer.prompt([
|
|
358
|
+
{
|
|
359
|
+
type: 'input',
|
|
360
|
+
name: 'userInput',
|
|
361
|
+
message: 'You >',
|
|
362
|
+
prefix: chalk.green('?')
|
|
368
363
|
}
|
|
369
|
-
|
|
370
|
-
}
|
|
364
|
+
]);
|
|
371
365
|
if (userInput.toLowerCase() === 'exit' || userInput.toLowerCase() === 'quit') {
|
|
372
366
|
console.log(chalk.cyan("Goodbye!"));
|
|
373
367
|
break;
|
|
@@ -378,17 +372,13 @@ async function runChat(queryParts, options) {
|
|
|
378
372
|
}
|
|
379
373
|
}
|
|
380
374
|
catch (err) {
|
|
381
|
-
if (err.
|
|
382
|
-
// Handled inside loop mostly, but just in case
|
|
375
|
+
if (err.message && (err.message.includes('User force closed') || err.message.includes('Prompt was canceled'))) {
|
|
383
376
|
console.log(chalk.cyan("\nGoodbye!"));
|
|
384
377
|
}
|
|
385
378
|
else {
|
|
386
379
|
console.error(chalk.red("Error in chat loop:"), err);
|
|
387
380
|
}
|
|
388
381
|
}
|
|
389
|
-
finally {
|
|
390
|
-
rl.close();
|
|
391
|
-
}
|
|
392
382
|
}
|
|
393
383
|
// Global error handler
|
|
394
384
|
main().catch(err => {
|