@adhdev/daemon-standalone 0.9.82-rc.567 → 0.9.82-rc.568

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/dist/index.js CHANGED
@@ -30217,10 +30217,10 @@ var require_dist3 = __commonJS({
30217
30217
  }
30218
30218
  function getDaemonBuildInfo() {
30219
30219
  if (cached2) return cached2;
30220
- const commit = readInjected(true ? "86f8d403efe203d7ff1d9b6997ede5f30620a485" : void 0) ?? "unknown";
30221
- const commitShort = readInjected(true ? "86f8d403" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30222
- const version2 = readInjected(true ? "0.9.82-rc.567" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30223
- const builtAt = readInjected(true ? "2026-07-18T09:04:52.949Z" : void 0);
30220
+ const commit = readInjected(true ? "39e0687342226d334e36c982bd8988802f43dd3e" : void 0) ?? "unknown";
30221
+ const commitShort = readInjected(true ? "39e06873" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
30222
+ const version2 = readInjected(true ? "0.9.82-rc.568" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
30223
+ const builtAt = readInjected(true ? "2026-07-18T14:18:58.061Z" : void 0);
30224
30224
  cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
30225
30225
  return cached2;
30226
30226
  }
@@ -78538,18 +78538,30 @@ ${body}
78538
78538
  * the dashboard tail-repair cache — a display value, not a completion decision.
78539
78539
  */
78540
78540
  lastVisibleAssistantSummary(messages) {
78541
- if (!Array.isArray(messages)) return "";
78541
+ return this.lastVisibleAssistantSummaryDetail(messages).content;
78542
+ }
78543
+ // Like lastVisibleAssistantSummary but also returns the source bubble's own
78544
+ // timestamp (ms), so a cached summary can later be turn-scoped: the display
78545
+ // cache is populated from an UNSCOPED tail read (it must show the answer as
78546
+ // soon as native-history has it), so it can hold a bubble that predates the
78547
+ // current turn. Recording the bubble's timestamp lets the weak-completion
78548
+ // fallback reject a turn-stale cached summary instead of re-leaking the exact
78549
+ // stale bubble the turn-boundary gate already rejected (FALSE-IDLE Defect 1c).
78550
+ lastVisibleAssistantSummaryDetail(messages) {
78551
+ if (!Array.isArray(messages)) return { content: "" };
78542
78552
  for (let i = messages.length - 1; i >= 0; i -= 1) {
78543
78553
  const m = messages[i];
78544
78554
  const role = typeof m?.role === "string" ? m.role : "";
78545
78555
  const kind = typeof m?.kind === "string" ? m.kind : "";
78546
78556
  if (role === "system") continue;
78547
78557
  if (kind === "tool" || kind === "activity") continue;
78548
- if (role === "user" || role === "human") return "";
78549
- if (role === "assistant") return flattenContent(m.content).trim();
78550
- return "";
78558
+ if (role === "user" || role === "human") return { content: "" };
78559
+ if (role === "assistant") {
78560
+ return { content: flattenContent(m.content).trim(), timestampMs: readChatMessageTimestampMs(m) };
78561
+ }
78562
+ return { content: "" };
78551
78563
  }
78552
- return "";
78564
+ return { content: "" };
78553
78565
  }
78554
78566
  /**
78555
78567
  * NOTIF Defect-B: the final assistant summary this instance ALREADY parsed and
@@ -78570,6 +78582,28 @@ ${body}
78570
78582
  const content = typeof cached3?.content === "string" ? cached3.content.trim() : "";
78571
78583
  return content;
78572
78584
  }
78585
+ // FALSE-IDLE Defect 1c: turn-scoped view of the cached completion summary.
78586
+ // The cache is populated from an UNSCOPED tail read (lastVisibleAssistant‑
78587
+ // SummaryDetail) so the dashboard can show the answer the instant native-history
78588
+ // has it — which means it can hold a bubble that PREDATES the producing turn.
78589
+ // The weak-completion (missing_final_assistant) emit path falls back to the cache
78590
+ // for finalSummary; without turn-scoping it would re-surface the exact stale
78591
+ // mid-turn bubble the turn-boundary gate already rejected as evidence, freezing
78592
+ // that stale text as the completion's finalSummary. Consult the cache only when
78593
+ // its source bubble is proven in-turn (timestamp at/after turnStartedAt). When no
78594
+ // boundary is known (turnStartedAt falsy) or the cache carries no source timestamp
78595
+ // (legacy writes), behaviour is identical to the unscoped read.
78596
+ cachedInTurnCompletionSummaryContent(turnStartedAt) {
78597
+ const cached3 = this.lastCompletionSummary;
78598
+ const content = typeof cached3?.content === "string" ? cached3.content.trim() : "";
78599
+ if (!content) return "";
78600
+ const hasBoundary = typeof turnStartedAt === "number" && Number.isFinite(turnStartedAt) && turnStartedAt > 0;
78601
+ const ts2 = cached3?.sourceTimestampMs;
78602
+ if (hasBoundary && typeof ts2 === "number" && Number.isFinite(ts2) && ts2 < turnStartedAt) {
78603
+ return "";
78604
+ }
78605
+ return content;
78606
+ }
78573
78607
  completionFinalAssistantEvidence(parsedMessages, turnStartedAt) {
78574
78608
  const turnClosed = !this.hasAdapterPendingResponse();
78575
78609
  if (this.completionHasFinalAssistantMessage(parsedMessages, turnStartedAt)) {
@@ -78583,9 +78617,9 @@ ${body}
78583
78617
  if (externalMessages) {
78584
78618
  const injectedTaskGenerating = this.injectedTaskHasStartedGenerating();
78585
78619
  const present = injectedTaskGenerating && turnClosed && this.completionHasFinalAssistantMessage(externalMessages, turnStartedAt);
78586
- const lastVisibleAssistant = this.lastVisibleAssistantSummary(externalMessages);
78587
- if (lastVisibleAssistant) {
78588
- this.lastCompletionSummary = { content: lastVisibleAssistant, receivedAt: Date.now() };
78620
+ const lastVisibleAssistant = this.lastVisibleAssistantSummaryDetail(externalMessages);
78621
+ if (lastVisibleAssistant.content) {
78622
+ this.lastCompletionSummary = { content: lastVisibleAssistant.content, receivedAt: Date.now(), sourceTimestampMs: lastVisibleAssistant.timestampMs };
78589
78623
  }
78590
78624
  return {
78591
78625
  present,
@@ -78609,7 +78643,7 @@ ${body}
78609
78643
  const externalMessages = this.readExternalCompletionMessages();
78610
78644
  const externalSummary = externalMessages ? extractFinalSummaryFromMessagesAfter(externalMessages, turnStartedAt) : "";
78611
78645
  if (externalSummary) {
78612
- this.lastCompletionSummary = { content: externalSummary, receivedAt: Date.now() };
78646
+ this.lastCompletionSummary = { content: externalSummary, receivedAt: Date.now(), sourceTimestampMs: typeof turnStartedAt === "number" ? turnStartedAt : void 0 };
78613
78647
  return externalSummary;
78614
78648
  }
78615
78649
  return parsedSummary || void 0;
@@ -78624,7 +78658,7 @@ ${body}
78624
78658
  } catch (error48) {
78625
78659
  parseError = error48?.message || String(error48);
78626
78660
  }
78627
- const evidence = this.completionFinalAssistantEvidence(parsed?.messages);
78661
+ const evidence = this.completionFinalAssistantEvidence(parsed?.messages, args.pending.turnStartedAt);
78628
78662
  if (evidence.source === "external-native") {
78629
78663
  this.recordPendingTranscriptProbe(args.pending);
78630
78664
  }
@@ -78633,7 +78667,7 @@ ${body}
78633
78667
  const lastVisibleRole = typeof lastVisible?.role === "string" ? lastVisible.role.trim().toLowerCase() : null;
78634
78668
  const lastVisibleKind = typeof lastVisible?.kind === "string" ? lastVisible.kind : null;
78635
78669
  const lastVisibleContentLength = lastVisible ? flattenContent(lastVisible.content).trim().length : 0;
78636
- const cachedSummary = evidence.present ? "" : this.cachedCompletionSummaryContent();
78670
+ const cachedSummary = evidence.present ? "" : this.cachedInTurnCompletionSummaryContent(args.pending.turnStartedAt);
78637
78671
  const creditedFromCache = !evidence.present && cachedSummary.length > 0;
78638
78672
  const finalAssistantPresent = evidence.present || creditedFromCache;
78639
78673
  const finalAssistantEvidenceSource = evidence.present ? evidence.source : creditedFromCache ? "cached-summary" : evidence.source;
@@ -79297,7 +79331,7 @@ ${body}
79297
79331
  // real answer (lastCompletionSummary). Fall back to the cache so the notification
79298
79332
  // carries the summary that mesh_read_chat.summary already shows — consistent with
79299
79333
  // completionDiagnostic.finalAssistantPresent being credited from the same cache.
79300
- finalSummary: this.completionFinalSummary(this.adapter?.getScriptParsedStatus()?.messages, pending.turnStartedAt) || this.cachedCompletionSummaryContent() || (blockReason.startsWith("parsed_status:") ? "" : void 0),
79334
+ finalSummary: this.completionFinalSummary(this.adapter?.getScriptParsedStatus()?.messages, pending.turnStartedAt) || this.cachedInTurnCompletionSummaryContent(pending.turnStartedAt) || (blockReason.startsWith("parsed_status:") ? "" : void 0),
79301
79335
  completionDiagnostic
79302
79336
  });
79303
79337
  this.completedDebouncePending = null;