@tiens.nguyen/gonext-local-worker 1.0.216 → 1.0.217

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 +13 -3
  2. package/package.json +1 -1
package/gonext-repl.mjs CHANGED
@@ -965,9 +965,19 @@ async function runAgentTurn(history) {
965
965
  jobRunning = job.jobStatus === "running";
966
966
  const text = typeof job.resultText === "string" ? job.resultText : "";
967
967
  if (job.jobStatus === "completed") {
968
- // Drop the transient status line and any partial reasoning tail. If this was a
969
- // plain reply, its text is ALREADY fully visible (streamed live above) the
970
- // caller must not print it again; `shown` tells it so.
968
+ // The job can flip to "completed" between polls with authoritative resultText that
969
+ // the live stream hasn't caught up to yet (a debounced last chunk, or the final
970
+ // PATCH landing before its chunk flush was polled). resultText is the source of
971
+ // truth, so flush any not-yet-shown suffix BEFORE returning — otherwise a plain
972
+ // reply, whose live stream is its ONLY output, renders truncated mid-word. Gated
973
+ // to plainReplyFlow: the agent path reprints its answer from resultText via the
974
+ // caller (shown=false), so a live flush there is unnecessary (and would compound
975
+ // the separate agent double-print). This runs for the completed poll only; the
976
+ // running-branch consume below handles every earlier poll.
977
+ if (plainReplyFlow && text.length > shownChars) {
978
+ consume(text.slice(shownChars));
979
+ shownChars = text.length;
980
+ }
971
981
  clearStatus();
972
982
  return { text: answerFrom(text), shown: answerShownLive };
973
983
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiens.nguyen/gonext-local-worker",
3
- "version": "1.0.216",
3
+ "version": "1.0.217",
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",