0agent 1.0.36 → 1.0.37
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/bin/chat.js +26 -3
- package/package.json +1 -1
package/bin/chat.js
CHANGED
|
@@ -39,6 +39,18 @@ class Spinner {
|
|
|
39
39
|
if (clearIt) process.stdout.write('\r\x1b[2K');
|
|
40
40
|
}
|
|
41
41
|
get active() { return this._active; }
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Pause spinner, run fn() (which may print lines), then resume.
|
|
45
|
+
* Prevents spinner from overwriting printed content.
|
|
46
|
+
*/
|
|
47
|
+
pauseFor(fn) {
|
|
48
|
+
const wasActive = this._active;
|
|
49
|
+
const savedMsg = this._msg;
|
|
50
|
+
if (wasActive) this.stop(true);
|
|
51
|
+
fn();
|
|
52
|
+
if (wasActive) this.start(savedMsg);
|
|
53
|
+
}
|
|
42
54
|
}
|
|
43
55
|
|
|
44
56
|
// ─── ANSI helpers ─────────────────────────────────────────────────────────────
|
|
@@ -371,7 +383,9 @@ async function runTask(input) {
|
|
|
371
383
|
});
|
|
372
384
|
const s = await res.json();
|
|
373
385
|
sessionId = s.session_id ?? s.id;
|
|
374
|
-
|
|
386
|
+
// Show affordance so user knows they can queue messages while agent works
|
|
387
|
+
process.stdout.write(`\n \x1b[2m(type and press Enter to queue next message)\x1b[0m\n`);
|
|
388
|
+
spinner.start('Thinking');
|
|
375
389
|
|
|
376
390
|
// Polling fallback — runs concurrently with WS events.
|
|
377
391
|
// Catches completion when WS is disconnected (e.g. daemon just restarted).
|
|
@@ -926,11 +940,20 @@ rl.on('line', async (input) => {
|
|
|
926
940
|
const line = input.trim();
|
|
927
941
|
if (!line) { rl.prompt(); return; }
|
|
928
942
|
|
|
929
|
-
// If a session is already running, queue the message
|
|
943
|
+
// If a session is already running, queue the message.
|
|
944
|
+
// pauseFor() stops the spinner briefly so the user can see the confirmation,
|
|
945
|
+
// then resumes — prevents spinner from overwriting their typed text.
|
|
930
946
|
if (pendingResolve) {
|
|
931
947
|
messageQueue.push(line);
|
|
932
948
|
const qLen = messageQueue.length;
|
|
933
|
-
|
|
949
|
+
spinner.pauseFor(() => {
|
|
950
|
+
process.stdout.write(
|
|
951
|
+
` ${fmt(C.magenta, '↳')} ${fmt(C.bold, `[queued #${qLen}]`)} ${fmt(C.dim, line.slice(0, 70))}\n`
|
|
952
|
+
);
|
|
953
|
+
if (qLen > 1) {
|
|
954
|
+
process.stdout.write(` ${fmt(C.dim, `${qLen} tasks waiting`)}\n`);
|
|
955
|
+
}
|
|
956
|
+
});
|
|
934
957
|
return;
|
|
935
958
|
}
|
|
936
959
|
|