@tiens.nguyen/gonext-local-worker 1.0.259 → 1.0.260

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.
Files changed (2) hide show
  1. package/gonext-repl.mjs +15 -0
  2. package/package.json +1 -1
package/gonext-repl.mjs CHANGED
@@ -1750,6 +1750,18 @@ async function main() {
1750
1750
  console.log(shown ? "" : `\n\n${answer}\n`);
1751
1751
  } else {
1752
1752
  history.pop(); // aborted/failed/cancelled turn — don't poison the next request
1753
+ // A turn that ended WITHOUT an answer (Ctrl+C cancel, or an abort/failure) must not
1754
+ // silently launch another turn. Any keystrokes the user typed DURING the dead turn
1755
+ // sit in `_lineQueue` — they land there (not ignored) whenever `following` was still
1756
+ // false, e.g. during the agent-ask round-trip at the very start of the turn, or
1757
+ // while the user was mashing "continue"/Enter. If left queued, `nextLine()` drains
1758
+ // them back-to-back on the next loop iterations, each auto-firing a fresh turn that
1759
+ // a straggler Ctrl+C then lands on — the reported "every turn immediately shows
1760
+ // (cancelled)" loop. Drop that buffered input so the NEXT turn only starts when the
1761
+ // user deliberately types something new (bug #92). Resume via "continue" still works:
1762
+ // that's typed AFTER the cancel note, so it arrives through the live waiter, not the
1763
+ // queue.
1764
+ if (_lineQueue.length > 0) _lineQueue.length = 0;
1753
1765
  // Ctrl+C cancel already printed its own "(cancelled)" note in runAgentTurn — a
1754
1766
  // second "(no answer)" line here would be redundant/misleading.
1755
1767
  if (cancelled) {
@@ -1763,6 +1775,9 @@ async function main() {
1763
1775
  }
1764
1776
  } catch (err) {
1765
1777
  history.pop();
1778
+ // Same reasoning as the no-answer branch (bug #92): don't let input buffered during a
1779
+ // turn that just threw auto-fire the next one.
1780
+ if (_lineQueue.length > 0) _lineQueue.length = 0;
1766
1781
  console.error(red(`\ngonext: ${err.message}\n`));
1767
1782
  }
1768
1783
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiens.nguyen/gonext-local-worker",
3
- "version": "1.0.259",
3
+ "version": "1.0.260",
4
4
  "description": "Polls GoNext cloud API for async local LLM jobs and runs them against Ollama/OpenAI-compatible servers on this Mac",
5
5
  "type": "module",
6
6
  "license": "MIT",