@runuai/host 0.8.22 → 0.8.23

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.
@@ -244,9 +244,31 @@ export class CursorSession implements AgentSession {
244
244
  const m = mapCursorLine(line);
245
245
  if (m.sessionId) this.sessionId = m.sessionId;
246
246
  if (typeof m.textDelta === "string") {
247
- sawText = true;
248
- acc += m.textDelta;
249
- this.emit({ type: "message_delta", text: m.textDelta });
247
+ // Cursor (--stream-partial-output) streams incremental token deltas
248
+ // and then a REDUNDANT full-message snapshot. The timestamp_ms
249
+ // heuristic in mapCursorLine drops that final snapshot for models
250
+ // whose final line is untagged — but Cursor's multi-model support
251
+ // (ADR-068) means SOME models tag the final full snapshot with
252
+ // timestamp_ms too, so it slips through and gets appended on top of
253
+ // the tokens: every message doubled (live 2026-07-21). Reconcile
254
+ // against what we've already streamed instead of trusting the tag —
255
+ // robust to incremental tokens, cumulative snapshots, and the
256
+ // redundant final repeat alike.
257
+ const t = m.textDelta;
258
+ let delta: string | null;
259
+ if (t === acc) {
260
+ delta = null; // full-message snapshot we've already emitted
261
+ } else if (acc.length > 0 && t.startsWith(acc)) {
262
+ delta = t.slice(acc.length); // cumulative snapshot → growth only
263
+ acc = t;
264
+ } else {
265
+ delta = t; // incremental token / genuinely new text
266
+ acc += t;
267
+ }
268
+ if (delta) {
269
+ sawText = true;
270
+ this.emit({ type: "message_delta", text: delta });
271
+ }
250
272
  }
251
273
  if (m.toolCall) {
252
274
  this.emit({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runuai/host",
3
- "version": "0.8.22",
3
+ "version": "0.8.23",
4
4
  "description": "Uai host — runs ephemeral AI coding tasks in Docker on a machine you control.",
5
5
  "license": "MIT",
6
6
  "author": "Diogo Perillo <diogo.perillo@gmail.com>",