@semalt-ai/code 1.3.0 → 1.3.1
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/index.js +11 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -789,6 +789,7 @@ async function cmdChat(opts) {
|
|
|
789
789
|
printBanner();
|
|
790
790
|
const cwd = process.cwd();
|
|
791
791
|
let currentModel = opts.model || config.default_model;
|
|
792
|
+
let isRunningAgent = false;
|
|
792
793
|
|
|
793
794
|
printStatusBar(currentModel, cwd);
|
|
794
795
|
printHelpHints();
|
|
@@ -807,8 +808,15 @@ async function cmdChat(opts) {
|
|
|
807
808
|
process.exit(0);
|
|
808
809
|
});
|
|
809
810
|
|
|
811
|
+
rl.on('SIGINT', () => {
|
|
812
|
+
if (isRunningAgent) return;
|
|
813
|
+
console.log(`\n ${FG_YELLOW}Use Ctrl+D or type exit to quit.${RST}`);
|
|
814
|
+
rl.prompt(true);
|
|
815
|
+
});
|
|
816
|
+
|
|
810
817
|
async function prompt() {
|
|
811
|
-
rl.
|
|
818
|
+
rl.setPrompt(` ${FG_TEAL}${BOLD}>${RST} `);
|
|
819
|
+
rl.question(rl.getPrompt(), async (input) => {
|
|
812
820
|
const text = (input || '').trim();
|
|
813
821
|
|
|
814
822
|
if (!text) return prompt();
|
|
@@ -889,7 +897,9 @@ async function cmdChat(opts) {
|
|
|
889
897
|
console.log(` ${FG_DARK}${'─'.repeat(Math.min(cols, 70) - 4)}${RST}`);
|
|
890
898
|
|
|
891
899
|
rl.pause();
|
|
900
|
+
isRunningAgent = true;
|
|
892
901
|
messages = await runAgentLoop(messages, currentModel);
|
|
902
|
+
isRunningAgent = false;
|
|
893
903
|
rl.resume();
|
|
894
904
|
|
|
895
905
|
console.log(` ${FG_DARK}${'━'.repeat(Math.min(cols, 70) - 4)}${RST}`);
|